Skip to contentSkip to conversation

drm/vkms: Unset preferred_depth

PATCH In review Daniel Vetter 3 participants 4 messages Oct 20, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vkms: Unset preferred_depth

There's a confusion between the preferred_depth uapi and the generic fbdev helpers. Former wants depth, latter wants bpp, and for XRGB8888 they don't match. Which hit me with vkms, which wants that.

All other drivers setting this and using the generic fbdev helpers use 16, where both numbers match, for RGB565.

Since fixing this is a bit involved (I think for atomic drivers we should just compute this all internally from the format list of the first primary plane) paper over the issue in vkms by using defaults everywhere. Then userspace will pick XRGB8888, and fbdev helpers will do the same, and we have what we want.

Cc Simon Ser <[email protected]>
Cc Rodrigo Siqueira <[email protected]>
Cc Melissa Wen <[email protected]>
Cc Haneen Mohammed <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/vkms/vkms_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/vkms/vkms_drv.c +4 -1
index 25faba5aac08..98ba844ae77d 100644
@@ -114,7 +114,10 @@ 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;
-	dev->mode_config.preferred_depth = 32;
+	/* 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 ix XRGB8888 in all cases. */
+	dev->mode_config.preferred_depth = 0;
 	dev->mode_config.helper_private = &vkms_mode_config_helpers;
 
 	return vkms_output_init(vkmsdev, 0);
Signature · 6 lines
2.28.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Daniel Vetter

There's a confusion between the preferred_depth uapi and the generic fbdev helpers. Former wants depth, latter wants bpp, and for XRGB8888 they don't match. Which hit me with vkms, which wants that.

All other drivers setting this and using the generic fbdev helpers use 16, where both numbers match, for RGB565.

Not quite: grepping reveals a majority of 24 (as shown in drmdb). A few drivers set 16 (udl, cirrus), and hisilicon sets 32.

Quoted 6 lines

Since fixing this is a bit involved (I think for atomic drivers we should just compute this all internally from the format list of the first primary plane) paper over the issue in vkms by using defaults everywhere. Then userspace will pick XRGB8888, and fbdev helpers will do the same, and we have what we want.

Quoted 7 lines
Cc Simon Ser [email protected]
Cc Rodrigo Siqueira [email protected]
Cc Melissa Wen [email protected]
Cc Haneen Mohammed [email protected]
Cc Daniel Vetter [email protected]

With the commit message clarified:

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
Quoted 7 lines · Simon Ser
Quoted 4 lines · Daniel Vetter

There's a confusion between the preferred_depth uapi and the generic fbdev helpers. Former wants depth, latter wants bpp, and for XRGB8888 they don't match. Which hit me with vkms, which wants that.

Quoted 5 lines
Quoted 2 lines

All other drivers setting this and using the generic fbdev helpers use 16, where both numbers match, for RGB565.

Not quite: grepping reveals a majority of 24 (as shown in drmdb). A few drivers set 16 (udl, cirrus), and hisilicon sets 32.

If I haven't screwed up my grepping, those drivers that set 24 don't use the generic fbdev emulation. Which is the broken combination.

hisilicon setting 32 is just plain wrong, and it's indeed using fbdev emulation :-/ I also noticed that mga200 can end up setting 32bit.

So I guess I've not been terribly well awake when doing my grepping ...

Quoted 18 lines
Quoted 6 lines

Since fixing this is a bit involved (I think for atomic drivers we should just compute this all internally from the format list of the first primary plane) paper over the issue in vkms by using defaults everywhere. Then userspace will pick XRGB8888, and fbdev helpers will do the same, and we have what we want.

Quoted 7 lines
Cc Simon Ser [email protected]
Cc Rodrigo Siqueira [email protected]
Cc Melissa Wen [email protected]
Cc Haneen Mohammed [email protected]
Cc Daniel Vetter [email protected]

With the commit message clarified:

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
In reply to Daniel Vetter

Hi

Quoted 29 lines · Daniel Vetter

There's a confusion between the preferred_depth uapi and the generic fbdev helpers. Former wants depth, latter wants bpp, and for XRGB8888 they don't match. Which hit me with vkms, which wants that.

All other drivers setting this and using the generic fbdev helpers use 16, where both numbers match, for RGB565.

Since fixing this is a bit involved (I think for atomic drivers we should just compute this all internally from the format list of the first primary plane) paper over the issue in vkms by using defaults everywhere. Then userspace will pick XRGB8888, and fbdev helpers will do the same, and we have what we want.

Cc Simon Ser <[email protected]>
Cc Rodrigo Siqueira <[email protected]>
Cc Melissa Wen <[email protected]>
Cc Haneen Mohammed <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/vkms/vkms_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/vkms/vkms_drv.c +0 -0
index 25faba5aac08..98ba844ae77d 100644

drivers/gpu/drm/vkms/vkms_drv.c static int vkms_modeset_init(struct vkms_device *vkmsdev) · line 120

Quoted 8 lines
drivers/gpu/drm/vkms/vkms_drv.c +4 -1
@@ -114,7 +114,10 @@ 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;
-	dev->mode_config.preferred_depth = 32;
+	/* 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 ix XRGB8888 in all cases. */
+	dev->mode_config.preferred_depth = 0;

It's already 0 at this point.

I suggest to rather document this FIXME as part of the documentation of drm_fbdev_generic_setup() and preferred_depth. Other drivers are also affected.

Best regards
Thomas

Quoted 4 lines
drivers/gpu/drm/vkms/vkms_drv.c +0 -0
 	dev->mode_config.helper_private = &vkms_mode_config_helpers;
 
 	return vkms_output_init(vkmsdev, 0);
Signature · 10 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel