Linux virtualization list
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Jocelyn Falempe <jfalempe@redhat.com>,
	David Airlie <airlied@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Gurchetan Singh <gurchetansingh@chromium.org>,
	Chia-I Wu <olvaffe@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev
Cc: Javier Martinez Canillas <javierm@redhat.com>
Subject: Re: [PATCH v2 2/2] drm/virtio: Fix host color format for big endian guests
Date: Tue, 20 Aug 2024 14:48:49 +0200	[thread overview]
Message-ID: <efe083ed-b83b-45e8-a418-1861f535e31f@suse.de> (raw)
In-Reply-To: <20240820090908.151042-2-jfalempe@redhat.com>

Hi

Am 20.08.24 um 11:07 schrieb Jocelyn Falempe:
> The colors are inverted when testing a s390x VM on a s390x host.
> Changing the conversion from DRM_FORMAT -> VIRTIO_GPU_FORMAT on big
> endian guests fixes the colors. But it may break big-endian guest on
> little-endian host. In this case, the fix should be in qemu, because
> the host endianess is not known in the guest VM.
>
> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
> Acked-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>   drivers/gpu/drm/virtio/virtgpu_plane.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
> index 860b5757ec3fc..0ec6ecc96eb13 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
> @@ -37,16 +37,24 @@ static const uint32_t virtio_gpu_cursor_formats[] = {
>   	DRM_FORMAT_ARGB8888,
>   };
>   
> +#ifdef __BIG_ENDIAN
> +#define VIRTIO_GPU_HOST_XRGB8888 VIRTIO_GPU_FORMAT_X8R8G8B8_UNORM
> +#define VIRTIO_GPU_HOST_ARGB8888 VIRTIO_GPU_FORMAT_A8R8G8B8_UNORM
> +#else
> +#define VIRTIO_GPU_HOST_XRGB8888 VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM
> +#define VIRTIO_GPU_HOST_ARGB8888 VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM
> +#endif

As these defines are only used here, would it be beneficial to put the 
__BIG_ENDIAN branch directly around the switch statement?

Best regards
Thomas

> +
>   uint32_t virtio_gpu_translate_format(uint32_t drm_fourcc)
>   {
>   	uint32_t format;
>   
>   	switch (drm_fourcc) {
>   	case DRM_FORMAT_XRGB8888:
> -		format = VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM;
> +		format = VIRTIO_GPU_HOST_XRGB8888;
>   		break;
>   	case DRM_FORMAT_ARGB8888:
> -		format = VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM;
> +		format = VIRTIO_GPU_HOST_ARGB8888;
>   		break;
>   	default:
>   		/*

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


  reply	other threads:[~2024-08-20 12:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  9:07 [PATCH v2 1/2] drm/virtio: Use XRGB8888 also for big endian systems Jocelyn Falempe
2024-08-20  9:07 ` [PATCH v2 2/2] drm/virtio: Fix host color format for big endian guests Jocelyn Falempe
2024-08-20 12:48   ` Thomas Zimmermann [this message]
2024-08-20 12:55     ` Jocelyn Falempe
2024-08-20 13:25       ` Thomas Zimmermann
2024-08-20 14:27       ` Javier Martinez Canillas
2024-08-21 10:46   ` Gerd Hoffmann
2024-08-21 11:12 ` [PATCH v2 1/2] drm/virtio: Use XRGB8888 also for big endian systems Gerd Hoffmann
2024-08-22 14:46   ` Jocelyn Falempe

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=efe083ed-b83b-45e8-a418-1861f535e31f@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gurchetansingh@chromium.org \
    --cc=javierm@redhat.com \
    --cc=jfalempe@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=olvaffe@gmail.com \
    --cc=virtualization@lists.linux.dev \
    /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