lib: Require drmModeResources()
PATCH v5 1/2 lib: Require drmModeResources()
From: Chris Wilson <[email protected]>
If modesetting is not supported, the drmModeGetResources() call will fail with -EINVAL (or -ENOTSUPP). As no displays are connected, skip.
--- lib/igt_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_kms.c +1 -1
@@ -1857,7 +1857,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) display->drm_fd = drm_fd; resources =drmModeGetResources (display->drm_fd); -igt_assert (resources); +igt_require (resources);/* * We cache the number of pipes, that number is a physical limit of the
Signature · 6 lines
2.19.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v5 2/2 tests: Check and skip unhandled tests that needs display
'lib: Require drmModeResources()' take care of all tests that calls igt_display_init(), here handling other tests that needs display and do not call it.
v2:
- Not skipping all tests in debugfs_test, perf_pmu and perf_pmu, now skiping only the required subtests
v3:
- Renamed igt_require_display to igt_display_required, to keep naming consistent
- Added igt_display_available()
- Checking if display is available by quering a modeset capability instead of drmModeGetResources()
- Not skiping read_all_entries tests when display is disabled
v4:
- Using 'lib: Require drmModeResources()', so all tests already handled by that patch had the igt_display_require() call removed.
v5:
- Replacing igt_display_require() calls to igt_require() over the return of drmModeGetResources() when possible
--- lib/igt_kms.c | 30 +++++++++++++- lib/igt_kms.h | 2 + tests/debugfs_test.c | 14 +++++-- tests/kms_3d.c | 3 +- tests/kms_addfb_basic.c | 4 +- tests/kms_draw_crc.c | 1 + tests/kms_fbcon_fbt.c | 1 + tests/kms_force_connector_basic.c | 2 +- tests/kms_getfb.c | 4 +- tests/kms_hdmi_inject.c | 1 + tests/kms_setmode.c | 2 +- tests/kms_sysfs_edid_timing.c | 4 ++ tests/kms_tv_load_detect.c | 2 +- tests/perf_pmu.c | 12 +++--- tests/pm_lpsp.c | 1 + tests/pm_rpm.c | 69 ++++++++++++++++++++++++------- tests/prime_vgem.c | 2 + tests/testdisplay.c | 23 ++++------- 18 files changed, 128 insertions(+), 49 deletions(-)
lib/igt_kms.c +29 -1
@@ -2018,6 +2018,34 @@ int igt_display_get_n_pipes(igt_display_t *display)return display->n_pipes; } +/** +* igt_display_require: +* @drm_fd: a drm file descriptor +* +* Checks if driver supports modeset and have display enabled. +*/ +void igt_display_require (int fd) +{ +bool available =igt_display_available (fd); +igt_require_f (available,"drm driver do not support modeset\n" ); +} + +/** +* igt_display_available: +* @drm_fd: a drm file descriptor +* +* Return true if driver supports modeset and have display enabled. +*/ +bool igt_display_available (int fd) +{ +uint64_t cap; + +/* Check if driver support modeset by checking one of the modeset +* specific capabilities, in case of error it is not supported. +*/ +return !drmGetCap (fd,DRM_CAP_DUMB_BUFFER , &cap); +} +/** * igt_display_require_output: * @display: A pointer to an #igt_display_t structure
@@ -3895,7 +3923,7 @@ void igt_enable_connectors(void) drm_fd =drm_open_driver (DRIVER_ANY ); res =drmModeGetResources (drm_fd); -igt_assert (res !=NULL ); +igt_require (res !=NULL );for (int i =0 ; i < res->count_connectors; i++) {drmModeConnector *c;
lib/igt_kms.h +2 -0
@@ -388,6 +388,8 @@ void igt_display_commit_atomic(igt_display_t *display, uint32_t flags, void *useint igt_display_try_commit2 (igt_display_t *display,enum igt_commit_style s);int igt_display_drop_events (igt_display_t *display);int igt_display_get_n_pipes (igt_display_t *display); +void igt_display_require (int fd); +bool igt_display_available (int fd);void igt_display_require_output (igt_display_t *display);void igt_display_require_output_on_pipe (igt_display_t *display,enum pipe pipe);
tests/debugfs_test.c +10 -4
@@ -102,7 +102,10 @@ igt_main debugfs =igt_debugfs_dir (fd);kmstest_set_vt_graphics_mode (); -igt_display_init (&display, fd); +if (igt_display_available (fd)) +igt_display_init (&display, fd); +else + display.n_pipes = display.n_outputs =0 ; } igt_subtest("read_all_entries") {
@@ -131,8 +134,9 @@ igt_main } } -igt_display_commit2 (&display, display.is_atomic ?COMMIT_ATOMIC :COMMIT_LEGACY ); - +if (display.n_pipes) +igt_display_commit2 (&display, display.is_atomic ? +COMMIT_ATOMIC :COMMIT_LEGACY );read_and_discard_sysfs_entries (debugfs,0 ); }
@@ -147,7 +151,9 @@ igt_mainfor_each_plane_on_pipe (&display, pipe, plane)igt_plane_set_fb (plane,NULL ); -igt_display_commit2 (&display, display.is_atomic ?COMMIT_ATOMIC :COMMIT_LEGACY ); +if (display.n_pipes) +igt_display_commit2 (&display, display.is_atomic ? +COMMIT_ATOMIC :COMMIT_LEGACY );read_and_discard_sysfs_entries (debugfs,0 ); }
tests/kms_3d.c +1 -2
@@ -36,10 +36,9 @@ igt_simple_mainint mode_count, connector_id; drm_fd =drm_open_driver_master (DRIVER_INTEL ); +igt_require (drmSetClientCap (drm_fd,DRM_CLIENT_CAP_STEREO_3D ,1 ) >=0 ); res =drmModeGetResources (drm_fd); -igt_assert (drmSetClientCap (drm_fd,DRM_CLIENT_CAP_STEREO_3D ,1 ) >=0 ); -/* find an hdmi connector */ for (int i =0 ; i < res->count_connectors; i++) {
tests/kms_addfb_basic.c +3 -1
@@ -671,8 +671,10 @@ int fd;igt_main { -igt_fixture + igt_fixture { fd =drm_open_driver_master (DRIVER_ANY ); +igt_display_require (fd); + }invalid_tests (fd);
tests/kms_draw_crc.c +1 -0
@@ -253,6 +253,7 @@ static void setup_environment(void)igt_require (drm_fd >=0 ); drm_res =drmModeGetResources (drm_fd); +igt_require (drm_res);igt_assert (drm_res->count_connectors <=MAX_CONNECTORS );for (i =0 ; i < drm_res->count_connectors; i++)
tests/kms_fbcon_fbt.c +1 -0
@@ -63,6 +63,7 @@ static void setup_drm(struct drm_info *drm) drm->debugfs_fd =igt_debugfs_dir (drm->fd); drm->res =drmModeGetResources (drm->fd); +igt_require (drm->res);igt_assert (drm->res->count_connectors <=MAX_CONNECTORS );for (i =0 ; i < drm->res->count_connectors; i++)
tests/kms_force_connector_basic.c +1 -1
@@ -90,7 +90,7 @@ int main(int argc, char **argv) drm_fd =drm_open_driver_master (DRIVER_INTEL ); res =drmModeGetResources (drm_fd); -igt_assert (res); +igt_require (res);/* find the vga connector */ for (int i =0 ; i < res->count_connectors; i++) {
tests/kms_getfb.c +3 -1
@@ -198,8 +198,10 @@ igt_main {int fd; -igt_fixture + igt_fixture { fd =drm_open_driver_master (DRIVER_ANY ); +igt_display_require (fd); + }igt_subtest_group test_handle_input (fd );
tests/kms_hdmi_inject.c +1 -0
@@ -255,6 +255,7 @@ igt_main igt_fixture { drm_fd =drm_open_driver_master (DRIVER_INTEL ); res =drmModeGetResources (drm_fd); +igt_require (res); connector =get_connector (drm_fd, res);igt_require (connector);
tests/kms_setmode.c +1 -1
@@ -858,7 +858,7 @@ int main(int argc, char **argv)kmstest_set_vt_graphics_mode (); drm_resources =drmModeGetResources (drm_fd); -igt_assert (drm_resources); +igt_require (drm_resources); }for (i =0 ; i <ARRAY_SIZE (tests); i++) {
tests/kms_sysfs_edid_timing.c +4 -0
@@ -41,6 +41,10 @@ igt_simple_main {DIR *dirp;struct dirent *de; +int drm_fd; + + drm_fd =drm_open_driver_master (DRIVER_ANY ); +close (drm_fd); dirp =opendir ("/sys/class/drm" );igt_assert (dirp !=NULL );
tests/kms_tv_load_detect.c +1 -1
@@ -38,7 +38,7 @@ int main(int argc, char **argv) igt_fixture { drm_fd =drm_open_driver_master (DRIVER_INTEL ); res =drmModeGetResources (drm_fd); -igt_assert (res); +igt_require (res);/* find the TV connector */ for (int i =0 ; i < res->count_connectors; i++) {
tests/perf_pmu.c +6 -6
@@ -1398,12 +1398,12 @@ test_rc6(int gem_fd, unsigned int flags)drmModeRes *res; res =drmModeGetResources (gem_fd); -igt_assert (res); - -/* force all connectors off */ -kmstest_set_vt_graphics_mode (); -kmstest_unset_all_crtcs (gem_fd, res); -drmModeFreeResources (res); +if (res) { +/* force all connectors off */ +kmstest_set_vt_graphics_mode (); +kmstest_unset_all_crtcs (gem_fd, res); +drmModeFreeResources (res); + }igt_require (igt_setup_runtime_pm ());igt_require (igt_wait_for_pm_status (IGT_RUNTIME_PM_STATUS_SUSPENDED ));
tests/pm_lpsp.c +1 -0
@@ -199,6 +199,7 @@ igt_main devid =intel_get_drm_devid (drm_fd); drm_res =drmModeGetResources (drm_fd); +igt_require (drm_res);igt_assert (drm_res->count_connectors <=MAX_CONNECTORS );for (i =0 ; i < drm_res->count_connectors; i++)
tests/pm_rpm.c +54 -15
213 lines not on this page · raw message
tests/prime_vgem.c +2 -0
@@ -747,6 +747,8 @@ static void test_flip(int i915, int vgem, unsigned hang)struct vgem_bo bo[2 ];uint32_t fb_id[2 ], handle[2 ], crtc_id; +igt_display_require (i915); +signal (SIGHUP , sighandler);for (int i =0 ; i <2 ; i++) {
tests/testdisplay.c +7 -16
@@ -112,17 +112,10 @@ struct connector {int pipe; }; -static void dump_connectors_fd (int drmfd) +static void dump_connectors_fd (int drmfd,drmModeRes *mode_resources) {int i, j; -drmModeRes *mode_resources =drmModeGetResources (drmfd); - -if (!mode_resources) { -igt_warn ("drmModeGetResources failed: %s\n" ,strerror (errno)); -return ; - } -igt_info ("Connectors:\n" );igt_info ("id\tencoder\tstatus\t\ttype\tsize (mm)\tmodes\n" );for (i =0 ; i < mode_resources->count_connectors; i++) {
@@ -154,10 +147,9 @@ static void dump_connectors_fd(int drmfd)drmModeFreeResources (mode_resources); } -static void dump_crtcs_fd (int drmfd) +static void dump_crtcs_fd (int drmfd,drmModeRes *mode_resources) {int i; -drmModeRes *mode_resources =drmModeGetResources (drmfd);igt_info ("CRTCs:\n" );igt_info ("id\tfb\tpos\tsize\n" );
@@ -181,8 +173,10 @@ static void dump_crtcs_fd(int drmfd)static void dump_info (void ) { -dump_connectors_fd (drm_fd); -dump_crtcs_fd (drm_fd); +drmModeRes *resources =drmModeGetResources (drm_fd); +igt_require (resources); +dump_connectors_fd (drm_fd, resources); +dump_crtcs_fd (drm_fd, resources); } static void connector_find_preferred_mode(uint32_t connector_id,
@@ -454,10 +448,7 @@ int update_display(bool probe)int c; resources =drmModeGetResources (drm_fd); -if (!resources) { -igt_warn ("drmModeGetResources failed: %s\n" ,strerror (errno)); -return 0 ; - } +igt_require (resources); connectors =calloc (resources->count_connectors,sizeof (struct connector ));
Signature · 6 lines
2.19.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,v5,1/2] lib: Require drmModeResources()
In reply to José Roberto de Souza== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,v5,1/2] lib: Require drmModeResources()
URL : https://patchwork.freedesktop.org/series/49679/
State : success
== Summary ==
= CI Bug Log - changes from IGT_4639_full -> IGTPW_1839_full =
== Summary - WARNING ==
Minor unknown changes coming with IGTPW_1839_full need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_1839_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/49679/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in IGTPW_1839_full:
=== IGT changes ===
==== Warnings ====
igt@gem_busy@extended-parallel-bsd1:
shard-hsw: SKIP -> ( 2 SKIP ) +896
igt@gem_exec_params@dr1-dirt:
shard-kbl: PASS -> ( 2 PASS ) +1726
igt@gem_mmap_wc@set-cache-level:
shard-glk: PASS -> ( 2 PASS ) +103
igt@gem_pread@stolen-uncached:
shard-kbl: SKIP -> ( 2 SKIP ) +629
igt@gem_pwrite@display:
shard-snb: PASS -> ( 2 PASS ) +979
igt@kms_chv_cursor_fail@pipe-b-256x256-top-edge:
shard-hsw: PASS -> ( 2 PASS ) +1692
igt@kms_flip@2x-plain-flip-ts-check:
shard-apl: SKIP -> ( 2 SKIP ) +788
igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-indfb-pgflip-blt:
shard-glk: SKIP -> ( 2 SKIP ) +35
igt@kms_rotation_crc@sprite-rotation-90-pos-100-0:
shard-apl: PASS -> ( 2 PASS ) +1722
igt@perf_pmu@busy-start-vcs1:
shard-snb: SKIP -> ( 2 SKIP ) +1013
igt@pm_rc6_residency@rc6-accuracy:
shard-snb: PASS -> ( 1 PASS, 1 SKIP )
igt@tools_test@tools_test:
shard-apl: PASS -> ( 2 SKIP )
shard-glk: PASS -> SKIP
shard-snb: PASS -> ( 2 SKIP )
shard-hsw: PASS -> ( 2 SKIP ) +1
shard-kbl: PASS -> ( 2 SKIP )== Known issues ==
Here are the changes found in IGTPW_1839_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@gem_userptr_blits@stress-mm:
shard-glk: PASS -> INCOMPLETE (fdo#103359, k.org#198133) +1
igt@kms_cursor_legacy@cursor-vs-flip-toggle:
shard-hsw: PASS -> ( 1 FAIL, 1 PASS ) (fdo#103355) +1
igt@kms_cursor_legacy@cursora-vs-flipa-toggle:
shard-glk: PASS -> DMESG-WARN (fdo#106538, fdo#105763)
igt@kms_flip@flip-vs-expired-vblank-interruptible:
shard-glk: PASS -> FAIL (fdo#105363, fdo#102887)
igt@kms_setmode@basic:
shard-glk: PASS -> FAIL (fdo#99912)
==== Possible fixes ====
igt@kms_atomic_transition@plane-all-modeset-transition-fencing:
shard-glk: INCOMPLETE (fdo#103359, k.org#198133) -> PASS +1
igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
shard-hsw: FAIL (fdo#105767) -> ( 2 PASS )
igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
shard-snb: FAIL (fdo#103166) -> PASS
igt@kms_rotation_crc@sprite-rotation-180:
shard-snb: FAIL (fdo#103925) -> ( 2 PASS )
igt@kms_sysfs_edid_timing:
shard-hsw: WARN (fdo#100047) -> ( 2 PASS )
shard-glk: WARN (fdo#100047) -> PASS
igt@perf_pmu@all-busy-check-all:
shard-snb: INCOMPLETE (fdo#105411) -> ( 2 PASS )
==== Warnings ====
igt@gem_exec_schedule@pi-ringfull-blt:
shard-apl: FAIL (fdo#103158) -> ( 2 FAIL ) (fdo#103158) +3
igt@gem_exec_schedule@pi-ringfull-bsd1:
shard-kbl: FAIL (fdo#103158) -> ( 2 FAIL ) (fdo#103158) +4
igt@kms_available_modes_crc@available_mode_test_crc:
shard-hsw: FAIL (fdo#106641) -> ( 2 FAIL ) (fdo#106641)
shard-kbl: FAIL (fdo#106641) -> ( 2 FAIL ) (fdo#106641)
igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
shard-apl: FAIL (fdo#106510, fdo#105458) -> ( 2 FAIL ) (fdo#106510, fdo#105458) +1
igt@kms_setmode@basic:
shard-apl: FAIL (fdo#99912) -> ( 1 FAIL, 1 PASS ) (fdo#99912)
shard-hsw: FAIL (fdo#99912) -> ( 2 FAIL ) (fdo#99912)
shard-snb: FAIL (fdo#99912) -> ( 2 FAIL ) (fdo#99912)
igt@kms_sysfs_edid_timing:
shard-apl: FAIL (fdo#100047) -> ( 2 FAIL ) (fdo#100047)
shard-kbl: FAIL (fdo#100047) -> ( 2 FAIL ) (fdo#100047) {name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103158 https://bugs.freedesktop.org/show_bug.cgi?id=103158
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103355 https://bugs.freedesktop.org/show_bug.cgi?id=103355
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#105458 https://bugs.freedesktop.org/show_bug.cgi?id=105458
fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
fdo#105767 https://bugs.freedesktop.org/show_bug.cgi?id=105767
fdo#106510 https://bugs.freedesktop.org/show_bug.cgi?id=106510
fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
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_4639 -> IGTPW_1839
* Linux: CI_DRM_4806 -> CI_DRM_4807
CI_DRM_4806: feeccde66999c5e87be3550f2159e5d7eeb61c67 @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4807: 55b148b84b254f61adbfeb89c4f6674664f01c46 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1839: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1839/
IGT_4639: c7fa2ea9fbce87206474748100b825558eebe08e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1839/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev