Re: [PATCH] drm/vkms: add support for gamma_set interface
From: Ville Syrjälä
Date: Wed Sep 02 2020 - 07:51:59 EST
On Wed, Sep 02, 2020 at 09:09:11AM +0000, Simon Ser wrote:
> On Tuesday, September 1, 2020 3:26 PM, Daniel Vetter <daniel@xxxxxxxx> wrote:
>
> > On Tue, Sep 01, 2020 at 08:57:37AM +0000, Simon Ser wrote:
> >
> > > On Monday, August 31, 2020 3:48 PM, Ville Syrjälä ville.syrjala@xxxxxxxxxxxxxxx wrote:
> > >
> > > > > > It doesn't seem like this IGT test's goal is to exercise support for
> > > > > > gamma LUTs. Does the test just tries to reset the gamma LUT to linear?
> > > > > > If so, I think the IGT test should be fixed to ignore "I don't support
> > > > > > gamma" errors.
> > > > >
> > > > > It seems like that IGT test pixel-format is to make gamma lut like below.
> > > > > for (i = 0; i < lut_size; i++)
> > > > > lut[i] = (i * 0xffff / (lut_size - 1)) & mask;
> > > > > And set this table to drm driver. and test begins. It's the test about pixel
> > > > > format. I think you're right. It's not about gamma lut.
> > > >
> > > > The point of the gamma LUT stuff in the pixel format test is to throw
> > > > away a bunch of the lsbs so that the test passes when the result is
> > > > "close enough" to the 8bpc RGB reference image. Without it we would
> > > > never get a crc match when testing non-8bpc or YCbCr formats.
> > >
> > > OK, that makes sense. Would it be sensible to:
> > >
> > > - Don't set gamma if the pixel format being tested is 8bpc
> >
> > Hm not sure what 8bpc format you mean here, because we have C8 (needs
> > gamma table or doesn't work) and the 8b greyscale one with the R8 one. If
> > you ask for legacy 8bpc you get C8.
>
> Why do we need a gamma LUT for C8 and R8? There shouldn't be any
> precision loss, right?
C8 always needs a LUT. Somewhat annoying legacy uapi thing that the
crtc's gamma LUT is also the LUT for C8 scanout, but at least it does
match how eg. Intel hw works. I think ideally there should a separate
per-plane LUT for this (with i915 then having to check that the same
LUT is used for all C8 planes on the crtc).
As for why we might need the LUT even for 8bpc formats.
The test does the following:
capture a reference CRC using XRGB8888
for_each_format
capture CRC using the format
compare CRC to the reference CRC
So all formats need to use the LUT to preserve the same number
of msbs and throw away the unwanted lsbs.
I guess we could add a special case for the "plane only
supports 8bpc formats" situation and omit the LUT in that case...
>
> > > - Make the test skip if the pixel format is >8bpc and gamma isn't
> > > supported
> > >
> >
> > Yeah the test should skip if gamma isn't there.
> > -Daniel
> >
> > > dri-devel mailing list
> > > dri-devel@xxxxxxxxxxxxxxxxxxxxx
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >
> > --
> >
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
>
--
Ville Syrjälä
Intel