[PATCH v2.1 3/3] drm/edid: Switch DDC when reading the EDID
Thierry Reding
thierry.reding at gmail.com
Mon Aug 17 03:41:32 PDT 2015
On Fri, Aug 14, 2015 at 06:28:35PM +0200, Lukas Wunner wrote:
> Originally by Seth Forshee <seth.forshee at canonical.com>, 2012-10-04:
> Some dual graphics machines support muxing the DDC separately from the
> display, so make use of this functionality when reading the EDID on the
> inactive GPU. Also serialize drm_get_edid() with a mutex to avoid races
> on the DDC mux state.
>
> Modified by Dave Airlie <airlied at gmail.com>, 2012-12-22:
> I can't figure out why I didn't like this, but I rewrote this [...] to
> lock/unlock the ddc lines [...]. I think I'd prefer something like that
> otherwise the interface got really ugly.
>
> Modified by Lukas Wunner <lukas at wunner.de>, 2015-03-27:
> Unlock DDC lines if drm_probe_ddc() fails.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88861
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61115
> Tested-by: Pierre Moreau <pierre.morrow at free.fr>
> [MBP 5,3 2009 nvidia 9400M + 9600M GT pre-retina]
> Tested-by: Paul Hordiienko <pvt.gord at gmail.com>
> [MBP 6,2 2010 intel ILK + nvidia GT216 pre-retina]
> Tested-by: William Brown <william at blackhats.net.au>
> [MBP 8,2 2011 intel SNB + amd turks pre-retina]
> Tested-by: Lukas Wunner <lukas at wunner.de>
> [MBP 9,1 2012 intel IVB + nvidia GK107 pre-retina]
> Tested-by: Bruno Bierbaumer <bruno at bierbaumer.net>
> [MBP 11,3 2013 intel HSW + nvidia GK107 retina -- work in progress]
>
> Cc: Seth Forshee <seth.forshee at canonical.com>
> Cc: Dave Airlie <airlied at gmail.com>
> Signed-off-by: Lukas Wunner <lukas at wunner.de>
> ---
> drivers/gpu/drm/drm_edid.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index e6e05bb..cdb2fa1 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -32,6 +32,7 @@
> #include <linux/hdmi.h>
> #include <linux/i2c.h>
> #include <linux/module.h>
> +#include <linux/vga_switcheroo.h>
> #include <drm/drmP.h>
> #include <drm/drm_edid.h>
> #include <drm/drm_displayid.h>
> @@ -1377,13 +1378,21 @@ struct edid *drm_get_edid(struct drm_connector *connector,
> struct i2c_adapter *adapter)
> {
> struct edid *edid;
> + struct pci_dev *pdev = connector->dev->pdev;
>
> - if (!drm_probe_ddc(adapter))
> + vga_switcheroo_lock_ddc(pdev);
> +
> + if (!drm_probe_ddc(adapter)) {
> + vga_switcheroo_unlock_ddc(pdev);
> return NULL;
> + }
>
> edid = drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter);
> if (edid)
> drm_get_displayid(connector, edid);
> +
> + vga_switcheroo_unlock_ddc(pdev);
> +
> return edid;
> }
> EXPORT_SYMBOL(drm_get_edid);
I think this is backwards and it'd be more explicit (though I suspect
slightly more work for this patch) to add a separate helper that does
the VGA switcheroo wrapping rather than have this in drm_get_edid()
where essentially every driver will go through the motions even if it
doesn't remotely support switcheroo.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150817/02a0ebe2/attachment.sig>
More information about the dri-devel
mailing list