From 877417d9ae6846bea4744b198131a5fe5117d7a5 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 9 Jan 2015 09:27:09 +0100 Subject: ui/sdl2: Support shared surface for more pixman formats Signed-off-by: Gerd Hoffmann --- ui/sdl2-2d.c | 13 +++++++++++++ ui/sdl2.c | 13 +++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'ui') diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c index 9264817e76..f907c21895 100644 --- a/ui/sdl2-2d.c +++ b/ui/sdl2-2d.c @@ -120,3 +120,16 @@ void sdl2_2d_redraw(struct sdl2_console *scon) surface_width(scon->surface), surface_height(scon->surface)); } + +bool sdl2_2d_check_format(DisplayChangeListener *dcl, + pixman_format_code_t format) +{ + /* + * We let SDL convert for us a few more formats than, + * the native ones. Thes are the ones I have tested. + */ + return (format == PIXMAN_x8r8g8b8 || + format == PIXMAN_b8g8r8x8 || + format == PIXMAN_x1r5g5b5 || + format == PIXMAN_r5g6b5); +} diff --git a/ui/sdl2.c b/ui/sdl2.c index 1ae2781624..60e3c3b6fa 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -668,12 +668,13 @@ static void sdl_cleanup(void) } static const DisplayChangeListenerOps dcl_2d_ops = { - .dpy_name = "sdl2-2d", - .dpy_gfx_update = sdl2_2d_update, - .dpy_gfx_switch = sdl2_2d_switch, - .dpy_refresh = sdl2_2d_refresh, - .dpy_mouse_set = sdl_mouse_warp, - .dpy_cursor_define = sdl_mouse_define, + .dpy_name = "sdl2-2d", + .dpy_gfx_update = sdl2_2d_update, + .dpy_gfx_switch = sdl2_2d_switch, + .dpy_gfx_check_format = sdl2_2d_check_format, + .dpy_refresh = sdl2_2d_refresh, + .dpy_mouse_set = sdl_mouse_warp, + .dpy_cursor_define = sdl_mouse_define, }; void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) -- cgit v1.2.3-55-g7522