dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Màxim Pedraza Padilla" <maximpedraza@gmail.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Helge Deller" <deller@gmx.de>, "Peter Jones" <pjones@redhat.com>
Cc: "Francesco Valla" <francesco@valla.it>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Mario Limonciello" <mario.limonciello@amd.com>,
	"Javier Martinez Canillas" <javierm@redhat.com>,
	"Jocelyn Falempe" <jfalempe@redhat.com>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-efi@vger.kernel.org
Subject: Re: [PATCH v6 04/15] drm: client: add splash client
Date: Tue, 27 Oct 2026 14:19:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-186719@kernel.org> (raw)
In-Reply-To: <20261027135342.2003632-5-maximpedraza@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/client: splash: deferred restore during suspend skipped when n_scanout is 0
--

commit e78c6d64f4fdb91cb45b16a96f7a38008255ec63
Author: Francesco Valla <francesco@valla.it>

drm: client: add splash client

This commit adds a DRM splash client capable of displaying an EFI BGRT logo,
a firmware-loaded 24bpp uncompressed BMP image, or a solid background color.
The client draws from a work item, handles hotplug events while keeping the
previous scanouts on screen until new ones are committed, and defers drawing
and restore commits while the device is suspended.

> diff --git a/drivers/gpu/drm/clients/drm_splash.c b/drivers/gpu/drm/clients/drm_splash.c
> new file mode 100644
> index 0000000000000..337c7160c4a1b
> --- /dev/null
> +++ b/drivers/gpu/drm/clients/drm_splash.c
> @@ -0,0 +1,976 @@

[ ... ]

> +static void drm_splash_work(struct work_struct *work)
> +{
> +	struct drm_splash *splash = container_of(work, struct drm_splash, work);
> +	struct drm_client_dev *client = &splash->client;
> +	const u8 *img_data = NULL;
> +	size_t img_data_len = 0;
> +	bool img_loaded;
> +	unsigned int i;
> +	int ret;
> +
> +	guard(mutex)(&splash->lock);
> +
> +	/*
> +	 * Not while the device sleeps, not even drawing, which flushes the
>	 * buffers to the hardware: resume queues the work again
> +	 */
> +	if (splash->suspended) {
> +		splash->work_skipped = true;
> +		return;
> +	}
> +
> +	if (!splash->n_scanout)
> +		return;

[ ... ]

> +	ret = drm_client_modeset_commit(client);
> +	if (ret) {
> +		/* What a hotplug replaced is still on screen: it stays */
> +		drm_dbg(client->dev, "splash: commit: %d\n", ret);
> +		return;
> +	}
> +
> +	/* Whatever a hotplug replaced is no longer on screen */
> +	drm_splash_delete_scanouts(&splash->old_scanout, &splash->n_old_scanout);
> +}

[ ... ]

> +/* An output without a buffer has no mode either: the commit switches it off */
> +static int drm_splash_client_restore(struct drm_client_dev *client, bool force)
> +{
> +	struct drm_splash *splash = client_to_drm_splash(client);
> +	int ret;
> +
> +	guard(mutex)(&splash->lock);
> +
> +	/* Not while the device sleeps: resume runs the work, which commits */
> +	if (splash->suspended) {
> +		splash->work_skipped = true;
> +		return 0;
> +	}
> +
> +	if (force)
> +		ret = drm_client_modeset_commit_locked(client);
> +	else
> +		ret = drm_client_modeset_commit(client);
> +
> +	/* Whatever a hotplug replaced is no longer on screen */
> +	if (!ret)
> +		drm_splash_delete_scanouts(&splash->old_scanout,
> +					   &splash->n_old_scanout);
> +
> +	return ret;
> +}

[Severity: Medium]
In drivers/gpu/drm/clients/drm_splash.c, can a restore deferred during
suspend be skipped on resume when splash->n_scanout is 0, or lose the force
flag?

If a hotplug event finds no usable modesets or fails buffer allocation,
drm_splash_client_hotplug() moves the previously active scanouts to
splash->old_scanout and calls drm_splash_free_scanout(), which clears
client->modesets via drm_splash_modeset_off() and leaves splash->n_scanout
at 0.

If drm_splash_client_restore() is then called while splash->suspended is
true (for example, via drm_lastclose() when a userspace master closes its
DRM file descriptor), it sets splash->work_skipped = true and returns 0,
relying on drm_splash_client_resume() to queue drm_splash_work() to perform
the commit.

However, when drm_splash_work() runs on resume, it checks:

	if (!splash->n_scanout)
		return;

and returns before calling drm_client_modeset_commit(client) and
drm_splash_delete_scanouts(&splash->old_scanout, &splash->n_old_scanout).
Wouldn't this leave the disabled modesets uncommitted and splash->old_scanout
unfreed?

Additionally, if drm_splash_client_restore(client, true) is called while
suspended, the force argument is not recorded, so drm_splash_work() will
call drm_client_modeset_commit() instead of
drm_client_modeset_commit_locked() and fail with -EBUSY if a DRM master is
still active.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261027135342.2003632-1-maximpedraza@gmail.com?part=4

  reply	other threads:[~2026-10-27 14:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 13:53 [PATCH v6 00/15] Add splash DRM client Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 01/15] drm/clients: Kconfig: indent DRM_CLIENT_DEFAULT with tabs Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 02/15] efi: bgrt: add accessors for the boot graphics Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 03/15] fbdev: efifb: move the BMP headers to <video/bmp.h> Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 04/15] drm: client: add splash client Màxim Pedraza Padilla
2026-10-27 14:19   ` sashiko-bot [this message]
2026-10-27 13:53 ` [PATCH v6 05/15] MAINTAINERS: add entry for DRM " Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 06/15] drm: docs: remove bootsplash from TODO Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 07/15] dt-bindings: display: add a boot logo node under /chosen Màxim Pedraza Padilla
2026-10-27 18:59   ` Rob Herring (Arm)
2026-10-27 13:53 ` [PATCH v6 08/15] drm/client: splash: pick the image source in one place Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 09/15] drm/client: splash: add a device tree image source Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 10/15] drm/client: splash: place the device tree image where it asks Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 11/15] drm/client: splash: turn the device tree image as " Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 12/15] drm/client: splash: take the background colour from the image source Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 13/15] drm/client: splash: turn the BGRT image on panels mounted turned Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 14/15] drm/client: splash: follow the connector's orientation Màxim Pedraza Padilla
2026-10-27 13:53 ` [PATCH v6 15/15] drm/client: splash: document the image sources Màxim Pedraza Padilla

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=sashiko-outbox-186719@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=airlied@gmail.com \
    --cc=ardb@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=deller@gmx.de \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=francesco@valla.it \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=javierm@redhat.com \
    --cc=jfalempe@redhat.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mario.limonciello@amd.com \
    --cc=maximpedraza@gmail.com \
    --cc=mripard@kernel.org \
    --cc=pjones@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=robh@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=simona@ffwll.ch \
    --cc=skhan@linuxfoundation.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