[waffle] [PATCH] Enabling Waffle library for Android.

Juha-Pekka Heikkilä juha-pekka.heikkila at linux.intel.com
Mon Aug 20 04:54:17 PDT 2012


Another week, another version for Android patch for Waffle. Again in the
attachment.

I did do some restructuring of my code to try to get the multiple window
system working for Android but alas it seems this was useless work for
now.

Display now contain pointer to reach control over SurfaceComposerClient
which is one per process type object, trying to initialize this for second
time in one process will segfault the calling process. Apparently this has
been so since Gingerbread, at least according to some googling I did.

Window has pointer for SurfaceControl, creating many windowses would
create many SurfaceControl objects allowing them to be independent from
each other. Alas it seems for one SurfaceComposerClient one can only
create single SurfaceControl object, creating second did make everything
unstable. After creating second SurfaceControl accessing either
SurfaceControl will segfault or freeze inside calling method. Once I
notice this I tried it with simple piece of code which just create
composer client and two surface controls to get the same behaviour as with
when doing this with Waffle thus unless there is something I did totally
miss it seems one process can only have one surface in Android for now.
There is the video player which has the special secondary layer where the
video is playing and I did not yet see how does it do it but I suspect
layer for video is flagged to be special.

With the surfaces I also found behaviour which was not very nice. After I
destroy the surface and clean everything related to it to create a new
surface I get same errors as if I was creating second surface with the
first one still there giving me a segfault. To get the new surface there
is a need for a new composer client which again is one per process.

The native calls for Android are now returning just the unsupported error,
required pointers in display/window are still there so if there is ever
need to change this it will not be a big task.

The unnecessary static function definitions from headers should now be
gone from flooding the preprocessor.

I did also look into getting things working with CMake and found a
problem. I am able to build Waffle with CMake for Ice Cream Sandwitch but
the cmake-android script fails one Jelly Bean. CMake android script should
be patched to work with Jelly Bean, I think the problem was related to how
build tools versioning was presented causing android-cmake script to fail
with JB.

The patch will compile for JB by default. If one is compiling against ICS
there is a need to add definition for 'BUILD_FOR_ICS'. This define will
switch one include folder.

/Juha-Pekka

>
> I think floating surfaces will work well enough for now.
>
> Problem 1:
>
> I'd prefer that Waffle not expose a user-facing interface on Android that
> is
> known not to work and will hence later need to be changed. Since your
> surfaces
> do not repond to input, and the main reason for exposing the types in
> waffle_android.h is to enable Waffle clients to implement input, then I
> think
> the current best approach for the waffle_X_get_native functions is to
>   1. Delete waffle_android.h.
>   2. Let each waffle_X_get_native return null and emit
> WAFFLE_ERROR_UNSUPPORTED.
>
> For an example of how that should look, see commit 1f52c43.
>
>
> Problem 2:
>
> If the user calls waffle_window_create() twice, then
> eglCreateWindowSurface
> gets called twice on the same ANativeWindow. What should happen is that
> two
> distinct windows be created.
>
> The underlying problem is that the Android window objects, SurfaceControl
> and
> ANativeWindow, should be created during waffle_window_create and be
> contained
> in the android_window, not during waffle_display_create and in the
> android_display.
>
> (I do not understand what SurfaceComposerClient does, so I am unsure if it
> should belong to android_display or android_window. I suspect
> android_display).
>
>
> Problem 3:
>
> This is a small problem that causes no bugs. Static functions shouldn't be
> declared in headers unless they are also inline. That is, the following
> function declarations need to be removed:
>
>   android_config.h:android_config_destroy
>   android_context.h:android_context_destroy
>   android_display.h:android_display_disconnect
>   android_display.h:android_display_supports_context_api
>   android_window.h:android_window_destroy
>   android_window.h:android_window_show
>   android_window.h:android_window_swap_buffers
>
> In android_context.c, I see that you define android_context_create above
> android_context_destroy. That's ok, but the build will fail after removing
> the
> declaration at android_context.h:android_context_destroy. To fix the build
> without changing the order of things in android_context.c, you will need
> to
> move the declaration at android_context.h:android_context_destroy to the
> top
> of android_context.c. The same applies to android_config_destroy,
> android_display_disconnect, and android_window_destroy.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Android-support-for-Waffle.-This-uses-Android.mk-fil.patch
Type: text/x-patch
Size: 53286 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/waffle/attachments/20120820/217adc72/attachment-0001.bin>


More information about the waffle mailing list