Weird behaviour sharing textures between contexts (glGetTexImage works, but painting crashes) unless sharing display values
Submitted by Emilio Cobos Álvarez
Assigned to Ian Romanick
Created attachment 120394 Test case
I initially discovered this bug trying to share textures from different threads, but it also fails in single-threaded mode.
A texture created using a shared context,
Trying to paint a texture created from another thread (using a shared context) generates garbage unless that context has been created using the same display value, and sooner or later ends up crashing with:
intel_do_flush_locked failed: No such file or directory
I attach a test case that crashes on resize for me (when using the shared texture). I used glut for convenience in the test-case, if you want me to update it to use just X/GLX, please tell me.
To compile the test-case I used:
g++ test.cpp -std=c++11 -Wall -pedantic -lX11 -lGL -lglut -pthread -o test
The test-case just creates a 1x1 blue texture in the main thread, and a 1x1 red texture in another thread, using a shared context, and then tries to paint the second one using a simple GL program from the first one, once the shared context has been unbound.
The test-case as-is produces a crash on resize (the first paint grabs the first texture), but if comments in lines 60 and 61 are toggled (if the shared context uses the same display value as the "main" one), it produces the expected output.
The weird thing is that
glGetTexImage work as expected, even when not using the same display value.
I use an integrated Intel HD4600 card.
Another person tested it with propietary nvidia drivers and the test-case worked as expected.
Attachment 120394, "Test case":