When userspace takes drm_master, the drm_client buffer is no more
visible, so drm_log shouldn't waste CPU cycle to draw on it.

Signed-off-by: Jocelyn Falempe <jfale...@redhat.com>
---
 drivers/gpu/drm/drm_log.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_log.c b/drivers/gpu/drm/drm_log.c
index 0739a4c72bb7..b94ce3ea48a0 100644
--- a/drivers/gpu/drm/drm_log.c
+++ b/drivers/gpu/drm/drm_log.c
@@ -22,6 +22,7 @@
 
 #include "drm_draw.h"
 #include "drm_log.h"
+#include "drm_internal.h"
 
 MODULE_AUTHOR("Jocelyn Falempe");
 MODULE_DESCRIPTION("DRM boot logger");
@@ -361,10 +362,15 @@ static bool drm_log_active_output(void)
        bool active = false;
 
        mutex_lock(&drm_log_lock);
-       list_for_each_entry(dclient, &drm_log_clients, head)
-               if (dclient->n_scanout || !dclient->probed)
-                       active = true;
-
+       list_for_each_entry(dclient, &drm_log_clients, head) {
+               if (dclient->n_scanout || !dclient->probed) {
+                       /* Also check that we are still the master */
+                       if (drm_master_internal_acquire(dclient->client.dev)) {
+                               
drm_master_internal_release(dclient->client.dev);
+                               active = true;
+                       }
+               }
+       }
        mutex_unlock(&drm_log_lock);
        return active;
 }
-- 
2.46.0

Reply via email to