I'd prefer the kernel implementation. If you do the swapping in user-space you require a context switch to each client that needs to swap. However, you need to react to the vblank interrupt as fast as possible in order to finish the swap during the vertical retrace.
I hadn't thought about that. If there are more than 3 or 4 clients waiting to swap, the last one probably won't get woken up until past the vblank period. I think that effectively kills all the user-space proposals. :(
If that turns out to be too complicated then the user-space thread would be my second choice. Using a signal is not really an option IMHO.
I've been thinking about this before and I got stuck at a more practical problem. Maybe my thoughts are a bit Radeon-centric though. The problem is that you have rendering commands queued in the ring buffer. When the vblank IRQ occurs you want to swap immediately. So you can't put the swap commands (blits, whatever) on the same command queue. That would delay the swap for an unspecified time and make the whole procedure useless.
We discussed this before and it was concluded that there needs to be some sort of high priority command queue. IIRC certain hardware (was it i8xx?) has such a high priority queue. Is there a good way to implement one in software if the hardware doesn't have such an extra queue?
My idea was to build some sort of scheduler for the GPU into the DRM that would never fill up much of the hardware command queue. Then it could squeeze in higher priority commands without much delay. A full blown scheduler for the GPU sounds like overkill to me though. Does anyone have a simpler idea?
That does sound like overkill. I would expect that there will only be swaps pending for a small percentage of the time. Perhaps when there is a swap pending in, say, the next frame or two we could put the driver in "partial full" mode. In that mode it would only fill the command queue part way, like you suggest. That should be fine if there are only a couple apps running at once, but I suspect it won't scale well.
Sounds like this will take some more thinking...
------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click -- _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel