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>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Jocelyn Falempe <jfalempe@redhat.com>
Subject: [PATCH v4 6/7] drm/log: Implement suspend/resume
Date: Fri, 11 Oct 2024 12:50:03 +0200 [thread overview]
Message-ID: <20241011105526.615812-7-jfalempe@redhat.com> (raw)
In-Reply-To: <20241011105526.615812-1-jfalempe@redhat.com>
The console is already suspended in printk.c.
Just make sure we don't write to the framebuffer while the graphic
driver is suspended.
It may lose a few messages between graphic suspend and console
suspend.
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
---
drivers/gpu/drm/drm_log.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/gpu/drm/drm_log.c b/drivers/gpu/drm/drm_log.c
index 635dff7b37ce..07d151300146 100644
--- a/drivers/gpu/drm/drm_log.c
+++ b/drivers/gpu/drm/drm_log.c
@@ -50,6 +50,7 @@ struct drm_log {
struct drm_client_dev client;
struct console con;
bool probed;
+ bool suspended;
u32 n_scanout;
struct drm_log_scanout *scanout;
};
@@ -310,10 +311,32 @@ static int drm_log_client_hotplug(struct drm_client_dev *client)
return 0;
}
+static int drm_log_client_suspend(struct drm_client_dev *client, bool _console_lock)
+{
+ struct drm_log *dlog = client_to_drm_log(client);
+
+ mutex_lock(&dlog->lock);
+ dlog->suspended = true;
+ mutex_unlock(&dlog->lock);
+ return 0;
+}
+
+static int drm_log_client_resume(struct drm_client_dev *client, bool _console_lock)
+{
+ struct drm_log *dlog = client_to_drm_log(client);
+
+ mutex_lock(&dlog->lock);
+ dlog->suspended = false;
+ mutex_unlock(&dlog->lock);
+ return 0;
+}
+
static const struct drm_client_funcs drm_log_client_funcs = {
.owner = THIS_MODULE,
.unregister = drm_log_client_unregister,
.hotplug = drm_log_client_hotplug,
+ .suspend = drm_log_client_suspend,
+ .resume = drm_log_client_resume,
};
static void drm_log_write_thread(struct console *con, struct nbcon_write_context *wctxt)
@@ -321,6 +344,9 @@ static void drm_log_write_thread(struct console *con, struct nbcon_write_context
struct drm_log *dlog = console_to_drm_log(con);
int i;
+ if (dlog->suspended)
+ return;
+
if (!dlog->probed)
drm_log_init_client(dlog);
--
2.46.2
next prev parent reply other threads:[~2024-10-11 10:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 10:49 [PATCH v4 0/7] drm/log: Introduce a new boot logger to draw the kmsg on the screen Jocelyn Falempe
2024-10-11 10:49 ` [PATCH v4 1/7] [NOT FOR REVIEW] drm/client, squash of drm client pending series Jocelyn Falempe
2024-10-11 10:49 ` [PATCH v4 2/7] drm/panic: Move drawing functions to drm_draw Jocelyn Falempe
2024-10-11 10:50 ` [PATCH v4 3/7] drm/log: Introduce a new boot logger to draw the kmsg on the screen Jocelyn Falempe
2024-10-15 20:05 ` kernel test robot
2024-10-11 10:50 ` [PATCH v4 4/7] drm/log: Do not draw if drm_master is taken Jocelyn Falempe
2024-10-11 10:50 ` [PATCH v4 5/7] drm/log: Color the timestamp, to improve readability Jocelyn Falempe
2024-10-11 10:50 ` Jocelyn Falempe [this message]
2024-10-11 10:50 ` [PATCH v4 7/7] drm/log: Add integer scaling support Jocelyn Falempe
2024-10-11 11:18 ` Jani Nikula
2024-10-11 11:58 ` 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=20241011105526.615812-7-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=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®