GNOME Bugzilla – Bug 774546
[Wayland][gdk][stage] Use GDK API instead of Wayland directly
Last modified: 2017-05-09 08:23:44 UTC
Description: The clutter gdk backend uses a subsurface for its clutter-stage-gdk backend implementation on Wayland. But GDK has all the bits required for dealing with subsurfaces, so by using the GDK API we could save a few lines of code.
Created attachment 340015 [details] [review] [PATCH] gdk: stage: Use gdk for the Wayland subsurface Mainly a proof of concept.
Created attachment 340602 [details] [review] [PATCH] gdk: stage: Use gdk for the Wayland subsurface This patch, along with those from bug 774475, bug 774534, bug 774915, bug 774917 in gtk+ fixes bug 771320
Created attachment 340916 [details] [review] [PATCH v3] gdk: stage: Use gdk for the Wayland subsurface Fix scale on hidpi screens.
It also needs the patch from bug 769190
Review of attachment 340916 [details] [review]: Do we need to bump up the required version of GTK for this? ::: clutter/gdk/clutter-stage-gdk.c @@ +277,2 @@ cogl_wayland_onscreen_resize (stage_cogl->onscreen, + width, height, 0, 0); Why isn't the scale applied here? Does Cogl apply the buffer scale internally? @@ +702,3 @@ +#if defined(GDK_WINDOWING_WAYLAND) && defined(COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) + if (GDK_IS_WAYLAND_WINDOW (stage_gdk->subsurface)) + { Coding style: curly braces should be on a new indendation level.
(In reply to Emmanuele Bassi (:ebassi) from comment #5) > Review of attachment 340916 [details] [review] [review]: > > Do we need to bump up the required version of GTK for this? Yes, we will eventually, once the required changes have all landed in gtk+ (listed in bugzilal deps) and released as part of a gtk+ update. > ::: clutter/gdk/clutter-stage-gdk.c > @@ +277,2 @@ > cogl_wayland_onscreen_resize (stage_cogl->onscreen, > + width, height, 0, 0); > > Why isn't the scale applied here? Does Cogl apply the buffer scale > internally? Yeah, I just figured, scale is still not right... > @@ +702,3 @@ > +#if defined(GDK_WINDOWING_WAYLAND) && > defined(COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) > + if (GDK_IS_WAYLAND_WINDOW (stage_gdk->subsurface)) > + { > > Coding style: curly braces should be on a new indendation level. Right.
(In reply to Olivier Fourdan from comment #6) > (In reply to Emmanuele Bassi (:ebassi) from comment #5) > > Why isn't the scale applied here? Does Cogl apply the buffer scale > > internally? > > Yeah, I just figured, scale is still not right... Appears that the scaling of both output and input is donw with gdk, so to get it correct, no scaling is to be applied at the stage_gdk level when using a gdk subsurface. Actually, we don't even need the patch from bug 769190...
Created attachment 340972 [details] [review] [PATCH v4] gdk: stage: Use gdk for the Wayland subsurface v4: When using a gdk subsurface, no scaling is required, so tweak clutter_stage_gdk_get_scale_factor() to return 1 in this case and reuse that in various places to achive the correct scaling when using gdk subsurface. Tested with totem and gnome-contacts with "MUTTER_DEBUG_NUM_DUMMY_MONITORS=2 MUTTER_DEBUG_DUMMY_MONITOR_SCALES=1,2 mutter --wayland --nested" to make sure the scaling is applied when moving between monitors of different scales.
All dependency bugs have landed in gtk+/gdk now, so this patch here should work as-is on top of an up-to-date gtk-3-22 build.
Review of attachment 340972 [details] [review]: Looks good to me.
Thanks a bunch! I'll wait for a release of gtk+ that includes all the remaining bits first and make a dependency on that version in clutter, so we don't end up with clutter using an older version of gdk that doesn't work well with clutter usage of subsurfaces.
Sounds like a good plan. As soon as the patch is in, I'll spin a stable Clutter release with them.
Created attachment 342925 [details] [review] [PATCH] build: Bump gdk version requirement gtk+-3.22.6 includes all the fixes required to use gdk subsurfaces under Wayland, bump the minimal required version to this new version.
Comment on attachment 340972 [details] [review] [PATCH v4] gdk: stage: Use gdk for the Wayland subsurface attachment 340972 [details] [review] pushed to git master as commit ffa7aa9 - gdk: stage: Use gdk for the Wayland subsurface
Comment on attachment 342925 [details] [review] [PATCH] build: Bump gdk version requirement attachment 342925 [details] [review] pushed to git master as commit 8076b09 - build: Bump gdk version requirement
I've been experiencing bug #781975 in totem with this patch applied, after reverting https://git.gnome.org/browse/clutter/commit/?id=ffa7aa95d8ec62efbbc20e5aacc29d52555f3145 the bug is gone.