dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer
@ 2019-03-20 10:48 Uma Shankar
  2019-03-20 10:48 ` [v6 01/13] drm: Add HDR source metadata property Uma Shankar
                   ` (12 more replies)
  0 siblings, 13 replies; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel
  Cc: ville.syrjala, Liviu.Dudau, emil.l.velikov, Uma Shankar,
	maarten.lankhorst

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 we should be getting
   the initial version pretty soon for review.

Please review and share your feedbacks/suggestions.

Note: The intention for these patches is to get a design feedback on
the uapi changes, generic property design and infoframe handling.
This cannot get merged as of now without the userspace support in place.

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.

Note: Media driver and VAAPI changes for HDR are already out, with compositors
changes also expected to land soon. Weston changes already floated and reviews
started in community and is in active development along with GL efforts.

Uma Shankar (10):
  drm: Add HDR source metadata property
  drm: Parse HDR metadata info from EDID
  drm: Parse Colorimetry data block from EDID
  drm/i915: Attach HDR metadata property to connector
  drm: Implement HDR output metadata set and get property handling
  drm: Enable HDR infoframe support
  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
  video/hdmi: Add const variants for drm infoframe

Ville Syrjälä (3):
  drm/i915: [DO NOT MERGE] hack for glk board outputs
  drm/i915: Add HLG EOTF
  drm/i915: Enable infoframes on GLK+ for HDR

 drivers/gpu/drm/drm_atomic.c        |   2 +
 drivers/gpu/drm/drm_atomic_uapi.c   |  13 +++
 drivers/gpu/drm/drm_connector.c     |   6 ++
 drivers/gpu/drm/drm_edid.c          | 131 +++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h     |   4 +
 drivers/gpu/drm/i915/intel_atomic.c |  15 ++-
 drivers/gpu/drm/i915/intel_bios.c   |   7 ++
 drivers/gpu/drm/i915/intel_ddi.c    |  13 +++
 drivers/gpu/drm/i915/intel_drv.h    |   1 +
 drivers/gpu/drm/i915/intel_hdmi.c   |  59 ++++++++++-
 drivers/video/hdmi.c                | 188 ++++++++++++++++++++++++++++++++++++
 include/drm/drm_connector.h         |  13 +++
 include/drm/drm_edid.h              |   4 +
 include/drm/drm_mode_config.h       |   6 ++
 include/linux/hdmi.h                |  38 ++++++++
 include/uapi/drm/drm_mode.h         |  16 +++
 16 files changed, 513 insertions(+), 3 deletions(-)

-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [v6 01/13] drm: Add HDR source metadata property
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-21 11:30   ` Brian Starkey
  2019-03-20 10:48 ` [v6 02/13] drm: Parse HDR metadata info from EDID Uma Shankar
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

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

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.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_connector.c |  6 ++++++
 include/drm/drm_connector.h     | 10 ++++++++++
 include/drm/drm_mode_config.h   |  6 ++++++
 include/linux/hdmi.h            | 10 ++++++++++
 include/uapi/drm/drm_mode.h     | 16 ++++++++++++++++
 5 files changed, 48 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 2355124..0bdae90 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -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;
 }
 
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index c806199..29388bd 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -561,6 +561,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_blob_ptr;
+	u8 hdr_metadata_changed : 1;
 };
 
 /**
@@ -1201,6 +1208,9 @@ struct drm_connector {
 	 * &drm_mode_config.connector_free_work.
 	 */
 	struct llist_node free_node;
+
+	/* HDR metdata */
+	struct hdr_static_metadata hdr_metadata;
 };
 
 #define obj_to_connector(x) container_of(x, struct drm_connector, base)
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 7f60e8e..ef2656b 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -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;
 
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 927ad64..a065194 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -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;
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index a439c2e..5012af2 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -630,6 +630,22 @@ struct drm_color_lut {
 	__u16 reserved;
 };
 
+/* HDR Metadata */
+struct hdr_static_metadata {
+	uint8_t eotf;
+	uint8_t metadata_type;
+	struct {
+		uint16_t x, y;
+		} display_primaries[3];
+	struct {
+		uint16_t x, y;
+		} white_point;
+	uint16_t max_mastering_display_luminance;
+	uint16_t min_mastering_display_luminance;
+	uint16_t max_fall;
+	uint16_t max_cll;
+};
+
 #define DRM_MODE_PAGE_FLIP_EVENT 0x01
 #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
 #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 02/13] drm: Parse HDR metadata info from EDID
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
  2019-03-20 10:48 ` [v6 01/13] drm: Add HDR source metadata property Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-29 11:41   ` Sharma, Shashank
  2019-03-20 10:48 ` [v6 03/13] drm: Parse Colorimetry data block " Uma Shankar
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel
  Cc: ville.syrjala, Liviu.Dudau, emil.l.velikov, Uma Shankar,
	maarten.lankhorst

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

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index fa39592..fd8a621a 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2840,6 +2840,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
@@ -3587,6 +3588,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];
@@ -3822,6 +3829,46 @@ 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_metadata.eotf = eotf_supported(db);
+	connector->hdr_metadata.metadata_type = hdr_metadata_type(db);
+
+	if (len >= 5)
+		connector->hdr_metadata.max_fall = db[5];
+	if (len >= 4)
+		connector->hdr_metadata.max_cll = db[4];
+}
+
 static void
 drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
 {
@@ -4449,6 +4496,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);
 	}
 }
 
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 03/13] drm: Parse Colorimetry data block from EDID
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
  2019-03-20 10:48 ` [v6 01/13] drm: Add HDR source metadata property Uma Shankar
  2019-03-20 10:48 ` [v6 02/13] drm: Parse HDR metadata info from EDID Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-21 11:17   ` Brian Starkey
  2019-03-20 10:48 ` [v6 04/13] drm/i915: Attach HDR metadata property to connector Uma Shankar
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel
  Cc: ville.syrjala, Liviu.Dudau, emil.l.velikov, Uma Shankar,
	maarten.lankhorst

CEA 861.3 spec adds colorimetry data block for HDMI.
Parsing the block to get the colorimetry data from
panel.

v2: Rebase

v3: No Change

v4: Addressed Shashank's review comments. Updated
colorimetry field to 16 bit as DCI-P3 got added
in CEA 861-G spec, as pointed out by Shashank.

v5: Fixed checkpatch warnings with --strict option.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/drm_edid.c  | 25 +++++++++++++++++++++++++
 include/drm/drm_connector.h |  3 +++
 2 files changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index fd8a621a..676569b 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2840,6 +2840,7 @@ static int drm_cvt_modes(struct drm_connector *connector,
 #define VIDEO_BLOCK     0x02
 #define VENDOR_BLOCK    0x03
 #define SPEAKER_BLOCK	0x04
+#define COLORIMETRY_DATA_BLOCK		0x5
 #define HDR_STATIC_METADATA_BLOCK	0x6
 #define USE_EXTENDED_TAG 0x07
 #define EXT_VIDEO_CAPABILITY_BLOCK 0x00
@@ -3829,6 +3830,28 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
 	mode->clock = clock;
 }
 
+static bool cea_db_is_hdmi_colorimetry_data_block(const u8 *db)
+{
+	if (cea_db_tag(db) != USE_EXTENDED_TAG)
+		return false;
+
+	if (db[1] != COLORIMETRY_DATA_BLOCK)
+		return false;
+
+	return true;
+}
+
+static void
+drm_parse_colorimetry_data_block(struct drm_connector *connector, const u8 *db)
+{
+	struct drm_hdmi_info *info = &connector->display_info.hdmi;
+	u16 len;
+
+	len = cea_db_payload_len_ext(db);
+	/* As per CEA 861-G spec */
+	info->colorimetry = ((db[3] & (0x1 << 7)) << 1) | db[2];
+}
+
 static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db)
 {
 	if (cea_db_tag(db) != USE_EXTENDED_TAG)
@@ -4498,6 +4521,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
 			drm_parse_vcdb(connector, db);
 		if (cea_db_is_hdmi_hdr_metadata_block(db))
 			drm_parse_hdr_metadata_block(connector, db);
+		if (cea_db_is_hdmi_colorimetry_data_block(db))
+			drm_parse_colorimetry_data_block(connector, db);
 	}
 }
 
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 29388bd..94f926e 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -206,6 +206,9 @@ struct drm_hdmi_info {
 
 	/** @y420_dc_modes: bitmap of deep color support index */
 	u8 y420_dc_modes;
+
+	/* @colorimetry: bitmap of supported colorimetry modes */
+	u16 colorimetry;
 };
 
 /**
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 04/13] drm/i915: Attach HDR metadata property to connector
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
                   ` (2 preceding siblings ...)
  2019-03-20 10:48 ` [v6 03/13] drm: Parse Colorimetry data block " Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-20 10:48 ` [v6 05/13] drm: Implement HDR output metadata set and get property handling Uma Shankar
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

Attach HDR metadata property to connector object.

v2: Rebase

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

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/i915/intel_hdmi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 5ccb305..5f06237 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -2719,6 +2719,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);
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 05/13] drm: Implement HDR output metadata set and get property handling
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
                   ` (3 preceding siblings ...)
  2019-03-20 10:48 ` [v6 04/13] drm/i915: Attach HDR metadata property to connector Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-21 11:46   ` Brian Starkey
  2019-03-20 10:48 ` [v6 06/13] drm: Enable HDR infoframe support Uma Shankar
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

This patch 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 added Ville's POC changes

v3: No Change

v4: Addressed Shashank's review comments

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_atomic.c      |  2 ++
 drivers/gpu/drm/drm_atomic_uapi.c | 13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 5eb4013..8b9c126 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -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)
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 4eb81f1..18c8b81f 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -686,6 +686,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, NULL, val);
@@ -734,6 +736,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_blob_ptr,
+				val,
+				-1, sizeof(struct hdr_static_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) {
@@ -820,6 +830,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_blob_ptr) ?
+			state->hdr_output_metadata_blob_ptr->base.id : 0;
 	} else if (property == connector->content_protection_property) {
 		*val = state->content_protection;
 	} else if (property == config->writeback_fb_id_property) {
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 06/13] drm: Enable HDR infoframe support
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
                   ` (4 preceding siblings ...)
  2019-03-20 10:48 ` [v6 05/13] drm: Implement HDR output metadata set and get property handling Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-21 11:41   ` Brian Starkey
  2019-03-20 10:48 ` [v6 07/13] drm/i915: Write HDR infoframe and send to panel Uma Shankar
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

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.

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.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/drm_edid.c |  56 ++++++++++++++++++++
 drivers/video/hdmi.c       | 129 +++++++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_edid.h     |   4 ++
 include/linux/hdmi.h       |  22 ++++++++
 4 files changed, 211 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 676569b..78c0b97 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4916,6 +4916,62 @@ 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,
+				    void *hdr_metadata)
+{
+	struct hdr_static_metadata *hdr_source_metadata;
+	int err, i;
+
+	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);
+
+	hdr_source_metadata = (struct hdr_static_metadata *)hdr_metadata;
+
+	frame->length = sizeof(struct hdr_static_metadata);
+
+	frame->eotf = hdr_source_metadata->eotf;
+	frame->metadata_type = hdr_source_metadata->metadata_type;
+
+	for (i = 0; i < 3; i++) {
+		frame->display_primaries[i].x =
+			hdr_source_metadata->display_primaries[i].x;
+		frame->display_primaries[i].y =
+			hdr_source_metadata->display_primaries[i].y;
+	}
+
+	frame->white_point.x = hdr_source_metadata->white_point.x;
+	frame->white_point.y = hdr_source_metadata->white_point.y;
+
+	frame->max_mastering_display_luminance =
+		hdr_source_metadata->max_mastering_display_luminance;
+	frame->min_mastering_display_luminance =
+		hdr_source_metadata->min_mastering_display_luminance;
+
+	frame->max_cll = hdr_source_metadata->max_cll;
+	frame->max_fall = hdr_source_metadata->max_fall;
+
+	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
diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index 799ae49..80bb0ee 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -650,6 +650,93 @@ 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);
+
+/**
+ * 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(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_mastering_display_luminance;
+	*ptr++ = frame->max_mastering_display_luminance >> 8;
+
+	*ptr++ = frame->min_mastering_display_luminance;
+	*ptr++ = frame->min_mastering_display_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;
+}
+
 /*
  * hdmi_vendor_any_infoframe_check() - check a vendor infoframe
  */
@@ -806,6 +893,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 +928,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 +1376,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_mastering_display_luminance: %d\n",
+		 frame->max_mastering_display_luminance);
+	hdmi_log("min_mastering_display_luminance: %d\n",
+		 frame->min_mastering_display_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 +1498,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);
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 9d3b5b9..973e43e 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -370,6 +370,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,
+				    void *hdr_source_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 a065194..b925b24 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -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,32 @@ struct hdmi_avi_infoframe {
 	unsigned short right_bar;
 };
 
+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_mastering_display_luminance;
+	u16 min_mastering_display_luminance;
+	u16 max_fall;
+	u16 max_cll;
+	u16 min_cll;
+};
+
 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);
 
 enum hdmi_spd_sdi {
 	HDMI_SPD_SDI_UNKNOWN,
@@ -365,6 +386,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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 07/13] drm/i915: Write HDR infoframe and send to panel
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
                   ` (5 preceding siblings ...)
  2019-03-20 10:48 ` [v6 06/13] drm: Enable HDR infoframe support Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-29 11:48   ` Sharma, Shashank
  2019-03-20 10:48 ` [v6 08/13] drm/i915: [DO NOT MERGE] hack for glk board outputs Uma Shankar
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

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.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/intel_drv.h  |  1 +
 drivers/gpu/drm/i915/intel_hdmi.c | 41 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index d9f188e..c6c3cc7 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1043,6 +1043,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 */
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 5f06237..e4bc7fc 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -555,6 +555,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)
@@ -777,6 +778,30 @@ void intel_read_infoframe(struct intel_encoder *encoder,
 	return true;
 }
 
+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_static_metadata *hdr_metadata;
+	int ret;
+
+	hdr_metadata = (struct hdr_static_metadata *)
+			conn_state->hdr_output_metadata_blob_ptr->data;
+
+	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);
+
+	return true;
+}
+
 static void g4x_set_infoframes(struct intel_encoder *encoder,
 			       bool enable,
 			       const struct intel_crtc_state *crtc_state,
@@ -1175,6 +1200,9 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
 	intel_write_infoframe(encoder, crtc_state,
 			      HDMI_INFOFRAME_TYPE_VENDOR,
 			      &crtc_state->infoframes.hdmi);
+	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)
@@ -2381,6 +2409,19 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
 		return -EINVAL;
 	}
 
+	/*
+	 * 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) {
+		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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 08/13] drm/i915: [DO NOT MERGE] hack for glk board outputs
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
                   ` (6 preceding siblings ...)
  2019-03-20 10:48 ` [v6 07/13] drm/i915: Write HDR infoframe and send to panel Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-20 10:48 ` [v6 09/13] drm/i915: Add HLG EOTF Uma Shankar
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

This is to limit PORT C on GLK to drive only
HDMI. Not sure if this is mandatory, this is just
to test HDR on GLK HDMI.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/intel_bios.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 64f2017..4934b5f 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1405,6 +1405,13 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 		is_hdmi = false;
 	}
 
+	if (IS_GEMINILAKE(dev_priv) && port == PORT_C) {
+		is_hdmi = true;
+		is_dvi = true;
+		is_dp = false;
+		is_edp = false;
+	}
+
 	info->supports_dvi = is_dvi;
 	info->supports_hdmi = is_hdmi;
 	info->supports_dp = is_dp;
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 09/13] drm/i915: Add HLG EOTF
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
                   ` (7 preceding siblings ...)
  2019-03-20 10:48 ` [v6 08/13] drm/i915: [DO NOT MERGE] hack for glk board outputs Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-20 10:48 ` [v6 10/13] drm/i915: Enable infoframes on GLK+ for HDR Uma Shankar
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 3 ++-
 include/linux/hdmi.h       | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 78c0b97..4784447 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3868,7 +3868,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)
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index b925b24..202ed4a 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -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 {
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 10/13] drm/i915: Enable infoframes on GLK+ for HDR
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
                   ` (8 preceding siblings ...)
  2019-03-20 10:48 ` [v6 09/13] drm/i915: Add HLG EOTF Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-29 12:31   ` Sharma, Shashank
  2019-03-20 10:48 ` [v6 11/13] drm/i915:Enabled Modeset when HDR Infoframe changes Uma Shankar
                   ` (2 subsequent siblings)
  12 siblings, 1 reply; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel
  Cc: ville.syrjala, Liviu.Dudau, emil.l.velikov, Uma Shankar,
	maarten.lankhorst

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

v2: Addressed Shashank's review comment.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h   |  4 ++++
 drivers/gpu/drm/i915/intel_hdmi.c | 18 +++++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 31a3020..fe931e7 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -4718,6 +4718,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
@@ -8156,6 +8157,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
@@ -8169,6 +8171,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
@@ -8194,6 +8197,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)
 
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index e4bc7fc..8decafd 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -134,6 +134,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;
@@ -159,6 +161,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;
@@ -545,7 +549,8 @@ static u32 hsw_infoframes_enabled(struct intel_encoder *encoder,
 
 	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);
+		      VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW |
+		      VIDEO_DIP_ENABLE_DRM_GLK);
 }
 
 static const u8 infoframe_type_to_idx[] = {
@@ -1177,7 +1182,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);
@@ -1200,9 +1206,11 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
 	intel_write_infoframe(encoder, crtc_state,
 			      HDMI_INFOFRAME_TYPE_VENDOR,
 			      &crtc_state->infoframes.hdmi);
-	intel_write_infoframe(encoder, crtc_state,
-			      HDMI_INFOFRAME_TYPE_DRM,
-			      &crtc_state->infoframes.drm);
+	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);
 }
 
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable)
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 11/13] drm/i915:Enabled Modeset when HDR Infoframe changes
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
                   ` (9 preceding siblings ...)
  2019-03-20 10:48 ` [v6 10/13] drm/i915: Enable infoframes on GLK+ for HDR Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-29 12:56   ` Sharma, Shashank
  2019-03-20 10:48 ` [v6 12/13] drm/i915: Set Infoframe for non modeset case for HDR Uma Shankar
  2019-03-20 10:48 ` [v6 13/13] video/hdmi: Add const variants for drm infoframe Uma Shankar
  12 siblings, 1 reply; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel
  Cc: ville.syrjala, Liviu.Dudau, emil.l.velikov, Uma Shankar,
	maarten.lankhorst

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

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/intel_atomic.c | 15 ++++++++++++++-
 drivers/gpu/drm/i915/intel_hdmi.c   |  4 ++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index b844e88..4ff6042 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -102,6 +102,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)
 {
@@ -129,7 +139,10 @@ 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_blob_ptr,
+			old_conn_state->base.hdr_output_metadata_blob_ptr))
 		crtc_state->mode_changed = true;
 
 	return 0;
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 8decafd..4d06734 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -792,6 +792,10 @@ void intel_read_infoframe(struct intel_encoder *encoder,
 	struct hdr_static_metadata *hdr_metadata;
 	int ret;
 
+	if (!conn_state->hdr_output_metadata_blob_ptr ||
+	    conn_state->hdr_output_metadata_blob_ptr->length == 0)
+		return true;
+
 	hdr_metadata = (struct hdr_static_metadata *)
 			conn_state->hdr_output_metadata_blob_ptr->data;
 
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 12/13] drm/i915: Set Infoframe for non modeset case for HDR
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
                   ` (10 preceding siblings ...)
  2019-03-20 10:48 ` [v6 11/13] drm/i915:Enabled Modeset when HDR Infoframe changes Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-29 12:14   ` Sharma, Shashank
  2019-03-29 14:04   ` Ville Syrjälä
  2019-03-20 10:48 ` [v6 13/13] video/hdmi: Add const variants for drm infoframe Uma Shankar
  12 siblings, 2 replies; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel
  Cc: ville.syrjala, Liviu.Dudau, emil.l.velikov, Uma Shankar,
	maarten.lankhorst

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.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 69aa0d1..a27aab9 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3566,6 +3566,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);
 
@@ -3575,6 +3579,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,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [v6 13/13] video/hdmi: Add const variants for drm infoframe
  2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
                   ` (11 preceding siblings ...)
  2019-03-20 10:48 ` [v6 12/13] drm/i915: Set Infoframe for non modeset case for HDR Uma Shankar
@ 2019-03-20 10:48 ` Uma Shankar
  2019-03-21 12:00   ` Brian Starkey
  2019-03-29 12:22   ` Sharma, Shashank
  12 siblings, 2 replies; 32+ messages in thread
From: Uma Shankar @ 2019-03-20 10:48 UTC (permalink / raw)
  To: intel-gfx, dri-devel
  Cc: ville.syrjala, Liviu.Dudau, emil.l.velikov, Uma Shankar,
	maarten.lankhorst

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

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/video/hdmi.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 include/linux/hdmi.h |  5 +++++
 2 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index 80bb0ee..f9ca555 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -668,6 +668,30 @@ int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame)
 }
 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 and updates derived fields
+ * (eg. length) based on other fields.
+ *
+ * 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
@@ -682,8 +706,8 @@ int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame)
  * 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)
+ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
+				     void *buffer, size_t size)
 {
 	u8 *ptr = buffer;
 	size_t length;
@@ -736,6 +760,37 @@ ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
 
 	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
@@ -845,6 +900,10 @@ ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
 		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);
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 202ed4a..fd8e534 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -213,6 +213,11 @@ 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,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [v6 03/13] drm: Parse Colorimetry data block from EDID
  2019-03-20 10:48 ` [v6 03/13] drm: Parse Colorimetry data block " Uma Shankar
@ 2019-03-21 11:17   ` Brian Starkey
  2019-03-29  6:16     ` Shankar, Uma
  0 siblings, 1 reply; 32+ messages in thread
From: Brian Starkey @ 2019-03-21 11:17 UTC (permalink / raw)
  To: Uma Shankar; +Cc: ville.syrjala, intel-gfx, dri-devel, nd, maarten.lankhorst

Hi Uma,

On Wed, Mar 20, 2019 at 04:18:16PM +0530, Uma Shankar wrote:
> CEA 861.3 spec adds colorimetry data block for HDMI.
> Parsing the block to get the colorimetry data from
> panel.
> 

While code which parses these parts (patches 2 and 3) out of EDID
could be useful - it doesn't seem to actually be used anywhere in the
kernel (sorry if I missed it), and I'm not sure it will/can be unless
we expose more properties.

The discussion last time leant towards a more useful/generic userspace
library for EDID parsing, so perhaps patches 2 and 3 should be
dropped.

Did you have an intended use for them in the kernel?

Thanks,
-Brian

> v2: Rebase
> 
> v3: No Change
> 
> v4: Addressed Shashank's review comments. Updated
> colorimetry field to 16 bit as DCI-P3 got added
> in CEA 861-G spec, as pointed out by Shashank.
> 
> v5: Fixed checkpatch warnings with --strict option.
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c  | 25 +++++++++++++++++++++++++
>  include/drm/drm_connector.h |  3 +++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index fd8a621a..676569b 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2840,6 +2840,7 @@ static int drm_cvt_modes(struct drm_connector *connector,
>  #define VIDEO_BLOCK     0x02
>  #define VENDOR_BLOCK    0x03
>  #define SPEAKER_BLOCK	0x04
> +#define COLORIMETRY_DATA_BLOCK		0x5
>  #define HDR_STATIC_METADATA_BLOCK	0x6
>  #define USE_EXTENDED_TAG 0x07
>  #define EXT_VIDEO_CAPABILITY_BLOCK 0x00
> @@ -3829,6 +3830,28 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
>  	mode->clock = clock;
>  }
>  
> +static bool cea_db_is_hdmi_colorimetry_data_block(const u8 *db)
> +{
> +	if (cea_db_tag(db) != USE_EXTENDED_TAG)
> +		return false;
> +
> +	if (db[1] != COLORIMETRY_DATA_BLOCK)
> +		return false;
> +
> +	return true;
> +}
> +
> +static void
> +drm_parse_colorimetry_data_block(struct drm_connector *connector, const u8 *db)
> +{
> +	struct drm_hdmi_info *info = &connector->display_info.hdmi;
> +	u16 len;
> +
> +	len = cea_db_payload_len_ext(db);
> +	/* As per CEA 861-G spec */
> +	info->colorimetry = ((db[3] & (0x1 << 7)) << 1) | db[2];
> +}
> +
>  static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db)
>  {
>  	if (cea_db_tag(db) != USE_EXTENDED_TAG)
> @@ -4498,6 +4521,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
>  			drm_parse_vcdb(connector, db);
>  		if (cea_db_is_hdmi_hdr_metadata_block(db))
>  			drm_parse_hdr_metadata_block(connector, db);
> +		if (cea_db_is_hdmi_colorimetry_data_block(db))
> +			drm_parse_colorimetry_data_block(connector, db);
>  	}
>  }
>  
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 29388bd..94f926e 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -206,6 +206,9 @@ struct drm_hdmi_info {
>  
>  	/** @y420_dc_modes: bitmap of deep color support index */
>  	u8 y420_dc_modes;
> +
> +	/* @colorimetry: bitmap of supported colorimetry modes */
> +	u16 colorimetry;
>  };
>  
>  /**
> -- 
> 1.9.1
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 01/13] drm: Add HDR source metadata property
  2019-03-20 10:48 ` [v6 01/13] drm: Add HDR source metadata property Uma Shankar
@ 2019-03-21 11:30   ` Brian Starkey
  2019-03-29  6:13     ` Shankar, Uma
  0 siblings, 1 reply; 32+ messages in thread
From: Brian Starkey @ 2019-03-21 11:30 UTC (permalink / raw)
  To: Uma Shankar; +Cc: ville.syrjala, intel-gfx, dri-devel, nd, maarten.lankhorst

Hi Uma,

On Wed, Mar 20, 2019 at 04:18:14PM +0530, Uma Shankar wrote:
> This patch adds a blob property to get HDR metadata
> information from userspace. This will be send as part
> of AVI Infoframe to panel.
> 
> 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.
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>  drivers/gpu/drm/drm_connector.c |  6 ++++++
>  include/drm/drm_connector.h     | 10 ++++++++++
>  include/drm/drm_mode_config.h   |  6 ++++++
>  include/linux/hdmi.h            | 10 ++++++++++
>  include/uapi/drm/drm_mode.h     | 16 ++++++++++++++++
>  5 files changed, 48 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 2355124..0bdae90 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -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;
>  }
>  
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index c806199..29388bd 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -561,6 +561,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_blob_ptr;
> +	u8 hdr_metadata_changed : 1;
>  };
>  
>  /**
> @@ -1201,6 +1208,9 @@ struct drm_connector {
>  	 * &drm_mode_config.connector_free_work.
>  	 */
>  	struct llist_node free_node;
> +
> +	/* HDR metdata */
> +	struct hdr_static_metadata hdr_metadata;
>  };
>  
>  #define obj_to_connector(x) container_of(x, struct drm_connector, base)
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 7f60e8e..ef2656b 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -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;
>  
> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
> index 927ad64..a065194 100644
> --- a/include/linux/hdmi.h
> +++ b/include/linux/hdmi.h
> @@ -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;
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index a439c2e..5012af2 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -630,6 +630,22 @@ struct drm_color_lut {
>  	__u16 reserved;
>  };
>  
> +/* HDR Metadata */

If this is meant to exactly match the layout in the CTA spec, maybe
it's worth a note here saying that, to make it clear it isn't
arbitrary.

> +struct hdr_static_metadata {
> +	uint8_t eotf;
> +	uint8_t metadata_type;
> +	struct {
> +		uint16_t x, y;
> +		} display_primaries[3];
> +	struct {
> +		uint16_t x, y;
> +		} white_point;
> +	uint16_t max_mastering_display_luminance;
> +	uint16_t min_mastering_display_luminance;
> +	uint16_t max_fall;
> +	uint16_t max_cll;

In my copy of CTA-861, fall and cll are the other way around. cll in
bytes 23/24, fall in 25/26.

> +};

The types should be __u8 etc in this kernel header.

It occurred to me that we're likely to want to support dynamic
metadata before too long, and I'm sure there'll be other new HDR
metadata types too. So, perhaps we should add a "header" of sorts to
the HDR_OUTPUT_METADATA blob, to let it be re-used for stuff which
isn't "STATIC_METADATA_TYPE1" in the future.

Something like:

struct hdr_output_metadata {
	__u32 metadata_type;
	union {
		struct hdr_static_metadata hdmi_type1;
	};
};

Not sure how DRM feels about unions in ioctl arguments.

Thanks,
-Brian

> +
>  #define DRM_MODE_PAGE_FLIP_EVENT 0x01
>  #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
>  #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
> -- 
> 1.9.1
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 06/13] drm: Enable HDR infoframe support
  2019-03-20 10:48 ` [v6 06/13] drm: Enable HDR infoframe support Uma Shankar
@ 2019-03-21 11:41   ` Brian Starkey
  2019-03-29  6:24     ` Shankar, Uma
  0 siblings, 1 reply; 32+ messages in thread
From: Brian Starkey @ 2019-03-21 11:41 UTC (permalink / raw)
  To: Uma Shankar
  Cc: ville.syrjala, Liviu Dudau, intel-gfx, emil.l.velikov, dri-devel,
	nd, maarten.lankhorst

On Wed, Mar 20, 2019 at 04:18:19PM +0530, Uma Shankar wrote:
> 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.
> 
> 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.
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c |  56 ++++++++++++++++++++
>  drivers/video/hdmi.c       | 129 +++++++++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_edid.h     |   4 ++
>  include/linux/hdmi.h       |  22 ++++++++
>  4 files changed, 211 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 676569b..78c0b97 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -4916,6 +4916,62 @@ 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,
> +				    void *hdr_metadata)

I don't think this needs to be/should be a void *, you might as well
us (struct hdr_static_metadata *). Looks like you do the cast in i915
before calling this function anyway.

> +{
> +	struct hdr_static_metadata *hdr_source_metadata;
> +	int err, i;
> +
> +	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);
> +
> +	hdr_source_metadata = (struct hdr_static_metadata *)hdr_metadata;
> +
> +	frame->length = sizeof(struct hdr_static_metadata);
> +
> +	frame->eotf = hdr_source_metadata->eotf;
> +	frame->metadata_type = hdr_source_metadata->metadata_type;
> +
> +	for (i = 0; i < 3; i++) {
> +		frame->display_primaries[i].x =
> +			hdr_source_metadata->display_primaries[i].x;
> +		frame->display_primaries[i].y =
> +			hdr_source_metadata->display_primaries[i].y;
> +	}
> +
> +	frame->white_point.x = hdr_source_metadata->white_point.x;
> +	frame->white_point.y = hdr_source_metadata->white_point.y;
> +
> +	frame->max_mastering_display_luminance =
> +		hdr_source_metadata->max_mastering_display_luminance;
> +	frame->min_mastering_display_luminance =
> +		hdr_source_metadata->min_mastering_display_luminance;
> +
> +	frame->max_cll = hdr_source_metadata->max_cll;
> +	frame->max_fall = hdr_source_metadata->max_fall;

Couldn't the infoframe definition embed the UAPI structure, making
this a straight memcpy() ?

> +
> +	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
> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> index 799ae49..80bb0ee 100644
> --- a/drivers/video/hdmi.c
> +++ b/drivers/video/hdmi.c
> @@ -650,6 +650,93 @@ 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);
> +
> +/**
> + * 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(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_mastering_display_luminance;
> +	*ptr++ = frame->max_mastering_display_luminance >> 8;
> +
> +	*ptr++ = frame->min_mastering_display_luminance;
> +	*ptr++ = frame->min_mastering_display_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;
> +}
> +
>  /*
>   * hdmi_vendor_any_infoframe_check() - check a vendor infoframe
>   */
> @@ -806,6 +893,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 +928,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 +1376,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_mastering_display_luminance: %d\n",
> +		 frame->max_mastering_display_luminance);
> +	hdmi_log("min_mastering_display_luminance: %d\n",
> +		 frame->min_mastering_display_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 +1498,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);
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index 9d3b5b9..973e43e 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -370,6 +370,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,
> +				    void *hdr_source_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 a065194..b925b24 100644
> --- a/include/linux/hdmi.h
> +++ b/include/linux/hdmi.h
> @@ -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,32 @@ struct hdmi_avi_infoframe {
>  	unsigned short right_bar;
>  };
>  
> +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_mastering_display_luminance;
> +	u16 min_mastering_display_luminance;
> +	u16 max_fall;
> +	u16 max_cll;

Less confusing IMO if these are the same way around as in the spec.
max_cll first, then max_fall.

> +	u16 min_cll;

This guy isn't in the copy of I have (CTA-861-G). I'm probably out of
date, but you also don't print or encode this value, so should it be
dropped?

Cheers,
-Brian

> +};
> +
>  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);
>  
>  enum hdmi_spd_sdi {
>  	HDMI_SPD_SDI_UNKNOWN,
> @@ -365,6 +386,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
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 05/13] drm: Implement HDR output metadata set and get property handling
  2019-03-20 10:48 ` [v6 05/13] drm: Implement HDR output metadata set and get property handling Uma Shankar
@ 2019-03-21 11:46   ` Brian Starkey
  2019-03-29  6:21     ` Shankar, Uma
  0 siblings, 1 reply; 32+ messages in thread
From: Brian Starkey @ 2019-03-21 11:46 UTC (permalink / raw)
  To: Uma Shankar
  Cc: ville.syrjala, Liviu Dudau, intel-gfx, emil.l.velikov, dri-devel,
	nd, maarten.lankhorst

Hi,

On Wed, Mar 20, 2019 at 04:18:18PM +0530, Uma Shankar wrote:
> This patch 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 added Ville's POC changes
> 
> v3: No Change
> 
> v4: Addressed Shashank's review comments
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>

This looks like a candidate to be squashed into patch 1.

> ---
>  drivers/gpu/drm/drm_atomic.c      |  2 ++
>  drivers/gpu/drm/drm_atomic_uapi.c | 13 +++++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 5eb4013..8b9c126 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -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)
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 4eb81f1..18c8b81f 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -686,6 +686,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, NULL, val);
> @@ -734,6 +736,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_blob_ptr,
> +				val,
> +				-1, sizeof(struct hdr_static_metadata),
> +				&replaced);
> +		state->hdr_metadata_changed |= replaced;

I've said the same about other flags: Do we really need them?
It seems easy enough to just compare the blob pointers or their IDs

Thanks,
-Brian

> +		return ret;
>  	} else if (property == config->aspect_ratio_property) {
>  		state->picture_aspect_ratio = val;
>  	} else if (property == config->content_type_property) {
> @@ -820,6 +830,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_blob_ptr) ?
> +			state->hdr_output_metadata_blob_ptr->base.id : 0;
>  	} else if (property == connector->content_protection_property) {
>  		*val = state->content_protection;
>  	} else if (property == config->writeback_fb_id_property) {
> -- 
> 1.9.1
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 13/13] video/hdmi: Add const variants for drm infoframe
  2019-03-20 10:48 ` [v6 13/13] video/hdmi: Add const variants for drm infoframe Uma Shankar
@ 2019-03-21 12:00   ` Brian Starkey
  2019-03-29  6:29     ` Shankar, Uma
  2019-03-29 12:22   ` Sharma, Shashank
  1 sibling, 1 reply; 32+ messages in thread
From: Brian Starkey @ 2019-03-21 12:00 UTC (permalink / raw)
  To: Uma Shankar
  Cc: ville.syrjala, Liviu Dudau, intel-gfx, emil.l.velikov, dri-devel,
	nd, maarten.lankhorst

Hi,

On Wed, Mar 20, 2019 at 04:18:26PM +0530, Uma Shankar wrote:
> Added the const version of infoframe for DRM metadata
> for HDR.
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>

Unless there's a strong reason not to, I think this can be squashed
into patch 6.

> ---
>  drivers/video/hdmi.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++--
>  include/linux/hdmi.h |  5 +++++
>  2 files changed, 66 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> index 80bb0ee..f9ca555 100644
> --- a/drivers/video/hdmi.c
> +++ b/drivers/video/hdmi.c
> @@ -668,6 +668,30 @@ int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame)
>  }
>  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 and updates derived fields
> + * (eg. length) based on other fields.

This comment doesn't match the implementation.

Thanks,
-Brian

> + *
> + * 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
> @@ -682,8 +706,8 @@ int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame)
>   * 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)
> +ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
> +				     void *buffer, size_t size)
>  {
>  	u8 *ptr = buffer;
>  	size_t length;
> @@ -736,6 +760,37 @@ ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
>  
>  	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
> @@ -845,6 +900,10 @@ ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
>  		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);
> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
> index 202ed4a..fd8e534 100644
> --- a/include/linux/hdmi.h
> +++ b/include/linux/hdmi.h
> @@ -213,6 +213,11 @@ 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,
> -- 
> 1.9.1
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 01/13] drm: Add HDR source metadata property
  2019-03-21 11:30   ` Brian Starkey
@ 2019-03-29  6:13     ` Shankar, Uma
  0 siblings, 0 replies; 32+ messages in thread
From: Shankar, Uma @ 2019-03-29  6:13 UTC (permalink / raw)
  To: Brian Starkey
  Cc: Syrjala, Ville, intel-gfx, dri-devel, nd, Lankhorst, Maarten



>-----Original Message-----
>From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On Behalf Of Brian
>Starkey
>Sent: Thursday, March 21, 2019 5:01 PM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: Syrjala, Ville <ville.syrjala@intel.com>; Liviu Dudau <Liviu.Dudau@arm.com>;
>intel-gfx@lists.freedesktop.org; emil.l.velikov@gmail.com; dri-
>devel@lists.freedesktop.org; nd <nd@arm.com>; Lankhorst, Maarten
><maarten.lankhorst@intel.com>
>Subject: Re: [v6 01/13] drm: Add HDR source metadata property
>
>Hi Uma,
>
>On Wed, Mar 20, 2019 at 04:18:14PM +0530, Uma Shankar wrote:
>> This patch adds a blob property to get HDR metadata information from
>> userspace. This will be send as part of AVI Infoframe to panel.
>>
>> 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.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> ---
>>  drivers/gpu/drm/drm_connector.c |  6 ++++++
>>  include/drm/drm_connector.h     | 10 ++++++++++
>>  include/drm/drm_mode_config.h   |  6 ++++++
>>  include/linux/hdmi.h            | 10 ++++++++++
>>  include/uapi/drm/drm_mode.h     | 16 ++++++++++++++++
>>  5 files changed, 48 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_connector.c
>> b/drivers/gpu/drm/drm_connector.c index 2355124..0bdae90 100644
>> --- a/drivers/gpu/drm/drm_connector.c
>> +++ b/drivers/gpu/drm/drm_connector.c
>> @@ -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;
>>  }
>>
>> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
>> index c806199..29388bd 100644
>> --- a/include/drm/drm_connector.h
>> +++ b/include/drm/drm_connector.h
>> @@ -561,6 +561,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_blob_ptr;
>> +	u8 hdr_metadata_changed : 1;
>>  };
>>
>>  /**
>> @@ -1201,6 +1208,9 @@ struct drm_connector {
>>  	 * &drm_mode_config.connector_free_work.
>>  	 */
>>  	struct llist_node free_node;
>> +
>> +	/* HDR metdata */
>> +	struct hdr_static_metadata hdr_metadata;
>>  };
>>
>>  #define obj_to_connector(x) container_of(x, struct drm_connector,
>> base) diff --git a/include/drm/drm_mode_config.h
>> b/include/drm/drm_mode_config.h index 7f60e8e..ef2656b 100644
>> --- a/include/drm/drm_mode_config.h
>> +++ b/include/drm/drm_mode_config.h
>> @@ -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;
>>
>> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index
>> 927ad64..a065194 100644
>> --- a/include/linux/hdmi.h
>> +++ b/include/linux/hdmi.h
>> @@ -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;
>> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
>> index a439c2e..5012af2 100644
>> --- a/include/uapi/drm/drm_mode.h
>> +++ b/include/uapi/drm/drm_mode.h
>> @@ -630,6 +630,22 @@ struct drm_color_lut {
>>  	__u16 reserved;
>>  };
>>
>> +/* HDR Metadata */
>
>If this is meant to exactly match the layout in the CTA spec, maybe it's worth a note
>here saying that, to make it clear it isn't arbitrary.
>
>> +struct hdr_static_metadata {
>> +	uint8_t eotf;
>> +	uint8_t metadata_type;
>> +	struct {
>> +		uint16_t x, y;
>> +		} display_primaries[3];
>> +	struct {
>> +		uint16_t x, y;
>> +		} white_point;
>> +	uint16_t max_mastering_display_luminance;
>> +	uint16_t min_mastering_display_luminance;
>> +	uint16_t max_fall;
>> +	uint16_t max_cll;
>
>In my copy of CTA-861, fall and cll are the other way around. cll in bytes 23/24, fall in
>25/26.

Sure Brian, will re-order these.

>> +};
>
>The types should be __u8 etc in this kernel header.

Ok will update them.

>It occurred to me that we're likely to want to support dynamic metadata before too
>long, and I'm sure there'll be other new HDR metadata types too. So, perhaps we
>should add a "header" of sorts to the HDR_OUTPUT_METADATA blob, to let it be re-
>used for stuff which isn't "STATIC_METADATA_TYPE1" in the future.
>
>Something like:
>
>struct hdr_output_metadata {
>	__u32 metadata_type;
>	union {
>		struct hdr_static_metadata hdmi_type1;
>	};
>};
>
>Not sure how DRM feels about unions in ioctl arguments.


Sounds good, I will update like this and will try to test this out.

Thanks & Regards,
Uma Shankar

>Thanks,
>-Brian
>
>> +
>>  #define DRM_MODE_PAGE_FLIP_EVENT 0x01  #define
>> DRM_MODE_PAGE_FLIP_ASYNC 0x02  #define
>> DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
>> --
>> 1.9.1
>>
>_______________________________________________
>dri-devel mailing list
>dri-devel@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 03/13] drm: Parse Colorimetry data block from EDID
  2019-03-21 11:17   ` Brian Starkey
@ 2019-03-29  6:16     ` Shankar, Uma
  0 siblings, 0 replies; 32+ messages in thread
From: Shankar, Uma @ 2019-03-29  6:16 UTC (permalink / raw)
  To: Brian Starkey
  Cc: Syrjala, Ville, intel-gfx, dri-devel, nd, Lankhorst, Maarten



>-----Original Message-----
>From: Brian Starkey [mailto:Brian.Starkey@arm.com]
>Sent: Thursday, March 21, 2019 4:47 PM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Lankhorst,
>Maarten <maarten.lankhorst@intel.com>; Syrjala, Ville <ville.syrjala@intel.com>;
>Sharma, Shashank <shashank.sharma@intel.com>; emil.l.velikov@gmail.com; Liviu
>Dudau <Liviu.Dudau@arm.com>; nd <nd@arm.com>
>Subject: Re: [v6 03/13] drm: Parse Colorimetry data block from EDID
>
>Hi Uma,
>
>On Wed, Mar 20, 2019 at 04:18:16PM +0530, Uma Shankar wrote:
>> CEA 861.3 spec adds colorimetry data block for HDMI.
>> Parsing the block to get the colorimetry data from panel.
>>
>
>While code which parses these parts (patches 2 and 3) out of EDID could be useful - it
>doesn't seem to actually be used anywhere in the kernel (sorry if I missed it), and I'm
>not sure it will/can be unless we expose more properties.
>
>The discussion last time leant towards a more useful/generic userspace library for
>EDID parsing, so perhaps patches 2 and 3 should be dropped.
>
>Did you have an intended use for them in the kernel?

The idea was to use them for any kernel defaults or some state and error checking, when we
have more such types exposed. But yeah, may be till we have it I can drop it for now and
re-introduced them later when needed.

Thanks & Regards,
Uma Shankar

>Thanks,
>-Brian
>
>> v2: Rebase
>>
>> v3: No Change
>>
>> v4: Addressed Shashank's review comments. Updated colorimetry field to
>> 16 bit as DCI-P3 got added in CEA 861-G spec, as pointed out by
>> Shashank.
>>
>> v5: Fixed checkpatch warnings with --strict option.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>>  drivers/gpu/drm/drm_edid.c  | 25 +++++++++++++++++++++++++
>> include/drm/drm_connector.h |  3 +++
>>  2 files changed, 28 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index fd8a621a..676569b 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -2840,6 +2840,7 @@ static int drm_cvt_modes(struct drm_connector
>*connector,
>>  #define VIDEO_BLOCK     0x02
>>  #define VENDOR_BLOCK    0x03
>>  #define SPEAKER_BLOCK	0x04
>> +#define COLORIMETRY_DATA_BLOCK		0x5
>>  #define HDR_STATIC_METADATA_BLOCK	0x6
>>  #define USE_EXTENDED_TAG 0x07
>>  #define EXT_VIDEO_CAPABILITY_BLOCK 0x00 @@ -3829,6 +3830,28 @@ static
>> void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
>>  	mode->clock = clock;
>>  }
>>
>> +static bool cea_db_is_hdmi_colorimetry_data_block(const u8 *db) {
>> +	if (cea_db_tag(db) != USE_EXTENDED_TAG)
>> +		return false;
>> +
>> +	if (db[1] != COLORIMETRY_DATA_BLOCK)
>> +		return false;
>> +
>> +	return true;
>> +}
>> +
>> +static void
>> +drm_parse_colorimetry_data_block(struct drm_connector *connector,
>> +const u8 *db) {
>> +	struct drm_hdmi_info *info = &connector->display_info.hdmi;
>> +	u16 len;
>> +
>> +	len = cea_db_payload_len_ext(db);
>> +	/* As per CEA 861-G spec */
>> +	info->colorimetry = ((db[3] & (0x1 << 7)) << 1) | db[2]; }
>> +
>>  static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db)  {
>>  	if (cea_db_tag(db) != USE_EXTENDED_TAG) @@ -4498,6 +4521,8 @@ static
>> void drm_parse_cea_ext(struct drm_connector *connector,
>>  			drm_parse_vcdb(connector, db);
>>  		if (cea_db_is_hdmi_hdr_metadata_block(db))
>>  			drm_parse_hdr_metadata_block(connector, db);
>> +		if (cea_db_is_hdmi_colorimetry_data_block(db))
>> +			drm_parse_colorimetry_data_block(connector, db);
>>  	}
>>  }
>>
>> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
>> index 29388bd..94f926e 100644
>> --- a/include/drm/drm_connector.h
>> +++ b/include/drm/drm_connector.h
>> @@ -206,6 +206,9 @@ struct drm_hdmi_info {
>>
>>  	/** @y420_dc_modes: bitmap of deep color support index */
>>  	u8 y420_dc_modes;
>> +
>> +	/* @colorimetry: bitmap of supported colorimetry modes */
>> +	u16 colorimetry;
>>  };
>>
>>  /**
>> --
>> 1.9.1
>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 05/13] drm: Implement HDR output metadata set and get property handling
  2019-03-21 11:46   ` Brian Starkey
@ 2019-03-29  6:21     ` Shankar, Uma
  0 siblings, 0 replies; 32+ messages in thread
From: Shankar, Uma @ 2019-03-29  6:21 UTC (permalink / raw)
  To: Brian Starkey
  Cc: Syrjala, Ville, intel-gfx, dri-devel, nd, Lankhorst, Maarten



>-----Original Message-----
>From: Brian Starkey [mailto:Brian.Starkey@arm.com]
>Sent: Thursday, March 21, 2019 5:17 PM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Lankhorst,
>Maarten <maarten.lankhorst@intel.com>; Syrjala, Ville <ville.syrjala@intel.com>;
>Sharma, Shashank <shashank.sharma@intel.com>; emil.l.velikov@gmail.com; Liviu
>Dudau <Liviu.Dudau@arm.com>; nd <nd@arm.com>
>Subject: Re: [v6 05/13] drm: Implement HDR output metadata set and get property
>handling
>
>Hi,
>
>On Wed, Mar 20, 2019 at 04:18:18PM +0530, Uma Shankar wrote:
>> This patch 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 added Ville's POC changes
>>
>> v3: No Change
>>
>> v4: Addressed Shashank's review comments
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>
>This looks like a candidate to be squashed into patch 1.

Ok, will merged it with 1.

>> ---
>>  drivers/gpu/drm/drm_atomic.c      |  2 ++
>>  drivers/gpu/drm/drm_atomic_uapi.c | 13 +++++++++++++
>>  2 files changed, 15 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic.c
>> b/drivers/gpu/drm/drm_atomic.c index 5eb4013..8b9c126 100644
>> --- a/drivers/gpu/drm/drm_atomic.c
>> +++ b/drivers/gpu/drm/drm_atomic.c
>> @@ -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) diff --git
>> a/drivers/gpu/drm/drm_atomic_uapi.c
>> b/drivers/gpu/drm/drm_atomic_uapi.c
>> index 4eb81f1..18c8b81f 100644
>> --- a/drivers/gpu/drm/drm_atomic_uapi.c
>> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
>> @@ -686,6 +686,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, NULL, val); @@ -734,6
>> +736,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_blob_ptr,
>> +				val,
>> +				-1, sizeof(struct hdr_static_metadata),
>> +				&replaced);
>> +		state->hdr_metadata_changed |= replaced;
>
>I've said the same about other flags: Do we really need them?
>It seems easy enough to just compare the blob pointers or their IDs

This was just an extension of how gamma luts are used. It's just to have this check
here and later use it where ever needed, since we may require it at multiple places for
certain checks. 

Regards,
Uma Shankar

>
>Thanks,
>-Brian
>
>> +		return ret;
>>  	} else if (property == config->aspect_ratio_property) {
>>  		state->picture_aspect_ratio = val;
>>  	} else if (property == config->content_type_property) { @@ -820,6
>> +830,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_blob_ptr) ?
>> +			state->hdr_output_metadata_blob_ptr->base.id : 0;
>>  	} else if (property == connector->content_protection_property) {
>>  		*val = state->content_protection;
>>  	} else if (property == config->writeback_fb_id_property) {
>> --
>> 1.9.1
>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [v6 06/13] drm: Enable HDR infoframe support
  2019-03-21 11:41   ` Brian Starkey
@ 2019-03-29  6:24     ` Shankar, Uma
  0 siblings, 0 replies; 32+ messages in thread
From: Shankar, Uma @ 2019-03-29  6:24 UTC (permalink / raw)
  To: Brian Starkey
  Cc: Syrjala, Ville, Liviu Dudau, intel-gfx, emil.l.velikov,
	dri-devel, nd, Lankhorst, Maarten



>-----Original Message-----
>From: Brian Starkey [mailto:Brian.Starkey@arm.com]
>Sent: Thursday, March 21, 2019 5:12 PM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Lankhorst,
>Maarten <maarten.lankhorst@intel.com>; Syrjala, Ville <ville.syrjala@intel.com>;
>Sharma, Shashank <shashank.sharma@intel.com>; emil.l.velikov@gmail.com; Liviu
>Dudau <Liviu.Dudau@arm.com>; Ville Syrjälä <ville.syrjala@linux.intel.com>; nd
><nd@arm.com>
>Subject: Re: [v6 06/13] drm: Enable HDR infoframe support
>
>On Wed, Mar 20, 2019 at 04:18:19PM +0530, Uma Shankar wrote:
>> 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.
>>
>> 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.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>>  drivers/gpu/drm/drm_edid.c |  56 ++++++++++++++++++++
>>  drivers/video/hdmi.c       | 129
>+++++++++++++++++++++++++++++++++++++++++++++
>>  include/drm/drm_edid.h     |   4 ++
>>  include/linux/hdmi.h       |  22 ++++++++
>>  4 files changed, 211 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index 676569b..78c0b97 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -4916,6 +4916,62 @@ 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,
>> +				    void *hdr_metadata)
>
>I don't think this needs to be/should be a void *, you might as well us (struct
>hdr_static_metadata *). Looks like you do the cast in i915 before calling this function
>anyway.

Ok, will update this.

>> +{
>> +	struct hdr_static_metadata *hdr_source_metadata;
>> +	int err, i;
>> +
>> +	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);
>> +
>> +	hdr_source_metadata = (struct hdr_static_metadata *)hdr_metadata;
>> +
>> +	frame->length = sizeof(struct hdr_static_metadata);
>> +
>> +	frame->eotf = hdr_source_metadata->eotf;
>> +	frame->metadata_type = hdr_source_metadata->metadata_type;
>> +
>> +	for (i = 0; i < 3; i++) {
>> +		frame->display_primaries[i].x =
>> +			hdr_source_metadata->display_primaries[i].x;
>> +		frame->display_primaries[i].y =
>> +			hdr_source_metadata->display_primaries[i].y;
>> +	}
>> +
>> +	frame->white_point.x = hdr_source_metadata->white_point.x;
>> +	frame->white_point.y = hdr_source_metadata->white_point.y;
>> +
>> +	frame->max_mastering_display_luminance =
>> +		hdr_source_metadata->max_mastering_display_luminance;
>> +	frame->min_mastering_display_luminance =
>> +		hdr_source_metadata->min_mastering_display_luminance;
>> +
>> +	frame->max_cll = hdr_source_metadata->max_cll;
>> +	frame->max_fall = hdr_source_metadata->max_fall;
>
>Couldn't the infoframe definition embed the UAPI structure, making this a straight
>memcpy() ?

Yeah it's doable, currently the structures were not exactly same. Will try to make them
Identical and perform a memcpy as even suggested by Shashank.

>> +
>> +	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
>> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c index
>> 799ae49..80bb0ee 100644
>> --- a/drivers/video/hdmi.c
>> +++ b/drivers/video/hdmi.c
>> @@ -650,6 +650,93 @@ 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);
>> +
>> +/**
>> + * 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(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_mastering_display_luminance;
>> +	*ptr++ = frame->max_mastering_display_luminance >> 8;
>> +
>> +	*ptr++ = frame->min_mastering_display_luminance;
>> +	*ptr++ = frame->min_mastering_display_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;
>> +}
>> +
>>  /*
>>   * hdmi_vendor_any_infoframe_check() - check a vendor infoframe
>>   */
>> @@ -806,6 +893,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 +928,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 +1376,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_mastering_display_luminance: %d\n",
>> +		 frame->max_mastering_display_luminance);
>> +	hdmi_log("min_mastering_display_luminance: %d\n",
>> +		 frame->min_mastering_display_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 +1498,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);
>> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index
>> 9d3b5b9..973e43e 100644
>> --- a/include/drm/drm_edid.h
>> +++ b/include/drm/drm_edid.h
>> @@ -370,6 +370,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,
>> +				    void *hdr_source_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 a065194..b925b24
>> 100644
>> --- a/include/linux/hdmi.h
>> +++ b/include/linux/hdmi.h
>> @@ -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,32 @@ struct hdmi_avi_infoframe {
>>  	unsigned short right_bar;
>>  };
>>
>> +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_mastering_display_luminance;
>> +	u16 min_mastering_display_luminance;
>> +	u16 max_fall;
>> +	u16 max_cll;
>
>Less confusing IMO if these are the same way around as in the spec.
>max_cll first, then max_fall.
>
>> +	u16 min_cll;
>
>This guy isn't in the copy of I have (CTA-861-G). I'm probably out of date, but you also
>don't print or encode this value, so should it be dropped?

Sure, will match exactly to 861.G. There were certain deltas here b/w 861.F and G. Will update this.

Thanks & Regards,
Uma Shankar

>Cheers,
>-Brian
>
>> +};
>> +
>>  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);
>>
>>  enum hdmi_spd_sdi {
>>  	HDMI_SPD_SDI_UNKNOWN,
>> @@ -365,6 +386,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
>>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 13/13] video/hdmi: Add const variants for drm infoframe
  2019-03-21 12:00   ` Brian Starkey
@ 2019-03-29  6:29     ` Shankar, Uma
  0 siblings, 0 replies; 32+ messages in thread
From: Shankar, Uma @ 2019-03-29  6:29 UTC (permalink / raw)
  To: Brian Starkey
  Cc: Syrjala, Ville, intel-gfx, dri-devel, nd, Lankhorst, Maarten



>-----Original Message-----
>From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On Behalf Of Brian
>Starkey
>Sent: Thursday, March 21, 2019 5:31 PM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: Syrjala, Ville <ville.syrjala@intel.com>; Liviu Dudau <Liviu.Dudau@arm.com>;
>intel-gfx@lists.freedesktop.org; emil.l.velikov@gmail.com; dri-
>devel@lists.freedesktop.org; nd <nd@arm.com>; Lankhorst, Maarten
><maarten.lankhorst@intel.com>
>Subject: Re: [v6 13/13] video/hdmi: Add const variants for drm infoframe
>
>Hi,
>
>On Wed, Mar 20, 2019 at 04:18:26PM +0530, Uma Shankar wrote:
>> Added the const version of infoframe for DRM metadata for HDR.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>
>Unless there's a strong reason not to, I think this can be squashed into patch 6.

This was added later after some infoframe rework, so was keeping this
separately, but yeah this can be squashed with 6.

>> ---
>>  drivers/video/hdmi.c | 63
>> ++++++++++++++++++++++++++++++++++++++++++++++++++--
>>  include/linux/hdmi.h |  5 +++++
>>  2 files changed, 66 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c index
>> 80bb0ee..f9ca555 100644
>> --- a/drivers/video/hdmi.c
>> +++ b/drivers/video/hdmi.c
>> @@ -668,6 +668,30 @@ int hdmi_drm_infoframe_init(struct
>> hdmi_drm_infoframe *frame)  }  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 and updates derived
>> +fields
>> + * (eg. length) based on other fields.
>
>This comment doesn't match the implementation.

Ok, will update this comment.

Thanks Brian for the review and valuable feedback. Will send out the next version soon
fixing all the comments.

Regards,
Uma Shankar

>Thanks,
>-Brian
>
>> + *
>> + * 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
>> @@ -682,8 +706,8 @@ int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe
>*frame)
>>   * 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)
>> +ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
>> +				     void *buffer, size_t size)
>>  {
>>  	u8 *ptr = buffer;
>>  	size_t length;
>> @@ -736,6 +760,37 @@ ssize_t hdmi_drm_infoframe_pack(struct
>> hdmi_drm_infoframe *frame, void *buffer,
>>
>>  	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 @@
>> -845,6 +900,10 @@ ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe
>*frame, void *buffer,
>>  		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);
>> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index
>> 202ed4a..fd8e534 100644
>> --- a/include/linux/hdmi.h
>> +++ b/include/linux/hdmi.h
>> @@ -213,6 +213,11 @@ 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,
>> --
>> 1.9.1
>>
>_______________________________________________
>dri-devel mailing list
>dri-devel@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 02/13] drm: Parse HDR metadata info from EDID
  2019-03-20 10:48 ` [v6 02/13] drm: Parse HDR metadata info from EDID Uma Shankar
@ 2019-03-29 11:41   ` Sharma, Shashank
  0 siblings, 0 replies; 32+ messages in thread
From: Sharma, Shashank @ 2019-03-29 11:41 UTC (permalink / raw)
  To: Uma Shankar, intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst


On 3/20/2019 4:18 PM, Uma Shankar wrote:
> 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
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>   drivers/gpu/drm/drm_edid.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 49 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index fa39592..fd8a621a 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2840,6 +2840,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
> @@ -3587,6 +3588,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];
> @@ -3822,6 +3829,46 @@ 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_metadata.eotf = eotf_supported(db);
> +	connector->hdr_metadata.metadata_type = hdr_metadata_type(db);
> +
> +	if (len >= 5)
> +		connector->hdr_metadata.max_fall = db[5];
> +	if (len >= 4)

Little bike shed, If we pass >=5 we need not to compare >= 4, or we 
should check >=4 first and then >=5 in sequence.

With that change ( and assuming you fixed the checkpatch stuff already), 
please feel free to use:

Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>

> +		connector->hdr_metadata.max_cll = db[4];
> +}
> +
>   static void
>   drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
>   {
> @@ -4449,6 +4496,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);
>   	}
>   }
>   
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 07/13] drm/i915: Write HDR infoframe and send to panel
  2019-03-20 10:48 ` [v6 07/13] drm/i915: Write HDR infoframe and send to panel Uma Shankar
@ 2019-03-29 11:48   ` Sharma, Shashank
  0 siblings, 0 replies; 32+ messages in thread
From: Sharma, Shashank @ 2019-03-29 11:48 UTC (permalink / raw)
  To: Uma Shankar, intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst


On 3/20/2019 4:18 PM, Uma Shankar wrote:
> 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.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_drv.h  |  1 +
>   drivers/gpu/drm/i915/intel_hdmi.c | 41 +++++++++++++++++++++++++++++++++++++++
>   2 files changed, 42 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index d9f188e..c6c3cc7 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1043,6 +1043,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 */
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 5f06237..e4bc7fc 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -555,6 +555,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)
> @@ -777,6 +778,30 @@ void intel_read_infoframe(struct intel_encoder *encoder,
>   	return true;
>   }
>   
> +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_static_metadata *hdr_metadata;
> +	int ret;
> +
> +	hdr_metadata = (struct hdr_static_metadata *)
> +			conn_state->hdr_output_metadata_blob_ptr->data;
> +
> +	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);
> +
> +	return true;
> +}
> +
>   static void g4x_set_infoframes(struct intel_encoder *encoder,
>   			       bool enable,
>   			       const struct intel_crtc_state *crtc_state,
> @@ -1175,6 +1200,9 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
>   	intel_write_infoframe(encoder, crtc_state,
>   			      HDMI_INFOFRAME_TYPE_VENDOR,
>   			      &crtc_state->infoframes.hdmi);
> +	intel_write_infoframe(encoder, crtc_state,

We should have a GEN check here also, else, there could be case where we 
dint compute infoframes <=10 but wrote it, which will write garbage.

- Shashank

> +			      HDMI_INFOFRAME_TYPE_DRM,
> +			      &crtc_state->infoframes.drm);
>   }
>   
>   void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable)
> @@ -2381,6 +2409,19 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
>   		return -EINVAL;
>   	}
>   
> +	/*
> +	 * 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) {
> +		if (!intel_hdmi_compute_drm_infoframe(encoder, pipe_config,
> +						      conn_state)) {
> +			DRM_DEBUG_KMS("bad DRM infoframe\n");
> +			return -EINVAL;
> +		}
> +	}
> +
>   	return 0;
>   }
>   
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 12/13] drm/i915: Set Infoframe for non modeset case for HDR
  2019-03-20 10:48 ` [v6 12/13] drm/i915: Set Infoframe for non modeset case for HDR Uma Shankar
@ 2019-03-29 12:14   ` Sharma, Shashank
  2019-03-29 14:04   ` Ville Syrjälä
  1 sibling, 0 replies; 32+ messages in thread
From: Sharma, Shashank @ 2019-03-29 12:14 UTC (permalink / raw)
  To: Uma Shankar, intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

On 3/20/2019 4:18 PM, Uma Shankar wrote:
> 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.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_ddi.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 69aa0d1..a27aab9 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3566,6 +3566,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);
>   
> @@ -3575,6 +3579,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);
> +	}
>   }
>   
Looks good to me,  Please feel free to use:

Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>


>   static void intel_ddi_set_fia_lane_count(struct intel_encoder *encoder,
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 13/13] video/hdmi: Add const variants for drm infoframe
  2019-03-20 10:48 ` [v6 13/13] video/hdmi: Add const variants for drm infoframe Uma Shankar
  2019-03-21 12:00   ` Brian Starkey
@ 2019-03-29 12:22   ` Sharma, Shashank
  1 sibling, 0 replies; 32+ messages in thread
From: Sharma, Shashank @ 2019-03-29 12:22 UTC (permalink / raw)
  To: Uma Shankar, intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst


On 3/20/2019 4:18 PM, Uma Shankar wrote:
> Added the const version of infoframe for DRM metadata
> for HDR.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>   drivers/video/hdmi.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++--
>   include/linux/hdmi.h |  5 +++++
>   2 files changed, 66 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> index 80bb0ee..f9ca555 100644
> --- a/drivers/video/hdmi.c
> +++ b/drivers/video/hdmi.c
> @@ -668,6 +668,30 @@ int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame)
>   }
>   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 and updates derived fields
> + * (eg. length) based on other fields.
> + *
This comment doesn't match what's being done in this function, as, 
hdmi_drm_infoframe_check_only() doesn't validate length.
> + * 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
> @@ -682,8 +706,8 @@ int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame)
>    * 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)
> +ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
> +				     void *buffer, size_t size)
>   {
>   	u8 *ptr = buffer;
>   	size_t length;
> @@ -736,6 +760,37 @@ ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
>   
>   	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
> @@ -845,6 +900,10 @@ ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
>   		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);
> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
> index 202ed4a..fd8e534 100644
> --- a/include/linux/hdmi.h
> +++ b/include/linux/hdmi.h
> @@ -213,6 +213,11 @@ 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,

With that minor comment related to description fixed, this patch looks 
good to me. Please feel free to use:

Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>

- Shashank

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 10/13] drm/i915: Enable infoframes on GLK+ for HDR
  2019-03-20 10:48 ` [v6 10/13] drm/i915: Enable infoframes on GLK+ for HDR Uma Shankar
@ 2019-03-29 12:31   ` Sharma, Shashank
  0 siblings, 0 replies; 32+ messages in thread
From: Sharma, Shashank @ 2019-03-29 12:31 UTC (permalink / raw)
  To: Uma Shankar, intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst


On 3/20/2019 4:18 PM, Uma Shankar wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> This patch enables infoframes on GLK+ to be
> used to send HDR metadata to HDMI sink.
>
> v2: Addressed Shashank's review comment.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_reg.h   |  4 ++++
>   drivers/gpu/drm/i915/intel_hdmi.c | 18 +++++++++++++-----
>   2 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 31a3020..fe931e7 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -4718,6 +4718,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
> @@ -8156,6 +8157,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
> @@ -8169,6 +8171,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
> @@ -8194,6 +8197,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)
>   
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index e4bc7fc..8decafd 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -134,6 +134,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;
> @@ -159,6 +161,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;
> @@ -545,7 +549,8 @@ static u32 hsw_infoframes_enabled(struct intel_encoder *encoder,
>   
>   	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);
> +		      VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW |
> +		      VIDEO_DIP_ENABLE_DRM_GLK);
I think this should also be GEN check protected, as 
hsw_infoframes_enabled will be called by many platforms, and before GLK 
they cant support DRM_IF.
>   }
>   
>   static const u8 infoframe_type_to_idx[] = {
> @@ -1177,7 +1182,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);

Same here.

- Shashank

>   
>   	if (!enable) {
>   		I915_WRITE(reg, val);
> @@ -1200,9 +1206,11 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
>   	intel_write_infoframe(encoder, crtc_state,
>   			      HDMI_INFOFRAME_TYPE_VENDOR,
>   			      &crtc_state->infoframes.hdmi);
> -	intel_write_infoframe(encoder, crtc_state,
> -			      HDMI_INFOFRAME_TYPE_DRM,
> -			      &crtc_state->infoframes.drm);
> +	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);
>   }
>   
>   void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 11/13] drm/i915:Enabled Modeset when HDR Infoframe changes
  2019-03-20 10:48 ` [v6 11/13] drm/i915:Enabled Modeset when HDR Infoframe changes Uma Shankar
@ 2019-03-29 12:56   ` Sharma, Shashank
  0 siblings, 0 replies; 32+ messages in thread
From: Sharma, Shashank @ 2019-03-29 12:56 UTC (permalink / raw)
  To: Uma Shankar, intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst


On 3/20/2019 4:18 PM, Uma Shankar wrote:
> This patch enables modeset whenever HDR metadata
> needs to be updated to sink.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_atomic.c | 15 ++++++++++++++-
>   drivers/gpu/drm/i915/intel_hdmi.c   |  4 ++++
>   2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index b844e88..4ff6042 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -102,6 +102,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)
>   {
> @@ -129,7 +139,10 @@ 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_blob_ptr,
If you are keeping this line ahead of the upper one due to 80 char 
limit, please pull that one also two tabs back, right now this is not 
even looking good.
> +			old_conn_state->base.hdr_output_metadata_blob_ptr))
>   		crtc_state->mode_changed = true;
>   
>   	return 0;
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 8decafd..4d06734 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -792,6 +792,10 @@ void intel_read_infoframe(struct intel_encoder *encoder,
>   	struct hdr_static_metadata *hdr_metadata;
>   	int ret;
>   
> +	if (!conn_state->hdr_output_metadata_blob_ptr ||
> +	    conn_state->hdr_output_metadata_blob_ptr->length == 0)
> +		return true;
> +

This patch needs a rebase on the latest code, as this is definitely not 
where we want this code :-)

- Shashank

>   	hdr_metadata = (struct hdr_static_metadata *)
>   			conn_state->hdr_output_metadata_blob_ptr->data;
>   
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [v6 12/13] drm/i915: Set Infoframe for non modeset case for HDR
  2019-03-20 10:48 ` [v6 12/13] drm/i915: Set Infoframe for non modeset case for HDR Uma Shankar
  2019-03-29 12:14   ` Sharma, Shashank
@ 2019-03-29 14:04   ` Ville Syrjälä
  2019-04-02 16:27     ` Shankar, Uma
  1 sibling, 1 reply; 32+ messages in thread
From: Ville Syrjälä @ 2019-03-29 14:04 UTC (permalink / raw)
  To: Uma Shankar; +Cc: ville.syrjala, intel-gfx, dri-devel, maarten.lankhorst

On Wed, Mar 20, 2019 at 04:18:25PM +0530, Uma Shankar wrote:
> 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.
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 69aa0d1..a27aab9 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3566,6 +3566,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);
>  
> @@ -3575,6 +3579,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);

I don't think this should be tied to the drm infoframe. It should
be totally generic. IIRC there is also some magic dance we may have
to perform when updating infoframes with the port enabled. But the
details escape right now.

> +	}
>  }
>  
>  static void intel_ddi_set_fia_lane_count(struct intel_encoder *encoder,
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [v6 12/13] drm/i915: Set Infoframe for non modeset case for HDR
  2019-03-29 14:04   ` Ville Syrjälä
@ 2019-04-02 16:27     ` Shankar, Uma
  0 siblings, 0 replies; 32+ messages in thread
From: Shankar, Uma @ 2019-04-02 16:27 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: Syrjala, Ville, emil.l.velikov, intel-gfx, Liviu.Dudau,
	dri-devel, Lankhorst, Maarten



>-----Original Message-----
>From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On Behalf Of Ville
>Syrjälä
>Sent: Friday, March 29, 2019 7:35 PM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: Syrjala, Ville <ville.syrjala@intel.com>; Liviu.Dudau@arm.com; intel-
>gfx@lists.freedesktop.org; emil.l.velikov@gmail.com; dri-
>devel@lists.freedesktop.org; Lankhorst, Maarten <maarten.lankhorst@intel.com>
>Subject: Re: [v6 12/13] drm/i915: Set Infoframe for non modeset case for HDR
>
>On Wed, Mar 20, 2019 at 04:18:25PM +0530, Uma Shankar wrote:
>> 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.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_ddi.c | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_ddi.c
>> b/drivers/gpu/drm/i915/intel_ddi.c
>> index 69aa0d1..a27aab9 100644
>> --- a/drivers/gpu/drm/i915/intel_ddi.c
>> +++ b/drivers/gpu/drm/i915/intel_ddi.c
>> @@ -3566,6 +3566,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);
>>
>> @@ -3575,6 +3579,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);
>
>I don't think this should be tied to the drm infoframe. It should be totally generic. IIRC
>there is also some magic dance we may have to perform when updating infoframes
>with the port enabled. But the details escape right now.

Hi Ville,
I agree, currently limiting it to DRM Infoframes so that we don't break the legacy
usecase/non HDR cases. We will have to enable this for all kind of infoframes and
validate if things are fine.

Regards,
Uma Shankar

>> +	}
>>  }
>>
>>  static void intel_ddi_set_fia_lane_count(struct intel_encoder
>> *encoder,
>> --
>> 1.9.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>--
>Ville Syrjälä
>Intel
>_______________________________________________
>dri-devel mailing list
>dri-devel@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2019-04-02 16:27 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 10:48 [v6 00/13] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
2019-03-20 10:48 ` [v6 01/13] drm: Add HDR source metadata property Uma Shankar
2019-03-21 11:30   ` Brian Starkey
2019-03-29  6:13     ` Shankar, Uma
2019-03-20 10:48 ` [v6 02/13] drm: Parse HDR metadata info from EDID Uma Shankar
2019-03-29 11:41   ` Sharma, Shashank
2019-03-20 10:48 ` [v6 03/13] drm: Parse Colorimetry data block " Uma Shankar
2019-03-21 11:17   ` Brian Starkey
2019-03-29  6:16     ` Shankar, Uma
2019-03-20 10:48 ` [v6 04/13] drm/i915: Attach HDR metadata property to connector Uma Shankar
2019-03-20 10:48 ` [v6 05/13] drm: Implement HDR output metadata set and get property handling Uma Shankar
2019-03-21 11:46   ` Brian Starkey
2019-03-29  6:21     ` Shankar, Uma
2019-03-20 10:48 ` [v6 06/13] drm: Enable HDR infoframe support Uma Shankar
2019-03-21 11:41   ` Brian Starkey
2019-03-29  6:24     ` Shankar, Uma
2019-03-20 10:48 ` [v6 07/13] drm/i915: Write HDR infoframe and send to panel Uma Shankar
2019-03-29 11:48   ` Sharma, Shashank
2019-03-20 10:48 ` [v6 08/13] drm/i915: [DO NOT MERGE] hack for glk board outputs Uma Shankar
2019-03-20 10:48 ` [v6 09/13] drm/i915: Add HLG EOTF Uma Shankar
2019-03-20 10:48 ` [v6 10/13] drm/i915: Enable infoframes on GLK+ for HDR Uma Shankar
2019-03-29 12:31   ` Sharma, Shashank
2019-03-20 10:48 ` [v6 11/13] drm/i915:Enabled Modeset when HDR Infoframe changes Uma Shankar
2019-03-29 12:56   ` Sharma, Shashank
2019-03-20 10:48 ` [v6 12/13] drm/i915: Set Infoframe for non modeset case for HDR Uma Shankar
2019-03-29 12:14   ` Sharma, Shashank
2019-03-29 14:04   ` Ville Syrjälä
2019-04-02 16:27     ` Shankar, Uma
2019-03-20 10:48 ` [v6 13/13] video/hdmi: Add const variants for drm infoframe Uma Shankar
2019-03-21 12:00   ` Brian Starkey
2019-03-29  6:29     ` Shankar, Uma
2019-03-29 12:22   ` Sharma, Shashank

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).