diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-11-17 20:08:49 -0200 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-11-17 20:08:49 -0200 |
commit | c2e318eaec3ac281457acdca4ea10fa368f646d3 (patch) | |
tree | 39d4133e79e296675cc64a814f15182561afa80b /src/smi_crtc.c | |
parent | ed6aba73259a1412e23a954d6a8dba439ad98a8a (diff) |
Enable XAA and randr rotated modes.
Use the same logic for offscreen memory management as used in
smi_video.c. This also makes the functions SMI_AllocateMemory and
SMI_FreeMemory no longer static in smi_video.c.
Diffstat (limited to 'src/smi_crtc.c')
-rw-r--r-- | src/smi_crtc.c | 35 |
1 files changed, 20 insertions, 15 deletions
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; } |