mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-26 17:26:14 +00:00
kms_cursor_crc: Add test for unthrottled cursor movement
We've had bugs in the past that caused cursor updates to be synced to vblank, resulting in sluggish cursor movement. Add a test to try to make sure we don't regress and reintroduce these bugs. Cc: kalyan.kondapally@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
parent
e3ac13e16a
commit
cd99ddead3
@ -55,6 +55,7 @@ typedef struct {
|
|||||||
igt_crc_t ref_crc;
|
igt_crc_t ref_crc;
|
||||||
int left, right, top, bottom;
|
int left, right, top, bottom;
|
||||||
int screenw, screenh;
|
int screenw, screenh;
|
||||||
|
int refresh;
|
||||||
int curw, curh; /* cursor size */
|
int curw, curh; /* cursor size */
|
||||||
int cursor_max_w, cursor_max_h;
|
int cursor_max_w, cursor_max_h;
|
||||||
igt_pipe_crc_t *pipe_crc;
|
igt_pipe_crc_t *pipe_crc;
|
||||||
@ -327,6 +328,7 @@ static bool prepare_crtc(data_t *data, igt_output_t *output,
|
|||||||
data->screenh = mode->vdisplay;
|
data->screenh = mode->vdisplay;
|
||||||
data->curw = cursor_w;
|
data->curw = cursor_w;
|
||||||
data->curh = cursor_h;
|
data->curh = cursor_h;
|
||||||
|
data->refresh = mode->vrefresh;
|
||||||
|
|
||||||
/* make sure cursor is disabled */
|
/* make sure cursor is disabled */
|
||||||
cursor_disable(data);
|
cursor_disable(data);
|
||||||
@ -479,6 +481,42 @@ static void test_cursor_size(data_t *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_rapid_movement(data_t *data)
|
||||||
|
{
|
||||||
|
struct timeval start, end, delta;
|
||||||
|
int x = 0, y = 0;
|
||||||
|
long usec;
|
||||||
|
int crtc_id = data->output->config.crtc->crtc_id;
|
||||||
|
|
||||||
|
igt_assert_eq(drmModeSetCursor(data->drm_fd, crtc_id,
|
||||||
|
data->fb.gem_handle, data->curw, data->curh), 0);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
for ( ; x < 100; x++)
|
||||||
|
igt_assert_eq(drmModeMoveCursor(data->drm_fd, crtc_id, x, y), 0);
|
||||||
|
for ( ; y < 100; y++)
|
||||||
|
igt_assert_eq(drmModeMoveCursor(data->drm_fd, crtc_id, x, y), 0);
|
||||||
|
for ( ; x > 0; x--)
|
||||||
|
igt_assert_eq(drmModeMoveCursor(data->drm_fd, crtc_id, x, y), 0);
|
||||||
|
for ( ; y > 0; y--)
|
||||||
|
igt_assert_eq(drmModeMoveCursor(data->drm_fd, crtc_id, x, y), 0);
|
||||||
|
gettimeofday(&end, NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We've done 400 cursor updates now. If we're being throttled to
|
||||||
|
* vblank, then that would take roughly 400/refresh seconds. If the
|
||||||
|
* elapsed time is greater than 90% of that value, we'll consider it
|
||||||
|
* a failure (since cursor updates shouldn't be throttled).
|
||||||
|
*/
|
||||||
|
timersub(&end, &start, &delta);
|
||||||
|
usec = delta.tv_usec + 1000000 * delta.tv_sec;
|
||||||
|
igt_assert_lt(usec, 0.9 * 400 * 1000000 / data->refresh);
|
||||||
|
|
||||||
|
igt_assert_eq(drmModeSetCursor(data->drm_fd, crtc_id,
|
||||||
|
0, data->curw, data->curh), 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void run_test_generic(data_t *data)
|
static void run_test_generic(data_t *data)
|
||||||
{
|
{
|
||||||
int cursor_size;
|
int cursor_size;
|
||||||
@ -510,6 +548,10 @@ static void run_test_generic(data_t *data)
|
|||||||
data->flags = 0;
|
data->flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
igt_subtest_f("cursor-%dx%d-rapid-movement", w, h) {
|
||||||
|
run_test(data, test_rapid_movement, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
igt_fixture
|
igt_fixture
|
||||||
igt_remove_fb(data->drm_fd, &data->fb);
|
igt_remove_fb(data->drm_fd, &data->fb);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user