diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-10-21 16:58:54 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-10-31 18:24:27 -0700 |
commit | 97cf53cc2ad7ecfdd495133bad31d0ec7d939326 (patch) | |
tree | 2d7b5a658067dc92cfbbdcc4ec1363fd0657b34e /hw | |
parent | 55246b67b755d4c1039d54971fe3f77ea60d604e (diff) |
ephyr: hostx_screen_init(): Fix bits_per_pixel and bytes_per_line
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.
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | 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 5fa33b9db..6020e8d63 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -695,9 +695,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}; @@ -717,10 +714,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)); |