[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240816125612.1003295-5-jfalempe@redhat.com>
Date: Fri, 16 Aug 2024 14:52:36 +0200
From: Jocelyn Falempe <jfalempe@...hat.com>
To: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
John Ogness <john.ogness@...utronix.de>,
Javier Martinez Canillas <javierm@...hat.com>,
"Guilherme G . Piccoli" <gpiccoli@...lia.com>,
bluescreen_avenger@...izon.net,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Cc: Jocelyn Falempe <jfalempe@...hat.com>
Subject: [PATCH v2 4/5] drm/log: Do not draw if drm_master is taken
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 <jfalempe@...hat.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
Powered by blists - more mailing lists