|
| 1 | +# Docker - Mesa 3D OpenGL Software Rendering (Gallium) - LLVMpipe, and OpenSWR Drivers |
| 2 | + |
| 3 | +[](https://travis-ci.org/jamesbrink/docker-opengl) [](https://hub.docker.com/r/jamesbrink/opengl/) [](https://hub.docker.com/r/jamesbrink/opengl/) [](https://hub.docker.com/r/jamesbrink/opengl/) [](https://microbadger.com/images/jamesbrink/opengl "Get your own image badge on microbadger.com") [](https://microbadger.com/images/jamesbrink/opengl "Get your own version badge on microbadger.com") |
| 4 | + |
| 5 | + |
| 6 | +## About |
| 7 | + |
| 8 | +Minimal Docker container bundled with the Mesa 3D Gallium Drivers: [LLVMpipe][mesa-llvm] & [OpenSWR][openswr], enabling OpenGL support inside a Docker container without the need for a GPU. |
| 9 | + |
| 10 | + |
| 11 | +## Features |
| 12 | + |
| 13 | +* Alpine Linux 3.7 |
| 14 | +* LLVMpipe Driver (Mesa 18.0.1) |
| 15 | +* OpenSWR Driver (Mesa 18.0.1) |
| 16 | +* OSMesa Interface (Mesa 18.0.1) |
| 17 | +* softpipe - Reference Gallium software driver |
| 18 | +* swrast - Legacy Mesa software rasterizer |
| 19 | +* Xvfb - X Virtual Frame Buffer |
| 20 | + |
| 21 | +## Docker Images |
| 22 | + |
| 23 | +| Image | Description | |
| 24 | +| ------------------------- | ----------------------------------------------------------------------- | |
| 25 | +| `jamesbrink/opengl` | Minimal image, good to extend `FROM` | |
| 26 | +| `jamesbrink/opengl:demos` | Same image with added mesa3d demos such as `glxinfo`, `glxgears`, etc.. | |
| 27 | + |
| 28 | +## Usage |
| 29 | + |
| 30 | +I build this image primarily to extnend from for other projects, but below are some simple examples. This image is already loaded with a trivial entrypoint script. |
| 31 | + |
| 32 | +Extending from this image. |
| 33 | + |
| 34 | +```Dockerfile |
| 35 | +FROM jamesbrink/php:7.2 |
| 36 | +COPY ./MyAppOpenGLApp /AnywhereMyHeartDesires |
| 37 | +RUN apk add --update my-deps... |
| 38 | +``` |
| 39 | + |
| 40 | +Running a simple glxgears test. |
| 41 | + |
| 42 | +```shell |
| 43 | +docker run jamesbrink/opengl:demos glxgears -info |
| 44 | +``` |
| 45 | + |
| 46 | +Running glxgears with OpenSWR |
| 47 | + |
| 48 | +```shell |
| 49 | +docker run jamesbrink/opengl:demos -e GALLIUM_DRIVER=swr glxgears -info |
| 50 | +``` |
| 51 | + |
| 52 | +## Environment Variables |
| 53 | + |
| 54 | +### High level settings |
| 55 | + |
| 56 | +| Variable | Default Value | Description | |
| 57 | +| ----------------------- | -------------- | -------------------------------------------------------------- | |
| 58 | +| `XVFB_WHD` | `1920x1080x24` | Xvfb demensions and bit depth. | |
| 59 | +| `DISPLAY` | `:99` | X Display number. | |
| 60 | +| `LIBGL_ALWAYS_SOFTWARE` | `1` | Forces Mesa 3D to always use software rendering. | |
| 61 | +| `GALLIUM_DRIVER` | `llvmpipe` | Sets OpenGL Driver `llvmpipe`, `swr`, `softpipe`, and `swrast` | |
| 62 | + |
| 63 | +### Lower level settings / tweaks |
| 64 | + |
| 65 | +| Variable | Default Value | Description | |
| 66 | +| ---------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 67 | +| `LP_NO_RAST` | `false` | LLVMpipe - If set LLVMpipe will no-op rasterization | |
| 68 | +| `LP_DEBUG` | `""` | LLVMpipe - A comma-separated list of debug options is accepted | |
| 69 | +| `LP_PERF` | `""` | LLVMpipe - A comma-separated list of options to selectively no-op various parts of the driver. | |
| 70 | +| `LP_NUM_THREADS` | `""` | LLVMpipe - An integer indicating how many threads to use for rendering. Zero (`0`) turns off threading completely. The default value is the number of CPU cores present. | |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | +[openswr]: http://openswr.org/ |
| 78 | +[mesa-llvm]: https://www.mesa3d.org/llvmpipe.html |
| 79 | + |
| 80 | + |
| 81 | + |
0 commit comments