Bug 94476

Summary: DRM backend does not search for i915_dri.so
Product: Wayland Reporter: gobogowoli
Component: westonAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED NOTOURBUG QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: weston log

Description gobogowoli 2016-03-10 14:01:12 UTC
I built and installed mesa, which gave me

/usr/lib64/mesa/{i965,swrast}_dri.so

I had to create symlinks to those in /usr/lib64/dri/, but that's probably just a bug in one of the distro packages.

When I launch weston, it works but it is unusably slow. Looking at the logs, I get:
gbm: Last dlopen error: /usr/lib64/dri/i965_dri.so: cannot open shared object file: no such file or directory
gbm: Failed to load driver: i965
gbm: Failed to open any driver (search path /usr/lib64/dri)
gbm: Last dlopen error: /usr/lib64/dri/kms_swrast_dri.so: cannot open shared object file: no such file or directory
gbm: Failed to load driver: kms_swrast
gbm: Failed to open any driver (search path /usr/lib64/dri)

lspci -vnn says that i915 is the driver in use. Why doesn't weston search for the i915_dri.so driver in /usr/lib64/dri?

Weston 1.9.0
Mesa 11.1.2
Comment 1 Pekka Paalanen 2016-03-10 15:31:54 UTC
Weston does not do the searching nor open any *_dri.so file on its own. Weston links to libgbm and libEGL, both provided by Mesa, and those somehow search for the drivers.

I suspect you have distribution-installed Mesa and manually built Mesa mixed up in your system, or just a confused installation.

In any case, I don't think this has anything to do with Weston.

You forgot to attach the weston output (stdout/err) which would show what Mesa and drivers you actually end up getting loaded.

Why did you not simply let your distribution provided Mesa be there?
Comment 2 Daniel Stone 2016-03-10 16:35:17 UTC
Yes, this is a Mesa issue. i965_dri.so is an internal Mesa module, loaded by libgbm/libEGL/libGLESv2, which are also provided by Mesa. I don't know how you installed it, but seemingly they have been installed to the wrong place.
Comment 3 gobogowoli 2016-03-10 17:26:50 UTC
Created attachment 122210 [details]
weston log
Comment 4 gobogowoli 2016-03-10 17:32:13 UTC
Sorry for the erroneous bug report. When it comes to the Linux graphics stack, I still only know just enough to be dangerous. I did look into libgbm since the error was labeled, but I couldn't readily find any documentation about it. I don't quite know where the lines are drawn between Weston, Mesa, DRI/DRM, etc.

Weston, Mesa, and at least all of their direct dependencies are installed via Gentoo Portage, so in theory they should be coherent with one another. However, I have to do some more testing to figure out why Mesa is installing modules in /usr/lib64/mesa and libgbm is searching for them in /usr/lib/dri. It's likely that I messed something up along the way, but if not it's a bug for the Gentoo (or perhaps Mesa) people I suppose. I only did the symlinks as a quickfix; I'm more concerned about libgbm searching for i965_dri.so instead of i915_dri.so, regardless of the parent directories.

Since libgbm is part of Mesa (which I didn't know until now), I'll look for some more documentation on it and see if there's some way to force libgbm to choose i915_dri.so specifically. I'll submit a bug report to Mesa also if necessary.

As for which driver is actually being loaded, I'm assuming its swrast_dri.so, since that's the only other one in /usr/lib64/mesa, and it would explain the slowness. I attached the log in case anyone is interested.

So thanks for the explanation. I'll look into libgbm some more and see if I can find a workaround or submit a bug report to Mesa.
Comment 5 Pekka Paalanen 2016-03-11 09:47:37 UTC
Oh Gentoo. You get Mesa installed in /usr/lib64/mesa because you have the option to *also* install proprietary graphics drivers, and then use eselect to switch between the different providers. I suppose libgbm is not part of that because neither NVIDIA nor fglrx drivers provide, so there are no conflicts to solve, I guess.

I also use Gentoo, and I have never had to do such symlinks by hand. Just make sure 'eselect opengl' it set for "xorg-x11" to have Mesa.

Your kernel driver may be i915, but you most probably do want i965_dri.so. The reason is that the kernel driver called "i915" supports also i965_dri.so GPUs. The i915_dri.so is for pretty old GPUs.

Gentoo-specific: Make sure your VIDEO_CARDS contains i965 and intel. Otherwise the Mesa package won't build the driver you need.

Currently you get a software rasterizer indeed.

It seems there's is something going on with the Weston package too, since Weston is not finding weston-keyboard. That's not too bad, though.
Comment 6 gobogowoli 2016-03-11 21:20:22 UTC
Pekka,
You can probably tell I'm new to Gentoo as well, so I'm dealing with a good amount of unfamiliarity all at once here, but I'm learning it as fast as I can.

In the context of the mesa package, USE="bindist" means "Disable patent-encumbered ARB_texture_float, EXT_texture_shared_exponent, and EXT_packed_float extensions."[1] I had automatically assumed it meant proprietary code would be **enabled**, so that was my mistake. So bindist was disabled, which enabled proprietary code, which caused the drivers to end up in /usr/lib64/mesa instead of /usr/lib64/dri. Do I need any of those proprietary functions/drivers (does Intel even provide any proprietary drivers?), or should I set USE="-bindist"?

"eselect opengl" is and was set to xorg-x11 (the only option available).

As you suggested, I added VIDEO_CARDS="intel i965" and reinstalled mesa. After symlinking /usr/lib64/dri/i965_dri.so to the real file in /usr/lib64/mesa, I started Weston, and it worked properly without the slowness. So, confusing as it sounds, i965_dri.so is the correct driver even when the kernel driver is i915, as you said.

Finally, my keyboard works under Weston, but do you think it would benefit other users if I report that bug anyway?

Thanks everyone for the help! Weston appears to be working for me now.

[1] https://packages.gentoo.org/packages/media-libs/mesa
Comment 7 Pekka Paalanen 2016-03-14 09:34:03 UTC
(In reply to gobogowoli from comment #6)
> In the context of the mesa package, USE="bindist" means "Disable
> patent-encumbered ARB_texture_float, EXT_texture_shared_exponent, and
> EXT_packed_float extensions."[1] I had automatically assumed it meant
> proprietary code would be **enabled**, so that was my mistake. So bindist
> was disabled, which enabled proprietary code, which caused the drivers to
> end up in /usr/lib64/mesa instead of /usr/lib64/dri. Do I need any of those
> proprietary functions/drivers (does Intel even provide any proprietary
> drivers?), or should I set USE="-bindist"?

For all I know, saying "bindist" affects installation location is totally incorrect.

It's also not proprietary code. It is all FOSS code, but some algorithms are patented in some countries, and in some countries those patents might even be valid, so if you were not building Mesa only for yourself, you might maybe perhaps one day get into trouble if you have enough money to be stolen. Whatever, I don't really understand the legal matters, but I believe it depends on your country a lot.

I repeat: it is not proprietary. Patent-encumbered is a different thing.

Whether you have "bindist" or not makes no difference to Weston. If you have "bindist" and see some applications not working, then you could consider disabling it. It only affects some GL extensions whether they work or not. Weston uses none of that.

"bindist" is a short for "it is safe to redistribute the binaries built from this package in all countries".

> "eselect opengl" is and was set to xorg-x11 (the only option available).
> 
> As you suggested, I added VIDEO_CARDS="intel i965" and reinstalled mesa.
> After symlinking /usr/lib64/dri/i965_dri.so to the real file in
> /usr/lib64/mesa, I started Weston, and it worked properly without the
> slowness. So, confusing as it sounds, i965_dri.so is the correct driver even
> when the kernel driver is i915, as you said.

No, you should not need to do any symlinking manually. 'eselect' should do all that, and reinstalling Mesa should trigger it automatically.

> Finally, my keyboard works under Weston, but do you think it would benefit
> other users if I report that bug anyway?

weston-keyboard is an on-screen keyboard program intended primarily for touchscreens when you don't have a real keyboard.

If it's really missing, it's an issue in the Gentoo packaging or the Weston USE flags you used.

> Thanks everyone for the help! Weston appears to be working for me now.

Cool, no worries.

> [1] https://packages.gentoo.org/packages/media-libs/mesa

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.