Skip to contentSkip to conversation

drm/vkms: Unset preferred_depth

PATCH In review Daniel Vetter 5 participants 8 messages Dec 11, 2020 – Dec 23, 2020

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

PATCH 1/2 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 d4d39227f2ed..aef29393b811 100644
@@ -113,7 +113,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.29.2

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

PATCH 2/2 drm/fb-helper: Add a FIXME that generic_setup is very confusing

I tried to fix this for real, but it's very sprawling and lots of drivers get this mildly wrong one way or the other.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_fb_helper.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +5 -0
index 596255edf023..27deed4af015 100644
@@ -2494,6 +2494,11 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
 		return;
 	}
 
+	/*
+	 * FIXME: This mixes up depth with bpp, which results in a glorious
+	 * mess, resulting in some drivers picking wrong fbdev defaults and
+	 * others wrong preferred_depth defaults.
+	 */
 	if (!preferred_bpp)
 		preferred_bpp = dev->mode_config.preferred_depth;
 	if (!preferred_bpp)
Signature · 6 lines
2.29.2

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

Re: [PATCH 2/2] drm/fb-helper: Add a FIXME that generic_setup is very confusing

Quoted 9 lines · Daniel Vetter

I tried to fix this for real, but it's very sprawling and lots of drivers get this mildly wrong one way or the other.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

Anyone feeling like an ack on this one?
-Daniel

Quoted 23 lines
---
 drivers/gpu/drm/drm_fb_helper.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +5 -0
index 596255edf023..27deed4af015 100644
@@ -2494,6 +2494,11 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
 		return;
 	}
 
+	/*
+	 * FIXME: This mixes up depth with bpp, which results in a glorious
+	 * mess, resulting in some drivers picking wrong fbdev defaults and
+	 * others wrong preferred_depth defaults.
+	 */
 	if (!preferred_bpp)
 		preferred_bpp = dev->mode_config.preferred_depth;
 	if (!preferred_bpp)
Signature · 1 line
2.29.2
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
Acked-by
#3 lore raw

Re: [PATCH 2/2] drm/fb-helper: Add a FIXME that generic_setup is very confusing

Quoted 4 lines · Daniel Vetter
Quoted 3 lines · Daniel Vetter

I tried to fix this for real, but it's very sprawling and lots of drivers get this mildly wrong one way or the other.

Quoted 8 lines
Quoted 6 lines
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

Anyone feeling like an ack on this one?

From my limited understanding of fbdev, this FIXME sounds correct to me.

Quoted 12 lines
Quoted 12 lines
---
 drivers/gpu/drm/drm_fb_helper.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +0 -0
index 596255edf023..27deed4af015 100644
@@ -2494,6 +2494,11 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
 		return;
 	}
 
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +5 -1
+	/*
+	 * FIXME: This mixes up depth with bpp, which results in a glorious
+	 * mess, resulting in some drivers picking wrong fbdev defaults and
+	 * others wrong preferred_depth defaults.
+	 */
 	if (!preferred_bpp)
 		preferred_bpp = dev->mode_config.preferred_depth;
 	if (!preferred_bpp)
--

2.29.2

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

#4 lore raw

Re: [PATCH 2/2] drm/fb-helper: Add a FIXME that generic_setup is very confusing

Quoted 13 lines · Simon Ser
Quoted 11 lines · Daniel Vetter
Quoted 9 lines · Daniel Vetter

I tried to fix this for real, but it's very sprawling and lots of drivers get this mildly wrong one way or the other.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Quoted 5 lines
Quoted 1 line

Anyone feeling like an ack on this one?

From my limited understanding of fbdev, this FIXME sounds correct to me.

Thanks for taking a look, patch pushed to drm-misc-next. -Daniel

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
---
 drivers/gpu/drm/drm_fb_helper.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +5 -1
index 596255edf023..27deed4af015 100644
@@ -2494,6 +2494,11 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
 		return;
 	}
 
+	/*
+	 * FIXME: This mixes up depth with bpp, which results in a glorious
+	 * mess, resulting in some drivers picking wrong fbdev defaults and
+	 * others wrong preferred_depth defaults.
+	 */
 	if (!preferred_bpp)
 		preferred_bpp = dev->mode_config.preferred_depth;
 	if (!preferred_bpp)
--

2.29.2

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
maintainer Acked-by
#5 lore raw

Re: [PATCH 2/2] drm/fb-helper: Add a FIXME that generic_setup is very confusing

In reply to Daniel Vetter
Quoted 4 lines · Daniel Vetter
Quoted 3 lines · Daniel Vetter

I tried to fix this for real, but it's very sprawling and lots of drivers get this mildly wrong one way or the other.

Quoted 8 lines
Quoted 6 lines
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

Anyone feeling like an ack on this one?

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

#6 lore raw
In reply to Daniel Vetter
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 8 lines

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.

I think I had a patch ages ago that tried to improve the fb_helper pixel format stuff a bit. This one I think:
https://patchwork.freedesktop.org/patch/203189/

Haven't checked how much of that would still be relevant though.

Quoted 36 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]>
---
 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 d4d39227f2ed..aef29393b811 100644
@@ -113,7 +113,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.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw
Quoted 14 lines · Ville Syrjälä
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 8 lines

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.

Quoted 5 lines

I think I had a patch ages ago that tried to improve the fb_helper pixel format stuff a bit. This one I think:
https://patchwork.freedesktop.org/patch/203189/

Haven't checked how much of that would still be relevant though.

Uh this looks useful, my attempts have only tried to clean up the driver side in what they're setting for preferred_depth and how they set up the fbdev emulation. I haven't looked at the fbdev code itself, and especially your mapping table should be useful.

Care to resubmit that one again?
-Daniel

Quoted 41 lines
Quoted 37 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]>
---
 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 d4d39227f2ed..aef29393b811 100644
@@ -113,7 +113,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.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Ville Syrjälä
Intel
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