dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm] libdrm: Fix drmNodeIsDRM() on DragonFly
@ 2018-12-11 22:04 François Tigeot
  2018-12-17 18:09 ` Emil Velikov
  0 siblings, 1 reply; 4+ messages in thread
From: François Tigeot @ 2018-12-11 22:04 UTC (permalink / raw)
  To: dri-devel; +Cc: François Tigeot

* There is no way to check if a device name is really a drm device
  by looking it up in a virtual filesystem like on Linux

* The major device number is also dynamically allocated from a pool,
  comparing it to a constant makes no sense

* In the absence of better ideas, just assume the device name really
  points to a drm device and always return true

Signed-off-by: François Tigeot <ftigeot@wolfpond.org>
---
 xf86drm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xf86drm.c b/xf86drm.c
index 71ad54ba..0085bf17 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2778,6 +2778,8 @@ static bool drmNodeIsDRM(int maj, int min)
     snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device/drm",
              maj, min);
     return stat(path, &sbuf) == 0;
+#elif __DragonFly__
+    return true;	/* DragonFly BSD has no fixed major device numbers */
 #else
     return maj == DRM_MAJOR;
 #endif
-- 
2.19.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH libdrm] libdrm: Fix drmNodeIsDRM() on DragonFly
  2018-12-11 22:04 [PATCH libdrm] libdrm: Fix drmNodeIsDRM() on DragonFly François Tigeot
@ 2018-12-17 18:09 ` Emil Velikov
  2018-12-18 19:11   ` Francois Tigeot
  0 siblings, 1 reply; 4+ messages in thread
From: Emil Velikov @ 2018-12-17 18:09 UTC (permalink / raw)
  To: François Tigeot; +Cc: ML dri-devel

On Tue, 11 Dec 2018 at 22:15, François Tigeot <ftigeot@wolfpond.org> wrote:
>
> * There is no way to check if a device name is really a drm device
>   by looking it up in a virtual filesystem like on Linux
>
> * The major device number is also dynamically allocated from a pool,
>   comparing it to a constant makes no sense
>
> * In the absence of better ideas, just assume the device name really
>   points to a drm device and always return true
>
I guess one could use the sysfs path, although that may require a few
extra lines to the linux emulation layer.

What's the reason behind the dynamic allocation of the major? FWIW
some userspace requires a fixed DRM_MAJOR - they will need patching to
run :-(

Thanks
Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH libdrm] libdrm: Fix drmNodeIsDRM() on DragonFly
  2018-12-17 18:09 ` Emil Velikov
@ 2018-12-18 19:11   ` Francois Tigeot
  2018-12-19 13:32     ` Eric Engestrom
  0 siblings, 1 reply; 4+ messages in thread
From: Francois Tigeot @ 2018-12-18 19:11 UTC (permalink / raw)
  To: Emil Velikov; +Cc: François Tigeot, ML dri-devel

On Mon, Dec 17, 2018 at 06:09:47PM +0000, Emil Velikov wrote:
> On Tue, 11 Dec 2018 at 22:15, François Tigeot <ftigeot@wolfpond.org> wrote:
> >
> > * There is no way to check if a device name is really a drm device
> >   by looking it up in a virtual filesystem like on Linux
> >
> > * The major device number is also dynamically allocated from a pool,
> >   comparing it to a constant makes no sense
> >
> > * In the absence of better ideas, just assume the device name really
> >   points to a drm device and always return true
> >
> I guess one could use the sysfs path, although that may require a few
> extra lines to the linux emulation layer.

We currently have such a thing living in local patches and it's a source
of pain; it regularly breaks for one reason or another.
It's not using sysfs but a hw.dri sysctl mechanism originating from FreeBSD.
Some of the patches are visible here:
https://github.com/DragonFlyBSD/DPorts/blob/master/graphics/libdrm/files/patch-xf86drm.c

> What's the reason behind the dynamic allocation of the major? FWIW
> some userspace requires a fixed DRM_MAJOR - they will need patching to
> run :-(

Major/minor numbers were required when device files had to be created on
regular filesystem like UFS but when a devfs filesystem was implemented
for DragonFly almost a decade ago, nobody thought it was important anymore.

There have been no fixed major numbers on DragonFly since 2009 or so.

-- 
Francois Tigeot
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH libdrm] libdrm: Fix drmNodeIsDRM() on DragonFly
  2018-12-18 19:11   ` Francois Tigeot
@ 2018-12-19 13:32     ` Eric Engestrom
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Engestrom @ 2018-12-19 13:32 UTC (permalink / raw)
  To: Francois Tigeot; +Cc: Emil Velikov, ML dri-devel

On Tuesday, 2018-12-18 20:11:27 +0100, Francois Tigeot wrote:
> On Mon, Dec 17, 2018 at 06:09:47PM +0000, Emil Velikov wrote:
> > On Tue, 11 Dec 2018 at 22:15, François Tigeot <ftigeot@wolfpond.org> wrote:
> > >
> > > * There is no way to check if a device name is really a drm device
> > >   by looking it up in a virtual filesystem like on Linux
> > >
> > > * The major device number is also dynamically allocated from a pool,
> > >   comparing it to a constant makes no sense
> > >
> > > * In the absence of better ideas, just assume the device name really
> > >   points to a drm device and always return true
> > >
> > I guess one could use the sysfs path, although that may require a few
> > extra lines to the linux emulation layer.
> 
> We currently have such a thing living in local patches and it's a source
> of pain; it regularly breaks for one reason or another.
> It's not using sysfs but a hw.dri sysctl mechanism originating from FreeBSD.
> Some of the patches are visible here:
> https://github.com/DragonFlyBSD/DPorts/blob/master/graphics/libdrm/files/patch-xf86drm.c

I'm going through those right now, and I'll send patches for those that
make sense upstream. Apologies in advance for the rebase pains :]

> 
> > What's the reason behind the dynamic allocation of the major? FWIW
> > some userspace requires a fixed DRM_MAJOR - they will need patching to
> > run :-(
> 
> Major/minor numbers were required when device files had to be created on
> regular filesystem like UFS but when a devfs filesystem was implemented
> for DragonFly almost a decade ago, nobody thought it was important anymore.
> 
> There have been no fixed major numbers on DragonFly since 2009 or so.

Fwiw, this `if dragonfly return true` patch is:
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-19 13:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-11 22:04 [PATCH libdrm] libdrm: Fix drmNodeIsDRM() on DragonFly François Tigeot
2018-12-17 18:09 ` Emil Velikov
2018-12-18 19:11   ` Francois Tigeot
2018-12-19 13:32     ` Eric Engestrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox