Skip to contentSkip to conversation

drm/i915: Add connector property to force bpc

RFC In review Sripada, Radhakrishna 5 participants 7 messages Oct 18, 2017 – Oct 20, 2017

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

RFC 1/2 drm/i915: Add connector property to force bpc

Currently the user space does not have a way to force the bpc. The default bpc to be programmed is decided by the driver and is run against connector limitations. Creating a new property for the userspace to recommend a certain color depth while scanning out the pixels.

Cc Ville Syrjälä <[email protected]>
Cc Paulo Zanoni <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h     |  7 +++++++
 drivers/gpu/drm/i915/intel_atomic.c |  7 +++++++
 drivers/gpu/drm/i915/intel_drv.h    |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c   |  1 +
 drivers/gpu/drm/i915/intel_modes.c  | 29 +++++++++++++++++++++++++++++
 5 files changed, 46 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +7 -0
index 2783f07c6fc4..e58856f7b08a 100644
@@ -2521,6 +2521,7 @@ struct drm_i915_private {
 
 	struct drm_property *broadcast_rgb_property;
 	struct drm_property *force_audio_property;
+	struct drm_property *force_bpc_property;
 
 	/* hda/i915 audio component */
 	struct i915_audio_component *audio_component;
@@ -2858,6 +2859,12 @@ enum hdmi_force_audio {
 	HDMI_AUDIO_ON,			/* force turn on HDMI audio */
 };
 
+enum connector_force_bpc {
+	INTEL_FORCE_BPC_AUTO,
+	INTEL_FORCE_BPC_8,
+	INTEL_FORCE_BPC_10,
+	INTEL_FORCE_BPC_12,
+};
 #define I915_GTT_OFFSET_NONE ((u32)-1)
 
 /*
drivers/gpu/drm/i915/intel_atomic.c +7 -0
index 36d4e635e4ce..10a74669f49a 100644
@@ -58,6 +58,8 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
 		*val = intel_conn_state->force_audio;
 	else if (property == dev_priv->broadcast_rgb_property)
 		*val = intel_conn_state->broadcast_rgb;
+	else if (property == dev_priv->force_bpc_property)
+		*val = intel_conn_state->force_bpc;
 	else {
 		DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
 		return -EINVAL;
@@ -95,6 +97,11 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
 		return 0;
 	}
 
+	if (property == dev_priv->force_bpc_property) {
+		intel_conn_state->force_bpc = val;
+		return 0;
+	}
+
 	DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
 	return -EINVAL;
 }
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 77117e188b04..654e76d19514 100644
@@ -341,6 +341,7 @@ struct intel_digital_connector_state {
 
 	enum hdmi_force_audio force_audio;
 	int broadcast_rgb;
+	enum connector_force_bpc force_bpc;
 };
 
 #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
@@ -1708,6 +1709,7 @@ int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
 void intel_attach_force_audio_property(struct drm_connector *connector);
 void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
 void intel_attach_aspect_ratio_property(struct drm_connector *connector);
+void intel_attach_force_bpc_property(struct drm_connector *connector);
 
 
 /* intel_overlay.c */
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
index 50214e342401..a2d6d97cc730 100644
@@ -1798,6 +1798,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);
+	intel_attach_force_bpc_property(connector);
 	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
drivers/gpu/drm/i915/intel_modes.c +29 -0
index 28a778b785ac..d7be44a951e8 100644
@@ -151,3 +151,32 @@ intel_attach_aspect_ratio_property(struct drm_connector *connector)
 			connector->dev->mode_config.aspect_ratio_property,
 			DRM_MODE_PICTURE_ASPECT_NONE);
 }
+
+static const struct drm_prop_enum_list force_bpc_names[] = {
+	{ INTEL_FORCE_BPC_AUTO, "Automatic" },
+	{ INTEL_FORCE_BPC_8, "8 bpc" },
+	{ INTEL_FORCE_BPC_10, "10 bpc" },
+	{ INTEL_FORCE_BPC_12, "12 bpc" },
+};
+
+void
+intel_attach_force_bpc_property(struct drm_connector *connector)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct drm_property *prop;
+
+	prop = dev_priv->force_bpc_property;
+	if (prop == NULL) {
+		prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
+					   "bpc",
+					   force_bpc_names,
+					   ARRAY_SIZE(force_bpc_names));
+		if (prop == NULL)
+			return;
+
+		dev_priv->force_bpc_property = prop;
+	}
+
+	drm_object_attach_property(&connector->base, prop, 0);
+}
Signature · 6 lines
2.9.3

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

RFC 2/2 drm/i915: Allow force_bpc property to limit pipe_bpp

Use the newly added force_bpc connector property to limit pipe bpp.

Cc Ville Syrjälä <[email protected]>
Cc Paulo Zanoni <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/i915/intel_display.c +25 -0
index e691c07afd9a..ed8e3f06e605 100644
@@ -10587,6 +10587,29 @@ connected_sink_compute_bpp(struct intel_connector *connector,
 	}
 }
 
+static void
+connected_sink_force_bpp(struct intel_digital_connector_state *intel_conn_state,
+			     struct intel_crtc_state *pipe_config)
+{
+	enum connector_force_bpc force_bpc = intel_conn_state->force_bpc;
+
+	switch (force_bpc) {
+	case INTEL_FORCE_BPC_AUTO:
+		break;
+	case INTEL_FORCE_BPC_8:
+		pipe_config->pipe_bpp = 8*3;
+		break;
+	case INTEL_FORCE_BPC_10:
+		pipe_config->pipe_bpp = 10*3;
+		break;
+	case INTEL_FORCE_BPC_12:
+		pipe_config->pipe_bpp = 12*3;
+		break;
+	default:
+		break;
+	}
+}
+
 static int
 compute_baseline_pipe_bpp(struct intel_crtc *crtc,
 			  struct intel_crtc_state *pipe_config)
@@ -10615,6 +10638,8 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc,
 		if (connector_state->crtc != &crtc->base)
 			continue;
 
+		connected_sink_force_bpp(to_intel_digital_connector_state(connector_state),
+					     pipe_config);
 		connected_sink_compute_bpp(to_intel_connector(connector),
 					   pipe_config);
 	}
Signature · 6 lines
2.9.3

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

✗ Fi.CI.BAT: warning for series starting with [RFC,1/2] drm/i915: Add connector property to force bpc

In reply to Sripada, Radhakrishna
== Series Details ==

== Series Details ==

Series: series starting with [RFC,1/2] drm/i915: Add connector property to force bpc
URL : https://patchwork.freedesktop.org/series/32251/
State : warning

== Summary ==

Series 32251v1 series starting with [RFC,1/2] drm/i915: Add connector property to force bpc
https://patchwork.freedesktop.org/api/1.0/series/32251/revisions/1/mbox/

Test kms_cursor_legacy:

        Subgroup basic-flip-before-cursor-varying-size:
                pass       -> SKIP       (fi-hsw-4770r)
fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:441s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:446s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:375s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:531s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:263s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:496s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:500s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:493s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:472s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:420s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:250s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:579s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:447s
fi-hsw-4770r     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:423s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:437s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:478s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:455s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:489s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:565s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:478s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:578s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:541s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:456s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:644s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:521s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:499s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:461s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:561s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:417s

399dd92e2b42475c3d89e7a2f16b8305e105ed11 drm-tip: 2017y-10m-18d-21h-54m-46s UTC integration manifest fe6f516cb458 drm/i915: Allow force_bpc property to limit pipe_bpp
f4b52adc45dc drm/i915: Add connector property to force bpc

== Logs ==

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

#3 lore raw
In reply to Sripada, Radhakrishna
Quoted 9 lines · Radhakrishna

Currently the user space does not have a way to force the bpc. The default bpc to be programmed is decided by the driver and is run against connector limitations. Creating a new property for the userspace to recommend a certain color depth while scanning out the pixels.

Cc Ville Syrjälä <[email protected]>
Cc Paulo Zanoni <[email protected]>
Cc Manasi Navare <[email protected]>

Why not put this onto the pipe directly? Also, what's the userspace use-case here, we need those patches too.
-Daniel

Quoted 134 lines
---
 drivers/gpu/drm/i915/i915_drv.h     |  7 +++++++
 drivers/gpu/drm/i915/intel_atomic.c |  7 +++++++
 drivers/gpu/drm/i915/intel_drv.h    |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c   |  1 +
 drivers/gpu/drm/i915/intel_modes.c  | 29 +++++++++++++++++++++++++++++
 5 files changed, 46 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +7 -0
index 2783f07c6fc4..e58856f7b08a 100644
@@ -2521,6 +2521,7 @@ struct drm_i915_private {
 
 	struct drm_property *broadcast_rgb_property;
 	struct drm_property *force_audio_property;
+	struct drm_property *force_bpc_property;
 
 	/* hda/i915 audio component */
 	struct i915_audio_component *audio_component;
@@ -2858,6 +2859,12 @@ enum hdmi_force_audio {
 	HDMI_AUDIO_ON,			/* force turn on HDMI audio */
 };
 
+enum connector_force_bpc {
+	INTEL_FORCE_BPC_AUTO,
+	INTEL_FORCE_BPC_8,
+	INTEL_FORCE_BPC_10,
+	INTEL_FORCE_BPC_12,
+};
 #define I915_GTT_OFFSET_NONE ((u32)-1)
 
 /*
drivers/gpu/drm/i915/intel_atomic.c +7 -0
index 36d4e635e4ce..10a74669f49a 100644
@@ -58,6 +58,8 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
 		*val = intel_conn_state->force_audio;
 	else if (property == dev_priv->broadcast_rgb_property)
 		*val = intel_conn_state->broadcast_rgb;
+	else if (property == dev_priv->force_bpc_property)
+		*val = intel_conn_state->force_bpc;
 	else {
 		DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
 		return -EINVAL;
@@ -95,6 +97,11 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
 		return 0;
 	}
 
+	if (property == dev_priv->force_bpc_property) {
+		intel_conn_state->force_bpc = val;
+		return 0;
+	}
+
 	DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
 	return -EINVAL;
 }
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 77117e188b04..654e76d19514 100644
@@ -341,6 +341,7 @@ struct intel_digital_connector_state {
 
 	enum hdmi_force_audio force_audio;
 	int broadcast_rgb;
+	enum connector_force_bpc force_bpc;
 };
 
 #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
@@ -1708,6 +1709,7 @@ int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
 void intel_attach_force_audio_property(struct drm_connector *connector);
 void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
 void intel_attach_aspect_ratio_property(struct drm_connector *connector);
+void intel_attach_force_bpc_property(struct drm_connector *connector);
 
 
 /* intel_overlay.c */
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
index 50214e342401..a2d6d97cc730 100644
@@ -1798,6 +1798,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);
+	intel_attach_force_bpc_property(connector);
 	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
drivers/gpu/drm/i915/intel_modes.c +29 -0
index 28a778b785ac..d7be44a951e8 100644
@@ -151,3 +151,32 @@ intel_attach_aspect_ratio_property(struct drm_connector *connector)
 			connector->dev->mode_config.aspect_ratio_property,
 			DRM_MODE_PICTURE_ASPECT_NONE);
 }
+
+static const struct drm_prop_enum_list force_bpc_names[] = {
+	{ INTEL_FORCE_BPC_AUTO, "Automatic" },
+	{ INTEL_FORCE_BPC_8, "8 bpc" },
+	{ INTEL_FORCE_BPC_10, "10 bpc" },
+	{ INTEL_FORCE_BPC_12, "12 bpc" },
+};
+
+void
+intel_attach_force_bpc_property(struct drm_connector *connector)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct drm_property *prop;
+
+	prop = dev_priv->force_bpc_property;
+	if (prop == NULL) {
+		prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
+					   "bpc",
+					   force_bpc_names,
+					   ARRAY_SIZE(force_bpc_names));
+		if (prop == NULL)
+			return;
+
+		dev_priv->force_bpc_property = prop;
+	}
+
+	drm_object_attach_property(&connector->base, prop, 0);
+}
Signature · 6 lines
2.9.3

_______________________________________________
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
maintainer
#4 lore raw
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · Radhakrishna

Currently the user space does not have a way to force the bpc. The default bpc to be programmed is decided by the driver and is run against connector limitations. Creating a new property for the userspace to recommend a certain color depth while scanning out the pixels.

Quoted 7 lines
Quoted 4 lines
Cc Ville Syrjälä <[email protected]>
Cc Paulo Zanoni <[email protected]>
Cc Manasi Navare <[email protected]>

Why not put this onto the pipe directly? Also, what's the userspace use-case here, we need those patches too.

And rationale in the commit message, please. The "why".

BR,
Jani.

Quoted 136 lines

-Daniel

Quoted 134 lines
---
 drivers/gpu/drm/i915/i915_drv.h     |  7 +++++++
 drivers/gpu/drm/i915/intel_atomic.c |  7 +++++++
 drivers/gpu/drm/i915/intel_drv.h    |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c   |  1 +
 drivers/gpu/drm/i915/intel_modes.c  | 29 +++++++++++++++++++++++++++++
 5 files changed, 46 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +7 -0
index 2783f07c6fc4..e58856f7b08a 100644
@@ -2521,6 +2521,7 @@ struct drm_i915_private {
 
 	struct drm_property *broadcast_rgb_property;
 	struct drm_property *force_audio_property;
+	struct drm_property *force_bpc_property;
 
 	/* hda/i915 audio component */
 	struct i915_audio_component *audio_component;
@@ -2858,6 +2859,12 @@ enum hdmi_force_audio {
 	HDMI_AUDIO_ON,			/* force turn on HDMI audio */
 };
 
+enum connector_force_bpc {
+	INTEL_FORCE_BPC_AUTO,
+	INTEL_FORCE_BPC_8,
+	INTEL_FORCE_BPC_10,
+	INTEL_FORCE_BPC_12,
+};
 #define I915_GTT_OFFSET_NONE ((u32)-1)
 
 /*
drivers/gpu/drm/i915/intel_atomic.c +7 -0
index 36d4e635e4ce..10a74669f49a 100644
@@ -58,6 +58,8 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
 		*val = intel_conn_state->force_audio;
 	else if (property == dev_priv->broadcast_rgb_property)
 		*val = intel_conn_state->broadcast_rgb;
+	else if (property == dev_priv->force_bpc_property)
+		*val = intel_conn_state->force_bpc;
 	else {
 		DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
 		return -EINVAL;
@@ -95,6 +97,11 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
 		return 0;
 	}
 
+	if (property == dev_priv->force_bpc_property) {
+		intel_conn_state->force_bpc = val;
+		return 0;
+	}
+
 	DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
 	return -EINVAL;
 }
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 77117e188b04..654e76d19514 100644
@@ -341,6 +341,7 @@ struct intel_digital_connector_state {
 
 	enum hdmi_force_audio force_audio;
 	int broadcast_rgb;
+	enum connector_force_bpc force_bpc;
 };
 
 #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
@@ -1708,6 +1709,7 @@ int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
 void intel_attach_force_audio_property(struct drm_connector *connector);
 void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
 void intel_attach_aspect_ratio_property(struct drm_connector *connector);
+void intel_attach_force_bpc_property(struct drm_connector *connector);
 
 
 /* intel_overlay.c */
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
index 50214e342401..a2d6d97cc730 100644
@@ -1798,6 +1798,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);
+	intel_attach_force_bpc_property(connector);
 	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
drivers/gpu/drm/i915/intel_modes.c +29 -0
index 28a778b785ac..d7be44a951e8 100644
@@ -151,3 +151,32 @@ intel_attach_aspect_ratio_property(struct drm_connector *connector)
 			connector->dev->mode_config.aspect_ratio_property,
 			DRM_MODE_PICTURE_ASPECT_NONE);
 }
+
+static const struct drm_prop_enum_list force_bpc_names[] = {
+	{ INTEL_FORCE_BPC_AUTO, "Automatic" },
+	{ INTEL_FORCE_BPC_8, "8 bpc" },
+	{ INTEL_FORCE_BPC_10, "10 bpc" },
+	{ INTEL_FORCE_BPC_12, "12 bpc" },
+};
+
+void
+intel_attach_force_bpc_property(struct drm_connector *connector)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct drm_property *prop;
+
+	prop = dev_priv->force_bpc_property;
+	if (prop == NULL) {
+		prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
+					   "bpc",
+					   force_bpc_names,
+					   ARRAY_SIZE(force_bpc_names));
+		if (prop == NULL)
+			return;
+
+		dev_priv->force_bpc_property = prop;
+	}
+
+	drm_object_attach_property(&connector->base, prop, 0);
+}
Signature · 6 lines
2.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 12 lines · Jani Nikula
Quoted 11 lines · Daniel Vetter
Quoted 9 lines · Radhakrishna

Currently the user space does not have a way to force the bpc. The default bpc to be programmed is decided by the driver and is run against connector limitations. Creating a new property for the userspace to recommend a certain color depth while scanning out the pixels.

Cc Ville Syrjälä <[email protected]>
Cc Paulo Zanoni <[email protected]>
Cc Manasi Navare <[email protected]>
Quoted 4 lines
Quoted 2 lines

Why not put this onto the pipe directly? Also, what's the userspace use-case here, we need those patches too.

And rationale in the commit message, please. The "why".

One rationale is cruddy cables/dongles/level shifters/misprogrammed buf translations/etc. which fail when we try to push 12bpc HDMI through them. And to work around those we probably want this to be a connector property so that xrandr will get it automagically. Won't help fbdev of course, but for that we'd either need a modparam, or maybe some generic way to expose properties via sysfs or something.

See eg. https://bugs.freedesktop.org/show_bug.cgi?id=91434 for likely 12bpc issues.

As far as the implementation goes, I'd probably just make it range property ("max bpc" or something like that) with some sane range of values (8-16?, or maybe we need to go lower?), with the default value being the max.

Quoted 149 lines

BR,
Jani.

Quoted 136 lines

-Daniel

Quoted 134 lines
---
 drivers/gpu/drm/i915/i915_drv.h     |  7 +++++++
 drivers/gpu/drm/i915/intel_atomic.c |  7 +++++++
 drivers/gpu/drm/i915/intel_drv.h    |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c   |  1 +
 drivers/gpu/drm/i915/intel_modes.c  | 29 +++++++++++++++++++++++++++++
 5 files changed, 46 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +7 -0
index 2783f07c6fc4..e58856f7b08a 100644
@@ -2521,6 +2521,7 @@ struct drm_i915_private {
 
 	struct drm_property *broadcast_rgb_property;
 	struct drm_property *force_audio_property;
+	struct drm_property *force_bpc_property;
 
 	/* hda/i915 audio component */
 	struct i915_audio_component *audio_component;
@@ -2858,6 +2859,12 @@ enum hdmi_force_audio {
 	HDMI_AUDIO_ON,			/* force turn on HDMI audio */
 };
 
+enum connector_force_bpc {
+	INTEL_FORCE_BPC_AUTO,
+	INTEL_FORCE_BPC_8,
+	INTEL_FORCE_BPC_10,
+	INTEL_FORCE_BPC_12,
+};
 #define I915_GTT_OFFSET_NONE ((u32)-1)
 
 /*
drivers/gpu/drm/i915/intel_atomic.c +7 -0
index 36d4e635e4ce..10a74669f49a 100644
@@ -58,6 +58,8 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
 		*val = intel_conn_state->force_audio;
 	else if (property == dev_priv->broadcast_rgb_property)
 		*val = intel_conn_state->broadcast_rgb;
+	else if (property == dev_priv->force_bpc_property)
+		*val = intel_conn_state->force_bpc;
 	else {
 		DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
 		return -EINVAL;
@@ -95,6 +97,11 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
 		return 0;
 	}
 
+	if (property == dev_priv->force_bpc_property) {
+		intel_conn_state->force_bpc = val;
+		return 0;
+	}
+
 	DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
 	return -EINVAL;
 }
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 77117e188b04..654e76d19514 100644
@@ -341,6 +341,7 @@ struct intel_digital_connector_state {
 
 	enum hdmi_force_audio force_audio;
 	int broadcast_rgb;
+	enum connector_force_bpc force_bpc;
 };
 
 #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
@@ -1708,6 +1709,7 @@ int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
 void intel_attach_force_audio_property(struct drm_connector *connector);
 void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
 void intel_attach_aspect_ratio_property(struct drm_connector *connector);
+void intel_attach_force_bpc_property(struct drm_connector *connector);
 
 
 /* intel_overlay.c */
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
index 50214e342401..a2d6d97cc730 100644
@@ -1798,6 +1798,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);
+	intel_attach_force_bpc_property(connector);
 	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
drivers/gpu/drm/i915/intel_modes.c +29 -0
index 28a778b785ac..d7be44a951e8 100644
@@ -151,3 +151,32 @@ intel_attach_aspect_ratio_property(struct drm_connector *connector)
 			connector->dev->mode_config.aspect_ratio_property,
 			DRM_MODE_PICTURE_ASPECT_NONE);
 }
+
+static const struct drm_prop_enum_list force_bpc_names[] = {
+	{ INTEL_FORCE_BPC_AUTO, "Automatic" },
+	{ INTEL_FORCE_BPC_8, "8 bpc" },
+	{ INTEL_FORCE_BPC_10, "10 bpc" },
+	{ INTEL_FORCE_BPC_12, "12 bpc" },
+};
+
+void
+intel_attach_force_bpc_property(struct drm_connector *connector)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct drm_property *prop;
+
+	prop = dev_priv->force_bpc_property;
+	if (prop == NULL) {
+		prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
+					   "bpc",
+					   force_bpc_names,
+					   ARRAY_SIZE(force_bpc_names));
+		if (prop == NULL)
+			return;
+
+		dev_priv->force_bpc_property = prop;
+	}
+
+	drm_object_attach_property(&connector->base, prop, 0);
+}
Signature · 6 lines
2.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 39 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Thursday, October 19, 2017 7:09 AM
To: Jani Nikula <[email protected]>
Cc: Daniel Vetter <[email protected]>; Sripada, Radhakrishna <[email protected]>; [email protected]; Zanoni, Paulo R <[email protected]>
Subject: Re: [Intel-gfx] [RFC 1/2] drm/i915: Add connector property to force bpc

Quoted 6 lines · Jani Nikula
Quoted 5 lines · Daniel Vetter
Quoted 4 lines · Radhakrishna

Currently the user space does not have a way to force the bpc. The default bpc to be programmed is decided by the driver and is run against connector limitations. Creating a new property for the userspace to recommend a certain color depth while scanning out the

pixels.

Quoted 11 lines
Quoted 9 lines
Quoted 6 lines

Cc: Ville Syrjälä <[email protected]>
Cc: Paulo Zanoni <[email protected]>
Cc: Manasi Navare <[email protected]>
Signed-off-by: Radhakrishna Sripada
<[email protected]>

Why not put this onto the pipe directly? Also, what's the userspace use-case here, we need those patches too.

And rationale in the commit message, please. The "why".

One rationale is cruddy cables/dongles/level shifters/misprogrammed buf translations/etc. which fail when we try to push 12bpc HDMI through them. And to work around those we probably want this to be a connector property so that xrandr will get it automagically. Won't help fbdev of course, but for that we'd either need a modparam, or maybe some generic way to expose properties via sysfs or something.

Quoted 6 lines

See eg. https://bugs.freedesktop.org/show_bug.cgi?id=91434 for likely 12bpc issues.

As far as the implementation goes, I'd probably just make it range property ("max bpc" or something like that) with some sane range of values (8-16?, or maybe we need to go lower?), with the default value being the max.

Thank you for the feedback. I will incorporate the changes in V1 of the patch.

Regards,
Radhakrishna(RK)

Quoted 170 lines
Quoted 25 lines

BR,
Jani.

Quoted 18 lines

-Daniel

Quoted 16 lines
---
 drivers/gpu/drm/i915/i915_drv.h     |  7 +++++++
 drivers/gpu/drm/i915/intel_atomic.c |  7 +++++++
 drivers/gpu/drm/i915/intel_drv.h    |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c   |  1 +
 drivers/gpu/drm/i915/intel_modes.c  | 29
+++++++++++++++++++++++++++++
 5 files changed, 46 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_drv.h index 2783f07c6fc4..e58856f7b08a 100644

drivers/gpu/drm/i915/i915_drv.h +0 -0
@@ -2521,6 +2521,7 @@ struct drm_i915_private {
 
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private {

Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.h +1 -0
 	struct drm_property *broadcast_rgb_property;
 	struct drm_property *force_audio_property;
+	struct drm_property *force_bpc_property;
 
 	/* hda/i915 audio component */
 	struct i915_audio_component *audio_component; @@ -2858,6

+2859,12

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

@@ enum hdmi_force_audio {
HDMI_AUDIO_ON, /* force turn on HDMI audio

*/

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

};

drivers/gpu/drm/i915/i915_drv.h +6 -0
+enum connector_force_bpc {
+	INTEL_FORCE_BPC_AUTO,
+	INTEL_FORCE_BPC_8,
+	INTEL_FORCE_BPC_10,
+	INTEL_FORCE_BPC_12,
+};
 #define I915_GTT_OFFSET_NONE ((u32)-1)
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/i915/intel_atomic.c int

Quoted 7 lines

/*

drivers/gpu/drm/i915/intel_atomic.c +0 -0
index 36d4e635e4ce..10a74669f49a 100644
@@ -58,6 +58,8 @@ int

intel_digital_connector_atomic_get_property(struct drm_connector *connector,

Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/i915/intel_atomic.c int intel_digital_connector_atomic_get_property(struct drm_connector *connector,

Quoted 7 lines
drivers/gpu/drm/i915/intel_atomic.c +2 -0
 		*val = intel_conn_state->force_audio;
 	else if (property == dev_priv->broadcast_rgb_property)
 		*val = intel_conn_state->broadcast_rgb;
+	else if (property == dev_priv->force_bpc_property)
+		*val = intel_conn_state->force_bpc;
 	else {
 		DRM_DEBUG_ATOMIC("Unknown property %s\n",

property->name);

Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/i915/intel_atomic.c int

Quoted 2 lines
drivers/gpu/drm/i915/intel_atomic.c +0 -0
 		return -EINVAL;
@@ -95,6 +97,11 @@ int

intel_digital_connector_atomic_set_property(struct drm_connector *connector,

Quoted 36 lines
Quoted 9 lines

drivers/gpu/drm/i915/intel_atomic.c int intel_digital_connector_atomic_set_property(struct drm_connector *connector,

Quoted 9 lines
drivers/gpu/drm/i915/intel_atomic.c +5 -0
 		return 0;
 	}
 
+	if (property == dev_priv->force_bpc_property) {
+		intel_conn_state->force_bpc = val;
+		return 0;
+	}
+
 	DRM_DEBUG_ATOMIC("Unknown property %s\n", property-

name);

Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/i915/intel_atomic.c +0 -0
 	return -EINVAL;
 }
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 77117e188b04..654e76d19514 100644
@@ -341,6 +341,7 @@ struct intel_digital_connector_state {
 
 	enum hdmi_force_audio force_audio;
 	int broadcast_rgb;
+	enum connector_force_bpc force_bpc;
 };
 
 #define to_intel_digital_connector_state(x) container_of(x, struct

intel_digital_connector_state, base) @@ -1708,6 +1709,7 @@ int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter); void intel_attach_force_audio_property(struct drm_connector *connector); void intel_attach_broadcast_rgb_property(struct drm_connector *connector); void intel_attach_aspect_ratio_property(struct drm_connector *connector);

drivers/gpu/drm/i915/intel_drv.h +2 -0
+void intel_attach_force_bpc_property(struct drm_connector
+*connector);
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/i915/intel_hdmi.c intel_hdmi_add_properties(struct intel_hdmi

Quoted 7 lines

/* intel_overlay.c */

drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index 50214e342401..a2d6d97cc730 100644
@@ -1798,6 +1798,7 @@ intel_hdmi_add_properties(struct intel_hdmi

*intel_hdmi, struct drm_connector *c

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
 	intel_attach_force_audio_property(connector);
 	intel_attach_broadcast_rgb_property(connector);
 	intel_attach_aspect_ratio_property(connector);
+	intel_attach_force_bpc_property(connector);
 	connector->state->picture_aspect_ratio =
 HDMI_PICTURE_ASPECT_NONE;  }
 
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_modes.c intel_attach_aspect_ratio_property(struct

Quoted 6 lines
drivers/gpu/drm/i915/intel_modes.c +0 -0
index 28a778b785ac..d7be44a951e8 100644
@@ -151,3 +151,32 @@ intel_attach_aspect_ratio_property(struct

drm_connector *connector)

Quoted 12 lines
Quoted 1 line

drivers/gpu/drm/i915/intel_modes.c intel_attach_aspect_ratio_property(struct · line 151

Quoted 1 line
drivers/gpu/drm/i915/intel_modes.c +0 -0
 			connector->dev-

mode_config.aspect_ratio_property,

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/i915/intel_modes.c +8 -0
 			DRM_MODE_PICTURE_ASPECT_NONE);
 }
+
+static const struct drm_prop_enum_list force_bpc_names[] = {
+	{ INTEL_FORCE_BPC_AUTO, "Automatic" },
+	{ INTEL_FORCE_BPC_8, "8 bpc" },
+	{ INTEL_FORCE_BPC_10, "10 bpc" },
+	{ INTEL_FORCE_BPC_12, "12 bpc" }, };
+
+void
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/intel_modes.c intel_attach_aspect_ratio_property(struct drm_connector *connector)

Quoted 8 lines
drivers/gpu/drm/i915/intel_modes.c +8 -0
+intel_attach_force_bpc_property(struct drm_connector *connector) {
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct drm_property *prop;
+
+	prop = dev_priv->force_bpc_property;
+	if (prop == NULL) {
+		prop = drm_property_create_enum(dev,

DRM_MODE_PROP_ENUM,

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_modes.c +10 -1
+					   "bpc",
+					   force_bpc_names,
+					   ARRAY_SIZE(force_bpc_names));
+		if (prop == NULL)
+			return;
+
+		dev_priv->force_bpc_property = prop;
+	}
+
+	drm_object_attach_property(&connector->base, prop, 0); }
--

2.9.3

Quoted 11 lines
Quoted 4 lines
Quoted 4 lines

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

--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Quoted 3 lines

--
Ville Syrjälä
Intel OTC

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