summaryrefslogtreecommitdiff
path: root/src/smi_accel.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_accel.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_accel.c')
-rw-r--r--src/smi_accel.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/src/smi_accel.c b/src/smi_accel.c
index 5cdadc0..750b896 100644
--- a/src/smi_accel.c
+++ b/src/smi_accel.c
@@ -83,24 +83,10 @@ SMI_EngineReset(ScrnInfoPtr pScrn)
ENTER_PROC("SMI_EngineReset");
- pSmi->Stride = (pSmi->width * pSmi->Bpp + 15) & ~15;
-
- switch (pScrn->bitsPerPixel) {
- case 8:
- DEDataFormat = 0x00000000;
- break;
- case 16:
- pSmi->Stride >>= 1;
- DEDataFormat = 0x00100000;
- break;
- case 24:
- DEDataFormat = 0x00300000;
- break;
- case 32:
- pSmi->Stride >>= 2;
- DEDataFormat = 0x00200000;
- break;
- }
+ pSmi->Stride = ((pSmi->width * pSmi->Bpp + 15) & ~15) / pSmi->Bpp;
+ if(pScrn->bitsPerPixel==24)
+ pSmi->Stride *= 3;
+ DEDataFormat = SMI_DEDataFormat(pScrn->bitsPerPixel);
for (i = 0; i < sizeof(xyAddress) / sizeof(xyAddress[0]); i++) {
if (pSmi->rotate) {
@@ -122,8 +108,13 @@ SMI_EngineReset(ScrnInfoPtr pScrn)
WRITE_DPR(pSmi, 0x24, 0xFFFFFFFF);
WRITE_DPR(pSmi, 0x28, 0xFFFFFFFF);
WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride);
- WRITE_DPR(pSmi, 0x40, pSmi->FBOffset >> 3);
- WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3);
+ if(pSmi->shadowFB){
+ WRITE_DPR(pSmi, 0x40, 0);
+ WRITE_DPR(pSmi, 0x44, 0); /* The shadow framebuffer is located at offset 0 */
+ }else{
+ WRITE_DPR(pSmi, 0x40, pSmi->FBOffset >> 3);
+ WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3);
+ }
SMI_DisableClipping(pScrn);
@@ -200,3 +191,24 @@ SMI_DisableClipping(ScrnInfoPtr pScrn)
LEAVE_PROC("SMI_DisableClipping");
}
+CARD32
+SMI_DEDataFormat(int bpp) {
+ CARD32 DEDataFormat = 0;
+
+ switch (bpp) {
+ case 8:
+ DEDataFormat = 0x00000000;
+ break;
+ case 16:
+ DEDataFormat = 0x00100000;
+ break;
+ case 24:
+ DEDataFormat = 0x00300000;
+ break;
+ case 32:
+ DEDataFormat = 0x00200000;
+ break;
+ }
+ return DEDataFormat;
+}
+