[PATCH 2/9] [kdrive] Move Xephyr-specific fields out of KdScreenInfo

Mikhail Gusarov dottedmag at dottedmag.net
Sat Jan 2 06:32:52 PST 2010


memory_base, memory_size, off_screen_base fields in
KdScreenInfo are used only by fake EXA in Xephyr. Move
them into Xephyr, cleanup Xfake and Xfbdev.

Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
 hw/kdrive/ephyr/ephyr.c      |   31 ++++++++++++++++++-------------
 hw/kdrive/ephyr/ephyr.h      |    2 ++
 hw/kdrive/ephyr/ephyr_draw.c |    7 ++++---
 hw/kdrive/fake/fake.c        |    3 ---
 hw/kdrive/fbdev/fbdev.c      |    4 ----
 hw/kdrive/src/kdrive.h       |    3 ---
 6 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index b6a2ada..93118a8 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -220,6 +220,22 @@ ephyrWindowLinear (ScreenPtr	pScreen,
   return priv->base + row * priv->bytes_per_line + offset;
 }
 
+/**
+ * Figure out display buffer size. If fakexa is enabled, allocate a larger
+ * buffer so that fakexa has space to put offscreen pixmaps.
+ */
+int
+ephyrBufferHeight(KdScreenInfo *screen)
+{
+    int buffer_height;
+    if (ephyrFuncs.initAccel == NULL)
+	buffer_height = screen->height;
+    else
+	buffer_height = 3 * screen->height;
+    return buffer_height;
+}
+
+
 Bool
 ephyrMapFramebuffer (KdScreenInfo *screen)
 {
@@ -235,22 +251,11 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
   KdSetPointerMatrix (&m);
   
   priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
-  
-  /* point the framebuffer to the data in an XImage */
-  /* If fakexa is enabled, allocate a larger buffer so that fakexa has space to
-   * put offscreen pixmaps.
-   */
-  if (ephyrFuncs.initAccel == NULL)
-    buffer_height = screen->height;
-  else
-    buffer_height = 3 * screen->height;
+
+  buffer_height = ephyrBufferHeight(screen);
 
   priv->base = hostx_screen_init (screen, screen->width, screen->height, buffer_height);
 
-  screen->memory_base  = (CARD8 *) (priv->base);
-  screen->memory_size  = priv->bytes_per_line * buffer_height;
-  screen->off_screen_base = priv->bytes_per_line * screen->height;
-  
   if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All))
     {
       scrpriv->shadow = FALSE;
diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h
index f5ea144..cb5e4b5 100644
--- a/hw/kdrive/ephyr/ephyr.h
+++ b/hw/kdrive/ephyr/ephyr.h
@@ -180,6 +180,8 @@ extern Bool ephyrCursorInit(ScreenPtr pScreen);
 
 extern void ephyrCursorEnable(ScreenPtr pScreen);
 
+extern int ephyrBufferHeight(KdScreenInfo *screen);
+
 /* ephyr_draw.c */
 
 Bool
diff --git a/hw/kdrive/ephyr/ephyr_draw.c b/hw/kdrive/ephyr/ephyr_draw.c
index 7b579c2..f9fac80 100644
--- a/hw/kdrive/ephyr/ephyr_draw.c
+++ b/hw/kdrive/ephyr/ephyr_draw.c
@@ -428,6 +428,7 @@ ephyrDrawInit(ScreenPtr pScreen)
     KdScreenPriv(pScreen);
     KdScreenInfo *screen = pScreenPriv->screen;
     EphyrScrPriv *scrpriv = screen->driver;
+    EphyrPriv *priv = screen->card->driver;
     EphyrFakexaPriv *fakexa;
     Bool success;
 
@@ -441,9 +442,9 @@ ephyrDrawInit(ScreenPtr pScreen)
 	return FALSE;
     }
 
-    fakexa->exa->memoryBase = screen->memory_base;
-    fakexa->exa->memorySize = screen->memory_size;
-    fakexa->exa->offScreenBase = screen->off_screen_base;
+    fakexa->exa->memoryBase = (CARD8 *) (priv->base);
+    fakexa->exa->memorySize = priv->bytes_per_line * ephyrBufferHeight(screen);
+    fakexa->exa->offScreenBase = priv->bytes_per_line * screen->height;
 
     /* Since we statically link against EXA, we shouldn't have to be smart about
      * versioning.
diff --git a/hw/kdrive/fake/fake.c b/hw/kdrive/fake/fake.c
index ea88f0e..a4044b6 100644
--- a/hw/kdrive/fake/fake.c
+++ b/hw/kdrive/fake/fake.c
@@ -171,9 +171,6 @@ fakeMapFramebuffer (KdScreenInfo *screen)
     if (priv->base)
 	free (priv->base);
     priv->base = malloc (priv->bytes_per_line * screen->height);
-    screen->memory_base = (CARD8 *) (priv->base);
-    screen->memory_size = 0;
-    screen->off_screen_base = 0;
     
     if (scrpriv->shadow)
     {
diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c
index cdb4b5c..d4fc5db 100644
--- a/hw/kdrive/fbdev/fbdev.c
+++ b/hw/kdrive/fbdev/fbdev.c
@@ -345,15 +345,12 @@ fbdevMapFramebuffer (KdScreenInfo *screen)
 
     screen->width = priv->var.xres;
     screen->height = priv->var.yres;
-    screen->memory_base = (CARD8 *) (priv->fb);
-    screen->memory_size = priv->fix.smem_len;
 
     if (scrpriv->shadow)
     {
 	if (!KdShadowFbAlloc (screen, 0,
 			      scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
 	    return FALSE;
-	screen->off_screen_base = screen->memory_size;
     }
     else
     {
@@ -361,7 +358,6 @@ fbdevMapFramebuffer (KdScreenInfo *screen)
         screen->fb[0].pixelStride = (priv->fix.line_length * 8 /
     				 priv->var.bits_per_pixel);
         screen->fb[0].frameBuffer = (CARD8 *) (priv->fb);
-	screen->off_screen_base = screen->fb[0].byteStride * screen->height;
     }
 
     return TRUE;
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 91977b3..260f355 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -112,9 +112,6 @@ typedef struct _KdScreenInfo {
     int		mynum;
     DDXPointRec	origin;
     KdFrameBuffer   fb[KD_MAX_FB];
-    CARD8	*memory_base;
-    unsigned long   memory_size;
-    unsigned long   off_screen_base;
 } KdScreenInfo;
 
 typedef struct _KdCardFuncs {
-- 
1.6.3.3



More information about the xorg-devel mailing list