On Tue, Aug 20, 2024 at 11:07:41AM GMT, Jocelyn Falempe wrote: > 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@xxxxxxxxxx> > Acked-by: Javier Martinez Canillas <javierm@xxxxxxxxxx> > --- > 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 VIRTIO_GPU_FORMAT_* is little endian (like DRM_FORMAT_*), there should be no need to do anything byte order specific here. This looks like you are papering over a bug somewhere else. take care, Gerd