On 4 February 2015 at 06:20, Tapani Pälli <tapani.pa...@intel.com> wrote: > > > On 02/03/2015 07:32 PM, Emil Velikov wrote: >> >> On 2 February 2015 at 13:08, Tapani Pälli <tapani.pa...@intel.com> wrote: >>> >>> Patch introduces a new API that enables application to register >>> a callback to be called when swapbuffers has finished. This can be >>> used to throttle rendering loop. >>> >> [...] >>> >>> @@ -173,6 +174,9 @@ bool >>> waffle_is_extension_in_string(const char *extension_string, >>> const char *extension_name); >>> >>> +bool >>> +waffle_register_swap_callback(waffle_swapbuffers_cb func); >>> + >> >> Perhaps inlining the typedef in there, and wrapping it in >> WAFFLE_API_VERSION (alongside the function prototype) ? > > > I put it in separate header so that wcore_platform.h would not need to > include whole "waffle.h" but if that feels ok then typedef can be moved > here. > Hmm good point. I would leave the final decision to Chad, but imho things will be better if we're compacted.
>> Fwiw changing the func prototype to something like the following will >> be more consistent, and less likely to abuse. >> >> bool >> waffle_window_register_swap_callback(struct waffle_window *window, >> waffle_swapbuffers_cb func); > > > This means that callback would be window specific. I think this is ok, > although then user needs to register callback for each window separately and > window argument could be removed from the actual callback. > True, and I don't think it can be seen as a problem. >> On the topic of the OML triple (ust, msc, sbc), I cannot really >> comment as I've never had the pleasure. >> >>> diff --git a/src/waffle/api/waffle_gl_misc.c >>> b/src/waffle/api/waffle_gl_misc.c >>> index 138974d..ac155c0 100644 >>> --- a/src/waffle/api/waffle_gl_misc.c >>> +++ b/src/waffle/api/waffle_gl_misc.c >>> @@ -108,3 +108,20 @@ waffle_get_proc_address(const char *name) >>> >>> return api_platform->vtbl->get_proc_address(api_platform, name); >>> } >>> + >>> +WAFFLE_API bool >>> +waffle_register_swap_callback(waffle_swapbuffers_cb func) >>> +{ >>> + const struct api_object *obj_list[] = { >>> + (void*) func, >>> + }; >>> + >>> + if (!api_check_entry(obj_list, 1)) >>> + return false; >>> + >> >> With the "struct waffle_window *" in you can use it so that one does >> not abuse the API too much :) > > > I'm now sure what would be the abuse case? > Maybe "misuse" is a better word - iirc api_check_entry confirms that all the objects in obj_list are linked/attached to each other. Although as you brought it up I'm not sure how it works when there is only a single object. -Emil _______________________________________________ waffle mailing list waffle@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/waffle