summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/smi.h5
-rw-r--r--src/smi_accel.c52
-rw-r--r--src/smi_driver.c191
-rw-r--r--src/smi_exa.c37
-rw-r--r--src/smi_shadow.c60
5 files changed, 217 insertions, 128 deletions
diff --git a/src/smi.h b/src/smi.h
index c785fa0..30ed679 100644
--- a/src/smi.h
+++ b/src/smi.h
@@ -220,7 +220,9 @@ typedef struct
Bool shadowFB; /* Flag if shadow buffer is
used */
int rotate; /* Rotation flags */
- int ShadowPitch; /* Pitch of shadow buffer */
+ Bool randrRotation; /* Allow RandR rotation */
+ CARD32 screenStride; /* Stride of the on-screen framebuffer */
+ /* when using a shadow fb*/
int ShadowWidthBytes; /* Width of shadow
buffer in bytes */
int ShadowWidth; /* Width of shadow buffer in
@@ -350,6 +352,7 @@ void SMI_GEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file);
void SMI_EngineReset(ScrnInfoPtr);
void SMI_SetClippingRectangle(ScrnInfoPtr, int, int, int, int);
void SMI_DisableClipping(ScrnInfoPtr);
+CARD32 SMI_DEDataFormat(int bpp);
/* smi_hwcurs.c */
Bool SMI_HWCursorInit(ScreenPtr pScrn);
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;
+}
+
diff --git a/src/smi_driver.c b/src/smi_driver.c
index 6e4de86..ea9c5da 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -84,6 +84,7 @@ static unsigned int SMI_ddc1Read(ScrnInfoPtr pScrn);
static void SMI_FreeScreen(int ScrnIndex, int flags);
static void SMI_ProbeDDC(ScrnInfoPtr pScrn, int index);
static void SMI_DetectPanelSize(ScrnInfoPtr pScrn);
+static Bool SMI_DriverFunc(ScrnInfoPtr pScrn , xorgDriverFuncOp op,pointer ptr);
#define SILICONMOTION_NAME "Silicon Motion"
@@ -164,6 +165,7 @@ typedef enum
OPTION_ZOOMONLCD,
OPTION_DUALHEAD,
OPTION_ACCELMETHOD,
+ OPTION_RANDRROTATION,
NUMBER_OF_OPTIONS
} SMIOpts;
@@ -190,6 +192,7 @@ static const OptionInfoRec SMIOptions[] =
{ OPTION_ZOOMONLCD, "ZoomOnLCD", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DUALHEAD, "Dualhead", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE },
+ { OPTION_RANDRROTATION, "RandRRotation", OPTV_BOOLEAN, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
@@ -696,6 +699,11 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
pSmi->MCLK = 0;
}
+ if(!pSmi->randrRotation && xf86GetOptValBool(pSmi->Options, OPTION_RANDRROTATION, &pSmi->randrRotation)){
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "RandRRotation %s.\n",
+ pSmi->randrRotation ? "enabled" : "disabled");
+ }
+
from = X_DEFAULT;
pSmi->hwcursor = TRUE;
if (xf86GetOptValBool(pSmi->Options, OPTION_HWCURSOR, &pSmi->hwcursor)) {
@@ -705,14 +713,24 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
pSmi->hwcursor = FALSE;
from = X_CONFIG;
}
- xf86DrvMsg(pScrn->scrnIndex, from, "Using %s Cursor\n",
- pSmi->hwcursor ? "Hardware" : "Software");
+ if(pSmi->hwcursor && pSmi->randrRotation){
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "RandRRotation enabled: Disabling hardware cursor.\n");
+ pSmi->hwcursor = FALSE;
+ }else{
+ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s Cursor\n",
+ pSmi->hwcursor ? "Hardware" : "Software");
+ }
if (xf86GetOptValBool(pSmi->Options, OPTION_SHADOW_FB, &pSmi->shadowFB)) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShadowFB %s.\n",
pSmi->shadowFB ? "enabled" : "disabled");
}
+ if(!pSmi->shadowFB && pSmi->randrRotation){
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "RandRRotation enabled: Enabling ShadowFB.\n");
+ pSmi->shadowFB = TRUE;
+ }
+
#if 1 /* PDR#932 */
if ((pScrn->depth == 8) || (pScrn->depth == 16))
#endif /* PDR#932 */
@@ -1230,8 +1248,8 @@ SMI_EnterVT(int scrnIndex, int flags)
box.x1 = 0;
box.y1 = 0;
- box.x2 = pScrn->virtualY;
- box.y2 = pScrn->virtualX;
+ box.x2 = pSmi->width;
+ box.y2 = pSmi->height;
if (pSmi->Chipset == SMI_COUGAR3DR) {
SMI_RefreshArea730(pScrn, 1, &box);
} else {
@@ -2051,6 +2069,12 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Zero the frame buffer, #258 */
memset(pSmi->FBBase, 0, pSmi->videoRAMBytes);
+
+ /* Callback for RandR rotation */
+ pScrn->DriverFunc = SMI_DriverFunc;
+ if(pSmi->randrRotation)
+ pSmi->rotate=0;
+
/* Initialize the first mode */
if (!SMI_ModeInit(pScrn, pScrn->currentMode)) {
LEAVE_PROC("SMI_ScreenInit");
@@ -2111,8 +2135,9 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!pSmi->useEXA) {
int numLines, maxLines;
BoxRec AvailFBArea;
-
- maxLines = pSmi->FBReserved / (pSmi->width * pSmi->Bpp);
+ RegionRec AvailFBRegion;
+
+ maxLines = pSmi->FBReserved / (pScrn->displayWidth * pSmi->Bpp);
if (pSmi->rotate) {
numLines = maxLines;
} else {
@@ -2129,14 +2154,20 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
AvailFBArea.x1 = 0;
- AvailFBArea.y1 = 0;
- AvailFBArea.x2 = pSmi->width;
+ if(pSmi->randrRotation) /* The rotated mode could need more memory */
+ AvailFBArea.y1= max(((pScrn->virtualX * pSmi->Bpp + 15) & ~15)*pScrn->virtualY,
+ ((pScrn->virtualY * pSmi->Bpp + 15) & ~15)*pScrn->virtualX)/(pScrn->virtualX*pSmi->Bpp);
+ else
+ AvailFBArea.y1 = pScrn->virtualY;
+ AvailFBArea.x2 = pScrn->virtualX;
AvailFBArea.y2 = numLines;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"FrameBuffer Box: %d,%d - %d,%d\n",
AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2,
AvailFBArea.y2);
- xf86InitFBManager(pScreen, &AvailFBArea);
+ REGION_INIT(pScreen,&AvailFBRegion,&AvailFBArea,1);
+ xf86InitFBManagerRegion(pScreen, &AvailFBRegion);
+ REGION_UNINIT(pScreen,&AvailFBRegion);
}
/* end CZ */
@@ -2239,7 +2270,7 @@ SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
SMIPtr pSmi = SMIPTR(pScrn);
- int width, height, displayWidth;
+ int width, height;
int bytesPerPixel = pScrn->bitsPerPixel / 8;
int xDpi, yDpi;
int ret;
@@ -2251,26 +2282,21 @@ SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen)
height = pScrn->virtualX;
xDpi = pScrn->yDpi;
yDpi = pScrn->xDpi;
- displayWidth = ((width * bytesPerPixel + 15) & ~15) / bytesPerPixel;
} else {
width = pScrn->virtualX;
height = pScrn->virtualY;
xDpi = pScrn->xDpi;
yDpi = pScrn->yDpi;
- displayWidth = pScrn->displayWidth;
}
+ pScrn->displayWidth = ((width * bytesPerPixel + 15) & ~15) / bytesPerPixel;
if (pSmi->shadowFB) {
pSmi->ShadowWidth = width;
pSmi->ShadowHeight = height;
- pSmi->ShadowWidthBytes = (width * bytesPerPixel + 15) & ~15;
- if (bytesPerPixel == 3) {
- pSmi->ShadowPitch = ((height * 3) << 16)
- | pSmi->ShadowWidthBytes;
- } else {
- pSmi->ShadowPitch = (height << 16)
- | (pSmi->ShadowWidthBytes / bytesPerPixel);
- }
+ pSmi->ShadowWidthBytes = pScrn->displayWidth*bytesPerPixel;
+ pSmi->screenStride = ((pScrn->virtualX * pSmi->Bpp + 15) & ~15)/ pSmi->Bpp;
+ if(pScrn->bitsPerPixel==24)
+ pSmi->screenStride *= 3;
pSmi->saveBufferSize = pSmi->ShadowWidthBytes * pSmi->ShadowHeight;
pSmi->FBReserved -= pSmi->saveBufferSize;
@@ -2282,10 +2308,9 @@ SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen)
pScrn->fbOffset = pSmi->FBOffset + pSmi->fbMapOffset;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Shadow: width=%d height=%d "
- "offset=0x%08lX pitch=0x%08X\n",
+ "offset=0x%08lX\n",
pSmi->ShadowWidth, pSmi->ShadowHeight,
- (unsigned long)pSmi->FBOffset,
- pSmi->ShadowPitch);
+ (unsigned long)pSmi->FBOffset);
} else {
pSmi->FBOffset = 0;
pScrn->fbOffset = pSmi->FBOffset + pSmi->fbMapOffset;
@@ -2297,14 +2322,14 @@ SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen)
*/
DEBUG((VERBLEV, "\tInitializing FB @ 0x%08X for %dx%d (%d)\n",
- pSmi->FBBase, width, height, displayWidth));
+ pSmi->FBBase, width, height, pScrn->displayWidth));
switch (pScrn->bitsPerPixel) {
case 8:
case 16:
case 24:
case 32:
ret = fbScreenInit(pScreen, pSmi->FBBase, width, height, xDpi,
- yDpi, displayWidth, pScrn->bitsPerPixel);
+ yDpi, pScrn->displayWidth, pScrn->bitsPerPixel);
break;
default:
xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) "
@@ -2368,13 +2393,13 @@ SMI_ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
}
#if 1 /* PDR#944 */
- if (pSmi->rotate) {
- if ((mode->HDisplay != pSmi->lcdWidth) ||
- (mode->VDisplay != pSmi->lcdHeight)) {
- LEAVE_PROC("SMI_ValidMode");
- return MODE_PANEL;
- }
- }
+/* if (pSmi->rotate) { */
+/* if ((mode->HDisplay != pSmi->lcdWidth) || */
+/* (mode->VDisplay != pSmi->lcdHeight)) { */
+/* LEAVE_PROC("SMI_ValidMode"); */
+/* return MODE_PANEL; */
+/* } */
+/* } */
#endif
LEAVE_PROC("SMI_ValidMode");
@@ -2393,23 +2418,11 @@ SMI_DPRInit(ScrnInfoPtr pScrn)
SMIRegPtr new = &pSmi->ModeReg;
/* Set DPR registers */
- 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) {
@@ -2433,8 +2446,13 @@ SMI_DPRInit(ScrnInfoPtr pScrn)
new->DPR2C = 0;
new->DPR30 = 0;
new->DPR3C = (pSmi->Stride << 16) | pSmi->Stride;
- new->DPR40 = pSmi->FBOffset >> 3;
- new->DPR44 = pSmi->FBOffset >> 3;
+ if(pSmi->shadowFB){
+ new->DPR40 = 0;
+ new->DPR44 = 0; /* The shadow framebuffer is located at offset 0 */
+ }else{
+ new->DPR40 = pSmi->FBOffset >> 3;
+ new->DPR44 = pSmi->FBOffset >> 3;
+ }
}
@@ -2804,6 +2822,8 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
SMI_WriteMode(pScrn, vganew, new);
/* Adjust the viewport */
+ pScrn->frameX1=pScrn->frameX0 + pScrn->currentMode->HDisplay - 1;
+ pScrn->frameY1=pScrn->frameY0 + pScrn->currentMode->VDisplay - 1;
SMI_AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
LEAVE_PROC("SMI_ModeInit");
@@ -3361,3 +3381,72 @@ SMI_ddc1(int scrnIndex)
return success;
}
+static void SMI_SetShadowDimensions(ScrnInfoPtr pScrn,int width,int height){
+ SMIPtr pSmi = SMIPTR(pScrn);
+ pScrn->displayWidth=width;
+ pSmi->ShadowWidth = pSmi->width = width;
+ pSmi->ShadowHeight = pSmi->height= height;
+ pSmi->ShadowWidthBytes = width * pSmi->Bpp;
+ pSmi->saveBufferSize = pSmi->ShadowWidthBytes * height;
+ pSmi->Stride = ((pScrn->displayWidth * pSmi->Bpp + 15) & ~15) / pSmi->Bpp;
+ if(pScrn->bitsPerPixel==24)
+ pSmi->Stride*=3;
+ pScrn->pScreen->ModifyPixmapHeader(pScrn->pScreen->GetScreenPixmap(pScrn->pScreen),width,height,-1,-1,width*pSmi->Bpp,NULL);
+ if(pSmi->EXADriverPtr){
+ pSmi->EXADriverPtr->offScreenBase = pScrn->displayWidth * pSmi->height * pSmi->Bpp;
+ }
+}
+
+static Bool
+SMI_DriverFunc(ScrnInfoPtr pScrn , xorgDriverFuncOp op,pointer ptr){
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_DriverFunc");
+ if(op==RR_GET_INFO){
+ if(pSmi->randrRotation)
+ ((xorgRRRotation*)ptr)->RRRotations = RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_270;
+ else
+ ((xorgRRRotation*)ptr)->RRRotations = RR_Rotate_0;
+
+ }else if(op==RR_SET_CONFIG){
+ if(!pSmi->randrRotation){
+ LEAVE_PROC("SMI_DriverFunc");
+ return FALSE;
+ }
+
+ xorgRRConfig rconf= ((xorgRRRotation*)ptr)->RRConfig;
+ if(rconf.rotation==RR_Rotate_0){
+ if(pSmi->rotate!=0){
+ if(pSmi->PointerMoved != NULL){
+ pScrn->PointerMoved = pSmi->PointerMoved;
+ pSmi->PointerMoved = NULL;
+ }
+ SMI_SetShadowDimensions(pScrn,rconf.width,rconf.height);
+ }
+ pSmi->rotate=0;
+ }else if(rconf.rotation==RR_Rotate_90 || rconf.rotation==RR_Rotate_270){
+ if(pSmi->rotate==0){
+ if(pSmi->PointerMoved == NULL){
+ pSmi->PointerMoved = pScrn->PointerMoved;
+ pScrn->PointerMoved = SMI_PointerMoved;
+ }
+ SMI_SetShadowDimensions(pScrn,rconf.height,rconf.width);
+ }
+
+ if(rconf.rotation==RR_Rotate_90)
+ pSmi->rotate=SMI_ROTATE_CCW;
+ else
+ pSmi->rotate=SMI_ROTATE_CW;
+
+ }else{
+ LEAVE_PROC("SMI_DriverFunc");
+ return FALSE;
+ }
+ }else{
+ LEAVE_PROC("SMI_DriverFunc");
+ return FALSE;
+ }
+
+ LEAVE_PROC("SMI_DriverFunc");
+ return TRUE;
+}
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);
diff --git a/src/smi_shadow.c b/src/smi_shadow.c
index dcfa16a..113a2ec 100644
--- a/src/smi_shadow.c
+++ b/src/smi_shadow.c
@@ -68,17 +68,20 @@ void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
return;
}
- if (pSmi->rotate) {
- /* IF we need to do rotation, setup the hardware here. */
- WaitIdleEmpty();
- WRITE_DPR(pSmi, 0x10, pSmi->ShadowPitch);
- WRITE_DPR(pSmi, 0x3C, pSmi->ShadowPitch);
- WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3);
- }
+ WaitIdleEmpty();
+ if(pSmi->useEXA) /* Some other function may have set SMI_QUICK_START */
+ WRITE_DPR(pSmi, 0x0C, 0);
+
+ WRITE_DPR(pSmi, 0x10, ((pSmi->screenStride) << 16) | (pSmi->Stride));
+ WRITE_DPR(pSmi, 0x3C, ((pSmi->screenStride) << 16) | (pSmi->Stride));
+
+ WRITE_DPR(pSmi, 0x40, 0); /*Source offset = Shadow FB*/
+ WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); /* Destination = Screen FB*/
+
+ WRITE_DPR(pSmi, 0x1C, SMI_DEDataFormat(pScrn->bitsPerPixel));
/* #672 */
if (pSmi->ClipTurnedOn) {
- WaitQueue(1);
WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft);
pSmi->ClipTurnedOn = FALSE;
}
@@ -159,13 +162,10 @@ void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
pbox++;
}
- if (pSmi->rotate) {
- /* If we did a rotation, we need to restore the hardware state here. */
- WaitIdleEmpty();
- WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride);
- WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride);
- WRITE_DPR(pSmi, 0x44, 0);
- }
+ WaitIdleEmpty();
+ WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride);
+ WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride);
+ WRITE_DPR(pSmi, 0x44, 0);
LEAVE_PROC("SMI_RefreshArea");
}
@@ -187,17 +187,20 @@ void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
return;
}
- if (pSmi->rotate) {
- /* IF we need to do rotation, setup the hardware here. */
- WaitIdleEmpty();
- WRITE_DPR(pSmi, 0x10, pSmi->ShadowPitch);
- WRITE_DPR(pSmi, 0x3C, pSmi->ShadowPitch);
- WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3);
- }
+ WaitIdleEmpty();
+ if(pSmi->useEXA) /* Some other function may have set SMI_QUICK_START */
+ WRITE_DPR(pSmi, 0x0C, 0);
+
+ WRITE_DPR(pSmi, 0x10, ((pSmi->screenStride) << 16) | (pSmi->Stride));
+ WRITE_DPR(pSmi, 0x3C, ((pSmi->screenStride) << 16) | (pSmi->Stride));
+
+ WRITE_DPR(pSmi, 0x40, 0); /*Source offset = Shadow FB*/
+ WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); /* Destination = Screen FB*/
+
+ WRITE_DPR(pSmi, 0x1C, SMI_DEDataFormat(pScrn->bitsPerPixel));
/* #672 */
if (pSmi->ClipTurnedOn) {
- WaitQueue(1);
WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft);
pSmi->ClipTurnedOn = FALSE;
}
@@ -300,13 +303,10 @@ void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
pbox++;
}
- if (pSmi->rotate) {
- /* If we did a rotation, we need to restore the hardware state here. */
- WaitIdleEmpty();
- WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride);
- WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride);
- WRITE_DPR(pSmi, 0x44, 0);
- }
+ WaitIdleEmpty();
+ WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride);
+ WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride);
+ WRITE_DPR(pSmi, 0x44, 0);
LEAVE_PROC("SMI_RefreshArea730");
}