Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] drm/bridge: drm_bridge_attach() disables readout if compare hook is unset - [Low] drm/atomic_sro: duplicated line in DOC: overview comment --
commit 00233166cd25376785bc177974713d5ccca22687 Author: Maxime Ripard <[email protected]> drm/atomic_helper: Compare actual and readout states once the commit is done This commit introduces atomic_sro_compare_state callbacks for KMS objects and adds drm_atomic_sro_readout_and_compare() to read back and compare hardware state against the committed state after blocking atomic commits. > diff --git a/drivers/gpu/drm/drm_atomic_state_readout.c > b/drivers/gpu/drm/drm_atomic_state_readout.c > index 3e50b0796cbec..4b6512ef1aae7 100644 > --- a/drivers/gpu/drm/drm_atomic_state_readout.c > +++ b/drivers/gpu/drm/drm_atomic_state_readout.c > @@ -26,7 +26,7 @@ > * firmware already configured the display, the first userspace > * modeset can be skipped when the requested mode matches. > * > - * The SRO lifecycle has two phases. The first phase is the readout > + * The SRO lifecycle has three phases. The first phase is the readout > * itself: at driver registration time, each KMS object (CRTCs, planes, > * connectors, bridges, private objects) has its > * atomic_sro_readout_state hook called to populate a > @@ -46,7 +46,17 @@ > * state active, such as power domains, clocks, or interrupts. This hook > * cannot fail. > * > - * Drivers integrate with SRO by implementing the readout hooks in their > + * The third phase is the comparison. Because getting access to every > + * firmware variation is hard, and most firmware setups will be fairly > + * basic, the framework also provides a way to verify the readout > + * implementation during normal operation. After every blocking commit, > + * the framework reads out a fresh state from hardware and compares it > + * to the committed state using the atomic_sro_compare_state hooks. Any > + * mismatch is reported, which allows to catch readout bugs without > + * needing specific firmware configurations. > + * > + * Drivers integrate with SRO by implementing the readout and compare > + * hooks in their object funcs vtables and setting the > * object funcs vtables and setting the > * &drm_mode_config_funcs.atomic_sro_readout_state, > * &drm_mode_config_helper_funcs.atomic_sro_install_state, and [Severity: Low] This isn't a bug, but "object funcs vtables and setting the" is duplicated in the overview comment. [ ... ] > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c > index 868558a09f951..fe9b535d02bd5 100644 > --- a/drivers/gpu/drm/drm_bridge.c > +++ b/drivers/gpu/drm/drm_bridge.c > @@ -798,7 +798,8 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct > drm_bridge *bridge, > } > > if (bridge->funcs && > - bridge->funcs->atomic_sro_readout_state) > + bridge->funcs->atomic_sro_readout_state && > + bridge->funcs->atomic_sro_compare_state) > ret = drm_atomic_private_obj_init(bridge->dev, &bridge->base, > bridge->name, > > &drm_bridge_priv_state_funcs_with_sro); [Severity: Medium] Does requiring bridge->funcs->atomic_sro_compare_state here break bridge state readout when atomic_readout is set to DRM_ATOMIC_READOUT_SKIP_MISSING_COMPARE or DRM_ATOMIC_READOUT_SKIP_MISSING_READOUT? If a bridge implements atomic_sro_readout_state without atomic_sro_compare_state, drm_bridge_attach() falls back to drm_bridge_priv_state_funcs, which leaves privobj->funcs->atomic_sro_readout_state and privobj->funcs->atomic_sro_install_state NULL. drm_atomic_sro_can_readout() then rejects the device under DRM_ATOMIC_READOUT_SKIP_MISSING_COMPARE, and drm_atomic_helper_sro_readout_bridge_state() skips the bridge's readout hook under DRM_ATOMIC_READOUT_SKIP_MISSING_READOUT. Also, at this point in the series, drm_bridge_priv_state_funcs_with_sro does not yet set .atomic_sro_compare_state (wired in the later commit "drm/atomic-state-helper: Provide atomic_compare_state helpers"), so drm_atomic_sro_can_compare() returns false under DRM_ATOMIC_READOUT_ENABLED for any device with an attached bridge until that commit. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=22
