intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Marius Vlad <marius.c.vlad@intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Support HDMI EDID injection
Date: Tue, 2 Feb 2016 18:00:03 +0200	[thread overview]
Message-ID: <20160202160002.GA10873@mcvlad-wk.rb.intel.com> (raw)
In-Reply-To: <87h9hr2kmy.fsf@intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 2686 bytes --]

On Tue, Feb 02, 2016 at 05:32:21PM +0200, Jani Nikula wrote:
> On Tue, 02 Feb 2016, Marius Vlad <marius.c.vlad@intel.com> wrote:
> > Use the drm_property_blob data for user-supplied EDID blobs.
> >
> > Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_hdmi.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> > index 8698a64..a10f3d9 100644
> > --- a/drivers/gpu/drm/i915/intel_hdmi.c
> > +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> > @@ -1336,7 +1336,8 @@ intel_hdmi_unset_edid(struct drm_connector *connector)
> >  	intel_hdmi->has_audio = false;
> >  	intel_hdmi->rgb_quant_range_selectable = false;
> >  
> > -	kfree(to_intel_connector(connector)->detect_edid);
> > +	if (!connector->override_edid)
> > +		kfree(to_intel_connector(connector)->detect_edid);
> >  	to_intel_connector(connector)->detect_edid = NULL;
> >  }
> >  
> > @@ -1355,6 +1356,9 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
> >  				    intel_gmbus_get_adapter(dev_priv,
> >  				    intel_hdmi->ddc_bus));
> >  
> > +		if (!edid && connector->override_edid)
> > +			edid = (struct edid *) connector->edid_blob_ptr->data;
> > +
> 
> If the user goes on to update the edid by hand, ->detect_edid will end
> up pointing at released memory. You should probably kmemdup the edid
> (like some other drivers do, git grep for edid_blob_ptr), even though
> that will lead to using a stale edid until intel_hdmi_set_edid is called
> again.

My initial approach was doing just that. Then I noticed I might get away
without doing any kind of allocations. I've some tests that work
both ways.

In intel_hdmi_unset_edid(), kfree(detect_edid) is only called when
connector->override_edid is not set, in this way it won't deallocate
random data.

> 
> The other question is, why do you base the decision to use override edid
> on whether we can get the actual edid or not?

In case edid is not set (failed to communicate with the display) and
the override_edid is set (which is set by edid_write() in drm_debugfs()
meaing a user supplied a EDID blob) I can assume that the user
did injected a HDMI EDID, and use data from drm_property_blob.

Seems to be the only place before looking for CEA extensions in HDMI
supplied EDID.

> 
> /me thinks this is all really messy at the drm level, including the
> handling of edid firmware.
> 
> BR,
> Jani.
> 
> 
> 
> >  		intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
> >  	}
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-02-03 16:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 13:01 [PATCH] drm/i915: Support HDMI EDID injection Marius Vlad
2016-02-02 13:18 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-02-02 15:32 ` [PATCH] " Jani Nikula
2016-02-02 16:00   ` Marius Vlad [this message]
2016-02-03 16:49 ` [PATCH v2] " Marius Vlad
2016-02-03 17:15 ` ✗ Fi.CI.BAT: warning for drm/i915: Support HDMI EDID injection (rev2) Patchwork
     [not found] <1454344533-30325-1-git-send-email-marius.c.vlad@intel.com>
2016-02-11  9:07 ` [PATCH] drm/i915: Support HDMI EDID injection Daniel Vetter
     [not found] <1454411107-30206-1-git-send-email-marius.c.vlad@intel.com>
2016-02-11  9:09 ` Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2017-02-16  6:43 Abdiel Janulgue
2017-02-16 10:39 ` Jani Nikula

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=20160202160002.GA10873@mcvlad-wk.rb.intel.com \
    --to=marius.c.vlad@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.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).