[igt-dev] [PATCH i-g-t] tests/kms_plane: try to detect mid test modeset
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Mon Oct 19 11:24:59 UTC 2020
mid test happening modeset will mess up vblank counting in test.
Flag happened modeset and use this information to ignore vblank
frame value in case of modeset.
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
tests/kms_plane.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index e42c71cd9..12c232385 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -539,11 +539,11 @@ static int num_unique_crcs(const igt_crc_t crc[], int num_crc)
return num_unique_crc;
}
-static void capture_crc(data_t *data, unsigned int vblank, igt_crc_t *crc)
+static void capture_crc(data_t *data, unsigned int vblank, igt_crc_t *crc, bool modeset)
{
igt_pipe_crc_get_for_frame(data->drm_fd, data->pipe_crc, vblank, crc);
- igt_fail_on_f(crc->has_valid_frame && crc->frame != vblank,
+ igt_fail_on_f(crc->has_valid_frame && (crc->frame != vblank && !modeset),
"Got CRC for the wrong frame (got %u, expected %u). CRC buffer overflow?\n",
crc->frame, vblank);
}
@@ -557,8 +557,9 @@ static void capture_format_crcs(data_t *data, enum pipe pipe,
igt_crc_t crc[], struct igt_fb *fb)
{
unsigned int vblank[ARRAY_SIZE(colors_extended)];
+ bool modeset[ARRAY_SIZE(colors_extended)];
struct drm_event_vblank ev;
- int i;
+ int i, ret;
for (i = 0; i < data->num_colors; i++) {
const color_t *c = &data->colors[i];
@@ -585,18 +586,25 @@ static void capture_format_crcs(data_t *data, enum pipe pipe,
* is for frame N-2.
*/
if (i >= 2)
- capture_crc(data, vblank[i - 2], &crc[i - 2]);
+ capture_crc(data, vblank[i - 2], &crc[i - 2], modeset[i - 2]);
if (data->display.is_atomic) {
+ modeset[i] = false;
/*
* Use non-blocking commits to allow the next fb
* to be prepared in parallel while the current fb
* awaits to be latched.
*/
- igt_display_commit_atomic(&data->display,
- DRM_MODE_ATOMIC_ALLOW_MODESET |
- DRM_MODE_ATOMIC_NONBLOCK |
- DRM_MODE_PAGE_FLIP_EVENT, NULL);
+ ret = igt_display_try_commit_atomic(&data->display,
+ DRM_MODE_ATOMIC_NONBLOCK |
+ DRM_MODE_PAGE_FLIP_EVENT, NULL);
+ if (ret) {
+ modeset[i] = true;
+ igt_display_commit_atomic(&data->display,
+ DRM_MODE_ATOMIC_ALLOW_MODESET |
+ DRM_MODE_ATOMIC_NONBLOCK |
+ DRM_MODE_PAGE_FLIP_EVENT, NULL);
+ }
} else {
/*
* Last moment to grab the previous crc
@@ -652,8 +660,8 @@ static void capture_format_crcs(data_t *data, enum pipe pipe,
* between different pixel formats as well? Could get messy.
*/
if (i >= 2)
- capture_crc(data, vblank[i - 2], &crc[i - 2]);
- capture_crc(data, vblank[i - 1], &crc[i - 1]);
+ capture_crc(data, vblank[i - 2], &crc[i - 2], modeset[i - 2]);
+ capture_crc(data, vblank[i - 1], &crc[i - 1], modeset[i - 1]);
}
static bool test_format_plane_colors(data_t *data, enum pipe pipe,
@@ -815,7 +823,9 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
igt_plane_set_fb(plane, &test_fb);
- ret = igt_display_try_commit_atomic(&data->display, DRM_MODE_ATOMIC_TEST_ONLY, NULL);
+ ret = igt_display_try_commit_atomic(&data->display,
+ DRM_MODE_ATOMIC_ALLOW_MODESET |
+ DRM_MODE_ATOMIC_TEST_ONLY, NULL);
if (!ret) {
width = test_fb.width;
@@ -1029,7 +1039,7 @@ static const struct option long_opts[] = {
static const char help_str[] =
" --extended\t\tRun the extended tests\n";
-static data_t data;
+static data_t data = {};
igt_main_args("", long_opts, help_str, opt_handler, &data)
{
--
2.28.0
More information about the igt-dev
mailing list