All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] sdl2: Support all virtio-gpu formats
@ 2018-10-08 18:50 Max Reitz
  2018-10-08 18:54 ` Max Reitz
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Max Reitz @ 2018-10-08 18:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Reitz, Gerd Hoffmann

There are some 2D resource formats that can be used through virtio-gpu,
but which are not supported by SDL2 when used for a scanout; these are
all alpha-channel formats and also XBGR (RGBX in non-BE pixman).

Add these formats in the switch converting pixman to SDL format
constants so a guest cannot crash the VM by triggering the
g_assert_not_reached() with an unsupported format.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 ui/sdl2-2d.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c
index 85484407be..c9df72636a 100644
--- a/ui/sdl2-2d.c
+++ b/ui/sdl2-2d.c
@@ -101,15 +101,24 @@ void sdl2_2d_switch(DisplayChangeListener *dcl,
     case PIXMAN_r5g6b5:
         format = SDL_PIXELFORMAT_RGB565;
         break;
+    case PIXMAN_a8r8g8b8:
     case PIXMAN_x8r8g8b8:
         format = SDL_PIXELFORMAT_ARGB8888;
         break;
+    case PIXMAN_a8b8g8r8:
+    case PIXMAN_x8b8g8r8:
+        format = SDL_PIXELFORMAT_ABGR8888;
+        break;
+    case PIXMAN_r8g8b8a8:
     case PIXMAN_r8g8b8x8:
         format = SDL_PIXELFORMAT_RGBA8888;
         break;
     case PIXMAN_b8g8r8x8:
         format = SDL_PIXELFORMAT_BGRX8888;
         break;
+    case PIXMAN_b8g8r8a8:
+        format = SDL_PIXELFORMAT_BGRA8888;
+        break;
     default:
         g_assert_not_reached();
     }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-10-12 13:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-08 18:50 [Qemu-devel] [PATCH] sdl2: Support all virtio-gpu formats Max Reitz
2018-10-08 18:54 ` Max Reitz
2018-10-10 10:10 ` Gerd Hoffmann
2018-10-10 17:35   ` Max Reitz
2018-10-10 17:53     ` Max Reitz
2018-10-11  7:45     ` Gerd Hoffmann
2018-10-12 12:48 ` Gerd Hoffmann
2018-10-12 13:33   ` Max Reitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.