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

Tapani Pälli tapani.palli at intel.com
Fri Jan 30 02:33:41 PST 2015


As a Finn I interpret silence as 'yes' :) So I started to hack on swap 
completion event support. I believe it can be useful for other backends 
also since then application can throttle rendering and receive 
information on swaps.

I made early hacky prototype that fixes the issues I've seen with nacl 

I have a few questions on implementation details for the 
'waffle_swap_complete'. This is my proposal for the API:

typedef void (*waffle_swapbuffers_cb) (struct waffle_window *);

bool waffle_set_swap_complete_handler(waffle_swapbuffers_cb func);
(would fail if backend does not support this)

Optionally we could put timestamp there also as callback data but I'm 
not sure what format is preferred for that. Any ideas here would be 
good. I'm not sure the OML triple (ust, msc, sbc) like in 
GLX_INTEL_swap_event make sense or should it be something simpler?

Then, whenever waffle_wndow_swap_buffers(window) gets called, backend 
will call callback if it is set. It should be noted that it can happen 
from a separate thread.

How does this sound?

On 01/27/2015 03:03 PM, Tapani Pälli wrote:
> Hello;
> 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:
> http://koti.kapsi.fi/~tpalli/naclgears-bug/
> Here's a hacked version where I sleep (just a tiny bit) between frames
> and tadaa it works:
> http://koti.kapsi.fi/~tpalli/naclgears/
> 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
> this?
> Thanks;
> 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
> _______________________________________________
> waffle mailing list
> waffle at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/waffle

More information about the waffle mailing list