[igt-dev] [PATCH i-g-t v4] test/kms_plane_cursor: Honour max cursor size
Aurabindo Pillai
aurabindo.pillai at amd.com
Thu Oct 13 18:16:10 UTC 2022
Skip the tests for cursor sizes that are not supported by the hardware
Signed-off-by: Aurabindo Pillai <aurabindo.pillai at amd.com>
Reviewed-by: Alex Hung <alex.hung at amd.com>
--
Changes in v2
=============
* Remove the duplicate definitions for DRM cursor width capability
* Check for both cursor width and height when verifying the test cursor size
Changes in v3
=============
* Add variables to hold max cursor size to the global data_t struct
* Remove stale comment from v1
Changes in v4
=============
* Initialize max cursor parameters with default values
* Remove extra newline and unnecessary brackets
---
tests/kms_plane_cursor.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c
index 43bcaaa4..e9abfd78 100644
--- a/tests/kms_plane_cursor.c
+++ b/tests/kms_plane_cursor.c
@@ -64,6 +64,8 @@ typedef struct data {
enum pipe pipe_id;
int drm_fd;
rect_t or;
+ uint64_t max_curw;
+ uint64_t max_curh;
} data_t;
/* Common test setup. */
@@ -222,6 +224,8 @@ static void test_cursor(data_t *data, int size, unsigned int flags)
int sw, sh;
int pad = 128;
+ igt_skip_on(size > data->max_curw || size > data->max_curh);
+
sw = data->mode->hdisplay;
sh = data->mode->vdisplay;
@@ -251,7 +255,7 @@ static void test_cursor(data_t *data, int size, unsigned int flags)
igt_main
{
static const int cursor_sizes[] = { 64, 128, 256 };
- data_t data = {};
+ data_t data = { .max_curw = 64, .max_curh = 64 };
enum pipe pipe;
igt_output_t *output;
int i, j;
@@ -270,8 +274,15 @@ igt_main
};
igt_fixture {
+ int ret;
+
data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+ ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_WIDTH, &data.max_curw);
+ igt_assert(ret == 0 || errno == EINVAL);
+ ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_HEIGHT, &data.max_curh);
+ igt_assert(ret == 0 || errno == EINVAL);
+
kmstest_set_vt_graphics_mode();
igt_display_require(&data.display, data.drm_fd);
--
2.38.0
More information about the igt-dev
mailing list