All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Stone <daniels@collabora.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_getfb: Test we reject CCS buffers
Date: Fri, 23 Mar 2018 15:00:37 +0200	[thread overview]
Message-ID: <20180323130037.GQ5453@intel.com> (raw)
In-Reply-To: <20180323115955.709-1-daniels@collabora.com>

On Fri, Mar 23, 2018 at 11:59:55AM +0000, Daniel Stone wrote:
> The getfb ioctl only supports returning a single buffer handle
> (mirroring addfb), which means it should refuse to return us back CCS
> buffers.
> 
> This is enforced by the kernel as of b24791fe00f8.
> 
> Signed-off-by: Daniel Stone <daniels@collabora.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  tests/kms_getfb.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
> 
> diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c
> index 00b5dfcf..c5968e75 100644
> --- a/tests/kms_getfb.c
> +++ b/tests/kms_getfb.c
> @@ -40,6 +40,38 @@
>  #include "drm.h"
>  #include "drm_fourcc.h"
>  
> +static void get_ccs_fb(int fd, struct drm_mode_fb_cmd2 *ret)
> +{
> +	struct drm_mode_fb_cmd2 add = {
> +		.width = 1024,
> +		.height = 1024,
> +		.pixel_format = DRM_FORMAT_XRGB8888,
> +		.flags = DRM_MODE_FB_MODIFIERS,
> +		.modifier = {
> +			I915_FORMAT_MOD_Y_TILED_CCS,
> +			I915_FORMAT_MOD_Y_TILED_CCS,
> +		},
> +	};
> +	int size;
> +
> +	/* An explanation of the magic numbers can be found in kms_ccs.c. */
> +	add.pitches[0] = ALIGN(add.width * 4, 128);
> +	add.offsets[1] = add.pitches[0] * ALIGN(add.height, 32);
> +	add.pitches[1] = ALIGN(ALIGN(add.width * 4, 32) / 32, 128);
> +
> +	size = add.offsets[1];
> +	size += add.pitches[1] * ALIGN(ALIGN(add.height, 16) / 16, 32);
> +
> +	add.handles[0] = gem_create(fd, size);
> +	igt_assert(add.handles[0]);
> +	add.handles[1] = add.handles[0];
> +
> +	if (drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &add) == 0)
> +		*ret = add;
> +	else
> +		gem_close(fd, add.handles[0]);
> +}
> +
>  static void test_handle_input(int fd)
>  {
>  	struct drm_mode_fb_cmd2 add = {};
> @@ -135,6 +167,19 @@ static void test_duplicate_handles(int fd)
>  		gem_close(fd, get2.handle);
>  	}
>  
> +	igt_subtest("getfb-reject-ccs") {
> +		struct drm_mode_fb_cmd2 add_ccs = { };
> +		struct drm_mode_fb_cmd get = { };
> +
> +		get_ccs_fb(fd, &add_ccs);
> +		igt_require(add_ccs.handles[0] != 0);
> +		get.fb_id = add_ccs.fb_id;
> +		do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB, &get, EINVAL);
> +
> +		do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add_ccs.fb_id);
> +		gem_close(fd, add_ccs.handles[0]);
> +	}
> +
>  	igt_fixture {
>  		do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add.fb_id);
>  		gem_close(fd, add.handles[0]);
> -- 
> 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
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-03-23 13:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 11:59 [igt-dev] [PATCH i-g-t] tests/kms_getfb: Test we reject CCS buffers Daniel Stone
2018-03-23 13:00 ` Ville Syrjälä [this message]
2018-03-23 20:42 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-03-24  2:24 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20180323130037.GQ5453@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=daniels@collabora.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.