The Khronos Group - a non-profit industry consortium to develop, publish and promote open standard, royalty-free media authoring and acceleration standards for desktop and handheld devices, combined with conformance qualification programs for platform and device interoperability.

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: Check the busy status of the OpenVG core

You don't need to worry about when rendering is complete, the swap handles presentation and synchronization.

You can explicitly flush a context with vgFlush() if you'd like, but a swap has an explicit flush. The swap will block until it's safe to start issuing rendering commands again. This could before the previous frame has completed rendering. But it will ensure your not rendering to a buffer which is currently being displayed.

There normally lots of mechanism under the cover to do this kind of synchronization, but it's not necessary for applications by any means since the implementation can always handle all the synchronization that's required.

Keep in mind however, some implementation might be more optimal then others, allowing greater overlap of resources.

Re: Check the busy status of the OpenVG core

Well, the thing is I am working in part of the implementation, I cannot afford to wait any blocking function since I would be wasting precious CPU time on doing nothing. Since I am the one swapping the buffers directly, I was wondering if there was a standard mechanism of checking the status using the API or I had to drill down to the system to get an IRQ or something else to get that status flag. I guess I just can do the latest.

Re: Check the busy status of the OpenVG core

If you doing the implementation, you shouldn't be calling eglSwapBuffers(), only applications should be doing this. The implementation of eglSwapBuffers() should tie into platform/OS specific code which handles synchronization and the actual buffer swap. In the implementation of this, you should make use of the OpenVG driver's internals to handle synchronization. How this is handled, depends on the windowing system, driver etc.

If your aiming for something optimal, you want to ensure eglSwapBuffers() will only block the application as long as it needs too. This allows it to start queue rendering commands while the GPU is busy. But you also need to ensure it doesn't return before it's safe to do so. Driver's absolutely need a mechanism to know when rendering is complete, popular mechanisms are callbacks, or blocking function calls. If it's a blocking function call, you can have a thread block waiting for rendering to complete prior to doing the actual swap, so you can return early on the eglSwapBuffers().