[waffle] New API call for Waffle
Chad Versace
chad.versace at linux.intel.com
Wed Jun 12 12:11:04 PDT 2013
Oops, resending b/c I forgot to CC the list.
On 06/12/2013 12:09 PM, Chad Versace wrote:
> On 06/06/2013 10:30 PM, Juha-Pekka Heikkilä wrote:
>> Hi,
>>
>> I've been porting retracer part of Apitrace for Waffle so I can use
>> retracer on Android. As a part of the process I notice I needed few
>> changes in Waffle. I was not certain what kind of API changes are
>> acceptable thus asking opinions.
>
> This API addition makes sense to me. Other platforms may need to this,
> so let's put in waffle rather than requiring each waffle user to
> reimplement resizing through extraction of native types.
>
>> Below is an addition to Waffle api which is implemented for Android, this
>> adds window resizing in a call 'waffle_window_resize'. I tried to go
>> around this with native interface at first but it started to feel silly
>> and I figure someone else might need window resizing too. On Android I did
>> not have possibility to merely destroy/recreate due to Android
>> limitations.
>>
>> One thing I am still trying to find a good way to implement is to get
>> Waffle to do
>> 'eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);'
>> I was thinking adding api call for such would feel a bit excessive thus I
>> currently do this through the native call in my retracer port. Would it be
>> best for this kind things be added as extra parameter to
>> waffle_make_current or create some extra/hidden behaviour for certain type
>> parameters?
>
> waffle_make_current(dpy, NULL, NULL) should work, even though the manpages
> doesn't state so. Could you try and verify that? I'll submit a patch to the
> list that documents this use case in the manpages and then update the web
> docs.
>
>
>
>> diff --git a/src/waffle/android/droid_platform.c
>> b/src/waffle/android/droid_platform.c
>> index f904685..bbf2b14 100644
>> --- a/src/waffle/android/droid_platform.c
>> +++ b/src/waffle/android/droid_platform.c
>> @@ -134,6 +134,7 @@ static const struct wcore_platform_vtbl
>> droid_platform_vtbl = {
>
> This hunk is corrupt. Did you copy-paste the patch into your email
> program? I had to move `droid_platform_vtbl = {` to the previous
> line to fix the patch.
>
>> .destroy = droid_window_destroy,
>> .show = droid_window_show,
>> .swap_buffers = wegl_window_swap_buffers,
>> + .resize = droid_window_resize,
>> .get_native = NULL,
>> },
>> };
>
>
>
>> --- a/src/waffle/api/waffle_window.c
>> +++ b/src/waffle/api/waffle_window.c
>> @@ -93,6 +93,24 @@ waffle_window_show(struct waffle_window *self)
>> }
>>
>> bool
>> +waffle_window_resize(
>> + struct waffle_window *self,
>> + int32_t width,
>> + int32_t height)
>> +{
>> + struct wcore_window *wc_self = wcore_window(self);
>> +
>> + const struct api_object *obj_list[] = {
>> + wc_self ? &wc_self->api : NULL,
>> + };
>> +
>> + if (!api_check_entry(obj_list, 1))
>> + return false;
>> +
>> + return api_platform->vtbl->window.resize(wc_self, width, height);
>
> This patch implements waffle_window_resize only for Android. So, this
> last line will segfault on other platforms. You need to emit WAFFLE_ERROR_UNSUPPORTED
> when resize is NULL to prevent that. For an example, see waffle_window_get_native.
>
> ----
>
> Other than the segfault problem, this patch looks good. Please resubmit with
> an appropriate commit message and I'll merge it. I assume you've already
> tested this patch with your retracer work, and all works as expected.
More information about the waffle
mailing list