After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 663344 - Rework the Clutter backend code
Rework the Clutter backend code
Product: clutter
Classification: Platform
Component: egl
git master
Other Linux
: Normal enhancement
: ---
Assigned To: clutter-maint
Depends on:
Reported: 2011-11-03 18:03 UTC by Emmanuele Bassi (:ebassi)
Modified: 2021-06-10 11:32 UTC
See Also:
GNOME target: ---
GNOME version: 3.3/3.4

Description Emmanuele Bassi (:ebassi) 2011-11-03 18:03:43 UTC
the existence of EGL is an implementation detail of Cogl, and the only remaining thing inside Clutter is the event handling through evdev or tslib. we should get rid of the EGL backend altogether.

while we're at it, we should get rid of most of the platform-specific code we have in the ClutterBackend subclasses, and move the Cogl code inside the ClutterBackend class itself.

this work can be tracked on the wip/backend-next branch.
Comment 1 Emmanuele Bassi (:ebassi) 2011-11-03 18:17:16 UTC
the most duplicated code from the cogl base backend is in:

  - x11/clutter-backend-x11.c:clutter_backend_x11_create_context
  - gdk/clutter-backend-gdk.c:clutter_backend_gdk_create_context
  - win32/clutter-backend-win32.c:clutter_backend_win32_create_context
  - egl/clutter-backend-eglnative.c:clutter_backend_egl_native_create_context

each backend does exactly the same things, but it needs a series of platform-specific calls that make it slightly more difficult to just replace piecemeal.

one option is to break the create_context() implementation up into its base components:

  • create renderer
  • create swap chain
  • create onscreen template
  • create display

the default implementation of create_context() would then call each of the components following the template of clutter_backend_cogl_create_context().

until we have a Quartz winsys for Cogl, we can still make the OSX backend replace the whole create_context() vfunc and allow it to take control of the overall context management.

once create_context() is handled internally by ClutterBackend we can also move the remaining get_features() implementation from ClutterBackendCogl to ClutterBackend, at which point ClutterBackendCogl becomes an empty shell and we can safely remove it.

the EglNative backend still has a create_stage() that just creates a ClutterStageCogl stage window; separating the platform-specific bits of the stage window will take a little bit more effort.
Comment 2 Emmanuele Bassi (:ebassi) 2011-11-04 19:34:48 UTC
I have something that I quite like, now, in the wip/backend-next branch.

  • moved most of the backend code into the shared ClutterBackend code paths;
  • added a CEx100-specific windowing backend;
  • gutted the Cogl backend to the point that I could just remove the
    clutter-backend-cogl.[ch] files;
  • the evdev and tslib input code is not tied to the EGL code paths any more;
  • the EglNative backend is a bare-bones backend that assumes that Cogl
    will do the right thing; it could be renamed to "base" or "null", or
    it could just be removed.

the changes have been tested with the x11, gdk, and osx backends.

git log --stat:

 .gitignore                                   |    2 +-
 clutter/                          |   13 +-
 clutter/cex100/clutter-backend-cex100.c      |  214 ++++++++++++++++++
 clutter/cex100/clutter-backend-cex100.h      |   71 ++++++
 clutter/cex100/           |   68 ++++++
 clutter/clutter-backend-private.h            |   18 ++-
 clutter/clutter-backend.c                    |  311 +++++++++++++++++++++++++-
 clutter/clutter-device-manager.c             |    7 +-
 clutter/clutter-main.c                       |   21 ++
 clutter/clutter-private.h                    |    2 +
 clutter/clutter-stage-window.c               |   19 ++
 clutter/cogl/clutter-backend-cogl.c          |  207 -----------------
 clutter/cogl/clutter-backend-cogl.h          |   70 ------
 clutter/cogl/clutter-stage-cogl.c            |   44 ++---
 clutter/cogl/clutter-stage-cogl.h            |    8 +-
 clutter/egl/clutter-backend-eglnative.c      |  213 +-----------------
 clutter/egl/clutter-backend-eglnative.h      |    8 +-
 clutter/egl/              |   91 --------
 clutter/egl/clutter-egl.h                    |    5 -
 clutter/evdev/clutter-device-manager-evdev.c |   12 +-
 clutter/gdk/clutter-backend-gdk.c            |  201 ++++++++---------
 clutter/gdk/clutter-backend-gdk.h            |    9 +-
 clutter/gdk/clutter-event-gdk.c              |   21 --
 clutter/osx/clutter-backend-osx.c            |   40 +---
 clutter/osx/clutter-backend-osx.h            |    6 +-
 clutter/osx/clutter-event-osx.c              |   14 --
 clutter/osx/clutter-stage-osx.c              |   46 ++++-
 clutter/wayland/clutter-backend-wayland.c    |   15 +-
 clutter/wayland/clutter-stage-wayland.c      |   37 +++
 clutter/win32/clutter-backend-win32.c        |  169 +-------------
 clutter/win32/clutter-backend-win32.h        |    2 -
 clutter/win32/clutter-stage-win32.c          |   50 ++++-
 clutter/x11/clutter-backend-x11-private.h    |   32 ---
 clutter/x11/clutter-backend-x11.c            |  196 ++++++++---------
 clutter/x11/clutter-backend-x11.h            |   40 ++--
 clutter/x11/clutter-event-x11.c              |  173 ++++-----------
 clutter/x11/clutter-stage-x11.c              |    5 +-                                 |  150 +++++++------
 38 files changed, 1231 insertions(+), 1379 deletions(-)
Comment 3 Emmanuele Bassi (:ebassi) 2011-11-10 15:05:34 UTC
the wip/backend-next branch has been merged into master. the EglNative backend is still marked as such, but a rename would be nice to have before 1.10, so let's keep this bug open for tracking final touches to the backend implementation.
Comment 4 André Klapper 2021-06-10 11:32:02 UTC
GNOME is going to shut down in favor of
As part of that, we are mass-closing older open tickets in
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version of clutter, then please follow
and create a ticket at

Thank you for your understanding and your help.