From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH] xf86drm: continue after drmProcessPlatformDevice failure Date: Thu, 20 Jul 2017 15:47:57 +0200 Message-ID: <20170720134757.GA25942@ulmo> References: <20170719153706.1535-1-gurchetansingh@chromium.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1969937985==" Return-path: Received: from mail-wr0-x232.google.com (mail-wr0-x232.google.com [IPv6:2a00:1450:400c:c0c::232]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5CA5889AC3 for ; Thu, 20 Jul 2017 13:48:00 +0000 (UTC) Received: by mail-wr0-x232.google.com with SMTP id f21so14594795wrf.5 for ; Thu, 20 Jul 2017 06:48:00 -0700 (PDT) In-Reply-To: <20170719153706.1535-1-gurchetansingh@chromium.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Gurchetan Singh Cc: emil.l.velikov@gmail.com, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1969937985== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 19, 2017 at 08:37:06AM -0700, Gurchetan Singh wrote: > On ChromeOS devices, readdir() processes the directory in > the following order: >=20 > -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 >=20 > 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 --LZvS9be/3tNcYl/X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAllwtIoACgkQ3SOs138+ s6H6gw//YhmoWEJXM9nOhyIhUzzSbc6cEmhNI4ECPgKpv292X4wke/dhUllR49at n+HJKXxiWSD1jAw/OfXKBoK/2XRyNGlVvk//KrOXM+T579XQfxxoSKT4fpcZWVsC vSW79KxVAv2EfOW3woxwQNaWlabQ7XlziyKrxIaeVKSZsRhEc83zIjJERzvdJheQ FaWG5NRPNu8nQzeW/xhuLSJZ2+Ts3UWZRpWZkwIM8eDSQnro0VYwiMESw77jQxuT c4EnIT3ELlYnrdyHkuoj71+wZ/OMlGBY/A6zYTMhgoNbf1ftLENl3Vb+YmN3SLt7 Lw6hTkll7hovRQApowHIOrCOo3HVWPXFiuf099Cpcge86+wQ1SNezqFhbzj5vypL mcbofjCAwvfDja4AN6ZyJow4YNN43vVV6w8VTeki587G1DxX50C5XKdNFldliBQA TxotMJw9RXr33clMVYZh0Ic3K0N3sAKnR6UGjxiT2sJ4+ZFrsfsK1I1+3IUD1HEs OGsP75dR3jRl23wm+lY4ltjcpU/uuS57V05NGd6qp64T1fIvrCl6gqBiwsBHhVcE 3R+Rt9FVvU36dB9zubX9bjn9YO5BTjF7RI7w0ybbheghGmJ4v4VuAoyDCs9ZVdEc ZCcIX3bxNeBpu3PerpDll2e7RD6PAoJaVkf5PqygxVQX4pyb2pU= =Ltzw -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X-- --===============1969937985== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1969937985==--