From: Maxime Ripard <mripard@kernel.org>
To: 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>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Devarsh Thakkar <devarsht@ti.com>,
dri-devel@lists.freedesktop.org,
Maxime Ripard <mripard@kernel.org>
Subject: [PATCH v9 24/42] drm/atomic-state-helper: Provide atomic_compare_state helpers
Date: Fri, 20 Nov 2026 13:55:16 +0100 [thread overview]
Message-ID: <20261120-drm-state-readout-v9-24-a67c2b45b8ec@kernel.org> (raw)
In-Reply-To: <20261120-drm-state-readout-v9-0-a67c2b45b8ec@kernel.org>
Now that we have introduced some new infrastructure to compare state
instances, provide helpers for the default states.
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
drivers/gpu/drm/drm_atomic_state_readout_helper.c | 391 ++++++++++++++++++++++
drivers/gpu/drm/drm_bridge.c | 16 +
include/drm/drm_atomic_state_readout_helper.h | 28 ++
include/drm/drm_bridge.h | 5 +-
include/drm/drm_connector.h | 5 +-
include/drm/drm_crtc.h | 5 +-
include/drm/drm_plane.h | 5 +-
7 files changed, 451 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_state_readout_helper.c b/drivers/gpu/drm/drm_atomic_state_readout_helper.c
index 80eb467baefc..d39d8e40f894 100644
--- a/drivers/gpu/drm/drm_atomic_state_readout_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_readout_helper.c
@@ -6,10 +6,11 @@
#include <drm/drm_bridge.h>
#include <drm/drm_colorop.h>
#include <drm/drm_connector.h>
#include <drm/drm_crtc.h>
#include <drm/drm_encoder.h>
+#include <drm/drm_framebuffer.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_plane.h>
#include <drm/drm_print.h>
#include <drm/drm_vblank.h>
@@ -936,10 +937,400 @@ void drm_atomic_helper_sro_install_state(struct drm_atomic_sro_state *state)
state->private_objs[i].ptr = NULL;
}
}
EXPORT_SYMBOL(drm_atomic_helper_sro_install_state);
+static bool drm_atomic_helper_fb_compare(struct drm_printer *p,
+ struct drm_framebuffer *expected,
+ struct drm_framebuffer *actual)
+{
+ unsigned int i;
+ bool ret = true;
+
+ STATE_CHECK_FORMAT_INFO(ret, p, "framebuffer", expected, actual, format);
+
+ /*
+ * A framebuffer reconstructed from the hardware only covers the
+ * part of the buffer that is scanned out, and its per-plane
+ * offsets are baked into the DMA base address: the buffer
+ * geometry and the offsets can't be read back and aren't
+ * compared. The scanned out geometry is still checked through
+ * the source and destination rectangles of the plane state.
+ */
+ for (i = 0; i < expected->format->num_planes; i++)
+ STATE_CHECK_U32(ret, p, "framebuffer", expected, actual, pitches[i]);
+
+ STATE_CHECK_U64(ret, p, "framebuffer", expected, actual, modifier);
+ STATE_CHECK_S32_X(ret, p, "framebuffer", expected, actual, flags);
+
+ return ret;
+}
+
+/**
+ * drm_atomic_helper_plane_compare_state - default &drm_plane_funcs.atomic_sro_compare_state hook
+ * @plane: the plane being compared
+ * @p: printer for reporting mismatches
+ * @expected: the committed &struct drm_plane_state
+ * @actual: the &struct drm_plane_state read out from hardware
+ *
+ * Compares the base &struct drm_plane_state fields of @actual to
+ * @expected and reports any mismatches through @p. Drivers subclassing
+ * the plane state should call this first, then compare their own fields.
+ *
+ * RETURNS:
+ *
+ * True if the states are identical, false otherwise.
+ */
+bool drm_atomic_helper_plane_compare_state(struct drm_plane *plane,
+ struct drm_printer *p,
+ struct drm_plane_state *expected,
+ struct drm_plane_state *actual)
+{
+ bool ret = true;
+
+ STATE_CHECK_PTR(ret, p, plane->name, expected, actual, plane);
+ STATE_CHECK_PTR(ret, p, plane->name, expected, actual, crtc);
+
+ /* Both disabled, geometry is meaningless. */
+ if (!expected->fb && !actual->fb)
+ return ret;
+
+ /* One enabled and the other disabled, that's a mismatch. */
+ if (!expected->fb || !actual->fb) {
+ drm_atomic_helper_print_state_mismatch(p,
+ plane->name,
+ "fb",
+ "expected framebuffer is %s, got %s",
+ expected->fb ? "non-NULL" : "NULL",
+ actual->fb ? "non-NULL" : "NULL");
+ return false;
+ }
+
+ /* Both enabled, compare framebuffer and geometry. */
+ if (!drm_atomic_helper_fb_compare(p, expected->fb, actual->fb))
+ ret = false;
+
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, crtc_x);
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, crtc_y);
+ STATE_CHECK_U32(ret, p, plane->name, expected, actual, crtc_w);
+ STATE_CHECK_U32(ret, p, plane->name, expected, actual, crtc_h);
+
+ /*
+ * NOTE: We can't check src_x and src_y: the source offsets are
+ * baked into the DMA base address and cannot be read back.
+ */
+ STATE_CHECK_U32_16_16(ret, p, plane->name, expected, actual, src_w);
+ STATE_CHECK_U32_16_16(ret, p, plane->name, expected, actual, src_h);
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, hotspot_x);
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, hotspot_y);
+ STATE_CHECK_U16(ret, p, plane->name, expected, actual, alpha);
+ STATE_CHECK_U16(ret, p, plane->name, expected, actual, pixel_blend_mode);
+ STATE_CHECK_U32(ret, p, plane->name, expected, actual, rotation);
+
+ /*
+ * When the zpos are normalized, the zpos property is a
+ * userspace request turned into normalized_zpos during
+ * atomic_check, and the hardware only stores the normalized
+ * result. Otherwise, the driver programs the zpos property
+ * directly and normalized_zpos isn't updated.
+ */
+ if (plane->dev->mode_config.normalize_zpos)
+ STATE_CHECK_U32(ret, p, plane->name, expected, actual, normalized_zpos);
+ else
+ STATE_CHECK_U32(ret, p, plane->name, expected, actual, zpos);
+
+ STATE_CHECK_U32(ret, p, plane->name, expected, actual, color_encoding);
+ STATE_CHECK_U32(ret, p, plane->name, expected, actual, color_range);
+
+ /*
+ * NOTE: We can't check fb_damage_clips and ignore_damage_clips
+ * because they are transient, per-commit software fields that
+ * are reset when the state is duplicated and never stored in
+ * the hardware.
+ */
+
+ STATE_CHECK_PTR(ret, p, plane->name, expected, actual, color_pipeline);
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, src.x1);
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, src.x2);
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, src.y1);
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, src.y2);
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, dst.x1);
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, dst.x2);
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, dst.y1);
+ STATE_CHECK_S32(ret, p, plane->name, expected, actual, dst.y2);
+ STATE_CHECK_BOOL(ret, p, plane->name, expected, actual, visible);
+ STATE_CHECK_U32(ret, p, plane->name, expected, actual, scaling_filter);
+
+ return ret;
+}
+EXPORT_SYMBOL(drm_atomic_helper_plane_compare_state);
+
+/**
+ * drm_atomic_helper_crtc_compare_state - default &drm_crtc_funcs.atomic_sro_compare_state hook
+ * @crtc: the CRTC being compared
+ * @p: printer for reporting mismatches
+ * @expected: the committed &struct drm_crtc_state
+ * @actual: the &struct drm_crtc_state read out from hardware
+ *
+ * Compares the base &struct drm_crtc_state fields of @actual to
+ * @expected and reports any mismatches through @p. Drivers subclassing
+ * the CRTC state should call this first, then compare their own fields.
+ *
+ * RETURNS:
+ *
+ * True if the states are identical, false otherwise.
+ */
+bool drm_atomic_helper_crtc_compare_state(struct drm_crtc *crtc,
+ struct drm_printer *p,
+ struct drm_crtc_state *expected,
+ struct drm_crtc_state *actual)
+{
+ bool ret = true;
+
+ STATE_CHECK_PTR(ret, p, crtc->name, expected, actual, crtc);
+ STATE_CHECK_BOOL(ret, p, crtc->name, expected, actual, active);
+
+ /* Both inactive, mode and properties are meaningless. */
+ if (!expected->active && !actual->active)
+ return ret;
+
+ /* One active and the other inactive, that's a mismatch. */
+ if (!expected->active || !actual->active)
+ return false;
+
+ /*
+ * Both active, compare everything. enable is only checked at
+ * this point: a DPMS off commit keeps enable set while the
+ * hardware, and thus the readout, reports an inactive CRTC.
+ */
+ STATE_CHECK_BOOL(ret, p, crtc->name, expected, actual, enable);
+
+ /* Both active, compare everything. */
+ STATE_CHECK_BOOL(ret, p, crtc->name, expected, actual, no_vblank);
+ STATE_CHECK_U32(ret, p, crtc->name, expected, actual, plane_mask);
+ STATE_CHECK_U32(ret, p, crtc->name, expected, actual, connector_mask);
+ STATE_CHECK_U32(ret, p, crtc->name, expected, actual, encoder_mask);
+
+ STATE_CHECK_DISPLAY_MODE(ret, p, crtc->name, expected, actual, mode);
+ STATE_CHECK_DISPLAY_MODE(ret, p, crtc->name, expected, actual, adjusted_mode);
+
+ /*
+ * NOTE: We can't check mode_blob: its payload also carries the
+ * mode type and name, and neither can be reconstructed from the
+ * hardware. The modes themselves are covered by the checks
+ * above.
+ */
+ STATE_CHECK_PROPERTY_BLOB(ret, p, crtc->name, expected, actual, degamma_lut);
+ STATE_CHECK_PROPERTY_BLOB(ret, p, crtc->name, expected, actual, ctm);
+ STATE_CHECK_PROPERTY_BLOB(ret, p, crtc->name, expected, actual, gamma_lut);
+ STATE_CHECK_BOOL(ret, p, crtc->name, expected, actual, vrr_enabled);
+ STATE_CHECK_BOOL(ret, p, crtc->name, expected, actual, self_refresh_active);
+ STATE_CHECK_U32(ret, p, crtc->name, expected, actual, scaling_filter);
+ STATE_CHECK_U64(ret, p, crtc->name, expected, actual, background_color);
+
+ return ret;
+}
+EXPORT_SYMBOL(drm_atomic_helper_crtc_compare_state);
+
+/**
+ * drm_atomic_helper_connector_compare_state - default &drm_connector_funcs.atomic_sro_compare_state hook
+ * @conn: the connector being compared
+ * @p: printer for reporting mismatches
+ * @expected: the committed &struct drm_connector_state
+ * @actual: the &struct drm_connector_state read out from hardware
+ *
+ * Compares the base &struct drm_connector_state fields of @actual to
+ * @expected and reports any mismatches through @p. Drivers subclassing
+ * the connector state should call this first, then compare their own
+ * fields.
+ *
+ * RETURNS:
+ *
+ * True if the states are identical, false otherwise.
+ */
+bool drm_atomic_helper_connector_compare_state(struct drm_connector *conn,
+ struct drm_printer *p,
+ struct drm_connector_state *expected,
+ struct drm_connector_state *actual)
+{
+ bool ret = true;
+
+ STATE_CHECK_PTR(ret, p, conn->name, expected, actual, connector);
+
+ /*
+ * Both unbound, the routing and the negotiated properties are
+ * meaningless: a disabled connector keeps the values it was
+ * last enabled with, while a state read out from a disabled
+ * pipeline is pristine.
+ */
+ if (!expected->crtc && !actual->crtc)
+ return ret;
+
+ STATE_CHECK_PTR(ret, p, conn->name, expected, actual, crtc);
+
+ /*
+ * One bound and the other unbound, that's a mismatch, and the
+ * negotiated properties of the unbound one are meaningless.
+ */
+ if (!expected->crtc || !actual->crtc)
+ return false;
+
+ STATE_CHECK_PTR(ret, p, conn->name, expected, actual, best_encoder);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, link_status);
+
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.select_subconnector);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.subconnector);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.margins.left);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.margins.right);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.margins.top);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.margins.bottom);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.legacy_mode);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.mode);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.brightness);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.contrast);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.flicker_reduction);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.overscan);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.saturation);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.hue);
+
+ STATE_CHECK_BOOL(ret, p, conn->name, expected, actual, self_refresh_aware);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, picture_aspect_ratio);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, content_type);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, hdcp_content_type);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, scaling_mode);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, content_protection);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, colorspace);
+
+ /*
+ * NOTE: We can't check max_bpc, max_requested_bpc,
+ * color_format or hdmi.broadcast_rgb because they are
+ * userspace requests negotiated during atomic_check into
+ * output_bpc, output_format and hdmi.is_limited_range. The
+ * hardware only stores the negotiated result.
+ */
+
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, privacy_screen_sw_state);
+
+ /*
+ * NOTE: We can't check hdr_output_metadata: it's a userspace
+ * request, and the hardware only stores the resulting HDR
+ * infoframe, compared below.
+ */
+
+ /*
+ * NOTE: The infoframe payloads are only compared when the
+ * infoframe is enabled in both states: the disabled ones keep
+ * stale data from earlier commits around in the expected
+ * state, while the readout state is pristine.
+ */
+ STATE_CHECK_BOOL(ret, p, conn->name, expected, actual, hdmi.infoframes.avi.set);
+ if (expected->hdmi.infoframes.avi.set && actual->hdmi.infoframes.avi.set)
+ STATE_CHECK_INFOFRAME(ret, p, conn->name, expected, actual, hdmi.infoframes.avi.data);
+ STATE_CHECK_BOOL(ret, p, conn->name, expected, actual, hdmi.infoframes.hdr_drm.set);
+ if (expected->hdmi.infoframes.hdr_drm.set && actual->hdmi.infoframes.hdr_drm.set)
+ STATE_CHECK_INFOFRAME(ret, p, conn->name, expected, actual, hdmi.infoframes.hdr_drm.data);
+ STATE_CHECK_BOOL(ret, p, conn->name, expected, actual, hdmi.infoframes.spd.set);
+ if (expected->hdmi.infoframes.spd.set && actual->hdmi.infoframes.spd.set)
+ STATE_CHECK_INFOFRAME(ret, p, conn->name, expected, actual, hdmi.infoframes.spd.data);
+ STATE_CHECK_BOOL(ret, p, conn->name, expected, actual, hdmi.infoframes.hdmi.set);
+ if (expected->hdmi.infoframes.hdmi.set && actual->hdmi.infoframes.hdmi.set)
+ STATE_CHECK_INFOFRAME(ret, p, conn->name, expected, actual, hdmi.infoframes.hdmi.data);
+
+ STATE_CHECK_BOOL(ret, p, conn->name, expected, actual, hdmi.is_limited_range);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, hdmi.output_bpc);
+ STATE_CHECK_U32(ret, p, conn->name, expected, actual, hdmi.output_format);
+ STATE_CHECK_U64(ret, p, conn->name, expected, actual, hdmi.tmds_char_rate);
+
+ /*
+ * hdmi.scrambler_needed is derived from hdmi.tmds_char_rate, so
+ * comparing tmds_char_rate already covers it.
+ */
+
+ return ret;
+}
+EXPORT_SYMBOL(drm_atomic_helper_connector_compare_state);
+
+/**
+ * drm_atomic_helper_bridge_compare_state - default &drm_bridge_funcs.atomic_sro_compare_state hook
+ * @bridge: the bridge being compared
+ * @p: printer for reporting mismatches
+ * @expected: the committed &struct drm_bridge_state
+ * @actual: the &struct drm_bridge_state read out from hardware
+ *
+ * Compares the base &struct drm_bridge_state fields of @actual to
+ * @expected and reports any mismatches through @p. Drivers subclassing
+ * the bridge state should call this first, then compare their own
+ * fields.
+ *
+ * The compared fields are the format and the flags of both the input
+ * and the output &struct drm_bus_cfg. @expected holds what
+ * drm_atomic_bridge_chain_check() computed, so the
+ * &drm_bridge_funcs.atomic_sro_readout_state implementation that
+ * filled @actual is expected to reproduce those values, which depend
+ * on the order in which each of them is determined.
+ *
+ * During a regular atomic check, the bus formats are negotiated from
+ * the last bridge to the first one, and the bus flags are propagated
+ * in the same direction: the output flags of a bridge are those of the
+ * input of the next element in the chain. During the readout, the
+ * bridges are however visited from the first to the last one, so the
+ * state of the previous bridge is available but the state of the next
+ * one is not. A readout implementation is thus expected to:
+ *
+ * - Report the input and output formats the hardware is configured
+ * with, or the ones the format negotiation would have selected if
+ * the hardware doesn't store them. A bridge that doesn't implement
+ * &drm_bridge_funcs.atomic_get_input_bus_fmts reports
+ * MEDIA_BUS_FMT_FIXED as its input format.
+ *
+ * - Report the input flags the hardware is configured with. If it
+ * doesn't store them, they can be taken from the output flags of the
+ * previous bridge if it was read out, from the CRTC state for the
+ * first bridge, or from the same source as
+ * &drm_bridge_timings.input_bus_flags if the bridge sets them
+ * statically in &drm_bridge_funcs.atomic_check.
+ *
+ * - Report the output flags the hardware produces. They can't be
+ * copied from the next bridge, which hasn't been read out yet. They
+ * should be read from the hardware when it stores them. The last
+ * bridge of a chain can use &drm_display_info.bus_flags, and a
+ * bridge forwarding its signals unmodified can use its own input
+ * flags, which is what the default flag propagation of the atomic
+ * check does.
+ *
+ * - Apply the same adjustments its &drm_bridge_funcs.atomic_check
+ * implementation does to the flags, since @expected includes them.
+ *
+ * Since the output flags are compared too, an output flag a bridge
+ * can't actually read, or guesses incorrectly, shows up as a mismatch.
+ * Likewise, hardware that can only store a flag as one of two values
+ * can't report that a flag was left unset in @expected. Drivers
+ * hitting that limitation can provide their own
+ * &drm_bridge_funcs.atomic_sro_compare_state implementation that
+ * ignores the flags the hardware can't report.
+ *
+ * RETURNS:
+ *
+ * True if the states are identical, false otherwise.
+ */
+bool drm_atomic_helper_bridge_compare_state(struct drm_bridge *bridge,
+ struct drm_printer *p,
+ struct drm_bridge_state *expected,
+ struct drm_bridge_state *actual)
+{
+ bool ret = true;
+
+ STATE_CHECK_PTR(ret, p, bridge->name, expected, actual, bridge);
+ STATE_CHECK_U32_X(ret, p, bridge->name, expected, actual, input_bus_cfg.format);
+ STATE_CHECK_U32_X(ret, p, bridge->name, expected, actual, input_bus_cfg.flags);
+ STATE_CHECK_U32_X(ret, p, bridge->name, expected, actual, output_bus_cfg.format);
+ STATE_CHECK_U32_X(ret, p, bridge->name, expected, actual, output_bus_cfg.flags);
+
+ return ret;
+}
+EXPORT_SYMBOL(drm_atomic_helper_bridge_compare_state);
+
/**
* drm_atomic_helper_print_state_mismatch - report a state comparison mismatch
* @p: printer to report through
* @name: human-readable name of the object (e.g. plane or CRTC name)
* @field: name of the mismatching field
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index fe9b535d02bd..0d0c39cdc775 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -635,10 +635,25 @@ drm_bridge_atomic_readout_priv_state(struct drm_private_obj *obj,
}
return 0;
}
+static bool drm_bridge_atomic_compare_priv_state(struct drm_private_obj *obj,
+ struct drm_printer *p,
+ struct drm_private_state *a,
+ struct drm_private_state *b)
+{
+ struct drm_bridge *bridge = drm_priv_to_bridge(obj);
+ struct drm_bridge_state *state_a = drm_priv_to_bridge_state(a);
+ struct drm_bridge_state *state_b = drm_priv_to_bridge_state(b);
+
+ if (bridge->funcs->atomic_sro_compare_state)
+ return bridge->funcs->atomic_sro_compare_state(bridge, p, state_a, state_b);
+ else
+ return false;
+}
+
static void
drm_bridge_atomic_install_priv_state(struct drm_private_obj *obj,
struct drm_private_state *priv_state)
{
struct drm_bridge *bridge = drm_priv_to_bridge(obj);
@@ -699,10 +714,11 @@ static const struct drm_private_state_funcs drm_bridge_priv_state_funcs = {
.atomic_destroy_state = drm_bridge_atomic_destroy_priv_state,
.atomic_print_state = drm_bridge_atomic_print_priv_state,
};
static const struct drm_private_state_funcs drm_bridge_priv_state_funcs_with_sro = {
+ .atomic_sro_compare_state = drm_bridge_atomic_compare_priv_state,
.atomic_sro_readout_state = drm_bridge_atomic_readout_priv_state,
.atomic_sro_install_state = drm_bridge_atomic_install_priv_state,
.atomic_create_state = drm_bridge_atomic_create_priv_state,
.atomic_duplicate_state = drm_bridge_atomic_duplicate_priv_state,
.atomic_destroy_state = drm_bridge_atomic_destroy_priv_state,
diff --git a/include/drm/drm_atomic_state_readout_helper.h b/include/drm/drm_atomic_state_readout_helper.h
index 603fe13a732e..6125ea668fa8 100644
--- a/include/drm/drm_atomic_state_readout_helper.h
+++ b/include/drm/drm_atomic_state_readout_helper.h
@@ -5,11 +5,19 @@
#include <linux/string_choices.h>
struct drm_atomic_commit;
struct drm_atomic_sro_state;
+struct drm_bridge;
+struct drm_bridge_state;
+struct drm_connector;
+struct drm_connector_state;
+struct drm_crtc;
+struct drm_crtc_state;
struct drm_device;
+struct drm_plane;
+struct drm_plane_state;
struct drm_printer;
int
drm_atomic_helper_sro_readout_planes_state(struct drm_device *dev,
struct drm_atomic_sro_state *state,
@@ -34,10 +42,30 @@ struct drm_atomic_sro_state *
drm_atomic_helper_sro_build_state(struct drm_device *dev,
struct drm_atomic_commit *commit);
int drm_atomic_helper_sro_readout_state(struct drm_device *dev);
void drm_atomic_helper_sro_install_state(struct drm_atomic_sro_state *state);
+bool drm_atomic_helper_connector_compare_state(struct drm_connector *connector,
+ struct drm_printer *p,
+ struct drm_connector_state *expected,
+ struct drm_connector_state *actual);
+
+bool drm_atomic_helper_crtc_compare_state(struct drm_crtc *crtc,
+ struct drm_printer *p,
+ struct drm_crtc_state *expected,
+ struct drm_crtc_state *actual);
+
+bool drm_atomic_helper_plane_compare_state(struct drm_plane *plane,
+ struct drm_printer *p,
+ struct drm_plane_state *expected,
+ struct drm_plane_state *actual);
+
+bool drm_atomic_helper_bridge_compare_state(struct drm_bridge *bridge,
+ struct drm_printer *p,
+ struct drm_bridge_state *expected,
+ struct drm_bridge_state *actual);
+
void __printf(4, 5)
drm_atomic_helper_print_state_mismatch(struct drm_printer *p,
const char *name,
const char *field,
const char *format, ...);
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index d812e809ae81..a74407ee5a9c 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -360,11 +360,14 @@ struct drm_bridge_funcs {
* Compares two &struct drm_bridge_state instances and reports
* any mismatches through @p.
*
* It is called after blocking commits to verify that the
* committed state matches what can be read back from the
- * hardware.
+ * hardware. Drivers subclassing the state should implement this
+ * to compare their driver-private fields, calling
+ * drm_atomic_helper_bridge_compare_state() first for the base
+ * state fields.
*
* This hook is mandatory for drivers implementing SRO, but can
* be left unassigned otherwise.
*
* RETURNS:
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 495c9a806d6c..dd00659c5c4d 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1913,11 +1913,14 @@ struct drm_connector_funcs {
* Compares two &struct drm_connector_state instances and
* reports any mismatches through @p.
*
* It is called after blocking commits to verify that the
* committed state matches what can be read back from the
- * hardware.
+ * hardware. Drivers subclassing the state should implement this
+ * to compare their driver-private fields, calling
+ * drm_atomic_helper_connector_compare_state() first for the
+ * base state fields.
*
* This hook is mandatory for drivers implementing SRO, but can
* be left unassigned otherwise.
*
* RETURNS:
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5a94fdb0f7c0..4f1a99626fca 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -747,11 +747,14 @@ struct drm_crtc_funcs {
* Compares two &struct drm_crtc_state instances and reports
* any mismatches through @p.
*
* It is called after blocking commits to verify that the
* committed state matches what can be read back from the
- * hardware.
+ * hardware. Drivers subclassing the state should implement this
+ * to compare their driver-private fields, calling
+ * drm_atomic_helper_crtc_compare_state() first for the base
+ * state fields.
*
* This hook is mandatory for drivers implementing SRO, but can
* be left unassigned otherwise.
*
* RETURNS:
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index d7af4b58ab31..f0c44afac016 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -494,11 +494,14 @@ struct drm_plane_funcs {
* Compares two &struct drm_plane_state instances and reports
* any mismatches through @p.
*
* It is called after blocking commits to verify that the
* committed state matches what can be read back from the
- * hardware.
+ * hardware. Drivers subclassing the state should implement this
+ * to compare their driver-private fields, calling
+ * drm_atomic_helper_plane_compare_state() first for the base
+ * state fields.
*
* This hook is mandatory for drivers implementing SRO, but can
* be left unassigned otherwise.
*
* RETURNS:
--
2.56.1
next prev parent reply other threads:[~2026-11-20 12:59 UTC|newest]
Thread overview: 53+ 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-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-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-20 12:55 ` [PATCH v9 08/42] drm/bridge: Switch print_state to use bridge name Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 09/42] drm/bridge: Add drm_private_obj_is_bridge() Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 10/42] drm/fb-dma-helper: Handle framebuffers without a GEM object Maxime Ripard
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-20 12:55 ` [PATCH v9 13/42] drm/atomic_sro: Create drm_atomic_sro_state container Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 14/42] drm/atomic_sro: Create kernel parameter to force or disable readout Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 15/42] drm/atomic_sro: Add atomic state readout infrastructure Maxime Ripard
2026-11-20 12:55 ` [PATCH v9 16/42] drm/atomic_sro: Create documentation Maxime Ripard
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 ` Maxime Ripard [this message]
2026-11-20 13:14 ` [PATCH v9 24/42] drm/atomic-state-helper: Provide atomic_compare_state helpers 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=20261120-drm-state-readout-v9-24-a67c2b45b8ec@kernel.org \
--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.