[Intel-gfx] [PATCH i-g-t] tests/kms_rotation_crc: Add bad-rotation subtest

2016-07-22 Thread Ville Syrjälä
On Fri, Jul 22, 2016 at 01:52:32PM +0100, Matthew Auld wrote:
> I believe you're thinking of:
> https://patchwork.freedesktop.org/patch/77191/
> https://patchwork.freedesktop.org/patch/77192/
> 
> Although they don't test for multiple rotation values...

I guess you could just

for (rotation = 0; rotation < 0x40; rotation++)
if (!is_power_of_2(rotation & 0xf) ||
(rotation & ~supported) != 0)
// expect failure
}

if you want to be really sure invalid crap won't get through.

-- 
Ville Syrjälä
Intel OTC


[Intel-gfx] [PATCH i-g-t] tests/kms_rotation_crc: Add bad-rotation subtest

2016-07-22 Thread Matthew Auld
I believe you're thinking of:
https://patchwork.freedesktop.org/patch/77191/
https://patchwork.freedesktop.org/patch/77192/

Although they don't test for multiple rotation values...


[PATCH i-g-t] tests/kms_rotation_crc: Add bad-rotation subtest

2016-07-21 Thread Ville Syrjälä
On Thu, Jul 21, 2016 at 01:32:48PM +0300, Joonas Lahtinen wrote:
> Was not this implemented once and then dropped for some reason?

Dunno.

> 
> On ke, 2016-07-20 at 16:18 +0300, ville.syrjala at linux.intel.com wrote:
> > From: Ville Syrjälä 
> > 
> > Add "bad-rotation" subtest to make sure the kernel rejects some
> > invalid rotation values (0 and specifying multiple angles at one).
> > 
> > Signed-off-by: Ville Syrjälä 
> > ---
> >  tests/kms_rotation_crc.c | 33 +
> >  1 file changed, 33 insertions(+)
> > 
> > diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> > index 6cc15337fff9..e10a0a770437 100644
> > --- a/tests/kms_rotation_crc.c
> > +++ b/tests/kms_rotation_crc.c
> > @@ -237,6 +237,31 @@ static void wait_for_pageflip(int fd)
> >    igt_assert(drmHandleEvent(fd, ) == 0);
> >  }
> >  
> > +static void test_bad_prop_value(data_t *data)
> > +{
> > +   igt_display_t *display = >display;
> > +   int valid_tests = 0;
> > +   enum pipe pipe;
> > +   igt_plane_t *plane;
> > +   int ret;
> > +
> > +   for_each_pipe(display, pipe)  {
> > +   for_each_plane_on_pipe(display, pipe, plane) {
> > +   igt_require(igt_plane_supports_rotation(plane));
> > +
> > +   ret = drmModeObjectSetProperty(display->drm_fd,
> > +          
> > plane->drm_plane->plane_id,
> > +          
> > DRM_MODE_OBJECT_PLANE,
> > +          
> > plane->rotation_property,
> > +          data->rotation);
> > +
> > +   igt_assert_eq(ret, -EINVAL);
> > +   valid_tests++;
> > +   }
> > +   }
> > +   igt_require_f(valid_tests, "no valid crtc/connector combinations 
> > found\n");
> > +}
> > +
> >  static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
> >  {
> >    igt_display_t *display = >display;
> > @@ -508,6 +533,14 @@ igt_main
> >  
> >    igt_display_init(, data.gfx_fd);
> >    }
> > +   igt_subtest_f("bad-rotation") {
> > +   data.rotation = 0;
> > +   test_bad_prop_value();
> > +
> > +   data.rotation = IGT_ROTATION_0 | IGT_ROTATION_180;
> > +   test_bad_prop_value();
> > +   }
> > +
> >    igt_subtest_f("primary-rotation-180") {
> >    data.rotation = IGT_ROTATION_180;
> >    test_plane_rotation(, IGT_PLANE_PRIMARY);
> -- 
> Joonas Lahtinen
> Open Source Technology Center
> Intel Corporation

-- 
Ville Syrjälä
Intel OTC


[PATCH i-g-t] tests/kms_rotation_crc: Add bad-rotation subtest

2016-07-21 Thread Joonas Lahtinen
Was not this implemented once and then dropped for some reason?

On ke, 2016-07-20 at 16:18 +0300, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> Add "bad-rotation" subtest to make sure the kernel rejects some
> invalid rotation values (0 and specifying multiple angles at one).
> 
> Signed-off-by: Ville Syrjälä 
> ---
>  tests/kms_rotation_crc.c | 33 +
>  1 file changed, 33 insertions(+)
> 
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 6cc15337fff9..e10a0a770437 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -237,6 +237,31 @@ static void wait_for_pageflip(int fd)
>  igt_assert(drmHandleEvent(fd, ) == 0);
>  }
>  
> +static void test_bad_prop_value(data_t *data)
> +{
> + igt_display_t *display = >display;
> + int valid_tests = 0;
> + enum pipe pipe;
> + igt_plane_t *plane;
> + int ret;
> +
> + for_each_pipe(display, pipe)  {
> + for_each_plane_on_pipe(display, pipe, plane) {
> + igt_require(igt_plane_supports_rotation(plane));
> +
> + ret = drmModeObjectSetProperty(display->drm_fd,
> +        
> plane->drm_plane->plane_id,
> +        
> DRM_MODE_OBJECT_PLANE,
> +        
> plane->rotation_property,
> +        data->rotation);
> +
> + igt_assert_eq(ret, -EINVAL);
> + valid_tests++;
> + }
> + }
> + igt_require_f(valid_tests, "no valid crtc/connector combinations 
> found\n");
> +}
> +
>  static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
>  {
>  igt_display_t *display = >display;
> @@ -508,6 +533,14 @@ igt_main
>  
>  igt_display_init(, data.gfx_fd);
>  }
> + igt_subtest_f("bad-rotation") {
> + data.rotation = 0;
> + test_bad_prop_value();
> +
> + data.rotation = IGT_ROTATION_0 | IGT_ROTATION_180;
> + test_bad_prop_value();
> + }
> +
>  igt_subtest_f("primary-rotation-180") {
>  data.rotation = IGT_ROTATION_180;
>  test_plane_rotation(, IGT_PLANE_PRIMARY);
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


[PATCH i-g-t] tests/kms_rotation_crc: Add bad-rotation subtest

2016-07-20 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

Add "bad-rotation" subtest to make sure the kernel rejects some
invalid rotation values (0 and specifying multiple angles at one).

Signed-off-by: Ville Syrjälä 
---
 tests/kms_rotation_crc.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 6cc15337fff9..e10a0a770437 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -237,6 +237,31 @@ static void wait_for_pageflip(int fd)
igt_assert(drmHandleEvent(fd, ) == 0);
 }

+static void test_bad_prop_value(data_t *data)
+{
+   igt_display_t *display = >display;
+   int valid_tests = 0;
+   enum pipe pipe;
+   igt_plane_t *plane;
+   int ret;
+
+   for_each_pipe(display, pipe)  {
+   for_each_plane_on_pipe(display, pipe, plane) {
+   igt_require(igt_plane_supports_rotation(plane));
+
+   ret = drmModeObjectSetProperty(display->drm_fd,
+  
plane->drm_plane->plane_id,
+  DRM_MODE_OBJECT_PLANE,
+  plane->rotation_property,
+  data->rotation);
+
+   igt_assert_eq(ret, -EINVAL);
+   valid_tests++;
+   }
+   }
+   igt_require_f(valid_tests, "no valid crtc/connector combinations 
found\n");
+}
+
 static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 {
igt_display_t *display = >display;
@@ -508,6 +533,14 @@ igt_main

igt_display_init(, data.gfx_fd);
}
+   igt_subtest_f("bad-rotation") {
+   data.rotation = 0;
+   test_bad_prop_value();
+
+   data.rotation = IGT_ROTATION_0 | IGT_ROTATION_180;
+   test_bad_prop_value();
+   }
+
igt_subtest_f("primary-rotation-180") {
data.rotation = IGT_ROTATION_180;
test_plane_rotation(, IGT_PLANE_PRIMARY);
-- 
2.7.4