Skip to contentSkip to conversation

Add HDR Metadata Parsing and handling in DRM layer

PATCH Superseded Uma Shankar 5 participants 34 messages May 8, 2019 – May 14, 2019

Subsystems (4)

v9 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v9 cover Add HDR Metadata Parsing and handling in DRM layer

This patch series enables HDR support in drm. It basically defines HDR metadata structures, property to pass content (after blending) metadata from user space compositors to driver.

Dynamic Range and Mastering infoframe creation and sending.

ToDo:
1. We need to get the color framework in place for all planes which support HDR content in hardware. This is already in progres and patches are out for review in mailing list.
2. UserSpace/Compositors: Blending policies and metadata blob creation and passing to driver. Work is already in progress by Intel's middleware teams on wayland and the patches for the same are in review.

A POC has already been developed by Ville based on wayland. Please refer below link to see the component interactions and usage:
https://lists.freedesktop.org/archives/wayland-devel/2017-December/036403.html

v2: Updated Ville's POC changes to the patch series.Incorporated cleanups and fixes from Ville. Rebase on latest drm-tip.

v3: Fixed a warning causing builds to break on CI. No major change.

v4: Addressed Shashank's review comments.

v5: Rebase on top of Ville's infoframe refactoring changes. Fixed non modeset case for HDR metadata update. Dropped a redundant patch.

v6: Addressed Shashank's review comments and added RB's received.

v7: Squashed 2 patches, dropped 1 change and addressed Brian Starkey's and Shashank's review comments.

v8: Addressed Jonas Karlman review comments. Added Shashank's RB to the series, fixed a WARN_ON on BYT/CHT.

v9: Addressed Ville and Jonas Karlman's review comments. Added the infoframe state readout and metadata reference count.

Note: This is already tested with Kodi and a confirmation from team kodi has been received. Branch details for the same as below:
https://github.com/xbmc/xbmc/tree/feature_drmprime-vaapi

Jonas Karlman (1):
drm: Add reference counting on HDR metadata blob

Uma Shankar (10):
drm: Add HDR source metadata property
drm: Parse HDR metadata info from EDID
drm: Enable HDR infoframe support
drm/i915: Attach HDR metadata property to connector drm/i915: Write HDR infoframe and send to panel drm/i915:Enabled Modeset when HDR Infoframe changes drm/i915: Set Infoframe for non modeset case for HDR drm/i915: Added DRM Infoframe handling for BYT/CHT video/hdmi: Add Unpack function for DRM infoframe drm/i915: Add state readout for DRM infoframe

Ville Syrjälä (2):
drm: Add HLG EOTF
drm/i915: Enable infoframes on GLK+ for HDR

 drivers/gpu/drm/drm_atomic.c              |   2 +
 drivers/gpu/drm/drm_atomic_state_helper.c |   6 +
 drivers/gpu/drm/drm_atomic_uapi.c         |  13 ++
 drivers/gpu/drm/drm_connector.c           |   6 +
 drivers/gpu/drm/drm_edid.c                | 101 +++++++++++++
 drivers/gpu/drm/i915/i915_reg.h           |   4 +
 drivers/gpu/drm/i915/intel_atomic.c       |  14 +-
 drivers/gpu/drm/i915/intel_ddi.c          |  17 +++
 drivers/gpu/drm/i915/intel_display.c      |   1 +
 drivers/gpu/drm/i915/intel_drv.h          |   1 +
 drivers/gpu/drm/i915/intel_hdmi.c         | 100 ++++++++++++-
 drivers/video/hdmi.c                      | 240 ++++++++++++++++++++++++++++++
 include/drm/drm_connector.h               |  11 ++
 include/drm/drm_edid.h                    |   5 +
 include/drm/drm_mode_config.h             |   6 +
 include/linux/hdmi.h                      |  55 +++++++
 include/uapi/drm/drm_mode.h               |  23 +++
 17 files changed, 598 insertions(+), 7 deletions(-)
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.CHECKPATCH: warning for Add HDR Metadata Parsing and handling in DRM layer (rev9)

== Series Details ==

== Series Details ==

Series: Add HDR Metadata Parsing and handling in DRM layer (rev9)
URL : https://patchwork.freedesktop.org/series/25091/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
b14249ae3b1a drm: Add HDR source metadata property
-:70: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#70: FILE: drivers/gpu/drm/drm_atomic_uapi.c:733:
+		ret = drm_atomic_replace_property_blob_from_id(dev,
+				&state->hdr_output_metadata,

total: 0 errors, 0 warnings, 1 checks, 153 lines checked d278f4561318 drm: Add reference counting on HDR metadata blob 7d53c237452a drm: Parse HDR metadata info from EDID 421fb3c1ee47 drm: Enable HDR infoframe support a4cac5224d14 drm/i915: Attach HDR metadata property to connector e59e2225c608 drm/i915: Write HDR infoframe and send to panel a3bd3148742b drm: Add HLG EOTF
2068040dcd3c drm/i915: Enable infoframes on GLK+ for HDR -:54: WARNING:LONG_LINE: line over 100 characters
#54: FILE: drivers/gpu/drm/i915/i915_reg.h:8190:
+#define GLK_TVIDEO_DIP_DRM_DATA(trans, i) _MMIO_TRANS2(trans, _GLK_VIDEO_DIP_DRM_DATA_A + (i) * 4)

total: 0 errors, 1 warnings, 0 checks, 81 lines checked 2c0cd563ef64 drm/i915:Enabled Modeset when HDR Infoframe changes -:86: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #86: FILE: drivers/gpu/drm/i915/intel_hdmi.c:833:
+ if (!is_eotf_supported(hdr_metadata->hdmi_metadata_type1.eotf,
+ connector->hdr_sink_metadata.hdmi_type1.eotf)) {

total: 0 errors, 0 warnings, 1 checks, 60 lines checked a2c9e4ca880d drm/i915: Set Infoframe for non modeset case for HDR 0c8ec025a0ff drm/i915: Added DRM Infoframe handling for BYT/CHT 40ccaedcd208 video/hdmi: Add Unpack function for DRM infoframe 8bd7456bcc7f drm/i915: Add state readout for DRM infoframe

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

PATCH v9 1/13 drm: Add HDR source metadata property

In reply to Uma Shankar

This patch adds a blob property to get HDR metadata information from userspace. This will be send as part of AVI Infoframe to panel.

It also implements get() and set() functions for HDR output metadata property.The blob data is received from userspace and saved in connector state, the same is returned as blob in get property call to userspace.

v2: Rebase and modified the metadata structure elements as per Ville's POC changes.

v3: No Change

v4: Addressed Shashank's review comments

v5: Rebase.

v6: Addressed Brian Starkey's review comments, defined new structure with header for dynamic metadata scalability. Merge get/set property functions for metadata in this patch.

v7: Addressed Jonas Karlman review comments and defined separate structure for infoframe to better align with CTA 861.G spec. Added Shashank's RB.

v8: Addressed Ville's review comments. Moved sink metadata structure out of uapi headers as suggested by Jonas Karlman.

---
 drivers/gpu/drm/drm_atomic.c      |  2 ++
 drivers/gpu/drm/drm_atomic_uapi.c | 13 +++++++++++++
 drivers/gpu/drm/drm_connector.c   |  6 ++++++
 include/drm/drm_connector.h       | 11 +++++++++++
 include/drm/drm_mode_config.h     |  6 ++++++
 include/linux/hdmi.h              | 26 ++++++++++++++++++++++++++
 include/uapi/drm/drm_mode.h       | 23 +++++++++++++++++++++++
 7 files changed, 87 insertions(+)
drivers/gpu/drm/drm_atomic.c +2 -0
index 5eb4013..8b9c126 100644
@@ -881,6 +881,8 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,
 
 	drm_printf(p, "connector[%u]: %s\n", connector->base.id, connector->name);
 	drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)");
+	drm_printf(p, "\thdr_metadata_changed=%d\n",
+		   state->hdr_metadata_changed);
 
 	if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
 		if (state->writeback_job && state->writeback_job->fb)
drivers/gpu/drm/drm_atomic_uapi.c +13 -0
index 428d826..2ecc79e 100644
@@ -676,6 +676,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 {
 	struct drm_device *dev = connector->dev;
 	struct drm_mode_config *config = &dev->mode_config;
+	bool replaced = false;
+	int ret;
 
 	if (property == config->prop_crtc_id) {
 		struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val);
@@ -726,6 +728,14 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 		 */
 		if (state->link_status != DRM_LINK_STATUS_GOOD)
 			state->link_status = val;
+	} else if (property == config->hdr_output_metadata_property) {
+		ret = drm_atomic_replace_property_blob_from_id(dev,
+				&state->hdr_output_metadata,
+				val,
+				-1, sizeof(struct hdr_output_metadata),
+				&replaced);
+		state->hdr_metadata_changed |= replaced;
+		return ret;
 	} else if (property == config->aspect_ratio_property) {
 		state->picture_aspect_ratio = val;
 	} else if (property == config->content_type_property) {
@@ -814,6 +824,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 		*val = state->colorspace;
 	} else if (property == connector->scaling_mode_property) {
 		*val = state->scaling_mode;
+	} else if (property == config->hdr_output_metadata_property) {
+		*val = state->hdr_output_metadata ?
+			state->hdr_output_metadata->base.id : 0;
 	} else if (property == connector->content_protection_property) {
 		*val = state->content_protection;
 	} else if (property == config->writeback_fb_id_property) {
drivers/gpu/drm/drm_connector.c +6 -0
index b34c3d3..365ace0 100644
@@ -1058,6 +1058,12 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.non_desktop_property = prop;
 
+	prop = drm_property_create(dev, DRM_MODE_PROP_BLOB,
+				   "HDR_OUTPUT_METADATA", 0);
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.hdr_output_metadata_property = prop;
+
 	return 0;
 }
 
include/drm/drm_connector.h +11 -0
index f43f40d..e54674b 100644
@@ -603,6 +603,13 @@ struct drm_connector_state {
 	 * and the connector bpc limitations obtained from edid.
 	 */
 	u8 max_bpc;
+
+	/**
+	 * @metadata_blob_ptr:
+	 * DRM blob property for HDR output metadata
+	 */
+	struct drm_property_blob *hdr_output_metadata;
+	u8 hdr_metadata_changed : 1;
 };
 
 /**
@@ -1243,6 +1250,10 @@ struct drm_connector {
 	 * &drm_mode_config.connector_free_work.
 	 */
 	struct llist_node free_node;
+
+	/* HDR metdata */
+	struct hdr_output_metadata hdr_output_metadata;
+	struct hdr_sink_metadata hdr_sink_metadata;
 };
 
 #define obj_to_connector(x) container_of(x, struct drm_connector, base)
include/drm/drm_mode_config.h +6 -0
index 7f60e8e..ef2656b 100644
@@ -836,6 +836,12 @@ struct drm_mode_config {
 	 */
 	struct drm_property *writeback_out_fence_ptr_property;
 
+	/*
+	 * hdr_metadata_property: Connector property containing hdr metatda
+	 * This will be provided by userspace compositors based on HDR content
+	 */
+	struct drm_property *hdr_output_metadata_property;
+
 	/* dumb ioctl parameters */
 	uint32_t preferred_depth, prefer_shadow;
 
include/linux/hdmi.h +26 -0
index 927ad64..6780476 100644
@@ -152,6 +152,16 @@ enum hdmi_content_type {
 	HDMI_CONTENT_TYPE_GAME,
 };
 
+enum hdmi_metadata_type {
+	HDMI_STATIC_METADATA_TYPE1 = 1,
+};
+
+enum hdmi_eotf {
+	HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
+	HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
+	HDMI_EOTF_SMPTE_ST2084,
+};
+
 struct hdmi_avi_infoframe {
 	enum hdmi_infoframe_type type;
 	unsigned char version;
@@ -320,6 +330,22 @@ struct hdmi_vendor_infoframe {
 	unsigned int s3d_ext_data;
 };
 
+/* HDR Metadata as per 861.G spec */
+struct hdr_static_metadata {
+	__u8 eotf;
+	__u8 metadata_type;
+	__u16 max_cll;
+	__u16 max_fall;
+	__u16 min_cll;
+};
+
+struct hdr_sink_metadata {
+	__u32 metadata_type;
+	union {
+		struct hdr_static_metadata hdmi_type1;
+	};
+};
+
 int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame);
 ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
 				   void *buffer, size_t size);
include/uapi/drm/drm_mode.h +23 -0
index 83cd163..997a7e0 100644
@@ -630,6 +630,29 @@ struct drm_color_lut {
 	__u16 reserved;
 };
 
+/* HDR Metadata Infoframe as per 861.G spec */
+struct hdr_metadata_infoframe {
+	__u8 eotf;
+	__u8 metadata_type;
+	struct {
+		__u16 x, y;
+		} display_primaries[3];
+	struct {
+		__u16 x, y;
+		} white_point;
+	__u16 max_display_mastering_luminance;
+	__u16 min_display_mastering_luminance;
+	__u16 max_cll;
+	__u16 max_fall;
+};
+
+struct hdr_output_metadata {
+	__u32 metadata_type;
+	union {
+		struct hdr_metadata_infoframe hdmi_metadata_type1;
+	};
+};
+
 #define DRM_MODE_PAGE_FLIP_EVENT 0x01
 #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
 #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH v9 2/13 drm: Add reference counting on HDR metadata blob

In reply to Uma Shankar

From: Jonas Karlman <[email protected]>

This adds reference count for HDR metadata blob, handled as part of duplicate and destroy connector state functions.

---
 drivers/gpu/drm/drm_atomic_state_helper.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_atomic_state_helper.c +6 -0
index ac929f6..8f49952 100644
@@ -391,6 +391,10 @@ void drm_atomic_helper_connector_reset(struct drm_connector *connector)
 		drm_connector_get(connector);
 	state->commit = NULL;
 
+	if (state->hdr_output_metadata)
+		drm_property_blob_get(state->hdr_output_metadata);
+	state->hdr_metadata_changed = false;
+
 	/* Don't copy over a writeback job, they are used only once */
 	state->writeback_job = NULL;
 }
@@ -438,6 +442,8 @@ struct drm_connector_state *
 
 	if (state->writeback_job)
 		drm_writeback_cleanup_job(state->writeback_job);
+
+	drm_property_blob_put(state->hdr_output_metadata);
 }
 EXPORT_SYMBOL(__drm_atomic_helper_connector_destroy_state);
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH v9 3/13 drm: Parse HDR metadata info from EDID

In reply to Uma Shankar

HDR metadata block is introduced in CEA-861.3 spec. Parsing the same to get the panel's HDR metadata.

v2: Rebase and added Ville's POC changes to the patch.

v3: No Change

v4: Addressed Shashank's review comments

v5: Addressed Shashank's comment and added his RB.

v6: Addressed Jonas Karlman review comments.

---
 drivers/gpu/drm/drm_edid.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
drivers/gpu/drm/drm_edid.c +52 -0
index 852bdd8..fe2c29b 100644
@@ -2852,6 +2852,7 @@ static int drm_cvt_modes(struct drm_connector *connector,
 #define VIDEO_BLOCK     0x02
 #define VENDOR_BLOCK    0x03
 #define SPEAKER_BLOCK	0x04
+#define HDR_STATIC_METADATA_BLOCK	0x6
 #define USE_EXTENDED_TAG 0x07
 #define EXT_VIDEO_CAPABILITY_BLOCK 0x00
 #define EXT_VIDEO_DATA_BLOCK_420	0x0E
@@ -3599,6 +3600,12 @@ static int add_3d_struct_modes(struct drm_connector *connector, u16 structure,
 }
 
 static int
+cea_db_payload_len_ext(const u8 *db)
+{
+	return (db[0] & 0x1f) - 1;
+}
+
+static int
 cea_db_extended_tag(const u8 *db)
 {
 	return db[1];
@@ -3834,6 +3841,49 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
 	mode->clock = clock;
 }
 
+static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db)
+{
+	if (cea_db_tag(db) != USE_EXTENDED_TAG)
+		return false;
+
+	if (db[1] != HDR_STATIC_METADATA_BLOCK)
+		return false;
+
+	return true;
+}
+
+static uint8_t eotf_supported(const u8 *edid_ext)
+{
+	return edid_ext[2] &
+		(BIT(HDMI_EOTF_TRADITIONAL_GAMMA_SDR) |
+		 BIT(HDMI_EOTF_TRADITIONAL_GAMMA_HDR) |
+		 BIT(HDMI_EOTF_SMPTE_ST2084));
+}
+
+static uint8_t hdr_metadata_type(const u8 *edid_ext)
+{
+	return edid_ext[3] &
+		BIT(HDMI_STATIC_METADATA_TYPE1);
+}
+
+static void
+drm_parse_hdr_metadata_block(struct drm_connector *connector, const u8 *db)
+{
+	u16 len;
+
+	len = cea_db_payload_len_ext(db);
+	connector->hdr_sink_metadata.hdmi_type1.eotf = eotf_supported(db);
+	connector->hdr_sink_metadata.hdmi_type1.metadata_type =
+					hdr_metadata_type(db);
+
+	if (len >= 4)
+		connector->hdr_sink_metadata.hdmi_type1.max_cll = db[4];
+	if (len >= 5)
+		connector->hdr_sink_metadata.hdmi_type1.max_fall = db[5];
+	if (len >= 6)
+		connector->hdr_sink_metadata.hdmi_type1.min_cll = db[6];
+}
+
 static void
 drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
 {
@@ -4461,6 +4511,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
 			drm_parse_y420cmdb_bitmap(connector, db);
 		if (cea_db_is_vcdb(db))
 			drm_parse_vcdb(connector, db);
+		if (cea_db_is_hdmi_hdr_metadata_block(db))
+			drm_parse_hdr_metadata_block(connector, db);
 	}
 }
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [v9 03/13] drm: Parse HDR metadata info from EDID

Quoted 72 lines · Uma Shankar

HDR metadata block is introduced in CEA-861.3 spec. Parsing the same to get the panel's HDR metadata.

v2: Rebase and added Ville's POC changes to the patch.

v3: No Change

v4: Addressed Shashank's review comments

v5: Addressed Shashank's comment and added his RB.

v6: Addressed Jonas Karlman review comments.

---
 drivers/gpu/drm/drm_edid.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
drivers/gpu/drm/drm_edid.c +31 -0
index 852bdd8..fe2c29b 100644
@@ -2852,6 +2852,7 @@ static int drm_cvt_modes(struct drm_connector *connector,
 #define VIDEO_BLOCK     0x02
 #define VENDOR_BLOCK    0x03
 #define SPEAKER_BLOCK	0x04
+#define HDR_STATIC_METADATA_BLOCK	0x6
 #define USE_EXTENDED_TAG 0x07
 #define EXT_VIDEO_CAPABILITY_BLOCK 0x00
 #define EXT_VIDEO_DATA_BLOCK_420	0x0E
@@ -3599,6 +3600,12 @@ static int add_3d_struct_modes(struct drm_connector *connector, u16 structure,
 }
 
 static int
+cea_db_payload_len_ext(const u8 *db)
+{
+	return (db[0] & 0x1f) - 1;
+}
+
+static int
 cea_db_extended_tag(const u8 *db)
 {
 	return db[1];
@@ -3834,6 +3841,49 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
 	mode->clock = clock;
 }
 
+static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db)
+{
+	if (cea_db_tag(db) != USE_EXTENDED_TAG)
+		return false;
+
+	if (db[1] != HDR_STATIC_METADATA_BLOCK)
+		return false;
+
+	return true;
+}
+
+static uint8_t eotf_supported(const u8 *edid_ext)
+{
+	return edid_ext[2] &
+		(BIT(HDMI_EOTF_TRADITIONAL_GAMMA_SDR) |
+		 BIT(HDMI_EOTF_TRADITIONAL_GAMMA_HDR) |
+		 BIT(HDMI_EOTF_SMPTE_ST2084));
+}
+
+static uint8_t hdr_metadata_type(const u8 *edid_ext)
+{
+	return edid_ext[3] &
+		BIT(HDMI_STATIC_METADATA_TYPE1);
+}

drivers/gpu/drm/drm_edid.c static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) · line 3877

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+
+static void
+drm_parse_hdr_metadata_block(struct drm_connector *connector, const u8 *db)
+{
+	u16 len;
+
+	len = cea_db_payload_len_ext(db);
+	connector->hdr_sink_metadata.hdmi_type1.eotf = eotf_supported(db);
+	connector->hdr_sink_metadata.hdmi_type1.metadata_type =
+					hdr_metadata_type(db);

Length checks missing for this stuff.

drivers/gpu/drm/drm_edid.c static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) · line 3884

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+
+	if (len >= 4)
+		connector->hdr_sink_metadata.hdmi_type1.max_cll = db[4];
+	if (len >= 5)
+		connector->hdr_sink_metadata.hdmi_type1.max_fall = db[5];
+	if (len >= 6)
+		connector->hdr_sink_metadata.hdmi_type1.min_cll = db[6];

All the length checks seem to be off by one due to cea_db_payload_len_ext(). I think just dropping cea_db_payload_len_ext() would make things better since a) nothing else has that, b) db still points at the start of the whole data block instead of the payload.

The while payload vs. block length thing is already confusing anyway. I have a feeling we should replace cea_db_payload_len() with something that returns the length of the whole data block. That way the db[index] vs. length checks would start to make some sense to the casual reader.

Quoted 21 lines
drivers/gpu/drm/drm_edid.c +4 -0
+}
+
 static void
 drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
 {
@@ -4461,6 +4511,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
 			drm_parse_y420cmdb_bitmap(connector, db);
 		if (cea_db_is_vcdb(db))
 			drm_parse_vcdb(connector, db);
+		if (cea_db_is_hdmi_hdr_metadata_block(db))
+			drm_parse_hdr_metadata_block(connector, db);
 	}
 }
 
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

RE: [v9 03/13] drm: Parse HDR metadata info from EDID

Quoted 89 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Tuesday, May 14, 2019 12:49 AM
To: Shankar, Uma <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [v9 03/13] drm: Parse HDR metadata info from EDID

drivers/gpu/drm/drm_edid.c static int drm_cvt_modes(struct drm_connector

Quoted 25 lines · Uma Shankar

HDR metadata block is introduced in CEA-861.3 spec. Parsing the same to get the panel's HDR metadata.

v2: Rebase and added Ville's POC changes to the patch.

v3: No Change

v4: Addressed Shashank's review comments

v5: Addressed Shashank's comment and added his RB.

v6: Addressed Jonas Karlman review comments.

---
 drivers/gpu/drm/drm_edid.c | 52
++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
drivers/gpu/drm/drm_edid.c +0 -0
index 852bdd8..fe2c29b 100644
@@ -2852,6 +2852,7 @@ static int drm_cvt_modes(struct drm_connector

*connector,

drivers/gpu/drm/drm_edid.c static void fixup_detailed_cea_mode_clock(struct

Quoted 21 lines
drivers/gpu/drm/drm_edid.c +7 -0
 #define VIDEO_BLOCK     0x02
 #define VENDOR_BLOCK    0x03
 #define SPEAKER_BLOCK	0x04
+#define HDR_STATIC_METADATA_BLOCK	0x6
 #define USE_EXTENDED_TAG 0x07
 #define EXT_VIDEO_CAPABILITY_BLOCK 0x00
 #define EXT_VIDEO_DATA_BLOCK_420	0x0E
@@ -3599,6 +3600,12 @@ static int add_3d_struct_modes(struct
 drm_connector *connector, u16 structure,  }
 
 static int
+cea_db_payload_len_ext(const u8 *db)
+{
+	return (db[0] & 0x1f) - 1;
+}
+
+static int
 cea_db_extended_tag(const u8 *db)
 {
 	return db[1];
@@ -3834,6 +3841,49 @@ static void fixup_detailed_cea_mode_clock(struct

drm_display_mode *mode)

Quoted 28 lines
drivers/gpu/drm/drm_edid.c +25 -0
 	mode->clock = clock;
 }
 
+static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db) {
+	if (cea_db_tag(db) != USE_EXTENDED_TAG)
+		return false;
+
+	if (db[1] != HDR_STATIC_METADATA_BLOCK)
+		return false;
+
+	return true;
+}
+
+static uint8_t eotf_supported(const u8 *edid_ext) {
+	return edid_ext[2] &
+		(BIT(HDMI_EOTF_TRADITIONAL_GAMMA_SDR) |
+		 BIT(HDMI_EOTF_TRADITIONAL_GAMMA_HDR) |
+		 BIT(HDMI_EOTF_SMPTE_ST2084));
+}
+
+static uint8_t hdr_metadata_type(const u8 *edid_ext) {
+	return edid_ext[3] &
+		BIT(HDMI_STATIC_METADATA_TYPE1);
+}
+
+static void
+drm_parse_hdr_metadata_block(struct drm_connector *connector, const
+u8 *db) {
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) · line 3877

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +6 -0
+	u16 len;
+
+	len = cea_db_payload_len_ext(db);
+	connector->hdr_sink_metadata.hdmi_type1.eotf = eotf_supported(db);
+	connector->hdr_sink_metadata.hdmi_type1.metadata_type =
+					hdr_metadata_type(db);

Length checks missing for this stuff.

The above 2 are mandatory bytes , so this will always be there in this block. Byte 5 to 7 are optional and depends on length field. So we should not need a length check here for above 2 fields. Hope my understanding is right.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+
+	if (len >= 4)
+		connector->hdr_sink_metadata.hdmi_type1.max_cll = db[4];
+	if (len >= 5)
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) · line 3884

Quoted 3 lines
drivers/gpu/drm/drm_edid.c +3 -0
+		connector->hdr_sink_metadata.hdmi_type1.max_fall = db[5];
+	if (len >= 6)
+		connector->hdr_sink_metadata.hdmi_type1.min_cll = db[6];

All the length checks seem to be off by one due to cea_db_payload_len_ext(). I think just dropping cea_db_payload_len_ext() would make things better since a) nothing else has that, b) db still points at the start of the whole data block instead of the payload.

The length field adds/includes the extended tag byte while reporting the size of block. So we need to
remove 1 byte to get the correct size of data. A value of n = 3 means bytes 5 to 7 are not present.

Quoted 4 lines

The while payload vs. block length thing is already confusing anyway. I have a feeling we should replace cea_db_payload_len() with something that returns the length of the whole data block. That way the db[index] vs. length checks would start to make some sense to the casual reader.

I hope with above understanding, in db[index], index just tells the byte number for a particular field which matches exactly to spec offsets.

Regards,
Uma Shankar

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/drm_edid.c +2 -0
+}
+
 static void
 drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8
 *db)  { @@ -4461,6 +4511,8 @@ static void drm_parse_cea_ext(struct

drm_connector *connector,

drivers/gpu/drm/drm_edid.c +2 -1
 			drm_parse_y420cmdb_bitmap(connector, db);
 		if (cea_db_is_vcdb(db))
 			drm_parse_vcdb(connector, db);
+		if (cea_db_is_hdmi_hdr_metadata_block(db))
+			drm_parse_hdr_metadata_block(connector, db);
 	}
 }
 
--

1.9.1

Quoted 8 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Ville Syrjälä
Intel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

Re: [v9 03/13] drm: Parse HDR metadata info from EDID

Quoted 98 lines · Uma
Quoted 89 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Tuesday, May 14, 2019 12:49 AM
To: Shankar, Uma <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [v9 03/13] drm: Parse HDR metadata info from EDID

drivers/gpu/drm/drm_edid.c static int drm_cvt_modes(struct drm_connector

Quoted 25 lines · Uma Shankar

HDR metadata block is introduced in CEA-861.3 spec. Parsing the same to get the panel's HDR metadata.

v2: Rebase and added Ville's POC changes to the patch.

v3: No Change

v4: Addressed Shashank's review comments

v5: Addressed Shashank's comment and added his RB.

v6: Addressed Jonas Karlman review comments.

---
 drivers/gpu/drm/drm_edid.c | 52
++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
drivers/gpu/drm/drm_edid.c +0 -0
index 852bdd8..fe2c29b 100644
@@ -2852,6 +2852,7 @@ static int drm_cvt_modes(struct drm_connector

*connector,

drivers/gpu/drm/drm_edid.c static void fixup_detailed_cea_mode_clock(struct

Quoted 21 lines
drivers/gpu/drm/drm_edid.c +7 -0
 #define VIDEO_BLOCK     0x02
 #define VENDOR_BLOCK    0x03
 #define SPEAKER_BLOCK	0x04
+#define HDR_STATIC_METADATA_BLOCK	0x6
 #define USE_EXTENDED_TAG 0x07
 #define EXT_VIDEO_CAPABILITY_BLOCK 0x00
 #define EXT_VIDEO_DATA_BLOCK_420	0x0E
@@ -3599,6 +3600,12 @@ static int add_3d_struct_modes(struct
 drm_connector *connector, u16 structure,  }
 
 static int
+cea_db_payload_len_ext(const u8 *db)
+{
+	return (db[0] & 0x1f) - 1;
+}
+
+static int
 cea_db_extended_tag(const u8 *db)
 {
 	return db[1];
@@ -3834,6 +3841,49 @@ static void fixup_detailed_cea_mode_clock(struct

drm_display_mode *mode)

Quoted 28 lines
drivers/gpu/drm/drm_edid.c +25 -0
 	mode->clock = clock;
 }
 
+static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db) {
+	if (cea_db_tag(db) != USE_EXTENDED_TAG)
+		return false;
+
+	if (db[1] != HDR_STATIC_METADATA_BLOCK)
+		return false;
+
+	return true;
+}
+
+static uint8_t eotf_supported(const u8 *edid_ext) {
+	return edid_ext[2] &
+		(BIT(HDMI_EOTF_TRADITIONAL_GAMMA_SDR) |
+		 BIT(HDMI_EOTF_TRADITIONAL_GAMMA_HDR) |
+		 BIT(HDMI_EOTF_SMPTE_ST2084));
+}
+
+static uint8_t hdr_metadata_type(const u8 *edid_ext) {
+	return edid_ext[3] &
+		BIT(HDMI_STATIC_METADATA_TYPE1);
+}
+
+static void
+drm_parse_hdr_metadata_block(struct drm_connector *connector, const
+u8 *db) {
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) · line 3877

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +6 -0
+	u16 len;
+
+	len = cea_db_payload_len_ext(db);
+	connector->hdr_sink_metadata.hdmi_type1.eotf = eotf_supported(db);
+	connector->hdr_sink_metadata.hdmi_type1.metadata_type =
+					hdr_metadata_type(db);

Length checks missing for this stuff.

Quoted 1 line

The above 2 are mandatory bytes , so this will always be there in this block.

You can only make that claim if the EDID is not malicious or corrupted. Never trust anything coming from an external source!

Quoted 19 lines

Byte 5 to 7 are optional and depends on length field. So we should not need a length check here for above 2 fields. Hope my understanding is right.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+
+	if (len >= 4)
+		connector->hdr_sink_metadata.hdmi_type1.max_cll = db[4];
+	if (len >= 5)
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) · line 3884

Quoted 3 lines
drivers/gpu/drm/drm_edid.c +3 -0
+		connector->hdr_sink_metadata.hdmi_type1.max_fall = db[5];
+	if (len >= 6)
+		connector->hdr_sink_metadata.hdmi_type1.min_cll = db[6];

All the length checks seem to be off by one due to cea_db_payload_len_ext(). I think just dropping cea_db_payload_len_ext() would make things better since a) nothing else has that, b) db still points at the start of the whole data block instead of the payload.

The length field adds/includes the extended tag byte while reporting the size of block. So we need to
remove 1 byte to get the correct size of data. A value of n = 3 means bytes 5 to 7 are not present.

Quoted 7 lines
Quoted 4 lines

The while payload vs. block length thing is already confusing anyway. I have a feeling we should replace cea_db_payload_len() with something that returns the length of the whole data block. That way the db[index] vs. length checks would start to make some sense to the casual reader.

I hope with above understanding, in db[index], index just tells the byte number for a particular field which matches exactly to spec offsets.

Not quite sure what you're saying.

What I'm saying is that with eg. n=6 (ie. the full block) your code ends up with len==5, and then it will not read min_cll even though it should.

Quoted 30 lines

Regards,
Uma Shankar

Quoted 26 lines
Quoted 18 lines
drivers/gpu/drm/drm_edid.c +2 -0
+}
+
 static void
 drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8
 *db)  { @@ -4461,6 +4511,8 @@ static void drm_parse_cea_ext(struct

drm_connector *connector,

drivers/gpu/drm/drm_edid.c +2 -1
 			drm_parse_y420cmdb_bitmap(connector, db);
 		if (cea_db_is_vcdb(db))
 			drm_parse_vcdb(connector, db);
+		if (cea_db_is_hdmi_hdr_metadata_block(db))
+			drm_parse_hdr_metadata_block(connector, db);
 	}
 }
 
--

1.9.1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Ville Syrjälä
Intel

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

Re: [v9 03/13] drm: Parse HDR metadata info from EDID

Quoted 99 lines
Quoted 99 lines
Quoted 98 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Tuesday, May 14, 2019 12:49 AM
To: Shankar, Uma <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [v9 03/13] drm: Parse HDR metadata info from EDID

drivers/gpu/drm/drm_edid.c static int drm_cvt_modes(struct drm_connector

Quoted 25 lines · Uma Shankar

HDR metadata block is introduced in CEA-861.3 spec. Parsing the same to get the panel's HDR metadata.

v2: Rebase and added Ville's POC changes to the patch.

v3: No Change

v4: Addressed Shashank's review comments

v5: Addressed Shashank's comment and added his RB.

v6: Addressed Jonas Karlman review comments.

---
 drivers/gpu/drm/drm_edid.c | 52
++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_edid.c index 852bdd8..fe2c29b 100644

drivers/gpu/drm/drm_edid.c +0 -0
@@ -2852,6 +2852,7 @@ static int drm_cvt_modes(struct drm_connector

*connector,

Quoted 20 lines
drivers/gpu/drm/drm_edid.c +6 -0
 #define VIDEO_BLOCK     0x02
 #define VENDOR_BLOCK    0x03
 #define SPEAKER_BLOCK	0x04
+#define HDR_STATIC_METADATA_BLOCK	0x6
 #define USE_EXTENDED_TAG 0x07
 #define EXT_VIDEO_CAPABILITY_BLOCK 0x00
 #define EXT_VIDEO_DATA_BLOCK_420	0x0E
@@ -3599,6 +3600,12 @@ static int add_3d_struct_modes(struct
 drm_connector *connector, u16 structure,  }
 
 static int
+cea_db_payload_len_ext(const u8 *db) {
+	return (db[0] & 0x1f) - 1;
+}
+
+static int
 cea_db_extended_tag(const u8 *db)
 {
 	return db[1];
@@ -3834,6 +3841,49 @@ static void
Quoted 1 line

fixup_detailed_cea_mode_clock(struct

drm_display_mode *mode)

Quoted 24 lines
drivers/gpu/drm/drm_edid.c +21 -0
 	mode->clock = clock;
 }
 
+static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db) {
+	if (cea_db_tag(db) != USE_EXTENDED_TAG)
+		return false;
+
+	if (db[1] != HDR_STATIC_METADATA_BLOCK)
+		return false;
+
+	return true;
+}
+
+static uint8_t eotf_supported(const u8 *edid_ext) {
+	return edid_ext[2] &
+		(BIT(HDMI_EOTF_TRADITIONAL_GAMMA_SDR) |
+		 BIT(HDMI_EOTF_TRADITIONAL_GAMMA_HDR) |
+		 BIT(HDMI_EOTF_SMPTE_ST2084));
+}
+
+static uint8_t hdr_metadata_type(const u8 *edid_ext) {
+	return edid_ext[3] &
+		BIT(HDMI_STATIC_METADATA_TYPE1); }
+

drivers/gpu/drm/drm_edid.c static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) · line 3877

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+static void
+drm_parse_hdr_metadata_block(struct drm_connector *connector,
+const
+u8 *db) {
+	u16 len;
+
+	len = cea_db_payload_len_ext(db);
+	connector->hdr_sink_metadata.hdmi_type1.eotf = eotf_supported(db);
+	connector->hdr_sink_metadata.hdmi_type1.metadata_type =
+					hdr_metadata_type(db);

Length checks missing for this stuff.

Quoted 4 lines
Quoted 1 line

The above 2 are mandatory bytes , so this will always be there in this block.

You can only make that claim if the EDID is not malicious or corrupted. Never trust anything coming from an external source!

Ok Got it, will have a check to ensure that we have a reliable EDID.

Quoted 26 lines
Quoted 16 lines

Byte 5 to 7 are optional and depends on length field. So we should not need a length check here for above 2 fields. Hope my understanding is right.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+
+	if (len >= 4)
+		connector->hdr_sink_metadata.hdmi_type1.max_cll = db[4];
+	if (len >= 5)
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) · line 3884

Quoted 3 lines
drivers/gpu/drm/drm_edid.c +3 -0
+		connector->hdr_sink_metadata.hdmi_type1.max_fall = db[5];
+	if (len >= 6)
+		connector->hdr_sink_metadata.hdmi_type1.min_cll = db[6];

All the length checks seem to be off by one due to cea_db_payload_len_ext(). I think just dropping cea_db_payload_len_ext() would make things better since a) nothing else has that, b) db still points at the start of the whole data block instead of the payload.

Quoted 2 lines

The length field adds/includes the extended tag byte while reporting
the size of block. So we need to remove 1 byte to get the correct size of data. A

value of n = 3 means bytes 5 to 7 are not present.

Quoted 5 lines
Quoted 5 lines

The while payload vs. block length thing is already confusing anyway. I have a feeling we should replace cea_db_payload_len() with something that returns the length of the whole data block. That way the db[index] vs. length checks would start to make some sense to the casual

reader.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

I hope with above understanding, in db[index], index just tells the byte number for a particular field which matches exactly to spec offsets.

Not quite sure what you're saying.

What I'm saying is that with eg. n=6 (ie. the full block) your code ends up with len==5, and then it will not read min_cll even though it should.

Hmm yeah, the checks are off. Will fix these and drop the cea_db_payload_len_ext(). Thanks Ville.

Regards,
Uma Shankar

Quoted 31 lines
Quoted 30 lines

Regards,
Uma Shankar

Quoted 27 lines
Quoted 19 lines
drivers/gpu/drm/drm_edid.c +2 -0
+}
+
 static void
 drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const

u8
*db) { @@ -4461,6 +4511,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,

drivers/gpu/drm/drm_edid.c +2 -1
 			drm_parse_y420cmdb_bitmap(connector, db);
 		if (cea_db_is_vcdb(db))
 			drm_parse_vcdb(connector, db);
+		if (cea_db_is_hdmi_hdr_metadata_block(db))
+			drm_parse_hdr_metadata_block(connector, db);
 	}
 }
 
--

1.9.1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Ville Syrjälä
Intel

Quoted 3 lines

--
Ville Syrjälä
Intel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

PATCH v9 4/13 drm: Enable HDR infoframe support

In reply to Uma Shankar

Enable Dynamic Range and Mastering Infoframe for HDR content, which is defined in CEA 861.3 spec.

The metadata will be computed based on blending policy in userspace compositors and passed as a connector property blob to driver. The same will be sent as infoframe to panel which support HDR.

Added the const version of infoframe for DRM metadata for HDR.

v2: Rebase and added Ville's POC changes.

v3: No Change

v4: Addressed Shashank's review comments and merged the patch making drm infoframe function arguments as constant.

v5: Rebase

v6: Fixed checkpatch warnings with --strict option. Addressed Shashank's review comments and added his RB.

v7: Addressed Brian Starkey's review comments. Merged 2 patches into one.

v8: Addressed Jonas Karlman review comments.

---
 drivers/gpu/drm/drm_edid.c |  48 ++++++++++++
 drivers/video/hdmi.c       | 186 +++++++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_edid.h     |   5 ++
 include/linux/hdmi.h       |  27 +++++++
 4 files changed, 266 insertions(+)
drivers/gpu/drm/drm_edid.c +48 -0
index fe2c29b..5f48965 100644
@@ -4906,6 +4906,54 @@ static bool is_hdmi2_sink(struct drm_connector *connector)
 }
 
 /**
+ * drm_hdmi_infoframe_set_hdr_metadata() - fill an HDMI AVI infoframe with
+ *                                         HDR metadata from userspace
+ * @frame: HDMI AVI infoframe
+ * @hdr_source_metadata: hdr_source_metadata info from userspace
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int
+drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
+				    struct hdr_output_metadata *hdr_metadata)
+{
+	int err;
+
+	if (!frame || !hdr_metadata)
+		return true;
+
+	err = hdmi_drm_infoframe_init(frame);
+	if (err < 0)
+		return err;
+
+	DRM_DEBUG_KMS("type = %x\n", frame->type);
+
+	frame->length = sizeof(struct hdr_metadata_infoframe);
+
+	frame->eotf = hdr_metadata->hdmi_metadata_type1.eotf;
+	frame->metadata_type = hdr_metadata->hdmi_metadata_type1.metadata_type;
+
+	memcpy(&frame->display_primaries,
+	       &hdr_metadata->hdmi_metadata_type1.display_primaries, 12);
+
+	memcpy(&frame->white_point,
+	       &hdr_metadata->hdmi_metadata_type1.white_point, 4);
+
+	frame->max_display_mastering_luminance =
+		hdr_metadata->hdmi_metadata_type1.max_display_mastering_luminance;
+	frame->min_display_mastering_luminance =
+		hdr_metadata->hdmi_metadata_type1.min_display_mastering_luminance;
+	frame->max_fall = hdr_metadata->hdmi_metadata_type1.max_fall;
+	frame->max_cll = hdr_metadata->hdmi_metadata_type1.max_cll;
+
+	hdmi_infoframe_log(KERN_CRIT, NULL,
+			   (union hdmi_infoframe *)frame);
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata);
+
+/**
  * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
  *                                              data from a DRM display mode
  * @frame: HDMI AVI infoframe
drivers/video/hdmi.c +186 -0

222 lines not on this page · raw message

include/drm/drm_edid.h +5 -0
index 9d3b5b9..d81c5c2 100644
@@ -25,6 +25,7 @@
 
 #include <linux/types.h>
 #include <linux/hdmi.h>
+#include <drm/drm_mode.h>
 
 struct drm_device;
 struct i2c_adapter;
@@ -370,6 +371,10 @@ int drm_av_sync_delay(struct drm_connector *connector,
 				   const struct drm_display_mode *mode,
 				   enum hdmi_quantization_range rgb_quant_range);
 
+int
+drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
+				    struct hdr_output_metadata *hdr_metadata);
+
 /**
  * drm_eld_mnl - Get ELD monitor name length in bytes.
  * @eld: pointer to an eld memory structure with mnl set
include/linux/hdmi.h +27 -0
index 6780476..7edafcf 100644
@@ -47,6 +47,7 @@ enum hdmi_infoframe_type {
 	HDMI_INFOFRAME_TYPE_AVI = 0x82,
 	HDMI_INFOFRAME_TYPE_SPD = 0x83,
 	HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
+	HDMI_INFOFRAME_TYPE_DRM = 0x87,
 };
 
 #define HDMI_IEEE_OUI 0x000c03
@@ -185,12 +186,37 @@ struct hdmi_avi_infoframe {
 	unsigned short right_bar;
 };
 
+/* DRM Infoframe as per CTA 861.G spec */
+struct hdmi_drm_infoframe {
+	enum hdmi_infoframe_type type;
+	unsigned char version;
+	unsigned char length;
+	enum hdmi_eotf eotf;
+	enum hdmi_metadata_type metadata_type;
+	struct {
+		u16 x, y;
+	} display_primaries[3];
+	struct {
+		u16 x, y;
+	} white_point;
+	u16 max_display_mastering_luminance;
+	u16 min_display_mastering_luminance;
+	u16 max_cll;
+	u16 max_fall;
+};
+
 int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);
 ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
 				size_t size);
 ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame,
 				     void *buffer, size_t size);
 int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame);
+int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame);
+ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
+				size_t size);
+ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
+				     void *buffer, size_t size);
+int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame);
 
 enum hdmi_spd_sdi {
 	HDMI_SPD_SDI_UNKNOWN,
@@ -381,6 +407,7 @@ ssize_t hdmi_vendor_infoframe_pack_only(const struct hdmi_vendor_infoframe *fram
 	struct hdmi_spd_infoframe spd;
 	union hdmi_vendor_any_infoframe vendor;
 	struct hdmi_audio_infoframe audio;
+	struct hdmi_drm_infoframe drm;
 };
 
 ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer,
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Re: [v9 04/13] drm: Enable HDR infoframe support

Quoted 80 lines · Uma Shankar

[CAUTION: External Email]

Enable Dynamic Range and Mastering Infoframe for HDR content, which is defined in CEA 861.3 spec.

The metadata will be computed based on blending policy in userspace compositors and passed as a connector property blob to driver. The same will be sent as infoframe to panel which support HDR.

Added the const version of infoframe for DRM metadata for HDR.

v2: Rebase and added Ville's POC changes.

v3: No Change

v4: Addressed Shashank's review comments and merged the patch making drm infoframe function arguments as constant.

v5: Rebase

v6: Fixed checkpatch warnings with --strict option. Addressed Shashank's review comments and added his RB.

v7: Addressed Brian Starkey's review comments. Merged 2 patches into one.

v8: Addressed Jonas Karlman review comments.

---
  drivers/gpu/drm/drm_edid.c |  48 ++++++++++++
  drivers/video/hdmi.c       | 186 +++++++++++++++++++++++++++++++++++++++++++++
  include/drm/drm_edid.h     |   5 ++
  include/linux/hdmi.h       |  27 +++++++
  4 files changed, 266 insertions(+)
drivers/gpu/drm/drm_edid.c +32 -0
index fe2c29b..5f48965 100644
@@ -4906,6 +4906,54 @@ static bool is_hdmi2_sink(struct drm_connector *connector)
  }
 
  /**
+ * drm_hdmi_infoframe_set_hdr_metadata() - fill an HDMI AVI infoframe with
+ *                                         HDR metadata from userspace
+ * @frame: HDMI AVI infoframe
+ * @hdr_source_metadata: hdr_source_metadata info from userspace
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int
+drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
+                                   struct hdr_output_metadata *hdr_metadata)
+{
+       int err;
+
+       if (!frame || !hdr_metadata)
+               return true;
+
+       err = hdmi_drm_infoframe_init(frame);
+       if (err < 0)
+               return err;
+
+       DRM_DEBUG_KMS("type = %x\n", frame->type);
+
+       frame->length = sizeof(struct hdr_metadata_infoframe);
+
+       frame->eotf = hdr_metadata->hdmi_metadata_type1.eotf;
+       frame->metadata_type = hdr_metadata->hdmi_metadata_type1.metadata_type;
+
+       memcpy(&frame->display_primaries,
+              &hdr_metadata->hdmi_metadata_type1.display_primaries, 12);
+
+       memcpy(&frame->white_point,
+              &hdr_metadata->hdmi_metadata_type1.white_point, 4);

drivers/gpu/drm/drm_edid.c static bool is_hdmi2_sink(struct drm_connector *connector) · line 4950

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+
+       frame->max_display_mastering_luminance =
+               hdr_metadata->hdmi_metadata_type1.max_display_mastering_luminance;
+       frame->min_display_mastering_luminance =
+               hdr_metadata->hdmi_metadata_type1.min_display_mastering_luminance;
+       frame->max_fall = hdr_metadata->hdmi_metadata_type1.max_fall;
+       frame->max_cll = hdr_metadata->hdmi_metadata_type1.max_cll;
+
+       hdmi_infoframe_log(KERN_CRIT, NULL,
+                          (union hdmi_infoframe *)frame);

This shouldn't really be KERN_CRIT for debug output. Maybe KERN_INFO or KERN_DEBUG or just drop the log altogether since it can't actually tag it to DRM or the driver itself in this function.

Nicholas Kazlauskas

Quoted 325 lines
drivers/gpu/drm/drm_edid.c +6 -0
+
+       return 0;
+}
+EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata);
+
+/**
   * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
   *                                              data from a DRM display mode
   * @frame: HDMI AVI infoframe
drivers/video/hdmi.c +186 -0
index 799ae49..717ed7fb 100644
@@ -650,6 +650,146 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
         return 0;
  }
 
+/**
+ * hdmi_drm_infoframe_init() - initialize an HDMI Dynaminc Range and
+ * mastering infoframe
+ * @frame: HDMI DRM infoframe
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame)
+{
+       memset(frame, 0, sizeof(*frame));
+
+       frame->type = HDMI_INFOFRAME_TYPE_DRM;
+       frame->version = 1;
+
+       return 0;
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_init);
+
+static int hdmi_drm_infoframe_check_only(const struct hdmi_drm_infoframe *frame)
+{
+       if (frame->type != HDMI_INFOFRAME_TYPE_DRM ||
+           frame->version != 1)
+               return -EINVAL;
+
+       return 0;
+}
+
+/**
+ * hdmi_drm_infoframe_check() - check a HDMI DRM infoframe
+ * @frame: HDMI DRM infoframe
+ *
+ * Validates that the infoframe is consistent.
+ * Returns 0 on success or a negative error code on failure.
+ */
+int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame)
+{
+       return hdmi_drm_infoframe_check_only(frame);
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_check);
+
+/**
+ * hdmi_drm_infoframe_pack() - write HDMI DRM infoframe to binary buffer
+ * @frame: HDMI DRM infoframe
+ * @buffer: destination buffer
+ * @size: size of buffer
+ *
+ * Packs the information contained in the @frame structure into a binary
+ * representation that can be written into the corresponding controller
+ * registers. Also computes the checksum as required by section 5.3.5 of
+ * the HDMI 1.4 specification.
+ *
+ * Returns the number of bytes packed into the binary buffer or a negative
+ * error code on failure.
+ */
+ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
+                                    void *buffer, size_t size)
+{
+       u8 *ptr = buffer;
+       size_t length;
+       int i;
+
+       length = HDMI_INFOFRAME_HEADER_SIZE + frame->length;
+
+       if (size < length)
+               return -ENOSPC;
+
+       memset(buffer, 0, size);
+
+       ptr[0] = frame->type;
+       ptr[1] = frame->version;
+       ptr[2] = frame->length;
+       ptr[3] = 0; /* checksum */
+
+       /* start infoframe payload */
+       ptr += HDMI_INFOFRAME_HEADER_SIZE;
+
+       *ptr++ = frame->eotf;
+       *ptr++ = frame->metadata_type;
+
+       for (i = 0; i < 3; i++) {
+               *ptr++ = frame->display_primaries[i].x;
+               *ptr++ = frame->display_primaries[i].x >> 8;
+               *ptr++ = frame->display_primaries[i].y;
+               *ptr++ = frame->display_primaries[i].y >> 8;
+       }
+
+       *ptr++ = frame->white_point.x;
+       *ptr++ = frame->white_point.x >> 8;
+
+       *ptr++ = frame->white_point.y;
+       *ptr++ = frame->white_point.y >> 8;
+
+       *ptr++ = frame->max_display_mastering_luminance;
+       *ptr++ = frame->max_display_mastering_luminance >> 8;
+
+       *ptr++ = frame->min_display_mastering_luminance;
+       *ptr++ = frame->min_display_mastering_luminance >> 8;
+
+       *ptr++ = frame->max_cll;
+       *ptr++ = frame->max_cll >> 8;
+
+       *ptr++ = frame->max_fall;
+       *ptr++ = frame->max_fall >> 8;
+
+       hdmi_infoframe_set_checksum(buffer, length);
+
+       return length;
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_pack_only);
+
+/**
+ * hdmi_drm_infoframe_pack() - check a HDMI DRM infoframe,
+ *                             and write it to binary buffer
+ * @frame: HDMI DRM infoframe
+ * @buffer: destination buffer
+ * @size: size of buffer
+ *
+ * Validates that the infoframe is consistent and updates derived fields
+ * (eg. length) based on other fields, after which it packs the information
+ * contained in the @frame structure into a binary representation that
+ * can be written into the corresponding controller registers. This function
+ * also computes the checksum as required by section 5.3.5 of the HDMI 1.4
+ * specification.
+ *
+ * Returns the number of bytes packed into the binary buffer or a negative
+ * error code on failure.
+ */
+ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame,
+                               void *buffer, size_t size)
+{
+       int ret;
+
+       ret = hdmi_drm_infoframe_check(frame);
+       if (ret)
+               return ret;
+
+       return hdmi_drm_infoframe_pack_only(frame, buffer, size);
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_pack);
+
  /*
   * hdmi_vendor_any_infoframe_check() - check a vendor infoframe
   */
@@ -758,6 +898,10 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
                 length = hdmi_avi_infoframe_pack_only(&frame->avi,
                                                       buffer, size);
                 break;
+       case HDMI_INFOFRAME_TYPE_DRM:
+               length = hdmi_drm_infoframe_pack_only(&frame->drm,
+                                                     buffer, size);
+               break;
         case HDMI_INFOFRAME_TYPE_SPD:
                 length = hdmi_spd_infoframe_pack_only(&frame->spd,
                                                       buffer, size);
@@ -806,6 +950,9 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
         case HDMI_INFOFRAME_TYPE_AVI:
                 length = hdmi_avi_infoframe_pack(&frame->avi, buffer, size);
                 break;
+       case HDMI_INFOFRAME_TYPE_DRM:
+               length = hdmi_drm_infoframe_pack(&frame->drm, buffer, size);
+               break;
         case HDMI_INFOFRAME_TYPE_SPD:
                 length = hdmi_spd_infoframe_pack(&frame->spd, buffer, size);
                 break;
@@ -838,6 +985,8 @@ static const char *hdmi_infoframe_type_get_name(enum hdmi_infoframe_type type)
                 return "Source Product Description (SPD)";
         case HDMI_INFOFRAME_TYPE_AUDIO:
                 return "Audio";
+       case HDMI_INFOFRAME_TYPE_DRM:
+               return "Dynamic Range and Mastering";
         }
         return "Reserved";
  }
@@ -1284,6 +1433,40 @@ static void hdmi_audio_infoframe_log(const char *level,
                         frame->downmix_inhibit ? "Yes" : "No");
  }
 
+/**
+ * hdmi_drm_infoframe_log() - log info of HDMI DRM infoframe
+ * @level: logging level
+ * @dev: device
+ * @frame: HDMI DRM infoframe
+ */
+static void hdmi_drm_infoframe_log(const char *level,
+                                  struct device *dev,
+                                  const struct hdmi_drm_infoframe *frame)
+{
+       int i;
+
+       hdmi_infoframe_log_header(level, dev,
+                                 (struct hdmi_any_infoframe *)frame);
+       hdmi_log("length: %d\n", frame->length);
+       hdmi_log("metadata type: %d\n", frame->metadata_type);
+       hdmi_log("eotf: %d\n", frame->eotf);
+       for (i = 0; i < 3; i++) {
+               hdmi_log("x[%d]: %d\n", i, frame->display_primaries[i].x);
+               hdmi_log("y[%d]: %d\n", i, frame->display_primaries[i].y);
+       }
+
+       hdmi_log("white point x: %d\n", frame->white_point.x);
+       hdmi_log("white point y: %d\n", frame->white_point.y);
+
+       hdmi_log("max_display_mastering_luminance: %d\n",
+                frame->max_display_mastering_luminance);
+       hdmi_log("min_display_mastering_luminance: %d\n",
+                frame->min_display_mastering_luminance);
+
+       hdmi_log("max_cll: %d\n", frame->max_cll);
+       hdmi_log("max_fall: %d\n", frame->max_fall);
+}
+
  static const char *
  hdmi_3d_structure_get_name(enum hdmi_3d_structure s3d_struct)
  {
@@ -1372,6 +1555,9 @@ void hdmi_infoframe_log(const char *level,
         case HDMI_INFOFRAME_TYPE_VENDOR:
                 hdmi_vendor_any_infoframe_log(level, dev, &frame->vendor);
                 break;
+       case HDMI_INFOFRAME_TYPE_DRM:
+               hdmi_drm_infoframe_log(level, dev, &frame->drm);
+               break;
         }
  }
  EXPORT_SYMBOL(hdmi_infoframe_log);
include/drm/drm_edid.h +5 -0
index 9d3b5b9..d81c5c2 100644
@@ -25,6 +25,7 @@
 
  #include <linux/types.h>
  #include <linux/hdmi.h>
+#include <drm/drm_mode.h>
 
  struct drm_device;
  struct i2c_adapter;
@@ -370,6 +371,10 @@ int drm_av_sync_delay(struct drm_connector *connector,
                                    const struct drm_display_mode *mode,
                                    enum hdmi_quantization_range rgb_quant_range);
 
+int
+drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
+                                   struct hdr_output_metadata *hdr_metadata);
+
  /**
   * drm_eld_mnl - Get ELD monitor name length in bytes.
   * @eld: pointer to an eld memory structure with mnl set
include/linux/hdmi.h +27 -1
index 6780476..7edafcf 100644
@@ -47,6 +47,7 @@ enum hdmi_infoframe_type {
         HDMI_INFOFRAME_TYPE_AVI = 0x82,
         HDMI_INFOFRAME_TYPE_SPD = 0x83,
         HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
+       HDMI_INFOFRAME_TYPE_DRM = 0x87,
  };
 
  #define HDMI_IEEE_OUI 0x000c03
@@ -185,12 +186,37 @@ struct hdmi_avi_infoframe {
         unsigned short right_bar;
  };
 
+/* DRM Infoframe as per CTA 861.G spec */
+struct hdmi_drm_infoframe {
+       enum hdmi_infoframe_type type;
+       unsigned char version;
+       unsigned char length;
+       enum hdmi_eotf eotf;
+       enum hdmi_metadata_type metadata_type;
+       struct {
+               u16 x, y;
+       } display_primaries[3];
+       struct {
+               u16 x, y;
+       } white_point;
+       u16 max_display_mastering_luminance;
+       u16 min_display_mastering_luminance;
+       u16 max_cll;
+       u16 max_fall;
+};
+
  int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);
  ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
                                 size_t size);
  ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame,
                                      void *buffer, size_t size);
  int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame);
+int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame);
+ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
+                               size_t size);
+ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
+                                    void *buffer, size_t size);
+int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame);
 
  enum hdmi_spd_sdi {
         HDMI_SPD_SDI_UNKNOWN,
@@ -381,6 +407,7 @@ ssize_t hdmi_vendor_infoframe_pack_only(const struct hdmi_vendor_infoframe *fram
         struct hdmi_spd_infoframe spd;
         union hdmi_vendor_any_infoframe vendor;
         struct hdmi_audio_infoframe audio;
+       struct hdmi_drm_infoframe drm;
  };
 
  ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer,
--

1.9.1

Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw

Re: [v9 04/13] drm: Enable HDR infoframe support

Quoted 103 lines

-----Original Message-----
From: Kazlauskas, Nicholas [mailto:[email protected]]
Sent: Tuesday, May 14, 2019 6:06 PM
To: Shankar, Uma <[email protected]>; [email protected]; dri- [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [v9 04/13] drm: Enable HDR infoframe support

Quoted 26 lines · Uma Shankar

[CAUTION: External Email]

Enable Dynamic Range and Mastering Infoframe for HDR content, which is defined in CEA 861.3 spec.

The metadata will be computed based on blending policy in userspace compositors and passed as a connector property blob to driver. The same will be sent as infoframe to panel which support HDR.

Added the const version of infoframe for DRM metadata for HDR.

v2: Rebase and added Ville's POC changes.

v3: No Change

v4: Addressed Shashank's review comments and merged the patch making drm infoframe function arguments as constant.

v5: Rebase

v6: Fixed checkpatch warnings with --strict option. Addressed Shashank's review comments and added his RB.

v7: Addressed Brian Starkey's review comments. Merged 2 patches into one.

Quoted 8 lines

v8: Addressed Jonas Karlman review comments.

---
  drivers/gpu/drm/drm_edid.c |  48 ++++++++++++
  drivers/video/hdmi.c       | 186

+++++++++++++++++++++++++++++++++++++++++++++

drivers/gpu/drm/drm_edid.c static bool is_hdmi2_sink(struct drm_connector

Quoted 9 lines
  include/drm/drm_edid.h     |   5 ++
  include/linux/hdmi.h       |  27 +++++++
  4 files changed, 266 insertions(+)
drivers/gpu/drm/drm_edid.c +0 -0
index fe2c29b..5f48965 100644
@@ -4906,6 +4906,54 @@ static bool is_hdmi2_sink(struct drm_connector

*connector)

Quoted 45 lines
drivers/gpu/drm/drm_edid.c +40 -0
  }
 
  /**
+ * drm_hdmi_infoframe_set_hdr_metadata() - fill an HDMI AVI infoframe with
+ *                                         HDR metadata from userspace
+ * @frame: HDMI AVI infoframe
+ * @hdr_source_metadata: hdr_source_metadata info from userspace
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int
+drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
+                                   struct hdr_output_metadata
+*hdr_metadata) {
+       int err;
+
+       if (!frame || !hdr_metadata)
+               return true;
+
+       err = hdmi_drm_infoframe_init(frame);
+       if (err < 0)
+               return err;
+
+       DRM_DEBUG_KMS("type = %x\n", frame->type);
+
+       frame->length = sizeof(struct hdr_metadata_infoframe);
+
+       frame->eotf = hdr_metadata->hdmi_metadata_type1.eotf;
+       frame->metadata_type =
+ hdr_metadata->hdmi_metadata_type1.metadata_type;
+
+       memcpy(&frame->display_primaries,
+              &hdr_metadata->hdmi_metadata_type1.display_primaries,
+ 12);
+
+       memcpy(&frame->white_point,
+              &hdr_metadata->hdmi_metadata_type1.white_point, 4);
+
+       frame->max_display_mastering_luminance =
+               hdr_metadata-
 hdmi_metadata_type1.max_display_mastering_luminance;
+       frame->min_display_mastering_luminance =
+               hdr_metadata-
 hdmi_metadata_type1.min_display_mastering_luminance;
+       frame->max_fall = hdr_metadata->hdmi_metadata_type1.max_fall;
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static bool is_hdmi2_sink(struct drm_connector *connector) · line 4950

Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+       frame->max_cll = hdr_metadata->hdmi_metadata_type1.max_cll;
+
+       hdmi_infoframe_log(KERN_CRIT, NULL,
+                          (union hdmi_infoframe *)frame);

This shouldn't really be KERN_CRIT for debug output. Maybe KERN_INFO or KERN_DEBUG or just drop the log altogether since it can't actually tag it to DRM or the driver itself in this function.

I added this for debug and missed to drop it, it's really not needed. Will drop this log in the next version.

Regards,
Uma Shankar

Quoted 327 lines

Nicholas Kazlauskas

drivers/gpu/drm/drm_edid.c static bool is_hdmi2_sink(struct drm_connector *connector)

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +6 -0
+
+       return 0;
+}
+EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata);
+
+/**
   * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe

with

drivers/video/hdmi.c ssize_t hdmi_vendor_infoframe_pack(struct

Quoted 7 lines

* data from a DRM display mode
* @frame: HDMI AVI infoframe

drivers/video/hdmi.c index renamed from drivers/video/hdmi.c +0 -0

799ae49..717ed7fb 100644

drivers/video/hdmi.c +0 -0
@@ -650,6 +650,146 @@ ssize_t hdmi_vendor_infoframe_pack(struct

hdmi_vendor_infoframe *frame,

drivers/video/hdmi.c ssize_t hdmi_vendor_infoframe_pack(struct

Quoted 153 lines
drivers/video/hdmi.c +146 -0
         return 0;
  }
 
+/**
+ * hdmi_drm_infoframe_init() - initialize an HDMI Dynaminc Range and
+ * mastering infoframe
+ * @frame: HDMI DRM infoframe
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame) {
+       memset(frame, 0, sizeof(*frame));
+
+       frame->type = HDMI_INFOFRAME_TYPE_DRM;
+       frame->version = 1;
+
+       return 0;
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_init);
+
+static int hdmi_drm_infoframe_check_only(const struct
+hdmi_drm_infoframe *frame) {
+       if (frame->type != HDMI_INFOFRAME_TYPE_DRM ||
+           frame->version != 1)
+               return -EINVAL;
+
+       return 0;
+}
+
+/**
+ * hdmi_drm_infoframe_check() - check a HDMI DRM infoframe
+ * @frame: HDMI DRM infoframe
+ *
+ * Validates that the infoframe is consistent.
+ * Returns 0 on success or a negative error code on failure.
+ */
+int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame) {
+       return hdmi_drm_infoframe_check_only(frame);
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_check);
+
+/**
+ * hdmi_drm_infoframe_pack() - write HDMI DRM infoframe to binary
+buffer
+ * @frame: HDMI DRM infoframe
+ * @buffer: destination buffer
+ * @size: size of buffer
+ *
+ * Packs the information contained in the @frame structure into a
+binary
+ * representation that can be written into the corresponding
+controller
+ * registers. Also computes the checksum as required by section 5.3.5
+of
+ * the HDMI 1.4 specification.
+ *
+ * Returns the number of bytes packed into the binary buffer or a
+negative
+ * error code on failure.
+ */
+ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
+                                    void *buffer, size_t size) {
+       u8 *ptr = buffer;
+       size_t length;
+       int i;
+
+       length = HDMI_INFOFRAME_HEADER_SIZE + frame->length;
+
+       if (size < length)
+               return -ENOSPC;
+
+       memset(buffer, 0, size);
+
+       ptr[0] = frame->type;
+       ptr[1] = frame->version;
+       ptr[2] = frame->length;
+       ptr[3] = 0; /* checksum */
+
+       /* start infoframe payload */
+       ptr += HDMI_INFOFRAME_HEADER_SIZE;
+
+       *ptr++ = frame->eotf;
+       *ptr++ = frame->metadata_type;
+
+       for (i = 0; i < 3; i++) {
+               *ptr++ = frame->display_primaries[i].x;
+               *ptr++ = frame->display_primaries[i].x >> 8;
+               *ptr++ = frame->display_primaries[i].y;
+               *ptr++ = frame->display_primaries[i].y >> 8;
+       }
+
+       *ptr++ = frame->white_point.x;
+       *ptr++ = frame->white_point.x >> 8;
+
+       *ptr++ = frame->white_point.y;
+       *ptr++ = frame->white_point.y >> 8;
+
+       *ptr++ = frame->max_display_mastering_luminance;
+       *ptr++ = frame->max_display_mastering_luminance >> 8;
+
+       *ptr++ = frame->min_display_mastering_luminance;
+       *ptr++ = frame->min_display_mastering_luminance >> 8;
+
+       *ptr++ = frame->max_cll;
+       *ptr++ = frame->max_cll >> 8;
+
+       *ptr++ = frame->max_fall;
+       *ptr++ = frame->max_fall >> 8;
+
+       hdmi_infoframe_set_checksum(buffer, length);
+
+       return length;
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_pack_only);
+
+/**
+ * hdmi_drm_infoframe_pack() - check a HDMI DRM infoframe,
+ *                             and write it to binary buffer
+ * @frame: HDMI DRM infoframe
+ * @buffer: destination buffer
+ * @size: size of buffer
+ *
+ * Validates that the infoframe is consistent and updates derived
+fields
+ * (eg. length) based on other fields, after which it packs the
+information
+ * contained in the @frame structure into a binary representation
+that
+ * can be written into the corresponding controller registers. This
+function
+ * also computes the checksum as required by section 5.3.5 of the
+HDMI 1.4
+ * specification.
+ *
+ * Returns the number of bytes packed into the binary buffer or a
+negative
+ * error code on failure.
+ */
+ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame,
+                               void *buffer, size_t size) {
+       int ret;
+
+       ret = hdmi_drm_infoframe_check(frame);
+       if (ret)
+               return ret;
+
+       return hdmi_drm_infoframe_pack_only(frame, buffer, size); }
+EXPORT_SYMBOL(hdmi_drm_infoframe_pack);
+
  /*
   * hdmi_vendor_any_infoframe_check() - check a vendor infoframe
   */
@@ -758,6 +898,10 @@ ssize_t hdmi_vendor_infoframe_pack(struct

hdmi_vendor_infoframe *frame,

drivers/video/hdmi.c ssize_t hdmi_vendor_infoframe_pack(struct

Quoted 11 lines
drivers/video/hdmi.c +4 -0
                 length = hdmi_avi_infoframe_pack_only(&frame->avi,
                                                       buffer, size);
                 break;
+       case HDMI_INFOFRAME_TYPE_DRM:
+               length = hdmi_drm_infoframe_pack_only(&frame->drm,
+                                                     buffer, size);
+               break;
         case HDMI_INFOFRAME_TYPE_SPD:
                 length = hdmi_spd_infoframe_pack_only(&frame->spd,
                                                       buffer, size);
@@ -806,6 +950,9 @@ ssize_t hdmi_vendor_infoframe_pack(struct

hdmi_vendor_infoframe *frame,

drivers/video/hdmi.c static const char *hdmi_infoframe_type_get_name(enum

Quoted 10 lines
drivers/video/hdmi.c +3 -0
         case HDMI_INFOFRAME_TYPE_AVI:
                 length = hdmi_avi_infoframe_pack(&frame->avi, buffer, size);
                 break;
+       case HDMI_INFOFRAME_TYPE_DRM:
+               length = hdmi_drm_infoframe_pack(&frame->drm, buffer, size);
+               break;
         case HDMI_INFOFRAME_TYPE_SPD:
                 length = hdmi_spd_infoframe_pack(&frame->spd, buffer, size);
                 break;
@@ -838,6 +985,8 @@ static const char *hdmi_infoframe_type_get_name(enum

hdmi_infoframe_type type)

drivers/video/hdmi.c static void hdmi_audio_infoframe_log(const char

Quoted 9 lines
drivers/video/hdmi.c +2 -0
                 return "Source Product Description (SPD)";
         case HDMI_INFOFRAME_TYPE_AUDIO:
                 return "Audio";
+       case HDMI_INFOFRAME_TYPE_DRM:
+               return "Dynamic Range and Mastering";
         }
         return "Reserved";
  }
@@ -1284,6 +1433,40 @@ static void hdmi_audio_infoframe_log(const char

*level,

Quoted 106 lines
drivers/video/hdmi.c +36 -0
                         frame->downmix_inhibit ? "Yes" : "No");
  }
 
+/**
+ * hdmi_drm_infoframe_log() - log info of HDMI DRM infoframe
+ * @level: logging level
+ * @dev: device
+ * @frame: HDMI DRM infoframe
+ */
+static void hdmi_drm_infoframe_log(const char *level,
+                                  struct device *dev,
+                                  const struct hdmi_drm_infoframe
+*frame) {
+       int i;
+
+       hdmi_infoframe_log_header(level, dev,
+                                 (struct hdmi_any_infoframe *)frame);
+       hdmi_log("length: %d\n", frame->length);
+       hdmi_log("metadata type: %d\n", frame->metadata_type);
+       hdmi_log("eotf: %d\n", frame->eotf);
+       for (i = 0; i < 3; i++) {
+               hdmi_log("x[%d]: %d\n", i, frame->display_primaries[i].x);
+               hdmi_log("y[%d]: %d\n", i, frame->display_primaries[i].y);
+       }
+
+       hdmi_log("white point x: %d\n", frame->white_point.x);
+       hdmi_log("white point y: %d\n", frame->white_point.y);
+
+       hdmi_log("max_display_mastering_luminance: %d\n",
+                frame->max_display_mastering_luminance);
+       hdmi_log("min_display_mastering_luminance: %d\n",
+                frame->min_display_mastering_luminance);
+
+       hdmi_log("max_cll: %d\n", frame->max_cll);
+       hdmi_log("max_fall: %d\n", frame->max_fall); }
+
  static const char *
  hdmi_3d_structure_get_name(enum hdmi_3d_structure s3d_struct)
  {
@@ -1372,6 +1555,9 @@ void hdmi_infoframe_log(const char *level,
         case HDMI_INFOFRAME_TYPE_VENDOR:
                 hdmi_vendor_any_infoframe_log(level, dev, &frame->vendor);
                 break;
+       case HDMI_INFOFRAME_TYPE_DRM:
+               hdmi_drm_infoframe_log(level, dev, &frame->drm);
+               break;
         }
  }
  EXPORT_SYMBOL(hdmi_infoframe_log);
include/drm/drm_edid.h index renamed from include/drm/drm_edid.h +0 -0

9d3b5b9..d81c5c2 100644

include/drm/drm_edid.h +6 -0
@@ -25,6 +25,7 @@
 
  #include <linux/types.h>
  #include <linux/hdmi.h>
+#include <drm/drm_mode.h>
 
  struct drm_device;
  struct i2c_adapter;
@@ -370,6 +371,10 @@ int drm_av_sync_delay(struct drm_connector *connector,
                                    const struct drm_display_mode *mode,
                                    enum hdmi_quantization_range
 rgb_quant_range);
 
+int
+drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
+                                   struct hdr_output_metadata
+*hdr_metadata);
+
  /**
   * drm_eld_mnl - Get ELD monitor name length in bytes.
   * @eld: pointer to an eld memory structure with mnl set diff --git

a/include/linux/hdmi.h b/include/linux/hdmi.h index 6780476..7edafcf 100644

include/linux/hdmi.h +17 -0
@@ -47,6 +47,7 @@ enum hdmi_infoframe_type {
         HDMI_INFOFRAME_TYPE_AVI = 0x82,
         HDMI_INFOFRAME_TYPE_SPD = 0x83,
         HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
+       HDMI_INFOFRAME_TYPE_DRM = 0x87,
  };
 
  #define HDMI_IEEE_OUI 0x000c03
@@ -185,12 +186,37 @@ struct hdmi_avi_infoframe {
         unsigned short right_bar;
  };
 
+/* DRM Infoframe as per CTA 861.G spec */ struct hdmi_drm_infoframe {
+       enum hdmi_infoframe_type type;
+       unsigned char version;
+       unsigned char length;
+       enum hdmi_eotf eotf;
+       enum hdmi_metadata_type metadata_type;
+       struct {
+               u16 x, y;
+       } display_primaries[3];
+       struct {
+               u16 x, y;
+       } white_point;
+       u16 max_display_mastering_luminance;
+       u16 min_display_mastering_luminance;
+       u16 max_cll;
+       u16 max_fall;

include/linux/hdmi.h struct hdmi_avi_infoframe { · line 214

Quoted 10 lines
include/linux/hdmi.h +4 -0
+};
+
  int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);
  ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
                                 size_t size);
  ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame,
                                      void *buffer, size_t size);
  int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame);
+int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame);
+ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void

*buffer,

Quoted 5 lines
include/linux/hdmi.h +4 -0
+                               size_t size); ssize_t
+hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
+                                    void *buffer, size_t size); int
+hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame);
 
Quoted 20 lines

include/linux/hdmi.h ssize_t hdmi_vendor_infoframe_pack_only(const struct

Quoted 3 lines
include/linux/hdmi.h +0 -0
  enum hdmi_spd_sdi {
         HDMI_SPD_SDI_UNKNOWN,
@@ -381,6 +407,7 @@ ssize_t hdmi_vendor_infoframe_pack_only(const struct

hdmi_vendor_infoframe *fram

Quoted 16 lines
include/linux/hdmi.h +1 -0
         struct hdmi_spd_infoframe spd;
         union hdmi_vendor_any_infoframe vendor;
         struct hdmi_audio_infoframe audio;
+       struct hdmi_drm_infoframe drm;
  };
 
  ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void

*buffer,
--
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

Re: [v9 04/13] drm: Enable HDR infoframe support

In reply to Kazlauskas, Nicholas
Quoted 48 lines · Nicholas
Quoted 47 lines · Uma Shankar

[CAUTION: External Email]

Enable Dynamic Range and Mastering Infoframe for HDR content, which is defined in CEA 861.3 spec.

The metadata will be computed based on blending policy in userspace compositors and passed as a connector property blob to driver. The same will be sent as infoframe to panel which support HDR.

Added the const version of infoframe for DRM metadata for HDR.

v2: Rebase and added Ville's POC changes.

v3: No Change

v4: Addressed Shashank's review comments and merged the patch making drm infoframe function arguments as constant.

v5: Rebase

v6: Fixed checkpatch warnings with --strict option. Addressed Shashank's review comments and added his RB.

v7: Addressed Brian Starkey's review comments. Merged 2 patches into one.

v8: Addressed Jonas Karlman review comments.

---
  drivers/gpu/drm/drm_edid.c |  48 ++++++++++++
  drivers/video/hdmi.c       | 186 +++++++++++++++++++++++++++++++++++++++++++++
  include/drm/drm_edid.h     |   5 ++
  include/linux/hdmi.h       |  27 +++++++
  4 files changed, 266 insertions(+)
drivers/gpu/drm/drm_edid.c +0 -0
index fe2c29b..5f48965 100644
@@ -4906,6 +4906,54 @@ static bool is_hdmi2_sink(struct drm_connector *connector)
  }
 
Quoted 11 lines

drivers/gpu/drm/drm_edid.c static bool is_hdmi2_sink(struct drm_connector *connector) · line 4918

Quoted 11 lines
drivers/gpu/drm/drm_edid.c +10 -0
  /**
+ * drm_hdmi_infoframe_set_hdr_metadata() - fill an HDMI AVI infoframe with
+ *                                         HDR metadata from userspace
+ * @frame: HDMI AVI infoframe
+ * @hdr_source_metadata: hdr_source_metadata info from userspace
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int
+drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
+                                   struct hdr_output_metadata *hdr_metadata)

hdr_metadata can be const.

Quoted 5 lines

drivers/gpu/drm/drm_edid.c static bool is_hdmi2_sink(struct drm_connector *connector) · line 4923

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+{
+       int err;
+
+       if (!frame || !hdr_metadata)
+               return true;

true?

Quoted 23 lines
Quoted 23 lines
drivers/gpu/drm/drm_edid.c +23 -0
+
+       err = hdmi_drm_infoframe_init(frame);
+       if (err < 0)
+               return err;
+
+       DRM_DEBUG_KMS("type = %x\n", frame->type);
+
+       frame->length = sizeof(struct hdr_metadata_infoframe);
+
+       frame->eotf = hdr_metadata->hdmi_metadata_type1.eotf;
+       frame->metadata_type = hdr_metadata->hdmi_metadata_type1.metadata_type;
+
+       memcpy(&frame->display_primaries,
+              &hdr_metadata->hdmi_metadata_type1.display_primaries, 12);
+
+       memcpy(&frame->white_point,
+              &hdr_metadata->hdmi_metadata_type1.white_point, 4);
+
+       frame->max_display_mastering_luminance =
+               hdr_metadata->hdmi_metadata_type1.max_display_mastering_luminance;
+       frame->min_display_mastering_luminance =
+               hdr_metadata->hdmi_metadata_type1.min_display_mastering_luminance;
+       frame->max_fall = hdr_metadata->hdmi_metadata_type1.max_fall;
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static bool is_hdmi2_sink(struct drm_connector *connector) · line 4950

Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+       frame->max_cll = hdr_metadata->hdmi_metadata_type1.max_cll;
+
+       hdmi_infoframe_log(KERN_CRIT, NULL,
+                          (union hdmi_infoframe *)frame);

This shouldn't really be KERN_CRIT for debug output. Maybe KERN_INFO or KERN_DEBUG or just drop the log altogether since it can't actually tag it to DRM or the driver itself in this function.

Yeah, this shouldn't be here. It's up to the driver to dump it when it wants to.

Quoted 338 lines

Nicholas Kazlauskas

Quoted 325 lines
drivers/gpu/drm/drm_edid.c +6 -0
+
+       return 0;
+}
+EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata);
+
+/**
   * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
   *                                              data from a DRM display mode
   * @frame: HDMI AVI infoframe
drivers/video/hdmi.c +186 -0
index 799ae49..717ed7fb 100644
@@ -650,6 +650,146 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
         return 0;
  }
 
+/**
+ * hdmi_drm_infoframe_init() - initialize an HDMI Dynaminc Range and
+ * mastering infoframe
+ * @frame: HDMI DRM infoframe
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame)
+{
+       memset(frame, 0, sizeof(*frame));
+
+       frame->type = HDMI_INFOFRAME_TYPE_DRM;
+       frame->version = 1;
+
+       return 0;
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_init);
+
+static int hdmi_drm_infoframe_check_only(const struct hdmi_drm_infoframe *frame)
+{
+       if (frame->type != HDMI_INFOFRAME_TYPE_DRM ||
+           frame->version != 1)
+               return -EINVAL;
+
+       return 0;
+}
+
+/**
+ * hdmi_drm_infoframe_check() - check a HDMI DRM infoframe
+ * @frame: HDMI DRM infoframe
+ *
+ * Validates that the infoframe is consistent.
+ * Returns 0 on success or a negative error code on failure.
+ */
+int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame)
+{
+       return hdmi_drm_infoframe_check_only(frame);
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_check);
+
+/**
+ * hdmi_drm_infoframe_pack() - write HDMI DRM infoframe to binary buffer
+ * @frame: HDMI DRM infoframe
+ * @buffer: destination buffer
+ * @size: size of buffer
+ *
+ * Packs the information contained in the @frame structure into a binary
+ * representation that can be written into the corresponding controller
+ * registers. Also computes the checksum as required by section 5.3.5 of
+ * the HDMI 1.4 specification.
+ *
+ * Returns the number of bytes packed into the binary buffer or a negative
+ * error code on failure.
+ */
+ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
+                                    void *buffer, size_t size)
+{
+       u8 *ptr = buffer;
+       size_t length;
+       int i;
+
+       length = HDMI_INFOFRAME_HEADER_SIZE + frame->length;
+
+       if (size < length)
+               return -ENOSPC;
+
+       memset(buffer, 0, size);
+
+       ptr[0] = frame->type;
+       ptr[1] = frame->version;
+       ptr[2] = frame->length;
+       ptr[3] = 0; /* checksum */
+
+       /* start infoframe payload */
+       ptr += HDMI_INFOFRAME_HEADER_SIZE;
+
+       *ptr++ = frame->eotf;
+       *ptr++ = frame->metadata_type;
+
+       for (i = 0; i < 3; i++) {
+               *ptr++ = frame->display_primaries[i].x;
+               *ptr++ = frame->display_primaries[i].x >> 8;
+               *ptr++ = frame->display_primaries[i].y;
+               *ptr++ = frame->display_primaries[i].y >> 8;
+       }
+
+       *ptr++ = frame->white_point.x;
+       *ptr++ = frame->white_point.x >> 8;
+
+       *ptr++ = frame->white_point.y;
+       *ptr++ = frame->white_point.y >> 8;
+
+       *ptr++ = frame->max_display_mastering_luminance;
+       *ptr++ = frame->max_display_mastering_luminance >> 8;
+
+       *ptr++ = frame->min_display_mastering_luminance;
+       *ptr++ = frame->min_display_mastering_luminance >> 8;
+
+       *ptr++ = frame->max_cll;
+       *ptr++ = frame->max_cll >> 8;
+
+       *ptr++ = frame->max_fall;
+       *ptr++ = frame->max_fall >> 8;
+
+       hdmi_infoframe_set_checksum(buffer, length);
+
+       return length;
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_pack_only);
+
+/**
+ * hdmi_drm_infoframe_pack() - check a HDMI DRM infoframe,
+ *                             and write it to binary buffer
+ * @frame: HDMI DRM infoframe
+ * @buffer: destination buffer
+ * @size: size of buffer
+ *
+ * Validates that the infoframe is consistent and updates derived fields
+ * (eg. length) based on other fields, after which it packs the information
+ * contained in the @frame structure into a binary representation that
+ * can be written into the corresponding controller registers. This function
+ * also computes the checksum as required by section 5.3.5 of the HDMI 1.4
+ * specification.
+ *
+ * Returns the number of bytes packed into the binary buffer or a negative
+ * error code on failure.
+ */
+ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame,
+                               void *buffer, size_t size)
+{
+       int ret;
+
+       ret = hdmi_drm_infoframe_check(frame);
+       if (ret)
+               return ret;
+
+       return hdmi_drm_infoframe_pack_only(frame, buffer, size);
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_pack);
+
  /*
   * hdmi_vendor_any_infoframe_check() - check a vendor infoframe
   */
@@ -758,6 +898,10 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
                 length = hdmi_avi_infoframe_pack_only(&frame->avi,
                                                       buffer, size);
                 break;
+       case HDMI_INFOFRAME_TYPE_DRM:
+               length = hdmi_drm_infoframe_pack_only(&frame->drm,
+                                                     buffer, size);
+               break;
         case HDMI_INFOFRAME_TYPE_SPD:
                 length = hdmi_spd_infoframe_pack_only(&frame->spd,
                                                       buffer, size);
@@ -806,6 +950,9 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
         case HDMI_INFOFRAME_TYPE_AVI:
                 length = hdmi_avi_infoframe_pack(&frame->avi, buffer, size);
                 break;
+       case HDMI_INFOFRAME_TYPE_DRM:
+               length = hdmi_drm_infoframe_pack(&frame->drm, buffer, size);
+               break;
         case HDMI_INFOFRAME_TYPE_SPD:
                 length = hdmi_spd_infoframe_pack(&frame->spd, buffer, size);
                 break;
@@ -838,6 +985,8 @@ static const char *hdmi_infoframe_type_get_name(enum hdmi_infoframe_type type)
                 return "Source Product Description (SPD)";
         case HDMI_INFOFRAME_TYPE_AUDIO:
                 return "Audio";
+       case HDMI_INFOFRAME_TYPE_DRM:
+               return "Dynamic Range and Mastering";
         }
         return "Reserved";
  }
@@ -1284,6 +1433,40 @@ static void hdmi_audio_infoframe_log(const char *level,
                         frame->downmix_inhibit ? "Yes" : "No");
  }
 
+/**
+ * hdmi_drm_infoframe_log() - log info of HDMI DRM infoframe
+ * @level: logging level
+ * @dev: device
+ * @frame: HDMI DRM infoframe
+ */
+static void hdmi_drm_infoframe_log(const char *level,
+                                  struct device *dev,
+                                  const struct hdmi_drm_infoframe *frame)
+{
+       int i;
+
+       hdmi_infoframe_log_header(level, dev,
+                                 (struct hdmi_any_infoframe *)frame);
+       hdmi_log("length: %d\n", frame->length);
+       hdmi_log("metadata type: %d\n", frame->metadata_type);
+       hdmi_log("eotf: %d\n", frame->eotf);
+       for (i = 0; i < 3; i++) {
+               hdmi_log("x[%d]: %d\n", i, frame->display_primaries[i].x);
+               hdmi_log("y[%d]: %d\n", i, frame->display_primaries[i].y);
+       }
+
+       hdmi_log("white point x: %d\n", frame->white_point.x);
+       hdmi_log("white point y: %d\n", frame->white_point.y);
+
+       hdmi_log("max_display_mastering_luminance: %d\n",
+                frame->max_display_mastering_luminance);
+       hdmi_log("min_display_mastering_luminance: %d\n",
+                frame->min_display_mastering_luminance);
+
+       hdmi_log("max_cll: %d\n", frame->max_cll);
+       hdmi_log("max_fall: %d\n", frame->max_fall);
+}
+
  static const char *
  hdmi_3d_structure_get_name(enum hdmi_3d_structure s3d_struct)
  {
@@ -1372,6 +1555,9 @@ void hdmi_infoframe_log(const char *level,
         case HDMI_INFOFRAME_TYPE_VENDOR:
                 hdmi_vendor_any_infoframe_log(level, dev, &frame->vendor);
                 break;
+       case HDMI_INFOFRAME_TYPE_DRM:
+               hdmi_drm_infoframe_log(level, dev, &frame->drm);
+               break;
         }
  }
  EXPORT_SYMBOL(hdmi_infoframe_log);
include/drm/drm_edid.h +5 -0
index 9d3b5b9..d81c5c2 100644
@@ -25,6 +25,7 @@
 
  #include <linux/types.h>
  #include <linux/hdmi.h>
+#include <drm/drm_mode.h>
 
  struct drm_device;
  struct i2c_adapter;
@@ -370,6 +371,10 @@ int drm_av_sync_delay(struct drm_connector *connector,
                                    const struct drm_display_mode *mode,
                                    enum hdmi_quantization_range rgb_quant_range);
 
+int
+drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
+                                   struct hdr_output_metadata *hdr_metadata);
+
  /**
   * drm_eld_mnl - Get ELD monitor name length in bytes.
   * @eld: pointer to an eld memory structure with mnl set
include/linux/hdmi.h +27 -1
index 6780476..7edafcf 100644
@@ -47,6 +47,7 @@ enum hdmi_infoframe_type {
         HDMI_INFOFRAME_TYPE_AVI = 0x82,
         HDMI_INFOFRAME_TYPE_SPD = 0x83,
         HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
+       HDMI_INFOFRAME_TYPE_DRM = 0x87,
  };
 
  #define HDMI_IEEE_OUI 0x000c03
@@ -185,12 +186,37 @@ struct hdmi_avi_infoframe {
         unsigned short right_bar;
  };
 
+/* DRM Infoframe as per CTA 861.G spec */
+struct hdmi_drm_infoframe {
+       enum hdmi_infoframe_type type;
+       unsigned char version;
+       unsigned char length;
+       enum hdmi_eotf eotf;
+       enum hdmi_metadata_type metadata_type;
+       struct {
+               u16 x, y;
+       } display_primaries[3];
+       struct {
+               u16 x, y;
+       } white_point;
+       u16 max_display_mastering_luminance;
+       u16 min_display_mastering_luminance;
+       u16 max_cll;
+       u16 max_fall;
+};
+
  int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);
  ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
                                 size_t size);
  ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame,
                                      void *buffer, size_t size);
  int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame);
+int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame);
+ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
+                               size_t size);
+ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
+                                    void *buffer, size_t size);
+int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame);
 
  enum hdmi_spd_sdi {
         HDMI_SPD_SDI_UNKNOWN,
@@ -381,6 +407,7 @@ ssize_t hdmi_vendor_infoframe_pack_only(const struct hdmi_vendor_infoframe *fram
         struct hdmi_spd_infoframe spd;
         union hdmi_vendor_any_infoframe vendor;
         struct hdmi_audio_infoframe audio;
+       struct hdmi_drm_infoframe drm;
  };
 
  ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer,
--

1.9.1

Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw

PATCH v9 5/13 drm/i915: Attach HDR metadata property to connector

In reply to Uma Shankar

Attach HDR metadata property to connector object.

v2: Rebase

v3: Updated the property name as per updated name
while creating hdr metadata property

---
 drivers/gpu/drm/i915/intel_hdmi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
index 2a4086c..92597d8 100644
@@ -2724,6 +2724,8 @@ static void intel_hdmi_destroy(struct drm_connector *connector)
 
 	drm_connector_attach_content_type_property(connector);
 	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
+	drm_object_attach_property(&connector->base,
+				   connector->dev->mode_config.hdr_output_metadata_property, 0);
 
 	if (!HAS_GMCH(dev_priv))
 		drm_connector_attach_max_bpc_property(connector, 8, 12);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH v9 6/13 drm/i915: Write HDR infoframe and send to panel

In reply to Uma Shankar

Enable writing of HDR metadata infoframe to panel. The data will be provid by usersapace compositors, based on blending policies and passsed to driver through a blob property.

v2: Rebase

v3: Fixed a warning message

v4: Addressed Shashank's review comments

v5: Rebase. Added infoframe calculation in compute config.

v6: Addressed Shashank's review comment. Added HDR metadata support from GEN10 onwards as per Shashank's recommendation.

v7: Addressed Shashank's review comments

v8: Added Shashank's RB.

---
 drivers/gpu/drm/i915/intel_drv.h  |  1 +
 drivers/gpu/drm/i915/intel_hdmi.c | 48 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 247893e..bc32b2c 100644
@@ -910,6 +910,7 @@ struct intel_crtc_state {
 		union hdmi_infoframe avi;
 		union hdmi_infoframe spd;
 		union hdmi_infoframe hdmi;
+		union hdmi_infoframe drm;
 	} infoframes;
 
 	/* HDMI scrambling status */
drivers/gpu/drm/i915/intel_hdmi.c +48 -0

72 lines not on this page · raw message

Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

Re: [v9 06/13] drm/i915: Write HDR infoframe and send to panel

Quoted 53 lines · Uma Shankar

Enable writing of HDR metadata infoframe to panel. The data will be provid by usersapace compositors, based on blending policies and passsed to driver through a blob property.

v2: Rebase

v3: Fixed a warning message

v4: Addressed Shashank's review comments

v5: Rebase. Added infoframe calculation in compute config.

v6: Addressed Shashank's review comment. Added HDR metadata support from GEN10 onwards as per Shashank's recommendation.

v7: Addressed Shashank's review comments

v8: Added Shashank's RB.

---
 drivers/gpu/drm/i915/intel_drv.h  |  1 +
 drivers/gpu/drm/i915/intel_hdmi.c | 48 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 247893e..bc32b2c 100644
@@ -910,6 +910,7 @@ struct intel_crtc_state {
 		union hdmi_infoframe avi;
 		union hdmi_infoframe spd;
 		union hdmi_infoframe hdmi;
+		union hdmi_infoframe drm;
 	} infoframes;
 
 	/* HDMI scrambling status */
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
index 92597d8..980900b 100644
@@ -573,6 +573,7 @@ static u32 hsw_infoframes_enabled(struct intel_encoder *encoder,
 	HDMI_INFOFRAME_TYPE_AVI,
 	HDMI_INFOFRAME_TYPE_SPD,
 	HDMI_INFOFRAME_TYPE_VENDOR,
+	HDMI_INFOFRAME_TYPE_DRM,
 };
 
 u32 intel_hdmi_infoframe_enable(unsigned int type)
@@ -795,6 +796,30 @@ void intel_read_infoframe(struct intel_encoder *encoder,
 	return true;

drivers/gpu/drm/i915/intel_hdmi.c void intel_read_infoframe(struct intel_encoder *encoder, · line 806

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +8 -0
 }
 
+static bool
+intel_hdmi_compute_drm_infoframe(struct intel_encoder *encoder,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state)
+{
+	struct hdmi_drm_infoframe *frame = &crtc_state->infoframes.drm.drm;
+	struct hdr_output_metadata *hdr_metadata;
+	int ret;

Missing has_infoframes check.

drivers/gpu/drm/i915/intel_hdmi.c void intel_read_infoframe(struct intel_encoder *encoder, · line 808

Quoted 2 lines
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+
+	hdr_metadata = (struct hdr_output_metadata *)

Pointless cast?

drivers/gpu/drm/i915/intel_hdmi.c void intel_read_infoframe(struct intel_encoder *encoder, · line 809

Quoted 1 line
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
+			conn_state->hdr_output_metadata->data;

NULL pointer deref? Hmm, how does this pass CI?

drivers/gpu/drm/i915/intel_hdmi.c void intel_read_infoframe(struct intel_encoder *encoder, · line 818

Quoted 9 lines
drivers/gpu/drm/i915/intel_hdmi.c +9 -0
+
+	ret = drm_hdmi_infoframe_set_hdr_metadata(frame, hdr_metadata);
+	if (ret < 0) {
+		DRM_ERROR("couldn't set HDR metadata in infoframe\n");
+		return false;
+	}
+
+	crtc_state->infoframes.enable |=
+		intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_DRM);

Everyone else sets this before populating the infoframe.

Missing the whatever_infoframe_check() call here.

Quoted 8 lines
drivers/gpu/drm/i915/intel_hdmi.c +4 -0
+
+	return true;
+}
+
 static void g4x_set_infoframes(struct intel_encoder *encoder,
 			       bool enable,
 			       const struct intel_crtc_state *crtc_state,

drivers/gpu/drm/i915/intel_hdmi.c static void hsw_set_infoframes(struct intel_encoder *encoder, · line 1214

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +7 -0
@@ -1180,6 +1205,16 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
 	intel_write_infoframe(encoder, crtc_state,
 			      HDMI_INFOFRAME_TYPE_VENDOR,
 			      &crtc_state->infoframes.hdmi);
+
+	/*
+	 * Support HDR Metadata from Gen10 onwards
+	 * ToDo: Gen9 also can support HDR with LSPCON.
+	 * Support for the same to be enabled later.
+	 */
+	if (INTEL_GEN(dev_priv) >= 10)

Missing glk. Actually this check can be removed entirely since intel_write_infoframe() already checks infoframes.enable.

drivers/gpu/drm/i915/intel_hdmi.c int intel_hdmi_compute_config(struct intel_encoder *encoder, · line 2425

Quoted 12 lines
drivers/gpu/drm/i915/intel_hdmi.c +5 -0
+		intel_write_infoframe(encoder, crtc_state,
+				      HDMI_INFOFRAME_TYPE_DRM,
+				      &crtc_state->infoframes.drm);
 }
 
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable)
@@ -2386,6 +2421,19 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
 		return -EINVAL;
 	}
 
+	/*
+	 * Support HDR Metadata from Gen10 onwards

This is not providing extra information beyond what the code is saying.

drivers/gpu/drm/i915/intel_hdmi.c int intel_hdmi_compute_config(struct intel_encoder *encoder, · line 2427

Quoted 2 lines
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+	 * ToDo: Gen9 also can support HDR with LSPCON.
+	 * Support for the same to be enabled later.

This is native HDMI code. LSPCON fixme doesn't make sense here.

drivers/gpu/drm/i915/intel_hdmi.c int intel_hdmi_compute_config(struct intel_encoder *encoder, · line 2429

Quoted 2 lines
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+	 */
+	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {

For GCP the platform check is in the function itself. Could do the same here for consistency.

Quoted 17 lines
drivers/gpu/drm/i915/intel_hdmi.c +7 -0
+		if (!intel_hdmi_compute_drm_infoframe(encoder, pipe_config,
+						      conn_state)) {
+			DRM_DEBUG_KMS("bad DRM infoframe\n");
+			return -EINVAL;
+		}
+	}
+
 	return 0;
 }
 
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

Re: [v9 06/13] drm/i915: Write HDR infoframe and send to panel

Quoted 71 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Tuesday, May 14, 2019 1:06 AM
To: Shankar, Uma <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [v9 06/13] drm/i915: Write HDR infoframe and send to panel

drivers/gpu/drm/i915/intel_hdmi.c static u32 hsw_infoframes_enabled(struct intel_encoder

Quoted 46 lines · Uma Shankar

Enable writing of HDR metadata infoframe to panel.
The data will be provid by usersapace compositors, based on blending policies and passsed to driver through a blob property.

v2: Rebase

v3: Fixed a warning message

v4: Addressed Shashank's review comments

v5: Rebase. Added infoframe calculation in compute config.

v6: Addressed Shashank's review comment. Added HDR metadata support from GEN10 onwards as per Shashank's recommendation.

v7: Addressed Shashank's review comments

v8: Added Shashank's RB.

---
 drivers/gpu/drm/i915/intel_drv.h  |  1 +
drivers/gpu/drm/i915/intel_hdmi.c | 48
+++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 247893e..bc32b2c 100644
@@ -910,6 +910,7 @@ struct intel_crtc_state {
 		union hdmi_infoframe avi;
 		union hdmi_infoframe spd;
 		union hdmi_infoframe hdmi;
+		union hdmi_infoframe drm;
 	} infoframes;
 
 	/* HDMI scrambling status */
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index 92597d8..980900b 100644
@@ -573,6 +573,7 @@ static u32 hsw_infoframes_enabled(struct intel_encoder

*encoder,

Quoted 11 lines
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
 	HDMI_INFOFRAME_TYPE_AVI,
 	HDMI_INFOFRAME_TYPE_SPD,
 	HDMI_INFOFRAME_TYPE_VENDOR,
+	HDMI_INFOFRAME_TYPE_DRM,
 };
 
 u32 intel_hdmi_infoframe_enable(unsigned int type) @@ -795,6 +796,30

@@ void intel_read_infoframe(struct intel_encoder *encoder,
return true;
}

Quoted 9 lines

drivers/gpu/drm/i915/intel_hdmi.c void intel_read_infoframe(struct intel_encoder *encoder, · line 806

Quoted 7 lines
drivers/gpu/drm/i915/intel_hdmi.c +7 -0
+static bool
+intel_hdmi_compute_drm_infoframe(struct intel_encoder *encoder,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state) {
+	struct hdmi_drm_infoframe *frame = &crtc_state->infoframes.drm.drm;
+	struct hdr_output_metadata *hdr_metadata;
+	int ret;

Missing has_infoframes check.

Ok, will add this.

Quoted 4 lines

drivers/gpu/drm/i915/intel_hdmi.c void intel_read_infoframe(struct intel_encoder *encoder, · line 808

Quoted 2 lines
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+
+	hdr_metadata = (struct hdr_output_metadata *)

Pointless cast?

Yeah, will remove this.

Quoted 4 lines

drivers/gpu/drm/i915/intel_hdmi.c void intel_read_infoframe(struct intel_encoder *encoder, · line 809

Quoted 2 lines
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
+			conn_state->hdr_output_metadata->data;

NULL pointer deref? Hmm, how does this pass CI?

Actually this check is added in a later patch in series (patch 9), will move the check here to avoid any bisect issues.

Quoted 12 lines

drivers/gpu/drm/i915/intel_hdmi.c void intel_read_infoframe(struct intel_encoder *encoder, · line 818

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +9 -0
+
+	ret = drm_hdmi_infoframe_set_hdr_metadata(frame, hdr_metadata);
+	if (ret < 0) {
+		DRM_ERROR("couldn't set HDR metadata in infoframe\n");
+		return false;
+	}
+
+	crtc_state->infoframes.enable |=
+		intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_DRM);

Everyone else sets this before populating the infoframe.

Will move this up.

Quoted 1 line

Missing the whatever_infoframe_check() call here.

Sure, will add the check.

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_hdmi.c +7 -0
+
+	return true;
+}
+
 static void g4x_set_infoframes(struct intel_encoder *encoder,
 			       bool enable,
 			       const struct intel_crtc_state *crtc_state, @@ -1180,6
+1205,16 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
 	intel_write_infoframe(encoder, crtc_state,
 			      HDMI_INFOFRAME_TYPE_VENDOR,
 			      &crtc_state->infoframes.hdmi);
+
+	/*
Quoted 8 lines

drivers/gpu/drm/i915/intel_hdmi.c static void hsw_set_infoframes(struct intel_encoder *encoder, · line 1214

Quoted 5 lines
drivers/gpu/drm/i915/intel_hdmi.c +5 -0
+	 * Support HDR Metadata from Gen10 onwards
+	 * ToDo: Gen9 also can support HDR with LSPCON.
+	 * Support for the same to be enabled later.
+	 */
+	if (INTEL_GEN(dev_priv) >= 10)

Missing glk. Actually this check can be removed entirely since intel_write_infoframe() already checks infoframes.enable.

Yeah right, will drop this check altogether.

Quoted 16 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_hdmi.c +3 -0
+		intel_write_infoframe(encoder, crtc_state,
+				      HDMI_INFOFRAME_TYPE_DRM,
+				      &crtc_state->infoframes.drm);
 }
 
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool

enable) @@ -2386,6 +2421,19 @@ int intel_hdmi_compute_config(struct

intel_encoder *encoder,

drivers/gpu/drm/i915/intel_hdmi.c int intel_hdmi_compute_config(struct intel_encoder *encoder, · line 2425

Quoted 5 lines
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
 		return -EINVAL;
 	}
 
+	/*
+	 * Support HDR Metadata from Gen10 onwards

This is not providing extra information beyond what the code is saying.

Quoted 4 lines

drivers/gpu/drm/i915/intel_hdmi.c

Quoted 2 lines
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+	 * ToDo: Gen9 also can support HDR with LSPCON.
+	 * Support for the same to be enabled later.

This is native HDMI code. LSPCON fixme doesn't make sense here.

Ok, will drop the comments here.

Quoted 5 lines

drivers/gpu/drm/i915/intel_hdmi.c int intel_hdmi_compute_config(struct intel_encoder *encoder, · line 2429

Quoted 2 lines
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+	 */
+	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {

For GCP the platform check is in the function itself. Could do the same here for consistency.

Sure, will do the same.

Regards,
Uma Shankar

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_hdmi.c +7 -1
+		if (!intel_hdmi_compute_drm_infoframe(encoder, pipe_config,
+						      conn_state)) {
+			DRM_DEBUG_KMS("bad DRM infoframe\n");
+			return -EINVAL;
+		}
+	}
+
 	return 0;
 }
 
--

1.9.1

Quoted 8 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Ville Syrjälä
Intel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw

PATCH v9 7/13 drm: Add HLG EOTF

In reply to Uma Shankar

From: Ville Syrjälä <[email protected]>

ADD HLG EOTF to the list of EOTF transfer functions supported. Hybrid Log-Gamma (HLG) is a high dynamic range (HDR) standard. HLG defines a nonlinear transfer function in which the lower half of the signal values use a gamma curve and the upper half of the signal values use a logarithmic curve.

v2: Rebase

v3: Fixed a warning message

v4: Addressed Shashank's review comments

v5: Addressed Jonas Karlman's review comment and dropped the i915 tag from header.

---
 drivers/gpu/drm/drm_edid.c | 3 ++-
 include/linux/hdmi.h       | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_edid.c +2 -1
index 5f48965..73b33ad 100644
@@ -3857,7 +3857,8 @@ static uint8_t eotf_supported(const u8 *edid_ext)
 	return edid_ext[2] &
 		(BIT(HDMI_EOTF_TRADITIONAL_GAMMA_SDR) |
 		 BIT(HDMI_EOTF_TRADITIONAL_GAMMA_HDR) |
-		 BIT(HDMI_EOTF_SMPTE_ST2084));
+		 BIT(HDMI_EOTF_SMPTE_ST2084) |
+		 BIT(HDMI_EOTF_BT_2100_HLG));
 }
 
 static uint8_t hdr_metadata_type(const u8 *edid_ext)
include/linux/hdmi.h +1 -0
index 7edafcf..3d7f10f 100644
@@ -161,6 +161,7 @@ enum hdmi_eotf {
 	HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
 	HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
 	HDMI_EOTF_SMPTE_ST2084,
+	HDMI_EOTF_BT_2100_HLG,
 };
 
 struct hdmi_avi_infoframe {
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

PATCH v9 8/13 drm/i915: Enable infoframes on GLK+ for HDR

In reply to Uma Shankar

From: Ville Syrjälä <[email protected]>

This patch enables infoframes on GLK+ to be
used to send HDR metadata to HDMI sink.

v2: Addressed Shashank's review comment.

v3: Addressed Shashank's review comment.

v4: Added Shashank's RB.

---
 drivers/gpu/drm/i915/i915_reg.h   |  4 ++++
 drivers/gpu/drm/i915/intel_hdmi.c | 22 +++++++++++++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +4 -0
index e97c47f..d3f5510 100644
@@ -4694,6 +4694,7 @@ enum {
 #define   VIDEO_DIP_FREQ_MASK		(3 << 16)
 /* HSW and later: */
 #define   DRM_DIP_ENABLE		(1 << 28)
+#define   VIDEO_DIP_ENABLE_DRM_GLK	(1 << 28)
 #define   PSR_VSC_BIT_7_SET		(1 << 27)
 #define   VSC_SELECT_MASK		(0x3 << 25)
 #define   VSC_SELECT_SHIFT		25
@@ -8146,6 +8147,7 @@ enum {
 #define _HSW_VIDEO_DIP_SPD_DATA_A	0x602A0
 #define _HSW_VIDEO_DIP_GMP_DATA_A	0x602E0
 #define _HSW_VIDEO_DIP_VSC_DATA_A	0x60320
+#define _GLK_VIDEO_DIP_DRM_DATA_A	0x60440
 #define _HSW_VIDEO_DIP_AVI_ECC_A	0x60240
 #define _HSW_VIDEO_DIP_VS_ECC_A		0x60280
 #define _HSW_VIDEO_DIP_SPD_ECC_A	0x602C0
@@ -8159,6 +8161,7 @@ enum {
 #define _HSW_VIDEO_DIP_SPD_DATA_B	0x612A0
 #define _HSW_VIDEO_DIP_GMP_DATA_B	0x612E0
 #define _HSW_VIDEO_DIP_VSC_DATA_B	0x61320
+#define _GLK_VIDEO_DIP_DRM_DATA_B	0x61440
 #define _HSW_VIDEO_DIP_BVI_ECC_B	0x61240
 #define _HSW_VIDEO_DIP_VS_ECC_B		0x61280
 #define _HSW_VIDEO_DIP_SPD_ECC_B	0x612C0
@@ -8184,6 +8187,7 @@ enum {
 #define HSW_TVIDEO_DIP_SPD_DATA(trans, i)	_MMIO_TRANS2(trans, _HSW_VIDEO_DIP_SPD_DATA_A + (i) * 4)
 #define HSW_TVIDEO_DIP_GMP_DATA(trans, i)	_MMIO_TRANS2(trans, _HSW_VIDEO_DIP_GMP_DATA_A + (i) * 4)
 #define HSW_TVIDEO_DIP_VSC_DATA(trans, i)	_MMIO_TRANS2(trans, _HSW_VIDEO_DIP_VSC_DATA_A + (i) * 4)
+#define GLK_TVIDEO_DIP_DRM_DATA(trans, i)	_MMIO_TRANS2(trans, _GLK_VIDEO_DIP_DRM_DATA_A + (i) * 4)
 #define ICL_VIDEO_DIP_PPS_DATA(trans, i)	_MMIO_TRANS2(trans, _ICL_VIDEO_DIP_PPS_DATA_A + (i) * 4)
 #define ICL_VIDEO_DIP_PPS_ECC(trans, i)		_MMIO_TRANS2(trans, _ICL_VIDEO_DIP_PPS_ECC_A + (i) * 4)
 
drivers/gpu/drm/i915/intel_hdmi.c +17 -5
index 980900b..92bc347 100644
@@ -152,6 +152,8 @@ static u32 hsw_infoframe_enable(unsigned int type)
 		return VIDEO_DIP_ENABLE_SPD_HSW;
 	case HDMI_INFOFRAME_TYPE_VENDOR:
 		return VIDEO_DIP_ENABLE_VS_HSW;
+	case HDMI_INFOFRAME_TYPE_DRM:
+		return VIDEO_DIP_ENABLE_DRM_GLK;
 	default:
 		MISSING_CASE(type);
 		return 0;
@@ -177,6 +179,8 @@ static u32 hsw_infoframe_enable(unsigned int type)
 		return HSW_TVIDEO_DIP_SPD_DATA(cpu_transcoder, i);
 	case HDMI_INFOFRAME_TYPE_VENDOR:
 		return HSW_TVIDEO_DIP_VS_DATA(cpu_transcoder, i);
+	case HDMI_INFOFRAME_TYPE_DRM:
+		return GLK_TVIDEO_DIP_DRM_DATA(cpu_transcoder, i);
 	default:
 		MISSING_CASE(type);
 		return INVALID_MMIO_REG;
@@ -560,10 +564,16 @@ static u32 hsw_infoframes_enabled(struct intel_encoder *encoder,
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	u32 val = I915_READ(HSW_TVIDEO_DIP_CTL(pipe_config->cpu_transcoder));
+	u32 mask;
 
-	return val & (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
-		      VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
-		      VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
+	mask = (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
+		VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
+		VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
+
+	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
+		mask |= VIDEO_DIP_ENABLE_DRM_GLK;
+
+	return val & mask;
 }
 
 static const u8 infoframe_type_to_idx[] = {
@@ -1182,7 +1192,8 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
 
 	val &= ~(VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
 		 VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
-		 VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
+		 VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW |
+		 VIDEO_DIP_ENABLE_DRM_GLK);
 
 	if (!enable) {
 		I915_WRITE(reg, val);
@@ -1211,7 +1222,8 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
 	 * ToDo: Gen9 also can support HDR with LSPCON.
 	 * Support for the same to be enabled later.
 	 */
-	if (INTEL_GEN(dev_priv) >= 10)
+	if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) &&
+	    conn_state->hdr_metadata_changed)
 		intel_write_infoframe(encoder, crtc_state,
 				      HDMI_INFOFRAME_TYPE_DRM,
 				      &crtc_state->infoframes.drm);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

Re: [v9 08/13] drm/i915: Enable infoframes on GLK+ for HDR

Quoted 108 lines · Uma Shankar

From: Ville Syrjälä <[email protected]>

This patch enables infoframes on GLK+ to be
used to send HDR metadata to HDMI sink.

v2: Addressed Shashank's review comment.

v3: Addressed Shashank's review comment.

v4: Added Shashank's RB.

---
 drivers/gpu/drm/i915/i915_reg.h   |  4 ++++
 drivers/gpu/drm/i915/intel_hdmi.c | 22 +++++++++++++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +4 -0
index e97c47f..d3f5510 100644
@@ -4694,6 +4694,7 @@ enum {
 #define   VIDEO_DIP_FREQ_MASK		(3 << 16)
 /* HSW and later: */
 #define   DRM_DIP_ENABLE		(1 << 28)
+#define   VIDEO_DIP_ENABLE_DRM_GLK	(1 << 28)
 #define   PSR_VSC_BIT_7_SET		(1 << 27)
 #define   VSC_SELECT_MASK		(0x3 << 25)
 #define   VSC_SELECT_SHIFT		25
@@ -8146,6 +8147,7 @@ enum {
 #define _HSW_VIDEO_DIP_SPD_DATA_A	0x602A0
 #define _HSW_VIDEO_DIP_GMP_DATA_A	0x602E0
 #define _HSW_VIDEO_DIP_VSC_DATA_A	0x60320
+#define _GLK_VIDEO_DIP_DRM_DATA_A	0x60440
 #define _HSW_VIDEO_DIP_AVI_ECC_A	0x60240
 #define _HSW_VIDEO_DIP_VS_ECC_A		0x60280
 #define _HSW_VIDEO_DIP_SPD_ECC_A	0x602C0
@@ -8159,6 +8161,7 @@ enum {
 #define _HSW_VIDEO_DIP_SPD_DATA_B	0x612A0
 #define _HSW_VIDEO_DIP_GMP_DATA_B	0x612E0
 #define _HSW_VIDEO_DIP_VSC_DATA_B	0x61320
+#define _GLK_VIDEO_DIP_DRM_DATA_B	0x61440
 #define _HSW_VIDEO_DIP_BVI_ECC_B	0x61240
 #define _HSW_VIDEO_DIP_VS_ECC_B		0x61280
 #define _HSW_VIDEO_DIP_SPD_ECC_B	0x612C0
@@ -8184,6 +8187,7 @@ enum {
 #define HSW_TVIDEO_DIP_SPD_DATA(trans, i)	_MMIO_TRANS2(trans, _HSW_VIDEO_DIP_SPD_DATA_A + (i) * 4)
 #define HSW_TVIDEO_DIP_GMP_DATA(trans, i)	_MMIO_TRANS2(trans, _HSW_VIDEO_DIP_GMP_DATA_A + (i) * 4)
 #define HSW_TVIDEO_DIP_VSC_DATA(trans, i)	_MMIO_TRANS2(trans, _HSW_VIDEO_DIP_VSC_DATA_A + (i) * 4)
+#define GLK_TVIDEO_DIP_DRM_DATA(trans, i)	_MMIO_TRANS2(trans, _GLK_VIDEO_DIP_DRM_DATA_A + (i) * 4)
 #define ICL_VIDEO_DIP_PPS_DATA(trans, i)	_MMIO_TRANS2(trans, _ICL_VIDEO_DIP_PPS_DATA_A + (i) * 4)
 #define ICL_VIDEO_DIP_PPS_ECC(trans, i)		_MMIO_TRANS2(trans, _ICL_VIDEO_DIP_PPS_ECC_A + (i) * 4)
 
drivers/gpu/drm/i915/intel_hdmi.c +15 -4
index 980900b..92bc347 100644
@@ -152,6 +152,8 @@ static u32 hsw_infoframe_enable(unsigned int type)
 		return VIDEO_DIP_ENABLE_SPD_HSW;
 	case HDMI_INFOFRAME_TYPE_VENDOR:
 		return VIDEO_DIP_ENABLE_VS_HSW;
+	case HDMI_INFOFRAME_TYPE_DRM:
+		return VIDEO_DIP_ENABLE_DRM_GLK;
 	default:
 		MISSING_CASE(type);
 		return 0;
@@ -177,6 +179,8 @@ static u32 hsw_infoframe_enable(unsigned int type)
 		return HSW_TVIDEO_DIP_SPD_DATA(cpu_transcoder, i);
 	case HDMI_INFOFRAME_TYPE_VENDOR:
 		return HSW_TVIDEO_DIP_VS_DATA(cpu_transcoder, i);
+	case HDMI_INFOFRAME_TYPE_DRM:
+		return GLK_TVIDEO_DIP_DRM_DATA(cpu_transcoder, i);
 	default:
 		MISSING_CASE(type);
 		return INVALID_MMIO_REG;
@@ -560,10 +564,16 @@ static u32 hsw_infoframes_enabled(struct intel_encoder *encoder,
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	u32 val = I915_READ(HSW_TVIDEO_DIP_CTL(pipe_config->cpu_transcoder));
+	u32 mask;
 
-	return val & (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
-		      VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
-		      VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
+	mask = (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
+		VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
+		VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
+
+	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
+		mask |= VIDEO_DIP_ENABLE_DRM_GLK;
+
+	return val & mask;
 }
 
 static const u8 infoframe_type_to_idx[] = {
@@ -1182,7 +1192,8 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
 
 	val &= ~(VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
 		 VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
-		 VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
+		 VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW |
+		 VIDEO_DIP_ENABLE_DRM_GLK);
 
 	if (!enable) {
 		I915_WRITE(reg, val);

drivers/gpu/drm/i915/intel_hdmi.c static void hsw_set_infoframes(struct intel_encoder *encoder, · line 1226

Quoted 6 lines
drivers/gpu/drm/i915/intel_hdmi.c +2 -1
@@ -1211,7 +1222,8 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
 	 * ToDo: Gen9 also can support HDR with LSPCON.
 	 * Support for the same to be enabled later.
 	 */
-	if (INTEL_GEN(dev_priv) >= 10)
+	if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) &&
+	    conn_state->hdr_metadata_changed)

The metadata_changed check shouldn't be here. This is a full modeset. We can't assume any previous hardware state is correct.

Quoted 5 lines
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
 		intel_write_infoframe(encoder, crtc_state,
 				      HDMI_INFOFRAME_TYPE_DRM,
 				      &crtc_state->infoframes.drm);
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

PATCH v9 9/13 drm/i915:Enabled Modeset when HDR Infoframe changes

In reply to Uma Shankar

This patch enables modeset whenever HDR metadata needs to be updated to sink.

v2: Addressed Shashank's review comments.

v3: Added Shashank's RB.

v4: Addressed Ville's review comments.

---
 drivers/gpu/drm/i915/intel_atomic.c | 14 +++++++++++++-
 drivers/gpu/drm/i915/intel_hdmi.c   | 17 +++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_atomic.c +13 -1
index 58b8049..6b985e8 100644
@@ -105,6 +105,16 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
 	return -EINVAL;
 }
 
+static bool blob_equal(const struct drm_property_blob *a,
+		       const struct drm_property_blob *b)
+{
+	if (a && b)
+		return a->length == b->length &&
+			!memcmp(a->data, b->data, a->length);
+
+	return !a == !b;
+}
+
 int intel_digital_connector_atomic_check(struct drm_connector *conn,
 					 struct drm_connector_state *new_state)
 {
@@ -132,7 +142,9 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
 	    new_conn_state->base.colorspace != old_conn_state->base.colorspace ||
 	    new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio ||
 	    new_conn_state->base.content_type != old_conn_state->base.content_type ||
-	    new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
+	    new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode ||
+	    !blob_equal(new_conn_state->base.hdr_output_metadata,
+			old_conn_state->base.hdr_output_metadata))
 		crtc_state->mode_changed = true;
 
 	return 0;
drivers/gpu/drm/i915/intel_hdmi.c +17 -0
index 92bc347..db9c82b 100644
@@ -806,6 +806,11 @@ void intel_read_infoframe(struct intel_encoder *encoder,
 	return true;
 }
 
+static inline bool is_eotf_supported(u8 output_eotf, u8 sink_eotf)
+{
+	return sink_eotf & BIT(output_eotf);
+}
+
 static bool
 intel_hdmi_compute_drm_infoframe(struct intel_encoder *encoder,
 				 struct intel_crtc_state *crtc_state,
@@ -813,11 +818,23 @@ void intel_read_infoframe(struct intel_encoder *encoder,
 {
 	struct hdmi_drm_infoframe *frame = &crtc_state->infoframes.drm.drm;
 	struct hdr_output_metadata *hdr_metadata;
+	struct drm_connector *connector = conn_state->connector;
 	int ret;
 
+	if (!conn_state->hdr_output_metadata ||
+	    conn_state->hdr_output_metadata->length == 0)
+		return true;
+
 	hdr_metadata = (struct hdr_output_metadata *)
 			conn_state->hdr_output_metadata->data;
 
+	/* Sink EOTF is Bit map while infoframe is absolute values */
+	if (!is_eotf_supported(hdr_metadata->hdmi_metadata_type1.eotf,
+	    connector->hdr_sink_metadata.hdmi_type1.eotf)) {
+		DRM_ERROR("EOTF Not Supported\n");
+		return true;
+	}
+
 	ret = drm_hdmi_infoframe_set_hdr_metadata(frame, hdr_metadata);
 	if (ret < 0) {
 		DRM_ERROR("couldn't set HDR metadata in infoframe\n");
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#21 lore raw

PATCH v9 10/13 drm/i915: Set Infoframe for non modeset case for HDR

In reply to Uma Shankar

HDR metadata requires a infoframe to be set. Due to fastset, full modeset is not performed hence adding it to update_pipe to handle that.

---
 drivers/gpu/drm/i915/intel_ddi.c  | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_hdmi.c |  7 +++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +13 -0
index cd5277d..d37526b 100644
@@ -3559,6 +3559,10 @@ static void intel_ddi_update_pipe(struct intel_encoder *encoder,
 				  const struct intel_crtc_state *crtc_state,
 				  const struct drm_connector_state *conn_state)
 {
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_digital_port *intel_dig_port =
+			enc_to_dig_port(&encoder->base);
+
 	if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
 		intel_ddi_update_pipe_dp(encoder, crtc_state, conn_state);
 
@@ -3568,6 +3572,15 @@ static void intel_ddi_update_pipe(struct intel_encoder *encoder,
 	else if (conn_state->content_protection ==
 		 DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
 		intel_hdcp_disable(to_intel_connector(conn_state->connector));
+
+	/* Set the infoframe for NON modeset cases as well */
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
+		if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) &&
+		    conn_state->hdr_metadata_changed)
+			intel_dig_port->set_infoframes(encoder,
+						       crtc_state->has_infoframe,
+						       crtc_state, conn_state);
+	}
 }
 
 static void intel_ddi_set_fia_lane_count(struct intel_encoder *encoder,
drivers/gpu/drm/i915/intel_hdmi.c +5 -2
index db9c82b..e559a940 100644
@@ -1204,8 +1204,11 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
 	i915_reg_t reg = HSW_TVIDEO_DIP_CTL(crtc_state->cpu_transcoder);
 	u32 val = I915_READ(reg);
 
-	assert_hdmi_transcoder_func_disabled(dev_priv,
-					     crtc_state->cpu_transcoder);
+	/* DRM Infoframe can be send with transcoder enabled */
+	if (!((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) &&
+	      conn_state->hdr_metadata_changed))
+		assert_hdmi_transcoder_func_disabled(dev_priv,
+						     crtc_state->cpu_transcoder);
 
 	val &= ~(VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
 		 VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#22 lore raw

Re: [v9 10/13] drm/i915: Set Infoframe for non modeset case for HDR

Quoted 29 lines · Uma Shankar

HDR metadata requires a infoframe to be set. Due to fastset, full modeset is not performed hence adding it to update_pipe to handle that.

---
 drivers/gpu/drm/i915/intel_ddi.c  | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_hdmi.c |  7 +++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +4 -0
index cd5277d..d37526b 100644
@@ -3559,6 +3559,10 @@ static void intel_ddi_update_pipe(struct intel_encoder *encoder,
 				  const struct intel_crtc_state *crtc_state,
 				  const struct drm_connector_state *conn_state)
 {
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_digital_port *intel_dig_port =
+			enc_to_dig_port(&encoder->base);
+
 	if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
 		intel_ddi_update_pipe_dp(encoder, crtc_state, conn_state);
 
@@ -3568,6 +3572,15 @@ static void intel_ddi_update_pipe(struct intel_encoder *encoder,
 	else if (conn_state->content_protection ==
 		 DRM_MODE_CONTENT_PROTECTION_UNDESIRED)

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_update_pipe(struct intel_encoder *encoder, · line 3583

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +9 -0
 		intel_hdcp_disable(to_intel_connector(conn_state->connector));
+
+	/* Set the infoframe for NON modeset cases as well */
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
+		if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) &&
+		    conn_state->hdr_metadata_changed)
+			intel_dig_port->set_infoframes(encoder,
+						       crtc_state->has_infoframe,
+						       crtc_state, conn_state);
+	}

Still nak.

Quoted 28 lines
drivers/gpu/drm/i915/intel_ddi.c +0 -0
 }
 
 static void intel_ddi_set_fia_lane_count(struct intel_encoder *encoder,
drivers/gpu/drm/i915/intel_hdmi.c +5 -2
index db9c82b..e559a940 100644
@@ -1204,8 +1204,11 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
 	i915_reg_t reg = HSW_TVIDEO_DIP_CTL(crtc_state->cpu_transcoder);
 	u32 val = I915_READ(reg);
 
-	assert_hdmi_transcoder_func_disabled(dev_priv,
-					     crtc_state->cpu_transcoder);
+	/* DRM Infoframe can be send with transcoder enabled */
+	if (!((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) &&
+	      conn_state->hdr_metadata_changed))
+		assert_hdmi_transcoder_func_disabled(dev_priv,
+						     crtc_state->cpu_transcoder);
 
 	val &= ~(VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
 		 VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#23 lore raw

RE: [v9 10/13] drm/i915: Set Infoframe for non modeset case for HDR

Quoted 42 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Tuesday, May 14, 2019 1:10 AM
To: Shankar, Uma <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [v9 10/13] drm/i915: Set Infoframe for non modeset case for HDR

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_update_pipe(struct intel_encoder

Quoted 17 lines · Uma Shankar

HDR metadata requires a infoframe to be set. Due to fastset, full modeset is not performed hence adding it to update_pipe to handle that.

---
 drivers/gpu/drm/i915/intel_ddi.c  | 13 +++++++++++++
drivers/gpu/drm/i915/intel_hdmi.c |  7 +++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index cd5277d..d37526b 100644
@@ -3559,6 +3559,10 @@ static void intel_ddi_update_pipe(struct intel_encoder

*encoder,

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_update_pipe(struct intel_encoder

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
 				  const struct intel_crtc_state *crtc_state,
 				  const struct drm_connector_state *conn_state)  {
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_digital_port *intel_dig_port =
+			enc_to_dig_port(&encoder->base);
+
 	if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
 		intel_ddi_update_pipe_dp(encoder, crtc_state, conn_state);
 
@@ -3568,6 +3572,15 @@ static void intel_ddi_update_pipe(struct intel_encoder

*encoder,

Quoted 14 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_update_pipe(struct intel_encoder *encoder, · line 3583

Quoted 12 lines
drivers/gpu/drm/i915/intel_ddi.c +9 -0
 	else if (conn_state->content_protection ==
 		 DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
 		intel_hdcp_disable(to_intel_connector(conn_state->connector));
+
+	/* Set the infoframe for NON modeset cases as well */
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
+		if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) &&
+		    conn_state->hdr_metadata_changed)
+			intel_dig_port->set_infoframes(encoder,
+						       crtc_state->has_infoframe,
+						       crtc_state, conn_state);
+	}

Still nak.

Ok, will drop this from this series and take this up later.

Quoted 26 lines

drivers/gpu/drm/i915/intel_hdmi.c static void hsw_set_infoframes(struct intel_encoder

Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c +0 -0
 }
 
 static void intel_ddi_set_fia_lane_count(struct intel_encoder

*encoder, diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index db9c82b..e559a940 100644

drivers/gpu/drm/i915/intel_hdmi.c +0 -0
@@ -1204,8 +1204,11 @@ static void hsw_set_infoframes(struct intel_encoder

*encoder,

Quoted 16 lines
drivers/gpu/drm/i915/intel_hdmi.c +5 -3
 	i915_reg_t reg = HSW_TVIDEO_DIP_CTL(crtc_state->cpu_transcoder);
 	u32 val = I915_READ(reg);
 
-	assert_hdmi_transcoder_func_disabled(dev_priv,
-					     crtc_state->cpu_transcoder);
+	/* DRM Infoframe can be send with transcoder enabled */
+	if (!((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) &&
+	      conn_state->hdr_metadata_changed))
+		assert_hdmi_transcoder_func_disabled(dev_priv,
+						     crtc_state->cpu_transcoder);
 
 	val &= ~(VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
 		 VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
--

1.9.1

Quoted 8 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Ville Syrjälä
Intel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#24 lore raw

PATCH v9 11/13 drm/i915: Added DRM Infoframe handling for BYT/CHT

In reply to Uma Shankar

BYT/CHT doesn't support DRM Infoframe. This caused a WARN_ON due to a missing CASE while executing intel_hdmi_infoframes_enabled function. This patch fixes the same.

---
 drivers/gpu/drm/i915/intel_hdmi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
index e559a940..224d33e 100644
@@ -129,6 +129,8 @@ static u32 g4x_infoframe_enable(unsigned int type)
 		return VIDEO_DIP_ENABLE_SPD;
 	case HDMI_INFOFRAME_TYPE_VENDOR:
 		return VIDEO_DIP_ENABLE_VENDOR;
+	case HDMI_INFOFRAME_TYPE_DRM:
+		return 0;
 	default:
 		MISSING_CASE(type);
 		return 0;
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#25 lore raw

PATCH v9 12/13 video/hdmi: Add Unpack function for DRM infoframe

In reply to Uma Shankar

Added unpack function for DRM infoframe for dynamic range and mastering infoframe readout.

---
 drivers/video/hdmi.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/hdmi.h |  1 +
 2 files changed, 55 insertions(+)
drivers/video/hdmi.c +54 -0
index 717ed7fb..110d405 100644
@@ -1801,6 +1801,57 @@ static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame,
 }
 
 /**
+ * hdmi_drm_infoframe_unpack() - unpack binary buffer to a HDMI DRM infoframe
+ * @frame: HDMI DRM infoframe
+ * @buffer: source buffer
+ * @size: size of buffer
+ *
+ * Unpacks the information contained in binary @buffer into a structured
+ * @frame of the HDMI Dynamic Range and Mastering (DRM) information frame.
+ * Also verifies the checksum as required by section 5.3.5 of the HDMI 1.4
+ * specification.
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+static int hdmi_drm_infoframe_unpack(struct hdmi_drm_infoframe *frame,
+				     const void *buffer, size_t size)
+{
+	const u8 *ptr = buffer;
+	int ret;
+
+	if (size < HDMI_INFOFRAME_SIZE(DRM))
+		return -EINVAL;
+
+	if (ptr[0] != HDMI_INFOFRAME_TYPE_DRM ||
+	    ptr[1] != 1 ||
+	    ptr[2] != HDMI_DRM_INFOFRAME_SIZE)
+		return -EINVAL;
+
+	if (hdmi_infoframe_checksum(buffer, HDMI_INFOFRAME_SIZE(DRM)) != 0)
+		return -EINVAL;
+
+	ret = hdmi_drm_infoframe_init(frame);
+	if (ret)
+		return ret;
+
+	frame->length = ptr[2];
+	ptr += HDMI_INFOFRAME_HEADER_SIZE;
+
+	frame->eotf = ptr[0] & 0x7;
+	frame->metadata_type = ptr[1] & 0x7;
+
+	memcpy(&frame->display_primaries, &ptr[2], 12);
+	memcpy(&frame->white_point, &ptr[14], 4);
+
+	frame->max_display_mastering_luminance = (ptr[19] << 8) | ptr[18];
+	frame->min_display_mastering_luminance = (ptr[21] << 8) | ptr[20];
+	frame->max_cll = (ptr[23] << 8) | ptr[22];
+	frame->max_fall = (ptr[25] << 8) | ptr[24];
+
+	return 0;
+}
+
+/**
  * hdmi_infoframe_unpack() - unpack binary buffer to a HDMI infoframe
  * @frame: HDMI infoframe
  * @buffer: source buffer
@@ -1826,6 +1877,9 @@ int hdmi_infoframe_unpack(union hdmi_infoframe *frame,
 	case HDMI_INFOFRAME_TYPE_AVI:
 		ret = hdmi_avi_infoframe_unpack(&frame->avi, buffer, size);
 		break;
+	case HDMI_INFOFRAME_TYPE_DRM:
+		ret = hdmi_drm_infoframe_unpack(&frame->drm, buffer, size);
+		break;
 	case HDMI_INFOFRAME_TYPE_SPD:
 		ret = hdmi_spd_infoframe_unpack(&frame->spd, buffer, size);
 		break;
include/linux/hdmi.h +1 -0
index 3d7f10f..ee55ba5 100644
@@ -56,6 +56,7 @@ enum hdmi_infoframe_type {
 #define HDMI_AVI_INFOFRAME_SIZE    13
 #define HDMI_SPD_INFOFRAME_SIZE    25
 #define HDMI_AUDIO_INFOFRAME_SIZE  10
+#define HDMI_DRM_INFOFRAME_SIZE    26
 
 #define HDMI_INFOFRAME_SIZE(type)	\
 	(HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#26 lore raw

Re: [v9 12/13] video/hdmi: Add Unpack function for DRM infoframe

Quoted 42 lines · Uma Shankar

Added unpack function for DRM infoframe for dynamic range and mastering infoframe readout.

---
 drivers/video/hdmi.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/hdmi.h |  1 +
 2 files changed, 55 insertions(+)
drivers/video/hdmi.c +24 -0
index 717ed7fb..110d405 100644
@@ -1801,6 +1801,57 @@ static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame,
 }
 
 /**
+ * hdmi_drm_infoframe_unpack() - unpack binary buffer to a HDMI DRM infoframe
+ * @frame: HDMI DRM infoframe
+ * @buffer: source buffer
+ * @size: size of buffer
+ *
+ * Unpacks the information contained in binary @buffer into a structured
+ * @frame of the HDMI Dynamic Range and Mastering (DRM) information frame.
+ * Also verifies the checksum as required by section 5.3.5 of the HDMI 1.4
+ * specification.
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+static int hdmi_drm_infoframe_unpack(struct hdmi_drm_infoframe *frame,
+				     const void *buffer, size_t size)
+{
+	const u8 *ptr = buffer;
+	int ret;
+
+	if (size < HDMI_INFOFRAME_SIZE(DRM))
+		return -EINVAL;
+
+	if (ptr[0] != HDMI_INFOFRAME_TYPE_DRM ||
+	    ptr[1] != 1 ||
+	    ptr[2] != HDMI_DRM_INFOFRAME_SIZE)

drivers/video/hdmi.c static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame, · line 1837

Quoted 10 lines
drivers/video/hdmi.c +10 -0
+		return -EINVAL;
+
+	if (hdmi_infoframe_checksum(buffer, HDMI_INFOFRAME_SIZE(DRM)) != 0)
+		return -EINVAL;
+
+	ret = hdmi_drm_infoframe_init(frame);
+	if (ret)
+		return ret;
+
+	frame->length = ptr[2];

The length handling is inconsistnet between the compute and readout sides. I would suggest for now just put the length initialization into hdmi_drm_infoframe_init() (and remove it from the drm code), and check it in the check_only(). We can revisit it if/when other metadata formats become relevant.

drivers/video/hdmi.c static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame, · line 1844

Quoted 7 lines
drivers/video/hdmi.c +7 -0
+	ptr += HDMI_INFOFRAME_HEADER_SIZE;
+
+	frame->eotf = ptr[0] & 0x7;
+	frame->metadata_type = ptr[1] & 0x7;
+
+	memcpy(&frame->display_primaries, &ptr[2], 12);
+	memcpy(&frame->white_point, &ptr[14], 4);

Endianness fail.

Quoted 42 lines
drivers/video/hdmi.c +13 -0
+
+	frame->max_display_mastering_luminance = (ptr[19] << 8) | ptr[18];
+	frame->min_display_mastering_luminance = (ptr[21] << 8) | ptr[20];
+	frame->max_cll = (ptr[23] << 8) | ptr[22];
+	frame->max_fall = (ptr[25] << 8) | ptr[24];
+
+	return 0;
+}
+
+/**
  * hdmi_infoframe_unpack() - unpack binary buffer to a HDMI infoframe
  * @frame: HDMI infoframe
  * @buffer: source buffer
@@ -1826,6 +1877,9 @@ int hdmi_infoframe_unpack(union hdmi_infoframe *frame,
 	case HDMI_INFOFRAME_TYPE_AVI:
 		ret = hdmi_avi_infoframe_unpack(&frame->avi, buffer, size);
 		break;
+	case HDMI_INFOFRAME_TYPE_DRM:
+		ret = hdmi_drm_infoframe_unpack(&frame->drm, buffer, size);
+		break;
 	case HDMI_INFOFRAME_TYPE_SPD:
 		ret = hdmi_spd_infoframe_unpack(&frame->spd, buffer, size);
 		break;
include/linux/hdmi.h +1 -0
index 3d7f10f..ee55ba5 100644
@@ -56,6 +56,7 @@ enum hdmi_infoframe_type {
 #define HDMI_AVI_INFOFRAME_SIZE    13
 #define HDMI_SPD_INFOFRAME_SIZE    25
 #define HDMI_AUDIO_INFOFRAME_SIZE  10
+#define HDMI_DRM_INFOFRAME_SIZE    26
 
 #define HDMI_INFOFRAME_SIZE(type)	\
 	(HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#27 lore raw

RE: [v9 12/13] video/hdmi: Add Unpack function for DRM infoframe

Quoted 66 lines

-----Original Message-----
From: dri-devel [mailto:[email protected]] On Behalf Of Ville Syrjälä
Sent: Tuesday, May 14, 2019 1:20 AM
To: Shankar, Uma <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [v9 12/13] video/hdmi: Add Unpack function for DRM infoframe

Quoted 52 lines · Uma Shankar

Added unpack function for DRM infoframe for dynamic range and mastering infoframe readout.

---
 drivers/video/hdmi.c | 54
++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/hdmi.h |  1 +
 2 files changed, 55 insertions(+)
drivers/video/hdmi.c index renamed from drivers/video/hdmi.c +0 -0

717ed7fb..110d405 100644

drivers/video/hdmi.c +33 -0
@@ -1801,6 +1801,57 @@ static int hdmi_audio_infoframe_unpack(struct
 hdmi_audio_infoframe *frame,  }
 
 /**
+ * hdmi_drm_infoframe_unpack() - unpack binary buffer to a HDMI DRM
+infoframe
+ * @frame: HDMI DRM infoframe
+ * @buffer: source buffer
+ * @size: size of buffer
+ *
+ * Unpacks the information contained in binary @buffer into a
+structured
+ * @frame of the HDMI Dynamic Range and Mastering (DRM) information frame.
+ * Also verifies the checksum as required by section 5.3.5 of the
+HDMI 1.4
+ * specification.
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+static int hdmi_drm_infoframe_unpack(struct hdmi_drm_infoframe *frame,
+				     const void *buffer, size_t size) {
+	const u8 *ptr = buffer;
+	int ret;
+
+	if (size < HDMI_INFOFRAME_SIZE(DRM))
+		return -EINVAL;
+
+	if (ptr[0] != HDMI_INFOFRAME_TYPE_DRM ||
+	    ptr[1] != 1 ||
+	    ptr[2] != HDMI_DRM_INFOFRAME_SIZE)
+		return -EINVAL;
+
+	if (hdmi_infoframe_checksum(buffer, HDMI_INFOFRAME_SIZE(DRM)) != 0)
+		return -EINVAL;
+
+	ret = hdmi_drm_infoframe_init(frame);
+	if (ret)
Quoted 8 lines

drivers/video/hdmi.c static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame, · line 1837

Quoted 3 lines
drivers/video/hdmi.c +3 -0
+		return ret;
+
+	frame->length = ptr[2];

The length handling is inconsistnet between the compute and readout sides. I would suggest for now just put the length initialization into hdmi_drm_infoframe_init() (and remove it from the drm code), and check it in the check_only(). We can revisit it if/when other metadata formats become relevant.

Sure, will update this.

Quoted 9 lines

drivers/video/hdmi.c static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame, · line 1844

Quoted 7 lines
drivers/video/hdmi.c +7 -0
+	ptr += HDMI_INFOFRAME_HEADER_SIZE;
+
+	frame->eotf = ptr[0] & 0x7;
+	frame->metadata_type = ptr[1] & 0x7;
+
+	memcpy(&frame->display_primaries, &ptr[2], 12);
+	memcpy(&frame->white_point, &ptr[14], 4);

Endianness fail.

Ok, will explicitly copy these.

Quoted 39 lines

drivers/video/hdmi.c int hdmi_infoframe_unpack(union hdmi_infoframe

Quoted 14 lines
drivers/video/hdmi.c +10 -0
+
+	frame->max_display_mastering_luminance = (ptr[19] << 8) | ptr[18];
+	frame->min_display_mastering_luminance = (ptr[21] << 8) | ptr[20];
+	frame->max_cll = (ptr[23] << 8) | ptr[22];
+	frame->max_fall = (ptr[25] << 8) | ptr[24];
+
+	return 0;
+}
+
+/**
  * hdmi_infoframe_unpack() - unpack binary buffer to a HDMI infoframe
  * @frame: HDMI infoframe
  * @buffer: source buffer
@@ -1826,6 +1877,9 @@ int hdmi_infoframe_unpack(union hdmi_infoframe

*frame,

Quoted 24 lines
drivers/video/hdmi.c +3 -0
 	case HDMI_INFOFRAME_TYPE_AVI:
 		ret = hdmi_avi_infoframe_unpack(&frame->avi, buffer, size);
 		break;
+	case HDMI_INFOFRAME_TYPE_DRM:
+		ret = hdmi_drm_infoframe_unpack(&frame->drm, buffer, size);
+		break;
 	case HDMI_INFOFRAME_TYPE_SPD:
 		ret = hdmi_spd_infoframe_unpack(&frame->spd, buffer, size);
 		break;
include/linux/hdmi.h index renamed from include/linux/hdmi.h +0 -0

3d7f10f..ee55ba5 100644

include/linux/hdmi.h +1 -1
@@ -56,6 +56,7 @@ enum hdmi_infoframe_type {
 #define HDMI_AVI_INFOFRAME_SIZE    13
 #define HDMI_SPD_INFOFRAME_SIZE    25
 #define HDMI_AUDIO_INFOFRAME_SIZE  10
+#define HDMI_DRM_INFOFRAME_SIZE    26
 
 #define HDMI_INFOFRAME_SIZE(type)	\
 	(HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)
--

1.9.1

Quoted 12 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#28 lore raw

PATCH v9 13/13 drm/i915: Add state readout for DRM infoframe

In reply to Uma Shankar

Added state readout for DRM infoframe and enabled
state validation for DRM infoframe.

---
 drivers/gpu/drm/i915/intel_ddi.c     | 4 ++++
 drivers/gpu/drm/i915/intel_display.c | 1 +
 drivers/gpu/drm/i915/intel_hdmi.c    | 4 ++++
 3 files changed, 9 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +4 -0
index d37526b..3a38f32 100644
@@ -3849,6 +3849,10 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 	intel_read_infoframe(encoder, pipe_config,
 			     HDMI_INFOFRAME_TYPE_VENDOR,
 			     &pipe_config->infoframes.hdmi);
+	if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
+		intel_read_infoframe(encoder, pipe_config,
+				     HDMI_INFOFRAME_TYPE_DRM,
+				     &pipe_config->infoframes.drm);
 }
 
 static enum intel_output_type
drivers/gpu/drm/i915/intel_display.c +1 -0
index a351c8e..74b5189 100644
@@ -12231,6 +12231,7 @@ static bool fastboot_enabled(struct drm_i915_private *dev_priv)
 	PIPE_CONF_CHECK_INFOFRAME(avi);
 	PIPE_CONF_CHECK_INFOFRAME(spd);
 	PIPE_CONF_CHECK_INFOFRAME(hdmi);
+	PIPE_CONF_CHECK_INFOFRAME(drm);
 
 #undef PIPE_CONF_CHECK_X
 #undef PIPE_CONF_CHECK_I
drivers/gpu/drm/i915/intel_hdmi.c +4 -0
index 224d33e..3886065 100644
@@ -1867,6 +1867,10 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
 	intel_read_infoframe(encoder, pipe_config,
 			     HDMI_INFOFRAME_TYPE_VENDOR,
 			     &pipe_config->infoframes.hdmi);
+	if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
+		intel_read_infoframe(encoder, pipe_config,
+				     HDMI_INFOFRAME_TYPE_DRM,
+				     &pipe_config->infoframes.drm);
 }
 
 static void intel_enable_hdmi_audio(struct intel_encoder *encoder,
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#29 lore raw

Re: [v9 13/13] drm/i915: Add state readout for DRM infoframe

Quoted 42 lines · Uma Shankar

Added state readout for DRM infoframe and enabled
state validation for DRM infoframe.

---
 drivers/gpu/drm/i915/intel_ddi.c     | 4 ++++
 drivers/gpu/drm/i915/intel_display.c | 1 +
 drivers/gpu/drm/i915/intel_hdmi.c    | 4 ++++
 3 files changed, 9 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +4 -0
index d37526b..3a38f32 100644
@@ -3849,6 +3849,10 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 	intel_read_infoframe(encoder, pipe_config,
 			     HDMI_INFOFRAME_TYPE_VENDOR,
 			     &pipe_config->infoframes.hdmi);
+	if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
+		intel_read_infoframe(encoder, pipe_config,
+				     HDMI_INFOFRAME_TYPE_DRM,
+				     &pipe_config->infoframes.drm);
 }
 
 static enum intel_output_type
drivers/gpu/drm/i915/intel_display.c +1 -0
index a351c8e..74b5189 100644
@@ -12231,6 +12231,7 @@ static bool fastboot_enabled(struct drm_i915_private *dev_priv)
 	PIPE_CONF_CHECK_INFOFRAME(avi);
 	PIPE_CONF_CHECK_INFOFRAME(spd);
 	PIPE_CONF_CHECK_INFOFRAME(hdmi);
+	PIPE_CONF_CHECK_INFOFRAME(drm);
 
 #undef PIPE_CONF_CHECK_X
 #undef PIPE_CONF_CHECK_I
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index 224d33e..3886065 100644

drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_get_config(struct intel_encoder *encoder, · line 1873

Quoted 7 lines
drivers/gpu/drm/i915/intel_hdmi.c +4 -0
@@ -1867,6 +1867,10 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
 	intel_read_infoframe(encoder, pipe_config,
 			     HDMI_INFOFRAME_TYPE_VENDOR,
 			     &pipe_config->infoframes.hdmi);
+	if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
+		intel_read_infoframe(encoder, pipe_config,
+				     HDMI_INFOFRAME_TYPE_DRM,
+				     &pipe_config->infoframes.drm);

Dead code.

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
 }
 
 static void intel_enable_hdmi_audio(struct intel_encoder *encoder,
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#30 lore raw

✓ Fi.CI.BAT: success for Add HDR Metadata Parsing and handling in DRM layer (rev9)

In reply to Uma Shankar
== Series Details ==

== Series Details ==

Series: Add HDR Metadata Parsing and handling in DRM layer (rev9)
URL : https://patchwork.freedesktop.org/series/25091/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6065 -> Patchwork_12988
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/

Known issues
------------

Here are the changes found in Patchwork_12988 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live_evict:
- fi-bsw-kefka: [PASS][1] -> [DMESG-WARN][2] ([fdo#107709])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/fi-bsw-kefka/igt@i915_selftest@live_evict.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/fi-bsw-kefka/igt@i915_selftest@live_evict.html

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [PASS][3] -> [FAIL][4] ([fdo#109485])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/fi-kbl-7500u/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/fi-kbl-7500u/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live_hangcheck:
- {fi-icl-y}: [INCOMPLETE][5] ([fdo#107713] / [fdo#108569]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/fi-icl-y/igt@i915_selftest@live_hangcheck.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/fi-icl-y/igt@i915_selftest@live_hangcheck.html

#### Warnings ####

* igt@i915_selftest@live_hangcheck:
- fi-apl-guc: [INCOMPLETE][7] ([fdo#103927] / [fdo#110624]) -> [INCOMPLETE][8] ([fdo#103927])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/fi-apl-guc/igt@i915_selftest@live_hangcheck.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/fi-apl-guc/igt@i915_selftest@live_hangcheck.html

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#107709]: https://bugs.freedesktop.org/show_bug.cgi?id=107709
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#109485]: https://bugs.freedesktop.org/show_bug.cgi?id=109485
[fdo#110624]: https://bugs.freedesktop.org/show_bug.cgi?id=110624

Participating hosts (53 -> 45)
------------------------------

Missing (8): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_6065 -> Patchwork_12988

CI_DRM_6065: 4ce82224f3c40ee55f11a505b57247f8f540990a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4973: 3e3ff0e48989abd25fce4916e85e8fef20a3c63a @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12988: 8bd7456bcc7f7323e227ab42d9539edc6cb078fd @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

8bd7456bcc7f drm/i915: Add state readout for DRM infoframe 40ccaedcd208 video/hdmi: Add Unpack function for DRM infoframe 0c8ec025a0ff drm/i915: Added DRM Infoframe handling for BYT/CHT a2c9e4ca880d drm/i915: Set Infoframe for non modeset case for HDR 2c0cd563ef64 drm/i915:Enabled Modeset when HDR Infoframe changes 2068040dcd3c drm/i915: Enable infoframes on GLK+ for HDR a3bd3148742b drm: Add HLG EOTF
e59e2225c608 drm/i915: Write HDR infoframe and send to panel a4cac5224d14 drm/i915: Attach HDR metadata property to connector 421fb3c1ee47 drm: Enable HDR infoframe support 7d53c237452a drm: Parse HDR metadata info from EDID d278f4561318 drm: Add reference counting on HDR metadata blob b14249ae3b1a drm: Add HDR source metadata property

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#31 lore raw

✓ Fi.CI.IGT: success for Add HDR Metadata Parsing and handling in DRM layer (rev9)

In reply to Uma Shankar
== Series Details ==

== Series Details ==

Series: Add HDR Metadata Parsing and handling in DRM layer (rev9)
URL : https://patchwork.freedesktop.org/series/25091/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6065_full -> Patchwork_12988_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Known issues
------------

Here are the changes found in Patchwork_12988_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_tiled_swapping@non-threaded:
- shard-iclb: [PASS][1] -> [FAIL][2] ([fdo#108686])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-iclb2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-iclb6/igt@[email protected]
- shard-glk: [PASS][3] -> [DMESG-WARN][4] ([fdo#108686])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-glk5/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-glk4/igt@[email protected]
- shard-apl: [PASS][5] -> [DMESG-WARN][6] ([fdo#108686])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-apl1/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-apl2/igt@[email protected]

* igt@i915_suspend@forcewake:
- shard-apl: [PASS][7] -> [DMESG-WARN][8] ([fdo#108566]) +4 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-apl6/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-apl4/igt@[email protected]

* igt@kms_cursor_crc@cursor-64x64-suspend:
- shard-skl: [PASS][9] -> [INCOMPLETE][10] ([fdo#104108])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-skl3/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-skl5/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank:
- shard-glk: [PASS][11] -> [FAIL][12] ([fdo#102887] / [fdo#105363])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-glk7/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-glk3/igt@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible:
- shard-skl: [PASS][13] -> [FAIL][14] ([fdo#100368])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-skl3/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-skl3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [PASS][15] -> [FAIL][16] ([fdo#103167]) +3 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-iclb8/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-iclb8/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

* igt@kms_plane_scaling@pipe-b-scaler-with-pixel-format:
- shard-glk: [PASS][17] -> [SKIP][18] ([fdo#109271] / [fdo#109278])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-glk9/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-glk2/igt@[email protected]

* igt@kms_psr@psr2_sprite_plane_onoff:
- shard-iclb: [PASS][19] -> [SKIP][20] ([fdo#109441]) +2 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-iclb2/igt@kms_psr@psr2_sprite_plane_onoff.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-iclb4/igt@kms_psr@psr2_sprite_plane_onoff.html

* igt@kms_vblank@pipe-c-accuracy-idle:
- shard-glk: [PASS][21] -> [FAIL][22] ([fdo#102583])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-glk3/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-glk3/igt@[email protected]

#### Possible fixes ####

* igt@gem_workarounds@suspend-resume-context:
- shard-skl: [INCOMPLETE][23] ([fdo#104108] / [fdo#107773]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-skl1/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-skl3/igt@[email protected]

* igt@i915_pm_rpm@dpms-lpsp:
- shard-skl: [INCOMPLETE][25] ([fdo#107807]) -> [PASS][26] +2 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-skl1/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-skl9/igt@[email protected]

* igt@i915_pm_rpm@modeset-stress-extra-wait:
- shard-skl: [SKIP][27] ([fdo#109271]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-skl1/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-skl3/igt@[email protected]

* igt@kms_cursor_crc@cursor-64x64-suspend:
- shard-kbl: [DMESG-WARN][29] ([fdo#108566]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-kbl4/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-kbl4/igt@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-hsw: [INCOMPLETE][31] ([fdo#103540]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-hsw5/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-hsw4/igt@[email protected]

* igt@kms_flip_tiling@flip-to-y-tiled:
- shard-skl: [FAIL][33] ([fdo#107931] / [fdo#108134]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-skl10/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-skl5/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-shrfb-msflip-blt:
- shard-skl: [FAIL][35] ([fdo#108040]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-skl10/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-skl5/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-pwrite:
- shard-iclb: [FAIL][37] ([fdo#103167]) -> [PASS][38] +6 similar issues
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-iclb4/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-pwrite.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-iclb5/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-pwrite.html

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-pri-indfb-draw-mmap-gtt:
- shard-skl: [FAIL][39] ([fdo#103167]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-skl10/igt@kms_frontbuffer_tracking@psr-1p-primscrn-pri-indfb-draw-mmap-gtt.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-skl5/igt@kms_frontbuffer_tracking@psr-1p-primscrn-pri-indfb-draw-mmap-gtt.html

* igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
- shard-skl: [FAIL][41] ([fdo#103191]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-skl10/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-skl5/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-min:
- shard-skl: [FAIL][43] ([fdo#108145]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-skl9/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-skl9/igt@[email protected]

* igt@kms_plane_lowres@pipe-a-tiling-x:
- shard-iclb: [FAIL][45] ([fdo#103166]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-iclb6/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-iclb7/igt@[email protected]

* igt@kms_plane_scaling@pipe-b-scaler-with-clipping-clamping:
- shard-glk: [SKIP][47] ([fdo#109271] / [fdo#109278]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-glk6/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-glk9/igt@[email protected]

* igt@kms_psr2_su@page_flip:
- shard-iclb: [SKIP][49] ([fdo#109642]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-iclb8/igt@kms_psr2_su@page_flip.html
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-iclb2/igt@kms_psr2_su@page_flip.html

* igt@kms_psr@psr2_sprite_plane_move:
- shard-iclb: [SKIP][51] ([fdo#109441]) -> [PASS][52] +3 similar issues
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-iclb6/igt@kms_psr@psr2_sprite_plane_move.html
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-iclb2/igt@kms_psr@psr2_sprite_plane_move.html

* igt@kms_sysfs_edid_timing:
- shard-iclb: [FAIL][53] ([fdo#100047]) -> [PASS][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-iclb2/igt@kms_sysfs_edid_timing.html
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-iclb4/igt@kms_sysfs_edid_timing.html

* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-apl: [DMESG-WARN][55] ([fdo#108566]) -> [PASS][56] +4 similar issues
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6065/shard-apl2/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/shard-apl4/igt@[email protected]

[fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
[fdo#100368]: https://bugs.freedesktop.org/show_bug.cgi?id=100368
[fdo#102583]: https://bugs.freedesktop.org/show_bug.cgi?id=102583
[fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#107773]: https://bugs.freedesktop.org/show_bug.cgi?id=107773
[fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
[fdo#107931]: https://bugs.freedesktop.org/show_bug.cgi?id=107931
[fdo#108040]: https://bugs.freedesktop.org/show_bug.cgi?id=108040
[fdo#108134]: https://bugs.freedesktop.org/show_bug.cgi?id=108134
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642

Participating hosts (10 -> 10)
------------------------------

No changes in participating hosts

Build changes
-------------

* Linux: CI_DRM_6065 -> Patchwork_12988

CI_DRM_6065: 4ce82224f3c40ee55f11a505b57247f8f540990a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4973: 3e3ff0e48989abd25fce4916e85e8fef20a3c63a @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12988: 8bd7456bcc7f7323e227ab42d9539edc6cb078fd @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12988/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Tested-by on the v9 series
#32 lore raw
In reply to Uma Shankar
Quoted 37 lines · Uma Shankar

This patch series enables HDR support in drm. It basically defines HDR metadata structures, property to pass content (after blending) metadata from user space compositors to driver.

Dynamic Range and Mastering infoframe creation and sending.

ToDo:
1. We need to get the color framework in place for all planes which support HDR content in hardware. This is already in progres and patches are out for review in mailing list.
2. UserSpace/Compositors: Blending policies and metadata blob creation and passing to driver. Work is already in progress by Intel's middleware teams on wayland and the patches for the same are in review.

A POC has already been developed by Ville based on wayland. Please refer below link to see the component interactions and usage:
https://lists.freedesktop.org/archives/wayland-devel/2017-December/036403.html

v2: Updated Ville's POC changes to the patch series.Incorporated cleanups and fixes from Ville. Rebase on latest drm-tip.

v3: Fixed a warning causing builds to break on CI. No major change.

v4: Addressed Shashank's review comments.

v5: Rebase on top of Ville's infoframe refactoring changes. Fixed non modeset case for HDR metadata update. Dropped a redundant patch.

v6: Addressed Shashank's review comments and added RB's received.

v7: Squashed 2 patches, dropped 1 change and addressed Brian Starkey's and Shashank's review comments.

v8: Addressed Jonas Karlman review comments. Added Shashank's RB to the series, fixed a WARN_ON on BYT/CHT.

Quoted 6 lines

v9: Addressed Ville and Jonas Karlman's review comments. Added the infoframe state readout and metadata reference count.

Note: This is already tested with Kodi and a confirmation from team kodi has been received. Branch details for the same as below:
https://github.com/xbmc/xbmc/tree/feature_drmprime-vaapi

I have now re-tested this v9 series (non i915 parts) on Rockchip RK3328/RK3399 using Kodi HDR PR [1] and dw-hdmi patch [2].
Kodi sets the HDR output metadata property with metadata retrieved from FFmpeg, my LG OLED B7 correctly activates/deactivates HDR/HLG mode depending on video file played.

[1] https://github.com/xbmc/xbmc/pull/16103
[2] https://github.com/Kwiboo/linux-rockchip/commit/a9ccea6d3d51001f6b4ab9a1fb600a38e517b9ce

There is still a few minor nits, comment param name do not match function/field and ugly logging, please see [3] for fixups, please feel free to squash/fixup.

[3] https://github.com/Kwiboo/linux-rockchip/compare/a9ccea6d3d51001f6b4ab9a1fb600a38e517b9ce...rockchip-5.1-libreelec-hdr-v5.1

For non-i915 drm patches:

Regards,
Jonas

Quoted 30 lines

Jonas Karlman (1):
drm: Add reference counting on HDR metadata blob

Uma Shankar (10):
drm: Add HDR source metadata property
drm: Parse HDR metadata info from EDID
drm: Enable HDR infoframe support
drm/i915: Attach HDR metadata property to connector drm/i915: Write HDR infoframe and send to panel drm/i915:Enabled Modeset when HDR Infoframe changes drm/i915: Set Infoframe for non modeset case for HDR drm/i915: Added DRM Infoframe handling for BYT/CHT video/hdmi: Add Unpack function for DRM infoframe drm/i915: Add state readout for DRM infoframe

Ville Syrjälä (2):
drm: Add HLG EOTF
drm/i915: Enable infoframes on GLK+ for HDR

 drivers/gpu/drm/drm_atomic.c              |   2 +
 drivers/gpu/drm/drm_atomic_state_helper.c |   6 +
 drivers/gpu/drm/drm_atomic_uapi.c         |  13 ++
 drivers/gpu/drm/drm_connector.c           |   6 +
 drivers/gpu/drm/drm_edid.c                | 101 +++++++++++++
 drivers/gpu/drm/i915/i915_reg.h           |   4 +
 drivers/gpu/drm/i915/intel_atomic.c       |  14 +-
 drivers/gpu/drm/i915/intel_ddi.c          |  17 +++
 drivers/gpu/drm/i915/intel_display.c      |   1 +
 drivers/gpu/drm/i915/intel_drv.h          |   1 +
Quoted 9 lines
 drivers/gpu/drm/i915/intel_hdmi.c         | 100 ++++++++++++-
 drivers/video/hdmi.c                      | 240 ++++++++++++++++++++++++++++++
 include/drm/drm_connector.h               |  11 ++
 include/drm/drm_edid.h                    |   5 +
 include/drm/drm_mode_config.h             |   6 +
 include/linux/hdmi.h                      |  55 +++++++
 include/uapi/drm/drm_mode.h               |  23 +++
 17 files changed, 598 insertions(+), 7 deletions(-)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#33 lore raw
Quoted 65 lines

-----Original Message-----
From: dri-devel [mailto:[email protected]] On Behalf Of Jonas Karlman
Sent: Monday, May 13, 2019 1:42 AM
To: Shankar, Uma <[email protected]>; [email protected]; dri- [email protected]
Cc: [email protected]; [email protected]; [email protected]; Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [v9 00/13] Add HDR Metadata Parsing and handling in DRM layer

Quoted 38 lines · Uma Shankar

This patch series enables HDR support in drm. It basically defines HDR metadata structures, property to pass content (after blending) metadata from user space compositors to driver.

Dynamic Range and Mastering infoframe creation and sending.

ToDo:
1. We need to get the color framework in place for all planes which support HDR content in hardware. This is already in progres and patches are out for review in mailing list.
2. UserSpace/Compositors: Blending policies and metadata blob creation and passing to driver. Work is already in progress by Intel's middleware teams on wayland and the patches for the same are in review.

A POC has already been developed by Ville based on wayland. Please refer below link to see the component interactions and usage:
https://lists.freedesktop.org/archives/wayland-devel/2017-December/036
403.html

v2: Updated Ville's POC changes to the patch series.Incorporated cleanups and fixes from Ville. Rebase on latest drm-tip.

v3: Fixed a warning causing builds to break on CI. No major change.

v4: Addressed Shashank's review comments.

v5: Rebase on top of Ville's infoframe refactoring changes. Fixed non modeset case for HDR metadata update. Dropped a redundant patch.

v6: Addressed Shashank's review comments and added RB's received.

v7: Squashed 2 patches, dropped 1 change and addressed Brian Starkey's and Shashank's review comments.

v8: Addressed Jonas Karlman review comments. Added Shashank's RB to the series, fixed a WARN_ON on BYT/CHT.

Quoted 6 lines

v9: Addressed Ville and Jonas Karlman's review comments. Added the infoframe state readout and metadata reference count.

Note: This is already tested with Kodi and a confirmation from team kodi has been received. Branch details for the same as below:
https://github.com/xbmc/xbmc/tree/feature_drmprime-vaapi

I have now re-tested this v9 series (non i915 parts) on Rockchip RK3328/RK3399 using Kodi HDR PR [1] and dw-hdmi patch [2].
Kodi sets the HDR output metadata property with metadata retrieved from FFmpeg, my LG OLED B7 correctly activates/deactivates HDR/HLG mode depending on video file played.

Quoted 6 lines

[1] https://github.com/xbmc/xbmc/pull/16103
[2] https://github.com/Kwiboo/linux-
rockchip/commit/a9ccea6d3d51001f6b4ab9a1fb600a38e517b9ce

There is still a few minor nits, comment param name do not match function/field and ugly logging, please see [3] for fixups, please feel free to squash/fixup.

Sure, will fix these up.

Quoted 8 lines

[3] https://github.com/Kwiboo/linux-
rockchip/compare/a9ccea6d3d51001f6b4ab9a1fb600a38e517b9ce...rockchip-5.1- libreelec-hdr-v5.1

For non-i915 drm patches:

Thanks Jonas for trying this out and giving your acknowledgement.

Regards,
Uma Shankar

Quoted 43 lines

Regards,
Jonas

Quoted 30 lines

Jonas Karlman (1):
drm: Add reference counting on HDR metadata blob

Uma Shankar (10):
drm: Add HDR source metadata property
drm: Parse HDR metadata info from EDID
drm: Enable HDR infoframe support
drm/i915: Attach HDR metadata property to connector drm/i915: Write HDR infoframe and send to panel drm/i915:Enabled Modeset when HDR Infoframe changes drm/i915: Set Infoframe for non modeset case for HDR drm/i915: Added DRM Infoframe handling for BYT/CHT video/hdmi: Add Unpack function for DRM infoframe drm/i915: Add state readout for DRM infoframe

Ville Syrjälä (2):
drm: Add HLG EOTF
drm/i915: Enable infoframes on GLK+ for HDR

 drivers/gpu/drm/drm_atomic.c              |   2 +
 drivers/gpu/drm/drm_atomic_state_helper.c |   6 +
 drivers/gpu/drm/drm_atomic_uapi.c         |  13 ++
 drivers/gpu/drm/drm_connector.c           |   6 +
 drivers/gpu/drm/drm_edid.c                | 101 +++++++++++++
 drivers/gpu/drm/i915/i915_reg.h           |   4 +
 drivers/gpu/drm/i915/intel_atomic.c       |  14 +-
 drivers/gpu/drm/i915/intel_ddi.c          |  17 +++
 drivers/gpu/drm/i915/intel_display.c      |   1 +
 drivers/gpu/drm/i915/intel_drv.h          |   1 +
Quoted 9 lines
 drivers/gpu/drm/i915/intel_hdmi.c         | 100 ++++++++++++-
 drivers/video/hdmi.c                      | 240 ++++++++++++++++++++++++++++++
 include/drm/drm_connector.h               |  11 ++
 include/drm/drm_edid.h                    |   5 +
 include/drm/drm_mode_config.h             |   6 +
 include/linux/hdmi.h                      |  55 +++++++
 include/uapi/drm/drm_mode.h               |  23 +++
 17 files changed, 598 insertions(+), 7 deletions(-)
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel