[Xorg-driver-geode] [PATCH 2/2] Fix rotation with newer Xserver versions without requiring extra video memory
Cui, Hunk
Hunk.Cui at amd.com
Thu Jul 1 00:43:34 PDT 2010
From: Hunk Cui <Hunk Cui at amd.com>
*Redistribute the Graphic memory (include in MemorySize).
*Prepare allocate the shadow buffer.
*Rotateeddata has to be allocated between memoryBase and memorySize.
*Ubuntu Bugzilla #377929
Signed-off-by: Hunk Cui <Hunk.Cui at amd.com>
---
src/geode.h | 4 ++++
src/lx_display.c | 13 ++++---------
src/lx_memory.c | 24 +++++++++++++++++++-----
3 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/src/geode.h b/src/geode.h
index 8fe67b5..7cbe4e5 100644
--- a/src/geode.h
+++ b/src/geode.h
@@ -221,6 +221,10 @@ typedef struct _geodeRec
unsigned int exaBfrOffset;
unsigned int exaBfrSz;
+ /* Rotate structures */
+ unsigned int RotateBfrOffset; /*Need for Rotate */
+ unsigned int RotateBfrSz;
+
/* Other structures */
EntityInfoPtr pEnt;
diff --git a/src/lx_display.c b/src/lx_display.c
index 856ad95..ea92278 100644
--- a/src/lx_display.c
+++ b/src/lx_display.c
@@ -368,15 +368,12 @@ lx_crtc_shadow_allocate(xf86CrtcPtr crtc, int
width, int height)
{
ScrnInfoPtr pScrni = crtc->scrn;
GeodePtr pGeode = GEODEPTR(pScrni);
- LXCrtcPrivatePtr lx_crtc = crtc->driver_private;
unsigned int rpitch, size;
rpitch = pScrni->displayWidth * (pScrni->bitsPerPixel / 8);
size = rpitch * height;
- lx_crtc->rotate_mem = GeodeAllocOffscreen(pGeode, size, 4);
-
- if (lx_crtc->rotate_mem == NULL) {
+ if (pGeode->RotateBfrOffset == NULL) {
xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
"Couldn't allocate the shadow memory for rotation\n");
xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
@@ -386,8 +383,8 @@ lx_crtc_shadow_allocate(xf86CrtcPtr crtc, int width,
int height)
return NULL;
}
- memset(pGeode->FBBase + lx_crtc->rotate_mem->offset, 0, size);
- return pGeode->FBBase + lx_crtc->rotate_mem->offset;
+ memset(pGeode->FBBase + pGeode->RotateBfrOffset, 0, size);
+ return pGeode->FBBase + pGeode->RotateBfrOffset;
}
static PixmapPtr
@@ -417,15 +414,13 @@ lx_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr
rpixmap, void *data)
{
ScrnInfoPtr pScrni = crtc->scrn;
GeodeRec *pGeode = GEODEPTR(pScrni);
- LXCrtcPrivatePtr lx_crtc = crtc->driver_private;
if (rpixmap)
FreeScratchPixmapHeader(rpixmap);
if (data) {
gp_wait_until_idle();
- GeodeFreeOffscreen(pGeode, lx_crtc->rotate_mem);
- lx_crtc->rotate_mem = NULL;
+ memset(data, 0, pGeode->RotateBfrSz);
}
}
diff --git a/src/lx_memory.c b/src/lx_memory.c
index 3f853d4..782faaa 100644
--- a/src/lx_memory.c
+++ b/src/lx_memory.c
@@ -236,11 +236,21 @@ LXInitOffscreen(ScrnInfoPtr pScrni)
pGeode->pExa->offScreenBase = 0;
pGeode->pExa->memorySize = 0;
+ /* Advance prepare allocate the size of a shadow buffer */
+ size = pScrni->virtualX *
+ (pScrni->virtualY * (pScrni->bitsPerPixel >> 3));
+
+ ptr = GeodeAllocOffscreen(pGeode, size, 4);
+ if (ptr != NULL) {
+ pGeode->RotateBfrOffset = ptr->offset;
+ pGeode->RotateBfrSz = ptr->size;
+ }
+
/* This might cause complaints - in order to avoid using
xorg.conf as much as possible, we make assumptions about
what a "default" memory map would look like. After
discussion, we agreed that the default driver should assume
- the user will want to use rotation and video overlays, and
+ the user will want to use video overlays, and
EXA will get whatever is leftover.
*/
@@ -250,10 +260,6 @@ LXInitOffscreen(ScrnInfoPtr pScrni)
/* Deduct the maxmimum size of a video overlay */
size -= 0x200000;
- /* Deduct the probable size of a shadow buffer */
- size -= pScrni->virtualX *
- (pScrni->virtualY * (pScrni->bitsPerPixel >> 3));
-
/* Align the size to a K boundary */
size &= ~1023;
@@ -287,6 +293,14 @@ LXInitOffscreen(ScrnInfoPtr pScrni)
xf86DrvMsg(pScrni->scrnIndex, X_INFO, " Cursor: 0x%x bytes\n",
LX_CURSOR_HW_WIDTH * 4 * LX_CURSOR_HW_HEIGHT);
+ if (pGeode->exaBfrSz)
+ xf86DrvMsg(pScrni->scrnIndex, X_INFO, " ExaBfrSz: 0x%x
bytes\n",
+ pGeode->exaBfrSz);
+
+ if (pGeode->RotateBfrSz)
+ xf86DrvMsg(pScrni->scrnIndex, X_INFO, " RotateBfrSz: 0x%x
bytes\n",
+ pGeode->RotateBfrSz);
+
if (pGeode->pExa->offScreenBase)
xf86DrvMsg(pScrni->scrnIndex, X_INFO, " EXA: 0x%x bytes\n",
(unsigned int)(pGeode->pExa->memorySize -
--
1.6.0.6
More information about the Xorg-driver-geode
mailing list