diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2019-02-20 17:25:29 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2019-02-22 16:17:47 +0100 |
commit | d57546bd07cbf25dbb32b959110daf2b6f42ce9d (patch) | |
tree | afab58b604ff005a8b693adc914297aa0106ead1 /tests | |
parent | e0e8da1833d110cf1e96c1f11f342b5a84b56f4e (diff) |
tests/kms_lease: validate implicitly added planes
Without universal planes the kernel should auto-add the (in that case
hidden) primary and cursor planes. Check this works and all the error
handling is there for evil userspace.
Cc: Keith Packard <keithp@keithp.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/kms_lease.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/kms_lease.c b/tests/kms_lease.c index e42e187a..da0d37f5 100644 --- a/tests/kms_lease.c +++ b/tests/kms_lease.c @@ -927,6 +927,53 @@ static void multimaster_lease(data_t *data) close(lease_fd); } +static void implicit_plane_lease(data_t *data) +{ + uint32_t object_ids[3]; + struct local_drm_mode_create_lease mcl; + struct local_drm_mode_get_lease mgl; + + uint32_t cursor_id = igt_pipe_get_plane_type(&data->master.display.pipes[0], + DRM_PLANE_TYPE_CURSOR)->drm_plane->plane_id; + + object_ids[0] = data->master.display.pipes[0].crtc_id; + object_ids[1] = data->master.display.outputs[0].id; + object_ids[2] = igt_pipe_get_plane_type(&data->master.display.pipes[0], + DRM_PLANE_TYPE_PRIMARY)->drm_plane->plane_id; + mcl.object_ids = (uint64_t) (uintptr_t) object_ids; + mcl.object_count = 3; + mcl.flags = 0; + + /* sanity check */ + igt_assert_eq(create_lease(data->master.fd, &mcl), 0); + close(mcl.fd); + drmSetClientCap(data->master.fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 0); + + /* non universal plane automatically adds primary/cursor plane */ + mcl.object_count = 2; + igt_assert_eq(create_lease(data->master.fd, &mcl), 0); + + mgl.pad = 0; + mgl.count_objects = 0; + mgl.objects_ptr = 0; + igt_assert_eq(get_lease(mcl.fd, &mgl), 0); + + igt_assert_eq(mgl.count_objects, 3 + (cursor_id ? 1 : 0)); + + close(mcl.fd); + + /* check that implicit lease doesn't lead to confusion when + * explicitly adding primary plane */ + mcl.object_count = 3; + igt_assert_eq(create_lease(data->master.fd, &mcl), -ENOSPC); + + /* same for the cursor */ + object_ids[2] = cursor_id; + igt_assert_eq(create_lease(data->master.fd, &mcl), -ENOSPC); + + drmSetClientCap(data->master.fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1); +} + igt_main { data_t data; @@ -971,4 +1018,7 @@ igt_main igt_subtest("multimaster-lease") multimaster_lease(&data); + + igt_subtest("implicit-plane-lease") + implicit_plane_lease(&data); } |