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 704104 - gdk/wayland: cope with the compositor implementing an older protocol than us
gdk/wayland: cope with the compositor implementing an older protocol than us
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Wayland
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-07-12 15:06 UTC by Giovanni Campagna
Modified: 2013-07-16 16:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdk/wayland: cope with the compositor implementing an older protocol than us (3.21 KB, patch)
2013-07-12 15:06 UTC, Giovanni Campagna
none Details | Review
gdk/wayland: cope with the compositor implementing an older protocol than us (4.11 KB, patch)
2013-07-15 07:49 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2013-07-12 15:06:47 UTC
If we bind to a global with an higher version than implemented, or
we make requests that appeared in a later version, we would get
fatal wayland errors.
Comment 1 Giovanni Campagna 2013-07-12 15:06:49 UTC
Created attachment 249018 [details] [review]
gdk/wayland: cope with the compositor implementing an older protocol than us
Comment 2 Emmanuele Bassi (:ebassi) 2013-07-12 16:31:03 UTC
Review of attachment 249018 [details] [review]:

if we make requests that appeared in a later version I assume we'll have fallbacks in place.

as a side note: at some point, we'll have to fix the coding style of this whole backend to fit in with the GDK coding style.

::: gdk/wayland/gdkdisplay-wayland.c
@@ +170,3 @@
   } else if (strcmp(interface, "wl_output") == 0) {
     output =
+      wl_registry_bind(display_wayland->wl_registry, id, &wl_output_interface, MIN (version, 2));

we're not using it, right now, but should we save the output version as well, for later use?

::: gdk/wayland/gdkwindow-wayland.c
@@ +587,3 @@
   wl_surface_attach (impl->surface, data->buffer, dx, dy);
+  if (GDK_WAYLAND_DISPLAY (gdk_window_get_display (window))->compositor_version >=
+      WL_SURFACE_HAS_BUFFER_SCALE)

don't break the condition; if the line feels too long, take out the cast from GdkDisplay to GdkWaylandDisplay into a separate assignment.
Comment 3 Giovanni Campagna 2013-07-15 07:47:31 UTC
(In reply to comment #2)
> Review of attachment 249018 [details] [review]:
> 
> if we make requests that appeared in a later version I assume we'll have
> fallbacks in place.

Yes, the only request we make is set_buffer_scale (wl_surface v3), which we can skip by disabling the scaled window support.

> as a side note: at some point, we'll have to fix the coding style of this whole
> backend to fit in with the GDK coding style.
> 
> ::: gdk/wayland/gdkdisplay-wayland.c
> @@ +170,3 @@
>    } else if (strcmp(interface, "wl_output") == 0) {
>      output =
> +      wl_registry_bind(display_wayland->wl_registry, id, &wl_output_interface,
> MIN (version, 2));
> 
> we're not using it, right now, but should we save the output version as well,
> for later use?

We do save the output version and use it (line 173), although we probably should save the version we're actually requesting, rather than the compositor version, for forward compatibility.
Comment 4 Giovanni Campagna 2013-07-15 07:49:33 UTC
Created attachment 249161 [details] [review]
gdk/wayland: cope with the compositor implementing an older protocol than us

If we bind to a global with an higher version than implemented, or
we make requests that appeared in a later version, we would get
fatal wayland errors.
Comment 5 Kristian Høgsberg 2013-07-15 22:30:01 UTC
(In reply to comment #4)
> Created an attachment (id=249161) [details] [review]
> gdk/wayland: cope with the compositor implementing an older protocol than us
> 
> If we bind to a global with an higher version than implemented, or
> we make requests that appeared in a later version, we would get
> fatal wayland errors.

That looks good.
Comment 6 Rob Bradford 2013-07-16 16:14:37 UTC
Review of attachment 249161 [details] [review]:

Yeh lets go with this. Thanks!
Comment 7 Rob Bradford 2013-07-16 16:14:38 UTC
Review of attachment 249161 [details] [review]:

Yeh lets go with this. Thanks!
Comment 8 Giovanni Campagna 2013-07-16 16:21:48 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.

(I forgot to git-bz :D )