From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9Vsy-000627-ND for qemu-devel@nongnu.org; Fri, 09 Jan 2015 04:29:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9Vsr-00016x-Qv for qemu-devel@nongnu.org; Fri, 09 Jan 2015 04:29:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53786) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9Vsr-00016q-Ho for qemu-devel@nongnu.org; Fri, 09 Jan 2015 04:29:33 -0500 From: Gerd Hoffmann Date: Fri, 9 Jan 2015 10:28:37 +0100 Message-Id: <1420795717-28966-9-git-send-email-kraxel@redhat.com> In-Reply-To: <1420795717-28966-1-git-send-email-kraxel@redhat.com> References: <1420795717-28966-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 8/8] ui/sdl2: Support shared surface for more pixman formats List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Anthony Liguori Signed-off-by: Gerd Hoffmann --- include/ui/sdl2.h | 2 ++ ui/sdl2-2d.c | 13 +++++++++++++ ui/sdl2.c | 13 +++++++------ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index f56c596..51fff2e 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -28,5 +28,7 @@ void sdl2_2d_switch(DisplayChangeListener *dcl, DisplaySurface *new_surface); void sdl2_2d_refresh(DisplayChangeListener *dcl); void sdl2_2d_redraw(struct sdl2_console *scon); +bool sdl2_2d_check_format(DisplayChangeListener *dcl, + pixman_format_code_t format); #endif /* SDL2_H */ diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c index 9264817..f907c21 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 1ae2781..60e3c3b 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) -- 1.8.3.1