Out of that, I ended up with the project of making GLX allow binding a single GL context into multiple threads. This should largely fix the disaster that is GL multithreading. The basic idea is: I have a collection of threads that want to work on a single context because they're sharing all the same objects and want to have some sort of serialization into a GL command stream. If we pass the context around between the threads, unbinding and rebinding, you get this forced command stream flushing that will kill performance. If we make multiple contexts, then at the transition of changed objects between one thread and another you have to flush in the producer and re-bind the object in the consumer. Whether or not that could perform well, we determined that in the gstreamer model we couldn't know in time whether the producer is going to be in a different thread than the consumer: you'd have to flush every time just like passing a single context around.
So here comes a simple hack: Just rip out the piece of the spec that says you can't bind one context into multiple threads. Tell the user that if they do this, locking is up to them. It's not an uncommon position for projects to take, and it will let us do exactly what we want in gstreamer: everyone works in the same context[1], and when you want access to the GL context, just grab the lock for the context and go.
Development trees are at:
http://cgit.freedesktop.org/~anholt/pig
http://cgit.freedesktop.org/~anholt/mes
The testcase gets bad rendering at the moment. So I made the testcase for the non-extended version, and it still didn't render, with either i965 or swrast. Next step is to test my testcase against someone else's GL.
Incidentally, Apple's GL spec allows binding a single context to multiple threads like this. Windows GL doesn't.
[1] OK, so that's not exactly true. I'm assuming that elements negotiate a single context through some handwavy caps magic -- people have said that this is possible. You can still end up with two contexts, though, like with the following pipeline: videotestsrc ! glupload ! glfilterblur ! gldownload ! gamma ! glupload ! glimagesink. The second group of gl elements doesn't know about the first, or have any way to communicate with them. But if each element calls glXMakeCurrent at the start, it'll be approximately free for the one-context case, and just work for the multiple-contexts case.
Anonymous
December 8 2009, 06:42:06 UTC 2 years ago
I was wondering...
Is Direct3D structurally better in that area? It's hard to know just looking at the docs.I've always wondered if a modern D3D-ish API for linux could be useful in addition to opengl...
OG.
December 8 2009, 07:14:41 UTC 2 years ago
Re: I was wondering...
No. We're years behind on enabling hardware features exposed in the current OpenGL API. Giving us more APIs to support means that both would be supported worse over time.Anonymous
December 25 2009, 11:47:43 UTC 2 years ago
Re: I was wondering...
Interesting, and makes sense. What hardware features are you talking about at this point? Video decoding?OG.
December 28 2009, 06:27:15 UTC 2 years ago
Re: I was wondering...
No, I meant compare the list of extensions rolled into core GL currently to what we expose in Mesa. Of course, the very newest stuff is applicable to video decode as well, but that wasn't where I was going in the previous comment.Anonymous
December 28 2009, 10:21:24 UTC 2 years ago
Re: I was wondering...
Ok, I'll have a look, thanks.OG,
Anonymous
December 26 2009, 09:11:04 UTC 2 years ago
Re: I was wondering...
Intel, should consider hiring graphic driver developers that can implement OpenGL 3.x API or at least finish OpenGL 2.x and make GLSL functional for this platform.Trust me, its a big market, also people not using GNU/Linux are not using it because of bad state of graphic drivers.
December 28 2009, 06:26:06 UTC 2 years ago
Re: I was wondering...
Uh, yeah, that's what I and others on my team work on.Anonymous
January 26 2010, 14:08:30 UTC 2 years ago
Poulsbo GM500 driver
Hi, are there any hopes for cleaning up the Poulsbo GMA500 driver code and including it in Intel driver?Afaik there is native working driver for Ubuntu, but its messy.