Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp360206pxa; Thu, 27 Aug 2020 04:33:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1mWoSXr8jPg0iCln1Sn3LzrctFX0geYURdNFbS3TjuY3aJ5AL/O5RtiROZqtr9H0H28rt X-Received: by 2002:a50:bac2:: with SMTP id x60mr19870878ede.210.1598528013786; Thu, 27 Aug 2020 04:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598528013; cv=none; d=google.com; s=arc-20160816; b=V00MKtttvLV4jUkiFRq1PjPXS6WGkofJ5pBF0l5eH9nRjCzzUYTLZmr+AqwZzeD1lz TLYFIxRtUS1j0DAUNtSuyqNJwB8MpTsLBpJPgVdpExkPkAi2cTjYr91xHxAYRHpJtBV1 v1EoCWBugA4VrR8ob3jizHjxvKJq4g4ERvUHiPymGRZigBLcIIA1d9UDz0Qy/v7rRa+V p3YP3pbSD+OWjbjFN9v466lLbZ0Xqdez55lXZFV/1h6uPjqvXsmCUqS1yCB+KXPQYO2t FV7fhy9UGofB8MzAwzmDg8RYiWh7kXE6rlQs53o2KNyKI8YDFQMBWvZpyK+6vB5kYyW2 nIfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=FGt4jDWNdd1Qd9hnQvI6fWpikPuMrEiLDPzvlhzyG38=; b=lZ8Yp+9Fo910C7c/xdUFJiLP74Gi9AwegDKxkydHtZe7VM1dK/RoSkMYfZ3UuVvr9T 4X4fXNAJ5IXgYL6QsqYV41guNXjAmkb2LTGvy9tOLyiQi9Hp1V7Uvr49r9EeLTmY+VsB dSKjeceT190I20ILBxkICzWMDecmm8NJkktk24JdkhzhLGZB7nYoO2Z9+U0W3U9lmuhK Uqtgf1mpQJI8XS0J+RuaGE/7sc4B43kQc14bnsddXkUCXplijlyni02ESfNlapIVMe5T kB0QstcLyBuRgx2DI+XHI5wv3y7hZAVI/XdvoJw6vpHb2DZfFYOkB4jfREsKnzxe3Yrm AZ9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c3si1171553ejm.314.2020.08.27.04.33.10; Thu, 27 Aug 2020 04:33:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726938AbgH0L3x (ORCPT + 99 others); Thu, 27 Aug 2020 07:29:53 -0400 Received: from mga06.intel.com ([134.134.136.31]:25895 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728001AbgH0LQj (ORCPT ); Thu, 27 Aug 2020 07:16:39 -0400 IronPort-SDR: fZA/Uwmv6ju5YRAP+EE6lkqv+etZSSE1Zz3eOsXxZfpX3+Lj1W8dGqLstaPFuEfEyRLK5bVGw6 zj+Q95yUQrNw== X-IronPort-AV: E=McAfee;i="6000,8403,9725"; a="218008691" X-IronPort-AV: E=Sophos;i="5.76,359,1592895600"; d="scan'208";a="218008691" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2020 03:57:05 -0700 IronPort-SDR: 5VR6ccig7DZlLiO+sMhEo+Emle4xy6LXWOE2nLy+9HD06TFwaDF3kjkmYll9QnidBP84HuExZ0 bWSumeroZ0Jw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,359,1592895600"; d="scan'208";a="299810019" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by orsmga006.jf.intel.com with SMTP; 27 Aug 2020 03:57:01 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 27 Aug 2020 13:57:01 +0300 Date: Thu, 27 Aug 2020 13:57:01 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Algea Cao Cc: mripard@kernel.org, tzimmermann@suse.de, linux-kernel@vger.kernel.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, maarten.lankhorst@linux.intel.com, daniel@ffwll.ch, linux-rockchip@lists.infradead.org Subject: Re: [PATCH] drm: Parse Colorimetry data block from EDID Message-ID: <20200827105701.GS6112@intel.com> References: <20200826142328.131144-1-algea.cao@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200826142328.131144-1-algea.cao@rock-chips.com> X-Patchwork-Hint: comment User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 26, 2020 at 10:23:28PM +0800, Algea Cao wrote: > CEA 861.3 spec adds colorimetry data block for HDMI. > Parsing the block to get the colorimetry data from > panel. And what exactly do you want to do with that data? > > Signed-off-by: Algea Cao > --- > > drivers/gpu/drm/drm_edid.c | 45 +++++++++++++++++++++++++++++++++++++ > include/drm/drm_connector.h | 3 +++ > include/drm/drm_edid.h | 14 ++++++++++++ > 3 files changed, 62 insertions(+) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 31496b6cfc56..67e607c04492 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -3223,6 +3223,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid, > #define VIDEO_BLOCK 0x02 > #define VENDOR_BLOCK 0x03 > #define SPEAKER_BLOCK 0x04 > +#define COLORIMETRY_DATA_BLOCK 0x5 > #define HDR_STATIC_METADATA_BLOCK 0x6 > #define USE_EXTENDED_TAG 0x07 > #define EXT_VIDEO_CAPABILITY_BLOCK 0x00 > @@ -4309,6 +4310,48 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) > mode->clock = clock; > } > > +static bool cea_db_is_hdmi_colorimetry_data_block(const u8 *db) > +{ > + if (cea_db_tag(db) != USE_EXTENDED_TAG) > + return false; > + > + if (db[1] != COLORIMETRY_DATA_BLOCK) > + return false; > + > + if (cea_db_payload_len(db) < 2) > + return false; > + > + return true; > +} > + > +static void > +drm_parse_colorimetry_data_block(struct drm_connector *connector, const u8 *db) > +{ > + struct drm_hdmi_info *info = &connector->display_info.hdmi; > + > + if (db[2] & DRM_EDID_CLRMETRY_xvYCC_601) > + info->colorimetry |= DRM_EDID_CLRMETRY_xvYCC_601; > + if (db[2] & DRM_EDID_CLRMETRY_xvYCC_709) > + info->colorimetry |= DRM_EDID_CLRMETRY_xvYCC_709; > + if (db[2] & DRM_EDID_CLRMETRY_sYCC_601) > + info->colorimetry |= DRM_EDID_CLRMETRY_sYCC_601; > + if (db[2] & DRM_EDID_CLRMETRY_ADBYCC_601) > + info->colorimetry |= DRM_EDID_CLRMETRY_ADBYCC_601; > + if (db[2] & DRM_EDID_CLRMETRY_ADB_RGB) > + info->colorimetry |= DRM_EDID_CLRMETRY_ADB_RGB; > + if (db[2] & DRM_EDID_CLRMETRY_BT2020_CYCC) > + info->colorimetry |= DRM_EDID_CLRMETRY_BT2020_CYCC; > + if (db[2] & DRM_EDID_CLRMETRY_BT2020_YCC) > + info->colorimetry |= DRM_EDID_CLRMETRY_BT2020_YCC; > + if (db[2] & DRM_EDID_CLRMETRY_BT2020_RGB) > + info->colorimetry |= DRM_EDID_CLRMETRY_BT2020_RGB; > + /* Byte 4 Bit 7: DCI-P3 */ > + if (db[3] & BIT(7)) > + info->colorimetry |= DRM_EDID_CLRMETRY_DCI_P3; > + > + DRM_DEBUG_KMS("Supported Colorimetry 0x%x\n", info->colorimetry); > +} > + > static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db) > { > if (cea_db_tag(db) != USE_EXTENDED_TAG) > @@ -4994,6 +5037,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector, > drm_parse_vcdb(connector, db); > if (cea_db_is_hdmi_hdr_metadata_block(db)) > drm_parse_hdr_metadata_block(connector, db); > + if (cea_db_is_hdmi_colorimetry_data_block(db)) > + drm_parse_colorimetry_data_block(connector, db); > } > } > > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h > index af145608b5ed..d599c3b9e881 100644 > --- a/include/drm/drm_connector.h > +++ b/include/drm/drm_connector.h > @@ -207,6 +207,9 @@ struct drm_hdmi_info { > > /** @y420_dc_modes: bitmap of deep color support index */ > u8 y420_dc_modes; > + > + /* @colorimetry: bitmap of supported colorimetry modes */ > + u16 colorimetry; > }; > > /** > diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h > index cfa4f5af49af..98fa78c2f82d 100644 > --- a/include/drm/drm_edid.h > +++ b/include/drm/drm_edid.h > @@ -229,6 +229,20 @@ struct detailed_timing { > DRM_EDID_YCBCR420_DC_36 | \ > DRM_EDID_YCBCR420_DC_30) > > +/* > + * Supported Colorimetry from colorimetry data block > + * as per CEA 861-G spec > + */ > +#define DRM_EDID_CLRMETRY_xvYCC_601 (1 << 0) > +#define DRM_EDID_CLRMETRY_xvYCC_709 (1 << 1) > +#define DRM_EDID_CLRMETRY_sYCC_601 (1 << 2) > +#define DRM_EDID_CLRMETRY_ADBYCC_601 (1 << 3) > +#define DRM_EDID_CLRMETRY_ADB_RGB (1 << 4) > +#define DRM_EDID_CLRMETRY_BT2020_CYCC (1 << 5) > +#define DRM_EDID_CLRMETRY_BT2020_YCC (1 << 6) > +#define DRM_EDID_CLRMETRY_BT2020_RGB (1 << 7) > +#define DRM_EDID_CLRMETRY_DCI_P3 (1 << 15) > + > /* ELD Header Block */ > #define DRM_ELD_HEADER_BLOCK_SIZE 4 > > -- > 2.25.1 > > > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrj?l? Intel