From aeca5fbd37c9a1703954b3bd0d88c4c8e9e615ca Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 20 Mar 2014 16:39:06 +0000 Subject: Move GPU source programming into gal_prepare_gpu() We don't need to replicate this in every function, we can just do this when preparing the vivante pixmap for GPU access - but currently only for the non-blended operations. Signed-off-by: Russell King --- src/vivante_accel.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/src/vivante_accel.c b/src/vivante_accel.c index 7b92ba2..fd3bf8b 100644 --- a/src/vivante_accel.c +++ b/src/vivante_accel.c @@ -252,6 +252,7 @@ static void vivante_batch_commit(struct vivante *vivante) enum gpuid { GPU2D_Source, + GPU2D_SourceBlend, GPU2D_Target, }; @@ -302,15 +303,16 @@ gal_prepare_gpu(struct vivante *vivante, struct vivante_pixmap *vPix, break; case GPU2D_Source: -#if 0 - err = gco2D_SetColorSourceAdvanced(vivante->e2d, vSrc->handle, - vSrc->pitch, vSrc->format, gcvSURF_0_DEGREE, - vSrc->width, vSrc->height, gcvFALSE); + err = gco2D_SetColorSourceAdvanced(vivante->e2d, vPix->handle, + vPix->pitch, vPix->format, gcvSURF_0_DEGREE, + vPix->width, vPix->height, gcvFALSE); if (err != gcvSTATUS_OK) { vivante_error(vivante, "gco2D_SetColourSourceAdvanced", err); return FALSE; } -#endif + break; + + case GPU2D_SourceBlend: break; } return TRUE; @@ -697,7 +699,6 @@ void vivante_accel_CopyNtoN(DrawablePtr pSrc, DrawablePtr pDst, int dst_off_x, dst_off_y, src_off_x, src_off_y; BoxRec limits; gceSTATUS err; - const char *what; if (vivante->force_fallback) goto fallback; @@ -723,21 +724,13 @@ void vivante_accel_CopyNtoN(DrawablePtr pSrc, DrawablePtr pDst, /* Right, we're all good to go */ if (!gal_prepare_gpu(vivante, vDst, GPU2D_Target) || - !gal_prepare_gpu(vivante, vSrc, GPU2D_Source)) + !gal_prepare_gpu(vivante, vSrc, GPU2D_Source)) goto fallback; vivante_disable_alpha_blend(vivante); /* No need to load the brush here - the blit copy doesn't use it. */ - err = gco2D_SetColorSourceAdvanced(vivante->e2d, vSrc->handle, - vSrc->pitch, vSrc->format, gcvSURF_0_DEGREE, - vSrc->width, vSrc->height, gcvFALSE); - if (err != gcvSTATUS_OK) { - what = "SetColorSourceAdvanced"; - goto fallback_msg; - } - /* Submit the blit operations */ err = vivante_blit_copy(vivante, pGC, &limits, pBox, nBox, src_off_x, src_off_y, @@ -752,8 +745,6 @@ void vivante_accel_CopyNtoN(DrawablePtr pSrc, DrawablePtr pDst, return; - fallback_msg: - vivante_error(vivante, what, err); fallback: vivante_unaccel_CopyNtoN(pSrc, pDst, pGC, pBox, nBox, dx, dy, reverse, upsidedown, bitPlane, closure); @@ -886,7 +877,7 @@ Bool vivante_accel_PolyFillRectTiled(DrawablePtr pDrawable, GCPtr pGC, int n, /* Right, we're all good to go */ if (!gal_prepare_gpu(vivante, vPix, GPU2D_Target) || - !gal_prepare_gpu(vivante, vTile, GPU2D_Source)) + !gal_prepare_gpu(vivante, vTile, GPU2D_Source)) goto fallback; vivante_disable_alpha_blend(vivante); @@ -897,14 +888,6 @@ Bool vivante_accel_PolyFillRectTiled(DrawablePtr pDrawable, GCPtr pGC, int n, goto fallback; } - err = gco2D_SetColorSourceAdvanced(vivante->e2d, vTile->handle, - vTile->pitch, vTile->format, gcvSURF_0_DEGREE, - vTile->width, vTile->height, gcvFALSE); - if (err != gcvSTATUS_OK) { - vivante_error(vivante, "SetColorSourceAdvanced", err); - goto fallback; - } - /* Calculate the tile offset from the rect coords */ off_x += pDrawable->x + pGC->patOrg.x; off_y += pDrawable->y + pGC->patOrg.y; @@ -1133,7 +1116,7 @@ static Bool vivante_blend(struct vivante *vivante, gcsRECT_PTR clip, gceSTATUS err; if (!gal_prepare_gpu(vivante, vDst, GPU2D_Target) || - !gal_prepare_gpu(vivante, vSrc, GPU2D_Source)) + !gal_prepare_gpu(vivante, vSrc, GPU2D_SourceBlend)) return FALSE; if (!blend) { -- cgit