From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDBrd-0002to-4K for qemu-devel@nongnu.org; Mon, 19 Jan 2015 07:55:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDBrS-00045R-MO for qemu-devel@nongnu.org; Mon, 19 Jan 2015 07:55:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44603) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDBrS-00045H-E1 for qemu-devel@nongnu.org; Mon, 19 Jan 2015 07:55:18 -0500 From: Gerd Hoffmann Date: Mon, 19 Jan 2015 13:55:08 +0100 Message-Id: <1421672109-29467-8-git-send-email-kraxel@redhat.com> In-Reply-To: <1421672109-29467-1-git-send-email-kraxel@redhat.com> References: <1421672109-29467-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 7/8] ui/sdl: 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 From: Benjamin Herrenschmidt At least all the ones I've tested. We make the assumption that SDL is going to be better at conversion than we are. Signed-off-by: Benjamin Herrenschmidt [ kraxel: minor format tweaks ] Signed-off-by: Gerd Hoffmann --- ui/sdl.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/ui/sdl.c b/ui/sdl.c index 3e9d810..138ca73 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -151,6 +151,19 @@ static void sdl_switch(DisplayChangeListener *dcl, pf.bmask, pf.amask); } +static bool sdl_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); +} + /* generic keyboard conversion */ #include "sdl_keysym.h" @@ -865,12 +878,13 @@ static void sdl_cleanup(void) } static const DisplayChangeListenerOps dcl_ops = { - .dpy_name = "sdl", - .dpy_gfx_update = sdl_update, - .dpy_gfx_switch = sdl_switch, - .dpy_refresh = sdl_refresh, - .dpy_mouse_set = sdl_mouse_warp, - .dpy_cursor_define = sdl_mouse_define, + .dpy_name = "sdl", + .dpy_gfx_update = sdl_update, + .dpy_gfx_switch = sdl_switch, + .dpy_gfx_check_format = sdl_check_format, + .dpy_refresh = sdl_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