All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jocelyn Falempe <jfalempe@redhat.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	John Ogness <john.ogness@linutronix.de>,
	Javier Martinez Canillas <javierm@redhat.com>,
	"Guilherme G . Piccoli" <gpiccoli@igalia.com>,
	bluescreen_avenger@verizon.net,
	Caleb Connolly <caleb.connolly@linaro.org>,
	Petr Mladek <pmladek@suse.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Jocelyn Falempe <jfalempe@redhat.com>
Subject: [PATCH v7 4/7] drm/log: Do not draw if drm_master is taken
Date: Fri,  8 Nov 2024 09:10:22 +0100	[thread overview]
Message-ID: <20241108082025.1004653-5-jfalempe@redhat.com> (raw)
In-Reply-To: <20241108082025.1004653-1-jfalempe@redhat.com>

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>
---
 drivers/gpu/drm/drm_log.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_log.c b/drivers/gpu/drm/drm_log.c
index 376ee173d99d9..226e206e8b6a3 100644
--- a/drivers/gpu/drm/drm_log.c
+++ b/drivers/gpu/drm/drm_log.c
@@ -18,6 +18,7 @@
 #include <drm/drm_print.h>
 
 #include "drm_draw.h"
+#include "drm_internal.h"
 #include "drm_log.h"
 
 MODULE_AUTHOR("Jocelyn Falempe");
@@ -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)
-- 
2.47.0


  parent reply	other threads:[~2024-11-08  8:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  8:10 [PATCH v7 0/7] drm/log: Introduce a new boot logger to draw the kmsg on the screen Jocelyn Falempe
2024-11-08  8:10 ` [PATCH v7 1/7] drm/panic: Move drawing functions to drm_draw Jocelyn Falempe
2024-11-11 13:03   ` Thomas Zimmermann
2024-11-08  8:10 ` [PATCH v7 2/7] drm/client: Always select DRM_CLIENT_LIB Jocelyn Falempe
2024-11-08 11:56   ` kernel test robot
2024-11-08  8:10 ` [PATCH v7 3/7] drm/log: Introduce a new boot logger to draw the kmsg on the screen Jocelyn Falempe
2024-11-08 12:27   ` kernel test robot
2024-11-08 13:08   ` kernel test robot
2024-11-08  8:10 ` Jocelyn Falempe [this message]
2024-11-08 13:33   ` [PATCH v7 4/7] drm/log: Do not draw if drm_master is taken Thomas Zimmermann
2024-11-08 13:51     ` Jocelyn Falempe
2024-11-08  8:10 ` [PATCH v7 5/7] drm/log: Color the timestamp, to improve readability Jocelyn Falempe
2024-11-08  8:10 ` [PATCH v7 6/7] drm/log: Implement suspend/resume Jocelyn Falempe
2024-11-08  8:10 ` [PATCH v7 7/7] drm/log: Add integer scaling support Jocelyn Falempe
2024-11-11 13:06   ` Thomas Zimmermann
2024-11-12  9:51     ` Jocelyn Falempe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241108082025.1004653-5-jfalempe@redhat.com \
    --to=jfalempe@redhat.com \
    --cc=airlied@gmail.com \
    --cc=bluescreen_avenger@verizon.net \
    --cc=caleb.connolly@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gpiccoli@igalia.com \
    --cc=javierm@redhat.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=pmladek@suse.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.