Skip to contentSkip to conversation

tests/kms_closefb: add CLOSEFB IOCTL test

PATCH Superseded Simon Ser 2 participants 2 messages Oct 18, 2023 Arm/Amlogic Meson SoC support

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Simon Ser

author
#0 lore raw

PATCH v2 1/1 tests/kms_closefb: add CLOSEFB IOCTL test

CLOSEFB is the same as RMFB but keeps the FB alive as long as any plane is using it. Check the behavior of that IOCTL.

Cc Kamil Konieczny <[email protected]>
Cc Juha-Pekka Heikkila <[email protected]>
Cc Bhanuprakash Modem <[email protected]>
---
 tests/kms_closefb.c | 115 ++++++++++++++++++++++++++++++++++++++++++++
 tests/meson.build   |   1 +
 2 files changed, 116 insertions(+)
 create mode 100644 tests/kms_closefb.c
tests/kms_closefb.c new file +115 -0
new file mode 100644
index 000000000000..eee09e071367
@@ -0,0 +1,115 @@
+// SPDX-License-Identifier: MIT
+// Copyright © 2023 Simon Ser
+
+#include "igt.h"
+
+/**
+ * TEST: kms closefb
+ * Category: Display
+ * Description: This tests CLOSEFB behavior. Contrary to RMFB, the
+ *              framebuffers should not be removed from the CRTC.
+ *
+ * SUBTEST: closefb-ioctl
+ * Description: CLOSEFB is supposed to leave all planes intact.
+ */
+
+IGT_TEST_DESCRIPTION("This tests CLOSEFB behavior. Contrary to RMFB, the"
+		     "framebuffers should not be removed from the CRTC.");
+
+// TODO: drop when shipped in kernel header
+#ifndef DRM_IOCTL_MODE_CLOSEFB
+#define DRM_IOCTL_MODE_CLOSEFB DRM_IOWR(0xD0, unsigned int)
+#endif
+
+/* 1. Set primary plane to a known FB.
+ * 2. Make sure GETCRTC returns the correct FB ID.
+ * 3. Call CLOSEFB on the FB.
+ * 4. Make sure GETCRTC returns non-0 FB ID.
+ */
+static void
+test_closefb(int *drm_fd, igt_display_t *display, igt_output_t *output,
+	     enum pipe pipe)
+{
+	struct igt_fb fb;
+	drmModeModeInfo *mode;
+	igt_plane_t *plane;
+	drmModeCrtc *crtc;
+	int ret;
+
+	mode = igt_output_get_mode(output);
+	plane = igt_pipe_get_plane_type(&display->pipes[pipe], DRM_PLANE_TYPE_PRIMARY);
+
+	igt_create_fb(*drm_fd, mode->hdisplay, mode->vdisplay,
+		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, &fb);
+	igt_plane_set_fb(plane, &fb);
+	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	crtc = drmModeGetCrtc(*drm_fd, output->config.crtc->crtc_id);
+	igt_assert_eq(crtc->buffer_id, fb.fb_id);
+	drmModeFreeCrtc(crtc);
+
+	ret = drmIoctl(*drm_fd, DRM_IOCTL_MODE_CLOSEFB, &fb.fb_id);
+	igt_assert_eq(ret, 0);
+
+	/* Re-open our DRM FD. Without CLOSEFB, this would implicitly turn off
+	 * the CRTC and remove the FB (see test kms_rmfb@close-fd). */
+	drm_close_driver(*drm_fd);
+	*drm_fd = drm_open_driver_master(DRIVER_ANY);
+	drmSetClientCap(*drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
+	drmSetClientCap(*drm_fd, DRM_CLIENT_CAP_ATOMIC, 1);
+	igt_pipe_refresh(display, pipe, true);
+
+	/* Check that our CRTC still has the FB attached */
+	crtc = drmModeGetCrtc(*drm_fd, output->config.crtc->crtc_id);
+	igt_assert_eq(crtc->buffer_id, fb.fb_id);
+	drmModeFreeCrtc(crtc);
+}
+
+static void
+run_closefb_test(int *drm_fd, igt_display_t *display)
+{
+	igt_output_t *output;
+	enum pipe pipe;
+
+	for_each_pipe_with_single_output(display, pipe, output) {
+		igt_display_reset(display);
+
+		igt_output_set_pipe(output, pipe);
+
+		igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe),
+			      igt_output_name(output))
+			test_closefb(drm_fd, display, output, pipe);
+	}
+}
+
+igt_main
+{
+	int drm_fd;
+	igt_display_t display;
+	uint32_t fb_id = 0;
+	int ret;
+
+	igt_fixture {
+		drm_fd = drm_open_driver_master(DRIVER_ANY);
+
+		kmstest_set_vt_graphics_mode();
+
+		igt_display_require(&display, drm_fd);
+		igt_display_require_output(&display);
+
+		/* Detect kernel support for CLOSEFB */
+		ret = drmIoctl(drm_fd, DRM_IOCTL_MODE_CLOSEFB, &fb_id);
+		igt_require(ret != 0 && errno == ENOENT);
+	}
+
+	igt_describe("CLOSEFB is supposed to not touch any plane the FB is "
+		     "currently attached to. Check that behavior.");
+	igt_subtest_with_dynamic("closefb-ioctl") {
+		run_closefb_test(&drm_fd, &display);
+	}
+
+	igt_fixture {
+		igt_display_fini(&display);
+		drm_close_driver(drm_fd);
+	}
+}
tests/meson.build +1 -0
index 2c2e1ca9acad..6b1b15973bde 100644
@@ -21,6 +21,7 @@ test_progs = [
 	'kms_atomic_interruptible',
 	'kms_atomic_transition',
 	'kms_bw',
+	'kms_closefb',
 	'kms_color',
 	'kms_concurrent',
 	'kms_content_protection',

base-commit: 93c5ec2105500f7083d0cb50db3fbb3bca3776bb

Signature · 1 line
2.42.0
#1 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_closefb: add CLOSEFB IOCTL test (rev2)

== Series Details ==

== Series Details ==

Series: tests/kms_closefb: add CLOSEFB IOCTL test (rev2)
URL : https://patchwork.freedesktop.org/series/125174/
State : failure

== Summary ==

CI Bug Log - changes from IGT_7545 -> IGTPW_10026
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_10026 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes
introduced in IGTPW_10026, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/index.html

Participating hosts (34 -> 33)
------------------------------

Additional (1): fi-ilk-650
Missing (2): fi-snb-2520m fi-bsw-n3050

Possible new issues
-------------------

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

### IGT changes ###

#### Possible regressions ####

* igt@i915_module_load@load:
- bat-jsl-3: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7545/bat-jsl-3/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/bat-jsl-3/igt@[email protected]
- bat-adln-1: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7545/bat-adln-1/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/bat-adln-1/igt@[email protected]

Known issues
------------

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

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@read_all_entries:
- fi-kbl-7567u: NOTRUN -> [ABORT][5] ([i915#8913])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/fi-kbl-7567u/igt@debugfs_test@read_all_entries.html

* igt@gem_close_race@basic-process:
- bat-dg1-5: [PASS][6] -> [INCOMPLETE][7] ([i915#2295])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7545/bat-dg1-5/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/bat-dg1-5/igt@[email protected]

* igt@gem_exec_suspend@basic-s0@smem:
- bat-dg2-9: [PASS][8] -> [INCOMPLETE][9] ([i915#9275])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7545/bat-dg2-9/igt@gem_exec_suspend@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/bat-dg2-9/igt@gem_exec_suspend@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-cfl-8109u: NOTRUN -> [SKIP][10] ([fdo#109271] / [i915#2190])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/fi-cfl-8109u/igt@[email protected]

* igt@gem_lmem_swapping@verify-random:
- fi-cfl-8109u: NOTRUN -> [SKIP][11] ([fdo#109271] / [i915#4613]) +3 other tests skip
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/fi-cfl-8109u/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- fi-cfl-8109u: NOTRUN -> [SKIP][12] ([fdo#109271]) +9 other tests skip
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/fi-cfl-8109u/igt@[email protected]

* igt@kms_psr@cursor_plane_move:
- fi-ilk-650: NOTRUN -> [SKIP][13] ([fdo#109271]) +19 other tests skip
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/fi-ilk-650/igt@kms_psr@cursor_plane_move.html

#### Possible fixes ####

* igt@i915_module_load@load:
- fi-kbl-7567u: [INCOMPLETE][14] -> [PASS][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7545/fi-kbl-7567u/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/fi-kbl-7567u/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-bsw-nick: [FAIL][16] ([i915#9276]) -> [PASS][17]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7545/fi-bsw-nick/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/fi-bsw-nick/igt@[email protected]

* igt@kms_hdmi_inject@inject-audio:
- fi-kbl-guc: [FAIL][18] ([IGT#3]) -> [PASS][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7545/fi-kbl-guc/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/fi-kbl-guc/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-d-edp-1:
- bat-rplp-1: [ABORT][20] ([i915#8668]) -> [PASS][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7545/bat-rplp-1/igt@kms_pipe_crc_basic@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/bat-rplp-1/igt@kms_pipe_crc_basic@[email protected]

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

[IGT#3]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/3
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2295]: https://gitlab.freedesktop.org/drm/intel/issues/2295
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#8668]: https://gitlab.freedesktop.org/drm/intel/issues/8668
[i915#8913]: https://gitlab.freedesktop.org/drm/intel/issues/8913
[i915#9275]: https://gitlab.freedesktop.org/drm/intel/issues/9275
[i915#9276]: https://gitlab.freedesktop.org/drm/intel/issues/9276

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_7545 -> IGTPW_10026

CI-20190529: 20190529
CI_DRM_13771: 1ba7a7c3ed3fc1ec846f5099a181993b6bc1b5b7 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_10026: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/index.html
IGT_7545: 4aac61139d076775a173a75a15156e408a366546 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

Testlist changes
----------------

+igt@kms_closefb@closefb-ioctl

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10026/index.html