Skip to contentSkip to conversation

drm/i915: Add connector property to limit max bpc

PATCH Superseded Radhakrishna Sripada 2 participants 4 messages Oct 25, 2017

Subsystems (2)

v1 of 14 Superseded Latest is v14 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915: Add connector property to limit max bpc

From: "Sripada, Radhakrishna" <[email protected]>

At times 12bpc HDMI cannot be driven due to faulty cables, dongles level shifters etc. To workaround them we may need to drive the output at a lower bpc. Currently the user space does not have a way to limit the bpc. The default bpc to be programmed is decided by the driver and is run against connector limitations.

Creating a new connector property "max bpc" in order to limit the bpc with which the pixels are scanned out. xrandr can make use of this connector property to make sure that bpc does not exceed the configured value.

---
 drivers/gpu/drm/i915/i915_drv.h     |  1 +
 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  | 19 +++++++++++++++++++
 5 files changed, 30 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 54b5d4c582b6..f74f953d2a7b 100644
@@ -2465,6 +2465,7 @@ struct drm_i915_private {
 
 	struct drm_property *broadcast_rgb_property;
 	struct drm_property *force_audio_property;
+	struct drm_property *max_bpc_property;
 
 	/* hda/i915 audio component */
 	struct i915_audio_component *audio_component;
drivers/gpu/drm/i915/intel_atomic.c +7 -0
index 36d4e635e4ce..d6d836ea1a7f 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->max_bpc_property)
+		*val = intel_conn_state->max_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->max_bpc_property) {
+		intel_conn_state->max_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 47d022d48718..27f497d165d6 100644
@@ -337,6 +337,7 @@ struct intel_digital_connector_state {
 
 	enum hdmi_force_audio force_audio;
 	int broadcast_rgb;
+	int max_bpc;
 };
 
 #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
@@ -1692,6 +1693,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_max_bpc_property(struct drm_connector *connector, int min, int max);
 
 
 /* intel_overlay.c */
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
index 5132dc814788..64d8e0e5e200 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_max_bpc_property(connector, 8, 12);
 	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
drivers/gpu/drm/i915/intel_modes.c +19 -0
index 28a778b785ac..116324b3cc28 100644
@@ -151,3 +151,22 @@ intel_attach_aspect_ratio_property(struct drm_connector *connector)
 			connector->dev->mode_config.aspect_ratio_property,
 			DRM_MODE_PICTURE_ASPECT_NONE);
 }
+
+void
+intel_attach_max_bpc_property(struct drm_connector *connector, int min, int max)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct drm_property *prop;
+
+	prop = dev_priv->max_bpc_property;
+	if (prop == NULL) {
+		prop = drm_property_create_range(dev, 0, "max bpc", min, max);
+		if (prop == NULL)
+			return;
+
+		dev_priv->max_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

PATCH 2/2 drm/i915: Allow "max bpc" property to limit pipe_bpp

From: "Sripada, Radhakrishna" <[email protected]>

Use the newly added "max 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 | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
drivers/gpu/drm/i915/intel_display.c +27 -0
index e2ac976844d8..d3cf68bd4fdc 100644
@@ -10507,6 +10507,28 @@ connected_sink_compute_bpp(struct intel_connector *connector,
 	}
 }
 
+static void
+connected_sink_max_bpp(struct intel_digital_connector_state *intel_conn_state,
+			     struct intel_crtc_state *pipe_config)
+{
+	switch (intel_conn_state->max_bpc) {
+	case 8:
+	case 9:
+		pipe_config->pipe_bpp = 8*3;
+		break;
+	case 10:
+	case 11:
+		pipe_config->pipe_bpp = 10*3;
+		break;
+	case 12:
+		pipe_config->pipe_bpp = 12*3;
+		break;
+	default:
+		break;
+	}
+	DRM_DEBUG_KMS("Limiting display bpp to %d\n", pipe_config->pipe_bpp);
+}
+
 static int
 compute_baseline_pipe_bpp(struct intel_crtc *crtc,
 			  struct intel_crtc_state *pipe_config)
@@ -10515,6 +10537,7 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc,
 	struct drm_atomic_state *state;
 	struct drm_connector *connector;
 	struct drm_connector_state *connector_state;
+	struct intel_digital_connector_state *intel_conn_state;
 	int bpp, i;
 
 	if ((IS_G4X(dev_priv) || IS_VALLEYVIEW(dev_priv) ||
@@ -10535,6 +10558,10 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc,
 		if (connector_state->crtc != &crtc->base)
 			continue;
 
+		intel_conn_state = to_intel_digital_connector_state(connector_state);
+		if (intel_conn_state->max_bpc)
+			connected_sink_max_bpp(intel_conn_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: success for series starting with [1/2] drm/i915: Add connector property to limit max bpc

In reply to Radhakrishna Sripada
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915: Add connector property to limit max bpc
URL : https://patchwork.freedesktop.org/series/32656/
State : success

== Summary ==

Series 32656v1 series starting with [1/2] drm/i915: Add connector property to limit max bpc
https://patchwork.freedesktop.org/api/1.0/series/32656/revisions/1/mbox/

Test chamelium:

        Subgroup dp-crc-fast:
                fail       -> PASS       (fi-kbl-7500u) fdo#102514
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                fail       -> PASS       (fi-skl-6770hq)

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

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:448s
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:262s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:498s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:495s
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:469s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:549s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:607s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:413s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:249s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:579s
fi-glk-dsi       total:289  pass:258  dwarn:0   dfail:0   fail:1   skip:30  time:487s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:433s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:430s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:428s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:500s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:460s
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:568s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:474s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:583s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:448s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:593s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:645s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:520s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:500s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:453s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:557s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:414s

fi-pnv-d510 failed to connect after reboot

be67da218126edb88de92c391a48964c89219c11 drm-tip: 2017y-10m-25d-17h-36m-48s UTC integration manifest 9727b787decc drm/i915: Allow "max bpc" property to limit pipe_bpp
f2a1adf95cec drm/i915: Add connector property to limit max bpc

== Logs ==

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

#3 lore raw

✗ Fi.CI.IGT: failure for series starting with [1/2] drm/i915: Add connector property to limit max bpc

In reply to Radhakrishna Sripada
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915: Add connector property to limit max bpc
URL : https://patchwork.freedesktop.org/series/32656/
State : failure

== Summary ==

Test kms_flip:

        Subgroup plain-flip-fb-recreate-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#100368
Test kms_properties:
        Subgroup connector-properties-legacy:
                pass       -> FAIL       (shard-hsw)
        Subgroup connector-properties-atomic:
                pass       -> FAIL       (shard-hsw)
Test gem_exec_suspend:
        Subgroup basic-S3-devices:
                pass       -> FAIL       (shard-hsw)
        Subgroup basic-S3:
                pass       -> SKIP       (shard-hsw)
Test kms_vblank:
        Subgroup accuracy-idle:
                fail       -> PASS       (shard-hsw) fdo#102583
Test kms_plane:
        Subgroup plane-position-hole-dpms-pipe-B-planes:
                skip       -> PASS       (shard-hsw)
Test kms_busy:
        Subgroup extended-modeset-hang-newfb-with-reset-render-C:
                pass       -> DMESG-WARN (shard-hsw) fdo#102249

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102583 https://bugs.freedesktop.org/show_bug.cgi?id=102583
fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249

shard-hsw total:2540 pass:1428 dwarn:2 dfail:0 fail:12 skip:1098 time:9273s

== Logs ==

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