intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: xorg-devel-go0+a7rfsptAfugRpC6u6w@public.gmane.org
Subject: Re: [PATCH xf86-video-intel 5/6] sna/video/textured: Add XV_COLOR_RANGE port attribute
Date: Wed, 4 Jul 2018 23:09:28 +0300	[thread overview]
Message-ID: <20180704200928.GW5565@intel.com> (raw)
In-Reply-To: <20180704185919.30946-5-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

On Wed, Jul 04, 2018 at 09:59:18PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add a new Xv port attribute XV_COLOR_RANGE to select the incoming YUV
> quantization range. 0 means limited range (Y: 16-235, Cb/Cr: 16-240),
> 1 means full range (0-255).
> 
> Cc: xorg-devel@lists.x.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  src/sna/sna_video_textured.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c
> index a784fe2ec0f4..a33cbc4506cb 100644
> --- a/src/sna/sna_video_textured.c
> +++ b/src/sna/sna_video_textured.c
> @@ -36,7 +36,7 @@
>  
>  #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, true)
>  
> -static Atom xvBrightness, xvContrast, xvSyncToVblank, xvColorspace;
> +static Atom xvBrightness, xvContrast, xvSyncToVblank, xvColorspace, xvColorRange;
>  
>  static XvFormatRec Formats[] = {
>  	{15}, {16}, {24}
> @@ -45,6 +45,7 @@ static XvFormatRec Formats[] = {
>  static const XvAttributeRec Attributes[] = {
>  	{XvSettable | XvGettable, -1, 1, (char *)"XV_SYNC_TO_VBLANK"},
>  	{XvSettable | XvGettable, 0, 1, (char *)"XV_COLORSPACE"}, /* BT.601, BT.709 */
> +	{XvSettable | XvGettable, 0, 1, (char *)"XV_COLOR_RANGE"}, /* limited, full */

Oh, and I forgot to mention in the commit message that I tried to look
for a pre-existing attribute for this stuff in a bunch other drivers
but couldn't find anything. If I missed something please let me know.

>  	//{XvSettable | XvGettable, -128, 127, (char *)"XV_BRIGHTNESS"},
>  	//{XvSettable | XvGettable, 0, 255, (char *)"XV_CONTRAST"},
>  };
> @@ -108,6 +109,11 @@ sna_video_textured_set_attribute(ddSetPortAttribute_ARGS)
>  			return BadValue;
>  
>  		video->colorspace = value;
> +	} else if (attribute == xvColorRange) {
> +		if (value < 0 || value > 1)
> +			return BadValue;
> +
> +		video->color_range = value;
>  	} else
>  		return BadMatch;
>  
> @@ -127,6 +133,8 @@ sna_video_textured_get_attribute(ddGetPortAttribute_ARGS)
>  		*value = video->SyncToVblank;
>  	else if (attribute == xvColorspace)
>  		*value = video->colorspace;
> +	else if (attribute == xvColorRange)
> +		*value = video->color_range;
>  	else
>  		return BadMatch;
>  
> @@ -435,6 +443,7 @@ void sna_video_textured_setup(struct sna *sna, ScreenPtr screen)
>  		v->textured = true;
>  		v->alignment = 4;
>  		v->colorspace = 1; /* BT.709 */
> +		v->color_range = 0; /* limited */
>  		v->SyncToVblank = (sna->flags & SNA_NO_WAIT) == 0;
>  
>  		RegionNull(&v->clip);
> @@ -456,6 +465,7 @@ void sna_video_textured_setup(struct sna *sna, ScreenPtr screen)
>  	xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
>  	xvContrast = MAKE_ATOM("XV_CONTRAST");
>  	xvColorspace = MAKE_ATOM("XV_COLORSPACE");
> +	xvColorRange = MAKE_ATOM("XV_COLOR_RANGE");
>  	xvSyncToVblank = MAKE_ATOM("XV_SYNC_TO_VBLANK");
>  
>  	DBG(("%s: '%s' initialized %d ports\n", __FUNCTION__, adaptor->name, adaptor->nPorts));
> -- 
> 2.16.4

-- 
Ville Syrjälä
Intel
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

  parent reply	other threads:[~2018-07-04 20:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04 18:59 [PATCH xf86-video-intel 1/6] sna: Add SAMPLER_OFFSET() compile time asserts for gen6/7 Ville Syrjala
2018-07-04 18:59 ` [PATCH xf86-video-intel 2/6] sna/gen6+: Split out wm_kernel from the sna_composite_op flags Ville Syrjala
2018-07-04 19:08   ` Chris Wilson
2018-07-04 19:20     ` Ville Syrjälä
2018-07-04 18:59 ` [PATCH xf86-video-intel 3/6] sna/vide/textured: Rename yuv shaders to indicate they handle limited range data Ville Syrjala
2018-07-04 18:59 ` [PATCH xf86-video-intel 4/6] sna/video/textured: Add shaders to deal with full range yuv data Ville Syrjala
2018-07-04 18:59 ` [PATCH xf86-video-intel 5/6] sna/video/textured: Add XV_COLOR_RANGE port attribute Ville Syrjala
     [not found]   ` <20180704185919.30946-5-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-07-04 20:09     ` Ville Syrjälä [this message]
     [not found] ` <20180704185919.30946-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-07-04 18:59   ` [PATCH xf86-video-intel 6/6] sna/video/sprite: " Ville Syrjala

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=20180704200928.GW5565@intel.com \
    --to=ville.syrjala-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=xorg-devel-go0+a7rfsptAfugRpC6u6w@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).