summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-11-17 20:08:49 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-11-17 20:08:49 -0200
commitc2e318eaec3ac281457acdca4ea10fa368f646d3 (patch)
tree39d4133e79e296675cc64a814f15182561afa80b
parented6aba73259a1412e23a954d6a8dba439ad98a8a (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.
-rw-r--r--src/smi.h3
-rw-r--r--src/smi_crtc.c35
-rw-r--r--src/smi_crtc.h2
-rw-r--r--src/smi_video.c6
4 files changed, 26 insertions, 20 deletions
diff --git a/src/smi.h b/src/smi.h
index 76de956..0b23310 100644
--- a/src/smi.h
+++ b/src/smi.h
@@ -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