From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/6] drm/i915: Don't use split gamma when we don't have to
Date: Fri, 29 Mar 2019 15:49:26 +0200 [thread overview]
Message-ID: <20190329134926.GZ3888@intel.com> (raw)
In-Reply-To: <20190329104702.GU3888@intel.com>
On Fri, Mar 29, 2019 at 12:47:02PM +0200, Ville Syrjälä wrote:
> On Thu, Mar 28, 2019 at 05:16:03PM -0700, Matt Roper wrote:
> > On Thu, Mar 28, 2019 at 11:05:01PM +0200, Ville Syrjala wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > >
> > > Using the split gamma mode when we don't have to has the annoying
> > > requirement of loading a linear LUT to the unused half. Instead
> > > let's make life simpler by switching to the 10bit gamma mode
> > > and duplicating each entry.
> > >
> > > This also allows us to load the software gamma LUT into the
> > > hardware degamma LUT, thus removing some of the buggy
> > > configurations we currently allow (YCbCr/limited range RGB
> > > + gamma LUT). We do still have other configurations that are
> > > also buggy, but those will need more complicated fixes
> > > or they just need to be rejected. Sadly GLK doesn't have
> > > this flexibility anymore and the degamma and gamma LUTs
> > > are very different so no help there.
> > >
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > > drivers/gpu/drm/i915/i915_reg.h | 1 +
> > > drivers/gpu/drm/i915/intel_color.c | 159 +++++++++++++++--------------
> > > 2 files changed, 86 insertions(+), 74 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > > index c866379a521b..eb7e93354cfe 100644
> > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > @@ -10127,6 +10127,7 @@ enum skl_power_gate {
> > > #define PAL_PREC_SPLIT_MODE (1 << 31)
> > > #define PAL_PREC_AUTO_INCREMENT (1 << 15)
> > > #define PAL_PREC_INDEX_VALUE_MASK (0x3ff << 0)
> > > +#define PAL_PREC_INDEX_VALUE(x) ((x) << 0)
> > > #define _PAL_PREC_DATA_A 0x4A404
> > > #define _PAL_PREC_DATA_B 0x4AC04
> > > #define _PAL_PREC_DATA_C 0x4B404
> > > diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
> > > index d7c38a2bbd8f..ed4bd9bd15f5 100644
> > > --- a/drivers/gpu/drm/i915/intel_color.c
> > > +++ b/drivers/gpu/drm/i915/intel_color.c
> > > @@ -466,72 +466,32 @@ static void skl_color_commit(const struct intel_crtc_state *crtc_state)
> > > ilk_load_csc_matrix(crtc_state);
> > > }
> > >
> > > -static void bdw_load_degamma_lut(const struct intel_crtc_state *crtc_state)
> > > +static void bdw_load_lut_10(struct intel_crtc *crtc,
> > > + const struct drm_property_blob *blob,
> > > + u32 prec_index, bool duplicate)
> > > {
> > > - struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> > > struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> > > - const struct drm_property_blob *degamma_lut = crtc_state->base.degamma_lut;
> > > - u32 i, lut_size = INTEL_INFO(dev_priv)->color.degamma_lut_size;
> > > + const struct drm_color_lut *lut = blob->data;
> > > + int i, lut_size = drm_color_lut_size(blob);
> > > enum pipe pipe = crtc->pipe;
> > >
> > > - I915_WRITE(PREC_PAL_INDEX(pipe),
> > > - PAL_PREC_SPLIT_MODE | PAL_PREC_AUTO_INCREMENT);
> > > -
> > > - if (degamma_lut) {
> > > - const struct drm_color_lut *lut = degamma_lut->data;
> > > + I915_WRITE(PREC_PAL_INDEX(pipe), prec_index |
> > > + PAL_PREC_AUTO_INCREMENT);
> > >
> > > - for (i = 0; i < lut_size; i++)
> > > - I915_WRITE(PREC_PAL_DATA(pipe), ilk_lut_10(&lut[i]));
> > > - } else {
> > > + /*
> > > + * We advertize the split gamma sizes. When not using split
> > > + * gamma we just duplicate each entry.
> > > + *
> > > + * TODO: expose the full LUT to userspace
> >
> > Any reason not to just do this immediately? Throwing away half the
> > table entries if we decide we need split mode doesn't seem any harder
> > than duplicating the entries when we decide we don't. The color
> > management kerneldoc already explicitly recommends this approach for
> > hardware that can support multiple gamma modes, so I don't think we need
> > any new ABI to handle it.
>
> Hmm. I guess that apporach could be doable. It might be a bit annoying
> for userspace though if it expects a direct color visual. But at least
> for X we won't use degamma/ctm anyway so seems like it should work out
> just fine.
As usual this needs a bit of care when picking the LUT entries we
use. I think I'll send that as a followup.
--
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-03-29 13:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-28 21:04 [PATCH 0/6] drm/i915: Finish the GAMMA_LUT stuff Ville Syrjala
2019-03-28 21:05 ` [PATCH 1/6] drm/i915: Extract ilk_lut_10() Ville Syrjala
2019-03-29 0:15 ` Matt Roper
2019-03-28 21:05 ` [PATCH 2/6] drm/i915: Don't use split gamma when we don't have to Ville Syrjala
2019-03-29 0:16 ` Matt Roper
2019-03-29 10:47 ` Ville Syrjälä
2019-03-29 12:25 ` Shankar, Uma
2019-03-29 13:49 ` Ville Syrjälä [this message]
2019-03-29 14:14 ` [PATCH v2 " Ville Syrjala
2019-03-28 21:05 ` [PATCH 3/6] drm/i915: Implement split/10bit gamma for ivb/hsw Ville Syrjala
2019-03-29 0:16 ` Matt Roper
2019-03-28 21:05 ` [PATCH 4/6] drm/i915: Add 10bit LUT for ilk/snb Ville Syrjala
2019-03-29 0:17 ` Matt Roper
2019-03-29 10:07 ` Maarten Lankhorst
2019-03-28 21:05 ` [PATCH 5/6] drm/i915: Add "10.6" LUT mode for i965+ Ville Syrjala
2019-04-04 23:52 ` Sripada, Radhakrishna
2019-03-28 21:05 ` [PATCH 6/6] drm/i915: Expose the legacy LUT via the GAMMA_LUT/GAMMA_LUT_SIZE props on gen2/3 Ville Syrjala
2019-04-04 16:52 ` Sripada, Radhakrishna
2019-03-28 22:06 ` ✓ Fi.CI.BAT: success for drm/i915: Finish the GAMMA_LUT stuff Patchwork
2019-03-29 8:34 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-03-29 10:57 ` Ville Syrjälä
2019-03-29 15:26 ` ✓ Fi.CI.BAT: success for drm/i915: Finish the GAMMA_LUT stuff (rev2) Patchwork
2019-03-29 19:13 ` ✗ Fi.CI.IGT: failure " 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=20190329134926.GZ3888@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.d.roper@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