OSDN Git Service

wayland: Also support wl_drm version 1
authorPhilipp Kerling <pkerling@casix.org>
Tue, 13 Jun 2017 07:54:06 +0000 (09:54 +0200)
committerXiang, Haihao <haihao.xiang@intel.com>
Thu, 15 Jun 2017 08:40:48 +0000 (16:40 +0800)
Just using version 2 without checking would lead to a protocol error
bringing down the entire application, and wl_drm version 1 is still
supported since v2 only adds PRIME capabilities.

Signed-off-by: Philipp Kerling <pkerling@casix.org>
va/wayland/va_wayland_drm.c

index 97dfee1..4a24a2c 100644 (file)
@@ -183,8 +183,12 @@ registry_handle_global(
     struct va_wayland_drm_context *wl_drm_ctx = data;
 
     if (strcmp(interface, "wl_drm") == 0) {
     struct va_wayland_drm_context *wl_drm_ctx = data;
 
     if (strcmp(interface, "wl_drm") == 0) {
+        /* bind to at most version 2, but also support version 1 if
+         * compositor does not have v2
+         */
         wl_drm_ctx->drm =
         wl_drm_ctx->drm =
-            wl_registry_bind(wl_drm_ctx->registry, id, wl_drm_ctx->drm_interface, 2);
+            wl_registry_bind(wl_drm_ctx->registry, id, wl_drm_ctx->drm_interface,
+                             (version < 2) ? version : 2);
     }
 }
 
     }
 }