diff mbox series

[1/2] drm/vkms: Unset preferred_depth

Message ID 20201211161113.3350061-1-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/vkms: Unset preferred_depth | expand

Commit Message

Daniel Vetter Dec. 11, 2020, 4:11 p.m. UTC
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.

Reported-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Simon Ser <contact@emersion.fr>
Cc: Simon Ser <contact@emersion.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/vkms/vkms_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Ville Syrjälä Dec. 11, 2020, 4:21 p.m. UTC | #1
On Fri, Dec 11, 2020 at 05:11:12PM +0100, Daniel Vetter wrote:
> 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.

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.

> 
> Reported-by: Simon Ser <contact@emersion.fr>
> Reviewed-by: Simon Ser <contact@emersion.fr>
> Cc: Simon Ser <contact@emersion.fr>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> Cc: Melissa Wen <melissa.srw@gmail.com>
> Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  drivers/gpu/drm/vkms/vkms_drv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> index d4d39227f2ed..aef29393b811 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.c
> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> @@ -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);
> -- 
> 2.29.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter Dec. 11, 2020, 4:25 p.m. UTC | #2
On Fri, Dec 11, 2020 at 06:21:40PM +0200, Ville Syrjälä wrote:
> On Fri, Dec 11, 2020 at 05:11:12PM +0100, Daniel Vetter wrote:
> > 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.
> 
> 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

> 
> > 
> > Reported-by: Simon Ser <contact@emersion.fr>
> > Reviewed-by: Simon Ser <contact@emersion.fr>
> > Cc: Simon Ser <contact@emersion.fr>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > Cc: Melissa Wen <melissa.srw@gmail.com>
> > Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > ---
> >  drivers/gpu/drm/vkms/vkms_drv.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> > index d4d39227f2ed..aef29393b811 100644
> > --- a/drivers/gpu/drm/vkms/vkms_drv.c
> > +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> > @@ -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);
> > -- 
> > 2.29.2
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Ville Syrjälä
> Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index d4d39227f2ed..aef29393b811 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -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);