01552a
From 167e74e56df055f419c960657eb66d73802a54f1 Mon Sep 17 00:00:00 2001
01552a
From: Ray Strode <rstrode@redhat.com>
01552a
Date: Mon, 20 Jun 2016 11:06:49 -0400
01552a
Subject: [PATCH] drm: don't pick up drm master implicitly
01552a
01552a
If a client opens the drm device, they're given drm master
01552a
implicitly. We already explicitly take DRM master when we need it,
01552a
so that featuer is unneeded.
01552a
01552a
Furthermore, it's actively harmful, since fbdev won't let you change
01552a
the color palette of the terminal if drm master is held.
01552a
01552a
This commit makes sure to drop master as soon as we get it from
01552a
open().
01552a
---
01552a
 src/plugins/renderers/drm/plugin.c | 2 ++
01552a
 1 file changed, 2 insertions(+)
01552a
01552a
diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c
01552a
index 6677279..ebfe864 100644
01552a
--- a/src/plugins/renderers/drm/plugin.c
01552a
+++ b/src/plugins/renderers/drm/plugin.c
01552a
@@ -462,60 +462,62 @@ load_driver (ply_renderer_backend_t *backend)
01552a
   int device_fd;
01552a
 
01552a
   ply_trace ("Opening '%s'", backend->device_name);
01552a
   device_fd = open (backend->device_name, O_RDWR);
01552a
 
01552a
   if (device_fd < 0)
01552a
     {
01552a
       ply_trace ("open failed: %m");
01552a
       return false;
01552a
     }
01552a
 
01552a
   backend->driver_interface = ply_renderer_generic_driver_get_interface (device_fd);
01552a
   backend->driver_supports_mapping_console = false;
01552a
 
01552a
   if (backend->driver_interface == NULL)
01552a
     {
01552a
       close (device_fd);
01552a
       return false;
01552a
     }
01552a
 
01552a
   backend->driver = backend->driver_interface->create_driver (device_fd);
01552a
 
01552a
   if (backend->driver == NULL)
01552a
     {
01552a
       close (device_fd);
01552a
       return false;
01552a
     }
01552a
 
01552a
   backend->device_fd = device_fd;
01552a
 
01552a
+  drmDropMaster (device_fd);
01552a
+
01552a
   return true;
01552a
 }
01552a
 
01552a
 static void
01552a
 unload_driver (ply_renderer_backend_t *backend)
01552a
 {
01552a
   if (backend->driver == NULL)
01552a
     return;
01552a
 
01552a
   ply_trace ("unloading driver");
01552a
   assert (backend->driver_interface != NULL);
01552a
 
01552a
   backend->driver_interface->destroy_driver (backend->driver);
01552a
   backend->driver = NULL;
01552a
 
01552a
   backend->driver_interface = NULL;
01552a
 
01552a
   if (backend->device_fd >= 0)
01552a
     {
01552a
       drmClose (backend->device_fd);
01552a
       backend->device_fd = -1;
01552a
     }
01552a
 }
01552a
 
01552a
 static bool
01552a
 open_device (ply_renderer_backend_t *backend)
01552a
 {
01552a
   assert (backend != NULL);
01552a
   assert (backend->device_name != NULL);
01552a
 
01552a
-- 
01552a
2.7.4
01552a