Commit 0a8bc1d0 authored by Thomas Zimmermann's avatar Thomas Zimmermann
Browse files

drm/client: log: Implement struct drm_client_funcs.restore



Restore the log client's output when the DRM core invokes the restore
callback. Follow the existing behavior of fbdev emulation wrt. the
value of the force parameter.

If force is false, acquire the DRM master lock and reprogram the
display. This is the case when the user-space compositor exits and
the DRM core transfers the display back to the in-kernel client. This
also enables drm_log output during reboot and shutdown.

If force is true, reprogram without considering the master lock. This
overrides the current compositor and prints the log to the screen. In
case of system malfunction, users can enter SysRq+v to invoke the
emergency error reporting. See Documentation/admin-guide/sysrq.rst for
more information.

v2:
- s/exists/exits/ in second paragraph of commit description
- fix grammar in commit description

Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
Link: https://patch.msgid.link/20251110154616.539328-4-tzimmermann@suse.de
parent 6915190a
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -315,6 +315,18 @@ static void drm_log_client_unregister(struct drm_client_dev *client)
	drm_client_release(client);
}

static int drm_log_client_restore(struct drm_client_dev *client, bool force)
{
	int ret;

	if (force)
		ret = drm_client_modeset_commit_locked(client);
	else
		ret = drm_client_modeset_commit(client);

	return ret;
}

static int drm_log_client_hotplug(struct drm_client_dev *client)
{
	struct drm_log *dlog = client_to_drm_log(client);
@@ -348,6 +360,7 @@ static const struct drm_client_funcs drm_log_client_funcs = {
	.owner		= THIS_MODULE,
	.free		= drm_log_client_free,
	.unregister	= drm_log_client_unregister,
	.restore	= drm_log_client_restore,
	.hotplug	= drm_log_client_hotplug,
	.suspend	= drm_log_client_suspend,
	.resume		= drm_log_client_resume,