Prefer render nodes instead of X to discover GPU
Submitted by Sven Arvidsson
Assigned to Zhigang Gong @gongzg
Link to original bug (#107582)
Description
At the moment Beignet defaults to using X11/DRI to find the GPU. This makes it hard to use the integrated GPU when a discrete graphics card is used as the primary display driver.
Beignet reports an unhelpful error message:
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument Assuming 131072kB available aperture size. May lead to reduced performance or incorrect rendering. get chip id failed: -1 [2]
and no devices are found.
The only way to get OpenCL working is by unsetting the DISPLAY variable so X isn't found, and by doing so only non-x applications can use OpenCL.
It would be better if render nodes were used by default (I think these are enabled by default since kernel 3.15?) and X11/DRI only as a fallback.
Compiling Beignet without X11 gets rid of this problem and seems to work fine in all the environments I tried. (AMD GPU as primary with X11, Intel GPU as primary with X11, from a a headless console environment, etc.)
Possibly X11 support could be removed entirely to cut down on dependencies.
The documentation on https://www.freedesktop.org/wiki/Software/Beignet/ could use an update too. It took far longer to figure out how to get this working than I care to admit ;-)