Bool VGetSurfAddrBy32(GALINFOPTR galInfo,int maxsize, int *phyaddr,int *lgaddr,int *width,int *height,int *stride) { static int gphyaddr; static int glgaddr; static int gwidth; static int gheight; static int gstride; static int lastmaxsize=0; gceSTATUS status = gcvSTATUS_OK; VIVGPUPtr gpuctx = (VIVGPUPtr) (galInfo->mGpu); if (maxsize <MAX_WIDTH) maxsize=MAX_WIDTH; if (_vsurf32.surf && (maxsize >lastmaxsize)) { if (VDestroySurf32()!=TRUE) TRACE_EXIT(FALSE); lastmaxsize=maxsize; } if (_vsurf32.surf==NULL) { lastmaxsize=maxsize; status=gcoSURF_Construct(gpuctx->mDriver->mHal,maxsize,maxsize,1,gcvSURF_BITMAP,gcvSURF_A8R8G8B8,gcvPOOL_DEFAULT,&(_vsurf32.surf)); if (status!=gcvSTATUS_OK) TRACE_EXIT(FALSE); status=gcoSURF_GetAlignedSize(_vsurf32.surf,&gwidth,&gheight,&gstride); if (status!=gcvSTATUS_OK) TRACE_EXIT(FALSE); status=gcoSURF_Lock(_vsurf32.surf, &gphyaddr, (void *)&glgaddr); _vsurf32.lineaddr=glgaddr; } *phyaddr=gphyaddr; *lgaddr=glgaddr; *width=gwidth; *height=gheight; *stride=gstride; TRACE_EXIT(TRUE); }
gceSTATUS GC2D_Accelerator::CreateGALSurface( IN gctUINT Width, IN gctUINT Height, IN gceSURF_FORMAT Format, IN gcePOOL Pool, OUT gcoSURF * Surface ) { return gcoSURF_Construct(mHal, Width, Height, 1, gcvSURF_BITMAP, Format, Pool, Surface); }
gceSTATUS _FitSurface( IN gcsCOPYBIT_CONTEXT * Context, IN gcsSURFACE * Surface, IN gctUINT32 Width, IN gctUINT32 Height ) { gceSTATUS status = gcvSTATUS_OK; if (Surface == gcvNULL) { return gcvSTATUS_INVALID_ARGUMENT; } do { /* Create the tmp Surfaceace if necessary. */ if ((Surface->surface == gcvNULL) || (Surface->width < Width) || (Surface->height < Height) ) { /* Destroy last surface. */ if (Surface->surface != gcvNULL) { if (Surface->logical != gcvNULL) { gcmERR_BREAK( gcoSURF_Unlock(Surface->surface, Surface->logical)); } gcmERR_BREAK( gcoSURF_Destroy(Surface->surface)); } /* New surface values. */ Surface->format = gcvSURF_A8R8G8B8; Surface->width = Width; Surface->height = Height; gcmERR_BREAK( gcoSURF_Construct(gcvNULL, Surface->width, Surface->height, 1, gcvSURF_BITMAP, Surface->format, gcvPOOL_DEFAULT, &Surface->surface)); gcmERR_BREAK( gcoSURF_Lock(Surface->surface, &Surface->physical, &Surface->logical)); gcmERR_BREAK( gcoSURF_GetAlignedSize(Surface->surface, &Surface->alignedWidth, &Surface->alignedHeight, &Surface->stride)); } } while (gcvFALSE); return status; }
/******************************************************************************* ** ** _WorkaroundForFilterBlit ** ** Workaround for the dirty region issue of filter blit. ** It only exists for old GC300 before 2.0.2 (included). ** ** INPUT: ** ** gctHAL Hal ** Pointer to HAL. ** ** OUTPUT: ** ** Nothing. */ static gceSTATUS _WorkaroundForFilterBlit( IN gcoHAL Hal ) { gceSTATUS status; gcoSURF srcSurf = gcvNULL; gcsRECT srcRect; gcoSURF dstSurf = gcvNULL; gcsRECT dstRect; do { gcmERR_BREAK(gcoSURF_Construct( gcvNULL, 256, 256, 1, gcvSURF_BITMAP, gcvSURF_A8R8G8B8, gcvPOOL_DEFAULT, &srcSurf )); gcmERR_BREAK(gcoSURF_Construct( gcvNULL, 256, 256, 1, gcvSURF_BITMAP, gcvSURF_A8R8G8B8, gcvPOOL_DEFAULT, &dstSurf )); srcRect.left = 0; srcRect.top = 0; srcRect.right = 64; srcRect.bottom = 16; dstRect.left = 0; dstRect.top = 0; dstRect.right = 128; dstRect.bottom = 32; gcmERR_BREAK(gcoSURF_FilterBlit( srcSurf, dstSurf, &srcRect, &dstRect, gcvNULL )); gcmERR_BREAK(gcoSURF_Destroy(srcSurf)); srcSurf = gcvNULL; gcmERR_BREAK(gcoSURF_Destroy(dstSurf)); dstSurf = gcvNULL; } while(gcvFALSE); if (gcmIS_ERROR(status)) { gcmTRACE_ZONE(gcvLEVEL_ERROR, gcvZONE_HAL, "Failed to workarond for GC300."); if (srcSurf) { gcmVERIFY_OK(gcoSURF_Destroy(srcSurf)); } if (dstSurf) { gcmVERIFY_OK(gcoSURF_Destroy(dstSurf)); } } return status; }