summaryrefslogtreecommitdiff
path: root/src/smi_exa.c
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@gmail.com>2008-08-16 13:00:31 +0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-08-16 19:16:28 -0300
commit209097ba5b44a0ce0da7f1ea52150dcace2b5244 (patch)
treecf75b4a605fb5448bd6cc9d4e70ad0ccaab7ec74 /src/smi_exa.c
parent45c6aedd6fe4e4d6abe58d1bb39ec01049404f09 (diff)
RandR rotation implemented.
* I added the configuration file option "RandRRotation". * I replaced pSmi->ShadowPitch with pSmi->screenStride, it seems it makes more sense because the lower word of ShadowPitch may change independently. * I moved the SMI_DEDataFormat to smi_accel.c because it seems it is a piece of code repeated many times in the driver. * At some places, it is assumed the framebuffer is at FBOffset: when using a shadow framebuffer, FBOffset is the location of the on-screen framebuffer (0 should be used). This made e.g. EXA completly useless with ShadowFB enabled (it crashed). * In the FBManager initialization, I have replaced xf86InitFBManager with xf86InitFBManagerRegion to reserve some additional space as screen fb: it's unlikely to be the case, but a less efficient alignment in the rotated mode could make the rotated mode need more memory than the unrotated one. This is not a problem with EXA as the offscreen memory parameters can be easily modified when doing the rotation. * In SMI_RefreshArea it's assumed that some DE registers are already in some state, this is specially not true when using EXA. * SMI_ValidMode rejects a rotated mode with different dimensions than the panel. This seems to work now. Signed-off-by: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
Diffstat (limited to 'src/smi_exa.c')
-rw-r--r--src/smi_exa.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/src/smi_exa.c b/src/smi_exa.c
index 575ab65..515f8a4 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -56,6 +56,8 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int sr
Bool
SMI_DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst, int dst_pitch);
+#define PIXMAP_FORMAT(pixmap) SMI_DEDataFormat(pixmap->drawable.bitsPerPixel)
+
Bool
SMI_EXAInit(ScreenPtr pScreen)
{
@@ -76,9 +78,13 @@ SMI_EXAInit(ScreenPtr pScreen)
SMI_EngineReset(pScrn);
/* Memory Manager */
- pSmi->EXADriverPtr->memoryBase = pSmi->FBBase + pSmi->FBOffset;
+ if(pSmi->shadowFB){
+ pSmi->EXADriverPtr->memoryBase = pSmi->FBBase; /* The shadow framebuffer is located at offset 0 */
+ }else{
+ pSmi->EXADriverPtr->memoryBase = pSmi->FBBase + pSmi->FBOffset;
+ }
pSmi->EXADriverPtr->memorySize = pSmi->FBReserved;
- pSmi->EXADriverPtr->offScreenBase = pSmi->width * pSmi->height * pSmi->Bpp;
+ pSmi->EXADriverPtr->offScreenBase = pScrn->displayWidth * pSmi->height * pSmi->Bpp;
/* Flags */
pSmi->EXADriverPtr->flags = EXA_TWO_BITBLT_DIRECTIONS;
@@ -150,27 +156,6 @@ SMI_EXASync(ScreenPtr pScreen, int marker)
LEAVE_PROC("SMI_EXASync");
}
-static CARD32
-SMI_DEDataFormat(PixmapPtr pPixmap) {
- CARD32 DEDataFormat = 0;
-
- switch (pPixmap->drawable.bitsPerPixel) {
- case 8:
- DEDataFormat = 0x00000000;
- break;
- case 16:
- DEDataFormat = 0x00100000;
- break;
- case 24:
- DEDataFormat = 0x00300000;
- break;
- case 32:
- DEDataFormat = 0x00200000;
- break;
- }
- return DEDataFormat;
-}
-
/* ----------------------------------------------------- EXA Copy ---------------------------------------------- */
CARD8 SMI_BltRop[16] = /* table stolen from KAA */
@@ -246,7 +231,7 @@ SMI_PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
/* Destination and Source Row Pitch */
WRITE_DPR(pSmi, 0x10, (dst_pitch << 16) | (src_pitch & 0xFFFF));
/* Drawing engine data format */
- WRITE_DPR(pSmi, 0x1C, SMI_DEDataFormat(pDstPixmap));
+ WRITE_DPR(pSmi, 0x1C, PIXMAP_FORMAT(pDstPixmap));
/* Destination and Source Base Address (offset) */
WRITE_DPR(pSmi, 0x40, src_offset);
WRITE_DPR(pSmi, 0x44, dst_offset);
@@ -378,7 +363,7 @@ SMI_PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
/* Destination Row Pitch */
WRITE_DPR(pSmi, 0x10, (dst_pitch << 16) | (dst_pitch & 0xFFFF));
/* Drawing engine data format */
- WRITE_DPR(pSmi, 0x1C, SMI_DEDataFormat(pPixmap));
+ WRITE_DPR(pSmi, 0x1C, PIXMAP_FORMAT(pPixmap));
/* Source and Destination Base Address (offset) */
WRITE_DPR(pSmi, 0x40, dst_offset);
WRITE_DPR(pSmi, 0x44, dst_offset);
@@ -512,7 +497,7 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
/* Source and Destination Row Pitch */
WRITE_DPR(pSmi, 0x10, (dst_pitch << 16) | (source_pitch & 0xFFFF));
/* Drawing engine data format */
- WRITE_DPR(pSmi, 0x1C, SMI_DEDataFormat(pDst));
+ WRITE_DPR(pSmi, 0x1C,PIXMAP_FORMAT(pDst));
/* Source and Destination Base Address (offset) */
WRITE_DPR(pSmi, 0x40, 0);
WRITE_DPR(pSmi, 0x44, dst_offset);