From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Stone <daniels@collabora.com>
Cc: igt-dev@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests
Date: Fri, 23 Mar 2018 17:01:10 +0200 [thread overview]
Message-ID: <20180323150110.GA5453@intel.com> (raw)
In-Reply-To: <20180323134616.16058-3-daniels@collabora.com>
On Fri, Mar 23, 2018 at 01:46:16PM +0000, Daniel Stone wrote:
> Mirroring addfb2, add tests for the new ioctl which will return us
> information about framebuffers containing multiple buffers, as well as
> modifiers.
lgtm
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Maybe we also want to encode my earlier 'getfb2(&cmd); addfb2(&cmd);'
idea into a test?
>
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> ---
> tests/kms_getfb.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 91 insertions(+)
>
> diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c
> index a9852626..b8583694 100644
> --- a/tests/kms_getfb.c
> +++ b/tests/kms_getfb.c
> @@ -186,7 +186,96 @@ static void test_duplicate_handles(int fd)
> do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add.fb_id);
> gem_close(fd, add.handles[0]);
> }
> +}
> +
> +static void test_getfb2(int fd)
> +{
> + struct drm_mode_fb_cmd2 add_basic = {};
> +
> + igt_fixture {
> + struct drm_mode_fb_cmd2 get = {};
> +
> + add_basic.width = 1024;
> + add_basic.height = 1024;
> + add_basic.pixel_format = DRM_FORMAT_XRGB8888;
> + add_basic.pitches[0] = 1024*4;
> + add_basic.handles[0] = igt_create_bo_with_dimensions(fd, 1024, 1024,
> + DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL);
> + igt_assert(add_basic.handles[0]);
> + do_ioctl(fd, DRM_IOCTL_MODE_ADDFB2, &add_basic);
> +
> + get.fb_id = add_basic.fb_id;
> + do_ioctl(fd, DRM_IOCTL_MODE_GETFB2, &get);
> + igt_assert_neq_u32(get.handles[0], 0);
> + gem_close(fd, get.handles[0]);
> + }
> +
> + igt_subtest("getfb2-handle-zero") {
> + struct drm_mode_fb_cmd2 get = {};
> + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB2, &get, ENOENT);
> + }
> +
> + igt_subtest("getfb2-handle-closed") {
> + struct drm_mode_fb_cmd2 add = add_basic;
> + struct drm_mode_fb_cmd2 get = { };
> +
> + add.handles[0] = igt_create_bo_with_dimensions(fd, 1024, 1024,
> + DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL);
> + igt_assert(add.handles[0]);
> + do_ioctl(fd, DRM_IOCTL_MODE_ADDFB2, &add);
> + do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add.fb_id);
>
> + get.fb_id = add.fb_id;
> + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB2, &get, ENOENT);
> + gem_close(fd, add.handles[0]);
> + }
> +
> + igt_subtest("getfb2-handle-not-fb") {
> + struct drm_mode_fb_cmd get = { .fb_id = get_prop_id(fd) };
> + igt_require(get.fb_id > 0);
> + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB, &get, ENOENT);
> + }
> +
> + igt_subtest("getfb2-accept-ccs") {
> + struct drm_mode_fb_cmd2 add_ccs = { };
> + struct drm_mode_fb_cmd2 get = { };
> + int i;
> +
> + get_ccs_fb(fd, &add_ccs);
> + igt_require(add_ccs.fb_id != 0);
> + get.fb_id = add_ccs.fb_id;
> + do_ioctl(fd, DRM_IOCTL_MODE_GETFB2, &get);
> +
> + igt_assert_eq_u32(get.width, add_ccs.width);
> + igt_assert_eq_u32(get.height, add_ccs.height);
> + igt_assert(get.flags & DRM_MODE_FB_MODIFIERS);
> +
> + for (i = 0; i < ARRAY_SIZE(get.handles); i++) {
> + igt_assert_eq_u32(get.pitches[i], add_ccs.pitches[i]);
> + igt_assert_eq_u32(get.offsets[i], add_ccs.offsets[i]);
> + if (add_ccs.handles[i] != 0) {
> + igt_assert_neq_u32(get.handles[i], 0);
> + igt_assert_neq_u32(get.handles[i],
> + add_ccs.handles[i]);
> + igt_assert_eq_u64(get.modifier[i],
> + add_ccs.modifier[i]);
> + } else {
> + igt_assert_eq_u32(get.handles[i], 0);
> + igt_assert_eq_u64(get.modifier[i],
> + DRM_FORMAT_MOD_INVALID);
> + }
> + }
> + igt_assert_eq_u32(get.handles[0], get.handles[1]);
> +
> + do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &get.fb_id);
> + gem_close(fd, add_ccs.handles[0]);
> + gem_close(fd, get.handles[0]);
> + }
> +
> + igt_fixture {
> + do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add_basic.fb_id);
> + gem_close(fd, add_basic.handles[0]);
> + }
> }
>
> igt_main
> @@ -200,6 +289,8 @@ igt_main
>
> test_duplicate_handles(fd);
>
> + test_getfb2(fd);
> +
> igt_fixture
> close(fd);
> }
> --
> 2.16.2
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
--
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-03-23 15:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-23 13:42 [igt-dev] [PATCH 0/8] Add GetFB2 ioctl Daniel Stone
2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Daniel Stone
2018-03-23 13:46 ` [PATCH i-g-t 2/3] NOMERGE: Update DRM UAPI to latest kernel version Daniel Stone
2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests Daniel Stone
2018-03-23 15:01 ` Ville Syrjälä [this message]
2018-03-23 14:53 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Ville Syrjälä
2018-03-23 14:55 ` Daniel Stone
2018-03-23 13:51 ` [igt-dev] [PATCH 0/8] Add GetFB2 ioctl Daniel Stone
-- strict thread matches above, loose matches on Subject: below --
2018-03-30 15:49 [igt-dev] [PATCH i-g-t 1/3] include: Update DRM uAPI headers Daniel Stone
2018-03-30 15:49 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests Daniel Stone
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180323150110.GA5453@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniels@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox