aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorAlexei Shlychkov <x0177296@ti.com>2012-09-24 12:19:21 -0700
committerZiyann <jaraidaniel@gmail.com>2014-10-01 13:01:02 +0200
commitb476c538b2066128a54a1e95e4d65def806fbf84 (patch)
treec3d1ce3ee1f3241f4ac4dc2189b0e0722d1046e1 /drivers/misc
parent297a56ffca25c8194bfcd0b2e8a16a18c8166c91 (diff)
downloadkernel_samsung_tuna-b476c538b2066128a54a1e95e4d65def806fbf84.zip
kernel_samsung_tuna-b476c538b2066128a54a1e95e4d65def806fbf84.tar.gz
kernel_samsung_tuna-b476c538b2066128a54a1e95e4d65def806fbf84.tar.bz2
gcx: added source rectangle validation.
Also debug logging improved. Change-Id: I0fd42fc417080d163f55f1c58e12dd5713f3d8be Signed-off-by: Alexei Shlychkov <x0177296@ti.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/gcx/gcbv/gcblit.c49
-rw-r--r--drivers/misc/gcx/gcbv/gcbv.c20
-rw-r--r--drivers/misc/gcx/gcbv/gcbv.h3
-rw-r--r--drivers/misc/gcx/gcbv/gcfilter.c107
-rw-r--r--drivers/misc/gcx/gcbv/gcparser.c90
5 files changed, 161 insertions, 108 deletions
diff --git a/drivers/misc/gcx/gcbv/gcblit.c b/drivers/misc/gcx/gcbv/gcblit.c
index 5f41784..37ad9a4 100644
--- a/drivers/misc/gcx/gcbv/gcblit.c
+++ b/drivers/misc/gcx/gcbv/gcblit.c
@@ -189,7 +189,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;
@@ -217,34 +217,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:
@@ -319,7 +330,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;
@@ -328,7 +339,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;
@@ -353,7 +364,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);
@@ -372,8 +383,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) {
@@ -583,8 +594,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/drivers/misc/gcx/gcbv/gcbv.c b/drivers/misc/gcx/gcbv/gcbv.c
index 2aa6ffa..c985e46 100644
--- a/drivers/misc/gcx/gcbv/gcbv.c
+++ b/drivers/misc/gcx/gcbv/gcbv.c
@@ -957,8 +957,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) {
@@ -1114,9 +1112,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);
@@ -1135,7 +1131,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;
@@ -1161,9 +1157,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);
@@ -1182,7 +1176,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;
@@ -1208,9 +1202,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);
@@ -1240,7 +1232,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/drivers/misc/gcx/gcbv/gcbv.h b/drivers/misc/gcx/gcbv/gcbv.h
index fa4b0a2..decd739 100644
--- a/drivers/misc/gcx/gcbv/gcbv.h
+++ b/drivers/misc/gcx/gcbv/gcbv.h
@@ -513,6 +513,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/drivers/misc/gcx/gcbv/gcfilter.c b/drivers/misc/gcx/gcbv/gcfilter.c
index 7ffee49..edd0a17 100644
--- a/drivers/misc/gcx/gcbv/gcfilter.c
+++ b/drivers/misc/gcx/gcbv/gcfilter.c
@@ -856,7 +856,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) {
@@ -881,7 +885,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);
}
@@ -1330,8 +1338,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;
@@ -1378,7 +1387,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",
@@ -1408,9 +1417,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) {
@@ -1423,8 +1434,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;
@@ -1473,31 +1485,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",
@@ -1506,8 +1539,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",
@@ -1551,8 +1584,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. */
@@ -1635,8 +1668,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;
@@ -1648,13 +1681,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);
@@ -1764,9 +1797,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);
@@ -1796,8 +1829,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/drivers/misc/gcx/gcbv/gcparser.c b/drivers/misc/gcx/gcbv/gcparser.c
index 0f1a758..747a524 100644
--- a/drivers/misc/gcx/gcbv/gcparser.c
+++ b/drivers/misc/gcx/gcbv/gcparser.c
@@ -57,14 +57,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",
@@ -217,13 +219,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):
@@ -357,16 +359,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;
@@ -1256,8 +1262,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) &&
@@ -1373,6 +1378,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;
@@ -1389,7 +1396,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;
@@ -1427,7 +1433,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);
@@ -1474,20 +1481,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);
@@ -1543,7 +1550,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);
@@ -1585,29 +1592,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.");
@@ -1616,7 +1621,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,
@@ -1747,13 +1752,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
@@ -1815,16 +1817,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);
}
@@ -1834,6 +1836,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)
@@ -1927,6 +1933,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;
@@ -2007,6 +2017,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;