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 774546 - [Wayland][gdk][stage] Use GDK API instead of Wayland directly
[Wayland][gdk][stage] Use GDK API instead of Wayland directly
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: wayland
git master
Other Linux
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on: 774475 774534 774915 774917 775319
Blocks: 771320
 
 
Reported: 2016-11-16 14:41 UTC by Olivier Fourdan
Modified: 2017-05-09 08:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] gdk: stage: Use gdk for the Wayland subsurface (8.05 KB, patch)
2016-11-16 14:42 UTC, Olivier Fourdan
none Details | Review
[PATCH] gdk: stage: Use gdk for the Wayland subsurface (8.52 KB, patch)
2016-11-23 14:06 UTC, Olivier Fourdan
none Details | Review
[PATCH v3] gdk: stage: Use gdk for the Wayland subsurface (8.02 KB, patch)
2016-11-28 15:26 UTC, Olivier Fourdan
none Details | Review
[PATCH v4] gdk: stage: Use gdk for the Wayland subsurface (10.24 KB, patch)
2016-11-29 13:35 UTC, Olivier Fourdan
committed Details | Review
[PATCH] build: Bump gdk version requirement (1006 bytes, patch)
2017-01-05 08:10 UTC, Olivier Fourdan
committed Details | Review

Description Olivier Fourdan 2016-11-16 14:41:03 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.
Comment 1 Olivier Fourdan 2016-11-16 14:42:22 UTC
Created attachment 340015 [details] [review]
[PATCH] gdk: stage: Use gdk for the Wayland subsurface

Mainly a proof of concept.
Comment 2 Olivier Fourdan 2016-11-23 14:06:04 UTC
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
Comment 3 Olivier Fourdan 2016-11-28 15:26:02 UTC
Created attachment 340916 [details] [review]
[PATCH v3] gdk: stage: Use gdk for the Wayland subsurface

Fix scale on hidpi screens.
Comment 4 Olivier Fourdan 2016-11-28 15:26:40 UTC
It also needs the patch from bug 769190
Comment 5 Emmanuele Bassi (:ebassi) 2016-11-28 15:44:44 UTC
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.
Comment 6 Olivier Fourdan 2016-11-28 15:50:13 UTC
(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.
Comment 7 Olivier Fourdan 2016-11-29 13:32:26 UTC
(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...
Comment 8 Olivier Fourdan 2016-11-29 13:35:38 UTC
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.
Comment 9 Olivier Fourdan 2016-12-15 12:50:04 UTC
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.
Comment 10 Emmanuele Bassi (:ebassi) 2016-12-15 14:58:45 UTC
Review of attachment 340972 [details] [review]:

Looks good to me.
Comment 11 Olivier Fourdan 2016-12-15 15:12:29 UTC
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.
Comment 12 Emmanuele Bassi (:ebassi) 2016-12-15 15:19:33 UTC
Sounds like a good plan. As soon as the patch is in, I'll spin a stable Clutter release with them.
Comment 13 Olivier Fourdan 2017-01-05 08:10:58 UTC
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 14 Olivier Fourdan 2017-01-09 10:59:52 UTC
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 15 Olivier Fourdan 2017-01-09 11:00:45 UTC
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
Comment 16 Christophe Fergeau 2017-05-09 08:08:18 UTC
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.