hi there,
I need some help with CK.
I've hacked a simple KMS backend for SDL 1.2, and it uses double buffering in my SDL_Flip implementation. What's more, it has a delay in SDL_Flip that waits for the flipping event to finish, in order to avoid tearing.
However, after I chose CK as a test case to polish this backend, I found some facts that have me keep wondering...
If I leave g_pTimer->TimeToDelay(), that call introduces some more delay in the game's main loop that, as a side effect, frees the cpu when there's time left after processing events and graphics in the current loop: in other words, it prevents "fast wild looping" in the game's main loop that would cause 100% CPU to be used. BUT since I introduced my own delay for each frame (in the SDL_Flip() implementation), this extra delays causes the game to miss vblanks, so it runs with less FPS than it should.
Well, my SDL_Flip() function does precissely that, too, but if I disable g_pTimer->TimeToDelay() call, I still get 100% CPU usage, wich shouldn't happen since as I said my SDL_Flip() implementation would block the program for the time remaining to the 16ms, when the "flipping complete" event takes place.
So I was wondering: does g_pVideoDriver run in a separate thread? That would explain why, even if I have the delay in the function SDL_Flip() called by g_pVideoDriver->updateScreen(), the main game loop runs like crazy and still takes 100% CPU.
If it's true, where's that thread launched? Is it at g_pVideoDriver->start() ?
How? I can't see anything in g_pVideoDriver->start() mentioning threads or the SDL fnx to manage them.
I'd like to discuss these sources more in-depth so I entered the IRC channel, but it seems to be pretty dead these days...
Help understanding CK's sources: separated video thread?
KMS SDL backend
I'd like to use this KMS SDL backend of yours. Any chance of open sourcing it? I see you're on Github, I'm sure it would be useful for others too. Maybe you would consider putting it on there?
Dunno why have I thought of this only now but... guess it is a coincidence!
To the few random visitors who may be interested, looks like the KMS backend has been uploaded (very) recently.
Forum post: http://www.raspberrypi.org/phpBB3/viewt ... 78&t=25146
GitHub page: https://github.com/vanfanel/SDL12-kms-dispmanx
To the few random visitors who may be interested, looks like the KMS backend has been uploaded (very) recently.
Forum post: http://www.raspberrypi.org/phpBB3/viewt ... 78&t=25146
GitHub page: https://github.com/vanfanel/SDL12-kms-dispmanx
Website: https://ny.duke4.net/