From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Peter_Fr=C3=BChberger?= Subject: Re: [PATCH] Implement Limited Video Range Date: Fri, 11 Nov 2016 09:53:35 +0100 Message-ID: References: <20151130084332.GP17050@phenom.ffwll.local> <20151130141103.GR4437@intel.com> <20161109202548.GB31595@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1398626610==" Return-path: Received: from mail-it0-x243.google.com (mail-it0-x243.google.com [IPv6:2607:f8b0:4001:c0b::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6BF516E1E6 for ; Fri, 11 Nov 2016 08:53:36 +0000 (UTC) Received: by mail-it0-x243.google.com with SMTP id q124so9217576itd.1 for ; Fri, 11 Nov 2016 00:53:36 -0800 (PST) In-Reply-To: <20161109202548.GB31595@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============1398626610== Content-Type: multipart/alternative; boundary=001a113d632e1f9677054102a074 --001a113d632e1f9677054102a074 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I was implementing this suggestion today and I think that will confuse users and also devs maintaining that code. Out of the following reason: compress_color_range can be true or false, it does not reference a mode, but an additional setting that only influences color clamping / scaling. What do we expect if someone runs in Full Range and has compress_color_range set to true? Also what do we expect if someone runs in Limited Range and additionally set this flag to true? In some cases it would do nothing and was not transparent. In my original patch I implemented a new mode, which was: Video Range 16:235. That meant: Tell Limited info frame, don't alter any colors. It was a combination of two things: limited info frame + compress_color_range =3D false; The driver code mainly uses: intel_hdmi->limited_color_range to distinguish if colors should be clamped or not. Therefore if the above value was set, that just needed setting to false. I think if we decide for a compress_color_range bool, it should not work as an entire new mode but as an option to alter current mode, meaning something not set via "BroadCast RGB". Any thoughts on that matter? On Wed, Nov 9, 2016 at 9:25 PM, Ville Syrj=C3=A4l=C3=A4 wrote: > On Wed, Nov 09, 2016 at 09:11:58PM +0100, Peter Fr=C3=BChberger wrote: > > I am currently not sure what the way forward should be. > > > > We are successfully implementing this patch in e.g. LibreELEC an embedd= ed > > distribution for home theater pcs. But through current bug reports - I = am > > not sure, if we should give such functionality to the user, that is > > overwritten on a lower level, e.g. it does not what the user expects. > > > > E.g. since some time displays are driven with 10 or 12 bit from the int= el > > driver, image data is dithered, scaled back and forth without being > > transparent for the user. In fact we have some users with hdmi capture > > cards, coming back to us if some decoded values of their video stuff do= es > > not match. > > Re-reading what was written (can't remember anymore obviously), I think > what both me and Daniel were after was a cleaner separation of the > "what should the infoframe say?" and "how should we mangle the color > data?". > > Daniel's "limit_color_range" is a wee bit too similar looking to > "limited_color_range" for my liking. So how about we go with something > like "bool compress_color_range". It also conveys the fact that we're > not just clamping things. Any objections/thoughts/better ideas? > > > > > Best regards > > Peter > > > > On Mon, Nov 30, 2015 at 3:11 PM, Ville Syrj=C3=A4l=C3=A4 < > > ville.syrjala@linux.intel.com> wrote: > > > > > On Mon, Nov 30, 2015 at 09:43:32AM +0100, Daniel Vetter wrote: > > > > On Mon, Nov 30, 2015 at 08:08:48AM +0100, Peter Fr=C3=BChberger wro= te: > > > > > (Resent cause of moderation) > > > > > > > > > > This implements a highly needed feature in a minimal non > instructive > > > way. > > > > > Consider a Limited Range display (like most TVs) where you want t= o > > > watch a > > > > > decoded video. The TV is set to limited range and the intel drive= r > also > > > > > uses full scaling Limited 16:235 mode, e.g. if you display the gr= ay > > > value > > > > > 16 - the driver will postprocess it to something like ~ 22. > > > > > > > > > > The following happens currently in linux intel video world: > > > > > Video is decoded with e.g. vaapi, the decoded surface is either > used > > > via > > > > > EGL directly in Limited Range. Limited Range processing takes pla= ce > > > and at > > > > > the end while rendering the intel driver will scale down the > limited > > > range > > > > > data again as it cannot distunguish of the data it gets when e.g. > > > rendering > > > > > with OpenGL like we succesfully do in kodi. > > > > > > > > > > Another use case is vaapi when using the old vaCopySurfaceGLX > > > > > (vaPutSurface) which would automatically use BT601 / BT709 matrix > to > > > > > upscale the content without any dithering to Full Range RGB. Late= r > on > > > this > > > > > is scaled down again with the Limited 16:235 setting and output. > > > Quality > > > > > degrades two times. > > > > > > > > > > Users and applications widely used want to make sure that colors > > > appear on > > > > > screen like they were processed after the last processing step. I= n > > > video > > > > > case two use cases make sense: > > > > > > > > > > a) scaling limited range to full range with dithering applied whe= n > you > > > need > > > > > to output fullrange > > > > > b) already having limited range and outputting that without any > further > > > > > touching by the driver > > > > > > > > > > Use case a) is already possible. Usecase b) will be possible with > the > > > > > attached patch. It is a possibility to get Limited Range on scree= n > in > > > > > perfect quality in 2k15. > > > > > > > > > > For the future a userspace api to provide info frames and so on i= n > a > > > > > generic way should be considered but until we have this I bet we > have 2 > > > > > years to go. This solution also works on X11 (without wayland) an= d > is > > > > > useful for existing applications. > > > > > > > > > > Thanks much for consideration. > > > > > > > > > > --- > > > > > From deaa9d730c08aefefe3671d073d93d970bb39a31 Mon Sep 17 00:00:00 > 2001 > > > > > From: fritsch > > > > > Date: Sun, 29 Nov 2015 16:38:14 +0100 > > > > > Subject: [PATCH] Intel: Implement Video Color Range > > > > > > > > > > --- > > > > > drivers/gpu/drm/i915/i915_drv.h | 1 + > > > > > drivers/gpu/drm/i915/intel_display.c | 4 ++-- > > > > > drivers/gpu/drm/i915/intel_drv.h | 8 ++++++++ > > > > > drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++++++++++-- > > > > > drivers/gpu/drm/i915/intel_modes.c | 1 + > > > > > 5 files changed, 27 insertions(+), 4 deletions(-) > > > > > > > > > > diff --git a/drivers/gpu/drm/i915/i915_drv.h > > > > > b/drivers/gpu/drm/i915/i915_drv.h > > > > > index 95bb27d..e453461 100644 > > > > > --- a/drivers/gpu/drm/i915/i915_drv.h > > > > > +++ b/drivers/gpu/drm/i915/i915_drv.h > > > > > @@ -3449,6 +3449,7 @@ int intel_freq_opcode(struct drm_i915_priva= te > > > > > *dev_priv, int val); > > > > > #define INTEL_BROADCAST_RGB_AUTO 0 > > > > > #define INTEL_BROADCAST_RGB_FULL 1 > > > > > #define INTEL_BROADCAST_RGB_LIMITED 2 > > > > > +#define INTEL_BROADCAST_RGB_VIDEO 3 > > > > > > > > > > static inline uint32_t i915_vgacntrl_reg(struct drm_device *dev) > > > > > { > > > > > diff --git a/drivers/gpu/drm/i915/intel_display.c > > > > > b/drivers/gpu/drm/i915/intel_display.c > > > > > index 71860f8..ea40d81 100644 > > > > > --- a/drivers/gpu/drm/i915/intel_display.c > > > > > +++ b/drivers/gpu/drm/i915/intel_display.c > > > > > @@ -8605,7 +8605,7 @@ static void intel_set_pipe_csc(struct > drm_crtc > > > *crtc) > > > > > * consideration. > > > > > */ > > > > > > > > > > - if (intel_crtc->config->limited_color_range) > > > > > + if (intel_crtc->config->limited_color_range && > > > > > !intel_crtc->config->video_color_range) > > > > > coeff =3D ((235 - 16) * (1 << 12) / 255) & 0xff8; /* 0.xxx... *= / > > > > > > > > > > /* > > > > > @@ -8629,7 +8629,7 @@ static void intel_set_pipe_csc(struct > drm_crtc > > > *crtc) > > > > > if (INTEL_INFO(dev)->gen > 6) { > > > > > uint16_t postoff =3D 0; > > > > > > > > > > - if (intel_crtc->config->limited_color_range) > > > > > + if (intel_crtc->config->limited_color_range && > > > > > !intel_crtc->config->video_color_range) > > > > > postoff =3D (16 * (1 << 12) / 255) & 0x1fff; > > > > > > > > > > I915_WRITE(PIPE_CSC_POSTOFF_HI(pipe), postoff); > > > > > diff --git a/drivers/gpu/drm/i915/intel_drv.h > > > > > b/drivers/gpu/drm/i915/intel_drv.h > > > > > index 0598932..6940243 100644 > > > > > --- a/drivers/gpu/drm/i915/intel_drv.h > > > > > +++ b/drivers/gpu/drm/i915/intel_drv.h > > > > > @@ -372,6 +372,13 @@ struct intel_crtc_state { > > > > > */ > > > > > bool limited_color_range; > > > > > > > > > > + /* > > > > > + * > > > > > + * Use reduced/limited/broadcast rgb range without compressing. > > > > > + * > > > > > + */ > > > > > + bool video_color_range; > > > > > > > > I think the names and semantics are confusion, resulting in > hard-to-read > > > > if conditions. What about: > > > > > > > > bool limit_color_range; /* should we limit from full->16:235 = in > > > > the encoder/csc? */ > > > > > > We might call this simply as "adjust_color_range" or something like > > > that. Then it would also work for the limited->full conversion if we > > > ever come up with some use case that would need such a thing. Althogu= h > > > it does mean we'd have to check both flags when deciding how to progr= am > > > the port/pipeconf range bit/pipe csc. > > > > > > > > > > > bool limited_color_range_output; /* set the infoframe or not? > */ > > > > > > > > Names aren't great yet I think, coffee's not yet working ;-) > > > > > > > > Thanks, Daniel > > > > > > > > > + > > > > > /* DP has a bunch of special case unfortunately, so mark the pi= pe > > > > > * accordingly. */ > > > > > bool has_dp_encoder; > > > > > @@ -682,6 +689,7 @@ struct intel_hdmi { > > > > > int ddc_bus; > > > > > bool limited_color_range; > > > > > bool color_range_auto; > > > > > + bool color_range_video; > > > > > bool has_hdmi_sink; > > > > > bool has_audio; > > > > > enum hdmi_force_audio force_audio; > > > > > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c > > > > > b/drivers/gpu/drm/i915/intel_hdmi.c > > > > > index 9eafa19..dc78760 100644 > > > > > --- a/drivers/gpu/drm/i915/intel_hdmi.c > > > > > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > > > > > @@ -464,7 +464,8 @@ static void intel_hdmi_set_avi_infoframe( > struct > > > > > drm_encoder *encoder, > > > > > } > > > > > > > > > > if (intel_hdmi->rgb_quant_range_selectable) { > > > > > - if (intel_crtc->config->limited_color_range) > > > > > + if (intel_crtc->config->limited_color_range || > > > > > + intel_crtc->config->video_color_range) > > > > > frame.avi.quantization_range =3D > > > > > HDMI_QUANTIZATION_RANGE_LIMITED; > > > > > else > > > > > @@ -1266,6 +1267,8 @@ bool intel_hdmi_compute_config(struct > > > intel_encoder > > > > > *encoder, > > > > > pipe_config->limited_color_range =3D > > > > > intel_hdmi->limited_color_range; > > > > > } > > > > > + if (intel_hdmi->color_range_video) > > > > > + pipe_config->video_color_range =3D true; > > > > > > > > > > if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) { > > > > > pipe_config->pixel_multiplier =3D 2; > > > > > @@ -1485,25 +1488,35 @@ intel_hdmi_set_property(struct > drm_connector > > > > > *connector, > > > > > if (property =3D=3D dev_priv->broadcast_rgb_property) { > > > > > bool old_auto =3D intel_hdmi->color_range_auto; > > > > > bool old_range =3D intel_hdmi->limited_color_range; > > > > > + bool old_range_video =3D intel_hdmi->color_range_video; > > > > > > > > > > switch (val) { > > > > > case INTEL_BROADCAST_RGB_AUTO: > > > > > intel_hdmi->color_range_auto =3D true; > > > > > + intel_hdmi->color_range_video =3D false; > > > > > break; > > > > > case INTEL_BROADCAST_RGB_FULL: > > > > > intel_hdmi->color_range_auto =3D false; > > > > > intel_hdmi->limited_color_range =3D false; > > > > > + intel_hdmi->color_range_video =3D false; > > > > > break; > > > > > case INTEL_BROADCAST_RGB_LIMITED: > > > > > intel_hdmi->color_range_auto =3D false; > > > > > intel_hdmi->limited_color_range =3D true; > > > > > + intel_hdmi->color_range_video =3D false; > > > > > + break; > > > > > + case INTEL_BROADCAST_RGB_VIDEO: > > > > > + intel_hdmi->color_range_auto =3D false; > > > > > + intel_hdmi->limited_color_range =3D true= ; > > > > > + intel_hdmi->color_range_video =3D true; > > > > > break; > > > > > default: > > > > > return -EINVAL; > > > > > } > > > > > > > > > > if (old_auto =3D=3D intel_hdmi->color_range_auto && > > > > > - old_range =3D=3D intel_hdmi->limited_color_range) > > > > > + old_range =3D=3D intel_hdmi->limited_color_range && > > > > > + old_range_video =3D=3D intel_hdmi->color_range_video) > > > > > return 0; > > > > > > > > > > goto done; > > > > > diff --git a/drivers/gpu/drm/i915/intel_modes.c > > > > > b/drivers/gpu/drm/i915/intel_modes.c > > > > > index 38a4c8c..c49681a 100644 > > > > > --- a/drivers/gpu/drm/i915/intel_modes.c > > > > > +++ b/drivers/gpu/drm/i915/intel_modes.c > > > > > @@ -103,6 +103,7 @@ static const struct drm_prop_enum_list > > > > > broadcast_rgb_names[] =3D { > > > > > { INTEL_BROADCAST_RGB_AUTO, "Automatic" }, > > > > > { INTEL_BROADCAST_RGB_FULL, "Full" }, > > > > > { INTEL_BROADCAST_RGB_LIMITED, "Limited 16:235" }, > > > > > + { INTEL_BROADCAST_RGB_VIDEO, "Video 16:235 pass-through" }, > > > > > }; > > > > > > > > > > void > > > > > -- > > > > > 2.5.0 > > > > > > > > > _______________________________________________ > > > > > Intel-gfx mailing list > > > > > Intel-gfx@lists.freedesktop.org > > > > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx > > > > > > > > > > > > -- > > > > Daniel Vetter > > > > Software Engineer, Intel Corporation > > > > http://blog.ffwll.ch > > > > _______________________________________________ > > > > Intel-gfx mailing list > > > > Intel-gfx@lists.freedesktop.org > > > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx > > > > > > -- > > > Ville Syrj=C3=A4l=C3=A4 > > > Intel OTC > > > > > -- > Ville Syrj=C3=A4l=C3=A4 > Intel OTC > --001a113d632e1f9677054102a074 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I was implementing this suggestion = today and I think that will confuse users and also devs maintaining that co= de. Out of the following reason:
c= ompress_color_range can be true or false, it does not reference a mode, but= an additional setting that only influences color clamping / scaling.

What do we expect if someone runs in Full Range an= d has compress_color_range set to true? Also what do we expect if someone r= uns in Limited Range and additionally set this flag to true? In some cases = it would do nothing and was not transparent.

In= my original patch I implemented a new mode, which was: Video Range 16:235.= That meant: Tell Limited info frame, don't alter any colors. It was a = combination of two things: limited info frame + compress_color_range =3D fa= lse;

= The driver code mainly uses:=C2=A0intel_hdmi= ->limited_color_range to distinguish if colors should be clamped or not.= Therefore if the above value was set, that just needed setting to false.

I think if we decide for a=C2=A0compress_color_range bool, it should not work as an ent= ire new mode but as an option to alter current mode, meaning something not = set via "BroadCast RGB".

Any thoughts o= n that matter?

On Wed, Nov 9, 2016 at 9:25 PM, Ville Syrj=C3=A4l=C3=A4 <ville.syrjala@linux.intel.com> wrote:
On Wed, Nov 09, 2016 at 09:11:58PM = +0100, Peter Fr=C3=BChberger wrote:
> I am currently not sure what the way forward should be.
>
> We are successfully implementing this patch in e.g. LibreELEC an embed= ded
> distribution for home theater pcs. But through current bug reports - I= am
> not sure, if we should give such functionality to the user, that is > overwritten on a lower level, e.g. it does not what the user expects.<= br> >
> E.g. since some time displays are driven with 10 or 12 bit from the in= tel
> driver, image data is dithered, scaled back and forth without being > transparent for the user. In fact we have some users with hdmi capture=
> cards, coming back to us if some decoded values of their video stuff d= oes
> not match.

Re-reading what was written (can't remember anymore obviously), = I think
what both me and Daniel were after was a cleaner separation of the
"what should the infoframe say?" and "how should we mangle t= he color data?".

Daniel's "limit_color_range" is a wee bit too similar looking= to
"limited_color_range" for my liking. So how about we go with some= thing
like "bool compress_color_range". It also conveys the fact that w= e're
not just clamping things. Any objections/thoughts/better ideas?

>
> Best regards
> Peter
>
> On Mon, Nov 30, 2015 at 3:11 PM, Ville Syrj=C3=A4l=C3=A4 <
> ville.syrjala@linux.i= ntel.com> wrote:
>
> > On Mon, Nov 30, 2015 at 09:43:32AM +0100, Daniel Vetter wrote: > > > On Mon, Nov 30, 2015 at 08:08:48AM +0100, Peter Fr=C3=BChber= ger wrote:
> > > > (Resent cause of moderation)
> > > >
> > > > This implements a highly needed feature in a minimal no= n instructive
> > way.
> > > > Consider a Limited Range display (like most TVs) where = you want to
> > watch a
> > > > decoded video. The TV is set to limited range and the i= ntel driver also
> > > > uses full scaling Limited 16:235 mode, e.g. if you disp= lay the gray
> > value
> > > > 16 - the driver will postprocess it to something like ~= 22.
> > > >
> > > > The following happens currently in linux intel video wo= rld:
> > > > Video is decoded with e.g. vaapi, the decoded surface i= s either used
> > via
> > > > EGL directly in Limited Range. Limited Range processing= takes place
> > and at
> > > > the end while rendering the intel driver will scale dow= n the limited
> > range
> > > > data again as it cannot distunguish of the data it gets= when e.g.
> > rendering
> > > > with OpenGL like we succesfully do in kodi.
> > > >
> > > > Another use case is vaapi when using the old vaCopySurf= aceGLX
> > > > (vaPutSurface) which would automatically use BT601 / BT= 709 matrix to
> > > > upscale the content without any dithering to Full Range= RGB. Later on
> > this
> > > > is scaled down again with the Limited 16:235 setting an= d output.
> > Quality
> > > > degrades two times.
> > > >
> > > > Users and applications widely used want to make sure th= at colors
> > appear on
> > > > screen like they were processed after the last processi= ng step. In
> > video
> > > > case two use cases make sense:
> > > >
> > > > a) scaling limited range to full range with dithering a= pplied when you
> > need
> > > > to output fullrange
> > > > b) already having limited range and outputting that wit= hout any further
> > > > touching by the driver
> > > >
> > > > Use case a) is already possible. Usecase b) will be pos= sible with the
> > > > attached patch. It is a possibility to get Limited Rang= e on screen in
> > > > perfect quality in 2k15.
> > > >
> > > > For the future a userspace api to provide info frames a= nd so on in a
> > > > generic way should be considered but until we have this= I bet we have 2
> > > > years to go. This solution also works on X11 (without w= ayland) and is
> > > > useful for existing applications.
> > > >
> > > > Thanks much for consideration.
> > > >
> > > > ---
> > > > From deaa9d730c08aefefe3671d073d93d970bb39a31 Mon = Sep 17 00:00:00 2001
> > > > From: fritsch <peter.fruehberger@gmail.com>
> > > > Date: Sun, 29 Nov 2015 16:38:14 +0100
> > > > Subject: [PATCH] Intel: Implement Video Color Range
> > > >
> > > > ---
> > > >=C2=A0 drivers/gpu/drm/i915/i915_drv.h=C2=A0 =C2=A0= =C2=A0 |=C2=A0 1 +
> > > >=C2=A0 drivers/gpu/drm/i915/intel_display.c |=C2=A0= 4 ++--
> > > >=C2=A0 drivers/gpu/drm/i915/intel_drv.h=C2=A0 =C2= =A0 =C2=A0|=C2=A0 8 ++++++++
> > > >=C2=A0 drivers/gpu/drm/i915/intel_hdmi.c=C2=A0 =C2= =A0 | 17 +++++++++++++++--
> > > >=C2=A0 drivers/gpu/drm/i915/intel_modes.c=C2=A0 =C2= =A0|=C2=A0 1 +
> > > >=C2=A0 5 files changed, 27 insertions(+), 4 deletions(-)=
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > > > b/drivers/gpu/drm/i915/i915_drv.h
> > > > index 95bb27d..e453461 100644
> > > > --- a/drivers/gpu/drm/i915/i915_drv.h
> > > > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > > > @@ -3449,6 +3449,7 @@ int intel_freq_opcode(struct drm_= i915_private
> > > > *dev_priv, int val);
> > > >=C2=A0 #define INTEL_BROADCAST_RGB_AUTO 0
> > > >=C2=A0 #define INTEL_BROADCAST_RGB_FULL 1
> > > >=C2=A0 #define INTEL_BROADCAST_RGB_LIMITED 2
> > > > +#define INTEL_BROADCAST_RGB_VIDEO 3
> > > >
> > > >=C2=A0 static inline uint32_t i915_vgacntrl_reg(struct d= rm_device *dev)
> > > >=C2=A0 {
> > > > diff --git a/drivers/gpu/drm/i915/intel_display.c<= br> > > > > b/drivers/gpu/drm/i915/intel_display.c
> > > > index 71860f8..ea40d81 100644
> > > > --- a/drivers/gpu/drm/i915/intel_display.c
> > > > +++ b/drivers/gpu/drm/i915/intel_display.c
> > > > @@ -8605,7 +8605,7 @@ static void intel_set_pipe_csc(st= ruct drm_crtc
> > *crtc)
> > > >=C2=A0 =C2=A0 * consideration.
> > > >=C2=A0 =C2=A0 */
> > > >
> > > > - if (intel_crtc->config->limited_color_rang= e)
> > > > + if (intel_crtc->config->limited_color_rang= e &&
> > > > !intel_crtc->config->video_color_range)
> > > >=C2=A0 =C2=A0coeff =3D ((235 - 16) * (1 << 12) / 2= 55) & 0xff8; /* 0.xxx... */
> > > >
> > > >=C2=A0 =C2=A0/*
> > > > @@ -8629,7 +8629,7 @@ static void intel_set_pipe_csc(st= ruct drm_crtc
> > *crtc)
> > > >=C2=A0 =C2=A0if (INTEL_INFO(dev)->gen > 6) {
> > > >=C2=A0 =C2=A0uint16_t postoff =3D 0;
> > > >
> > > > - if (intel_crtc->config->limited_color_rang= e)
> > > > + if (intel_crtc->config->limited_color_rang= e &&
> > > > !intel_crtc->config->video_color_range)
> > > >=C2=A0 =C2=A0postoff =3D (16 * (1 << 12) / 255) &a= mp; 0x1fff;
> > > >
> > > >=C2=A0 =C2=A0I915_WRITE(PIPE_CSC_POSTOFF_HI(pipe), = postoff);
> > > > diff --git a/drivers/gpu/drm/i915/intel_drv.h
> > > > b/drivers/gpu/drm/i915/intel_drv.h
> > > > index 0598932..6940243 100644
> > > > --- a/drivers/gpu/drm/i915/intel_drv.h
> > > > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > > > @@ -372,6 +372,13 @@ struct intel_crtc_state {
> > > >=C2=A0 =C2=A0 */
> > > >=C2=A0 =C2=A0bool limited_color_range;
> > > >
> > > > + /*
> > > > +=C2=A0 *
> > > > +=C2=A0 * Use reduced/limited/broadcast rgb range witho= ut compressing.
> > > > +=C2=A0 *
> > > > +=C2=A0 */
> > > > + bool video_color_range;
> > >
> > > I think the names and semantics are confusion, resulting in = hard-to-read
> > > if conditions. What about:
> > >
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0bool limit_color_range; /* should = we limit from full->16:235 in
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0the encoder/csc? */
> >
> > We might call this simply as "adjust_color_range" or so= mething like
> > that. Then it would also work for the limited->full conversion= if we
> > ever come up with some use case that would need such a thing. Alt= hoguh
> > it does mean we'd have to check both flags when deciding how = to program
> > the port/pipeconf range bit/pipe csc.
> >
> > >
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0bool limited_color_range_output; /= * set the infoframe or not? */
> > >
> > > Names aren't great yet I think, coffee's not yet wor= king ;-)
> > >
> > > Thanks, Daniel
> > >
> > > > +
> > > >=C2=A0 =C2=A0/* DP has a bunch of special case unfortuna= tely, so mark the pipe
> > > >=C2=A0 =C2=A0 * accordingly. */
> > > >=C2=A0 =C2=A0bool has_dp_encoder;
> > > > @@ -682,6 +689,7 @@ struct intel_hdmi {
> > > >=C2=A0 =C2=A0int ddc_bus;
> > > >=C2=A0 =C2=A0bool limited_color_range;
> > > >=C2=A0 =C2=A0bool color_range_auto;
> > > > + bool color_range_video;
> > > >=C2=A0 =C2=A0bool has_hdmi_sink;
> > > >=C2=A0 =C2=A0bool has_audio;
> > > >=C2=A0 =C2=A0enum hdmi_force_audio force_audio;
> > > > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
> > > > b/drivers/gpu/drm/i915/intel_hdmi.c
> > > > index 9eafa19..dc78760 100644
> > > > --- a/drivers/gpu/drm/i915/intel_hdmi.c
> > > > +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> > > > @@ -464,7 +464,8 @@ static void intel_hdmi_set_avi_info= frame(struct
> > > > drm_encoder *encoder,
> > > >=C2=A0 =C2=A0}
> > > >
> > > >=C2=A0 =C2=A0if (intel_hdmi->rgb_quant_range_sel= ectable) {
> > > > - if (intel_crtc->config->limited_color_rang= e)
> > > > + if (intel_crtc->config->limited_color_rang= e ||
> > > > +=C2=A0 =C2=A0 =C2=A0intel_crtc->config->video_color_range)
> > > >=C2=A0 =C2=A0frame.avi.quantization_range =3D
> > > >=C2=A0 =C2=A0HDMI_QUANTIZATION_RANGE_LIMITED;
> > > >=C2=A0 =C2=A0else
> > > > @@ -1266,6 +1267,8 @@ bool intel_hdmi_compute_config(struct
> > intel_encoder
> > > > *encoder,
> > > >=C2=A0 =C2=A0pipe_config->limited_color_range = =3D
> > > >=C2=A0 =C2=A0intel_hdmi->limited_color_range; > > > >=C2=A0 =C2=A0}
> > > > + if (intel_hdmi->color_range_video)
> > > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0pipe_config->video_color_range =3D true;
> > > >
> > > >=C2=A0 =C2=A0if (adjusted_mode->flags & DRM_MODE_= FLAG_DBLCLK) {
> > > >=C2=A0 =C2=A0pipe_config->pixel_multiplier =3D 2;
> > > > @@ -1485,25 +1488,35 @@ intel_hdmi_set_property(struct = drm_connector
> > > > *connector,
> > > >=C2=A0 =C2=A0if (property =3D=3D dev_priv->broadcast_= rgb_property) {
> > > >=C2=A0 =C2=A0bool old_auto =3D intel_hdmi->color_rang= e_auto;
> > > >=C2=A0 =C2=A0bool old_range =3D intel_hdmi->limited_c= olor_range;
> > > > + bool old_range_video =3D intel_hdmi->color_range_v= ideo;
> > > >
> > > >=C2=A0 =C2=A0switch (val) {
> > > >=C2=A0 =C2=A0case INTEL_BROADCAST_RGB_AUTO:
> > > >=C2=A0 =C2=A0intel_hdmi->color_range_auto =3D true; > > > > + intel_hdmi->color_range_video =3D false;
> > > >=C2=A0 =C2=A0break;
> > > >=C2=A0 =C2=A0case INTEL_BROADCAST_RGB_FULL:
> > > >=C2=A0 =C2=A0intel_hdmi->color_range_auto =3D false;<= br> > > > >=C2=A0 =C2=A0intel_hdmi->limited_color_range =3D= false;
> > > > + intel_hdmi->color_range_video =3D false;
> > > >=C2=A0 =C2=A0break;
> > > >=C2=A0 =C2=A0case INTEL_BROADCAST_RGB_LIMITED:
> > > >=C2=A0 =C2=A0intel_hdmi->color_range_auto =3D false;<= br> > > > >=C2=A0 =C2=A0intel_hdmi->limited_color_range =3D= true;
> > > > + intel_hdmi->color_range_video =3D false;
> > > > + break;
> > > > + case INTEL_BROADCAST_RGB_VIDEO:
> > > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 intel_hdmi->color_range_auto =3D false;<= br> > > > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 intel_hdmi->limited_color_range =3D= true;
> > > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 intel_hdmi->color_range_video =3D true;<= br> > > > >=C2=A0 =C2=A0break;
> > > >=C2=A0 =C2=A0default:
> > > >=C2=A0 =C2=A0return -EINVAL;
> > > >=C2=A0 =C2=A0}
> > > >
> > > >=C2=A0 =C2=A0if (old_auto =3D=3D intel_hdmi->color_ra= nge_auto &&
> > > > -=C2=A0 =C2=A0 =C2=A0old_range =3D=3D intel_hdmi->li= mited_color_range)
> > > > +=C2=A0 =C2=A0 =C2=A0old_range =3D=3D intel_hdmi->li= mited_color_range &&
> > > > +=C2=A0 =C2=A0 =C2=A0old_range_video =3D=3D intel_hdmi-= >color_range_video)
> > > >=C2=A0 =C2=A0return 0;
> > > >
> > > >=C2=A0 =C2=A0goto done;
> > > > diff --git a/drivers/gpu/drm/i915/intel_modes.c > > > > b/drivers/gpu/drm/i915/intel_modes.c
> > > > index 38a4c8c..c49681a 100644
> > > > --- a/drivers/gpu/drm/i915/intel_modes.c
> > > > +++ b/drivers/gpu/drm/i915/intel_modes.c
> > > > @@ -103,6 +103,7 @@ static const struct drm_prop_enum_l= ist
> > > > broadcast_rgb_names[] =3D {
> > > >=C2=A0 =C2=A0{ INTEL_BROADCAST_RGB_AUTO, "Automatic= " },
> > > >=C2=A0 =C2=A0{ INTEL_BROADCAST_RGB_FULL, "Full"= ; },
> > > >=C2=A0 =C2=A0{ INTEL_BROADCAST_RGB_LIMITED, "Limite= d 16:235" },
> > > > + { INTEL_BROADCAST_RGB_VIDEO, "Video 16:235 pass-= through" },
> > > >=C2=A0 };
> > > >
> > > >=C2=A0 void
> > > > --
> > > > 2.5.0
> > >
> > > > _______________________________________________ > > > > Intel-gfx mailing list
> > > > Inte= l-gfx@lists.freedesktop.org
> > > > http://lists.freedesktop.= org/mailman/listinfo/intel-gfx
> > >
> > >
> > > --
> > > Daniel Vetter
> > > Software Engineer, Intel Corporation
> > > http://blog.ffwll.ch
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx= @lists.freedesktop.org
> > > http://lists.freedesktop.org/<= wbr>mailman/listinfo/intel-gfx
> >
> > --
> > Ville Syrj=C3=A4l=C3=A4
> > Intel OTC
> >

--
Ville Syrj=C3=A4l=C3=A4
Intel OTC

--001a113d632e1f9677054102a074-- --===============1398626610== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============1398626610==--