[PATCH] xf86drm: continue after drmProcessPlatformDevice failure

Thierry Reding thierry.reding at gmail.com
Thu Jul 20 13:47:57 UTC 2017


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20170720/cd5172ee/attachment-0001.sig>


More information about the dri-devel mailing list