From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org,
ankit.k.nautiyal@intel.com
Subject: Re: [v9][PATCH 03/11] drm/i915/display: Add func to compare hw/sw gamma lut
Date: Mon, 9 Sep 2019 17:19:49 +0300 [thread overview]
Message-ID: <20190909141949.GX7482@intel.com> (raw)
In-Reply-To: <87a7bd36c2.fsf@intel.com>
On Mon, Sep 09, 2019 at 05:14:05PM +0300, Jani Nikula wrote:
> On Mon, 09 Sep 2019, "Sharma, Swati2" <swati2.sharma@intel.com> wrote:
> > On 30-Aug-19 6:17 PM, Jani Nikula wrote:
> >> On Fri, 30 Aug 2019, Swati Sharma <swati2.sharma@intel.com> wrote:
> >>> Add func intel_color_lut_equal() to compare hw/sw gamma
> >>> lut values. Since hw/sw gamma lut sizes and lut entries comparison
> >>> will be different for different gamma modes, add gamma mode dependent
> >>> checks.
> >>>
> >>> v3: -Rebase
> >>> v4: -Renamed intel_compare_color_lut() to intel_color_lut_equal() [Jani]
> >>> -Added the default label above the correct label [Jani]
> >>> -Corrected smatch warn "variable dereferenced before check"
> >>> [Dan Carpenter]
> >>> v5: -Added condition (!blob1 && !blob2) return true [Jani]
> >>> v6: -Made patch11 as patch3 [Jani]
> >>> v8: -Split patch 3 into 4 patches
> >>> -Optimized blob check condition [Ville]
> >>> v9: -Exclude spilt gamma mode (bdw and ivb platforms)
> >>> as there is exception in way gamma values are written in
> >>> hardware [Ville]
> >>> -Added exception made in commit [Uma]
> >>> -Dropeed else, character limit and indentation [Uma]
> >>> -Added multi segmented gama mode for icl+ platforms [Uma]
> >>>
> >>> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> >>> ---
> >>> drivers/gpu/drm/i915/display/intel_color.c | 104 +++++++++++++++++++++++++++++
> >>> drivers/gpu/drm/i915/display/intel_color.h | 6 ++
> >>> 2 files changed, 110 insertions(+)
> >>>
> >>> diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
> >>> index dcc65d7..141efb0 100644
> >>> --- a/drivers/gpu/drm/i915/display/intel_color.c
> >>> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> >>> @@ -1470,6 +1470,110 @@ int intel_color_get_gamma_bit_precision(const struct intel_crtc_state *crtc_stat
> >>> return 0;
> >>> }
> >>>
> >>> +static inline bool err_check(struct drm_color_lut *sw_lut,
> >>
> >> Please drop the inline throughout in .c files. For static functions the
> >> compiler will make the best call what to do here.
> >>
> >>> + struct drm_color_lut *hw_lut, u32 err)
> >>> +{
> >>> + return ((abs((long)hw_lut->red - sw_lut->red)) <= err) &&
> >>> + ((abs((long)hw_lut->blue - sw_lut->blue)) <= err) &&
> >>> + ((abs((long)hw_lut->green - sw_lut->green)) <= err);
> >>> +}
> >>> +
> >>> +static inline bool intel_color_lut_entry_equal(struct drm_color_lut *sw_lut,
> >>> + struct drm_color_lut *hw_lut,
> >>> + int hw_lut_size, u32 err)
> >>> +{
> >>> + int i;
> >>> +
> >>> + for (i = 0; i < hw_lut_size; i++) {
> >>> + if (!err_check(&hw_lut[i], &sw_lut[i], err))
> >>> + return false;
> >>> + }
> >>> +
> >>> + return true;
> >>> +}
> >>> +
> >>> +static inline bool intel_color_lut_entry_equal_multi(struct drm_color_lut *sw_lut,
> >>> + struct drm_color_lut *hw_lut,
> >>> + u32 err)
> >>> +{
> >>> + int i;
> >>> +
> >>> + for (i = 0; i < 9; i++) {
> >>> + if (!err_check(&hw_lut[i], &sw_lut[i], err))
> >>> + return false;
> >>> + }
> >>> +
> >>> + for (i = 1; i < 257; i++) {
> >>> + if (!err_check(&hw_lut[8 + i], &sw_lut[i * 8], err))
> >>> + return false;
> >>> + }
> >>> +
> >>> + for (i = 0; i < 256; i++) {
> >>> + if (!err_check(&hw_lut[265 + i], &sw_lut[i * 8 * 128], err))
> >>> + return false;
> >>> + }
> >>> +
> >>> + return true;
> >>> +}
> >>> +
> >>> +bool intel_color_lut_equal(struct drm_property_blob *blob1,
> >>> + struct drm_property_blob *blob2,
> >>> + u32 gamma_mode, u32 bit_precision)
> >>> +{
> >>> + struct drm_color_lut *sw_lut, *hw_lut;
> >>> + int sw_lut_size, hw_lut_size;
> >>> + u32 err;
> >>> +
> >>> + if (!blob1 != !blob2)
> >>> + return false;
> >>> +
> >>> + if (!blob1)
> >>> + return true;
> >>> +
> >>> + sw_lut_size = drm_color_lut_size(blob1);
> >>> + hw_lut_size = drm_color_lut_size(blob2);
> >>
> >> Basically the code here shouldn't assume one is hw state and the other
> >> is sw state...
> >>
> >>> +
> >>> + /* check sw and hw lut size */
> >>> + switch (gamma_mode) {
> >>> + case GAMMA_MODE_MODE_8BIT:
> >>> + case GAMMA_MODE_MODE_10BIT:
> >>> + if (sw_lut_size != hw_lut_size)
> >>> + return false;
> >>> + break;
> >>> + case GAMMA_MODE_MODE_12BIT_MULTI_SEGMENTED:
> >>> + if ((sw_lut_size != 262145) || (hw_lut_size != 521))
> >>> + return false;
> >>
> >> The readout code should result in a blob similar to the hardware
> >> state. Assuming distinct hw and sw, you'll bypass fastset on icl
> >> whenever multisegmented gamma is enabled! See
> >> intel_crtc_check_fastset().
> >>
> >> Ville also pointed out that on fastboot, the state read out from the
> >> hardware is presented to the userspace, resulting in a bogus 521 lut
> >> size.
> >>
> >> So the readout code for multisegmented gamma has to come up with some
> >> intermediate entries that aren't preserved in hardware. Not unlike the
> >> precision is lost in hardware. Those may be read out by the userspace
> >> after fastboot. The compare code has to ignore those interpolated
> >> values, and only look at the values that have been read from the
> >> hardware.
> >>
> > Hi Jani,
> > As you stated readout code should result in a blob similar to hardware
> > state and readout code for multi-seg gamma has to come up with
> > "intermediate values". Do these intermediate values need to be some
> > logical values or any junk values while creating a hw blob?
>
> Preferrably sensible values, as they may be read out by the userspace
> after fastboot. But it can be the simplest interpolation I think.
The hardware uses linear interpolation anyway, so no point in doing
anything fancier in software either.
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-09-09 14:19 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-30 8:31 [v9][PATCH 00/11] drm/i915: adding state checker for gamma lut values Swati Sharma
2019-08-30 8:31 ` [v9][PATCH 01/11] drm/i915/display: Add func to get gamma bit precision Swati Sharma
2019-08-30 12:02 ` Jani Nikula
2019-08-30 12:04 ` Jani Nikula
2019-08-30 12:05 ` Jani Nikula
2019-08-30 8:31 ` [v9][PATCH 02/11] drm/i915/display: Add debug log for color parameters Swati Sharma
2019-08-30 12:06 ` Jani Nikula
2019-08-30 8:31 ` [v9][PATCH 03/11] drm/i915/display: Add func to compare hw/sw gamma lut Swati Sharma
2019-08-30 12:47 ` Jani Nikula
2019-09-09 13:53 ` Sharma, Swati2
2019-09-09 14:14 ` Jani Nikula
2019-09-09 14:19 ` Ville Syrjälä [this message]
2019-08-30 8:31 ` [v9][PATCH 04/11] drm/i915/display: Add macro to compare gamma hw/sw lut Swati Sharma
2019-08-30 8:31 ` [v9][PATCH 05/11] drm/i915/display: Extract i9xx_read_luts() Swati Sharma
2019-08-30 12:54 ` Jani Nikula
2019-08-30 8:31 ` [v9][PATCH 06/11] drm/i915/display: Extract i965_read_luts() Swati Sharma
2019-08-30 13:08 ` Jani Nikula
2019-08-30 8:31 ` [v9][PATCH 07/11] drm/i915/display: Extract chv_read_luts() Swati Sharma
2019-08-30 13:15 ` Jani Nikula
2019-08-30 8:31 ` [v9][PATCH 08/11] drm/i915/display: Extract ilk_read_luts() Swati Sharma
2019-08-30 13:18 ` Jani Nikula
2019-08-30 8:31 ` [v9][PATCH 09/11] drm/i915/display: Extract glk_read_luts() Swati Sharma
2019-08-30 8:31 ` [v9][PATCH 10/11] drm/i915/display: Extract icl_read_luts() Swati Sharma
2019-08-30 8:31 ` [v9][PATCH 11/11] FOR_TESTING_ONLY: Print rgb values of hw and sw blobs Swati Sharma
2019-08-30 9:39 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: adding state checker for gamma lut values (rev13) Patchwork
2019-08-30 9:44 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-08-30 10:01 ` ✓ Fi.CI.BAT: success " Patchwork
2019-08-31 3:01 ` ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190909141949.GX7482@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox