diff mbox

[libdrm,3/3] xf86drm: don't fatal on per device error in drmGetDevice[s]2

Message ID 20161210055222.43795-3-jsg@jsg.id.au (mailing list archive)
State New, archived
Headers show

Commit Message

Jonathan Gray Dec. 10, 2016, 5:52 a.m. UTC
When iterating over all the device nodes if drmProcessPciDevice()
returned an error for any node the function would return an error,
ignoring any valid nodes.

The result of this on OpenBSD where drmProcessPciDevice() results in
device nodes being opened to issue ioctls to get pci data
was that data obtained from /dev/drm0 would be ignored if /dev/drm1
could not be opened.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
---
 xf86drm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Emil Velikov Dec. 12, 2016, 2:12 p.m. UTC | #1
On 10 December 2016 at 05:52, Jonathan Gray <jsg@jsg.id.au> wrote:
> When iterating over all the device nodes if drmProcessPciDevice()
> returned an error for any node the function would return an error,
> ignoring any valid nodes.
>
> The result of this on OpenBSD where drmProcessPciDevice() results in
> device nodes being opened to issue ioctls to get pci data
> was that data obtained from /dev/drm0 would be ignored if /dev/drm1
> could not be opened.
>
Out of curiosity - did you actually hit such an issue or you've
spotted it by observation ?
I'm not too sure which route is the "correct" one here, but I believe
you got it spot on.

I'll push this alongside v2 of 1/3 and 2/3.

Thanks !
Emil
Jonathan Gray Dec. 12, 2016, 2:55 p.m. UTC | #2
On Mon, Dec 12, 2016 at 02:12:28PM +0000, Emil Velikov wrote:
> On 10 December 2016 at 05:52, Jonathan Gray <jsg@jsg.id.au> wrote:
> > When iterating over all the device nodes if drmProcessPciDevice()
> > returned an error for any node the function would return an error,
> > ignoring any valid nodes.
> >
> > The result of this on OpenBSD where drmProcessPciDevice() results in
> > device nodes being opened to issue ioctls to get pci data
> > was that data obtained from /dev/drm0 would be ignored if /dev/drm1
> > could not be opened.
> >
> Out of curiosity - did you actually hit such an issue or you've
> spotted it by observation ?
> I'm not too sure which route is the "correct" one here, but I believe
> you got it spot on.
> 
> I'll push this alongside v2 of 1/3 and 2/3.
> 
> Thanks !
> Emil

Currently by default on login we change ownership of /dev/drm0 via
fbtab when a user logs in on a glass console but no other /dev/drm
nodes.

I saw this before the OpenBSD specific path was added and was reminded
of it when testing one of the functions that isn't used by Mesa yet.
diff mbox

Patch

diff --git a/xf86drm.c b/xf86drm.c
index afce8ec..2dc679a 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3383,7 +3383,7 @@  int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device)
         case DRM_BUS_PCI:
             ret = drmProcessPciDevice(&d, node, node_type, maj, min, true, flags);
             if (ret)
-                goto free_devices;
+                continue;
 
             break;
         default:
@@ -3514,7 +3514,7 @@  int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices)
             ret = drmProcessPciDevice(&device, node, node_type,
                                       maj, min, devices != NULL, flags);
             if (ret)
-                goto free_devices;
+                continue;
 
             break;
         default: