summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2010-01-02 14:59:07 +0600
committerMikhail Gusarov <dottedmag@dottedmag.net>2010-01-06 19:47:53 +0600
commit5337ddcfd9dc2a5b823da39df7adaad6692214f0 (patch)
tree594a6ede413cc3339563d44d3d221d36b0246484
parent62883b499b72f678ab055de4d0370227ae441370 (diff)
kdrive: Move Xephyr-specific fields out of KdScreenInfo
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. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
-rw-r--r--hw/kdrive/ephyr/ephyr.c31
-rw-r--r--hw/kdrive/ephyr/ephyr.h2
-rw-r--r--hw/kdrive/ephyr/ephyr_draw.c7
-rw-r--r--hw/kdrive/fake/fake.c3
-rw-r--r--hw/kdrive/fbdev/fbdev.c4
-rw-r--r--hw/kdrive/src/kdrive.h3
6 files changed, 24 insertions, 26 deletions
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index b6a2adaff..93118a86f 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 f5ea144b3..cb5e4b51b 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 7b579c24b..f9fac8007 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 ea88f0edb..a4044b68c 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 cdb4b5cba..d4fc5dbe9 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 185995db4..9865e6fe1 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -111,9 +111,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 {