Re: [AD] Test patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Chris wrote:

I don't like the idea of telling the user to yield. It ought to Just Work, even if yielding is a good idea in many cases.


I agree.. but I can't see anything that Allegro does that could help solve the problem short of calling rest(0) itself.


You might be right. I implemented a FIFO queue so that it would pass control to a thread blocking on XLOCK when another thread XUNLOCK'd. Unfortunately it didn't help with the problem in test.c. Either my implementation was buggered (probably), or the FIFO queue idea was useless to begin with. Like, you can give control to a thread that is waiting on XLOCK, but what if it's not waiting on XLOCK and just sleeping for some other reason?

Hmm, that's an idea. Using bg_man might be the source of the problem. It only wakes up every so often, and under linux it isn't given higher priority than the main thread (actually I did try that and ran test as root, but it didn't seem to have any effect). If X event handling was moved to dedicated thread and always blocked on XLOCK (instead of just sleeping) then the OS scheduling (or the FIFO queue idea) might work better. I was going to stop using bg_man for the X events in the new_api_branch anyway, when getting to keyboard and mouse input.

BTW, don't you find that you get rather different numbers in the test program with your rest(0) patch?


Hmm.. you're right. I actually get a few thousand more blits per second with the yield than without. I also find it odd that I get better memory->screen performance than screen->screen. Since the screen bitmap in X is just a memory bitmap, I don't see why it would be so different.


Actually, I get less blits with the yield than without.

Peter




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/