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 <[email protected]> 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/[email protected]?part=4
