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 736564 - problem with gtkclutterembed and gtkstack under wayland
problem with gtkclutterembed and gtkstack under wayland
Status: RESOLVED FIXED
Product: clutter-gtk
Classification: Platform
Component: GtkClutterEmbed
1.5.x
Other Linux
: Normal normal
: ---
Assigned To: clutter-gtk maintainer(s)
clutter-gtk maintainer(s)
Depends on:
Blocks: 672735
 
 
Reported: 2014-09-12 14:08 UTC by Matthias Clasen
Modified: 2014-09-18 23:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtk-clutter-multistage.c (3.12 KB, text/plain)
2014-09-12 14:08 UTC, Matthias Clasen
  Details
screenshot (63.46 KB, image/png)
2014-09-12 14:09 UTC, Matthias Clasen
  Details
Wip: Fix positioning of subsurfaces with GtkStack (2.29 KB, patch)
2014-09-12 14:43 UTC, Matthias Clasen
none Details | Review
Use GDK support for subsurfaces (5.64 KB, patch)
2014-09-15 02:36 UTC, Matthias Clasen
reviewed Details | Review
Use GDK support for subsurfaces (5.35 KB, patch)
2014-09-17 14:50 UTC, Bastien Nocera
needs-work Details | Review
gtk-clutter-embed: Fix hiding embed inside container (6.20 KB, patch)
2014-09-17 17:45 UTC, Bastien Nocera
reviewed Details | Review
gtk-clutter-embed: Fix hiding embed inside container (6.21 KB, patch)
2014-09-17 17:55 UTC, Bastien Nocera
committed Details | Review

Description Matthias Clasen 2014-09-12 14:08:58 UTC
Created attachment 286042 [details]
gtk-clutter-multistage.c

the offscreen is 'popping out'. I'll attach a slightly edited copy of gtk-clutter-multistage.c that shows it, and a screenshot.
Comment 1 Matthias Clasen 2014-09-12 14:09:16 UTC
Created attachment 286043 [details]
screenshot
Comment 2 Matthias Clasen 2014-09-12 14:43:01 UTC
Created attachment 286052 [details] [review]
Wip: Fix positioning of subsurfaces with GtkStack

The subsurface needs to be placed at an offset relative to the
toplevel, not to the parent widget. Therefore, use
gdk_window_get_origin instead of the widget allocation.

The initial position is still wrong here for some reason,
after the first allocation, things snap into the right place.
Comment 3 Matthias Clasen 2014-09-14 12:43:58 UTC
max/unmax gets things out of sync again.
Comment 4 Matthias Clasen 2014-09-15 02:36:49 UTC
Created attachment 286181 [details] [review]
Use GDK support for subsurfaces

Instead of manually creating a subsurface and (failing to) keep
it positioned manually, use the GDK support for subsurfaces.
Comment 5 Matthias Clasen 2014-09-15 02:37:28 UTC
I haven't been able to track down why this patch causes memory corruption and crashes.
Comment 6 Bastien Nocera 2014-09-15 14:03:40 UTC
(In reply to comment #5)
> I haven't been able to track down why this patch causes memory corruption and
> crashes.

I didn't get any memory corruption when using your test from comment 0. I would merge your 2 patches and propose it for an updated clutter-gtk.

But I do get:
- 2 flickery video displays when using cheese (which doesn't use a GtkStack)
- mouse events going nowhere (buttons not working, hidden video texture) in totem

I can reproduce the latter with another test program. Given that it only happens when using clutter-gst inside clutter-gtk, I would consider it a clutter-gst bug.
Comment 7 Bastien Nocera 2014-09-15 14:06:01 UTC
Filed the clutter-gst section as bug 736677.
Comment 8 Emmanuele Bassi (:ebassi) 2014-09-16 18:44:31 UTC
Review of attachment 286181 [details] [review]:

it will likely need a bump in the GTK+ requirement, but I can live with that.
Comment 9 Bastien Nocera 2014-09-17 14:50:42 UTC
Created attachment 286386 [details] [review]
Use GDK support for subsurfaces

Instead of manually creating a subsurface and (failing to) keep
it positioned manually, use the GDK support for subsurfaces.
Comment 10 Bastien Nocera 2014-09-17 15:59:42 UTC
Comment on attachment 286386 [details] [review]
Use GDK support for subsurfaces

This is currently unusable.
Comment 11 Bastien Nocera 2014-09-17 17:45:56 UTC
Created attachment 286410 [details] [review]
gtk-clutter-embed: Fix hiding embed inside container

Such as the embed inside a GtkStack, as used in Cheese or Totem.

With help from Matthias Clasen (positioning inside the window), and
Jasper St. Pierre (Wayland API help).
Comment 12 Emmanuele Bassi (:ebassi) 2014-09-17 17:52:25 UTC
Review of attachment 286410 [details] [review]:

looks okay to me, with two minor fixes.

::: clutter-gtk/gtk-clutter-embed.c
@@ +297,3 @@
+    return;
+
+  gtk_widget_get_allocation (GTK_WIDGET (embed), &allocation);

considering the amount of calls that take a GTK_WIDGET (embed), it'd be better to just cast it once.

@@ +302,3 @@
+
+  priv->subsurface =
+          wl_subcompositor_get_subsurface (priv->subcompositor,

coding style: only two spaces for the indentation of the call to wl_subcompositor_get_subsurface().
Comment 13 Bastien Nocera 2014-09-17 17:52:54 UTC
This works for me with Totem and Cheese. The multi-stage doesn't work, seems to get stuck deep inside the video driver [1]. I'd punt this for a later look.

[1]: 
  • #0 poll
    at ../sysdeps/unix/syscall-template.S line 81
  • #1 wl_display_dispatch_queue
    from /lib64/libwayland-client.so.0
  • #2 get_back_bo
    from /lib64/libEGL.so.1
  • #3 update_buffers
    from /lib64/libEGL.so.1
  • #4 image_get_buffers
    from /lib64/libEGL.so.1
  • #5 intel_update_renderbuffers
    from /usr/lib64/dri/i965_dri.so
  • #6 intel_prepare_render
    from /usr/lib64/dri/i965_dri.so
  • #7 brw_draw_prims
    from /usr/lib64/dri/i965_dri.so
  • #8 brw_draw_rectlist
    from /usr/lib64/dri/i965_dri.so
  • #9 brw_meta_resolve_color
    from /usr/lib64/dri/i965_dri.so
  • #10 intel_resolve_for_dri2_flush.part
    from /usr/lib64/dri/i965_dri.so
  • #11 intel_dri2_flush_with_flags
    from /usr/lib64/dri/i965_dri.so
  • #12 dri2_wl_swap_buffers_with_damage
    from /lib64/libEGL.so.1
  • #13 eglSwapBuffers
    from /lib64/libEGL.so.1
  • #14 _cogl_winsys_onscreen_swap_buffers_with_damage
    from /lib64/libcogl.so.20
  • #15 cogl_onscreen_swap_buffers_with_damage
    from /lib64/libcogl.so.20
  • #16 clutter_stage_cogl_redraw
    at ./cogl/clutter-stage-cogl.c line 660
  • #17 clutter_stage_allocate
    at ./clutter-stage.c line 431
  • #18 clutter_actor_allocate_internal
    at ./clutter-actor.c line 9769
  • #19 clutter_actor_set_animatable_property
    at ./clutter-actor.c line 14759
  • #20 _clutter_actor_create_transition
    at ./clutter-actor.c line 18926
  • #21 clutter_actor_allocate
    at ./clutter-actor.c line 9906
  • #22 _clutter_stage_maybe_relayout
    at ./clutter-stage.c line 1153
  • #23 _clutter_stage_do_update
    at ./clutter-stage.c line 1252
  • #24 master_clock_update_stages
    at ./clutter-master-clock.c line 463
  • #25 clutter_clock_dispatch
    at ./clutter-master-clock.c line 595
  • #26 g_main_dispatch
    at gmain.c line 3067
  • #27 g_main_context_dispatch
    at gmain.c line 3676
  • #28 g_main_context_iterate
    at gmain.c line 3747
  • #29 g_main_loop_run
    at gmain.c line 3941
  • #30 gtk_main
    at gtkmain.c line 1207
  • #31 main
    at gtk-clutter-multistage.c line 75

Comment 14 Bastien Nocera 2014-09-17 17:55:33 UTC
Created attachment 286413 [details] [review]
gtk-clutter-embed: Fix hiding embed inside container

Such as the embed inside a GtkStack, as used in Cheese or Totem.

With help from Matthias Clasen (positioning inside the window), and
Jasper St. Pierre (Wayland API help).
Comment 15 Bastien Nocera 2014-09-17 19:54:48 UTC
Attachment 286413 [details] pushed as 062ddb7 - gtk-clutter-embed: Fix hiding embed inside container
Comment 16 Bastien Nocera 2014-09-17 20:00:19 UTC
Hang filed as https://bugs.freedesktop.org/show_bug.cgi?id=84016
Comment 17 Carlos Garnacho 2014-09-18 18:41:55 UTC
(In reply to comment #16)
> Hang filed as https://bugs.freedesktop.org/show_bug.cgi?id=84016

That bt looks familiar to me... Is eglSwapInterval(dpy, 0) being called when making the context current? Otherwise the wayland platform code in mesa will schedule its own wl_surface_frame().
Comment 18 Lionel Landwerlin 2014-09-18 23:40:49 UTC
You can force the eglSwapInterval(dpy, 0) by setting CLUTTER_VBLANK=none, but that doesn't fix the problem.
It seems to be a genuine problem with Mesa synchronization implementation.
get_back_bo() seems to be called outside of the SwapBuffers() operation, this doesn't seem like the place where you want to synchronize stuff :|
Still investigating...