eglstreams-kms-example
eglstreams-kms-example copied to clipboard
Producer/Consumer multi process example
Hi I'm really interested in a multi process producer consumer example. I cannot figure out how the context will be shared between the two graphic threads (processes). Sorry for opening a new issue, but there is no other way to post a message on this thread. Thanks.
It should be possible to have the producer and the consumer in separate processes using EGL_KHR_stream_cross_process_fd:
https://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_stream_cross_process_fd.txt
There is sample code in that spec for using a UNIX Domain Socket to pass the file descriptor for the stream between two processes, but it is pretty cumbersome. To experiment, I would start with a single process, but use EGL_KHR_stream_cross_process_fd to create the producer and consumer. After that, I would have one process create the fd, then fork, and have the child use the fd. Once that much works, then I'd try to wire up the fd passing over a unix domain socket.
Let me know if that doesn't work.
Hi Andy, I managed to get one nVidia graphics card (GTX760) and I tried to build your example. I have kernel 4.1.2 and the 364.12 driver installed:
" azanosch@azanosch-PC ~/WORK/eglstreams-kms-example $ uname -r 4.1.2-040102-generic azanosch@azanosch-PC ~/WORK/eglstreams-kms-example $ azanosch@azanosch-PC ~/WORK/eglstreams-kms-example $ glxgears -info Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. GL_RENDERER = GeForce GTX 760/PCIe/SSE2 GL_VERSION = 4.5.0 NVIDIA 364.12 GL_VENDOR = NVIDIA Corporation "
The problem is I get at runtime a strange error and I don't know from where to start:
./eglstreams-kms-example ERROR: DRM_CLIENT_CAP_ATOMIC not available. azanosch@azanosch-PC ~/WORK/eglstreams-kms-example $
The build log of the application doesn't throw any error, only some warnings that I don't think are related to the runtime issue:
make gcc -c main.c -o main.o -Wall -Wextra -g -I /usr/include/libdrm -I khronos gcc -c egl.c -o egl.o -Wall -Wextra -g -I /usr/include/libdrm -I khronos gcc -c kms.c -o kms.o -Wall -Wextra -g -I /usr/include/libdrm -I khronos kms.c: In function ‘AssignAtomicRequest’: kms.c:436:12: warning: missing braces around initializer [-Wmissing-braces] struct PropertyIDs propertyIDs = { 0 }; ^ kms.c:436:12: warning: (near initialization for ‘propertyIDs.crtc’) [-Wmissing-braces] kms.c:436:12: warning: missing initializer for field ‘plane’ of ‘struct PropertyIDs’ [-Wmissing-field-initializers] kms.c:63:7: note: ‘plane’ declared here } plane; ^ gcc -c utils.c -o utils.o -Wall -Wextra -g -I /usr/include/libdrm -I khronos gcc -c eglgears.c -o eglgears.o -Wall -Wextra -g -I /usr/include/libdrm -I khronos gcc -o eglstreams-kms-example main.o egl.o kms.o utils.o eglgears.o -lEGL -lOpenGL -ldrm -lm
Do you have any idea from where might this problem come?
Regards, Aurelian
Hi Aurelian, since you gave the glxgears example: is X currently running? eglstreams-kms-example is intended to run when X is not running. Beyond that, are there any useful messages in the kernel log at the time of the failure?
The DRM_CLIENT_CAP_ATOMIC error is in response to this:
ret = drmSetClientCap(drmFd, DRM_CLIENT_CAP_ATOMIC, 1);
if (ret != 0) {
Fatal("DRM_CLIENT_CAP_ATOMIC not available.\n");
}
So I think the next step is to figure out why drmSetClientCap() failed.
I get the same DRM_CLIENT_CAP_ATOMIC failure on Ubuntu 17.04 with nvidia-375 & nvidia-381, and "ERROR: unable to query DRM-KMS resources" next if I skip over it (out of curiosity). Any idea what would cause that?
I installed Arch and was able to get further than on Ubuntu (note, the DRM_CLIENT_CAP_ATOMIC failure appeared identically to Ubuntu when I forgot to modprobe nvidia-drm modeset=1
initially).
Now I get a correct single rendering of gears, but the app hangs upon the second call to eglSwapBuffers. I'll make a new issue for that...