From patchwork Wed Jul 4 18:59:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 10507515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 83A9D601D7 for ; Wed, 4 Jul 2018 18:59:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88FA128A6F for ; Wed, 4 Jul 2018 18:59:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86C6F28DE7; Wed, 4 Jul 2018 18:59:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6446128DE8 for ; Wed, 4 Jul 2018 18:59:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 70EFA6EC41; Wed, 4 Jul 2018 18:59:35 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6FBB6EC41 for ; Wed, 4 Jul 2018 18:59:34 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jul 2018 11:59:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,308,1526367600"; d="scan'208";a="62301446" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by FMSMGA003.fm.intel.com with SMTP; 04 Jul 2018 11:59:32 -0700 Received: by stinkbox (sSMTP sendmail emulation); Wed, 04 Jul 2018 21:59:31 +0300 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Date: Wed, 4 Jul 2018 21:59:18 +0300 Message-Id: <20180704185919.30946-5-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180704185919.30946-1-ville.syrjala@linux.intel.com> References: <20180704185919.30946-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH xf86-video-intel 5/6] sna/video/textured: Add XV_COLOR_RANGE port attribute X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: xorg-devel@lists.x.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Ville Syrjälä 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ä --- 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));