From: Maxime Ripard <mripard@kernel.org>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Devarsh Thakkar <devarsht@ti.com>,
dri-devel@lists.freedesktop.org,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Jyri Sarha <jyri.sarha@iki.fi>
Subject: Re: [PATCH v9 13/42] drm/atomic_sro: Create drm_atomic_sro_state container
Date: Wed, 25 Nov 2026 10:17:28 +0100 [thread overview]
Message-ID: <awamDCF8_6VEhWJA@houat> (raw)
In-Reply-To: <ff6aeb12-270e-4959-838a-260bed0fb336@ideasonboard.com>
[-- Attachment #1: Type: text/plain, Size: 3715 bytes --]
Hi Tomi,
Thanks for your review,
On Wed, Nov 25, 2026 at 10:55:24AM +0200, Tomi Valkeinen wrote:
> On 20/11/2026 14:55, Maxime Ripard wrote:
> > The SRO infrastructure needs a state container to collect the readout
> > states for all KMS objects. Unlike drm_atomic_commit which tracks old
> > and new states for atomic commits, this container only holds a single
> > state per object: the one read out from the hardware.
> >
> > Create struct drm_atomic_sro_state with arrays for planes, CRTCs,
> > connectors, and private objects, along with accessors to get and set
> > individual object states within it.
> >
> > Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Signed-off-by: Maxime Ripard <mripard@kernel.org>
> > ---
> > drivers/gpu/drm/Makefile | 1 +
> > drivers/gpu/drm/drm_atomic_state_readout.c | 491 +++++++++++++++++++++++++++++
> > include/drm/drm_atomic_state_readout.h | 51 +++
> > 3 files changed, 543 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> > index 2c6bc093a923..e94b77497514 100644
> > --- a/drivers/gpu/drm/Makefile
> > +++ b/drivers/gpu/drm/Makefile
> > @@ -32,10 +32,11 @@ endif
> > # Enable -Werror in CI and development
> > subdir-ccflags-$(CONFIG_DRM_WERROR) += -Werror
> > drm-y := \
> > drm_atomic.o \
> > + drm_atomic_state_readout.o \
> > drm_atomic_uapi.o \
> > drm_auth.o \
> > drm_blend.o \
> > drm_bridge.o \
> > drm_cache.o \
> > diff --git a/drivers/gpu/drm/drm_atomic_state_readout.c b/drivers/gpu/drm/drm_atomic_state_readout.c
> > new file mode 100644
> > index 000000000000..c00631800234
> > --- /dev/null
> > +++ b/drivers/gpu/drm/drm_atomic_state_readout.c
> > @@ -0,0 +1,491 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +
> > +#include <drm/drm_atomic.h>
> > +#include <drm/drm_atomic_state_readout.h>
> > +#include <drm/drm_bridge.h>
> > +#include <drm/drm_connector.h>
> > +#include <drm/drm_crtc.h>
> > +#include <drm/drm_drv.h>
> > +#include <drm/drm_plane.h>
> > +#include <drm/drm_print.h>
> > +#include <linux/module.h>
> > +#include <linux/sched/mm.h>
> > +
> > +#include "drm_internal.h"
> > +#include "drm_crtc_internal.h"
> > +
> > +struct __drm_atomic_sro_plane {
> > + struct drm_plane *ptr;
> > + struct drm_plane_state *state;
> > +};
> > +
> > +struct __drm_atomic_sro_crtc {
> > + struct drm_crtc *ptr;
> > + struct drm_crtc_state *state;
> > +};
> > +
> > +struct __drm_atomic_sro_connector {
> > + struct drm_connector *ptr;
> > + struct drm_connector_state *state;
> > +};
> > +
> > +struct __drm_atomic_sro_private_obj {
> > + struct drm_private_obj *ptr;
> > + struct drm_private_state *state;
> > +};
> > +
> > +struct drm_atomic_sro_state {
> > + struct drm_device *dev;
> > + struct __drm_atomic_sro_plane *planes;
> > + struct __drm_atomic_sro_crtc *crtcs;
> > + struct __drm_atomic_sro_connector *connectors;
> > + unsigned int max_connector_index;
> > + struct __drm_atomic_sro_private_obj *private_objs;
> > + unsigned int num_private_objs;
>
> The private_objs makes me feel a bit uneasy. You add to private_objs array
> dynamically, without any check for the array size. An extra call to
> drm_atomic_sro_set_private_obj_state() will write over the array.
>
> If you're sure that can never happen, fine for me.
I don't think it's a concern for private_objs. They do not support
dynamic registration, and we initialize the array with the total number
of private_objs registered, so we over-allocate and cannot (I think?)
end up in a situation where we have a private_obj without a slot.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
next prev parent reply other threads:[~2026-11-25 9:17 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 12:54 [PATCH v9 00/42] drm: Implement state readout support Maxime Ripard
2026-11-20 12:54 ` [PATCH v9 01/42] drm/atomic: Add drm_atomic_get_connector_for_encoder_locked() Maxime Ripard
2026-11-23 13:56 ` Tomi Valkeinen
2026-11-20 12:54 ` [PATCH v9 02/42] drm/bridge-helper: Don't unlock the connection mutex after a backoff Maxime Ripard
2026-11-20 12:54 ` [PATCH v9 03/42] drm/tests: hdmi-state-helper: Handle EDEADLK in the 420-only test Maxime Ripard
2026-11-20 12:54 ` [PATCH v9 04/42] drm/tests: hdmi-state-helper: Handle EDEADLK in the color format test Maxime Ripard
2026-11-20 12:54 ` [PATCH v9 05/42] drm/colorop: Export drm_atomic_helper_colorop_create_state() Maxime Ripard
2026-11-24 8:40 ` Tomi Valkeinen
2026-11-20 12:54 ` [PATCH v9 06/42] drm/atomic: Fix private obj error handling Maxime Ripard
2026-11-20 12:54 ` [PATCH v9 07/42] drm/atomic: Add drm_private_obj name Maxime Ripard
2026-11-24 8:42 ` Tomi Valkeinen
2026-11-20 12:55 ` [PATCH v9 08/42] drm/bridge: Switch print_state to use bridge name Maxime Ripard
2026-11-24 8:43 ` Tomi Valkeinen
2026-11-20 12:55 ` [PATCH v9 09/42] drm/bridge: Add drm_private_obj_is_bridge() Maxime Ripard
2026-11-24 8:49 ` Tomi Valkeinen
2026-11-20 12:55 ` [PATCH v9 10/42] drm/fb-dma-helper: Handle framebuffers without a GEM object Maxime Ripard
2026-11-24 9:22 ` Tomi Valkeinen
2026-11-20 12:55 ` [PATCH v9 11/42] drm/gem-atomic-helper: " Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 12/42] drm/atomic: Export drm_atomic_*_print_state Maxime Ripard
2026-11-24 9:23 ` Tomi Valkeinen
2026-11-20 12:55 ` [PATCH v9 13/42] drm/atomic_sro: Create drm_atomic_sro_state container Maxime Ripard
2026-11-25 8:55 ` Tomi Valkeinen
2026-11-25 9:17 ` Maxime Ripard [this message]
2026-11-20 12:55 ` [PATCH v9 14/42] drm/atomic_sro: Create kernel parameter to force or disable readout Maxime Ripard
2026-11-25 9:05 ` Tomi Valkeinen
2026-11-20 12:55 ` [PATCH v9 15/42] drm/atomic_sro: Add atomic state readout infrastructure Maxime Ripard
2026-11-24 3:54 ` Chaoyi Chen
2026-11-24 12:28 ` Maxime Ripard
2026-11-24 12:43 ` Chaoyi Chen
2026-11-20 12:55 ` [PATCH v9 16/42] drm/atomic_sro: Create documentation Maxime Ripard
2026-11-27 9:46 ` Tomi Valkeinen
2026-11-20 12:55 ` [PATCH v9 17/42] drm/bridge: Handle bridges with hardware state readout Maxime Ripard
2026-11-20 13:18 ` sashiko-bot
2026-11-20 12:55 ` [PATCH v9 18/42] drm/mode-config: Read out hardware state in drm_mode_config_create_initial_state Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 19/42] drm/atomic_sro: Provide helpers to implement hardware state readout Maxime Ripard
2026-11-20 13:17 ` sashiko-bot
2026-11-20 12:55 ` [PATCH v9 20/42] drm/mode-config: Introduce hw_reset hook Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 21/42] drm/modeset-helper: Add drm_mode_config_helper_hw_reset() Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 22/42] drm/atomic_helper: Compare actual and readout states once the commit is done Maxime Ripard
2026-11-20 13:17 ` sashiko-bot
2026-11-20 12:55 ` [PATCH v9 23/42] drm/atomic-state-helper: Provide comparison macros Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 24/42] drm/atomic-state-helper: Provide atomic_compare_state helpers Maxime Ripard
2026-11-20 13:14 ` sashiko-bot
2026-11-20 12:55 ` [PATCH v9 25/42] drm/atomic-helper: Document State Read-Out as a state initialization approach Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 26/42] drm/tests: kunit: Add a drm_printer helper Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 27/42] drm/tests: Add tests for the atomic state readout Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 28/42] drm/encoder: Create atomic_sro_get_current_crtc hook Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 29/42] drm/bridge: display-connector: Implement readout support Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 30/42] drm/bridge_connector: Implement hw readout for connector Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 31/42] drm/tidss: Implement hw_reset Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 32/42] drm/tidss: crtc: Implement hardware state readout Maxime Ripard
2026-11-20 13:14 ` sashiko-bot
2026-11-20 12:55 ` [PATCH v9 33/42] drm/tidss: encoder: " Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 34/42] drm/tidss: kms: Hook up " Maxime Ripard
2026-11-20 13:25 ` sashiko-bot
2026-11-20 12:55 ` [PATCH v9 35/42] drm/tidss: plane: Implement " Maxime Ripard
2026-11-20 13:28 ` sashiko-bot
2026-11-20 12:55 ` [PATCH v9 36/42] drm/tidss: dispc: Add hardware state readout helpers Maxime Ripard
2026-11-20 13:17 ` sashiko-bot
2026-11-20 12:55 ` [PATCH v9 37/42] drm/tidss: encoder: Implement atomic_sro_get_current_crtc Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 38/42] drm/bridge: sii902x: Implement hw state readout Maxime Ripard
2026-11-20 13:26 ` sashiko-bot
2026-11-20 12:55 ` [PATCH v9 39/42] drm/panel: Implement state readout support Maxime Ripard
2026-11-20 12:55 ` [PATCH DO NOT MERGE v9 40/42] fixup! drm/tidss: dispc: Add hardware state readout helpers Maxime Ripard
2026-11-20 12:55 ` [PATCH DO NOT MERGE v9 41/42] drm/tidss: oldi: Implement hardware state readout Maxime Ripard
2026-11-20 13:34 ` sashiko-bot
2026-11-20 12:55 ` [PATCH HACK v9 42/42] drm/panel: Prepare and enable panels read out as active Maxime Ripard
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=awamDCF8_6VEhWJA@houat \
--to=mripard@kernel.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=devarsht@ti.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=jyri.sarha@iki.fi \
--cc=maarten.lankhorst@linux.intel.com \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tomi.valkeinen@ideasonboard.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.