Ubuntu – Ubuntu 12.10 OpenCL OpenGL Interop with ATI graphics

atidriversopenclopenglxorg

I have successfully installed the ATI Catalyst drivers on a my ATI hybrid graphics system running on Ubuntu 12.10. I have verified that OpenCL and OpenGL work independently; however OpenCL-OpenGL interop is not functioning correctly. I've done some debugging, but am not sure where to go from here. Can anyone help?

Details:

My system is an HP Envy 6 running Ubuntu 12.10 (all updates applied) with a ATI hybrid graphics system composed of an Radeon 7600m and Intel HD3000. I installed the latest ATI Beta drivers (v. 12.11) following these instructions:

How do I get AMD/Intel Hybrid Graphics drivers to work?

Doing this I was able to get OpenGL and OpenCL operational. glxgears runs at ~1200 fps and all of the OpenCL-only samples in the AMD APP SDK function as expected. However, any OpenCL-OpenGL interop applications fail to launch with a X Error of failed request: BadMatch (invalid parameter attributes) error. All of the sample code previously worked under Ubuntu 12.04 with the package manager ATI drivers.

To get a little more debugging information, I ran LIBGL_DEBUG=verbose /opt/AMDAPP/samples/opencl/bin/x86_64/SimpleGL. This detects my discrete GPU, appears to select the right drivers, and detects that OpenCL-OpenGL interop is enabled:

$ LIBGL_DEBUG=verbose ./SimpleGL
ukiDynamicMajor: found major device number 250
ukiDynamicMajor: found major device number 250
ukiDynamicMajor: found major device number 250
ukiOpenDevice: node name is /dev/ati/card0
ukiOpenDevice: open result is 7, (OK)
ukiGetBusid returned 'PCI:1:0:0'
ukiOpenDevice: node name is /dev/ati/card1
ukiOpenDevice: UKI_ERR_NOT_ROOT
...
ukiOpenDevice: node name is /dev/ati/card15
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiDynamicMajor: found major device number 250
ukiOpenByBusid: Searching for BusID PCI:1:0:0
ukiOpenDevice: node name is /dev/ati/card0
ukiOpenDevice: open result is 7, (OK)
ukiOpenByBusid: ukiOpenMinor returns 7
ukiOpenByBusid: ukiGetBusid reports PCI:1:0:0
ukiDynamicMajor: found major device number 250
ukiDynamicMajor: found major device number 250
ukiOpenByBusid: Searching for BusID PCI:1:0:0
ukiOpenDevice: node name is /dev/ati/card0
ukiOpenDevice: open result is 7, (OK)
ukiOpenByBusid: ukiOpenMinor returns 7
ukiOpenByBusid: ukiGetBusid reports PCI:1:0:0
Platform 0 : Advanced Micro Devices, Inc.
Platform found : Advanced Micro Devices, Inc.

Selected Platform Vendor : Advanced Micro Devices, Inc.
Device 0 : Turks Device ID is 0x1a16b40
Number of displays 1
libGL: AtiGetClientDriverName: 9.1.11 fglrx (screen 0)
libGL: OpenDriver: trying /usr/lib/fglrx/dri/fglrx_dri.so
ukiDynamicMajor: found major device number 250
ukiDynamicMajor: found major device number 250
ukiOpenByBusid: Searching for BusID PCI:1:0:0
ukiOpenDevice: node name is /dev/ati/card0
ukiOpenDevice: open result is 10, (OK)
ukiOpenByBusid: ukiOpenMinor returns 10
ukiOpenByBusid: ukiGetBusid reports PCI:1:0:0
glXCreateContextAttribsARB 0x7f4e05938280
Number of interoperable devices 1
Interop Device ID is 0x1a16b40
libGL: OpenDriver: trying /usr/lib/fglrx/dri/tls/i965_dri.so
libGL: OpenDriver: trying /usr/lib/fglrx/dri/i965_dri.so
libGL error: dlopen /usr/lib/fglrx/dri/i965_dri.so failed     (/usr/lib/fglrx/dri/i965_dri.so: cannot open shared object file: No such file or     directory)
libGL: OpenDriver: trying /usr/lib32/fglrx/dri/tls/i965_dri.so
libGL: OpenDriver: trying /usr/lib32/fglrx/dri/i965_dri.so
libGL error: dlopen /usr/lib32/fglrx/dri/i965_dri.so failed     (/usr/lib32/fglrx/dri/i965_dri.so: cannot open shared object file: No such file or directory)
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL: OpenDriver: trying /usr/lib/fglrx/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/fglrx/dri/swrast_dri.so
libGL error: dlopen /usr/lib/fglrx/dri/swrast_dri.so failed (/usr/lib/fglrx/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/lib32/fglrx/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib32/fglrx/dri/swrast_dri.so
libGL error: dlopen /usr/lib32/fglrx/dri/swrast_dri.so failed (/usr/lib32/fglrx/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  28
  Current serial number in output stream:  28

I'm not sure where to go from here. This could either be a lingering issue with the known ATI Ubuntu 12.10 problems or something new. Anyone have any suggestions?

Best Answer

Ok. Figured it out (at least in my case). The libGL.so file in /usr/lib/fglrx is not found by by the linker. Adding

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/fglrx

to my ~/.bashrc (or ~/.profile) made it work. This shouldn't be required though because the driver installer adds /usr/lib/fglrx to the /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf file.

EDIT Note: My previous post blamed this bug on Cinnamon (bug 1483); however, this was incorrect. The solution documented is correct.