Skip to content

Commit de93ddf

Browse files
committed
drm/atomic: Filter out redundant DPMS calls
Video players (eg. mpv) do periodic XResetScreenSaver() calls to keep the screen on while the video playing. The modesetting ddx plumbs these straight through into the kernel as DPMS setproperty ioctls, without any filtering whatsoever. When implemented via atomic these end up as empty commits on the crtc (which will nonetheless take one full frame), which leads to a dropped frame every time XResetScreenSaver() is called. Let's just filter out redundant DPMS property changes in the kernel to avoid this issue. v2: Explain the resulting commits a bit better (Sima) Document the behaviour in uapi docs (Sima) Cc: stable@vger.kernel.org Testcase: igt/kms_flip/flip-vs-dpms-on-nop Reviewed-by: Simona Vetter <simona.vetter@ffwll.ch> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250219160239.17502-1-ville.syrjala@linux.intel.com
1 parent cba3b86 commit de93ddf

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

drivers/gpu/drm/drm_atomic_uapi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,10 @@ int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state,
956956

957957
if (mode != DRM_MODE_DPMS_ON)
958958
mode = DRM_MODE_DPMS_OFF;
959+
960+
if (connector->dpms == mode)
961+
goto out;
962+
959963
connector->dpms = mode;
960964

961965
crtc = connector->state->crtc;

drivers/gpu/drm/drm_connector.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,10 @@ EXPORT_SYMBOL(drm_hdmi_connector_get_output_format_name);
14271427
* callback. For atomic drivers the remapping to the "ACTIVE" property is
14281428
* implemented in the DRM core.
14291429
*
1430+
* On atomic drivers any DPMS setproperty ioctl where the value does not
1431+
* change is completely skipped, otherwise a full atomic commit will occur.
1432+
* On legacy drivers the exact behavior is driver specific.
1433+
*
14301434
* Note that this property cannot be set through the MODE_ATOMIC ioctl,
14311435
* userspace must use "ACTIVE" on the CRTC instead.
14321436
*

0 commit comments

Comments
 (0)