Skip to contentSkip to conversation

drm: add broadcast rgb connector property for digital outputs

RFC PATCH New Russell King 1 participant 1 message Jul 4, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 drm: add broadcast rgb connector property for digital outputs

Add core DRM support for the i915 "Broadcast RGB" property, which controls the selection of the RGB quantization range in the digital domain. For 8bpc, this selects between limited (16 to 235), full (0 to 255) range, or automatically select depending on the mode.

---
As described in the commit description, this is modelled on the i915 property, and uses exactly the same strings as the i915 version.

Some discussion points:

1. do we wish to call the additional structure members "broadcast_rgb" or would "rgb_quantization_range" be more appropriate for what it is?

2. should drm_connector_create_broadcast_rgb_property() create the mode_config property when required and attach it to the connector, or should drm_connector_create_standard_properties() create the property, and have drm_connector_attach_broadcast_rgb_property() attach it to the connector instead?

3. should we pass a bitmask of the supported types in the same way that the YCbCr properties do and create per-connector properties?

 drivers/gpu/drm/drm_atomic.c        |  6 ++++
 drivers/gpu/drm/drm_atomic_helper.c |  4 ++-
 drivers/gpu/drm/drm_color_mgmt.c    | 62 +++++++++++++++++++++++++++++++++++++
 include/drm/drm_connector.h         | 27 ++++++++++++++++
 include/drm/drm_mode_config.h       |  7 +++++
 5 files changed, 105 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic.c +6 -0
index d5cefb1cb2a2..4aa9ddb84aad 100644
@@ -1415,6 +1415,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 
 		return set_out_fence_for_connector(state->state, connector,
 						   fence_ptr);
+	} else if (property == config->broadcast_rgb_property) {
+		state->broadcast_rgb = val;
 	} else if (connector->funcs->atomic_set_property) {
 		return connector->funcs->atomic_set_property(connector,
 				state, property, val);
@@ -1435,6 +1437,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, "\tbroadcast_rgb=%s\n",
+		   drm_get_broadcast_rgb_name(state->broadcast_rgb));
 
 	if (connector->funcs->atomic_print_state)
 		connector->funcs->atomic_print_state(p, state);
@@ -1506,6 +1510,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
 		*val = 0;
 	} else if (property == config->writeback_out_fence_ptr_property) {
 		*val = 0;
+	} else if (property == config->broadcast_rgb_property) {
+		*val = state->broadcast_rgb;
 	} else if (connector->funcs->atomic_get_property) {
 		return connector->funcs->atomic_get_property(connector,
 				state, property, val);
drivers/gpu/drm/drm_atomic_helper.c +3 -1
index 8008a7de2e10..5540e99923fb 100644
@@ -3630,8 +3630,10 @@ void
 __drm_atomic_helper_connector_reset(struct drm_connector *connector,
 				    struct drm_connector_state *conn_state)
 {
-	if (conn_state)
+	if (conn_state) {
 		conn_state->connector = connector;
+		conn_state->broadcast_rgb = DRM_BROADCAST_RGB_AUTO;
+	}
 
 	connector->state = conn_state;
 }
drivers/gpu/drm/drm_color_mgmt.c +62 -0

71 lines not on this page · raw message

include/drm/drm_connector.h +27 -0
index bf0f0f0786d3..70458c2bf4b0 100644
@@ -206,6 +206,23 @@ enum drm_panel_orientation {
 };
 
 /**
+ * enum drm_broadcast_rgb_mode - broadcast (output) rgb range
+ *
+ * For digital outputs, this enum describes the quantization range of RGB
+ * values to be supplied to the connected sink.
+ *
+ * DRM_BROADCAST_RGB_AUTO:    Automatically select, according to the display
+ *			      mode, limited or full quantization range.
+ * DRM_BROADCAST_RGB_FULL:    Full (eg, 0 to 255) quantization range RGB.
+ * DRM_BROADCAST_RGB_LIMITED: Limited (eg, 16 to 235) quantization range RGB.
+ */
+enum drm_broadcast_rgb_mode {
+	DRM_BROADCAST_RGB_AUTO,
+	DRM_BROADCAST_RGB_FULL,
+	DRM_BROADCAST_RGB_LIMITED,
+};
+
+/**
  * struct drm_display_info - runtime data about the connected sink
  *
  * Describes a given display (e.g. CRT or flat panel) and its limitations. For
@@ -450,6 +467,12 @@ struct drm_connector_state {
 	 * drm_writeback_signal_completion()
 	 */
 	struct drm_writeback_job *writeback_job;
+
+	/**
+	 * @broadcast_rgb: Connector property to control the RGB
+	 * quantization range.
+	 */
+	enum drm_broadcast_rgb_mode broadcast_rgb;
 };
 
 /**
@@ -1114,6 +1137,8 @@ const char *drm_get_dvi_i_select_name(int val);
 const char *drm_get_tv_subconnector_name(int val);
 const char *drm_get_tv_select_name(int val);
 const char *drm_get_content_protection_name(int val);
+const char *drm_get_broadcast_rgb_name(enum drm_broadcast_rgb_mode mode);
+
 
 int drm_mode_create_dvi_i_properties(struct drm_device *dev);
 int drm_mode_create_tv_properties(struct drm_device *dev,
@@ -1131,6 +1156,8 @@ void drm_hdmi_avi_infoframe_content_type(struct hdmi_avi_infoframe *frame,
 					 const struct drm_connector_state *conn_state);
 
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
+int drm_connector_create_broadcast_rgb_property(struct drm_connector *connector,
+					enum drm_broadcast_rgb_mode mode);
 
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
 					 const char *path);
include/drm/drm_mode_config.h +7 -0
index a0b202e1d69a..609922529368 100644
@@ -807,6 +807,13 @@ struct drm_mode_config {
 	 */
 	struct drm_property *writeback_out_fence_ptr_property;
 
+	/**
+	 * @broadcast_rgb_property: Optional connector property indicating
+	 * whether the output RGB should be automatically selected, limited
+	 * range (16-235) or full range (0-255).
+	 */
+	struct drm_property *broadcast_rgb_property;
+
 	/* dumb ioctl parameters */
 	uint32_t preferred_depth, prefer_shadow;
 
Signature · 6 lines
2.7.4

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