]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Fix CRC open failure during active rendering
authorTom Chung <chiahsuan.chung@amd.com>
Tue, 28 Apr 2026 08:41:12 +0000 (16:41 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 11 May 2026 20:10:16 +0000 (16:10 -0400)
[Why]
Opening the CRC data file during active rendering can fail with -EINVAL.
The wait for commit->hw_done returns remaining jiffies on success, but
the CRC path was treating that as an error.

[How]
Handle wait_for_completion_interruptible_timeout() correctly:
positive return as success, 0 as timeout, and negative as error.

Reviewed-by: Ray Wu <ray.wu@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: James Lin <pinglei.lin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c

index 4155984201c6d0c26e571416a3f7c9d011e5ea87..5adbb0f6a0c8892c962a2da56d04c12c342f0996 100644 (file)
@@ -613,8 +613,13 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name)
                 */
                ret = wait_for_completion_interruptible_timeout(
                        &commit->hw_done, 10 * HZ);
-               if (ret)
+               if (ret < 0)
+                       goto cleanup;
+
+               if (ret == 0) {
+                       ret = -ETIMEDOUT;
                        goto cleanup;
+               }
        }
 
        enable = amdgpu_dm_is_valid_crc_source(source);