* [PATCH i-g-t] tests: Add kms_atomic_interruptible test, v2.
@ 2017-09-06 12:30 Maarten Lankhorst
2017-09-06 12:50 ` ✗ Fi.CI.BAT: warning for " Patchwork
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Maarten Lankhorst @ 2017-09-06 12:30 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Stone
This tests the various parts of atomic that I want to make
interruptible. Running with --debug shows the stats from
__igt_sigiter_continue, which can be used to make sure that
we don't fall over.
The default igt kms helpers use drmIoctl, which is not intercepted
by igt_while_interruptible. Only igt_ioctl is. This means we have
to call the ioctls manually here.
Changes since v1:
- Implement interruptible DPMS checking too.
- Use igt_ioctl + igt_while_interruptible, instead of the signal helper
shotgun.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Stone <daniels@collabora.com>
---
lib/igt_kms.c | 3 +-
lib/igt_kms.h | 1 +
tests/Makefile.sources | 1 +
tests/kms_atomic_interruptible.c | 319 +++++++++++++++++++++++++++++++++++++++
4 files changed, 323 insertions(+), 1 deletion(-)
create mode 100644 tests/kms_atomic_interruptible.c
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 14e2701c3afd..1f57e8981347 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -186,7 +186,8 @@ const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
"scaling mode",
- "CRTC_ID"
+ "CRTC_ID",
+ "DPMS"
};
/*
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index e5dc329b161e..3d1061fa08c8 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -114,6 +114,7 @@ extern const char *igt_crtc_prop_names[];
enum igt_atomic_connector_properties {
IGT_CONNECTOR_SCALING_MODE = 0,
IGT_CONNECTOR_CRTC_ID,
+ IGT_CONNECTOR_DPMS,
IGT_NUM_CONNECTOR_PROPS
};
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 0f4e39af10a1..cf542df181a8 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -172,6 +172,7 @@ TESTS_progs = \
kms_3d \
kms_addfb_basic \
kms_atomic \
+ kms_atomic_interruptible \
kms_atomic_transition \
kms_busy \
kms_ccs \
diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c
new file mode 100644
index 000000000000..6ec7a666b995
--- /dev/null
+++ b/tests/kms_atomic_interruptible.c
@@ -0,0 +1,319 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "igt.h"
+#include "drmtest.h"
+#include "sw_sync.h"
+
+enum plane_test_type
+{
+ test_legacy_modeset,
+ test_atomic_modeset,
+ test_legacy_dpms,
+ test_setplane,
+ test_setcursor,
+ test_pageflip
+};
+
+static int block_plane(igt_display_t *display, igt_output_t *output, enum plane_test_type test_type, igt_plane_t *plane)
+{
+ int timeline = sw_sync_timeline_create();
+
+ igt_fork(child, 1) {
+ /* Ignore the signal helper, we need to block indefinitely on the fence. */
+ signal(SIGCONT, SIG_IGN);
+
+ if (test_type == test_legacy_modeset || test_type == test_atomic_modeset) {
+ igt_output_set_pipe(output, PIPE_NONE);
+ igt_plane_set_fb(plane, NULL);
+ }
+ igt_plane_set_fence_fd(plane, sw_sync_timeline_create_fence(timeline, 1));
+
+ igt_display_commit2(display, COMMIT_ATOMIC);
+ }
+
+ return timeline;
+}
+
+static void unblock(int block)
+{
+ sw_sync_timeline_inc(block, 1);
+ close(block);
+}
+
+static void ev_page_flip(int fd, unsigned seq, unsigned tv_sec, unsigned tv_usec, void *user_data)
+{
+ igt_debug("Retrieved vblank seq: %u on unk\n", seq);
+}
+
+static drmEventContext drm_events = {
+ .version = 2,
+ .page_flip_handler = ev_page_flip
+};
+
+static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t *output,
+ enum plane_test_type test_type, unsigned plane_type)
+{
+ drmModeModeInfo *mode;
+ igt_fb_t fb, fb2;
+ igt_plane_t *primary, *plane;
+ int block;
+
+ /*
+ * Make sure we start with everything disabled to force a real modeset.
+ * igt_display_init only sets sw state, and assumes the first test doesn't care
+ * about hw state.
+ */
+ igt_display_commit2(display, COMMIT_ATOMIC);
+
+ igt_output_set_pipe(output, pipe);
+
+ primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+ plane = igt_output_get_plane_type(output, plane_type);
+ mode = igt_output_get_mode(output);
+
+ igt_create_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE, &fb);
+
+ switch (plane_type) {
+ case DRM_PLANE_TYPE_PRIMARY:
+ igt_create_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE, &fb2);
+ break;
+ case DRM_PLANE_TYPE_CURSOR:
+ igt_create_fb(display->drm_fd, 64, 64,
+ DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE, &fb2);
+ break;
+ }
+
+ if (test_type != test_legacy_modeset && test_type != test_atomic_modeset) {
+ igt_plane_set_fb(primary, &fb);
+ igt_display_commit2(display, COMMIT_ATOMIC);
+ }
+
+ igt_plane_set_fb(plane, &fb2);
+
+ block = block_plane(display, output, test_type, plane);
+ sleep(1);
+
+ igt_fork(child, 1) {
+ signal(SIGCONT, SIG_IGN);
+ igt_assert(sleep(5) == 0);
+
+ unblock(block);
+ }
+
+ /* run the test */
+ igt_while_interruptible(true) {
+ switch (test_type) {
+ case test_legacy_modeset: {
+ struct drm_mode_crtc crtc = {
+ .set_connectors_ptr = (uint64_t)(uintptr_t)&output->id,
+ .count_connectors = 1,
+ .crtc_id = primary->pipe->crtc_id,
+ .fb_id = fb2.fb_id,
+ .mode_valid = 1,
+ .mode = *(struct drm_mode_modeinfo*)mode,
+ };
+
+ do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_SETCRTC, &crtc));
+ break;
+ }
+ case test_atomic_modeset: {
+ uint32_t objs[3] = { plane->pipe->crtc_id, output->id, plane->drm_plane->plane_id };
+ uint32_t count_props[3] = { 2, 1, 6 };
+ uint32_t props[] = {
+ /* crtc: 2 props */
+ plane->pipe->atomic_props_crtc[IGT_CRTC_MODE_ID],
+ plane->pipe->atomic_props_crtc[IGT_CRTC_ACTIVE],
+ /* connector: 1 prop */
+ output->config.atomic_props_connector[IGT_CONNECTOR_CRTC_ID],
+ /* plane: remainder props */
+ plane->atomic_props_plane[IGT_PLANE_CRTC_ID],
+ plane->atomic_props_plane[IGT_PLANE_FB_ID],
+ plane->atomic_props_plane[IGT_PLANE_SRC_W],
+ plane->atomic_props_plane[IGT_PLANE_SRC_H],
+ plane->atomic_props_plane[IGT_PLANE_CRTC_W],
+ plane->atomic_props_plane[IGT_PLANE_CRTC_H]
+ };
+ uint64_t prop_vals[] = {
+ /* crtc */
+ 0, /* mode_id, filled in below */
+ true,
+ /* connector */
+ plane->pipe->crtc_id,
+ /* plane */
+ plane->pipe->crtc_id,
+ fb2.fb_id,
+ IGT_FIXED(fb2.width, 0),
+ IGT_FIXED(fb2.height, 0),
+ fb2.width,
+ fb2.height
+ };
+ uint32_t mode_blob;
+
+ struct drm_mode_atomic atm = {
+ .flags = DRM_MODE_ATOMIC_ALLOW_MODESET,
+ .count_objs = 3, /* crtc, connector, plane */
+ .objs_ptr = (uint64_t)(uintptr_t)&objs,
+ .count_props_ptr = (uint64_t)(uintptr_t)&count_props,
+ .props_ptr = (uint64_t)(uintptr_t)&props,
+ .prop_values_ptr = (uint64_t)(uintptr_t)&prop_vals,
+ };
+
+ do_or_die(drmModeCreatePropertyBlob(display->drm_fd, mode, sizeof(*mode), &mode_blob));
+ prop_vals[0] = mode_blob;
+
+ do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_ATOMIC, &atm));
+
+ do_or_die(drmModeDestroyPropertyBlob(display->drm_fd, mode_blob));
+ break;
+ }
+ case test_legacy_dpms: {
+ struct drm_mode_connector_set_property prop = {
+ .value = DRM_MODE_DPMS_OFF,
+ .prop_id = output->config.atomic_props_connector[IGT_CONNECTOR_DPMS],
+ .connector_id = output->id,
+ };
+
+ do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_SETPROPERTY, &prop));
+ break;
+ }
+ case test_setcursor: {
+ struct drm_mode_cursor cur = {
+ .flags = DRM_MODE_CURSOR_BO,
+ .crtc_id = plane->pipe->crtc_id,
+ .width = fb2.width,
+ .height = fb2.height,
+ .handle = fb2.gem_handle,
+ };
+ do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &cur));
+ break;
+ }
+ case test_setplane: {
+ struct drm_mode_set_plane setplane = {
+ .plane_id = plane->drm_plane->plane_id,
+ .crtc_id = plane->pipe->crtc_id,
+ .fb_id = fb2.fb_id,
+ .crtc_w = fb2.width,
+ .crtc_h = fb2.height,
+ .src_w = IGT_FIXED(fb2.width, 0),
+ .src_h = IGT_FIXED(fb2.height, 0),
+ };
+
+ do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_SETPLANE, &setplane));
+ break;
+ }
+ case test_pageflip: {
+ struct drm_mode_crtc_page_flip pageflip = {
+ .crtc_id = plane->pipe->crtc_id,
+ .fb_id = fb2.fb_id,
+ .flags = DRM_MODE_PAGE_FLIP_EVENT,
+ };
+
+ do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_PAGE_FLIP, &pageflip));
+
+ drmHandleEvent(display->drm_fd, &drm_events);
+ break;
+ }
+ }
+ }
+
+ igt_waitchildren();
+
+ igt_plane_set_fb(plane, NULL);
+ igt_plane_set_fb(primary, NULL);
+ igt_output_set_pipe(output, PIPE_NONE);
+ igt_display_commit2(display, COMMIT_ATOMIC);
+ igt_remove_fb(display->drm_fd, &fb);
+}
+
+igt_main
+{
+ igt_display_t display;
+ igt_output_t *output;
+ enum pipe pipe;
+
+ igt_skip_on_simulation();
+
+ igt_fixture {
+ display.drm_fd = drm_open_driver_master(DRIVER_ANY);
+
+ kmstest_set_vt_graphics_mode();
+
+ igt_display_init(&display, display.drm_fd);
+
+ igt_require(display.is_atomic);
+
+ igt_display_require_output(&display);
+
+ igt_require_sw_sync();
+ }
+
+ igt_subtest("legacy-setmode")
+ for_each_pipe_with_valid_output(&display, pipe, output) {
+ run_plane_test(&display, pipe, output, test_legacy_modeset, DRM_PLANE_TYPE_PRIMARY);
+ break;
+ }
+
+ igt_subtest("atomic-setmode")
+ for_each_pipe_with_valid_output(&display, pipe, output) {
+ run_plane_test(&display, pipe, output, test_atomic_modeset, DRM_PLANE_TYPE_PRIMARY);
+ break;
+ }
+
+ igt_subtest("legacy-dpms")
+ for_each_pipe_with_valid_output(&display, pipe, output) {
+ run_plane_test(&display, pipe, output, test_legacy_dpms, DRM_PLANE_TYPE_PRIMARY);
+ break;
+ }
+
+ igt_subtest("legacy-pageflip")
+ for_each_pipe_with_valid_output(&display, pipe, output) {
+ run_plane_test(&display, pipe, output, test_pageflip, DRM_PLANE_TYPE_PRIMARY);
+ break;
+ }
+
+ igt_subtest("legacy-cursor")
+ for_each_pipe_with_valid_output(&display, pipe, output) {
+ run_plane_test(&display, pipe, output, test_setcursor, DRM_PLANE_TYPE_CURSOR);
+ break;
+ }
+
+ igt_subtest("universal-setplane-primary")
+ for_each_pipe_with_valid_output(&display, pipe, output) {
+ run_plane_test(&display, pipe, output, test_setplane, DRM_PLANE_TYPE_PRIMARY);
+ break;
+ }
+
+ igt_subtest("universal-setplane-cursor")
+ for_each_pipe_with_valid_output(&display, pipe, output) {
+ run_plane_test(&display, pipe, output, test_setplane, DRM_PLANE_TYPE_CURSOR);
+ break;
+ }
+
+ /* TODO: legacy gamma_set/get, object set/getprop, getcrtc, getconnector */
+ igt_fixture {
+ igt_display_fini(&display);
+ }
+}
--
2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 6+ messages in thread* ✗ Fi.CI.BAT: warning for tests: Add kms_atomic_interruptible test, v2. 2017-09-06 12:30 [PATCH i-g-t] tests: Add kms_atomic_interruptible test, v2 Maarten Lankhorst @ 2017-09-06 12:50 ` Patchwork 2017-09-06 13:58 ` ✓ Fi.CI.BAT: success " Patchwork ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2017-09-06 12:50 UTC (permalink / raw) To: Maarten Lankhorst; +Cc: intel-gfx == Series Details == Series: tests: Add kms_atomic_interruptible test, v2. URL : https://patchwork.freedesktop.org/series/29877/ State : warning == Summary == IGT patchset tested on top of latest successful build 918863f8e3e8f49235fd2e4a36e11f386c06c11c intel_display_poller: Fix truncation of a test name. with latest DRM-Tip kernel build CI_DRM_3044 0640ea73be26 drm-tip: 2017y-09m-06d-06h-41m-15s UTC integration manifest Test kms_cursor_legacy: Subgroup basic-busy-flip-before-cursor-atomic: pass -> FAIL (fi-snb-2600) fdo#100215 Test kms_flip: Subgroup basic-flip-vs-modeset: skip -> PASS (fi-skl-x1585l) fdo#101781 Test pm_rpm: Subgroup basic-pci-d3-state: pass -> SKIP (fi-cfl-s) fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215 fdo#101781 https://bugs.freedesktop.org/show_bug.cgi?id=101781 fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:458s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:440s fi-blb-e6850 total:289 pass:224 dwarn:1 dfail:0 fail:0 skip:64 time:362s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:559s fi-bwr-2160 total:289 pass:184 dwarn:0 dfail:0 fail:0 skip:105 time:254s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:524s fi-byt-j1900 total:289 pass:254 dwarn:1 dfail:0 fail:0 skip:34 time:527s fi-byt-n2820 total:289 pass:250 dwarn:1 dfail:0 fail:0 skip:38 time:522s fi-cfl-s total:289 pass:249 dwarn:4 dfail:0 fail:0 skip:36 time:471s fi-elk-e7500 total:289 pass:230 dwarn:0 dfail:0 fail:0 skip:59 time:442s fi-glk-2a total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:613s fi-hsw-4770 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:450s fi-hsw-4770r total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:432s fi-ilk-650 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:430s fi-ivb-3520m total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:511s fi-ivb-3770 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:483s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:510s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:600s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:601s fi-pnv-d510 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:527s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:476s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:542s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:519s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:441s fi-skl-x1585l total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:518s fi-snb-2520m total:289 pass:251 dwarn:0 dfail:0 fail:0 skip:38 time:561s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:1 skip:39 time:406s == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_151/ _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* ✓ Fi.CI.BAT: success for tests: Add kms_atomic_interruptible test, v2. 2017-09-06 12:30 [PATCH i-g-t] tests: Add kms_atomic_interruptible test, v2 Maarten Lankhorst 2017-09-06 12:50 ` ✗ Fi.CI.BAT: warning for " Patchwork @ 2017-09-06 13:58 ` Patchwork 2017-09-06 16:56 ` ✓ Fi.CI.IGT: " Patchwork 2017-09-08 7:08 ` [PATCH i-g-t] " Daniel Vetter 3 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2017-09-06 13:58 UTC (permalink / raw) To: Maarten Lankhorst; +Cc: intel-gfx == Series Details == Series: tests: Add kms_atomic_interruptible test, v2. URL : https://patchwork.freedesktop.org/series/29877/ State : success == Summary == IGT patchset tested on top of latest successful build 918863f8e3e8f49235fd2e4a36e11f386c06c11c intel_display_poller: Fix truncation of a test name. with latest DRM-Tip kernel build CI_DRM_3045 c18a85fe008e drm-tip: 2017y-09m-06d-13h-17m-59s UTC integration manifest Test kms_cursor_legacy: Subgroup basic-busy-flip-before-cursor-legacy: fail -> PASS (fi-snb-2600) fdo#100215 Test kms_flip: Subgroup basic-flip-vs-modeset: skip -> PASS (fi-skl-x1585l) fdo#101781 Test pm_rpm: Subgroup basic-pci-d3-state: skip -> PASS (fi-cfl-s) fdo#102294 fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215 fdo#101781 https://bugs.freedesktop.org/show_bug.cgi?id=101781 fdo#102294 https://bugs.freedesktop.org/show_bug.cgi?id=102294 fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:460s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:439s fi-blb-e6850 total:289 pass:224 dwarn:1 dfail:0 fail:0 skip:64 time:362s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:570s fi-bwr-2160 total:289 pass:184 dwarn:0 dfail:0 fail:0 skip:105 time:253s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:524s fi-byt-j1900 total:289 pass:254 dwarn:1 dfail:0 fail:0 skip:34 time:528s fi-byt-n2820 total:289 pass:250 dwarn:1 dfail:0 fail:0 skip:38 time:521s fi-cfl-s total:289 pass:250 dwarn:4 dfail:0 fail:0 skip:35 time:466s fi-elk-e7500 total:289 pass:230 dwarn:0 dfail:0 fail:0 skip:59 time:438s fi-glk-2a total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:617s fi-hsw-4770 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:452s fi-hsw-4770r total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:433s fi-ilk-650 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:429s fi-ivb-3520m total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:508s fi-ivb-3770 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:474s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:518s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:601s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:601s fi-pnv-d510 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:530s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:470s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:539s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:523s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:454s fi-skl-x1585l total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:513s fi-snb-2600 total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:418s == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_153/ _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* ✓ Fi.CI.IGT: success for tests: Add kms_atomic_interruptible test, v2. 2017-09-06 12:30 [PATCH i-g-t] tests: Add kms_atomic_interruptible test, v2 Maarten Lankhorst 2017-09-06 12:50 ` ✗ Fi.CI.BAT: warning for " Patchwork 2017-09-06 13:58 ` ✓ Fi.CI.BAT: success " Patchwork @ 2017-09-06 16:56 ` Patchwork 2017-09-08 7:08 ` [PATCH i-g-t] " Daniel Vetter 3 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2017-09-06 16:56 UTC (permalink / raw) To: Maarten Lankhorst; +Cc: intel-gfx == Series Details == Series: tests: Add kms_atomic_interruptible test, v2. URL : https://patchwork.freedesktop.org/series/29877/ State : success == Summary == Test perf: Subgroup blocking: fail -> PASS (shard-hsw) fdo#102252 Test kms_flip: Subgroup plain-flip-fb-recreate: fail -> PASS (shard-hsw) fdo#102504 Test kms_setmode: Subgroup basic: fail -> PASS (shard-hsw) fdo#99912 fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252 fdo#102504 https://bugs.freedesktop.org/show_bug.cgi?id=102504 fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912 shard-hsw total:2272 pass:1241 dwarn:0 dfail:0 fail:15 skip:1016 time:9747s == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_153/shards.html _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH i-g-t] tests: Add kms_atomic_interruptible test, v2. 2017-09-06 12:30 [PATCH i-g-t] tests: Add kms_atomic_interruptible test, v2 Maarten Lankhorst ` (2 preceding siblings ...) 2017-09-06 16:56 ` ✓ Fi.CI.IGT: " Patchwork @ 2017-09-08 7:08 ` Daniel Vetter 2017-09-08 7:39 ` Maarten Lankhorst 3 siblings, 1 reply; 6+ messages in thread From: Daniel Vetter @ 2017-09-08 7:08 UTC (permalink / raw) To: Maarten Lankhorst; +Cc: intel-gfx, Daniel Stone On Wed, Sep 06, 2017 at 02:30:28PM +0200, Maarten Lankhorst wrote: > This tests the various parts of atomic that I want to make > interruptible. Running with --debug shows the stats from > __igt_sigiter_continue, which can be used to make sure that > we don't fall over. > > The default igt kms helpers use drmIoctl, which is not intercepted > by igt_while_interruptible. Only igt_ioctl is. This means we have > to call the ioctls manually here. > > Changes since v1: > - Implement interruptible DPMS checking too. > - Use igt_ioctl + igt_while_interruptible, instead of the signal helper > shotgun. > > Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> > Cc: Daniel Stone <daniels@collabora.com> > --- > lib/igt_kms.c | 3 +- > lib/igt_kms.h | 1 + > tests/Makefile.sources | 1 + > tests/kms_atomic_interruptible.c | 319 +++++++++++++++++++++++++++++++++++++++ > 4 files changed, 323 insertions(+), 1 deletion(-) > create mode 100644 tests/kms_atomic_interruptible.c > > diff --git a/lib/igt_kms.c b/lib/igt_kms.c > index 14e2701c3afd..1f57e8981347 100644 > --- a/lib/igt_kms.c > +++ b/lib/igt_kms.c > @@ -186,7 +186,8 @@ const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = { > > const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = { > "scaling mode", > - "CRTC_ID" > + "CRTC_ID", > + "DPMS" > }; > > /* > diff --git a/lib/igt_kms.h b/lib/igt_kms.h > index e5dc329b161e..3d1061fa08c8 100644 > --- a/lib/igt_kms.h > +++ b/lib/igt_kms.h > @@ -114,6 +114,7 @@ extern const char *igt_crtc_prop_names[]; > enum igt_atomic_connector_properties { > IGT_CONNECTOR_SCALING_MODE = 0, > IGT_CONNECTOR_CRTC_ID, > + IGT_CONNECTOR_DPMS, > IGT_NUM_CONNECTOR_PROPS > }; > > diff --git a/tests/Makefile.sources b/tests/Makefile.sources > index 0f4e39af10a1..cf542df181a8 100644 > --- a/tests/Makefile.sources > +++ b/tests/Makefile.sources > @@ -172,6 +172,7 @@ TESTS_progs = \ > kms_3d \ > kms_addfb_basic \ > kms_atomic \ > + kms_atomic_interruptible \ > kms_atomic_transition \ > kms_busy \ > kms_ccs \ > diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c > new file mode 100644 > index 000000000000..6ec7a666b995 > --- /dev/null > +++ b/tests/kms_atomic_interruptible.c > @@ -0,0 +1,319 @@ > +/* > + * Copyright © 2016 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice (including the next > + * paragraph) shall be included in all copies or substantial portions of the > + * Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS > + * IN THE SOFTWARE. > + */ > + > +#include "igt.h" > +#include "drmtest.h" > +#include "sw_sync.h" > + > +enum plane_test_type > +{ > + test_legacy_modeset, > + test_atomic_modeset, > + test_legacy_dpms, > + test_setplane, > + test_setcursor, > + test_pageflip > +}; > + > +static int block_plane(igt_display_t *display, igt_output_t *output, enum plane_test_type test_type, igt_plane_t *plane) > +{ > + int timeline = sw_sync_timeline_create(); > + > + igt_fork(child, 1) { > + /* Ignore the signal helper, we need to block indefinitely on the fence. */ > + signal(SIGCONT, SIG_IGN); > + > + if (test_type == test_legacy_modeset || test_type == test_atomic_modeset) { > + igt_output_set_pipe(output, PIPE_NONE); > + igt_plane_set_fb(plane, NULL); > + } > + igt_plane_set_fence_fd(plane, sw_sync_timeline_create_fence(timeline, 1)); > + > + igt_display_commit2(display, COMMIT_ATOMIC); > + } > + > + return timeline; > +} > + > +static void unblock(int block) > +{ > + sw_sync_timeline_inc(block, 1); > + close(block); > +} > + > +static void ev_page_flip(int fd, unsigned seq, unsigned tv_sec, unsigned tv_usec, void *user_data) > +{ > + igt_debug("Retrieved vblank seq: %u on unk\n", seq); > +} > + > +static drmEventContext drm_events = { > + .version = 2, > + .page_flip_handler = ev_page_flip > +}; > + > +static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t *output, > + enum plane_test_type test_type, unsigned plane_type) > +{ > + drmModeModeInfo *mode; > + igt_fb_t fb, fb2; > + igt_plane_t *primary, *plane; > + int block; > + > + /* > + * Make sure we start with everything disabled to force a real modeset. > + * igt_display_init only sets sw state, and assumes the first test doesn't care > + * about hw state. > + */ > + igt_display_commit2(display, COMMIT_ATOMIC); > + > + igt_output_set_pipe(output, pipe); > + > + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); > + plane = igt_output_get_plane_type(output, plane_type); > + mode = igt_output_get_mode(output); > + > + igt_create_fb(display->drm_fd, mode->hdisplay, mode->vdisplay, > + DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE, &fb); > + > + switch (plane_type) { > + case DRM_PLANE_TYPE_PRIMARY: > + igt_create_fb(display->drm_fd, mode->hdisplay, mode->vdisplay, > + DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE, &fb2); > + break; > + case DRM_PLANE_TYPE_CURSOR: > + igt_create_fb(display->drm_fd, 64, 64, > + DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE, &fb2); > + break; > + } > + > + if (test_type != test_legacy_modeset && test_type != test_atomic_modeset) { > + igt_plane_set_fb(primary, &fb); > + igt_display_commit2(display, COMMIT_ATOMIC); > + } > + > + igt_plane_set_fb(plane, &fb2); > + > + block = block_plane(display, output, test_type, plane); > + sleep(1); Ugh. Oh well. > + > + igt_fork(child, 1) { > + signal(SIGCONT, SIG_IGN); > + igt_assert(sleep(5) == 0); > + > + unblock(block); > + } > + > + /* run the test */ > + igt_while_interruptible(true) { > + switch (test_type) { > + case test_legacy_modeset: { > + struct drm_mode_crtc crtc = { > + .set_connectors_ptr = (uint64_t)(uintptr_t)&output->id, > + .count_connectors = 1, > + .crtc_id = primary->pipe->crtc_id, > + .fb_id = fb2.fb_id, > + .mode_valid = 1, > + .mode = *(struct drm_mode_modeinfo*)mode, > + }; > + > + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_SETCRTC, &crtc)); > + break; > + } > + case test_atomic_modeset: { Why all these {} for each case statement? I've never seen that before, looks funny and un-C. > + uint32_t objs[3] = { plane->pipe->crtc_id, output->id, plane->drm_plane->plane_id }; > + uint32_t count_props[3] = { 2, 1, 6 }; > + uint32_t props[] = { > + /* crtc: 2 props */ > + plane->pipe->atomic_props_crtc[IGT_CRTC_MODE_ID], > + plane->pipe->atomic_props_crtc[IGT_CRTC_ACTIVE], > + /* connector: 1 prop */ > + output->config.atomic_props_connector[IGT_CONNECTOR_CRTC_ID], > + /* plane: remainder props */ > + plane->atomic_props_plane[IGT_PLANE_CRTC_ID], > + plane->atomic_props_plane[IGT_PLANE_FB_ID], > + plane->atomic_props_plane[IGT_PLANE_SRC_W], > + plane->atomic_props_plane[IGT_PLANE_SRC_H], > + plane->atomic_props_plane[IGT_PLANE_CRTC_W], > + plane->atomic_props_plane[IGT_PLANE_CRTC_H] > + }; > + uint64_t prop_vals[] = { > + /* crtc */ > + 0, /* mode_id, filled in below */ > + true, > + /* connector */ > + plane->pipe->crtc_id, > + /* plane */ > + plane->pipe->crtc_id, > + fb2.fb_id, > + IGT_FIXED(fb2.width, 0), > + IGT_FIXED(fb2.height, 0), > + fb2.width, > + fb2.height > + }; > + uint32_t mode_blob; > + > + struct drm_mode_atomic atm = { > + .flags = DRM_MODE_ATOMIC_ALLOW_MODESET, > + .count_objs = 3, /* crtc, connector, plane */ > + .objs_ptr = (uint64_t)(uintptr_t)&objs, > + .count_props_ptr = (uint64_t)(uintptr_t)&count_props, > + .props_ptr = (uint64_t)(uintptr_t)&props, > + .prop_values_ptr = (uint64_t)(uintptr_t)&prop_vals, > + }; > + > + do_or_die(drmModeCreatePropertyBlob(display->drm_fd, mode, sizeof(*mode), &mode_blob)); > + prop_vals[0] = mode_blob; > + > + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_ATOMIC, &atm)); > + > + do_or_die(drmModeDestroyPropertyBlob(display->drm_fd, mode_blob)); > + break; > + } > + case test_legacy_dpms: { > + struct drm_mode_connector_set_property prop = { > + .value = DRM_MODE_DPMS_OFF, > + .prop_id = output->config.atomic_props_connector[IGT_CONNECTOR_DPMS], > + .connector_id = output->id, > + }; > + > + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_SETPROPERTY, &prop)); > + break; > + } > + case test_setcursor: { > + struct drm_mode_cursor cur = { > + .flags = DRM_MODE_CURSOR_BO, > + .crtc_id = plane->pipe->crtc_id, > + .width = fb2.width, > + .height = fb2.height, > + .handle = fb2.gem_handle, > + }; > + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &cur)); > + break; > + } > + case test_setplane: { > + struct drm_mode_set_plane setplane = { > + .plane_id = plane->drm_plane->plane_id, > + .crtc_id = plane->pipe->crtc_id, > + .fb_id = fb2.fb_id, > + .crtc_w = fb2.width, > + .crtc_h = fb2.height, > + .src_w = IGT_FIXED(fb2.width, 0), > + .src_h = IGT_FIXED(fb2.height, 0), > + }; > + > + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_SETPLANE, &setplane)); > + break; > + } > + case test_pageflip: { > + struct drm_mode_crtc_page_flip pageflip = { > + .crtc_id = plane->pipe->crtc_id, > + .fb_id = fb2.fb_id, > + .flags = DRM_MODE_PAGE_FLIP_EVENT, > + }; > + > + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_PAGE_FLIP, &pageflip)); > + > + drmHandleEvent(display->drm_fd, &drm_events); > + break; > + } > + } Especially since it makes it look like you double-close the same block here (but it's actually the case + switch you close). Please remove those {} case blocks. Otherwise lgtm. The time-based blocking isn't the most perfect testing technique, but well, replacing all of libdrm's atomic stuff is a bit over the top. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> > + } > + > + igt_waitchildren(); > + > + igt_plane_set_fb(plane, NULL); > + igt_plane_set_fb(primary, NULL); > + igt_output_set_pipe(output, PIPE_NONE); > + igt_display_commit2(display, COMMIT_ATOMIC); > + igt_remove_fb(display->drm_fd, &fb); > +} > + > +igt_main > +{ > + igt_display_t display; > + igt_output_t *output; > + enum pipe pipe; > + > + igt_skip_on_simulation(); > + > + igt_fixture { > + display.drm_fd = drm_open_driver_master(DRIVER_ANY); > + > + kmstest_set_vt_graphics_mode(); > + > + igt_display_init(&display, display.drm_fd); > + > + igt_require(display.is_atomic); > + > + igt_display_require_output(&display); > + > + igt_require_sw_sync(); > + } > + > + igt_subtest("legacy-setmode") > + for_each_pipe_with_valid_output(&display, pipe, output) { > + run_plane_test(&display, pipe, output, test_legacy_modeset, DRM_PLANE_TYPE_PRIMARY); > + break; > + } > + > + igt_subtest("atomic-setmode") > + for_each_pipe_with_valid_output(&display, pipe, output) { > + run_plane_test(&display, pipe, output, test_atomic_modeset, DRM_PLANE_TYPE_PRIMARY); > + break; > + } > + > + igt_subtest("legacy-dpms") > + for_each_pipe_with_valid_output(&display, pipe, output) { > + run_plane_test(&display, pipe, output, test_legacy_dpms, DRM_PLANE_TYPE_PRIMARY); > + break; > + } > + > + igt_subtest("legacy-pageflip") > + for_each_pipe_with_valid_output(&display, pipe, output) { > + run_plane_test(&display, pipe, output, test_pageflip, DRM_PLANE_TYPE_PRIMARY); > + break; > + } > + > + igt_subtest("legacy-cursor") > + for_each_pipe_with_valid_output(&display, pipe, output) { > + run_plane_test(&display, pipe, output, test_setcursor, DRM_PLANE_TYPE_CURSOR); > + break; > + } > + > + igt_subtest("universal-setplane-primary") > + for_each_pipe_with_valid_output(&display, pipe, output) { > + run_plane_test(&display, pipe, output, test_setplane, DRM_PLANE_TYPE_PRIMARY); > + break; > + } > + > + igt_subtest("universal-setplane-cursor") > + for_each_pipe_with_valid_output(&display, pipe, output) { > + run_plane_test(&display, pipe, output, test_setplane, DRM_PLANE_TYPE_CURSOR); > + break; > + } > + > + /* TODO: legacy gamma_set/get, object set/getprop, getcrtc, getconnector */ > + igt_fixture { > + igt_display_fini(&display); > + } > +} > -- > 2.11.0 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH i-g-t] tests: Add kms_atomic_interruptible test, v2. 2017-09-08 7:08 ` [PATCH i-g-t] " Daniel Vetter @ 2017-09-08 7:39 ` Maarten Lankhorst 0 siblings, 0 replies; 6+ messages in thread From: Maarten Lankhorst @ 2017-09-08 7:39 UTC (permalink / raw) To: Daniel Vetter; +Cc: intel-gfx, Daniel Stone Op 08-09-17 om 09:08 schreef Daniel Vetter: > On Wed, Sep 06, 2017 at 02:30:28PM +0200, Maarten Lankhorst wrote: >> This tests the various parts of atomic that I want to make >> interruptible. Running with --debug shows the stats from >> __igt_sigiter_continue, which can be used to make sure that >> we don't fall over. >> >> The default igt kms helpers use drmIoctl, which is not intercepted >> by igt_while_interruptible. Only igt_ioctl is. This means we have >> to call the ioctls manually here. >> >> Changes since v1: >> - Implement interruptible DPMS checking too. >> - Use igt_ioctl + igt_while_interruptible, instead of the signal helper >> shotgun. >> >> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> >> Cc: Daniel Stone <daniels@collabora.com> >> --- >> lib/igt_kms.c | 3 +- >> lib/igt_kms.h | 1 + >> tests/Makefile.sources | 1 + >> tests/kms_atomic_interruptible.c | 319 +++++++++++++++++++++++++++++++++++++++ >> 4 files changed, 323 insertions(+), 1 deletion(-) >> create mode 100644 tests/kms_atomic_interruptible.c >> >> diff --git a/lib/igt_kms.c b/lib/igt_kms.c >> index 14e2701c3afd..1f57e8981347 100644 >> --- a/lib/igt_kms.c >> +++ b/lib/igt_kms.c >> @@ -186,7 +186,8 @@ const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = { >> >> const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = { >> "scaling mode", >> - "CRTC_ID" >> + "CRTC_ID", >> + "DPMS" >> }; >> >> /* >> diff --git a/lib/igt_kms.h b/lib/igt_kms.h >> index e5dc329b161e..3d1061fa08c8 100644 >> --- a/lib/igt_kms.h >> +++ b/lib/igt_kms.h >> @@ -114,6 +114,7 @@ extern const char *igt_crtc_prop_names[]; >> enum igt_atomic_connector_properties { >> IGT_CONNECTOR_SCALING_MODE = 0, >> IGT_CONNECTOR_CRTC_ID, >> + IGT_CONNECTOR_DPMS, >> IGT_NUM_CONNECTOR_PROPS >> }; >> >> diff --git a/tests/Makefile.sources b/tests/Makefile.sources >> index 0f4e39af10a1..cf542df181a8 100644 >> --- a/tests/Makefile.sources >> +++ b/tests/Makefile.sources >> @@ -172,6 +172,7 @@ TESTS_progs = \ >> kms_3d \ >> kms_addfb_basic \ >> kms_atomic \ >> + kms_atomic_interruptible \ >> kms_atomic_transition \ >> kms_busy \ >> kms_ccs \ >> diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c >> new file mode 100644 >> index 000000000000..6ec7a666b995 >> --- /dev/null >> +++ b/tests/kms_atomic_interruptible.c >> @@ -0,0 +1,319 @@ >> +/* >> + * Copyright © 2016 Intel Corporation >> + * >> + * Permission is hereby granted, free of charge, to any person obtaining a >> + * copy of this software and associated documentation files (the "Software"), >> + * to deal in the Software without restriction, including without limitation >> + * the rights to use, copy, modify, merge, publish, distribute, sublicense, >> + * and/or sell copies of the Software, and to permit persons to whom the >> + * Software is furnished to do so, subject to the following conditions: >> + * >> + * The above copyright notice and this permission notice (including the next >> + * paragraph) shall be included in all copies or substantial portions of the >> + * Software. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER >> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING >> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS >> + * IN THE SOFTWARE. >> + */ >> + >> +#include "igt.h" >> +#include "drmtest.h" >> +#include "sw_sync.h" >> + >> +enum plane_test_type >> +{ >> + test_legacy_modeset, >> + test_atomic_modeset, >> + test_legacy_dpms, >> + test_setplane, >> + test_setcursor, >> + test_pageflip >> +}; >> + >> +static int block_plane(igt_display_t *display, igt_output_t *output, enum plane_test_type test_type, igt_plane_t *plane) >> +{ >> + int timeline = sw_sync_timeline_create(); >> + >> + igt_fork(child, 1) { >> + /* Ignore the signal helper, we need to block indefinitely on the fence. */ >> + signal(SIGCONT, SIG_IGN); >> + >> + if (test_type == test_legacy_modeset || test_type == test_atomic_modeset) { >> + igt_output_set_pipe(output, PIPE_NONE); >> + igt_plane_set_fb(plane, NULL); >> + } >> + igt_plane_set_fence_fd(plane, sw_sync_timeline_create_fence(timeline, 1)); >> + >> + igt_display_commit2(display, COMMIT_ATOMIC); >> + } >> + >> + return timeline; >> +} >> + >> +static void unblock(int block) >> +{ >> + sw_sync_timeline_inc(block, 1); >> + close(block); >> +} >> + >> +static void ev_page_flip(int fd, unsigned seq, unsigned tv_sec, unsigned tv_usec, void *user_data) >> +{ >> + igt_debug("Retrieved vblank seq: %u on unk\n", seq); >> +} >> + >> +static drmEventContext drm_events = { >> + .version = 2, >> + .page_flip_handler = ev_page_flip >> +}; >> + >> +static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t *output, >> + enum plane_test_type test_type, unsigned plane_type) >> +{ >> + drmModeModeInfo *mode; >> + igt_fb_t fb, fb2; >> + igt_plane_t *primary, *plane; >> + int block; >> + >> + /* >> + * Make sure we start with everything disabled to force a real modeset. >> + * igt_display_init only sets sw state, and assumes the first test doesn't care >> + * about hw state. >> + */ >> + igt_display_commit2(display, COMMIT_ATOMIC); >> + >> + igt_output_set_pipe(output, pipe); >> + >> + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); >> + plane = igt_output_get_plane_type(output, plane_type); >> + mode = igt_output_get_mode(output); >> + >> + igt_create_fb(display->drm_fd, mode->hdisplay, mode->vdisplay, >> + DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE, &fb); >> + >> + switch (plane_type) { >> + case DRM_PLANE_TYPE_PRIMARY: >> + igt_create_fb(display->drm_fd, mode->hdisplay, mode->vdisplay, >> + DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE, &fb2); >> + break; >> + case DRM_PLANE_TYPE_CURSOR: >> + igt_create_fb(display->drm_fd, 64, 64, >> + DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE, &fb2); >> + break; >> + } >> + >> + if (test_type != test_legacy_modeset && test_type != test_atomic_modeset) { >> + igt_plane_set_fb(primary, &fb); >> + igt_display_commit2(display, COMMIT_ATOMIC); >> + } >> + >> + igt_plane_set_fb(plane, &fb2); >> + >> + block = block_plane(display, output, test_type, plane); >> + sleep(1); > Ugh. Oh well. > >> + >> + igt_fork(child, 1) { >> + signal(SIGCONT, SIG_IGN); >> + igt_assert(sleep(5) == 0); >> + >> + unblock(block); >> + } >> + >> + /* run the test */ >> + igt_while_interruptible(true) { >> + switch (test_type) { >> + case test_legacy_modeset: { >> + struct drm_mode_crtc crtc = { >> + .set_connectors_ptr = (uint64_t)(uintptr_t)&output->id, >> + .count_connectors = 1, >> + .crtc_id = primary->pipe->crtc_id, >> + .fb_id = fb2.fb_id, >> + .mode_valid = 1, >> + .mode = *(struct drm_mode_modeinfo*)mode, >> + }; >> + >> + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_SETCRTC, &crtc)); >> + break; >> + } >> + case test_atomic_modeset: { > Why all these {} for each case statement? I've never seen that before, > looks funny and un-C. drm_atomic_get_property uses it so you might have seen it, but never noticed. It's required to declare the local variables in a case statement. > >> + uint32_t objs[3] = { plane->pipe->crtc_id, output->id, plane->drm_plane->plane_id }; >> + uint32_t count_props[3] = { 2, 1, 6 }; >> + uint32_t props[] = { >> + /* crtc: 2 props */ >> + plane->pipe->atomic_props_crtc[IGT_CRTC_MODE_ID], >> + plane->pipe->atomic_props_crtc[IGT_CRTC_ACTIVE], >> + /* connector: 1 prop */ >> + output->config.atomic_props_connector[IGT_CONNECTOR_CRTC_ID], >> + /* plane: remainder props */ >> + plane->atomic_props_plane[IGT_PLANE_CRTC_ID], >> + plane->atomic_props_plane[IGT_PLANE_FB_ID], >> + plane->atomic_props_plane[IGT_PLANE_SRC_W], >> + plane->atomic_props_plane[IGT_PLANE_SRC_H], >> + plane->atomic_props_plane[IGT_PLANE_CRTC_W], >> + plane->atomic_props_plane[IGT_PLANE_CRTC_H] >> + }; >> + uint64_t prop_vals[] = { >> + /* crtc */ >> + 0, /* mode_id, filled in below */ >> + true, >> + /* connector */ >> + plane->pipe->crtc_id, >> + /* plane */ >> + plane->pipe->crtc_id, >> + fb2.fb_id, >> + IGT_FIXED(fb2.width, 0), >> + IGT_FIXED(fb2.height, 0), >> + fb2.width, >> + fb2.height >> + }; >> + uint32_t mode_blob; >> + >> + struct drm_mode_atomic atm = { >> + .flags = DRM_MODE_ATOMIC_ALLOW_MODESET, >> + .count_objs = 3, /* crtc, connector, plane */ >> + .objs_ptr = (uint64_t)(uintptr_t)&objs, >> + .count_props_ptr = (uint64_t)(uintptr_t)&count_props, >> + .props_ptr = (uint64_t)(uintptr_t)&props, >> + .prop_values_ptr = (uint64_t)(uintptr_t)&prop_vals, >> + }; >> + >> + do_or_die(drmModeCreatePropertyBlob(display->drm_fd, mode, sizeof(*mode), &mode_blob)); >> + prop_vals[0] = mode_blob; >> + >> + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_ATOMIC, &atm)); >> + >> + do_or_die(drmModeDestroyPropertyBlob(display->drm_fd, mode_blob)); >> + break; >> + } >> + case test_legacy_dpms: { >> + struct drm_mode_connector_set_property prop = { >> + .value = DRM_MODE_DPMS_OFF, >> + .prop_id = output->config.atomic_props_connector[IGT_CONNECTOR_DPMS], >> + .connector_id = output->id, >> + }; >> + >> + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_SETPROPERTY, &prop)); >> + break; >> + } >> + case test_setcursor: { >> + struct drm_mode_cursor cur = { >> + .flags = DRM_MODE_CURSOR_BO, >> + .crtc_id = plane->pipe->crtc_id, >> + .width = fb2.width, >> + .height = fb2.height, >> + .handle = fb2.gem_handle, >> + }; >> + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &cur)); >> + break; >> + } >> + case test_setplane: { >> + struct drm_mode_set_plane setplane = { >> + .plane_id = plane->drm_plane->plane_id, >> + .crtc_id = plane->pipe->crtc_id, >> + .fb_id = fb2.fb_id, >> + .crtc_w = fb2.width, >> + .crtc_h = fb2.height, >> + .src_w = IGT_FIXED(fb2.width, 0), >> + .src_h = IGT_FIXED(fb2.height, 0), >> + }; >> + >> + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_SETPLANE, &setplane)); >> + break; >> + } >> + case test_pageflip: { >> + struct drm_mode_crtc_page_flip pageflip = { >> + .crtc_id = plane->pipe->crtc_id, >> + .fb_id = fb2.fb_id, >> + .flags = DRM_MODE_PAGE_FLIP_EVENT, >> + }; >> + >> + do_or_die(igt_ioctl(display->drm_fd, DRM_IOCTL_MODE_PAGE_FLIP, &pageflip)); >> + >> + drmHandleEvent(display->drm_fd, &drm_events); >> + break; >> + } >> + } > Especially since it makes it look like you double-close the same block > here (but it's actually the case + switch you close). Please remove those > {} case blocks. It's required for declaring the local variables. I can increase the indent of case by 1, which should make the apparent double close disappear. :) > Otherwise lgtm. The time-based blocking isn't the most perfect testing > technique, but well, replacing all of libdrm's atomic stuff is a bit over > the top. > > Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Thanks for review. ~Maarten _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-09-08 7:39 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-09-06 12:30 [PATCH i-g-t] tests: Add kms_atomic_interruptible test, v2 Maarten Lankhorst 2017-09-06 12:50 ` ✗ Fi.CI.BAT: warning for " Patchwork 2017-09-06 13:58 ` ✓ Fi.CI.BAT: success " Patchwork 2017-09-06 16:56 ` ✓ Fi.CI.IGT: " Patchwork 2017-09-08 7:08 ` [PATCH i-g-t] " Daniel Vetter 2017-09-08 7:39 ` Maarten Lankhorst
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox