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>
This commit is contained in:
		
							parent
							
								
									55246b67b7
								
							
						
					
					
						commit
						97cf53cc2a
					
				| 
						 | 
				
			
			@ -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));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue