mbox series

[libdrm,0/2] xf86drm: add OF_ fallback mechanism

Message ID 20181018200737.5953-1-christian.gmeiner@gmail.com (mailing list archive)
Headers show
Series xf86drm: add OF_ fallback mechanism | expand

Message

Christian Gmeiner Oct. 18, 2018, 8:07 p.m. UTC
Since kernel 4.17 (drm/etnaviv: remove the need for a gpu-subsystem DT
node) the etnaviv DRM driver doesn't have an associated DT node
anymore. This is technically correct, as the etnaviv device is a
virtual device driving multiple hardware devices.

Before 4.17 the userspace had access to the following information:
# cat /sys/dev/char/226:128/device/uevent
DRIVER=etnaviv
OF_NAME=gpu-subsystem
OF_FULLNAME=/gpu-subsystem
OF_COMPATIBLE_0=fsl,imx-gpu-subsystem
OF_COMPATIBLE_N=1
MODALIAS=of:Ngpu-subsystemT<NULL>Cfsl,imx-gpu-subsystem
DRIVER=imx-drm
OF_NAME=display-subsystem
OF_FULLNAME=/display-subsystem
OF_COMPATIBLE_0=fsl,imx-display-subsystem
OF_COMPATIBLE_N=1

Afer 4.17:
# cat /sys/dev/char/226:128/device/uevent
DRIVER=etnaviv
MODALIAS=platform:etnaviv

As a consequence we need to add fallback mechanism to handle this
change. This series fixes kmscube and friends when using mesa's
loader_open_render_node(..).

Christian Gmeiner (2):
  xf86drm: fallback to DRIVER uevent entry when OF_FULLNAME fails
  xf86drm: handle non existing OF_COMPATIBLE_N uevent entry

 xf86drm.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Emil Velikov Oct. 23, 2018, 5:28 p.m. UTC | #1
On Thu, 18 Oct 2018 at 21:07, Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
>
> Since kernel 4.17 (drm/etnaviv: remove the need for a gpu-subsystem DT
> node) the etnaviv DRM driver doesn't have an associated DT node
> anymore. This is technically correct, as the etnaviv device is a
> virtual device driving multiple hardware devices.
>
> Before 4.17 the userspace had access to the following information:
> # cat /sys/dev/char/226:128/device/uevent
> DRIVER=etnaviv
> OF_NAME=gpu-subsystem
> OF_FULLNAME=/gpu-subsystem
> OF_COMPATIBLE_0=fsl,imx-gpu-subsystem
> OF_COMPATIBLE_N=1
> MODALIAS=of:Ngpu-subsystemT<NULL>Cfsl,imx-gpu-subsystem
> DRIVER=imx-drm
> OF_NAME=display-subsystem
> OF_FULLNAME=/display-subsystem
> OF_COMPATIBLE_0=fsl,imx-display-subsystem
> OF_COMPATIBLE_N=1
>
> Afer 4.17:
> # cat /sys/dev/char/226:128/device/uevent
> DRIVER=etnaviv
> MODALIAS=platform:etnaviv
>
Mostly relaying what I mentioned previously [1], yet forgot to CC RobH.

- Are the OF entries in uevent part of the ABI or not? Can we have that
documented anywhere?

There are very few mentions in the official kernel doc - Documentation/ABI/
Obviously it doesn't mention anything OF_* but it neither does DRIVER
or MODALIAS. Yet if we change those $world will break ;-)

- How can we distinguish in the (perhaps hypothetical) case when
there's two or more etnaviv devices?

Thanks
Emil

[1] https://lists.freedesktop.org/archives/mesa-dev/2018-September/205660.html
Lucas Stach Oct. 29, 2018, 11:32 a.m. UTC | #2
Am Dienstag, den 23.10.2018, 18:28 +0100 schrieb Emil Velikov:
> On Thu, 18 Oct 2018 at 21:07, Christian Gmeiner
> > <christian.gmeiner@gmail.com> wrote:
> > 
> > Since kernel 4.17 (drm/etnaviv: remove the need for a gpu-subsystem DT
> > node) the etnaviv DRM driver doesn't have an associated DT node
> > anymore. This is technically correct, as the etnaviv device is a
> > virtual device driving multiple hardware devices.
> > 
> > Before 4.17 the userspace had access to the following information:
> > # cat /sys/dev/char/226:128/device/uevent
> > DRIVER=etnaviv
> > OF_NAME=gpu-subsystem
> > OF_FULLNAME=/gpu-subsystem
> > OF_COMPATIBLE_0=fsl,imx-gpu-subsystem
> > OF_COMPATIBLE_N=1
> > MODALIAS=of:Ngpu-subsystemT<NULL>Cfsl,imx-gpu-subsystem
> > DRIVER=imx-drm
> > OF_NAME=display-subsystem
> > OF_FULLNAME=/display-subsystem
> > OF_COMPATIBLE_0=fsl,imx-display-subsystem
> > OF_COMPATIBLE_N=1
> > 
> > Afer 4.17:
> > # cat /sys/dev/char/226:128/device/uevent
> > DRIVER=etnaviv
> > MODALIAS=platform:etnaviv
> > 
> 
> Mostly relaying what I mentioned previously [1], yet forgot to CC RobH.
> 
> - Are the OF entries in uevent part of the ABI or not? Can we have that
> documented anywhere?
> 
> There are very few mentions in the official kernel doc - Documentation/ABI/
> Obviously it doesn't mention anything OF_* but it neither does DRIVER
> or MODALIAS. Yet if we change those $world will break ;-)

The OF node has never been part of the etnaviv UABI, simply due to the
fact that it's still possible to instantiate the etnaviv driver from a
platform file, instead of a devicetree node.

> 
> - How can we distinguish in the (perhaps hypothetical) case when
> there's two or more etnaviv devices?

Why not simply use the DRM minor? All you need is an arbitrary handle
to grab the right instance.

Regards,
Lucas