diff mbox series

[v2,2/2] drm/virtio: Add support for XRGB8888 and BGRX8888

Message ID 20240903075414.297622-2-jfalempe@redhat.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] drm/virtio: Defer the host dumb buffer creation | expand

Commit Message

Jocelyn Falempe Sept. 3, 2024, 7:48 a.m. UTC
On big endian machine, fbdev wants BGRX8888, but gnome/wayland wants
XRGB8888, which wasn't possible because virtio-gpu could only support
one format. Now that it's fixed, it can support both.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 6 ++++--
 drivers/gpu/drm/virtio/virtgpu_plane.c   | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Gerd Hoffmann Sept. 4, 2024, 7:10 a.m. UTC | #1
On Tue, Sep 03, 2024 at 09:48:27AM GMT, Jocelyn Falempe wrote:
> On big endian machine, fbdev wants BGRX8888, but gnome/wayland wants
> XRGB8888, which wasn't possible because virtio-gpu could only support
> one format. Now that it's fixed, it can support both.

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>

take care,
  Gerd
diff mbox series

Patch

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index 5e8ca742c6d00..b94d16134b8cf 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -325,8 +325,10 @@  virtio_gpu_user_framebuffer_create(struct drm_device *dev,
 	struct virtio_gpu_object *bo;
 	int ret;
 
-	if (mode_cmd->pixel_format != DRM_FORMAT_HOST_XRGB8888 &&
-	    mode_cmd->pixel_format != DRM_FORMAT_HOST_ARGB8888)
+	if (mode_cmd->pixel_format != DRM_FORMAT_XRGB8888 &&
+	    mode_cmd->pixel_format != DRM_FORMAT_ARGB8888 &&
+	    mode_cmd->pixel_format != DRM_FORMAT_BGRX8888 &&
+	    mode_cmd->pixel_format != DRM_FORMAT_BGRA8888)
 		return ERR_PTR(-ENOENT);
 
 	/* lookup object associated with res handle */
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index a72a2dbda031c..32fbe30b45a46 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -30,11 +30,13 @@ 
 #include "virtgpu_drv.h"
 
 static const uint32_t virtio_gpu_formats[] = {
-	DRM_FORMAT_HOST_XRGB8888,
+	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_BGRX8888,
 };
 
 static const uint32_t virtio_gpu_cursor_formats[] = {
-	DRM_FORMAT_HOST_ARGB8888,
+	DRM_FORMAT_ARGB8888,
+	DRM_FORMAT_BGRA8888,
 };
 
 uint32_t virtio_gpu_translate_format(uint32_t drm_fourcc)