linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: crj <algea.cao@rock-chips.com>
Cc: daniel@ffwll.ch, airlied@linux.ie,
	maarten.lankhorst@linux.intel.com, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	linux-rockchip@lists.infradead.org, mripard@kernel.org,
	tzimmermann@suse.de,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: Re: [PATCH] drm: Parse Colorimetry data block from EDID
Date: Tue, 1 Sep 2020 15:17:18 +0200	[thread overview]
Message-ID: <20200901131718.GC2352366@phenom.ffwll.local> (raw)
In-Reply-To: <7a800d9f-2679-73a6-f3d3-dd6cfa829790@rock-chips.com>

On Tue, Sep 01, 2020 at 03:30:17PM +0800, crj wrote:
> Hi,
> 
> 在 2020/9/1 3:53, Ville Syrjälä 写道:
> > On Fri, Aug 28, 2020 at 09:07:13AM +0800, crj wrote:
> > > Hi Ville Syrjälä,
> > > 
> > > 在 2020/8/27 18:57, Ville Syrjälä 写道:
> > > > 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?
> > > 
> > > We can get colorimetry data block from edid then support
> > > 
> > > HDMI colorimetry such as BT2020.
> > But what do you want to do with it? The patch does nothing
> > functional.
> 
> If we want to output BT2020 in HDMI driver, we can know whether TV support
> BT2020
> 
> via connector->display_info.hdmi.colorimetry. If TV don't support BT2020,
> HDMI shouldn't
> 
> ouput in BT2020.

You need to include these driver patches in your series, not just the core
changes. We don't review/merge just core enabling patches, we need an
entire functional slice.
-Daniel

> 
> > > > > Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
> > > > > ---
> > > > > 
> > > > >    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
> 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

      reply	other threads:[~2020-09-01 13:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 14:23 [PATCH] drm: Parse Colorimetry data block from EDID Algea Cao
2020-08-27  7:34 ` Printing bitfields in the kernel (Re: [PATCH] drm: Parse Colorimetry data block from EDID) Pekka Paalanen
2020-08-28  4:58   ` Joe Perches
2020-08-27 10:57 ` [PATCH] drm: Parse Colorimetry data block from EDID Ville Syrjälä
2020-08-28  1:07   ` crj
2020-08-31 19:53     ` Ville Syrjälä
2020-09-01  7:30       ` crj
2020-09-01 13:17         ` Daniel Vetter [this message]

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=20200901131718.GC2352366@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=algea.cao@rock-chips.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=ville.syrjala@linux.intel.com \
    /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).