ephyr: Fix crash on 24bpp host framebuffer
Use bytes_per_line and bits_per_pixel from the created XImage to fix https://bugzilla.redhat.com/show_bug.cgi?id=518960 Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
e21e183059
commit
bd58ebe4cf
|
@ -238,13 +238,11 @@ ephyrMapFramebuffer(KdScreenInfo * screen)
|
||||||
KdComputePointerMatrix(&m, ephyrRandr, screen->width, screen->height);
|
KdComputePointerMatrix(&m, ephyrRandr, screen->width, screen->height);
|
||||||
KdSetPointerMatrix(&m);
|
KdSetPointerMatrix(&m);
|
||||||
|
|
||||||
priv->bytes_per_line =
|
|
||||||
((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
|
|
||||||
|
|
||||||
buffer_height = ephyrBufferHeight(screen);
|
buffer_height = ephyrBufferHeight(screen);
|
||||||
|
|
||||||
priv->base =
|
priv->base =
|
||||||
hostx_screen_init(screen, screen->width, screen->height, buffer_height);
|
hostx_screen_init(screen, screen->width, screen->height, buffer_height,
|
||||||
|
&priv->bytes_per_line, &screen->fb.bitsPerPixel);
|
||||||
|
|
||||||
if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All)) {
|
if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All)) {
|
||||||
scrpriv->shadow = FALSE;
|
scrpriv->shadow = FALSE;
|
||||||
|
|
|
@ -619,7 +619,8 @@ hostx_set_cmap_entry(unsigned char idx,
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
hostx_screen_init(EphyrScreenInfo screen,
|
hostx_screen_init(EphyrScreenInfo screen,
|
||||||
int width, int height, int buffer_height)
|
int width, int height, int buffer_height,
|
||||||
|
int *bytes_per_line, int *bits_per_pixel)
|
||||||
{
|
{
|
||||||
int bitmap_pad;
|
int bitmap_pad;
|
||||||
Bool shm_success = False;
|
Bool shm_success = False;
|
||||||
|
@ -696,6 +697,9 @@ hostx_screen_init(EphyrScreenInfo screen,
|
||||||
malloc(host_screen->ximg->bytes_per_line * buffer_height);
|
malloc(host_screen->ximg->bytes_per_line * buffer_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*bytes_per_line = host_screen->ximg->bytes_per_line;
|
||||||
|
*bits_per_pixel = host_screen->ximg->bits_per_pixel;
|
||||||
|
|
||||||
XResizeWindow(HostX.dpy, host_screen->win, width, height);
|
XResizeWindow(HostX.dpy, host_screen->win, width, height);
|
||||||
|
|
||||||
/* Ask the WM to keep our size static */
|
/* Ask the WM to keep our size static */
|
||||||
|
|
|
@ -193,7 +193,8 @@ hostx_set_cmap_entry(unsigned char idx,
|
||||||
unsigned char r, unsigned char g, unsigned char b);
|
unsigned char r, unsigned char g, unsigned char b);
|
||||||
|
|
||||||
void *hostx_screen_init(EphyrScreenInfo screen,
|
void *hostx_screen_init(EphyrScreenInfo screen,
|
||||||
int width, int height, int buffer_height);
|
int width, int height, int buffer_height,
|
||||||
|
int *bytes_per_line, int *bits_per_pixel);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue