Skip to contentSkip to conversation

drm/i915: avoid full modeset when changing the color range properties

PATCH In review Daniel Vetter 3 participants 6 messages Apr 19, 2013 – Apr 23, 2013

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

PATCH 1/1 drm/i915: avoid full modeset when changing the color range properties

Automatic color range selection was added in

commit 55bc60db5988c8366751d3d04dd690698a53412c

Author: Ville Syrjälä <[email protected]>
Date:   Thu Jan 17 16:31:29 2013 +0200

drm/i915: Add "Automatic" mode for the "Broadcast RGB" property

but that removed the check to avoid a full modeset if the value is unchanged. Unfortunately X sets all properties with their current value at start-up, resulting in some ugly flickering which shouldn't be there.

Cc Ville Syrjälä <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c   | 8 ++++++++
 drivers/gpu/drm/i915/intel_hdmi.c | 8 ++++++++
 drivers/gpu/drm/i915/intel_sdvo.c | 8 ++++++++
 3 files changed, 24 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +8 -0
index 50a9d9f..be529da 100644
@@ -2666,6 +2666,9 @@ intel_dp_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_dp->color_range_auto;
+		bool old_range = intel_dp->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_dp->color_range_auto = true;
@@ -2681,6 +2684,11 @@ intel_dp_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_dp->color_range_auto &&
+		    old_range == intel_dp->color_range)
+			return 0;
+
 		goto done;
 	}
 
drivers/gpu/drm/i915/intel_hdmi.c +8 -0
index 3942041..40d5812 100644
@@ -947,6 +947,9 @@ intel_hdmi_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_hdmi->color_range_auto;
+		bool old_range = intel_hdmi->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_hdmi->color_range_auto = true;
@@ -962,6 +965,11 @@ intel_hdmi_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_hdmi->color_range_auto &&
+		    old_range == intel_hdmi->color_range)
+			return 0;
+
 		goto done;
 	}
 
drivers/gpu/drm/i915/intel_sdvo.c +8 -0
index a618a6a..c1f7e0a 100644
@@ -1930,6 +1930,9 @@ intel_sdvo_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_sdvo->color_range_auto;
+		bool old_range = intel_sdvo->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_sdvo->color_range_auto = true;
@@ -1947,6 +1950,11 @@ intel_sdvo_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_sdvo->color_range_auto &&
+		    old_range == intel_sdvo->color_range)
+			return 0;
+
 		goto done;
 	}
 
Signature · 6 lines
1.7.11.7

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 6 lines · Daniel Vetter

Automatic color range selection was added in

commit 55bc60db5988c8366751d3d04dd690698a53412c

Author: Ville Syrjälä <[email protected]>
Date:   Thu Jan 17 16:31:29 2013 +0200
Quoted 6 lines

drm/i915: Add "Automatic" mode for the "Broadcast RGB" property

but that removed the check to avoid a full modeset if the value is unchanged. Unfortunately X sets all properties with their current value at start-up, resulting in some ugly flickering which shouldn't be there.

How silly of me to drop the unchanged check.

Quoted 15 lines
Cc Ville Syrjälä <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c   | 8 ++++++++
 drivers/gpu/drm/i915/intel_hdmi.c | 8 ++++++++
 drivers/gpu/drm/i915/intel_sdvo.c | 8 ++++++++
 3 files changed, 24 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 50a9d9f..be529da 100644

drivers/gpu/drm/i915/intel_dp.c intel_dp_set_property(struct drm_connector *connector, · line 2670

Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
@@ -2666,6 +2666,9 @@ intel_dp_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_dp->color_range_auto;
+		bool old_range = intel_dp->color_range;

This looks like it shouldn't work.

We have these guys:
#define HDMI_COLOR_RANGE_16_235 (1 << 8) /* HDMI only */
#define DP_COLOR_RANGE_16_235 (1 << 8)

When assigned to bool they become true (== 1), and then that gets promoted to uint32_t for the comparison below, so it will never match.

Quoted 70 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_dp->color_range_auto = true;
@@ -2681,6 +2684,11 @@ intel_dp_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_dp->color_range_auto &&
+		    old_range == intel_dp->color_range)
+			return 0;
+
 		goto done;
 	}
 
drivers/gpu/drm/i915/intel_hdmi.c +8 -0
index 3942041..40d5812 100644
@@ -947,6 +947,9 @@ intel_hdmi_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_hdmi->color_range_auto;
+		bool old_range = intel_hdmi->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_hdmi->color_range_auto = true;
@@ -962,6 +965,11 @@ intel_hdmi_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_hdmi->color_range_auto &&
+		    old_range == intel_hdmi->color_range)
+			return 0;
+
 		goto done;
 	}
 
drivers/gpu/drm/i915/intel_sdvo.c +8 -0
index a618a6a..c1f7e0a 100644
@@ -1930,6 +1930,9 @@ intel_sdvo_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_sdvo->color_range_auto;
+		bool old_range = intel_sdvo->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_sdvo->color_range_auto = true;
@@ -1947,6 +1950,11 @@ intel_sdvo_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_sdvo->color_range_auto &&
+		    old_range == intel_sdvo->color_range)
+			return 0;
+
 		goto done;
 	}
 
Signature · 1 line
1.7.11.7
Signature · 2 lines
Ville Syrjälä
Intel OTC
#2 lore raw

PATCH 1/1 drm/i915: avoid full modeset when changing the color range properties

Automatic color range selection was added in

commit 55bc60db5988c8366751d3d04dd690698a53412c

Author: Ville Syrjälä <[email protected]>
Date:   Thu Jan 17 16:31:29 2013 +0200

drm/i915: Add "Automatic" mode for the "Broadcast RGB" property

but that removed the check to avoid a full modeset if the value is unchanged. Unfortunately X sets all properties with their current value at start-up, resulting in some ugly flickering which shouldn't be there.

v2: Change old_range from bool to uint32_t, spotted by Ville.

Cc Ville Syrjälä <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c   | 8 ++++++++
 drivers/gpu/drm/i915/intel_hdmi.c | 8 ++++++++
 drivers/gpu/drm/i915/intel_sdvo.c | 8 ++++++++
 3 files changed, 24 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +8 -0
index 97edbb2..994a05d 100644
@@ -2649,6 +2649,9 @@ intel_dp_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_dp->color_range_auto;
+		uint32_t old_range = intel_dp->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_dp->color_range_auto = true;
@@ -2664,6 +2667,11 @@ intel_dp_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_dp->color_range_auto &&
+		    old_range == intel_dp->color_range)
+			return 0;
+
 		goto done;
 	}
 
drivers/gpu/drm/i915/intel_hdmi.c +8 -0
index 3942041..4dca486 100644
@@ -947,6 +947,9 @@ intel_hdmi_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_hdmi->color_range_auto;
+		uint32_t old_range = intel_hdmi->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_hdmi->color_range_auto = true;
@@ -962,6 +965,11 @@ intel_hdmi_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_hdmi->color_range_auto &&
+		    old_range == intel_hdmi->color_range)
+			return 0;
+
 		goto done;
 	}
 
drivers/gpu/drm/i915/intel_sdvo.c +8 -0
index a618a6a..c1f7e0a 100644
@@ -1930,6 +1930,9 @@ intel_sdvo_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_sdvo->color_range_auto;
+		bool old_range = intel_sdvo->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_sdvo->color_range_auto = true;
@@ -1947,6 +1950,11 @@ intel_sdvo_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_sdvo->color_range_auto &&
+		    old_range == intel_sdvo->color_range)
+			return 0;
+
 		goto done;
 	}
 
Signature · 6 lines
1.7.11.7

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

PATCH 1/1 drm/i915: avoid full modeset when changing the color range properties

In reply to Ville Syrjälä

Automatic color range selection was added in

commit 55bc60db5988c8366751d3d04dd690698a53412c

Author: Ville Syrjälä <[email protected]>
Date:   Thu Jan 17 16:31:29 2013 +0200

drm/i915: Add "Automatic" mode for the "Broadcast RGB" property

but that removed the check to avoid a full modeset if the value is unchanged. Unfortunately X sets all properties with their current value at start-up, resulting in some ugly flickering which shouldn't be there.

v2: Change old_range from bool to uint32_t, spotted by Ville.

v3: Actually git add everything ;-)

Cc Ville Syrjälä <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c   | 8 ++++++++
 drivers/gpu/drm/i915/intel_hdmi.c | 8 ++++++++
 drivers/gpu/drm/i915/intel_sdvo.c | 8 ++++++++
 3 files changed, 24 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +8 -0
index 97edbb2..994a05d 100644
@@ -2649,6 +2649,9 @@ intel_dp_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_dp->color_range_auto;
+		uint32_t old_range = intel_dp->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_dp->color_range_auto = true;
@@ -2664,6 +2667,11 @@ intel_dp_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_dp->color_range_auto &&
+		    old_range == intel_dp->color_range)
+			return 0;
+
 		goto done;
 	}
 
drivers/gpu/drm/i915/intel_hdmi.c +8 -0
index 3942041..4dca486 100644
@@ -947,6 +947,9 @@ intel_hdmi_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_hdmi->color_range_auto;
+		uint32_t old_range = intel_hdmi->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_hdmi->color_range_auto = true;
@@ -962,6 +965,11 @@ intel_hdmi_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_hdmi->color_range_auto &&
+		    old_range == intel_hdmi->color_range)
+			return 0;
+
 		goto done;
 	}
 
drivers/gpu/drm/i915/intel_sdvo.c +8 -0
index a618a6a..d154284 100644
@@ -1930,6 +1930,9 @@ intel_sdvo_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_sdvo->color_range_auto;
+		uint32_t old_range = intel_sdvo->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_sdvo->color_range_auto = true;
@@ -1947,6 +1950,11 @@ intel_sdvo_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_sdvo->color_range_auto &&
+		    old_range == intel_sdvo->color_range)
+			return 0;
+
 		goto done;
 	}
 
Signature · 6 lines
1.7.11.7

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#4 lore raw
Quoted 13 lines · Daniel Vetter

Automatic color range selection was added in

commit 55bc60db5988c8366751d3d04dd690698a53412c

Author: Ville Syrjälä <[email protected]>
Date:   Thu Jan 17 16:31:29 2013 +0200

drm/i915: Add "Automatic" mode for the "Broadcast RGB" property

but that removed the check to avoid a full modeset if the value is unchanged. Unfortunately X sets all properties with their current value at start-up, resulting in some ugly flickering which shouldn't be there.

Quoted 7 lines

v2: Change old_range from bool to uint32_t, spotted by Ville.

v3: Actually git add everything ;-)

Cc Ville Syrjälä <[email protected]>
Cc Paulo Zanoni <[email protected]>
Quoted 86 lines
---
 drivers/gpu/drm/i915/intel_dp.c   | 8 ++++++++
 drivers/gpu/drm/i915/intel_hdmi.c | 8 ++++++++
 drivers/gpu/drm/i915/intel_sdvo.c | 8 ++++++++
 3 files changed, 24 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +8 -0
index 97edbb2..994a05d 100644
@@ -2649,6 +2649,9 @@ intel_dp_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_dp->color_range_auto;
+		uint32_t old_range = intel_dp->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_dp->color_range_auto = true;
@@ -2664,6 +2667,11 @@ intel_dp_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_dp->color_range_auto &&
+		    old_range == intel_dp->color_range)
+			return 0;
+
 		goto done;
 	}
 
drivers/gpu/drm/i915/intel_hdmi.c +8 -0
index 3942041..4dca486 100644
@@ -947,6 +947,9 @@ intel_hdmi_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_hdmi->color_range_auto;
+		uint32_t old_range = intel_hdmi->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_hdmi->color_range_auto = true;
@@ -962,6 +965,11 @@ intel_hdmi_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_hdmi->color_range_auto &&
+		    old_range == intel_hdmi->color_range)
+			return 0;
+
 		goto done;
 	}
 
drivers/gpu/drm/i915/intel_sdvo.c +8 -0
index a618a6a..d154284 100644
@@ -1930,6 +1930,9 @@ intel_sdvo_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
+		bool old_auto = intel_sdvo->color_range_auto;
+		uint32_t old_range = intel_sdvo->color_range;
+
 		switch (val) {
 		case INTEL_BROADCAST_RGB_AUTO:
 			intel_sdvo->color_range_auto = true;
@@ -1947,6 +1950,11 @@ intel_sdvo_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+
+		if (old_auto == intel_sdvo->color_range_auto &&
+		    old_range == intel_sdvo->color_range)
+			return 0;
+
 		goto done;
 	}
 
Signature · 1 line
1.7.11.7
Signature · 2 lines
Ville Syrjälä
Intel OTC
#5 lore raw
Quoted 16 lines · Ville Syrjälä
Quoted 15 lines · Daniel Vetter

Automatic color range selection was added in

commit 55bc60db5988c8366751d3d04dd690698a53412c

Author: Ville Syrjälä <[email protected]>
Date:   Thu Jan 17 16:31:29 2013 +0200

drm/i915: Add "Automatic" mode for the "Broadcast RGB" property

but that removed the check to avoid a full modeset if the value is unchanged. Unfortunately X sets all properties with their current value at start-up, resulting in some ugly flickering which shouldn't be there.

v2: Change old_range from bool to uint32_t, spotted by Ville.

Quoted 7 lines
Quoted 5 lines

v3: Actually git add everything ;-)

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

Picked up for -fixes, thanks for the review.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch