Skip to contentSkip to conversation

lib/igt_debugfs: Add igt_pipe_crc_get_current() to get a crc.

PATCH In review Maarten Lankhorst 4 participants 9 messages Jul 24, 2018 – Aug 14, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 lib/igt_debugfs: Add igt_pipe_crc_get_current() to get a crc.

A pair of igt_pipe_crc_drain() and igt_pipe_crc_get_single() has a bug in which you're not sure whether the new CRC is captured because the vblank irq may race against the CRC irq and delivered to userspace too soon.

When receiving a vblank event, igt_pipe_crc_drain() will then drain all crc's, but not the new (stale) crc, which is then delivered and immediately returned by igt_pipe_crc_get_single().

---
 lib/igt_debugfs.c | 32 +++++++++++++++++++++++++++++++-
 lib/igt_debugfs.h |  2 ++
 2 files changed, 33 insertions(+), 1 deletion(-)
lib/igt_debugfs.c +31 -1
index f3196f4341f3..dc2c7df9da30 100644
@@ -910,7 +910,7 @@ void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc)
  * look at igt_pipe_crc_collect_crc().
  *
  * If capturing has been going on for a while and a fresh crc is required,
- * you will need to call igt_pipe_crc_drain() first to remove stale entries.
+ * you should use igt_pipe_crc_get_current() instead.
  *
  * Returns:
  * Whether a crc is captured, only false in non-blocking mode.
@@ -933,6 +933,36 @@ igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
 	return found;
 }
 
+/**
+ * igt_pipe_crc_get_current:
+ * @drm_fd: Pointer to drm fd for vblank counter
+ * @pipe_crc: pipe CRC object
+ * @crc: buffer pointer for the captured CRC value
+ *
+ * Same as igt_pipe_crc_get_single(), but will wait until a new CRC can be captured.
+ * This is useful for retrieving the current CRC in a more race free way than
+ * igt_pipe_crc_drain() + igt_pipe_crc_get_single().
+ */
+void
+igt_pipe_crc_get_current(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
+{
+	unsigned vblank = kmstest_get_vblank(drm_fd, pipe_crc->pipe, 0);
+
+	igt_assert(!(pipe_crc->flags & O_NONBLOCK));
+	do {
+		read_one_crc(pipe_crc, crc);
+
+		/* Only works with valid frame counter */
+		if (!crc->has_valid_frame) {
+			igt_pipe_crc_drain(pipe_crc);
+			igt_pipe_crc_get_single(pipe_crc, crc);
+			return;
+		}
+	} while (crc->frame <= vblank);
+
+	crc_sanity_checks(crc);
+}
+
 /*
  * Drop caches
  */
lib/igt_debugfs.h +2 -0
index 8d25abfe43c1..db634a827290 100644
@@ -132,6 +132,8 @@ int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
 			  igt_crc_t **out_crcs);
 void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc);
 bool igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
+void igt_pipe_crc_get_current(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc);
+
 void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
 
 void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
Signature · 6 lines
2.18.0

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

PATCH 2/3 tests: Replace calls to igt_pipe_crc_drain + get_single with igt_pipe_crc_get_current()

This is a more race free of accomplishing the same.

---
 tests/kms_available_modes_crc.c |  3 +--
 tests/kms_cursor_legacy.c       |  3 +--
 tests/kms_plane.c               |  6 +-----
 tests/kms_plane_lowres.c        |  6 ++----
 tests/kms_plane_multiple.c      |  3 +--
 tests/kms_rotation_crc.c        | 13 +++++--------
 6 files changed, 11 insertions(+), 23 deletions(-)
tests/kms_available_modes_crc.c +1 -2
index b70ef5d7d4c0..69a6a37d8ebd 100644
@@ -400,8 +400,7 @@ test_one_mode(data_t* data, igt_output_t *output, igt_plane_t* plane,
 		igt_display_commit2(&data->display, data->commit);
 
 		if (do_crc) {
-			igt_pipe_crc_drain(data->pipe_crc);
-			igt_pipe_crc_get_single(data->pipe_crc, &current_crc);
+			igt_pipe_crc_get_current(data->gfx_fd, data->pipe_crc, &current_crc);
 
 			if (plane->type != DRM_PLANE_TYPE_CURSOR) {
 				if (!igt_check_crc_equal(&current_crc,
tests/kms_cursor_legacy.c +1 -2
index 85340d43e5b6..82ceebcb0809 100644
@@ -1334,8 +1334,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
 
 		igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
 
-		igt_pipe_crc_drain(pipe_crc);
-		igt_pipe_crc_get_single(pipe_crc, &test_crc);
+		igt_pipe_crc_get_current(display->drm_fd, pipe_crc, &test_crc);
 
 		igt_spin_batch_free(display->drm_fd, spin);
 
tests/kms_plane.c +1 -5
index f9e123f0d1ea..3999dde8f694 100644
@@ -419,11 +419,7 @@ static void test_format_plane_color(data_t *data, enum pipe pipe,
 	igt_plane_set_fb(plane, fb);
 
 	igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
-
-	/* make sure the crc we get is for the new fb */
-	igt_wait_for_vblank(data->drm_fd, pipe);
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, crc);
+	igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc, crc);
 
 	igt_remove_fb(data->drm_fd, &old_fb);
 }
tests/kms_plane_lowres.c +2 -4
index d1e4b3ca536e..5e83ef5630b5 100644
@@ -221,8 +221,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 	check_mode(&mode_lowres, mode2);
 
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
-	igt_pipe_crc_drain(pipe_crc);
-	igt_pipe_crc_get_single(pipe_crc, &crc_lowres);
+	igt_pipe_crc_get_current(data->display.drm_fd, pipe_crc, &crc_lowres);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, false);
 
@@ -236,8 +235,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
-	igt_pipe_crc_drain(pipe_crc);
-	igt_pipe_crc_get_single(pipe_crc, &crc_hires2);
+	igt_pipe_crc_get_current(data->display.drm_fd, pipe_crc, &crc_hires2);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, true);
 
tests/kms_plane_multiple.c +1 -2
index e61bc84624b3..a53be00141f0 100644
@@ -276,8 +276,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 		igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
-		igt_pipe_crc_drain(data->pipe_crc);
-		igt_pipe_crc_get_single(data->pipe_crc, &crc);
+		igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc, &crc);
 
 		igt_assert_crc_equal(&data->ref_crc, &crc);
 
tests/kms_rotation_crc.c +5 -8
index 6cb5858adb0f..b994cc5d24fe 100644
@@ -235,8 +235,8 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	if (plane->type != DRM_PLANE_TYPE_CURSOR)
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 	igt_display_commit2(display, COMMIT_ATOMIC);
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, &data->flip_crc);
+
+	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->flip_crc);
 
 	/*
 	  * Prepare the non-rotated flip fb.
@@ -259,8 +259,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 	igt_display_commit2(display, COMMIT_ATOMIC);
 
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, &data->ref_crc);
+	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->ref_crc);
 
 	/*
 	 * Prepare the non-rotated reference fb.
@@ -310,8 +309,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 	igt_assert_eq(ret, 0);
 
 	/* Check CRC */
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
+	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
 	igt_assert_crc_equal(&data->ref_crc, &crc_output);
 
 	/*
@@ -334,8 +332,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 			igt_assert_eq(ret, 0);
 		}
 		kmstest_wait_for_pageflip(data->gfx_fd);
-		igt_pipe_crc_drain(data->pipe_crc);
-		igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
+		igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
 		igt_assert_crc_equal(&data->flip_crc,
 				     &crc_output);
 	}
Signature · 6 lines
2.18.0

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#4 lore raw

PATCH 3/3 tests/kms_nv12: Add nv12 specific tests.

In reply to Maarten Lankhorst

Add tests excercising switching between various scaled/unscaled transitions to and from NV12, since some of the workarounds mention this may fail.

We also add NV12 specific clipping/scaling tests, to make sure that NV12 src coordinates are always programmed as a multiple of 4 correctly, and verify scaling/clipping works with CRC tests.

---
 tests/Makefile.sources |   1 +
 tests/kms_nv12.c       | 743 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 745 insertions(+)
 create mode 100644 tests/kms_nv12.c
tests/Makefile.sources +1 -0
index c84933f1d971..dab9260f584d 100644
@@ -190,6 +190,7 @@ TESTS_progs = \
 	kms_invalid_dotclock \
 	kms_legacy_colorkey \
 	kms_mmap_write_crc \
+	kms_nv12 \
 	kms_panel_fitting \
 	kms_pipe_b_c_ivb \
 	kms_pipe_crc_basic \
tests/kms_nv12.c new file +743 -0

743 lines not on this page · raw message

tests/meson.build +1 -0
index 32c2156c6f4d..e5fab06bc2f2 100644
@@ -166,6 +166,7 @@ test_progs = [
 	'kms_invalid_dotclock',
 	'kms_legacy_colorkey',
 	'kms_mmap_write_crc',
+	'kms_nv12',
 	'kms_panel_fitting',
 	'kms_pipe_b_c_ivb',
 	'kms_pipe_crc_basic',
Signature · 6 lines
2.18.0

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#7 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib/igt_debugfs: Add igt_pipe_crc_get_current() to get a crc.

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: series starting with [i-g-t,1/3] lib/igt_debugfs: Add igt_pipe_crc_get_current() to get a crc.
URL : https://patchwork.freedesktop.org/series/47129/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4534 -> IGTPW_1641 =

== Summary - SUCCESS ==

No regressions found.

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

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_chamelium@dp-edid-read:
      fi-kbl-7500u:       PASS -> FAIL (fdo#103841)

    igt@kms_flip@basic-flip-vs-wf_vblank:
      {fi-bsw-kefka}:     PASS -> FAIL (fdo#100368)

    
    ==== Possible fixes ====

    igt@gem_exec_flush@basic-wb-ro-default:
      fi-glk-j4005:       DMESG-WARN (fdo#105719) -> PASS

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

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

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#105719 https://bugs.freedesktop.org/show_bug.cgi?id=105719

== Participating hosts (52 -> 44) ==

Missing (8): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-skl-caroline fi-byt-clapper fi-bdw-samus

== Build changes ==

* IGT: IGT_4572 -> IGTPW_1641

CI_DRM_4534: a59bbda34ede6f5685fdc86b58f143bada751617 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1641: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1641/
IGT_4572: 9b064015df14506b23cd2d7245a73e1b1d16ee1f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Testlist changes ==

+igt@kms_nv12@pipe-a-nv12-chroma-subpixel-clip
+igt@kms_nv12@pipe-a-nv12-crop-scale-bug
+igt@kms_nv12@pipe-a-nv12-rgb-scaled-switch
+igt@kms_nv12@pipe-a-nv12-rgb-switch
+igt@kms_nv12@pipe-a-nv12-valid-width
+igt@kms_nv12@pipe-b-nv12-chroma-subpixel-clip
+igt@kms_nv12@pipe-b-nv12-crop-scale-bug
+igt@kms_nv12@pipe-b-nv12-rgb-scaled-switch
+igt@kms_nv12@pipe-b-nv12-rgb-switch
+igt@kms_nv12@pipe-b-nv12-valid-width
+igt@kms_nv12@pipe-c-nv12-chroma-subpixel-clip
+igt@kms_nv12@pipe-c-nv12-crop-scale-bug
+igt@kms_nv12@pipe-c-nv12-rgb-scaled-switch
+igt@kms_nv12@pipe-c-nv12-rgb-switch
+igt@kms_nv12@pipe-c-nv12-valid-width
+igt@kms_nv12@pipe-d-nv12-chroma-subpixel-clip
+igt@kms_nv12@pipe-d-nv12-crop-scale-bug
+igt@kms_nv12@pipe-d-nv12-rgb-scaled-switch
+igt@kms_nv12@pipe-d-nv12-rgb-switch
+igt@kms_nv12@pipe-d-nv12-valid-width
+igt@kms_nv12@pipe-e-nv12-chroma-subpixel-clip
+igt@kms_nv12@pipe-e-nv12-crop-scale-bug
+igt@kms_nv12@pipe-e-nv12-rgb-scaled-switch
+igt@kms_nv12@pipe-e-nv12-rgb-switch
+igt@kms_nv12@pipe-e-nv12-valid-width
+igt@kms_nv12@pipe-f-nv12-chroma-subpixel-clip
+igt@kms_nv12@pipe-f-nv12-crop-scale-bug
+igt@kms_nv12@pipe-f-nv12-rgb-scaled-switch
+igt@kms_nv12@pipe-f-nv12-rgb-switch
+igt@kms_nv12@pipe-f-nv12-valid-width

== Logs ==

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

#8 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/3] lib/igt_debugfs: Add igt_pipe_crc_get_current() to get a crc.

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: series starting with [i-g-t,1/3] lib/igt_debugfs: Add igt_pipe_crc_get_current() to get a crc.
URL : https://patchwork.freedesktop.org/series/47129/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4572_full -> IGTPW_1641_full =

== Summary - WARNING ==

Minor unknown changes coming with IGTPW_1641_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_1641_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/47129/revisions/1/mbox/

== Possible new issues ==

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

=== IGT changes ===

    ==== Possible regressions ====

    {igt@kms_nv12@pipe-a-nv12-chroma-subpixel-clip}:
      shard-kbl:          NOTRUN -> DMESG-FAIL +3

    {igt@kms_nv12@pipe-a-nv12-crop-scale-bug}:
      shard-glk:          NOTRUN -> WARN +2

    {igt@kms_nv12@pipe-b-nv12-chroma-subpixel-clip}:
      shard-glk:          NOTRUN -> DMESG-FAIL +2

    {igt@kms_nv12@pipe-b-nv12-crop-scale-bug}:
      shard-kbl:          NOTRUN -> WARN +1

    
    ==== Warnings ====

    igt@gem_exec_schedule@deep-blt:
      shard-apl:          SKIP -> PASS +3

    igt@gem_exec_schedule@deep-bsd:
      shard-glk:          SKIP -> PASS +3

    igt@gem_exec_schedule@deep-bsd1:
      shard-kbl:          SKIP -> PASS +2

    igt@pm_rc6_residency@rc6-accuracy:
      shard-snb:          PASS -> SKIP

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

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

    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#105454, fdo#106509)

    igt@kms_flip@2x-blocking-wf_vblank:
      shard-glk:          PASS -> FAIL (fdo#100368)

    igt@kms_flip@2x-flip-vs-expired-vblank:
      shard-glk:          PASS -> FAIL (fdo#105363)

    igt@kms_flip@flip-vs-expired-vblank:
      shard-glk:          PASS -> FAIL (fdo#105363, fdo#102887)

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

    igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665)

    
    ==== Possible fixes ====

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

    igt@kms_flip@plain-flip-ts-check:
      shard-glk:          FAIL (fdo#100368) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      shard-kbl:          INCOMPLETE (fdo#103665) -> PASS

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

    igt@kms_universal_plane@cursor-fb-leak-pipe-a:
      shard-apl:          FAIL (fdo#107241) -> PASS

    igt@perf_pmu@rc6-runtime-pm-long:
      shard-kbl:          FAIL (fdo#105010) -> PASS

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

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#105010 https://bugs.freedesktop.org/show_bug.cgi?id=105010
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
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#107241 https://bugs.freedesktop.org/show_bug.cgi?id=107241
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

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

No changes in participating hosts

== Build changes ==

* IGT: IGT_4572 -> IGTPW_1641
* Linux: CI_DRM_4533 -> CI_DRM_4534

CI_DRM_4533: 712e7047cfc7a129df6d324f59cc5d4eb2879285 @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4534: a59bbda34ede6f5685fdc86b58f143bada751617 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1641: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1641/
IGT_4572: 9b064015df14506b23cd2d7245a73e1b1d16ee1f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

#5 lore raw

Re: [igt-dev] [PATCH i-g-t 3/3] tests/kms_nv12: Add nv12 specific tests.

In reply to Maarten Lankhorst
Quoted 34 lines · Maarten Lankhorst

Add tests excercising switching between various scaled/unscaled transitions to and from NV12, since some of the workarounds mention this may fail.

We also add NV12 specific clipping/scaling tests, to make sure that NV12 src coordinates are always programmed as a multiple of 4 correctly, and verify scaling/clipping works with CRC tests.

---
 tests/Makefile.sources |   1 +
 tests/kms_nv12.c       | 743 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 745 insertions(+)
 create mode 100644 tests/kms_nv12.c
tests/Makefile.sources +1 -0
index c84933f1d971..dab9260f584d 100644
@@ -190,6 +190,7 @@ TESTS_progs = \
 	kms_invalid_dotclock \
 	kms_legacy_colorkey \
 	kms_mmap_write_crc \
+	kms_nv12 \
 	kms_panel_fitting \
 	kms_pipe_b_c_ivb \
 	kms_pipe_crc_basic \
tests/kms_nv12.c new file +0 -0
new file mode 100644
index 000000000000..05ae83e53dda

tests/kms_nv12.c line 2

Quoted 2 lines
tests/kms_nv12.c new file +2 -0
@@ -0,0 +1,743 @@
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a

Where's the copyright line?

Signature · 5 lines
Petri Latvala
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#6 lore raw

Re: [igt-dev] [PATCH i-g-t 3/3] tests/kms_nv12: Add nv12 specific tests.

Op 26-07-18 om 08:55 schreef Petri Latvala:

Quoted 31 lines · Maarten Lankhorst
Quoted 30 lines

Add tests excercising switching between various scaled/unscaled transitions to and from NV12, since some of the workarounds mention this may fail.

We also add NV12 specific clipping/scaling tests, to make sure that NV12 src coordinates are always programmed as a multiple of 4 correctly, and verify scaling/clipping works with CRC tests.

---
 tests/Makefile.sources |   1 +
 tests/kms_nv12.c       | 743 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 745 insertions(+)
 create mode 100644 tests/kms_nv12.c
tests/Makefile.sources +1 -0
index c84933f1d971..dab9260f584d 100644
@@ -190,6 +190,7 @@ TESTS_progs = \
 	kms_invalid_dotclock \
 	kms_legacy_colorkey \
 	kms_mmap_write_crc \
+	kms_nv12 \
 	kms_panel_fitting \
 	kms_pipe_b_c_ivb \
 	kms_pipe_crc_basic \
tests/kms_nv12.c new file +0 -0
new file mode 100644
Quoted 11 lines

tests/kms_nv12.c line 2

Quoted 6 lines

index 000000000000..05ae83e53dda

tests/kms_nv12.c new file +2 -0
@@ -0,0 +1,743 @@
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a

Where's the copyright line?

Indeed, good catch. :)

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw

Re: [igt-dev] [PATCH i-g-t 2/3] tests: Replace calls to igt_pipe_crc_drain + get_single with igt_pipe_crc_get_current()

In reply to Maarten Lankhorst
Quoted 3 lines · Maarten Lankhorst

This is a more race free of accomplishing the same.

Grep says you missed a few. I'd also go even further and entirely remove igt_pipe_crc_get_single - the only place it's safe to call is right after _start, and there there's not really a functional difference between get_single and get_current.

Anyway, on patch 1: Reviewed-by: Daniel Vetter <[email protected]>

Also Reviewed-by: Daniel Vetter <[email protected]> if you respin this one here to convert all places where we have drain+get_single. -Daniel

Quoted 144 lines
---
 tests/kms_available_modes_crc.c |  3 +--
 tests/kms_cursor_legacy.c       |  3 +--
 tests/kms_plane.c               |  6 +-----
 tests/kms_plane_lowres.c        |  6 ++----
 tests/kms_plane_multiple.c      |  3 +--
 tests/kms_rotation_crc.c        | 13 +++++--------
 6 files changed, 11 insertions(+), 23 deletions(-)
tests/kms_available_modes_crc.c +1 -2
index b70ef5d7d4c0..69a6a37d8ebd 100644
@@ -400,8 +400,7 @@ test_one_mode(data_t* data, igt_output_t *output, igt_plane_t* plane,
 		igt_display_commit2(&data->display, data->commit);
 
 		if (do_crc) {
-			igt_pipe_crc_drain(data->pipe_crc);
-			igt_pipe_crc_get_single(data->pipe_crc, &current_crc);
+			igt_pipe_crc_get_current(data->gfx_fd, data->pipe_crc, &current_crc);
 
 			if (plane->type != DRM_PLANE_TYPE_CURSOR) {
 				if (!igt_check_crc_equal(&current_crc,
tests/kms_cursor_legacy.c +1 -2
index 85340d43e5b6..82ceebcb0809 100644
@@ -1334,8 +1334,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
 
 		igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
 
-		igt_pipe_crc_drain(pipe_crc);
-		igt_pipe_crc_get_single(pipe_crc, &test_crc);
+		igt_pipe_crc_get_current(display->drm_fd, pipe_crc, &test_crc);
 
 		igt_spin_batch_free(display->drm_fd, spin);
 
tests/kms_plane.c +1 -5
index f9e123f0d1ea..3999dde8f694 100644
@@ -419,11 +419,7 @@ static void test_format_plane_color(data_t *data, enum pipe pipe,
 	igt_plane_set_fb(plane, fb);
 
 	igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
-
-	/* make sure the crc we get is for the new fb */
-	igt_wait_for_vblank(data->drm_fd, pipe);
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, crc);
+	igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc, crc);
 
 	igt_remove_fb(data->drm_fd, &old_fb);
 }
tests/kms_plane_lowres.c +2 -4
index d1e4b3ca536e..5e83ef5630b5 100644
@@ -221,8 +221,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 	check_mode(&mode_lowres, mode2);
 
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
-	igt_pipe_crc_drain(pipe_crc);
-	igt_pipe_crc_get_single(pipe_crc, &crc_lowres);
+	igt_pipe_crc_get_current(data->display.drm_fd, pipe_crc, &crc_lowres);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, false);
 
@@ -236,8 +235,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
-	igt_pipe_crc_drain(pipe_crc);
-	igt_pipe_crc_get_single(pipe_crc, &crc_hires2);
+	igt_pipe_crc_get_current(data->display.drm_fd, pipe_crc, &crc_hires2);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, true);
 
tests/kms_plane_multiple.c +1 -2
index e61bc84624b3..a53be00141f0 100644
@@ -276,8 +276,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 		igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
-		igt_pipe_crc_drain(data->pipe_crc);
-		igt_pipe_crc_get_single(data->pipe_crc, &crc);
+		igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc, &crc);
 
 		igt_assert_crc_equal(&data->ref_crc, &crc);
 
tests/kms_rotation_crc.c +5 -8
index 6cb5858adb0f..b994cc5d24fe 100644
@@ -235,8 +235,8 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	if (plane->type != DRM_PLANE_TYPE_CURSOR)
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 	igt_display_commit2(display, COMMIT_ATOMIC);
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, &data->flip_crc);
+
+	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->flip_crc);
 
 	/*
 	  * Prepare the non-rotated flip fb.
@@ -259,8 +259,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 	igt_display_commit2(display, COMMIT_ATOMIC);
 
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, &data->ref_crc);
+	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->ref_crc);
 
 	/*
 	 * Prepare the non-rotated reference fb.
@@ -310,8 +309,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 	igt_assert_eq(ret, 0);
 
 	/* Check CRC */
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
+	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
 	igt_assert_crc_equal(&data->ref_crc, &crc_output);
 
 	/*
@@ -334,8 +332,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 			igt_assert_eq(ret, 0);
 		}
 		kmstest_wait_for_pageflip(data->gfx_fd);
-		igt_pipe_crc_drain(data->pipe_crc);
-		igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
+		igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
 		igt_assert_crc_equal(&data->flip_crc,
 				     &crc_output);
 	}
Signature · 6 lines
2.18.0

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#3 lore raw

Re: [igt-dev] [PATCH i-g-t 2/3] tests: Replace calls to igt_pipe_crc_drain + get_single with igt_pipe_crc_get_current()

Op 14-08-18 om 17:18 schreef Daniel Vetter:

Quoted 9 lines · Maarten Lankhorst
Quoted 3 lines

This is a more race free of accomplishing the same.

Grep says you missed a few. I'd also go even further and entirely remove igt_pipe_crc_get_single - the only place it's safe to call is right after _start, and there there's not really a functional difference between get_single and get_current.

Quoted 5 lines

Anyway, on patch 1: Reviewed-by: Daniel Vetter <[email protected]>

Also Reviewed-by: Daniel Vetter <[email protected]> if you respin this one here to convert all places where we have drain+get_single. -Daniel

Thanks, pushed both with fixes :)

Quoted 140 lines
Quoted 140 lines
---
 tests/kms_available_modes_crc.c |  3 +--
 tests/kms_cursor_legacy.c       |  3 +--
 tests/kms_plane.c               |  6 +-----
 tests/kms_plane_lowres.c        |  6 ++----
 tests/kms_plane_multiple.c      |  3 +--
 tests/kms_rotation_crc.c        | 13 +++++--------
 6 files changed, 11 insertions(+), 23 deletions(-)
tests/kms_available_modes_crc.c +1 -2
index b70ef5d7d4c0..69a6a37d8ebd 100644
@@ -400,8 +400,7 @@ test_one_mode(data_t* data, igt_output_t *output, igt_plane_t* plane,
 		igt_display_commit2(&data->display, data->commit);
 
 		if (do_crc) {
-			igt_pipe_crc_drain(data->pipe_crc);
-			igt_pipe_crc_get_single(data->pipe_crc, &current_crc);
+			igt_pipe_crc_get_current(data->gfx_fd, data->pipe_crc, &current_crc);
 
 			if (plane->type != DRM_PLANE_TYPE_CURSOR) {
 				if (!igt_check_crc_equal(&current_crc,
tests/kms_cursor_legacy.c +1 -2
index 85340d43e5b6..82ceebcb0809 100644
@@ -1334,8 +1334,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
 
 		igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
 
-		igt_pipe_crc_drain(pipe_crc);
-		igt_pipe_crc_get_single(pipe_crc, &test_crc);
+		igt_pipe_crc_get_current(display->drm_fd, pipe_crc, &test_crc);
 
 		igt_spin_batch_free(display->drm_fd, spin);
 
tests/kms_plane.c +1 -5
index f9e123f0d1ea..3999dde8f694 100644
@@ -419,11 +419,7 @@ static void test_format_plane_color(data_t *data, enum pipe pipe,
 	igt_plane_set_fb(plane, fb);
 
 	igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
-
-	/* make sure the crc we get is for the new fb */
-	igt_wait_for_vblank(data->drm_fd, pipe);
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, crc);
+	igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc, crc);
 
 	igt_remove_fb(data->drm_fd, &old_fb);
 }
tests/kms_plane_lowres.c +2 -4
index d1e4b3ca536e..5e83ef5630b5 100644
@@ -221,8 +221,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 	check_mode(&mode_lowres, mode2);
 
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
-	igt_pipe_crc_drain(pipe_crc);
-	igt_pipe_crc_get_single(pipe_crc, &crc_lowres);
+	igt_pipe_crc_get_current(data->display.drm_fd, pipe_crc, &crc_lowres);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, false);
 
@@ -236,8 +235,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
-	igt_pipe_crc_drain(pipe_crc);
-	igt_pipe_crc_get_single(pipe_crc, &crc_hires2);
+	igt_pipe_crc_get_current(data->display.drm_fd, pipe_crc, &crc_hires2);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, true);
 
tests/kms_plane_multiple.c +1 -2
index e61bc84624b3..a53be00141f0 100644
@@ -276,8 +276,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 		igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
-		igt_pipe_crc_drain(data->pipe_crc);
-		igt_pipe_crc_get_single(data->pipe_crc, &crc);
+		igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc, &crc);
 
 		igt_assert_crc_equal(&data->ref_crc, &crc);
 
tests/kms_rotation_crc.c +5 -8
index 6cb5858adb0f..b994cc5d24fe 100644
@@ -235,8 +235,8 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	if (plane->type != DRM_PLANE_TYPE_CURSOR)
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 	igt_display_commit2(display, COMMIT_ATOMIC);
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, &data->flip_crc);
+
+	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->flip_crc);
 
 	/*
 	  * Prepare the non-rotated flip fb.
@@ -259,8 +259,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 	igt_display_commit2(display, COMMIT_ATOMIC);
 
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, &data->ref_crc);
+	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->ref_crc);
 
 	/*
 	 * Prepare the non-rotated reference fb.
@@ -310,8 +309,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 	igt_assert_eq(ret, 0);
 
 	/* Check CRC */
-	igt_pipe_crc_drain(data->pipe_crc);
-	igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
+	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
 	igt_assert_crc_equal(&data->ref_crc, &crc_output);
 
 	/*
@@ -334,8 +332,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 			igt_assert_eq(ret, 0);
 		}
 		kmstest_wait_for_pageflip(data->gfx_fd);
-		igt_pipe_crc_drain(data->pipe_crc);
-		igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
+		igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
 		igt_assert_crc_equal(&data->flip_crc,
 				     &crc_output);
 	}
Signature · 1 line
2.18.0
Quoted 4 lines
Quoted 4 lines

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev