Languages

Menu
Sites
Language
GLPlayer not thread safe

Hi,

I noticed that the GLPlayer/GLRenderer are not threadsafe : I had a lot of trouble while using another thread to prepare my renderings : a lot of OUT_OF_MEMORY, and corrupted textures.

More precisely, I was using a thread managing the application basic and the rendering, and another managing the game logic and the rendering preparation.

There was no GL calls in my first thread, and every 60fps the GLplayer was waiting for the rendering preparation to complete (if needed), then locking while the rendering was done, then unlocking, and was starting again (I agree, it's a bit ugly).
At the same time, the second thread was preparing the gl objects (vbo, textures, etc...), and waiting for the draw request. Then it rendered, and started again...

The problem was that randomely, the memory was "running out" (even if there was still plenty free), or the textures were corrupted...

As I found that really weird, and after a lot of experiments, I tried to export the content of my main loop in the draw call of the renderer... And shazam, no problem anymore.
I hope that it helps someone,
and if there is a Tizen developper here, could it be possible to implement a Thread oriented GLPlayer (the current version is Timer oriented isn't it ?).
Cheers

Benjamin

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

3 Replies
muditha murthy
Tizen Opengl does not guarantee sub-thread. Please call rendering methods on Maint-Thread. Follow Q/A is in Tizen doxygen. Q: How can I support a UI in a non-main thread? A: The UI and Graphics namespace APIs are not thread-safe. If you need to offload some tasks, create a worker thread to perform functions, such as downloading data, decoding images, and playing sound, but handle all the UI controls in the main thread.
Benjamin Blois
Ok, thank you for confirming that, I spend a loooot of time on that one, I'm glad that the source of my problems is now found. I think that it could be a really good idea to indicate the non threadsafeness of the couple GLPlayer/GLRenderer in the appropriate sections of the documentation (in the description of those classes, and in the programming guide). Moreover, as many graphical intensive application rely on an infinite loop that performs the logic and prepares the rendering, and as OpenGL itself is threadsafe, implementing a second Player/renderer couple relying based on thread would be a good idea. By the way, I was wondering, is this forum maintained by Samsung, or only by people working on Tizen ? Is this the right place to ask for features or to make feedback ? (aka, are the Samsung Developers getting any information of what's said here ?) Thanks Benjamin
muditha murthy
If find any bugs or want to propose any change you can raise itthrough "Bug Tracker" @https://bugs.tizen.org/jira