[waffle] [PATCH 6/7] nacl: add implementation for waffle_window_swap_buffers

Chad Versace chad.versace at intel.com
Tue Feb 3 10:50:19 PST 2015


On 01/22/2015 11:59 PM, Tapani Pälli wrote:
> Implementation for nacl is somewhat different as for other platforms,
> platform needs to ensure that the previous swap has finished before
> issuing another one. This is done by introducing a worker thread that
> does buffer swaps from a work queue.
> 
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>


> +// Thread takes care that we do not issue another buffer
> +// swap before previous swap has completed.
> +class NaclSwapThread : public pp::SimpleThread

> +
> +    void swap_buffers(int32_t result)
> +    {
> +        ctx.SwapBuffers(pp::BlockUntilComplete());
> +    }

I think I discovered why you were seeing rendering artifacts despite using BlockUntilComplete
as the callback. Quoting the NaCl API reference:

    int32_t(* PPB_Graphics3D::SwapBuffers)(PP_Resource context, struct PP_CompletionCallback callback)

    [...]

    SwapBuffers runs in asynchronous mode. Specify a callback function and the argument for that
    callback function. The callback function will be executed on the calling thread ***after*** the color
    buffer has been composited with rest of the html page.

The keyword is "after". If I understand this correctly, ctx.SwapBuffers() returned immediately.
Later, after webpage composition completed, the NaCl runtime called the BlockUntilComplete
callback, which is a no-op at that time. This is all new to me, though, so maybe I'm completely
wrong.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 884 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/waffle/attachments/20150203/04160e96/attachment.sig>


More information about the waffle mailing list