qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] sdl2: Support all virtio-gpu formats
Date: Mon, 8 Oct 2018 20:54:11 +0200	[thread overview]
Message-ID: <d3a7d12c-162a-8ba2-cfbe-767e0f261c29@redhat.com> (raw)
In-Reply-To: <20181008185013.19371-1-mreitz@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]

On 08.10.18 20:50, Max Reitz wrote:
> 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).

Oops, it's the other way round.  The virtio-gpu format is RGBX, and the
non-BE pixman (and SDL) constant is XBGR.

Max

> 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();
>      }
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2018-10-08 19:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08 18:50 [Qemu-devel] [PATCH] sdl2: Support all virtio-gpu formats Max Reitz
2018-10-08 18:54 ` Max Reitz [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3a7d12c-162a-8ba2-cfbe-767e0f261c29@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).