[PATCH i-g-t] tests/intel/kms_odd_pan: Add test to validate odd panning
Nemesa Garg
nemesa.garg at intel.com
Mon Feb 17 15:14:44 UTC 2025
Add a new test to check whether odd pan is supported or not.
Signed-off-by: Nemesa Garg <nemesa.garg at intel.com>
---
tests/intel/kms_odd_pan.c | 155 ++++++++++++++++++++++++++++++++++++++
tests/meson.build | 1 +
2 files changed, 156 insertions(+)
create mode 100644 tests/intel/kms_odd_pan.c
diff --git a/tests/intel/kms_odd_pan.c b/tests/intel/kms_odd_pan.c
new file mode 100644
index 000000000..46f9c8fe2
--- /dev/null
+++ b/tests/intel/kms_odd_pan.c
@@ -0,0 +1,155 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+
+/**
+ * TEST: kms odd pan
+ * Category: Display
+ * Description: Test to validate odd panning for planar format
+ * Driver requirement: xe
+ * Mega feature: General Display Features
+ * Test category: functionality test
+ * Functionality: panning
+ */
+
+#include "igt.h"
+#include "igt_vec.h"
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include "xe/xe_query.h"
+
+/**
+ * SUBTEST: odd-panning
+ * Description: Verify that odd panning in horizontal direction for planar format
+ * Driver requirement: i915, xe
+ * Functionality: kms_odd_pan
+ * Mega feature: General Display Features
+ * Test category: functionality test
+ */
+
+IGT_TEST_DESCRIPTION("Test to validate odd panning for planar format");
+
+typedef struct {
+ int drm_fd;
+ igt_display_t display;
+ igt_output_t *output;
+ igt_plane_t **plane;
+ struct igt_fb *fb;
+} data_t;
+
+#define PLANE_WIDTH 810
+#define PLANE_HEIGHT 590
+
+static void
+prepare_planes(igt_display_t *display, const enum pipe pipe_id,
+ igt_output_t *output)
+{
+ igt_plane_t *primary;
+ struct igt_fb primary_fb_1, primary_fb_2;
+ unsigned int fb_id_1, fb_id_2;
+ int j = 0, ret;
+
+ igt_output_set_pipe(output, pipe_id);
+
+ primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+
+ fb_id_1 = igt_create_pattern_fb(display->drm_fd,
+ 800, 590,
+ DRM_FORMAT_NV12,
+ DRM_FORMAT_MOD_LINEAR,
+ &primary_fb_1);
+
+ fb_id_2 = igt_create_pattern_fb(display->drm_fd,
+ 800, 590,
+ DRM_FORMAT_NV12,
+ DRM_FORMAT_MOD_LINEAR,
+ &primary_fb_2);
+
+ igt_assert(fb_id_1);
+ igt_assert(fb_id_2);
+
+ igt_plane_set_fb(primary, &primary_fb_1);
+
+ igt_plane_set_size(primary, PLANE_WIDTH, PLANE_HEIGHT);
+ igt_plane_set_position(primary, -501, 200);
+
+ ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+
+ do {
+ if (j % 2 == 0) {
+ igt_plane_set_fb(primary, &primary_fb_1);
+ igt_plane_set_size(primary, PLANE_WIDTH - j, PLANE_HEIGHT);
+ ret = igt_display_try_commit_atomic(display, 0, NULL);
+ } else {
+ igt_plane_set_fb(primary, &primary_fb_2);
+ igt_plane_set_size(primary, PLANE_WIDTH - j, PLANE_HEIGHT);
+ ret = igt_display_try_commit_atomic(display, 0, NULL);
+ }
+ j++;
+ } while (j < 20);
+
+ igt_assert_eq(ret, -22);
+
+ igt_plane_set_fb(primary, NULL);
+ igt_output_set_pipe(output, PIPE_NONE);
+ igt_display_try_commit2(display, COMMIT_ATOMIC);
+
+ igt_remove_fb(display->drm_fd, &primary_fb_1);
+ igt_remove_fb(display->drm_fd, &primary_fb_2);
+}
+
+static void run_test_pan(igt_display_t *display, const enum pipe pipe_id,
+ igt_output_t *output)
+{
+ prepare_planes(display, pipe_id, output);
+}
+
+static void run_test_odd_pan(data_t *data)
+{
+ igt_display_t *display = &data->display;
+ enum pipe pipe;
+ igt_output_t *output;
+
+ for_each_pipe_with_valid_output(display, pipe, output) {
+ igt_display_reset(display);
+
+ igt_output_set_pipe(output, pipe);
+ if (!intel_pipe_output_combo_valid(display))
+ continue;
+
+ igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output))
+ run_test_pan(display, pipe, output);
+
+ if (pipe == 0)
+ break;
+ }
+}
+
+igt_main
+{
+ data_t data = {};
+
+ igt_fixture {
+ data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+ igt_require(data.drm_fd >= 0);
+
+ kmstest_set_vt_graphics_mode();
+
+ igt_display_require(&data.display, data.drm_fd);
+ igt_require(data.display.is_atomic);
+
+ igt_display_require_output(&data.display);
+ }
+
+ igt_describe("Tests odd panning");
+ igt_subtest_with_dynamic("odd-panning")
+ run_test_odd_pan(&data);
+
+ igt_fixture {
+ igt_display_fini(&data.display);
+ drm_close_driver(data.drm_fd);
+ }
+}
diff --git a/tests/meson.build b/tests/meson.build
index f8a0ab836..97effb290 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -257,6 +257,7 @@ intel_kms_progs = [
'kms_joiner',
'kms_legacy_colorkey',
'kms_mmap_write_crc',
+ 'kms_odd_pan',
'kms_pipe_b_c_ivb',
'kms_pipe_stress',
'kms_pm_backlight',
--
2.25.1
More information about the igt-dev
mailing list