Clutter is unable to find a valid input backend and abort the execution on ARM

Bug #960893 reported by Ricardo Salveti
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
clutter-1.0 (Ubuntu)
Fix Released
High
Ricardo Salveti
Precise
Fix Released
High
Ricardo Salveti
clutter-gst (Ubuntu)
Invalid
High
Unassigned
Precise
Invalid
High
Unassigned

Bug Description

Currently on ARM clutter is completely broken because it can find a valid input backend when starting itself.

As a consequence, everyone that depends on clutter at runtime, will fail as well. One example of that is clutter-gst, that breaks the build while running the object introspection (basically because of clutter_gst_init).

To reproduce the issue all you need to do is to run clutter_init, like the small example bellow:
===
#include <clutter/clutter.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff }; /* Black */

  clutter_init (&argc, &argv);

  /* Get the stage and set its size and color: */
  ClutterActor *stage = clutter_stage_get_default ();
  clutter_actor_set_size (stage, 200, 200);
  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);

  /* Show the stage: */
  clutter_actor_show (stage);

  /* Start the main loop, so we can respond to events: */
  clutter_main ();

  return EXIT_SUCCESS;
}
===

If I compile this example and run on my X86 machine, it'll work just fine and a black box will appear at the screen. When running the same example at ARM (ARMHF image on Pandaboard) I get the following:
./main
libEGL warning: DRI2: failed to authenticate

(main:8445): Clutter-ERROR **: Unknown input backend
Trace/breakpoint trap (core dumped)

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

The core dump output:
(gdb) bt full
#0 __libc_do_syscall () at ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S:47
No locals.
#1 0xb6d5b650 in raise (sig=5) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:46
        _a1 = <optimized out>
        _a3tmp = 5
        _a1tmp = 7667
        _a3 = <optimized out>
        _a2tmp = 7667
        _a2 = <optimized out>
        _name = <optimized out>
        _sys_result = <optimized out>
        pid = 7667
#2 0xb6da4a94 in g_logv (log_domain=0xb6ef0614 "Clutter", log_level=G_LOG_LEVEL_ERROR, format=0xb6efa1ac "Unknown input backend", args1=...) at /build/buildd/glib2.0-2.31.22/./glib/gmessages.c:758
        domain = 0x0
        data = <optimized out>
        depth = <optimized out>
        log_func = <optimized out>
        domain_fatal_mask = <optimized out>
        masquerade_fatal = <optimized out>
        test_level = <optimized out>
        was_fatal = 0
        was_recursion = 0
        i = <optimized out>
#3 0xb6da4b84 in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=0xb6efa1ac "Unknown input backend") at /build/buildd/glib2.0-2.31.22/./glib/gmessages.c:792
        args = {__ap = 0xbe83d54c}
#4 0xb6ea29be in clutter_backend_real_init_events (backend=<optimized out>) at ./clutter-backend.c:531
No locals.
#5 clutter_backend_real_init_events (backend=0x5f3c10) at ./clutter-backend.c:459
        input_backend = 0x0
#6 0xb6ea2f1e in _clutter_backend_init_events (backend=0x5f3c10) at ./clutter-backend.c:871
        klass = 0x5f00b0
        __PRETTY_FUNCTION__ = "_clutter_backend_init_events"
#7 0xb6eb96fa in clutter_init_real (error=<optimized out>) at ./clutter-main.c:1597
        ctx = 0x5f1a20
        backend = <optimized out>
#8 0xb6eb9840 in post_parse_hook (error=0xbe83d63c, context=<optimized out>, group=<optimized out>, data=<optimized out>) at ./clutter-main.c:1783
        clutter_context = 0x5f1a20
        backend = 0x5f3c10
#9 post_parse_hook (context=<optimized out>, group=<optimized out>, data=<optimized out>, error=0xbe83d63c) at ./clutter-main.c:1751
No locals.
#10 0xb6da741e in g_option_context_parse (context=<optimized out>, argc=0xbe83d664, argv=0xbe83d660, error=<optimized out>) at /build/buildd/glib2.0-2.31.22/./glib/goption.c:2025
        i = 1
        j = <optimized out>
        k = <optimized out>
        list = <optimized out>
#11 0xb6eb9a2e in clutter_parse_args (error=0xbe83d638, argv=0xbe83d660, argc=0xbe83d664) at ./clutter-main.c:2019
        clutter_group = <optimized out>
        internal_error = 0x0
        ret = 1
        option_context = 0x5f2248
        cogl_group = <optimized out>
#12 clutter_init (argc=0xbe83d664, argv=0xbe83d660) at ./clutter-main.c:2081
        ctx = <optimized out>
        error = 0x0
        res = <optimized out>
#13 0x00008860 in main (argc=1, argv=0xbe83d7c4) at main.c:20
        stage_color = {red = 0 '\000', green = 0 '\000', blue = 0 '\000', alpha = 255 '\377'}
        stage = 0x0

summary: - Clutter is unable to find a valid input backend and abort the executing
+ Clutter is unable to find a valid input backend and abort the execution
on ARM
Changed in clutter-1.0 (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Here's the code that checks for a valid input and fail:
clutter-backend.c + 459:
clutter_backend_real_init_events (ClutterBackend *backend)
...
  input_backend = g_getenv ("CLUTTER_INPUT_BACKEND");
  if (input_backend != NULL)
    input_backend = g_intern_string (input_backend);
...
#ifdef CLUTTER_INPUT_X11
  if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) &&
      (input_backend == NULL || input_backend == I_(CLUTTER_INPUT_X11)))
    {
      _clutter_backend_x11_events_init (backend);
    }
  else
#endif
....
  if (input_backend != NULL)
    {
      if (input_backend != I_(CLUTTER_INPUT_NULL))
        g_error ("Unrecognized input backend '%s'", input_backend);
    }
  else
    g_error ("Unknown input backend");

As CLUTTER_INPUT_X11 exists, it'll first try to check the windowing_backend and then set the input_backend.

Here's what happen at clutter_check_windowing_backend:
clutter-main.c + 3672:
  ClutterMainContext *context = _clutter_context_get_default ();

  g_return_val_if_fail (backend_type != NULL, FALSE);

  backend_type = g_intern_string (backend_type);
...
#ifdef CLUTTER_WINDOWING_EGL
  if (backend_type == I_(CLUTTER_WINDOWING_EGL) &&
      CLUTTER_IS_BACKEND_EGL_NATIVE (context->backend))
    return TRUE;
  else
#endif
...
#ifdef CLUTTER_WINDOWING_X11
  if (backend_type == I_(CLUTTER_WINDOWING_X11) &&
      CLUTTER_IS_BACKEND_X11 (context->backend))
    return TRUE;
  else
#endif
  return FALSE;

As backend_type is "x11" (CLUTTER_WINDOWING_X11), it'll skip the EGL verification, but will fail while checking the X11 backend.

When running with GDB the check CLUTTER_IS_BACKEND_X11 (context->backend) returned FALSE, breaking the logic and then skipping any input method initialization.

Gdb output:
(gdb) p context
$1 = (ClutterMainContext *) 0x19a20
(gdb) p context->backend->cogl_display
$2 = (CoglDisplay *) 0x16928
(gdb) p context->backend->cogl_renderer
$3 = (CoglRenderer *) 0x1fc90
(gdb) p context->backend->cogl_renderer->connected
$4 = 1
(gdb) p context->backend->cogl_renderer->winsys_id_override
$5 = COGL_WINSYS_ID_ANY
(gdb) p context->backend->cogl_renderer->constraints
$6 = (GList *) 0x0
(gdb) p context->backend->cogl_renderer->foreign_xdpy
$7 = (Display *) 0x0
(gdb) p context->backend->cogl_renderer->driver
$8 = COGL_DRIVER_GLES2
(gdb) p backend_type
$9 = 0x1a483 "x11"

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

From config:
Clutter - 1.9.14 (snapshot)

 • Global:
        Prefix: /usr
        Libdir: ${prefix}/lib/arm-linux-gnueabihf
        Sysconfdir: /etc

 • Compiler options:
        Clutter debug level: yes
        Compiler flags: -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall -g
        Profiling enabled: no
        Enable coverage tests: no
        Enable deprecated symbols: no

 • Documentation:
        Build API Reference: yes
        Build Additional Documentation: no (Generate PDF: no)

 • Extra:
        Build introspection data: yes
        Build conformance test suite: yes
        Build X11-specific tests: yes

 • Clutter Backends:
        Windowing systems: x11 egl (WARNING: Experimental backends enabled)
        Input backends: x11

     - X11 backend options:
        Enabled extensions: xext xfixes xdamage xcomposite xge xi xkb
        Build X11-specific tests: yes

It might be the case that it's using the egl windowing system while checking for x11, as in theory x11 should be supported just fine.

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

That's exactly the case:

Breakpoint 2, clutter_check_windowing_backend (backend_type=0xb6faa180 "x11") at ./clutter-main.c:3673
3673 {
(gdb) n
3674 ClutterMainContext *context = _clutter_context_get_default ();
(gdb) n
3676 g_return_val_if_fail (backend_type != NULL, FALSE);
(gdb) p context
$1 = (ClutterMainContext *) 0x19a20
(gdb) n
3678 backend_type = g_intern_string (backend_type);
(gdb)
3699 if (backend_type == I_(CLUTTER_WINDOWING_EGL) &&
(gdb)
3711 if (backend_type == I_(CLUTTER_WINDOWING_X11) &&
(gdb) p _clutter_backend_egl_native_get_type()
$2 = 105256
(gdb) p context->backend->parent_instance->g_type_instance->g_class->g_type
$3 = 105256

Now need to understand why the context type is EGL instead of X11.

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Seems it's actually quite simple :-) For some reason the EGL framebuffer windowing system is enabled for ARM, probably because in the past the flag was related with EGLX (EGL rendering on top of X11). As cogl is now a separated package, I believe the rendering part needs to be enabled as EGL there and at clutter we'd only enable X11.

I'm rebuilding the package to check if that is the case nowadays.

Changed in clutter-1.0 (Ubuntu):
assignee: nobody → Ricardo Salveti (rsalveti)
Jeremy Bícha (jbicha)
tags: added: rls-mgr-p-tracking
Changed in clutter-gst (Ubuntu Precise):
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in clutter-gst (Ubuntu):
status: New → Confirmed
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

The attached debdiff fixes both the invalid EGL windowing support for ARM and latest FTBFS issue (it now depends on gtk-3).

Tested locally and was also able to build clutter-gst on ARM on top of this package.

Also pushed to a PPA to validate it properly, should have the results in one hour.

Revision history for this message
Adam Conrad (adconrad) wrote :

Not a bug in clutter-gst.

Changed in clutter-gst (Ubuntu Precise):
status: Confirmed → Invalid
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package clutter-1.0 - 1.9.16-0ubuntu2

---------------
clutter-1.0 (1.9.16-0ubuntu2) precise; urgency=low

  * debian/rules:
    - EGL support for ARM doesn't mean EGLX anymore, that's now part of cogl.
      As we don't yet support EGL framebuffer (EGL native windowing), drop
      --enable-egl-backend=yes for ARM (LP: #960893)
  * debian/control.in:
    - adding libgtk-3-dev as it's now required for gdk related symbols
    - removing libgles2-dev dependencies for ARM, as the EGL support is now
      part the cogl package
  * debian/libclutter-1.0-0.symbols:
    - removing egl related symbols as it's not related with the EGLX support
      anymore
  * debian/patches/eglx_glx_share_same_soname.patch:
    - removing patch as this is now fixed with upstream and cogl
 -- Ricardo Salveti de Araujo <email address hidden> Wed, 21 Mar 2012 19:46:37 -0300

Changed in clutter-1.0 (Ubuntu Precise):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.