From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxx Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> --- 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 */ //{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 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx