[PATCH i-g-t] tests/kms_histogram: Add test to count the number of histogram events
Mohammed Thasleem
mohammed.thasleem at intel.com
Wed Dec 11 15:14:24 UTC 2024
This test to count the number of histogram events during color flips.
Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
---
tests/kms_histogram.c | 42 ++++++++++++++++++++++++++++++------------
1 file changed, 30 insertions(+), 12 deletions(-)
diff --git a/tests/kms_histogram.c b/tests/kms_histogram.c
index c25aa022b..9d9112915 100644
--- a/tests/kms_histogram.c
+++ b/tests/kms_histogram.c
@@ -29,6 +29,7 @@
#define GLOBAL_HIST_ENABLE 1
#define GLOBAL_HIST_DELAY 2
#define FLIP_COUNT 20
+#define CHK_FLIP_COUNT 200
/**
* SUBTEST: global-basic
@@ -229,9 +230,10 @@ static void flip_fb(data_t *data, enum pipe pipe, igt_output_t *output, struct i
igt_display_commit2(&data->display, COMMIT_ATOMIC);
}
-static void prepare_pipe(data_t *data, enum pipe pipe, igt_output_t *output, bool color_fb)
+static void prepare_pipe(data_t *data, enum pipe pipe, igt_output_t *output,
+ bool color_fb, bool count_events)
{
- int i;
+ int i, events = 0;
struct udev_monitor *mon = igt_watch_uevents();
drmModeModeInfo *mode = igt_output_get_mode(output);
bool event_detected = false;
@@ -248,24 +250,34 @@ static void prepare_pipe(data_t *data, enum pipe pipe, igt_output_t *output, boo
igt_flush_uevents(mon);
for (i = 1; i <= FLIP_COUNT; i++) {
flip_fb(data, pipe, output, &data->fb[i % fb_count]);
+ if (count_events)
+ igt_wait_for_vblank(data->drm_fd, data->display.pipes[pipe].crtc_offset);
/* Check for histogram event on every flip and break the loop if detected. */
if (igt_global_histogram_event_detected(mon, 0)) {
- event_detected = true;
- break;
+ if (count_events)
+ events++;
+ else {
+ event_detected = true;
+ break;
+ }
}
}
igt_cleanup_uevents(mon);
- igt_assert_f(event_detected, "Histogram event not generated.\n");
+ if (count_events) {
+ igt_info("Number of histogram events received = %d\n", events);
+ igt_assert_f(events, "Histogram event not generated.\n");
+ } else
+ igt_assert_f(event_detected, "Histogram event not generated.\n");
}
static void run_global_histogram_pipeline(data_t *data, enum pipe pipe, igt_output_t *output,
- bool color_fb, test_t test_pixel_factor)
+ bool color_fb, test_t test_pixel_factor, bool count_events)
{
drmModePropertyBlobRes *global_hist_blob = NULL;
- prepare_pipe(data, pipe, output, color_fb);
+ prepare_pipe(data, pipe, output, color_fb, count_events);
read_global_histogram(data, pipe, &global_hist_blob);
@@ -277,7 +289,8 @@ static void run_global_histogram_pipeline(data_t *data, enum pipe pipe, igt_outp
}
static void run_tests_for_global_histogram(data_t *data, bool color_fb,
- test_t test_pixel_factor)
+ test_t test_pixel_factor,
+ bool count_events)
{
enum pipe pipe;
igt_output_t *output;
@@ -294,7 +307,7 @@ static void run_tests_for_global_histogram(data_t *data, bool color_fb,
continue;
igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output))
- run_global_histogram_pipeline(data, pipe, output, color_fb, test_pixel_factor);
+ run_global_histogram_pipeline(data, pipe, output, color_fb, test_pixel_factor, count_events);
}
}
}
@@ -302,7 +315,7 @@ static void run_tests_for_global_histogram(data_t *data, bool color_fb,
static void run_algo_test(data_t *data, bool color_fb)
{
#ifdef HAVE_LIBGHE
- run_tests_for_global_histogram(data, color_fb, algo_image_enhancement_factor);
+ run_tests_for_global_histogram(data, color_fb, algo_image_enhancement_factor, false);
#else
igt_skip("Histogram algorithm library not found.\n");
#endif
@@ -320,15 +333,20 @@ igt_main
igt_require(data.display.is_atomic);
}
+ igt_describe("Test to enable histogram, flip color fbs, count histogram "
+ "event.");
+ igt_subtest_with_dynamic("global-color-event")
+ run_tests_for_global_histogram(&data, true, NULL, true);
+
igt_describe("Test to enable histogram, flip monochrome fbs, wait for histogram "
"event and then read the histogram data.");
igt_subtest_with_dynamic("global-basic")
- run_tests_for_global_histogram(&data, false, NULL);
+ run_tests_for_global_histogram(&data, false, NULL, false);
igt_describe("Test to enable histogram, flip color fbs, wait for histogram event "
"and then read the histogram data.");
igt_subtest_with_dynamic("global-color")
- run_tests_for_global_histogram(&data, true, NULL);
+ run_tests_for_global_histogram(&data, true, NULL, false);
igt_describe("Test to enable histogram, flip monochrome fbs, wait for histogram "
"event and then read the histogram data and enhance pixels by multiplying "
--
2.25.1
More information about the igt-dev
mailing list