Wayland: EGL_ALPHA_SIZE in egl_attributes_from_framebuffer_config()



Hi,

background: I am trying to get clutter-lib work on Raspberry Pi, with Wayland/Weston. I am running a pretty custom config to get it compile & run (most recent kernel, Tomeu Vizoso's RPi userland package from https://github.com/tomeuv/userland, etc.. a blog post is in progress). However, when displaying anything involving EGL, the colors get messed up: the clutter/examples/image-content.c shows a blue hand for redhand.png; the cogl/examples/cogl-hello.c shows a blueish triangle on a dark blue background.

Having zero knowledge on GL usage, I painfully traced it down to following line in COGL (cogl-1.18 branch):
file: cogl/winsys/cogl-winsys-egl.c
function: egl_attributes_from_framebuffer_config()
lines:

   attributes[i++] = EGL_ALPHA_SIZE;
   attributes[i++] = config->swap_chain->has_alpha ? 1 : EGL_DONT_CARE;

has_alpha is false, so EGL_DONT_CARE will be set for EGL_ALPHA_SIZE.

If I change the value to constant 1 instead, the colors magically work again, no more blueish tint.

I tried to investigate a bit more, but from the call tree I see that has_alpha is set to a default value (?).

For my purposes I simply added:

+#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT
+  attributes[i++] = 1;
+#else
   attributes[i++] = config->swap_chain->has_alpha ? 1 : EGL_DONT_CARE;
+#endif

..however I am sure that there is a good reason for consulting the value in has_alpha..

Questions:
- what would be the "correct" solution for this?
- is it possible that the Raspberry Pi code has a bug? In this case, shall we simply add a workaround?
- in general, do you have a guide on how to contribute to cogl/clutter library? Or shall we just submit patches here?

Thanks,
Richard


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]