[PATCH] xf86drm: add drmOpenByFB
cwhuang at linux.org.tw
Thu May 28 09:46:08 UTC 2020
Simon Ser <contact at emersion.fr> 於 2020年5月25日 週一 上午3:25寫道：
> On Sunday, May 24, 2020 8:53 PM, Daniel Vetter <daniel at ffwll.ch> wrote:
> > On Sat, May 23, 2020 at 5:44 PM Mauro Rossi issor.oruam at gmail.com wrote:
> > > OpenByFB is introduced to overcome GPU driver loading order issue
> > > on a device with multiple GPUs, e.g. Intel iGPU and Nvidia dGPU
> > > where the first drmfb kernel module loaded will become device file
> > > /dev/dri/card0 and the second will become /dev/dri/card1
> > > The use case is to prefer Intel iGPU over dGPU, or viceversa,
> > > in a deterministic and reliable manner.
> > > OpenByFB function opens the DRM device with specified fb and node type,
> > > thus enabling gralloc to open the correct device node of the primary fb,
> > > regardless of the GPU driver loading order.
> > The fbdev load ordering is as inconsistent/random as the dri node
> > loading. Well more so, because you might have random firmware fbdev
> > drivers hanging out there. Hence I'm not following how this solves
> > anything for your problem.
> > I think usually what userspace does it look at the boot_vga property
> > of the underlying device in sysfs, and prefer that one.
Thank you for the reply.
I'm not the expert so
I can't fully understand what you mean.
What does 'boot_vga' mean and how could it help our problem?
The main problem we're trying to solve is to
find the DRM device of the primary framebuffer (fb0).
I believe /sys/class/graphics/fb0/device/drm
is the correct one we could use.
At least it works on all devices I've tested
including nvidia optimus notebooks.
If there is a simpler way to get the DRM device of fb0
I'm happy to learn.
> Yes. See  for an example of how to do this.
> : https://github.com/swaywm/wlroots/blob/5c942bd5972afee9a68cb15c14aa83b4b0aaf82d/backend/session/session.c#L331
Thank you for the example.
However, our target platform is Android and
Android doesn't have udev. So I'm afraid we can't use it.
More information about the dri-devel