[igt-dev] [PATCH i-g-t] test/kms_plane_cursor: Honour max cursor size

Aurabindo Pillai aurabindo.pillai at amd.com
Wed Oct 12 16:15:46 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>
---
 tests/kms_plane_cursor.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c
index 43bcaaa4..bd4d0016 100644
--- a/tests/kms_plane_cursor.c
+++ b/tests/kms_plane_cursor.c
@@ -30,6 +30,15 @@
  * - DRM index indicates z-ordering, higher index = higher z-order
  */
 
+#ifndef DRM_CAP_CURSOR_WIDTH
+#define DRM_CAP_CURSOR_WIDTH 0x8
+#endif
+#ifndef DRM_CAP_CURSOR_HEIGHT
+#define DRM_CAP_CURSOR_HEIGHT 0x9
+#endif
+
+static uint64_t max_curw = 64, max_curh = 64;
+
 enum {
 	TEST_PRIMARY = 0,
 	TEST_OVERLAY = 1 << 0,
@@ -222,6 +231,8 @@ static void test_cursor(data_t *data, int size, unsigned int flags)
 	int sw, sh;
 	int pad = 128;
 
+	igt_skip_on(size > max_curw);
+
 	sw = data->mode->hdisplay;
 	sh = data->mode->vdisplay;
 
@@ -270,8 +281,16 @@ igt_main
 	};
 
 	igt_fixture {
+		int ret;
+
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
 
+		ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_WIDTH, &max_curw);
+		igt_assert(ret == 0 || errno == EINVAL);
+		/* Not making use of cursor_height since it is same as width, still reading */
+		ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_HEIGHT, &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