All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Exercise legacy interface to addfb2
@ 2018-09-05 10:05 Chris Wilson
  2018-09-05 10:18 ` Chris Wilson
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Chris Wilson @ 2018-09-05 10:05 UTC (permalink / raw)
  To: igt-dev

The legacy interface passes in a single handle, and instead of providing
the pixel_format fourcc, passes in a bpp/depth combination that the
kernel translates into a fourcc. If that is an illegal combination, the
kernel should be reporting EINVAL rather than pass an unknown
framebuffer to the drivers.

As the number of possible permutations of bpp/depth (both are strictly
u32 parameters) is huge, we simply fuzz the interface for 1s.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_addfb_basic.c | 103 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)

diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index 7d8852f02..b1b143f12 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -38,9 +38,35 @@
 #include "drm.h"
 #include "drm_fourcc.h"
 
+#include "igt_rand.h"
+
 uint32_t gem_bo;
 uint32_t gem_bo_small;
 
+static int legacy_addfb(int fd, struct drm_mode_fb_cmd *arg)
+{
+	int err;
+
+	err = 0;
+	if (igt_ioctl(fd, DRM_IOCTL_MODE_ADDFB, arg))
+		err = -errno;
+
+	errno = 0;
+	return err;
+}
+
+static int rmfb(int fd, uint32_t id)
+{
+	int err;
+
+	err = 0;
+	if (igt_ioctl(fd, DRM_IOCTL_MODE_RMFB, &id))
+		err = -errno;
+
+	errno = 0;
+	return err;
+}
+
 static void invalid_tests(int fd)
 {
 	struct local_drm_mode_fb_cmd2 f = {};
@@ -113,6 +139,83 @@ static void invalid_tests(int fd)
 		igt_assert(f.modifier[0] == 0);
 	}
 
+	igt_subtest("legacy-format") {
+		struct {
+			/* drm_mode_legacy_fb_format() */
+			int bpp, depth;
+			int expect;
+		} known_formats[] = {
+			{ 8, 0 },   /* palette */
+			{ 16, 15 }, /* x1r5g5b5 */
+			{ 16, 16 }, /* r5g6b5 */
+			{ 24, 24 }, /* r8g8b8 */
+			{ 32, 24 }, /* x8r8g8b8 */
+			{ 32, 30 }, /* x2r10g10b10 */
+			{ 32, 32 }, /* a2r10g10b10 */
+		};
+		struct drm_mode_fb_cmd arg = {
+			.width = f.width,
+			.height = f.height,
+			.pitch = f.pitches[0],
+			.handle = f.handles[0],
+		};
+		uint32_t prng = 0x12345678;
+
+		/*
+		 * First confirm the kernel recognises our known_formats;
+		 * some may be invalid for different devices.
+		 */
+		for (int i = 0; i < ARRAY_SIZE(known_formats); i++) {
+			arg.bpp = known_formats[i].bpp;
+			arg.depth = known_formats[i].depth;
+			known_formats[i].expect = legacy_addfb(fd, &arg);
+			igt_debug("(bpp:%d, depth:%d) -> expect:%d\n",
+				  arg.bpp, arg.depth, known_formats[i].expect);
+			if (arg.fb_id) {
+				igt_assert_eq(rmfb(fd, arg.fb_id), 0);
+				arg.fb_id = 0;
+			}
+		}
+
+		igt_until_timeout(1) {
+			int expect = -EINVAL;
+			int err;
+
+			arg.bpp = hars_petruska_f54_1_random(&prng);
+			arg.depth = hars_petruska_f54_1_random(&prng);
+			for (int start = 0, end = ARRAY_SIZE(known_formats);
+			     start < end; ) {
+				int mid = start + (end - start) / 2;
+				typeof(*known_formats) *tbl = &known_formats[mid];
+
+				if (arg.bpp < tbl->bpp) {
+					end = mid;
+				} else if (arg.bpp > tbl->bpp) {
+					start = mid + 1;
+				} else {
+					if (arg.depth < tbl->depth) {
+						end = mid;
+					} else if (arg.depth > tbl->depth) {
+						start = mid + 1;
+					} else {
+						expect = tbl->expect;
+						break;
+					}
+				}
+			}
+
+
+			err = legacy_addfb(fd, &arg);
+			igt_assert_f(err == expect,
+				     "Expected %d with (bpp:%d, depth:%d), got %d instead\n",
+				     expect, arg.bpp, arg.depth, err);
+			if (arg.fb_id) {
+				igt_assert_eq(rmfb(fd, arg.fb_id), 0);
+				arg.fb_id = 0;
+			}
+		}
+	}
+
 	igt_fixture {
 		gem_close(fd, gem_bo);
 		gem_close(fd, gem_bo_small);
-- 
2.19.0.rc1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Exercise legacy interface to addfb2
  2018-09-05 10:05 [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Exercise legacy interface to addfb2 Chris Wilson
@ 2018-09-05 10:18 ` Chris Wilson
  2018-09-05 12:45 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2018-09-05 10:18 UTC (permalink / raw)
  To: igt-dev

Quoting Chris Wilson (2018-09-05 11:05:22)
> The legacy interface passes in a single handle, and instead of providing
> the pixel_format fourcc, passes in a bpp/depth combination that the
> kernel translates into a fourcc. If that is an illegal combination, the
> kernel should be reporting EINVAL rather than pass an unknown
> framebuffer to the drivers.
> 
> As the number of possible permutations of bpp/depth (both are strictly
> u32 parameters) is huge, we simply fuzz the interface for 1s.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  tests/kms_addfb_basic.c | 103 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 103 insertions(+)
> 
> diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> index 7d8852f02..b1b143f12 100644
> --- a/tests/kms_addfb_basic.c
> +++ b/tests/kms_addfb_basic.c
> @@ -38,9 +38,35 @@
>  #include "drm.h"
>  #include "drm_fourcc.h"
>  
> +#include "igt_rand.h"
> +
>  uint32_t gem_bo;
>  uint32_t gem_bo_small;
>  
> +static int legacy_addfb(int fd, struct drm_mode_fb_cmd *arg)
> +{
> +       int err;
> +
> +       err = 0;
> +       if (igt_ioctl(fd, DRM_IOCTL_MODE_ADDFB, arg))
> +               err = -errno;
> +
> +       errno = 0;
> +       return err;
> +}
> +
> +static int rmfb(int fd, uint32_t id)
> +{
> +       int err;
> +
> +       err = 0;
> +       if (igt_ioctl(fd, DRM_IOCTL_MODE_RMFB, &id))
> +               err = -errno;
> +
> +       errno = 0;
> +       return err;
> +}
> +
>  static void invalid_tests(int fd)
>  {
>         struct local_drm_mode_fb_cmd2 f = {};
> @@ -113,6 +139,83 @@ static void invalid_tests(int fd)
>                 igt_assert(f.modifier[0] == 0);
>         }
>  
> +       igt_subtest("legacy-format") {
> +               struct {
> +                       /* drm_mode_legacy_fb_format() */
> +                       int bpp, depth;
> +                       int expect;
> +               } known_formats[] = {
> +                       { 8, 0 },   /* palette */
> +                       { 16, 15 }, /* x1r5g5b5 */
> +                       { 16, 16 }, /* r5g6b5 */

or a1r5g5b5

> +                       { 24, 24 }, /* r8g8b8 */
> +                       { 32, 24 }, /* x8r8g8b8 */
> +                       { 32, 30 }, /* x2r10g10b10 */
> +                       { 32, 32 }, /* a2r10g10b10 */

or a8r8g8b8

If I'm tagging them I might as well point out the ambiguity (hopefully
the rgb order is obvious enough).
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for igt/kms_addfb_basic: Exercise legacy interface to addfb2
  2018-09-05 10:05 [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Exercise legacy interface to addfb2 Chris Wilson
  2018-09-05 10:18 ` Chris Wilson
@ 2018-09-05 12:45 ` Patchwork
  2018-09-05 14:33 ` [igt-dev] [PATCH i-g-t] " Daniel Vetter
  2018-09-05 17:00 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
  3 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-09-05 12:45 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: igt/kms_addfb_basic: Exercise legacy interface to addfb2
URL   : https://patchwork.freedesktop.org/series/49176/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4770 -> IGTPW_1790 =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1790 need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1790, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/49176/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1790:

  === IGT changes ===

    ==== Warnings ====

    igt@pm_rpm@module-reload:
      fi-hsw-4770r:       SKIP -> PASS

    
== Known issues ==

  Here are the changes found in IGTPW_1790 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_suspend@basic-s3:
      fi-skl-caroline:    NOTRUN -> INCOMPLETE (fdo#107556, fdo#104108)

    igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
      fi-byt-clapper:     PASS -> FAIL (fdo#103191, fdo#107362)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-bxt-dsi:         PASS -> INCOMPLETE (fdo#103927)

    igt@kms_psr@primary_page_flip:
      fi-icl-u:           NOTRUN -> FAIL (fdo#107383) +3

    
    ==== Possible fixes ====

    igt@drv_module_reload@basic-reload-inject:
      fi-hsw-4770r:       DMESG-WARN (fdo#107425) -> PASS

    igt@gem_exec_suspend@basic-s4-devices:
      fi-kbl-7500u:       DMESG-WARN (fdo#107139, fdo#105128) -> PASS

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         FAIL (fdo#104008) -> PASS

    
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
  fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
  fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
  fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139
  fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
  fdo#107383 https://bugs.freedesktop.org/show_bug.cgi?id=107383
  fdo#107425 https://bugs.freedesktop.org/show_bug.cgi?id=107425
  fdo#107556 https://bugs.freedesktop.org/show_bug.cgi?id=107556


== Participating hosts (50 -> 49) ==

  Additional (4): fi-glk-j4005 fi-skl-caroline fi-icl-u fi-elk-e7500 
  Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 


== Build changes ==

    * IGT: IGT_4627 -> IGTPW_1790

  CI_DRM_4770: 0c3535cf60140d017a5df73d84d06e8b1a5b5d3b @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1790: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1790/
  IGT_4627: e0c3033a57d85c0d2eb33af0451afa16edc79f10 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@kms_addfb_basic@legacy-format

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1790/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Exercise legacy interface to addfb2
  2018-09-05 10:05 [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Exercise legacy interface to addfb2 Chris Wilson
  2018-09-05 10:18 ` Chris Wilson
  2018-09-05 12:45 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2018-09-05 14:33 ` Daniel Vetter
  2018-09-05 14:37   ` Chris Wilson
  2018-09-05 17:00 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
  3 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2018-09-05 14:33 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

On Wed, Sep 05, 2018 at 11:05:22AM +0100, Chris Wilson wrote:
> The legacy interface passes in a single handle, and instead of providing
> the pixel_format fourcc, passes in a bpp/depth combination that the
> kernel translates into a fourcc. If that is an illegal combination, the
> kernel should be reporting EINVAL rather than pass an unknown
> framebuffer to the drivers.
> 
> As the number of possible permutations of bpp/depth (both are strictly
> u32 parameters) is huge, we simply fuzz the interface for 1s.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  tests/kms_addfb_basic.c | 103 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 103 insertions(+)
> 
> diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> index 7d8852f02..b1b143f12 100644
> --- a/tests/kms_addfb_basic.c
> +++ b/tests/kms_addfb_basic.c
> @@ -38,9 +38,35 @@
>  #include "drm.h"
>  #include "drm_fourcc.h"
>  
> +#include "igt_rand.h"
> +
>  uint32_t gem_bo;
>  uint32_t gem_bo_small;
>  
> +static int legacy_addfb(int fd, struct drm_mode_fb_cmd *arg)
> +{
> +	int err;
> +
> +	err = 0;
> +	if (igt_ioctl(fd, DRM_IOCTL_MODE_ADDFB, arg))
> +		err = -errno;
> +
> +	errno = 0;
> +	return err;
> +}
> +
> +static int rmfb(int fd, uint32_t id)
> +{
> +	int err;
> +
> +	err = 0;
> +	if (igt_ioctl(fd, DRM_IOCTL_MODE_RMFB, &id))
> +		err = -errno;
> +
> +	errno = 0;
> +	return err;
> +}
> +
>  static void invalid_tests(int fd)
>  {
>  	struct local_drm_mode_fb_cmd2 f = {};
> @@ -113,6 +139,83 @@ static void invalid_tests(int fd)
>  		igt_assert(f.modifier[0] == 0);
>  	}
>  
> +	igt_subtest("legacy-format") {
> +		struct {
> +			/* drm_mode_legacy_fb_format() */
> +			int bpp, depth;
> +			int expect;
> +		} known_formats[] = {
> +			{ 8, 0 },   /* palette */

Apparently 8/8
> +			{ 16, 15 }, /* x1r5g5b5 */
> +			{ 16, 16 }, /* r5g6b5 */
> +			{ 24, 24 }, /* r8g8b8 */
> +			{ 32, 24 }, /* x8r8g8b8 */
> +			{ 32, 30 }, /* x2r10g10b10 */
> +			{ 32, 32 }, /* a2r10g10b10 */
> +		};
> +		struct drm_mode_fb_cmd arg = {
> +			.width = f.width,
> +			.height = f.height,
> +			.pitch = f.pitches[0],
> +			.handle = f.handles[0],
> +		};
> +		uint32_t prng = 0x12345678;
> +
> +		/*
> +		 * First confirm the kernel recognises our known_formats;
> +		 * some may be invalid for different devices.
> +		 */
> +		for (int i = 0; i < ARRAY_SIZE(known_formats); i++) {
> +			arg.bpp = known_formats[i].bpp;
> +			arg.depth = known_formats[i].depth;
> +			known_formats[i].expect = legacy_addfb(fd, &arg);
> +			igt_debug("(bpp:%d, depth:%d) -> expect:%d\n",
> +				  arg.bpp, arg.depth, known_formats[i].expect);
> +			if (arg.fb_id) {
> +				igt_assert_eq(rmfb(fd, arg.fb_id), 0);
> +				arg.fb_id = 0;
> +			}
> +		}
> +
> +		igt_until_timeout(1) {
> +			int expect = -EINVAL;
> +			int err;
> +
> +			arg.bpp = hars_petruska_f54_1_random(&prng);
> +			arg.depth = hars_petruska_f54_1_random(&prng);
> +			for (int start = 0, end = ARRAY_SIZE(known_formats);
> +			     start < end; ) {

The b-search is maybe a bit overkill for an array with 7 entries :-) I'd
simplify to a brute-force match.

> +				int mid = start + (end - start) / 2;
> +				typeof(*known_formats) *tbl = &known_formats[mid];
> +
> +				if (arg.bpp < tbl->bpp) {
> +					end = mid;
> +				} else if (arg.bpp > tbl->bpp) {
> +					start = mid + 1;
> +				} else {
> +					if (arg.depth < tbl->depth) {
> +						end = mid;
> +					} else if (arg.depth > tbl->depth) {
> +						start = mid + 1;
> +					} else {
> +						expect = tbl->expect;
> +						break;
> +					}
> +				}
> +			}
> +
> +
> +			err = legacy_addfb(fd, &arg);
> +			igt_assert_f(err == expect,
> +				     "Expected %d with (bpp:%d, depth:%d), got %d instead\n",
> +				     expect, arg.bpp, arg.depth, err);
> +			if (arg.fb_id) {
> +				igt_assert_eq(rmfb(fd, arg.fb_id), 0);
> +				arg.fb_id = 0;
> +			}
> +		}
> +	}

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +
>  	igt_fixture {
>  		gem_close(fd, gem_bo);
>  		gem_close(fd, gem_bo_small);
> -- 
> 2.19.0.rc1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Exercise legacy interface to addfb2
  2018-09-05 14:33 ` [igt-dev] [PATCH i-g-t] " Daniel Vetter
@ 2018-09-05 14:37   ` Chris Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2018-09-05 14:37 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: igt-dev

Quoting Daniel Vetter (2018-09-05 15:33:22)
> On Wed, Sep 05, 2018 at 11:05:22AM +0100, Chris Wilson wrote:
> > +     igt_subtest("legacy-format") {
> > +             struct {
> > +                     /* drm_mode_legacy_fb_format() */
> > +                     int bpp, depth;
> > +                     int expect;
> > +             } known_formats[] = {
> > +                     { 8, 0 },   /* palette */
> 
> Apparently 8/8

Indeed. The more we learn, the stranger things get.

> > +                     { 16, 15 }, /* x1r5g5b5 */
> > +                     { 16, 16 }, /* r5g6b5 */
> > +                     { 24, 24 }, /* r8g8b8 */
> > +                     { 32, 24 }, /* x8r8g8b8 */
> > +                     { 32, 30 }, /* x2r10g10b10 */
> > +                     { 32, 32 }, /* a2r10g10b10 */
> > +             };
> > +             struct drm_mode_fb_cmd arg = {
> > +                     .width = f.width,
> > +                     .height = f.height,
> > +                     .pitch = f.pitches[0],
> > +                     .handle = f.handles[0],
> > +             };
> > +             uint32_t prng = 0x12345678;
> > +
> > +             /*
> > +              * First confirm the kernel recognises our known_formats;
> > +              * some may be invalid for different devices.
> > +              */
> > +             for (int i = 0; i < ARRAY_SIZE(known_formats); i++) {
> > +                     arg.bpp = known_formats[i].bpp;
> > +                     arg.depth = known_formats[i].depth;
> > +                     known_formats[i].expect = legacy_addfb(fd, &arg);
> > +                     igt_debug("(bpp:%d, depth:%d) -> expect:%d\n",
> > +                               arg.bpp, arg.depth, known_formats[i].expect);
> > +                     if (arg.fb_id) {
> > +                             igt_assert_eq(rmfb(fd, arg.fb_id), 0);
> > +                             arg.fb_id = 0;
> > +                     }
> > +             }
> > +
> > +             igt_until_timeout(1) {
> > +                     int expect = -EINVAL;
> > +                     int err;
> > +
> > +                     arg.bpp = hars_petruska_f54_1_random(&prng);
> > +                     arg.depth = hars_petruska_f54_1_random(&prng);
> > +                     for (int start = 0, end = ARRAY_SIZE(known_formats);
> > +                          start < end; ) {
> 
> The b-search is maybe a bit overkill for an array with 7 entries :-) I'd
> simplify to a brute-force match.

You don't think Ville's going to add a thousand more distinct bpp/depth
later?
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for igt/kms_addfb_basic: Exercise legacy interface to addfb2
  2018-09-05 10:05 [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Exercise legacy interface to addfb2 Chris Wilson
                   ` (2 preceding siblings ...)
  2018-09-05 14:33 ` [igt-dev] [PATCH i-g-t] " Daniel Vetter
@ 2018-09-05 17:00 ` Patchwork
  3 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-09-05 17:00 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: igt/kms_addfb_basic: Exercise legacy interface to addfb2
URL   : https://patchwork.freedesktop.org/series/49176/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4627_full -> IGTPW_1790_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1790_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1790_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/49176/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1790_full:

  === IGT changes ===

    ==== Possible regressions ====

    {igt@kms_addfb_basic@legacy-format}:
      shard-hsw:          NOTRUN -> DMESG-FAIL
      shard-glk:          NOTRUN -> DMESG-FAIL
      shard-apl:          NOTRUN -> DMESG-FAIL
      shard-snb:          NOTRUN -> DMESG-FAIL

    
    ==== Warnings ====

    igt@kms_vblank@pipe-b-wait-idle:
      shard-snb:          PASS -> SKIP +2

    igt@perf_pmu@rc6:
      shard-kbl:          PASS -> SKIP

    
== Known issues ==

  Here are the changes found in IGTPW_1790_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_ctx_isolation@vcs1-s3:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665)

    igt@gem_exec_parallel@blt-contexts:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665, fdo#106023)

    igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
      shard-hsw:          PASS -> FAIL (fdo#105767)

    igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic:
      shard-glk:          NOTRUN -> FAIL (fdo#106509, fdo#105454)

    igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-spr-indfb-draw-pwrite:
      shard-glk:          PASS -> FAIL (fdo#103167)

    igt@kms_setmode@basic:
      shard-apl:          PASS -> FAIL (fdo#99912)

    igt@pm_rpm@system-suspend-modeset:
      shard-apl:          PASS -> INCOMPLETE (fdo#103927)

    igt@testdisplay:
      shard-glk:          PASS -> INCOMPLETE (k.org#198133, fdo#107093, fdo#103359)

    
    ==== Possible fixes ====

    igt@kms_plane@pixel-format-pipe-a-planes:
      shard-snb:          FAIL (fdo#107749) -> PASS

    igt@kms_rotation_crc@sprite-rotation-180:
      shard-snb:          FAIL (fdo#103925) -> PASS

    igt@perf@buffer-fill:
      shard-kbl:          INCOMPLETE (fdo#103665) -> PASS

    igt@prime_vgem@basic-write:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105454 https://bugs.freedesktop.org/show_bug.cgi?id=105454
  fdo#105767 https://bugs.freedesktop.org/show_bug.cgi?id=105767
  fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
  fdo#106509 https://bugs.freedesktop.org/show_bug.cgi?id=106509
  fdo#107093 https://bugs.freedesktop.org/show_bug.cgi?id=107093
  fdo#107749 https://bugs.freedesktop.org/show_bug.cgi?id=107749
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4627 -> IGTPW_1790
    * Linux: CI_DRM_4767 -> CI_DRM_4770

  CI_DRM_4767: e9b69bafd3c2c13a8b9fa8e7a410f5d5ef32e328 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4770: 0c3535cf60140d017a5df73d84d06e8b1a5b5d3b @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1790: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1790/
  IGT_4627: e0c3033a57d85c0d2eb33af0451afa16edc79f10 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1790/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Exercise legacy interface to addfb2
@ 2018-09-06  7:40 Chris Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2018-09-06  7:40 UTC (permalink / raw)
  To: igt-dev

The legacy interface passes in a single handle, and instead of providing
the pixel_format fourcc, passes in a bpp/depth combination that the
kernel translates into a fourcc. If that is an illegal combination, the
kernel should be reporting EINVAL rather than pass an unknown
framebuffer to the drivers.

As the number of possible permutations of bpp/depth (both are strictly
u32 parameters) is huge, we simply fuzz the interface for 1s.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 tests/kms_addfb_basic.c | 128 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 128 insertions(+)

diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index 7d8852f02..ce48d24fa 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -38,9 +38,35 @@
 #include "drm.h"
 #include "drm_fourcc.h"
 
+#include "igt_rand.h"
+
 uint32_t gem_bo;
 uint32_t gem_bo_small;
 
+static int legacy_addfb(int fd, struct drm_mode_fb_cmd *arg)
+{
+	int err;
+
+	err = 0;
+	if (igt_ioctl(fd, DRM_IOCTL_MODE_ADDFB, arg))
+		err = -errno;
+
+	errno = 0;
+	return err;
+}
+
+static int rmfb(int fd, uint32_t id)
+{
+	int err;
+
+	err = 0;
+	if (igt_ioctl(fd, DRM_IOCTL_MODE_RMFB, &id))
+		err = -errno;
+
+	errno = 0;
+	return err;
+}
+
 static void invalid_tests(int fd)
 {
 	struct local_drm_mode_fb_cmd2 f = {};
@@ -113,6 +139,108 @@ static void invalid_tests(int fd)
 		igt_assert(f.modifier[0] == 0);
 	}
 
+	igt_subtest("legacy-format") {
+		struct {
+			/* drm_mode_legacy_fb_format() */
+			int bpp, depth;
+			int expect;
+		} known_formats[] = {
+			{  8,  8 }, /* c8 (palette) */
+			{ 16, 15 }, /* x1r5g5b5 */
+			{ 16, 16 }, /* r5g6b5 or a1r5g5b5! */
+			{ 24, 24 }, /* r8g8b8 */
+			{ 32, 24 }, /* x8r8g8b8 */
+			{ 32, 30 }, /* x2r10g10b10 */
+			{ 32, 32 }, /* a8r8g8b8 or a2r10g10b10! */
+		};
+		struct drm_mode_fb_cmd arg = {
+			.handle = f.handles[0],
+			.width  = f.width,
+			.height = f.height,
+			.pitch  = f.pitches[0],
+		};
+		uint32_t prng = 0x12345678;
+		unsigned long timeout = 1;
+		unsigned long count = 0;
+
+		/*
+		 * First confirm the kernel recognises our known_formats;
+		 * some may be invalid for different devices.
+		 */
+		for (int i = 0; i < ARRAY_SIZE(known_formats); i++) {
+			arg.bpp = known_formats[i].bpp;
+			arg.depth = known_formats[i].depth;
+			known_formats[i].expect = legacy_addfb(fd, &arg);
+			igt_debug("{bpp:%d, depth:%d} -> expect:%d\n",
+				  arg.bpp, arg.depth, known_formats[i].expect);
+			if (arg.fb_id) {
+				igt_assert_eq(rmfb(fd, arg.fb_id), 0);
+				arg.fb_id = 0;
+			}
+		}
+
+		igt_until_timeout(timeout) {
+			int expect = -EINVAL;
+			int err;
+
+			arg.bpp = hars_petruska_f54_1_random(&prng);
+			arg.depth = hars_petruska_f54_1_random(&prng);
+			for (int start = 0, end = ARRAY_SIZE(known_formats);
+			     start < end; ) {
+				int mid = start + (end - start) / 2;
+				typeof(*known_formats) *tbl = &known_formats[mid];
+
+				if (arg.bpp < tbl->bpp) {
+					end = mid;
+				} else if (arg.bpp > tbl->bpp) {
+					start = mid + 1;
+				} else {
+					if (arg.depth < tbl->depth) {
+						end = mid;
+					} else if (arg.depth > tbl->depth) {
+						start = mid + 1;
+					} else {
+						expect = tbl->expect;
+						break;
+					}
+				}
+			}
+
+			err = legacy_addfb(fd, &arg);
+			igt_assert_f(err == expect,
+				     "Expected %d with {bpp:%d, depth:%d}, got %d instead\n",
+				     expect, arg.bpp, arg.depth, err);
+			if (arg.fb_id) {
+				igt_assert_eq(rmfb(fd, arg.fb_id), 0);
+				arg.fb_id = 0;
+			}
+
+			count++;
+		}
+
+		/* After all the abuse, confirm the known_formats */
+		for (int i = 0; i < ARRAY_SIZE(known_formats); i++) {
+			int err;
+
+			arg.bpp = known_formats[i].bpp;
+			arg.depth = known_formats[i].depth;
+
+			err = legacy_addfb(fd, &arg);
+			igt_assert_f(err == known_formats[i].expect,
+				     "Expected %d with {bpp:%d, depth:%d}, got %d instead\n",
+				     known_formats[i].expect,
+				     arg.bpp, arg.depth,
+				     err);
+			if (arg.fb_id) {
+				igt_assert_eq(rmfb(fd, arg.fb_id), 0);
+				arg.fb_id = 0;
+			}
+		}
+
+		igt_info("Successfully fuzzed %lu {bpp, depth} variations\n",
+			 count);
+	}
+
 	igt_fixture {
 		gem_close(fd, gem_bo);
 		gem_close(fd, gem_bo_small);
-- 
2.19.0.rc2

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-09-06  7:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-05 10:05 [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Exercise legacy interface to addfb2 Chris Wilson
2018-09-05 10:18 ` Chris Wilson
2018-09-05 12:45 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-09-05 14:33 ` [igt-dev] [PATCH i-g-t] " Daniel Vetter
2018-09-05 14:37   ` Chris Wilson
2018-09-05 17:00 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
2018-09-06  7:40 [igt-dev] [PATCH i-g-t] " Chris Wilson

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.