I'm currently running Ubuntu 16.04.2, fairly new install with just enough to start programming. I do have a r9 390 AMD card which has been having lots of issues with the AMD drivers, but I don't think that is an issue.
I created a dockerfile with the following snippet:
FROM ubuntu:16.04
.....
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
WORKDIR /buildls
CMD ["bash"]
RUN apt-get install -y x11-apps
RUN apt-get install -y libcanberra-gtk*
RUN apt-get -y install libglfw3-dev
RUN apt-get -y install libglew-dev
RUN apt-get -y install mesa-utils
.......
After building it, I run it with:
docker run -it `#container process` \
-v /tmp/.X11-unix:/tmp/.X11-unix `#Allows the X11 server to be shared (GUI)` \
-v $(pwd)/volume:/app `#Shares a folder, one down in current directory (~/volume) with ROOT/app in the container` \
-e DISPLAY=$DISPLAY `#Shares the display between the 2 systems` \
opengl_why_you_no_work \
I created a simple GL loader program, with GLFW and GLEW, I made 2 versions to support OpenGL 2.1 (you'll see why later) and 3.2. Between the sample program that I wrote (with some debugging output calls) and
glxinfo|grep OpenGL
I get some interesting questions. Using the glxinfo call on my host, I get
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD HAWAII (DRM 2.46.0 / 4.8.0-58-generic, LLVM 3.8.0)
OpenGL core profile version string: 4.1 (Core Profile) Mesa 12.0.6
OpenGL core profile shading language version string: 4.10
OpenGL version string: 3.0 Mesa 12.0.6
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 12.0.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
On the docker image:
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.8, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.0.6
OpenGL core profile shading language version string: 3.30
OpenGL version string: 3.0 Mesa 12.0.6
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 12.0.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
hmmm, vendors? So, the program written for OpenGL 2.1, using:
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
Runs on both host and docker; simple rendering... but it works. Even though it renders on the docker image, I still get this error:
libGL error: failed to open drm device: Permission denied
libGL error: failed to load driver: radeonsi
If I try to run the version made for OpenGL 3.2 on the docker image, I get no rendering, no window, the same 2 errors above, and this output:
Renderer: (null)
OpenGL version supported (null)
instead of the 2.1 version on the docker image:
Renderer: Gallium 0.4 on llvmpipe (LLVM 3.8, 256 bits)
OpenGL version supported 3.0 Mesa 12.0.6
or the result of running either version on the host:
Renderer: Gallium 0.4 on AMD HAWAII (DRM 2.46.0 / 4.8.0-58-generic, LLVM 3.8.0)
OpenGL version supported 4.1 (Core Profile) Mesa 12.0.6
So, I'm assuming it has something to do with the vendor, X.org versus VMware, Inc. Can I override, passthrough, replace, or otherwise work around this? I could probably write the code for OpenGL 3.0 (where is the fun in that?) but the libGL errors have me concerned once I get more complex in the program. Additionally, I want to try with OpenCL and I'm sure I'll have similar issues.