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

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Feb 28 14:29:05 UTC 2019


On Thu, Feb 28, 2019 at 03:19:10PM +0100, Daniel Vetter wrote:
> 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;

Could use named intializers.

Anyways, looks reasonable to me.
Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

> +
> +	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));
> +
> +		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_fixture
> +		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0);
> +
> +}
> +
>  static bool has_addfb2_iface(int fd)
>  {
>  	struct local_drm_mode_fb_cmd2 f = {};
> @@ -713,6 +752,8 @@ igt_main
>  
>  	prop_tests(fd);
>  
> +	master_tests(fd);
> +
>  	igt_fixture
>  		close(fd);
>  }
> -- 
> 2.14.4
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Ville Syrjälä
Intel


More information about the igt-dev mailing list