diff options
-rw-r--r-- | src/smi.h | 3 | ||||
-rw-r--r-- | src/smi_crtc.c | 35 | ||||
-rw-r--r-- | src/smi_crtc.h | 2 | ||||
-rw-r--r-- | src/smi_video.c | 6 |
4 files changed, 26 insertions, 20 deletions
@@ -397,5 +397,8 @@ Bool SMI_DGAInit(ScreenPtr pScrn); /* smi_video.c */ void SMI_InitVideo(ScreenPtr pScreen); +CARD32 SMI_AllocateMemory(ScrnInfoPtr pScrn, void **mem_struct, int size); +void SMI_FreeMemory(ScrnInfoPtr pScrn, void *mem_struct); + #endif /*_SMI_H*/ diff --git a/src/smi_crtc.c b/src/smi_crtc.c index 329a907..fa2b097 100644 --- a/src/smi_crtc.c +++ b/src/smi_crtc.c @@ -119,22 +119,26 @@ SMI_CrtcGammaSet(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, static void * SMI_CrtcShadowAllocate (xf86CrtcPtr crtc, int width, int height) { - ScrnInfoPtr pScrn = crtc->scrn; - SMIPtr pSmi = SMIPTR(pScrn); - SMICrtcPrivatePtr crtcPriv = SMICRTC(crtc); + ScrnInfoPtr pScrn = crtc->scrn; + SMIPtr pSmi = SMIPTR(pScrn); + SMICrtcPrivatePtr crtcPriv = SMICRTC(crtc); + int offset, size; + char *result = NULL; ENTER(); - if(!pSmi->NoAccel && pSmi->useEXA){ - int aligned_pitch = (width * pSmi->Bpp + 15) & ~15; - - crtcPriv->shadowArea = exaOffscreenAlloc(pScrn->pScreen, aligned_pitch * height, 16, TRUE, NULL, NULL); + size = (pSmi->useEXA ? ((width * pSmi->Bpp + 15) & ~15) : width) * height; + offset = SMI_AllocateMemory(pScrn, &crtcPriv->shadowArea, size); - if(crtcPriv->shadowArea) - RETURN(pSmi->FBBase + crtcPriv->shadowArea->offset); + if (offset) { + result = pSmi->FBBase; + if (pSmi->useEXA) + result += ((ExaOffscreenArea *)crtcPriv->shadowArea)->offset; + else + result += offset * pSmi->Bpp; } - RETURN(NULL); + RETURN(result); } static PixmapPtr @@ -155,16 +159,17 @@ SMI_CrtcShadowCreate (xf86CrtcPtr crtc, void *data, int width, int height) static void SMI_CrtcShadowDestroy (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data) { - ScrnInfoPtr pScrn = crtc->scrn; - SMICrtcPrivatePtr crtcPriv = SMICRTC(crtc); + ScrnInfoPtr pScrn = crtc->scrn; + SMIPtr pSmi = SMIPTR(pScrn); + SMICrtcPrivatePtr crtcPriv = SMICRTC(crtc); ENTER(); - if(pPixmap) + if (pSmi->useEXA && pPixmap) FreeScratchPixmapHeader(pPixmap); - if(crtcPriv->shadowArea){ - exaOffscreenFree(pScrn->pScreen, crtcPriv->shadowArea); + if (crtcPriv->shadowArea) { + SMI_FreeMemory(pScrn, crtcPriv->shadowArea); crtcPriv->shadowArea = NULL; } diff --git a/src/smi_crtc.h b/src/smi_crtc.h index fcd8345..951f78f 100644 --- a/src/smi_crtc.h +++ b/src/smi_crtc.h @@ -28,7 +28,7 @@ typedef struct { /* Memory copy of the CRTC color palette */ CARD16 lut_r[256],lut_g[256],lut_b[256]; /* Allocated memory area used as shadow pixmap (for rotation) */ - ExaOffscreenArea* shadowArea; + void* shadowArea; /* Setup the CRTC registers to show the specified framebuffer location*/ void (*adjust_frame)(xf86CrtcPtr crtc, int x, int y); diff --git a/src/smi_video.c b/src/smi_video.c index df11a67..6346cfd 100644 --- a/src/smi_video.c +++ b/src/smi_video.c @@ -130,8 +130,6 @@ static void SMI_BlockHandler(int i, pointer blockData, pointer pTimeout, static void SMI_InitOffscreenImages(ScreenPtr pScreen); static void SMI_VideoSave(ScreenPtr pScreen, ExaOffscreenArea *area); -static CARD32 SMI_AllocateMemory(ScrnInfoPtr pScrn, void **mem_struct, int size); -static void SMI_FreeMemory(ScrnInfoPtr pScrn, void *mem_struct); static void CopyYV12ToVideoMem(unsigned char *src1, unsigned char *src2, unsigned char *src3, unsigned char *dst, @@ -2216,7 +2214,7 @@ SMI_VideoSave(ScreenPtr pScreen, ExaOffscreenArea *area) LEAVE(); } -static CARD32 +CARD32 SMI_AllocateMemory(ScrnInfoPtr pScrn, void **mem_struct, int size) { ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; @@ -2281,7 +2279,7 @@ SMI_AllocateMemory(ScrnInfoPtr pScrn, void **mem_struct, int size) RETURN(offset); } -static void +void SMI_FreeMemory( ScrnInfoPtr pScrn, void *mem_struct |