lib/drmtest: Move open device to separate function
PATCH 1/1 lib/drmtest: Move open device to separate function
While working on IGT code and during reviewes I've noticed that it could be nice to have function that is opening particular device. Let's move out conditions for opening device and rename __open_device to __search_and_open() function.
--- lib/drmtest.c | 64 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 25 deletions(-)
lib/drmtest.c +39 -25
@@ -218,38 +218,52 @@ static void modprobe_i915(const char *name)igt_i915_driver_load (NULL ); } -static int __open_device (const char *base,int offset,unsigned int chipset) +static int open_device (const char *name,unsigned int chipset) { -for (int i =0 ; i <16 ; i++) { -char name[80 ]; -int fd; +int fd; -sprintf (name,"%s%u" , base, i + offset); - fd =open (name,O_RDWR ); -if (fd ==-1 ) -continue ; + fd =open (name,O_RDWR ); -if (chipset &DRIVER_INTEL &&is_i915_device (fd) && -has_known_intel_chipset (fd)) -return fd; +if (fd ==-1 ) +return -1 ; -if (chipset &DRIVER_VC4 &&is_vc4_device (fd)) -return fd; +if (chipset &DRIVER_INTEL &&is_i915_device (fd) && +has_known_intel_chipset (fd)) +return fd; -if (chipset &DRIVER_VGEM &&is_vgem_device (fd)) -return fd; +if (chipset &DRIVER_VC4 &&is_vc4_device (fd)) +return fd; -if (chipset &DRIVER_VIRTIO &&is_virtio_device (fd)) -return fd; +if (chipset &DRIVER_VGEM &&is_vgem_device (fd)) +return fd; -if (chipset &DRIVER_AMDGPU &&is_amd_device (fd)) -return fd; +if (chipset &DRIVER_VIRTIO &&is_virtio_device (fd)) +return fd; -/* Only VGEM-specific tests should be run on VGEM */ -if (chipset ==DRIVER_ANY && !is_vgem_device (fd)) -return fd; +if (chipset &DRIVER_AMDGPU &&is_amd_device (fd)) +return fd; -close (fd); +/* Only VGEM-specific tests should be run on VGEM */ +if (chipset ==DRIVER_ANY && !is_vgem_device (fd)) +return fd; + +close (fd); + +return -1 ; +} + +static int __search_and_open (const char *base,int offset,unsigned int chipset) +{ +for (int i =0 ; i <16 ; i++) { +char name[80 ]; +int fd; + +sprintf (name,"%s%u" , base, i + offset); + fd =open_device (name, chipset); +if (fd ==-1 ) +continue ; +else +return fd; }return -1 ;
@@ -272,7 +286,7 @@ static int __open_driver(const char *base, int offset, unsigned int chipset) };int fd; - fd =__open_device (base, offset, chipset); + fd =__search_and_open (base, offset, chipset);if (fd !=-1 )return fd;
@@ -287,7 +301,7 @@ static int __open_driver(const char *base, int offset, unsigned int chipset) }pthread_mutex_unlock (&mutex); -return __open_device (base, offset, chipset); +return __search_and_open (base, offset, chipset); }/**
Signature · 6 lines
2.17.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoting Katarzyna Dec (2018-08-30 09:38:29)
Quoted 4 lines
While working on IGT code and during reviewes I've noticed that it could be nice to have function that is opening particular device. Let's move out conditions for opening device and rename
__open_deviceto__search_and_open()function.
Sell an improvement. How about tackling that we repeat the drm_version_t name lookup for driver checking and make that efficient. Opening the way forward for a struct drm_driver.
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for lib/drmtest: Move open device to separate function
In reply to Katarzyna Dec== Series Details ==
== Series Details ==
Series: lib/drmtest: Move open device to separate function
URL : https://patchwork.freedesktop.org/series/48929/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_4737 -> IGTPW_1758 =
== Summary - SUCCESS ==
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/48929/revisions/1/mbox/
== Known issues ==
Here are the changes found in IGTPW_1758 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_flip@basic-plain-flip:
fi-ilk-650: PASS -> DMESG-WARN (fdo#106387) +3
igt@kms_pipe_crc_basic@nonblocking-crc-pipe-b-frame-sequence:
{fi-byt-clapper}: PASS -> FAIL (fdo#107362, fdo#103191) +1
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
fi-snb-2520m: PASS -> INCOMPLETE (fdo#103713)
fi-cnl-psr: PASS -> DMESG-WARN (fdo#104951)
==== Possible fixes ====
igt@kms_pipe_crc_basic@read-crc-pipe-a:
{fi-byt-clapper}: FAIL (fdo#107362) -> PASS
{igt@pm_rpm@module-reload}:
fi-cnl-psr: WARN (fdo#107602, fdo#107708) -> PASS {name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#104951 https://bugs.freedesktop.org/show_bug.cgi?id=104951
fdo#106387 https://bugs.freedesktop.org/show_bug.cgi?id=106387
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107602 https://bugs.freedesktop.org/show_bug.cgi?id=107602
fdo#107708 https://bugs.freedesktop.org/show_bug.cgi?id=107708
== Participating hosts (53 -> 49) ==
Missing (4): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan
== Build changes ==
* IGT: IGT_4611 -> IGTPW_1758
CI_DRM_4737: c8fe77635992b1f6b32102657faced7c9165c942 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1758: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1758/
IGT_4611: b966dd93a30f41581fe1dbf9bc1c4a29b552ca05 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1758/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.IGT: success for lib/drmtest: Move open device to separate function
In reply to Katarzyna Dec== Series Details ==
== Series Details ==
Series: lib/drmtest: Move open device to separate function
URL : https://patchwork.freedesktop.org/series/48929/
State : success
== Summary ==
= CI Bug Log - changes from IGT_4611_full -> IGTPW_1758_full =
== Summary - WARNING ==
Minor unknown changes coming with IGTPW_1758_full need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_1758_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/48929/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in IGTPW_1758_full:
=== IGT changes ===
==== Warnings ====
igt@perf_pmu@rc6:
shard-kbl: PASS -> SKIP== Known issues ==
Here are the changes found in IGTPW_1758_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@drv_suspend@shrink:
shard-hsw: PASS -> INCOMPLETE (fdo#106886, fdo#103540)
igt@gem_ppgtt@blt-vs-render-ctx0:
shard-kbl: PASS -> INCOMPLETE (fdo#106023, fdo#103665)
igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
shard-glk: PASS -> FAIL (fdo#105363)
igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-blt:
shard-glk: PASS -> FAIL (fdo#103167)
igt@kms_rotation_crc@primary-rotation-180:
shard-snb: PASS -> FAIL (fdo#103925)
igt@kms_setmode@basic:
shard-apl: PASS -> FAIL (fdo#99912)
igt@testdisplay:
shard-glk: PASS -> INCOMPLETE (k.org#198133, fdo#103359, fdo#107093)
==== Possible fixes ====
igt@drv_selftest@live_hangcheck:
shard-kbl: DMESG-FAIL (fdo#106560, fdo#106947) -> PASS
igt@gem_render_copy_redux@normal:
shard-kbl: INCOMPLETE (fdo#103665, fdo#106650) -> PASS
igt@kms_cursor_crc@cursor-64x64-suspend:
shard-kbl: INCOMPLETE (fdo#103665, fdo#107556) -> PASS
igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
shard-snb: INCOMPLETE (fdo#105411) -> PASS
igt@kms_setmode@basic:
shard-kbl: FAIL (fdo#99912) -> PASS fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
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#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106560 https://bugs.freedesktop.org/show_bug.cgi?id=106560
fdo#106650 https://bugs.freedesktop.org/show_bug.cgi?id=106650
fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
fdo#106947 https://bugs.freedesktop.org/show_bug.cgi?id=106947
fdo#107093 https://bugs.freedesktop.org/show_bug.cgi?id=107093
fdo#107556 https://bugs.freedesktop.org/show_bug.cgi?id=107556
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_4611 -> IGTPW_1758
* Linux: CI_DRM_4715 -> CI_DRM_4737
CI_DRM_4715: 1b73a69651beab39192502181c83e77a1022014a @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4737: c8fe77635992b1f6b32102657faced7c9165c942 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1758: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1758/
IGT_4611: b966dd93a30f41581fe1dbf9bc1c4a29b552ca05 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1758/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev