mirror of https://lore.kernel.org/lkml/
 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, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Cc: Jocelyn Falempe <jfalempe@redhat.com>
Subject: [PATCH v2 4/5] drm/log: Do not draw if drm_master is taken
Date: Fri, 16 Aug 2024 14:52:36 +0200	[thread overview]
Message-ID: <20240816125612.1003295-5-jfalempe@redhat.com> (raw)
In-Reply-To: <20240816125612.1003295-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 | 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


  parent reply	other threads:[~2024-08-16 12:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-16 12:52 [RFC PATCH v2 0/5] drm/log: Introduce a new boot logger to draw the kmsg on the screen Jocelyn Falempe
2024-08-16 12:52 ` [PATCH v2 1/5] [NOT FOR REVIEW] drm/panic: Squash of pending series Jocelyn Falempe
2024-08-16 12:52 ` [PATCH v2 2/5] drm/panic: Move drawing functions to drm_draw Jocelyn Falempe
2024-08-16 12:52 ` [PATCH v2 3/5] drm/log: Introduce a new boot logger to draw the kmsg on the screen Jocelyn Falempe
2024-08-18  8:33   ` kernel test robot
2024-08-16 12:52 ` Jocelyn Falempe [this message]
2024-08-16 12:52 ` [PATCH v2 5/5] drm/log: Color the timestamp, to improve readability Jocelyn Falempe
2024-08-17 13:45 ` [RFC PATCH v2 0/5] drm/log: Introduce a new boot logger to draw the kmsg on the screen nerdopolis

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=20240816125612.1003295-5-jfalempe@redhat.com \
    --to=jfalempe@redhat.com \
    --cc=airlied@gmail.com \
    --cc=bluescreen_avenger@verizon.net \
    --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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®