diff options
author | Jordan Crouse <jordan.crouse@amd.com> | 2007-05-02 14:38:24 -0600 |
---|---|---|
committer | Jordan Crouse <jordan.crouse@amd.com> | 2007-05-02 14:39:27 -0600 |
commit | 4dfae85222779694e162c8bb942b7587c2600592 (patch) | |
tree | e77734f15260d8cc3b970f063dfc027a2eeed4b4 | |
parent | dc5db7c4d68268377cd99f7c8e4bc54556923ed1 (diff) |
Solve several vexing issues with RandR:
* Incorrect rendering while rotated
* Mouse was incorrectly drawn for 90 and 270
* subsequent RandR commands were killing the rotated stride
-rw-r--r-- | src/amd_lx_cursor.c | 8 | ||||
-rw-r--r-- | src/amd_lx_driver.c | 6 | ||||
-rw-r--r-- | src/amd_lx_rotate.c | 72 |
3 files changed, 48 insertions, 38 deletions
diff --git a/src/amd_lx_cursor.c b/src/amd_lx_cursor.c index e385484..f66f62d 100644 --- a/src/amd_lx_cursor.c +++ b/src/amd_lx_cursor.c @@ -101,7 +101,7 @@ LXSetCursorPosition(ScrnInfoPtr pScrni, int x, int y) hsx= 31; hsy = 31; break; - case RR_Rotate_90: + case RR_Rotate_270: newX = savey; newY = pScrni->pScreen->width - savex; hsx= 31; hsy = 0; @@ -113,7 +113,7 @@ LXSetCursorPosition(ScrnInfoPtr pScrni, int x, int y) hsx = 0; hsy = 0; break; - case RR_Rotate_270: + case RR_Rotate_90: newX = pScrni->pScreen->height - savey; newY = savex; hsx= 0; hsy= 31; @@ -161,7 +161,7 @@ LXLoadCursorImage(ScrnInfoPtr pScrni, unsigned char *src) newX = x; newY = y; break; - case RR_Rotate_90: + case RR_Rotate_270: newX = y; newY = 31 - x; break; @@ -169,7 +169,7 @@ LXLoadCursorImage(ScrnInfoPtr pScrni, unsigned char *src) newX = 31 - x; newY = 31 - y; break; - case RR_Rotate_270: + case RR_Rotate_90: newX = 31 - y; newY = x; break; diff --git a/src/amd_lx_driver.c b/src/amd_lx_driver.c index 3756add..e78504b 100644 --- a/src/amd_lx_driver.c +++ b/src/amd_lx_driver.c @@ -244,9 +244,11 @@ LXAllocateMemory(ScreenPtr pScrn, ScrnInfoPtr pScrni, int rotate) pGeode->displayPitch = ((pScrni->virtualX + 3) & ~3) * (pScrni->bitsPerPixel >> 3); - pGeode->Pitch = pGeode->displayPitch; pGeode->displayWidth = pGeode->displayPitch / bytpp; - pScrni->displayWidth = pGeode->displayWidth; + + + /* Sets pGeode->Pitch and pScrni->displayWidth based on the rotate settings */ + LXSetRotatePitch(pScrni); fbavail = pGeode->FBAvail - GP3_SCRATCH_BUFFER_SIZE; diff --git a/src/amd_lx_rotate.c b/src/amd_lx_rotate.c index a9b8f28..191dfda 100644 --- a/src/amd_lx_rotate.c +++ b/src/amd_lx_rotate.c @@ -68,8 +68,11 @@ LXUpdateFunc(ScreenPtr pScreen, shadowBufPtr pBuf) /* Set up the blt */ + gp_wait_until_idle(); gp_declare_blt(0); + gp_set_bpp(pScrni->bitsPerPixel); + switch(shaBpp) { case 8: gp_set_source_format(CIMGP_SOURCE_FMT_3_3_2); @@ -79,12 +82,12 @@ LXUpdateFunc(ScreenPtr pScreen, shadowBufPtr pBuf) gp_set_source_format(CIMGP_SOURCE_FMT_0_5_6_5); break; + case 24: case 32: gp_set_source_format(CIMGP_SOURCE_FMT_8_8_8_8); break; } - gp_set_bpp(pScrni->bitsPerPixel); gp_set_raster_operation(0xCC); gp_write_parameters(); @@ -128,12 +131,44 @@ LXUpdateFunc(ScreenPtr pScreen, shadowBufPtr pBuf) dstOffset = pGeode->displayOffset + (dy * pGeode->displayPitch) + (dx * (pScrni->bitsPerPixel >> 3)); - gp_declare_blt(0); + gp_declare_blt(CIMGP_BLTFLAGS_HAZARD); gp_set_strides(pGeode->displayPitch, pGeode->Pitch); gp_rotate_blt(dstOffset, srcOffset, w, h, degrees); + pbox++; } } +Bool LXSetRotatePitch(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + switch (pGeode->rotation) { + case RR_Rotate_0: + pScrni->displayWidth = pGeode->displayWidth; + break; + + case RR_Rotate_90: + pScrni->displayWidth = pScrni->pScreen->width; + break; + + case RR_Rotate_180: + pScrni->displayWidth = pGeode->displayWidth; + break; + + case RR_Rotate_270: + pScrni->displayWidth = pScrni->pScreen->width; + break; + } + + /* Set the new drawing pitch */ + + if (pGeode->Compression) + pGeode->Pitch = LXCalculatePitchBytes(pScrni->displayWidth, + pScrni->bitsPerPixel); + else + pGeode->Pitch = (pScrni->displayWidth * + (pScrni->bitsPerPixel >> 3)); +} + Bool LXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode) { @@ -154,36 +189,7 @@ LXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode) shadowRemove(pScrni->pScreen, NULL); - switch (pGeode->rotation) { - case RR_Rotate_0: - ErrorF("Rotate to 0 degrees\n"); - pScrni->displayWidth = pGeode->displayWidth; - break; - - case RR_Rotate_90: - ErrorF("Rotate to 90 degrees\n"); - pScrni->displayWidth = pScrni->pScreen->width; - break; - - case RR_Rotate_180: - ErrorF("Rotate to 180 degrees\n"); - pScrni->displayWidth = pGeode->displayWidth; - break; - - case RR_Rotate_270: - ErrorF("Rotate to 270 degrees\n"); - pScrni->displayWidth = pScrni->pScreen->width; - break; - } - - /* Set the new drawing pitch */ - - if (pGeode->Compression) - pGeode->Pitch = LXCalculatePitchBytes(pScrni->displayWidth, - pScrni->bitsPerPixel); - else - pGeode->Pitch = (pScrni->displayWidth * - (pScrni->bitsPerPixel >> 3)); + LXSetRotatePitch(pScrni); if (pGeode->rotation != RR_Rotate_0) { @@ -202,6 +208,8 @@ LXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode) else pScrni->fbOffset = pGeode->shadowOffset; + vg_set_display_offset(pScrni->fbOffset); + pScrni->pScreen->ModifyPixmapHeader(pPixmap, pScrni->pScreen->width, pScrni->pScreen->height, |