diff mbox series

[v6,11/13] drm/i915:Enabled Modeset when HDR Infoframe changes

Message ID 1553078906-5991-12-git-send-email-uma.shankar@intel.com (mailing list archive)
State New, archived
Headers show
Series Add HDR Metadata Parsing and handling in DRM layer | expand

Commit Message

Shankar, Uma March 20, 2019, 10:48 a.m. UTC
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(-)

Comments

Sharma, Shashank March 29, 2019, 12:56 p.m. UTC | #1
On 3/20/2019 4:18 PM, Uma Shankar wrote:
> 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(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index b844e88..4ff6042 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -102,6 +102,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)
>   {
> @@ -129,7 +139,10 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
>   	    new_conn_state->base.colorspace != old_conn_state->base.colorspace ||
>   	    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_output_metadata_blob_ptr,
If you are keeping this line ahead of the upper one due to 80 char 
limit, please pull that one also two tabs back, right now this is not 
even looking good.
> +			old_conn_state->base.hdr_output_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 8decafd..4d06734 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -792,6 +792,10 @@ void intel_read_infoframe(struct intel_encoder *encoder,
>   	struct hdr_static_metadata *hdr_metadata;
>   	int ret;
>   
> +	if (!conn_state->hdr_output_metadata_blob_ptr ||
> +	    conn_state->hdr_output_metadata_blob_ptr->length == 0)
> +		return true;
> +

This patch needs a rebase on the latest code, as this is definitely not 
where we want this code :-)

- Shashank

>   	hdr_metadata = (struct hdr_static_metadata *)
>   			conn_state->hdr_output_metadata_blob_ptr->data;
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index b844e88..4ff6042 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -102,6 +102,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)
 {
@@ -129,7 +139,10 @@  int intel_digital_connector_atomic_check(struct drm_connector *conn,
 	    new_conn_state->base.colorspace != old_conn_state->base.colorspace ||
 	    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_output_metadata_blob_ptr,
+			old_conn_state->base.hdr_output_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 8decafd..4d06734 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -792,6 +792,10 @@  void intel_read_infoframe(struct intel_encoder *encoder,
 	struct hdr_static_metadata *hdr_metadata;
 	int ret;
 
+	if (!conn_state->hdr_output_metadata_blob_ptr ||
+	    conn_state->hdr_output_metadata_blob_ptr->length == 0)
+		return true;
+
 	hdr_metadata = (struct hdr_static_metadata *)
 			conn_state->hdr_output_metadata_blob_ptr->data;