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 _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; }