* [PATCH] xf86drm: continue after drmProcessPlatformDevice failure
@ 2017-07-19 15:37 Gurchetan Singh
2017-07-20 11:33 ` Emil Velikov
2017-07-20 13:47 ` Thierry Reding
0 siblings, 2 replies; 3+ messages in thread
From: Gurchetan Singh @ 2017-07-19 15:37 UTC (permalink / raw)
To: dri-devel; +Cc: thierry.reding, emil.l.velikov, Gurchetan Singh
On ChromeOS devices, readdir() processes the directory in
the following order:
-NAME- -TYPE-
. n/a
.. n/a
vgem n/a
card1 DRM_BUS_PLATFORM
renderD129 DRM_BUS_PLATFORM
card0 DRM_BUS_PCI
renderD128 DRM_BUS_PCI
controlD64 DRM_BUS_PCI
In drmGetDevices2, after drmProcessPlatformDevice fails for
/dev/dri/card1, we don't process the remaining directory entries.
As such, Vulkan fails to initialize since Mesa uses drmGetDevices2.
To fix this, continue if drmProcessPlatformDevice fails.
---
xf86drm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xf86drm.c b/xf86drm.c
index 879f85b6..50862f22 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3997,7 +3997,7 @@ int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices)
ret = drmProcessPlatformDevice(&device, node, node_type, maj, min,
devices != NULL, flags);
if (ret)
- goto free_devices;
+ continue;
break;
--
2.12.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xf86drm: continue after drmProcessPlatformDevice failure
2017-07-19 15:37 [PATCH] xf86drm: continue after drmProcessPlatformDevice failure Gurchetan Singh
@ 2017-07-20 11:33 ` Emil Velikov
2017-07-20 13:47 ` Thierry Reding
1 sibling, 0 replies; 3+ messages in thread
From: Emil Velikov @ 2017-07-20 11:33 UTC (permalink / raw)
To: Gurchetan Singh; +Cc: Thierry Reding, ML dri-devel
On 19 July 2017 at 16:37, Gurchetan Singh <gurchetansingh@chromium.org> wrote:
> On ChromeOS devices, readdir() processes the directory in
> the following order:
>
> -NAME- -TYPE-
> . n/a
> .. n/a
> vgem n/a
> card1 DRM_BUS_PLATFORM
> renderD129 DRM_BUS_PLATFORM
> card0 DRM_BUS_PCI
> renderD128 DRM_BUS_PCI
> controlD64 DRM_BUS_PCI
>
> In drmGetDevices2, after drmProcessPlatformDevice fails for
> /dev/dri/card1, we don't process the remaining directory entries.
> As such, Vulkan fails to initialize since Mesa uses drmGetDevices2.
> To fix this, continue if drmProcessPlatformDevice fails.
Added a fixes tag and addressed the host1x + usb instances.
Thank you!
Emil
_______________________________________________
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: [PATCH] xf86drm: continue after drmProcessPlatformDevice failure
2017-07-19 15:37 [PATCH] xf86drm: continue after drmProcessPlatformDevice failure Gurchetan Singh
2017-07-20 11:33 ` Emil Velikov
@ 2017-07-20 13:47 ` Thierry Reding
1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2017-07-20 13:47 UTC (permalink / raw)
To: Gurchetan Singh; +Cc: emil.l.velikov, dri-devel
[-- Attachment #1.1: Type: text/plain, Size: 1705 bytes --]
On Wed, Jul 19, 2017 at 08:37:06AM -0700, Gurchetan Singh wrote:
> On ChromeOS devices, readdir() processes the directory in
> the following order:
>
> -NAME- -TYPE-
> . n/a
> .. n/a
> vgem n/a
> card1 DRM_BUS_PLATFORM
> renderD129 DRM_BUS_PLATFORM
> card0 DRM_BUS_PCI
> renderD128 DRM_BUS_PCI
> controlD64 DRM_BUS_PCI
>
> In drmGetDevices2, after drmProcessPlatformDevice fails for
> /dev/dri/card1, we don't process the remaining directory entries.
> As such, Vulkan fails to initialize since Mesa uses drmGetDevices2.
> To fix this, continue if drmProcessPlatformDevice fails.
> ---
> xf86drm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I'm not sure this is a good fix. drmProcessPlatformDevice() is only
supposed to fail in fatal situations, such as out-of-memory. So the
reason it doesn't continue is that it doesn't make sense to. In the
case of out-of-memory situations, for example, the next allocation
is assumed to fail as well.
Now, reading the code again, maybe the reason it is failing is because
the code tries to look for OF_FULLNAME and OF_COMPATIBLE_N and may not
find them. I suspect that card1 and renderD129 are from a vgem device,
which is, as far as I can tell, the only case of a platform device
without an OF node.
In that case I think we should fix drmProcessPlatformDevice() to deal
with those cases instead (make the list of compatibles optional, and
fallback to some other mechanism to determine the name). Otherwise we
will be silently ignoring errors and skipping devices that we really
shouldn't.
Thierry
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
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:[~2017-07-20 13:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-19 15:37 [PATCH] xf86drm: continue after drmProcessPlatformDevice failure Gurchetan Singh
2017-07-20 11:33 ` Emil Velikov
2017-07-20 13:47 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox