[igt-dev] [PATCH i-g-t] tests/kms_legacy_colorkey: Test a lot more things
Ville Syrjala
ville.syrjala at linux.intel.com
Tue Feb 6 20:44:05 UTC 2018
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Try to test that we can actually use the colorkey ioctl to
ask for different colorkeying modes, and make sure the kernel
rejects invalid/unsupported flags, etc.
What we;re still missing is looking at the crc to make sure
the color keying actually works. But let's leave that for
the future.
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
tests/kms_legacy_colorkey.c | 132 ++++++++++++++++++++++++++++++++++++++------
1 file changed, 115 insertions(+), 17 deletions(-)
diff --git a/tests/kms_legacy_colorkey.c b/tests/kms_legacy_colorkey.c
index 150520ce6913..981e950d08fb 100644
--- a/tests/kms_legacy_colorkey.c
+++ b/tests/kms_legacy_colorkey.c
@@ -22,51 +22,149 @@
*/
#include "igt.h"
+#include "i915_drm.h"
#include <errno.h>
-IGT_TEST_DESCRIPTION("Check that the legacy set colorkey ioctl only works on sprite planes.");
+IGT_TEST_DESCRIPTION("Check that the legacy set colorkey ioctl works.");
static int drm_fd;
static igt_display_t display;
static int p;
static igt_plane_t *plane;
static uint32_t max_id;
+static uint32_t devid;
-static void test_plane(uint32_t plane_id, int expected_ret)
+static void test_plane(uint32_t plane_id,
+ uint32_t flags,
+ int expected_ret)
{
struct drm_intel_sprite_colorkey ckey = {
.plane_id = plane_id,
+ .flags = flags,
};
igt_assert(drmCommandWrite(drm_fd, DRM_I915_SET_SPRITE_COLORKEY, &ckey,
sizeof(ckey)) == expected_ret);
}
-igt_simple_main
+igt_main
{
igt_skip_on_simulation();
- drm_fd = drm_open_driver_master(DRIVER_INTEL);
+ igt_fixture {
+ drm_fd = drm_open_driver_master(DRIVER_INTEL);
- kmstest_set_vt_graphics_mode();
+ devid = intel_get_drm_devid(drm_fd);
- igt_display_init(&display, drm_fd);
+ kmstest_set_vt_graphics_mode();
- for_each_pipe(&display, p) {
- for_each_plane_on_pipe(&display, p, plane) {
- bool is_valid = (plane->type == DRM_PLANE_TYPE_PRIMARY ||
- plane->type == DRM_PLANE_TYPE_CURSOR);
- test_plane(plane->drm_plane->plane_id,
- is_valid ? -ENOENT : 0);
+ igt_display_init(&display, drm_fd);
+ }
+
+ igt_subtest("invalid-plane-id") {
+ /* try some invalid plane IDs */
+ test_plane(0, 0, -ENOENT);
+
+ for_each_pipe(&display, p) {
+ for_each_plane_on_pipe(&display, p, plane) {
+ max_id = max(max_id, plane->drm_plane->plane_id);
+ }
+ }
+ test_plane(max_id + 1, 0, -ENOENT);
+ }
+
+ for_each_pipe_static(p) {
+ igt_subtest_f("pipe-%s-unsupported-plane", kmstest_pipe_name(p)) {
+ igt_skip_on(p >= display.n_pipes);
+
+ for_each_plane_on_pipe(&display, p, plane) {
+ if (plane->type == DRM_PLANE_TYPE_OVERLAY)
+ continue;
+
+ /* should be rejected for primary/cursor planes */
+ test_plane(plane->drm_plane->plane_id,
+ 0, -ENOENT);
+ }
+ }
+ }
+
+ for_each_pipe_static(p) {
+ igt_subtest_f("pipe-%s-invalid-flags", kmstest_pipe_name(p)) {
+ igt_skip_on(p >= display.n_pipes);
+
+ for_each_plane_on_pipe(&display, p, plane) {
+ if (plane->type != DRM_PLANE_TYPE_OVERLAY)
+ continue;
+
+ /* dst + src keying is not supported */
+ test_plane(plane->drm_plane->plane_id,
+ I915_SET_COLORKEY_DESTINATION |
+ I915_SET_COLORKEY_SOURCE,
+ -EINVAL);
+
+ /* test some undefined flags */
+ test_plane(plane->drm_plane->plane_id,
+ 1 << 3, -EINVAL);
+ test_plane(plane->drm_plane->plane_id,
+ 1 << 31, -EINVAL);
+ }
+ }
+ }
+
+ for_each_pipe_static(p) {
+ igt_subtest_f("pipe-%s-no-colorkey", kmstest_pipe_name(p)) {
+ igt_skip_on(p >= display.n_pipes);
+
+ for_each_plane_on_pipe(&display, p, plane) {
+ if (plane->type != DRM_PLANE_TYPE_OVERLAY)
+ continue;
+
+ test_plane(plane->drm_plane->plane_id, 0, 0);
- max_id = max(max_id, plane->drm_plane->plane_id);
+ /* the "none" flag should be ignore by the kernel */
+ test_plane(plane->drm_plane->plane_id,
+ I915_SET_COLORKEY_NONE, 0);
+ }
}
}
- /* try some invalid IDs too */
- test_plane(0, -ENOENT);
- test_plane(max_id + 1, -ENOENT);
+ for_each_pipe_static(p) {
+ igt_subtest_f("pipe-%s-src-colorkey", kmstest_pipe_name(p)) {
+ igt_skip_on(p >= display.n_pipes);
+
+ for_each_plane_on_pipe(&display, p, plane) {
+ if (plane->type != DRM_PLANE_TYPE_OVERLAY)
+ continue;
+
+ test_plane(plane->drm_plane->plane_id,
+ I915_SET_COLORKEY_SOURCE, 0);
+ test_plane(plane->drm_plane->plane_id, 0, 0);
+ }
+ }
+ }
- igt_display_fini(&display);
+ for_each_pipe_static(p) {
+ igt_subtest_f("pipe-%s-dst-colorkey", kmstest_pipe_name(p)) {
+ igt_skip_on(p >= display.n_pipes);
+
+ for_each_plane_on_pipe(&display, p, plane) {
+ /* VLV/CHV don't support dst colorkey */
+ bool is_valid = !IS_VALLEYVIEW(devid) &&
+ !IS_CHERRYVIEW(devid);
+
+ if (plane->type != DRM_PLANE_TYPE_OVERLAY)
+ continue;
+
+ test_plane(plane->drm_plane->plane_id,
+ I915_SET_COLORKEY_DESTINATION,
+ is_valid ? 0 : -EINVAL);
+ test_plane(plane->drm_plane->plane_id, 0, 0);
+ }
+ }
+ }
+
+ igt_fixture {
+ igt_display_fini(&display);
+ }
}
--
2.13.6
More information about the igt-dev
mailing list