Skip to contentSkip to conversation

Enabling content-type setting for HDMI displays.

PATCH Superseded StanLis 4 participants 13 messages Apr 19, 2018 – Apr 24, 2018

Subsystems (4)

v5 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

StanLis

author
#0 lore raw

v5 cover Enabling content-type setting for HDMI displays.

From: Stanislav Lisovskiy <[email protected]>

Added content type setting property to drm_connector(part 1) and enabled transmitting it with HDMI AVI infoframes for i915(part 2).

Stanislav Lisovskiy (2):
drm: content-type property for HDMI connector
i915: content-type property for HDMI connector

 Documentation/gpu/kms-properties.csv |  1 +
 drivers/gpu/drm/drm_atomic.c         | 17 ++++++++++
 drivers/gpu/drm/drm_connector.c      | 51 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_edid.c           |  2 ++
 drivers/gpu/drm/i915/intel_atomic.c  |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c    |  4 +++
 include/drm/drm_connector.h          | 18 ++++++++++
 include/drm/drm_mode_config.h        |  5 +++
 include/uapi/drm/drm_mode.h          |  7 ++++
 9 files changed, 107 insertions(+)
Signature · 6 lines
2.17.0

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

PATCH v5 1/2 drm: content-type property for HDMI connector

From: Stanislav Lisovskiy <[email protected]>

Added content_type property to drm_connector_state
in order to properly handle external HDMI TV content-type setting.

v2:
* Moved helper function which attaches content type property to the drm core, as was suggested.
Removed redundant connector state initialization.

v3:
* Removed caps in drm_content_type_enum_list.
After some discussion it turned out that HDMI Spec 1.4 was wrongly assuming that IT Content(itc) bit doesn't affect Content type states, however itc bit needs to be manupulated as well. In order to not expose additional property for itc, for sake of simplicity it was decided to bind those together in same "content type" property.

v4:
* Added it_content checking in intel_digital_connector_atomic_check. Fixed documentation for new content type enum.

v5:
* Moved patch revision's description to commit messages.

---
 Documentation/gpu/kms-properties.csv |  1 +
 drivers/gpu/drm/drm_atomic.c         | 17 ++++++++++
 drivers/gpu/drm/drm_connector.c      | 51 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_edid.c           |  2 ++
 include/drm/drm_connector.h          | 18 ++++++++++
 include/drm/drm_mode_config.h        |  5 +++
 include/uapi/drm/drm_mode.h          |  7 ++++
 7 files changed, 101 insertions(+)
Documentation/gpu/kms-properties.csv +1 -0
index 6b28b014cb7d..a91c9211b8d6 100644
@@ -17,6 +17,7 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
 ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
 ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
 ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
+,Optional,"""content type""",ENUM,"{ ""No data"", ""Graphics"", ""Photo"", ""Cinema"", ""Game"" }",Connector,TBD
 i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
 ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
 ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
drivers/gpu/drm/drm_atomic.c +17 -0
index 7d25c42f22db..479499f5848e 100644
@@ -1266,6 +1266,15 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 			state->link_status = val;
 	} else if (property == config->aspect_ratio_property) {
 		state->picture_aspect_ratio = val;
+	} else if (property == config->content_type_property) {
+		/*
+		 * Lowest two bits of content_type property control
+		 * content_type, bit 2 controls itc bit.
+		 * It was decided to have a single property called
+		 * content_type, instead of content_type and itc.
+		 */
+		state->content_type = val & 3;
+		state->it_content = val >> 2;
 	} else if (property == connector->scaling_mode_property) {
 		state->scaling_mode = val;
 	} else if (property == connector->content_protection_property) {
@@ -1351,6 +1360,14 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
 		*val = state->link_status;
 	} else if (property == config->aspect_ratio_property) {
 		*val = state->picture_aspect_ratio;
+	} else if (property == config->content_type_property) {
+		/*
+		 * Lowest two bits of content_type property control
+		 * content_type, bit 2 controls itc bit.
+		 * It was decided to have a single property called
+		 * content_type, instead of content_type and itc.
+		 */
+		*val = state->content_type | (state->it_content << 2);
 	} else if (property == connector->scaling_mode_property) {
 		*val = state->scaling_mode;
 	} else if (property == connector->content_protection_property) {
drivers/gpu/drm/drm_connector.c +51 -0

69 lines not on this page · raw message

drivers/gpu/drm/drm_edid.c +2 -0
index 134069f36482..b1b7f9683e34 100644
@@ -4867,6 +4867,8 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	}
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+	frame->content_type = HDMI_CONTENT_TYPE_GRAPHICS;
+	frame->itc = 0;
 
 	/*
 	 * Populate picture aspect ratio from either
include/drm/drm_connector.h +18 -0
index 675cc3f8cf85..1fedab750f09 100644
@@ -418,6 +418,22 @@ struct drm_connector_state {
 	 */
 	enum hdmi_picture_aspect picture_aspect_ratio;
 
+	/**
+	 * @content_type: Connector property to control the
+	 * HDMI infoframe content type setting.
+	 * The %DRM_MODE_CONTENT_TYPE_\* values lowest 2 bits much
+	 * match the values for &enum hdmi_content_type
+	 */
+	enum hdmi_content_type content_type;
+
+	/**
+	 * @it_content: Connector property to control the
+	 * HDMI infoframe it content setting(used with content type).
+	 * The %DRM_MODE_CONTENT_TYPE_\* values bit 2
+	 * match the values of it_content
+	 */
+	bool it_content;
+
 	/**
 	 * @scaling_mode: Connector property to control the
 	 * upscaling, mostly used for built-in panels.
@@ -1089,11 +1105,13 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
 				  unsigned int num_modes,
 				  const char * const modes[]);
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
+int drm_connector_attach_content_type_property(struct drm_connector *dev);
 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
 					       u32 scaling_mode_mask);
 int drm_connector_attach_content_protection_property(
 		struct drm_connector *connector);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
+int drm_mode_create_content_type_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
 
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
include/drm/drm_mode_config.h +5 -0
index 33b3a96d66d0..fb45839179dd 100644
@@ -726,6 +726,11 @@ struct drm_mode_config {
 	 * HDMI infoframe aspect ratio setting.
 	 */
 	struct drm_property *aspect_ratio_property;
+	/**
+	 * @content_type_property: Optional connector property to control the
+	 * HDMI infoframe content type setting.
+	 */
+	struct drm_property *content_type_property;
 	/**
 	 * @degamma_lut_property: Optional CRTC property to set the LUT used to
 	 * convert the framebuffer's colors to linear gamma.
include/uapi/drm/drm_mode.h +7 -0
index 50bcf4214ff9..3c234bfa80b9 100644
@@ -94,6 +94,13 @@ extern "C" {
 #define DRM_MODE_PICTURE_ASPECT_4_3		1
 #define DRM_MODE_PICTURE_ASPECT_16_9		2
 
+/* HDMI content type and itc bit bound together for simplicity */
+#define DRM_MODE_CONTENT_TYPE_NO_DATA		0
+#define DRM_MODE_CONTENT_TYPE_GRAPHICS		4
+#define DRM_MODE_CONTENT_TYPE_PHOTO		5
+#define DRM_MODE_CONTENT_TYPE_CINEMA		6
+#define DRM_MODE_CONTENT_TYPE_GAME		7
+
 /* Aspect ratio flag bitmask (4 bits 22:19) */
 #define DRM_MODE_FLAG_PIC_AR_MASK		(0x0F<<19)
 #define  DRM_MODE_FLAG_PIC_AR_NONE \
Signature · 6 lines
2.17.0

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

Re: [PATCH v5 1/2] drm: content-type property for HDMI connector

Quoted 89 lines · StanLis

From: Stanislav Lisovskiy <[email protected]>

Added content_type property to drm_connector_state
in order to properly handle external HDMI TV content-type setting.

v2:
* Moved helper function which attaches content type property to the drm core, as was suggested.
Removed redundant connector state initialization.

v3:
* Removed caps in drm_content_type_enum_list.
After some discussion it turned out that HDMI Spec 1.4 was wrongly assuming that IT Content(itc) bit doesn't affect Content type states, however itc bit needs to be manupulated as well. In order to not expose additional property for itc, for sake of simplicity it was decided to bind those together in same "content type" property.

v4:
* Added it_content checking in intel_digital_connector_atomic_check. Fixed documentation for new content type enum.

v5:
* Moved patch revision's description to commit messages.

---
 Documentation/gpu/kms-properties.csv |  1 +
 drivers/gpu/drm/drm_atomic.c         | 17 ++++++++++
 drivers/gpu/drm/drm_connector.c      | 51 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_edid.c           |  2 ++
 include/drm/drm_connector.h          | 18 ++++++++++
 include/drm/drm_mode_config.h        |  5 +++
 include/uapi/drm/drm_mode.h          |  7 ++++
 7 files changed, 101 insertions(+)
Documentation/gpu/kms-properties.csv +1 -0
index 6b28b014cb7d..a91c9211b8d6 100644
@@ -17,6 +17,7 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
 ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
 ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
 ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
+,Optional,"""content type""",ENUM,"{ ""No data"", ""Graphics"", ""Photo"", ""Cinema"", ""Game"" }",Connector,TBD
 i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
 ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
 ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
drivers/gpu/drm/drm_atomic.c +17 -0
index 7d25c42f22db..479499f5848e 100644
@@ -1266,6 +1266,15 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 			state->link_status = val;
 	} else if (property == config->aspect_ratio_property) {
 		state->picture_aspect_ratio = val;
+	} else if (property == config->content_type_property) {
+		/*
+		 * Lowest two bits of content_type property control
+		 * content_type, bit 2 controls itc bit.
+		 * It was decided to have a single property called
+		 * content_type, instead of content_type and itc.
+		 */
+		state->content_type = val & 3;
+		state->it_content = val >> 2;
 	} else if (property == connector->scaling_mode_property) {
 		state->scaling_mode = val;
 	} else if (property == connector->content_protection_property) {
@@ -1351,6 +1360,14 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
 		*val = state->link_status;
 	} else if (property == config->aspect_ratio_property) {
 		*val = state->picture_aspect_ratio;
+	} else if (property == config->content_type_property) {
+		/*
+		 * Lowest two bits of content_type property control
+		 * content_type, bit 2 controls itc bit.
+		 * It was decided to have a single property called
+		 * content_type, instead of content_type and itc.
+		 */
+		*val = state->content_type | (state->it_content << 2);
 	} else if (property == connector->scaling_mode_property) {
 		*val = state->scaling_mode;
 	} else if (property == connector->content_protection_property) {
drivers/gpu/drm/drm_connector.c +0 -0
index b3cde897cd80..757a0712f7c1 100644

drivers/gpu/drm/drm_connector.c static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = { · line 724

Quoted 5 lines
drivers/gpu/drm/drm_connector.c +2 -0
@@ -720,6 +720,14 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
 	{ DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
 };
 
+static const struct drm_prop_enum_list drm_content_type_enum_list[] = {
+	{ DRM_MODE_CONTENT_TYPE_NO_DATA, "No data" },

Shouldn't this be "No Data"? At least, I see "Upside Down" below, so I assume each word should start with upper case.

Quoted 145 lines
drivers/gpu/drm/drm_connector.c +49 -0
+	{ DRM_MODE_CONTENT_TYPE_GRAPHICS, "Graphics" },
+	{ DRM_MODE_CONTENT_TYPE_PHOTO, "Photo" },
+	{ DRM_MODE_CONTENT_TYPE_CINEMA, "Cinema" },
+	{ DRM_MODE_CONTENT_TYPE_GAME, "Game" },
+};
+
 static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {
 	{ DRM_MODE_PANEL_ORIENTATION_NORMAL,	"Normal"	},
 	{ DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP,	"Upside Down"	},
@@ -996,6 +1004,22 @@ int drm_mode_create_dvi_i_properties(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_dvi_i_properties);
 
+/**
+ * drm_connector_attach_content_type_property - attach content-type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time a HDMI connector is made.
+ */
+int drm_connector_attach_content_type_property(struct drm_connector *connector)
+{
+	if (!drm_mode_create_content_type_property(connector->dev))
+		drm_object_attach_property(&connector->base,
+			connector->dev->mode_config.content_type_property,
+			DRM_MODE_CONTENT_TYPE_NO_DATA);
+	return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_content_type_property);
+
 /**
  * drm_create_tv_properties - create TV specific connector properties
  * @dev: DRM device
@@ -1260,6 +1284,33 @@ int drm_mode_create_aspect_ratio_property(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
 
+/**
+ * drm_mode_create_content_type_property - create content type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time it's needed, must be attached to desired
+ * connectors.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_create_content_type_property(struct drm_device *dev)
+{
+	if (dev->mode_config.content_type_property)
+		return 0;
+
+	dev->mode_config.content_type_property =
+		drm_property_create_enum(dev, 0, "content type",
+				drm_content_type_enum_list,
+				ARRAY_SIZE(drm_content_type_enum_list));
+
+	if (dev->mode_config.content_type_property == NULL)
+		return -ENOMEM;
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_mode_create_content_type_property);
+
 /**
  * drm_mode_create_suggested_offset_properties - create suggests offset properties
  * @dev: DRM device
drivers/gpu/drm/drm_edid.c +2 -0
index 134069f36482..b1b7f9683e34 100644
@@ -4867,6 +4867,8 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	}
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+	frame->content_type = HDMI_CONTENT_TYPE_GRAPHICS;
+	frame->itc = 0;
 
 	/*
 	 * Populate picture aspect ratio from either
include/drm/drm_connector.h +18 -0
index 675cc3f8cf85..1fedab750f09 100644
@@ -418,6 +418,22 @@ struct drm_connector_state {
 	 */
 	enum hdmi_picture_aspect picture_aspect_ratio;
 
+	/**
+	 * @content_type: Connector property to control the
+	 * HDMI infoframe content type setting.
+	 * The %DRM_MODE_CONTENT_TYPE_\* values lowest 2 bits much
+	 * match the values for &enum hdmi_content_type
+	 */
+	enum hdmi_content_type content_type;
+
+	/**
+	 * @it_content: Connector property to control the
+	 * HDMI infoframe it content setting(used with content type).
+	 * The %DRM_MODE_CONTENT_TYPE_\* values bit 2
+	 * match the values of it_content
+	 */
+	bool it_content;
+
 	/**
 	 * @scaling_mode: Connector property to control the
 	 * upscaling, mostly used for built-in panels.
@@ -1089,11 +1105,13 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
 				  unsigned int num_modes,
 				  const char * const modes[]);
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
+int drm_connector_attach_content_type_property(struct drm_connector *dev);
 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
 					       u32 scaling_mode_mask);
 int drm_connector_attach_content_protection_property(
 		struct drm_connector *connector);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
+int drm_mode_create_content_type_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
 
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
include/drm/drm_mode_config.h +5 -0
index 33b3a96d66d0..fb45839179dd 100644
@@ -726,6 +726,11 @@ struct drm_mode_config {
 	 * HDMI infoframe aspect ratio setting.
 	 */
 	struct drm_property *aspect_ratio_property;
+	/**
+	 * @content_type_property: Optional connector property to control the
+	 * HDMI infoframe content type setting.
+	 */
+	struct drm_property *content_type_property;
 	/**
 	 * @degamma_lut_property: Optional CRTC property to set the LUT used to
 	 * convert the framebuffer's colors to linear gamma.
include/uapi/drm/drm_mode.h +0 -0
index 50bcf4214ff9..3c234bfa80b9 100644
@@ -94,6 +94,13 @@ extern "C" {
 #define DRM_MODE_PICTURE_ASPECT_4_3		1
 #define DRM_MODE_PICTURE_ASPECT_16_9		2
 

include/uapi/drm/drm_mode.h extern "C" { · line 106

Quoted 10 lines
include/uapi/drm/drm_mode.h +7 -0
+/* HDMI content type and itc bit bound together for simplicity */
+#define DRM_MODE_CONTENT_TYPE_NO_DATA		0
+#define DRM_MODE_CONTENT_TYPE_GRAPHICS		4
+#define DRM_MODE_CONTENT_TYPE_PHOTO		5
+#define DRM_MODE_CONTENT_TYPE_CINEMA		6
+#define DRM_MODE_CONTENT_TYPE_GAME		7
+
 /* Aspect ratio flag bitmask (4 bits 22:19) */
 #define DRM_MODE_FLAG_PIC_AR_MASK		(0x0F<<19)
 #define  DRM_MODE_FLAG_PIC_AR_NONE \

Other than that this looks good to me.

Regards,

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

#3 lore raw

Re: [PATCH v5 1/2] drm: content-type property for HDMI connector

In reply to StanLis
Quoted 19 lines · StanLis

From: Stanislav Lisovskiy <[email protected]>

Added content_type property to drm_connector_state
in order to properly handle external HDMI TV content-type setting.

v2:
* Moved helper function which attaches content type property to the drm core, as was suggested.
Removed redundant connector state initialization.

v3:
* Removed caps in drm_content_type_enum_list.
After some discussion it turned out that HDMI Spec 1.4 was wrongly assuming that IT Content(itc) bit doesn't affect Content type states, however itc bit needs to be manupulated as well. In order to not expose additional property for itc, for sake of simplicity it was decided to bind those together in same "content type" property.

Quoted 8 lines

v4:
* Added it_content checking in intel_digital_connector_atomic_check. Fixed documentation for new content type enum.

v5:
* Moved patch revision's description to commit messages.

The property documentation to tie all the bits together (property, helper, internals) is missing. It should be in

https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#standard-connector-properties

Probably want to start with an intro-paragraph for HDMI properties (someone should document the broadcast prop too eventually).

Pls also make sure the resulting docs look pretty and that it's all nicely hyperlink:

$ make htmldocs

Thanks,
Daniel

Quoted 228 lines
---
 Documentation/gpu/kms-properties.csv |  1 +
 drivers/gpu/drm/drm_atomic.c         | 17 ++++++++++
 drivers/gpu/drm/drm_connector.c      | 51 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_edid.c           |  2 ++
 include/drm/drm_connector.h          | 18 ++++++++++
 include/drm/drm_mode_config.h        |  5 +++
 include/uapi/drm/drm_mode.h          |  7 ++++
 7 files changed, 101 insertions(+)
Documentation/gpu/kms-properties.csv +1 -0
index 6b28b014cb7d..a91c9211b8d6 100644
@@ -17,6 +17,7 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
 ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
 ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
 ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
+,Optional,"""content type""",ENUM,"{ ""No data"", ""Graphics"", ""Photo"", ""Cinema"", ""Game"" }",Connector,TBD
 i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
 ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
 ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
drivers/gpu/drm/drm_atomic.c +17 -0
index 7d25c42f22db..479499f5848e 100644
@@ -1266,6 +1266,15 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 			state->link_status = val;
 	} else if (property == config->aspect_ratio_property) {
 		state->picture_aspect_ratio = val;
+	} else if (property == config->content_type_property) {
+		/*
+		 * Lowest two bits of content_type property control
+		 * content_type, bit 2 controls itc bit.
+		 * It was decided to have a single property called
+		 * content_type, instead of content_type and itc.
+		 */
+		state->content_type = val & 3;
+		state->it_content = val >> 2;
 	} else if (property == connector->scaling_mode_property) {
 		state->scaling_mode = val;
 	} else if (property == connector->content_protection_property) {
@@ -1351,6 +1360,14 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
 		*val = state->link_status;
 	} else if (property == config->aspect_ratio_property) {
 		*val = state->picture_aspect_ratio;
+	} else if (property == config->content_type_property) {
+		/*
+		 * Lowest two bits of content_type property control
+		 * content_type, bit 2 controls itc bit.
+		 * It was decided to have a single property called
+		 * content_type, instead of content_type and itc.
+		 */
+		*val = state->content_type | (state->it_content << 2);
 	} else if (property == connector->scaling_mode_property) {
 		*val = state->scaling_mode;
 	} else if (property == connector->content_protection_property) {
drivers/gpu/drm/drm_connector.c +51 -0
index b3cde897cd80..757a0712f7c1 100644
@@ -720,6 +720,14 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
 	{ DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
 };
 
+static const struct drm_prop_enum_list drm_content_type_enum_list[] = {
+	{ DRM_MODE_CONTENT_TYPE_NO_DATA, "No data" },
+	{ DRM_MODE_CONTENT_TYPE_GRAPHICS, "Graphics" },
+	{ DRM_MODE_CONTENT_TYPE_PHOTO, "Photo" },
+	{ DRM_MODE_CONTENT_TYPE_CINEMA, "Cinema" },
+	{ DRM_MODE_CONTENT_TYPE_GAME, "Game" },
+};
+
 static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {
 	{ DRM_MODE_PANEL_ORIENTATION_NORMAL,	"Normal"	},
 	{ DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP,	"Upside Down"	},
@@ -996,6 +1004,22 @@ int drm_mode_create_dvi_i_properties(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_dvi_i_properties);
 
+/**
+ * drm_connector_attach_content_type_property - attach content-type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time a HDMI connector is made.
+ */
+int drm_connector_attach_content_type_property(struct drm_connector *connector)
+{
+	if (!drm_mode_create_content_type_property(connector->dev))
+		drm_object_attach_property(&connector->base,
+			connector->dev->mode_config.content_type_property,
+			DRM_MODE_CONTENT_TYPE_NO_DATA);
+	return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_content_type_property);
+
 /**
  * drm_create_tv_properties - create TV specific connector properties
  * @dev: DRM device
@@ -1260,6 +1284,33 @@ int drm_mode_create_aspect_ratio_property(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
 
+/**
+ * drm_mode_create_content_type_property - create content type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time it's needed, must be attached to desired
+ * connectors.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_create_content_type_property(struct drm_device *dev)
+{
+	if (dev->mode_config.content_type_property)
+		return 0;
+
+	dev->mode_config.content_type_property =
+		drm_property_create_enum(dev, 0, "content type",
+				drm_content_type_enum_list,
+				ARRAY_SIZE(drm_content_type_enum_list));
+
+	if (dev->mode_config.content_type_property == NULL)
+		return -ENOMEM;
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_mode_create_content_type_property);
+
 /**
  * drm_mode_create_suggested_offset_properties - create suggests offset properties
  * @dev: DRM device
drivers/gpu/drm/drm_edid.c +2 -0
index 134069f36482..b1b7f9683e34 100644
@@ -4867,6 +4867,8 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	}
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+	frame->content_type = HDMI_CONTENT_TYPE_GRAPHICS;
+	frame->itc = 0;
 
 	/*
 	 * Populate picture aspect ratio from either
include/drm/drm_connector.h +18 -0
index 675cc3f8cf85..1fedab750f09 100644
@@ -418,6 +418,22 @@ struct drm_connector_state {
 	 */
 	enum hdmi_picture_aspect picture_aspect_ratio;
 
+	/**
+	 * @content_type: Connector property to control the
+	 * HDMI infoframe content type setting.
+	 * The %DRM_MODE_CONTENT_TYPE_\* values lowest 2 bits much
+	 * match the values for &enum hdmi_content_type
+	 */
+	enum hdmi_content_type content_type;
+
+	/**
+	 * @it_content: Connector property to control the
+	 * HDMI infoframe it content setting(used with content type).
+	 * The %DRM_MODE_CONTENT_TYPE_\* values bit 2
+	 * match the values of it_content
+	 */
+	bool it_content;
+
 	/**
 	 * @scaling_mode: Connector property to control the
 	 * upscaling, mostly used for built-in panels.
@@ -1089,11 +1105,13 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
 				  unsigned int num_modes,
 				  const char * const modes[]);
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
+int drm_connector_attach_content_type_property(struct drm_connector *dev);
 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
 					       u32 scaling_mode_mask);
 int drm_connector_attach_content_protection_property(
 		struct drm_connector *connector);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
+int drm_mode_create_content_type_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
 
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
include/drm/drm_mode_config.h +5 -0
index 33b3a96d66d0..fb45839179dd 100644
@@ -726,6 +726,11 @@ struct drm_mode_config {
 	 * HDMI infoframe aspect ratio setting.
 	 */
 	struct drm_property *aspect_ratio_property;
+	/**
+	 * @content_type_property: Optional connector property to control the
+	 * HDMI infoframe content type setting.
+	 */
+	struct drm_property *content_type_property;
 	/**
 	 * @degamma_lut_property: Optional CRTC property to set the LUT used to
 	 * convert the framebuffer's colors to linear gamma.
include/uapi/drm/drm_mode.h +7 -0
index 50bcf4214ff9..3c234bfa80b9 100644
@@ -94,6 +94,13 @@ extern "C" {
 #define DRM_MODE_PICTURE_ASPECT_4_3		1
 #define DRM_MODE_PICTURE_ASPECT_16_9		2
 
+/* HDMI content type and itc bit bound together for simplicity */
+#define DRM_MODE_CONTENT_TYPE_NO_DATA		0
+#define DRM_MODE_CONTENT_TYPE_GRAPHICS		4
+#define DRM_MODE_CONTENT_TYPE_PHOTO		5
+#define DRM_MODE_CONTENT_TYPE_CINEMA		6
+#define DRM_MODE_CONTENT_TYPE_GAME		7
+
 /* Aspect ratio flag bitmask (4 bits 22:19) */
 #define DRM_MODE_FLAG_PIC_AR_MASK		(0x0F<<19)
 #define  DRM_MODE_FLAG_PIC_AR_NONE \
Signature · 6 lines
2.17.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [PATCH v5 1/2] drm: content-type property for HDMI connector

________________________________________
From: Daniel Vetter [[email protected]] on behalf of Daniel Vetter [[email protected]]

Quoted 5 lines

The property documentation to tie all the bits together (property, helper, internals) is missing. It should be in

https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#standard-connector-properties

Quoted 7 lines

Probably want to start with an intro-paragraph for HDMI properties (someone should document the broadcast prop too eventually).

Pls also make sure the resulting docs look pretty and that it's all nicely hyperlink:

$ make htmldocs

Thank you for your feedback. The thing is that I actually looked into docs, but I think there should have been already some HDMI specific property documentation, because this one is actually not a standard connector property, so I've added it only to

https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#existing-kms-properties table as optional.
I think it might be a bit misleading, if I add that one to standard connector properties, there are probably should be created some HDMI specific property chapter then, as there are already plenty of HDMI specific ones(force audio, broadcast rgb, aspect ratio).

Shouldn't it then go in a separate patch may be? Because this work is surely needed, however goes a bit out of scope of this patch.

Best Regards,

Lisovskiy Stanislav

Quoted 224 lines
---
 Documentation/gpu/kms-properties.csv |  1 +
 drivers/gpu/drm/drm_atomic.c         | 17 ++++++++++
 drivers/gpu/drm/drm_connector.c      | 51 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_edid.c           |  2 ++
 include/drm/drm_connector.h          | 18 ++++++++++
 include/drm/drm_mode_config.h        |  5 +++
 include/uapi/drm/drm_mode.h          |  7 ++++
 7 files changed, 101 insertions(+)
Documentation/gpu/kms-properties.csv +1 -0
index 6b28b014cb7d..a91c9211b8d6 100644
@@ -17,6 +17,7 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
 ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
 ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
 ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
+,Optional,"""content type""",ENUM,"{ ""No data"", ""Graphics"", ""Photo"", ""Cinema"", ""Game"" }",Connector,TBD
 i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
 ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
 ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
drivers/gpu/drm/drm_atomic.c +17 -0
index 7d25c42f22db..479499f5848e 100644
@@ -1266,6 +1266,15 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
                      state->link_status = val;
      } else if (property == config->aspect_ratio_property) {
              state->picture_aspect_ratio = val;
+     } else if (property == config->content_type_property) {
+             /*
+              * Lowest two bits of content_type property control
+              * content_type, bit 2 controls itc bit.
+              * It was decided to have a single property called
+              * content_type, instead of content_type and itc.
+              */
+             state->content_type = val & 3;
+             state->it_content = val >> 2;
      } else if (property == connector->scaling_mode_property) {
              state->scaling_mode = val;
      } else if (property == connector->content_protection_property) {
@@ -1351,6 +1360,14 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
              *val = state->link_status;
      } else if (property == config->aspect_ratio_property) {
              *val = state->picture_aspect_ratio;
+     } else if (property == config->content_type_property) {
+             /*
+              * Lowest two bits of content_type property control
+              * content_type, bit 2 controls itc bit.
+              * It was decided to have a single property called
+              * content_type, instead of content_type and itc.
+              */
+             *val = state->content_type | (state->it_content << 2);
      } else if (property == connector->scaling_mode_property) {
              *val = state->scaling_mode;
      } else if (property == connector->content_protection_property) {
drivers/gpu/drm/drm_connector.c +51 -0
index b3cde897cd80..757a0712f7c1 100644
@@ -720,6 +720,14 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
      { DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
 };
 
+static const struct drm_prop_enum_list drm_content_type_enum_list[] = {
+     { DRM_MODE_CONTENT_TYPE_NO_DATA, "No data" },
+     { DRM_MODE_CONTENT_TYPE_GRAPHICS, "Graphics" },
+     { DRM_MODE_CONTENT_TYPE_PHOTO, "Photo" },
+     { DRM_MODE_CONTENT_TYPE_CINEMA, "Cinema" },
+     { DRM_MODE_CONTENT_TYPE_GAME, "Game" },
+};
+
 static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {
      { DRM_MODE_PANEL_ORIENTATION_NORMAL,    "Normal"        },
      { DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, "Upside Down"   },
@@ -996,6 +1004,22 @@ int drm_mode_create_dvi_i_properties(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_dvi_i_properties);
 
+/**
+ * drm_connector_attach_content_type_property - attach content-type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time a HDMI connector is made.
+ */
+int drm_connector_attach_content_type_property(struct drm_connector *connector)
+{
+     if (!drm_mode_create_content_type_property(connector->dev))
+             drm_object_attach_property(&connector->base,
+                     connector->dev->mode_config.content_type_property,
+                     DRM_MODE_CONTENT_TYPE_NO_DATA);
+     return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_content_type_property);
+
 /**
  * drm_create_tv_properties - create TV specific connector properties
  * @dev: DRM device
@@ -1260,6 +1284,33 @@ int drm_mode_create_aspect_ratio_property(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
 
+/**
+ * drm_mode_create_content_type_property - create content type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time it's needed, must be attached to desired
+ * connectors.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_create_content_type_property(struct drm_device *dev)
+{
+     if (dev->mode_config.content_type_property)
+             return 0;
+
+     dev->mode_config.content_type_property =
+             drm_property_create_enum(dev, 0, "content type",
+                             drm_content_type_enum_list,
+                             ARRAY_SIZE(drm_content_type_enum_list));
+
+     if (dev->mode_config.content_type_property == NULL)
+             return -ENOMEM;
+
+     return 0;
+}
+EXPORT_SYMBOL(drm_mode_create_content_type_property);
+
 /**
  * drm_mode_create_suggested_offset_properties - create suggests offset properties
  * @dev: DRM device
drivers/gpu/drm/drm_edid.c +2 -0
index 134069f36482..b1b7f9683e34 100644
@@ -4867,6 +4867,8 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
      }
 
      frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+     frame->content_type = HDMI_CONTENT_TYPE_GRAPHICS;
+     frame->itc = 0;
 
      /*
       * Populate picture aspect ratio from either
include/drm/drm_connector.h +18 -0
index 675cc3f8cf85..1fedab750f09 100644
@@ -418,6 +418,22 @@ struct drm_connector_state {
       */
      enum hdmi_picture_aspect picture_aspect_ratio;
 
+     /**
+      * @content_type: Connector property to control the
+      * HDMI infoframe content type setting.
+      * The %DRM_MODE_CONTENT_TYPE_\* values lowest 2 bits much
+      * match the values for &enum hdmi_content_type
+      */
+     enum hdmi_content_type content_type;
+
+     /**
+      * @it_content: Connector property to control the
+      * HDMI infoframe it content setting(used with content type).
+      * The %DRM_MODE_CONTENT_TYPE_\* values bit 2
+      * match the values of it_content
+      */
+     bool it_content;
+
      /**
       * @scaling_mode: Connector property to control the
       * upscaling, mostly used for built-in panels.
@@ -1089,11 +1105,13 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
                                unsigned int num_modes,
                                const char * const modes[]);
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
+int drm_connector_attach_content_type_property(struct drm_connector *dev);
 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
                                             u32 scaling_mode_mask);
 int drm_connector_attach_content_protection_property(
              struct drm_connector *connector);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
+int drm_mode_create_content_type_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
 
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
include/drm/drm_mode_config.h +5 -0
index 33b3a96d66d0..fb45839179dd 100644
@@ -726,6 +726,11 @@ struct drm_mode_config {
       * HDMI infoframe aspect ratio setting.
       */
      struct drm_property *aspect_ratio_property;
+     /**
+      * @content_type_property: Optional connector property to control the
+      * HDMI infoframe content type setting.
+      */
+     struct drm_property *content_type_property;
      /**
       * @degamma_lut_property: Optional CRTC property to set the LUT used to
       * convert the framebuffer's colors to linear gamma.
include/uapi/drm/drm_mode.h +7 -1
index 50bcf4214ff9..3c234bfa80b9 100644
@@ -94,6 +94,13 @@ extern "C" {
 #define DRM_MODE_PICTURE_ASPECT_4_3          1
 #define DRM_MODE_PICTURE_ASPECT_16_9         2
 
+/* HDMI content type and itc bit bound together for simplicity */
+#define DRM_MODE_CONTENT_TYPE_NO_DATA                0
+#define DRM_MODE_CONTENT_TYPE_GRAPHICS               4
+#define DRM_MODE_CONTENT_TYPE_PHOTO          5
+#define DRM_MODE_CONTENT_TYPE_CINEMA         6
+#define DRM_MODE_CONTENT_TYPE_GAME           7
+
 /* Aspect ratio flag bitmask (4 bits 22:19) */
 #define DRM_MODE_FLAG_PIC_AR_MASK            (0x0F<<19)
 #define  DRM_MODE_FLAG_PIC_AR_NONE \
--

2.17.0

Quoted 4 lines

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

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [Intel-gfx] [PATCH v5 1/2] drm: content-type property for HDMI connector

Quoted 15 lines · Stanislav

________________________________________
From: Daniel Vetter [[email protected]] on behalf of Daniel Vetter [[email protected]]

Quoted 10 lines

The property documentation to tie all the bits together (property, helper, internals) is missing. It should be in

https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#standard-connector-properties

Probably want to start with an intro-paragraph for HDMI properties (someone should document the broadcast prop too eventually).

Pls also make sure the resulting docs look pretty and that it's all nicely hyperlink:

Quoted 7 lines
Quoted 1 line
$ make htmldocs

Thank you for your feedback. The thing is that I actually looked into docs, but I think there should have been already some HDMI specific property documentation, because this one is actually not a standard connector property, so I've added it only to

https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#existing-kms-properties table

This table is seriously deprecated, because it's unreadable and unmaintainable. Quoting from the docs:

"Because this table is very unwieldy, do not add any new properties here. Instead document them in a section above."

We haven't yet moved all the existing properties over to the new layout (patches very much welcome, especially if you spot that an entire area you're touching like HDMI properties isn't moved yet). But the old table is very much not cool to add stuff to.

Sorry that I didn't notice this earlier, missed it in the diffstat.

Quoted 7 lines

as optional.
I think it might be a bit misleading, if I add that one to standard connector properties, there are probably should be created some HDMI specific property chapter then, as there are already plenty of HDMI specific ones(force audio, broadcast rgb, aspect ratio).

Shouldn't it then go in a separate patch may be? Because this work is surely needed, however goes a bit out of scope of this patch.

Don't make it worse by adding more unmaintainable and unreadable entries to this table. That's the minimum. Moving all the standard hdmi properties first would obviously be even better. That also makes reviewing easier, since it's clearer what's there already, and how your new thing fits in. -Daniel

Quoted 238 lines

Best Regards,

Lisovskiy Stanislav

Quoted 224 lines
---
 Documentation/gpu/kms-properties.csv |  1 +
 drivers/gpu/drm/drm_atomic.c         | 17 ++++++++++
 drivers/gpu/drm/drm_connector.c      | 51 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_edid.c           |  2 ++
 include/drm/drm_connector.h          | 18 ++++++++++
 include/drm/drm_mode_config.h        |  5 +++
 include/uapi/drm/drm_mode.h          |  7 ++++
 7 files changed, 101 insertions(+)
Documentation/gpu/kms-properties.csv +1 -0
index 6b28b014cb7d..a91c9211b8d6 100644
@@ -17,6 +17,7 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
 ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
 ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
 ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
+,Optional,"""content type""",ENUM,"{ ""No data"", ""Graphics"", ""Photo"", ""Cinema"", ""Game"" }",Connector,TBD
 i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
 ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
 ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
drivers/gpu/drm/drm_atomic.c +17 -0
index 7d25c42f22db..479499f5848e 100644
@@ -1266,6 +1266,15 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
                      state->link_status = val;
      } else if (property == config->aspect_ratio_property) {
              state->picture_aspect_ratio = val;
+     } else if (property == config->content_type_property) {
+             /*
+              * Lowest two bits of content_type property control
+              * content_type, bit 2 controls itc bit.
+              * It was decided to have a single property called
+              * content_type, instead of content_type and itc.
+              */
+             state->content_type = val & 3;
+             state->it_content = val >> 2;
      } else if (property == connector->scaling_mode_property) {
              state->scaling_mode = val;
      } else if (property == connector->content_protection_property) {
@@ -1351,6 +1360,14 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
              *val = state->link_status;
      } else if (property == config->aspect_ratio_property) {
              *val = state->picture_aspect_ratio;
+     } else if (property == config->content_type_property) {
+             /*
+              * Lowest two bits of content_type property control
+              * content_type, bit 2 controls itc bit.
+              * It was decided to have a single property called
+              * content_type, instead of content_type and itc.
+              */
+             *val = state->content_type | (state->it_content << 2);
      } else if (property == connector->scaling_mode_property) {
              *val = state->scaling_mode;
      } else if (property == connector->content_protection_property) {
drivers/gpu/drm/drm_connector.c +51 -0
index b3cde897cd80..757a0712f7c1 100644
@@ -720,6 +720,14 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
      { DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
 };
 
+static const struct drm_prop_enum_list drm_content_type_enum_list[] = {
+     { DRM_MODE_CONTENT_TYPE_NO_DATA, "No data" },
+     { DRM_MODE_CONTENT_TYPE_GRAPHICS, "Graphics" },
+     { DRM_MODE_CONTENT_TYPE_PHOTO, "Photo" },
+     { DRM_MODE_CONTENT_TYPE_CINEMA, "Cinema" },
+     { DRM_MODE_CONTENT_TYPE_GAME, "Game" },
+};
+
 static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {
      { DRM_MODE_PANEL_ORIENTATION_NORMAL,    "Normal"        },
      { DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, "Upside Down"   },
@@ -996,6 +1004,22 @@ int drm_mode_create_dvi_i_properties(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_dvi_i_properties);
 
+/**
+ * drm_connector_attach_content_type_property - attach content-type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time a HDMI connector is made.
+ */
+int drm_connector_attach_content_type_property(struct drm_connector *connector)
+{
+     if (!drm_mode_create_content_type_property(connector->dev))
+             drm_object_attach_property(&connector->base,
+                     connector->dev->mode_config.content_type_property,
+                     DRM_MODE_CONTENT_TYPE_NO_DATA);
+     return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_content_type_property);
+
 /**
  * drm_create_tv_properties - create TV specific connector properties
  * @dev: DRM device
@@ -1260,6 +1284,33 @@ int drm_mode_create_aspect_ratio_property(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
 
+/**
+ * drm_mode_create_content_type_property - create content type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time it's needed, must be attached to desired
+ * connectors.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_create_content_type_property(struct drm_device *dev)
+{
+     if (dev->mode_config.content_type_property)
+             return 0;
+
+     dev->mode_config.content_type_property =
+             drm_property_create_enum(dev, 0, "content type",
+                             drm_content_type_enum_list,
+                             ARRAY_SIZE(drm_content_type_enum_list));
+
+     if (dev->mode_config.content_type_property == NULL)
+             return -ENOMEM;
+
+     return 0;
+}
+EXPORT_SYMBOL(drm_mode_create_content_type_property);
+
 /**
  * drm_mode_create_suggested_offset_properties - create suggests offset properties
  * @dev: DRM device
drivers/gpu/drm/drm_edid.c +2 -0
index 134069f36482..b1b7f9683e34 100644
@@ -4867,6 +4867,8 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
      }
 
      frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+     frame->content_type = HDMI_CONTENT_TYPE_GRAPHICS;
+     frame->itc = 0;
 
      /*
       * Populate picture aspect ratio from either
include/drm/drm_connector.h +18 -0
index 675cc3f8cf85..1fedab750f09 100644
@@ -418,6 +418,22 @@ struct drm_connector_state {
       */
      enum hdmi_picture_aspect picture_aspect_ratio;
 
+     /**
+      * @content_type: Connector property to control the
+      * HDMI infoframe content type setting.
+      * The %DRM_MODE_CONTENT_TYPE_\* values lowest 2 bits much
+      * match the values for &enum hdmi_content_type
+      */
+     enum hdmi_content_type content_type;
+
+     /**
+      * @it_content: Connector property to control the
+      * HDMI infoframe it content setting(used with content type).
+      * The %DRM_MODE_CONTENT_TYPE_\* values bit 2
+      * match the values of it_content
+      */
+     bool it_content;
+
      /**
       * @scaling_mode: Connector property to control the
       * upscaling, mostly used for built-in panels.
@@ -1089,11 +1105,13 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
                                unsigned int num_modes,
                                const char * const modes[]);
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
+int drm_connector_attach_content_type_property(struct drm_connector *dev);
 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
                                             u32 scaling_mode_mask);
 int drm_connector_attach_content_protection_property(
              struct drm_connector *connector);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
+int drm_mode_create_content_type_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
 
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
include/drm/drm_mode_config.h +5 -0
index 33b3a96d66d0..fb45839179dd 100644
@@ -726,6 +726,11 @@ struct drm_mode_config {
       * HDMI infoframe aspect ratio setting.
       */
      struct drm_property *aspect_ratio_property;
+     /**
+      * @content_type_property: Optional connector property to control the
+      * HDMI infoframe content type setting.
+      */
+     struct drm_property *content_type_property;
      /**
       * @degamma_lut_property: Optional CRTC property to set the LUT used to
       * convert the framebuffer's colors to linear gamma.
include/uapi/drm/drm_mode.h +7 -1
index 50bcf4214ff9..3c234bfa80b9 100644
@@ -94,6 +94,13 @@ extern "C" {
 #define DRM_MODE_PICTURE_ASPECT_4_3          1
 #define DRM_MODE_PICTURE_ASPECT_16_9         2
 
+/* HDMI content type and itc bit bound together for simplicity */
+#define DRM_MODE_CONTENT_TYPE_NO_DATA                0
+#define DRM_MODE_CONTENT_TYPE_GRAPHICS               4
+#define DRM_MODE_CONTENT_TYPE_PHOTO          5
+#define DRM_MODE_CONTENT_TYPE_CINEMA         6
+#define DRM_MODE_CONTENT_TYPE_GAME           7
+
 /* Aspect ratio flag bitmask (4 bits 22:19) */
 #define DRM_MODE_FLAG_PIC_AR_MASK            (0x0F<<19)
 #define  DRM_MODE_FLAG_PIC_AR_NONE \
--

2.17.0

Quoted 4 lines

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

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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

RE: [Intel-gfx] [PATCH v5 1/2] drm: content-type property for HDMI connector

Quoted 19 lines

This table is seriously deprecated, because it's unreadable and unmaintainable. Quoting from the docs:

"Because this table is very unwieldy, do not add any new properties here. Instead document them in a section above."

We haven't yet moved all the existing properties over to the new layout (patches very much welcome, especially if you spot that an entire area you're touching like HDMI properties isn't moved yet). But the old table is very much not cool to add stuff to.

Sorry that I didn't notice this earlier, missed it in the diffstat.

Quoted 5 lines

as optional.
I think it might be a bit misleading, if I add that one to standard connector properties, there are probably should be created some HDMI specific property chapter then, as there are already plenty of HDMI specific ones(force audio, broadcast rgb, aspect ratio).

Quoted 7 lines
Quoted 2 lines

Shouldn't it then go in a separate patch may be? Because this work is surely needed, however goes a bit out of scope of this patch.

Don't make it worse by adding more unmaintainable and unreadable entries to this table. That's the minimum. Moving all the standard hdmi properties first would obviously be even better. That also makes reviewing easier, since it's clearer what's there already, and how your new thing fits in.

Ok, then I think I will add a new section called HDMI Specific Connector Properties under Standard Connector Properties and move content type description there. I can add another entries there too, however would prefer to do it in a separate patch as those are not subject of that commit.

Quoted 229 lines

Best Regards,

Lisovskiy Stanislav

Quoted 224 lines
---
 Documentation/gpu/kms-properties.csv |  1 +
 drivers/gpu/drm/drm_atomic.c         | 17 ++++++++++
 drivers/gpu/drm/drm_connector.c      | 51 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_edid.c           |  2 ++
 include/drm/drm_connector.h          | 18 ++++++++++
 include/drm/drm_mode_config.h        |  5 +++
 include/uapi/drm/drm_mode.h          |  7 ++++
 7 files changed, 101 insertions(+)
Documentation/gpu/kms-properties.csv +1 -0
index 6b28b014cb7d..a91c9211b8d6 100644
@@ -17,6 +17,7 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
 ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
 ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
 ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
+,Optional,"""content type""",ENUM,"{ ""No data"", ""Graphics"", ""Photo"", ""Cinema"", ""Game"" }",Connector,TBD
 i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
 ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
 ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
drivers/gpu/drm/drm_atomic.c +17 -0
index 7d25c42f22db..479499f5848e 100644
@@ -1266,6 +1266,15 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
                      state->link_status = val;
      } else if (property == config->aspect_ratio_property) {
              state->picture_aspect_ratio = val;
+     } else if (property == config->content_type_property) {
+             /*
+              * Lowest two bits of content_type property control
+              * content_type, bit 2 controls itc bit.
+              * It was decided to have a single property called
+              * content_type, instead of content_type and itc.
+              */
+             state->content_type = val & 3;
+             state->it_content = val >> 2;
      } else if (property == connector->scaling_mode_property) {
              state->scaling_mode = val;
      } else if (property == connector->content_protection_property) {
@@ -1351,6 +1360,14 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
              *val = state->link_status;
      } else if (property == config->aspect_ratio_property) {
              *val = state->picture_aspect_ratio;
+     } else if (property == config->content_type_property) {
+             /*
+              * Lowest two bits of content_type property control
+              * content_type, bit 2 controls itc bit.
+              * It was decided to have a single property called
+              * content_type, instead of content_type and itc.
+              */
+             *val = state->content_type | (state->it_content << 2);
      } else if (property == connector->scaling_mode_property) {
              *val = state->scaling_mode;
      } else if (property == connector->content_protection_property) {
drivers/gpu/drm/drm_connector.c +51 -0
index b3cde897cd80..757a0712f7c1 100644
@@ -720,6 +720,14 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
      { DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
 };
 
+static const struct drm_prop_enum_list drm_content_type_enum_list[] = {
+     { DRM_MODE_CONTENT_TYPE_NO_DATA, "No data" },
+     { DRM_MODE_CONTENT_TYPE_GRAPHICS, "Graphics" },
+     { DRM_MODE_CONTENT_TYPE_PHOTO, "Photo" },
+     { DRM_MODE_CONTENT_TYPE_CINEMA, "Cinema" },
+     { DRM_MODE_CONTENT_TYPE_GAME, "Game" },
+};
+
 static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {
      { DRM_MODE_PANEL_ORIENTATION_NORMAL,    "Normal"        },
      { DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, "Upside Down"   },
@@ -996,6 +1004,22 @@ int drm_mode_create_dvi_i_properties(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_dvi_i_properties);
 
+/**
+ * drm_connector_attach_content_type_property - attach content-type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time a HDMI connector is made.
+ */
+int drm_connector_attach_content_type_property(struct drm_connector *connector)
+{
+     if (!drm_mode_create_content_type_property(connector->dev))
+             drm_object_attach_property(&connector->base,
+                     connector->dev->mode_config.content_type_property,
+                     DRM_MODE_CONTENT_TYPE_NO_DATA);
+     return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_content_type_property);
+
 /**
  * drm_create_tv_properties - create TV specific connector properties
  * @dev: DRM device
@@ -1260,6 +1284,33 @@ int drm_mode_create_aspect_ratio_property(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
 
+/**
+ * drm_mode_create_content_type_property - create content type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time it's needed, must be attached to desired
+ * connectors.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_create_content_type_property(struct drm_device *dev)
+{
+     if (dev->mode_config.content_type_property)
+             return 0;
+
+     dev->mode_config.content_type_property =
+             drm_property_create_enum(dev, 0, "content type",
+                             drm_content_type_enum_list,
+                             ARRAY_SIZE(drm_content_type_enum_list));
+
+     if (dev->mode_config.content_type_property == NULL)
+             return -ENOMEM;
+
+     return 0;
+}
+EXPORT_SYMBOL(drm_mode_create_content_type_property);
+
 /**
  * drm_mode_create_suggested_offset_properties - create suggests offset properties
  * @dev: DRM device
drivers/gpu/drm/drm_edid.c +2 -0
index 134069f36482..b1b7f9683e34 100644
@@ -4867,6 +4867,8 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
      }
 
      frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+     frame->content_type = HDMI_CONTENT_TYPE_GRAPHICS;
+     frame->itc = 0;
 
      /*
       * Populate picture aspect ratio from either
include/drm/drm_connector.h +18 -0
index 675cc3f8cf85..1fedab750f09 100644
@@ -418,6 +418,22 @@ struct drm_connector_state {
       */
      enum hdmi_picture_aspect picture_aspect_ratio;
 
+     /**
+      * @content_type: Connector property to control the
+      * HDMI infoframe content type setting.
+      * The %DRM_MODE_CONTENT_TYPE_\* values lowest 2 bits much
+      * match the values for &enum hdmi_content_type
+      */
+     enum hdmi_content_type content_type;
+
+     /**
+      * @it_content: Connector property to control the
+      * HDMI infoframe it content setting(used with content type).
+      * The %DRM_MODE_CONTENT_TYPE_\* values bit 2
+      * match the values of it_content
+      */
+     bool it_content;
+
      /**
       * @scaling_mode: Connector property to control the
       * upscaling, mostly used for built-in panels.
@@ -1089,11 +1105,13 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
                                unsigned int num_modes,
                                const char * const modes[]);
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
+int drm_connector_attach_content_type_property(struct drm_connector *dev);
 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
                                             u32 scaling_mode_mask);
 int drm_connector_attach_content_protection_property(
              struct drm_connector *connector);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
+int drm_mode_create_content_type_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
 
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
include/drm/drm_mode_config.h +5 -0
index 33b3a96d66d0..fb45839179dd 100644
@@ -726,6 +726,11 @@ struct drm_mode_config {
       * HDMI infoframe aspect ratio setting.
       */
      struct drm_property *aspect_ratio_property;
+     /**
+      * @content_type_property: Optional connector property to control the
+      * HDMI infoframe content type setting.
+      */
+     struct drm_property *content_type_property;
      /**
       * @degamma_lut_property: Optional CRTC property to set the LUT used to
       * convert the framebuffer's colors to linear gamma.
include/uapi/drm/drm_mode.h +7 -1
index 50bcf4214ff9..3c234bfa80b9 100644
@@ -94,6 +94,13 @@ extern "C" {
 #define DRM_MODE_PICTURE_ASPECT_4_3          1
 #define DRM_MODE_PICTURE_ASPECT_16_9         2
 
+/* HDMI content type and itc bit bound together for simplicity */
+#define DRM_MODE_CONTENT_TYPE_NO_DATA                0
+#define DRM_MODE_CONTENT_TYPE_GRAPHICS               4
+#define DRM_MODE_CONTENT_TYPE_PHOTO          5
+#define DRM_MODE_CONTENT_TYPE_CINEMA         6
+#define DRM_MODE_CONTENT_TYPE_GAME           7
+
 /* Aspect ratio flag bitmask (4 bits 22:19) */
 #define DRM_MODE_FLAG_PIC_AR_MASK            (0x0F<<19)
 #define  DRM_MODE_FLAG_PIC_AR_NONE \
--

2.17.0

Quoted 9 lines
Quoted 4 lines

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

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

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

Re: [Intel-gfx] [PATCH v5 1/2] drm: content-type property for HDMI connector

Quoted 27 lines · Stanislav
Quoted 19 lines

This table is seriously deprecated, because it's unreadable and unmaintainable. Quoting from the docs:

"Because this table is very unwieldy, do not add any new properties here. Instead document them in a section above."

We haven't yet moved all the existing properties over to the new layout (patches very much welcome, especially if you spot that an entire area you're touching like HDMI properties isn't moved yet). But the old table is very much not cool to add stuff to.

Sorry that I didn't notice this earlier, missed it in the diffstat.

Quoted 5 lines

as optional.
I think it might be a bit misleading, if I add that one to standard connector properties, there are probably should be created some HDMI specific property chapter then, as there are already plenty of HDMI specific ones(force audio, broadcast rgb, aspect ratio).

Quoted 7 lines
Quoted 2 lines

Shouldn't it then go in a separate patch may be? Because this work is surely needed, however goes a bit out of scope of this patch.

Don't make it worse by adding more unmaintainable and unreadable entries to this table. That's the minimum. Moving all the standard hdmi properties first would obviously be even better. That also makes reviewing easier, since it's clearer what's there already, and how your new thing fits in.

Quoted 4 lines

Ok, then I think I will add a new section called HDMI Specific Connector Properties under Standard Connector Properties and move content type description there. I can add another entries there too, however would prefer to do it in a separate patch as those are not subject of that commit.

Sounds all good.
-Daniel

Quoted 244 lines
Quoted 230 lines

Best Regards,

Lisovskiy Stanislav

Quoted 224 lines
---
 Documentation/gpu/kms-properties.csv |  1 +
 drivers/gpu/drm/drm_atomic.c         | 17 ++++++++++
 drivers/gpu/drm/drm_connector.c      | 51 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_edid.c           |  2 ++
 include/drm/drm_connector.h          | 18 ++++++++++
 include/drm/drm_mode_config.h        |  5 +++
 include/uapi/drm/drm_mode.h          |  7 ++++
 7 files changed, 101 insertions(+)
Documentation/gpu/kms-properties.csv +1 -0
index 6b28b014cb7d..a91c9211b8d6 100644
@@ -17,6 +17,7 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
 ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
 ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
 ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
+,Optional,"""content type""",ENUM,"{ ""No data"", ""Graphics"", ""Photo"", ""Cinema"", ""Game"" }",Connector,TBD
 i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
 ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
 ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
drivers/gpu/drm/drm_atomic.c +17 -0
index 7d25c42f22db..479499f5848e 100644
@@ -1266,6 +1266,15 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
                      state->link_status = val;
      } else if (property == config->aspect_ratio_property) {
              state->picture_aspect_ratio = val;
+     } else if (property == config->content_type_property) {
+             /*
+              * Lowest two bits of content_type property control
+              * content_type, bit 2 controls itc bit.
+              * It was decided to have a single property called
+              * content_type, instead of content_type and itc.
+              */
+             state->content_type = val & 3;
+             state->it_content = val >> 2;
      } else if (property == connector->scaling_mode_property) {
              state->scaling_mode = val;
      } else if (property == connector->content_protection_property) {
@@ -1351,6 +1360,14 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
              *val = state->link_status;
      } else if (property == config->aspect_ratio_property) {
              *val = state->picture_aspect_ratio;
+     } else if (property == config->content_type_property) {
+             /*
+              * Lowest two bits of content_type property control
+              * content_type, bit 2 controls itc bit.
+              * It was decided to have a single property called
+              * content_type, instead of content_type and itc.
+              */
+             *val = state->content_type | (state->it_content << 2);
      } else if (property == connector->scaling_mode_property) {
              *val = state->scaling_mode;
      } else if (property == connector->content_protection_property) {
drivers/gpu/drm/drm_connector.c +51 -0
index b3cde897cd80..757a0712f7c1 100644
@@ -720,6 +720,14 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
      { DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
 };
 
+static const struct drm_prop_enum_list drm_content_type_enum_list[] = {
+     { DRM_MODE_CONTENT_TYPE_NO_DATA, "No data" },
+     { DRM_MODE_CONTENT_TYPE_GRAPHICS, "Graphics" },
+     { DRM_MODE_CONTENT_TYPE_PHOTO, "Photo" },
+     { DRM_MODE_CONTENT_TYPE_CINEMA, "Cinema" },
+     { DRM_MODE_CONTENT_TYPE_GAME, "Game" },
+};
+
 static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {
      { DRM_MODE_PANEL_ORIENTATION_NORMAL,    "Normal"        },
      { DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, "Upside Down"   },
@@ -996,6 +1004,22 @@ int drm_mode_create_dvi_i_properties(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_dvi_i_properties);
 
+/**
+ * drm_connector_attach_content_type_property - attach content-type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time a HDMI connector is made.
+ */
+int drm_connector_attach_content_type_property(struct drm_connector *connector)
+{
+     if (!drm_mode_create_content_type_property(connector->dev))
+             drm_object_attach_property(&connector->base,
+                     connector->dev->mode_config.content_type_property,
+                     DRM_MODE_CONTENT_TYPE_NO_DATA);
+     return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_content_type_property);
+
 /**
  * drm_create_tv_properties - create TV specific connector properties
  * @dev: DRM device
@@ -1260,6 +1284,33 @@ int drm_mode_create_aspect_ratio_property(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
 
+/**
+ * drm_mode_create_content_type_property - create content type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time it's needed, must be attached to desired
+ * connectors.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_create_content_type_property(struct drm_device *dev)
+{
+     if (dev->mode_config.content_type_property)
+             return 0;
+
+     dev->mode_config.content_type_property =
+             drm_property_create_enum(dev, 0, "content type",
+                             drm_content_type_enum_list,
+                             ARRAY_SIZE(drm_content_type_enum_list));
+
+     if (dev->mode_config.content_type_property == NULL)
+             return -ENOMEM;
+
+     return 0;
+}
+EXPORT_SYMBOL(drm_mode_create_content_type_property);
+
 /**
  * drm_mode_create_suggested_offset_properties - create suggests offset properties
  * @dev: DRM device
drivers/gpu/drm/drm_edid.c +2 -0
index 134069f36482..b1b7f9683e34 100644
@@ -4867,6 +4867,8 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
      }
 
      frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+     frame->content_type = HDMI_CONTENT_TYPE_GRAPHICS;
+     frame->itc = 0;
 
      /*
       * Populate picture aspect ratio from either
include/drm/drm_connector.h +18 -0
index 675cc3f8cf85..1fedab750f09 100644
@@ -418,6 +418,22 @@ struct drm_connector_state {
       */
      enum hdmi_picture_aspect picture_aspect_ratio;
 
+     /**
+      * @content_type: Connector property to control the
+      * HDMI infoframe content type setting.
+      * The %DRM_MODE_CONTENT_TYPE_\* values lowest 2 bits much
+      * match the values for &enum hdmi_content_type
+      */
+     enum hdmi_content_type content_type;
+
+     /**
+      * @it_content: Connector property to control the
+      * HDMI infoframe it content setting(used with content type).
+      * The %DRM_MODE_CONTENT_TYPE_\* values bit 2
+      * match the values of it_content
+      */
+     bool it_content;
+
      /**
       * @scaling_mode: Connector property to control the
       * upscaling, mostly used for built-in panels.
@@ -1089,11 +1105,13 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
                                unsigned int num_modes,
                                const char * const modes[]);
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
+int drm_connector_attach_content_type_property(struct drm_connector *dev);
 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
                                             u32 scaling_mode_mask);
 int drm_connector_attach_content_protection_property(
              struct drm_connector *connector);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
+int drm_mode_create_content_type_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
 
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
include/drm/drm_mode_config.h +5 -0
index 33b3a96d66d0..fb45839179dd 100644
@@ -726,6 +726,11 @@ struct drm_mode_config {
       * HDMI infoframe aspect ratio setting.
       */
      struct drm_property *aspect_ratio_property;
+     /**
+      * @content_type_property: Optional connector property to control the
+      * HDMI infoframe content type setting.
+      */
+     struct drm_property *content_type_property;
      /**
       * @degamma_lut_property: Optional CRTC property to set the LUT used to
       * convert the framebuffer's colors to linear gamma.
include/uapi/drm/drm_mode.h +7 -1
index 50bcf4214ff9..3c234bfa80b9 100644
@@ -94,6 +94,13 @@ extern "C" {
 #define DRM_MODE_PICTURE_ASPECT_4_3          1
 #define DRM_MODE_PICTURE_ASPECT_16_9         2
 
+/* HDMI content type and itc bit bound together for simplicity */
+#define DRM_MODE_CONTENT_TYPE_NO_DATA                0
+#define DRM_MODE_CONTENT_TYPE_GRAPHICS               4
+#define DRM_MODE_CONTENT_TYPE_PHOTO          5
+#define DRM_MODE_CONTENT_TYPE_CINEMA         6
+#define DRM_MODE_CONTENT_TYPE_GAME           7
+
 /* Aspect ratio flag bitmask (4 bits 22:19) */
 #define DRM_MODE_FLAG_PIC_AR_MASK            (0x0F<<19)
 #define  DRM_MODE_FLAG_PIC_AR_NONE \
--

2.17.0

Quoted 9 lines
Quoted 4 lines

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

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

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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#8 lore raw

PATCH v5 2/2 i915: content-type property for HDMI connector

In reply to StanLis

From: Stanislav Lisovskiy <[email protected]>

Added encoding of drm content_type property from drm_connector_state within AVI infoframe in order to properly handle external HDMI TV content-type setting.

This requires also manipulationg ITC bit, as stated in HDMI spec.

v2:
* Moved helper function which attaches content type property to the drm core, as was suggested.
Removed redundant connector state initialization.

v3:
* Removed caps in drm_content_type_enum_list.
After some discussion it turned out that HDMI Spec 1.4 was wrongly assuming that IT Content(itc) bit doesn't affect Content type states, however itc bit needs to be manupulated as well. In order to not expose additional property for itc, for sake of simplicity it was decided to bind those together in same "content type" property.

v4:
* Added it_content checking in intel_digital_connector_atomic_check. Fixed documentation for new content type enum.

v5:
* Moved patch revision's description to commit messages.

---
 drivers/gpu/drm/i915/intel_atomic.c | 2 ++
 drivers/gpu/drm/i915/intel_hdmi.c   | 4 ++++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/i915/intel_atomic.c +2 -0
index 40285d1b91b7..96a42eb457c5 100644
@@ -124,6 +124,8 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
 	if (new_conn_state->force_audio != old_conn_state->force_audio ||
 	    new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb ||
 	    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.it_content != old_conn_state->base.it_content ||
 	    new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
 		crtc_state->mode_changed = true;
 
drivers/gpu/drm/i915/intel_hdmi.c +4 -0
index ee929f31f7db..078200908b7a 100644
@@ -491,6 +491,9 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 					   intel_hdmi->rgb_quant_range_selectable,
 					   is_hdmi2_sink);
 
+	frame.avi.content_type = connector->state->content_type;
+	frame.avi.itc = connector->state->it_content;
+
 	/* TODO: handle pixel repetition for YCBCR420 outputs */
 	intel_write_infoframe(encoder, crtc_state, &frame);
 }
@@ -2065,6 +2068,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
 	intel_attach_force_audio_property(connector);
 	intel_attach_broadcast_rgb_property(connector);
 	intel_attach_aspect_ratio_property(connector);
+	drm_connector_attach_content_type_property(connector);
 	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v5 2/2
#9 lore raw

Re: [PATCH v5 2/2] i915: content-type property for HDMI connector

Quoted 23 lines · StanLis

From: Stanislav Lisovskiy <[email protected]>

Added encoding of drm content_type property from drm_connector_state within AVI infoframe in order to properly handle external HDMI TV content-type setting.

This requires also manipulationg ITC bit, as stated in HDMI spec.

v2:
* Moved helper function which attaches content type property to the drm core, as was suggested.
Removed redundant connector state initialization.

v3:
* Removed caps in drm_content_type_enum_list.
After some discussion it turned out that HDMI Spec 1.4 was wrongly assuming that IT Content(itc) bit doesn't affect Content type states, however itc bit needs to be manupulated as well. In order to not expose additional property for itc, for sake of simplicity it was decided to bind those together in same "content type" property.

Quoted 8 lines

v4:
* Added it_content checking in intel_digital_connector_atomic_check. Fixed documentation for new content type enum.

v5:
* Moved patch revision's description to commit messages.

Regards,

Hans

Quoted 34 lines
---
 drivers/gpu/drm/i915/intel_atomic.c | 2 ++
 drivers/gpu/drm/i915/intel_hdmi.c   | 4 ++++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/i915/intel_atomic.c +2 -0
index 40285d1b91b7..96a42eb457c5 100644
@@ -124,6 +124,8 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
 	if (new_conn_state->force_audio != old_conn_state->force_audio ||
 	    new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb ||
 	    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.it_content != old_conn_state->base.it_content ||
 	    new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
 		crtc_state->mode_changed = true;
 
drivers/gpu/drm/i915/intel_hdmi.c +3 -0
index ee929f31f7db..078200908b7a 100644
@@ -491,6 +491,9 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 					   intel_hdmi->rgb_quant_range_selectable,
 					   is_hdmi2_sink);
 
+	frame.avi.content_type = connector->state->content_type;
+	frame.avi.itc = connector->state->it_content;
+
 	/* TODO: handle pixel repetition for YCBCR420 outputs */
 	intel_write_infoframe(encoder, crtc_state, &frame);
 }

drivers/gpu/drm/i915/intel_hdmi.c intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c · line 2074

Quoted 7 lines
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
@@ -2065,6 +2068,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
 	intel_attach_force_audio_property(connector);
 	intel_attach_broadcast_rgb_property(connector);
 	intel_attach_aspect_ratio_property(connector);
+	drm_connector_attach_content_type_property(connector);
 	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 

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

#10 lore raw

✗ Fi.CI.CHECKPATCH: warning for Enabling content-type setting for HDMI displays. (rev4)

In reply to StanLis
== Series Details ==

== Series Details ==

Series: Enabling content-type setting for HDMI displays. (rev4)
URL : https://patchwork.freedesktop.org/series/41876/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
b77a9ab3cc9a drm: content-type property for HDMI connector
-:113: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#113: FILE: drivers/gpu/drm/drm_connector.c:1017:
+		drm_object_attach_property(&connector->base,
+			connector->dev->mode_config.content_type_property,

-:143: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #143: FILE: drivers/gpu/drm/drm_connector.c:1304:
+ drm_property_create_enum(dev, 0, "content type",
+ drm_content_type_enum_list,

-:146: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!dev->mode_config.content_type_property" #146: FILE: drivers/gpu/drm/drm_connector.c:1307:
+ if (dev->mode_config.content_type_property == NULL)

total: 0 errors, 0 warnings, 3 checks, 172 lines checked 674d7cb399e9 i915: content-type property for HDMI connector

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

#11 lore raw

✓ Fi.CI.BAT: success for Enabling content-type setting for HDMI displays. (rev4)

In reply to StanLis
== Series Details ==

== Series Details ==

Series: Enabling content-type setting for HDMI displays. (rev4)
URL : https://patchwork.freedesktop.org/series/41876/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4069 -> Patchwork_8753 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/41876/revisions/4/mbox/

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      fi-ivb-3520m:       PASS -> DMESG-WARN (fdo#106084)

    
    ==== Possible fixes ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      fi-cnl-y3:          DMESG-WARN (fdo#104951) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-ivb-3520m:       DMESG-WARN (fdo#106084) -> PASS

fdo#104951 https://bugs.freedesktop.org/show_bug.cgi?id=104951
fdo#106084 https://bugs.freedesktop.org/show_bug.cgi?id=106084

== Participating hosts (35 -> 31) ==

Missing (4): fi-ctg-p8600 fi-ilk-m540 fi-glk-1 fi-skl-6700hq

== Build changes ==

* Linux: CI_DRM_4069 -> Patchwork_8753

CI_DRM_4069: 8136363fe770a1a51688172d5ba46a5017f76677 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4441: 83ba5b7d3bde48b383df41792fc9c955a5a23bdb @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8753: 674d7cb399e989924e8fcc0dfafb1af895f7171e @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4441: e60d247eb359f044caf0c09904da14e39d7adca1 @ git://anongit.freedesktop.org/piglit

== Linux commits ==

674d7cb399e9 i915: content-type property for HDMI connector b77a9ab3cc9a drm: content-type property for HDMI connector

== Logs ==

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

#12 lore raw

✓ Fi.CI.IGT: success for Enabling content-type setting for HDMI displays. (rev4)

In reply to StanLis
== Series Details ==

== Series Details ==

Series: Enabling content-type setting for HDMI displays. (rev4)
URL : https://patchwork.freedesktop.org/series/41876/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4069_full -> Patchwork_8753_full =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/41876/revisions/4/mbox/

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_flush@basic-wb-set-default:
      shard-glk:          PASS -> FAIL (fdo#105900)

    igt@kms_flip@plain-flip-fb-recreate-interruptible:
      shard-glk:          PASS -> FAIL (fdo#100368)

    igt@kms_sysfs_edid_timing:
      shard-apl:          PASS -> WARN (fdo#100047)

    
    ==== Possible fixes ====

    igt@kms_cursor_legacy@flip-vs-cursor-atomic:
      shard-hsw:          FAIL (fdo#102670) -> PASS

    igt@kms_flip@2x-plain-flip-ts-check-interruptible:
      shard-hsw:          FAIL (fdo#100368) -> PASS +1

    igt@kms_flip@blocking-absolute-wf_vblank-interruptible:
      shard-glk:          FAIL (fdo#106134) -> PASS

    igt@kms_flip@flip-vs-wf_vblank-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS +1

    igt@kms_flip@wf_vblank-ts-check-interruptible:
      shard-glk:          FAIL (fdo#103933) -> PASS

    igt@kms_vblank@pipe-a-accuracy-idle:
      shard-hsw:          FAIL (fdo#102583) -> PASS

fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102583 https://bugs.freedesktop.org/show_bug.cgi?id=102583
fdo#102670 https://bugs.freedesktop.org/show_bug.cgi?id=102670
fdo#103933 https://bugs.freedesktop.org/show_bug.cgi?id=103933
fdo#105900 https://bugs.freedesktop.org/show_bug.cgi?id=105900
fdo#106134 https://bugs.freedesktop.org/show_bug.cgi?id=106134

== Participating hosts (6 -> 4) ==

Missing (2): shard-glkb shard-kbl

== Build changes ==

* Linux: CI_DRM_4069 -> Patchwork_8753

CI_DRM_4069: 8136363fe770a1a51688172d5ba46a5017f76677 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4441: 83ba5b7d3bde48b383df41792fc9c955a5a23bdb @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8753: 674d7cb399e989924e8fcc0dfafb1af895f7171e @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4441: e60d247eb359f044caf0c09904da14e39d7adca1 @ git://anongit.freedesktop.org/piglit

== Logs ==

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