From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: jsg@jsg.id.au
Cc: emil.l.velikov@gmail.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH libdrm v2 5/5] xf86drm: implement an OpenBSD specific drmGetDevice2
Date: Tue, 26 Jun 2018 14:03:08 +0200 (CEST) [thread overview]
Message-ID: <2459ed18ee7da562@bloch.sibelius.xs4all.nl> (raw)
In-Reply-To: <20180626105818.GA16497@largo.jsg.id.au> (message from Jonathan Gray on Tue, 26 Jun 2018 20:58:18 +1000)
> Date: Tue, 26 Jun 2018 20:58:18 +1000
> From: Jonathan Gray <jsg@jsg.id.au>
>
> On Tue, Jun 26, 2018 at 11:38:20AM +0100, Emil Velikov wrote:
> > On 21 June 2018 at 16:32, Jonathan Gray <jsg@jsg.id.au> wrote:
> > > On Thu, Jun 21, 2018 at 03:24:49PM +0100, Emil Velikov wrote:
> > >> Hi Jonathan,
> > >>
> > >> On 1 December 2016 at 04:18, Jonathan Gray <jsg@jsg.id.au> wrote:
> > >>
> > >> > --- a/xf86drm.c
> > >> > +++ b/xf86drm.c
> > >> > @@ -3248,6 +3248,67 @@ drm_device_validate_flags(uint32_t flags)
> > >> > */
> > >> > int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device)
> > >> > {
> > >> > +#ifdef __OpenBSD__
> > >> > + /*
> > >> > + * DRI device nodes on OpenBSD are not in their own directory, they reside
> > >> > + * in /dev along with a large number of statically generated /dev nodes.
> > >> > + * Avoid stat'ing all of /dev needlessly by implementing this custom path.
> > >> > + */
> > >> I was in the area, fixing the odd bug and doing some cleanups and a
> > >> question came to mind:
> > >>
> > >> Is there some obstacle of placing the drm nodes under /dev/dri/? It
> > >> would involve a check/update through the OpenBSD tree, yet no obvious
> > >> downsides comes to mind.
> > >> I think it would make things more distinct and obvious. IIRC the
> > >> OpenBSD xserver does some checking which /dev node opened, the
> > >> suggestion should help there.
> > >>
> > >> What do you think?
> > >> Emil
> > >
> > > There are no other devices under a sub-directory besides /dev/fd/.
> > > I don't think anyone is going to be onboard with changing things for
> > > drm nodes. Though drm device nodes names will have to be revisted
> > > when/if render nodes etc get supported. drmR drmC etc have not
> > > been proposed yet.
> >
> > I see, that's enlighening.
> >
> > Out of curiosity: personally, do you see any technical issues with a
> > sub-directory approach?
>
> I get that you want a single path but it seems these functions were
> really designed assuming the approach was going to be a sub-directory.
The bigger picture here is that this code is primarily used to query
for information about an open drm file descriptor. The Linux
implementation does a lot of filesystem groveling to achieve that.
Especially the bits that descend into /sys are never going to work on
OpenBSD. If a more OS-agnostic approach is wanted, I would say an
ioctl to return the relevant information would be more appropriate.
This is actually what we did for OpenBSD where we implemented
DRM_IOCTL_GET_PCIINFO to implement drmParsePciBusInfo. Such an
approach avoids the issue of mapping the file descriptor back to a
file system path. Also note that mapping and open file descriptor to
a file system path is fundamentally impossible on Unix without
cheating. Although cheating is fairly easy for devices.
If mapping a file descriptor back to a filesystem path is necessary,
OpenBSD actually implements devname(3) which uses a database to map
device major/minor pairs back to a device name. This is actually a
function that was introduced in 4.4BSD, and as far as I can tell it is
still present in FreeBSD and NetBSD as well. We could change the
OpenBSD implementation of drmGetDevice2() to use that, but it wouldn't
really make the code simpler.
All in all, I think it is best to keep the Linux and OpenBSD code
separate here.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-06-26 12:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-01 4:18 [PATCH libdrm v2 1/5] xf86drm: implement drmGetMinorNameForFD for non-sysfs Jonathan Gray
2016-12-01 4:18 ` [PATCH libdrm v2 2/5] xf86drm: implement drmParseSubsystemType for OpenBSD Jonathan Gray
2016-12-01 4:18 ` [PATCH libdrm v2 3/5] xf86drm: implement drmParsePciDeviceInfo " Jonathan Gray
2016-12-01 4:18 ` [PATCH libdrm v2 4/5] xf86drm: implement drmParsePciBusInfo " Jonathan Gray
2016-12-01 4:18 ` [PATCH libdrm v2 5/5] xf86drm: implement an OpenBSD specific drmGetDevice2 Jonathan Gray
2016-12-05 17:56 ` Emil Velikov
2016-12-06 5:12 ` Jonathan Gray
2016-12-07 16:46 ` Emil Velikov
2018-06-21 14:24 ` Emil Velikov
2018-06-21 15:32 ` Jonathan Gray
2018-06-26 10:38 ` Emil Velikov
2018-06-26 10:58 ` Jonathan Gray
2018-06-26 12:03 ` Mark Kettenis [this message]
2018-06-26 12:38 ` Emil Velikov
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=2459ed18ee7da562@bloch.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
--cc=jsg@jsg.id.au \
/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).