Message ID | 20230626055444.1113796-3-chaitanya.kumar.borah@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | MTL Degamma implementation | expand |
On Mon, 26 Jun 2023, Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> wrote: > For MTL and beyond, convert back the 24 bit lut values > read from HW to 16 bit values to maintain parity with > userspace values. This way we avoid pipe config mismatch > for pre-csc lut values. > > Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> > --- > drivers/gpu/drm/i915/display/intel_color.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c > index 25c73e2e6fa3..856191640e71 100644 > --- a/drivers/gpu/drm/i915/display/intel_color.c > +++ b/drivers/gpu/drm/i915/display/intel_color.c > @@ -3477,6 +3477,14 @@ static struct drm_property_blob *glk_read_degamma_lut(struct intel_crtc *crtc) > for (i = 0; i < lut_size; i++) { > u32 val = intel_de_read_fw(dev_priv, PRE_CSC_GAMC_DATA(pipe)); > > + /* > + * For MTL and beyond, convert back the 24 bit lut values > + * read from HW to 16 bit values to maintain parity with > + * userspace values > + */ > + if (DISPLAY_VER(dev_priv) >= 14) > + val = mul_u32_u32(val, (1 << 16)) / (1 << 24); > + Here too please add a small helper for the conversion. BR, Jani. > lut[i].red = val; > lut[i].green = val; > lut[i].blue = val;
Hello Jani, > -----Original Message----- > From: Jani Nikula <jani.nikula@linux.intel.com> > Sent: Monday, June 26, 2023 5:53 PM > To: Borah, Chaitanya Kumar <chaitanya.kumar.borah@intel.com>; intel- > gfx@lists.freedesktop.org > Subject: Re: [Intel-gfx] [PATCH 2/2] drm/i915/color: For MTL convert 24 bit lut > values to 16 bit > > On Mon, 26 Jun 2023, Chaitanya Kumar Borah > <chaitanya.kumar.borah@intel.com> wrote: > > For MTL and beyond, convert back the 24 bit lut values read from HW to > > 16 bit values to maintain parity with userspace values. This way we > > avoid pipe config mismatch for pre-csc lut values. > > > > Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> > > --- > > drivers/gpu/drm/i915/display/intel_color.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/gpu/drm/i915/display/intel_color.c > > b/drivers/gpu/drm/i915/display/intel_color.c > > index 25c73e2e6fa3..856191640e71 100644 > > --- a/drivers/gpu/drm/i915/display/intel_color.c > > +++ b/drivers/gpu/drm/i915/display/intel_color.c > > @@ -3477,6 +3477,14 @@ static struct drm_property_blob > *glk_read_degamma_lut(struct intel_crtc *crtc) > > for (i = 0; i < lut_size; i++) { > > u32 val = intel_de_read_fw(dev_priv, > PRE_CSC_GAMC_DATA(pipe)); > > > > + /* > > + * For MTL and beyond, convert back the 24 bit lut values > > + * read from HW to 16 bit values to maintain parity with > > + * userspace values > > + */ > > + if (DISPLAY_VER(dev_priv) >= 14) > > + val = mul_u32_u32(val, (1 << 16)) / (1 << 24); > > + > > Here too please add a small helper for the conversion. > Thank you for the comment. I have sent a new version with a helper function. Please let me know if you see any pitfalls with it. Regards Chaitanya. > BR, > Jani. > > > lut[i].red = val; > > lut[i].green = val; > > lut[i].blue = val; > > -- > Jani Nikula, Intel Open Source Graphics Center
diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c index 25c73e2e6fa3..856191640e71 100644 --- a/drivers/gpu/drm/i915/display/intel_color.c +++ b/drivers/gpu/drm/i915/display/intel_color.c @@ -3477,6 +3477,14 @@ static struct drm_property_blob *glk_read_degamma_lut(struct intel_crtc *crtc) for (i = 0; i < lut_size; i++) { u32 val = intel_de_read_fw(dev_priv, PRE_CSC_GAMC_DATA(pipe)); + /* + * For MTL and beyond, convert back the 24 bit lut values + * read from HW to 16 bit values to maintain parity with + * userspace values + */ + if (DISPLAY_VER(dev_priv) >= 14) + val = mul_u32_u32(val, (1 << 16)) / (1 << 24); + lut[i].red = val; lut[i].green = val; lut[i].blue = val;
For MTL and beyond, convert back the 24 bit lut values read from HW to 16 bit values to maintain parity with userspace values. This way we avoid pipe config mismatch for pre-csc lut values. Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> --- drivers/gpu/drm/i915/display/intel_color.c | 8 ++++++++ 1 file changed, 8 insertions(+)