[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241011105526.615812-7-jfalempe@redhat.com>
Date: Fri, 11 Oct 2024 12:50:03 +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,
Caleb Connolly <caleb.connolly@...aro.org>,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Cc: Jocelyn Falempe <jfalempe@...hat.com>
Subject: [PATCH v4 6/7] drm/log: Implement suspend/resume
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@...hat.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
Powered by blists - more mailing lists