[PATCH 1/3] drm/vkms: Set preferred depth correctly

Daniel Vetter daniel.vetter at ffwll.ch
Fri Oct 16 17:05:40 UTC 2020


On Fri, Oct 16, 2020 at 7:02 PM Melissa Wen <melissa.srw at gmail.com> wrote:
>
> On 10/16, Daniel Vetter wrote:
> > On Fri, Oct 16, 2020 at 12:38 PM Simon Ser <contact at emersion.fr> wrote:
> > >
> > > > The only thing we support is xrgb8888.
> > > >
> > > > Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> > > > Cc: Rodrigo Siqueira <rodrigosiqueiramelo at gmail.com>
> > > > Cc: Melissa Wen <melissa.srw at gmail.com>
> > > > Cc: Haneen Mohammed <hamohammed.sa at gmail.com>
> > > > Cc: Daniel Vetter <daniel at ffwll.ch>
> > > > ---
> > > >  drivers/gpu/drm/vkms/vkms_drv.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> > > > index 726801ab44d4..eb4007443706 100644
> > > > --- a/drivers/gpu/drm/vkms/vkms_drv.c
> > > > +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> > > > @@ -124,7 +124,7 @@ 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 = 24;
> > > > +     dev->mode_config.preferred_depth = 32;
> > >
> > > Are you sure xrgb8888's depth is 32 and not 24? Looking at drmdb [1], *all*
> > > drivers set it to 24.
> >
> > Uh there's a problem I think. Depth should indeed stay at 24, the
> > problem is that fb helpers directly take that to be the bpp parameter,
> > which is a different thing. And if you look at how most drivers set up
> > that, they pick 32.
> >
> > I guess I need to revert this here, and unconfuse the fb helpers about
> > depth vs bpp.
>
> Hi guys,
>
> Perhaps it deserves to be pointed out: the documentation says
> "preferred_depth: preferred RBG(sic) pixel depth, used by fb helpers",
> and looking to fb helpers, preferred_depth is only used by
> generic_setup, as bits by pixel (if I didn't miss something there).
>
> In fact, the alpha channel is not used for final display (perhaps in the
> future); however, I saw another driver with a change similar to this
> here and, possibly like me, following the same misunderstanding.

Yeah the problem is that preferred_depth is depth, and that means 24
bit for XRGB8888. But bpp as used by fb helpers would be 32 bit for
XRGB8888.

I think the real fix here is to switch this entire mess over to using
drm_fourcc codes directly, at least for atomic drivers. Which nowadays
are most. Interim I'm not sure whether we should revert my patch (it
breaks fbdev) or switch preferred_depth to 0, which means we get the
default every, and that means both fbdev helpers and userspace will
pick XRGB8888.
-Daniel

> Melissa
> >
> > Maybe best would be to just switch over to preferred drm_fourcc format
> > code, or maybe just pick this up from the first format the primary
> > plane supports.
> >
> > This is all getting slightly tricky and a lot more work :-/
> > -Daniel
> > --
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch



-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list