summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJocelyn Falempe <jfalempe@redhat.com>2024-12-04 16:45:02 +0100
committerJocelyn Falempe <jfalempe@redhat.com>2024-12-10 14:36:53 +0100
commiteb30b4453e4c29bbe2ff855c08b13f332b3505aa (patch)
tree11dff2157b35fb4900866be8744aa8e882e5bd4d
parentf7b42442c4ac142ab5e261858cec48eb6c9c1567 (diff)
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@redhat.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20241204160014.1171469-4-jfalempe@redhat.com
-rw-r--r--drivers/gpu/drm/clients/drm_log.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/drm/clients/drm_log.c b/drivers/gpu/drm/clients/drm_log.c
index 4e07bff6c864..a933da024b1a 100644
--- a/drivers/gpu/drm/clients/drm_log.c
+++ b/drivers/gpu/drm/clients/drm_log.c
@@ -19,6 +19,7 @@
#include "drm_client_internal.h"
#include "drm_draw_internal.h"
+#include "drm_internal.h"
MODULE_AUTHOR("Jocelyn Falempe");
MODULE_DESCRIPTION("DRM boot logger");
@@ -308,8 +309,13 @@ static void drm_log_write_thread(struct console *con, struct nbcon_write_context
if (!dlog->probed)
drm_log_init_client(dlog);
- for (i = 0; i < dlog->n_scanout; i++)
- drm_log_draw_kmsg_record(&dlog->scanout[i], wctxt->outbuf, wctxt->len);
+ /* Check that we are still the master before drawing */
+ if (drm_master_internal_acquire(dlog->client.dev)) {
+ drm_master_internal_release(dlog->client.dev);
+
+ for (i = 0; i < dlog->n_scanout; i++)
+ drm_log_draw_kmsg_record(&dlog->scanout[i], wctxt->outbuf, wctxt->len);
+ }
}
static void drm_log_lock(struct console *con, unsigned long *flags)