dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Uma Shankar <uma.shankar@intel.com>
Cc: ville.syrjala@intel.com, jonas@kwiboo.se,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	seanpaul@chromium.org, dcastagna@chromium.org,
	maarten.lankhorst@intel.com
Subject: Re: [v8 08/10] drm/i915:Enabled Modeset when HDR Infoframe changes
Date: Tue, 7 May 2019 15:01:38 +0300	[thread overview]
Message-ID: <20190507120138.GK24299@intel.com> (raw)
In-Reply-To: <1554828284-17776-9-git-send-email-uma.shankar@intel.com>

On Tue, Apr 09, 2019 at 10:14:42PM +0530, Uma Shankar wrote:
> This patch enables modeset whenever HDR metadata
> needs to be updated to sink.
> 
> v2: Addressed Shashank's review comments.
> 
> v3: Added Shashank's RB.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_atomic.c | 14 +++++++++++++-
>  drivers/gpu/drm/i915/intel_hdmi.c   | 26 ++++++++++++++++++++++++++
>  2 files changed, 39 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index 8c8fae3..e8b5f84 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -104,6 +104,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;
> +}

I have a feeling the memcmp() is overkill. We could just check for
whether the blob is the same or not. If userspace is an idiot and
creates a new blob with identical content so be it.

> +
>  int intel_digital_connector_atomic_check(struct drm_connector *conn,
>  					 struct drm_connector_state *new_state)
>  {
> @@ -131,7 +141,9 @@ 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 0ecfda0..85333a7 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -799,6 +799,20 @@ void intel_read_infoframe(struct intel_encoder *encoder,
>  	return true;
>  }
>  
> +static bool is_eotf_supported(u8 output_eotf, u8 sink_eotf)
> +{
> +	if (output_eotf == 0)
> +		return (sink_eotf & (1 << 0));
> +	if (output_eotf == 1)
> +		return (sink_eotf & (1 << 1));
> +	if (output_eotf == 2)
> +		return (sink_eotf & (1 << 2));
> +	if (output_eotf == 3)
> +		return (sink_eotf & (1 << 3));
> +
> +	return false;

return sink_eotf & BIT(output_eotf);

> +}
> +
>  static bool
>  intel_hdmi_compute_drm_infoframe(struct intel_encoder *encoder,
>  				 struct intel_crtc_state *crtc_state,
> @@ -806,11 +820,23 @@ void intel_read_infoframe(struct intel_encoder *encoder,
>  {
>  	struct hdmi_drm_infoframe *frame = &crtc_state->infoframes.drm.drm;
>  	struct hdr_output_metadata *hdr_metadata;
> +	struct drm_connector *connector = conn_state->connector;
>  	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_output_metadata *)
>  			conn_state->hdr_output_metadata_blob_ptr->data;
>  
> +	/* Sink EOTF is Bit map while infoframe is absolute values */
> +	if (!is_eotf_supported(hdr_metadata->hdmi_metadata_type1.eotf,
> +			       connector->hdr_sink_metadata.hdmi_type1.eotf)) {
> +		DRM_ERROR("EOTF Not Supported\n");
> +		return true;
> +	}
> +
>  	ret = drm_hdmi_infoframe_set_hdr_metadata(frame, hdr_metadata);
>  	if (ret < 0) {
>  		DRM_ERROR("couldn't set HDR metadata in infoframe\n");
> -- 
> 1.9.1

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-05-07 12:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09 16:44 [v8 00/10] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
2019-04-09 16:44 ` [v8 01/10] drm: Add HDR source metadata property Uma Shankar
2019-05-04 10:17   ` Jonas Karlman
2019-05-07  9:03     ` Shankar, Uma
2019-05-07 10:25       ` Ville Syrjälä
2019-05-07 12:10         ` Ville Syrjälä
2019-05-08  9:03           ` Shankar, Uma
2019-05-07 12:07   ` Ville Syrjälä
2019-04-09 16:44 ` [v8 02/10] drm: Parse HDR metadata info from EDID Uma Shankar
2019-05-07 13:32   ` Kazlauskas, Nicholas
2019-04-09 16:44 ` [v8 03/10] drm: Enable HDR infoframe support Uma Shankar
2019-04-09 16:44 ` [v8 04/10] drm/i915: Attach HDR metadata property to connector Uma Shankar
2019-04-09 16:44 ` [v8 05/10] drm/i915: Write HDR infoframe and send to panel Uma Shankar
2019-04-09 16:44 ` [v8 06/10] drm/i915: Add HLG EOTF Uma Shankar
2019-04-09 16:44 ` [v8 07/10] drm/i915: Enable infoframes on GLK+ for HDR Uma Shankar
2019-04-09 16:44 ` [v8 08/10] drm/i915:Enabled Modeset when HDR Infoframe changes Uma Shankar
2019-05-07 12:01   ` Ville Syrjälä [this message]
2019-05-08  9:58     ` Shankar, Uma
2019-04-09 16:44 ` [v8 09/10] drm/i915: Set Infoframe for non modeset case for HDR Uma Shankar
2019-04-09 16:44 ` [v8 10/10] drm/i915: Added DRM Infoframe handling for BYT/CHT Uma Shankar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190507120138.GK24299@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dcastagna@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jonas@kwiboo.se \
    --cc=maarten.lankhorst@intel.com \
    --cc=seanpaul@chromium.org \
    --cc=uma.shankar@intel.com \
    --cc=ville.syrjala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).