diff options
author | Craig Stout <craig.stout@ti.com> | 2012-09-24 17:27:22 -0700 |
---|---|---|
committer | Craig Stout <craig.stout@ti.com> | 2012-09-25 14:41:20 -0700 |
commit | 50819aedef353e1c37cf00b47ae591d45d4a8017 (patch) | |
tree | dd2f89a01d3194dcc0681a294bad48da84d15ce4 | |
parent | 0a2d56ece80f465f1dd9e99726e2211e42d212f6 (diff) | |
download | hardware_ti_omap4-50819aedef353e1c37cf00b47ae591d45d4a8017.zip hardware_ti_omap4-50819aedef353e1c37cf00b47ae591d45d4a8017.tar.gz hardware_ti_omap4-50819aedef353e1c37cf00b47ae591d45d4a8017.tar.bz2 |
gcbv-user: added source rectangle validation.
Also debug logging improved.
Change-Id: Ib740087d2431efbb0055c024a5e68f2b0f3b8917
Signed-off-by: Alexei Shlychkov <x0177296@ti.com>
-rw-r--r-- | gcbv/mirror/gcblit.c | 49 | ||||
-rw-r--r-- | gcbv/mirror/gcbv.c | 20 | ||||
-rw-r--r-- | gcbv/mirror/gcbv.h | 3 | ||||
-rw-r--r-- | gcbv/mirror/gcfilter.c | 107 | ||||
-rw-r--r-- | gcbv/mirror/gcparser.c | 90 |
5 files changed, 161 insertions, 108 deletions
diff --git a/gcbv/mirror/gcblit.c b/gcbv/mirror/gcblit.c index 579e90e..bd63331 100644 --- a/gcbv/mirror/gcblit.c +++ b/gcbv/mirror/gcblit.c @@ -167,7 +167,7 @@ enum bverror do_blit(struct bvbltparams *bvbltparams, int srcshiftX, srcshiftY; int srcpixalign, srcbyteshift; - int srcleft, srctop; + struct gcrect srcclipped; int srcsurfwidth, srcsurfheight; unsigned int physwidth, physheight; int orthogonal; @@ -195,34 +195,45 @@ enum bverror do_blit(struct bvbltparams *bvbltparams, * to each other. */ orthogonal = (srcinfo->angle % 2) != (dstinfo->angle % 2); - /* Compute clipped source origin. */ - srcleft = srcinfo->rect.left + batch->clipdelta.left; - srctop = srcinfo->rect.top + batch->clipdelta.top; + /* Compute clipped source rectangle. */ + srcclipped.left = srcinfo->rect.left + batch->clipdelta.left; + srcclipped.top = srcinfo->rect.top + batch->clipdelta.top; + srcclipped.right = srcinfo->rect.right + batch->clipdelta.right; + srcclipped.bottom = srcinfo->rect.bottom + batch->clipdelta.bottom; + + /* Validate the source rectangle. */ + if (!valid_rect(srcinfo->geom, &srcclipped)) { + BVSETBLTERROR((srcinfo->index == 0) + ? BVERR_SRC1RECT + : BVERR_SRC2RECT, + "invalid source rectangle."); + goto exit; + } /* Compute the source surface shift. */ switch (srcinfo->angle) { case ROT_ANGLE_0: - srcshiftX = srcleft - batch->dstadjusted.left; - srcshiftY = srctop - batch->dstadjusted.top; + srcshiftX = srcclipped.left - batch->dstadjusted.left; + srcshiftY = srcclipped.top - batch->dstadjusted.top; break; case ROT_ANGLE_90: - srcshiftX = srctop - batch->dstadjusted.top; - srcshiftY = (srcinfo->geom->width - srcleft) + srcshiftX = srcclipped.top - batch->dstadjusted.top; + srcshiftY = (srcinfo->geom->width - srcclipped.left) - (batch->dstwidth - batch->dstadjusted.left); break; case ROT_ANGLE_180: - srcshiftX = (srcinfo->geom->width - srcleft) + srcshiftX = (srcinfo->geom->width - srcclipped.left) - (batch->dstwidth - batch->dstadjusted.left); - srcshiftY = (srcinfo->geom->height - srctop) + srcshiftY = (srcinfo->geom->height - srcclipped.top) - (batch->dstheight - batch->dstadjusted.top); break; case ROT_ANGLE_270: - srcshiftX = (srcinfo->geom->height - srctop) + srcshiftX = (srcinfo->geom->height - srcclipped.top) - (batch->dstheight - batch->dstadjusted.top); - srcshiftY = srcleft - batch->dstadjusted.left; + srcshiftY = srcclipped.left - batch->dstadjusted.left; break; default: @@ -297,7 +308,7 @@ enum bverror do_blit(struct bvbltparams *bvbltparams, switch (srcinfo->angle) { case ROT_ANGLE_0: /* Adjust left coordinate. */ - srcleft -= srcpixalign; + srcclipped.left -= srcpixalign; /* Determine source size. */ srcsurfwidth = srcinfo->geom->width - srcpixalign; @@ -306,7 +317,7 @@ enum bverror do_blit(struct bvbltparams *bvbltparams, case ROT_ANGLE_90: /* Adjust top coordinate. */ - srctop -= srcpixalign; + srcclipped.top -= srcpixalign; /* Determine source size. */ srcsurfwidth = srcinfo->geom->height - srcpixalign; @@ -331,7 +342,7 @@ enum bverror do_blit(struct bvbltparams *bvbltparams, } GCDBG(GCZONE_SURF, "srcrect origin = %d,%d\n", - srcleft, srctop); + srcclipped.left, srcclipped.top); GCDBG(GCZONE_SURF, "source physical size = %dx%d\n", srcsurfwidth, srcsurfheight); @@ -350,8 +361,8 @@ enum bverror do_blit(struct bvbltparams *bvbltparams, GCDBG(GCZONE_SURF, "multi-source disabled.\n"); } else { /* Source origin is not used in multi-source setup. */ - srcleft = 0; - srctop = 0; + srcclipped.left = 0; + srcclipped.top = 0; /* Adjust the destination to match the source geometry. */ switch (srcinfo->angle) { @@ -561,8 +572,8 @@ enum bverror do_blit(struct bvbltparams *bvbltparams, gcmosrc->config.reg.format = srcinfo->format.format; gcmosrc->origin_ldst = gcmosrc_origin_ldst[index]; - gcmosrc->origin.reg.x = srcleft; - gcmosrc->origin.reg.y = srctop; + gcmosrc->origin.reg.x = srcclipped.left; + gcmosrc->origin.reg.y = srcclipped.top; gcmosrc->size_ldst = gcmosrc_size_ldst[index]; gcmosrc->size.reg = gcregsrcsize_max; diff --git a/gcbv/mirror/gcbv.c b/gcbv/mirror/gcbv.c index 9d4f27c..003da68 100644 --- a/gcbv/mirror/gcbv.c +++ b/gcbv/mirror/gcbv.c @@ -935,8 +935,6 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) bvbltparams->errdesc = NULL; /* Verify the destination parameters structure. */ - GCDBG(GCZONE_DEST, "verifying destination parameters.\n"); - res = verify_surface(0, (union bvinbuff *) &bvbltparams->dstdesc, bvbltparams->dstgeom); if (res != -1) { @@ -1092,9 +1090,7 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) /* Verify the src1 parameters structure. */ if (src1used) { - GCDBG(GCZONE_SRC, "src1used\n"); - GCDBG(GCZONE_SRC, "verifying source1 parameters.\n"); - + GCDBG(GCZONE_SRC, "source #1: used\n"); res = verify_surface( bvbltparams->flags & BVBATCH_TILE_SRC1, &bvbltparams->src1, bvbltparams->src1geom); @@ -1113,7 +1109,7 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) &bvbltparams->src1rect, bvbltparams->dstdesc, dstrect)) { - GCDBG(GCZONE_BLIT, "src1 is the same as dst\n"); + GCDBG(GCZONE_BLIT, " same as destination\n"); } else { srcinfo[srccount].index = 0; srcinfo[srccount].buf = bvbltparams->src1; @@ -1139,9 +1135,7 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) /* Verify the src2 parameters structure. */ if (src2used) { - GCDBG(GCZONE_SRC, "src2used\n"); - GCDBG(GCZONE_SRC, "verifying source2 parameters.\n"); - + GCDBG(GCZONE_SRC, "source #2: used\n"); res = verify_surface( bvbltparams->flags & BVBATCH_TILE_SRC2, &bvbltparams->src2, bvbltparams->src2geom); @@ -1160,7 +1154,7 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) &bvbltparams->src2rect, bvbltparams->dstdesc, dstrect)) { - GCDBG(GCZONE_BLIT, "src2 is the same as dst\n"); + GCDBG(GCZONE_BLIT, " same as destination\n"); } else { srcinfo[srccount].index = 1; srcinfo[srccount].buf = bvbltparams->src2; @@ -1186,9 +1180,7 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) /* Verify the mask parameters structure. */ if (maskused) { - GCDBG(GCZONE_MASK, "maskused\n"); - GCDBG(GCZONE_MASK, "verifying mask parameters.\n"); - + GCDBG(GCZONE_MASK, "mask: used\n"); res = verify_surface( bvbltparams->flags & BVBATCH_TILE_MASK, &bvbltparams->mask, bvbltparams->maskgeom); @@ -1218,7 +1210,7 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) int srcw, srch; GCDBG(GCZONE_BLIT, "processing source %d.\n", - srcinfo[i].index); + srcinfo[i].index + 1); if (gca == NULL) { GCDBG(GCZONE_BLIT, diff --git a/gcbv/mirror/gcbv.h b/gcbv/mirror/gcbv.h index e2c4e08..d07debd 100644 --- a/gcbv/mirror/gcbv.h +++ b/gcbv/mirror/gcbv.h @@ -491,6 +491,9 @@ struct gcbatch { /* Get the pointer to the context. */ struct gccontext *get_context(void); +/* Validation. */ +bool valid_rect(struct bvsurfgeom *bvsurfgeom, struct gcrect *gcrect); + /* Parsers. */ enum bverror parse_format(struct bvbltparams *bvbltparams, struct surfaceinfo *surfaceinfo); diff --git a/gcbv/mirror/gcfilter.c b/gcbv/mirror/gcfilter.c index 56c7a73..897930b 100644 --- a/gcbv/mirror/gcfilter.c +++ b/gcbv/mirror/gcfilter.c @@ -834,7 +834,11 @@ void process_rotation(struct bvbltparams *bvbltparams, gcfilter->dstadjusted.bottom = gcfilter->dstclipped.bottom - dstoffsetY; - GCPRINT_RECT(GCZONE_DEST, "dstadjusted", + GCPRINT_RECT(GCZONE_DEST, "rotated dstrect", + &gcfilter->dstrect); + GCPRINT_RECT(GCZONE_DEST, "rotated dstclipped", + &gcfilter->dstclipped); + GCPRINT_RECT(GCZONE_DEST, "rotated dstadjusted", &gcfilter->dstadjusted); if (batch->haveaux) { @@ -859,7 +863,11 @@ void process_rotation(struct bvbltparams *bvbltparams, gcfilter->dstadjustedaux.bottom = batch->dstclippedaux.bottom - dstoffsetY; - GCPRINT_RECT(GCZONE_DEST, "dstadjustedaux", + GCPRINT_RECT(GCZONE_DEST, "rotated dstrectaux", + &gcfilter->dstrectaux); + GCPRINT_RECT(GCZONE_DEST, "rotated dstclippedaux", + &gcfilter->dstclippedaux); + GCPRINT_RECT(GCZONE_DEST, "rotated dstadjustedaux", &gcfilter->dstadjustedaux); } @@ -1308,8 +1316,9 @@ enum bverror do_filter(struct bvbltparams *bvbltparams, struct bvsurfgeom dstrotated0geom; struct gcrect dstrotated0; - int dstleftoffs, dsttopoffs, dstrightoffs; - int srcleftoffs, srctopoffs, srcrightoffs; + struct gcrect dstdelta; + struct gcrect srcdelta; + struct gcrect srcclipped; struct bvbuffmap *srcmap = NULL; struct bvbuffmap *tmpmap = NULL; @@ -1356,7 +1365,7 @@ enum bverror do_filter(struct bvbltparams *bvbltparams, * for the surface base address misalignment if any. */ srcinfo->pixalign = get_pixel_offset(srcinfo, 0); srcinfo->bytealign = (srcinfo->pixalign - * (int) srcinfo->format.bitspp) / 8; + * (int) srcinfo->format.bitspp) / 8; GCDBG(GCZONE_SRC, "source surface offset (pixels) = %d,0\n", srcinfo->pixalign); GCDBG(GCZONE_SRC, "source surface offset (bytes) = %d\n", @@ -1386,9 +1395,11 @@ enum bverror do_filter(struct bvbltparams *bvbltparams, /* Rotate the source rectangle to 0 degree. */ srcrect = &srcinfo->rect; + GCPRINT_RECT(GCZONE_FILTER, "full src", srcrect); rotate_gcrect(adjangle, - srcinfo->geom, &srcinfo->rect, - srcinfo->geom, &srcinfo->rect); + srcinfo->geom, srcrect, + srcinfo->geom, srcrect); + GCPRINT_RECT(GCZONE_FILTER, "full adjusted src", srcrect); /* Get destination rect shortcuts. */ if ((srcinfo->index == 1) && batch->haveaux) { @@ -1401,8 +1412,9 @@ enum bverror do_filter(struct bvbltparams *bvbltparams, dstadjusted = &gcfilter->dstadjusted; } - /* Get source rect shortcut. */ - srcrect = &srcinfo->rect; + GCPRINT_RECT(GCZONE_FILTER, "full adjusted dst", dstrect); + GCPRINT_RECT(GCZONE_FILTER, "clipped adjusted dst", dstclipped); + GCPRINT_RECT(GCZONE_FILTER, "aligned adjusted dst", dstadjusted); /* Determine the source and destination rectangles. */ srcwidth = srcrect->right - srcrect->left; @@ -1451,31 +1463,52 @@ enum bverror do_filter(struct bvbltparams *bvbltparams, GCDBG(GCZONE_FILTER, "verscalefactor = 0x%08X\n", verscalefactor); /* Compute the destination offsets. */ - dstleftoffs = dstclipped->left - dstrect->left; - dsttopoffs = dstclipped->top - dstrect->top; - dstrightoffs = dstclipped->right - dstrect->left; + dstdelta.left = dstclipped->left - dstrect->left; + dstdelta.top = dstclipped->top - dstrect->top; + dstdelta.right = dstclipped->right - dstrect->left; + dstdelta.bottom = dstclipped->bottom - dstrect->top; /* Compute the source offsets. */ - srcleftoffs = dstleftoffs * horscalefactor; - srctopoffs = dsttopoffs * verscalefactor; - srcrightoffs = (dstrightoffs - 1) * horscalefactor + (1 << 16); + srcdelta.left = dstdelta.left * horscalefactor; + srcdelta.top = dstdelta.top * verscalefactor; + srcdelta.right = (dstdelta.right - 1) * horscalefactor + (1 << 16); + srcdelta.bottom = (dstdelta.bottom - 1) * verscalefactor + (1 << 16); GCDBG(GCZONE_FILTER, "offsets (dst, src):\n"); - GCDBG(GCZONE_FILTER, " left = %d, 0x%08X\n", - dstleftoffs, srcleftoffs); - GCDBG(GCZONE_FILTER, " top = %d, 0x%08X\n", - dsttopoffs, srctopoffs); - GCDBG(GCZONE_FILTER, " right = %d, 0x%08X\n", - dstrightoffs, srcrightoffs); + GCDBG(GCZONE_FILTER, " left = %d, 0x%08X\n", + dstdelta.left, srcdelta.left); + GCDBG(GCZONE_FILTER, " top = %d, 0x%08X\n", + dstdelta.top, srcdelta.top); + GCDBG(GCZONE_FILTER, " right = %d, 0x%08X\n", + dstdelta.right, srcdelta.right); + GCDBG(GCZONE_FILTER, " bottom = %d, 0x%08X\n", + dstdelta.bottom, srcdelta.bottom); /* Before rendering each destination pixel, the HW will select the * corresponding source center pixel to apply the kernel around. * To make this process precise we need to add 0.5 to source initial * coordinates here; this will make HW pick the next source pixel if * the fraction is equal or greater then 0.5. */ - srcleftoffs += 0x00008000; - srctopoffs += 0x00008000; - srcrightoffs += 0x00008000; + srcdelta.left += 0x00008000; + srcdelta.top += 0x00008000; + srcdelta.right += 0x00008000; + srcdelta.bottom += 0x00008000; + + /* Determine clipped source rectangle. */ + srcclipped.left = srcrect->left + (srcdelta.left >> 16); + srcclipped.top = srcrect->top + (srcdelta.top >> 16); + srcclipped.right = srcrect->left + (srcdelta.right >> 16); + srcclipped.bottom = srcrect->top + (srcdelta.bottom >> 16); + GCPRINT_RECT(GCZONE_FILTER, " clipped source", &srcclipped); + + /* Validate the source rectangle. */ + if (!valid_rect(srcinfo->geom, &srcclipped)) { + BVSETBLTERROR((srcinfo->index == 0) + ? BVERR_SRC1RECT + : BVERR_SRC2RECT, + "invalid source rectangle."); + goto exit; + } GCDBG(GCZONE_FILTER, "source:\n"); GCDBG(GCZONE_FILTER, " stride = %d, geom = %dx%d\n", @@ -1484,8 +1517,8 @@ enum bverror do_filter(struct bvbltparams *bvbltparams, GCDBG(GCZONE_FILTER, " rotation = %d\n", srcinfo->angle); GCDBG(GCZONE_FILTER, " rect offsets = " - "(0x%08X,0x%08X)-(0x%08X,---)\n", - srcleftoffs, srctopoffs, srcrightoffs); + "(0x%08X,0x%08X)-(0x%08X,0x%08X)\n", + srcdelta.left, srcdelta.top, srcdelta.right, srcdelta.bottom); GCDBG(GCZONE_FILTER, "destination:\n"); GCDBG(GCZONE_FILTER, " stride = %d, geom size = %dx%d\n", @@ -1529,8 +1562,8 @@ enum bverror do_filter(struct bvbltparams *bvbltparams, = GCREG_VR_CONFIG_EX_MASK_FILTER_TAP_ENABLED; /* Setup single pass. */ - srcx = (srcrect->left << 16) + srcleftoffs; - srcy = (srcrect->top << 16) + srctopoffs; + srcx = (srcrect->left << 16) + srcdelta.left; + srcy = (srcrect->top << 16) + srcdelta.top; GCDBG(GCZONE_SRC, "src origin: 0x%08X,0x%08X\n", srcx, srcy); /* Load the horizontal filter. */ @@ -1613,8 +1646,8 @@ enum bverror do_filter(struct bvbltparams *bvbltparams, * kernel information on the edges of the image. */ horkernelhalf = gcfilter->horkernelsize >> 1; - leftextra = srcleftoffs >> 16; - rightextra = srcwidth - (srcrightoffs >> 16); + leftextra = srcdelta.left >> 16; + rightextra = srcwidth - (srcdelta.right >> 16); if (leftextra > horkernelhalf) leftextra = horkernelhalf; @@ -1626,13 +1659,13 @@ enum bverror do_filter(struct bvbltparams *bvbltparams, leftextra, rightextra); /* Determine the source origin. */ - srcx = ((srcrect->left - leftextra) << 16) + srcleftoffs; - srcy = (srcrect->top << 16) + srctopoffs; + srcx = ((srcrect->left - leftextra) << 16) + srcdelta.left; + srcy = (srcrect->top << 16) + srcdelta.top; GCDBG(GCZONE_SRC, "src origin: 0x%08X,0x%08X\n", srcx, srcy); /* Determine the size of the temporary image. */ tmprectwidth = leftextra + rightextra - + ((srcrightoffs >> 16) - (srcleftoffs >> 16)); + + ((srcdelta.right >> 16) - (srcdelta.left >> 16)); tmprectheight = dstadjusted->bottom - dstadjusted->top; GCDBG(GCZONE_FILTER, "tmp rect size: %dx%d\n", tmprectwidth, tmprectheight); @@ -1742,9 +1775,9 @@ enum bverror do_filter(struct bvbltparams *bvbltparams, /* Determine the source origin. */ srcx = ((leftextra + tmpinfo.rect.left) << 16) - + (srcleftoffs & 0xFFFF); + + (srcdelta.left & 0xFFFF); srcy = (tmpinfo.rect.top << 16) - + (srctopoffs & 0xFFFF); + + (srcdelta.top & 0xFFFF); GCDBG(GCZONE_SRC, "src origin: 0x%08X,0x%08X\n", srcx, srcy); @@ -1774,8 +1807,8 @@ enum bverror do_filter(struct bvbltparams *bvbltparams, scalex ? "horizontal" : "vertical"); /* Setup single pass. */ - srcx = (srcrect->left << 16) + srcleftoffs; - srcy = (srcrect->top << 16) + srctopoffs; + srcx = (srcrect->left << 16) + srcdelta.left; + srcy = (srcrect->top << 16) + srcdelta.top; GCDBG(GCZONE_SRC, "src origin: 0x%08X,0x%08X\n", srcx, srcy); if (scalex) { diff --git a/gcbv/mirror/gcparser.c b/gcbv/mirror/gcparser.c index 30867c7..7de33e7 100644 --- a/gcbv/mirror/gcparser.c +++ b/gcbv/mirror/gcparser.c @@ -35,14 +35,16 @@ #define GCZONE_NONE 0 #define GCZONE_ALL (~0U) #define GCZONE_FORMAT (1 << 0) -#define GCZONE_BLEND (1 << 1) -#define GCZONE_OFFSET (1 << 2) -#define GCZONE_DEST (1 << 3) -#define GCZONE_SRC (1 << 4) -#define GCZONE_SCALING (1 << 5) +#define GCZONE_FORMAT_VERBOSE (1 << 1) +#define GCZONE_BLEND (1 << 2) +#define GCZONE_OFFSET (1 << 3) +#define GCZONE_DEST (1 << 4) +#define GCZONE_SRC (1 << 5) +#define GCZONE_SCALING (1 << 6) GCDBG_FILTERDEF(gcparser, GCZONE_NONE, "format", + "formatverbose", "blend", "offset", "dest", @@ -195,13 +197,13 @@ enum bverror parse_format(struct bvbltparams *bvbltparams, bits = ((ocdformat & OCDFMTDEF_COMPONENTSIZEMINUS1_MASK) >> OCDFMTDEF_COMPONENTSIZEMINUS1_SHIFT) + 1; - GCDBG(GCZONE_FORMAT, "std = %d\n", std); - GCDBG(GCZONE_FORMAT, "cs = %d\n", cs); - GCDBG(GCZONE_FORMAT, "alpha = %d\n", alpha ? 1 : 0); - GCDBG(GCZONE_FORMAT, "subsample = %d\n", subsample); - GCDBG(GCZONE_FORMAT, "layout = %d\n", layout); - GCDBG(GCZONE_FORMAT, "cont = %d\n", cont); - GCDBG(GCZONE_FORMAT, "bits = %d\n", bits); + GCDBG(GCZONE_FORMAT_VERBOSE, "std = %d\n", std); + GCDBG(GCZONE_FORMAT_VERBOSE, "cs = %d\n", cs); + GCDBG(GCZONE_FORMAT_VERBOSE, "alpha = %d\n", alpha ? 1 : 0); + GCDBG(GCZONE_FORMAT_VERBOSE, "subsample = %d\n", subsample); + GCDBG(GCZONE_FORMAT_VERBOSE, "layout = %d\n", layout); + GCDBG(GCZONE_FORMAT_VERBOSE, "cont = %d\n", cont); + GCDBG(GCZONE_FORMAT_VERBOSE, "bits = %d\n", bits); switch (cs) { case (OCDFMTDEF_CS_RGB >> OCDFMTDEF_CS_SHIFT): @@ -335,16 +337,20 @@ enum bverror parse_format(struct bvbltparams *bvbltparams, /* Determine the swizzle. */ reversed = ocdformat & OCDFMTDEF_REVERSED; leftjust = ocdformat & OCDFMTDEF_LEFT_JUSTIFIED; - GCDBG(GCZONE_FORMAT, "reversed = %d\n", reversed ? 1 : 0); - GCDBG(GCZONE_FORMAT, "leftjust = %d\n", leftjust ? 1 : 0); + GCDBG(GCZONE_FORMAT_VERBOSE, "reversed = %d\n", + reversed ? 1 : 0); + GCDBG(GCZONE_FORMAT_VERBOSE, "leftjust = %d\n", + leftjust ? 1 : 0); /* Parse the standard. */ switch (std) { case OCDFMTDEF_STD_ITUR_601_YCbCr >> OCDFMTDEF_STD_SHIFT: + GCDBG(GCZONE_FORMAT, "OCDFMTDEF_STD_ITUR_601_YCbCr\n"); format->cs.yuv.std = GCREG_PE_CONTROL_YUV_601; break; case OCDFMTDEF_STD_ITUR_709_YCbCr >> OCDFMTDEF_STD_SHIFT: + GCDBG(GCZONE_FORMAT, "OCDFMTDEF_STD_ITUR_709_YCbCr\n"); format->cs.yuv.std = GCREG_PE_CONTROL_YUV_709; break; @@ -1234,8 +1240,7 @@ static inline int get_angle(int orientation) * Surface compare and validation. */ -static inline bool valid_rect(struct bvsurfgeom *bvsurfgeom, - struct gcrect *gcrect) +bool valid_rect(struct bvsurfgeom *bvsurfgeom, struct gcrect *gcrect) { return ((gcrect->left >= 0) && (gcrect->top >= 0) && @@ -1351,6 +1356,8 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, GCENTER(GCZONE_DEST); + GCDBG(GCZONE_DEST, "parsing destination\n"); + /* Did the destination surface change? */ if ((batch->batchflags & BVBATCH_DST) != 0) { struct surfaceinfo *dstinfo; @@ -1367,7 +1374,6 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, dstinfo->gca = NULL; /* Parse the destination format. */ - GCDBG(GCZONE_FORMAT, "parsing destination format.\n"); if (parse_format(bvbltparams, dstinfo) != BVERR_NONE) { bverror = BVERR_DSTGEOM_FORMAT; goto exit; @@ -1405,7 +1411,8 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, dstinfo->bytealign = (dstinfo->pixalign * (int) dstinfo->format.bitspp) / 8; - GCDBG(GCZONE_DEST, "destination surface:\n"); + GCDBG(GCZONE_DEST, " buffer length = %d\n", + dstinfo->buf.desc->length); GCDBG(GCZONE_DEST, " rotation %d degrees.\n", dstinfo->angle * 90); @@ -1452,20 +1459,20 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, /* Determine destination rectangle. */ dstrect = &dstinfo->rect; GCCONVERT_RECT(GCZONE_DEST, - "destination", + " rect", &bvbltparams->dstrect, dstrect); /* Determine whether aux destination is specified. */ batch->haveaux = ((bvbltparams->flags & BVFLAG_SRC2_AUXDSTRECT) != 0); - GCDBG(GCZONE_DEST, "aux dest = %d\n", batch->haveaux); + GCDBG(GCZONE_DEST, " have aux dest = %d\n", batch->haveaux); /* Is clipping rectangle specified? */ if ((bvbltparams->flags & BVFLAG_CLIP) == BVFLAG_CLIP) { /* Convert the clipping rectangle. */ GCCONVERT_RECT(GCZONE_DEST, - "clipping", + " clipping", &bvbltparams->cliprect, &cliprect); @@ -1521,7 +1528,7 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, /* Convert the aux rectangle. */ dstrectaux = &batch->dstrectaux; GCCONVERT_RECT(GCZONE_DEST, - "aux destination", + " aux rect", &bvbltparams->src2auxdstrect, dstrectaux); @@ -1563,29 +1570,27 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, if (batch->haveaux) /* Convert the aux rectangle. */ GCCONVERT_RECT(GCZONE_DEST, - "aux destination", + " aux rect", &bvbltparams->src2auxdstrect, &batch->dstclippedaux); } - GCPRINT_RECT(GCZONE_DEST, "clipped dest", + GCPRINT_RECT(GCZONE_DEST, " clipped rect", &batch->dstclipped); /* Validate the destination rectangle. */ - if (!valid_rect(bvbltparams->dstgeom, - &batch->dstclipped)) { + if (!valid_rect(dstinfo->geom, &batch->dstclipped)) { BVSETBLTERROR(BVERR_DSTRECT, "invalid destination rectangle."); goto exit; } if (batch->haveaux) { - GCPRINT_RECT(GCZONE_DEST, "clipped aux dest", + GCPRINT_RECT(GCZONE_DEST, " clipped aux rect", &batch->dstclippedaux); /* Validate the aux destination rectangle. */ - if (!valid_rect(bvbltparams->dstgeom, - &batch->dstclippedaux)) { + if (!valid_rect(dstinfo->geom, &batch->dstclippedaux)) { BVSETBLTERROR(BVERR_DSTRECT, "invalid aux destination " "rectangle."); @@ -1594,7 +1599,7 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, } GCDBG(GCZONE_DEST, - "clipping delta = (%d,%d)-(%d,%d)\n", + " clipping delta = (%d,%d)-(%d,%d)\n", batch->clipdelta.left, batch->clipdelta.top, batch->clipdelta.right, @@ -1725,13 +1730,10 @@ enum bverror parse_source(struct bvbltparams *bvbltparams, { enum bverror bverror = BVERR_NONE; - /* Convert the rectangle. */ - GCCONVERT_RECT(GCZONE_SRC, - "source", srcrect, &srcinfo->rect); + GCDBG(GCZONE_SRC, "parsing source #%d\n", + srcinfo->index + 1); /* Parse the source format. */ - GCDBG(GCZONE_FORMAT, "parsing source%d format.\n", - srcinfo->index + 1); if (parse_format(bvbltparams, srcinfo) != BVERR_NONE) { bverror = (srcinfo->index == 0) ? BVERR_SRC1GEOM_FORMAT @@ -1793,16 +1795,16 @@ enum bverror parse_source(struct bvbltparams *bvbltparams, : (bvbltparams->flags >> BVFLAG_FLIP_SRC2_SHIFT) & BVFLAG_FLIP_MASK; - GCDBG(GCZONE_SRC, "source surface %d:\n", srcinfo->index + 1); + GCDBG(GCZONE_SRC, " buffer length = %d\n", srcinfo->buf.desc->length); GCDBG(GCZONE_SRC, " rotation %d degrees.\n", srcinfo->angle * 90); if (srcinfo->buf.desc->auxtype == BVAT_PHYSDESC) { struct bvphysdesc *bvphysdesc; bvphysdesc = (struct bvphysdesc *) srcinfo->buf.desc->auxptr; - GCDBG(GCZONE_DEST, " page offset = 0x%08X\n", + GCDBG(GCZONE_SRC, " page offset = 0x%08X\n", bvphysdesc->pageoffset); } else { - GCDBG(GCZONE_DEST, " virtual address = 0x%08X\n", + GCDBG(GCZONE_SRC, " virtual address = 0x%08X\n", (unsigned int) srcinfo->buf.desc->virtaddr); } @@ -1812,6 +1814,10 @@ enum bverror parse_source(struct bvbltparams *bvbltparams, srcinfo->geom->width, srcinfo->geom->height); GCDBG(GCZONE_SRC, " mirror = %d\n", srcinfo->mirror); + /* Convert the rectangle. */ + GCCONVERT_RECT(GCZONE_SRC, + " rect", srcrect, &srcinfo->rect); + /* Validate source geometry. */ if (!valid_geom(srcinfo)) { BVSETBLTERROR((srcinfo->index == 0) @@ -1905,6 +1911,10 @@ static enum bverror parse_implicitscale(struct bvbltparams *bvbltparams, goto exit; } + GCDBG(GCZONE_SCALING, "kernel size = %dx%d\n", + batch->op.filter.horkernelsize, + batch->op.filter.verkernelsize); + exit: GCEXIT(GCZONE_SCALING); return bverror; @@ -1985,6 +1995,10 @@ static enum bverror parse_explicitscale(struct bvbltparams *bvbltparams, goto exit; } + GCDBG(GCZONE_SCALING, "kernel size = %dx%d\n", + batch->op.filter.horkernelsize, + batch->op.filter.verkernelsize); + exit: GCEXIT(GCZONE_SCALING); return bverror; |