On Saturday 30 April 2011 18:26:04 Emanuele Oriani wrote:
Hi Stefan,
What do you think about using inline spinlocks (in asm code maybe) to implement locks? Clearly an optimized spinlock would mean different code for different compilers/architectures, but shouldn't it be the best solution?
I am usually pessimistic about hand-written assembler optimizations. You can give it a try, but compilers are pretty clever these days.
I think trying to optimize the lock calls is a more promising way. We can't simply drop the ENTER_GL/LEAVE_GL calls, as you found out in SC2. We may be able to reduce the number of those calls by moving blocks of opengl calls closer together.
There's also the wined3d lock, which is somewhat like the big kernel lock. There's room for improvement there as well, if we soften the "you must call wined3d under lock" rule. However the wined3d lock is the smaller problem compared to the X11 lock.