dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/1] DRM Node Probing functionality
@ 2018-04-11 14:49 Robert Foss
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Foss @ 2018-04-11 14:49 UTC (permalink / raw)
  To: dri-devel, John Stultz, Emil Velikov, Tomasz Figa, Stefan Schake,
	Chih-Wei Huang, Daniel Stone
  Cc: Robert Foss, Tomeu Vizoso

This patch implements a simple function for matching DRM device FDs against
the desired properties of a device that you are looking for.

The properties that are possible to look for are the elements of DrmVersion
and DrmDevice.

The discussion that led to this series can be found here:
https://lists.freedesktop.org/archives/mesa-dev/2018-January/183878.html

In the previous discussion we left off having settled on implementing this
in mesa/src/loader/loader.c, which I initially did. But the code ended up being
so generic that there's no reason for it not to live in libdrm, since it can be
used for any compositor and mesa.

The implementer will still have to iterate through all of the devices available
on the target, and see if they match. This additional functionality could be
moved into libdrm at a later point if it turns out that all of the users do this
in the same manner.
If there is some variety, for example with selecting fallback devices if nothing
matches maybe it is best left up to the user of libdrm.

The biggest problem with the approach as implemented, the way I see it, is how
we match against the DrmVersion/DrmDevice of a given FD. 
Currently we use DrmVersion & DrmDevice as supplied by the caller to define what 
we are looking for.
This is a little bit problematic, especially for DrmDevice, since all of the 
elements of the struct do not have enough bitspace to signal that we are 
uninterested in looking for that specific element. DrmDevice uses
drmDevicesEqual() to do what amounts to a memcmp of the DrmDevice argument and
the one of the FD. So looking for any device on any PCI bus with just the
PCI vendor ID supplied isn't possible.

An alternative Daniel Stone suggested is adding enums for different properties
and allowing the caller to supply a list of properties that are interesting and
their values. In terms of long-term maintainership this might be less pleasant
than the  approach of the current implementation.


Robert Foss (1):
  xf86drm: Add drmHandleMatch func

 xf86drm.h     |  2 ++
 xf86drmMode.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)

-- 
2.14.1

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

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

* Re: [RFC 0/1] DRM Node Probing functionality
  2018-04-12  3:55 Robert Foss
@ 2018-04-16  4:17 ` Tomasz Figa
  0 siblings, 0 replies; 3+ messages in thread
From: Tomasz Figa @ 2018-04-16  4:17 UTC (permalink / raw)
  To: robert.foss
  Cc: Tomeu Vizoso, Daniel Stone, Emil Velikov, dri-devel,
	Stefan Schake, Chih-Wei Huang

Hi Rob,

On Thu, Apr 12, 2018 at 12:56 PM Robert Foss <robert.foss@collabora.com>
wrote:

> *Resend the whole actual series*

> This patch implements a simple function for matching DRM device FDs
against
> the desired properties of a device that you are looking for.

> The properties that are possible to look for are the elements of
DrmVersion
> and DrmDevice.

> The discussion that led to this series can be found here:
> https://lists.freedesktop.org/archives/mesa-dev/2018-January/183878.html

> In the previous discussion we left off having settled on implementing this
> in mesa/src/loader/loader.c, which I initially did. But the code ended up
being
> so generic that there's no reason for it not to live in libdrm, since it
can be
> used for any compositor and mesa.

> The implementer will still have to iterate through all of the devices
available
> on the target, and see if they match. This additional functionality could
be
> moved into libdrm at a later point if it turns out that all of the users
do this
> in the same manner.
> If there is some variety, for example with selecting fallback devices if
nothing
> matches maybe it is best left up to the user of libdrm.

> The biggest problem with the approach as implemented, the way I see it,
is how
> we match against the DrmVersion/DrmDevice of a given FD.
> Currently we use DrmVersion & DrmDevice as supplied by the caller to
define what
> we are looking for.
> This is a little bit problematic, especially for DrmDevice, since all of
the
> elements of the struct do not have enough bitspace to signal that we are
> uninterested in looking for that specific element. DrmDevice uses
> drmDevicesEqual() to do what amounts to a memcmp of the DrmDevice
argument and
> the one of the FD. So looking for any device on any PCI bus with just the
> PCI vendor ID supplied isn't possible.

> An alternative Daniel Stone suggested is adding enums for different
properties
> and allowing the caller to supply a list of properties that are
interesting and
> their values. In terms of long-term maintainership this might be less
pleasant
> than the  approach of the current implementation.

I'm personally okay with how patch 1 implements the matching. Thanks for
this work. Looking forward to the Mesa probing helper, which uses this! :)

P.S. I normally use my @chromium.org email for mailing lists.

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

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

* [RFC 0/1] DRM Node Probing functionality
@ 2018-04-12  3:55 Robert Foss
  2018-04-16  4:17 ` Tomasz Figa
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Foss @ 2018-04-12  3:55 UTC (permalink / raw)
  To: dri-devel, John Stultz, Emil Velikov, Tomasz Figa, Stefan Schake,
	Chih-Wei Huang, Daniel Stone
  Cc: Robert Foss, Tomeu Vizoso

*Resend the whole actual series*

This patch implements a simple function for matching DRM device FDs against
the desired properties of a device that you are looking for.

The properties that are possible to look for are the elements of DrmVersion
and DrmDevice.

The discussion that led to this series can be found here:
https://lists.freedesktop.org/archives/mesa-dev/2018-January/183878.html

In the previous discussion we left off having settled on implementing this
in mesa/src/loader/loader.c, which I initially did. But the code ended up being
so generic that there's no reason for it not to live in libdrm, since it can be
used for any compositor and mesa.

The implementer will still have to iterate through all of the devices available
on the target, and see if they match. This additional functionality could be
moved into libdrm at a later point if it turns out that all of the users do this
in the same manner.
If there is some variety, for example with selecting fallback devices if nothing
matches maybe it is best left up to the user of libdrm.

The biggest problem with the approach as implemented, the way I see it, is how
we match against the DrmVersion/DrmDevice of a given FD. 
Currently we use DrmVersion & DrmDevice as supplied by the caller to define what 
we are looking for.
This is a little bit problematic, especially for DrmDevice, since all of the 
elements of the struct do not have enough bitspace to signal that we are 
uninterested in looking for that specific element. DrmDevice uses
drmDevicesEqual() to do what amounts to a memcmp of the DrmDevice argument and
the one of the FD. So looking for any device on any PCI bus with just the
PCI vendor ID supplied isn't possible.

An alternative Daniel Stone suggested is adding enums for different properties
and allowing the caller to supply a list of properties that are interesting and
their values. In terms of long-term maintainership this might be less pleasant
than the  approach of the current implementation.


Robert Foss (1):
  xf86drm: Add drmHandleMatch func

 xf86drm.h     |  2 ++
 xf86drmMode.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)

-- 
2.14.1

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

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

end of thread, other threads:[~2018-04-16  4:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-11 14:49 [RFC 0/1] DRM Node Probing functionality Robert Foss
2018-04-12  3:55 Robert Foss
2018-04-16  4:17 ` Tomasz Figa

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).