Linux EFI development
 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>,
	"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, linux-efi@vger.kernel.org
Subject: Re: [PATCH v7 4/6] drm: client: add splash client
Date: Mon, 16 Nov 2026 00:51:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-215973@kernel.org> (raw)
In-Reply-To: <20261116002156.1027726-5-maximpedraza@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/client: splash: stale modeset kept when probe finds no
  connectors
--

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

drm: client: add splash client

This commit adds an in-kernel DRM client that displays a solid background
color, an EFI BGRT logo, or a BMP firmware image until userspace takes
over the display.

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

[ ... ]

> +static int drm_splash_init_client(struct drm_splash *splash)
> +{
> +	struct drm_client_dev *client = &splash->client;
> +	struct drm_mode_set *modeset;
> +	unsigned int fb_count = 0;
> +	unsigned int i, k;
> +	int err = -ENODEV;
> +
> +	if (drm_client_modeset_probe(client, 0, 0))
> +		return -EIO;
> +
> +	mutex_lock(&client->modeset_mutex);
> +
> +	/*
> +	 * Collect one scanout per usable modeset, or per tile group. Each
> +	 * scanout records the modesets it feeds by their position in the
> +	 * list, so that the second pass below can find them again whatever
> +	 * was skipped in between.
> +	 */
> +	i = 0;
> +	drm_client_for_each_modeset(modeset, client) {
> +		struct drm_splash_scanout *tmp;
> +		struct drm_splash_scanout *scanout;
> +		unsigned int idx = i++;
> +		u32 format;
> +		int id;
> +
> +		if (WARN_ON_ONCE(idx >= 32))
> +			break;
> +
> +		/* Skip modesets without a mode */
> +		if (!modeset->mode)
> +			continue;
> +
> +		id = drm_splash_tile_group_id(modeset->connectors[0]);

[ ... ]

> +	/*
> +	 * And point every modeset at the buffer of its scanout. One left
> +	 * without, whatever the reason, is switched off: a mode without a
> +	 * framebuffer fails the commit, and with it every other output.
> +	 * Never the old one: a probe without connectors leaves it there.
> +	 */
> +	i = 0;
> +	drm_client_for_each_modeset(modeset, client) {
> +		unsigned int idx = i++;
> +
> +		modeset->fb = NULL;
> +		for (k = 0; idx < 32 && k < splash->n_scanout; k++) {
> +			struct drm_splash_scanout *scanout = &splash->scanout[k];
> +
> +			if (scanout->buffer && (scanout->modesets & BIT(idx))) {
> +				modeset->fb = scanout->buffer->fb;
> +				break;
> +			}
> +		}
> +
> +		if (!modeset->fb)
> +			drm_splash_modeset_off(client->dev, modeset);
> +	}

[ ... ]

> +static void drm_splash_rebuild(struct drm_splash *splash)
> +{
> +	struct drm_client_dev *client = &splash->client;
> +	int ret;
> +
> +	/*
> +	 * Every hotplug starts over, with the outputs there are now. The
> +	 * scanouts on screen stay there until the work or restore has
> +	 * committed the new ones; with some still waiting for that, the
> +	 * current ones were never committed and can go.
> +	 */
> +	if (splash->old_scanout) {
> +		drm_splash_free_scanout(client);
> +	} else {
> +		splash->old_scanout = splash->scanout;
> +		splash->n_old_scanout = splash->n_scanout;
> +		splash->scanout = NULL;
> +		splash->n_scanout = 0;
> +	}
> +
> +	ret = drm_splash_init_client(splash);

[Severity: Medium]
Does drm_splash_init_client() rebuild and commit a stale modeset when all
connectors are removed?

After a commit clears splash->old_scanout, drm_splash_rebuild() moves
splash->scanout to splash->old_scanout without calling
drm_splash_free_scanout(), leaving client->modesets populated.  If
all dynamic connectors (such as DP MST outputs) have been removed,
drm_client_modeset_probe() returns 0 before calling
drm_client_modeset_release():

drivers/gpu/drm/drm_client_modeset.c:drm_client_modeset_probe() {
	...
	if (!connector_count)
		return 0;
	...
	drm_client_modeset_release(client);
}

Because the old modeset->mode and modeset->connectors[0] remain in place,
the first loop in drm_splash_init_client() sees modeset->mode != NULL,
reads the stale modeset->connectors[0], and creates a new scanout and dumb
buffer for the removed output, so the final loop sets modeset->fb to the
new buffer instead of calling drm_splash_modeset_off().

Clearing client->modesets with drm_splash_modeset_off() in the else branch
of drm_splash_rebuild() before probing would avoid reusing the old
modeset state.

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

  reply	other threads:[~2026-11-16  0:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  0:21 [PATCH v7 0/6] Add splash DRM client Màxim Pedraza Padilla
2026-11-16  0:21 ` [PATCH v7 1/6] drm/clients: Kconfig: indent DRM_CLIENT_DEFAULT with tabs Màxim Pedraza Padilla
2026-11-16  0:21 ` [PATCH v7 2/6] efi: bgrt: add accessors for the boot graphics Màxim Pedraza Padilla
2026-11-16  0:21 ` [PATCH v7 3/6] fbdev: efifb: move the BMP headers to <video/bmp.h> Màxim Pedraza Padilla
2026-11-16  0:21 ` [PATCH v7 4/6] drm: client: add splash client Màxim Pedraza Padilla
2026-11-16  0:51   ` sashiko-bot [this message]
2026-11-16  0:21 ` [PATCH v7 5/6] drm: docs: remove bootsplash from TODO Màxim Pedraza Padilla
2026-11-16  0:21 ` [PATCH v7 6/6] drm/client: splash: pick the image source in one place 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-215973@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=airlied@gmail.com \
    --cc=ardb@kernel.org \
    --cc=corbet@lwn.net \
    --cc=deller@gmx.de \
    --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=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=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