* [RFC PATCH i-g-t] tests/kms_virtio_damage: Check rotating dumb buffer scanout
@ 2026-12-05 6:34 Aditya Tipre
2026-12-05 7:09 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Tipre @ 2026-12-05 6:34 UTC (permalink / raw)
To: igt-dev; +Cc: dri-devel, tipreaditya
When damage clips describe changes relative to the previous frame,
drivers that upload each dumb buffer independently must also account
for damage since that buffer was last displayed.
Test two- and three-buffer rotation with linear XRGB8888 dumb buffers
and atomic page flips. Paint the complete scene into the selected guest
buffer on each frame. Leave the damage blob unset for the initial
modeset and submit only the latest damage clip on subsequent flips.
Check the host scanout to catch stale pixels in the device's copy.
Pass a bidirectional file descriptor to the test through
IGT_VIRTIO_DAMAGE_CAPTURE_FD. The test sends one line per frame in the
form IGT_VIRTIO_DAMAGE <frame> <width> <height>. The host-side verifier
replies with a single '+' byte after checking the scanout against the
expected image. Both subtests skip if no verifier is configured.
OpenAI Codex assisted with test design, implementation, and validation.
Signed-off-by: Aditya Tipre <tipreaditya@gmail.com>
---
diff --git a/tests/kms_virtio_damage.c b/tests/kms_virtio_damage.c
new file mode 100644
index 0000000..8140491
--- /dev/null
+++ b/tests/kms_virtio_damage.c
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: MIT
+
+#include "igt.h"
+#include "igt_kms.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <poll.h>
+
+#define FRAME_COUNT 10
+#define TILE_SIZE 32
+#define MAX_BUFFERS 3
+
+static void check_scanout(int fd, int frame, int width, int height)
+{
+ struct pollfd pfd = { .fd = fd, .events = POLLIN };
+ char result;
+ int ret;
+
+ /* The host captures the presented scanout before the next commit. */
+ igt_assert(dprintf(fd, "IGT_VIRTIO_DAMAGE %d %d %d\n",
+ frame, width, height) > 0);
+ do {
+ ret = poll(&pfd, 1, 10000);
+ } while (ret < 0 && errno == EINTR);
+ igt_assert_f(ret == 1 && (pfd.revents & POLLIN),
+ "No scanout verification for frame %d\n", frame);
+ igt_assert_eq(read(fd, &result, 1), 1);
+ igt_assert_f(result == '+', "Host scanout mismatch on frame %d\n", frame);
+}
+
+static void paint_scene(struct igt_fb *fb, void *map, int frame)
+{
+ memset(map, 0, fb->strides[0] * (size_t)fb->height);
+
+ for (int i = 1; i <= frame; i++) {
+ int x = TILE_SIZE * i;
+ uint32_t color = (i * 0x123457u) & 0xffffff;
+
+ for (int y = TILE_SIZE; y < 2 * TILE_SIZE; y++) {
+ uint32_t *row = map + (size_t)y * fb->strides[0];
+
+ for (int col = x; col < x + TILE_SIZE; col++)
+ row[col] = color;
+ }
+ }
+}
+
+static void test_rotating_buffers(int drm_fd, igt_display_t *display,
+ int capture_fd, unsigned int count)
+{
+ struct igt_fb fb[MAX_BUFFERS];
+ void *map[MAX_BUFFERS];
+ igt_output_t *output;
+ igt_crtc_t *crtc;
+ igt_plane_t *primary = NULL;
+ drmModeModeInfo *mode = NULL;
+ uint32_t flags;
+
+ for_each_crtc_with_valid_output(display, crtc, output) {
+ primary = igt_crtc_get_plane_type(crtc, DRM_PLANE_TYPE_PRIMARY);
+ if (!igt_plane_has_prop(primary, IGT_PLANE_FB_DAMAGE_CLIPS))
+ continue;
+ mode = igt_output_get_mode(output);
+ if (mode->hdisplay < FRAME_COUNT * TILE_SIZE ||
+ mode->vdisplay < 2 * TILE_SIZE) {
+ mode = NULL;
+ continue;
+ }
+ igt_output_set_crtc(output, crtc);
+ break;
+ }
+ igt_require_f(mode, "No suitable output with FB_DAMAGE_CLIPS\n");
+
+ for (unsigned int i = 0; i < count; i++) {
+ igt_create_fb(drm_fd, mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, &fb[i]);
+ igt_assert(fb[i].is_dumb);
+ map[i] = igt_fb_map_buffer(drm_fd, &fb[i]);
+ }
+
+ for (int frame = 0; frame < FRAME_COUNT; frame++) {
+ unsigned int slot = frame % count;
+ struct drm_mode_rect clip = {
+ .x1 = TILE_SIZE * frame,
+ .y1 = TILE_SIZE,
+ .x2 = TILE_SIZE * (frame + 1),
+ .y2 = 2 * TILE_SIZE,
+ };
+
+ /* Damage is relative to the previous frame, not this buffer. */
+ paint_scene(&fb[slot], map[slot], frame);
+ igt_plane_set_fb(primary, &fb[slot]);
+ igt_plane_replace_prop_blob(primary, IGT_PLANE_FB_DAMAGE_CLIPS,
+ frame ? &clip : NULL,
+ frame ? sizeof(clip) : 0);
+ flags = frame ? DRM_MODE_PAGE_FLIP_EVENT : DRM_MODE_ATOMIC_ALLOW_MODESET;
+ igt_display_commit_atomic(display, flags, NULL);
+ if (frame)
+ kmstest_wait_for_pageflip(drm_fd);
+ check_scanout(capture_fd, frame, mode->hdisplay, mode->vdisplay);
+ }
+
+ igt_plane_replace_prop_blob(primary, IGT_PLANE_FB_DAMAGE_CLIPS, NULL, 0);
+ igt_plane_set_fb(primary, NULL);
+ igt_output_set_crtc(output, NULL);
+ igt_display_commit2(display, COMMIT_ATOMIC);
+ for (unsigned int i = 0; i < count; i++) {
+ igt_fb_unmap_buffer(&fb[i], map[i]);
+ igt_remove_fb(drm_fd, &fb[i]);
+ }
+}
+
+IGT_TEST_DESCRIPTION("Verify host scanout contents with rotating virtio-gpu dumb buffers");
+
+int igt_main()
+{
+ igt_display_t display;
+ int drm_fd, capture_fd;
+
+ igt_fixture() {
+ const char *value = getenv("IGT_VIRTIO_DAMAGE_CAPTURE_FD");
+ char *end;
+ long fd;
+
+ igt_require_f(value, "Requires a host scanout verifier\n");
+ errno = 0;
+ fd = strtol(value, &end, 10);
+ igt_assert_f(!errno && end != value && !*end && fd >= 3 &&
+ fd <= INT_MAX && fcntl((int)fd, F_GETFD) >= 0,
+ "Invalid IGT_VIRTIO_DAMAGE_CAPTURE_FD\n");
+ capture_fd = fd;
+ drm_fd = drm_open_driver_master(DRIVER_VIRTIO);
+ kmstest_set_vt_graphics_mode();
+ igt_display_require(&display, drm_fd);
+ igt_require(display.is_atomic);
+ igt_display_require_output(&display);
+ }
+
+ igt_describe("Verify that two rotating dumb buffers display all prior damage.");
+ igt_subtest("two-buffers")
+ test_rotating_buffers(drm_fd, &display, capture_fd, 2);
+
+ igt_describe("Verify that three rotating dumb buffers display all prior damage.");
+ igt_subtest("three-buffers")
+ test_rotating_buffers(drm_fd, &display, capture_fd, 3);
+
+ igt_fixture() {
+ igt_display_fini(&display);
+ close(drm_fd);
+ }
+}
diff --git a/tests/meson.build b/tests/meson.build
index 806320a..c146b30 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -69,6 +69,7 @@ test_progs = [
'kms_universal_plane',
'kms_vblank',
'kms_vrr',
+ 'kms_virtio_damage',
'kms_writeback',
'meta_test',
'prime_vgem',
^ permalink raw reply related [flat|nested] 2+ messages in thread
* ✗ LGCI.VerificationFailed: failure for tests/kms_virtio_damage: Check rotating dumb buffer scanout
2026-12-05 6:34 [RFC PATCH i-g-t] tests/kms_virtio_damage: Check rotating dumb buffer scanout Aditya Tipre
@ 2026-12-05 7:09 ` Patchwork
0 siblings, 0 replies; 2+ messages in thread
From: Patchwork @ 2026-12-05 7:09 UTC (permalink / raw)
To: Aditya Tipre; +Cc: igt-dev
== Series Details ==
Series: tests/kms_virtio_damage: Check rotating dumb buffer scanout
URL : https://patchwork.freedesktop.org/series/180583/
State : failure
== Summary ==
Series author address 'tipreaditya@gmail.com' is not on the allowlist, which prevents CI from being automatically triggered.
If you want CI to run for this series, ask Patchwork project owners to click 'retest' on the series in Patchwork.
Exception occurred during validation, bailing out!
Build URL: http://gfx-ci.igk.intel.com:8080/job/CI_IGTPW_check/244808/ (on cidrm1)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-05 7:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 6:34 [RFC PATCH i-g-t] tests/kms_virtio_damage: Check rotating dumb buffer scanout Aditya Tipre
2026-12-05 7:09 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.