VKMS defaults to XRGB8888, which has a color depth of 24 bits stored
in a 32 bpp container. Setting preferred_depth to 24 reports the actual
depth to userspace (such as Xorg) via DRM_CAP_DUMB_PREFERRED_DEPTH
rather than returning 0, while keeping the fbdev default intact.

Signed-off-by: Karthik Sarvan <[email protected]>
Reviewed-by: Oarora Etimis <[email protected]>
---
v2:
- Add commit description (Thomas Zimmermann).
- Collect Reviewed-by from Oarora Etimis.
- Resend as standalone thread per reviewer request.

 drivers/gpu/drm/vkms/vkms_drv.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 5a640b531d88..10337889b1b0 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -146,12 +146,8 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev)
        dev->mode_config.max_height = YRES_MAX;
        dev->mode_config.cursor_width = 512;
        dev->mode_config.cursor_height = 512;
-       /*
-        * FIXME: There's a confusion between bpp and depth between this and
-        * fbdev helpers. We have to go with 0, meaning "pick the default",
-        * which is XRGB8888 in all cases.
-        */
-       dev->mode_config.preferred_depth = 0;
+       /* XRGB8888 has 24 bits of color data stored in 32 bits per pixel. */
+       dev->mode_config.preferred_depth = 24;
        dev->mode_config.helper_private = &vkms_mode_config_helpers;
 
        return vkms_output_init(vkmsdev);
-- 
2.56.0

Reply via email to