[PATCH i-g-t v1 1/5] tests/kms_flip: Enable degamma LUT testing in kms_flip
Naladala Ramanaidu
ramanaidu.naladala at intel.com
Thu Aug 7 07:31:45 UTC 2025
Adds support for testing degamma LUT functionality in the kms_flip
test suite. A new TEST_DEGAMMA flag is introduced to control the
test flow.
Signed-off-by: Naladala Ramanaidu <ramanaidu.naladala at intel.com>
---
tests/kms_flip.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++
tests/meson.build | 1 +
2 files changed, 69 insertions(+)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 0cebbecac..6b91ad6eb 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -33,6 +33,7 @@
#include "igt.h"
#include "i915/intel_drrs.h"
+#include "kms_color_helper.h"
#include <cairo.h>
#include <errno.h>
@@ -257,6 +258,8 @@
#define TEST_NO_VBLANK (1 << 29)
#define TEST_BASIC (1 << 30)
+#define TEST_DEGAMMA (1 << 17)
+
#define EVENT_FLIP (1 << 0)
#define EVENT_VBLANK (1 << 1)
@@ -1540,6 +1543,31 @@ static void get_suitable_modes(struct test_output *o)
o->kmode[1] = mode[1];
}
+static void
+test_setup(data_t *data, enum pipe p, uint64_t modifier)
+{
+ igt_pipe_t *pipe;
+
+ data->drm_fd = drm_fd;
+ data->color_depth = 8;
+ data->drm_format = DRM_FORMAT_XRGB8888;
+
+ memcpy(&data->display, &display, sizeof(igt_display_t));
+ igt_require_pipe(&data->display, p);
+
+ if (igt_pipe_obj_has_prop(&data->display.pipes[p], IGT_CRTC_DEGAMMA_LUT_SIZE)) {
+ data->degamma_lut_size =
+ igt_pipe_obj_get_prop(&data->display.pipes[p],
+ IGT_CRTC_DEGAMMA_LUT_SIZE);
+ igt_assert_lt(0, data->degamma_lut_size);
+ }
+
+ pipe = &data->display.pipes[p];
+ igt_require(pipe->n_planes >= 0);
+
+ data->primary = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
+}
+
static void __run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
int crtc_count, int duration_ms)
{
@@ -1551,6 +1579,9 @@ static void __run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
unsigned elapsed;
uint64_t modifier;
int i, ret;
+ data_t data = {};
+ gamma_lut_t *degamma_lut;
+ igt_pipe_t *pipe;
restart:
last_connector = o->kconnector[0];
@@ -1567,6 +1598,11 @@ restart:
else
modifier = DRM_FORMAT_MOD_LINEAR;
+ if (o->flags & TEST_DEGAMMA) {
+ test_setup(&data, o->pipe, modifier);
+ pipe = &data.display.pipes[o->pipe];
+ }
+
if (o->flags & TEST_FENCE_STRESS)
modifier = I915_FORMAT_MOD_X_TILED;
@@ -1593,6 +1629,14 @@ restart:
igt_assert(o->fb_ids[0]);
igt_assert(o->fb_ids[1]);
+ if (o->flags & TEST_DEGAMMA) {
+ if (igt_pipe_obj_has_prop(pipe, IGT_CRTC_DEGAMMA_LUT)) {
+ degamma_lut = generate_table_max(data.degamma_lut_size);
+ set_degamma(&data, pipe, degamma_lut);
+ igt_display_commit(&display);
+ }
+ }
+
paint_flip_mode(&o->fb_info[0], false);
if (!(o->flags & TEST_BO_TOOBIG))
paint_flip_mode(&o->fb_info[1], true);
@@ -1653,6 +1697,14 @@ retry:
/* quiescent the hw a bit so ensure we don't miss a single frame */
if (o->flags & TEST_CHECK_TS && !calibrate_ts(o, crtc_idxs[0])) {
+ if (retried) {
+ if (o->flags & TEST_DEGAMMA) {
+ disable_degamma(pipe);
+ free_lut(degamma_lut);
+ }
+
+ igt_display_commit(&display);
+ }
igt_assert(!retried);
/*
@@ -1701,6 +1753,15 @@ retry:
state_ok &= check_final_state(o, &o->vblank_state, elapsed);
if (!state_ok) {
+ if (retried) {
+ if (o->flags & TEST_DEGAMMA) {
+ disable_degamma(pipe);
+ free_lut(degamma_lut);
+ }
+
+ igt_display_commit(&display);
+ }
+
igt_assert(!retried);
/*
@@ -1722,6 +1783,13 @@ out:
igt_remove_fb(drm_fd, &o->fb_info[1]);
igt_remove_fb(drm_fd, &o->fb_info[0]);
+ if (o->flags & TEST_DEGAMMA) {
+ disable_degamma(pipe);
+ free_lut(degamma_lut);
+ }
+
+ igt_display_commit(&display);
+
last_connector = NULL;
free_test_output(o);
diff --git a/tests/meson.build b/tests/meson.build
index 5c01c64e9..aabac2284 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -373,6 +373,7 @@ extra_sources = {
'dumb_buffer': ['dumb_buffer.c' ],
'testdisplay': [ 'testdisplay_hotplug.c' ],
'kms_color': [ 'kms_color_helper.c' ],
+ 'kms_flip': ['kms_color_helper.c' ],
'kms_chamelium_audio': [ join_paths ('chamelium', 'kms_chamelium_helper.c') ],
'kms_chamelium_color': [ 'kms_color_helper.c', join_paths ('chamelium', 'kms_chamelium_helper.c') ],
'kms_chamelium_edid': [ join_paths ('chamelium', 'kms_chamelium_helper.c') ],
--
2.43.0
More information about the Intel-gfx-trybot
mailing list