[v3,13/14] drm/i915:Enabled Modeset when HDR Infoframe changes

Submitted by Uma Shankar on Dec. 11, 2018, 10:35 p.m.

Details

Message ID 1544567719-15745-14-git-send-email-uma.shankar@intel.com
State New
Headers show
Series "Add HDR Metadata Parsing and handling in DRM layer" ( rev: 3 ) in DRI devel

Commit Message

Uma Shankar Dec. 11, 2018, 10:35 p.m.
This patch enables modeset whenever HDR metadata
needs to be updated to sink.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/intel_atomic.c | 15 ++++++++++++++-
 drivers/gpu/drm/i915/intel_hdmi.c   |  4 ++++
 2 files changed, 18 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index 8cb02f2..72c3fcb 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -101,6 +101,16 @@  int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
 	return -EINVAL;
 }
 
+static bool blob_equal(const struct drm_property_blob *a,
+		       const struct drm_property_blob *b)
+{
+	if (a && b)
+		return a->length == b->length &&
+			!memcmp(a->data, b->data, a->length);
+
+	return !a == !b;
+}
+
 int intel_digital_connector_atomic_check(struct drm_connector *conn,
 					 struct drm_connector_state *new_state)
 {
@@ -127,7 +137,10 @@  int intel_digital_connector_atomic_check(struct drm_connector *conn,
 	    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.scaling_mode != old_conn_state->base.scaling_mode)
+	    new_conn_state->base.scaling_mode !=
+				old_conn_state->base.scaling_mode ||
+	    !blob_equal(new_conn_state->base.hdr_source_metadata_blob_ptr,
+			old_conn_state->base.hdr_source_metadata_blob_ptr))
 		crtc_state->mode_changed = true;
 
 	return 0;
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 8d145d4..414768a 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -491,6 +491,10 @@  static void intel_hdmi_set_drm_infoframe(struct intel_encoder *encoder,
 	struct hdr_static_metadata *hdr_metadata;
 	int ret;
 
+	if (!conn_state->hdr_source_metadata_blob_ptr ||
+		conn_state->hdr_source_metadata_blob_ptr->length == 0)
+		return;
+
 	hdr_metadata = (struct hdr_static_metadata *)
 		conn_state->hdr_source_metadata_blob_ptr->data;