Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69435606A31C for ; Sun, 29 Nov 2026 18:07:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=tPK4pRnn Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9AA8410E341; Sun, 29 Nov 2026 18:07:30 +0000 (UTC) Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id 517C910E2AC for ; Sun, 29 Nov 2026 18:07:16 +0000 (UTC) Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-4a451915d8aso6933802b6e.2 for ; Sun, 29 Nov 2026 10:07:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795975635; x=1796580435; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=F7IFdMInpbigWJITDDNJxK3fEvX6j+2SOuXgrLyv/aY=; b=tPK4pRnnorzCACcvHguXs2mseypweYUp/6iEMn1iLJMYeKKH3B3V1q3rK38LonjaG0 eMH2ardP4yFT0xShC8reXxQ64fSKHW00JRAgLNUfZjhyxqdNqSfFfHUEBnskIyCCTBxP wCGGvafbWQ4wiferZaSqBVBDTX0bq2UfYCCa8WOF3o8TYG8aRExlCeRq4rHmo8dCKUCj ChE15z5zdL6n5NotjoiQG4DkIg4L1X22s5PUrt6eskIC7tjKi5ft1IlQjy7EiJQJswlX TYuZzb8x3erYYe/N98g/GE9rgfPoa2SxTK4vpSISsxzIU9cDLZuM8ubh4OBzDCLLnnk5 I0hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795975635; x=1796580435; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=F7IFdMInpbigWJITDDNJxK3fEvX6j+2SOuXgrLyv/aY=; b=xxYc1De3X46p1vJPkhVY32kfg8PZCbWLaVyMaJ3Jqsi1MrE/0BkKP/eaOgKW593qMC iXc5ccPsDkrYPDhSDxZ/zxx4KCtxGRwqFRYXRwXiSQgTeUCcHXM0JbQ+X4eSQ1oyC9YC mcyLXJ3KKDHYOhGXaYGYYBNvlivAjRKRXoh0XLwF7cZBxb+BWcN9WurnlneLhCo6wi+X NCXSog8Trb9y5xWAhLiysUC19LCDFSQ/5ECFQAQExZRbbb6LcNza2apSDSQgkZdm6ndB sfSh/8hco2wpvfnJsnqiO5131xiRu1S6reODavSO1JfFVb+bb0NofnsTCDPAWlc3MZcu 4Aog== X-Gm-Message-State: APuU4Z9P8kFRalhu92cJGxLwiXJhfvACvX0ZdTV0toIWHXH1rm61a89R nN2ka4KRbt/Y7j1OncHW51PINVgEEBZOJxsFe824SQSPKvi1hx0czFnc X-Gm-Gg: AZFdTZcrU9g1ii2TK0DJcabMCNYP+WOtScbZQlUSAcmp7qNERCfYBYa2iabldkUgPXE XNYI8rAWmcw6zPt6EujOR6ayA+vZqsbwVoP+Cl+nLEbCTxYu9JRTU3bFg4vHtv8xiWiSfN8xHiA ZHeXXl/f+OYn+v6HN1eznT25LroXVufqXU9rar6DlklosPUqKbhCGI2F1Y0tTgSKB+UK9ZtIAgn AnVYLqJIgiqzuH56v73KjL8K6Z4Z0Zmh6fQlTggTkcOH6fK+80uCN4WDlK4Fc82rT5lYp/+b8Fr e7S4kuBkC49hwaIrlvjQdVJBr/aeSGN0VLx1gSM3R0IYyhZcDxeD+VetrRAP+F3/7rpz0A9cEDt xyRofcWeHpZVSHwBhHZ7ykbNlvuQY7PUwDJ0/Xqta4rA5XqKQR8LQiwAy/AtaHPxPtbFvHQA8XA Lp30TQA23SHRuI35ptYRazpQPDyvyiJXpIIH1Z8Jjw67ztWSY8+FEfsGRk15xUkcYJ7TW/slDTL 7rMVJLuiQHUpv2Rspk1QQI7fQGa6RHyITzcxAm6ODOk45V/TZNCW/Qkcrdr6rLX/XoBfTMBasKZ mZhrrYzIliK8PyREm+T3dcBFLUKRTBkNvzMBkBHssc7dgq3eCG+lJ13fGG1BfLGi0H4oP+E1dz7 Ixh2AnGzJRg== X-Received: by 2002:a05:6808:23ca:b0:4b5:5bfd:518f with SMTP id 5614622812f47-57a08917887mr37498024b6e.21.1795975635309; Sun, 29 Nov 2026 10:07:15 -0800 (PST) Received: from localhost.localdomain ([72.12.197.23]) by smtp.gmail.com with ESMTPSA id 5614622812f47-57a34250ef2sm24226176b6e.3.2026.11.29.10.07.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 29 Nov 2026 10:07:15 -0800 (PST) From: Aditya Tipre To: igt-dev@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, louis.chauvet@bootlin.com, sowmiya.s@intel.com, kamil.konieczny@linux.intel.com, karthik.b.s@intel.com, swati2.sharma@intel.com, tipreaditya@gmail.com Subject: [PATCH i-g-t v4 2/2] tests/kms_writeback: Check CRC capture survives writeback Date: Sun, 29 Nov 2026 13:07:00 -0500 Message-ID: <20261129180700.89278-3-tipreaditya@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20261129180700.89278-1-tipreaditya@gmail.com> References: <20261129180700.89278-1-tipreaditya@gmail.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The existing writeback tests validate captured framebuffer contents, but do not keep pipe CRC capture active across writeback completion. This misses the VKMS bug where writeback cleanup disables the composer while CRC capture still needs it, leaving subsequent CRC reads waiting for samples that never arrive. Add a VKMS-only writeback-preserves-crc subtest. Complete the initial modeset before starting capture and establish reference CRCs for separate red and blue input framebuffers. Keep capture open across four alternating writebacks, wait for each output fence, and compare three fresh CRC samples with the corresponding reference after each writeback. Do not allow modesets once capture starts, since they may disrupt CRC generation. Clear the pending out-fence request left by the configuration probe before the initial modeset so the subtest also works when run independently. Use the final fixture to close capture, disable the output, and remove the two new framebuffers so subtest failure or skip also cleans them up. Check output fence status in the shared wait helper so a signalled error fence cannot be treated as a successful writeback. On ARM64 QEMU with one and two CPUs, the new subtest fails with a CRC read timeout on the unmodified kernel and passes with the VKMS composer-user lifetime fix, both independently and in the full writeback suite. Signed-off-by: Aditya Tipre --- tests/kms_writeback.c | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c index 550d603..e277752 100644 --- a/tests/kms_writeback.c +++ b/tests/kms_writeback.c @@ -64,6 +64,10 @@ * * SUBTEST: writeback-pixel-formats * Description: Check the writeback format + * + * SUBTEST: writeback-preserves-crc + * Description: CRC capture remains active across completed writebacks + * Driver requirement: vkms */ IGT_TEST_DESCRIPTION( @@ -321,6 +325,7 @@ static void get_and_wait_out_fence(igt_output_t *output) ret = sync_fence_wait(output->writeback_out_fence_fd, 1000); igt_assert_f(ret == 0, "sync_fence_wait failed: %s\n", strerror(-ret)); + igt_assert_eq(sync_fence_status(output->writeback_out_fence_fd), 1); close(output->writeback_out_fence_fd); output->writeback_out_fence_fd = -1; } @@ -541,6 +546,8 @@ int igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL) igt_output_t *output; igt_plane_t *plane; igt_fb_t input_fb, input_fb_10bit; + static igt_pipe_crc_t *pipe_crc; + static igt_fb_t crc_blue_fb, crc_output_fb; drmModeModeInfo mode; unsigned int fb_id; int ret; @@ -713,8 +720,68 @@ int igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL) igt_remove_fb(display.drm_fd, &output_fb); } + igt_describe("CRC capture remains active across completed writebacks"); + igt_subtest("writeback-preserves-crc") { + igt_fb_t *colors[] = { &input_fb, &crc_blue_fb }; + igt_crc_t reference[2], crc; + int i, j; + + igt_skip_on(data.dump_check || data.list_modes); + igt_require(is_vkms_device(display.drm_fd)); + igt_require(data.supported_colors & XRGB8888); + igt_require_pipe_crc(display.drm_fd); + + igt_create_color_fb(display.drm_fd, mode.hdisplay, mode.vdisplay, + DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, + 0.0, 0.0, 1.0, &crc_blue_fb); + igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay, + DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, + &crc_output_fb); + fill_fb(&input_fb, 0x00ff0000); + igt_plane_set_fb(plane, &input_fb); + igt_output_set_writeback_fb(output, NULL); + /* Discard the out-fence request left by the configuration probe. */ + igt_output_set_prop_value(output, IGT_CONNECTOR_WRITEBACK_OUT_FENCE_PTR, + to_user_pointer(NULL)); + igt_display_commit_atomic(&display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL); + + /* Finish the modeset before starting continuous CRC capture. */ + pipe_crc = igt_pipe_crc_new(display.drm_fd, output->config.crtc_index, + IGT_PIPE_CRC_SOURCE_AUTO); + igt_pipe_crc_start(pipe_crc); + + /* + * Establish both references before writeback can affect capture. + * Do not allow modesets below: they may disrupt continuous CRC + * generation. + */ + for (i = 0; i < ARRAY_SIZE(colors); i++) { + igt_plane_set_fb(plane, colors[i]); + igt_display_commit_atomic(&display, 0, NULL); + igt_pipe_crc_get_current(display.drm_fd, pipe_crc, &reference[i]); + } + + for (i = 0; i < 4; i++) { + int color = i % ARRAY_SIZE(colors); + + igt_plane_set_fb(plane, colors[color]); + igt_output_set_writeback_fb(output, &crc_output_fb); + igt_display_commit_atomic(&display, 0, NULL); + get_and_wait_out_fence(output); + + /* Require fresh frames without stopping or restarting capture. */ + for (j = 0; j < 3; j++) { + igt_pipe_crc_get_current(display.drm_fd, pipe_crc, &crc); + igt_assert_crc_equal(&reference[color], &crc); + } + } + } + igt_fixture() { + igt_pipe_crc_free(pipe_crc); cleanup_writeback(&display, output); + igt_remove_fb(display.drm_fd, &crc_blue_fb); + igt_remove_fb(display.drm_fd, &crc_output_fb); igt_remove_fb(display.drm_fd, &input_fb); if (data.supported_colors & XRGB2101010) -- 2.50.1 (Apple Git-155)