diff options
author | Alexei Shlychkov <x0177296@ti.com> | 2012-07-27 16:58:02 -0700 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 13:00:55 +0200 |
commit | f1b4708d870f80530baee48f2809da3d5e7a5d7b (patch) | |
tree | 0f7220e5d9381f0f3018b6c899ab368f3f89ef44 | |
parent | 88fdeb6d1620e09b5b65e4385045ca23bbf36379 (diff) | |
download | kernel_samsung_tuna-f1b4708d870f80530baee48f2809da3d5e7a5d7b.zip kernel_samsung_tuna-f1b4708d870f80530baee48f2809da3d5e7a5d7b.tar.gz kernel_samsung_tuna-f1b4708d870f80530baee48f2809da3d5e7a5d7b.tar.bz2 |
gcx: added scaling support.
Includes support for nv12 source.
Change-Id: I6af32e3d38bfbcc804c0f64ae1b863f8327a5af1
Signed-off-by: Alexei Shlychkov <x0177296@ti.com>
-rw-r--r-- | drivers/misc/gcx/gcbv/gcblit.c | 472 | ||||
-rw-r--r-- | drivers/misc/gcx/gcbv/gcbv.c | 390 | ||||
-rw-r--r-- | drivers/misc/gcx/gcbv/gcbv.h | 243 | ||||
-rw-r--r-- | drivers/misc/gcx/gcbv/gcfill.c | 50 | ||||
-rw-r--r-- | drivers/misc/gcx/gcbv/gcfilter.c | 1277 | ||||
-rw-r--r-- | drivers/misc/gcx/gcbv/gcmain.c | 104 | ||||
-rw-r--r-- | drivers/misc/gcx/gcbv/gcmain.h | 31 | ||||
-rw-r--r-- | drivers/misc/gcx/gcbv/gcmap.c | 34 | ||||
-rw-r--r-- | drivers/misc/gcx/gcbv/gcparser.c | 716 | ||||
-rw-r--r-- | drivers/misc/gcx/gccore/gcdbglog.c | 38 | ||||
-rw-r--r-- | drivers/misc/gcx/gccore/gcdebug.c | 2 | ||||
-rw-r--r-- | drivers/misc/gcx/gccore/gcmain.c | 230 | ||||
-rw-r--r-- | drivers/misc/gcx/gccore/gcmain.h | 11 | ||||
-rw-r--r-- | drivers/misc/gcx/gccore/gcmmu.c | 55 | ||||
-rw-r--r-- | drivers/misc/gcx/gcioctl/gcif.c | 177 | ||||
-rw-r--r-- | include/linux/gccore.h | 14 | ||||
-rw-r--r-- | include/linux/gcdbglog.h | 14 | ||||
-rw-r--r-- | include/linux/gcioctl.h | 99 | ||||
-rw-r--r-- | include/linux/gcreg.h | 3191 | ||||
-rw-r--r-- | include/linux/gcx.h | 14 |
20 files changed, 5244 insertions, 1918 deletions
diff --git a/drivers/misc/gcx/gcbv/gcblit.c b/drivers/misc/gcx/gcbv/gcblit.c index 8fa2a00..6928a90 100644 --- a/drivers/misc/gcx/gcbv/gcblit.c +++ b/drivers/misc/gcx/gcbv/gcblit.c @@ -66,24 +66,32 @@ GCDBG_FILTERDEF(gcblit, GCZONE_NONE, "blit") -static enum bverror do_blit_end(struct bvbltparams *bltparams, +static enum bverror do_blit_end(struct bvbltparams *bvbltparams, struct gcbatch *batch) { enum bverror bverror; + struct gcblit *gcblit; + struct surfaceinfo *dstinfo; struct gcmobltconfig *gcmobltconfig; - struct gcmostart *gcmostart; + struct gcmostartde *gcmostartde; GCENTER(GCZONE_BLIT); + /* Get a shortcut to the operation specific data. */ + gcblit = &batch->op.blit; + GCDBG(GCZONE_BLIT, "finalizing the blit, scrcount = %d\n", - batch->gcblit.srccount); + gcblit->srccount); + + /* Get a shortcut to the destination surface. */ + dstinfo = &batch->dstinfo; /*********************************************************************** * Configure the operation. */ /* Allocate command buffer. */ - bverror = claim_buffer(bltparams, batch, + bverror = claim_buffer(bvbltparams, batch, sizeof(struct gcmobltconfig), (void **) &gcmobltconfig); if (bverror != BVERR_NONE) @@ -92,7 +100,7 @@ static enum bverror do_blit_end(struct bvbltparams *bltparams, /* Configure multi-source control. */ gcmobltconfig->multisource_ldst = gcmobltconfig_multisource_ldst; gcmobltconfig->multisource.raw = 0; - gcmobltconfig->multisource.reg.srccount = batch->gcblit.srccount - 1; + gcmobltconfig->multisource.reg.srccount = gcblit->srccount - 1; GCDBG(GCZONE_BLIT, "blockenable = %d\n", batch->blockenable); if (batch->blockenable) { @@ -109,17 +117,17 @@ static enum bverror do_blit_end(struct bvbltparams *bltparams, /* Set destination configuration. */ GCDBG(GCZONE_BLIT, "format entry = 0x%08X\n", - (unsigned int) batch->dstformat); + (unsigned int) dstinfo->format); GCDBG(GCZONE_BLIT, " swizzle code = %d\n", - batch->dstformat->swizzle); + dstinfo->format->swizzle); GCDBG(GCZONE_BLIT, " format code = %d\n", - batch->dstformat->format); + dstinfo->format->format); gcmobltconfig->dstconfig_ldst = gcmobltconfig_dstconfig_ldst; gcmobltconfig->dstconfig.raw = 0; - gcmobltconfig->dstconfig.reg.swizzle = batch->dstformat->swizzle; - gcmobltconfig->dstconfig.reg.format = batch->dstformat->format; - gcmobltconfig->dstconfig.reg.command = batch->gcblit.multisrc + gcmobltconfig->dstconfig.reg.swizzle = dstinfo->format->swizzle; + gcmobltconfig->dstconfig.reg.format = dstinfo->format->format; + gcmobltconfig->dstconfig.reg.command = gcblit->multisrc ? GCREG_DEST_CONFIG_COMMAND_MULTI_SOURCE_BLT : GCREG_DEST_CONFIG_COMMAND_BIT_BLT; @@ -127,38 +135,38 @@ static enum bverror do_blit_end(struct bvbltparams *bltparams, gcmobltconfig->rop_ldst = gcmobltconfig_rop_ldst; gcmobltconfig->rop.raw = 0; gcmobltconfig->rop.reg.type = GCREG_ROP_TYPE_ROP3; - gcmobltconfig->rop.reg.fg = (unsigned char) batch->gcblit.rop; + gcmobltconfig->rop.reg.fg = (unsigned char) gcblit->rop; /*********************************************************************** * Start the operation. */ /* Allocate command buffer. */ - bverror = claim_buffer(bltparams, batch, - sizeof(struct gcmostart), - (void **) &gcmostart); + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmostartde), + (void **) &gcmostartde); if (bverror != BVERR_NONE) goto exit; /* Set START_DE command. */ - gcmostart->startde.cmd.fld = gcfldstartde; + gcmostartde->startde.cmd.fld = gcfldstartde; /* Set destination rectangle. */ - gcmostart->rect.left = batch->left; - gcmostart->rect.top = batch->top; - gcmostart->rect.right = batch->right; - gcmostart->rect.bottom = batch->bottom; + gcmostartde->rect.left = gcblit->dstrect.left; + gcmostartde->rect.top = gcblit->dstrect.top; + gcmostartde->rect.right = gcblit->dstrect.right; + gcmostartde->rect.bottom = gcblit->dstrect.bottom; GCDBG(GCZONE_BLIT, "dstrect = (%d,%d)-(%d,%d)\n", - gcmostart->rect.left, gcmostart->rect.top, - gcmostart->rect.right, gcmostart->rect.bottom); + gcmostartde->rect.left, gcmostartde->rect.top, + gcmostartde->rect.right, gcmostartde->rect.bottom); /* Reset the finalizer. */ batch->batchend = do_end; - gc_debug_blt(batch->gcblit.srccount, - abs(batch->right - batch->left), - abs(batch->bottom - batch->top)); + gc_debug_blt(gcblit->srccount, + abs(gcblit->dstrect.right - gcblit->dstrect.left), + abs(gcblit->dstrect.bottom - gcblit->dstrect.top)); exit: GCEXITARG(GCZONE_BLIT, "bv%s = %d\n", @@ -166,36 +174,29 @@ exit: return bverror; } -enum bverror do_blit(struct bvbltparams *bltparams, +enum bverror do_blit(struct bvbltparams *bvbltparams, struct gcbatch *batch, - struct srcinfo *srcinfo) + struct surfaceinfo *srcinfo) { enum bverror bverror = BVERR_NONE; struct gccontext *gccontext = get_context(); struct gcmosrc *gcmosrc; - struct gcmosrcalpha *gcmosrcalpha; + struct gcmoxsrcalpha *gcmoxsrcalpha; unsigned int index; + struct bvbuffmap *dstmap = NULL; + struct bvbuffmap *srcmap = NULL; - struct bvbuffmap *dstmap; - struct bvbuffdesc *dstdesc; - struct bvsurfgeom *dstgeom; - struct bvformatxlate *dstformat; + struct surfaceinfo *dstinfo; int dstshiftX, dstshiftY; int dstalign, dstbyteshift; - struct bvbuffmap *srcmap; - struct gcalpha *srcgca; - struct bvrect *srcrect; - struct bvbuffdesc *srcdesc; - struct bvsurfgeom *srcgeom; - struct bvformatxlate *srcformat; int srcshiftX, srcshiftY; int srcalign, srcbyteshift; int srcleft, srctop; - int dstleft, dsttop, dstright, dstbottom; + struct gcrect dstadjusted; int srcsurfwidth, srcsurfheight; unsigned int physwidth, physheight; int orthogonal; @@ -203,19 +204,8 @@ enum bverror do_blit(struct bvbltparams *bltparams, GCENTER(GCZONE_BLIT); - /* Create source object shortcuts. */ - srcmap = NULL; - srcgca = srcinfo->gca; - srcrect = srcinfo->rect; - srcdesc = srcinfo->buf.desc; - srcgeom = srcinfo->geom; - srcformat = srcinfo->format; - - /* Create destination object shortcuts. */ - dstmap = NULL; - dstdesc = bltparams->dstdesc; - dstgeom = bltparams->dstgeom; - dstformat = batch->dstformat; + /* Get a shortcut to the destination surface. */ + dstinfo = &batch->dstinfo; /*********************************************************************** * Determine source surface alignment offset. @@ -223,46 +213,48 @@ enum bverror do_blit(struct bvbltparams *bltparams, /* Determine whether the source and the destination are orthogonal * to each other. */ - orthogonal = (srcinfo->angle % 2) != (batch->dstangle % 2); + orthogonal = (srcinfo->angle % 2) != (dstinfo->angle % 2); /* Compute adjusted destination rectangle. */ - dstleft = batch->clippedleft + batch->dstoffsetX; - dsttop = batch->clippedtop + batch->dstoffsetY; - dstright = batch->clippedright + batch->dstoffsetX; - dstbottom = batch->clippedbottom + batch->dstoffsetY; + dstadjusted.left = batch->dstclipped.left + batch->dstoffsetX; + dstadjusted.top = batch->dstclipped.top + batch->dstoffsetY; + dstadjusted.right = batch->dstclipped.right + batch->dstoffsetX; + dstadjusted.bottom = batch->dstclipped.bottom + batch->dstoffsetY; /* Compute clipped source origin. */ - srcleft = srcrect->left + batch->deltaleft; - srctop = srcrect->top + batch->deltatop; + srcleft = srcinfo->rect.left + batch->clipdelta.left; + srctop = srcinfo->rect.top + batch->clipdelta.top; GCDBG(GCZONE_SURF, "adjusted dstrect = (%d,%d)-(%d,%d), %dx%d\n", - dstleft, dsttop, dstright, dstbottom, - dstright - dstleft, dstbottom - dsttop); + dstadjusted.left, dstadjusted.top, + dstadjusted.right, dstadjusted.bottom, + dstadjusted.right - dstadjusted.left, + dstadjusted.bottom - dstadjusted.top); /* Compute the source surface shift. */ switch (srcinfo->angle) { case ROT_ANGLE_0: - srcshiftX = srcleft - dstleft; - srcshiftY = srctop - dsttop; + srcshiftX = srcleft - dstadjusted.left; + srcshiftY = srctop - dstadjusted.top; break; case ROT_ANGLE_90: - srcshiftX = srctop - dsttop; - srcshiftY = (srcgeom->width - srcleft) - - (batch->dstwidth - dstleft); + srcshiftX = srctop - dstadjusted.top; + srcshiftY = (srcinfo->geom->width - srcleft) + - (batch->dstwidth - dstadjusted.left); break; case ROT_ANGLE_180: - srcshiftX = (srcgeom->width - srcleft) - - (batch->dstwidth - dstleft); - srcshiftY = (srcgeom->height - srctop) - - (batch->dstheight - dsttop); + srcshiftX = (srcinfo->geom->width - srcleft) + - (batch->dstwidth - dstadjusted.left); + srcshiftY = (srcinfo->geom->height - srctop) + - (batch->dstheight - dstadjusted.top); break; case ROT_ANGLE_270: - srcshiftX = (srcgeom->height - srctop) - - (batch->dstheight - dsttop); - srcshiftY = srcleft - dstleft; + srcshiftX = (srcinfo->geom->height - srctop) + - (batch->dstheight - dstadjusted.top); + srcshiftY = srcleft - dstadjusted.left; break; default: @@ -271,12 +263,12 @@ enum bverror do_blit(struct bvbltparams *bltparams, } /* Compute the source surface offset in bytes. */ - srcbyteshift = srcshiftY * (int) srcgeom->virtstride - + srcshiftX * (int) srcformat->bitspp / 8; + srcbyteshift = srcshiftY * (int) srcinfo->geom->virtstride + + srcshiftX * (int) srcinfo->format->bitspp / 8; /* Compute the source offset in pixels needed to compensate * for the surface base address misalignment if any. */ - srcalign = get_pixel_offset(srcdesc, srcformat, srcbyteshift); + srcalign = get_pixel_offset(srcinfo, srcbyteshift); GCDBG(GCZONE_SURF, "source surface %d:\n", srcinfo->index + 1); GCDBG(GCZONE_SURF, " surface offset (pixels) = %d,%d\n", @@ -287,7 +279,7 @@ enum bverror do_blit(struct bvbltparams *bltparams, srcalign); /* Apply the source alignment. */ - srcbyteshift += srcalign * (int) srcformat->bitspp / 8; + srcbyteshift += srcalign * (int) srcinfo->format->bitspp / 8; srcshiftX += srcalign; GCDBG(GCZONE_SURF, " adjusted surface offset (pixels) = %d,%d\n", @@ -296,17 +288,17 @@ enum bverror do_blit(struct bvbltparams *bltparams, srcbyteshift); /* Determine the destination surface shift. */ - dstshiftX = batch->dstalign; - dstshiftY = (((srcinfo->angle + 3) % 4) == batch->dstangle) + dstshiftX = dstinfo->pixalign; + dstshiftY = (((srcinfo->angle + 3) % 4) == dstinfo->angle) ? srcalign : 0; /* Compute the destination surface offset in bytes. */ - dstbyteshift = dstshiftY * (int) dstgeom->virtstride - + dstshiftX * (int) dstformat->bitspp / 8; + dstbyteshift = dstshiftY * (int) dstinfo->geom->virtstride + + dstshiftX * (int) dstinfo->format->bitspp / 8; /* Compute the destination offset in pixels needed to compensate * for the surface base address misalignment if any. */ - dstalign = get_pixel_offset(dstdesc, dstformat, dstbyteshift); + dstalign = get_pixel_offset(dstinfo, dstbyteshift); GCDBG(GCZONE_SURF, "destination surface:\n"); GCDBG(GCZONE_SURF, " surface offset (pixels) = %d,%d\n", @@ -316,16 +308,15 @@ enum bverror do_blit(struct bvbltparams *bltparams, GCDBG(GCZONE_SURF, " realignment = %d\n", dstalign); - if ((srcformat->format == GCREG_DE_FORMAT_NV12) || + if ((srcinfo->format->format == GCREG_DE_FORMAT_NV12) || (dstalign != 0) || - ((srcalign != 0) && (srcinfo->angle == batch->dstangle))) { + ((srcalign != 0) && (srcinfo->angle == dstinfo->angle))) { /* Compute the source offset in pixels needed to compensate * for the surface base address misalignment if any. */ - srcalign = get_pixel_offset(srcdesc, srcformat, 0); + srcalign = get_pixel_offset(srcinfo, 0); /* Compute the surface offsets in bytes. */ - srcbyteshift = srcalign * (int) srcformat->bitspp / 8; - dstbyteshift = batch->dstalign * (int) dstformat->bitspp / 8; + srcbyteshift = srcalign * (int) srcinfo->format->bitspp / 8; GCDBG(GCZONE_SURF, "recomputed for single-source setup:\n"); GCDBG(GCZONE_SURF, " srcalign = %d\n", @@ -333,7 +324,7 @@ enum bverror do_blit(struct bvbltparams *bltparams, GCDBG(GCZONE_SURF, " srcsurf offset (bytes) = 0x%08X\n", srcbyteshift); GCDBG(GCZONE_SURF, " dstsurf offset (bytes) = 0x%08X\n", - dstbyteshift); + dstinfo->bytealign); switch (srcinfo->angle) { case ROT_ANGLE_0: @@ -341,8 +332,8 @@ enum bverror do_blit(struct bvbltparams *bltparams, srcleft -= srcalign; /* Determine source size. */ - srcsurfwidth = srcgeom->width - srcalign; - srcsurfheight = srcgeom->height; + srcsurfwidth = srcinfo->geom->width - srcalign; + srcsurfheight = srcinfo->geom->height; break; case ROT_ANGLE_90: @@ -350,20 +341,20 @@ enum bverror do_blit(struct bvbltparams *bltparams, srctop -= srcalign; /* Determine source size. */ - srcsurfwidth = srcgeom->height - srcalign; - srcsurfheight = srcgeom->width; + srcsurfwidth = srcinfo->geom->height - srcalign; + srcsurfheight = srcinfo->geom->width; break; case ROT_ANGLE_180: /* Determine source size. */ - srcsurfwidth = srcgeom->width - srcalign; - srcsurfheight = srcgeom->height; + srcsurfwidth = srcinfo->geom->width - srcalign; + srcsurfheight = srcinfo->geom->height; break; case ROT_ANGLE_270: /* Determine source size. */ - srcsurfwidth = srcgeom->height - srcalign; - srcsurfheight = srcgeom->width; + srcsurfwidth = srcinfo->geom->height - srcalign; + srcsurfheight = srcinfo->geom->width; break; default: @@ -377,8 +368,8 @@ enum bverror do_blit(struct bvbltparams *bltparams, srcsurfwidth, srcsurfheight); /* Set the physical destination size. */ - physwidth = batch->dstphyswidth; - physheight = batch->dstphysheight; + physwidth = dstinfo->physwidth; + physheight = dstinfo->physheight; /* Disable multi source for YUV and for the cases where * the destination and the base address alignment does @@ -393,56 +384,56 @@ enum bverror do_blit(struct bvbltparams *bltparams, /* Adjust the destination to match the source geometry. */ switch (srcinfo->angle) { case ROT_ANGLE_0: - dstleft -= srcalign; - dstright -= srcalign; + dstadjusted.left -= srcalign; + dstadjusted.right -= srcalign; /* Apply the source alignment. */ - if ((batch->dstangle == ROT_ANGLE_0) || - (batch->dstangle == ROT_ANGLE_180)) { - physwidth = batch->dstphyswidth - srcalign; - physheight = batch->dstphysheight; + if ((dstinfo->angle == ROT_ANGLE_0) || + (dstinfo->angle == ROT_ANGLE_180)) { + physwidth = dstinfo->physwidth - srcalign; + physheight = dstinfo->physheight; } else { - physwidth = batch->dstphyswidth; - physheight = batch->dstphysheight - srcalign; + physwidth = dstinfo->physwidth; + physheight = dstinfo->physheight - srcalign; } break; case ROT_ANGLE_90: - dsttop -= srcalign; - dstbottom -= srcalign; + dstadjusted.top -= srcalign; + dstadjusted.bottom -= srcalign; /* Apply the source alignment. */ - if ((batch->dstangle == ROT_ANGLE_0) || - (batch->dstangle == ROT_ANGLE_180)) { - physwidth = batch->dstphyswidth; - physheight = batch->dstphysheight - srcalign; + if ((dstinfo->angle == ROT_ANGLE_0) || + (dstinfo->angle == ROT_ANGLE_180)) { + physwidth = dstinfo->physwidth; + physheight = dstinfo->physheight - srcalign; } else { - physwidth = batch->dstphyswidth - srcalign; - physheight = batch->dstphysheight; + physwidth = dstinfo->physwidth - srcalign; + physheight = dstinfo->physheight; } break; case ROT_ANGLE_180: /* Apply the source alignment. */ - if ((batch->dstangle == ROT_ANGLE_0) || - (batch->dstangle == ROT_ANGLE_180)) { - physwidth = batch->dstphyswidth - srcalign; - physheight = batch->dstphysheight; + if ((dstinfo->angle == ROT_ANGLE_0) || + (dstinfo->angle == ROT_ANGLE_180)) { + physwidth = dstinfo->physwidth - srcalign; + physheight = dstinfo->physheight; } else { - physwidth = batch->dstphyswidth; - physheight = batch->dstphysheight - srcalign; + physwidth = dstinfo->physwidth; + physheight = dstinfo->physheight - srcalign; } break; case ROT_ANGLE_270: /* Apply the source alignment. */ - if ((batch->dstangle == ROT_ANGLE_0) || - (batch->dstangle == ROT_ANGLE_180)) { - physwidth = batch->dstphyswidth; - physheight = batch->dstphysheight - srcalign; + if ((dstinfo->angle == ROT_ANGLE_0) || + (dstinfo->angle == ROT_ANGLE_180)) { + physwidth = dstinfo->physwidth; + physheight = dstinfo->physheight - srcalign; } else { - physwidth = batch->dstphyswidth - srcalign; - physheight = batch->dstphysheight; + physwidth = dstinfo->physwidth - srcalign; + physheight = dstinfo->physheight; } break; @@ -480,40 +471,37 @@ enum bverror do_blit(struct bvbltparams *bltparams, /* Check if we need to finalize existing batch. */ if ((batch->batchend != do_blit_end) || - (batch->gcblit.srccount == 4) || - (batch->gcblit.multisrc == 0) || + (batch->op.blit.srccount == 4) || + (batch->op.blit.multisrc == 0) || (multisrc == 0) || ((batch->batchflags & (BVBATCH_DST | BVBATCH_CLIPRECT | BVBATCH_DESTRECT)) != 0)) { /* Finalize existing batch if any. */ - bverror = batch->batchend(bltparams, batch); + bverror = batch->batchend(bvbltparams, batch); if (bverror != BVERR_NONE) goto exit; /* Initialize the new batch. */ batch->batchend = do_blit_end; batch->blockenable = 0; - batch->gcblit.srccount = 0; - batch->gcblit.multisrc = multisrc; - batch->gcblit.rop = srcinfo->rop; + batch->op.blit.srccount = 0; + batch->op.blit.multisrc = multisrc; + batch->op.blit.rop = srcinfo->rop; } /* Set destination coordinates. */ - batch->left = dstleft; - batch->top = dsttop; - batch->right = dstright; - batch->bottom = dstbottom; + batch->op.blit.dstrect = dstadjusted; /* Map the destination. */ - bverror = do_map(dstdesc, batch, &dstmap); + bverror = do_map(dstinfo->buf.desc, batch, &dstmap); if (bverror != BVERR_NONE) { - bltparams->errdesc = gccontext->bverrorstr; + bvbltparams->errdesc = gccontext->bverrorstr; goto exit; } /* Set the new destination. */ - bverror = set_dst(bltparams, batch, dstmap); + bverror = set_dst(bvbltparams, batch, dstmap); if (bverror != BVERR_NONE) goto exit; @@ -523,9 +511,9 @@ enum bverror do_blit(struct bvbltparams *bltparams, BVBATCH_DESTRECT); /* Map the source. */ - bverror = do_map(srcdesc, batch, &srcmap); + bverror = do_map(srcinfo->buf.desc, batch, &srcmap); if (bverror != BVERR_NONE) { - bltparams->errdesc = gccontext->bverrorstr; + bvbltparams->errdesc = gccontext->bverrorstr; goto exit; } @@ -538,23 +526,22 @@ enum bverror do_blit(struct bvbltparams *bltparams, batch->blockenable = orthogonal; /* Allocate command buffer. */ - bverror = claim_buffer(bltparams, batch, + bverror = claim_buffer(bvbltparams, batch, sizeof(struct gcmosrc), (void **) &gcmosrc); if (bverror != BVERR_NONE) goto exit; /* Shortcut to the register index. */ - index = batch->gcblit.srccount; - - add_fixup(bltparams, batch, &gcmosrc->address, srcbyteshift); + index = batch->op.blit.srccount; /* Set surface parameters. */ gcmosrc->address_ldst = gcmosrc_address_ldst[index]; gcmosrc->address = GET_MAP_HANDLE(srcmap); + add_fixup(bvbltparams, batch, &gcmosrc->address, srcbyteshift); gcmosrc->stride_ldst = gcmosrc_stride_ldst[index]; - gcmosrc->stride = srcgeom->virtstride; + gcmosrc->stride = srcinfo->geom->virtstride; gcmosrc->rotation_ldst = gcmosrc_rotation_ldst[index]; gcmosrc->rotation.raw = 0; @@ -562,8 +549,8 @@ enum bverror do_blit(struct bvbltparams *bltparams, gcmosrc->config_ldst = gcmosrc_config_ldst[index]; gcmosrc->config.raw = 0; - gcmosrc->config.reg.swizzle = srcformat->swizzle; - gcmosrc->config.reg.format = srcformat->format; + gcmosrc->config.reg.swizzle = srcinfo->format->swizzle; + gcmosrc->config.reg.format = srcinfo->format->format; gcmosrc->origin_ldst = gcmosrc_origin_ldst[index]; gcmosrc->origin.reg.x = srcleft; @@ -580,28 +567,28 @@ enum bverror do_blit(struct bvbltparams *bltparams, = gcmosrc_rotationangle_ldst[index]; gcmosrc->rotationangle.raw = 0; gcmosrc->rotationangle.reg.src = rotencoding[srcinfo->angle]; - gcmosrc->rotationangle.reg.dst = rotencoding[batch->dstangle]; + gcmosrc->rotationangle.reg.dst = rotencoding[dstinfo->angle]; gcmosrc->rotationangle.reg.src_mirror = srcinfo->mirror; gcmosrc->rotationangle.reg.dst_mirror = GCREG_MIRROR_NONE; gcmosrc->rop_ldst = gcmosrc_rop_ldst[index]; gcmosrc->rop.raw = 0; gcmosrc->rop.reg.type = GCREG_ROP_TYPE_ROP3; - gcmosrc->rop.reg.fg = (unsigned char) batch->gcblit.rop; + gcmosrc->rop.reg.fg = (unsigned char) batch->op.blit.rop; gcmosrc->mult_ldst = gcmosrc_mult_ldst[index]; gcmosrc->mult.raw = 0; gcmosrc->mult.reg.srcglobalpremul = GCREG_COLOR_MULTIPLY_MODES_SRC_GLOBAL_PREMULTIPLY_DISABLE; - if ((srcgeom->format & OCDFMTDEF_NON_PREMULT) != 0) + if ((srcinfo->geom->format & OCDFMTDEF_NON_PREMULT) != 0) gcmosrc->mult.reg.srcpremul = GCREG_COLOR_MULTIPLY_MODES_SRC_PREMULTIPLY_ENABLE; else gcmosrc->mult.reg.srcpremul = GCREG_COLOR_MULTIPLY_MODES_SRC_PREMULTIPLY_DISABLE; - if ((dstgeom->format & OCDFMTDEF_NON_PREMULT) != 0) { + if ((dstinfo->geom->format & OCDFMTDEF_NON_PREMULT) != 0) { gcmosrc->mult.reg.dstpremul = GCREG_COLOR_MULTIPLY_MODES_SRC_PREMULTIPLY_ENABLE; @@ -615,133 +602,104 @@ enum bverror do_blit(struct bvbltparams *bltparams, = GCREG_COLOR_MULTIPLY_MODES_DST_DEMULTIPLY_DISABLE; } - if (srcformat->format == GCREG_DE_FORMAT_NV12) { - struct gcmosrcplanaryuv *yuv; - int uvshift = srcbyteshift; - -#if 0 - /* TODO: needs rework */ - if (multisrc && (srcsurftop % 2)) { - /* We can't shift the uv plane by an odd number - * of rows. */ - BVSETBLTERROR(BVERR_SRC1RECT, - "src/dst y coordinate combination" - " not supported"); - goto exit; - } -#endif - - bverror = claim_buffer(bltparams, batch, - sizeof(struct gcmosrcplanaryuv), - (void **) &yuv); - if (bverror != BVERR_NONE) - goto exit; - - yuv->uplaneaddress_ldst = - gcmosrc_uplaneaddress_ldst[index]; - yuv->uplanestride_ldst = - gcmosrc_uplanestride_ldst[index]; - yuv->vplaneaddress_ldst = - gcmosrc_vplaneaddress_ldst[index]; - yuv->vplanestride_ldst = - gcmosrc_vplanestride_ldst[index]; - -#if 0 - /* TODO: needs rework */ - if (multisrc) { - /* UV plane is half height. */ - uvshift = (srcsurftop / 2) - * (int) srcgeom->virtstride - + srcsurfleft - * (int) srcformat->bitspp / 8; - } else { - /* No shift needed for single source walker. */ - uvshift = 0; - } -#endif - - GCDBG(GCZONE_SURF, " uvshift = 0x%08X (%d)\n", - uvshift, uvshift); - - /* add fixed offset from Y plane */ - uvshift += srcgeom->virtstride * srcgeom->height; - - GCDBG(GCZONE_SURF, " final uvshift = 0x%08X (%d)\n", - uvshift, uvshift); - - yuv->uplaneaddress = GET_MAP_HANDLE(srcmap); - add_fixup(bltparams, batch, &yuv->uplaneaddress, uvshift); - - yuv->uplanestride = srcgeom->virtstride; - - yuv->vplaneaddress = GET_MAP_HANDLE(srcmap); - add_fixup(bltparams, batch, &yuv->vplaneaddress, uvshift); - - yuv->vplanestride = srcgeom->virtstride; - } - - if (srcgca != NULL) { + if (srcinfo->gca == NULL) { + GCDBG(GCZONE_BLEND, "blending disabled.\n"); gcmosrc->alphacontrol_ldst = gcmosrc_alphacontrol_ldst[index]; - gcmosrc->alphacontrol.raw = 0; - gcmosrc->alphacontrol.reg.enable - = GCREG_ALPHA_CONTROL_ENABLE_ON; + gcmosrc->alphacontrol.reg = gcregalpha_off; + } else { + gcmosrc->alphacontrol_ldst + = gcmosrc_alphacontrol_ldst[index]; + gcmosrc->alphacontrol.reg = gcregalpha_on; /* Allocate command buffer. */ - bverror = claim_buffer(bltparams, batch, - sizeof(struct gcmosrcalpha), - (void **) &gcmosrcalpha); + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmoxsrcalpha), + (void **) &gcmoxsrcalpha); if (bverror != BVERR_NONE) goto exit; - gcmosrcalpha->alphamodes_ldst - = gcmosrcalpha_alphamodes_ldst[index]; - gcmosrcalpha->alphamodes.raw = 0; - gcmosrcalpha->alphamodes.reg.src_global_alpha - = srcgca->src_global_alpha_mode; - gcmosrcalpha->alphamodes.reg.dst_global_alpha - = srcgca->dst_global_alpha_mode; + gcmoxsrcalpha->alphamodes_ldst + = gcmoxsrcalpha_alphamodes_ldst[index]; + gcmoxsrcalpha->alphamodes.raw = 0; + gcmoxsrcalpha->alphamodes.reg.src_global_alpha_mode + = srcinfo->gca->src_global_alpha_mode; + gcmoxsrcalpha->alphamodes.reg.dst_global_alpha_mode + = srcinfo->gca->dst_global_alpha_mode; - gcmosrcalpha->alphamodes.reg.src_blend - = srcgca->srcconfig->factor_mode; - gcmosrcalpha->alphamodes.reg.src_color_reverse - = srcgca->srcconfig->color_reverse; + gcmoxsrcalpha->alphamodes.reg.src_blend + = srcinfo->gca->srcconfig->factor_mode; + gcmoxsrcalpha->alphamodes.reg.src_color_reverse + = srcinfo->gca->srcconfig->color_reverse; - gcmosrcalpha->alphamodes.reg.dst_blend - = srcgca->dstconfig->factor_mode; - gcmosrcalpha->alphamodes.reg.dst_color_reverse - = srcgca->dstconfig->color_reverse; + gcmoxsrcalpha->alphamodes.reg.dst_blend + = srcinfo->gca->dstconfig->factor_mode; + gcmoxsrcalpha->alphamodes.reg.dst_color_reverse + = srcinfo->gca->dstconfig->color_reverse; GCDBG(GCZONE_BLEND, "dst blend:\n"); GCDBG(GCZONE_BLEND, " factor = %d\n", - gcmosrcalpha->alphamodes.reg.dst_blend); + gcmoxsrcalpha->alphamodes.reg.dst_blend); GCDBG(GCZONE_BLEND, " inverse = %d\n", - gcmosrcalpha->alphamodes.reg.dst_color_reverse); + gcmoxsrcalpha->alphamodes.reg.dst_color_reverse); GCDBG(GCZONE_BLEND, "src blend:\n"); GCDBG(GCZONE_BLEND, " factor = %d\n", - gcmosrcalpha->alphamodes.reg.src_blend); + gcmoxsrcalpha->alphamodes.reg.src_blend); GCDBG(GCZONE_BLEND, " inverse = %d\n", - gcmosrcalpha->alphamodes.reg.src_color_reverse); + gcmoxsrcalpha->alphamodes.reg.src_color_reverse); - gcmosrcalpha->srcglobal_ldst - = gcmosrcalpha_srcglobal_ldst[index]; - gcmosrcalpha->srcglobal.raw = srcgca->src_global_color; + gcmoxsrcalpha->srcglobal_ldst + = gcmoxsrcalpha_srcglobal_ldst[index]; + gcmoxsrcalpha->srcglobal.raw = srcinfo->gca->src_global_color; - gcmosrcalpha->dstglobal_ldst - = gcmosrcalpha_dstglobal_ldst[index]; - gcmosrcalpha->dstglobal.raw = srcgca->dst_global_color; - } else { - GCDBG(GCZONE_BLEND, "blending disabled.\n"); + gcmoxsrcalpha->dstglobal_ldst + = gcmoxsrcalpha_dstglobal_ldst[index]; + gcmoxsrcalpha->dstglobal.raw = srcinfo->gca->dst_global_color; + } - gcmosrc->alphacontrol_ldst - = gcmosrc_alphacontrol_ldst[index]; - gcmosrc->alphacontrol.raw = 0; - gcmosrc->alphacontrol.reg.enable - = GCREG_ALPHA_CONTROL_ENABLE_OFF; + if (srcinfo->format->format == GCREG_DE_FORMAT_NV12) { + struct gcmoxsrcyuv *gcmoxsrcyuv; + int uvshift; + + uvshift = srcbyteshift + + srcinfo->geom->virtstride + * srcinfo->geom->height; + GCDBG(GCZONE_SURF, " uvshift = 0x%08X (%d)\n", + uvshift, uvshift); + + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmoxsrcyuv), + (void **) &gcmoxsrcyuv); + if (bverror != BVERR_NONE) + goto exit; + + gcmoxsrcyuv->uplaneaddress_ldst = + gcmoxsrcyuv_uplaneaddress_ldst[index]; + gcmoxsrcyuv->uplaneaddress = GET_MAP_HANDLE(srcmap); + add_fixup(bvbltparams, batch, &gcmoxsrcyuv->uplaneaddress, + uvshift); + + gcmoxsrcyuv->uplanestride_ldst = + gcmoxsrcyuv_uplanestride_ldst[index]; + gcmoxsrcyuv->uplanestride = srcinfo->geom->virtstride; + + gcmoxsrcyuv->vplaneaddress_ldst = + gcmoxsrcyuv_vplaneaddress_ldst[index]; + gcmoxsrcyuv->vplaneaddress = GET_MAP_HANDLE(srcmap); + add_fixup(bvbltparams, batch, &gcmoxsrcyuv->vplaneaddress, + uvshift); + + gcmoxsrcyuv->vplanestride_ldst = + gcmoxsrcyuv_vplanestride_ldst[index]; + gcmoxsrcyuv->vplanestride = srcinfo->geom->virtstride; + + gcmoxsrcyuv->pectrl_ldst = + gcmoxsrcyuv_pectrl_ldst[index]; + gcmoxsrcyuv->pectrl = GCREG_PE_CONTROL_ResetValue; } - batch->gcblit.srccount += 1; + batch->op.blit.srccount += 1; exit: GCEXITARG(GCZONE_BLIT, "bv%s = %d\n", diff --git a/drivers/misc/gcx/gcbv/gcbv.c b/drivers/misc/gcx/gcbv/gcbv.c index 170d4b4..16d63cc 100644 --- a/drivers/misc/gcx/gcbv/gcbv.c +++ b/drivers/misc/gcx/gcbv/gcbv.c @@ -64,6 +64,8 @@ #define GCZONE_BATCH (1 << 5) #define GCZONE_BLIT (1 << 6) #define GCZONE_CACHE (1 << 7) +#define GCZONE_CALLBACK (1 << 8) +#define GCZONE_TEMP (1 << 9) GCDBG_FILTERDEF(gcbv, GCZONE_NONE, "mapping", @@ -73,7 +75,9 @@ GCDBG_FILTERDEF(gcbv, GCZONE_NONE, "mask", "batch", "blit", - "cache") + "cache", + "callback", + "tempbuffer") /******************************************************************************* @@ -251,14 +255,33 @@ static struct bvsurferrorid g_masksurferr = { "mask", BVERR_MASKDESC }; * Callback info management. */ +/* BLTsville callback function. */ +struct gccallbackbltsville { + /* Function pointer. */ + void (*fn) (struct bvcallbackerror *err, unsigned long callbackdata); + + /* Callback data. */ + unsigned long data; +}; + +/* Information for freeing a surface. */ +struct gccallbackfreesurface { + /* Pointer to the buffer descriptor. */ + struct bvbuffdesc *desc; + + /* Pointer to the buffer. */ + void *ptr; +}; + /* Callback information. */ struct gccallbackinfo { - /* BLTsville callback function. */ - void (*callbackfn) (struct bvcallbackerror *err, - unsigned long callbackdata); + union { + /* BLTsville callback function. */ + struct gccallbackbltsville callback; - /* Callback data. */ - unsigned long callbackdata; + /* Information for freeing a surface. */ + struct gccallbackfreesurface freesurface; + } info; /* Previous/next callback information. */ struct list_head link; @@ -311,22 +334,159 @@ static void free_callback(struct gccallbackinfo *gccallbackinfo) GCUNLOCK(&gccontext->callbacklock); } -void gccallback(void *callbackparam) +void callbackbltsville(void *callbackinfo) +{ + struct gccallbackinfo *gccallbackinfo; + + GCENTER(GCZONE_CALLBACK); + + gccallbackinfo = (struct gccallbackinfo *) callbackinfo; + GCDBG(GCZONE_CALLBACK, "bltsville_callback = 0x%08X\n", + (unsigned int) gccallbackinfo->info.callback.fn); + GCDBG(GCZONE_CALLBACK, "bltsville_param = 0x%08X\n", + (unsigned int) gccallbackinfo->info.callback.data); + + gccallbackinfo->info.callback.fn(NULL, + gccallbackinfo->info.callback.data); + free_callback(gccallbackinfo); + + GCEXIT(GCZONE_CALLBACK); +} + +void callbackfreesurface(void *callbackinfo) { struct gccallbackinfo *gccallbackinfo; - GCENTER(GCZONE_BLIT); + GCENTER(GCZONE_CALLBACK); - gccallbackinfo = (struct gccallbackinfo *) callbackparam; - GCDBG(GCZONE_BLIT, "bltsville_callback = 0x%08X\n", - (unsigned int) gccallbackinfo->callbackfn); - GCDBG(GCZONE_BLIT, "bltsville_param = 0x%08X\n", - (unsigned int) gccallbackinfo->callbackdata); + gccallbackinfo = (struct gccallbackinfo *) callbackinfo; + GCDBG(GCZONE_CALLBACK, "freeing descriptir @ 0x%08X\n", + (unsigned int) gccallbackinfo->info.freesurface.desc); + GCDBG(GCZONE_CALLBACK, "freeing memory @ 0x%08X\n", + (unsigned int) gccallbackinfo->info.freesurface.ptr); - gccallbackinfo->callbackfn(NULL, gccallbackinfo->callbackdata); + free_surface(gccallbackinfo->info.freesurface.desc, + gccallbackinfo->info.freesurface.ptr); free_callback(gccallbackinfo); - GCEXIT(GCZONE_BLIT); + GCEXIT(GCZONE_CALLBACK); +} + + +/******************************************************************************* + * Temporary buffer management. + */ + +enum bverror allocate_temp(struct bvbltparams *bvbltparams, + unsigned int size) +{ + enum bverror bverror; + struct gccontext *gccontext = get_context(); + + GCENTER(GCZONE_TEMP); + + /* Existing buffer too small? */ + if ((gccontext->tmpbuffdesc != NULL) && + (gccontext->tmpbuffdesc->length < size)) { + GCDBG(GCZONE_TEMP, "freeing current buffer.\n"); + bverror = free_temp(true); + if (bverror != BVERR_NONE) { + bvbltparams->errdesc = gccontext->bverrorstr; + goto exit; + } + } + + /* Allocate new buffer if necessary. */ + if ((size > 0) && (gccontext->tmpbuffdesc == NULL)) { + /* Allocate temporary surface. */ + bverror = allocate_surface(&gccontext->tmpbuffdesc, + &gccontext->tmpbuff, + size); + if (bverror != BVERR_NONE) { + bvbltparams->errdesc = gccontext->bverrorstr; + goto exit; + } + + GCDBG(GCZONE_TEMP, "buffdesc @ 0x%08X\n", + gccontext->tmpbuffdesc); + GCDBG(GCZONE_TEMP, "allocated @ 0x%08X\n", + gccontext->tmpbuff); + GCDBG(GCZONE_TEMP, "size = %d\n", + size); + + /* Map the buffer explicitly. */ + bverror = bv_map(gccontext->tmpbuffdesc); + if (bverror != BVERR_NONE) { + bvbltparams->errdesc = gccontext->bverrorstr; + goto exit; + } + } + + /* Success. */ + bverror = BVERR_NONE; + +exit: + GCEXIT(GCZONE_TEMP); + return bverror; +} + +enum bverror free_temp(bool schedule) +{ + enum bverror bverror; + struct gccontext *gccontext = get_context(); + struct gccallbackinfo *gccallbackinfo; + struct gcicallbackarm gcicallbackarm; + + /* Is the buffer allocated? */ + if (gccontext->tmpbuffdesc == NULL) { + bverror = BVERR_NONE; + goto exit; + } + + /* Unmap the buffer. */ + bverror = bv_unmap(gccontext->tmpbuffdesc); + if (bverror != BVERR_NONE) + goto exit; + + /* Cannot be mapped. */ + if (gccontext->tmpbuffdesc->map != NULL) { + BVSETERROR(BVERR_OOM, "temporary buffer is still mapped"); + goto exit; + } + + /* Free the buffer. */ + if (schedule) { + bverror = get_callbackinfo(&gccallbackinfo); + if (bverror != BVERR_NONE) { + BVSETERROR(BVERR_OOM, + "callback allocation failed"); + goto exit; + } + + gccallbackinfo->info.freesurface.desc = gccontext->tmpbuffdesc; + gccallbackinfo->info.freesurface.ptr = gccontext->tmpbuff; + gcicallbackarm.callback = callbackfreesurface; + gcicallbackarm.callbackparam = gccallbackinfo; + + /* Schedule to free the buffer. */ + gc_callback_wrapper(&gcicallbackarm); + + /* Error? */ + if (gcicallbackarm.gcerror != GCERR_NONE) { + BVSETERROR(BVERR_OOM, "unable to schedule callback"); + goto exit; + } + } else { + /* Free the buffer immediately. */ + free_surface(gccontext->tmpbuffdesc, gccontext->tmpbuff); + } + + /* Reset the buffer descriptor. */ + gccontext->tmpbuffdesc = NULL; + gccontext->tmpbuff = NULL; + +exit: + return bverror; } @@ -334,7 +494,7 @@ void gccallback(void *callbackparam) * Program the destination. */ -enum bverror set_dst(struct bvbltparams *bltparams, +enum bverror set_dst(struct bvbltparams *bvbltparams, struct gcbatch *batch, struct bvbuffmap *dstmap) { @@ -346,20 +506,20 @@ enum bverror set_dst(struct bvbltparams *bltparams, /* Did destination surface change? */ if ((batch->batchflags & BVBATCH_DST) != 0) { /* Allocate command buffer. */ - bverror = claim_buffer(bltparams, batch, + bverror = claim_buffer(bvbltparams, batch, sizeof(struct gcmodst), (void **) &gcmodst); if (bverror != BVERR_NONE) goto exit; /* Add the address fixup. */ - add_fixup(bltparams, batch, &gcmodst->address, + add_fixup(bvbltparams, batch, &gcmodst->address, batch->dstbyteshift); /* Set surface parameters. */ - gcmodst->address_ldst = gcmodst_address_ldst; + gcmodst->config_ldst = gcmodst_config_ldst; gcmodst->address = GET_MAP_HANDLE(dstmap); - gcmodst->stride = bltparams->dstgeom->virtstride; + gcmodst->stride = bvbltparams->dstgeom->virtstride; /* Set surface width and height. */ gcmodst->rotation.raw = 0; @@ -368,7 +528,7 @@ enum bverror set_dst(struct bvbltparams *bltparams, gcmodst->rotationheight.raw = 0; gcmodst->rotationheight.reg.height = batch->physheight; - /* Set clipping. */ + /* Disable hardware clipping. */ gcmodst->clip_ldst = gcmodst_clip_ldst; gcmodst->cliplt.raw = 0; gcmodst->cliprb.raw = 0; @@ -387,6 +547,15 @@ exit: * Surface compare and validation. */ +static inline bool valid_rect(struct bvsurfgeom *bvsurfgeom, + struct gcrect *gcrect) +{ + return (((gcrect->right - gcrect->left) > 0) && + ((gcrect->bottom - gcrect->top) > 0) && + (gcrect->right <= (int) bvsurfgeom->width) && + (gcrect->bottom <= (int) bvsurfgeom->height)); +} + static inline bool equal_rects(struct bvrect *rect1, struct bvrect *rect2) { if (rect1->left != rect2->left) @@ -492,6 +661,8 @@ static int verify_surface(unsigned int tile, void bv_init(void) { struct gccontext *gccontext = get_context(); + struct gcicaps gcicaps; + unsigned i, j; GCDBG_REGISTER(gcbv); GCDBG_REGISTER(gcparser); @@ -513,6 +684,25 @@ void bv_init(void) INIT_LIST_HEAD(&gccontext->batchvac); INIT_LIST_HEAD(&gccontext->callbacklist); INIT_LIST_HEAD(&gccontext->callbackvac); + + /* Initialize the filter cache. */ + for (i = 0; i < GC_FILTER_COUNT; i += 1) + for (j = 0; j < GC_TAP_COUNT; j += 1) + INIT_LIST_HEAD(&gccontext->filtercache[i][j].list); + + /* Query hardware caps. */ + gc_getcaps_wrapper(&gcicaps); + if (gcicaps.gcerror == GCERR_NONE) { + gccontext->gcmodel = gcicaps.gcmodel; + gccontext->gcrevision = gcicaps.gcrevision; + gccontext->gcdate = gcicaps.gcdate; + gccontext->gctime = gcicaps.gctime; + gccontext->gcfeatures = gcicaps.gcfeatures; + gccontext->gcfeatures0 = gcicaps.gcfeatures0; + gccontext->gcfeatures1 = gcicaps.gcfeatures1; + gccontext->gcfeatures2 = gcicaps.gcfeatures2; + gccontext->gcfeatures3 = gcicaps.gcfeatures3; + } } void bv_exit(void) @@ -524,6 +714,7 @@ void bv_exit(void) struct gcbuffer *gcbuffer; struct gcfixup *gcfixup; struct gcbatch *gcbatch; + struct gccallbackinfo *gccallbackinfo; while (gccontext->buffmapvac != NULL) { bvbuffmap = gccontext->buffmapvac; @@ -558,6 +749,20 @@ void bv_exit(void) list_del(head); gcfree(gcbatch); } + + while (!list_empty(&gccontext->callbacklist)) { + head = gccontext->callbacklist.next; + list_move(head, &gccontext->callbackvac); + } + + while (!list_empty(&gccontext->callbackvac)) { + head = gccontext->callbackvac.next; + gccallbackinfo = list_entry(head, struct gccallbackinfo, link); + list_del(head); + gcfree(gccallbackinfo); + } + + free_temp(false); } @@ -599,7 +804,7 @@ enum bverror bv_unmap(struct bvbuffdesc *bvbuffdesc) struct bvbuffmap *prev = NULL; struct bvbuffmap *bvbuffmap; struct bvbuffmapinfo *bvbuffmapinfo; - struct gcmap gcmap; + struct gcimap gcimap; GCENTERARG(GCZONE_MAPPING, "bvbuffdesc = 0x%08X\n", (unsigned int) bvbuffdesc); @@ -695,10 +900,10 @@ enum bverror bv_unmap(struct bvbuffdesc *bvbuffdesc) } /* Unmap the buffer. */ - memset(&gcmap, 0, sizeof(gcmap)); - gcmap.handle = bvbuffmapinfo->handle; - gc_unmap_wrapper(&gcmap); - if (gcmap.gcerror != GCERR_NONE) { + memset(&gcimap, 0, sizeof(gcimap)); + gcimap.handle = bvbuffmapinfo->handle; + gc_unmap_wrapper(&gcimap); + if (gcimap.gcerror != GCERR_NONE) { BVSETERROR(BVERR_OOM, "unable to free gccore memory"); goto exit; } @@ -737,9 +942,10 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) struct gcbatch *gcbatch; struct bvrect *dstrect; int src1used, src2used, maskused; - struct srcinfo srcinfo[2]; + struct surfaceinfo srcinfo[2]; + struct bvrect *srcrect[2]; unsigned short rop; - struct gccommit gccommit; + struct gcicommit gcicommit; int i, srccount, res; GCENTERARG(GCZONE_BLIT, "bvbltparams = 0x%08X\n", @@ -917,6 +1123,23 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) if (bverror != BVERR_NONE) goto exit; + /* Validate destination rectangles. */ + if (!valid_rect(bvbltparams->dstgeom, + &gcbatch->dstclipped)) { + GCDBG(GCZONE_DEST, + "invalid destination rectangle.\n"); + goto exit; + } + + if (((bvbltparams->flags & BVFLAG_SRC2_AUXDSTRECT) != 0) && + !valid_rect(bvbltparams->dstgeom, + &gcbatch->dstclippedaux)) { + GCDBG(GCZONE_DEST, + "invalid aux destination rectangle.\n"); + goto exit; + } + + /* Reset the number of sources. */ srccount = 0; /* Verify the src1 parameters structure. */ @@ -947,9 +1170,10 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) srcinfo[srccount].index = 0; srcinfo[srccount].buf = bvbltparams->src1; srcinfo[srccount].geom = bvbltparams->src1geom; - srcinfo[srccount].rect = &bvbltparams->src1rect; + srcrect[srccount] = &bvbltparams->src1rect; bverror = parse_source(bvbltparams, gcbatch, + &bvbltparams->src1rect, &srcinfo[srccount]); if (bverror != BVERR_NONE) goto exit; @@ -986,9 +1210,10 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) srcinfo[srccount].index = 1; srcinfo[srccount].buf = bvbltparams->src2; srcinfo[srccount].geom = bvbltparams->src2geom; - srcinfo[srccount].rect = &bvbltparams->src2rect; + srcrect[srccount] = &bvbltparams->src2rect; bverror = parse_source(bvbltparams, gcbatch, + &bvbltparams->src2rect, &srcinfo[srccount]); if (bverror != BVERR_NONE) goto exit; @@ -1028,13 +1253,25 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) goto exit; } else { for (i = 0; i < srccount; i += 1) { + int srcw, srch; + GCDBG(GCZONE_BLIT, + "processing source %d.\n", + srcinfo[i].index); + if (gca == NULL) { + GCDBG(GCZONE_BLIT, + " blending disabled.\n"); srcinfo[i].rop = bvbltparams->op.rop; srcinfo[i].gca = NULL; } else if ((i + 1) != srccount) { + GCDBG(GCZONE_BLIT, + " disabling blending for " + "the first source.\n"); srcinfo[i].rop = 0xCC; srcinfo[i].gca = NULL; } else { + GCDBG(GCZONE_BLIT, + " enabling blending.\n"); srcinfo[i].rop = 0xCC; srcinfo[i].gca = gca; @@ -1047,18 +1284,43 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) } } - if ((srcinfo[i].rect->width == 1) && - (srcinfo[i].rect->height == 1) && - (bvbltparams->src1.desc->virtaddr)) - bverror = do_fill(bvbltparams, gcbatch, - &srcinfo[i]); - else if (EQ_SIZE(srcinfo[i].rect, dstrect)) - bverror = do_blit(bvbltparams, gcbatch, + GCDBG(GCZONE_BLIT, " srcsize %dx%d.\n", + srcrect[i]->width, srcrect[i]->height); + GCDBG(GCZONE_BLIT, " dstsize %dx%d.\n", + dstrect->width, dstrect->height); + + srcw = srcrect[i]->width; + srch = srcrect[i]->height; + if ((srcw == 1) && (srch == 1) && + (bvbltparams->src1.desc->virtaddr)) { + GCDBG(GCZONE_BLIT, " op: fill.\n"); + bverror = do_fill(bvbltparams, + gcbatch, &srcinfo[i]); - else + } else if ((srcw == dstrect->width) && + (srch == dstrect->height)) { + GCDBG(GCZONE_BLIT, " op: bitblit.\n"); + bverror = do_blit(bvbltparams, + gcbatch, + &srcinfo[i]); + } else { + GCDBG(GCZONE_BLIT, " op: filter.\n"); + + /* Finish previous batch if any. */ + bverror = gcbatch->batchend( + bvbltparams, gcbatch); + if (bverror != BVERR_NONE) + goto exit; + + bverror = parse_scalemode(bvbltparams, + gcbatch); + if (bverror != BVERR_NONE) + goto exit; + bverror = do_filter(bvbltparams, gcbatch, &srcinfo[i]); + } if (bverror != BVERR_NONE) goto exit; @@ -1090,9 +1352,9 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) /* Process asynchronous operation. */ if ((bvbltparams->flags & BVFLAG_ASYNC) == 0) { GCDBG(GCZONE_BLIT, "synchronous batch.\n"); - gccommit.callback = NULL; - gccommit.callbackparam = NULL; - gccommit.asynchronous = false; + gcicommit.callback = NULL; + gcicommit.callbackparam = NULL; + gcicommit.asynchronous = false; } else { struct gccallbackinfo *gccallbackinfo; @@ -1101,8 +1363,8 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) if (bvbltparams->callbackfn == NULL) { GCDBG(GCZONE_BLIT, "no callback given.\n"); - gccommit.callback = NULL; - gccommit.callbackparam = NULL; + gcicommit.callback = NULL; + gcicommit.callbackparam = NULL; } else { bverror = get_callbackinfo(&gccallbackinfo); if (bverror != BVERR_NONE) { @@ -1112,59 +1374,59 @@ enum bverror bv_blt(struct bvbltparams *bvbltparams) goto exit; } - gccallbackinfo->callbackfn + gccallbackinfo->info.callback.fn = bvbltparams->callbackfn; - gccallbackinfo->callbackdata + gccallbackinfo->info.callback.data = bvbltparams->callbackdata; - gccommit.callback = gccallback; - gccommit.callbackparam = gccallbackinfo; + gcicommit.callback = callbackbltsville; + gcicommit.callbackparam = gccallbackinfo; GCDBG(GCZONE_BLIT, "gcbv_callback = 0x%08X\n", - (unsigned int) gccommit.callback); + (unsigned int) gcicommit.callback); GCDBG(GCZONE_BLIT, "gcbv_param = 0x%08X\n", - (unsigned int) gccommit.callbackparam); + (unsigned int) gcicommit.callbackparam); GCDBG(GCZONE_BLIT, "bltsville_callback = 0x%08X\n", (unsigned int) - gccallbackinfo->callbackfn); + gccallbackinfo->info.callback.fn); GCDBG(GCZONE_BLIT, "bltsville_param = 0x%08X\n", (unsigned int) - gccallbackinfo->callbackdata); + gccallbackinfo->info.callback.data); } - gccommit.asynchronous = true; + gcicommit.asynchronous = true; } /* Process scheduled unmappings. */ do_unmap_implicit(gcbatch); - INIT_LIST_HEAD(&gccommit.unmap); - list_splice_init(&gcbatch->unmap, &gccommit.unmap); + INIT_LIST_HEAD(&gcicommit.unmap); + list_splice_init(&gcbatch->unmap, &gcicommit.unmap); /* Pass the batch for execution. */ GCDUMPBATCH(gcbatch); - gccommit.gcerror = GCERR_NONE; - gccommit.entrypipe = GCPIPE_2D; - gccommit.exitpipe = GCPIPE_2D; + gcicommit.gcerror = GCERR_NONE; + gcicommit.entrypipe = GCPIPE_2D; + gcicommit.exitpipe = GCPIPE_2D; - INIT_LIST_HEAD(&gccommit.buffer); - list_splice_init(&gcbatch->buffer, &gccommit.buffer); + INIT_LIST_HEAD(&gcicommit.buffer); + list_splice_init(&gcbatch->buffer, &gcicommit.buffer); GCDBG(GCZONE_BLIT, "submitting the batch.\n"); - gc_commit_wrapper(&gccommit); + gc_commit_wrapper(&gcicommit); /* Move the lists back to the batch. */ - list_splice_init(&gccommit.buffer, &gcbatch->buffer); - list_splice_init(&gccommit.unmap, &gcbatch->unmap); + list_splice_init(&gcicommit.buffer, &gcbatch->buffer); + list_splice_init(&gcicommit.unmap, &gcbatch->unmap); /* Error? */ - if (gccommit.gcerror != GCERR_NONE) { - switch (gccommit.gcerror) { + if (gcicommit.gcerror != GCERR_NONE) { + switch (gcicommit.gcerror) { case GCERR_OODM: case GCERR_CTX_ALLOC: BVSETBLTERROR(BVERR_OOM, diff --git a/drivers/misc/gcx/gcbv/gcbv.h b/drivers/misc/gcx/gcbv/gcbv.h index 789d710..d54ad84 100644 --- a/drivers/misc/gcx/gcbv/gcbv.h +++ b/drivers/misc/gcx/gcbv/gcbv.h @@ -61,6 +61,8 @@ * Miscellaneous defines and macros. */ +#define GC_MAX_BASE_ALIGN 64 + #if !defined(BVBATCH_DESTRECT) #define BVBATCH_DESTRECT (BVBATCH_DSTRECT_ORIGIN | BVBATCH_DSTRECT_SIZE) #endif @@ -73,11 +75,6 @@ #define BVBATCH_SRC2RECT (BVBATCH_SRC2RECT_ORIGIN | BVBATCH_SRC2RECT_SIZE) #endif -#define EQ_SIZE(rect1, rect2) \ -( \ - (rect1->width == rect2->width) && (rect1->height == rect2->height) \ -) - #define STRUCTSIZE(structptr, lastmember) \ ( \ (size_t) &structptr->lastmember + \ @@ -118,6 +115,41 @@ do { \ /******************************************************************************* + * Kernel table definitions. + */ + +#define GC_TAP_COUNT 9 +#define GC_PHASE_BITS 5 +#define GC_PHASE_MAX_COUNT (1 << GC_PHASE_BITS) +#define GC_PHASE_LOAD_COUNT (GC_PHASE_MAX_COUNT / 2 + 1) +#define GC_COEFFICIENT_COUNT (GC_PHASE_LOAD_COUNT * GC_TAP_COUNT) +#define GC_FILTER_CACHE_MAX 10 + +enum gcfiltertype { + GC_FILTER_SYNC, + GC_FILTER_BLUR, + + /* Number of supported filter types. */ + GC_FILTER_COUNT +}; + +struct gcfilterkernel { + enum gcfiltertype type; + unsigned int kernelsize; + unsigned int srcsize; + unsigned int dstsize; + unsigned int scalefactor; + short kernelarray[GC_COEFFICIENT_COUNT]; + struct list_head link; +}; + +struct gcfiltercache { + unsigned int count; + struct list_head list; /* gcfilterkernel */ +}; + + +/******************************************************************************* * Global data structure. */ @@ -125,6 +157,17 @@ struct gccontext { /* Last generated error message. */ char bverrorstr[128]; + /* Capabilities and characteristics. */ + unsigned int gcmodel; + unsigned int gcrevision; + unsigned int gcdate; + unsigned int gctime; + union gcfeatures gcfeatures; + union gcfeatures0 gcfeatures0; + union gcfeatures1 gcfeatures1; + union gcfeatures2 gcfeatures2; + union gcfeatures3 gcfeatures3; + /* Dynamically allocated structure cache. */ struct bvbuffmap *buffmapvac; /* bvbuffmap */ struct list_head unmapvac; /* gcschedunmap */ @@ -142,6 +185,14 @@ struct gccontext { GCLOCK_TYPE fixuplock; GCLOCK_TYPE maplock; GCLOCK_TYPE callbacklock; + + /* Kernel table cache. */ + struct gcfilterkernel *loadedfilter; /* gcfilterkernel */ + struct gcfiltercache filtercache[GC_FILTER_COUNT][GC_TAP_COUNT]; + + /* Temporary buffer descriptor. */ + struct bvbuffdesc *tmpbuffdesc; + void *tmpbuff; }; @@ -166,10 +217,13 @@ struct bvbuffmapinfo { * Color format. */ -enum bvformattype { - BVFMT_RGB, - BVFMT_YUV -}; +#define BVFMT_PLANAR 0x100 +#define BVFMT_MASK 0xFF + +#define BVFMT_RGB 1 +#define BVFMT_YUV 2 +#define BVFMT_PACKED_YUV (BVFMT_YUV) +#define BVFMT_PLANAR_YUV (BVFMT_YUV | BVFMT_PLANAR) struct bvcomponent { unsigned int shift; @@ -185,10 +239,10 @@ struct bvcsrgb { }; struct bvformatxlate { - enum bvformattype type; - unsigned bitspp; - unsigned format; - unsigned swizzle; + unsigned int type; + unsigned int bitspp; + unsigned int format; + unsigned int swizzle; struct bvcsrgb rgba; }; @@ -249,6 +303,48 @@ extern const unsigned int rotencoding[]; /******************************************************************************* + * Surface descriptor. + */ + +struct surfaceinfo { + /* BLTsville source index (-1 for dst, 0 for src1 and 1 for src2). */ + int index; + + /* Surface buffer descriptor. */ + union bvinbuff buf; + + /* Surface geometry. */ + struct bvsurfgeom *geom; + + /* Rectangle to source from/render to. */ + struct gcrect rect; + + /* Surface format. */ + struct bvformatxlate *format; + + /* Physical size of the surface (accounted for rotation). */ + unsigned int physwidth; + unsigned int physheight; + + /* Base address alignment. */ + int pixalign; + int bytealign; + + /* Rotation angle. */ + int angle; + + /* Mirror setting. */ + unsigned int mirror; + + /* ROP. */ + unsigned short rop; + + /* Blending info. */ + struct gcalpha *gca; +}; + + +/******************************************************************************* * Batch structures. */ @@ -259,9 +355,30 @@ typedef enum bverror (*gcbatchend) (struct bvbltparams *bvbltparams, /* Blit states. */ struct gcblit { + /* Number of sources in the operation. */ unsigned int srccount; + + /* Multi source enable flag. */ unsigned int multisrc; + + /* ROP code. */ unsigned short rop; + + /* Computed destination rectangle coordinates; in multi-source + * setup can be modified to match new destination and source + * geometry. */ + struct gcrect dstrect; +}; + +/* Filter states. */ +struct gcfilter { + /* Kernel size. */ + unsigned int horkernelsize; + unsigned int verkernelsize; + + /* Scale factors. */ + unsigned int horscalefactor; + unsigned int verscalefactor; }; /* Batch header. */ @@ -276,50 +393,30 @@ struct gcbatch { gcbatchend batchend; /* State of the current operation. */ - struct gcblit gcblit; + union { + struct gcblit blit; + struct gcfilter filter; + } op; - /* Destination format. */ - struct bvformatxlate *dstformat; + /* Destination surface. */ + struct surfaceinfo dstinfo; /* Clipping deltas; used to correct the source coordinates for * single source blits. */ - int deltaleft; - int deltatop; - int deltaright; - int deltabottom; + struct gcrect clipdelta; /* Clipped destination rectangle coordinates. */ - unsigned short clippedleft; - unsigned short clippedtop; - unsigned short clippedright; - unsigned short clippedbottom; - - /* Destination base address alignment in pixels. */ - int dstalign; + struct gcrect dstclipped; + struct gcrect dstclippedaux; - /* Destination origin offset. */ + /* Destination origin offset caused by surface base misalignment. */ unsigned int dstoffsetX; unsigned int dstoffsetY; - /* Rotation angle. */ - int dstangle; - - /* Geometry size of the destination surface. */ + /* Adjusted geometry size of the destination surface. */ unsigned int dstwidth; unsigned int dstheight; - /* Physical size of the destination surface. */ - unsigned int dstphyswidth; - unsigned int dstphysheight; - - /* Computed destination rectangle coordinates; in multi-source - * setup can be modified to match new destination and source - * geometry. */ - unsigned short left; - unsigned short top; - unsigned short right; - unsigned short bottom; - /* Physical size of the matched destination and source surfaces * for multi-source setup. */ unsigned int physwidth; @@ -356,41 +453,6 @@ struct gcbatch { /******************************************************************************* - * srcinfo is used by blitters to define an array of valid sources. - */ - -struct srcinfo { - /* BLTsville source index (0 for src1 and 1 for src2). */ - int index; - - /* Source surface buffer descriptor. */ - union bvinbuff buf; - - /* Source surface geometry. */ - struct bvsurfgeom *geom; - - /* Source rectangle. */ - struct bvrect *rect; - - /* Source surface format. */ - struct bvformatxlate *format; - - /* Source rotation angle. */ - int angle; - unsigned int rot; - - /* Mirror setting. */ - unsigned int mirror; - - /* ROP. */ - unsigned short rop; - - /* Blending info. */ - struct gcalpha *gca; -}; - - -/******************************************************************************* * Internal API entries. */ @@ -398,9 +460,6 @@ struct srcinfo { struct gccontext *get_context(void); /* Parsers. */ -enum bverror parse_format(struct bvbltparams *bvbltparams, - enum ocdformat ocdformat, - struct bvformatxlate **format); enum bverror parse_blend(struct bvbltparams *bvbltparams, enum bvblend blend, struct gcalpha *gca); @@ -408,12 +467,13 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, struct gcbatch *gcbatch); enum bverror parse_source(struct bvbltparams *bvbltparams, struct gcbatch *gcbatch, - struct srcinfo *srcinfo); + struct bvrect *srcrect, + struct surfaceinfo *srcinfo); +enum bverror parse_scalemode(struct bvbltparams *bvbltparams, + struct gcbatch *batch); /* Return surface alignment offset. */ -int get_pixel_offset(struct bvbuffdesc *bvbuffdesc, - struct bvformatxlate *format, - int offset); +int get_pixel_offset(struct surfaceinfo *surfaceinfo, int offset); /* Buffer mapping. */ enum bverror do_map(struct bvbuffdesc *bvbuffdesc, @@ -440,6 +500,11 @@ enum bverror claim_buffer(struct bvbltparams *bvbltparams, unsigned int size, void **buffer); +/* Temporary buffer management. */ +enum bverror allocate_temp(struct bvbltparams *bvbltparams, + unsigned int size); +enum bverror free_temp(bool schedule); + /* Program the destination. */ enum bverror set_dst(struct bvbltparams *bltparams, struct gcbatch *batch, @@ -448,12 +513,12 @@ enum bverror set_dst(struct bvbltparams *bltparams, /* Rendering entry points. */ enum bverror do_fill(struct bvbltparams *bltparams, struct gcbatch *gcbatch, - struct srcinfo *srcinfo); + struct surfaceinfo *srcinfo); enum bverror do_blit(struct bvbltparams *bltparams, struct gcbatch *gcbatch, - struct srcinfo *srcinfo); + struct surfaceinfo *srcinfo); enum bverror do_filter(struct bvbltparams *bvbltparams, struct gcbatch *gcbatch, - struct srcinfo *srcinfo); + struct surfaceinfo *srcinfo); #endif diff --git a/drivers/misc/gcx/gcbv/gcfill.c b/drivers/misc/gcx/gcbv/gcfill.c index 475467d..a43bb63 100644 --- a/drivers/misc/gcx/gcbv/gcfill.c +++ b/drivers/misc/gcx/gcbv/gcfill.c @@ -144,13 +144,13 @@ static unsigned int getinternalcolor(void *ptr, struct bvformatxlate *format) return dstpixel; } -enum bverror do_fill(struct bvbltparams *bltparams, +enum bverror do_fill(struct bvbltparams *bvbltparams, struct gcbatch *batch, - struct srcinfo *srcinfo) + struct surfaceinfo *srcinfo) { enum bverror bverror; struct gccontext *gccontext = get_context(); - int dstbyteshift; + struct surfaceinfo *dstinfo; struct gcmofill *gcmofill; unsigned char *fillcolorptr; struct bvbuffmap *dstmap = NULL; @@ -158,35 +158,35 @@ enum bverror do_fill(struct bvbltparams *bltparams, GCENTER(GCZONE_FILL); /* Finish previous batch if any. */ - bverror = batch->batchend(bltparams, batch); + bverror = batch->batchend(bvbltparams, batch); if (bverror != BVERR_NONE) goto exit; - /* Compute the surface offset in bytes. */ - dstbyteshift = batch->dstalign * (int) batch->dstformat->bitspp / 8; + /* Get a shortcut to the destination surface. */ + dstinfo = &batch->dstinfo; /* Verify if the destination parameter have been modified. */ - if ((batch->dstbyteshift != dstbyteshift) || - (batch->physwidth != batch->dstphyswidth) || - (batch->physheight != batch->dstphysheight)) { + if ((batch->dstbyteshift != dstinfo->bytealign) || + (batch->physwidth != dstinfo->physwidth) || + (batch->physheight != dstinfo->physheight)) { /* Set new values. */ - batch->dstbyteshift = dstbyteshift; - batch->physwidth = batch->dstphyswidth; - batch->physheight = batch->dstphysheight; + batch->dstbyteshift = dstinfo->bytealign; + batch->physwidth = dstinfo->physwidth; + batch->physheight = dstinfo->physheight; /* Mark as modified. */ batch->batchflags |= BVBATCH_DST; } /* Map the destination. */ - bverror = do_map(bltparams->dstdesc, batch, &dstmap); + bverror = do_map(bvbltparams->dstdesc, batch, &dstmap); if (bverror != BVERR_NONE) { - bltparams->errdesc = gccontext->bverrorstr; + bvbltparams->errdesc = gccontext->bverrorstr; goto exit; } /* Set the new destination. */ - bverror = set_dst(bltparams, batch, dstmap); + bverror = set_dst(bvbltparams, batch, dstmap); if (bverror != BVERR_NONE) goto exit; @@ -199,7 +199,7 @@ enum bverror do_fill(struct bvbltparams *bltparams, ** Allocate command buffer. */ - bverror = claim_buffer(bltparams, batch, + bverror = claim_buffer(bvbltparams, batch, sizeof(struct gcmofill), (void **) &gcmofill); if (bverror != BVERR_NONE) @@ -232,8 +232,8 @@ enum bverror do_fill(struct bvbltparams *bltparams, fillcolorptr = (unsigned char *) srcinfo->buf.desc->virtaddr - + srcinfo->rect->top * srcinfo->geom->virtstride - + srcinfo->rect->left * srcinfo->format->bitspp / 8; + + srcinfo->rect.top * srcinfo->geom->virtstride + + srcinfo->rect.left * srcinfo->format->bitspp / 8; gcmofill->clearcolor_ldst = gcmofill_clearcolor_ldst; gcmofill->clearcolor.raw = getinternalcolor(fillcolorptr, @@ -246,24 +246,24 @@ enum bverror do_fill(struct bvbltparams *bltparams, /* Set destination configuration. */ gcmofill->dstconfig_ldst = gcmofill_dstconfig_ldst; gcmofill->dstconfig.raw = 0; - gcmofill->dstconfig.reg.swizzle = batch->dstformat->swizzle; - gcmofill->dstconfig.reg.format = batch->dstformat->format; + gcmofill->dstconfig.reg.swizzle = dstinfo->format->swizzle; + gcmofill->dstconfig.reg.format = dstinfo->format->format; gcmofill->dstconfig.reg.command = GCREG_DEST_CONFIG_COMMAND_CLEAR; /* Set ROP3. */ gcmofill->rop_ldst = gcmofill_rop_ldst; gcmofill->rop.raw = 0; gcmofill->rop.reg.type = GCREG_ROP_TYPE_ROP3; - gcmofill->rop.reg.fg = (unsigned char) bltparams->op.rop; + gcmofill->rop.reg.fg = (unsigned char) bvbltparams->op.rop; /* Set START_DE command. */ gcmofill->startde.cmd.fld = gcfldstartde; /* Set destination rectangle. */ - gcmofill->rect.left = batch->clippedleft + batch->dstoffsetX; - gcmofill->rect.top = batch->clippedtop + batch->dstoffsetY; - gcmofill->rect.right = batch->clippedright + batch->dstoffsetX; - gcmofill->rect.bottom = batch->clippedbottom + batch->dstoffsetY; + gcmofill->rect.left = batch->dstclipped.left + batch->dstoffsetX; + gcmofill->rect.top = batch->dstclipped.top + batch->dstoffsetY; + gcmofill->rect.right = batch->dstclipped.right + batch->dstoffsetX; + gcmofill->rect.bottom = batch->dstclipped.bottom + batch->dstoffsetY; exit: GCEXITARG(GCZONE_FILL, "bv%s = %d\n", diff --git a/drivers/misc/gcx/gcbv/gcfilter.c b/drivers/misc/gcx/gcbv/gcfilter.c index aa1c11e..d2dc438 100644 --- a/drivers/misc/gcx/gcbv/gcfilter.c +++ b/drivers/misc/gcx/gcbv/gcfilter.c @@ -56,73 +56,1252 @@ #define GCZONE_NONE 0 #define GCZONE_ALL (~0U) -#define GCZONE_FILTER (1 << 11) +#define GCZONE_KERNEL (1 << 0) +#define GCZONE_FILTER (1 << 1) +#define GCZONE_BLEND (1 << 2) +#define GCZONE_TYPE (1 << 3) GCDBG_FILTERDEF(gcfilter, GCZONE_NONE, - "filter") + "kernel", + "filter", + "blend", + "type") -enum bverror do_filter(struct bvbltparams *bltparams, + +/******************************************************************************* + * Miscellaneous defines. + */ + +#define GC_BITS_PER_CACHELINE (64 * 8) + + +/******************************************************************************* + * Scale factor format: unsigned 1.31 fixed point. + */ + +#define GC_SCALE_TYPE unsigned int +#define GC_SCALE_FRACTION 31 +#define GC_SCALE_ONE ((GC_SCALE_TYPE) (1 << GC_SCALE_FRACTION)) + + +/******************************************************************************* + * X coordinate format: signed 4.28 fixed point. + */ + +#define GC_COORD_TYPE int +#define GC_COORD_FRACTION 28 +#define GC_COORD_PI ((GC_COORD_TYPE) 0x3243F6C0) +#define GC_COORD_2OVERPI ((GC_COORD_TYPE) 0x0A2F9832) +#define GC_COORD_PIOVER2 ((GC_COORD_TYPE) 0x1921FB60) +#define GC_COORD_ZERO ((GC_COORD_TYPE) 0) +#define GC_COORD_HALF ((GC_COORD_TYPE) (1 << (GC_COORD_FRACTION - 1))) +#define GC_COORD_ONE ((GC_COORD_TYPE) (1 << GC_COORD_FRACTION)) +#define GC_COORD_NEGONE ((GC_COORD_TYPE) (~GC_COORD_ONE + 1)) +#define GC_COORD_SUBPIX_STEP ((GC_COORD_TYPE) \ + (1 << (GC_COORD_FRACTION - GC_PHASE_BITS))) + + +/******************************************************************************* + * Hardware coefficient format: signed 2.14 fixed point. + */ + +#define GC_COEF_TYPE short +#define GC_COEF_FRACTION 14 +#define GC_COEF_ZERO ((GC_COEF_TYPE) 0) +#define GC_COEF_ONE ((GC_COEF_TYPE) (1 << GC_COEF_FRACTION)) +#define GC_COEF_NEGONE ((GC_COEF_TYPE) (~GC_COEF_ONE + 1)) + + +/******************************************************************************* + * Weight sum format: x.28 fixed point. + */ + +#define GC_SUM_TYPE long long +#define GC_SUM_FRACTION GC_COORD_FRACTION + + +/******************************************************************************* + * Math shortcuts. + */ + +#define computescale(dstsize, srcsize) ((GC_SCALE_TYPE) \ + div_u64(((u64) (dstsize)) << GC_SCALE_FRACTION, (srcsize)) \ +) + +#define normweight(weight, sum) ((GC_COORD_TYPE) \ + div64_s64(((s64) (weight)) << GC_COORD_FRACTION, (sum)) \ +) + +#define convertweight(weight) ((GC_COEF_TYPE) \ + ((weight) >> (GC_COORD_FRACTION - GC_COEF_FRACTION)) \ +) + + +/******************************************************************************* + * Fixed point SINE function. Takes a positive value in range [0..pi/2]. + */ + +static GC_COORD_TYPE sine(GC_COORD_TYPE x) +{ + static const GC_COORD_TYPE sinetable[] = { + 0x00000000, 0x001FFFEB, 0x003FFF55, 0x005FFDC0, + 0x007FFAAB, 0x009FF596, 0x00BFEE01, 0x00DFE36C, + 0x00FFD557, 0x011FC344, 0x013FACB2, 0x015F9120, + 0x017F7010, 0x019F4902, 0x01BF1B78, 0x01DEE6F2, + 0x01FEAAEE, 0x021E66F0, 0x023E1A7C, 0x025DC50C, + 0x027D6624, 0x029CFD48, 0x02BC89F8, 0x02DC0BB8, + 0x02FB8204, 0x031AEC64, 0x033A4A5C, 0x03599B64, + 0x0378DF08, 0x039814CC, 0x03B73C2C, 0x03D654B0, + 0x03F55DDC, 0x04145730, 0x04334030, 0x04521868, + 0x0470DF58, 0x048F9488, 0x04AE3770, 0x04CCC7A8, + 0x04EB44A8, 0x0509ADF8, 0x05280328, 0x054643B0, + 0x05646F28, 0x05828508, 0x05A084E0, 0x05BE6E38, + 0x05DC4098, 0x05F9FB80, 0x06179E88, 0x06352928, + 0x06529AF8, 0x066FF380, 0x068D3248, 0x06AA56D8, + 0x06C760C0, 0x06E44F90, 0x070122C8, 0x071DD9F8, + 0x073A74B8, 0x0756F290, 0x07735308, 0x078F95B0, + 0x07ABBA20, 0x07C7BFD8, 0x07E3A678, 0x07FF6D88, + 0x081B14A0, 0x08369B40, 0x08520110, 0x086D4590, + 0x08886860, 0x08A36910, 0x08BE4730, 0x08D90250, + 0x08F39A20, 0x090E0E10, 0x09285DD0, 0x094288E0, + 0x095C8EF0, 0x09766F90, 0x09902A60, 0x09A9BEE0, + 0x09C32CC0, 0x09DC7390, 0x09F592F0, 0x0A0E8A70, + 0x0A2759C0, 0x0A400070, 0x0A587E20, 0x0A70D270, + 0x0A88FD00, 0x0AA0FD60, 0x0AB8D350, 0x0AD07E50, + 0x0AE7FE10, 0x0AFF5230, 0x0B167A50, 0x0B2D7610, + 0x0B444520, 0x0B5AE730, 0x0B715BC0, 0x0B87A290, + 0x0B9DBB40, 0x0BB3A580, 0x0BC960F0, 0x0BDEED30, + 0x0BF44A00, 0x0C0976F0, 0x0C1E73D0, 0x0C334020, + 0x0C47DBB0, 0x0C5C4620, 0x0C707F20, 0x0C848660, + 0x0C985B80, 0x0CABFE50, 0x0CBF6E60, 0x0CD2AB80, + 0x0CE5B550, 0x0CF88B80, 0x0D0B2DE0, 0x0D1D9C10, + 0x0D2FD5C0, 0x0D41DAB0, 0x0D53AAA0, 0x0D654540, + 0x0D76AA40, 0x0D87D970, 0x0D98D280, 0x0DA99530, + 0x0DBA2140, 0x0DCA7650, 0x0DDA9450, 0x0DEA7AD0, + 0x0DFA29B0, 0x0E09A0B0, 0x0E18DF80, 0x0E27E5F0, + 0x0E36B3C0, 0x0E4548B0, 0x0E53A490, 0x0E61C720, + 0x0E6FB020, 0x0E7D5F70, 0x0E8AD4C0, 0x0E980FF0, + 0x0EA510B0, 0x0EB1D6F0, 0x0EBE6260, 0x0ECAB2D0, + 0x0ED6C810, 0x0EE2A200, 0x0EEE4070, 0x0EF9A310, + 0x0F04C9E0, 0x0F0FB490, 0x0F1A6300, 0x0F24D510, + 0x0F2F0A80, 0x0F390340, 0x0F42BF10, 0x0F4C3DE0, + 0x0F557F70, 0x0F5E83C0, 0x0F674A80, 0x0F6FD3B0, + 0x0F781F20, 0x0F802CB0, 0x0F87FC40, 0x0F8F8DA0, + 0x0F96E0D0, 0x0F9DF5B0, 0x0FA4CC00, 0x0FAB63D0, + 0x0FB1BCF0, 0x0FB7D740, 0x0FBDB2B0, 0x0FC34F30, + 0x0FC8ACA0, 0x0FCDCAF0, 0x0FD2AA10, 0x0FD749E0, + 0x0FDBAA50, 0x0FDFCB50, 0x0FE3ACD0, 0x0FE74EC0, + 0x0FEAB110, 0x0FEDD3C0, 0x0FF0B6B0, 0x0FF359F0, + 0x0FF5BD50, 0x0FF7E0E0, 0x0FF9C490, 0x0FFB6850, + 0x0FFCCC30, 0x0FFDF010, 0x0FFED400, 0x0FFF77F0, + 0x0FFFDBF0, 0x0FFFFFE0, 0x0FFFE3D0, 0x0FFF87D0, + 0x0FFEEBC0, 0x0FFE0FC0, 0x0FFCF3D0, 0x0FFB97E0 + }; + + static const unsigned int indexwidth = 8; + static const unsigned int intwidth = 1; + static const unsigned int indexshift = intwidth + + GC_COORD_FRACTION + - indexwidth; + + unsigned int p1, p2; + GC_COORD_TYPE p1x, p2x; + GC_COORD_TYPE p1y, p2y; + GC_COORD_TYPE dx, dy; + GC_COORD_TYPE a, b; + GC_COORD_TYPE result; + + /* Determine the indices of two closest points in the table. */ + p1 = ((unsigned int) x) >> indexshift; + p2 = p1 + 1; + + if ((p1 >= countof(sinetable)) || (p2 >= countof(sinetable))) { + GCERR("invalid table index.\n"); + return GC_COORD_ZERO; + } + + /* Determine the coordinates of the two closest points. */ + p1x = p1 << indexshift; + p2x = p2 << indexshift; + + p1y = sinetable[p1]; + p2y = sinetable[p2]; + + /* Determine the deltas. */ + dx = p2x - p1x; + dy = p2y - p1y; + + /* Find the slope and the y-intercept. */ + b = (GC_COORD_TYPE) div64_s64(((s64) dy) << GC_COORD_FRACTION, dx); + a = p1y - (GC_COORD_TYPE) (((s64) b * p1x) >> GC_COORD_FRACTION); + + /* Compute the result. */ + result = a + (GC_COORD_TYPE) (((s64) b * x) >> GC_COORD_FRACTION); + return result; +} + + +/******************************************************************************* + * SINC function used in filter kernel generation. + */ + +static GC_COORD_TYPE sinc_filter(GC_COORD_TYPE x, int radius) +{ + GC_COORD_TYPE result; + s64 radius64; + s64 pit, pitd; + s64 normpit, normpitd; + int negpit, negpitd; + int quadpit, quadpitd; + GC_COORD_TYPE sinpit, sinpitd; + GC_COORD_TYPE f1, f2; + + if (x == GC_COORD_ZERO) + return GC_COORD_ONE; + + radius64 = abs(radius) << GC_COORD_FRACTION; + if (x > radius64) + return GC_COORD_ZERO; + + pit = (((s64) GC_COORD_PI) * x) >> GC_COORD_FRACTION; + pitd = div_s64(pit, radius); + + /* Sine table only has values for the first positive quadrant, + * remove the sign here. */ + if (pit < 0) { + normpit = -pit; + negpit = 1; + } else { + normpit = pit; + negpit = 0; + } + + if (pitd < 0) { + normpitd = -pitd; + negpitd = 1; + } else { + normpitd = pitd; + negpitd = 0; + } + + /* Determine which quadrant we are in. */ + quadpit = (int) ((normpit * GC_COORD_2OVERPI) + >> (2 * GC_COORD_FRACTION)); + quadpitd = (int) ((normpitd * GC_COORD_2OVERPI) + >> (2 * GC_COORD_FRACTION)); + + /* Move coordinates to the first quadrant. */ + normpit -= (s64) GC_COORD_PIOVER2 * quadpit; + normpitd -= (s64) GC_COORD_PIOVER2 * quadpitd; + + /* Normalize the quadrant numbers. */ + quadpit %= 4; + quadpitd %= 4; + + /* Flip the coordinates if necessary. */ + if ((quadpit == 1) || (quadpit == 3)) + normpit = GC_COORD_PIOVER2 - normpit; + + if ((quadpitd == 1) || (quadpitd == 3)) + normpitd = GC_COORD_PIOVER2 - normpitd; + + sinpit = sine(normpit); + sinpitd = sine(normpitd); + + /* Negate depending on the quadrant. */ + if (negpit) { + if ((quadpit == 0) || (quadpit == 1)) + sinpit = -sinpit; + } else { + if ((quadpit == 2) || (quadpit == 3)) + sinpit = -sinpit; + } + + if (negpitd) { + if ((quadpitd == 0) || (quadpitd == 1)) + sinpitd = -sinpitd; + } else { + if ((quadpitd == 2) || (quadpitd == 3)) + sinpitd = -sinpitd; + } + + f1 = (GC_COORD_TYPE) + div64_s64(((s64) sinpit) << GC_COORD_FRACTION, pit); + f2 = (GC_COORD_TYPE) + div64_s64(((s64) sinpitd) << GC_COORD_FRACTION, pitd); + + result = (GC_COORD_TYPE) ((((s64) f1) * f2) + >> GC_COORD_FRACTION); + + return result; +} + + +/******************************************************************************* + * Filter kernel generator based on SINC function. + */ + +static void calculate_sync_filter(struct gcfilterkernel *gcfilterkernel) +{ + GC_SCALE_TYPE scale; + GC_COORD_TYPE subpixset[GC_TAP_COUNT]; + GC_COORD_TYPE subpixeloffset; + GC_COORD_TYPE x, weight; + GC_SUM_TYPE weightsum; + short convweightsum; + int kernelhalf, padding; + int subpixpos, kernelpos; + short *kernelarray; + short count, adjustfrom, adjustment; + int index; + + /* Compute the scale factor. */ + scale = (gcfilterkernel->dstsize >= gcfilterkernel->srcsize) + ? GC_SCALE_ONE + : computescale(gcfilterkernel->dstsize, gcfilterkernel->srcsize); + + /* Calculate the kernel half. */ + kernelhalf = (int) (gcfilterkernel->kernelsize >> 1); + + /* Init the subpixel offset. */ + subpixeloffset = GC_COORD_HALF; + + /* Determine kernel padding size. */ + padding = (GC_TAP_COUNT - gcfilterkernel->kernelsize) / 2; + + /* Set initial kernel array pointer. */ + kernelarray = gcfilterkernel->kernelarray; + + /* Loop through each subpixel. */ + for (subpixpos = 0; subpixpos < GC_PHASE_LOAD_COUNT; subpixpos += 1) { + /* Compute weights. */ + weightsum = GC_COORD_ZERO; + for (kernelpos = 0; kernelpos < GC_TAP_COUNT; kernelpos += 1) { + /* Determine the current index. */ + index = kernelpos - padding; + + /* Pad with zeros left side. */ + if (index < 0) { + subpixset[kernelpos] = GC_COORD_ZERO; + continue; + } + + /* Pad with zeros right side. */ + if (index >= (int) gcfilterkernel->kernelsize) { + subpixset[kernelpos] = GC_COORD_ZERO; + continue; + } + + /* "Filter off" case. */ + if (gcfilterkernel->kernelsize == 1) { + subpixset[kernelpos] = GC_COORD_ONE; + + /* Update the sum of the weights. */ + weightsum += GC_COORD_ONE; + continue; + } + + /* Compute X coordinate. */ + x = ((index - kernelhalf) << GC_COORD_FRACTION) + + subpixeloffset; + + /* Scale the coordinate. */ + x = (GC_COORD_TYPE) + ((((s64) x) * scale) >> GC_SCALE_FRACTION); + + /* Compute the weight. */ + subpixset[kernelpos] = sinc_filter(x, kernelhalf); + + /* Update the sum of the weights. */ + weightsum += subpixset[kernelpos]; + } + + /* Convert the weights to the hardware format. */ + convweightsum = 0; + for (kernelpos = 0; kernelpos < GC_TAP_COUNT; kernelpos += 1) { + /* Normalize the current weight. */ + weight = normweight(subpixset[kernelpos], weightsum); + + /* Convert the weight to fixed point. */ + if (weight == GC_COORD_ZERO) + kernelarray[kernelpos] = GC_COEF_ZERO; + else if (weight >= GC_COORD_ONE) + kernelarray[kernelpos] = GC_COEF_ONE; + else if (weight <= GC_COORD_NEGONE) + kernelarray[kernelpos] = GC_COEF_NEGONE; + else + kernelarray[kernelpos] = convertweight(weight); + + /* Compute the sum of all coefficients. */ + convweightsum += kernelarray[kernelpos]; + } + + /* Adjust the fixed point coefficients so that the sum is 1. */ + count = GC_COEF_ONE - convweightsum; + if (count < 0) { + count = -count; + adjustment = -1; + } else { + adjustment = 1; + } + + if (count > GC_TAP_COUNT) { + GCERR("adjust count is too high = %d\n", count); + } else { + adjustfrom = (GC_TAP_COUNT - count) / 2; + for (kernelpos = 0; kernelpos < count; kernelpos += 1) + kernelarray[adjustfrom + kernelpos] + += adjustment; + } + + /* Advance the array pointer. */ + kernelarray += GC_TAP_COUNT; + + /* Advance to the next subpixel. */ + subpixeloffset -= GC_COORD_SUBPIX_STEP; + } +} + + +/******************************************************************************* + * Loads a filter into the GPU. + */ + +static enum bverror load_filter(struct bvbltparams *bvbltparams, + struct gcbatch *batch, + enum gcfiltertype type, + unsigned int kernelsize, + unsigned int scalefactor, + unsigned int srcsize, + unsigned int dstsize, + struct gccmdldstate arraystate) +{ + enum bverror bverror = BVERR_NONE; + struct gccontext *gccontext = get_context(); + struct gcfiltercache *filtercache; + struct list_head *filterlist; + struct list_head *filterhead; + struct gcfilterkernel *gcfilterkernel; + struct gcmofilterkernel *gcmofilterkernel; + + GCDBG(GCZONE_KERNEL, "kernelsize = %d\n", kernelsize); + GCDBG(GCZONE_KERNEL, "srcsize = %d\n", srcsize); + GCDBG(GCZONE_KERNEL, "dstsize = %d\n", dstsize); + + /* Is the filter already loaded? */ + if ((gccontext->loadedfilter != NULL) && + (gccontext->loadedfilter->type == type) && + (gccontext->loadedfilter->kernelsize == kernelsize) && + (gccontext->loadedfilter->scalefactor == scalefactor)) { + GCDBG(GCZONE_KERNEL, "filter already computed.\n"); + gcfilterkernel = gccontext->loadedfilter; + goto load; + } + + /* Get the proper filter cache. */ + filtercache = &gccontext->filtercache[type][kernelsize]; + filterlist = &filtercache->list; + + /* Try to find existing filter. */ + GCDBG(GCZONE_KERNEL, "scanning for existing filter.\n"); + list_for_each(filterhead, filterlist) { + gcfilterkernel = list_entry(filterhead, + struct gcfilterkernel, + link); + if (gcfilterkernel->scalefactor == scalefactor) { + GCDBG(GCZONE_KERNEL, "filter found @ 0x%08X.\n", + (unsigned int) gcfilterkernel); + break; + } + } + + /* Found the filter? */ + if (filterhead != filterlist) { + /* Move the filter to the head of the list. */ + if (filterlist->next != filterhead) { + GCDBG(GCZONE_KERNEL, "moving to the head.\n"); + list_move(filterhead, filterlist); + } + } else { + GCDBG(GCZONE_KERNEL, "filter not found.\n"); + if (filtercache->count == GC_FILTER_CACHE_MAX) { + GCDBG(GCZONE_KERNEL, + "reached the maximum number of filters.\n"); + filterhead = filterlist->prev; + list_move(filterhead, filterlist); + + gcfilterkernel = list_entry(filterhead, + struct gcfilterkernel, + link); + } else { + GCDBG(GCZONE_KERNEL, "allocating new filter.\n"); + gcfilterkernel = gcalloc(struct gcfilterkernel, + sizeof(struct gcfilterkernel)); + if (gcfilterkernel == NULL) { + BVSETBLTERROR(BVERR_OOM, + "filter allocation failed"); + goto exit; + } + + list_add(&gcfilterkernel->link, filterlist); + } + + /* Update the number of filters. */ + filtercache->count += 1; + + /* Initialize the filter. */ + gcfilterkernel->type = type; + gcfilterkernel->kernelsize = kernelsize; + gcfilterkernel->srcsize = srcsize; + gcfilterkernel->dstsize = dstsize; + gcfilterkernel->scalefactor = scalefactor; + + /* Compute the coefficients. */ + calculate_sync_filter(gcfilterkernel); + } + +load: + /* Load the filter. */ + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmofilterkernel), + (void **) &gcmofilterkernel); + if (bverror != BVERR_NONE) + goto exit; + + gcmofilterkernel->kernelarray_ldst = arraystate; + memcpy(&gcmofilterkernel->kernelarray, + gcfilterkernel->kernelarray, + sizeof(gcfilterkernel->kernelarray)); + + /* Set the filter. */ + gccontext->loadedfilter = gcfilterkernel; + +exit: + return bverror; +} + + +/******************************************************************************* + * Compute the scale factor. + */ + +static inline unsigned int get_scale_factor(unsigned int srcsize, + unsigned int dstsize) +{ + if ((srcsize <= 1) || (dstsize <= 1)) + return 0; + + return ((srcsize - 1) << 16) / (dstsize - 1); +} + + +/******************************************************************************* + * Rasterizer setup. + */ + +static enum bverror startvr(struct bvbltparams *bvbltparams, + struct gcbatch *batch, + struct bvbuffmap *srcmap, + struct bvbuffmap *dstmap, + struct surfaceinfo *srcinfo, + struct surfaceinfo *dstinfo, + unsigned int srcx, + unsigned int srcy, + struct gcrect *dstrect, + struct gcregvrconfig config, + bool prepass) +{ + enum bverror bverror; + struct gccontext *gccontext = get_context(); + struct gcalpha *gca; + + struct gcmovrdst *gcmovrdst; + struct gcmovrsrc *gcmovrsrc; + struct gcmoalphaoff *gcmoalphaoff; + struct gcmoalpha *gcmoalpha; + struct gcmoglobal *gcmoglobal; + struct gcmostartvr *gcmostartvr; + + struct gcrect srcrect; + int srcpixalign, srcbytealign; + int srcsurfwidth, srcsurfheight; + + GCENTER(GCZONE_FILTER); + + /*********************************************************************** + * Program the destination. + */ + + /* Allocate command buffer. */ + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmovrdst), + (void **) &gcmovrdst); + if (bverror != BVERR_NONE) + goto exit; + + /* Add the address fixup. */ + add_fixup(bvbltparams, batch, &gcmovrdst->address, dstinfo->bytealign); + + /* Set surface parameters. */ + gcmovrdst->config_ldst = gcmovrdst_config_ldst; + gcmovrdst->address = GET_MAP_HANDLE(dstmap); + gcmovrdst->stride = dstinfo->geom->virtstride; + gcmovrdst->config.raw = 0; + gcmovrdst->config.reg.swizzle = dstinfo->format->swizzle; + gcmovrdst->config.reg.format = dstinfo->format->format; + + /* Set surface width and height. */ + gcmovrdst->rotation.raw = 0; + gcmovrdst->rotation.reg.surf_width = dstinfo->physwidth; + gcmovrdst->rotationheight_ldst = gcmovrdst_rotationheight_ldst; + gcmovrdst->rotationheight.raw = 0; + gcmovrdst->rotationheight.reg.height = dstinfo->physheight; + + /*********************************************************************** + * Program the source. + */ + + /* Initialize the source rectangle. */ + srcrect.left = srcinfo->rect.left; + srcrect.top = srcinfo->rect.top; + srcrect.right = srcinfo->rect.right; + srcrect.bottom = srcinfo->rect.bottom; + + /* Compute the source alignments needed to compensate + * for the surface base address misalignment if any. */ + srcpixalign = get_pixel_offset(srcinfo, 0); + srcbytealign = (srcpixalign * (int) srcinfo->format->bitspp) / 8; + + switch (srcinfo->angle) { + case ROT_ANGLE_0: + /* Adjust the source rectangle. */ + srcrect.left -= srcpixalign; + srcrect.right -= srcpixalign; + srcx -= (srcpixalign << 16); + + /* Determine source size. */ + srcsurfwidth = srcinfo->geom->width - srcpixalign; + srcsurfheight = srcinfo->geom->height; + break; + + case ROT_ANGLE_90: + /* Adjust the source rectangle. */ + srcrect.top -= srcpixalign; + srcrect.bottom -= srcpixalign; + srcy -= (srcpixalign << 16); + + /* Determine source size. */ + srcsurfwidth = srcinfo->geom->height - srcpixalign; + srcsurfheight = srcinfo->geom->width; + break; + + case ROT_ANGLE_180: + /* Determine source size. */ + srcsurfwidth = srcinfo->geom->width - srcpixalign; + srcsurfheight = srcinfo->geom->height; + break; + + case ROT_ANGLE_270: + /* Determine source size. */ + srcsurfwidth = srcinfo->geom->height - srcpixalign; + srcsurfheight = srcinfo->geom->width; + break; + + default: + srcsurfwidth = 0; + srcsurfheight = 0; + } + + /* Allocate command buffer. */ + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmovrsrc), + (void **) &gcmovrsrc); + if (bverror != BVERR_NONE) + goto exit; + + add_fixup(bvbltparams, batch, &gcmovrsrc->address, srcbytealign); + + gcmovrsrc->config_ldst = gcmovrsrc_config_ldst; + + gcmovrsrc->address = GET_MAP_HANDLE(srcmap); + gcmovrsrc->stride = srcinfo->geom->virtstride; + + gcmovrsrc->rotation.raw = 0; + gcmovrsrc->rotation.reg.surf_width = srcsurfwidth; + + gcmovrsrc->config.raw = 0; + gcmovrsrc->config.reg.swizzle = srcinfo->format->swizzle; + gcmovrsrc->config.reg.format = srcinfo->format->format; + + if (gccontext->gcfeatures2.reg.l2cachefor420 && + ((srcinfo->format->type & BVFMT_PLANAR) != 0) && + ((srcinfo->angle & 1) != 0)) + gcmovrsrc->config.reg.disable420L2cache + = GCREG_SRC_CONFIG_DISABLE420_L2_CACHE_DISABLED; + + gcmovrsrc->pos_ldst = gcmovrsrc_pos_ldst; + + /* Source image bounding box. */ + gcmovrsrc->lt.reg.left = srcrect.left; + gcmovrsrc->lt.reg.top = srcrect.top; + gcmovrsrc->rb.reg.right = srcrect.right; + gcmovrsrc->rb.reg.bottom = srcrect.bottom; + + /* Fractional origin. */ + gcmovrsrc->x = srcx; + gcmovrsrc->y = srcy; + + /* Program rotation. */ + gcmovrsrc->rotation_ldst = gcmovrsrc_rotation_ldst; + gcmovrsrc->rotationheight.reg.height = srcsurfheight; + gcmovrsrc->rotationangle.raw = 0; + gcmovrsrc->rotationangle.reg.src = rotencoding[srcinfo->angle]; + gcmovrsrc->rotationangle.reg.dst = rotencoding[dstinfo->angle]; + + if (prepass) { + gcmovrsrc->rotationangle.reg.src_mirror = GCREG_MIRROR_NONE; + gcmovrsrc->rotationangle.reg.dst_mirror = GCREG_MIRROR_NONE; + } else { + gcmovrsrc->rotationangle.reg.src_mirror = srcinfo->mirror; + gcmovrsrc->rotationangle.reg.dst_mirror = dstinfo->mirror; + } + + gcmovrsrc->rop_ldst = gcmovrsrc_rop_ldst; + gcmovrsrc->rop.raw = 0; + gcmovrsrc->rop.reg.type = GCREG_ROP_TYPE_ROP3; + gcmovrsrc->rop.reg.fg = 0xCC; + + /* Program multiply modes. */ + gcmovrsrc->mult_ldst = gcmovrsrc_mult_ldst; + gcmovrsrc->mult.raw = 0; + gcmovrsrc->mult.reg.srcglobalpremul + = GCREG_COLOR_MULTIPLY_MODES_SRC_GLOBAL_PREMULTIPLY_DISABLE; + + if ((srcinfo->geom->format & OCDFMTDEF_NON_PREMULT) != 0) + gcmovrsrc->mult.reg.srcpremul + = GCREG_COLOR_MULTIPLY_MODES_SRC_PREMULTIPLY_ENABLE; + else + gcmovrsrc->mult.reg.srcpremul + = GCREG_COLOR_MULTIPLY_MODES_SRC_PREMULTIPLY_DISABLE; + + if ((dstinfo->geom->format & OCDFMTDEF_NON_PREMULT) != 0) { + gcmovrsrc->mult.reg.dstpremul + = GCREG_COLOR_MULTIPLY_MODES_SRC_PREMULTIPLY_ENABLE; + + gcmovrsrc->mult.reg.dstdemul + = GCREG_COLOR_MULTIPLY_MODES_DST_DEMULTIPLY_ENABLE; + } else { + gcmovrsrc->mult.reg.dstpremul + = GCREG_COLOR_MULTIPLY_MODES_SRC_PREMULTIPLY_DISABLE; + + gcmovrsrc->mult.reg.dstdemul + = GCREG_COLOR_MULTIPLY_MODES_DST_DEMULTIPLY_DISABLE; + } + + if (srcinfo->format->format == GCREG_DE_FORMAT_NV12) { + struct gcmoxsrcyuv *gcmoxsrcyuv; + int index = 0; + int uvshift; + + uvshift = srcbytealign + + srcinfo->geom->virtstride + * srcinfo->geom->height; + GCDBG(GCZONE_FILTER, " uvshift = 0x%08X (%d)\n", + uvshift, uvshift); + + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmoxsrcyuv), + (void **) &gcmoxsrcyuv); + if (bverror != BVERR_NONE) + goto exit; + + gcmoxsrcyuv->uplaneaddress_ldst = + gcmoxsrcyuv_uplaneaddress_ldst[index]; + gcmoxsrcyuv->uplaneaddress = GET_MAP_HANDLE(srcmap); + add_fixup(bvbltparams, batch, &gcmoxsrcyuv->uplaneaddress, + uvshift); + + gcmoxsrcyuv->uplanestride_ldst = + gcmoxsrcyuv_uplanestride_ldst[index]; + gcmoxsrcyuv->uplanestride = srcinfo->geom->virtstride; + + gcmoxsrcyuv->vplaneaddress_ldst = + gcmoxsrcyuv_vplaneaddress_ldst[index]; + gcmoxsrcyuv->vplaneaddress = GET_MAP_HANDLE(srcmap); + add_fixup(bvbltparams, batch, &gcmoxsrcyuv->vplaneaddress, + uvshift); + + gcmoxsrcyuv->vplanestride_ldst = + gcmoxsrcyuv_vplanestride_ldst[index]; + gcmoxsrcyuv->vplanestride = srcinfo->geom->virtstride; + + gcmoxsrcyuv->pectrl_ldst = + gcmoxsrcyuv_pectrl_ldst[index]; + gcmoxsrcyuv->pectrl = GCREG_PE_CONTROL_ResetValue; + } + + /*********************************************************************** + * Program blending. + */ + + gca = srcinfo->gca; + if (prepass || (gca == NULL)) { + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmoalphaoff), + (void **) &gcmoalphaoff); + if (bverror != BVERR_NONE) + goto exit; + + gcmoalphaoff->control_ldst = gcmoalphaoff_control_ldst; + gcmoalphaoff->control.reg = gcregalpha_off; + + GCDBG(GCZONE_BLEND, "blending disabled.\n"); + } else { + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmoalpha), + (void **) &gcmoalpha); + if (bverror != BVERR_NONE) + goto exit; + + gcmoalpha->config_ldst = gcmoalpha_config_ldst; + gcmoalpha->control.reg = gcregalpha_on; + + gcmoalpha->mode.raw = 0; + gcmoalpha->mode.reg.src_global_alpha_mode + = gca->src_global_alpha_mode; + gcmoalpha->mode.reg.dst_global_alpha_mode + = gca->dst_global_alpha_mode; + + gcmoalpha->mode.reg.src_blend + = gca->srcconfig->factor_mode; + gcmoalpha->mode.reg.src_color_reverse + = gca->srcconfig->color_reverse; + + gcmoalpha->mode.reg.dst_blend + = gca->dstconfig->factor_mode; + gcmoalpha->mode.reg.dst_color_reverse + = gca->dstconfig->color_reverse; + + GCDBG(GCZONE_BLEND, "dst blend:\n"); + GCDBG(GCZONE_BLEND, " factor = %d\n", + gcmoalpha->mode.reg.dst_blend); + GCDBG(GCZONE_BLEND, " inverse = %d\n", + gcmoalpha->mode.reg.dst_color_reverse); + + GCDBG(GCZONE_BLEND, "src blend:\n"); + GCDBG(GCZONE_BLEND, " factor = %d\n", + gcmoalpha->mode.reg.src_blend); + GCDBG(GCZONE_BLEND, " inverse = %d\n", + gcmoalpha->mode.reg.src_color_reverse); + + if ((gca->src_global_alpha_mode + != GCREG_GLOBAL_ALPHA_MODE_NORMAL) || + (gca->dst_global_alpha_mode + != GCREG_GLOBAL_ALPHA_MODE_NORMAL)) { + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmoglobal), + (void **) &gcmoglobal); + if (bverror != BVERR_NONE) + goto exit; + + gcmoglobal->color_ldst = gcmoglobal_color_ldst; + gcmoglobal->srcglobal.raw = gca->src_global_color; + gcmoglobal->dstglobal.raw = gca->dst_global_color; + } + } + + + /*********************************************************************** + * Start the operation. + */ + + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmostartvr), + (void **) &gcmostartvr); + if (bverror != BVERR_NONE) + goto exit; + + gcmostartvr->scale_ldst = gcmostartvr_scale_ldst; + gcmostartvr->scalex = batch->op.filter.horscalefactor; + gcmostartvr->scaley = batch->op.filter.verscalefactor; + + gcmostartvr->rect_ldst = gcmostartvr_rect_ldst; + gcmostartvr->lt.left = dstrect->left; + gcmostartvr->lt.top = dstrect->top; + gcmostartvr->rb.right = dstrect->right; + gcmostartvr->rb.bottom = dstrect->bottom; + + gcmostartvr->config_ldst = gcmostartvr_config_ldst; + gcmostartvr->config = config; + +exit: + GCEXITARG(GCZONE_FILTER, "bv%s = %d\n", + (bverror == BVERR_NONE) ? "result" : "error", bverror); + return bverror; +} + + +/******************************************************************************* + * Main fiter entry. + */ + +enum bverror do_filter(struct bvbltparams *bvbltparams, struct gcbatch *batch, - struct srcinfo *srcinfo) + struct surfaceinfo *srcinfo) { -/* enum bverror bverror = BVERR_NONE;*/ - int verpass; + enum bverror bverror = BVERR_NONE; + struct gccontext *gccontext = get_context(); + + struct surfaceinfo *dstinfo; + struct bvrect *dstrect; + struct gcrect *dstrectclipped; + struct gcrect dstadjusted; + int dstleftoffs, dsttopoffs, dstrightoffs; + int srcleftoffs, srctopoffs, srcrightoffs; + + struct bvbuffmap *srcmap = NULL; + struct bvbuffmap *tmpmap = NULL; + struct bvbuffmap *dstmap = NULL; + + struct gcmovrconfigex *gcmovrconfigex; + + unsigned int srcx, srcy; + unsigned int srcwidth, srcheight; + unsigned int horscalefactor, verscalefactor; + unsigned int kernelsize; + int horpass, verpass; GCENTER(GCZONE_FILTER); + /* Additional stride requirements. */ + if (srcinfo->format->format == GCREG_DE_FORMAT_NV12) { + /* Nv12 may be shifted up to 32 bytes for alignment. + * In the worst case stride must be 32 bytes greater. + */ + int min_stride = srcinfo->geom->width + 32; + + if (srcinfo->geom->virtstride < min_stride) { + BVSETBLTERROR((srcinfo->index == 0) + ? BVERR_SRC1GEOM_STRIDE + : BVERR_SRC2GEOM_STRIDE, + "nv12 source stride too small (%ld < %d)\n", + srcinfo->geom->virtstride, + min_stride); + goto exit; + } + } + + /* Determine the destination rectangle. */ + if ((srcinfo->index == 1) && + ((bvbltparams->flags & BVFLAG_SRC2_AUXDSTRECT) != 0)) { + dstrect = &bvbltparams->src2auxdstrect; + dstrectclipped = &batch->dstclippedaux; + } else { + dstrect = &bvbltparams->dstrect; + dstrectclipped = &batch->dstclipped; + } + + /* Get a shortcut to the destination surface. */ + dstinfo = &batch->dstinfo; + + /* Compute the size of the source rectangle. */ + srcwidth = srcinfo->rect.right - srcinfo->rect.left; + srcheight = srcinfo->rect.bottom - srcinfo->rect.top; + + /* Compute the scale factors. */ + batch->op.filter.horscalefactor = + horscalefactor = get_scale_factor(srcwidth, dstrect->width); + + batch->op.filter.verscalefactor = + verscalefactor = get_scale_factor(srcheight, dstrect->height); + + /* Compute adjusted destination rectangle. */ + dstadjusted.left = dstrectclipped->left + batch->dstoffsetX; + dstadjusted.top = dstrectclipped->top + batch->dstoffsetY; + dstadjusted.right = dstrectclipped->right + batch->dstoffsetX; + dstadjusted.bottom = dstrectclipped->bottom + batch->dstoffsetY; + + /* Compute the destination offsets. */ + dstleftoffs = dstrectclipped->left - dstrect->left; + dsttopoffs = dstrectclipped->top - dstrect->top; + dstrightoffs = dstrectclipped->right - dstrect->left; + + /* Compute the source offsets. */ + srcleftoffs = dstleftoffs * horscalefactor; + srctopoffs = dsttopoffs * verscalefactor; + srcrightoffs = (dstrightoffs - 1) * verscalefactor + (1 << 16); + + /* 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; + GCDBG(GCZONE_FILTER, "source rectangle:\n"); GCDBG(GCZONE_FILTER, " stride = %d, geom = %dx%d\n", - srcinfo->geom->virtstride, - srcinfo->geom->width, srcinfo->geom->height); + srcinfo->geom->virtstride, + srcinfo->geom->width, srcinfo->geom->height); GCDBG(GCZONE_FILTER, " rotation = %d\n", - srcinfo->angle); - GCDBG(GCZONE_FILTER, " rect = (%d,%d)-(%d,%d), %dx%d\n", - srcinfo->rect->left, srcinfo->rect->top, - srcinfo->rect->left + srcinfo->rect->width, - srcinfo->rect->top + srcinfo->rect->height, - srcinfo->rect->width, srcinfo->rect->height); + srcinfo->angle); + GCDBG(GCZONE_FILTER, " rect offsets = " + "(0x%08X,0x%08X)-(0x%08X,---)\n", + srcleftoffs, srctopoffs, srcrightoffs); GCDBG(GCZONE_FILTER, "destination rectangle:\n"); GCDBG(GCZONE_FILTER, " stride = %d, geom size = %dx%d\n", - bltparams->dstgeom->virtstride, - bltparams->dstgeom->width, bltparams->dstgeom->height); + bvbltparams->dstgeom->virtstride, + bvbltparams->dstgeom->width, bvbltparams->dstgeom->height); GCDBG(GCZONE_FILTER, " rotaton = %d\n", - batch->dstangle); - GCDBG(GCZONE_FILTER, " rect = (%d,%d)-(%d,%d), %dx%d\n", - bltparams->dstrect.left, bltparams->dstrect.top, - bltparams->dstrect.left + bltparams->dstrect.width, - bltparams->dstrect.top + bltparams->dstrect.height, - bltparams->dstrect.width, bltparams->dstrect.height); + dstinfo->angle); + GCDBG(GCZONE_FILTER, " rect = (%d,%d)-(%d,%d)\n", + dstrectclipped->left, dstrectclipped->top, + dstrectclipped->right, dstrectclipped->bottom); - /*********************************************************************** - * Update kernel arrays. - */ + /* Map the source. */ + bverror = do_map(srcinfo->buf.desc, batch, &srcmap); + if (bverror != BVERR_NONE) { + bvbltparams->errdesc = gccontext->bverrorstr; + goto exit; + } + + /* Map the destination. */ + bverror = do_map(dstinfo->buf.desc, batch, &dstmap); + if (bverror != BVERR_NONE) { + bvbltparams->errdesc = gccontext->bverrorstr; + goto exit; + } + + /* Determine needed passes. */ + horpass = (srcwidth != dstrect->width); + verpass = (srcheight != dstrect->height); + + /* Do single pass filter if we can. */ + if (((batch->op.filter.horkernelsize == 3) || + (batch->op.filter.horkernelsize == 5)) && + ((batch->op.filter.verkernelsize == 3) || + (batch->op.filter.verkernelsize == 5))) { + /* Determine the kernel size to use. */ + kernelsize = max(batch->op.filter.horkernelsize, + batch->op.filter.verkernelsize); + + /* Set kernel size. */ + bverror = claim_buffer(bvbltparams, batch, + sizeof(struct gcmovrconfigex), + (void **) &gcmovrconfigex); + if (bverror != BVERR_NONE) + goto exit; - /* Do we need the vertical pass? */ - verpass = (srcinfo->rect->height != bltparams->dstrect.height); - -#if 0 - /* Recompute the table if necessary. */ - gcmONERROR(_CalculateSyncTable( - hardware, - State->newHorKernelSize, - srcRectSize.x, - destRectSize.x, - horKernel - )); - - gcmONERROR(_CalculateSyncTable( - hardware, - State->newVerKernelSize, - srcRectSize.y, - destRectSize.y, - verKernel - )); -#endif + gcmovrconfigex->config_ldst = gcmovrconfigex_config_ldst; + gcmovrconfigex->config.raw = ~0U; + gcmovrconfigex->config.reg.kernelsize = kernelsize; + gcmovrconfigex->config.reg.mask_kernelsize + = GCREG_VR_CONFIG_EX_MASK_FILTER_TAP_ENABLED; + /* Setup single pass. */ + srcx = (srcinfo->rect.left << 16) + srcleftoffs; + srcy = (srcinfo->rect.top << 16) + srctopoffs; + + /* Load the horizontal filter. */ + bverror = load_filter(bvbltparams, batch, GC_FILTER_SYNC, + batch->op.filter.horkernelsize, + batch->op.filter.horscalefactor, + srcwidth, dstrect->width, + gcmofilterkernel_horizontal_ldst); + if (bverror != BVERR_NONE) + goto exit; + + /* Load the vertical filter. */ + bverror = load_filter(bvbltparams, batch, GC_FILTER_SYNC, + batch->op.filter.verkernelsize, + batch->op.filter.verscalefactor, + srcheight, dstrect->height, + gcmofilterkernel_vertical_ldst); + if (bverror != BVERR_NONE) + goto exit; + + /* Start the operation. */ + bverror = startvr(bvbltparams, batch, + srcmap, dstmap, srcinfo, dstinfo, + srcx, srcy, &dstadjusted, + gcregvrconfig_onepass, false); + + GCDBG(GCZONE_TYPE, "single pass\n"); + } else if (horpass && verpass) { + unsigned int horkernelhalf; + unsigned int leftextra, rightextra; + unsigned int tmprectwidth, tmprectheight; + unsigned int tmpalignmask; + unsigned int tmpsize; + struct surfaceinfo tmpinfo; + struct bvsurfgeom tmpgeom; + + /* Initialize the temporaty surface geometry. */ + tmpgeom.structsize = sizeof(struct bvsurfgeom); + tmpgeom.orientation = 0; + tmpgeom.paletteformat = 0; + tmpgeom.palette = NULL; + + /* Initialize the temporaty surface descriptor. */ + tmpinfo.index = -1; + tmpinfo.geom = &tmpgeom; + tmpinfo.pixalign = 0; + tmpinfo.bytealign = 0; + tmpinfo.angle = srcinfo->angle; + tmpinfo.mirror = srcinfo->mirror; + tmpinfo.rop = srcinfo->rop; + tmpinfo.gca = srcinfo->gca; + + /* Determine temporary surface format. */ + if (srcinfo->format->type == BVFMT_YUV) { + tmpinfo.format = dstinfo->format; + tmpgeom.format = dstinfo->geom->format; + } else { + tmpinfo.format = srcinfo->format; + tmpgeom.format = srcinfo->geom->format; + } + + /* Determine pixel alignment. */ + tmpalignmask = GC_BITS_PER_CACHELINE + / tmpinfo.format->bitspp - 1; + + /* In partial filter blit cases, the vertical pass has to render + * more pixel information to the left and to the right of the + * temporary image so that the horizontal pass has its necessary + * kernel information on the edges of the image. */ + horkernelhalf = batch->op.filter.horkernelsize >> 1; + + leftextra = srcleftoffs >> 16; + rightextra = srcwidth - (srcrightoffs >> 16); + + if (leftextra > horkernelhalf) + leftextra = horkernelhalf; + + if (rightextra > horkernelhalf) + rightextra = horkernelhalf; + + /* Determine the source origin. */ + srcx = ((srcinfo->rect.left - leftextra) << 16) + srcleftoffs; + srcy = (srcinfo->rect.top << 16) + srctopoffs; + + /* Determine the size of the temporary image. */ + tmprectwidth = leftextra + rightextra + + ((srcrightoffs >> 16) - (srcleftoffs >> 16)); + tmprectheight = dstadjusted.bottom - dstadjusted.top; + + /* Determine the destination coordinates. */ + tmpinfo.rect.left = (srcx >> 16) & tmpalignmask; + tmpinfo.rect.top = dstadjusted.top; + tmpinfo.rect.right = tmpinfo.rect.left + tmprectwidth; + tmpinfo.rect.bottom = tmpinfo.rect.top + tmprectheight; + + /* Determine the size of the temporaty surface. */ + tmpgeom.width = (tmpinfo.rect.right + tmpalignmask) + & ~tmpalignmask; + tmpgeom.height = tmpinfo.rect.bottom; + tmpgeom.virtstride = (tmpgeom.width + * tmpinfo.format->bitspp) / 8; + tmpsize = tmpgeom.virtstride * tmpgeom.height; + + /* Allocate the temporary buffer. */ + bverror = allocate_temp(bvbltparams, tmpsize); + if (bverror != BVERR_NONE) + goto exit; + + /* Map the temporary buffer. */ + tmpinfo.buf.desc = gccontext->tmpbuffdesc; + bverror = do_map(tmpinfo.buf.desc, batch, &tmpmap); + if (bverror != BVERR_NONE) { + bvbltparams->errdesc = gccontext->bverrorstr; + goto exit; + } + + /* Set the temporaty surface size. */ + tmpinfo.physwidth = tmpgeom.width; + tmpinfo.physheight = tmpgeom.height; + + /* Load the vertical filter. */ + bverror = load_filter(bvbltparams, batch, GC_FILTER_SYNC, + batch->op.filter.verkernelsize, + batch->op.filter.verscalefactor, + srcheight, dstrect->height, + gcmofilterkernel_shared_ldst); + if (bverror != BVERR_NONE) + goto exit; + + /* Start the operation. */ + bverror = startvr(bvbltparams, batch, + srcmap, tmpmap, srcinfo, &tmpinfo, + srcx, srcy, &tmpinfo.rect, + gcregvrconfig_vertical, true); + if (bverror != BVERR_NONE) + goto exit; + + /* Determine the source origin. */ + srcx = ((leftextra + tmpinfo.rect.left) << 16) + + (srcleftoffs & 0xFFFF); + srcy = (tmpinfo.rect.top << 16) + + (srctopoffs & 0xFFFF); + + /* Load the horizontal filter. */ + bverror = load_filter(bvbltparams, batch, GC_FILTER_SYNC, + batch->op.filter.horkernelsize, + batch->op.filter.horscalefactor, + srcwidth, dstrect->width, + gcmofilterkernel_shared_ldst); + if (bverror != BVERR_NONE) + goto exit; + + /* Start the operation. */ + bverror = startvr(bvbltparams, batch, + tmpmap, dstmap, &tmpinfo, dstinfo, + srcx, srcy, &dstadjusted, + gcregvrconfig_horizontal, false); + if (bverror != BVERR_NONE) + goto exit; + + GCDBG(GCZONE_TYPE, "two pass\n"); + } else { + /* Setup single pass. */ + srcx = (srcinfo->rect.left << 16) + srcleftoffs; + srcy = (srcinfo->rect.top << 16) + srctopoffs; + + if (verpass) + /* Load the vertical filter. */ + bverror = load_filter(bvbltparams, batch, + GC_FILTER_SYNC, + batch->op.filter.verkernelsize, + batch->op.filter.verscalefactor, + srcheight, dstrect->height, + gcmofilterkernel_shared_ldst); + else + /* Load the horizontal filter. */ + bverror = load_filter(bvbltparams, batch, + GC_FILTER_SYNC, + batch->op.filter.horkernelsize, + batch->op.filter.horscalefactor, + srcwidth, dstrect->width, + gcmofilterkernel_shared_ldst); + + if (bverror != BVERR_NONE) + goto exit; + + /* Start the operation. */ + bverror = startvr(bvbltparams, batch, + srcmap, dstmap, srcinfo, dstinfo, + srcx, srcy, &dstadjusted, + verpass + ? gcregvrconfig_vertical + : gcregvrconfig_horizontal, + false); + + GCDBG(GCZONE_TYPE, "two pass one pass config.\n"); + } + +exit: GCEXITARG(GCZONE_FILTER, "bv%s = %d\n", (bverror == BVERR_NONE) ? "result" : "error", bverror); - - /* Not implemented yet */ - return BVERR_OP; + return bverror; } diff --git a/drivers/misc/gcx/gcbv/gcmain.c b/drivers/misc/gcx/gcbv/gcmain.c index 412e229..c2f73e4 100644 --- a/drivers/misc/gcx/gcbv/gcmain.c +++ b/drivers/misc/gcx/gcbv/gcmain.c @@ -12,8 +12,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#include <plat/cpu.h> -#include "gcmain.h" +#include "gcbv.h" /******************************************************************************* @@ -100,6 +99,107 @@ unsigned char gcfp2norm8(float value) /******************************************************************************* + * Surface allocation. + */ + +enum bverror allocate_surface(struct bvbuffdesc **bvbuffdesc, + void **buffer, + unsigned int size) +{ + enum bverror bverror; + struct bvbuffdesc *tempbuffdesc = NULL; + void *tempbuff = NULL; + unsigned long *temparray = NULL; + struct bvphysdesc *tempphysdesc = NULL; + unsigned char *pageaddr; + unsigned int i; + + /* Allocate surface buffer descriptor. */ + tempbuffdesc = vmalloc(sizeof(struct bvbuffdesc)); + if (tempbuffdesc == NULL) { + BVSETERROR(BVERR_OOM, "failed to allocate surface"); + goto exit; + } + + /* Initialize buffer descriptor. */ + tempbuffdesc->structsize = sizeof(struct bvbuffdesc); + tempbuffdesc->virtaddr = NULL; + tempbuffdesc->length = size; + tempbuffdesc->map = NULL; + tempbuffdesc->auxtype = BVAT_PHYSDESC; + tempbuffdesc->auxptr = NULL; + + /* Allocate the surface. */ + tempbuff = vmalloc(size); + if (tempbuff == NULL) { + BVSETERROR(BVERR_OOM, "failed to allocate surface"); + goto exit; + } + tempbuffdesc->virtaddr = tempbuff; + + /* Allocate the physical descriptor. */ + tempphysdesc = vmalloc(sizeof(struct bvphysdesc)); + if (tempphysdesc == NULL) { + BVSETERROR(BVERR_OOM, "failed to allocate surface"); + goto exit; + } + tempbuffdesc->auxptr = tempphysdesc; + + /* Initialize physical descriptor. */ + tempphysdesc->structsize = sizeof(struct bvphysdesc); + tempphysdesc->pagesize = PAGE_SIZE; + tempphysdesc->pagearray = NULL; + tempphysdesc->pagecount = (size + PAGE_SIZE - 1) / PAGE_SIZE; + tempphysdesc->pageoffset = 0; + + /* Allocate array of pages. */ + temparray = vmalloc(tempphysdesc->pagecount * sizeof(unsigned long)); + if (temparray == NULL) { + BVSETERROR(BVERR_OOM, "failed to allocate surface"); + goto exit; + } + tempphysdesc->pagearray = temparray; + + /* Initialize the array. */ + pageaddr = (unsigned char *) tempbuff; + for (i = 0; i < tempphysdesc->pagecount; i += 1) { + temparray[i] = PFN_PHYS(vmalloc_to_pfn(pageaddr)); + pageaddr += PAGE_SIZE; + } + + /* Set return pointers. */ + *bvbuffdesc = tempbuffdesc; + *buffer = tempbuff; + return BVERR_NONE; + +exit: + free_surface(tempbuffdesc, tempbuff); + return bverror; +} + +void free_surface(struct bvbuffdesc *bvbuffdesc, + void *buffer) +{ + if (bvbuffdesc != NULL) { + if (bvbuffdesc->virtaddr != NULL) + vfree(bvbuffdesc->virtaddr); + + if (bvbuffdesc->auxptr != NULL) { + struct bvphysdesc *bvphysdesc; + + bvphysdesc = (struct bvphysdesc *) bvbuffdesc->auxptr; + if (bvphysdesc->pagearray != NULL) + vfree(bvphysdesc->pagearray); + + vfree(bvphysdesc); + } + + vfree(bvbuffdesc); + } +} + + +/******************************************************************************* * Cache operation wrapper. */ diff --git a/drivers/misc/gcx/gcbv/gcmain.h b/drivers/misc/gcx/gcbv/gcmain.h index bfd59aa..45b55b6 100644 --- a/drivers/misc/gcx/gcbv/gcmain.h +++ b/drivers/misc/gcx/gcbv/gcmain.h @@ -17,6 +17,7 @@ #include <linux/slab.h> #include <linux/module.h> +#include <linux/vmalloc.h> #include <linux/dma-mapping.h> #include <linux/list.h> #include <linux/gcx.h> @@ -43,14 +44,32 @@ * Core driver API definitions. */ -#define gc_map_wrapper(gcmap) \ - gc_map(gcmap, false) +#define gc_getcaps_wrapper(gcicaps) \ + gc_caps(gcicaps) -#define gc_unmap_wrapper(gcmap) \ - gc_unmap(gcmap, false) +#define gc_commit_wrapper(gcicommit) \ + gc_commit(gcicommit, false) -#define gc_commit_wrapper(gccommit) \ - gc_commit(gccommit, false) +#define gc_map_wrapper(gcimap) \ + gc_map(gcimap, false) + +#define gc_unmap_wrapper(gcimap) \ + gc_unmap(gcimap, false) + +#define gc_callback_wrapper(gcicallbackarm) \ + gc_callback(gcicallbackarm, false) + + +/******************************************************************************* + * Surface allocation. + */ + +enum bverror allocate_surface(struct bvbuffdesc **bvbuffdesc, + void **buffer, + unsigned int size); + +void free_surface(struct bvbuffdesc *bvbuffdesc, + void *buffer); /******************************************************************************* diff --git a/drivers/misc/gcx/gcbv/gcmap.c b/drivers/misc/gcx/gcbv/gcmap.c index eac76f8..691b3fd 100644 --- a/drivers/misc/gcx/gcbv/gcmap.c +++ b/drivers/misc/gcx/gcbv/gcmap.c @@ -80,7 +80,7 @@ enum bverror do_map(struct bvbuffdesc *bvbuffdesc, struct bvbuffmapinfo *bvbuffmapinfo; struct bvphysdesc *bvphysdesc; bool mappedbyothers; - struct gcmap gcmap; + struct gcimap gcimap; struct gcschedunmap *gcschedunmap; GCENTERARG(GCZONE_MAPPING, "bvbuffdesc = 0x%08X\n", @@ -120,8 +120,8 @@ enum bverror do_map(struct bvbuffdesc *bvbuffdesc, * that the buffer starts at a location that is supported by * the hw. If it is not, offset is computed and the buffer is * extended by the value of the offset. */ - gcmap.gcerror = GCERR_NONE; - gcmap.handle = 0; + gcimap.gcerror = GCERR_NONE; + gcimap.handle = 0; if (bvbuffdesc->auxtype == BVAT_PHYSDESC) { bvphysdesc = (struct bvphysdesc *) bvbuffdesc->auxptr; @@ -133,10 +133,10 @@ enum bverror do_map(struct bvbuffdesc *bvbuffdesc, goto fail; } - gcmap.buf.offset = bvphysdesc->pageoffset; - gcmap.pagesize = bvphysdesc->pagesize; - gcmap.pagearray = bvphysdesc->pagearray; - gcmap.size = bvbuffdesc->length; + gcimap.buf.offset = bvphysdesc->pageoffset; + gcimap.pagesize = bvphysdesc->pagesize; + gcimap.pagearray = bvphysdesc->pagearray; + gcimap.size = bvbuffdesc->length; GCDBG(GCZONE_MAPPING, "new mapping (%s):\n", (batch == NULL) ? "explicit" : "implicit"); @@ -147,25 +147,25 @@ enum bverror do_map(struct bvbuffdesc *bvbuffdesc, GCDBG(GCZONE_MAPPING, "pageoffset = %lu\n", bvphysdesc->pageoffset); GCDBG(GCZONE_MAPPING, "mapping size = %d\n", - gcmap.size); + gcimap.size); } else { - gcmap.buf.logical = bvbuffdesc->virtaddr; - gcmap.pagesize = 0; - gcmap.pagearray = NULL; - gcmap.size = bvbuffdesc->length; + gcimap.buf.logical = bvbuffdesc->virtaddr; + gcimap.pagesize = 0; + gcimap.pagearray = NULL; + gcimap.size = bvbuffdesc->length; GCDBG(GCZONE_MAPPING, "new mapping (%s):\n", (batch == NULL) ? "explicit" : "implicit"); GCDBG(GCZONE_MAPPING, "specified virtaddr = 0x%08X\n", (unsigned int) bvbuffdesc->virtaddr); GCDBG(GCZONE_MAPPING, "aligned virtaddr = 0x%08X\n", - (unsigned int) gcmap.buf.logical); + (unsigned int) gcimap.buf.logical); GCDBG(GCZONE_MAPPING, "mapping size = %d\n", - gcmap.size); + gcimap.size); } - gc_map_wrapper(&gcmap); - if (gcmap.gcerror != GCERR_NONE) { + gc_map_wrapper(&gcimap); + if (gcimap.gcerror != GCERR_NONE) { BVSETERROR(BVERR_OOM, "unable to allocate gccore memory"); goto fail; @@ -173,7 +173,7 @@ enum bverror do_map(struct bvbuffdesc *bvbuffdesc, /* Set map handle. */ bvbuffmapinfo = (struct bvbuffmapinfo *) bvbuffmap->handle; - bvbuffmapinfo->handle = gcmap.handle; + bvbuffmapinfo->handle = gcimap.handle; /* Initialize reference counters. */ if (batch == NULL) { diff --git a/drivers/misc/gcx/gcbv/gcparser.c b/drivers/misc/gcx/gcbv/gcparser.c index 654fc76..37ed98f 100644 --- a/drivers/misc/gcx/gcbv/gcparser.c +++ b/drivers/misc/gcx/gcbv/gcparser.c @@ -58,14 +58,47 @@ #define GCZONE_ALL (~0U) #define GCZONE_FORMAT (1 << 0) #define GCZONE_BLEND (1 << 1) -#define GCZONE_DEST (1 << 2) -#define GCZONE_SRC (1 << 3) +#define GCZONE_OFFSET (1 << 2) +#define GCZONE_DEST (1 << 3) +#define GCZONE_SRC (1 << 4) +#define GCZONE_SCALING (1 << 5) GCDBG_FILTERDEF(gcparser, GCZONE_NONE, "format", "blend", + "offset", "dest", - "src") + "src", + "scaling") + + +/******************************************************************************* + * Internal macros. + */ + +#define GCCONVERT_RECT(zone, error, name, bvrect, gcrect) \ +{ \ + (gcrect)->left = (bvrect)->left; \ + (gcrect)->top = (bvrect)->top; \ + (gcrect)->right = (bvrect)->left + (bvrect)->width; \ + (gcrect)->bottom = (bvrect)->top + (bvrect)->height; \ + \ + if (((gcrect)->left < GC_CLIP_RESET_LEFT) || \ + ((gcrect)->top < GC_CLIP_RESET_TOP) || \ + ((gcrect)->right > GC_CLIP_RESET_RIGHT) || \ + ((gcrect)->bottom > GC_CLIP_RESET_BOTTOM)) { \ + BVSETBLTERROR((error), \ + "invalid " name " rectangle"); \ + goto exit; \ + } \ + \ + GCDBG(zone, \ + name " = (%d,%d)-(%d,%d), %dx%d\n", \ + (gcrect)->left, (gcrect)->top, \ + (gcrect)->right, (gcrect)->bottom, \ + (gcrect)->right - (gcrect)->left, \ + (gcrect)->bottom - (gcrect)->top); \ +} /******************************************************************************* @@ -124,17 +157,17 @@ GCDBG_FILTERDEF(gcparser, GCZONE_NONE, { 0, 0, 0, 0, { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } } } static struct bvformatxlate g_format_nv12 = { - .type = BVFMT_YUV, + .type = BVFMT_PLANAR_YUV, .bitspp = 8, .format = GCREG_DE_FORMAT_NV12, }; static struct bvformatxlate g_format_uyvy = { - .type = BVFMT_YUV, + .type = BVFMT_PACKED_YUV, .bitspp = 16, .format = GCREG_DE_FORMAT_UYVY }; static struct bvformatxlate g_format_yuy2 = { - .type = BVFMT_YUV, + .type = BVFMT_PACKED_YUV, .bitspp = 16, .format = GCREG_DE_FORMAT_YUY2 }; @@ -299,9 +332,8 @@ static struct bvformatxlate formatxlate[] = { BVRED(16, 8), BVGREEN(8, 8), BVBLUE(0, 8), BVALPHA(24, 8)), }; -enum bverror parse_format(struct bvbltparams *bvbltparams, - enum ocdformat ocdformat, - struct bvformatxlate **format) +static enum bverror parse_format(struct bvbltparams *bvbltparams, + struct surfaceinfo *surfaceinfo) { static unsigned int containers[] = { 8, /* OCDFMTDEF_CONTAINER_8BIT */ @@ -315,6 +347,7 @@ enum bverror parse_format(struct bvbltparams *bvbltparams, }; enum bverror bverror = BVERR_NONE; + enum ocdformat ocdformat; unsigned int cs; unsigned int bits; unsigned int swizzle; @@ -322,6 +355,7 @@ enum bverror parse_format(struct bvbltparams *bvbltparams, unsigned int index; unsigned int cont; + ocdformat = surfaceinfo->geom->format; GCENTERARG(GCZONE_FORMAT, "ocdformat = 0x%08X\n", ocdformat); cs = (ocdformat & OCDFMTDEF_CS_MASK) >> OCDFMTDEF_CS_SHIFT; @@ -386,17 +420,17 @@ enum bverror parse_format(struct bvbltparams *bvbltparams, switch (ocdformat) { case OCDFMT_NV12: GCDBG(GCZONE_FORMAT, "OCDFMT_NV12\n"); - *format = &g_format_nv12; + surfaceinfo->format = &g_format_nv12; goto exit; case OCDFMT_UYVY: GCDBG(GCZONE_FORMAT, "OCDFMT_UYVY\n"); - *format = &g_format_uyvy; + surfaceinfo->format = &g_format_uyvy; goto exit; case OCDFMT_YUY2: GCDBG(GCZONE_FORMAT, "OCDFMT_YUY2\n"); - *format = &g_format_yuy2; + surfaceinfo->format = &g_format_yuy2; goto exit; default: @@ -417,7 +451,7 @@ enum bverror parse_format(struct bvbltparams *bvbltparams, goto exit; } - *format = &formatxlate[index]; + surfaceinfo->format = &formatxlate[index]; GCDBG(GCZONE_FORMAT, "format record = 0x%08X\n", (unsigned int) &formatxlate[index]); @@ -1025,8 +1059,8 @@ static struct bvblendxlate blendxlate[64] = { }; enum bverror parse_blend(struct bvbltparams *bvbltparams, - enum bvblend blend, - struct gcalpha *gca) + enum bvblend blend, + struct gcalpha *gca) { enum bverror bverror; unsigned int global; @@ -1186,191 +1220,106 @@ static inline int get_angle(int orientation) * Surface compare and validation. */ -static bool valid_geom(struct bvbuffdesc *buffdesc, - struct bvsurfgeom *geom, - struct bvformatxlate *format) +static bool valid_geom(struct surfaceinfo *surfaceinfo) { unsigned int size; /* Compute the size of the surface. */ - size = (geom->width * geom->height * format->bitspp) / 8; + size = (surfaceinfo->geom->width * + surfaceinfo->geom->height * + surfaceinfo->format->bitspp) / 8; /* Make sure the size is not greater then the surface. */ - if (size > buffdesc->length) { + if (size > surfaceinfo->buf.desc->length) { GCERR("invalid geometry detected:\n"); GCERR(" specified dimensions: %dx%d, %d bitspp\n", - geom->width, geom->height, format->bitspp); + surfaceinfo->geom->width, + surfaceinfo->geom->height, + surfaceinfo->format->bitspp); GCERR(" surface size based on the dimensions: %d\n", - size); + size); GCERR(" specified surface size: %lu\n", - buffdesc->length); + surfaceinfo->buf.desc->length); return false; } return true; } -int get_pixel_offset(struct bvbuffdesc *bvbuffdesc, - struct bvformatxlate *format, - int offset) +int get_pixel_offset(struct surfaceinfo *surfaceinfo, int offset) { unsigned int alignment; int byteoffset; unsigned int alignedoffset; int pixeloffset; - alignment = (format->type == BVFMT_YUV) + GCENTERARG(GCZONE_OFFSET, "surfaceinfo=0x%08X, offset=%d\n", + surfaceinfo, offset); + + alignment = ((surfaceinfo->format->type & BVFMT_MASK) == BVFMT_YUV) ? (64 - 1) : (16 - 1); + GCDBG(GCZONE_OFFSET, "bpp = %d\n", surfaceinfo->format->bitspp); + GCDBG(GCZONE_OFFSET, "alignment = %d\n", alignment); + /* Determine offset in bytes from the base modified by the * given offset. */ - if (bvbuffdesc->auxtype == BVAT_PHYSDESC) { + if (surfaceinfo->buf.desc->auxtype == BVAT_PHYSDESC) { struct bvphysdesc *bvphysdesc; - bvphysdesc = (struct bvphysdesc *) bvbuffdesc->auxptr; + + bvphysdesc = (struct bvphysdesc *) + surfaceinfo->buf.desc->auxptr; + GCDBG(GCZONE_OFFSET, "physical descriptor @ 0x%08X\n", + bvphysdesc); + byteoffset = bvphysdesc->pageoffset + offset; } else { - byteoffset = (unsigned int) bvbuffdesc->virtaddr + offset; + GCDBG(GCZONE_OFFSET, "no physical descriptor.\n"); + byteoffset = (unsigned int) + surfaceinfo->buf.desc->virtaddr + offset; } + GCDBG(GCZONE_OFFSET, "byteoffset = %d\n", byteoffset); + /* Compute the aligned offset. */ alignedoffset = byteoffset & alignment; /* Convert to pixels. */ - pixeloffset = alignedoffset * 8 / format->bitspp; + pixeloffset = alignedoffset * 8 / surfaceinfo->format->bitspp; + + GCDBG(GCZONE_OFFSET, "alignedoffset = %d\n", alignedoffset); + GCDBG(GCZONE_OFFSET, "pixeloffset = %d\n", pixeloffset); + + GCEXIT(GCZONE_OFFSET); return -pixeloffset; } enum bverror parse_destination(struct bvbltparams *bvbltparams, - struct gcbatch *batch) + struct gcbatch *batch) { enum bverror bverror = BVERR_NONE; GCENTER(GCZONE_DEST); - /* Did clipping/destination rects change? */ - if ((batch->batchflags & (BVBATCH_CLIPRECT | - BVBATCH_DESTRECT)) != 0) { - struct bvrect *dstrect; - struct bvrect *cliprect; - int destleft, desttop, destright, destbottom; - int clipleft, cliptop, clipright, clipbottom; - unsigned short clippedleft, clippedtop; - unsigned short clippedright, clippedbottom; - - /* Make shortcuts to the destination objects. */ - dstrect = &bvbltparams->dstrect; - cliprect = &bvbltparams->cliprect; - - /* Determine destination rectangle. */ - destleft = dstrect->left; - desttop = dstrect->top; - destright = destleft + dstrect->width; - destbottom = desttop + dstrect->height; - - GCDBG(GCZONE_DEST, "destination rectangle:\n"); - GCDBG(GCZONE_DEST, " dstrect = (%d,%d)-(%d,%d), %dx%d\n", - destleft, desttop, destright, destbottom, - dstrect->width, dstrect->height); - - /* Determine clipping. */ - if ((bvbltparams->flags & BVFLAG_CLIP) == BVFLAG_CLIP) { - clipleft = cliprect->left; - cliptop = cliprect->top; - clipright = clipleft + cliprect->width; - clipbottom = cliptop + cliprect->height; - - if ((clipleft < GC_CLIP_RESET_LEFT) || - (cliptop < GC_CLIP_RESET_TOP) || - (clipright > GC_CLIP_RESET_RIGHT) || - (clipbottom > GC_CLIP_RESET_BOTTOM) || - (clipright < clipleft) || - (clipbottom < cliptop)) { - BVSETBLTERROR(BVERR_CLIP_RECT, - "invalid clipping rectangle"); - goto exit; - } - - GCDBG(GCZONE_DEST, - " cliprect = (%d,%d)-(%d,%d), %dx%d\n", - clipleft, cliptop, clipright, clipbottom, - cliprect->width, cliprect->height); - } else { - clipleft = GC_CLIP_RESET_LEFT; - cliptop = GC_CLIP_RESET_TOP; - clipright = GC_CLIP_RESET_RIGHT; - clipbottom = GC_CLIP_RESET_BOTTOM; - } - - /* Compute clipping deltas and the adjusted destination rect. */ - if (clipleft <= destleft) { - batch->deltaleft = 0; - clippedleft = destleft; - } else { - batch->deltaleft = clipleft - destleft; - clippedleft = clipleft; - } - - if (cliptop <= desttop) { - batch->deltatop = 0; - clippedtop = desttop; - } else { - batch->deltatop = cliptop - desttop; - clippedtop = cliptop; - } - - if (clipright >= destright) { - batch->deltaright = 0; - clippedright = destright; - } else { - batch->deltaright = clipright - destright; - clippedright = clipright; - } - - if (clipbottom >= destbottom) { - batch->deltabottom = 0; - clippedbottom = destbottom; - } else { - batch->deltabottom = clipbottom - destbottom; - clippedbottom = clipbottom; - } - - /* Validate the rectangle. */ - if ((clippedright > (int) bvbltparams->dstgeom->width) || - (clippedbottom > (int) bvbltparams->dstgeom->height)) { - BVSETBLTERROR(BVERR_DSTRECT, - "destination rect exceeds surface size"); - goto exit; - } - - /* Set clipped coordinates. */ - batch->clippedleft = clippedleft; - batch->clippedtop = clippedtop; - batch->clippedright = clippedright; - batch->clippedbottom = clippedbottom; - - GCDBG(GCZONE_DEST, - " clipped dstrect = (%d,%d)-(%d,%d), %dx%d\n", - clippedleft, clippedtop, clippedright, clippedbottom, - clippedright - clippedleft, clippedbottom - clippedtop); - GCDBG(GCZONE_DEST, - " clipping delta = (%d,%d)-(%d,%d)\n", - batch->deltaleft, batch->deltatop, - batch->deltaright, batch->deltabottom); - } - /* Did the destination surface change? */ if ((batch->batchflags & BVBATCH_DST) != 0) { - struct bvbuffdesc *dstdesc; - struct bvsurfgeom *dstgeom; + struct surfaceinfo *dstinfo; unsigned int stridealign; - /* Make shortcuts to the destination objects. */ - dstdesc = bvbltparams->dstdesc; - dstgeom = bvbltparams->dstgeom; + /* Initialize the destination descriptor. */ + dstinfo = &batch->dstinfo; + dstinfo->index = -1; + dstinfo->buf.desc = bvbltparams->dstdesc; + dstinfo->geom = bvbltparams->dstgeom; + + /* Initialize members that are not used. */ + dstinfo->mirror = GCREG_MIRROR_NONE; + dstinfo->rop = 0; + dstinfo->gca = NULL; /* Check for unsupported dest formats. */ - switch (dstgeom->format) { + switch (dstinfo->geom->format) { case OCDFMT_NV12: BVSETBLTERROR(BVERR_DSTGEOM_FORMAT, "destination format unsupported"); @@ -1382,22 +1331,21 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, /* Parse the destination format. */ GCDBG(GCZONE_FORMAT, "parsing destination format.\n"); - if (parse_format(bvbltparams, dstgeom->format, - &batch->dstformat) != BVERR_NONE) { + if (parse_format(bvbltparams, dstinfo) != BVERR_NONE) { bverror = BVERR_DSTGEOM_FORMAT; goto exit; } /* Validate geometry. */ - if (!valid_geom(dstdesc, dstgeom, batch->dstformat)) { + if (!valid_geom(dstinfo)) { BVSETBLTERROR(BVERR_DSTGEOM, "destination geom exceeds surface size"); goto exit; } /* Destination stride must be 8 pixel aligned. */ - stridealign = batch->dstformat->bitspp - 1; - if ((dstgeom->virtstride & stridealign) != 0) { + stridealign = dstinfo->format->bitspp - 1; + if ((dstinfo->geom->virtstride & stridealign) != 0) { BVSETBLTERROR(BVERR_DSTGEOM_STRIDE, "destination stride must be 8 pixel " "aligned."); @@ -1405,55 +1353,62 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, } /* Parse orientation. */ - batch->dstangle = get_angle(dstgeom->orientation); - if (batch->dstangle == ROT_ANGLE_INVALID) { + dstinfo->angle = get_angle(dstinfo->geom->orientation); + if (dstinfo->angle == ROT_ANGLE_INVALID) { BVSETBLTERROR(BVERR_DSTGEOM, "unsupported destination orientation %d.", - dstgeom->orientation); + dstinfo->geom->orientation); } - /* Compute the destination offset in pixels needed to compensate + /* Compute the destination alignments needed to compensate * for the surface base address misalignment if any. */ - batch->dstalign = get_pixel_offset(dstdesc, - batch->dstformat, 0); + dstinfo->pixalign = get_pixel_offset(dstinfo, 0); + dstinfo->bytealign = (dstinfo->pixalign + * (int) dstinfo->format->bitspp) / 8; - switch (batch->dstangle) { + switch (dstinfo->angle) { case ROT_ANGLE_0: /* Determine the physical size. */ - batch->dstphyswidth = dstgeom->width - batch->dstalign; - batch->dstphysheight = dstgeom->height; + dstinfo->physwidth = dstinfo->geom->width + - dstinfo->pixalign; + dstinfo->physheight = dstinfo->geom->height; /* Determine geometry size. */ - batch->dstwidth = dstgeom->width - batch->dstalign; - batch->dstheight = dstgeom->height; + batch->dstwidth = dstinfo->geom->width + - dstinfo->pixalign; + batch->dstheight = dstinfo->geom->height; /* Determine the origin offset. */ - batch->dstoffsetX = -batch->dstalign; + batch->dstoffsetX = -dstinfo->pixalign; batch->dstoffsetY = 0; break; case ROT_ANGLE_90: /* Determine the physical size. */ - batch->dstphyswidth = dstgeom->height - batch->dstalign; - batch->dstphysheight = dstgeom->width; + dstinfo->physwidth = dstinfo->geom->height + - dstinfo->pixalign; + dstinfo->physheight = dstinfo->geom->width; /* Determine geometry size. */ - batch->dstwidth = dstgeom->width; - batch->dstheight = dstgeom->height - batch->dstalign; + batch->dstwidth = dstinfo->geom->width; + batch->dstheight = dstinfo->geom->height + - dstinfo->pixalign; /* Determine the origin offset. */ batch->dstoffsetX = 0; - batch->dstoffsetY = -batch->dstalign; + batch->dstoffsetY = -dstinfo->pixalign; break; case ROT_ANGLE_180: /* Determine the physical size. */ - batch->dstphyswidth = dstgeom->width - batch->dstalign; - batch->dstphysheight = dstgeom->height; + dstinfo->physwidth = dstinfo->geom->width + - dstinfo->pixalign; + dstinfo->physheight = dstinfo->geom->height; /* Determine geometry size. */ - batch->dstwidth = dstgeom->width - batch->dstalign; - batch->dstheight = dstgeom->height; + batch->dstwidth = dstinfo->geom->width + - dstinfo->pixalign; + batch->dstheight = dstinfo->geom->height; /* Determine the origin offset. */ batch->dstoffsetX = 0; @@ -1462,12 +1417,14 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, case ROT_ANGLE_270: /* Determine the physical size. */ - batch->dstphyswidth = dstgeom->height - batch->dstalign; - batch->dstphysheight = dstgeom->width; + dstinfo->physwidth = dstinfo->geom->height + - dstinfo->pixalign; + dstinfo->physheight = dstinfo->geom->width; /* Determine geometry size. */ - batch->dstwidth = dstgeom->width; - batch->dstheight = dstgeom->height - batch->dstalign; + batch->dstwidth = dstinfo->geom->width; + batch->dstheight = dstinfo->geom->height + - dstinfo->pixalign; /* Determine the origin offset. */ batch->dstoffsetX = 0; @@ -1477,30 +1434,174 @@ enum bverror parse_destination(struct bvbltparams *bvbltparams, GCDBG(GCZONE_DEST, "destination surface:\n"); GCDBG(GCZONE_DEST, " rotation %d degrees.\n", - batch->dstangle * 90); + dstinfo->angle * 90); - if (dstdesc->auxtype == BVAT_PHYSDESC) { + if (dstinfo->buf.desc->auxtype == BVAT_PHYSDESC) { struct bvphysdesc *bvphysdesc; - bvphysdesc = (struct bvphysdesc *) dstdesc->auxptr; + bvphysdesc = (struct bvphysdesc *) + dstinfo->buf.desc->auxptr; GCDBG(GCZONE_DEST, " page offset = 0x%08X\n", bvphysdesc->pageoffset); } else { GCDBG(GCZONE_DEST, " virtual address = 0x%08X\n", - (unsigned int) dstdesc->virtaddr); + (unsigned int) dstinfo->buf.desc->virtaddr); } GCDBG(GCZONE_DEST, " stride = %ld\n", - dstgeom->virtstride); + dstinfo->geom->virtstride); GCDBG(GCZONE_DEST, " geometry size = %dx%d\n", - dstgeom->width, dstgeom->height); + dstinfo->geom->width, dstinfo->geom->height); GCDBG(GCZONE_DEST, " aligned geometry size = %dx%d\n", batch->dstwidth, batch->dstheight); GCDBG(GCZONE_DEST, " aligned physical size = %dx%d\n", - batch->dstphyswidth, batch->dstphysheight); + dstinfo->physwidth, dstinfo->physheight); GCDBG(GCZONE_DEST, " origin offset (pixels) = %d,%d\n", batch->dstoffsetX, batch->dstoffsetY); GCDBG(GCZONE_DEST, " surface offset (pixels) = %d,0\n", - batch->dstalign); + dstinfo->pixalign); + } + + /* Did clipping/destination rects change? */ + if ((batch->batchflags & (BVBATCH_CLIPRECT | + BVBATCH_DESTRECT | + BVBATCH_DST)) != 0) { + struct surfaceinfo *dstinfo; + struct gcrect cliprect; + struct gcrect *dstrect; + struct gcrect dstrectaux; + bool haveaux; + + /* Get a shortcut to the destination surface. */ + dstinfo = &batch->dstinfo; + + /* Determine destination rectangle. */ + dstrect = &dstinfo->rect; + GCCONVERT_RECT(GCZONE_DEST, BVERR_DSTRECT, + "destination", + &bvbltparams->dstrect, + dstrect); + + /* Determine whether aux destination is specified. */ + haveaux = ((bvbltparams->flags & BVFLAG_SRC2_AUXDSTRECT) != 0); + + /* Is clipping rectangle specified? */ + if ((bvbltparams->flags & BVFLAG_CLIP) == BVFLAG_CLIP) { + /* Convert and validate clipping rectangle. */ + GCCONVERT_RECT(GCZONE_DEST, BVERR_CLIP_RECT, + "clipping", + &bvbltparams->cliprect, + &cliprect); + + /* Compute clipping deltas and the adjusted + * destination rect. */ + if (cliprect.left <= dstrect->left) { + batch->clipdelta.left = 0; + batch->dstclipped.left = dstrect->left; + } else { + batch->clipdelta.left = cliprect.left + - dstrect->left; + batch->dstclipped.left = cliprect.left; + } + + if (cliprect.top <= dstrect->top) { + batch->clipdelta.top = 0; + batch->dstclipped.top = dstrect->top; + } else { + batch->clipdelta.top = cliprect.top + - dstrect->top; + batch->dstclipped.top = cliprect.top; + } + + if (cliprect.right >= dstrect->right) { + batch->clipdelta.right = 0; + batch->dstclipped.right = dstrect->right; + } else { + batch->clipdelta.right = cliprect.right + - dstrect->right; + batch->dstclipped.right = cliprect.right; + } + + if (cliprect.bottom >= dstrect->bottom) { + batch->clipdelta.bottom = 0; + batch->dstclipped.bottom = dstrect->bottom; + } else { + batch->clipdelta.bottom = cliprect.bottom + - dstrect->bottom; + batch->dstclipped.bottom = cliprect.bottom; + } + + /* Clip the aux destination. */ + if (haveaux) { + /* Convert and validate aux rectangle. */ + GCCONVERT_RECT(GCZONE_DEST, BVERR_DSTRECT, + "aux destination", + &bvbltparams->src2auxdstrect, + &dstrectaux); + + batch->dstclippedaux.left + = (cliprect.left <= dstrectaux.left) + ? dstrectaux.left + : cliprect.left; + + batch->dstclippedaux.top + = (cliprect.top <= dstrectaux.top) + ? dstrectaux.top + : cliprect.top; + + batch->dstclippedaux.right + = (cliprect.right >= dstrectaux.right) + ? dstrectaux.right + : cliprect.right; + + batch->dstclippedaux.bottom + = (cliprect.bottom >= dstrectaux.bottom) + ? dstrectaux.bottom + : cliprect.bottom; + } + } else { + batch->clipdelta.left = + batch->clipdelta.top = + batch->clipdelta.right = + batch->clipdelta.bottom = 0; + + batch->dstclipped = *dstrect; + if (haveaux) + /* Convert and validate aux rectangle. */ + GCCONVERT_RECT(GCZONE_DEST, BVERR_DSTRECT, + "aux destination", + &bvbltparams->src2auxdstrect, + &batch->dstclippedaux); + } + + GCDBG(GCZONE_DEST, + "clipped dest = (%d,%d)-(%d,%d), %dx%d\n", + batch->dstclipped.left, + batch->dstclipped.top, + batch->dstclipped.right, + batch->dstclipped.bottom, + batch->dstclipped.right - + batch->dstclipped.left, + batch->dstclipped.bottom - + batch->dstclipped.top); + + if (haveaux) + GCDBG(GCZONE_DEST, + "clipped aux dest = (%d,%d)-(%d,%d), %dx%d\n", + batch->dstclippedaux.left, + batch->dstclippedaux.top, + batch->dstclippedaux.right, + batch->dstclippedaux.bottom, + batch->dstclippedaux.right - + batch->dstclippedaux.left, + batch->dstclippedaux.bottom - + batch->dstclippedaux.top); + + GCDBG(GCZONE_DEST, + "clipping delta = (%d,%d)-(%d,%d)\n", + batch->clipdelta.left, + batch->clipdelta.top, + batch->clipdelta.right, + batch->clipdelta.bottom); } exit: @@ -1510,25 +1611,24 @@ exit: } enum bverror parse_source(struct bvbltparams *bvbltparams, - struct gcbatch *batch, - struct srcinfo *srcinfo) + struct gcbatch *batch, + struct bvrect *srcrect, + struct surfaceinfo *srcinfo) { enum bverror bverror = BVERR_NONE; - struct bvbuffdesc *srcdesc; - struct bvsurfgeom *srcgeom; - struct bvrect *srcrect; unsigned int stridealign; - /* Make shortcuts to the source objects. */ - srcdesc = srcinfo->buf.desc; - srcgeom = srcinfo->geom; - srcrect = srcinfo->rect; + /* Convert the rectangle. */ + GCCONVERT_RECT(GCZONE_SRC, + (srcinfo->index == 0) + ? BVERR_SRC1GEOM_FORMAT + : BVERR_SRC2GEOM_FORMAT, + "source", srcrect, &srcinfo->rect); /* Parse the source format. */ GCDBG(GCZONE_FORMAT, "parsing source%d format.\n", srcinfo->index + 1); - if (parse_format(bvbltparams, srcgeom->format, - &srcinfo->format) != BVERR_NONE) { + if (parse_format(bvbltparams, srcinfo) != BVERR_NONE) { bverror = (srcinfo->index == 0) ? BVERR_SRC1GEOM_FORMAT : BVERR_SRC2GEOM_FORMAT; @@ -1536,7 +1636,7 @@ enum bverror parse_source(struct bvbltparams *bvbltparams, } /* Validate source geometry. */ - if (!valid_geom(srcdesc, srcgeom, srcinfo->format)) { + if (!valid_geom(srcinfo)) { BVSETBLTERROR((srcinfo->index == 0) ? BVERR_SRC1GEOM : BVERR_SRC2GEOM, @@ -1547,7 +1647,7 @@ enum bverror parse_source(struct bvbltparams *bvbltparams, /* Source must be 8 pixel aligned. */ stridealign = srcinfo->format->bitspp - 1; - if ((srcgeom->virtstride & stridealign) != 0) { + if ((srcinfo->geom->virtstride & stridealign) != 0) { BVSETBLTERROR((srcinfo->index == 0) ? BVERR_SRC1GEOM_STRIDE : BVERR_SRC2GEOM_STRIDE, @@ -1556,14 +1656,14 @@ enum bverror parse_source(struct bvbltparams *bvbltparams, } /* Parse orientation. */ - srcinfo->angle = get_angle(srcgeom->orientation); + srcinfo->angle = get_angle(srcinfo->geom->orientation); if (srcinfo->angle == ROT_ANGLE_INVALID) { BVSETBLTERROR((srcinfo->index == 0) ? BVERR_SRC1GEOM : BVERR_SRC2GEOM, "unsupported source%d orientation %d.", srcinfo->index + 1, - srcgeom->orientation); + srcinfo->geom->orientation); } /* Determine source mirror. */ @@ -1576,27 +1676,219 @@ enum bverror parse_source(struct bvbltparams *bvbltparams, GCDBG(GCZONE_SRC, "source surface %d:\n", srcinfo->index + 1); GCDBG(GCZONE_SRC, " rotation %d degrees.\n", srcinfo->angle * 90); - if (srcdesc->auxtype == BVAT_PHYSDESC) { + if (srcinfo->buf.desc->auxtype == BVAT_PHYSDESC) { struct bvphysdesc *bvphysdesc; - bvphysdesc = (struct bvphysdesc *) srcdesc->auxptr; + bvphysdesc = (struct bvphysdesc *) srcinfo->buf.desc->auxptr; GCDBG(GCZONE_DEST, " page offset = 0x%08X\n", bvphysdesc->pageoffset); } else { GCDBG(GCZONE_DEST, " virtual address = 0x%08X\n", - (unsigned int) srcdesc->virtaddr); + (unsigned int) srcinfo->buf.desc->virtaddr); } GCDBG(GCZONE_SRC, " stride = %ld\n", - srcgeom->virtstride); + srcinfo->geom->virtstride); GCDBG(GCZONE_SRC, " geometry size = %dx%d\n", - srcgeom->width, srcgeom->height); - GCDBG(GCZONE_SRC, " rect = (%d,%d)-(%d,%d), %dx%d\n", - srcrect->left, srcrect->top, - srcrect->left + srcrect->width, - srcrect->top + srcrect->height, - srcrect->width, srcrect->height); + srcinfo->geom->width, srcinfo->geom->height); GCDBG(GCZONE_SRC, " mirror = %d\n", srcinfo->mirror); exit: return bverror; } + +static enum bverror parse_implicitscale(struct bvbltparams *bvbltparams, + struct gcbatch *batch) +{ + enum bverror bverror = BVERR_NONE; + unsigned int quality; + unsigned int technique; + unsigned int imagetype; + + GCENTER(GCZONE_SCALING); + + quality = (bvbltparams->scalemode & BVSCALEDEF_QUALITY_MASK) + >> BVSCALEDEF_QUALITY_SHIFT; + technique = (bvbltparams->scalemode & BVSCALEDEF_TECHNIQUE_MASK) + >> BVSCALEDEF_TECHNIQUE_SHIFT; + imagetype = (bvbltparams->scalemode & BVSCALEDEF_TYPE_MASK) + >> BVSCALEDEF_TYPE_SHIFT; + + GCDBG(GCZONE_SCALING, "quality = %d\n", quality); + GCDBG(GCZONE_SCALING, "technique = %d\n", technique); + GCDBG(GCZONE_SCALING, "imagetype = %d\n", imagetype); + + switch (quality) { + case BVSCALEDEF_FASTEST >> BVSCALEDEF_QUALITY_SHIFT: + batch->op.filter.horkernelsize = 3; + batch->op.filter.verkernelsize = 3; + break; + + case BVSCALEDEF_GOOD >> BVSCALEDEF_QUALITY_SHIFT: + batch->op.filter.horkernelsize = 5; + batch->op.filter.verkernelsize = 5; + break; + + case BVSCALEDEF_BETTER >> BVSCALEDEF_QUALITY_SHIFT: + batch->op.filter.horkernelsize = 7; + batch->op.filter.verkernelsize = 7; + break; + + case BVSCALEDEF_BEST >> BVSCALEDEF_QUALITY_SHIFT: + batch->op.filter.horkernelsize = 9; + batch->op.filter.verkernelsize = 9; + break; + + default: + BVSETBLTERROR(BVERR_SCALE_MODE, + "unsupported scale quality 0x%02X", quality); + goto exit; + } + + switch (technique) { + case BVSCALEDEF_DONT_CARE >> BVSCALEDEF_TECHNIQUE_SHIFT: + case BVSCALEDEF_NOT_NEAREST_NEIGHBOR >> BVSCALEDEF_TECHNIQUE_SHIFT: + break; + + case BVSCALEDEF_POINT_SAMPLE >> BVSCALEDEF_TECHNIQUE_SHIFT: + batch->op.filter.horkernelsize = 1; + batch->op.filter.verkernelsize = 1; + break; + + case BVSCALEDEF_INTERPOLATED >> BVSCALEDEF_TECHNIQUE_SHIFT: + break; + + default: + BVSETBLTERROR(BVERR_SCALE_MODE, + "unsupported scale technique %d", technique); + goto exit; + } + + switch (imagetype) { + case 0: + case BVSCALEDEF_PHOTO >> BVSCALEDEF_TYPE_SHIFT: + case BVSCALEDEF_DRAWING >> BVSCALEDEF_TYPE_SHIFT: + break; + + default: + BVSETBLTERROR(BVERR_SCALE_MODE, + "unsupported image type %d", imagetype); + goto exit; + } + +exit: + GCEXIT(GCZONE_SCALING); + return bverror; +} + +static enum bverror parse_explicitscale(struct bvbltparams *bvbltparams, + struct gcbatch *batch) +{ + enum bverror bverror = BVERR_NONE; + unsigned int horsize; + unsigned int versize; + + GCENTER(GCZONE_SCALING); + + horsize = (bvbltparams->scalemode & BVSCALEDEF_HORZ_MASK) + >> BVSCALEDEF_HORZ_SHIFT; + versize = (bvbltparams->scalemode & BVSCALEDEF_VERT_MASK) + >> BVSCALEDEF_VERT_SHIFT; + + GCDBG(GCZONE_SCALING, "horsize = %d\n", horsize); + GCDBG(GCZONE_SCALING, "versize = %d\n", versize); + + switch (horsize) { + case BVSCALEDEF_NEAREST_NEIGHBOR: + batch->op.filter.horkernelsize = 1; + break; + + case BVSCALEDEF_LINEAR: + case BVSCALEDEF_CUBIC: + case BVSCALEDEF_3_TAP: + batch->op.filter.horkernelsize = 3; + break; + + case BVSCALEDEF_5_TAP: + batch->op.filter.horkernelsize = 5; + break; + + case BVSCALEDEF_7_TAP: + batch->op.filter.horkernelsize = 7; + break; + + case BVSCALEDEF_9_TAP: + batch->op.filter.horkernelsize = 9; + break; + + default: + BVSETBLTERROR(BVERR_SCALE_MODE, + "unsupported horizontal kernel size %d", horsize); + goto exit; + } + + switch (versize) { + case BVSCALEDEF_NEAREST_NEIGHBOR: + batch->op.filter.verkernelsize = 1; + break; + + case BVSCALEDEF_LINEAR: + case BVSCALEDEF_CUBIC: + case BVSCALEDEF_3_TAP: + batch->op.filter.verkernelsize = 3; + break; + + case BVSCALEDEF_5_TAP: + batch->op.filter.verkernelsize = 5; + break; + + case BVSCALEDEF_7_TAP: + batch->op.filter.verkernelsize = 7; + break; + + case BVSCALEDEF_9_TAP: + batch->op.filter.verkernelsize = 9; + break; + + default: + BVSETBLTERROR(BVERR_SCALE_MODE, + "unsupported vertical kernel size %d", versize); + goto exit; + } + +exit: + GCEXIT(GCZONE_SCALING); + return bverror; +} + +enum bverror parse_scalemode(struct bvbltparams *bvbltparams, + struct gcbatch *batch) +{ + enum bverror bverror; + unsigned int scaleclass; + + GCENTER(GCZONE_SCALING); + + scaleclass = (bvbltparams->scalemode & BVSCALEDEF_CLASS_MASK) + >> BVSCALEDEF_CLASS_SHIFT; + + GCDBG(GCZONE_SCALING, "scaleclass = %d\n", scaleclass); + + switch (scaleclass) { + case BVSCALEDEF_IMPLICIT >> BVSCALEDEF_CLASS_SHIFT: + bverror = parse_implicitscale(bvbltparams, batch); + break; + + case BVSCALEDEF_EXPLICIT >> BVSCALEDEF_CLASS_SHIFT: + bverror = parse_explicitscale(bvbltparams, batch); + break; + + default: + BVSETBLTERROR(BVERR_SCALE_MODE, + "unsupported scale class %d", scaleclass); + goto exit; + } + +exit: + GCEXIT(GCZONE_SCALING); + return bverror; +} diff --git a/drivers/misc/gcx/gccore/gcdbglog.c b/drivers/misc/gcx/gccore/gcdbglog.c index 93c020c..9d09e60 100644 --- a/drivers/misc/gcx/gccore/gcdbglog.c +++ b/drivers/misc/gcx/gccore/gcdbglog.c @@ -91,16 +91,6 @@ * Miscellaneous macros. */ -#define GC_PTR2INT(p) \ -( \ - (unsigned int) (p) \ -) - -#define GC_ALIGN(n, align) \ -( \ - ((n) + ((align) - 1)) & ~((align) - 1) \ -) - #define GC_PTRALIGNMENT(p, alignment) \ ( \ GC_ALIGN(GC_PTR2INT(p), alignment) - GC_PTR2INT(p) \ @@ -124,7 +114,7 @@ #endif #if GC_SHOW_TIME -#define GC_TIME_FORMAT "[%5ld.%ld] " +#define GC_TIME_FORMAT "[%5ld.%10ld] " #endif #if GC_SHOW_DUMP_LINE @@ -512,7 +502,7 @@ static void gc_print_command(struct seq_file *s, struct itembuffer *item, switch (command) { case GCREG_COMMAND_OPCODE_LOAD_STATE: - count = (data32[i] >> 16) & 0x3F; + count = (data32[i] >> 16) & 0x3FF; addr = data32[i] & 0xFFFF; GC_PRINTK(s, "%s 0x%08X: 0x%08X STATE(0x%04X, %d)\n", buffer, item->gpuaddr + (i << 2), @@ -1962,18 +1952,18 @@ int gc_parse_command_buffer(unsigned int *buffer, unsigned int size, break; case gcregSrcOriginRegAddrs: - info->src[0].rect.l + info->src[0].rect.left = buffer[i] & 0xFFFF; - info->src[0].rect.t + info->src[0].rect.top = (buffer[i] >> 16) & 0xFFFF; break; case gcregSrcSizeRegAddrs: - info->src[0].rect.r + info->src[0].rect.right = buffer[i] & 0xFFFF; - info->src[0].rect.b + info->src[0].rect.bottom = (buffer[i] >> 16) & 0xFFFF; break; @@ -2033,10 +2023,10 @@ int gc_parse_command_buffer(unsigned int *buffer, unsigned int size, case gcregBlock4SrcOriginRegAddrs + 2: case gcregBlock4SrcOriginRegAddrs + 3: index = addr & 3; - info->src[index].rect.l + info->src[index].rect.left = buffer[i] & 0xFFFF; - info->src[index].rect.t + info->src[index].rect.top = (buffer[i] >> 16) & 0xFFFF; break; @@ -2045,10 +2035,10 @@ int gc_parse_command_buffer(unsigned int *buffer, unsigned int size, case gcregBlock4SrcSizeRegAddrs + 2: case gcregBlock4SrcSizeRegAddrs + 3: index = addr & 3; - info->src[index].rect.r + info->src[index].rect.right = buffer[i] & 0xFFFF; - info->src[index].rect.b + info->src[index].rect.bottom = (buffer[i] >> 16) & 0xFFFF; break; @@ -2077,15 +2067,15 @@ int gc_parse_command_buffer(unsigned int *buffer, unsigned int size, i += 2; for (j = 0; j < info->dst.rectcount; j += 1) { - info->dst.rect[j].l + info->dst.rect[j].left = buffer[i] & 0xFFFF; - info->dst.rect[j].t + info->dst.rect[j].top = (buffer[i] >> 16) & 0xFFFF; i += 1; - info->dst.rect[j].r + info->dst.rect[j].right = buffer[i] & 0xFFFF; - info->dst.rect[j].b + info->dst.rect[j].bottom = (buffer[i] >> 16) & 0xFFFF; i += 1; } diff --git a/drivers/misc/gcx/gccore/gcdebug.c b/drivers/misc/gcx/gccore/gcdebug.c index b3395a1..fdabcb2 100644 --- a/drivers/misc/gcx/gccore/gcdebug.c +++ b/drivers/misc/gcx/gccore/gcdebug.c @@ -73,7 +73,7 @@ void gc_debug_cache_gpu_id(void) g_gcGpuId.chipDate = gc_read_reg(GC_CHIP_DATE_Address); g_gcGpuId.chipTime = gc_read_reg(GC_CHIP_TIME_Address); g_gcGpuId.chipFeatures = gc_read_reg(GC_FEATURES_Address); - g_gcGpuId.chipMinorFeatures = gc_read_reg(GC_MINOR_FEATURES0_Address); + g_gcGpuId.chipMinorFeatures = gc_read_reg(GC_FEATURES0_Address); g_gcGpuId.valid = 1; } diff --git a/drivers/misc/gcx/gccore/gcmain.c b/drivers/misc/gcx/gccore/gcmain.c index 6c7f0db..2754f11 100644 --- a/drivers/misc/gcx/gccore/gcmain.c +++ b/drivers/misc/gcx/gccore/gcmain.c @@ -31,6 +31,7 @@ #define GCZONE_COMMIT (1 << 3) #define GCZONE_MAPPING (1 << 4) #define GCZONE_PROBE (1 << 5) +#define GCZONE_CALLBACK (1 << 6) GCDBG_FILTERDEF(core, GCZONE_NONE, "init", @@ -38,7 +39,8 @@ GCDBG_FILTERDEF(core, GCZONE_NONE, "power", "commit", "mapping", - "probe") + "probe", + "callback") #if !defined(GC_ENABLE_SUSPEND) @@ -58,8 +60,8 @@ static struct gccorecontext g_context; */ static enum gcerror find_context(struct gccorecontext *gccorecontext, - bool fromuser, - struct gcmmucontext **gcmmucontext) + bool fromuser, + struct gcmmucontext **gcmmucontext) { enum gcerror gcerror = GCERR_NONE; struct list_head *ctxhead; @@ -444,10 +446,29 @@ void gcpwr_reset(struct gccorecontext *gccorecontext) /******************************************************************************* - * Command buffer submission. + * Public API. */ -void gc_commit(struct gccommit *gccommit, bool fromuser) +void gc_caps(struct gcicaps *gcicaps) +{ + struct gccorecontext *gccorecontext = &g_context; + + /* Copy capabilities. */ + gcicaps->gcmodel = gccorecontext->gcmodel; + gcicaps->gcrevision = gccorecontext->gcrevision; + gcicaps->gcdate = gccorecontext->gcdate; + gcicaps->gctime = gccorecontext->gctime; + gcicaps->gcfeatures = gccorecontext->gcfeatures; + gcicaps->gcfeatures0 = gccorecontext->gcfeatures0; + gcicaps->gcfeatures1 = gccorecontext->gcfeatures1; + gcicaps->gcfeatures2 = gccorecontext->gcfeatures2; + gcicaps->gcfeatures3 = gccorecontext->gcfeatures3; + + /* Success. */ + gcicaps->gcerror = GCERR_NONE; +} + +void gc_commit(struct gcicommit *gcicommit, bool fromuser) { struct gccorecontext *gccorecontext = &g_context; struct gcmmucontext *gcmmucontext; @@ -464,31 +485,31 @@ void gc_commit(struct gccommit *gccommit, bool fromuser) GCLOCK(&gccorecontext->mmucontextlock); /* Validate pipe values. */ - if ((gccommit->entrypipe != GCPIPE_2D) && - (gccommit->entrypipe != GCPIPE_3D)) { - gccommit->gcerror = GCERR_CMD_ENTRY_PIPE; + if ((gcicommit->entrypipe != GCPIPE_2D) && + (gcicommit->entrypipe != GCPIPE_3D)) { + gcicommit->gcerror = GCERR_CMD_ENTRY_PIPE; goto exit; } - if ((gccommit->exitpipe != GCPIPE_2D) && - (gccommit->exitpipe != GCPIPE_3D)) { - gccommit->gcerror = GCERR_CMD_EXIT_PIPE; + if ((gcicommit->exitpipe != GCPIPE_2D) && + (gcicommit->exitpipe != GCPIPE_3D)) { + gcicommit->gcerror = GCERR_CMD_EXIT_PIPE; goto exit; } /* Locate the client entry. */ - gccommit->gcerror = find_context(gccorecontext, fromuser, - &gcmmucontext); - if (gccommit->gcerror != GCERR_NONE) + gcicommit->gcerror = find_context(gccorecontext, fromuser, + &gcmmucontext); + if (gcicommit->gcerror != GCERR_NONE) goto exit; /* Set the master table. */ - gccommit->gcerror = gcmmu_set_master(gccorecontext, gcmmucontext); - if (gccommit->gcerror != GCERR_NONE) + gcicommit->gcerror = gcmmu_set_master(gccorecontext, gcmmucontext); + if (gcicommit->gcerror != GCERR_NONE) goto exit; /* Set the correct graphics pipe. */ - if (gccorecontext->gcpipe != gccommit->entrypipe) { + if (gccorecontext->gcpipe != gcicommit->entrypipe) { static struct gcregpipeselect gcregpipeselect[] = { /* GCPIPE_UNKNOWN */ { 0, 0 }, @@ -501,21 +522,22 @@ void gc_commit(struct gccommit *gccommit, bool fromuser) }; GCDBG(GCZONE_COMMIT, "allocating space for pipe switch.\n"); - gccommit->gcerror = gcqueue_alloc(gccorecontext, gcmmucontext, + gcicommit->gcerror = gcqueue_alloc(gccorecontext, gcmmucontext, sizeof(struct gcmopipesel), (void **) &gcmopipesel, NULL); - if (gccommit->gcerror != GCERR_NONE) + if (gcicommit->gcerror != GCERR_NONE) goto exit; gcmopipesel->pipesel_ldst = gcmopipesel_pipesel_ldst; - gcmopipesel->pipesel.reg = gcregpipeselect[gccommit->entrypipe]; + gcmopipesel->pipesel.reg + = gcregpipeselect[gcicommit->entrypipe]; } /* Update the current pipe. */ - gccorecontext->gcpipe = gccommit->exitpipe; + gccorecontext->gcpipe = gcicommit->exitpipe; /* Go through all buffers one at a time. */ - list_for_each(head, &gccommit->buffer) { + list_for_each(head, &gcicommit->buffer) { gcbuffer = list_entry(head, struct gcbuffer, link); GCDBG(GCZONE_COMMIT, "gcbuffer = 0x%08X\n", (unsigned int) gcbuffer); @@ -532,11 +554,11 @@ void gc_commit(struct gccommit *gccommit, bool fromuser) /* Reserve command buffer space. */ GCDBG(GCZONE_COMMIT, "allocating command buffer space.\n"); - gccommit->gcerror = gcqueue_alloc(gccorecontext, gcmmucontext, + gcicommit->gcerror = gcqueue_alloc(gccorecontext, gcmmucontext, buffersize, (void **) &logical, &address); - if (gccommit->gcerror != GCERR_NONE) + if (gcicommit->gcerror != GCERR_NONE) goto exit; if (fromuser) { @@ -544,7 +566,7 @@ void gc_commit(struct gccommit *gccommit, bool fromuser) if (copy_from_user(logical, gcbuffer->head, buffersize)) { GCERR("failed to read data.\n"); - gccommit->gcerror = GCERR_USER_READ; + gcicommit->gcerror = GCERR_USER_READ; goto exit; } } else { @@ -552,45 +574,45 @@ void gc_commit(struct gccommit *gccommit, bool fromuser) } /* Process fixups. */ - gccommit->gcerror = gcmmu_fixup(&gcbuffer->fixup, logical); - if (gccommit->gcerror != GCERR_NONE) + gcicommit->gcerror = gcmmu_fixup(&gcbuffer->fixup, logical); + if (gcicommit->gcerror != GCERR_NONE) goto exit; } /* Add the callback. */ - if (gccommit->callback != NULL) { - gccommit->gcerror = gcqueue_callback(gccorecontext, + if (gcicommit->callback != NULL) { + gcicommit->gcerror = gcqueue_callback(gccorecontext, gcmmucontext, - gccommit->callback, - gccommit->callbackparam); - if (gccommit->gcerror != GCERR_NONE) + gcicommit->callback, + gcicommit->callbackparam); + if (gcicommit->gcerror != GCERR_NONE) goto exit; } /* Process unmappings. */ - list_for_each(head, &gccommit->unmap) { + list_for_each(head, &gcicommit->unmap) { gcschedunmap = list_entry(head, struct gcschedunmap, link); - gccommit->gcerror = gcqueue_schedunmap(gccorecontext, + gcicommit->gcerror = gcqueue_schedunmap(gccorecontext, gcmmucontext, gcschedunmap->handle); - if (gccommit->gcerror != GCERR_NONE) + if (gcicommit->gcerror != GCERR_NONE) goto exit; } /* Execute the buffer. */ - gccommit->gcerror = gcqueue_execute(gccorecontext, false, - gccommit->asynchronous); + gcicommit->gcerror = gcqueue_execute(gccorecontext, false, + gcicommit->asynchronous); exit: GCUNLOCK(&gccorecontext->mmucontextlock); GCEXITARG(GCZONE_COMMIT, "gc%s = 0x%08X\n", - (gccommit->gcerror == GCERR_NONE) ? "result" : "error", - gccommit->gcerror); + (gcicommit->gcerror == GCERR_NONE) ? "result" : "error", + gcicommit->gcerror); } EXPORT_SYMBOL(gc_commit); -void gc_map(struct gcmap *gcmap, bool fromuser) +void gc_map(struct gcimap *gcimap, bool fromuser) { struct gccorecontext *gccorecontext = &g_context; struct gcmmucontext *gcmmucontext; @@ -602,40 +624,42 @@ void gc_map(struct gcmap *gcmap, bool fromuser) GCLOCK(&gccorecontext->mmucontextlock); /* Locate the client entry. */ - gcmap->gcerror = find_context(gccorecontext, fromuser, &gcmmucontext); - if (gcmap->gcerror != GCERR_NONE) + gcimap->gcerror = find_context(gccorecontext, + fromuser, + &gcmmucontext); + if (gcimap->gcerror != GCERR_NONE) goto exit; GCDBG(GCZONE_MAPPING, "map client buffer\n"); /* Initialize the mapping parameters. */ - if (gcmap->pagearray == NULL) { - mem.base = ((u32) gcmap->buf.logical) & ~(PAGE_SIZE - 1); - mem.offset = ((u32) gcmap->buf.logical) & (PAGE_SIZE - 1); + if (gcimap->pagearray == NULL) { + mem.base = ((u32) gcimap->buf.logical) & ~(PAGE_SIZE - 1); + mem.offset = ((u32) gcimap->buf.logical) & (PAGE_SIZE - 1); mem.pages = NULL; GCDBG(GCZONE_MAPPING, " logical = 0x%08X\n", - (unsigned int) gcmap->buf.logical); + (unsigned int) gcimap->buf.logical); } else { mem.base = 0; - mem.offset = gcmap->buf.offset; - mem.pages = gcmap->pagearray; + mem.offset = gcimap->buf.offset; + mem.pages = gcimap->pagearray; GCDBG(GCZONE_MAPPING, " pagearray = 0x%08X\n", - (unsigned int) gcmap->pagearray); + (unsigned int) gcimap->pagearray); } - GCDBG(GCZONE_MAPPING, " size = %d\n", gcmap->size); + GCDBG(GCZONE_MAPPING, " size = %d\n", gcimap->size); - mem.count = DIV_ROUND_UP(gcmap->size + mem.offset, PAGE_SIZE); - mem.pagesize = gcmap->pagesize ? gcmap->pagesize : PAGE_SIZE; + mem.count = DIV_ROUND_UP(gcimap->size + mem.offset, PAGE_SIZE); + mem.pagesize = gcimap->pagesize ? gcimap->pagesize : PAGE_SIZE; /* Map the buffer. */ - gcmap->gcerror = gcmmu_map(gccorecontext, gcmmucontext, &mem, &mapped); - if (gcmap->gcerror != GCERR_NONE) + gcimap->gcerror = gcmmu_map(gccorecontext, gcmmucontext, &mem, &mapped); + if (gcimap->gcerror != GCERR_NONE) goto exit; - gcmap->handle = (unsigned int) mapped; + gcimap->handle = (unsigned int) mapped; GCDBG(GCZONE_MAPPING, " mapped address = 0x%08X\n", mapped->address); GCDBG(GCZONE_MAPPING, " handle = 0x%08X\n", (unsigned int) mapped); @@ -644,12 +668,12 @@ exit: GCUNLOCK(&gccorecontext->mmucontextlock); GCEXITARG(GCZONE_MAPPING, "gc%s = 0x%08X\n", - (gcmap->gcerror == GCERR_NONE) ? "result" : "error", - gcmap->gcerror); + (gcimap->gcerror == GCERR_NONE) ? "result" : "error", + gcimap->gcerror); } EXPORT_SYMBOL(gc_map); -void gc_unmap(struct gcmap *gcmap, bool fromuser) +void gc_unmap(struct gcimap *gcimap, bool fromuser) { struct gccorecontext *gccorecontext = &g_context; struct gcmmucontext *gcmmucontext; @@ -659,36 +683,71 @@ void gc_unmap(struct gcmap *gcmap, bool fromuser) GCLOCK(&gccorecontext->mmucontextlock); /* Locate the client entry. */ - gcmap->gcerror = find_context(gccorecontext, fromuser, &gcmmucontext); - if (gcmap->gcerror != GCERR_NONE) + gcimap->gcerror = find_context(gccorecontext, + fromuser, + &gcmmucontext); + if (gcimap->gcerror != GCERR_NONE) goto exit; GCDBG(GCZONE_MAPPING, "unmap client buffer\n"); - GCDBG(GCZONE_MAPPING, " handle = 0x%08X\n", gcmap->handle); + GCDBG(GCZONE_MAPPING, " handle = 0x%08X\n", gcimap->handle); /* Schedule unmapping. */ - gcmap->gcerror = gcqueue_schedunmap(gccorecontext, gcmmucontext, - gcmap->handle); - if (gcmap->gcerror != GCERR_NONE) + gcimap->gcerror = gcqueue_schedunmap(gccorecontext, gcmmucontext, + gcimap->handle); + if (gcimap->gcerror != GCERR_NONE) goto exit; /* Execute the buffer. */ - gcmap->gcerror = gcqueue_execute(gccorecontext, false, false); - if (gcmap->gcerror != GCERR_NONE) + gcimap->gcerror = gcqueue_execute(gccorecontext, false, false); + if (gcimap->gcerror != GCERR_NONE) goto exit; /* Invalidate the handle. */ - gcmap->handle = ~0U; + gcimap->handle = ~0U; exit: GCUNLOCK(&gccorecontext->mmucontextlock); GCEXITARG(GCZONE_MAPPING, "gc%s = 0x%08X\n", - (gcmap->gcerror == GCERR_NONE) ? "result" : "error", - gcmap->gcerror); + (gcimap->gcerror == GCERR_NONE) ? "result" : "error", + gcimap->gcerror); } EXPORT_SYMBOL(gc_unmap); +void gc_callback(struct gcicallbackarm *gcicallbackarm, bool fromuser) +{ + struct gccorecontext *gccorecontext = &g_context; + struct gcmmucontext *gcmmucontext; + + GCENTER(GCZONE_CALLBACK); + + GCLOCK(&gccorecontext->mmucontextlock); + + /* Locate the client entry. */ + gcicallbackarm->gcerror = find_context(gccorecontext, fromuser, + &gcmmucontext); + if (gcicallbackarm->gcerror != GCERR_NONE) + goto exit; + + /* Schedule callback. */ + gcicallbackarm->gcerror + = gcqueue_callback(gccorecontext, + gcmmucontext, + gcicallbackarm->callback, + gcicallbackarm->callbackparam); + if (gcicallbackarm->gcerror != GCERR_NONE) + goto exit; + +exit: + GCUNLOCK(&gccorecontext->mmucontextlock); + + GCEXITARG(GCZONE_CALLBACK, "gc%s = 0x%08X\n", + (gcicallbackarm->gcerror == GCERR_NONE) ? "result" : "error", + gcicallbackarm->gcerror); +} +EXPORT_SYMBOL(gc_callback); + void gc_release(void) { struct gccorecontext *gccorecontext = &g_context; @@ -768,7 +827,7 @@ static int gc_probe(struct platform_device *pdev) GCENTER(GCZONE_PROBE); gccorecontext->plat = (struct omap_gcx_platform_data *) - pdev->dev.platform_data; + pdev->dev.platform_data; gccorecontext->regbase = gccorecontext->plat->regbase; gccorecontext->irqline = platform_get_irq(pdev, pdev->id); gccorecontext->device = &pdev->dev; @@ -780,19 +839,26 @@ static int gc_probe(struct platform_device *pdev) pm_runtime_get_sync(gccorecontext->device); + gccorecontext->gcmodel = gc_read_reg(GC_CHIP_ID_Address); + gccorecontext->gcrevision = gc_read_reg(GC_CHIP_REV_Address); + gccorecontext->gcdate = gc_read_reg(GC_CHIP_DATE_Address); + gccorecontext->gctime = gc_read_reg(GC_CHIP_TIME_Address); + gccorecontext->gcfeatures.raw = gc_read_reg(GC_FEATURES_Address); + gccorecontext->gcfeatures0.raw = gc_read_reg(GC_FEATURES0_Address); + gccorecontext->gcfeatures1.raw = gc_read_reg(GC_FEATURES1_Address); + gccorecontext->gcfeatures2.raw = gc_read_reg(GC_FEATURES2_Address); + gccorecontext->gcfeatures3.raw = gc_read_reg(GC_FEATURES3_Address); + GCDBG(GCZONE_PROBE, "GPU IDENTITY:\n"); - GCDBG(GCZONE_PROBE, " model=%X\n", - gc_read_reg(GC_CHIP_ID_Address)); - GCDBG(GCZONE_PROBE, " revision=%X\n", - gc_read_reg(GC_CHIP_REV_Address)); - GCDBG(GCZONE_PROBE, " date=%X\n", - gc_read_reg(GC_CHIP_DATE_Address)); - GCDBG(GCZONE_PROBE, " time=%X\n", - gc_read_reg(GC_CHIP_TIME_Address)); - GCDBG(GCZONE_PROBE, " chipFeatures=0x%08X\n", - gc_read_reg(GC_FEATURES_Address)); - GCDBG(GCZONE_PROBE, " minorFeatures=0x%08X\n", - gc_read_reg(GC_MINOR_FEATURES0_Address)); + GCDBG(GCZONE_PROBE, " model=%X\n", gccorecontext->gcmodel); + GCDBG(GCZONE_PROBE, " revision=%X\n", gccorecontext->gcrevision); + GCDBG(GCZONE_PROBE, " date=%X\n", gccorecontext->gcdate); + GCDBG(GCZONE_PROBE, " time=%X\n", gccorecontext->gctime); + GCDBG(GCZONE_PROBE, " features=0x%08X\n", gccorecontext->gcfeatures); + GCDBG(GCZONE_PROBE, " features0=0x%08X\n", gccorecontext->gcfeatures0); + GCDBG(GCZONE_PROBE, " features1=0x%08X\n", gccorecontext->gcfeatures1); + GCDBG(GCZONE_PROBE, " features2=0x%08X\n", gccorecontext->gcfeatures2); + GCDBG(GCZONE_PROBE, " features3=0x%08X\n", gccorecontext->gcfeatures3); pm_runtime_put_sync(gccorecontext->device); diff --git a/drivers/misc/gcx/gccore/gcmain.h b/drivers/misc/gcx/gccore/gcmain.h index 38436fe..cc2fa4c 100644 --- a/drivers/misc/gcx/gccore/gcmain.h +++ b/drivers/misc/gcx/gccore/gcmain.h @@ -44,6 +44,17 @@ struct gccorecontext { /* GPU IRQ line. */ int irqline; + /* Capabilities and characteristics. */ + unsigned int gcmodel; + unsigned int gcrevision; + unsigned int gcdate; + unsigned int gctime; + union gcfeatures gcfeatures; + union gcfeatures0 gcfeatures0; + union gcfeatures1 gcfeatures1; + union gcfeatures2 gcfeatures2; + union gcfeatures3 gcfeatures3; + /* Virtual pointer to the GPU register bank. */ void *regbase; diff --git a/drivers/misc/gcx/gccore/gcmmu.c b/drivers/misc/gcx/gccore/gcmmu.c index 98136ca..54c2ee5 100644 --- a/drivers/misc/gcx/gccore/gcmmu.c +++ b/drivers/misc/gcx/gccore/gcmmu.c @@ -277,54 +277,75 @@ static enum gcerror virt2phys(unsigned int logical, pte_t *physical) #endif static enum gcerror get_physical_pages(struct gcmmuphysmem *mem, - pte_t *parray, - struct gcmmuarena *arena) + pte_t *parray, + struct gcmmuarena *arena) { enum gcerror gcerror = GCERR_NONE; struct vm_area_struct *vma; struct page **pages = NULL; - unsigned int base, write; + unsigned long base, start, end; + unsigned int write; int i, count = 0; - /* Reset page descriptor array. */ - arena->pages = NULL; + GCENTER(GCZONE_MAPPING); - /* Get base address shortcut. */ + /* Get the base address. */ base = mem->base; + /* Reset page descriptor array. */ + arena->pages = NULL; + /* Store the logical pointer. */ arena->logical = (void *) base; - /* - * Important Note: base is mapped from user application process - * to current process - it must lie completely within the current - * virtual memory address space in order to be of use to us here. - */ + /* Compute virtual memory area limits. */ + start = base + mem->offset; + end = base + mem->count * mem->pagesize; + GCDBG(GCZONE_MAPPING, "base = 0x%08X\n", base); + GCDBG(GCZONE_MAPPING, "offset = 0x%08X\n", mem->offset); + GCDBG(GCZONE_MAPPING, "count = %d\n", mem->count); + GCDBG(GCZONE_MAPPING, "start = 0x%08X\n", start); + GCDBG(GCZONE_MAPPING, "end = 0x%08X\n", end); + + vma = find_vma(current->mm, start); + if (vma == NULL) { + gcerror = GCERR_MMU_BUFFER_BAD; + GCERR("failed to find VMA.\n"); + goto exit; + } - vma = find_vma(current->mm, base + (mem->count << PAGE_SHIFT) - 1); - if ((vma == NULL) || (base < vma->vm_start)) { + GCDBG(GCZONE_MAPPING, "vm_start = 0x%08X\n", vma->vm_start); + GCDBG(GCZONE_MAPPING, "vm_end = 0x%08X\n", vma->vm_end); + if ((start < vma->vm_start) || (end > vma->vm_end)) { gcerror = GCERR_MMU_BUFFER_BAD; + GCERR("failed to find VMA...\n"); goto exit; } /* Allocate page descriptor array. */ pages = kmalloc(mem->count * sizeof(struct page *), GFP_KERNEL); if (pages == NULL) { + GCERR("failed to allocate page descriptor array.\n"); gcerror = GCERR_SETGRP(GCERR_OODM, GCERR_MMU_DESC_ALLOC); goto exit; } /* Query page descriptors. */ write = ((vma->vm_flags & (VM_WRITE | VM_MAYWRITE)) != 0) ? 1 : 0; + + down_read(¤t->mm->mmap_sem); count = get_user_pages(current, current->mm, base, mem->count, - write, 1, pages, NULL); + write, 1, pages, NULL); + up_read(¤t->mm->mmap_sem); if (count < 0) { /* Kernel allocated buffer. */ for (i = 0; i < mem->count; i += 1) { gcerror = virt2phys(base, &parray[i]); - if (gcerror != GCERR_NONE) + if (gcerror != GCERR_NONE) { + GCERR("failed to convert virtual address.\n"); goto exit; + } base += mem->pagesize; } @@ -333,6 +354,7 @@ static enum gcerror get_physical_pages(struct gcmmuphysmem *mem, for (i = 0; i < mem->count; i += 1) { parray[i] = page_to_phys(pages[i]); if (phys_to_page(parray[i]) != pages[i]) { + GCERR("failed to convert page address.\n"); gcerror = GCERR_MMU_PAGE_BAD; goto exit; } @@ -341,6 +363,7 @@ static enum gcerror get_physical_pages(struct gcmmuphysmem *mem, /* Set page descriptor array. */ arena->pages = pages; } else { + GCERR("invalid number of pages.\n"); gcerror = GCERR_MMU_BUFFER_BAD; goto exit; } @@ -354,6 +377,7 @@ exit: kfree(pages); } + GCEXIT(GCZONE_MAPPING); return gcerror; } @@ -789,6 +813,7 @@ enum gcerror gcmmu_map(struct gccorecontext *gccorecontext, parray_alloc = kmalloc(mem->count * sizeof(pte_t *), GFP_KERNEL); if (parray_alloc == NULL) { + GCERR("failed to allocate page address array\n"); gcerror = GCERR_SETGRP(GCERR_OODM, GCERR_MMU_PHYS_ALLOC); goto exit; diff --git a/drivers/misc/gcx/gcioctl/gcif.c b/drivers/misc/gcx/gcioctl/gcif.c index b0d2ed9..473bedb 100644 --- a/drivers/misc/gcx/gcioctl/gcif.c +++ b/drivers/misc/gcx/gcioctl/gcif.c @@ -32,14 +32,16 @@ #define GCZONE_NONE 0 #define GCZONE_ALL (~0U) #define GCZONE_INIT (1 << 0) -#define GCZONE_MAPPING (1 << 1) -#define GCZONE_CACHE (1 << 2) -#define GCZONE_COMMIT (1 << 3) -#define GCZONE_IOCTL (1 << 4) -#define GCZONE_CALLBACK (1 << 5) +#define GCZONE_CAPS (1 << 1) +#define GCZONE_MAPPING (1 << 2) +#define GCZONE_CACHE (1 << 3) +#define GCZONE_COMMIT (1 << 4) +#define GCZONE_IOCTL (1 << 5) +#define GCZONE_CALLBACK (1 << 6) GCDBG_FILTERDEF(ioctl, GCZONE_NONE, "init", + "caps", "mapping", "cache", "commit", @@ -353,12 +355,12 @@ static enum gcerror alloc_callbackinfo(unsigned long handle, gcerror = GCERR_OODM; goto exit; } - list_add(&temp->link, &gccallbackhandle->scheduled); + list_add_tail(&temp->link, &gccallbackhandle->scheduled); } else { struct list_head *head; head = g_vacinfo.next; temp = list_entry(head, struct gccallbackinfo, link); - list_move(head, &gccallbackhandle->scheduled); + list_move_tail(head, &gccallbackhandle->scheduled); } temp->handle = handle; @@ -443,12 +445,31 @@ static void destroy_callback(void) * API user wrappers. */ -static int gc_commit_wrapper(struct gccommit *gccommit) +static int gc_getcaps_wrapper(struct gcicaps *gcicaps) +{ + int ret = 0; + struct gcicaps cpcaps; + + GCENTER(GCZONE_CAPS); + + /* Call the core driver. */ + gc_caps(&cpcaps); + + if (copy_to_user(gcicaps, &cpcaps, sizeof(struct gcicaps))) { + GCERR("failed to write data.\n"); + ret = -EFAULT; + } + + GCEXIT(GCZONE_CAPS); + return ret; +} + +static int gc_commit_wrapper(struct gcicommit *gcicommit) { int ret = 0; bool buffercopied = false; bool unmapcopied = false; - struct gccommit cpcommit; + struct gcicommit cpcommit; struct gccallbackinfo *gccallbackinfo; struct list_head *gcbufferhead; @@ -467,7 +488,7 @@ static int gc_commit_wrapper(struct gccommit *gccommit) GCENTER(GCZONE_COMMIT); /* Get IOCTL parameters. */ - if (copy_from_user(&cpcommit, gccommit, sizeof(struct gccommit))) { + if (copy_from_user(&cpcommit, gcicommit, sizeof(struct gcicommit))) { GCERR("failed to read data.\n"); cpcommit.gcerror = GCERR_USER_READ; goto exit; @@ -475,7 +496,7 @@ static int gc_commit_wrapper(struct gccommit *gccommit) /* Make a copy of the user buffer list. */ gcbufferhead = cpcommit.buffer.next; - while (gcbufferhead != &gccommit->buffer) { + while (gcbufferhead != &gcicommit->buffer) { gcbuffer = list_entry(gcbufferhead, struct gcbuffer, link); GCDBG(GCZONE_COMMIT, "copying buffer 0x%08X.\n", (unsigned int) gcbuffer); @@ -553,7 +574,7 @@ static int gc_commit_wrapper(struct gccommit *gccommit) /* Copy scheduled unmappings to the local list. */ GCDBG(GCZONE_COMMIT, "copying unmaps.\n"); gcschedunmaphead = cpcommit.unmap.next; - while (gcschedunmaphead != &gccommit->unmap) { + while (gcschedunmaphead != &gcicommit->unmap) { /* Get a pointer to the user structure. */ gcschedunmap = list_entry(gcschedunmaphead, struct gcschedunmap, @@ -612,7 +633,7 @@ static int gc_commit_wrapper(struct gccommit *gccommit) gc_commit(&cpcommit, true); exit: - if (copy_to_user(&gccommit->gcerror, &cpcommit.gcerror, + if (copy_to_user(&gcicommit->gcerror, &cpcommit.gcerror, sizeof(enum gcerror))) { GCERR("failed to write data.\n"); ret = -EFAULT; @@ -626,16 +647,16 @@ exit: return ret; } -static int gc_map_wrapper(struct gcmap *gcmap) +static int gc_map_wrapper(struct gcimap *gcimap) { int ret = 0; int mapped = 0; - struct gcmap cpmap; + struct gcimap cpmap; GCENTER(GCZONE_MAPPING); /* Get IOCTL parameters. */ - if (copy_from_user(&cpmap, gcmap, sizeof(struct gcmap))) { + if (copy_from_user(&cpmap, gcimap, sizeof(struct gcimap))) { GCERR("failed to read data.\n"); cpmap.gcerror = GCERR_USER_READ; goto exit; @@ -650,7 +671,7 @@ static int gc_map_wrapper(struct gcmap *gcmap) mapped = 1; exit: - if (copy_to_user(gcmap, &cpmap, offsetof(struct gcmap, buf))) { + if (copy_to_user(gcimap, &cpmap, offsetof(struct gcimap, buf))) { GCERR("failed to write data.\n"); cpmap.gcerror = GCERR_USER_WRITE; ret = -EFAULT; @@ -665,15 +686,15 @@ exit: return ret; } -static int gc_unmap_wrapper(struct gcmap *gcmap) +static int gc_unmap_wrapper(struct gcimap *gcimap) { int ret = 0; - struct gcmap cpmap; + struct gcimap cpmap; GCENTER(GCZONE_MAPPING); /* Get IOCTL parameters. */ - if (copy_from_user(&cpmap, gcmap, sizeof(struct gcmap))) { + if (copy_from_user(&cpmap, gcimap, sizeof(struct gcimap))) { GCERR("failed to read data.\n"); cpmap.gcerror = GCERR_USER_READ; goto exit; @@ -683,7 +704,7 @@ static int gc_unmap_wrapper(struct gcmap *gcmap) gc_unmap(&cpmap, true); exit: - if (copy_to_user(gcmap, &cpmap, offsetof(struct gcmap, buf))) { + if (copy_to_user(gcimap, &cpmap, offsetof(struct gcimap, buf))) { GCERR("failed to write data.\n"); ret = -EFAULT; } @@ -692,15 +713,15 @@ exit: return ret; } -static int gc_cache_wrapper(struct gccachexfer *gccachexfer) +static int gc_cache_wrapper(struct gcicache *gcicache) { int ret = 0; - struct gccachexfer cpcache; + struct gcicache cpcache; GCENTER(GCZONE_CACHE); /* Get IOCTL parameters. */ - if (copy_from_user(&cpcache, gccachexfer, sizeof(struct gccachexfer))) { + if (copy_from_user(&cpcache, gcicache, sizeof(struct gcicache))) { GCERR("failed to read data.\n"); goto exit; } @@ -727,10 +748,10 @@ exit: return ret; } -static int gc_callback_alloc(struct gccmdcallback *gccmdcallback) +static int gc_callback_alloc(struct gcicallback *gcicallback) { int ret = 0; - struct gccmdcallback cpcmdcallback; + struct gcicallback cpcmdcallback; struct gccallbackhandle *gccallbackhandle; GCENTER(GCZONE_CALLBACK); @@ -747,8 +768,8 @@ static int gc_callback_alloc(struct gccmdcallback *gccmdcallback) cpcmdcallback.handle = (unsigned long) gccallbackhandle; exit: - if (copy_to_user(gccmdcallback, &cpcmdcallback, - sizeof(struct gccmdcallback))) { + if (copy_to_user(gcicallback, &cpcmdcallback, + sizeof(struct gcicallback))) { GCERR("failed to write data.\n"); ret = -EFAULT; } @@ -757,17 +778,17 @@ exit: return ret; } -static int gc_callback_free(struct gccmdcallback *gccmdcallback) +static int gc_callback_free(struct gcicallback *gcicallback) { int ret = 0; - struct gccmdcallback cpcmdcallback; + struct gcicallback cpcmdcallback; struct gccallbackhandle *gccallbackhandle; GCENTER(GCZONE_CALLBACK); /* Get IOCTL parameters. */ - if (copy_from_user(&cpcmdcallback, gccmdcallback, - sizeof(struct gccmdcallback))) { + if (copy_from_user(&cpcmdcallback, gcicallback, + sizeof(struct gcicallback))) { GCERR("failed to read data.\n"); cpcmdcallback.gcerror = GCERR_USER_READ; goto exit; @@ -782,8 +803,8 @@ static int gc_callback_free(struct gccmdcallback *gccmdcallback) cpcmdcallback.gcerror = GCERR_NONE; exit: - if (copy_to_user(gccmdcallback, &cpcmdcallback, - sizeof(struct gccmdcallback))) { + if (copy_to_user(gcicallback, &cpcmdcallback, + sizeof(struct gcicallback))) { GCERR("failed to write data.\n"); ret = -EFAULT; } @@ -792,10 +813,10 @@ exit: return ret; } -static int gc_callback_wait(struct gccmdcallbackwait *gccmdcallbackwait) +static int gc_callback_wait(struct gcicallbackwait *gcicallbackwait) { int ret = 0; - struct gccmdcallbackwait cpcmdcallbackwait; + struct gcicallbackwait cpcmdcallbackwait; struct gccallbackhandle *gccallbackhandle; struct gccallbackinfo *gccallbackinfo; struct list_head *head; @@ -804,8 +825,8 @@ static int gc_callback_wait(struct gccmdcallbackwait *gccmdcallbackwait) GCENTER(GCZONE_CALLBACK); /* Get IOCTL parameters. */ - if (copy_from_user(&cpcmdcallbackwait, gccmdcallbackwait, - sizeof(struct gccmdcallbackwait))) { + if (copy_from_user(&cpcmdcallbackwait, gcicallbackwait, + sizeof(struct gcicallbackwait))) { GCERR("failed to read data.\n"); cpcmdcallbackwait.gcerror = GCERR_USER_READ; goto exit; @@ -823,14 +844,16 @@ static int gc_callback_wait(struct gccmdcallbackwait *gccmdcallbackwait) timeout = wait_for_completion_interruptible_timeout( &gccallbackhandle->ready, timeout); - if (timeout < 0) + if (timeout < 0) { + /* Error occurred. */ ret = timeout; - - else if (timeout == 0) { + } else if (timeout == 0) { + /* Timeout. */ cpcmdcallbackwait.gcerror = GCERR_TIMEOUT; cpcmdcallbackwait.callback = NULL; cpcmdcallbackwait.callbackparam = NULL; } else { + /* Callback event triggered. */ GCLOCK(&g_callbacklock); if (list_empty(&gccallbackhandle->triggered)) { @@ -857,8 +880,52 @@ static int gc_callback_wait(struct gccmdcallbackwait *gccmdcallbackwait) } exit: - if (copy_to_user(gccmdcallbackwait, &cpcmdcallbackwait, - sizeof(struct gccmdcallbackwait))) { + if (copy_to_user(gcicallbackwait, &cpcmdcallbackwait, + sizeof(struct gcicallbackwait))) { + GCERR("failed to write data.\n"); + ret = -EFAULT; + } + + GCEXIT(GCZONE_CALLBACK); + return ret; +} + +static int gc_callback_arm(struct gcicallbackarm *gcicallbackarm) +{ + int ret = 0; + struct gcicallbackarm cpcallbackarm; + struct gccallbackinfo *gccallbackinfo; + + GCENTER(GCZONE_CALLBACK); + + /* Get IOCTL parameters. */ + if (copy_from_user(&cpcallbackarm, gcicallbackarm, + sizeof(struct gcicallbackarm))) { + GCERR("failed to read data.\n"); + cpcallbackarm.gcerror = GCERR_USER_READ; + goto exit; + } + + /* Allocate callback info. */ + cpcallbackarm.gcerror = alloc_callbackinfo(cpcallbackarm.handle, + &gccallbackinfo); + if (cpcallbackarm.gcerror != GCERR_NONE) + goto exit; + + /* Initialize callback info. */ + gccallbackinfo->callback = cpcallbackarm.callback; + gccallbackinfo->callbackparam = cpcallbackarm.callbackparam; + + /* Substiture the callback. */ + cpcallbackarm.callback = gccallback; + cpcallbackarm.callbackparam = gccallbackinfo; + + /* Call the core driver. */ + gc_callback(&cpcallbackarm, true); + +exit: + if (copy_to_user(&gcicallbackarm->gcerror, &cpcallbackarm.gcerror, + sizeof(enum gcerror))) { GCERR("failed to write data.\n"); ret = -EFAULT; } @@ -895,39 +962,49 @@ static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) int ret; switch (cmd) { + case GCIOCTL_GETCAPS: + GCDBG(GCZONE_IOCTL, "GCIOCTL_GETCAPS\n"); + ret = gc_getcaps_wrapper((struct gcicaps *) arg); + break; + case GCIOCTL_COMMIT: GCDBG(GCZONE_IOCTL, "GCIOCTL_COMMIT\n"); - ret = gc_commit_wrapper((struct gccommit *) arg); + ret = gc_commit_wrapper((struct gcicommit *) arg); break; case GCIOCTL_MAP: GCDBG(GCZONE_IOCTL, "GCIOCTL_MAP\n"); - ret = gc_map_wrapper((struct gcmap *) arg); + ret = gc_map_wrapper((struct gcimap *) arg); break; case GCIOCTL_UNMAP: GCDBG(GCZONE_IOCTL, "GCIOCTL_UNMAP\n"); - ret = gc_unmap_wrapper((struct gcmap *) arg); + ret = gc_unmap_wrapper((struct gcimap *) arg); break; case GCIOCTL_CACHE: GCDBG(GCZONE_IOCTL, "GCIOCTL_CACHE\n"); - ret = gc_cache_wrapper((struct gccachexfer *) arg); + ret = gc_cache_wrapper((struct gcicache *) arg); break; case GCIOCTL_CALLBACK_ALLOC: GCDBG(GCZONE_IOCTL, "GCIOCTL_CALLBACK_ALLOC\n"); - ret = gc_callback_alloc((struct gccmdcallback *) arg); + ret = gc_callback_alloc((struct gcicallback *) arg); break; case GCIOCTL_CALLBACK_FREE: GCDBG(GCZONE_IOCTL, "GCIOCTL_CALLBACK_FREE\n"); - ret = gc_callback_free((struct gccmdcallback *) arg); + ret = gc_callback_free((struct gcicallback *) arg); break; case GCIOCTL_CALLBACK_WAIT: GCDBG(GCZONE_IOCTL, "GCIOCTL_CALLBACK_WAIT\n"); - ret = gc_callback_wait((struct gccmdcallbackwait *) arg); + ret = gc_callback_wait((struct gcicallbackwait *) arg); + break; + + case GCIOCTL_CALLBACK_ARM: + GCDBG(GCZONE_IOCTL, "GCIOCTL_CALLBACK_ARM\n"); + ret = gc_callback_arm((struct gcicallbackarm *) arg); break; default: diff --git a/include/linux/gccore.h b/include/linux/gccore.h index 566c661..ce9ed4f 100644 --- a/include/linux/gccore.h +++ b/include/linux/gccore.h @@ -18,12 +18,18 @@ #include "sched.h" #include "gcioctl.h" +/* Capability query. */ +void gc_caps(struct gcicaps *gcicaps); + /* Command buffer submission. */ -void gc_commit(struct gccommit *gccommit, bool fromuser); +void gc_commit(struct gcicommit *gcicommit, bool fromuser); + +/* Client memory mapping. */ +void gc_map(struct gcimap *gcimap, bool fromuser); +void gc_unmap(struct gcimap *gcimap, bool fromuser); -/* Surface management. */ -void gc_map(struct gcmap *gcmap, bool fromuser); -void gc_unmap(struct gcmap *gcmap, bool fromuser); +/* Arm a callback. */ +void gc_callback(struct gcicallbackarm *gcicallbackarm, bool fromuser); /* Process cleanup. */ void gc_release(void); diff --git a/include/linux/gcdbglog.h b/include/linux/gcdbglog.h index aa10418..35a198c 100644 --- a/include/linux/gcdbglog.h +++ b/include/linux/gcdbglog.h @@ -261,13 +261,6 @@ do { \ * Command buffer parser. */ -struct gcrect { - int l; - int t; - int r; - int b; -}; - struct gcsurfaceinfo { unsigned int width; unsigned int height; @@ -278,6 +271,13 @@ struct gcsurfaceinfo { unsigned int bpp; }; +struct gcrect { + int left; + int top; + int right; + int bottom; +}; + struct gcsourceinfo { struct gcsurfaceinfo surf; struct gcrect rect; diff --git a/include/linux/gcioctl.h b/include/linux/gcioctl.h index 64d9cfd..c89ddd8 100644 --- a/include/linux/gcioctl.h +++ b/include/linux/gcioctl.h @@ -17,6 +17,7 @@ #include "list.h" #include "gcerror.h" +#include "gcreg.h" #include "cache-2dmanager.h" #include "bverror.h" @@ -26,10 +27,39 @@ /******************************************************************************* + * Capability query API entry. + */ + +#define GCIOCTL_GETCAPS _IOWR(GCIOCTL_TYPE, GCIOCTL_BASE + 0x00, \ + struct gcicaps) + +/* GCIOCTL_CALLBACK_ALLOC / GCIOCTL_CALLBACK_FREE: + * To be able to use the callback mechanism each user space client must + * use the ALLOC/FREE APIs to manage a kernel side callback object + * represented by the handle member of struct gcicallback. + * ALLOC API allocates the object and returns the handle to it. */ +struct gcicaps { + /* Error code. */ + enum gcerror gcerror; + + /* Capabilities and characteristics. */ + unsigned int gcmodel; + unsigned int gcrevision; + unsigned int gcdate; + unsigned int gctime; + union gcfeatures gcfeatures; + union gcfeatures0 gcfeatures0; + union gcfeatures1 gcfeatures1; + union gcfeatures2 gcfeatures2; + union gcfeatures3 gcfeatures3; +}; + +/******************************************************************************* * Commit API entry. */ -#define GCIOCTL_COMMIT _IOWR(GCIOCTL_TYPE, GCIOCTL_BASE + 0x10, struct gccommit) +#define GCIOCTL_COMMIT _IOWR(GCIOCTL_TYPE, GCIOCTL_BASE + 0x10, \ + struct gcicommit) /* GPU graphics pipe definition. */ enum gcpipe { @@ -40,7 +70,7 @@ enum gcpipe { /* Commit header; contains pointers to the head and the tail of a linked list of command buffers to execute. */ -struct gccommit { +struct gcicommit { /* Return status code. */ enum gcerror gcerror; @@ -60,6 +90,8 @@ struct gccommit { * passed to the callback. */ void (*callback) (void *callbackparam); void *callbackparam; + + /* Callback object handle allocated with GCIOCTL_CALLBACK_ALLOC API. */ unsigned long handle; /* If asynchronous is set to true, the call returns immediately without @@ -125,10 +157,12 @@ struct gcschedunmap { * Map/unmap API entries. */ -#define GCIOCTL_MAP _IOWR(GCIOCTL_TYPE, GCIOCTL_BASE + 0x20, struct gcmap) -#define GCIOCTL_UNMAP _IOWR(GCIOCTL_TYPE, GCIOCTL_BASE + 0x21, struct gcmap) +#define GCIOCTL_MAP _IOWR(GCIOCTL_TYPE, GCIOCTL_BASE + 0x20, \ + struct gcimap) +#define GCIOCTL_UNMAP _IOWR(GCIOCTL_TYPE, GCIOCTL_BASE + 0x21, \ + struct gcimap) -struct gcmap { +struct gcimap { /* Return status code. */ enum gcerror gcerror; @@ -156,14 +190,14 @@ struct gcmap { }; -/***************************************************************************** +/******************************************************************************* * Cache manipulation API entries. */ #define GCIOCTL_CACHE _IOW(GCIOCTL_TYPE, GCIOCTL_BASE + 0x30, \ - struct gccachexfer) + struct gcicache) -struct gccachexfer { +struct gcicache { /* Number of regions. */ int count; @@ -179,26 +213,36 @@ struct gccachexfer { * Callback API entry. */ -#define GCIOCTL_CALLBACK_ALLOC _IOW(GCIOCTL_TYPE, GCIOCTL_BASE + 0x40, \ - struct gccmdcallback) -#define GCIOCTL_CALLBACK_FREE _IOW(GCIOCTL_TYPE, GCIOCTL_BASE + 0x41, \ - struct gccmdcallback) -#define GCIOCTL_CALLBACK_WAIT _IOW(GCIOCTL_TYPE, GCIOCTL_BASE + 0x42, \ - struct gccmdcallbackwait) - -struct gccmdcallback { +#define GCIOCTL_CALLBACK_ALLOC _IOWR(GCIOCTL_TYPE, GCIOCTL_BASE + 0x40, \ + struct gcicallback) +#define GCIOCTL_CALLBACK_FREE _IOWR(GCIOCTL_TYPE, GCIOCTL_BASE + 0x41, \ + struct gcicallback) +#define GCIOCTL_CALLBACK_WAIT _IOWR(GCIOCTL_TYPE, GCIOCTL_BASE + 0x42, \ + struct gcicallbackwait) +#define GCIOCTL_CALLBACK_ARM _IOWR(GCIOCTL_TYPE, GCIOCTL_BASE + 0x43, \ + struct gcicallbackarm) + +/* GCIOCTL_CALLBACK_ALLOC / GCIOCTL_CALLBACK_FREE: + * To be able to use the callback mechanism each user space client must + * use the ALLOC/FREE APIs to manage a kernel side callback object + * represented by the handle member of struct gcicallback. + * ALLOC API allocates the object and returns the handle to it. */ +struct gcicallback { /* Error code. */ enum gcerror gcerror; - /* Callback handle. */ + /* Callback object handle. */ unsigned long handle; }; -struct gccmdcallbackwait { +/* GCIOCTL_CALLBACK_WAIT: + * Called by the user level client to block and wait until the hardware + * has executed a callback that was previosuly scheduled for the handle. */ +struct gcicallbackwait { /* Error code. */ enum gcerror gcerror; - /* Callback handle. */ + /* Callback object handle. */ unsigned long handle; /* Timeout in milliseconds. */ @@ -210,5 +254,22 @@ struct gccmdcallbackwait { void *callbackparam; }; +/* GCIOCTL_CALLBACK_ARM: + * Called by the client to arm a callback. This is similar to what + * COMMIT API does, but in a separate API. */ +struct gcicallbackarm { + /* Return status code. */ + enum gcerror gcerror; + + /* Pointer to the callback function to be called when the GPU completes + * execution of all buffers specified in this call. This member can be + * NULL if no callback is desired. callbackparam specifies data to be + * passed to the callback. */ + void (*callback) (void *callbackparam); + void *callbackparam; + + /* Callback object handle allocated with GCIOCTL_CALLBACK_ALLOC API. */ + unsigned long handle; +}; #endif diff --git a/include/linux/gcreg.h b/include/linux/gcreg.h index c31e89a..9ae0fe6 100644 --- a/include/linux/gcreg.h +++ b/include/linux/gcreg.h @@ -650,6 +650,108 @@ union gcidle { #define GC_FEATURES_FE20_BIT_INDEX_NONE 0x0 #define GC_FEATURES_FE20_BIT_INDEX_AVAILABLE 0x1 +union gcfeatures { + struct { + /* GC_FEATURES_Address:FAST_CLEAR */ + unsigned int fastclear:1; + + /* GC_FEATURES_Address:SPECIAL_ANTI_ALIASING */ + unsigned int specialantialiasing:1; + + /* GC_FEATURES_Address:PIPE_3D */ + unsigned int pipe3d:1; + + /* GC_FEATURES_Address:DXT_TEXTURE_COMPRESSION */ + unsigned int dxt:1; + + /* GC_FEATURES_Address:DEBUG_MODE */ + unsigned int debugmode:1; + + /* GC_FEATURES_Address:ZCOMPRESSION */ + unsigned int zcompression:1; + + /* GC_FEATURES_Address:YUV420_FILTER */ + unsigned int yuv420filter:1; + + /* GC_FEATURES_Address:MSAA */ + unsigned int msaa:1; + + /* GC_FEATURES_Address:DC */ + unsigned int dc:1; + + /* GC_FEATURES_Address:PIPE_2D */ + unsigned int pipe2d:1; + + /* GC_FEATURES_Address:ETC1_TEXTURE_COMPRESSION */ + unsigned int etc:1; + + /* GC_FEATURES_Address:FAST_SCALER */ + unsigned int fastscaler:1; + + /* GC_FEATURES_Address:HIGH_DYNAMIC_RANGE */ + unsigned int hdr:1; + + /* GC_FEATURES_Address:YUV420_TILER */ + unsigned int yuv420tiler:1; + + /* GC_FEATURES_Address:MODULE_CG */ + unsigned int clockgating:1; + + /* GC_FEATURES_Address:MIN_AREA */ + unsigned int minarea:1; + + /* GC_FEATURES_Address:NO_EZ */ + unsigned int noez:1; + + /* GC_FEATURES_Address:NO422_TEXTURE */ + unsigned int no422texture:1; + + /* GC_FEATURES_Address:BUFFER_INTERLEAVING */ + unsigned int bufinterleaving:1; + + /* GC_FEATURES_Address:BYTE_WRITE_2D */ + unsigned int bytewrite2d:1; + + /* GC_FEATURES_Address:NO_SCALER */ + unsigned int noscaler:1; + + /* GC_FEATURES_Address:YUY2_AVERAGING */ + unsigned int yuy2averaging:1; + + /* GC_FEATURES_Address:HALF_PE_CACHE */ + unsigned int halfpecache:1; + + /* GC_FEATURES_Address:HALF_TX_CACHE */ + unsigned int halftxcache:1; + + /* GC_FEATURES_Address:YUY2_RENDER_TARGET */ + unsigned int yuy2target:1; + + /* GC_FEATURES_Address:MEM32_BIT_SUPPORT */ + unsigned int mem32:1; + + /* GC_FEATURES_Address:PIPE_VG */ + unsigned int pipevg:1; + + /* GC_FEATURES_Address:VGTS */ + unsigned int vgts:1; + + /* GC_FEATURES_Address:FE20 */ + unsigned int fe20:1; + + /* GC_FEATURES_Address:BYTE_WRITE_3D */ + unsigned int bytewrite3d:1; + + /* GC_FEATURES_Address:RS_YUV_TARGET */ + unsigned int rsyuvtarget:1; + + /* GC_FEATURES_Address:FE20_BIT_INDEX */ + unsigned int fe20bit:1; + } reg; + + unsigned int raw; +}; + /******************************************************************************* ** Register GCChipId */ @@ -754,273 +856,375 @@ union gcidle { ** set reset value. It varies with the implementation. */ -#define GC_MINOR_FEATURES0_Address 0x00034 -#define GC_MINOR_FEATURES0_MSB 15 -#define GC_MINOR_FEATURES0_LSB 0 -#define GC_MINOR_FEATURES0_BLK 0 -#define GC_MINOR_FEATURES0_Count 1 -#define GC_MINOR_FEATURES0_FieldMask 0xFFFFFFFF -#define GC_MINOR_FEATURES0_ReadMask 0xFFFFFFFF -#define GC_MINOR_FEATURES0_WriteMask 0x00000000 -#define GC_MINOR_FEATURES0_ResetValue 0x00000000 +#define GC_FEATURES0_Address 0x00034 +#define GC_FEATURES0_MSB 15 +#define GC_FEATURES0_LSB 0 +#define GC_FEATURES0_BLK 0 +#define GC_FEATURES0_Count 1 +#define GC_FEATURES0_FieldMask 0xFFFFFFFF +#define GC_FEATURES0_ReadMask 0xFFFFFFFF +#define GC_FEATURES0_WriteMask 0x00000000 +#define GC_FEATURES0_ResetValue 0x00000000 /* Y flipping capability is added to resolve. */ -#define GC_MINOR_FEATURES0_FLIP_Y 0 : 0 -#define GC_MINOR_FEATURES0_FLIP_Y_End 0 -#define GC_MINOR_FEATURES0_FLIP_Y_Start 0 -#define GC_MINOR_FEATURES0_FLIP_Y_Type U01 -#define GC_MINOR_FEATURES0_FLIP_Y_NONE 0x0 -#define GC_MINOR_FEATURES0_FLIP_Y_AVAILABLE 0x1 +#define GC_FEATURES0_FLIP_Y 0 : 0 +#define GC_FEATURES0_FLIP_Y_End 0 +#define GC_FEATURES0_FLIP_Y_Start 0 +#define GC_FEATURES0_FLIP_Y_Type U01 +#define GC_FEATURES0_FLIP_Y_NONE 0x0 +#define GC_FEATURES0_FLIP_Y_AVAILABLE 0x1 /* Dual Return Bus from HI to clients. */ -#define GC_MINOR_FEATURES0_DUAL_RETURN_BUS 1 : 1 -#define GC_MINOR_FEATURES0_DUAL_RETURN_BUS_End 1 -#define GC_MINOR_FEATURES0_DUAL_RETURN_BUS_Start 1 -#define GC_MINOR_FEATURES0_DUAL_RETURN_BUS_Type U01 -#define GC_MINOR_FEATURES0_DUAL_RETURN_BUS_NONE 0x0 -#define GC_MINOR_FEATURES0_DUAL_RETURN_BUS_AVAILABLE 0x1 +#define GC_FEATURES0_DUAL_RETURN_BUS 1 : 1 +#define GC_FEATURES0_DUAL_RETURN_BUS_End 1 +#define GC_FEATURES0_DUAL_RETURN_BUS_Start 1 +#define GC_FEATURES0_DUAL_RETURN_BUS_Type U01 +#define GC_FEATURES0_DUAL_RETURN_BUS_NONE 0x0 +#define GC_FEATURES0_DUAL_RETURN_BUS_AVAILABLE 0x1 /* Configurable endianness support. */ -#define GC_MINOR_FEATURES0_ENDIANNESS_CONFIG 2 : 2 -#define GC_MINOR_FEATURES0_ENDIANNESS_CONFIG_End 2 -#define GC_MINOR_FEATURES0_ENDIANNESS_CONFIG_Start 2 -#define GC_MINOR_FEATURES0_ENDIANNESS_CONFIG_Type U01 -#define GC_MINOR_FEATURES0_ENDIANNESS_CONFIG_NONE 0x0 -#define GC_MINOR_FEATURES0_ENDIANNESS_CONFIG_AVAILABLE 0x1 +#define GC_FEATURES0_ENDIANNESS_CONFIG 2 : 2 +#define GC_FEATURES0_ENDIANNESS_CONFIG_End 2 +#define GC_FEATURES0_ENDIANNESS_CONFIG_Start 2 +#define GC_FEATURES0_ENDIANNESS_CONFIG_Type U01 +#define GC_FEATURES0_ENDIANNESS_CONFIG_NONE 0x0 +#define GC_FEATURES0_ENDIANNESS_CONFIG_AVAILABLE 0x1 /* Supports 8Kx8K textures. */ -#define GC_MINOR_FEATURES0_TEXTURE8_K 3 : 3 -#define GC_MINOR_FEATURES0_TEXTURE8_K_End 3 -#define GC_MINOR_FEATURES0_TEXTURE8_K_Start 3 -#define GC_MINOR_FEATURES0_TEXTURE8_K_Type U01 -#define GC_MINOR_FEATURES0_TEXTURE8_K_NONE 0x0 -#define GC_MINOR_FEATURES0_TEXTURE8_K_AVAILABLE 0x1 +#define GC_FEATURES0_TEXTURE8_K 3 : 3 +#define GC_FEATURES0_TEXTURE8_K_End 3 +#define GC_FEATURES0_TEXTURE8_K_Start 3 +#define GC_FEATURES0_TEXTURE8_K_Type U01 +#define GC_FEATURES0_TEXTURE8_K_NONE 0x0 +#define GC_FEATURES0_TEXTURE8_K_AVAILABLE 0x1 /* Driver hack is not needed. */ -#define GC_MINOR_FEATURES0_CORRECT_TEXTURE_CONVERTER 4 : 4 -#define GC_MINOR_FEATURES0_CORRECT_TEXTURE_CONVERTER_End 4 -#define GC_MINOR_FEATURES0_CORRECT_TEXTURE_CONVERTER_Start 4 -#define GC_MINOR_FEATURES0_CORRECT_TEXTURE_CONVERTER_Type U01 -#define GC_MINOR_FEATURES0_CORRECT_TEXTURE_CONVERTER_NONE 0x0 -#define GC_MINOR_FEATURES0_CORRECT_TEXTURE_CONVERTER_AVAILABLE 0x1 +#define GC_FEATURES0_CORRECT_TEXTURE_CONVERTER 4 : 4 +#define GC_FEATURES0_CORRECT_TEXTURE_CONVERTER_End 4 +#define GC_FEATURES0_CORRECT_TEXTURE_CONVERTER_Start 4 +#define GC_FEATURES0_CORRECT_TEXTURE_CONVERTER_Type U01 +#define GC_FEATURES0_CORRECT_TEXTURE_CONVERTER_NONE 0x0 +#define GC_FEATURES0_CORRECT_TEXTURE_CONVERTER_AVAILABLE 0x1 /* Special LOD calculation when MSAA is on. */ -#define GC_MINOR_FEATURES0_SPECIAL_MSAA_LOD 5 : 5 -#define GC_MINOR_FEATURES0_SPECIAL_MSAA_LOD_End 5 -#define GC_MINOR_FEATURES0_SPECIAL_MSAA_LOD_Start 5 -#define GC_MINOR_FEATURES0_SPECIAL_MSAA_LOD_Type U01 -#define GC_MINOR_FEATURES0_SPECIAL_MSAA_LOD_NONE 0x0 -#define GC_MINOR_FEATURES0_SPECIAL_MSAA_LOD_AVAILABLE 0x1 +#define GC_FEATURES0_SPECIAL_MSAA_LOD 5 : 5 +#define GC_FEATURES0_SPECIAL_MSAA_LOD_End 5 +#define GC_FEATURES0_SPECIAL_MSAA_LOD_Start 5 +#define GC_FEATURES0_SPECIAL_MSAA_LOD_Type U01 +#define GC_FEATURES0_SPECIAL_MSAA_LOD_NONE 0x0 +#define GC_FEATURES0_SPECIAL_MSAA_LOD_AVAILABLE 0x1 /* Proper flush is done in fast clear cache. */ -#define GC_MINOR_FEATURES0_FAST_CLEAR_FLUSH 6 : 6 -#define GC_MINOR_FEATURES0_FAST_CLEAR_FLUSH_End 6 -#define GC_MINOR_FEATURES0_FAST_CLEAR_FLUSH_Start 6 -#define GC_MINOR_FEATURES0_FAST_CLEAR_FLUSH_Type U01 -#define GC_MINOR_FEATURES0_FAST_CLEAR_FLUSH_NONE 0x0 -#define GC_MINOR_FEATURES0_FAST_CLEAR_FLUSH_AVAILABLE 0x1 +#define GC_FEATURES0_FAST_CLEAR_FLUSH 6 : 6 +#define GC_FEATURES0_FAST_CLEAR_FLUSH_End 6 +#define GC_FEATURES0_FAST_CLEAR_FLUSH_Start 6 +#define GC_FEATURES0_FAST_CLEAR_FLUSH_Type U01 +#define GC_FEATURES0_FAST_CLEAR_FLUSH_NONE 0x0 +#define GC_FEATURES0_FAST_CLEAR_FLUSH_AVAILABLE 0x1 /* 2D PE 2.0 is present. */ -#define GC_MINOR_FEATURES0_2DPE20 7 : 7 -#define GC_MINOR_FEATURES0_2DPE20_End 7 -#define GC_MINOR_FEATURES0_2DPE20_Start 7 -#define GC_MINOR_FEATURES0_2DPE20_Type U01 -#define GC_MINOR_FEATURES0_2DPE20_NONE 0x0 -#define GC_MINOR_FEATURES0_2DPE20_AVAILABLE 0x1 +#define GC_FEATURES0_2DPE20 7 : 7 +#define GC_FEATURES0_2DPE20_End 7 +#define GC_FEATURES0_2DPE20_Start 7 +#define GC_FEATURES0_2DPE20_Type U01 +#define GC_FEATURES0_2DPE20_NONE 0x0 +#define GC_FEATURES0_2DPE20_AVAILABLE 0x1 /* Reserved. */ -#define GC_MINOR_FEATURES0_CORRECT_AUTO_DISABLE 8 : 8 -#define GC_MINOR_FEATURES0_CORRECT_AUTO_DISABLE_End 8 -#define GC_MINOR_FEATURES0_CORRECT_AUTO_DISABLE_Start 8 -#define GC_MINOR_FEATURES0_CORRECT_AUTO_DISABLE_Type U01 -#define GC_MINOR_FEATURES0_CORRECT_AUTO_DISABLE_NONE 0x0 -#define GC_MINOR_FEATURES0_CORRECT_AUTO_DISABLE_AVAILABLE 0x1 +#define GC_FEATURES0_CORRECT_AUTO_DISABLE 8 : 8 +#define GC_FEATURES0_CORRECT_AUTO_DISABLE_End 8 +#define GC_FEATURES0_CORRECT_AUTO_DISABLE_Start 8 +#define GC_FEATURES0_CORRECT_AUTO_DISABLE_Type U01 +#define GC_FEATURES0_CORRECT_AUTO_DISABLE_NONE 0x0 +#define GC_FEATURES0_CORRECT_AUTO_DISABLE_AVAILABLE 0x1 /* Supports 8K render target. */ -#define GC_MINOR_FEATURES0_RENDER_8K 9 : 9 -#define GC_MINOR_FEATURES0_RENDER_8K_End 9 -#define GC_MINOR_FEATURES0_RENDER_8K_Start 9 -#define GC_MINOR_FEATURES0_RENDER_8K_Type U01 -#define GC_MINOR_FEATURES0_RENDER_8K_NONE 0x0 -#define GC_MINOR_FEATURES0_RENDER_8K_AVAILABLE 0x1 +#define GC_FEATURES0_RENDER_8K 9 : 9 +#define GC_FEATURES0_RENDER_8K_End 9 +#define GC_FEATURES0_RENDER_8K_Start 9 +#define GC_FEATURES0_RENDER_8K_Type U01 +#define GC_FEATURES0_RENDER_8K_NONE 0x0 +#define GC_FEATURES0_RENDER_8K_AVAILABLE 0x1 /* 2 bits are used instead of 4 bits for tile status. */ -#define GC_MINOR_FEATURES0_TILE_STATUS_2BITS 10 : 10 -#define GC_MINOR_FEATURES0_TILE_STATUS_2BITS_End 10 -#define GC_MINOR_FEATURES0_TILE_STATUS_2BITS_Start 10 -#define GC_MINOR_FEATURES0_TILE_STATUS_2BITS_Type U01 -#define GC_MINOR_FEATURES0_TILE_STATUS_2BITS_NONE 0x0 -#define GC_MINOR_FEATURES0_TILE_STATUS_2BITS_AVAILABLE 0x1 +#define GC_FEATURES0_TILE_STATUS_2BITS 10 : 10 +#define GC_FEATURES0_TILE_STATUS_2BITS_End 10 +#define GC_FEATURES0_TILE_STATUS_2BITS_Start 10 +#define GC_FEATURES0_TILE_STATUS_2BITS_Type U01 +#define GC_FEATURES0_TILE_STATUS_2BITS_NONE 0x0 +#define GC_FEATURES0_TILE_STATUS_2BITS_AVAILABLE 0x1 /* Use 2 separate tile status buffers in interleaved mode. */ -#define GC_MINOR_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED 11 : 11 -#define GC_MINOR_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED_End 11 -#define GC_MINOR_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED_Start 11 -#define GC_MINOR_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED_Type U01 -#define GC_MINOR_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED_NONE 0x0 -#define GC_MINOR_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED_AVAILABLE 0x1 +#define GC_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED 11 : 11 +#define GC_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED_End 11 +#define GC_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED_Start 11 +#define GC_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED_Type U01 +#define GC_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED_NONE 0x0 +#define GC_FEATURES0_SEPARATE_TILE_STATUS_WHEN_INTERLEAVED_AVAILABLE 0x1 /* 32x32 super tile is available. */ -#define GC_MINOR_FEATURES0_SUPER_TILED_32X32 12 : 12 -#define GC_MINOR_FEATURES0_SUPER_TILED_32X32_End 12 -#define GC_MINOR_FEATURES0_SUPER_TILED_32X32_Start 12 -#define GC_MINOR_FEATURES0_SUPER_TILED_32X32_Type U01 -#define GC_MINOR_FEATURES0_SUPER_TILED_32X32_NONE 0x0 -#define GC_MINOR_FEATURES0_SUPER_TILED_32X32_AVAILABLE 0x1 +#define GC_FEATURES0_SUPER_TILED_32X32 12 : 12 +#define GC_FEATURES0_SUPER_TILED_32X32_End 12 +#define GC_FEATURES0_SUPER_TILED_32X32_Start 12 +#define GC_FEATURES0_SUPER_TILED_32X32_Type U01 +#define GC_FEATURES0_SUPER_TILED_32X32_NONE 0x0 +#define GC_FEATURES0_SUPER_TILED_32X32_AVAILABLE 0x1 /* Major updates to VG pipe (TS buffer tiling. State masking.). */ -#define GC_MINOR_FEATURES0_VG_20 13 : 13 -#define GC_MINOR_FEATURES0_VG_20_End 13 -#define GC_MINOR_FEATURES0_VG_20_Start 13 -#define GC_MINOR_FEATURES0_VG_20_Type U01 -#define GC_MINOR_FEATURES0_VG_20_NONE 0x0 -#define GC_MINOR_FEATURES0_VG_20_AVAILABLE 0x1 +#define GC_FEATURES0_VG_20 13 : 13 +#define GC_FEATURES0_VG_20_End 13 +#define GC_FEATURES0_VG_20_Start 13 +#define GC_FEATURES0_VG_20_Type U01 +#define GC_FEATURES0_VG_20_NONE 0x0 +#define GC_FEATURES0_VG_20_AVAILABLE 0x1 /* New commands added to the tessellator. */ -#define GC_MINOR_FEATURES0_TS_EXTENDED_COMMANDS 14 : 14 -#define GC_MINOR_FEATURES0_TS_EXTENDED_COMMANDS_End 14 -#define GC_MINOR_FEATURES0_TS_EXTENDED_COMMANDS_Start 14 -#define GC_MINOR_FEATURES0_TS_EXTENDED_COMMANDS_Type U01 -#define GC_MINOR_FEATURES0_TS_EXTENDED_COMMANDS_NONE 0x0 -#define GC_MINOR_FEATURES0_TS_EXTENDED_COMMANDS_AVAILABLE 0x1 +#define GC_FEATURES0_TS_EXTENDED_COMMANDS 14 : 14 +#define GC_FEATURES0_TS_EXTENDED_COMMANDS_End 14 +#define GC_FEATURES0_TS_EXTENDED_COMMANDS_Start 14 +#define GC_FEATURES0_TS_EXTENDED_COMMANDS_Type U01 +#define GC_FEATURES0_TS_EXTENDED_COMMANDS_NONE 0x0 +#define GC_FEATURES0_TS_EXTENDED_COMMANDS_AVAILABLE 0x1 /* If this bit is not set, the FIFO counter should be set to 50. Else, the ** ** default should remain. */ -#define GC_MINOR_FEATURES0_COMPRESSION_FIFO_FIXED 15 : 15 -#define GC_MINOR_FEATURES0_COMPRESSION_FIFO_FIXED_End 15 -#define GC_MINOR_FEATURES0_COMPRESSION_FIFO_FIXED_Start 15 -#define GC_MINOR_FEATURES0_COMPRESSION_FIFO_FIXED_Type U01 -#define GC_MINOR_FEATURES0_COMPRESSION_FIFO_FIXED_NONE 0x0 -#define GC_MINOR_FEATURES0_COMPRESSION_FIFO_FIXED_AVAILABLE 0x1 +#define GC_FEATURES0_COMPRESSION_FIFO_FIXED 15 : 15 +#define GC_FEATURES0_COMPRESSION_FIFO_FIXED_End 15 +#define GC_FEATURES0_COMPRESSION_FIFO_FIXED_Start 15 +#define GC_FEATURES0_COMPRESSION_FIFO_FIXED_Type U01 +#define GC_FEATURES0_COMPRESSION_FIFO_FIXED_NONE 0x0 +#define GC_FEATURES0_COMPRESSION_FIFO_FIXED_AVAILABLE 0x1 /* Floor, ceil, and sign instructions are available. */ -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0 16 : 16 -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0_End 16 -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0_Start 16 -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0_Type U01 -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0_NONE 0x0 -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0_AVAILABLE 0x1 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0 16 : 16 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0_End 16 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0_Start 16 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0_Type U01 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0_NONE 0x0 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS0_AVAILABLE 0x1 /* VG filter is available. */ -#define GC_MINOR_FEATURES0_VG_FILTER 17 : 17 -#define GC_MINOR_FEATURES0_VG_FILTER_End 17 -#define GC_MINOR_FEATURES0_VG_FILTER_Start 17 -#define GC_MINOR_FEATURES0_VG_FILTER_Type U01 -#define GC_MINOR_FEATURES0_VG_FILTER_NONE 0x0 -#define GC_MINOR_FEATURES0_VG_FILTER_AVAILABLE 0x1 +#define GC_FEATURES0_VG_FILTER 17 : 17 +#define GC_FEATURES0_VG_FILTER_End 17 +#define GC_FEATURES0_VG_FILTER_Start 17 +#define GC_FEATURES0_VG_FILTER_Type U01 +#define GC_FEATURES0_VG_FILTER_NONE 0x0 +#define GC_FEATURES0_VG_FILTER_AVAILABLE 0x1 /* Minor updates to VG pipe (Event generation from VG, TS, PE). Tiled image ** ** support. */ -#define GC_MINOR_FEATURES0_VG_21 18 : 18 -#define GC_MINOR_FEATURES0_VG_21_End 18 -#define GC_MINOR_FEATURES0_VG_21_Start 18 -#define GC_MINOR_FEATURES0_VG_21_Type U01 -#define GC_MINOR_FEATURES0_VG_21_NONE 0x0 -#define GC_MINOR_FEATURES0_VG_21_AVAILABLE 0x1 +#define GC_FEATURES0_VG_21 18 : 18 +#define GC_FEATURES0_VG_21_End 18 +#define GC_FEATURES0_VG_21_Start 18 +#define GC_FEATURES0_VG_21_Type U01 +#define GC_FEATURES0_VG_21_NONE 0x0 +#define GC_FEATURES0_VG_21_AVAILABLE 0x1 /* W is sent to SH from RA. */ -#define GC_MINOR_FEATURES0_SHADER_GETS_W 19 : 19 -#define GC_MINOR_FEATURES0_SHADER_GETS_W_End 19 -#define GC_MINOR_FEATURES0_SHADER_GETS_W_Start 19 -#define GC_MINOR_FEATURES0_SHADER_GETS_W_Type U01 -#define GC_MINOR_FEATURES0_SHADER_GETS_W_NONE 0x0 -#define GC_MINOR_FEATURES0_SHADER_GETS_W_AVAILABLE 0x1 +#define GC_FEATURES0_SHADER_GETS_W 19 : 19 +#define GC_FEATURES0_SHADER_GETS_W_End 19 +#define GC_FEATURES0_SHADER_GETS_W_Start 19 +#define GC_FEATURES0_SHADER_GETS_W_Type U01 +#define GC_FEATURES0_SHADER_GETS_W_NONE 0x0 +#define GC_FEATURES0_SHADER_GETS_W_AVAILABLE 0x1 /* Sqrt, sin, cos instructions are available. */ -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1 20 : 20 -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1_End 20 -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1_Start 20 -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1_Type U01 -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1_NONE 0x0 -#define GC_MINOR_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1_AVAILABLE 0x1 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1 20 : 20 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1_End 20 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1_Start 20 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1_Type U01 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1_NONE 0x0 +#define GC_FEATURES0_EXTRA_SHADER_INSTRUCTIONS1_AVAILABLE 0x1 /* Unavailable registers will return 0. */ -#define GC_MINOR_FEATURES0_DEFAULT_REG0 21 : 21 -#define GC_MINOR_FEATURES0_DEFAULT_REG0_End 21 -#define GC_MINOR_FEATURES0_DEFAULT_REG0_Start 21 -#define GC_MINOR_FEATURES0_DEFAULT_REG0_Type U01 -#define GC_MINOR_FEATURES0_DEFAULT_REG0_NONE 0x0 -#define GC_MINOR_FEATURES0_DEFAULT_REG0_AVAILABLE 0x1 +#define GC_FEATURES0_DEFAULT_REG0 21 : 21 +#define GC_FEATURES0_DEFAULT_REG0_End 21 +#define GC_FEATURES0_DEFAULT_REG0_Start 21 +#define GC_FEATURES0_DEFAULT_REG0_Type U01 +#define GC_FEATURES0_DEFAULT_REG0_NONE 0x0 +#define GC_FEATURES0_DEFAULT_REG0_AVAILABLE 0x1 /* New style MC with separate paths for color and depth. */ -#define GC_MINOR_FEATURES0_MC_20 22 : 22 -#define GC_MINOR_FEATURES0_MC_20_End 22 -#define GC_MINOR_FEATURES0_MC_20_Start 22 -#define GC_MINOR_FEATURES0_MC_20_Type U01 -#define GC_MINOR_FEATURES0_MC_20_NONE 0x0 -#define GC_MINOR_FEATURES0_MC_20_AVAILABLE 0x1 +#define GC_FEATURES0_MC_20 22 : 22 +#define GC_FEATURES0_MC_20_End 22 +#define GC_FEATURES0_MC_20_Start 22 +#define GC_FEATURES0_MC_20_Type U01 +#define GC_FEATURES0_MC_20_NONE 0x0 +#define GC_FEATURES0_MC_20_AVAILABLE 0x1 /* Put the MSAA data into sideband fifo. */ -#define GC_MINOR_FEATURES0_SHADER_MSAA_SIDEBAND 23 : 23 -#define GC_MINOR_FEATURES0_SHADER_MSAA_SIDEBAND_End 23 -#define GC_MINOR_FEATURES0_SHADER_MSAA_SIDEBAND_Start 23 -#define GC_MINOR_FEATURES0_SHADER_MSAA_SIDEBAND_Type U01 -#define GC_MINOR_FEATURES0_SHADER_MSAA_SIDEBAND_NONE 0x0 -#define GC_MINOR_FEATURES0_SHADER_MSAA_SIDEBAND_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES0_BUG_FIXES0 24 : 24 -#define GC_MINOR_FEATURES0_BUG_FIXES0_End 24 -#define GC_MINOR_FEATURES0_BUG_FIXES0_Start 24 -#define GC_MINOR_FEATURES0_BUG_FIXES0_Type U01 -#define GC_MINOR_FEATURES0_BUG_FIXES0_NONE 0x0 -#define GC_MINOR_FEATURES0_BUG_FIXES0_AVAILABLE 0x1 +#define GC_FEATURES0_SHADER_MSAA_SIDEBAND 23 : 23 +#define GC_FEATURES0_SHADER_MSAA_SIDEBAND_End 23 +#define GC_FEATURES0_SHADER_MSAA_SIDEBAND_Start 23 +#define GC_FEATURES0_SHADER_MSAA_SIDEBAND_Type U01 +#define GC_FEATURES0_SHADER_MSAA_SIDEBAND_NONE 0x0 +#define GC_FEATURES0_SHADER_MSAA_SIDEBAND_AVAILABLE 0x1 + +#define GC_FEATURES0_BUG_FIXES0 24 : 24 +#define GC_FEATURES0_BUG_FIXES0_End 24 +#define GC_FEATURES0_BUG_FIXES0_Start 24 +#define GC_FEATURES0_BUG_FIXES0_Type U01 +#define GC_FEATURES0_BUG_FIXES0_NONE 0x0 +#define GC_FEATURES0_BUG_FIXES0_AVAILABLE 0x1 /* VAA is available or not. */ -#define GC_MINOR_FEATURES0_VAA 25 : 25 -#define GC_MINOR_FEATURES0_VAA_End 25 -#define GC_MINOR_FEATURES0_VAA_Start 25 -#define GC_MINOR_FEATURES0_VAA_Type U01 -#define GC_MINOR_FEATURES0_VAA_NONE 0x0 -#define GC_MINOR_FEATURES0_VAA_AVAILABLE 0x1 +#define GC_FEATURES0_VAA 25 : 25 +#define GC_FEATURES0_VAA_End 25 +#define GC_FEATURES0_VAA_Start 25 +#define GC_FEATURES0_VAA_Type U01 +#define GC_FEATURES0_VAA_NONE 0x0 +#define GC_FEATURES0_VAA_AVAILABLE 0x1 /* Shader supports bypass mode when MSAA is enabled. */ -#define GC_MINOR_FEATURES0_BYPASS_IN_MSAA 26 : 26 -#define GC_MINOR_FEATURES0_BYPASS_IN_MSAA_End 26 -#define GC_MINOR_FEATURES0_BYPASS_IN_MSAA_Start 26 -#define GC_MINOR_FEATURES0_BYPASS_IN_MSAA_Type U01 -#define GC_MINOR_FEATURES0_BYPASS_IN_MSAA_NONE 0x0 -#define GC_MINOR_FEATURES0_BYPASS_IN_MSAA_AVAILABLE 0x1 +#define GC_FEATURES0_BYPASS_IN_MSAA 26 : 26 +#define GC_FEATURES0_BYPASS_IN_MSAA_End 26 +#define GC_FEATURES0_BYPASS_IN_MSAA_Start 26 +#define GC_FEATURES0_BYPASS_IN_MSAA_Type U01 +#define GC_FEATURES0_BYPASS_IN_MSAA_NONE 0x0 +#define GC_FEATURES0_BYPASS_IN_MSAA_AVAILABLE 0x1 /* Hierarchiccal Z is supported. */ -#define GC_MINOR_FEATURES0_HIERARCHICAL_Z 27 : 27 -#define GC_MINOR_FEATURES0_HIERARCHICAL_Z_End 27 -#define GC_MINOR_FEATURES0_HIERARCHICAL_Z_Start 27 -#define GC_MINOR_FEATURES0_HIERARCHICAL_Z_Type U01 -#define GC_MINOR_FEATURES0_HIERARCHICAL_Z_NONE 0x0 -#define GC_MINOR_FEATURES0_HIERARCHICAL_Z_AVAILABLE 0x1 +#define GC_FEATURES0_HIERARCHICAL_Z 27 : 27 +#define GC_FEATURES0_HIERARCHICAL_Z_End 27 +#define GC_FEATURES0_HIERARCHICAL_Z_Start 27 +#define GC_FEATURES0_HIERARCHICAL_Z_Type U01 +#define GC_FEATURES0_HIERARCHICAL_Z_NONE 0x0 +#define GC_FEATURES0_HIERARCHICAL_Z_AVAILABLE 0x1 /* New texture unit is available. */ -#define GC_MINOR_FEATURES0_NEW_TEXTURE 28 : 28 -#define GC_MINOR_FEATURES0_NEW_TEXTURE_End 28 -#define GC_MINOR_FEATURES0_NEW_TEXTURE_Start 28 -#define GC_MINOR_FEATURES0_NEW_TEXTURE_Type U01 -#define GC_MINOR_FEATURES0_NEW_TEXTURE_NONE 0x0 -#define GC_MINOR_FEATURES0_NEW_TEXTURE_AVAILABLE 0x1 +#define GC_FEATURES0_NEW_TEXTURE 28 : 28 +#define GC_FEATURES0_NEW_TEXTURE_End 28 +#define GC_FEATURES0_NEW_TEXTURE_Start 28 +#define GC_FEATURES0_NEW_TEXTURE_Type U01 +#define GC_FEATURES0_NEW_TEXTURE_NONE 0x0 +#define GC_FEATURES0_NEW_TEXTURE_AVAILABLE 0x1 /* 2D engine supports A8 target. */ -#define GC_MINOR_FEATURES0_A8_TARGET_SUPPORT 29 : 29 -#define GC_MINOR_FEATURES0_A8_TARGET_SUPPORT_End 29 -#define GC_MINOR_FEATURES0_A8_TARGET_SUPPORT_Start 29 -#define GC_MINOR_FEATURES0_A8_TARGET_SUPPORT_Type U01 -#define GC_MINOR_FEATURES0_A8_TARGET_SUPPORT_NONE 0x0 -#define GC_MINOR_FEATURES0_A8_TARGET_SUPPORT_AVAILABLE 0x1 +#define GC_FEATURES0_A8_TARGET_SUPPORT 29 : 29 +#define GC_FEATURES0_A8_TARGET_SUPPORT_End 29 +#define GC_FEATURES0_A8_TARGET_SUPPORT_Start 29 +#define GC_FEATURES0_A8_TARGET_SUPPORT_Type U01 +#define GC_FEATURES0_A8_TARGET_SUPPORT_NONE 0x0 +#define GC_FEATURES0_A8_TARGET_SUPPORT_AVAILABLE 0x1 /* Correct stencil behavior in depth only. */ -#define GC_MINOR_FEATURES0_CORRECT_STENCIL 30 : 30 -#define GC_MINOR_FEATURES0_CORRECT_STENCIL_End 30 -#define GC_MINOR_FEATURES0_CORRECT_STENCIL_Start 30 -#define GC_MINOR_FEATURES0_CORRECT_STENCIL_Type U01 -#define GC_MINOR_FEATURES0_CORRECT_STENCIL_NONE 0x0 -#define GC_MINOR_FEATURES0_CORRECT_STENCIL_AVAILABLE 0x1 +#define GC_FEATURES0_CORRECT_STENCIL 30 : 30 +#define GC_FEATURES0_CORRECT_STENCIL_End 30 +#define GC_FEATURES0_CORRECT_STENCIL_Start 30 +#define GC_FEATURES0_CORRECT_STENCIL_Type U01 +#define GC_FEATURES0_CORRECT_STENCIL_NONE 0x0 +#define GC_FEATURES0_CORRECT_STENCIL_AVAILABLE 0x1 /* Enhance VR and add a mode to walk 16 pixels in 16-bit mode in Vertical ** ** pass to improve $ hit rate when rotating 90/270. */ -#define GC_MINOR_FEATURES0_ENHANCE_VR 31 : 31 -#define GC_MINOR_FEATURES0_ENHANCE_VR_End 31 -#define GC_MINOR_FEATURES0_ENHANCE_VR_Start 31 -#define GC_MINOR_FEATURES0_ENHANCE_VR_Type U01 -#define GC_MINOR_FEATURES0_ENHANCE_VR_NONE 0x0 -#define GC_MINOR_FEATURES0_ENHANCE_VR_AVAILABLE 0x1 +#define GC_FEATURES0_ENHANCE_VR 31 : 31 +#define GC_FEATURES0_ENHANCE_VR_End 31 +#define GC_FEATURES0_ENHANCE_VR_Start 31 +#define GC_FEATURES0_ENHANCE_VR_Type U01 +#define GC_FEATURES0_ENHANCE_VR_NONE 0x0 +#define GC_FEATURES0_ENHANCE_VR_AVAILABLE 0x1 + +union gcfeatures0 { + struct { + /* GC_FEATURES0_Address:FLIP_Y */ + unsigned int flipy:1; + + /* GC_FEATURES0_Address:DUAL_RETURN_BUS */ + unsigned int dualreturnbus:1; + + /* GC_FEATURES0_Address:ENDIANNESS_CONFIG */ + unsigned int endianessconfig:1; + + /* GC_FEATURES0_Address:TEXTURE8_K */ + unsigned int texture8k:1; + + /* GC_FEATURES0_Address:CORRECT_TEXTURE_CONVERTER */ + unsigned int correcttextureconverter:1; + + /* GC_FEATURES0_Address:SPECIAL_MSAA_LOD */ + unsigned int specialmsaalod:1; + + /* GC_FEATURES0_Address:FAST_CLEAR_FLUSH */ + unsigned int fastclearflush:1; + + /* GC_FEATURES0_Address:2DPE20 */ + unsigned int pe2d20:1; + + /* GC_FEATURES0_Address:CORRECT_AUTO_DISABLE */ + unsigned int correctautodisable:1; + + /* GC_FEATURES0_Address:RENDER_8K */ + unsigned int render8k:1; + + /* GC_FEATURES0_Address:TILE_STATUS_2BITS */ + unsigned int tilestatus2bits:1; + + /* GC_FEATURES0_Address:SEPARATE_TILE_STATUS_WHEN_INTERLEAVED */ + unsigned int separatetilestatus:1; + + /* GC_FEATURES0_Address:SUPER_TILED_32X32 */ + unsigned int supertiled32x32:1; + + /* GC_FEATURES0_Address:VG_20 */ + unsigned int vg20:1; + + /* GC_FEATURES0_Address:TS_EXTENDED_COMMANDS */ + unsigned int tsplus:1; + + /* GC_FEATURES0_Address:COMPRESSION_FIFO_FIXED */ + unsigned int compressionfifo:1; + + /* GC_FEATURES0_Address:EXTRA_SHADER_INSTRUCTIONS0 */ + unsigned int shaderinst0:1; + + /* GC_FEATURES0_Address:VG_FILTER */ + unsigned int vgfilter:1; + + /* GC_FEATURES0_Address:VG_21 */ + unsigned int vg21:1; + + /* GC_FEATURES0_Address:SHADER_GETS_W */ + unsigned int shadergetsw:1; + + /* GC_FEATURES0_Address:EXTRA_SHADER_INSTRUCTIONS1 */ + unsigned int shaderinst1:1; + + /* GC_FEATURES0_Address:DEFAULT_REG0 */ + unsigned int defaultreg0:1; + + /* GC_FEATURES0_Address:MC_20 */ + unsigned int mc20:1; + + /* GC_FEATURES0_Address:SHADER_MSAA_SIDEBAND */ + unsigned int shadermsaasideband:1; + + /* GC_FEATURES0_Address:BUG_FIXES0 */ + unsigned int bugfixes0:1; + + /* GC_FEATURES0_Address:VAA */ + unsigned int vaa:1; + + /* GC_FEATURES0_Address:BYPASS_IN_MSAA */ + unsigned int bypassmsaa:1; + + /* GC_FEATURES0_Address:HIERARCHICAL_Z */ + unsigned int hz:1; + + /* GC_FEATURES0_Address:NEW_TEXTURE */ + unsigned int newtx:1; + + /* GC_FEATURES0_Address:A8_TARGET_SUPPORT */ + unsigned int a8target:1; + + /* GC_FEATURES0_Address:CORRECT_STENCIL */ + unsigned int correctstencil:1; + + /* GC_FEATURES0_Address:ENHANCE_VR */ + unsigned int vr20:1; + } reg; + + unsigned int raw; +}; /******************************************************************************* ** Register GCMinorFeatures1 @@ -1030,245 +1234,937 @@ union gcidle { ** reset value. It varies with the implementation. */ -#define GC_MINOR_FEATURES1_Address 0x00074 -#define GC_MINOR_FEATURES1_MSB 15 -#define GC_MINOR_FEATURES1_LSB 0 -#define GC_MINOR_FEATURES1_BLK 0 -#define GC_MINOR_FEATURES1_Count 1 -#define GC_MINOR_FEATURES1_FieldMask 0xFFFFFFFF -#define GC_MINOR_FEATURES1_ReadMask 0xFFFFFFFF -#define GC_MINOR_FEATURES1_WriteMask 0x00000000 -#define GC_MINOR_FEATURES1_ResetValue 0x00000000 +#define GC_FEATURES1_Address 0x00074 +#define GC_FEATURES1_MSB 15 +#define GC_FEATURES1_LSB 0 +#define GC_FEATURES1_BLK 0 +#define GC_FEATURES1_Count 1 +#define GC_FEATURES1_FieldMask 0xFFFFFFFF +#define GC_FEATURES1_ReadMask 0xFFFFFFFF +#define GC_FEATURES1_WriteMask 0x00000000 +#define GC_FEATURES1_ResetValue 0x00000000 /* Resolve UV swizzle. */ -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE 0 : 0 -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE_End 0 -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE_Start 0 -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE_Type U01 -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE_NONE 0x0 -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE_AVAILABLE 0x1 +#define GC_FEATURES1_RSUV_SWIZZLE 0 : 0 +#define GC_FEATURES1_RSUV_SWIZZLE_End 0 +#define GC_FEATURES1_RSUV_SWIZZLE_Start 0 +#define GC_FEATURES1_RSUV_SWIZZLE_Type U01 +#define GC_FEATURES1_RSUV_SWIZZLE_NONE 0x0 +#define GC_FEATURES1_RSUV_SWIZZLE_AVAILABLE 0x1 /* V2 compression. */ -#define GC_MINOR_FEATURES1_V2_COMPRESSION 1 : 1 -#define GC_MINOR_FEATURES1_V2_COMPRESSION_End 1 -#define GC_MINOR_FEATURES1_V2_COMPRESSION_Start 1 -#define GC_MINOR_FEATURES1_V2_COMPRESSION_Type U01 -#define GC_MINOR_FEATURES1_V2_COMPRESSION_NONE 0x0 -#define GC_MINOR_FEATURES1_V2_COMPRESSION_AVAILABLE 0x1 +#define GC_FEATURES1_V2_COMPRESSION 1 : 1 +#define GC_FEATURES1_V2_COMPRESSION_End 1 +#define GC_FEATURES1_V2_COMPRESSION_Start 1 +#define GC_FEATURES1_V2_COMPRESSION_Type U01 +#define GC_FEATURES1_V2_COMPRESSION_NONE 0x0 +#define GC_FEATURES1_V2_COMPRESSION_AVAILABLE 0x1 /* Double buffering support for VG (second TS-->VG semaphore is present). */ -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER 2 : 2 -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER_End 2 -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER_Start 2 -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER_Type U01 -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER_NONE 0x0 -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES1 3 : 3 -#define GC_MINOR_FEATURES1_BUG_FIXES1_End 3 -#define GC_MINOR_FEATURES1_BUG_FIXES1_Start 3 -#define GC_MINOR_FEATURES1_BUG_FIXES1_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES1_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES1_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES2 4 : 4 -#define GC_MINOR_FEATURES1_BUG_FIXES2_End 4 -#define GC_MINOR_FEATURES1_BUG_FIXES2_Start 4 -#define GC_MINOR_FEATURES1_BUG_FIXES2_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES2_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES2_AVAILABLE 0x1 +#define GC_FEATURES1_VG_DOUBLE_BUFFER 2 : 2 +#define GC_FEATURES1_VG_DOUBLE_BUFFER_End 2 +#define GC_FEATURES1_VG_DOUBLE_BUFFER_Start 2 +#define GC_FEATURES1_VG_DOUBLE_BUFFER_Type U01 +#define GC_FEATURES1_VG_DOUBLE_BUFFER_NONE 0x0 +#define GC_FEATURES1_VG_DOUBLE_BUFFER_AVAILABLE 0x1 + +#define GC_FEATURES1_BUG_FIXES1 3 : 3 +#define GC_FEATURES1_BUG_FIXES1_End 3 +#define GC_FEATURES1_BUG_FIXES1_Start 3 +#define GC_FEATURES1_BUG_FIXES1_Type U01 +#define GC_FEATURES1_BUG_FIXES1_NONE 0x0 +#define GC_FEATURES1_BUG_FIXES1_AVAILABLE 0x1 + +#define GC_FEATURES1_BUG_FIXES2 4 : 4 +#define GC_FEATURES1_BUG_FIXES2_End 4 +#define GC_FEATURES1_BUG_FIXES2_Start 4 +#define GC_FEATURES1_BUG_FIXES2_Type U01 +#define GC_FEATURES1_BUG_FIXES2_NONE 0x0 +#define GC_FEATURES1_BUG_FIXES2_AVAILABLE 0x1 /* Texture has stride and memory addressing. */ -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE 5 : 5 -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE_End 5 -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE_Start 5 -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE_Type U01 -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE_NONE 0x0 -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES3 6 : 6 -#define GC_MINOR_FEATURES1_BUG_FIXES3_End 6 -#define GC_MINOR_FEATURES1_BUG_FIXES3_Start 6 -#define GC_MINOR_FEATURES1_BUG_FIXES3_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES3_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES3_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE 7 : 7 -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE_End 7 -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE_Start 7 -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE_Type U01 -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE_NONE 0x0 -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS 8 : 8 -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS_End 8 -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS_Start 8 -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS_Type U01 -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS_NONE 0x0 -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES4 9 : 9 -#define GC_MINOR_FEATURES1_BUG_FIXES4_End 9 -#define GC_MINOR_FEATURES1_BUG_FIXES4_Start 9 -#define GC_MINOR_FEATURES1_BUG_FIXES4_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES4_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES4_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_L2_WINDOWING 10 : 10 -#define GC_MINOR_FEATURES1_L2_WINDOWING_End 10 -#define GC_MINOR_FEATURES1_L2_WINDOWING_Start 10 -#define GC_MINOR_FEATURES1_L2_WINDOWING_Type U01 -#define GC_MINOR_FEATURES1_L2_WINDOWING_NONE 0x0 -#define GC_MINOR_FEATURES1_L2_WINDOWING_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE 11 : 11 -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE_End 11 -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE_Start 11 -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE_Type U01 -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE_NONE 0x0 -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_PIXEL_DITHER 12 : 12 -#define GC_MINOR_FEATURES1_PIXEL_DITHER_End 12 -#define GC_MINOR_FEATURES1_PIXEL_DITHER_Start 12 -#define GC_MINOR_FEATURES1_PIXEL_DITHER_Type U01 -#define GC_MINOR_FEATURES1_PIXEL_DITHER_NONE 0x0 -#define GC_MINOR_FEATURES1_PIXEL_DITHER_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE 13 : 13 -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE_End 13 -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE_Start 13 -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE_Type U01 -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE_NONE 0x0 -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT 14 : 14 -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT_End 14 -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT_Start 14 -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT_Type U01 -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT_NONE 0x0 -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT_AVAILABLE 0x1 +#define GC_FEATURES1_TEXTURE_STRIDE 5 : 5 +#define GC_FEATURES1_TEXTURE_STRIDE_End 5 +#define GC_FEATURES1_TEXTURE_STRIDE_Start 5 +#define GC_FEATURES1_TEXTURE_STRIDE_Type U01 +#define GC_FEATURES1_TEXTURE_STRIDE_NONE 0x0 +#define GC_FEATURES1_TEXTURE_STRIDE_AVAILABLE 0x1 + +#define GC_FEATURES1_BUG_FIXES3 6 : 6 +#define GC_FEATURES1_BUG_FIXES3_End 6 +#define GC_FEATURES1_BUG_FIXES3_Start 6 +#define GC_FEATURES1_BUG_FIXES3_Type U01 +#define GC_FEATURES1_BUG_FIXES3_NONE 0x0 +#define GC_FEATURES1_BUG_FIXES3_AVAILABLE 0x1 + +#define GC_FEATURES1_CORRECT_AUTO_DISABLE 7 : 7 +#define GC_FEATURES1_CORRECT_AUTO_DISABLE_End 7 +#define GC_FEATURES1_CORRECT_AUTO_DISABLE_Start 7 +#define GC_FEATURES1_CORRECT_AUTO_DISABLE_Type U01 +#define GC_FEATURES1_CORRECT_AUTO_DISABLE_NONE 0x0 +#define GC_FEATURES1_CORRECT_AUTO_DISABLE_AVAILABLE 0x1 + +#define GC_FEATURES1_AUTO_RESTART_TS 8 : 8 +#define GC_FEATURES1_AUTO_RESTART_TS_End 8 +#define GC_FEATURES1_AUTO_RESTART_TS_Start 8 +#define GC_FEATURES1_AUTO_RESTART_TS_Type U01 +#define GC_FEATURES1_AUTO_RESTART_TS_NONE 0x0 +#define GC_FEATURES1_AUTO_RESTART_TS_AVAILABLE 0x1 + +#define GC_FEATURES1_BUG_FIXES4 9 : 9 +#define GC_FEATURES1_BUG_FIXES4_End 9 +#define GC_FEATURES1_BUG_FIXES4_Start 9 +#define GC_FEATURES1_BUG_FIXES4_Type U01 +#define GC_FEATURES1_BUG_FIXES4_NONE 0x0 +#define GC_FEATURES1_BUG_FIXES4_AVAILABLE 0x1 + +#define GC_FEATURES1_L2_WINDOWING 10 : 10 +#define GC_FEATURES1_L2_WINDOWING_End 10 +#define GC_FEATURES1_L2_WINDOWING_Start 10 +#define GC_FEATURES1_L2_WINDOWING_Type U01 +#define GC_FEATURES1_L2_WINDOWING_NONE 0x0 +#define GC_FEATURES1_L2_WINDOWING_AVAILABLE 0x1 + +#define GC_FEATURES1_HALF_FLOAT_PIPE 11 : 11 +#define GC_FEATURES1_HALF_FLOAT_PIPE_End 11 +#define GC_FEATURES1_HALF_FLOAT_PIPE_Start 11 +#define GC_FEATURES1_HALF_FLOAT_PIPE_Type U01 +#define GC_FEATURES1_HALF_FLOAT_PIPE_NONE 0x0 +#define GC_FEATURES1_HALF_FLOAT_PIPE_AVAILABLE 0x1 + +#define GC_FEATURES1_PIXEL_DITHER 12 : 12 +#define GC_FEATURES1_PIXEL_DITHER_End 12 +#define GC_FEATURES1_PIXEL_DITHER_Start 12 +#define GC_FEATURES1_PIXEL_DITHER_Type U01 +#define GC_FEATURES1_PIXEL_DITHER_NONE 0x0 +#define GC_FEATURES1_PIXEL_DITHER_AVAILABLE 0x1 + +#define GC_FEATURES1_TWO_STENCIL_REFERENCE 13 : 13 +#define GC_FEATURES1_TWO_STENCIL_REFERENCE_End 13 +#define GC_FEATURES1_TWO_STENCIL_REFERENCE_Start 13 +#define GC_FEATURES1_TWO_STENCIL_REFERENCE_Type U01 +#define GC_FEATURES1_TWO_STENCIL_REFERENCE_NONE 0x0 +#define GC_FEATURES1_TWO_STENCIL_REFERENCE_AVAILABLE 0x1 + +#define GC_FEATURES1_EXTENDED_PIXEL_FORMAT 14 : 14 +#define GC_FEATURES1_EXTENDED_PIXEL_FORMAT_End 14 +#define GC_FEATURES1_EXTENDED_PIXEL_FORMAT_Start 14 +#define GC_FEATURES1_EXTENDED_PIXEL_FORMAT_Type U01 +#define GC_FEATURES1_EXTENDED_PIXEL_FORMAT_NONE 0x0 +#define GC_FEATURES1_EXTENDED_PIXEL_FORMAT_AVAILABLE 0x1 /* EEZ and HZ are correct. */ -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH 15 : 15 -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH_End 15 -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH_Start 15 -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH_Type U01 -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH_NONE 0x0 -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH_AVAILABLE 0x1 +#define GC_FEATURES1_CORRECT_MIN_MAX_DEPTH 15 : 15 +#define GC_FEATURES1_CORRECT_MIN_MAX_DEPTH_End 15 +#define GC_FEATURES1_CORRECT_MIN_MAX_DEPTH_Start 15 +#define GC_FEATURES1_CORRECT_MIN_MAX_DEPTH_Type U01 +#define GC_FEATURES1_CORRECT_MIN_MAX_DEPTH_NONE 0x0 +#define GC_FEATURES1_CORRECT_MIN_MAX_DEPTH_AVAILABLE 0x1 /* Dither and filter+alpha available. */ -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D 16 : 16 -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_End 16 -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_Start 16 -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_Type U01 -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_NONE 0x0 -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES5 17 : 17 -#define GC_MINOR_FEATURES1_BUG_FIXES5_End 17 -#define GC_MINOR_FEATURES1_BUG_FIXES5_Start 17 -#define GC_MINOR_FEATURES1_BUG_FIXES5_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES5_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES5_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_NEW_2D 18 : 18 -#define GC_MINOR_FEATURES1_NEW_2D_End 18 -#define GC_MINOR_FEATURES1_NEW_2D_Start 18 -#define GC_MINOR_FEATURES1_NEW_2D_Type U01 -#define GC_MINOR_FEATURES1_NEW_2D_NONE 0x0 -#define GC_MINOR_FEATURES1_NEW_2D_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC 19 : 19 -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_End 19 -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_Start 19 -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_Type U01 -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_NONE 0x0 -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT 20 : 20 -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_End 20 -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_Start 20 -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_Type U01 -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_NONE 0x0 -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO 21 : 21 -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO_End 21 -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO_Start 21 -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO_Type U01 -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO_NONE 0x0 -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT 22 : 22 -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT_End 22 -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT_Start 22 -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT_Type U01 -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT_NONE 0x0 -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_HALTI0 23 : 23 -#define GC_MINOR_FEATURES1_HALTI0_End 23 -#define GC_MINOR_FEATURES1_HALTI0_Start 23 -#define GC_MINOR_FEATURES1_HALTI0_Type U01 -#define GC_MINOR_FEATURES1_HALTI0_NONE 0x0 -#define GC_MINOR_FEATURES1_HALTI0_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG 24 : 24 -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG_End 24 -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG_Start 24 -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG_Type U01 -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG_NONE 0x0 -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX 25 : 25 -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX_End 25 -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX_Start 25 -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX_Type U01 -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX_NONE 0x0 -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET 26 : 26 -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET_End 26 -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET_Start 26 -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET_Type U01 -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET_NONE 0x0 -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK 27 : 27 -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK_End 27 -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK_Start 27 -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK_Type U01 -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK_NONE 0x0 -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_MMU 28 : 28 -#define GC_MINOR_FEATURES1_MMU_End 28 -#define GC_MINOR_FEATURES1_MMU_Start 28 -#define GC_MINOR_FEATURES1_MMU_Type U01 -#define GC_MINOR_FEATURES1_MMU_NONE 0x0 -#define GC_MINOR_FEATURES1_MMU_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_WIDE_LINE 29 : 29 -#define GC_MINOR_FEATURES1_WIDE_LINE_End 29 -#define GC_MINOR_FEATURES1_WIDE_LINE_Start 29 -#define GC_MINOR_FEATURES1_WIDE_LINE_Type U01 -#define GC_MINOR_FEATURES1_WIDE_LINE_NONE 0x0 -#define GC_MINOR_FEATURES1_WIDE_LINE_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES6 30 : 30 -#define GC_MINOR_FEATURES1_BUG_FIXES6_End 30 -#define GC_MINOR_FEATURES1_BUG_FIXES6_Start 30 -#define GC_MINOR_FEATURES1_BUG_FIXES6_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES6_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES6_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL 31 : 31 -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL_End 31 -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL_Start 31 -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL_Type U01 -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL_NONE 0x0 -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL_AVAILABLE 0x1 +#define GC_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D 16 : 16 +#define GC_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_End 16 +#define GC_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_Start 16 +#define GC_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_Type U01 +#define GC_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_NONE 0x0 +#define GC_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_AVAILABLE 0x1 + +#define GC_FEATURES1_BUG_FIXES5 17 : 17 +#define GC_FEATURES1_BUG_FIXES5_End 17 +#define GC_FEATURES1_BUG_FIXES5_Start 17 +#define GC_FEATURES1_BUG_FIXES5_Type U01 +#define GC_FEATURES1_BUG_FIXES5_NONE 0x0 +#define GC_FEATURES1_BUG_FIXES5_AVAILABLE 0x1 + +#define GC_FEATURES1_NEW_2D 18 : 18 +#define GC_FEATURES1_NEW_2D_End 18 +#define GC_FEATURES1_NEW_2D_Start 18 +#define GC_FEATURES1_NEW_2D_Type U01 +#define GC_FEATURES1_NEW_2D_NONE 0x0 +#define GC_FEATURES1_NEW_2D_AVAILABLE 0x1 + +#define GC_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC 19 : 19 +#define GC_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_End 19 +#define GC_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_Start 19 +#define GC_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_Type U01 +#define GC_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_NONE 0x0 +#define GC_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_AVAILABLE 0x1 + +#define GC_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT 20 : 20 +#define GC_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_End 20 +#define GC_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_Start 20 +#define GC_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_Type U01 +#define GC_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_NONE 0x0 +#define GC_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_AVAILABLE 0x1 + +#define GC_FEATURES1_NON_POWER_OF_TWO 21 : 21 +#define GC_FEATURES1_NON_POWER_OF_TWO_End 21 +#define GC_FEATURES1_NON_POWER_OF_TWO_Start 21 +#define GC_FEATURES1_NON_POWER_OF_TWO_Type U01 +#define GC_FEATURES1_NON_POWER_OF_TWO_NONE 0x0 +#define GC_FEATURES1_NON_POWER_OF_TWO_AVAILABLE 0x1 + +#define GC_FEATURES1_LINEAR_TEXTURE_SUPPORT 22 : 22 +#define GC_FEATURES1_LINEAR_TEXTURE_SUPPORT_End 22 +#define GC_FEATURES1_LINEAR_TEXTURE_SUPPORT_Start 22 +#define GC_FEATURES1_LINEAR_TEXTURE_SUPPORT_Type U01 +#define GC_FEATURES1_LINEAR_TEXTURE_SUPPORT_NONE 0x0 +#define GC_FEATURES1_LINEAR_TEXTURE_SUPPORT_AVAILABLE 0x1 + +#define GC_FEATURES1_HALTI0 23 : 23 +#define GC_FEATURES1_HALTI0_End 23 +#define GC_FEATURES1_HALTI0_Start 23 +#define GC_FEATURES1_HALTI0_Type U01 +#define GC_FEATURES1_HALTI0_NONE 0x0 +#define GC_FEATURES1_HALTI0_AVAILABLE 0x1 + +#define GC_FEATURES1_CORRECT_OVERFLOW_VG 24 : 24 +#define GC_FEATURES1_CORRECT_OVERFLOW_VG_End 24 +#define GC_FEATURES1_CORRECT_OVERFLOW_VG_Start 24 +#define GC_FEATURES1_CORRECT_OVERFLOW_VG_Type U01 +#define GC_FEATURES1_CORRECT_OVERFLOW_VG_NONE 0x0 +#define GC_FEATURES1_CORRECT_OVERFLOW_VG_AVAILABLE 0x1 + +#define GC_FEATURES1_NEGATIVE_LOG_FIX 25 : 25 +#define GC_FEATURES1_NEGATIVE_LOG_FIX_End 25 +#define GC_FEATURES1_NEGATIVE_LOG_FIX_Start 25 +#define GC_FEATURES1_NEGATIVE_LOG_FIX_Type U01 +#define GC_FEATURES1_NEGATIVE_LOG_FIX_NONE 0x0 +#define GC_FEATURES1_NEGATIVE_LOG_FIX_AVAILABLE 0x1 + +#define GC_FEATURES1_RESOLVE_OFFSET 26 : 26 +#define GC_FEATURES1_RESOLVE_OFFSET_End 26 +#define GC_FEATURES1_RESOLVE_OFFSET_Start 26 +#define GC_FEATURES1_RESOLVE_OFFSET_Type U01 +#define GC_FEATURES1_RESOLVE_OFFSET_NONE 0x0 +#define GC_FEATURES1_RESOLVE_OFFSET_AVAILABLE 0x1 + +#define GC_FEATURES1_OK_TO_GATE_AXI_CLOCK 27 : 27 +#define GC_FEATURES1_OK_TO_GATE_AXI_CLOCK_End 27 +#define GC_FEATURES1_OK_TO_GATE_AXI_CLOCK_Start 27 +#define GC_FEATURES1_OK_TO_GATE_AXI_CLOCK_Type U01 +#define GC_FEATURES1_OK_TO_GATE_AXI_CLOCK_NONE 0x0 +#define GC_FEATURES1_OK_TO_GATE_AXI_CLOCK_AVAILABLE 0x1 + +#define GC_FEATURES1_MMU 28 : 28 +#define GC_FEATURES1_MMU_End 28 +#define GC_FEATURES1_MMU_Start 28 +#define GC_FEATURES1_MMU_Type U01 +#define GC_FEATURES1_MMU_NONE 0x0 +#define GC_FEATURES1_MMU_AVAILABLE 0x1 + +#define GC_FEATURES1_WIDE_LINE 29 : 29 +#define GC_FEATURES1_WIDE_LINE_End 29 +#define GC_FEATURES1_WIDE_LINE_Start 29 +#define GC_FEATURES1_WIDE_LINE_Type U01 +#define GC_FEATURES1_WIDE_LINE_NONE 0x0 +#define GC_FEATURES1_WIDE_LINE_AVAILABLE 0x1 + +#define GC_FEATURES1_BUG_FIXES6 30 : 30 +#define GC_FEATURES1_BUG_FIXES6_End 30 +#define GC_FEATURES1_BUG_FIXES6_Start 30 +#define GC_FEATURES1_BUG_FIXES6_Type U01 +#define GC_FEATURES1_BUG_FIXES6_NONE 0x0 +#define GC_FEATURES1_BUG_FIXES6_AVAILABLE 0x1 + +#define GC_FEATURES1_FC_FLUSH_STALL 31 : 31 +#define GC_FEATURES1_FC_FLUSH_STALL_End 31 +#define GC_FEATURES1_FC_FLUSH_STALL_Start 31 +#define GC_FEATURES1_FC_FLUSH_STALL_Type U01 +#define GC_FEATURES1_FC_FLUSH_STALL_NONE 0x0 +#define GC_FEATURES1_FC_FLUSH_STALL_AVAILABLE 0x1 + +union gcfeatures1 { + struct { + /* GC_FEATURES1_Address:RSUV_SWIZZLE */ + unsigned int rsuvswizzle:1; + + /* GC_FEATURES1_Address:V2_COMPRESSION */ + unsigned int v2compression:1; + + /* GC_FEATURES1_Address:VG_DOUBLE_BUFFER */ + unsigned int vgdblbuffer:1; + + /* GC_FEATURES1_Address:BUG_FIXES1 */ + unsigned int bugfixes1:1; + + /* GC_FEATURES1_Address:BUG_FIXES2 */ + unsigned int bugfixes2:1; + + /* GC_FEATURES1_Address:TEXTURE_STRIDE */ + unsigned int txstride:1; + + /* GC_FEATURES1_Address:BUG_FIXES3 */ + unsigned int bugfixes3:1; + + /* GC_FEATURES1_Address:CORRECT_AUTO_DISABLE */ + unsigned int correctautodisable:1; + + /* GC_FEATURES1_Address:AUTO_RESTART_TS */ + unsigned int autorestartts:1; + + /* GC_FEATURES1_Address:BUG_FIXES4 */ + unsigned int bugfixes4:1; + + /* GC_FEATURES1_Address:L2_WINDOWING */ + unsigned int l2win:1; + + /* GC_FEATURES1_Address:HALF_FLOAT_PIPE */ + unsigned int halffloatpipe:1; + + /* GC_FEATURES1_Address:PIXEL_DITHER */ + unsigned int pixeldither:1; + + /* GC_FEATURES1_Address:TWO_STENCIL_REFERENCE */ + unsigned int twostencilref:1; + + /* GC_FEATURES1_Address:EXTENDED_PIXEL_FORMAT */ + unsigned int pixformatex:1; + + /* GC_FEATURES1_Address:CORRECT_MIN_MAX_DEPTH */ + unsigned int correctminmaxdepth:1; + + /* GC_FEATURES1_Address:DITHER_AND_FILTER_PLUS_ALPHA_2D */ + unsigned int ditherfilter:1; + + /* GC_FEATURES1_Address:BUG_FIXES5 */ + unsigned int bugfixes5:1; + + /* GC_FEATURES1_Address:NEW_2D */ + unsigned int new2d:1; + + /* GC_FEATURES1_Address:NEW_FLOATING_POINT_ARITHMETIC */ + unsigned int newfp:1; + + /* GC_FEATURES1_Address:TEXTURE_HORIZONTAL_ALIGNMENT_SELECT */ + unsigned int txalign:1; + + /* GC_FEATURES1_Address:NON_POWER_OF_TWO */ + unsigned int nonpowof2:1; + + /* GC_FEATURES1_Address:LINEAR_TEXTURE_SUPPORT */ + unsigned int lineartx:1; + + /* GC_FEATURES1_Address:HALTI0 */ + unsigned int halti0:1; + + /* GC_FEATURES1_Address:CORRECT_OVERFLOW_VG */ + unsigned int correctoverflowvg:1; + + /* GC_FEATURES1_Address:NEGATIVE_LOG_FIX */ + unsigned int neglogfix:1; + + /* GC_FEATURES1_Address:RESOLVE_OFFSET */ + unsigned int rsoffset:1; + + /* GC_FEATURES1_Address:OK_TO_GATE_AXI_CLOCK */ + unsigned int axiclockgating:1; + + /* GC_FEATURES1_Address:MMU */ + unsigned int mmu:1; + + /* GC_FEATURES1_Address:WIDE_LINE */ + unsigned int wideline:1; + + /* GC_FEATURES1_Address:BUG_FIXES6 */ + unsigned int bugfixes6:1; + + /* GC_FEATURES1_Address:FC_FLUSH_STALL */ + unsigned int fcflushstall:1; + } reg; + + unsigned int raw; +}; + +/******************************************************************************* +** Register GCMinorFeatures2 +*/ + +/* Shows which features are enabled in this chip. This register has no set ** +** reset value. It varies with the implementation. */ + +#define GC_FEATURES2_Address 0x00084 +#define GC_FEATURES2_MSB 15 +#define GC_FEATURES2_LSB 0 +#define GC_FEATURES2_BLK 0 +#define GC_FEATURES2_Count 1 +#define GC_FEATURES2_FieldMask 0xFFFFFFFF +#define GC_FEATURES2_ReadMask 0xFFFFFFFF +#define GC_FEATURES2_WriteMask 0x00000000 +#define GC_FEATURES2_ResetValue 0x00000000 + +#define GC_FEATURES2_LINE_LOOP 0 : 0 +#define GC_FEATURES2_LINE_LOOP_End 0 +#define GC_FEATURES2_LINE_LOOP_Start 0 +#define GC_FEATURES2_LINE_LOOP_Type U01 +#define GC_FEATURES2_LINE_LOOP_NONE 0x0 +#define GC_FEATURES2_LINE_LOOP_AVAILABLE 0x1 + +#define GC_FEATURES2_LOGIC_OP 1 : 1 +#define GC_FEATURES2_LOGIC_OP_End 1 +#define GC_FEATURES2_LOGIC_OP_Start 1 +#define GC_FEATURES2_LOGIC_OP_Type U01 +#define GC_FEATURES2_LOGIC_OP_NONE 0x0 +#define GC_FEATURES2_LOGIC_OP_AVAILABLE 0x1 + +#define GC_FEATURES2_SEAMLESS_CUBE_MAP 2 : 2 +#define GC_FEATURES2_SEAMLESS_CUBE_MAP_End 2 +#define GC_FEATURES2_SEAMLESS_CUBE_MAP_Start 2 +#define GC_FEATURES2_SEAMLESS_CUBE_MAP_Type U01 +#define GC_FEATURES2_SEAMLESS_CUBE_MAP_NONE 0x0 +#define GC_FEATURES2_SEAMLESS_CUBE_MAP_AVAILABLE 0x1 + +#define GC_FEATURES2_SUPER_TILED_TEXTURE 3 : 3 +#define GC_FEATURES2_SUPER_TILED_TEXTURE_End 3 +#define GC_FEATURES2_SUPER_TILED_TEXTURE_Start 3 +#define GC_FEATURES2_SUPER_TILED_TEXTURE_Type U01 +#define GC_FEATURES2_SUPER_TILED_TEXTURE_NONE 0x0 +#define GC_FEATURES2_SUPER_TILED_TEXTURE_AVAILABLE 0x1 + +#define GC_FEATURES2_LINEAR_PE 4 : 4 +#define GC_FEATURES2_LINEAR_PE_End 4 +#define GC_FEATURES2_LINEAR_PE_Start 4 +#define GC_FEATURES2_LINEAR_PE_Type U01 +#define GC_FEATURES2_LINEAR_PE_NONE 0x0 +#define GC_FEATURES2_LINEAR_PE_AVAILABLE 0x1 + +#define GC_FEATURES2_RECT_PRIMITIVE 5 : 5 +#define GC_FEATURES2_RECT_PRIMITIVE_End 5 +#define GC_FEATURES2_RECT_PRIMITIVE_Start 5 +#define GC_FEATURES2_RECT_PRIMITIVE_Type U01 +#define GC_FEATURES2_RECT_PRIMITIVE_NONE 0x0 +#define GC_FEATURES2_RECT_PRIMITIVE_AVAILABLE 0x1 + +#define GC_FEATURES2_COMPOSITION 6 : 6 +#define GC_FEATURES2_COMPOSITION_End 6 +#define GC_FEATURES2_COMPOSITION_Start 6 +#define GC_FEATURES2_COMPOSITION_Type U01 +#define GC_FEATURES2_COMPOSITION_NONE 0x0 +#define GC_FEATURES2_COMPOSITION_AVAILABLE 0x1 + +#define GC_FEATURES2_CORRECT_AUTO_DISABLE_COUNT_WIDTH 7 : 7 +#define GC_FEATURES2_CORRECT_AUTO_DISABLE_COUNT_WIDTH_End 7 +#define GC_FEATURES2_CORRECT_AUTO_DISABLE_COUNT_WIDTH_Start 7 +#define GC_FEATURES2_CORRECT_AUTO_DISABLE_COUNT_WIDTH_Type U01 +#define GC_FEATURES2_CORRECT_AUTO_DISABLE_COUNT_WIDTH_NONE 0x0 +#define GC_FEATURES2_CORRECT_AUTO_DISABLE_COUNT_WIDTH_AVAILABLE 0x1 + +#define GC_FEATURES2_PE_SWIZZLE 8 : 8 +#define GC_FEATURES2_PE_SWIZZLE_End 8 +#define GC_FEATURES2_PE_SWIZZLE_Start 8 +#define GC_FEATURES2_PE_SWIZZLE_Type U01 +#define GC_FEATURES2_PE_SWIZZLE_NONE 0x0 +#define GC_FEATURES2_PE_SWIZZLE_AVAILABLE 0x1 + +#define GC_FEATURES2_END_EVENT 9 : 9 +#define GC_FEATURES2_END_EVENT_End 9 +#define GC_FEATURES2_END_EVENT_Start 9 +#define GC_FEATURES2_END_EVENT_Type U01 +#define GC_FEATURES2_END_EVENT_NONE 0x0 +#define GC_FEATURES2_END_EVENT_AVAILABLE 0x1 + +#define GC_FEATURES2_S1S8 10 : 10 +#define GC_FEATURES2_S1S8_End 10 +#define GC_FEATURES2_S1S8_Start 10 +#define GC_FEATURES2_S1S8_Type U01 +#define GC_FEATURES2_S1S8_NONE 0x0 +#define GC_FEATURES2_S1S8_AVAILABLE 0x1 + +#define GC_FEATURES2_HALTI1 11 : 11 +#define GC_FEATURES2_HALTI1_End 11 +#define GC_FEATURES2_HALTI1_Start 11 +#define GC_FEATURES2_HALTI1_Type U01 +#define GC_FEATURES2_HALTI1_NONE 0x0 +#define GC_FEATURES2_HALTI1_AVAILABLE 0x1 + +#define GC_FEATURES2_RGB888 12 : 12 +#define GC_FEATURES2_RGB888_End 12 +#define GC_FEATURES2_RGB888_Start 12 +#define GC_FEATURES2_RGB888_Type U01 +#define GC_FEATURES2_RGB888_NONE 0x0 +#define GC_FEATURES2_RGB888_AVAILABLE 0x1 + +#define GC_FEATURES2_TX__YUV_ASSEMBLER 13 : 13 +#define GC_FEATURES2_TX__YUV_ASSEMBLER_End 13 +#define GC_FEATURES2_TX__YUV_ASSEMBLER_Start 13 +#define GC_FEATURES2_TX__YUV_ASSEMBLER_Type U01 +#define GC_FEATURES2_TX__YUV_ASSEMBLER_NONE 0x0 +#define GC_FEATURES2_TX__YUV_ASSEMBLER_AVAILABLE 0x1 + +#define GC_FEATURES2_DYNAMIC_FREQUENCY_SCALING 14 : 14 +#define GC_FEATURES2_DYNAMIC_FREQUENCY_SCALING_End 14 +#define GC_FEATURES2_DYNAMIC_FREQUENCY_SCALING_Start 14 +#define GC_FEATURES2_DYNAMIC_FREQUENCY_SCALING_Type U01 +#define GC_FEATURES2_DYNAMIC_FREQUENCY_SCALING_NONE 0x0 +#define GC_FEATURES2_DYNAMIC_FREQUENCY_SCALING_AVAILABLE 0x1 + +#define GC_FEATURES2_TX_FILTER 15 : 15 +#define GC_FEATURES2_TX_FILTER_End 15 +#define GC_FEATURES2_TX_FILTER_Start 15 +#define GC_FEATURES2_TX_FILTER_Type U01 +#define GC_FEATURES2_TX_FILTER_NONE 0x0 +#define GC_FEATURES2_TX_FILTER_AVAILABLE 0x1 + +#define GC_FEATURES2_FULL_DIRECT_FB 16 : 16 +#define GC_FEATURES2_FULL_DIRECT_FB_End 16 +#define GC_FEATURES2_FULL_DIRECT_FB_Start 16 +#define GC_FEATURES2_FULL_DIRECT_FB_Type U01 +#define GC_FEATURES2_FULL_DIRECT_FB_NONE 0x0 +#define GC_FEATURES2_FULL_DIRECT_FB_AVAILABLE 0x1 + +#define GC_FEATURES2_ONE_PASS_2D_FILTER 17 : 17 +#define GC_FEATURES2_ONE_PASS_2D_FILTER_End 17 +#define GC_FEATURES2_ONE_PASS_2D_FILTER_Start 17 +#define GC_FEATURES2_ONE_PASS_2D_FILTER_Type U01 +#define GC_FEATURES2_ONE_PASS_2D_FILTER_NONE 0x0 +#define GC_FEATURES2_ONE_PASS_2D_FILTER_AVAILABLE 0x1 + +#define GC_FEATURES2_THREAD_WALKER_IN_PS 18 : 18 +#define GC_FEATURES2_THREAD_WALKER_IN_PS_End 18 +#define GC_FEATURES2_THREAD_WALKER_IN_PS_Start 18 +#define GC_FEATURES2_THREAD_WALKER_IN_PS_Type U01 +#define GC_FEATURES2_THREAD_WALKER_IN_PS_NONE 0x0 +#define GC_FEATURES2_THREAD_WALKER_IN_PS_AVAILABLE 0x1 + +#define GC_FEATURES2_TILE_FILLER 19 : 19 +#define GC_FEATURES2_TILE_FILLER_End 19 +#define GC_FEATURES2_TILE_FILLER_Start 19 +#define GC_FEATURES2_TILE_FILLER_Type U01 +#define GC_FEATURES2_TILE_FILLER_NONE 0x0 +#define GC_FEATURES2_TILE_FILLER_AVAILABLE 0x1 + +#define GC_FEATURES2_YUV_STANDARD 20 : 20 +#define GC_FEATURES2_YUV_STANDARD_End 20 +#define GC_FEATURES2_YUV_STANDARD_Start 20 +#define GC_FEATURES2_YUV_STANDARD_Type U01 +#define GC_FEATURES2_YUV_STANDARD_NONE 0x0 +#define GC_FEATURES2_YUV_STANDARD_AVAILABLE 0x1 + +#define GC_FEATURES2_MULTI_SOURCE_BLT 21 : 21 +#define GC_FEATURES2_MULTI_SOURCE_BLT_End 21 +#define GC_FEATURES2_MULTI_SOURCE_BLT_Start 21 +#define GC_FEATURES2_MULTI_SOURCE_BLT_Type U01 +#define GC_FEATURES2_MULTI_SOURCE_BLT_NONE 0x0 +#define GC_FEATURES2_MULTI_SOURCE_BLT_AVAILABLE 0x1 + +#define GC_FEATURES2_YUV_CONVERSION 22 : 22 +#define GC_FEATURES2_YUV_CONVERSION_End 22 +#define GC_FEATURES2_YUV_CONVERSION_Start 22 +#define GC_FEATURES2_YUV_CONVERSION_Type U01 +#define GC_FEATURES2_YUV_CONVERSION_NONE 0x0 +#define GC_FEATURES2_YUV_CONVERSION_AVAILABLE 0x1 + +#define GC_FEATURES2_FLUSH_FIXED_2D 23 : 23 +#define GC_FEATURES2_FLUSH_FIXED_2D_End 23 +#define GC_FEATURES2_FLUSH_FIXED_2D_Start 23 +#define GC_FEATURES2_FLUSH_FIXED_2D_Type U01 +#define GC_FEATURES2_FLUSH_FIXED_2D_NONE 0x0 +#define GC_FEATURES2_FLUSH_FIXED_2D_AVAILABLE 0x1 + +#define GC_FEATURES2_INTERLEAVER 24 : 24 +#define GC_FEATURES2_INTERLEAVER_End 24 +#define GC_FEATURES2_INTERLEAVER_Start 24 +#define GC_FEATURES2_INTERLEAVER_Type U01 +#define GC_FEATURES2_INTERLEAVER_NONE 0x0 +#define GC_FEATURES2_INTERLEAVER_AVAILABLE 0x1 + +#define GC_FEATURES2_MIXED_STREAMS 25 : 25 +#define GC_FEATURES2_MIXED_STREAMS_End 25 +#define GC_FEATURES2_MIXED_STREAMS_Start 25 +#define GC_FEATURES2_MIXED_STREAMS_Type U01 +#define GC_FEATURES2_MIXED_STREAMS_NONE 0x0 +#define GC_FEATURES2_MIXED_STREAMS_AVAILABLE 0x1 + +#define GC_FEATURES2_L2_CACHE_FOR_2D_420 26 : 26 +#define GC_FEATURES2_L2_CACHE_FOR_2D_420_End 26 +#define GC_FEATURES2_L2_CACHE_FOR_2D_420_Start 26 +#define GC_FEATURES2_L2_CACHE_FOR_2D_420_Type U01 +#define GC_FEATURES2_L2_CACHE_FOR_2D_420_NONE 0x0 +#define GC_FEATURES2_L2_CACHE_FOR_2D_420_AVAILABLE 0x1 + +#define GC_FEATURES2_BUG_FIXES7 27 : 27 +#define GC_FEATURES2_BUG_FIXES7_End 27 +#define GC_FEATURES2_BUG_FIXES7_Start 27 +#define GC_FEATURES2_BUG_FIXES7_Type U01 +#define GC_FEATURES2_BUG_FIXES7_NONE 0x0 +#define GC_FEATURES2_BUG_FIXES7_AVAILABLE 0x1 + +#define GC_FEATURES2_NO_INDEX_PATTERN 28 : 28 +#define GC_FEATURES2_NO_INDEX_PATTERN_End 28 +#define GC_FEATURES2_NO_INDEX_PATTERN_Start 28 +#define GC_FEATURES2_NO_INDEX_PATTERN_Type U01 +#define GC_FEATURES2_NO_INDEX_PATTERN_NONE 0x0 +#define GC_FEATURES2_NO_INDEX_PATTERN_AVAILABLE 0x1 + +#define GC_FEATURES2_TEXTURE_TILE_STATUS 29 : 29 +#define GC_FEATURES2_TEXTURE_TILE_STATUS_End 29 +#define GC_FEATURES2_TEXTURE_TILE_STATUS_Start 29 +#define GC_FEATURES2_TEXTURE_TILE_STATUS_Type U01 +#define GC_FEATURES2_TEXTURE_TILE_STATUS_NONE 0x0 +#define GC_FEATURES2_TEXTURE_TILE_STATUS_AVAILABLE 0x1 + +#define GC_FEATURES2_DECOMPRESS_Z16 30 : 30 +#define GC_FEATURES2_DECOMPRESS_Z16_End 30 +#define GC_FEATURES2_DECOMPRESS_Z16_Start 30 +#define GC_FEATURES2_DECOMPRESS_Z16_Type U01 +#define GC_FEATURES2_DECOMPRESS_Z16_NONE 0x0 +#define GC_FEATURES2_DECOMPRESS_Z16_AVAILABLE 0x1 + +#define GC_FEATURES2_BUG_FIXES8 31 : 31 +#define GC_FEATURES2_BUG_FIXES8_End 31 +#define GC_FEATURES2_BUG_FIXES8_Start 31 +#define GC_FEATURES2_BUG_FIXES8_Type U01 +#define GC_FEATURES2_BUG_FIXES8_NONE 0x0 +#define GC_FEATURES2_BUG_FIXES8_AVAILABLE 0x1 + +union gcfeatures2 { + struct { + /* GC_FEATURES2_Address:LINE_LOOP */ + unsigned int lineloop:1; + + /* GC_FEATURES2_Address:LOGIC_OP */ + unsigned int logop:1; + + /* GC_FEATURES2_Address:SEAMLESS_CUBE_MAP */ + unsigned int cubemap:1; + + /* GC_FEATURES2_Address:SUPER_TILED_TEXTURE */ + unsigned int supertiledtx:1; + + /* GC_FEATURES2_Address:LINEAR_PE */ + unsigned int linearpe:1; + + /* GC_FEATURES2_Address:RECT_PRIMITIVE */ + unsigned int rectprim:1; + + /* GC_FEATURES2_Address:COMPOSITION */ + unsigned int composition:1; + + /* GC_FEATURES2_Address:CORRECT_AUTO_DISABLE_COUNT_WIDTH */ + unsigned int correctcountwidth:1; + + /* GC_FEATURES2_Address:PE_SWIZZLE */ + unsigned int peswizzle:1; + + /* GC_FEATURES2_Address:END_EVENT */ + unsigned int endevent:1; + + /* GC_FEATURES2_Address:S1S8 */ + unsigned int s1s8:1; + + /* GC_FEATURES2_Address:HALTI1 */ + unsigned int halti1:1; + + /* GC_FEATURES2_Address:RGB888 */ + unsigned int rgb888:1; + + /* GC_FEATURES2_Address:TX__YUV_ASSEMBLER */ + unsigned int txyuvasm:1; + + /* GC_FEATURES2_Address:DYNAMIC_FREQUENCY_SCALING */ + unsigned int dynscaling:1; + + /* GC_FEATURES2_Address:TX_FILTER */ + unsigned int txfilter:1; + + /* GC_FEATURES2_Address:FULL_DIRECT_FB */ + unsigned int dfb:1; + + /* GC_FEATURES2_Address:ONE_PASS_2D_FILTER */ + unsigned int onepassfilter:1; + + /* GC_FEATURES2_Address:THREAD_WALKER_IN_PS */ + unsigned int pstw:1; + + /* GC_FEATURES2_Address:TILE_FILLER */ + unsigned int tilefiller:1; + + /* GC_FEATURES2_Address:YUV_STANDARD */ + unsigned int yuvstd:1; + + /* GC_FEATURES2_Address:MULTI_SOURCE_BLT */ + unsigned int multisrc:1; + + /* GC_FEATURES2_Address:YUV_CONVERSION */ + unsigned int yuvconvert:1; + + /* GC_FEATURES2_Address:FLUSH_FIXED_2D */ + unsigned int flushfixed2d:1; + + /* GC_FEATURES2_Address:INTERLEAVER */ + unsigned int interleaver:1; + + /* GC_FEATURES2_Address:MIXED_STREAMS */ + unsigned int mixedstreams:1; + + /* GC_FEATURES2_Address:L2_CACHE_FOR_2D_420 */ + unsigned int l2cachefor420:1; + + /* GC_FEATURES2_Address:BUG_FIXES7 */ + unsigned int bugfixes7:1; + + /* GC_FEATURES2_Address:NO_INDEX_PATTERN */ + unsigned int noindexpatern:1; + + /* GC_FEATURES2_Address:TEXTURE_TILE_STATUS */ + unsigned int tilestatustx:1; + + /* GC_FEATURES2_Address:DECOMPRESS_Z16 */ + unsigned int decompressz16:1; + + /* GC_FEATURES2_Address:BUG_FIXES8 */ + unsigned int bugfixes8:1; + } reg; + + unsigned int raw; +}; + +/******************************************************************************* +** Register GCMinorFeatures3 +*/ + +/* Shows which features are enabled in this chip. This register has no set ** +** reset value, it varies with the implementation. */ + +#define GC_FEATURES3_Address 0x00088 +#define GC_FEATURES3_MSB 15 +#define GC_FEATURES3_LSB 0 +#define GC_FEATURES3_BLK 0 +#define GC_FEATURES3_Count 1 +#define GC_FEATURES3_FieldMask 0x003FFFFF +#define GC_FEATURES3_ReadMask 0x003FFFFF +#define GC_FEATURES3_WriteMask 0x00000000 +#define GC_FEATURES3_ResetValue 0x00000000 + +#define GC_FEATURES3_DE_ROTATION_STALL_FIX 0 : 0 +#define GC_FEATURES3_DE_ROTATION_STALL_FIX_End 0 +#define GC_FEATURES3_DE_ROTATION_STALL_FIX_Start 0 +#define GC_FEATURES3_DE_ROTATION_STALL_FIX_Type U01 +#define GC_FEATURES3_DE_ROTATION_STALL_FIX_NONE 0x0 +#define GC_FEATURES3_DE_ROTATION_STALL_FIX_AVAILABLE 0x1 + +#define GC_FEATURES3_OCL_ONLY 1 : 1 +#define GC_FEATURES3_OCL_ONLY_End 1 +#define GC_FEATURES3_OCL_ONLY_Start 1 +#define GC_FEATURES3_OCL_ONLY_Type U01 +#define GC_FEATURES3_OCL_ONLY_NONE 0x0 +#define GC_FEATURES3_OCL_ONLY_AVAILABLE 0x1 + +#define GC_FEATURES3_NEW_FEATURES0 2 : 2 +#define GC_FEATURES3_NEW_FEATURES0_End 2 +#define GC_FEATURES3_NEW_FEATURES0_Start 2 +#define GC_FEATURES3_NEW_FEATURES0_Type U01 +#define GC_FEATURES3_NEW_FEATURES0_NONE 0x0 +#define GC_FEATURES3_NEW_FEATURES0_AVAILABLE 0x1 + +#define GC_FEATURES3_INSTRUCTION_CACHE 3 : 3 +#define GC_FEATURES3_INSTRUCTION_CACHE_End 3 +#define GC_FEATURES3_INSTRUCTION_CACHE_Start 3 +#define GC_FEATURES3_INSTRUCTION_CACHE_Type U01 +#define GC_FEATURES3_INSTRUCTION_CACHE_NONE 0x0 +#define GC_FEATURES3_INSTRUCTION_CACHE_AVAILABLE 0x1 + +#define GC_FEATURES3_GEOMETRY_SHADER 4 : 4 +#define GC_FEATURES3_GEOMETRY_SHADER_End 4 +#define GC_FEATURES3_GEOMETRY_SHADER_Start 4 +#define GC_FEATURES3_GEOMETRY_SHADER_Type U01 +#define GC_FEATURES3_GEOMETRY_SHADER_NONE 0x0 +#define GC_FEATURES3_GEOMETRY_SHADER_AVAILABLE 0x1 + +#define GC_FEATURES3_TEX_COMPRESSION_SUPERTILED 5 : 5 +#define GC_FEATURES3_TEX_COMPRESSION_SUPERTILED_End 5 +#define GC_FEATURES3_TEX_COMPRESSION_SUPERTILED_Start 5 +#define GC_FEATURES3_TEX_COMPRESSION_SUPERTILED_Type U01 +#define GC_FEATURES3_TEX_COMPRESSION_SUPERTILED_NONE 0x0 +#define GC_FEATURES3_TEX_COMPRESSION_SUPERTILED_AVAILABLE 0x1 + +#define GC_FEATURES3_GENERICS 6 : 6 +#define GC_FEATURES3_GENERICS_End 6 +#define GC_FEATURES3_GENERICS_Start 6 +#define GC_FEATURES3_GENERICS_Type U01 +#define GC_FEATURES3_GENERICS_NONE 0x0 +#define GC_FEATURES3_GENERICS_AVAILABLE 0x1 + +#define GC_FEATURES3_BUG_FIXES9 7 : 7 +#define GC_FEATURES3_BUG_FIXES9_End 7 +#define GC_FEATURES3_BUG_FIXES9_Start 7 +#define GC_FEATURES3_BUG_FIXES9_Type U01 +#define GC_FEATURES3_BUG_FIXES9_NONE 0x0 +#define GC_FEATURES3_BUG_FIXES9_AVAILABLE 0x1 + +#define GC_FEATURES3_FAST_MSAA 8 : 8 +#define GC_FEATURES3_FAST_MSAA_End 8 +#define GC_FEATURES3_FAST_MSAA_Start 8 +#define GC_FEATURES3_FAST_MSAA_Type U01 +#define GC_FEATURES3_FAST_MSAA_NONE 0x0 +#define GC_FEATURES3_FAST_MSAA_AVAILABLE 0x1 + +#define GC_FEATURES3_WCLIP 9 : 9 +#define GC_FEATURES3_WCLIP_End 9 +#define GC_FEATURES3_WCLIP_Start 9 +#define GC_FEATURES3_WCLIP_Type U01 +#define GC_FEATURES3_WCLIP_NONE 0x0 +#define GC_FEATURES3_WCLIP_AVAILABLE 0x1 + +#define GC_FEATURES3_BUG_FIXES10 10 : 10 +#define GC_FEATURES3_BUG_FIXES10_End 10 +#define GC_FEATURES3_BUG_FIXES10_Start 10 +#define GC_FEATURES3_BUG_FIXES10_Type U01 +#define GC_FEATURES3_BUG_FIXES10_NONE 0x0 +#define GC_FEATURES3_BUG_FIXES10_AVAILABLE 0x1 + +#define GC_FEATURES3_UNIFIED_SAMPLERS 11 : 11 +#define GC_FEATURES3_UNIFIED_SAMPLERS_End 11 +#define GC_FEATURES3_UNIFIED_SAMPLERS_Start 11 +#define GC_FEATURES3_UNIFIED_SAMPLERS_Type U01 +#define GC_FEATURES3_UNIFIED_SAMPLERS_NONE 0x0 +#define GC_FEATURES3_UNIFIED_SAMPLERS_AVAILABLE 0x1 + +#define GC_FEATURES3_BUG_FIXES11 12 : 12 +#define GC_FEATURES3_BUG_FIXES11_End 12 +#define GC_FEATURES3_BUG_FIXES11_Start 12 +#define GC_FEATURES3_BUG_FIXES11_Type U01 +#define GC_FEATURES3_BUG_FIXES11_NONE 0x0 +#define GC_FEATURES3_BUG_FIXES11_AVAILABLE 0x1 + +#define GC_FEATURES3_PERFORMANCE_COUNTERS 13 : 13 +#define GC_FEATURES3_PERFORMANCE_COUNTERS_End 13 +#define GC_FEATURES3_PERFORMANCE_COUNTERS_Start 13 +#define GC_FEATURES3_PERFORMANCE_COUNTERS_Type U01 +#define GC_FEATURES3_PERFORMANCE_COUNTERS_NONE 0x0 +#define GC_FEATURES3_PERFORMANCE_COUNTERS_AVAILABLE 0x1 + +/* High precision transcendentals are available. */ +#define GC_FEATURES3_EXTRA_SHADER_INSTRUCTIONS2 14 : 14 +#define GC_FEATURES3_EXTRA_SHADER_INSTRUCTIONS2_End 14 +#define GC_FEATURES3_EXTRA_SHADER_INSTRUCTIONS2_Start 14 +#define GC_FEATURES3_EXTRA_SHADER_INSTRUCTIONS2_Type U01 +#define GC_FEATURES3_EXTRA_SHADER_INSTRUCTIONS2_NONE 0x0 +#define GC_FEATURES3_EXTRA_SHADER_INSTRUCTIONS2_AVAILABLE 0x1 + +#define GC_FEATURES3_BUG_FIXES12 15 : 15 +#define GC_FEATURES3_BUG_FIXES12_End 15 +#define GC_FEATURES3_BUG_FIXES12_Start 15 +#define GC_FEATURES3_BUG_FIXES12_Type U01 +#define GC_FEATURES3_BUG_FIXES12_NONE 0x0 +#define GC_FEATURES3_BUG_FIXES12_AVAILABLE 0x1 + +#define GC_FEATURES3_BUG_FIXES13 16 : 16 +#define GC_FEATURES3_BUG_FIXES13_End 16 +#define GC_FEATURES3_BUG_FIXES13_Start 16 +#define GC_FEATURES3_BUG_FIXES13_Type U01 +#define GC_FEATURES3_BUG_FIXES13_NONE 0x0 +#define GC_FEATURES3_BUG_FIXES13_AVAILABLE 0x1 + +#define GC_FEATURES3_DE_ENHANCEMENTS1 17 : 17 +#define GC_FEATURES3_DE_ENHANCEMENTS1_End 17 +#define GC_FEATURES3_DE_ENHANCEMENTS1_Start 17 +#define GC_FEATURES3_DE_ENHANCEMENTS1_Type U01 +#define GC_FEATURES3_DE_ENHANCEMENTS1_NONE 0x0 +#define GC_FEATURES3_DE_ENHANCEMENTS1_AVAILABLE 0x1 + +#define GC_FEATURES3_ACE 18 : 18 +#define GC_FEATURES3_ACE_End 18 +#define GC_FEATURES3_ACE_Start 18 +#define GC_FEATURES3_ACE_Type U01 +#define GC_FEATURES3_ACE_NONE 0x0 +#define GC_FEATURES3_ACE_AVAILABLE 0x1 + +#define GC_FEATURES3_TX_ENHANCEMENTS1 19 : 19 +#define GC_FEATURES3_TX_ENHANCEMENTS1_End 19 +#define GC_FEATURES3_TX_ENHANCEMENTS1_Start 19 +#define GC_FEATURES3_TX_ENHANCEMENTS1_Type U01 +#define GC_FEATURES3_TX_ENHANCEMENTS1_NONE 0x0 +#define GC_FEATURES3_TX_ENHANCEMENTS1_AVAILABLE 0x1 + +#define GC_FEATURES3_SH_ENHANCEMENTS1 20 : 20 +#define GC_FEATURES3_SH_ENHANCEMENTS1_End 20 +#define GC_FEATURES3_SH_ENHANCEMENTS1_Start 20 +#define GC_FEATURES3_SH_ENHANCEMENTS1_Type U01 +#define GC_FEATURES3_SH_ENHANCEMENTS1_NONE 0x0 +#define GC_FEATURES3_SH_ENHANCEMENTS1_AVAILABLE 0x1 + +#define GC_FEATURES3_SH_ENHANCEMENTS2 21 : 21 +#define GC_FEATURES3_SH_ENHANCEMENTS2_End 21 +#define GC_FEATURES3_SH_ENHANCEMENTS2_Start 21 +#define GC_FEATURES3_SH_ENHANCEMENTS2_Type U01 +#define GC_FEATURES3_SH_ENHANCEMENTS2_NONE 0x0 +#define GC_FEATURES3_SH_ENHANCEMENTS2_AVAILABLE 0x1 + +union gcfeatures3 { + struct { + /* GC_FEATURES3_Address:DE_ROTATION_STALL_FIX */ + unsigned int rotationfix:1; + + /* GC_FEATURES3_Address:OCL_ONLY */ + unsigned int ocl:1; + + /* GC_FEATURES3_Address:NEW_FEATURES0 */ + unsigned int newfeatures0:1; + + /* GC_FEATURES3_Address:INSTRUCTION_CACHE */ + unsigned int icache:1; + + /* GC_FEATURES3_Address:GEOMETRY_SHADER */ + unsigned int gs:1; + + /* GC_FEATURES3_Address:TEX_COMPRESSION_SUPERTILED */ + unsigned int supertiledtxcompression:1; + + /* GC_FEATURES3_Address:GENERICS */ + unsigned int generics:1; + + /* GC_FEATURES3_Address:BUG_FIXES9 */ + unsigned int bugfixes9:1; + + /* GC_FEATURES3_Address:FAST_MSAA */ + unsigned int fastmsaa:1; + + /* GC_FEATURES3_Address:WCLIP */ + unsigned int wclip:1; + + /* GC_FEATURES3_Address:BUG_FIXES10 */ + unsigned int bugfixes10:1; + + /* GC_FEATURES3_Address:UNIFIED_SAMPLERS */ + unsigned int unifiedsamplers:1; + + /* GC_FEATURES3_Address:BUG_FIXES11 */ + unsigned int bugfixes11:1; + + /* GC_FEATURES3_Address:PERFORMANCE_COUNTERS */ + unsigned int perfcounters:1; + + /* GC_FEATURES3_Address:EXTRA_SHADER_INSTRUCTIONS2 */ + unsigned int shaderinst2:1; + + /* GC_FEATURES3_Address:BUG_FIXES12 */ + unsigned int bugfixes12:1; + + /* GC_FEATURES3_Address:BUG_FIXES13 */ + unsigned int bugfixes13:1; + + /* GC_FEATURES3_Address:DE_ENHANCEMENTS1 */ + unsigned int deenhancements1:1; + + /* GC_FEATURES3_Address:ACE */ + unsigned int ace:1; + + /* GC_FEATURES3_Address:TX_ENHANCEMENTS1 */ + unsigned int txenhancements1:1; + + /* GC_FEATURES3_Address:SH_ENHANCEMENTS1 */ + unsigned int shenhancements1:1; + + /* GC_FEATURES3_Address:SH_ENHANCEMENTS2 */ + unsigned int shenhancements2:1; + + /* GC_FEATURES3_Address:reserved */ + unsigned int _reserved_22_31:10; + } reg; + + unsigned int raw; +}; /******************************************************************************* ** Register GCResetMemCounters @@ -1527,253 +2423,6 @@ union gcidle { #define GC_AXI_CONTROL_WR_FULL_BURST_MODE_BURST_RESET_VALUE 0x1 /******************************************************************************* -** Register GCMinorFeatures1 -*/ - -/* Shows which features are enabled in this chip. This register has no set - reset value. It varies with the implementation. */ - -#define GC_MINOR_FEATURES1_Address 0x00074 -#define GC_MINOR_FEATURES1_MSB 15 -#define GC_MINOR_FEATURES1_LSB 0 -#define GC_MINOR_FEATURES1_BLK 0 -#define GC_MINOR_FEATURES1_Count 1 -#define GC_MINOR_FEATURES1_FieldMask 0xFFFFFFFF -#define GC_MINOR_FEATURES1_ReadMask 0xFFFFFFFF -#define GC_MINOR_FEATURES1_WriteMask 0x00000000 -#define GC_MINOR_FEATURES1_ResetValue 0x00000000 - -/* Resolve UV swizzle. */ -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE 0 : 0 -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE_End 0 -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE_Start 0 -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE_Type U01 -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE_NONE 0x0 -#define GC_MINOR_FEATURES1_RSUV_SWIZZLE_AVAILABLE 0x1 - -/* V2 compression. */ -#define GC_MINOR_FEATURES1_V2_COMPRESSION 1 : 1 -#define GC_MINOR_FEATURES1_V2_COMPRESSION_End 1 -#define GC_MINOR_FEATURES1_V2_COMPRESSION_Start 1 -#define GC_MINOR_FEATURES1_V2_COMPRESSION_Type U01 -#define GC_MINOR_FEATURES1_V2_COMPRESSION_NONE 0x0 -#define GC_MINOR_FEATURES1_V2_COMPRESSION_AVAILABLE 0x1 - -/* Double buffering support for VG (second TS-->VG semaphore is present). */ -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER 2 : 2 -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER_End 2 -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER_Start 2 -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER_Type U01 -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER_NONE 0x0 -#define GC_MINOR_FEATURES1_VG_DOUBLE_BUFFER_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES1 3 : 3 -#define GC_MINOR_FEATURES1_BUG_FIXES1_End 3 -#define GC_MINOR_FEATURES1_BUG_FIXES1_Start 3 -#define GC_MINOR_FEATURES1_BUG_FIXES1_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES1_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES1_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES2 4 : 4 -#define GC_MINOR_FEATURES1_BUG_FIXES2_End 4 -#define GC_MINOR_FEATURES1_BUG_FIXES2_Start 4 -#define GC_MINOR_FEATURES1_BUG_FIXES2_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES2_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES2_AVAILABLE 0x1 - -/* Texture has stride and memory addressing. */ -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE 5 : 5 -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE_End 5 -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE_Start 5 -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE_Type U01 -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE_NONE 0x0 -#define GC_MINOR_FEATURES1_TEXTURE_STRIDE_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES3 6 : 6 -#define GC_MINOR_FEATURES1_BUG_FIXES3_End 6 -#define GC_MINOR_FEATURES1_BUG_FIXES3_Start 6 -#define GC_MINOR_FEATURES1_BUG_FIXES3_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES3_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES3_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE 7 : 7 -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE_End 7 -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE_Start 7 -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE_Type U01 -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE_NONE 0x0 -#define GC_MINOR_FEATURES1_CORRECT_AUTO_DISABLE_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS 8 : 8 -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS_End 8 -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS_Start 8 -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS_Type U01 -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS_NONE 0x0 -#define GC_MINOR_FEATURES1_AUTO_RESTART_TS_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES4 9 : 9 -#define GC_MINOR_FEATURES1_BUG_FIXES4_End 9 -#define GC_MINOR_FEATURES1_BUG_FIXES4_Start 9 -#define GC_MINOR_FEATURES1_BUG_FIXES4_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES4_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES4_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_L2_WINDOWING 10 : 10 -#define GC_MINOR_FEATURES1_L2_WINDOWING_End 10 -#define GC_MINOR_FEATURES1_L2_WINDOWING_Start 10 -#define GC_MINOR_FEATURES1_L2_WINDOWING_Type U01 -#define GC_MINOR_FEATURES1_L2_WINDOWING_NONE 0x0 -#define GC_MINOR_FEATURES1_L2_WINDOWING_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE 11 : 11 -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE_End 11 -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE_Start 11 -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE_Type U01 -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE_NONE 0x0 -#define GC_MINOR_FEATURES1_HALF_FLOAT_PIPE_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_PIXEL_DITHER 12 : 12 -#define GC_MINOR_FEATURES1_PIXEL_DITHER_End 12 -#define GC_MINOR_FEATURES1_PIXEL_DITHER_Start 12 -#define GC_MINOR_FEATURES1_PIXEL_DITHER_Type U01 -#define GC_MINOR_FEATURES1_PIXEL_DITHER_NONE 0x0 -#define GC_MINOR_FEATURES1_PIXEL_DITHER_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE 13 : 13 -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE_End 13 -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE_Start 13 -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE_Type U01 -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE_NONE 0x0 -#define GC_MINOR_FEATURES1_TWO_STENCIL_REFERENCE_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT 14 : 14 -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT_End 14 -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT_Start 14 -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT_Type U01 -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT_NONE 0x0 -#define GC_MINOR_FEATURES1_EXTENDED_PIXEL_FORMAT_AVAILABLE 0x1 - -/* EEZ and HZ are correct. */ -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH 15 : 15 -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH_End 15 -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH_Start 15 -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH_Type U01 -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH_NONE 0x0 -#define GC_MINOR_FEATURES1_CORRECT_MIN_MAX_DEPTH_AVAILABLE 0x1 - -/* Dither and filter+alpha available. */ -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D 16 : 16 -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_End 16 -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_Start 16 -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_Type U01 -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_NONE 0x0 -#define GC_MINOR_FEATURES1_DITHER_AND_FILTER_PLUS_ALPHA_2D_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES5 17 : 17 -#define GC_MINOR_FEATURES1_BUG_FIXES5_End 17 -#define GC_MINOR_FEATURES1_BUG_FIXES5_Start 17 -#define GC_MINOR_FEATURES1_BUG_FIXES5_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES5_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES5_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_NEW_2D 18 : 18 -#define GC_MINOR_FEATURES1_NEW_2D_End 18 -#define GC_MINOR_FEATURES1_NEW_2D_Start 18 -#define GC_MINOR_FEATURES1_NEW_2D_Type U01 -#define GC_MINOR_FEATURES1_NEW_2D_NONE 0x0 -#define GC_MINOR_FEATURES1_NEW_2D_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC 19 : 19 -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_End 19 -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_Start 19 -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_Type U01 -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_NONE 0x0 -#define GC_MINOR_FEATURES1_NEW_FLOATING_POINT_ARITHMETIC_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT 20 : 20 -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_End 20 -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_Start 20 -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_Type U01 -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_NONE 0x0 -#define GC_MINOR_FEATURES1_TEXTURE_HORIZONTAL_ALIGNMENT_SELECT_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO 21 : 21 -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO_End 21 -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO_Start 21 -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO_Type U01 -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO_NONE 0x0 -#define GC_MINOR_FEATURES1_NON_POWER_OF_TWO_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT 22 : 22 -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT_End 22 -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT_Start 22 -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT_Type U01 -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT_NONE 0x0 -#define GC_MINOR_FEATURES1_LINEAR_TEXTURE_SUPPORT_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_HALTI0 23 : 23 -#define GC_MINOR_FEATURES1_HALTI0_End 23 -#define GC_MINOR_FEATURES1_HALTI0_Start 23 -#define GC_MINOR_FEATURES1_HALTI0_Type U01 -#define GC_MINOR_FEATURES1_HALTI0_NONE 0x0 -#define GC_MINOR_FEATURES1_HALTI0_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG 24 : 24 -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG_End 24 -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG_Start 24 -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG_Type U01 -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG_NONE 0x0 -#define GC_MINOR_FEATURES1_CORRECT_OVERFLOW_VG_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX 25 : 25 -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX_End 25 -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX_Start 25 -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX_Type U01 -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX_NONE 0x0 -#define GC_MINOR_FEATURES1_NEGATIVE_LOG_FIX_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET 26 : 26 -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET_End 26 -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET_Start 26 -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET_Type U01 -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET_NONE 0x0 -#define GC_MINOR_FEATURES1_RESOLVE_OFFSET_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK 27 : 27 -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK_End 27 -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK_Start 27 -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK_Type U01 -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK_NONE 0x0 -#define GC_MINOR_FEATURES1_OK_TO_GATE_AXI_CLOCK_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_MMU 28 : 28 -#define GC_MINOR_FEATURES1_MMU_End 28 -#define GC_MINOR_FEATURES1_MMU_Start 28 -#define GC_MINOR_FEATURES1_MMU_Type U01 -#define GC_MINOR_FEATURES1_MMU_NONE 0x0 -#define GC_MINOR_FEATURES1_MMU_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_WIDE_LINE 29 : 29 -#define GC_MINOR_FEATURES1_WIDE_LINE_End 29 -#define GC_MINOR_FEATURES1_WIDE_LINE_Start 29 -#define GC_MINOR_FEATURES1_WIDE_LINE_Type U01 -#define GC_MINOR_FEATURES1_WIDE_LINE_NONE 0x0 -#define GC_MINOR_FEATURES1_WIDE_LINE_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_BUG_FIXES6 30 : 30 -#define GC_MINOR_FEATURES1_BUG_FIXES6_End 30 -#define GC_MINOR_FEATURES1_BUG_FIXES6_Start 30 -#define GC_MINOR_FEATURES1_BUG_FIXES6_Type U01 -#define GC_MINOR_FEATURES1_BUG_FIXES6_NONE 0x0 -#define GC_MINOR_FEATURES1_BUG_FIXES6_AVAILABLE 0x1 - -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL 31 : 31 -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL_End 31 -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL_Start 31 -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL_Type U01 -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL_NONE 0x0 -#define GC_MINOR_FEATURES1_FC_FLUSH_STALL_AVAILABLE 0x1 - -/******************************************************************************* ** Register gcTotalCycles */ @@ -1979,7 +2628,7 @@ static const struct gccmdend gccmdend_const = { #define GCREG_COMMAND_NOP_OPCODE_Type U05 struct gcfldnop { - /* gcregCommandNop:reserve */ + /* gcregCommandNop:reserved */ unsigned int _reserved_0_26:27; /* gcregCommandNop:GCREG_COMMAND_NOP_OPCODE */ @@ -2002,7 +2651,7 @@ static const struct gccmdnop gccmdnop_const = { { /* fld */ { - /* gcregCommandNop:reserve */ + /* gcregCommandNop:reserved */ 0, /* gcregCommandNop:GCREG_COMMAND_NOP_OPCODE */ @@ -2402,7 +3051,7 @@ struct gccmdcall { #define GCREG_COMMAND_RETURN_OPCODE_Type U05 struct gcfldret { - /* gccmdCommandReturn:reserve */ + /* gccmdCommandReturn:reserved */ unsigned int _reserved_0_26:27; /* gccmdCommandReturn:GCREG_COMMAND_RETURN_OPCODE */ @@ -2421,7 +3070,7 @@ struct gccmdret { }; static const struct gcfldret gcfldret = { - /* gccmdCommandReturn:reserve */ + /* gccmdCommandReturn:reserved */ 0, /* gccmdCommandReturn:GCREG_COMMAND_RETURN_OPCODE */ @@ -3963,6 +4612,18 @@ struct gcregdstconfig { #define GCREG_FILTER_KERNEL_COEFFICIENT1_Start 16 #define GCREG_FILTER_KERNEL_COEFFICIENT1_Type U16 +struct gcregfilterkernelpair { + /* gcregFilterKernelRegAddrs:COEFFICIENT0 */ + unsigned int coeff0:16; + + /* gcregFilterKernelRegAddrs:COEFFICIENT1 */ + unsigned int coeff1:16; +}; + +struct gcregfilterkernel { + struct gcregfilterkernelpair filter[77]; +}; + /******************************************************************************* ** State gcregHoriFilterKernel */ @@ -4016,6 +4677,94 @@ struct gcregdstconfig { #define GCREG_VERTI_FILTER_KERNEL_COEFFICIENT1_Type U16 /******************************************************************************* +** State gcregVRConfig +*/ + +/* Video Rasterizer kick-off register. */ + +#define gcregVRConfigRegAddrs 0x04A5 +#define GCREG_VR_CONFIG_MSB 15 +#define GCREG_VR_CONFIG_LSB 0 +#define GCREG_VR_CONFIG_BLK 0 +#define GCREG_VR_CONFIG_Count 1 +#define GCREG_VR_CONFIG_FieldMask 0x0000000B +#define GCREG_VR_CONFIG_ReadMask 0x0000000B +#define GCREG_VR_CONFIG_WriteMask 0x0000000B +#define GCREG_VR_CONFIG_ResetValue 0x00000000 + +/* Kick-off command. */ +#define GCREG_VR_CONFIG_START 1 : 0 +#define GCREG_VR_CONFIG_START_End 1 +#define GCREG_VR_CONFIG_START_Start 0 +#define GCREG_VR_CONFIG_START_Type U02 +#define GCREG_VR_CONFIG_START_HORIZONTAL_BLIT 0x0 +#define GCREG_VR_CONFIG_START_VERTICAL_BLIT 0x1 +#define GCREG_VR_CONFIG_START_ONE_PASS_BLIT 0x2 + +#define GCREG_VR_CONFIG_MASK_START 3 : 3 +#define GCREG_VR_CONFIG_MASK_START_End 3 +#define GCREG_VR_CONFIG_MASK_START_Start 3 +#define GCREG_VR_CONFIG_MASK_START_Type U01 +#define GCREG_VR_CONFIG_MASK_START_ENABLED 0x0 +#define GCREG_VR_CONFIG_MASK_START_MASKED 0x1 + +struct gcregvrconfig { + /* gcregVRConfigRegAddrs:START */ + unsigned int start:2; + + /* gcregVRConfigRegAddrs:reserved */ + unsigned int _reserved_2:1; + + /* gcregVRConfigRegAddrs:MASK_START */ + unsigned int start_mask:1; + + /* gcregVRConfigRegAddrs:reserved */ + unsigned int _reserved_4_31:28; +}; + +static const struct gcregvrconfig gcregvrconfig_horizontal = { + /* gcregVRConfigRegAddrs:START */ + GCREG_VR_CONFIG_START_HORIZONTAL_BLIT, + + /* gcregVRConfigRegAddrs:reserved */ + 0, + + /* gcregVRConfigRegAddrs:MASK_START */ + GCREG_VR_CONFIG_MASK_START_ENABLED, + + /* gcregVRConfigRegAddrs:reserved */ + 0 +}; + +static const struct gcregvrconfig gcregvrconfig_vertical = { + /* gcregVRConfigRegAddrs:START */ + GCREG_VR_CONFIG_START_VERTICAL_BLIT, + + /* gcregVRConfigRegAddrs:reserved */ + 0, + + /* gcregVRConfigRegAddrs:MASK_START */ + GCREG_VR_CONFIG_MASK_START_ENABLED, + + /* gcregVRConfigRegAddrs:reserved */ + 0 +}; + +static const struct gcregvrconfig gcregvrconfig_onepass = { + /* gcregVRConfigRegAddrs:START */ + GCREG_VR_CONFIG_START_ONE_PASS_BLIT, + + /* gcregVRConfigRegAddrs:reserved */ + 0, + + /* gcregVRConfigRegAddrs:MASK_START */ + GCREG_VR_CONFIG_MASK_START_ENABLED, + + /* gcregVRConfigRegAddrs:reserved */ + 0 +}; + +/******************************************************************************* ** State gcregVRSourceImageLow */ @@ -4042,6 +4791,14 @@ struct gcregdstconfig { #define GCREG_VR_SOURCE_IMAGE_LOW_TOP_Start 16 #define GCREG_VR_SOURCE_IMAGE_LOW_TOP_Type U16 +struct gcregvrsourceimagelow { + /* gcregVRSourceImageLowRegAddrs:LEFT */ + unsigned int left:16; + + /* gcregVRSourceImageLowRegAddrs:TOP */ + unsigned int top:16; +}; + /******************************************************************************* ** State gcregVRSourceImageHigh */ @@ -4066,6 +4823,14 @@ struct gcregdstconfig { #define GCREG_VR_SOURCE_IMAGE_HIGH_BOTTOM_Start 16 #define GCREG_VR_SOURCE_IMAGE_HIGH_BOTTOM_Type U16 +struct gcregvrsourceimagehigh { + /* gcregVRSourceImageHighRegAddrs:RIGHT */ + unsigned int right:16; + + /* gcregVRSourceImageHighRegAddrs:BOTTOM */ + unsigned int bottom:16; +}; + /******************************************************************************* ** State gcregVRSourceOriginLow */ @@ -4137,6 +4902,14 @@ struct gcregdstconfig { #define GCREG_VR_TARGET_WINDOW_LOW_TOP_Start 16 #define GCREG_VR_TARGET_WINDOW_LOW_TOP_Type U16 +struct gcregvrtargetwindowlow { + /* gcregVRTargetWindowLowRegAddrs:LEFT */ + unsigned int left:16; + + /* gcregVRTargetWindowLowRegAddrs:TOP */ + unsigned int top:16; +}; + /******************************************************************************* ** State gcregVRTargetWindowHigh */ @@ -4161,37 +4934,13 @@ struct gcregdstconfig { #define GCREG_VR_TARGET_WINDOW_HIGH_BOTTOM_Start 16 #define GCREG_VR_TARGET_WINDOW_HIGH_BOTTOM_Type U16 -/******************************************************************************* -** State gcregVRConfig -*/ - -/* Video Rasterizer kick-off register. */ - -#define gcregVRConfigRegAddrs 0x04A5 -#define GCREG_VR_CONFIG_MSB 15 -#define GCREG_VR_CONFIG_LSB 0 -#define GCREG_VR_CONFIG_BLK 0 -#define GCREG_VR_CONFIG_Count 1 -#define GCREG_VR_CONFIG_FieldMask 0x0000000B -#define GCREG_VR_CONFIG_ReadMask 0x0000000B -#define GCREG_VR_CONFIG_WriteMask 0x0000000B -#define GCREG_VR_CONFIG_ResetValue 0x00000000 - -/* Kick-off command. */ -#define GCREG_VR_CONFIG_START 1 : 0 -#define GCREG_VR_CONFIG_START_End 1 -#define GCREG_VR_CONFIG_START_Start 0 -#define GCREG_VR_CONFIG_START_Type U02 -#define GCREG_VR_CONFIG_START_HORIZONTAL_BLIT 0x0 -#define GCREG_VR_CONFIG_START_VERTICAL_BLIT 0x1 -#define GCREG_VR_CONFIG_START_ONE_PASS_BLIT 0x2 +struct gcregvrtargetwindowhigh { + /* gcregVRTargetWindowHighRegAddrs:LEFT */ + unsigned int right:16; -#define GCREG_VR_CONFIG_MASK_START 3 : 3 -#define GCREG_VR_CONFIG_MASK_START_End 3 -#define GCREG_VR_CONFIG_MASK_START_Start 3 -#define GCREG_VR_CONFIG_MASK_START_Type U01 -#define GCREG_VR_CONFIG_MASK_START_ENABLED 0x0 -#define GCREG_VR_CONFIG_MASK_START_MASKED 0x1 + /* gcregVRTargetWindowHighRegAddrs:TOP */ + unsigned int bottom:16; +}; /******************************************************************************* ** State gcregVRConfigEx @@ -4239,6 +4988,26 @@ struct gcregdstconfig { #define GCREG_VR_CONFIG_EX_MASK_FILTER_TAP_ENABLED 0x0 #define GCREG_VR_CONFIG_EX_MASK_FILTER_TAP_MASKED 0x1 +struct gcregvrconfigex { + /* gcregVRConfigExRegAddrs:VERTICAL_LINE_WIDTH */ + unsigned int stripe:2; + + /* gcregVRConfigExRegAddrs:reserved */ + unsigned int _reserved_2:1; + + /* gcregVRConfigExRegAddrs:MASK_VERTICAL_LINE_WIDTH */ + unsigned int mask_stripe:1; + + /* gcregVRConfigExRegAddrs:FILTER_TAP */ + unsigned int kernelsize:4; + + /* gcregVRConfigExRegAddrs:MASK_FILTER_TAP */ + unsigned int mask_kernelsize:1; + + /* gcregVRConfigExRegAddrs:reserved */ + unsigned int _reserved_9_31:23; +}; + /******************************************************************************* ** State gcregBWConfig */ @@ -4513,10 +5282,19 @@ struct gcregdstconfig { #define GCREG_ROP_ROP_FG_Type U08 struct gcregrop { + /* gcregRopRegAddrs:ROP_FG */ unsigned int fg:8; + + /* gcregRopRegAddrs:ROP_BG */ unsigned int bg:8; + + /* gcregRopRegAddrs:reserved */ unsigned int _reserved_16_19:4; + + /* gcregRopRegAddrs:ROP_TYPE */ unsigned int type:2; + + /* gcregRopRegAddrs:reserved */ unsigned int _reserved_22_31:10; }; @@ -4550,9 +5328,16 @@ struct gcregrop { #define GCREG_CLIP_TOP_LEFT_X_Type U15 struct gcregcliplt { + /* gcregClipTopLeftRegAddrs:X */ unsigned int left:15; + + /* gcregClipTopLeftRegAddrs:reserved */ unsigned int _reserved_15:1; + + /* gcregClipTopLeftRegAddrs:Y */ unsigned int top:15; + + /* gcregClipTopLeftRegAddrs:reserved */ unsigned int _reserved_31:1; }; @@ -4586,9 +5371,16 @@ struct gcregcliplt { #define GCREG_CLIP_BOTTOM_RIGHT_X_Type U15 struct gcregcliprb { + /* gcregClipBottomRightRegAddrs:X */ unsigned int right:15; + + /* gcregClipBottomRightRegAddrs:reserved */ unsigned int _reserved_15:1; + + /* gcregClipBottomRightRegAddrs:Y */ unsigned int bottom:15; + + /* gcregClipBottomRightRegAddrs:reserved */ unsigned int _reserved_31:1; }; @@ -4692,6 +5484,22 @@ struct gcregalphacontrol { unsigned int _reserved_1_31:31; }; +static const struct gcregalphacontrol gcregalpha_off = { + /* gcregAlphaControlRegAddrs:GCREG_ALPHA_CONTROL_ENABLE */ + GCREG_ALPHA_CONTROL_ENABLE_OFF, + + /* gcregAlphaControlRegAddrs:reserved */ + 0 +}; + +static const struct gcregalphacontrol gcregalpha_on = { + /* gcregAlphaControlRegAddrs:GCREG_ALPHA_CONTROL_ENABLE */ + GCREG_ALPHA_CONTROL_ENABLE_ON, + + /* gcregAlphaControlRegAddrs:reserved */ + 0 +}; + /******************************************************************************* ** State gcregAlphaModes */ @@ -4792,13 +5600,13 @@ struct gcregalphamodes { unsigned int _reserved_5_7:3; /* gcregAlphaModes:GCREG_ALPHA_MODES_GLOBAL_SRC_ALPHA_MODE */ - unsigned int src_global_alpha:2; + unsigned int src_global_alpha_mode:2; /* gcregAlphaModes:reserved */ unsigned int _reserved_10_11:2; /* gcregAlphaModes:GCREG_ALPHA_MODES_GLOBAL_DST_ALPHA_MODE */ - unsigned int dst_global_alpha:2; + unsigned int dst_global_alpha_mode:2; /* gcregAlphaModes:reserved */ unsigned int _reserved_14_23:10; @@ -5785,6 +6593,14 @@ struct gcregcolormultiplymodes { #define GCREG_SRC_EX_CONFIG_MINOR_TILED_DISABLED 0x0 #define GCREG_SRC_EX_CONFIG_MINOR_TILED_ENABLED 0x1 +/* Source CacheMode. */ +#define GCREG_SRC_SRC_EX_CONFIG_CACHE_MODE 12 : 12 +#define GCREG_SRC_SRC_EX_CONFIG_CACHE_MODE_End 12 +#define GCREG_SRC_SRC_EX_CONFIG_CACHE_MODE_Start 12 +#define GCREG_SRC_SRC_EX_CONFIG_CACHE_MODE_Type U01 +#define GCREG_SRC_SRC_EX_CONFIG_CACHE_MODE_DISABLED 0x0 +#define GCREG_SRC_SRC_EX_CONFIG_CACHE_MODE_ENABLED 0x1 + /******************************************************************************* ** State gcregSrcExAddress */ @@ -6594,20 +7410,20 @@ struct gcregmultisource { /* 32-bit aligned base address of the source U plane. */ -#define gcregBlock4AddressURegAddrs 0x4A28 -#define GCREG_BLOCK4_ADDRESS_U_MSB 15 -#define GCREG_BLOCK4_ADDRESS_U_LSB 2 -#define GCREG_BLOCK4_ADDRESS_U_BLK 0 -#define GCREG_BLOCK4_ADDRESS_U_Count 4 -#define GCREG_BLOCK4_ADDRESS_U_FieldMask 0xFFFFFFFF -#define GCREG_BLOCK4_ADDRESS_U_ReadMask 0xFFFFFFFC -#define GCREG_BLOCK4_ADDRESS_U_WriteMask 0xFFFFFFFC -#define GCREG_BLOCK4_ADDRESS_U_ResetValue 0x00000000 +#define gcregBlock4UPlaneAddressRegAddrs 0x4A28 +#define GCREG_BLOCK4_UPLANE_ADDRESS_MSB 15 +#define GCREG_BLOCK4_UPLANE_ADDRESS_LSB 2 +#define GCREG_BLOCK4_UPLANE_ADDRESS_BLK 0 +#define GCREG_BLOCK4_UPLANE_ADDRESS_Count 4 +#define GCREG_BLOCK4_UPLANE_ADDRESS_FieldMask 0xFFFFFFFF +#define GCREG_BLOCK4_UPLANE_ADDRESS_ReadMask 0xFFFFFFFC +#define GCREG_BLOCK4_UPLANE_ADDRESS_WriteMask 0xFFFFFFFC +#define GCREG_BLOCK4_UPLANE_ADDRESS_ResetValue 0x00000000 -#define GCREG_BLOCK4_ADDRESS_U_ADDRESS 31 : 0 -#define GCREG_BLOCK4_ADDRESS_U_ADDRESS_End 30 -#define GCREG_BLOCK4_ADDRESS_U_ADDRESS_Start 0 -#define GCREG_BLOCK4_ADDRESS_U_ADDRESS_Type U31 +#define GCREG_BLOCK4_UPLANE_ADDRESS_ADDRESS 31 : 0 +#define GCREG_BLOCK4_UPLANE_ADDRESS_ADDRESS_End 30 +#define GCREG_BLOCK4_UPLANE_ADDRESS_ADDRESS_Start 0 +#define GCREG_BLOCK4_UPLANE_ADDRESS_ADDRESS_Type U31 /******************************************************************************* ** State gcregBlock4StrideU @@ -6615,20 +7431,20 @@ struct gcregmultisource { /* Stride of the source U plane in bytes. */ -#define gcregBlock4StrideURegAddrs 0x4A2C -#define GCREG_BLOCK4_STRIDE_U_MSB 15 -#define GCREG_BLOCK4_STRIDE_U_LSB 2 -#define GCREG_BLOCK4_STRIDE_U_BLK 0 -#define GCREG_BLOCK4_STRIDE_U_Count 4 -#define GCREG_BLOCK4_STRIDE_U_FieldMask 0x0003FFFF -#define GCREG_BLOCK4_STRIDE_U_ReadMask 0x0003FFFC -#define GCREG_BLOCK4_STRIDE_U_WriteMask 0x0003FFFC -#define GCREG_BLOCK4_STRIDE_U_ResetValue 0x00000000 +#define gcregBlock4UPlaneStrideRegAddrs 0x4A2C +#define GCREG_BLOCK4_UPLANE_STRIDE_MSB 15 +#define GCREG_BLOCK4_UPLANE_STRIDE_LSB 2 +#define GCREG_BLOCK4_UPLANE_STRIDE_BLK 0 +#define GCREG_BLOCK4_UPLANE_STRIDE_Count 4 +#define GCREG_BLOCK4_UPLANE_STRIDE_FieldMask 0x0003FFFF +#define GCREG_BLOCK4_UPLANE_STRIDE_ReadMask 0x0003FFFC +#define GCREG_BLOCK4_UPLANE_STRIDE_WriteMask 0x0003FFFC +#define GCREG_BLOCK4_UPLANE_STRIDE_ResetValue 0x00000000 -#define GCREG_BLOCK4_STRIDE_U_STRIDE 17 : 0 -#define GCREG_BLOCK4_STRIDE_U_STRIDE_End 17 -#define GCREG_BLOCK4_STRIDE_U_STRIDE_Start 0 -#define GCREG_BLOCK4_STRIDE_U_STRIDE_Type U18 +#define GCREG_BLOCK4_UPLANE_STRIDE_STRIDE 17 : 0 +#define GCREG_BLOCK4_UPLANE_STRIDE_STRIDE_End 17 +#define GCREG_BLOCK4_UPLANE_STRIDE_STRIDE_Start 0 +#define GCREG_BLOCK4_UPLANE_STRIDE_STRIDE_Type U18 /******************************************************************************* ** State gcregBlock4AddressV @@ -6636,20 +7452,20 @@ struct gcregmultisource { /* 32-bit aligned base address of the source V plane. */ -#define gcregBlock4AddressVRegAddrs 0x4A30 -#define GCREG_BLOCK4_ADDRESS_V_MSB 15 -#define GCREG_BLOCK4_ADDRESS_V_LSB 2 -#define GCREG_BLOCK4_ADDRESS_V_BLK 0 -#define GCREG_BLOCK4_ADDRESS_V_Count 4 -#define GCREG_BLOCK4_ADDRESS_V_FieldMask 0xFFFFFFFF -#define GCREG_BLOCK4_ADDRESS_V_ReadMask 0xFFFFFFFC -#define GCREG_BLOCK4_ADDRESS_V_WriteMask 0xFFFFFFFC -#define GCREG_BLOCK4_ADDRESS_V_ResetValue 0x00000000 +#define gcregBlock4VPlaneAddressRegAddrs 0x4A30 +#define GCREG_BLOCK4_VPLANE_ADDRESS_MSB 15 +#define GCREG_BLOCK4_VPLANE_ADDRESS_LSB 2 +#define GCREG_BLOCK4_VPLANE_ADDRESS_BLK 0 +#define GCREG_BLOCK4_VPLANE_ADDRESS_Count 4 +#define GCREG_BLOCK4_VPLANE_ADDRESS_FieldMask 0xFFFFFFFF +#define GCREG_BLOCK4_VPLANE_ADDRESS_ReadMask 0xFFFFFFFC +#define GCREG_BLOCK4_VPLANE_ADDRESS_WriteMask 0xFFFFFFFC +#define GCREG_BLOCK4_VPLANE_ADDRESS_ResetValue 0x00000000 -#define GCREG_BLOCK4_ADDRESS_V_ADDRESS 31 : 0 -#define GCREG_BLOCK4_ADDRESS_V_ADDRESS_End 30 -#define GCREG_BLOCK4_ADDRESS_V_ADDRESS_Start 0 -#define GCREG_BLOCK4_ADDRESS_V_ADDRESS_Type U31 +#define GCREG_BLOCK4_VPLANE_ADDRESS_ADDRESS 31 : 0 +#define GCREG_BLOCK4_VPLANE_ADDRESS_ADDRESS_End 30 +#define GCREG_BLOCK4_VPLANE_ADDRESS_ADDRESS_Start 0 +#define GCREG_BLOCK4_VPLANE_ADDRESS_ADDRESS_Type U31 /******************************************************************************* ** State gcregBlock4StrideV @@ -6657,20 +7473,20 @@ struct gcregmultisource { /* Stride of the source V plane in bytes. */ -#define gcregBlock4StrideVRegAddrs 0x4A34 -#define GCREG_BLOCK4_STRIDE_V_MSB 15 -#define GCREG_BLOCK4_STRIDE_V_LSB 2 -#define GCREG_BLOCK4_STRIDE_V_BLK 0 -#define GCREG_BLOCK4_STRIDE_V_Count 4 -#define GCREG_BLOCK4_STRIDE_V_FieldMask 0x0003FFFF -#define GCREG_BLOCK4_STRIDE_V_ReadMask 0x0003FFFC -#define GCREG_BLOCK4_STRIDE_V_WriteMask 0x0003FFFC -#define GCREG_BLOCK4_STRIDE_V_ResetValue 0x00000000 +#define gcregBlock4VPlaneStrideRegAddrs 0x4A34 +#define GCREG_BLOCK4_VPLANE_STRIDE_MSB 15 +#define GCREG_BLOCK4_VPLANE_STRIDE_LSB 2 +#define GCREG_BLOCK4_VPLANE_STRIDE_BLK 0 +#define GCREG_BLOCK4_VPLANE_STRIDE_Count 4 +#define GCREG_BLOCK4_VPLANE_STRIDE_FieldMask 0x0003FFFF +#define GCREG_BLOCK4_VPLANE_STRIDE_ReadMask 0x0003FFFC +#define GCREG_BLOCK4_VPLANE_STRIDE_WriteMask 0x0003FFFC +#define GCREG_BLOCK4_VPLANE_STRIDE_ResetValue 0x00000000 -#define GCREG_BLOCK4_STRIDE_V_STRIDE 17 : 0 -#define GCREG_BLOCK4_STRIDE_V_STRIDE_End 17 -#define GCREG_BLOCK4_STRIDE_V_STRIDE_Start 0 -#define GCREG_BLOCK4_STRIDE_V_STRIDE_Type U18 +#define GCREG_BLOCK4_VPLANE_STRIDE_STRIDE 17 : 0 +#define GCREG_BLOCK4_VPLANE_STRIDE_STRIDE_End 17 +#define GCREG_BLOCK4_VPLANE_STRIDE_STRIDE_Start 0 +#define GCREG_BLOCK4_VPLANE_STRIDE_STRIDE_Type U18 /******************************************************************************* ** State gcregBlock4SrcRotationHeight @@ -7005,58 +7821,58 @@ struct gcregmultisource { /* General purpose control register. */ -#define gcregBlock4ControlRegAddrs 0x4A50 -#define GCREG_BLOCK4_CONTROL_MSB 15 -#define GCREG_BLOCK4_CONTROL_LSB 2 -#define GCREG_BLOCK4_CONTROL_BLK 0 -#define GCREG_BLOCK4_CONTROL_Count 4 -#define GCREG_BLOCK4_CONTROL_FieldMask 0x00000999 -#define GCREG_BLOCK4_CONTROL_ReadMask 0x00000999 -#define GCREG_BLOCK4_CONTROL_WriteMask 0x00000999 -#define GCREG_BLOCK4_CONTROL_ResetValue 0x00000000 - -#define GCREG_BLOCK4_CONTROL_YUV 0 : 0 -#define GCREG_BLOCK4_CONTROL_YUV_End 0 -#define GCREG_BLOCK4_CONTROL_YUV_Start 0 -#define GCREG_BLOCK4_CONTROL_YUV_Type U01 -#define GCREG_BLOCK4_CONTROL_YUV_601 0x0 -#define GCREG_BLOCK4_CONTROL_YUV_709 0x1 - -#define GCREG_BLOCK4_CONTROL_MASK_YUV 3 : 3 -#define GCREG_BLOCK4_CONTROL_MASK_YUV_End 3 -#define GCREG_BLOCK4_CONTROL_MASK_YUV_Start 3 -#define GCREG_BLOCK4_CONTROL_MASK_YUV_Type U01 -#define GCREG_BLOCK4_CONTROL_MASK_YUV_ENABLED 0x0 -#define GCREG_BLOCK4_CONTROL_MASK_YUV_MASKED 0x1 - -#define GCREG_BLOCK4_CONTROL_UV_SWIZZLE 4 : 4 -#define GCREG_BLOCK4_CONTROL_UV_SWIZZLE_End 4 -#define GCREG_BLOCK4_CONTROL_UV_SWIZZLE_Start 4 -#define GCREG_BLOCK4_CONTROL_UV_SWIZZLE_Type U01 -#define GCREG_BLOCK4_CONTROL_UV_SWIZZLE_UV 0x0 -#define GCREG_BLOCK4_CONTROL_UV_SWIZZLE_VU 0x1 - -#define GCREG_BLOCK4_CONTROL_MASK_UV_SWIZZLE 7 : 7 -#define GCREG_BLOCK4_CONTROL_MASK_UV_SWIZZLE_End 7 -#define GCREG_BLOCK4_CONTROL_MASK_UV_SWIZZLE_Start 7 -#define GCREG_BLOCK4_CONTROL_MASK_UV_SWIZZLE_Type U01 -#define GCREG_BLOCK4_CONTROL_MASK_UV_SWIZZLE_ENABLED 0x0 -#define GCREG_BLOCK4_CONTROL_MASK_UV_SWIZZLE_MASKED 0x1 +#define gcregBlock4PEControlRegAddrs 0x4A50 +#define GCREG_BLOCK4_PE_CONTROL_MSB 15 +#define GCREG_BLOCK4_PE_CONTROL_LSB 2 +#define GCREG_BLOCK4_PE_CONTROL_BLK 0 +#define GCREG_BLOCK4_PE_CONTROL_Count 4 +#define GCREG_BLOCK4_PE_CONTROL_FieldMask 0x00000999 +#define GCREG_BLOCK4_PE_CONTROL_ReadMask 0x00000999 +#define GCREG_BLOCK4_PE_CONTROL_WriteMask 0x00000999 +#define GCREG_BLOCK4_PE_CONTROL_ResetValue 0x00000000 + +#define GCREG_BLOCK4_PE_CONTROL_YUV 0 : 0 +#define GCREG_BLOCK4_PE_CONTROL_YUV_End 0 +#define GCREG_BLOCK4_PE_CONTROL_YUV_Start 0 +#define GCREG_BLOCK4_PE_CONTROL_YUV_Type U01 +#define GCREG_BLOCK4_PE_CONTROL_YUV_601 0x0 +#define GCREG_BLOCK4_PE_CONTROL_YUV_709 0x1 + +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUV 3 : 3 +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUV_End 3 +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUV_Start 3 +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUV_Type U01 +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUV_ENABLED 0x0 +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUV_MASKED 0x1 + +#define GCREG_BLOCK4_PE_CONTROL_UV_SWIZZLE 4 : 4 +#define GCREG_BLOCK4_PE_CONTROL_UV_SWIZZLE_End 4 +#define GCREG_BLOCK4_PE_CONTROL_UV_SWIZZLE_Start 4 +#define GCREG_BLOCK4_PE_CONTROL_UV_SWIZZLE_Type U01 +#define GCREG_BLOCK4_PE_CONTROL_UV_SWIZZLE_UV 0x0 +#define GCREG_BLOCK4_PE_CONTROL_UV_SWIZZLE_VU 0x1 + +#define GCREG_BLOCK4_PE_CONTROL_MASK_UV_SWIZZLE 7 : 7 +#define GCREG_BLOCK4_PE_CONTROL_MASK_UV_SWIZZLE_End 7 +#define GCREG_BLOCK4_PE_CONTROL_MASK_UV_SWIZZLE_Start 7 +#define GCREG_BLOCK4_PE_CONTROL_MASK_UV_SWIZZLE_Type U01 +#define GCREG_BLOCK4_PE_CONTROL_MASK_UV_SWIZZLE_ENABLED 0x0 +#define GCREG_BLOCK4_PE_CONTROL_MASK_UV_SWIZZLE_MASKED 0x1 /* YUV to RGB convert enable */ -#define GCREG_BLOCK4_CONTROL_YUVRGB 8 : 8 -#define GCREG_BLOCK4_CONTROL_YUVRGB_End 8 -#define GCREG_BLOCK4_CONTROL_YUVRGB_Start 8 -#define GCREG_BLOCK4_CONTROL_YUVRGB_Type U01 -#define GCREG_BLOCK4_CONTROL_YUVRGB_DISABLED 0x0 -#define GCREG_BLOCK4_CONTROL_YUVRGB_ENABLED 0x1 +#define GCREG_BLOCK4_PE_CONTROL_YUVRGB 8 : 8 +#define GCREG_BLOCK4_PE_CONTROL_YUVRGB_End 8 +#define GCREG_BLOCK4_PE_CONTROL_YUVRGB_Start 8 +#define GCREG_BLOCK4_PE_CONTROL_YUVRGB_Type U01 +#define GCREG_BLOCK4_PE_CONTROL_YUVRGB_DISABLED 0x0 +#define GCREG_BLOCK4_PE_CONTROL_YUVRGB_ENABLED 0x1 -#define GCREG_BLOCK4_CONTROL_MASK_YUVRGB 11 : 11 -#define GCREG_BLOCK4_CONTROL_MASK_YUVRGB_End 11 -#define GCREG_BLOCK4_CONTROL_MASK_YUVRGB_Start 11 -#define GCREG_BLOCK4_CONTROL_MASK_YUVRGB_Type U01 -#define GCREG_BLOCK4_CONTROL_MASK_YUVRGB_ENABLED 0x0 -#define GCREG_BLOCK4_CONTROL_MASK_YUVRGB_MASKED 0x1 +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUVRGB 11 : 11 +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUVRGB_End 11 +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUVRGB_Start 11 +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUVRGB_Type U01 +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUVRGB_ENABLED 0x0 +#define GCREG_BLOCK4_PE_CONTROL_MASK_YUVRGB_MASKED 0x1 /******************************************************************************* ** State gcregBlock4SrcColorKeyHigh @@ -7132,6 +7948,14 @@ struct gcregmultisource { #define GCREG_BLOCK4_SRC_EX_CONFIG_MINOR_TILED_DISABLED 0x0 #define GCREG_BLOCK4_SRC_EX_CONFIG_MINOR_TILED_ENABLED 0x1 +/* Source CacheMode. */ +#define GCREG_BLOCK4_SRC_EX_CONFIG_CACHE_MODE 12 : 12 +#define GCREG_BLOCK4_SRC_EX_CONFIG_CACHE_MODE_End 12 +#define GCREG_BLOCK4_SRC_EX_CONFIG_CACHE_MODE_Start 12 +#define GCREG_BLOCK4_SRC_EX_CONFIG_CACHE_MODE_Type U01 +#define GCREG_BLOCK4_SRC_EX_CONFIG_CACHE_MODE_DISABLED 0x0 +#define GCREG_BLOCK4_SRC_EX_CONFIG_CACHE_MODE_ENABLED 0x1 + /******************************************************************************* ** State gcregBlock4SrcExAddress */ @@ -7591,19 +8415,19 @@ struct gcregmultisource { /* 32-bit aligned base address of the source U plane. */ #define gcregBlock8AddressURegAddrs 0x4AD0 -#define GCREG_BLOCK8_ADDRESS_U_MSB 15 -#define GCREG_BLOCK8_ADDRESS_U_LSB 3 -#define GCREG_BLOCK8_ADDRESS_U_BLK 0 -#define GCREG_BLOCK8_ADDRESS_U_Count 8 -#define GCREG_BLOCK8_ADDRESS_U_FieldMask 0xFFFFFFFF -#define GCREG_BLOCK8_ADDRESS_U_ReadMask 0xFFFFFFFC -#define GCREG_BLOCK8_ADDRESS_U_WriteMask 0xFFFFFFFC -#define GCREG_BLOCK8_ADDRESS_U_ResetValue 0x00000000 +#define GCREG_BLOCK8_UPLANE_ADDRESS_MSB 15 +#define GCREG_BLOCK8_UPLANE_ADDRESS_LSB 3 +#define GCREG_BLOCK8_UPLANE_ADDRESS_BLK 0 +#define GCREG_BLOCK8_UPLANE_ADDRESS_Count 8 +#define GCREG_BLOCK8_UPLANE_ADDRESS_FieldMask 0xFFFFFFFF +#define GCREG_BLOCK8_UPLANE_ADDRESS_ReadMask 0xFFFFFFFC +#define GCREG_BLOCK8_UPLANE_ADDRESS_WriteMask 0xFFFFFFFC +#define GCREG_BLOCK8_UPLANE_ADDRESS_ResetValue 0x00000000 -#define GCREG_BLOCK8_ADDRESS_U_ADDRESS 31 : 0 -#define GCREG_BLOCK8_ADDRESS_U_ADDRESS_End 30 -#define GCREG_BLOCK8_ADDRESS_U_ADDRESS_Start 0 -#define GCREG_BLOCK8_ADDRESS_U_ADDRESS_Type U31 +#define GCREG_BLOCK8_UPLANE_ADDRESS_ADDRESS 31 : 0 +#define GCREG_BLOCK8_UPLANE_ADDRESS_ADDRESS_End 30 +#define GCREG_BLOCK8_UPLANE_ADDRESS_ADDRESS_Start 0 +#define GCREG_BLOCK8_UPLANE_ADDRESS_ADDRESS_Type U31 /******************************************************************************* ** State gcregBlock8StrideU @@ -7612,19 +8436,19 @@ struct gcregmultisource { /* Stride of the source U plane in bytes. */ #define gcregBlock8StrideURegAddrs 0x4AD8 -#define GCREG_BLOCK8_STRIDE_U_MSB 15 -#define GCREG_BLOCK8_STRIDE_U_LSB 3 -#define GCREG_BLOCK8_STRIDE_U_BLK 0 -#define GCREG_BLOCK8_STRIDE_U_Count 8 -#define GCREG_BLOCK8_STRIDE_U_FieldMask 0x0003FFFF -#define GCREG_BLOCK8_STRIDE_U_ReadMask 0x0003FFFC -#define GCREG_BLOCK8_STRIDE_U_WriteMask 0x0003FFFC -#define GCREG_BLOCK8_STRIDE_U_ResetValue 0x00000000 +#define GCREG_BLOCK8_UPLANE_STRIDE_MSB 15 +#define GCREG_BLOCK8_UPLANE_STRIDE_LSB 3 +#define GCREG_BLOCK8_UPLANE_STRIDE_BLK 0 +#define GCREG_BLOCK8_UPLANE_STRIDE_Count 8 +#define GCREG_BLOCK8_UPLANE_STRIDE_FieldMask 0x0003FFFF +#define GCREG_BLOCK8_UPLANE_STRIDE_ReadMask 0x0003FFFC +#define GCREG_BLOCK8_UPLANE_STRIDE_WriteMask 0x0003FFFC +#define GCREG_BLOCK8_UPLANE_STRIDE_ResetValue 0x00000000 -#define GCREG_BLOCK8_STRIDE_U_STRIDE 17 : 0 -#define GCREG_BLOCK8_STRIDE_U_STRIDE_End 17 -#define GCREG_BLOCK8_STRIDE_U_STRIDE_Start 0 -#define GCREG_BLOCK8_STRIDE_U_STRIDE_Type U18 +#define GCREG_BLOCK8_UPLANE_STRIDE_STRIDE 17 : 0 +#define GCREG_BLOCK8_UPLANE_STRIDE_STRIDE_End 17 +#define GCREG_BLOCK8_UPLANE_STRIDE_STRIDE_Start 0 +#define GCREG_BLOCK8_UPLANE_STRIDE_STRIDE_Type U18 /******************************************************************************* ** State gcregBlock8AddressV @@ -7633,19 +8457,19 @@ struct gcregmultisource { /* 32-bit aligned base address of the source V plane. */ #define gcregBlock8AddressVRegAddrs 0x4AE0 -#define GCREG_BLOCK8_ADDRESS_V_MSB 15 -#define GCREG_BLOCK8_ADDRESS_V_LSB 3 -#define GCREG_BLOCK8_ADDRESS_V_BLK 0 -#define GCREG_BLOCK8_ADDRESS_V_Count 8 -#define GCREG_BLOCK8_ADDRESS_V_FieldMask 0xFFFFFFFF -#define GCREG_BLOCK8_ADDRESS_V_ReadMask 0xFFFFFFFC -#define GCREG_BLOCK8_ADDRESS_V_WriteMask 0xFFFFFFFC -#define GCREG_BLOCK8_ADDRESS_V_ResetValue 0x00000000 +#define GCREG_BLOCK8_VPLANE_ADDRESS_MSB 15 +#define GCREG_BLOCK8_VPLANE_ADDRESS_LSB 3 +#define GCREG_BLOCK8_VPLANE_ADDRESS_BLK 0 +#define GCREG_BLOCK8_VPLANE_ADDRESS_Count 8 +#define GCREG_BLOCK8_VPLANE_ADDRESS_FieldMask 0xFFFFFFFF +#define GCREG_BLOCK8_VPLANE_ADDRESS_ReadMask 0xFFFFFFFC +#define GCREG_BLOCK8_VPLANE_ADDRESS_WriteMask 0xFFFFFFFC +#define GCREG_BLOCK8_VPLANE_ADDRESS_ResetValue 0x00000000 -#define GCREG_BLOCK8_ADDRESS_V_ADDRESS 31 : 0 -#define GCREG_BLOCK8_ADDRESS_V_ADDRESS_End 30 -#define GCREG_BLOCK8_ADDRESS_V_ADDRESS_Start 0 -#define GCREG_BLOCK8_ADDRESS_V_ADDRESS_Type U31 +#define GCREG_BLOCK8_VPLANE_ADDRESS_ADDRESS 31 : 0 +#define GCREG_BLOCK8_VPLANE_ADDRESS_ADDRESS_End 30 +#define GCREG_BLOCK8_VPLANE_ADDRESS_ADDRESS_Start 0 +#define GCREG_BLOCK8_VPLANE_ADDRESS_ADDRESS_Type U31 /******************************************************************************* ** State gcregBlock8StrideV @@ -7654,19 +8478,19 @@ struct gcregmultisource { /* Stride of the source V plane in bytes. */ #define gcregBlock8StrideVRegAddrs 0x4AE8 -#define GCREG_BLOCK8_STRIDE_V_MSB 15 -#define GCREG_BLOCK8_STRIDE_V_LSB 3 -#define GCREG_BLOCK8_STRIDE_V_BLK 0 -#define GCREG_BLOCK8_STRIDE_V_Count 8 -#define GCREG_BLOCK8_STRIDE_V_FieldMask 0x0003FFFF -#define GCREG_BLOCK8_STRIDE_V_ReadMask 0x0003FFFC -#define GCREG_BLOCK8_STRIDE_V_WriteMask 0x0003FFFC -#define GCREG_BLOCK8_STRIDE_V_ResetValue 0x00000000 +#define GCREG_BLOCK8_VPLANE_STRIDE_MSB 15 +#define GCREG_BLOCK8_VPLANE_STRIDE_LSB 3 +#define GCREG_BLOCK8_VPLANE_STRIDE_BLK 0 +#define GCREG_BLOCK8_VPLANE_STRIDE_Count 8 +#define GCREG_BLOCK8_VPLANE_STRIDE_FieldMask 0x0003FFFF +#define GCREG_BLOCK8_VPLANE_STRIDE_ReadMask 0x0003FFFC +#define GCREG_BLOCK8_VPLANE_STRIDE_WriteMask 0x0003FFFC +#define GCREG_BLOCK8_VPLANE_STRIDE_ResetValue 0x00000000 -#define GCREG_BLOCK8_STRIDE_V_STRIDE 17 : 0 -#define GCREG_BLOCK8_STRIDE_V_STRIDE_End 17 -#define GCREG_BLOCK8_STRIDE_V_STRIDE_Start 0 -#define GCREG_BLOCK8_STRIDE_V_STRIDE_Type U18 +#define GCREG_BLOCK8_VPLANE_STRIDE_STRIDE 17 : 0 +#define GCREG_BLOCK8_VPLANE_STRIDE_STRIDE_End 17 +#define GCREG_BLOCK8_VPLANE_STRIDE_STRIDE_Start 0 +#define GCREG_BLOCK8_VPLANE_STRIDE_STRIDE_Type U18 /******************************************************************************* ** State gcregBlock8SrcRotationHeight @@ -8001,58 +8825,58 @@ struct gcregmultisource { /* General purpose control register. */ -#define gcregBlock8ControlRegAddrs 0x4B20 -#define GCREG_BLOCK8_CONTROL_MSB 15 -#define GCREG_BLOCK8_CONTROL_LSB 3 -#define GCREG_BLOCK8_CONTROL_BLK 0 -#define GCREG_BLOCK8_CONTROL_Count 8 -#define GCREG_BLOCK8_CONTROL_FieldMask 0x00000999 -#define GCREG_BLOCK8_CONTROL_ReadMask 0x00000999 -#define GCREG_BLOCK8_CONTROL_WriteMask 0x00000999 -#define GCREG_BLOCK8_CONTROL_ResetValue 0x00000000 - -#define GCREG_BLOCK8_CONTROL_YUV 0 : 0 -#define GCREG_BLOCK8_CONTROL_YUV_End 0 -#define GCREG_BLOCK8_CONTROL_YUV_Start 0 -#define GCREG_BLOCK8_CONTROL_YUV_Type U01 -#define GCREG_BLOCK8_CONTROL_YUV_601 0x0 -#define GCREG_BLOCK8_CONTROL_YUV_709 0x1 - -#define GCREG_BLOCK8_CONTROL_MASK_YUV 3 : 3 -#define GCREG_BLOCK8_CONTROL_MASK_YUV_End 3 -#define GCREG_BLOCK8_CONTROL_MASK_YUV_Start 3 -#define GCREG_BLOCK8_CONTROL_MASK_YUV_Type U01 -#define GCREG_BLOCK8_CONTROL_MASK_YUV_ENABLED 0x0 -#define GCREG_BLOCK8_CONTROL_MASK_YUV_MASKED 0x1 - -#define GCREG_BLOCK8_CONTROL_UV_SWIZZLE 4 : 4 -#define GCREG_BLOCK8_CONTROL_UV_SWIZZLE_End 4 -#define GCREG_BLOCK8_CONTROL_UV_SWIZZLE_Start 4 -#define GCREG_BLOCK8_CONTROL_UV_SWIZZLE_Type U01 -#define GCREG_BLOCK8_CONTROL_UV_SWIZZLE_UV 0x0 -#define GCREG_BLOCK8_CONTROL_UV_SWIZZLE_VU 0x1 - -#define GCREG_BLOCK8_CONTROL_MASK_UV_SWIZZLE 7 : 7 -#define GCREG_BLOCK8_CONTROL_MASK_UV_SWIZZLE_End 7 -#define GCREG_BLOCK8_CONTROL_MASK_UV_SWIZZLE_Start 7 -#define GCREG_BLOCK8_CONTROL_MASK_UV_SWIZZLE_Type U01 -#define GCREG_BLOCK8_CONTROL_MASK_UV_SWIZZLE_ENABLED 0x0 -#define GCREG_BLOCK8_CONTROL_MASK_UV_SWIZZLE_MASKED 0x1 +#define gcregBlock8PEControlRegAddrs 0x4B20 +#define GCREG_BLOCK8_PE_CONTROL_MSB 15 +#define GCREG_BLOCK8_PE_CONTROL_LSB 3 +#define GCREG_BLOCK8_PE_CONTROL_BLK 0 +#define GCREG_BLOCK8_PE_CONTROL_Count 8 +#define GCREG_BLOCK8_PE_CONTROL_FieldMask 0x00000999 +#define GCREG_BLOCK8_PE_CONTROL_ReadMask 0x00000999 +#define GCREG_BLOCK8_PE_CONTROL_WriteMask 0x00000999 +#define GCREG_BLOCK8_PE_CONTROL_ResetValue 0x00000000 + +#define GCREG_BLOCK8_PE_CONTROL_YUV 0 : 0 +#define GCREG_BLOCK8_PE_CONTROL_YUV_End 0 +#define GCREG_BLOCK8_PE_CONTROL_YUV_Start 0 +#define GCREG_BLOCK8_PE_CONTROL_YUV_Type U01 +#define GCREG_BLOCK8_PE_CONTROL_YUV_601 0x0 +#define GCREG_BLOCK8_PE_CONTROL_YUV_709 0x1 + +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUV 3 : 3 +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUV_End 3 +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUV_Start 3 +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUV_Type U01 +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUV_ENABLED 0x0 +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUV_MASKED 0x1 + +#define GCREG_BLOCK8_PE_CONTROL_UV_SWIZZLE 4 : 4 +#define GCREG_BLOCK8_PE_CONTROL_UV_SWIZZLE_End 4 +#define GCREG_BLOCK8_PE_CONTROL_UV_SWIZZLE_Start 4 +#define GCREG_BLOCK8_PE_CONTROL_UV_SWIZZLE_Type U01 +#define GCREG_BLOCK8_PE_CONTROL_UV_SWIZZLE_UV 0x0 +#define GCREG_BLOCK8_PE_CONTROL_UV_SWIZZLE_VU 0x1 + +#define GCREG_BLOCK8_PE_CONTROL_MASK_UV_SWIZZLE 7 : 7 +#define GCREG_BLOCK8_PE_CONTROL_MASK_UV_SWIZZLE_End 7 +#define GCREG_BLOCK8_PE_CONTROL_MASK_UV_SWIZZLE_Start 7 +#define GCREG_BLOCK8_PE_CONTROL_MASK_UV_SWIZZLE_Type U01 +#define GCREG_BLOCK8_PE_CONTROL_MASK_UV_SWIZZLE_ENABLED 0x0 +#define GCREG_BLOCK8_PE_CONTROL_MASK_UV_SWIZZLE_MASKED 0x1 /* YUV to RGB convert enable */ -#define GCREG_BLOCK8_CONTROL_YUVRGB 8 : 8 -#define GCREG_BLOCK8_CONTROL_YUVRGB_End 8 -#define GCREG_BLOCK8_CONTROL_YUVRGB_Start 8 -#define GCREG_BLOCK8_CONTROL_YUVRGB_Type U01 -#define GCREG_BLOCK8_CONTROL_YUVRGB_DISABLED 0x0 -#define GCREG_BLOCK8_CONTROL_YUVRGB_ENABLED 0x1 +#define GCREG_BLOCK8_PE_CONTROL_YUVRGB 8 : 8 +#define GCREG_BLOCK8_PE_CONTROL_YUVRGB_End 8 +#define GCREG_BLOCK8_PE_CONTROL_YUVRGB_Start 8 +#define GCREG_BLOCK8_PE_CONTROL_YUVRGB_Type U01 +#define GCREG_BLOCK8_PE_CONTROL_YUVRGB_DISABLED 0x0 +#define GCREG_BLOCK8_PE_CONTROL_YUVRGB_ENABLED 0x1 -#define GCREG_BLOCK8_CONTROL_MASK_YUVRGB 11 : 11 -#define GCREG_BLOCK8_CONTROL_MASK_YUVRGB_End 11 -#define GCREG_BLOCK8_CONTROL_MASK_YUVRGB_Start 11 -#define GCREG_BLOCK8_CONTROL_MASK_YUVRGB_Type U01 -#define GCREG_BLOCK8_CONTROL_MASK_YUVRGB_ENABLED 0x0 -#define GCREG_BLOCK8_CONTROL_MASK_YUVRGB_MASKED 0x1 +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUVRGB 11 : 11 +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUVRGB_End 11 +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUVRGB_Start 11 +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUVRGB_Type U01 +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUVRGB_ENABLED 0x0 +#define GCREG_BLOCK8_PE_CONTROL_MASK_YUVRGB_MASKED 0x1 /******************************************************************************* ** State gcregBlock8SrcColorKeyHigh @@ -8128,6 +8952,14 @@ struct gcregmultisource { #define GCREG_BLOCK8_SRC_EX_CONFIG_MINOR_TILED_DISABLED 0x0 #define GCREG_BLOCK8_SRC_EX_CONFIG_MINOR_TILED_ENABLED 0x1 +/* Source CacheMode. */ +#define GCREG_BLOCK8_SRC_EX_CONFIG_CACHE_MODE 12 : 12 +#define GCREG_BLOCK8_SRC_EX_CONFIG_CACHE_MODE_End 12 +#define GCREG_BLOCK8_SRC_EX_CONFIG_CACHE_MODE_Start 12 +#define GCREG_BLOCK8_SRC_EX_CONFIG_CACHE_MODE_Type U01 +#define GCREG_BLOCK8_SRC_EX_CONFIG_CACHE_MODE_DISABLED 0x0 +#define GCREG_BLOCK8_SRC_EX_CONFIG_CACHE_MODE_ENABLED 0x1 + /******************************************************************************* ** State gcregBlock8SrcExAddress */ @@ -8379,7 +9211,7 @@ struct gcmommuflush { ** Modular operations: dst */ -static const struct gccmdldstate gcmodst_address_ldst = +static const struct gccmdldstate gcmodst_config_ldst = GCLDSTATE(gcregDestAddressRegAddrs, 3); static const struct gccmdldstate gcmodst_rotationheight_ldst = @@ -8389,8 +9221,8 @@ static const struct gccmdldstate gcmodst_clip_ldst = GCLDSTATE(gcregClipTopLeftRegAddrs, 2); struct gcmodst { - /* gcregDestAddressRegAddrs */ - struct gccmdldstate address_ldst; + /* Configuration block. */ + struct gccmdldstate config_ldst; /* gcregDestAddressRegAddrs */ unsigned int address; @@ -8413,7 +9245,7 @@ struct gcmodst { unsigned int raw; } rotationheight; - /* gcregClipTopLeftRegAddrs */ + /* Clipping block. */ struct gccmdldstate clip_ldst; /* gcregClipTopLeftRegAddrs */ @@ -8433,6 +9265,239 @@ struct gcmodst { }; /******************************************************************************* +** Modular operations: alpha +*/ + +static const struct gccmdldstate gcmoalpha_config_ldst = + GCLDSTATE(gcregAlphaControlRegAddrs, 2); + +struct gcmoalpha { + /* Alpha control block. */ + struct gccmdldstate config_ldst; + + /* gcregAlphaControlRegAddrs */ + union { + struct gcregalphacontrol reg; + unsigned int raw; + } control; + + /* gcregAlphaModesRegAddrs */ + union { + struct gcregalphamodes reg; + unsigned int raw; + } mode; + + /* Alignment filler. */ + unsigned int _filler; +}; + +/******************************************************************************* +** Modular operations: alphaoff +*/ + +static const struct gccmdldstate gcmoalphaoff_control_ldst = + GCLDSTATE(gcregAlphaControlRegAddrs, 1); + +struct gcmoalphaoff { + /* gcregAlphaControlRegAddrs */ + struct gccmdldstate control_ldst; + + /* gcregAlphaControlRegAddrs */ + union { + struct gcregalphacontrol reg; + unsigned int raw; + } control; +}; + +/******************************************************************************* +** Modular operations: alphaglobal +*/ + +static const struct gccmdldstate gcmoglobal_color_ldst = + GCLDSTATE(gcregGlobalSrcColorRegAddrs, 2); + +struct gcmoglobal { + /* Global color block. */ + struct gccmdldstate color_ldst; + + /* gcregGlobalSrcColorRegAddrs */ + union { + struct gcregglobalsrccolor reg; + unsigned int raw; + } srcglobal; + + /* gcregGlobalDestColorRegAddrs */ + union { + struct gcregglobaldstcolor reg; + unsigned int raw; + } dstglobal; + + /* Alignment filler. */ + unsigned int _filler; +}; + +/******************************************************************************* +** Modular operations: xsrcalpha +*/ + +static const struct gccmdldstate gcmoxsrcalpha_alphamodes_ldst[4] = { + GCLDSTATE(gcregBlock4AlphaModesRegAddrs + 0, 1), + GCLDSTATE(gcregBlock4AlphaModesRegAddrs + 1, 1), + GCLDSTATE(gcregBlock4AlphaModesRegAddrs + 2, 1), + GCLDSTATE(gcregBlock4AlphaModesRegAddrs + 3, 1), +}; + +static const struct gccmdldstate gcmoxsrcalpha_srcglobal_ldst[4] = { + GCLDSTATE(gcregBlock4GlobalSrcColorRegAddrs + 0, 1), + GCLDSTATE(gcregBlock4GlobalSrcColorRegAddrs + 1, 1), + GCLDSTATE(gcregBlock4GlobalSrcColorRegAddrs + 2, 1), + GCLDSTATE(gcregBlock4GlobalSrcColorRegAddrs + 3, 1), +}; + +static const struct gccmdldstate gcmoxsrcalpha_dstglobal_ldst[4] = { + GCLDSTATE(gcregBlock4GlobalDestColorRegAddrs + 0, 1), + GCLDSTATE(gcregBlock4GlobalDestColorRegAddrs + 1, 1), + GCLDSTATE(gcregBlock4GlobalDestColorRegAddrs + 2, 1), + GCLDSTATE(gcregBlock4GlobalDestColorRegAddrs + 3, 1), +}; + +struct gcmoxsrcalpha { + /* gcregBlock4AlphaModesRegAddrs */ + struct gccmdldstate alphamodes_ldst; + + /* gcregBlock4AlphaModesRegAddrs */ + union { + struct gcregalphamodes reg; + unsigned int raw; + } alphamodes; + + /* gcregBlock4GlobalSrcColorRegAddrs */ + struct gccmdldstate srcglobal_ldst; + + /* gcregBlock4GlobalSrcColorRegAddrs */ + union { + struct gcregglobalsrccolor reg; + unsigned int raw; + } srcglobal; + + /* gcregBlock4GlobalDestColorRegAddrs */ + struct gccmdldstate dstglobal_ldst; + + /* gcregBlock4GlobalDestColorRegAddrs */ + union { + struct gcregglobaldstcolor reg; + unsigned int raw; + } dstglobal; +}; + +/******************************************************************************* +** Modular operations: yuv +*/ + +static const struct gccmdldstate gcmoyuv_plane_ldst = + GCLDSTATE(gcregUPlaneAddressRegAddrs, 4); + +static const struct gccmdldstate gcmoyuv_pectrl_ldst = + GCLDSTATE(gcregPEControlRegAddrs, 1); + +struct gcmoyuv { + /* Plane state block. */ + struct gccmdldstate plane_ldst; + + /* gcregBlock4UPlaneAddressRegAddrs */ + unsigned int uplaneaddress; + + /* gcregBlock4UPlaneStrideRegAddrs */ + unsigned int uplanestride; + + /* gcregBlock4VPlaneAddressRegAddrs */ + unsigned int vplaneaddress; + + /* gcregBlock4VPlaneStrideRegAddrs */ + unsigned int vplanestride; + + /* Alignment filler. */ + unsigned int _filler1; + + /* gcregBlock4PEControlRegAddrs */ + struct gccmdldstate pectrl_ldst; + + /* gcregBlock4PEControlRegAddrs */ + unsigned int pectrl; +}; + +/******************************************************************************* +** Modular operations: xsrcyuv +*/ + +static const struct gccmdldstate gcmoxsrcyuv_uplaneaddress_ldst[4] = { + GCLDSTATE(gcregBlock4UPlaneAddressRegAddrs + 0, 1), + GCLDSTATE(gcregBlock4UPlaneAddressRegAddrs + 1, 1), + GCLDSTATE(gcregBlock4UPlaneAddressRegAddrs + 2, 1), + GCLDSTATE(gcregBlock4UPlaneAddressRegAddrs + 3, 1), +}; + +static const struct gccmdldstate gcmoxsrcyuv_uplanestride_ldst[4] = { + GCLDSTATE(gcregBlock4UPlaneStrideRegAddrs + 0, 1), + GCLDSTATE(gcregBlock4UPlaneStrideRegAddrs + 1, 1), + GCLDSTATE(gcregBlock4UPlaneStrideRegAddrs + 2, 1), + GCLDSTATE(gcregBlock4UPlaneStrideRegAddrs + 3, 1), +}; + +static const struct gccmdldstate gcmoxsrcyuv_vplaneaddress_ldst[4] = { + GCLDSTATE(gcregBlock4VPlaneAddressRegAddrs + 0, 1), + GCLDSTATE(gcregBlock4VPlaneAddressRegAddrs + 1, 1), + GCLDSTATE(gcregBlock4VPlaneAddressRegAddrs + 2, 1), + GCLDSTATE(gcregBlock4VPlaneAddressRegAddrs + 3, 1), +}; + +static const struct gccmdldstate gcmoxsrcyuv_vplanestride_ldst[4] = { + GCLDSTATE(gcregBlock4VPlaneStrideRegAddrs + 0, 1), + GCLDSTATE(gcregBlock4VPlaneStrideRegAddrs + 1, 1), + GCLDSTATE(gcregBlock4VPlaneStrideRegAddrs + 2, 1), + GCLDSTATE(gcregBlock4VPlaneStrideRegAddrs + 3, 1), +}; + +static const struct gccmdldstate gcmoxsrcyuv_pectrl_ldst[4] = { + GCLDSTATE(gcregBlock4PEControlRegAddrs + 0, 1), + GCLDSTATE(gcregBlock4PEControlRegAddrs + 1, 1), + GCLDSTATE(gcregBlock4PEControlRegAddrs + 2, 1), + GCLDSTATE(gcregBlock4PEControlRegAddrs + 3, 1), +}; + +struct gcmoxsrcyuv { + /* gcregBlock4UPlaneAddressRegAddrs */ + struct gccmdldstate uplaneaddress_ldst; + + /* gcregBlock4UPlaneAddressRegAddrs */ + unsigned int uplaneaddress; + + /* gcregBlock4UPlaneStrideRegAddrs */ + struct gccmdldstate uplanestride_ldst; + + /* gcregBlock4UPlaneStrideRegAddrs */ + unsigned int uplanestride; + + /* gcregBlock4VPlaneAddressRegAddrs */ + struct gccmdldstate vplaneaddress_ldst; + + /* gcregBlock4VPlaneAddressRegAddrs */ + unsigned int vplaneaddress; + + /* gcregBlock4VPlaneStrideRegAddrs */ + struct gccmdldstate vplanestride_ldst; + + /* gcregBlock4VPlaneStrideRegAddrs */ + unsigned int vplanestride; + + /* gcregBlock4PEControlRegAddrs */ + struct gccmdldstate pectrl_ldst; + + /* gcregBlock4PEControlRegAddrs */ + unsigned int pectrl; +}; + +/******************************************************************************* ** Modular operations: src */ @@ -8450,34 +9515,6 @@ static const struct gccmdldstate gcmosrc_stride_ldst[4] = { GCLDSTATE(gcregBlock4SrcStrideRegAddrs + 3, 1), }; -static const struct gccmdldstate gcmosrc_uplaneaddress_ldst[4] = { - GCLDSTATE(gcregUPlaneAddressRegAddrs + 0, 1), - GCLDSTATE(gcregUPlaneAddressRegAddrs + 1, 1), - GCLDSTATE(gcregUPlaneAddressRegAddrs + 2, 1), - GCLDSTATE(gcregUPlaneAddressRegAddrs + 3, 1), -}; - -static const struct gccmdldstate gcmosrc_uplanestride_ldst[4] = { - GCLDSTATE(gcregUPlaneStrideRegAddrs + 0, 1), - GCLDSTATE(gcregUPlaneStrideRegAddrs + 1, 1), - GCLDSTATE(gcregUPlaneStrideRegAddrs + 2, 1), - GCLDSTATE(gcregUPlaneStrideRegAddrs + 3, 1), -}; - -static const struct gccmdldstate gcmosrc_vplaneaddress_ldst[4] = { - GCLDSTATE(gcregVPlaneAddressRegAddrs + 0, 1), - GCLDSTATE(gcregVPlaneAddressRegAddrs + 1, 1), - GCLDSTATE(gcregVPlaneAddressRegAddrs + 2, 1), - GCLDSTATE(gcregVPlaneAddressRegAddrs + 3, 1), -}; - -static const struct gccmdldstate gcmosrc_vplanestride_ldst[4] = { - GCLDSTATE(gcregVPlaneStrideRegAddrs + 0, 1), - GCLDSTATE(gcregVPlaneStrideRegAddrs + 1, 1), - GCLDSTATE(gcregVPlaneStrideRegAddrs + 2, 1), - GCLDSTATE(gcregVPlaneStrideRegAddrs + 3, 1), -}; - static const struct gccmdldstate gcmosrc_rotation_ldst[4] = { GCLDSTATE(gcregBlock4SrcRotationConfigRegAddrs + 0, 1), GCLDSTATE(gcregBlock4SrcRotationConfigRegAddrs + 1, 1), @@ -8541,27 +9578,6 @@ static const struct gccmdldstate gcmosrc_alphacontrol_ldst[4] = { GCLDSTATE(gcregBlock4AlphaControlRegAddrs + 3, 1), }; -static const struct gccmdldstate gcmosrcalpha_alphamodes_ldst[4] = { - GCLDSTATE(gcregBlock4AlphaModesRegAddrs + 0, 1), - GCLDSTATE(gcregBlock4AlphaModesRegAddrs + 1, 1), - GCLDSTATE(gcregBlock4AlphaModesRegAddrs + 2, 1), - GCLDSTATE(gcregBlock4AlphaModesRegAddrs + 3, 1), -}; - -static const struct gccmdldstate gcmosrcalpha_srcglobal_ldst[4] = { - GCLDSTATE(gcregBlock4GlobalSrcColorRegAddrs + 0, 1), - GCLDSTATE(gcregBlock4GlobalSrcColorRegAddrs + 1, 1), - GCLDSTATE(gcregBlock4GlobalSrcColorRegAddrs + 2, 1), - GCLDSTATE(gcregBlock4GlobalSrcColorRegAddrs + 3, 1), -}; - -static const struct gccmdldstate gcmosrcalpha_dstglobal_ldst[4] = { - GCLDSTATE(gcregBlock4GlobalDestColorRegAddrs + 0, 1), - GCLDSTATE(gcregBlock4GlobalDestColorRegAddrs + 1, 1), - GCLDSTATE(gcregBlock4GlobalDestColorRegAddrs + 2, 1), - GCLDSTATE(gcregBlock4GlobalDestColorRegAddrs + 3, 1), -}; - struct gcmosrc { /* gcregBlock4SrcAddressRegAddrs */ struct gccmdldstate address_ldst; @@ -8657,51 +9673,109 @@ struct gcmosrc { } alphacontrol; }; -struct gcmosrcplanaryuv { - /* gcregUPlaneAddressRegAddrs */ - struct gccmdldstate uplaneaddress_ldst; - unsigned int uplaneaddress; +/******************************************************************************* +** Modular operations: vrsrc +*/ - /* gcregUPlaneStrideRegAddrs */ - struct gccmdldstate uplanestride_ldst; - unsigned int uplanestride; +static const struct gccmdldstate gcmovrsrc_config_ldst = + GCLDSTATE(gcregSrcAddressRegAddrs, 4); - /* gcregVPlaneAddressRegAddrs */ - struct gccmdldstate vplaneaddress_ldst; - unsigned int vplaneaddress; +static const struct gccmdldstate gcmovrsrc_pos_ldst = + GCLDSTATE(gcregVRSourceImageLowRegAddrs, 4); - /* gcregVPlaneStrideRegAddrs */ - struct gccmdldstate vplanestride_ldst; - unsigned int vplanestride; -}; +static const struct gccmdldstate gcmovrsrc_rotation_ldst = + GCLDSTATE(gcregSrcRotationHeightRegAddrs, 2); -struct gcmosrcalpha { - /* gcregBlock4AlphaModesRegAddrs */ - struct gccmdldstate alphamodes_ldst; +static const struct gccmdldstate gcmovrsrc_rop_ldst = + GCLDSTATE(gcregRopRegAddrs, 1); - /* gcregBlock4AlphaModesRegAddrs */ +static const struct gccmdldstate gcmovrsrc_mult_ldst = + GCLDSTATE(gcregColorMultiplyModesRegAddrs, 1); + +struct gcmovrsrc { + /* Configuration block. */ + struct gccmdldstate config_ldst; + + /* gcregSrcAddressRegAddrs */ + unsigned int address; + + /* gcregSrcStrideRegAddrs */ + unsigned int stride; + + /* gcregSrcRotationConfigRegAddrs */ union { - struct gcregalphamodes reg; + struct gcregsrcrotationconfig reg; unsigned int raw; - } alphamodes; + } rotation; - /* gcregBlock4GlobalSrcColorRegAddrs */ - struct gccmdldstate srcglobal_ldst; + /* gcregSrcConfigRegAddrs */ + union { + struct gcregsrcconfig reg; + unsigned int raw; + } config; - /* gcregBlock4GlobalSrcColorRegAddrs */ + /* Alignment filler. */ + unsigned int _filler1; + + /* Source position block. */ + struct gccmdldstate pos_ldst; + + /* gcregVRSourceImageLowRegAddrs */ union { - struct gcregglobalsrccolor reg; + struct gcregvrsourceimagelow reg; unsigned int raw; - } srcglobal; + } lt; - /* gcregBlock4GlobalDestColorRegAddrs */ - struct gccmdldstate dstglobal_ldst; + /* gcregVRSourceImageHighRegAddrs */ + union { + struct gcregvrsourceimagehigh reg; + unsigned int raw; + } rb; - /* gcregBlock4GlobalDestColorRegAddrs */ + /* gcregVRSourceOriginLowRegAddrs */ + unsigned int x; + + /* gcregVRSourceOriginHighRegAddrs */ + unsigned int y; + + /* Alignment filler. */ + unsigned int _filler2; + + /* Rotation block. */ + struct gccmdldstate rotation_ldst; + + /* gcregSrcRotationHeightRegAddrs */ union { - struct gcregglobaldstcolor reg; + struct gcregsrcrotationheight reg; unsigned int raw; - } dstglobal; + } rotationheight; + + /* gcregRotAngleRegAddrs */ + union { + struct gcregrotangle reg; + unsigned int raw; + } rotationangle; + + /* Alignment filler. */ + unsigned int _filler3; + + /* gcregRopRegAddrs */ + struct gccmdldstate rop_ldst; + + /* gcregRopRegAddrs */ + union { + struct gcregrop reg; + unsigned int raw; + } rop; + + /* gcregColorMultiplyModesRegAddrs */ + struct gccmdldstate mult_ldst; + + /* gcregColorMultiplyModesRegAddrs */ + union { + struct gcregcolormultiplymodes reg; + unsigned int raw; + } mult; }; /******************************************************************************* @@ -8750,7 +9824,7 @@ struct gcmobltconfig { ** Modular operations: startde */ -struct gcmostart { +struct gcmostartde { /* Start DE command. */ struct gccmdstartde startde; struct gccmdstartderect rect; @@ -8864,4 +9938,133 @@ struct gcmofill { struct gccmdstartderect rect; }; +/******************************************************************************* +** Modular operations: filterkernel +*/ + +static const struct gccmdldstate gcmofilterkernel_shared_ldst = + GCLDSTATE(gcregFilterKernelRegAddrs, 77); + +static const struct gccmdldstate gcmofilterkernel_horizontal_ldst = + GCLDSTATE(gcregHoriFilterKernelRegAddrs, 77); + +static const struct gccmdldstate gcmofilterkernel_vertical_ldst = + GCLDSTATE(gcregVertiFilterKernelRegAddrs, 77); + +struct gcmofilterkernel { + /* Kernel array block. */ + struct gccmdldstate kernelarray_ldst; + + /* Array of kernel coefficients. */ + struct gcregfilterkernel kernelarray; +}; + +/******************************************************************************* +** Modular operations: vrdst +*/ + +static const struct gccmdldstate gcmovrdst_config_ldst = + GCLDSTATE(gcregDestAddressRegAddrs, 4); + +static const struct gccmdldstate gcmovrdst_rotationheight_ldst = + GCLDSTATE(gcregDstRotationHeightRegAddrs, 1); + +struct gcmovrdst { + /* Configuration block. */ + struct gccmdldstate config_ldst; + + /* gcregDestAddressRegAddrs */ + unsigned int address; + + /* gcregDestStrideRegAddrs */ + unsigned int stride; + + /* gcregDestRotationConfigRegAddrs */ + union { + struct gcregdstrotationconfig reg; + unsigned int raw; + } rotation; + + /* gcregDestConfigRegAddrs */ + union { + struct gcregdstconfig reg; + unsigned int raw; + } config; + + /* Alignment filler. */ + unsigned int _filler; + + /* gcregDstRotationHeightRegAddrs */ + struct gccmdldstate rotationheight_ldst; + + /* gcregDstRotationHeightRegAddrs */ + union { + struct gcregdstrotationheight reg; + unsigned int raw; + } rotationheight; +}; + +/******************************************************************************* +** Modular operations: vrconfigex +*/ + +static const struct gccmdldstate gcmovrconfigex_config_ldst = + GCLDSTATE(gcregVRConfigExRegAddrs, 1); + +struct gcmovrconfigex { + /* gcregVRConfigExRegAddrs */ + struct gccmdldstate config_ldst; + + /* gcregVRConfigExRegAddrs */ + union { + struct gcregvrconfigex reg; + unsigned int raw; + } config; +}; + +/******************************************************************************* +** Modular operations: startvr +*/ + +static const struct gccmdldstate gcmostartvr_scale_ldst = + GCLDSTATE(gcregStretchFactorLowRegAddrs, 2); + +static const struct gccmdldstate gcmostartvr_rect_ldst = + GCLDSTATE(gcregVRTargetWindowLowRegAddrs, 2); + +static const struct gccmdldstate gcmostartvr_config_ldst = + GCLDSTATE(gcregVRConfigRegAddrs, 1); + +struct gcmostartvr { + /* Scale factor block. */ + struct gccmdldstate scale_ldst; + + /* gcregStretchFactorLowRegAddrs */ + unsigned int scalex; + + /* gcregStretchFactorHighRegAddrs */ + unsigned int scaley; + + /* Alignment filler. */ + unsigned int _filler1; + + /* Target rectangle. */ + struct gccmdldstate rect_ldst; + + /* gcregVRTargetWindowLowRegAddrs */ + struct gcregvrtargetwindowlow lt; + + /* gcregVRTargetWindowHighRegAddrs */ + struct gcregvrtargetwindowhigh rb; + + /* Alignment filler. */ + unsigned int _filler2; + + /* Start video raster commad. */ + struct gccmdldstate config_ldst; + + /* gcregVRConfigRegAddrs */ + struct gcregvrconfig config; +}; + #endif diff --git a/include/linux/gcx.h b/include/linux/gcx.h index 146c8f3..0d3994a 100644 --- a/include/linux/gcx.h +++ b/include/linux/gcx.h @@ -23,9 +23,21 @@ #ifndef countof #define countof(a) \ - (sizeof(a) / sizeof(a[0])) +( \ + sizeof(a) / sizeof(a[0]) \ +) #endif +#define GC_PTR2INT(p) \ +( \ + (unsigned int) (p) \ +) + +#define GC_ALIGN(n, align) \ +( \ + ((n) + ((align) - 1)) & ~((align) - 1) \ +) + #define GCLOCK_TIMEOUT_SEC 10 #define GCLOCK_TIMEOUT_JIF (msecs_to_jiffies(GCLOCK_TIMEOUT_SEC * 1000)) |