dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Lukas Wunner <lukas@wunner.de>
Cc: Daniel Dadap <ddadap@nvidia.com>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: How to handle disconnection of eDP panels due to dynamic display mux switches
Date: Thu, 2 Apr 2020 16:40:34 +0200	[thread overview]
Message-ID: <CAKMK7uHVh=Kra_T0niHQZcHLgfJY+WuqNmq68dVkczfChwqBHQ@mail.gmail.com> (raw)
In-Reply-To: <20200402143117.qabod72gn3p6yft3@wunner.de>

On Thu, Apr 2, 2020 at 4:31 PM Lukas Wunner <lukas@wunner.de> wrote:
>
> On Thu, Apr 02, 2020 at 03:13:26PM +0200, Daniel Vetter wrote:
> > On Thu, Apr 2, 2020 at 2:58 PM Pekka Paalanen <ppaalanen@gmail.com> wrote:
> > > On Thu, 2 Apr 2020 13:39:25 +0200 Lukas Wunner <lukas@wunner.de> wrote:
> > > > Note that vga_switcheroo is currently controlled via debugfs.
> > > > That is a historic artefact.  The kernel has since gained a
> > > > mux subsystem in drivers/mux/ which could be used to represent
> > > > the display mux in a standardized way in regular sysfs.
> > >
> > > if mux control was in sysfs, then how would userspace figure out
> > > which mux state refers to which DRM device and its connector?
> > >
> > > Maybe some DRM connector property referring to the mux and its state?
> > >
> > > How would a display server running as a regular user gain access to
> > > sysfs to control the mux?
> >
> > I think a sysfs interface for vgaswitcheroo would need some kind of
> > links from drm_device (and for the outpu-only mux from drm_connector
> > sysfs files) to the corresponding sysfs directory for the
> > vgaswitcheroo switch.
>
> Yes, that would be one way to do it.
>
>
> > But actual change of state needs to indeed be done through some other
> > interface, since sysfs interfaces suck for compositors. We have this
> > problem already with backlight, and the solution there is a special
> > backlight frobbing services which compositors can call through udev,
> > and fun stuff like that. Definitely not an uapi pattern we want to
> > repeat. So I think sysfs would be only for information links, and
> > maybe the global switch for the old optimus designs where you can only
> > switch the entire gpu, and need to delay the switch until all existing
> > clients are closed. Aka 1) stop compositor 2) write to sysfs 3) start
> > new compositor on new gpu. For that case compositors don't need to
> > ever write to sysfs themselves, so I think that's ok. Also only
> > relevant for rather old hw.
>
> There's an in-kernel interface in <linux/mux/consumer.h> which
> could be invoked from, say, an ioctl(), to control or query the
> mux.
>
> I'm not really prepared to answer detailed questions how it should
> be done, my point is just that the existing building blocks (such
> as the mux subsystem) should be used instead of reinventing the
> wheel.  If the mux subsystem lacks specific features needed for
> graphics muxes, I think adding them won't face much opposition
> from Peter Rosin.

I guess if someone is bored they could port the internal vgaswitcheroo
mux drivers over to that mux subsystem. But we'll still need some
amount of graphics specific glue, and that seems perfectly reasonable
to have in vgaswitcheroo.c. That stuff isn't about a mux, but the
hand-off between the involved gpu (and audio) drivers, to me it
doesn't make sense to push all these kind of interactions into a
generic mux subsystem.

That also applies to the extensions discussed here to better handle
per-output muxing between drivers (like the self refresh trick for
seamless muxing). That's all graphics, and in practice already
possible with the hw vgaswitcheroo supports today (apple does that
already in macos). No change on the mux driver side needed at all I
think.

so tldr I guess if you want add a todo entry to look into porting
vgaswitcheroo drivers to the mux framework. But imo that would be
orthogonal to what we're discussing here.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-04-02 14:40 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 21:25 How to handle disconnection of eDP panels due to dynamic display mux switches Daniel Dadap
2020-03-30 15:11 ` Jani Nikula
2020-04-01  1:59   ` Daniel Dadap
2020-04-01  8:14     ` Pekka Paalanen
2020-04-01 19:15       ` Daniel Dadap
2020-04-01  8:24     ` Jani Nikula
2020-03-31  7:32 ` Daniel Vetter
2020-04-01  1:59   ` Daniel Dadap
2020-04-01  6:46     ` Daniel Vetter
2020-04-01 19:21       ` Daniel Dadap
2020-04-02 12:00         ` Daniel Stone
2020-04-02 11:39 ` Lukas Wunner
2020-04-02 11:50   ` Lukas Wunner
2020-04-02 12:49   ` Pekka Paalanen
2020-04-02 13:13     ` Daniel Vetter
2020-04-02 14:31       ` Lukas Wunner
2020-04-02 14:40         ` Daniel Vetter [this message]
2020-04-02 17:56   ` Daniel Dadap
2020-04-02 18:25     ` Lukas Wunner
2020-04-02 20:21       ` Daniel Dadap
2020-04-03  7:16     ` Daniel Vetter
2020-04-03 18:07       ` Daniel Dadap
2020-04-03 19:59         ` Daniel Vetter
2020-04-22 22:04           ` Daniel Dadap
2020-04-28 10:14             ` Daniel Vetter
2020-07-23 17:28               ` Daniel Dadap

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='CAKMK7uHVh=Kra_T0niHQZcHLgfJY+WuqNmq68dVkczfChwqBHQ@mail.gmail.com' \
    --to=daniel@ffwll.ch \
    --cc=ddadap@nvidia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lukas@wunner.de \
    /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).