Skip to content

Commit 84e2468

Browse files
danvetjfvogel
authored andcommitted
drm/atomic: clarify the rules around drm_atomic_state->allow_modeset
[ Upstream commit c5e3306 ] msm is automagically upgrading normal commits to full modesets, and that's a big no-no: - for one this results in full on->off->on transitions on all these crtc, at least if you're using the usual helpers. Which seems to be the case, and is breaking uapi - further even if the ctm change itself would not result in flicker, this can hide modesets for other reasons. Which again breaks the uapi v2: I forgot the case of adding unrelated crtc state. Add that case and link to the existing kerneldoc explainers. This has come up in an irc discussion with Manasi and Ville about intel's bigjoiner mode. Also cc everyone involved in the msm irc discussion, more people joined after I sent out v1. v3: Wording polish from Pekka and Thomas Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com> Acked-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: David Airlie <airlied@gmail.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Pekka Paalanen <pekka.paalanen@collabora.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Simon Ser <contact@emersion.fr> Cc: Manasi Navare <navaremanasi@google.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Simona Vetter <simona.vetter@intel.com> Signed-off-by: Simona Vetter <simona.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20250108172417.160831-1-simona.vetter@ffwll.ch Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit 135105287781eb6693f0075c63c0b3e6d68f7e62) Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
1 parent 2354a5d commit 84e2468

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

include/drm/drm_atomic.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,27 @@ struct drm_atomic_state {
376376
*
377377
* Allow full modeset. This is used by the ATOMIC IOCTL handler to
378378
* implement the DRM_MODE_ATOMIC_ALLOW_MODESET flag. Drivers should
379-
* never consult this flag, instead looking at the output of
380-
* drm_atomic_crtc_needs_modeset().
379+
* generally not consult this flag, but instead look at the output of
380+
* drm_atomic_crtc_needs_modeset(). The detailed rules are:
381+
*
382+
* - Drivers must not consult @allow_modeset in the atomic commit path.
383+
* Use drm_atomic_crtc_needs_modeset() instead.
384+
*
385+
* - Drivers must consult @allow_modeset before adding unrelated struct
386+
* drm_crtc_state to this commit by calling
387+
* drm_atomic_get_crtc_state(). See also the warning in the
388+
* documentation for that function.
389+
*
390+
* - Drivers must never change this flag, it is under the exclusive
391+
* control of userspace.
392+
*
393+
* - Drivers may consult @allow_modeset in the atomic check path, if
394+
* they have the choice between an optimal hardware configuration
395+
* which requires a modeset, and a less optimal configuration which
396+
* can be committed without a modeset. An example would be suboptimal
397+
* scanout FIFO allocation resulting in increased idle power
398+
* consumption. This allows userspace to avoid flickering and delays
399+
* for the normal composition loop at reasonable cost.
381400
*/
382401
bool allow_modeset : 1;
383402
/**

0 commit comments

Comments
 (0)