[PATCH 1/2] ephyr: hostx_screen_init(): Fix bits_per_pixel and bytes_per_line

Søren Sandmann sandmann at cs.au.dk
Mon Oct 21 23:18:45 CEST 2013


From: Søren Sandmann Pedersen <ssp at redhat.com>

When the depth of the Xephyr server matches that of the host X server,
Xephyr simply uses the buffer associated with the XImage as its
framebuffer. In this case, it is correct to get the bits_per_pixel and
bytes_per_line values returned from hostx_screen_init() from the XImage.

However, when the depth doesn't match the host, Xephyr uses a private
framebuffer that is periodically copied to the XImage. In this case,
the returned values of bits_per_pixel and bytes_per_line should be
those of the private framebuffer, not those of the XImage.
---
 hw/kdrive/ephyr/hostx.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index d985571..86f3679 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -693,9 +693,6 @@ hostx_screen_init(KdScreenInfo *screen,
             malloc(scrpriv->ximg->stride * buffer_height);
     }
 
-    *bytes_per_line = scrpriv->ximg->stride;
-    *bits_per_pixel = scrpriv->ximg->bpp;
-
     if (scrpriv->win_pre_existing == None && !EphyrWantResize) {
         /* Ask the WM to keep our size static */
         xcb_size_hints_t size_hints = {0};
@@ -715,10 +712,16 @@ hostx_screen_init(KdScreenInfo *screen,
     scrpriv->win_height = height;
 
     if (host_depth_matches_server(scrpriv)) {
+        *bytes_per_line = scrpriv->ximg->stride;
+        *bits_per_pixel = scrpriv->ximg->bpp;
+
         EPHYR_DBG("Host matches server");
         return scrpriv->ximg->data;
     }
     else {
+        *bytes_per_line = width * (scrpriv->server_depth >> 3);
+        *bits_per_pixel = scrpriv->server_depth;
+
         EPHYR_DBG("server bpp %i", scrpriv->server_depth >> 3);
         scrpriv->fb_data =
             malloc(width * buffer_height * (scrpriv->server_depth >> 3));
-- 
1.7.1



More information about the xorg-devel mailing list