[igt-dev] [PATCH i-g-t 1/9] tests/kms_addfb_basic: Check that only the owner can rmfb

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 28 14:36:10 UTC 2019


Quoting Daniel Vetter (2019-02-28 14:19:10)
> Just realized we don't seem to have any testcase for this. Fill this
> gap asap!
> 
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> ---
>  tests/kms_addfb_basic.c | 41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> index 400241a92e81..491e9bf9ee34 100644
> --- a/tests/kms_addfb_basic.c
> +++ b/tests/kms_addfb_basic.c
> @@ -667,6 +667,45 @@ static void prop_tests(int fd)
>  
>  }
>  
> +static void master_tests(int fd)
> +{
> +       struct drm_mode_fb_cmd2 f = {};
> +
> +       f.width = 1024;
> +       f.height = 1024;
> +       f.pixel_format = DRM_FORMAT_XRGB8888;
> +       f.pitches[0] = 1024*4;
> +
> +       igt_fixture {
> +               gem_bo = igt_create_bo_with_dimensions(fd, 1024, 1024,
> +                       DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL);
> +               igt_assert(gem_bo);
> +
> +               f.handles[0] = gem_bo;
> +
> +               igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) == 0);
> +       }
> +
> +       igt_subtest("master-rmfb") {
> +               int master2_fd;
> +
> +               do_or_die(drmDropMaster(fd));

igt_device_drop_master(fd)

> +               master2_fd = drm_open_driver_master(DRIVER_ANY);
> +
> +               igt_assert_eq(rmfb(master2_fd, f.fb_id), -ENOENT);
> +
> +               do_or_die(drmDropMaster(master2_fd));
> +               close(master2_fd);
> +
> +               do_or_die(drmSetMaster(fd));

igt_device_set_master(fd)

If you want some with pretty printing?
-Chris


More information about the igt-dev mailing list