[waffle] [PATCH 0/7] nacl backend implementation

Tapani Pälli tapani.palli at intel.com
Tue Jan 27 05:03:03 PST 2015


Unfortunately I've noticed a problem with the implementation. Native 
client expects 3D API to be used so that caller passes a callback that 
gets called when swapbuffers finishes. I haven't found explicit 
documentation of this to be *mandatory* but all the examples work this 
way and lots of comments on different forums suggest to use it like 
this. Now what follows is that while current nacl backend takes care 
that user cannot 'bomb' swapbuffers callback, it cannot take care that 
user would not go and call GL API (for example glClear) before 
swapbuffers finishes. For this to happen there would need to be callback 
mechanism or a new API to call on start of each frame. I'm not yet 100% 
sure but I believe this would fix the issues I'm seeing ATM.

I ported es2gears to Waffle to experiment this, here is a version that 
shows the problem, the artifacts on top of gears seem to relate to 
calling glClear 'too early' as if I remove glClear call it looks good, 
just not cleared:


Here's a hacked version where I sleep (just a tiny bit) between frames 
and tadaa it works:


I'm not yet sure what to do with this, one option would be to offer a 
callback mechanism in Waffle ("swap finished") but there are no existing 
callbacks like this in waffle. Would it be ok and create something like 


On 01/23/2015 09:59 AM, Tapani Pälli wrote:
> Hi;
> Here are patches for the NaCl backend implementation. While testing I
> noticed that there is a general issue with Chrome and DRI3 which is well
> described here: http://keithp.com/blogs/chromium-dri3/ . So for testing
> on DRI3 you'll need to use '--disable-gpu-sandbox' for this to work.
> Otherwise you will see :
> libGL error: DRI3 Fence object allocation failure Operation not permitted"
> which results in everything else failing, like creation of graphics
> context and so on. I haven't checked what's the status of fixing this
> but it is good to know when testing. This happened to me on Fedora 21.
> The whole series is in a branch here:
> http://cgit.freedesktop.org/~tpalli/waffle/log/?h=nacl
> and a 'demo' of gl_basic available here:
> http://koti.kapsi.fi/~tpalli/nacl/
> Note, I will be extending this to support OpenGL ES 3.0 later/soon. I'm
> also investigating how to make this work for "portable native client",
> pnacl-clang.
> Thanks;
> Tapani Pälli (7):
>    nacl: add supports_context_api implementation
>    nacl: add implementation for waffle_config_choose
>    nacl: add implementation for waffle_context_create
>    nacl: add implementation for window create and resize
>    nacl: add implementation for waffle_make_current
>    nacl: add implementation for waffle_window_swap_buffers
>    nacl: add implementation for waffle_dl_sym
>   src/waffle/nacl/nacl_config.c      |  30 ++++++++
>   src/waffle/nacl/nacl_config.h      |   2 +
>   src/waffle/nacl/nacl_container.cpp | 136 +++++++++++++++++++++++++++++++++++++
>   src/waffle/nacl/nacl_container.h   |  11 +++
>   src/waffle/nacl/nacl_context.c     |   6 ++
>   src/waffle/nacl/nacl_display.c     |   9 ++-
>   src/waffle/nacl/nacl_platform.c    |  65 +++++++++++++++++-
>   src/waffle/nacl/nacl_platform.h    |   1 +
>   src/waffle/nacl/nacl_swap_thread.h |  72 ++++++++++++++++++++
>   src/waffle/nacl/nacl_window.c      |  10 ++-
>   src/waffle/nacl/nacl_window.h      |   1 +
>   11 files changed, 337 insertions(+), 6 deletions(-)
>   create mode 100644 src/waffle/nacl/nacl_swap_thread.h

More information about the waffle mailing list