[PATCH 1/5] tests/kms_writeback: clear writeback properties in teardown path

Jessica Zhang quic_jesszhan at quicinc.com
Thu Aug 29 02:58:47 UTC 2024


Drop the WRITEBACK_FB_ID property check and refactor detach_crtc() so
that it properly clears all writeback-related properties before calling
a NULL commit.

The current WRITEBACK_FB_ID check in detach_crtc() will always return 0
due to the return value being hardcoded to 0 in the framework [1].
Because of this, detach_crtc() will never call the NULL commit to clean
up the atomic state.

Since the NULL commit is failing for cases where the WRITEBACK_FB_ID and
OUT_FENCE_PTR haven't been cleared by a non-NULL commit, let's
explicitly clear these properties before calling the NULL commit.

[1] https://elixir.bootlin.com/linux/v6.10.6/source/drivers/gpu/drm/drm_atomic_uapi.c#L853

Fixes: 7c3ceb08b ("tests/kms_writeback: Add helper method to detach pipe from output when test finishes")
Signed-off-by: Jessica Zhang <quic_jesszhan at quicinc.com>
---
 tests/kms_writeback.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
index e1d31bb93..4155961a0 100644
--- a/tests/kms_writeback.c
+++ b/tests/kms_writeback.c
@@ -213,15 +213,11 @@ static igt_output_t *kms_writeback_get_output(igt_display_t *display)
 	return NULL;
 }
 
-static uint64_t get_writeback_fb_id(igt_output_t *output)
+static void cleanup_writeback(igt_display_t *display, igt_output_t *output)
 {
-	return igt_output_get_prop(output, IGT_CONNECTOR_WRITEBACK_FB_ID);
-}
-
-static void detach_crtc(igt_display_t *display, igt_output_t *output)
-{
-	if (get_writeback_fb_id(output) == 0)
-		return;
+	igt_output_set_prop_value(output, IGT_CONNECTOR_WRITEBACK_OUT_FENCE_PTR,
+			to_user_pointer(NULL));
+	igt_output_set_writeback_fb(output, NULL);
 
 	igt_output_set_pipe(output, PIPE_NONE);
 	igt_display_commit2(display, COMMIT_ATOMIC);
@@ -726,7 +722,7 @@ igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL)
 	}
 
 	igt_fixture {
-		detach_crtc(&display, output);
+		cleanup_writeback(&display, output);
 		igt_remove_fb(display.drm_fd, &input_fb);
 		igt_remove_fb(display.drm_fd, &input_fb_10bit);
 		igt_display_fini(&display);

-- 
2.34.1



More information about the igt-dev mailing list