XE test cleanup to handle xe_device
cover XE test cleanup to handle xe_device
Instead of caching the xe_device struct at subtest level, cache just after opening the driver. And remove from the cache just before closing the driver. So, this series introduces new helper drm_close_driver() which helps to remove the xe_device & close the drm fd. So that every user must call drm_close_driver() instead of close().
V2: - Cleanup
- Split the patches into multiple
Bhanuprakash Modem (20):
lib: Interface to close the drm fd
lib: Cache xe_device at driver open/close level lib/xe/xe_query: Add xe_config() interface lib/igt_msm: Use drm_close_driver() to close the drm fd tests/amdgpu: Close the fd before exit
tests/i915: Close the fd before exit tests/nouveau_crc: Close the fd before exit tests/xe/xe_gpgpu_fill: Close the fd before exit tests/amdgpu: Use drm_close_driver() to close the drm fd tests/i915/kms_mmap_write_crc: Avoid closing the closed fd tests/panfrost: Use drm_close_driver() to close the drm fd tests/v3d: Use drm_close_driver() to close the drm fd tests/vc4: Use drm_close_driver() to close the drm fd tests/vmwgfx: Use drm_close_driver() to close the drm fd tests/kms: Use drm_close_driver() to close the drm fd tests/xe: Use drm_close_driver() to close the drm fd tests/i915: Use drm_close_driver() to close the drm fd tests/xe/xe_debugfs: Use xe_config() helper to get the config
tests: Drop xe_device get/put from test level Revert "lib/igt_kms: Cache xe_device info for kms tests"
lib/drmtest.c | 44 ++++++++++++++- lib/drmtest.h | 1 + lib/igt_kms.c | 8 --- lib/igt_msm.c | 2 +- lib/igt_types.c | 6 ++ lib/igt_vmwgfx.c | 2 +- lib/xe/xe_query.c | 8 +++ lib/xe/xe_query.h | 1 + tests/amdgpu/amd_abm.c | 1 + tests/amdgpu/amd_assr.c | 1 + tests/amdgpu/amd_basic.c | 2 +- tests/amdgpu/amd_cs_nop.c | 2 +- tests/amdgpu/amd_deadlock.c | 2 +- tests/amdgpu/amd_freesync_video_mode.c | 1 + tests/amdgpu/amd_info.c | 2 +- tests/amdgpu/amd_mem_leak.c | 1 + tests/amdgpu/amd_module_load.c | 2 +- tests/amdgpu/amd_prime.c | 6 +- tests/amdgpu/amd_psr.c | 3 +- tests/amdgpu/amd_vrr_range.c | 1 + tests/chamelium/kms_chamelium_audio.c | 2 +- tests/chamelium/kms_chamelium_edid.c | 2 +- tests/chamelium/kms_chamelium_frames.c | 2 +- tests/chamelium/kms_chamelium_hpd.c | 2 +- tests/core_auth.c | 10 ++-- tests/core_getclient.c | 2 +- tests/core_getstats.c | 2 +- tests/core_getversion.c | 2 +- tests/core_setmaster.c | 6 +- tests/core_setmaster_vs_auth.c | 6 +- tests/debugfs_test.c | 2 +- tests/dmabuf_sync_file.c | 3 + tests/drm_read.c | 3 + tests/dumb_buffer.c | 2 +- tests/eviction_common.c | 2 +- tests/fbdev.c | 2 +- tests/i915/api_intel_allocator.c | 6 +- tests/i915/api_intel_bb.c | 2 +- tests/i915/drm_fdinfo.c | 2 +- tests/i915/gem_bad_reloc.c | 2 +- tests/i915/gem_barrier_race.c | 5 +- tests/i915/gem_basic.c | 5 +- tests/i915/gem_blits.c | 2 +- tests/i915/gem_busy.c | 2 +- tests/i915/gem_caching.c | 2 +- tests/i915/gem_ccs.c | 2 +- tests/i915/gem_close_race.c | 14 ++--- tests/i915/gem_concurrent_all.c | 5 ++ tests/i915/gem_cs_tlb.c | 2 +- tests/i915/gem_ctx_bad_destroy.c | 2 +- tests/i915/gem_ctx_create.c | 4 +- tests/i915/gem_ctx_engines.c | 4 +- tests/i915/gem_ctx_exec.c | 5 +- tests/i915/gem_ctx_freq.c | 3 + tests/i915/gem_ctx_param.c | 2 +- tests/i915/gem_ctx_persistence.c | 6 +- tests/i915/gem_ctx_shared.c | 5 +- tests/i915/gem_ctx_sseu.c | 2 +- tests/i915/gem_ctx_switch.c | 2 +- tests/i915/gem_eio.c | 19 ++++--- tests/i915/gem_evict_alignment.c | 2 +- tests/i915/gem_evict_everything.c | 2 +- tests/i915/gem_exec_alignment.c | 5 +- tests/i915/gem_exec_async.c | 2 +- tests/i915/gem_exec_await.c | 2 +- tests/i915/gem_exec_balancer.c | 3 + tests/i915/gem_exec_basic.c | 2 +- tests/i915/gem_exec_big.c | 2 +- tests/i915/gem_exec_capture.c | 2 +- tests/i915/gem_exec_create.c | 2 +- tests/i915/gem_exec_endless.c | 3 + tests/i915/gem_exec_fair.c | 2 +- tests/i915/gem_exec_fence.c | 4 +- tests/i915/gem_exec_flush.c | 2 +- tests/i915/gem_exec_gttfill.c | 4 +- tests/i915/gem_exec_latency.c | 2 +- tests/i915/gem_exec_nop.c | 2 +- tests/i915/gem_exec_parallel.c | 4 +- tests/i915/gem_exec_params.c | 2 +- tests/i915/gem_exec_reloc.c | 2 +- tests/i915/gem_exec_schedule.c | 2 +- tests/i915/gem_exec_store.c | 2 +- tests/i915/gem_exec_suspend.c | 2 +- tests/i915/gem_exec_whisper.c | 6 +- tests/i915/gem_exercise_blt.c | 2 +- tests/i915/gem_fd_exhaustion.c | 2 +- tests/i915/gem_fence_thrash.c | 2 +- tests/i915/gem_fenced_exec_thrash.c | 2 +- tests/i915/gem_flink_basic.c | 7 ++- tests/i915/gem_flink_race.c | 6 +- tests/i915/gem_gtt_cpu_tlb.c | 2 +- tests/i915/gem_gtt_hog.c | 2 +- tests/i915/gem_gtt_speed.c | 2 +- tests/i915/gem_huc_copy.c | 2 +- tests/i915/gem_lmem_evict.c | 4 +- tests/i915/gem_lmem_swapping.c | 10 ++-- tests/i915/gem_madvise.c | 12 ++-- tests/i915/gem_media_fill.c | 2 +- tests/i915/gem_mmap.c | 2 +- tests/i915/gem_mmap_gtt.c | 6 +- tests/i915/gem_mmap_offset.c | 8 +-- tests/i915/gem_mmap_wc.c | 2 +- tests/i915/gem_partial_pwrite_pread.c | 2 +- tests/i915/gem_pipe_control_store_loop.c | 2 +- tests/i915/gem_ppgtt.c | 8 +-- tests/i915/gem_pread.c | 2 +- tests/i915/gem_pread_after_blit.c | 2 +- tests/i915/gem_pwrite.c | 2 +- tests/i915/gem_pwrite_snooped.c | 2 +- tests/i915/gem_pxp.c | 2 +- tests/i915/gem_read_read_speed.c | 2 +- tests/i915/gem_readwrite.c | 2 +- tests/i915/gem_reg_read.c | 2 +- tests/i915/gem_render_copy.c | 2 +- tests/i915/gem_render_copy_redux.c | 2 +- tests/i915/gem_reset_stats.c | 32 +++++------ tests/i915/gem_ringfill.c | 2 +- tests/i915/gem_set_tiling_vs_blt.c | 2 +- tests/i915/gem_set_tiling_vs_gtt.c | 2 +- tests/i915/gem_set_tiling_vs_pwrite.c | 2 +- tests/i915/gem_shrink.c | 14 ++--- tests/i915/gem_softpin.c | 4 +- tests/i915/gem_spin_batch.c | 2 +- tests/i915/gem_streaming_writes.c | 2 +- tests/i915/gem_stress.c | 2 +- tests/i915/gem_sync.c | 2 +- tests/i915/gem_tiled_blits.c | 2 +- tests/i915/gem_tiled_fence_blits.c | 2 +- tests/i915/gem_tiled_partial_pwrite_pread.c | 2 +- tests/i915/gem_tiled_pread_basic.c | 2 +- tests/i915/gem_tiled_pread_pwrite.c | 2 +- tests/i915/gem_tiled_swapping.c | 2 +- tests/i915/gem_tiled_wb.c | 2 +- tests/i915/gem_tiled_wc.c | 2 +- tests/i915/gem_tiling_max_stride.c | 2 +- tests/i915/gem_unfence_active_buffers.c | 2 +- tests/i915/gem_unref_active_buffers.c | 2 +- tests/i915/gem_userptr_blits.c | 9 ++- tests/i915/gem_vm_create.c | 4 +- tests/i915/gem_wait.c | 2 +- tests/i915/gem_watchdog.c | 2 +- tests/i915/gem_workarounds.c | 5 +- tests/i915/gen7_exec_parse.c | 4 +- tests/i915/gen9_exec_parse.c | 2 +- tests/i915/i915_fb_tiling.c | 2 +- tests/i915/i915_getparams_basic.c | 2 +- tests/i915/i915_hangman.c | 4 +- tests/i915/i915_hwmon.c | 2 +- tests/i915/i915_module_load.c | 8 +-- tests/i915/i915_pciid.c | 2 +- tests/i915/i915_pm_backlight.c | 2 +- tests/i915/i915_pm_dc.c | 2 +- tests/i915/i915_pm_freq_api.c | 2 +- tests/i915/i915_pm_freq_mult.c | 2 +- tests/i915/i915_pm_lpsp.c | 2 +- tests/i915/i915_pm_rc6_residency.c | 2 +- tests/i915/i915_pm_rps.c | 5 +- tests/i915/i915_pm_sseu.c | 2 +- tests/i915/i915_power.c | 2 +- tests/i915/i915_query.c | 2 +- tests/i915/i915_suspend.c | 6 +- tests/i915/kms_big_fb.c | 2 +- tests/i915/kms_big_joiner.c | 2 +- tests/i915/kms_busy.c | 2 +- tests/i915/kms_ccs.c | 2 +- tests/i915/kms_cdclk.c | 2 +- tests/i915/kms_draw_crc.c | 2 +- tests/i915/kms_dsc.c | 2 +- tests/i915/kms_fbcon_fbt.c | 2 +- tests/i915/kms_fence_pin_leak.c | 2 +- tests/i915/kms_flip_scaled_crc.c | 2 +- tests/i915/kms_flip_tiling.c | 2 +- tests/i915/kms_frontbuffer_tracking.c | 2 +- tests/i915/kms_legacy_colorkey.c | 2 +- tests/i915/kms_mmap_write_crc.c | 3 +- tests/i915/kms_pipe_b_c_ivb.c | 2 +- tests/i915/kms_psr.c | 2 +- tests/i915/kms_psr2_sf.c | 2 +- tests/i915/kms_psr2_su.c | 2 +- tests/i915/kms_psr_stress_test.c | 2 +- tests/i915/kms_pwrite_crc.c | 2 +- tests/i915/perf.c | 6 +- tests/i915/perf_pmu.c | 6 +- tests/i915/sysfs_defaults.c | 2 +- tests/i915/sysfs_heartbeat_interval.c | 2 +- tests/i915/sysfs_preempt_timeout.c | 2 +- tests/i915/sysfs_timeslice_duration.c | 2 +- tests/kms_3d.c | 8 +-- tests/kms_addfb_basic.c | 13 +---- tests/kms_async_flips.c | 2 +- tests/kms_atomic.c | 2 +- tests/kms_atomic_interruptible.c | 2 +- tests/kms_atomic_transition.c | 2 +- tests/kms_color.c | 2 +- tests/kms_concurrent.c | 2 +- tests/kms_content_protection.c | 2 +- tests/kms_cursor_crc.c | 2 +- tests/kms_cursor_edge_walk.c | 2 +- tests/kms_cursor_legacy.c | 2 +- tests/kms_dither.c | 2 +- tests/kms_dp_aux_dev.c | 2 +- tests/kms_dp_tiled_display.c | 2 +- tests/kms_flip.c | 11 +--- tests/kms_flip_event_leak.c | 8 +-- tests/kms_force_connector_basic.c | 4 +- tests/kms_getfb.c | 19 +------ tests/kms_hdmi_inject.c | 9 +-- tests/kms_hdr.c | 2 +- tests/kms_invalid_mode.c | 2 +- tests/kms_lease.c | 4 +- tests/kms_panel_fitting.c | 2 +- tests/kms_pipe_crc_basic.c | 2 +- tests/kms_plane.c | 2 +- tests/kms_plane_alpha_blend.c | 2 +- tests/kms_plane_cursor.c | 2 +- tests/kms_plane_lowres.c | 2 +- tests/kms_plane_multiple.c | 2 +- tests/kms_plane_scaling.c | 2 +- tests/kms_prime.c | 6 +- tests/kms_prop_blob.c | 8 +-- tests/kms_properties.c | 2 +- tests/kms_rmfb.c | 4 +- tests/kms_rotation_crc.c | 2 +- tests/kms_scaling_modes.c | 2 +- tests/kms_sequence.c | 2 +- tests/kms_setmode.c | 9 +-- tests/kms_tv_load_detect.c | 2 +- tests/kms_universal_plane.c | 2 +- tests/kms_vblank.c | 2 +- tests/kms_vrr.c | 1 + tests/kms_writeback.c | 1 + tests/nouveau_crc.c | 6 +- tests/panfrost_gem_new.c | 4 +- tests/panfrost_get_param.c | 2 +- tests/panfrost_prime.c | 4 +- tests/panfrost_submit.c | 6 +- tests/prime_busy.c | 2 +- tests/prime_mmap.c | 2 +- tests/prime_mmap_coherency.c | 4 +- tests/prime_mmap_kms.c | 2 +- tests/prime_self_import.c | 26 ++++----- tests/prime_vgem.c | 4 +- tests/syncobj_basic.c | 2 +- tests/syncobj_timeline.c | 2 +- tests/syncobj_wait.c | 2 +- tests/template.c | 2 +- tests/testdisplay.c | 4 +- tests/v3d/v3d_create_bo.c | 4 +- tests/v3d/v3d_get_bo_offset.c | 2 +- tests/v3d/v3d_get_param.c | 2 +- tests/v3d/v3d_job_submission.c | 2 +- tests/v3d/v3d_mmap.c | 2 +- tests/v3d/v3d_perfmon.c | 2 +- tests/v3d/v3d_submit_cl.c | 2 +- tests/v3d/v3d_submit_csd.c | 2 +- tests/v3d/v3d_wait_bo.c | 2 +- tests/vc4/vc4_create_bo.c | 4 +- tests/vc4/vc4_dmabuf_poll.c | 2 +- tests/vc4/vc4_label_bo.c | 2 +- tests/vc4/vc4_lookup_fail.c | 2 +- tests/vc4/vc4_mmap.c | 2 +- tests/vc4/vc4_perfmon.c | 2 +- tests/vc4/vc4_purgeable_bo.c | 2 +- tests/vc4/vc4_tiling.c | 2 +- tests/vc4/vc4_wait_bo.c | 2 +- tests/vc4/vc4_wait_seqno.c | 2 +- tests/vgem_basic.c | 6 +- tests/vgem_slow.c | 2 +- tests/vmwgfx/vmw_execution_buffer.c | 2 +- tests/vmwgfx/vmw_ref_count.c | 4 +- tests/vmwgfx/vmw_surface_copy.c | 2 +- tests/xe/xe_compute.c | 10 +--- tests/xe/xe_create.c | 11 +--- tests/xe/xe_debugfs.c | 10 +--- tests/xe/xe_dma_buf_sync.c | 15 ++--- tests/xe/xe_evict.c | 11 +--- tests/xe/xe_exec_balancer.c | 10 +--- tests/xe/xe_exec_basic.c | 10 +--- tests/xe/xe_exec_compute_mode.c | 10 +--- tests/xe/xe_exec_fault_mode.c | 7 +-- tests/xe/xe_exec_reset.c | 31 +++-------- tests/xe/xe_exec_threads.c | 28 +++------- tests/xe/xe_gpgpu_fill.c | 4 +- tests/xe/xe_guc_pc.c | 4 +- tests/xe/xe_huc_copy.c | 10 +--- tests/xe/xe_intel_bb.c | 4 +- tests/xe/xe_mmap.c | 10 +--- tests/xe/xe_mmio.c | 10 +--- tests/xe/xe_module_load.c | 2 +- tests/xe/xe_noexec_ping_pong.c | 4 +- tests/xe/xe_pm.c | 5 +- tests/xe/xe_prime_self_import.c | 61 ++++++--------------- tests/xe/xe_query.c | 10 +--- tests/xe/xe_vm.c | 7 +-- tests/xe/xe_waitfence.c | 10 +--- 295 files changed, 583 insertions(+), 655 deletions(-)
--
2.40.0
PATCH 1/20 lib: Interface to close the drm fd
Add new helper drm_close_driver() to close the drm fd. Now every user could call drm_close_driver() instead of close().
V2: - Fix commit message
- Add debug prints
--- lib/drmtest.c | 20 ++++++++++++++++++++ lib/drmtest.h | 1 + 2 files changed, 21 insertions(+)
lib/drmtest.c +20 -0
@@ -605,6 +605,26 @@ int drm_open_driver(int chipset)return fd; } +/** +* __drm_close_driver: +* @fd: a drm file descriptor +* +* Close the drm file descriptor @fd. +* +* Returns: 0 on success or -1 on error. +*/ +int drm_close_driver (int fd) +{ +/* Avoid closing standard file descriptors (0, 1, and 2). */ +if (fd <3 ) { +igt_debug ("Don't attempt to close standard/invalid file " +"descriptor: %d\n" , fd); +return -1 ; + } + +return close (fd); +} +/** * drm_open_driver_master: * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL
lib/drmtest.h +1 -0
@@ -105,6 +105,7 @@ int drm_open_driver_render(int chipset);int __drm_open_driver_another (int idx,int chipset);int __drm_open_driver (int chipset);int __drm_open_driver_render (int chipset); +int drm_close_driver (int fd);int drm_reopen_driver (int fd);
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 01/20] lib: Interface to close the drm fd
Quoted 26 lines · Bhanuprakash Modem
Add new helper
drm_close_driver()to close the drm fd. Now every user could calldrm_close_driver()instead ofclose().V2: - Fix commit message
- Add debug printsSigned-off-by Bhanuprakash Modem <[email protected]>--- lib/drmtest.c | 20 ++++++++++++++++++++ lib/drmtest.h | 1 + 2 files changed, 21 insertions(+)lib/drmtest.c +6
-0@@ -605,6 +605,26 @@ int drm_open_driver(int chipset)return fd; } +/** +* __drm_close_driver: +* @fd: a drm file descriptor +* +* Close the drm file descriptor @fd. +*
lib/drmtest.c int drm_open_driver(int chipset) · line 623
Quoted 10 lines
lib/drmtest.c +10
-0+* Returns: 0 on success or -1 on error. +*/ +int drm_close_driver (int fd) +{ +/* Avoid closing standard file descriptors (0, 1, and 2). */ +if (fd <3 ) { +igt_debug ("Don't attempt to close standard/invalid file " +"descriptor: %d\n" , fd); +return -1 ; + }
Maybe you shouldn't allow passing invalid descriptor at all and assert?
igt_assert(fd >= 0);
?
We can avoid situation when test will blow up long time after this code.
If you want to verify your fd is really drm fd just check what fd is leading to. Like readlink() with checking /dev/dri/card|render or sth.
--
Zbigniew
Quoted 22 lines
lib/drmtest.c +4
-0+ +return close (fd); +} +/** * drm_open_driver_master: * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL lib/drmtest.h +1
-0@@ -105,6 +105,7 @@ int drm_open_driver_render(int chipset);int __drm_open_driver_another (int idx,int chipset);int __drm_open_driver (int chipset);int __drm_open_driver_render (int chipset); +int drm_close_driver (int fd);int drm_reopen_driver (int fd);Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 01/20] lib: Interface to close the drm fd
In reply to Bhanuprakash ModemQuoted 26 lines · Bhanuprakash Modem
Add new helper
drm_close_driver()to close the drm fd. Now every user could calldrm_close_driver()instead ofclose().V2: - Fix commit message
- Add debug printsSigned-off-by Bhanuprakash Modem <[email protected]>--- lib/drmtest.c | 20 ++++++++++++++++++++ lib/drmtest.h | 1 + 2 files changed, 21 insertions(+)lib/drmtest.c +6
-0@@ -605,6 +605,26 @@ int drm_open_driver(int chipset)return fd; } +/** +* __drm_close_driver: +* @fd: a drm file descriptor +* +* Close the drm file descriptor @fd. +*
lib/drmtest.c int drm_open_driver(int chipset) · line 623
Quoted 10 lines
lib/drmtest.c +10
-0+* Returns: 0 on success or -1 on error. +*/ +int drm_close_driver (int fd) +{ +/* Avoid closing standard file descriptors (0, 1, and 2). */ +if (fd <3 ) { +igt_debug ("Don't attempt to close standard/invalid file " +"descriptor: %d\n" , fd); +return -1 ; + }
Just noticed you've altered other gpus tests. That means you shouldn't assume 0-2 are standard fds.
--
Zbigniew
Quoted 22 lines
lib/drmtest.c +4
-0+ +return close (fd); +} +/** * drm_open_driver_master: * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL lib/drmtest.h +1
-0@@ -105,6 +105,7 @@ int drm_open_driver_render(int chipset);int __drm_open_driver_another (int idx,int chipset);int __drm_open_driver (int chipset);int __drm_open_driver_render (int chipset); +int drm_close_driver (int fd);int drm_reopen_driver (int fd);Signature · 1 line
2.40.0
PATCH v3 1/20 lib: Interface to close the drm fd
In reply to Bhanuprakash ModemAdd new helper drm_close_driver() to close the drm fd. Now every user could call drm_close_driver() instead of close().
V2: - Fix commit message
- Add debug prints
V3: - Check the validity of fd before close
--- lib/drmtest.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ lib/drmtest.h | 1 + 2 files changed, 45 insertions(+)
lib/drmtest.c +44 -0
@@ -605,6 +605,50 @@ int drm_open_driver(int chipset)return fd; } +static bool is_valid_fd (int fd) +{ +char path[32 ]; +char buf[PATH_MAX ]; +int len; + +if (fd <0 ) +return false; + +snprintf (path,sizeof (path),"/proc/self/fd/%d" , fd); + +memset (buf,0 ,sizeof (buf)); + len =readlink (path, buf,sizeof (buf) -1 ); +if (len <=0 ) +return false; + + buf[len] ='\0' ; +if (strstr (buf,"/dev/dri/card" ) == buf || +strstr (buf,"/dev/dri/renderD" ) == buf) +return true; + +return false; +} + +/** +* drm_close_driver: +* @fd: a drm file descriptor +* +* Check the given drm file descriptor @fd is valid & Close if it is +* an valid drm fd. +* +* Returns: 0 on success or -1 on error. +*/ +int drm_close_driver (int fd) +{ +if (!is_valid_fd (fd)) { +igt_debug ("Don't attempt to close standard/invalid file " +"descriptor: %d\n" , fd); +return -1 ; + } + +return close (fd); +} +/** * drm_open_driver_master: * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL
lib/drmtest.h +1 -0
@@ -105,6 +105,7 @@ int drm_open_driver_render(int chipset);int __drm_open_driver_another (int idx,int chipset);int __drm_open_driver (int chipset);int __drm_open_driver_render (int chipset); +int drm_close_driver (int fd);int drm_reopen_driver (int fd);
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t V3 01/20] lib: Interface to close the drm fd
Quoted 50 lines · Bhanuprakash Modem
Add new helper
drm_close_driver()to close the drm fd. Now every user could calldrm_close_driver()instead ofclose().V2: - Fix commit message
- Add debug prints
V3: - Check the validity of fd before closeCc Zbigniew Kempczyński <[email protected]>Signed-off-by Bhanuprakash Modem <[email protected]>--- lib/drmtest.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ lib/drmtest.h | 1 + 2 files changed, 45 insertions(+)lib/drmtest.c +28
-0@@ -605,6 +605,50 @@ int drm_open_driver(int chipset)return fd; } +static bool is_valid_fd (int fd) +{ +char path[32 ]; +char buf[PATH_MAX ]; +int len; + +if (fd <0 ) +return false; + +snprintf (path,sizeof (path),"/proc/self/fd/%d" , fd); + +memset (buf,0 ,sizeof (buf)); + len =readlink (path, buf,sizeof (buf) -1 ); +if (len <=0 ) +return false; + + buf[len] ='\0' ; +if (strstr (buf,"/dev/dri/card" ) == buf || +strstr (buf,"/dev/dri/renderD" ) == buf) +return true; + +return false; +} + +/** +* drm_close_driver: +* @fd: a drm file descriptor +*
lib/drmtest.c int drm_open_driver(int chipset) · line 645
Quoted 10 lines
lib/drmtest.c +10
-0+* Check the given drm file descriptor @fd is valid & Close if it is +* an valid drm fd. +* +* Returns: 0 on success or -1 on error. +*/ +int drm_close_driver (int fd) +{ +if (!is_valid_fd (fd)) { +igt_debug ("Don't attempt to close standard/invalid file " +"descriptor: %d\n" , fd);
I would change this debug to igt_warn(). Closing not drm fd looks like programmer mistake and should be fixed. With this minor fix:
--
Zbigniew
Quoted 24 lines
lib/drmtest.c +6
-0+return -1 ; + } + +return close (fd); +} +/** * drm_open_driver_master: * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL lib/drmtest.h +1
-0@@ -105,6 +105,7 @@ int drm_open_driver_render(int chipset);int __drm_open_driver_another (int idx,int chipset);int __drm_open_driver (int chipset);int __drm_open_driver_render (int chipset); +int drm_close_driver (int fd);int drm_reopen_driver (int fd);Signature · 1 line
2.40.0
PATCH 2/20 lib: Cache xe_device at driver open/close level
In reply to Bhanuprakash ModemInstead of caching the xe_device struct at subtest level, cache just after opening the driver. And remove from the cache just before closing the driver.
V2: - Place the logic in correct helpers (Zbigniew)
--- lib/drmtest.c | 24 +++++++++++++++++++++--- lib/igt_types.c | 6 ++++++ 2 files changed, 27 insertions(+), 3 deletions(-)
lib/drmtest.c +21 -3
@@ -64,6 +64,7 @@#include "intel_reg.h" #include "ioctl_wrappers.h" #include "igt_dummyload.h" +#include "xe/xe_query.h" /** * SECTION:drmtest
@@ -465,9 +466,14 @@ int __drm_open_driver_another(int idx, int chipset) fd =__open_driver ("/dev/dri/card" ,0 , chipset, idx); } -if (fd >=0 ) +if (fd >=0 ) {_set_opened_fd (idx, fd); +/* Cache xe_device struct. */ +if (is_xe_device (fd)) +xe_device_get (fd); + } +return fd; }
@@ -491,6 +497,8 @@ int __drm_open_driver(int chipset)int __drm_open_driver_render (int chipset) { +int fd; +if (chipset !=DRIVER_VGEM &&igt_device_filter_count () >0 ) {struct igt_device_card card;bool found;
@@ -500,10 +508,16 @@ int __drm_open_driver_render(int chipset)if (!found || !strlen (card.render))return -1 ; -return __open_driver_exact (card.render, chipset); + fd =__open_driver_exact (card.render, chipset); + }else { + fd =__open_driver ("/dev/dri/renderD" ,128 , chipset,0 ); } -return __open_driver ("/dev/dri/renderD" ,128 , chipset,0 ); +/* Cache xe_device struct. */ +if (fd >=0 &&is_xe_device (fd)) +xe_device_get (fd); + +return fd; }static int at_exit_drm_fd =-1 ;
@@ -622,6 +636,10 @@ int drm_close_driver(int fd)return -1 ; } +/* Remove xe_device from cache. */ +if (is_xe_device (fd)) +xe_device_put (fd); +return close (fd); }
lib/igt_types.c +6 -0
@@ -5,13 +5,19 @@#include <unistd.h> +#include "drmtest.h" #include "igt_types.h" +#include "xe/xe_query.h" void igt_cleanup_fd (volatile int *fd) {if (!fd || *fd <0 )return ; +/* Remove xe_device from cache. */ +if (is_xe_device (*fd)) +xe_device_put (*fd); +close (*fd); *fd =-1 ; }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 02/20] lib: Cache xe_device at driver open/close level
Quoted 8 lines · Bhanuprakash Modem
Instead of caching the
xe_devicestruct at subtest level, cache just after opening the driver. And remove from the cache just before closing the driver.V2: - Place the logic in correct helpers (Zbigniew)
Signed-off-by Bhanuprakash Modem <[email protected]>Reviewed-by Kamil Konieczny <[email protected]>
LGTM too:
--
Zbigniew
Quoted 99 lines
--- lib/drmtest.c | 24 +++++++++++++++++++++--- lib/igt_types.c | 6 ++++++ 2 files changed, 27 insertions(+), 3 deletions(-)lib/drmtest.c +21
-3@@ -64,6 +64,7 @@#include "intel_reg.h" #include "ioctl_wrappers.h" #include "igt_dummyload.h" +#include "xe/xe_query.h" /** * SECTION:drmtest @@ -465,9 +466,14 @@ int __drm_open_driver_another(int idx, int chipset) fd =__open_driver ("/dev/dri/card" ,0 , chipset, idx); } -if (fd >=0 ) +if (fd >=0 ) {_set_opened_fd (idx, fd); +/* Cache xe_device struct. */ +if (is_xe_device (fd)) +xe_device_get (fd); + } +return fd; }@@ -491,6 +497,8 @@ int __drm_open_driver(int chipset)int __drm_open_driver_render (int chipset) { +int fd; +if (chipset !=DRIVER_VGEM &&igt_device_filter_count () >0 ) {struct igt_device_card card;bool found;@@ -500,10 +508,16 @@ int __drm_open_driver_render(int chipset)if (!found || !strlen (card.render))return -1 ; -return __open_driver_exact (card.render, chipset); + fd =__open_driver_exact (card.render, chipset); + }else { + fd =__open_driver ("/dev/dri/renderD" ,128 , chipset,0 ); } -return __open_driver ("/dev/dri/renderD" ,128 , chipset,0 ); +/* Cache xe_device struct. */ +if (fd >=0 &&is_xe_device (fd)) +xe_device_get (fd); + +return fd; }static int at_exit_drm_fd =-1 ;@@ -622,6 +636,10 @@ int drm_close_driver(int fd)return -1 ; } +/* Remove xe_device from cache. */ +if (is_xe_device (fd)) +xe_device_put (fd); +return close (fd); }lib/igt_types.c +6
-0@@ -5,13 +5,19 @@#include <unistd.h> +#include "drmtest.h" #include "igt_types.h" +#include "xe/xe_query.h" void igt_cleanup_fd (volatile int *fd) {if (!fd || *fd <0 )return ; +/* Remove xe_device from cache. */ +if (is_xe_device (*fd)) +xe_device_put (*fd); +close (*fd); *fd =-1 ; }Signature · 1 line
2.40.0
PATCH 3/20 lib/xe/xe_query: Add xe_config() interface
In reply to Bhanuprakash ModemAdd support to get XE configuration from xe_device.
--- lib/xe/xe_query.c | 8 ++++++++ lib/xe/xe_query.h | 1 + 2 files changed, 9 insertions(+)
lib/xe/xe_query.c +8 -0
@@ -479,6 +479,14 @@ uint32_t xe_min_page_size(int fd, uint64_t region)return xe_mem_region (fd, region)->min_page_size; } +/** +* xe_config: +* @fd: xe device fd +* +* Returns xe configuration of xe device @fd. +*/ +xe_dev_FN(xe_config, config, struct drm_xe_query_config *); +/** * xe_number_hw_engine: * @fd: xe device fd
lib/xe/xe_query.h +1 -0
@@ -86,6 +86,7 @@ struct drm_xe_engine_class_instance *xe_hw_engine(int fd, int idx);struct drm_xe_query_mem_region *xe_mem_region (int fd,uint64_t region);const char *xe_region_name (uint64_t region);uint32_t xe_min_page_size (int fd,uint64_t region); +struct drm_xe_query_config *xe_config (int fd);unsigned int xe_number_hw_engines (int fd);bool xe_has_vram (int fd);uint64_t xe_vram_size (int fd,int gt);
Signature · 1 line
2.40.0
PATCH 4/20 lib/igt_msm: Use drm_close_driver() to close the drm fd
In reply to Bhanuprakash ModemTo close the drm file descriptor, use igt helper drm_close_driver() instead of using close().
--- lib/igt_msm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_msm.c +1 -1
@@ -87,7 +87,7 @@ igt_msm_dev_close(struct msm_device *dev) {if (!dev)return ; -close (dev->fd); +drm_close_driver (dev->fd);free (dev); }
Signature · 1 line
2.40.0
PATCH 5/20 tests/amdgpu: Close the fd before exit
In reply to Bhanuprakash ModemClose the file descriptor before exiting the test.
--- tests/amdgpu/amd_abm.c | 1 + tests/amdgpu/amd_assr.c | 1 + tests/amdgpu/amd_freesync_video_mode.c | 1 + tests/amdgpu/amd_mem_leak.c | 1 + tests/amdgpu/amd_psr.c | 3 ++- tests/amdgpu/amd_vrr_range.c | 1 + 6 files changed, 7 insertions(+), 1 deletion(-)
tests/amdgpu/amd_abm.c +1 -0
@@ -378,5 +378,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.drm_fd); } }
tests/amdgpu/amd_assr.c +1 -0
@@ -299,5 +299,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }
tests/amdgpu/amd_freesync_video_mode.c +1 -0
@@ -868,5 +868,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.drm_fd); } }
tests/amdgpu/amd_mem_leak.c +1 -0
@@ -232,5 +232,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }
tests/amdgpu/amd_psr.c +2 -1
@@ -640,7 +640,7 @@ static void run_check_psr_su_cursor(data_t *data, bool test_mpo)* panning the primary plane at the top-left of screen * set alpha region in overlay plane and set alpha to 0.0 to show primary plane * set cursor plane and starting from position of (0, 0) -*/ +*/ draw_color_alpha (&data->ov_fb[0 ],0 ,0 , data->pfb_w, data->pfb_h,1.0 ,1.0 ,1.0 ,.0 );igt_plane_set_fb (data->primary, &data->pm_fb[0 ]);igt_plane_set_fb (data->overlay, &data->ov_fb[0 ]);
@@ -763,5 +763,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) }close (data.debugfs_fd);igt_display_fini (&data.display); +drm_close_driver (data.fd); } }
tests/amdgpu/amd_vrr_range.c +1 -0
@@ -338,5 +338,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 05/20] tests/amdgpu: Close the fd before exit
Hi Bhanuprakash,
+cc Vitaliy and Christian
Regards,
Kamil
Quoted 92 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Cc David Zhang <[email protected]>Cc Harry Wentland <[email protected]>Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/amdgpu/amd_abm.c | 1 + tests/amdgpu/amd_assr.c | 1 + tests/amdgpu/amd_freesync_video_mode.c | 1 + tests/amdgpu/amd_mem_leak.c | 1 + tests/amdgpu/amd_psr.c | 3 ++- tests/amdgpu/amd_vrr_range.c | 1 + 6 files changed, 7 insertions(+), 1 deletion(-)tests/amdgpu/amd_abm.c +1
-0@@ -378,5 +378,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.drm_fd); } }tests/amdgpu/amd_assr.c +1
-0@@ -299,5 +299,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }tests/amdgpu/amd_freesync_video_mode.c +1
-0@@ -868,5 +868,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.drm_fd); } }tests/amdgpu/amd_mem_leak.c +1
-0@@ -232,5 +232,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }tests/amdgpu/amd_psr.c +2
-1@@ -640,7 +640,7 @@ static void run_check_psr_su_cursor(data_t *data, bool test_mpo)* panning the primary plane at the top-left of screen * set alpha region in overlay plane and set alpha to 0.0 to show primary plane * set cursor plane and starting from position of (0, 0) -*/ +*/ draw_color_alpha (&data->ov_fb[0 ],0 ,0 , data->pfb_w, data->pfb_h,1.0 ,1.0 ,1.0 ,.0 );igt_plane_set_fb (data->primary, &data->pm_fb[0 ]);igt_plane_set_fb (data->overlay, &data->ov_fb[0 ]);@@ -763,5 +763,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) }close (data.debugfs_fd);igt_display_fini (&data.display); +drm_close_driver (data.fd); } }tests/amdgpu/amd_vrr_range.c +1
-0@@ -338,5 +338,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 05/20] tests/amdgpu: Close the fd before exit
Hi Kamil,
Thanks for letting us know about new(?) function
/drm_close_driver/.
Is there a pending change, I could not find this function in the DRM or IGT.
We open the driver with /drm_open_driver/, but then we use close vs /drm_close_driver/. I makes sense to have a symmetrical call:
/open/close/ and /drm_open_driver/drm_close_driver/
Thanks, Vitaly
Quoted 103 lines · Kamil Konieczny
Hi Bhanuprakash,
+cc Vitaliy and Christian
Cc Vitaly Prosyak <[email protected]>Cc Christian König <[email protected]>Regards,
KamilQuoted 92 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Cc David Zhang <[email protected]>Cc Harry Wentland <[email protected]>Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/amdgpu/amd_abm.c | 1 + tests/amdgpu/amd_assr.c | 1 + tests/amdgpu/amd_freesync_video_mode.c | 1 + tests/amdgpu/amd_mem_leak.c | 1 + tests/amdgpu/amd_psr.c | 3 ++- tests/amdgpu/amd_vrr_range.c | 1 + 6 files changed, 7 insertions(+), 1 deletion(-)tests/amdgpu/amd_abm.c +1
-0@@ -378,5 +378,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.drm_fd); } }tests/amdgpu/amd_assr.c +1
-0@@ -299,5 +299,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }tests/amdgpu/amd_freesync_video_mode.c +1
-0@@ -868,5 +868,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.drm_fd); } }tests/amdgpu/amd_mem_leak.c +1
-0@@ -232,5 +232,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }tests/amdgpu/amd_psr.c +2
-1@@ -640,7 +640,7 @@ static void run_check_psr_su_cursor(data_t *data, bool test_mpo)* panning the primary plane at the top-left of screen * set alpha region in overlay plane and set alpha to 0.0 to show primary plane * set cursor plane and starting from position of (0, 0) -*/ +*/ draw_color_alpha (&data->ov_fb[0 ],0 ,0 , data->pfb_w, data->pfb_h,1.0 ,1.0 ,1.0 ,.0 );igt_plane_set_fb (data->primary, &data->pm_fb[0 ]);igt_plane_set_fb (data->overlay, &data->ov_fb[0 ]);@@ -763,5 +763,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) }close (data.debugfs_fd);igt_display_fini (&data.display); +drm_close_driver (data.fd); } }tests/amdgpu/amd_vrr_range.c +1
-0@@ -338,5 +338,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 05/20] tests/amdgpu: Close the fd before exit
Hi Vitaliy,
Quoted 6 lines · vitaly prosyak
Hi Kamil,
Thanks for letting us know about new(?) function
/drm_close_driver/.Is there a pending change, I could not find this function in the DRM or IGT.
Yes, changes are not yet landed into the IGT (WIP).
Please refer Patch 1/20 in this series:
https://patchwork.freedesktop.org/patch/538070/?series=117263&rev=5
- Bhanu
Quoted 111 lines
We open the driver with /drm_open_driver/, but then we use close vs /drm_close_driver/. I makes sense to have a symmetrical call:
/open/close/ and /drm_open_driver/drm_close_driver/Thanks, Vitaly
Quoted 103 lines · Kamil Konieczny
Hi Bhanuprakash,
+cc Vitaliy and Christian
Cc Vitaly Prosyak<[email protected]>Cc Christian König<[email protected]>Regards,
KamilQuoted 92 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Cc David Zhang<[email protected]>Cc Harry Wentland<[email protected]>Signed-off-by Bhanuprakash Modem<[email protected]>--- tests/amdgpu/amd_abm.c | 1 + tests/amdgpu/amd_assr.c | 1 + tests/amdgpu/amd_freesync_video_mode.c | 1 + tests/amdgpu/amd_mem_leak.c | 1 + tests/amdgpu/amd_psr.c | 3 ++- tests/amdgpu/amd_vrr_range.c | 1 + 6 files changed, 7 insertions(+), 1 deletion(-)tests/amdgpu/amd_abm.c +1
-0@@ -378,5 +378,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.drm_fd); } }tests/amdgpu/amd_assr.c +1
-0@@ -299,5 +299,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }tests/amdgpu/amd_freesync_video_mode.c +1
-0@@ -868,5 +868,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.drm_fd); } }tests/amdgpu/amd_mem_leak.c +1
-0@@ -232,5 +232,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }tests/amdgpu/amd_psr.c +2
-1@@ -640,7 +640,7 @@ static void run_check_psr_su_cursor(data_t *data, bool test_mpo)* panning the primary plane at the top-left of screen * set alpha region in overlay plane and set alpha to 0.0 to show primary plane * set cursor plane and starting from position of (0, 0) -*/ +*/ draw_color_alpha (&data->ov_fb[0 ],0 ,0 , data->pfb_w, data->pfb_h,1.0 ,1.0 ,1.0 ,.0 );igt_plane_set_fb (data->primary, &data->pm_fb[0 ]);igt_plane_set_fb (data->overlay, &data->ov_fb[0 ]);@@ -763,5 +763,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) }close (data.debugfs_fd);igt_display_fini (&data.display); +drm_close_driver (data.fd); } }tests/amdgpu/amd_vrr_range.c +1
-0@@ -338,5 +338,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.fd); } }Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 05/20] tests/amdgpu: Close the fd before exit
Hi guys,
Am 15.06.23 um 06:46 schrieb Modem, Bhanuprakash:
Quoted 8 lines
Hi Vitaliy,
Quoted 5 lines · vitaly prosyak
Hi Kamil,
Thanks for letting us know about new(?) function
/drm_close_driver/.
Quoted 6 lines
Quoted 1 line
Is there a pending change, I could not find this function in the DRM or IGT.
Yes, changes are not yet landed into the IGT (WIP).
Please refer Patch 1/20 in this series:
https://patchwork.freedesktop.org/patch/538070/?series=117263&rev=5
well neither this patch here nor the referenced series is correct.
The libdrm functions take ownership of the file descriptor given to them!
So the application or in this case IGT is *not* supposed to close them at all.
Regards,
Christian.
Quoted 114 lines
- Bhanu
Quoted 111 lines
We open the driver with /drm_open_driver/, but then we use close vs /drm_close_driver/. I makes sense to have a symmetrical call:
/open/close/ and /drm_open_driver/drm_close_driver/Thanks, Vitaly
Quoted 103 lines · Kamil Konieczny
Hi Bhanuprakash,
+cc Vitaliy and Christian
Cc Vitaly Prosyak<[email protected]>Cc Christian König<[email protected]>Regards,
KamilQuoted 92 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Cc David Zhang<[email protected]>Cc Harry Wentland<[email protected]>Signed-off-by Bhanuprakash Modem<[email protected]>---
tests/amdgpu/amd_abm.c | 1 +
tests/amdgpu/amd_assr.c | 1 +
tests/amdgpu/amd_freesync_video_mode.c| 1 +
tests/amdgpu/amd_mem_leak.c | 1 +
tests/amdgpu/amd_psr.c | 3 ++-
tests/amdgpu/amd_vrr_range.c | 1 +6 files changed, 7 insertions(+), 1 deletion(-)tests/amdgpu/amd_abm.c +1
-0@@ -378,5 +378,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.drm_fd); } }tests/amdgpu/amd_assr.c +0
-0@@ -299,5 +299,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}tests/amdgpu/amd_freesync_video_mode.c +1
-0@@ -868,5 +868,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.drm_fd); } }tests/amdgpu/amd_mem_leak.c +0
-0@@ -232,5 +232,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}tests/amdgpu/amd_psr.c +1
-1@@ -640,7 +640,7 @@ static void run_check_psr_su_cursor(data_t*data, bool test_mpo) * panning the primary plane at the top-left of screen * set alpha region in overlay plane and set alpha to 0.0 to show primary plane * set cursor plane and starting from position of (0, 0) -*/ +*/ draw_color_alpha(&data->ov_fb[0], 0, 0, data->pfb_w, data->pfb_h, 1.0, 1.0, 1.0, .0); igt_plane_set_fb(data->primary, &data->pm_fb[0]);
igt_plane_set_fb(data->overlay, &data->ov_fb[0]);tests/amdgpu/amd_psr.c +1
-0@@ -763,5 +763,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) } close(data.debugfs_fd); igt_display_fini(&data.display); + drm_close_driver(data.fd); }}
tests/amdgpu/amd_vrr_range.c +0
-0@@ -338,5 +338,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 05/20] tests/amdgpu: Close the fd before exit
Quoted 15 lines · Christian König
Hi guys,
Am 15.06.23 um 06:46 schrieb Modem, Bhanuprakash:
Quoted 12 lines
Hi Vitaliy,
Quoted 6 lines · vitaly prosyak
Hi Kamil,
Thanks for letting us know about new(?) function
/drm_close_driver/.Is there a pending change, I could not find this function in the DRM or IGT.
Yes, changes are not yet landed into the IGT (WIP).
Quoted 8 lines
Quoted 2 lines
Please refer Patch 1/20 in this series:
https://patchwork.freedesktop.org/patch/538070/?series=117263&rev=5well neither this patch here nor the referenced series is correct.
The libdrm functions take ownership of the file descriptor given to them!
So the application or in this case IGT is *not* supposed to close them at all.
Unfortunately, that is not correct.
The application (IGT in this case), opens the driver and uses the libdrm functions to perform operations (like ioctl), but file descriptor is still with the IGT only.
Once it is done with the operations performed, it's IGT responsibility to close the driver (I think there are few gcc options available to close the device on IGT exit)
A typical IGT sudo-code:
fd = open(/dev/device); libdrm_call(fd); libdrm_call(fd); close(fd);
- Bhanu
Quoted 119 lines
Regards,
Christian.Quoted 114 lines
- Bhanu
Quoted 111 lines
We open the driver with /drm_open_driver/, but then we use close vs /drm_close_driver/. I makes sense to have a symmetrical call:
/open/close/ and /drm_open_driver/drm_close_driver/Thanks, Vitaly
Quoted 103 lines · Kamil Konieczny
Hi Bhanuprakash,
+cc Vitaliy and Christian
Cc Vitaly Prosyak<[email protected]>Cc Christian König<[email protected]>Regards,
KamilQuoted 92 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Cc David Zhang<[email protected]>Cc Harry Wentland<[email protected]>Signed-off-by Bhanuprakash Modem<[email protected]>---
tests/amdgpu/amd_abm.c | 1 +
tests/amdgpu/amd_assr.c | 1 +
tests/amdgpu/amd_freesync_video_mode.c| 1 +
tests/amdgpu/amd_mem_leak.c | 1 +
tests/amdgpu/amd_psr.c | 3 ++-
tests/amdgpu/amd_vrr_range.c | 1 +6 files changed, 7 insertions(+), 1 deletion(-)tests/amdgpu/amd_abm.c +1
-0@@ -378,5 +378,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.drm_fd); } }tests/amdgpu/amd_assr.c +0
-0@@ -299,5 +299,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}tests/amdgpu/amd_freesync_video_mode.c +1
-0@@ -868,5 +868,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.drm_fd); } }tests/amdgpu/amd_mem_leak.c +0
-0@@ -232,5 +232,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}tests/amdgpu/amd_psr.c +1
-1@@ -640,7 +640,7 @@ static void run_check_psr_su_cursor(data_t*data, bool test_mpo) * panning the primary plane at the top-left of screen * set alpha region in overlay plane and set alpha to 0.0 to show primary plane * set cursor plane and starting from position of (0, 0) -*/ +*/ draw_color_alpha(&data->ov_fb[0], 0, 0, data->pfb_w, data->pfb_h, 1.0, 1.0, 1.0, .0); igt_plane_set_fb(data->primary, &data->pm_fb[0]);
igt_plane_set_fb(data->overlay, &data->ov_fb[0]);tests/amdgpu/amd_psr.c +1
-0@@ -763,5 +763,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) } close(data.debugfs_fd); igt_display_fini(&data.display); + drm_close_driver(data.fd); }}
tests/amdgpu/amd_vrr_range.c +0
-0@@ -338,5 +338,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 05/20] tests/amdgpu: Close the fd before exit
Am 15.06.23 um 10:28 schrieb Modem, Bhanuprakash:
Quoted 23 lines · Christian König
Quoted 20 lines
Hi guys,
Am 15.06.23 um 06:46 schrieb Modem, Bhanuprakash:
Quoted 8 lines
Hi Vitaliy,
Quoted 5 lines · vitaly prosyak
Hi Kamil,
Thanks for letting us know about new(?) function
/drm_close_driver/.Quoted 6 lines
Quoted 1 line
Is there a pending change, I could not find this function in the DRM or IGT.
Yes, changes are not yet landed into the IGT (WIP).
Please refer Patch 1/20 in this series:
https://patchwork.freedesktop.org/patch/538070/?series=117263&rev=5well neither this patch here nor the referenced series is correct.
Quoted 7 lines
Quoted 3 lines
The libdrm functions take ownership of the file descriptor given to them!
So the application or in this case IGT is *not* supposed to close them at all.
Unfortunately, that is not correct.
The application (IGT in this case), opens the driver and uses the libdrm functions to perform operations (like ioctl), but file descriptor is still with the IGT only.
Ok, so we dup() the file descriptor somewhere?
Because at least amdgpu_device_free_internal() is clearly closing the fd before freeing the device structure:
static void amdgpu_device_free_internal(amdgpu_device_handle dev) {
...
close(dev->fd);
...
free(dev);
}
Quoted 2 lines
Once it is done with the operations performed, it's IGT responsibility to close the driver (I think there are few gcc options available to close the device on IGT exit)
Well no, that's not related to gcc in any way possible. File descriptors are closed by the kernel on process exit.
Regards,
Christian.
Quoted 131 lines
A typical IGT sudo-code:
fd = open(/dev/device);
libdrm_call(fd);
libdrm_call(fd);close(fd);
- Bhanu
Quoted 119 lines
Regards,
Christian.Quoted 114 lines
- Bhanu
Quoted 111 lines
We open the driver with /drm_open_driver/, but then we use close vs /drm_close_driver/. I makes sense to have a symmetrical call:
/open/close/ and /drm_open_driver/drm_close_driver/Thanks, Vitaly
Quoted 103 lines · Kamil Konieczny
Hi Bhanuprakash,
+cc Vitaliy and Christian
Cc Vitaly Prosyak<[email protected]>Cc Christian König<[email protected]>Regards,
KamilQuoted 92 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Cc David Zhang<[email protected]>Cc Harry Wentland<[email protected]>Signed-off-by Bhanuprakash Modem<[email protected]>---
tests/amdgpu/amd_abm.c | 1 +
tests/amdgpu/amd_assr.c | 1 +
tests/amdgpu/amd_freesync_video_mode.c| 1 +
tests/amdgpu/amd_mem_leak.c | 1 +
tests/amdgpu/amd_psr.c | 3 ++-
tests/amdgpu/amd_vrr_range.c | 1 +6 files changed, 7 insertions(+), 1 deletion(-)tests/amdgpu/amd_abm.c +1
-0@@ -378,5 +378,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.drm_fd); } }tests/amdgpu/amd_assr.c +0
-0@@ -299,5 +299,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}tests/amdgpu/amd_freesync_video_mode.c +1
-0@@ -868,5 +868,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.drm_fd); } }tests/amdgpu/amd_mem_leak.c +0
-0@@ -232,5 +232,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}tests/amdgpu/amd_psr.c +1
-1@@ -640,7 +640,7 @@ static void run_check_psr_su_cursor(data_t*data, bool test_mpo) * panning the primary plane at the top-left of screen * set alpha region in overlay plane and set alpha to 0.0 to show primary plane * set cursor plane and starting from position of (0, 0) -*/ +*/ draw_color_alpha(&data->ov_fb[0], 0, 0, data->pfb_w, data->pfb_h, 1.0, 1.0, 1.0, .0); igt_plane_set_fb(data->primary, &data->pm_fb[0]);
igt_plane_set_fb(data->overlay, &data->ov_fb[0]);tests/amdgpu/amd_psr.c +1
-0@@ -763,5 +763,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) } close(data.debugfs_fd); igt_display_fini(&data.display); + drm_close_driver(data.fd); }}
tests/amdgpu/amd_vrr_range.c +0
-0@@ -338,5 +338,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 05/20] tests/amdgpu: Close the fd before exit
Hi Christian,
I dropped David Zhang from Cc because I got bounce:
David Zhang ([email protected])<mailto:[email protected]> The email address you entered couldn't be found
Maybe address should be [email protected] ?
Quoted 42 lines · Christian König
Am 15.06.23 um 10:28 schrieb Modem, Bhanuprakash:
Quoted 27 lines · Christian König
Quoted 24 lines
Hi guys,
Am 15.06.23 um 06:46 schrieb Modem, Bhanuprakash:
Quoted 8 lines
Hi Vitaliy,
Quoted 5 lines · vitaly prosyak
Hi Kamil,
Thanks for letting us know about new(?) function
/drm_close_driver/.Quoted 7 lines
Quoted 2 lines
Is there a pending change, I could not find this function in the DRM or IGT.
Yes, changes are not yet landed into the IGT (WIP).
Please refer Patch 1/20 in this series:
https://patchwork.freedesktop.org/patch/538070/?series=117263&rev=5well neither this patch here nor the referenced series is correct.
The libdrm functions take ownership of the file descriptor given to them!
Quoted 8 lines
Quoted 2 lines
So the application or in this case IGT is *not* supposed to close them at all.
Unfortunately, that is not correct.
The application (IGT in this case), opens the driver and uses the libdrm functions to perform operations (like ioctl), but file descriptor is still with the IGT only.
Ok, so we
dup()the file descriptor somewhere?Because at least
amdgpu_device_free_internal()is clearly closing the fd before freeing the device structure:
Quoted 8 lines
static void
amdgpu_device_free_internal(amdgpu_device_handle dev){
...
close(dev->fd);
...
free(dev);
}
I see, so we should drop amd patches with drm_close_driver() from this patch series.
Btw I do see in tests/amdgpu/amd_info.c at last fixture:
igt_fixture {
amdgpu_device_deinitialize(dev);
close(fd);
}That "close(fd);" should be removed from amd_info.c test.
Regards,
Kamil
Quoted 151 lines
Quoted 5 lines
Once it is done with the operations performed, it's IGT responsibility to close the driver (I think there are few gcc options available to close the device on IGT exit)
Well no, that's not related to gcc in any way possible. File descriptors are closed by the kernel on process exit.
Regards,
Christian.Quoted 138 lines
A typical IGT sudo-code:
fd = open(/dev/device);
libdrm_call(fd);
libdrm_call(fd);close(fd);
- Bhanu
Quoted 126 lines
Regards,
Christian.Quoted 121 lines
- Bhanu
Quoted 118 lines
We open the driver with /drm_open_driver/, but then we use close vs /drm_close_driver/. I makes sense to have a symmetrical call:
/open/close/ and /drm_open_driver/drm_close_driver/Thanks, Vitaly
Quoted 108 lines · Kamil Konieczny
Hi Bhanuprakash,
+cc Vitaliy and Christian
Cc Vitaly Prosyak<[email protected]>Cc Christian König<[email protected]>Regards,
KamilQuoted 97 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Cc David Zhang<[email protected]>Cc Harry Wentland<[email protected]>Signed-off-by Bhanuprakash Modem<[email protected]>---
tests/amdgpu/amd_abm.c | 1 +
tests/amdgpu/amd_assr.c | 1 +
tests/amdgpu/amd_freesync_video_mode.c| 1 +
tests/amdgpu/amd_mem_leak.c | 1 +
tests/amdgpu/amd_psr.c | 3 ++-
tests/amdgpu/amd_vrr_range.c | 1 +6 files changed, 7 insertions(+), 1 deletion(-)tests/amdgpu/amd_abm.c +1
-0@@ -378,5 +378,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.drm_fd); } }tests/amdgpu/amd_assr.c +0
-0@@ -299,5 +299,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}tests/amdgpu/amd_freesync_video_mode.c +1
-0@@ -868,5 +868,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.drm_fd); } }tests/amdgpu/amd_mem_leak.c +0
-0@@ -232,5 +232,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}tests/amdgpu/amd_psr.c +0
-0@@ -640,7 +640,7 @@ static void run_check_psr_su_cursor(data_t *data, bool test_mpo) * panning the primary plane at the top-left of screen * set alpha region in overlay plane and setalpha to 0.0 to show primary plane
* set cursor plane and starting from position of (0, 0) - */
+ */
draw_color_alpha(&data->ov_fb[0], 0, 0, data->pfb_w, data->pfb_h, 1.0, 1.0, 1.0, .0);igt_plane_set_fb(data->primary, &data->pm_fb[0]);igt_plane_set_fb(data->overlay, &data->ov_fb[0]);tests/amdgpu/amd_psr.c +1
-0@@ -763,5 +763,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) } close(data.debugfs_fd); igt_display_fini(&data.display); + drm_close_driver(data.fd); }}
tests/amdgpu/amd_vrr_range.c +0
-0@@ -338,5 +338,6 @@ igt_main
igt_fixture
{
igt_display_fini(&data.display);
+drm_close_driver(data.fd);
}
}Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 05/20] tests/amdgpu: Close the fd before exit
Am 15.06.23 um 13:48 schrieb Kamil Konieczny:
Quoted 8 lines
Hi Christian,
I dropped David Zhang from Cc because I got bounce:
David Zhang ([email protected])<mailto:[email protected]> The email address you entered couldn't be found
Maybe address should be [email protected] ?
David unfortunately doesn't work for AMD any more. Just completely drop him.
Quoted 50 lines · Christian König
Quoted 37 lines
Am 15.06.23 um 10:28 schrieb Modem, Bhanuprakash:
Quoted 24 lines · Christian König
Quoted 22 lines
Hi guys,
Am 15.06.23 um 06:46 schrieb Modem, Bhanuprakash:
Quoted 8 lines
Hi Vitaliy,
Quoted 5 lines · vitaly prosyak
Hi Kamil,
Thanks for letting us know about new(?) function
/drm_close_driver/.Quoted 6 lines
Quoted 2 lines
Is there a pending change, I could not find this function in the DRM or IGT.
Yes, changes are not yet landed into the IGT (WIP).
Please refer Patch 1/20 in this series:
https://patchwork.freedesktop.org/patch/538070/?series=117263&rev=5well neither this patch here nor the referenced series is correct.
The libdrm functions take ownership of the file descriptor given to them!
Quoted 7 lines
Quoted 2 lines
So the application or in this case IGT is *not* supposed to close them at all.
Unfortunately, that is not correct.
The application (IGT in this case), opens the driver and uses the libdrm functions to perform operations (like ioctl), but file descriptor is still with the IGT only.
Ok, so we
dup()the file descriptor somewhere?Because at least
amdgpu_device_free_internal()is clearly closing the fd before freeing the device structure:Quoted 8 lines
static void
amdgpu_device_free_internal(amdgpu_device_handle dev){
...
close(dev->fd);
...
free(dev);
}I see, so we should drop amd patches with
drm_close_driver()from this patch series.
Quoted 8 lines
Btw I do see in
tests/amdgpu/amd_info.cat last fixture:igt_fixture { amdgpu_device_deinitialize(dev); close(fd); }That "close(fd);" should be removed from
amd_info.ctest.
After digging through the full source code I've found the matching dup() to the close in amdgpu_device_free_internal().
It's part of amdgpu_device_initialize() but uses the fnctl() version of dup(), so my "grep dup*" I couldn't find it of hand:
dev->fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
Sorry for the noise, your original patch was correct to begin with.
Regards,
Christian.
Quoted 146 lines
Regards,
KamilQuoted 142 lines
Quoted 3 lines
Once it is done with the operations performed, it's IGT responsibility to close the driver (I think there are few gcc options available to close the device on IGT exit)
Well no, that's not related to gcc in any way possible. File descriptors are closed by the kernel on process exit.
Regards,
Christian.Quoted 133 lines
A typical IGT sudo-code:
fd = open(/dev/device);
libdrm_call(fd);
libdrm_call(fd);close(fd);
- Bhanu
Quoted 122 lines
Regards,
Christian.Quoted 119 lines
- Bhanu
Quoted 117 lines
We open the driver with /drm_open_driver/, but then we use close vs /drm_close_driver/. I makes sense to have a symmetrical call:
/open/close/ and /drm_open_driver/drm_close_driver/Thanks, Vitaly
Quoted 108 lines · Kamil Konieczny
Hi Bhanuprakash,
+cc Vitaliy and Christian
Cc Vitaly Prosyak<[email protected]>Cc Christian König<[email protected]>Regards,
KamilQuoted 97 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Cc David Zhang<[email protected]>Cc Harry Wentland<[email protected]>Signed-off-by Bhanuprakash Modem<[email protected]>--- tests/amdgpu/amd_abm.c | 1 + tests/amdgpu/amd_assr.c | 1 + tests/amdgpu/amd_freesync_video_mode.c | 1 + tests/amdgpu/amd_mem_leak.c | 1 + tests/amdgpu/amd_psr.c | 3 ++- tests/amdgpu/amd_vrr_range.c | 1 + 6 files changed, 7 insertions(+), 1 deletion(-)tests/amdgpu/amd_abm.c +1
-0@@ -378,5 +378,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.drm_fd); } }tests/amdgpu/amd_assr.c +1
-0@@ -299,5 +299,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.fd); } }tests/amdgpu/amd_freesync_video_mode.c +1
-0@@ -868,5 +868,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.drm_fd); } }tests/amdgpu/amd_mem_leak.c +1
-0@@ -232,5 +232,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.fd); } }tests/amdgpu/amd_psr.c +0
-0@@ -640,7 +640,7 @@ static void run_check_psr_su_cursor(data_t *data, bool test_mpo) * panning the primary plane at the top-left of screen * set alpha region in overlay plane and setalpha to 0.0 to show primary plane
* set cursor plane and starting from position of (0, 0)
- */
+ */
draw_color_alpha(&data->ov_fb[0], 0, 0,data->pfb_w,data->pfb_h, 1.0, 1.0, 1.0, .0);
igt_plane_set_fb(data->primary, &data->pm_fb[0]);igt_plane_set_fb(data->overlay, &data->ov_fb[0]);tests/amdgpu/amd_psr.c +1
-0@@ -763,5 +763,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) } close(data.debugfs_fd); igt_display_fini(&data.display); + drm_close_driver(data.fd); }}
tests/amdgpu/amd_vrr_range.c +1
-0@@ -338,5 +338,6 @@ igt_main igt_fixture { igt_display_fini(&data.display); + drm_close_driver(data.fd); } }Signature · 1 line
2.40.0
PATCH 6/20 tests/i915: Close the fd before exit
In reply to Bhanuprakash ModemClose the file descriptor before exiting the test.
--- tests/dmabuf_sync_file.c | 3 +++ tests/drm_read.c | 3 +++ tests/i915/gem_barrier_race.c | 3 +++ tests/i915/gem_basic.c | 3 +++ tests/i915/gem_concurrent_all.c | 5 +++++ tests/i915/gem_ctx_engines.c | 4 +++- tests/i915/gem_ctx_exec.c | 3 +++ tests/i915/gem_ctx_freq.c | 3 +++ tests/i915/gem_ctx_shared.c | 3 +++ tests/i915/gem_eio.c | 3 +++ tests/i915/gem_exec_alignment.c | 3 +++ tests/i915/gem_exec_balancer.c | 3 +++ tests/i915/gem_exec_endless.c | 3 +++ tests/i915/gem_flink_basic.c | 3 +++ tests/i915/gem_userptr_blits.c | 3 +++ tests/i915/gem_workarounds.c | 3 +++ tests/i915/i915_pm_rps.c | 3 +++ 17 files changed, 53 insertions(+), 1 deletion(-)
tests/dmabuf_sync_file.c +3 -0
@@ -380,4 +380,7 @@ igt_main "operations."); igt_subtest("import-multiple-read-write")test_import_multiple (fd, true); + +igt_fixture +drm_close_driver (fd ); }
tests/drm_read.c +3 -0
@@ -311,4 +311,7 @@ igt_main igt_subtest("short-buffer-wakeup")test_short_buffer_wakeup (fd, pipe); + +igt_fixture +drm_close_driver (fd ); }
tests/i915/gem_barrier_race.c +3 -0
@@ -153,4 +153,7 @@ igt_mainbreak ; } } + +igt_fixture +drm_close_driver (fd ); }
tests/i915/gem_basic.c +3 -0
@@ -117,4 +117,7 @@ igt_mainigt_describe ("Verify that closing drm driver is possible with opened gem object." ); igt_subtest("create-fd-close")test_create_fd_close (fd); + +igt_fixture +drm_close_driver (fd ); }
tests/i915/gem_concurrent_all.c +5 -0
@@ -2015,4 +2015,9 @@ igt_main } } } + + igt_fixture { +drm_close_driver (fd); +drm_close_driver (vgem_drv); + } }
tests/i915/gem_ctx_engines.c +3 -1
@@ -633,6 +633,8 @@ igt_mainindependent_all (i915, ctx); } -igt_fixture + igt_fixture {igt_stop_hang_detector (); +drm_close_driver (i915); + } }
tests/i915/gem_ctx_exec.c +3 -0
@@ -546,4 +546,7 @@ igt_maingem_context_destroy (fd, ctx_id);put_ahnd (ahnd); } + +igt_fixture +drm_close_driver (fd ); }
tests/i915/gem_ctx_freq.c +3 -0
@@ -213,4 +213,7 @@ igt_main igt_subtest_f("sysfs")sysfs_range (i915); + +igt_fixture +drm_close_driver (i915 ); }
tests/i915/gem_ctx_shared.c +3 -0
@@ -1088,4 +1088,7 @@ igt_mainigt_stop_hang_detector (); } } + +igt_fixture +drm_close_driver (i915 ); }
tests/i915/gem_eio.c +3 -0
@@ -1126,4 +1126,7 @@ igt_mainintel_allocator_multiprocess_stop (); } } + +igt_fixture +drm_close_driver (fd ); }
tests/i915/gem_exec_alignment.c +3 -0
@@ -546,4 +546,7 @@ igt_mainprio_inversion (fd,SHARED ); igt_subtest("pi-isolated")prio_inversion (fd,ISOLATED ); + +igt_fixture +drm_close_driver (fd ); }
tests/i915/gem_exec_balancer.c +3 -0
@@ -3482,4 +3482,7 @@ igt_main igt_subtest("nohangcheck")nohangcheck (i915); } + +igt_fixture +drm_close_driver (i915 ); }
tests/i915/gem_exec_endless.c +3 -0
@@ -367,4 +367,7 @@ igt_mainintel_register_access_fini (&mmio); } } + +igt_fixture +drm_close_driver (i915 ); }
tests/i915/gem_flink_basic.c +3 -0
@@ -188,4 +188,7 @@ igt_mainigt_describe ("Tests flink lifetime by referencing from multiple descriptors." ); igt_subtest("flink-lifetime")test_flink_lifetime (fd); + +igt_fixture +drm_close_driver (fd ); }
tests/i915/gem_userptr_blits.c +3 -0
@@ -2703,4 +2703,7 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)igt_require (has_userptr_probe (fd));test_probe (fd); } + +igt_fixture +drm_close_driver (fd ); }
tests/i915/gem_workarounds.c +3 -0
@@ -339,4 +339,7 @@ igt_main } } } + +igt_fixture +drm_close_driver (device ); }
tests/i915/i915_pm_rps.c +3 -0
@@ -959,4 +959,7 @@ igt_mainwaitboost (drm_fd, true);igt_disallow_hang (drm_fd, hang); } + +igt_fixture +drm_close_driver (drm_fd ); }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 06/20] tests/i915: Close the fd before exit
Quoted 28 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/dmabuf_sync_file.c | 3 +++ tests/drm_read.c | 3 +++ tests/i915/gem_barrier_race.c | 3 +++ tests/i915/gem_basic.c | 3 +++ tests/i915/gem_concurrent_all.c | 5 +++++ tests/i915/gem_ctx_engines.c | 4 +++- tests/i915/gem_ctx_exec.c | 3 +++ tests/i915/gem_ctx_freq.c | 3 +++ tests/i915/gem_ctx_shared.c | 3 +++ tests/i915/gem_eio.c | 3 +++ tests/i915/gem_exec_alignment.c | 3 +++ tests/i915/gem_exec_balancer.c | 3 +++ tests/i915/gem_exec_endless.c | 3 +++ tests/i915/gem_flink_basic.c | 3 +++ tests/i915/gem_userptr_blits.c | 3 +++ tests/i915/gem_workarounds.c | 3 +++ tests/i915/i915_pm_rps.c | 3 +++ 17 files changed, 53 insertions(+), 1 deletion(-)tests/dmabuf_sync_file.c +0
-0
tests/dmabuf_sync_file.c igt_main · line 385
Quoted 6 lines
tests/dmabuf_sync_file.c +3
-0@@ -380,4 +380,7 @@ igt_main "operations."); igt_subtest("import-multiple-read-write")test_import_multiple (fd, true); + +igt_fixture +drm_close_driver (fd );
I think this is handled by igt_types.c:igt_cleanup_fd()
--
Zbigniew
Quoted 200 lines
tests/dmabuf_sync_file.c +0
-0}tests/drm_read.c +3
-0@@ -311,4 +311,7 @@ igt_main igt_subtest("short-buffer-wakeup")test_short_buffer_wakeup (fd, pipe); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_barrier_race.c +3
-0@@ -153,4 +153,7 @@ igt_mainbreak ; } } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_basic.c +3
-0@@ -117,4 +117,7 @@ igt_mainigt_describe ("Verify that closing drm driver is possible with opened gem object." ); igt_subtest("create-fd-close")test_create_fd_close (fd); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_concurrent_all.c +5
-0@@ -2015,4 +2015,9 @@ igt_main } } } + + igt_fixture { +drm_close_driver (fd); +drm_close_driver (vgem_drv); + } }tests/i915/gem_ctx_engines.c +3
-1@@ -633,6 +633,8 @@ igt_mainindependent_all (i915, ctx); } -igt_fixture + igt_fixture {igt_stop_hang_detector (); +drm_close_driver (i915); + } }tests/i915/gem_ctx_exec.c +3
-0@@ -546,4 +546,7 @@ igt_maingem_context_destroy (fd, ctx_id);put_ahnd (ahnd); } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_ctx_freq.c +3
-0@@ -213,4 +213,7 @@ igt_main igt_subtest_f("sysfs")sysfs_range (i915); + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_ctx_shared.c +3
-0@@ -1088,4 +1088,7 @@ igt_mainigt_stop_hang_detector (); } } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_eio.c +3
-0@@ -1126,4 +1126,7 @@ igt_mainintel_allocator_multiprocess_stop (); } } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_exec_alignment.c +3
-0@@ -546,4 +546,7 @@ igt_mainprio_inversion (fd,SHARED ); igt_subtest("pi-isolated")prio_inversion (fd,ISOLATED ); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_exec_balancer.c +3
-0@@ -3482,4 +3482,7 @@ igt_main igt_subtest("nohangcheck")nohangcheck (i915); } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_exec_endless.c +3
-0@@ -367,4 +367,7 @@ igt_mainintel_register_access_fini (&mmio); } } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_flink_basic.c +3
-0@@ -188,4 +188,7 @@ igt_mainigt_describe ("Tests flink lifetime by referencing from multiple descriptors." ); igt_subtest("flink-lifetime")test_flink_lifetime (fd); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_userptr_blits.c +3
-0@@ -2703,4 +2703,7 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)igt_require (has_userptr_probe (fd));test_probe (fd); } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_workarounds.c +3
-0@@ -339,4 +339,7 @@ igt_main } } } + +igt_fixture +drm_close_driver (device ); }tests/i915/i915_pm_rps.c +3
-0@@ -959,4 +959,7 @@ igt_mainwaitboost (drm_fd, true);igt_disallow_hang (drm_fd, hang); } + +igt_fixture +drm_close_driver (drm_fd ); }Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 06/20] tests/i915: Close the fd before exit
Hi Zbigniew,
Quoted 24 lines · Zbigniew Kempczyński
Quoted 23 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/dmabuf_sync_file.c | 3 +++ tests/drm_read.c | 3 +++ tests/i915/gem_barrier_race.c | 3 +++ tests/i915/gem_basic.c | 3 +++ tests/i915/gem_concurrent_all.c | 5 +++++ tests/i915/gem_ctx_engines.c | 4 +++- tests/i915/gem_ctx_exec.c | 3 +++ tests/i915/gem_ctx_freq.c | 3 +++ tests/i915/gem_ctx_shared.c | 3 +++ tests/i915/gem_eio.c | 3 +++ tests/i915/gem_exec_alignment.c | 3 +++ tests/i915/gem_exec_balancer.c | 3 +++ tests/i915/gem_exec_endless.c | 3 +++ tests/i915/gem_flink_basic.c | 3 +++ tests/i915/gem_userptr_blits.c | 3 +++ tests/i915/gem_workarounds.c | 3 +++ tests/i915/i915_pm_rps.c | 3 +++ 17 files changed, 53 insertions(+), 1 deletion(-)
Quoted 13 lines
tests/dmabuf_sync_file.c igt_main · line 385
Quoted 11 lines
tests/dmabuf_sync_file.c +3
-0@@ -380,4 +380,7 @@ igt_main "operations."); igt_subtest("import-multiple-read-write")test_import_multiple (fd, true); + +igt_fixture +drm_close_driver (fd );I think this is handled by igt_types.c:igt_cleanup_fd()
I am not 100% sure, I think we need to declare the fd as "igt_fd_t(fd)", then only igt_cleanup_fd() will takecare of it.
Also, as it is a good practice to close the fd before exit, still I can recommend to use drm_close_driver().
- Bhanu
Quoted 204 lines
--
ZbigniewQuoted 200 lines
tests/dmabuf_sync_file.c +0
-0}tests/drm_read.c +3
-0@@ -311,4 +311,7 @@ igt_main igt_subtest("short-buffer-wakeup")test_short_buffer_wakeup (fd, pipe); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_barrier_race.c +3
-0@@ -153,4 +153,7 @@ igt_mainbreak ; } } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_basic.c +3
-0@@ -117,4 +117,7 @@ igt_mainigt_describe ("Verify that closing drm driver is possible with opened gem object." ); igt_subtest("create-fd-close")test_create_fd_close (fd); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_concurrent_all.c +5
-0@@ -2015,4 +2015,9 @@ igt_main } } } + + igt_fixture { +drm_close_driver (fd); +drm_close_driver (vgem_drv); + } }tests/i915/gem_ctx_engines.c +3
-1@@ -633,6 +633,8 @@ igt_mainindependent_all (i915, ctx); } -igt_fixture + igt_fixture {igt_stop_hang_detector (); +drm_close_driver (i915); + } }tests/i915/gem_ctx_exec.c +3
-0@@ -546,4 +546,7 @@ igt_maingem_context_destroy (fd, ctx_id);put_ahnd (ahnd); } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_ctx_freq.c +3
-0@@ -213,4 +213,7 @@ igt_main igt_subtest_f("sysfs")sysfs_range (i915); + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_ctx_shared.c +3
-0@@ -1088,4 +1088,7 @@ igt_mainigt_stop_hang_detector (); } } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_eio.c +3
-0@@ -1126,4 +1126,7 @@ igt_mainintel_allocator_multiprocess_stop (); } } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_exec_alignment.c +3
-0@@ -546,4 +546,7 @@ igt_mainprio_inversion (fd,SHARED ); igt_subtest("pi-isolated")prio_inversion (fd,ISOLATED ); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_exec_balancer.c +3
-0@@ -3482,4 +3482,7 @@ igt_main igt_subtest("nohangcheck")nohangcheck (i915); } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_exec_endless.c +3
-0@@ -367,4 +367,7 @@ igt_mainintel_register_access_fini (&mmio); } } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_flink_basic.c +3
-0@@ -188,4 +188,7 @@ igt_mainigt_describe ("Tests flink lifetime by referencing from multiple descriptors." ); igt_subtest("flink-lifetime")test_flink_lifetime (fd); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_userptr_blits.c +3
-0@@ -2703,4 +2703,7 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)igt_require (has_userptr_probe (fd));test_probe (fd); } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_workarounds.c +3
-0@@ -339,4 +339,7 @@ igt_main } } } + +igt_fixture +drm_close_driver (device ); }tests/i915/i915_pm_rps.c +3
-0@@ -959,4 +959,7 @@ igt_mainwaitboost (drm_fd, true);igt_disallow_hang (drm_fd, hang); } + +igt_fixture +drm_close_driver (drm_fd ); }Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 06/20] tests/i915: Close the fd before exit
Quoted 41 lines · Bhanuprakash
Hi Zbigniew,
Quoted 24 lines · Zbigniew Kempczyński
Quoted 23 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/dmabuf_sync_file.c | 3 +++ tests/drm_read.c | 3 +++ tests/i915/gem_barrier_race.c | 3 +++ tests/i915/gem_basic.c | 3 +++ tests/i915/gem_concurrent_all.c | 5 +++++ tests/i915/gem_ctx_engines.c | 4 +++- tests/i915/gem_ctx_exec.c | 3 +++ tests/i915/gem_ctx_freq.c | 3 +++ tests/i915/gem_ctx_shared.c | 3 +++ tests/i915/gem_eio.c | 3 +++ tests/i915/gem_exec_alignment.c | 3 +++ tests/i915/gem_exec_balancer.c | 3 +++ tests/i915/gem_exec_endless.c | 3 +++ tests/i915/gem_flink_basic.c | 3 +++ tests/i915/gem_userptr_blits.c | 3 +++ tests/i915/gem_workarounds.c | 3 +++ tests/i915/i915_pm_rps.c | 3 +++ 17 files changed, 53 insertions(+), 1 deletion(-)Quoted 13 lines
tests/dmabuf_sync_file.c igt_main · line 385
Quoted 11 lines
tests/dmabuf_sync_file.c +3
-0@@ -380,4 +380,7 @@ igt_main "operations."); igt_subtest("import-multiple-read-write")test_import_multiple (fd, true); + +igt_fixture +drm_close_driver (fd );I think this is handled by igt_types.c:igt_cleanup_fd()
Quoted 2 lines
I am not 100% sure, I think we need to declare the fd as "
igt_fd_t(fd)", then onlyigt_cleanup_fd()will takecare of it.
Yes, I've picked gem_basic.c and this was the reason of my comment. I see also gem_ctx_engines.c, gem_ctx_shared.c, gem_exec_alignment.c, gem_exec_balancer.c gem_flink_basic.c, gem_userptr_blits.c and gem_workarounds.c already contains this declaration.
--
Zbigniew
Quoted 207 lines
Also, as it is a good practice to close the fd before exit, still I can recommend to use
drm_close_driver().- Bhanu
Quoted 201 lines
--
ZbigniewQuoted 197 lines
tests/dmabuf_sync_file.c +0
-0}tests/drm_read.c +3
-0@@ -311,4 +311,7 @@ igt_main igt_subtest("short-buffer-wakeup")test_short_buffer_wakeup (fd, pipe); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_barrier_race.c +3
-0@@ -153,4 +153,7 @@ igt_mainbreak ; } } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_basic.c +3
-0@@ -117,4 +117,7 @@ igt_mainigt_describe ("Verify that closing drm driver is possible with opened gem object." ); igt_subtest("create-fd-close")test_create_fd_close (fd); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_concurrent_all.c +5
-0@@ -2015,4 +2015,9 @@ igt_main } } } + + igt_fixture { +drm_close_driver (fd); +drm_close_driver (vgem_drv); + } }tests/i915/gem_ctx_engines.c +3
-1@@ -633,6 +633,8 @@ igt_mainindependent_all (i915, ctx); } -igt_fixture + igt_fixture {igt_stop_hang_detector (); +drm_close_driver (i915); + } }tests/i915/gem_ctx_exec.c +3
-0@@ -546,4 +546,7 @@ igt_maingem_context_destroy (fd, ctx_id);put_ahnd (ahnd); } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_ctx_freq.c +3
-0@@ -213,4 +213,7 @@ igt_main igt_subtest_f("sysfs")sysfs_range (i915); + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_ctx_shared.c +3
-0@@ -1088,4 +1088,7 @@ igt_mainigt_stop_hang_detector (); } } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_eio.c +3
-0@@ -1126,4 +1126,7 @@ igt_mainintel_allocator_multiprocess_stop (); } } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_exec_alignment.c +3
-0@@ -546,4 +546,7 @@ igt_mainprio_inversion (fd,SHARED ); igt_subtest("pi-isolated")prio_inversion (fd,ISOLATED ); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_exec_balancer.c +3
-0@@ -3482,4 +3482,7 @@ igt_main igt_subtest("nohangcheck")nohangcheck (i915); } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_exec_endless.c +3
-0@@ -367,4 +367,7 @@ igt_mainintel_register_access_fini (&mmio); } } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_flink_basic.c +3
-0@@ -188,4 +188,7 @@ igt_mainigt_describe ("Tests flink lifetime by referencing from multiple descriptors." ); igt_subtest("flink-lifetime")test_flink_lifetime (fd); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_userptr_blits.c +3
-0@@ -2703,4 +2703,7 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)igt_require (has_userptr_probe (fd));test_probe (fd); } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_workarounds.c +3
-0@@ -339,4 +339,7 @@ igt_main } } } + +igt_fixture +drm_close_driver (device ); }tests/i915/i915_pm_rps.c +3
-0@@ -959,4 +959,7 @@ igt_mainwaitboost (drm_fd, true);igt_disallow_hang (drm_fd, hang); } + +igt_fixture +drm_close_driver (drm_fd ); }Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 06/20] tests/i915: Close the fd before exit
Quoted 42 lines · Zbigniew Kempczyński
Quoted 41 lines · Bhanuprakash
Hi Zbigniew,
Quoted 37 lines · Zbigniew Kempczyński
Quoted 28 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/dmabuf_sync_file.c | 3 +++ tests/drm_read.c | 3 +++ tests/i915/gem_barrier_race.c | 3 +++ tests/i915/gem_basic.c | 3 +++ tests/i915/gem_concurrent_all.c | 5 +++++ tests/i915/gem_ctx_engines.c | 4 +++- tests/i915/gem_ctx_exec.c | 3 +++ tests/i915/gem_ctx_freq.c | 3 +++ tests/i915/gem_ctx_shared.c | 3 +++ tests/i915/gem_eio.c | 3 +++ tests/i915/gem_exec_alignment.c | 3 +++ tests/i915/gem_exec_balancer.c | 3 +++ tests/i915/gem_exec_endless.c | 3 +++ tests/i915/gem_flink_basic.c | 3 +++ tests/i915/gem_userptr_blits.c | 3 +++ tests/i915/gem_workarounds.c | 3 +++ tests/i915/i915_pm_rps.c | 3 +++ 17 files changed, 53 insertions(+), 1 deletion(-)tests/dmabuf_sync_file.c +0
-0tests/dmabuf_sync_file.c igt_main · line 385
Quoted 6 lines
tests/dmabuf_sync_file.c +3
-0@@ -380,4 +380,7 @@ igt_main "operations."); igt_subtest("import-multiple-read-write")test_import_multiple (fd, true); + +igt_fixture +drm_close_driver (fd );I think this is handled by igt_types.c:igt_cleanup_fd()
Quoted 7 lines
Quoted 2 lines
I am not 100% sure, I think we need to declare the fd as "
igt_fd_t(fd)", then onlyigt_cleanup_fd()will takecare of it.Yes, I've picked
gem_basic.cand this was the reason of my comment. I see alsogem_ctx_engines.c,gem_ctx_shared.c,gem_exec_alignment.c,gem_exec_balancer.cgem_flink_basic.c,gem_userptr_blits.candgem_workarounds.calready contains this declaration.
Then, shall we drop these tests from this patch?
- Bhanu
Quoted 211 lines
--
ZbigniewQuoted 207 lines
Also, as it is a good practice to close the fd before exit, still I can recommend to use
drm_close_driver().- Bhanu
Quoted 201 lines
--
ZbigniewQuoted 197 lines
tests/dmabuf_sync_file.c +0
-0}tests/drm_read.c +3
-0@@ -311,4 +311,7 @@ igt_main igt_subtest("short-buffer-wakeup")test_short_buffer_wakeup (fd, pipe); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_barrier_race.c +3
-0@@ -153,4 +153,7 @@ igt_mainbreak ; } } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_basic.c +3
-0@@ -117,4 +117,7 @@ igt_mainigt_describe ("Verify that closing drm driver is possible with opened gem object." ); igt_subtest("create-fd-close")test_create_fd_close (fd); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_concurrent_all.c +5
-0@@ -2015,4 +2015,9 @@ igt_main } } } + + igt_fixture { +drm_close_driver (fd); +drm_close_driver (vgem_drv); + } }tests/i915/gem_ctx_engines.c +3
-1@@ -633,6 +633,8 @@ igt_mainindependent_all (i915, ctx); } -igt_fixture + igt_fixture {igt_stop_hang_detector (); +drm_close_driver (i915); + } }tests/i915/gem_ctx_exec.c +3
-0@@ -546,4 +546,7 @@ igt_maingem_context_destroy (fd, ctx_id);put_ahnd (ahnd); } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_ctx_freq.c +3
-0@@ -213,4 +213,7 @@ igt_main igt_subtest_f("sysfs")sysfs_range (i915); + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_ctx_shared.c +3
-0@@ -1088,4 +1088,7 @@ igt_mainigt_stop_hang_detector (); } } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_eio.c +3
-0@@ -1126,4 +1126,7 @@ igt_mainintel_allocator_multiprocess_stop (); } } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_exec_alignment.c +3
-0@@ -546,4 +546,7 @@ igt_mainprio_inversion (fd,SHARED ); igt_subtest("pi-isolated")prio_inversion (fd,ISOLATED ); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_exec_balancer.c +3
-0@@ -3482,4 +3482,7 @@ igt_main igt_subtest("nohangcheck")nohangcheck (i915); } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_exec_endless.c +3
-0@@ -367,4 +367,7 @@ igt_mainintel_register_access_fini (&mmio); } } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_flink_basic.c +3
-0@@ -188,4 +188,7 @@ igt_mainigt_describe ("Tests flink lifetime by referencing from multiple descriptors." ); igt_subtest("flink-lifetime")test_flink_lifetime (fd); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_userptr_blits.c +3
-0@@ -2703,4 +2703,7 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)igt_require (has_userptr_probe (fd));test_probe (fd); } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_workarounds.c +3
-0@@ -339,4 +339,7 @@ igt_main } } } + +igt_fixture +drm_close_driver (device ); }tests/i915/i915_pm_rps.c +3
-0@@ -959,4 +959,7 @@ igt_mainwaitboost (drm_fd, true);igt_disallow_hang (drm_fd, hang); } + +igt_fixture +drm_close_driver (drm_fd ); }Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 06/20] tests/i915: Close the fd before exit
Quoted 47 lines · Bhanuprakash
Quoted 45 lines · Zbigniew Kempczyński
Quoted 43 lines · Bhanuprakash
Hi Zbigniew,
Quoted 24 lines · Zbigniew Kempczyński
Quoted 23 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/dmabuf_sync_file.c | 3 +++ tests/drm_read.c | 3 +++ tests/i915/gem_barrier_race.c | 3 +++ tests/i915/gem_basic.c | 3 +++ tests/i915/gem_concurrent_all.c | 5 +++++ tests/i915/gem_ctx_engines.c | 4 +++- tests/i915/gem_ctx_exec.c | 3 +++ tests/i915/gem_ctx_freq.c | 3 +++ tests/i915/gem_ctx_shared.c | 3 +++ tests/i915/gem_eio.c | 3 +++ tests/i915/gem_exec_alignment.c | 3 +++ tests/i915/gem_exec_balancer.c | 3 +++ tests/i915/gem_exec_endless.c | 3 +++ tests/i915/gem_flink_basic.c | 3 +++ tests/i915/gem_userptr_blits.c | 3 +++ tests/i915/gem_workarounds.c | 3 +++ tests/i915/i915_pm_rps.c | 3 +++ 17 files changed, 53 insertions(+), 1 deletion(-)Quoted 13 lines
tests/dmabuf_sync_file.c igt_main · line 385
Quoted 11 lines
tests/dmabuf_sync_file.c +3
-0@@ -380,4 +380,7 @@ igt_main "operations."); igt_subtest("import-multiple-read-write")test_import_multiple (fd, true); + +igt_fixture +drm_close_driver (fd );I think this is handled by igt_types.c:igt_cleanup_fd()
I am not 100% sure, I think we need to declare the fd as "
igt_fd_t(fd)", then onlyigt_cleanup_fd()will takecare of it.
Quoted 6 lines
Quoted 4 lines
Yes, I've picked
gem_basic.cand this was the reason of my comment. I see alsogem_ctx_engines.c,gem_ctx_shared.c,gem_exec_alignment.c,gem_exec_balancer.cgem_flink_basic.c,gem_userptr_blits.candgem_workarounds.calready contains this declaration.Then, shall we drop these tests from this patch?
Yes. BTW I've noticed in gem_basic.c there's explicit fd close inside create-fd-close test so igt_warn/igt_debug will be called from drm_close_driver(). I wonder to reopen the driver for this case to avoid double close.
--
Zbigniew
Quoted 214 lines
- Bhanu
Quoted 211 lines
--
ZbigniewQuoted 207 lines
Also, as it is a good practice to close the fd before exit, still I can recommend to use
drm_close_driver().- Bhanu
Quoted 201 lines
--
ZbigniewQuoted 197 lines
tests/dmabuf_sync_file.c +0
-0}tests/drm_read.c +3
-0@@ -311,4 +311,7 @@ igt_main igt_subtest("short-buffer-wakeup")test_short_buffer_wakeup (fd, pipe); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_barrier_race.c +3
-0@@ -153,4 +153,7 @@ igt_mainbreak ; } } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_basic.c +3
-0@@ -117,4 +117,7 @@ igt_mainigt_describe ("Verify that closing drm driver is possible with opened gem object." ); igt_subtest("create-fd-close")test_create_fd_close (fd); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_concurrent_all.c +5
-0@@ -2015,4 +2015,9 @@ igt_main } } } + + igt_fixture { +drm_close_driver (fd); +drm_close_driver (vgem_drv); + } }tests/i915/gem_ctx_engines.c +3
-1@@ -633,6 +633,8 @@ igt_mainindependent_all (i915, ctx); } -igt_fixture + igt_fixture {igt_stop_hang_detector (); +drm_close_driver (i915); + } }tests/i915/gem_ctx_exec.c +3
-0@@ -546,4 +546,7 @@ igt_maingem_context_destroy (fd, ctx_id);put_ahnd (ahnd); } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_ctx_freq.c +3
-0@@ -213,4 +213,7 @@ igt_main igt_subtest_f("sysfs")sysfs_range (i915); + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_ctx_shared.c +3
-0@@ -1088,4 +1088,7 @@ igt_mainigt_stop_hang_detector (); } } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_eio.c +3
-0@@ -1126,4 +1126,7 @@ igt_mainintel_allocator_multiprocess_stop (); } } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_exec_alignment.c +3
-0@@ -546,4 +546,7 @@ igt_mainprio_inversion (fd,SHARED ); igt_subtest("pi-isolated")prio_inversion (fd,ISOLATED ); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_exec_balancer.c +3
-0@@ -3482,4 +3482,7 @@ igt_main igt_subtest("nohangcheck")nohangcheck (i915); } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_exec_endless.c +3
-0@@ -367,4 +367,7 @@ igt_mainintel_register_access_fini (&mmio); } } + +igt_fixture +drm_close_driver (i915 ); }tests/i915/gem_flink_basic.c +3
-0@@ -188,4 +188,7 @@ igt_mainigt_describe ("Tests flink lifetime by referencing from multiple descriptors." ); igt_subtest("flink-lifetime")test_flink_lifetime (fd); + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_userptr_blits.c +3
-0@@ -2703,4 +2703,7 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)igt_require (has_userptr_probe (fd));test_probe (fd); } + +igt_fixture +drm_close_driver (fd ); }tests/i915/gem_workarounds.c +3
-0@@ -339,4 +339,7 @@ igt_main } } } + +igt_fixture +drm_close_driver (device ); }tests/i915/i915_pm_rps.c +3
-0@@ -959,4 +959,7 @@ igt_mainwaitboost (drm_fd, true);igt_disallow_hang (drm_fd, hang); } + +igt_fixture +drm_close_driver (drm_fd ); }Signature · 1 line
2.40.0
PATCH 7/20 tests/nouveau_crc: Close the fd before exit
In reply to Bhanuprakash ModemClose the file descriptor before exiting the test.
--- tests/nouveau_crc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tests/nouveau_crc.c +4 -2
@@ -409,7 +409,9 @@ igt_mainclose (data.nv_crc_dir); } } - igt_fixture - igt_display_fini(&data.display); + igt_fixture { +igt_display_fini (&data.display); +drm_close_driver (data.drm_fd); + } }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 07/20] tests/nouveau_crc: Close the fd before exit
Quoted 24 lines · Bhanuprakash Modem
Close the file descriptor before exiting the test.
Cc Lyude Paul <[email protected]>Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/nouveau_crc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)tests/nouveau_crc.c +4
-2@@ -409,7 +409,9 @@ igt_mainclose (data.nv_crc_dir); } } - igt_fixture - igt_display_fini(&data.display); + igt_fixture { +igt_display_fini (&data.display); +drm_close_driver (data.drm_fd); + } }
Signature · 3 lines
Cheers, Lyude Paul (she/her) Software Engineer at Red Hat
PATCH 8/20 tests/xe/xe_gpgpu_fill: Close the fd before exit
In reply to Bhanuprakash ModemClose the file descriptor before exiting the test.
--- tests/xe/xe_gpgpu_fill.c | 1 + 1 file changed, 1 insertion(+)
tests/xe/xe_gpgpu_fill.c +1 -0
@@ -131,5 +131,6 @@ igt_main igt_fixture {xe_device_put (data.drm_fd);buf_ops_destroy (data.bops); +drm_close_driver (data.drm_fd); } }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 08/20] tests/xe/xe_gpgpu_fill: Close the fd before exit
LGTM
Quoted 28 lines
-----Original Message-----
From: Modem, Bhanuprakash <[email protected]>
Sent: 16 May 2023 22:21
To: [email protected]; [email protected]; Kumar, Janga Rahul <[email protected]>
Cc: Modem, Bhanuprakash <[email protected]>
Subject: [i-g-t 08/20] tests/xe/xe_gpgpu_fill: Close the fd before exitClose the file descriptor before exiting the test.
Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/xe/xe_gpgpu_fill.c | 1 + 1 file changed, 1 insertion(+)tests/xe/xe_gpgpu_fill.c index renamed from tests/xe/xe_gpgpu_fill.c +0
-0
5bca19c87..28ad2382b100644tests/xe/xe_gpgpu_fill.c +1
-1@@ -131,5 +131,6 @@ igt_main igt_fixture {xe_device_put (data.drm_fd);buf_ops_destroy (data.bops); +drm_close_driver (data.drm_fd); } } --2.40.0
PATCH 9/20 tests/amdgpu: Use drm_close_driver() to close the drm fd
In reply to Bhanuprakash ModemTo close the drm file descriptor, use igt helper drm_close_driver() instead of using close().
--- tests/amdgpu/amd_basic.c | 2 +- tests/amdgpu/amd_cs_nop.c | 2 +- tests/amdgpu/amd_deadlock.c | 2 +- tests/amdgpu/amd_info.c | 2 +- tests/amdgpu/amd_module_load.c | 2 +- tests/amdgpu/amd_prime.c | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-)
tests/amdgpu/amd_basic.c +1 -1
@@ -696,6 +696,6 @@ igt_main igt_fixture {amdgpu_device_deinitialize (device); -close (fd); +drm_close_driver (fd); } }
tests/amdgpu/amd_cs_nop.c +1 -1
@@ -239,6 +239,6 @@ igt_main igt_fixture {amdgpu_cs_ctx_free (context);amdgpu_device_deinitialize (device); -close (fd); +drm_close_driver (fd); } }
tests/amdgpu/amd_deadlock.c +1 -1
@@ -118,6 +118,6 @@ igt_main igt_fixture {amdgpu_device_deinitialize (device); -close (fd); +drm_close_driver (fd); } }
tests/amdgpu/amd_info.c +1 -1
@@ -154,6 +154,6 @@ igt_main igt_fixture {amdgpu_device_deinitialize (dev); -close (fd); +drm_close_driver (fd); } }
tests/amdgpu/amd_module_load.c +1 -1
@@ -54,7 +54,7 @@ static void sanity_check(void) err = -errno;igt_set_timeout (0 ,NULL ); -close (fd); +drm_close_driver (fd);igt_assert_eq (err,0 ); }
tests/amdgpu/amd_prime.c +3 -3
@@ -166,7 +166,7 @@ static void amd_plug(amdgpu_device_handle device, struct cork *c)static void unplug (struct cork *c) {vgem_fence_signal (c->device, c->fence); -close (c->device); +drm_close_driver (c->device); }static void i915_to_amd (int i915,int amd,amdgpu_device_handle device)
@@ -461,7 +461,7 @@ igt_main igt_fixture {amdgpu_device_deinitialize (device); -close (amd); -close (i915); +drm_close_driver (amd); +drm_close_driver (i915); } }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 09/20] tests/amdgpu: Use drm_close_driver() to close the drm fd
Hi Bhanuprakash,
+cc Vitaliy and Christian
Regards,
Kamil
Quoted 102 lines · Bhanuprakash Modem
To close the drm file descriptor, use igt helper
drm_close_driver()instead of usingclose().Cc Harry Wentland <[email protected]>Cc Rodrigo Siqueira <[email protected]>Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/amdgpu/amd_basic.c | 2 +- tests/amdgpu/amd_cs_nop.c | 2 +- tests/amdgpu/amd_deadlock.c | 2 +- tests/amdgpu/amd_info.c | 2 +- tests/amdgpu/amd_module_load.c | 2 +- tests/amdgpu/amd_prime.c | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-)tests/amdgpu/amd_basic.c +1
-1@@ -696,6 +696,6 @@ igt_main igt_fixture {amdgpu_device_deinitialize (device); -close (fd); +drm_close_driver (fd); } }tests/amdgpu/amd_cs_nop.c +1
-1@@ -239,6 +239,6 @@ igt_main igt_fixture {amdgpu_cs_ctx_free (context);amdgpu_device_deinitialize (device); -close (fd); +drm_close_driver (fd); } }tests/amdgpu/amd_deadlock.c +1
-1@@ -118,6 +118,6 @@ igt_main igt_fixture {amdgpu_device_deinitialize (device); -close (fd); +drm_close_driver (fd); } }tests/amdgpu/amd_info.c +1
-1@@ -154,6 +154,6 @@ igt_main igt_fixture {amdgpu_device_deinitialize (dev); -close (fd); +drm_close_driver (fd); } }tests/amdgpu/amd_module_load.c +1
-1@@ -54,7 +54,7 @@ static void sanity_check(void) err = -errno;igt_set_timeout (0 ,NULL ); -close (fd); +drm_close_driver (fd);igt_assert_eq (err,0 ); }tests/amdgpu/amd_prime.c +3
-3@@ -166,7 +166,7 @@ static void amd_plug(amdgpu_device_handle device, struct cork *c)static void unplug (struct cork *c) {vgem_fence_signal (c->device, c->fence); -close (c->device); +drm_close_driver (c->device); }static void i915_to_amd (int i915,int amd,amdgpu_device_handle device)@@ -461,7 +461,7 @@ igt_main igt_fixture {amdgpu_device_deinitialize (device); -close (amd); -close (i915); +drm_close_driver (amd); +drm_close_driver (i915); } }Signature · 1 line
2.40.0
PATCH 10/20 tests/i915/kms_mmap_write_crc: Avoid closing the closed fd
In reply to Bhanuprakash ModemAvoid closing the closed fd.
--- tests/i915/kms_mmap_write_crc.c | 1 - 1 file changed, 1 deletion(-)
tests/i915/kms_mmap_write_crc.c +0 -1
@@ -306,6 +306,5 @@ igt_main_args("n", NULL, NULL, opt_handler, NULL)close (data.drm_fd);igt_stop_helper (&hog); -close (data.drm_fd); } }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 10/20] tests/i915/kms_mmap_write_crc: Avoid closing the closed fd
Hi,
Quoted 3 lines · Bhanuprakash Modem
Avoid closing the closed fd.
Signed-off-by Bhanuprakash Modem <[email protected]>
tests/i915/kms_mmap_write_crc.c igt_main_args("n", NULL, NULL, opt_handler, NULL) · line 309
Quoted 13 lines
--- tests/i915/kms_mmap_write_crc.c | 1 - 1 file changed, 1 deletion(-)tests/i915/kms_mmap_write_crc.c +0
-1@@ -306,6 +306,5 @@ igt_main_args("n", NULL, NULL, opt_handler, NULL)close (data.drm_fd);igt_stop_helper (&hog); -close (data.drm_fd);
Nice catch.
Quoted 5 lines
tests/i915/kms_mmap_write_crc.c +0
-0} }Signature · 1 line
2.40.0
PATCH 11/20 tests/panfrost: Use drm_close_driver() to close the drm fd
In reply to Bhanuprakash ModemTo close the drm file descriptor, use igt helper drm_close_driver() instead of using close().
--- tests/panfrost_gem_new.c | 4 ++-- tests/panfrost_get_param.c | 2 +- tests/panfrost_prime.c | 4 ++-- tests/panfrost_submit.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-)
tests/panfrost_gem_new.c +2 -2
@@ -82,9 +82,9 @@ igt_mainmunmap (map, size);igt_panfrost_free_bo (fd2, bo); -close (fd2); +drm_close_driver (fd2); }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/panfrost_get_param.c +1 -1
@@ -69,5 +69,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/panfrost_prime.c +2 -2
@@ -96,7 +96,7 @@ igt_main } igt_fixture { -close (fd); -close (kms_fd); +drm_close_driver (fd); +drm_close_driver (kms_fd); } }
tests/panfrost_submit.c +3 -3
@@ -154,7 +154,7 @@ igt_maincheck_done (headers[2 ]);igt_panfrost_free_job (fd, submit[0 ]);igt_panfrost_free_job (tmpfd, submit[1 ]); -close (tmpfd); +drm_close_driver (tmpfd); } igt_subtest("pan-submit-and-close") {
@@ -165,7 +165,7 @@ igt_main submit =igt_panfrost_job_loop (tmpfd);do_ioctl (tmpfd,DRM_IOCTL_PANFROST_SUBMIT , submit->args);igt_panfrost_free_job (tmpfd, submit); -close (tmpfd); +drm_close_driver (tmpfd); } igt_subtest("pan-unhandled-pagefault") {
@@ -197,6 +197,6 @@ igt_main } igt_fixture { -close (fd); +drm_close_driver (fd); } }
Signature · 1 line
2.40.0
PATCH 12/20 tests/v3d: Use drm_close_driver() to close the drm fd
In reply to Bhanuprakash ModemTo close the drm file descriptor, use igt helper drm_close_driver() instead of using close().
--- tests/v3d/v3d_create_bo.c | 4 ++-- tests/v3d/v3d_get_bo_offset.c | 2 +- tests/v3d/v3d_get_param.c | 2 +- tests/v3d/v3d_job_submission.c | 2 +- tests/v3d/v3d_mmap.c | 2 +- tests/v3d/v3d_perfmon.c | 2 +- tests/v3d/v3d_submit_cl.c | 2 +- tests/v3d/v3d_submit_csd.c | 2 +- tests/v3d/v3d_wait_bo.c | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-)
tests/v3d/v3d_create_bo.c +2 -2
@@ -63,9 +63,9 @@ igt_mainigt_assert_eq_u32 (((uint32_t *)bo->map)[i],0x0 );igt_v3d_free_bo (fd2, bo); -close (fd2); +drm_close_driver (fd2); }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/v3d/v3d_get_bo_offset.c +1 -1
@@ -67,5 +67,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/v3d/v3d_get_param.c +1 -1
@@ -69,5 +69,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/v3d/v3d_job_submission.c +1 -1
@@ -219,5 +219,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/v3d/v3d_mmap.c +1 -1
@@ -75,5 +75,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/v3d/v3d_perfmon.c +1 -1
@@ -142,5 +142,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/v3d/v3d_submit_cl.c +1 -1
@@ -376,5 +376,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/v3d/v3d_submit_csd.c +1 -1
@@ -360,5 +360,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/v3d/v3d_wait_bo.c +1 -1
@@ -122,6 +122,6 @@ igt_main igt_fixture {igt_v3d_free_bo (fd, bo); -close (fd); +drm_close_driver (fd); } }
Signature · 1 line
2.40.0
PATCH 13/20 tests/vc4: Use drm_close_driver() to close the drm fd
In reply to Bhanuprakash ModemTo close the drm file descriptor, use igt helper drm_close_driver() instead of using close().
--- tests/vc4/vc4_create_bo.c | 4 ++-- tests/vc4/vc4_dmabuf_poll.c | 2 +- tests/vc4/vc4_label_bo.c | 2 +- tests/vc4/vc4_lookup_fail.c | 2 +- tests/vc4/vc4_mmap.c | 2 +- tests/vc4/vc4_perfmon.c | 2 +- tests/vc4/vc4_purgeable_bo.c | 2 +- tests/vc4/vc4_tiling.c | 2 +- tests/vc4/vc4_wait_bo.c | 2 +- tests/vc4/vc4_wait_seqno.c | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-)
tests/vc4/vc4_create_bo.c +2 -2
@@ -72,9 +72,9 @@ igt_mainmunmap (map, size);gem_close (fd2, handle); -close (fd2); +drm_close_driver (fd2); }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/vc4/vc4_dmabuf_poll.c +1 -1
@@ -73,5 +73,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/vc4/vc4_label_bo.c +1 -1
@@ -82,5 +82,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/vc4/vc4_lookup_fail.c +1 -1
@@ -67,5 +67,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/vc4/vc4_mmap.c +1 -1
@@ -49,5 +49,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/vc4/vc4_perfmon.c +1 -1
@@ -135,5 +135,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/vc4/vc4_purgeable_bo.c +1 -1
@@ -249,5 +249,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/vc4/vc4_tiling.c +1 -1
@@ -124,5 +124,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/vc4/vc4_wait_bo.c +1 -1
@@ -111,5 +111,5 @@ igt_maintest_used_bo (fd, ~0ull );igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/vc4/vc4_wait_seqno.c +1 -1
@@ -55,5 +55,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
Signature · 1 line
2.40.0
PATCH 14/20 tests/vmwgfx: Use drm_close_driver() to close the drm fd
In reply to Bhanuprakash ModemTo close the drm file descriptor, use igt helper drm_close_driver() instead of using close().
--- lib/igt_vmwgfx.c | 2 +- tests/vmwgfx/vmw_execution_buffer.c | 2 +- tests/vmwgfx/vmw_ref_count.c | 4 ++-- tests/vmwgfx/vmw_surface_copy.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
lib/igt_vmwgfx.c +1 -1
@@ -135,7 +135,7 @@ void vmw_svga_device_fini(struct vmw_svga_device *device)vmw_bitvector_free (device->rt_view_bv);vmw_bitvector_free (device->ds_view_bv);vmw_bitvector_free (device->shader_bv); -close (device->drm_fd); +drm_close_driver (device->drm_fd); } bool vmw_save_data_as_png(struct vmw_surface *surface, void *data,
tests/vmwgfx/vmw_execution_buffer.c +1 -1
@@ -308,6 +308,6 @@ igt_main_args("st:", long_options, NULL, parse_options, NULL) igt_fixture {vmw_ioctl_context_destroy (fd, cid); -close (fd); +drm_close_driver (fd); } }
tests/vmwgfx/vmw_ref_count.c +2 -2
@@ -314,7 +314,7 @@ igt_main igt_fixture { -close (fd1); -close (fd2); +drm_close_driver (fd1); +drm_close_driver (fd2); } }
tests/vmwgfx/vmw_surface_copy.c +1 -1
@@ -336,6 +336,6 @@ igt_main igt_fixture {vmw_ioctl_context_destroy (fd, cid); -close (fd); +drm_close_driver (fd); } }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 14/20] tests/vmwgfx: Use drm_close_driver() to close the drm fd
Quoted 1 line · Bhanuprakash Modem
|Bhanuprakash Modem <[email protected]> |
Signature · 5 lines
LGTM Reviewed-by: Maaz Mombasawala <[email protected]> Maaz Mombasawala (VMware) <[email protected]>
PATCH 15/20 tests/kms: Use drm_close_driver() to close the drm fd
In reply to Bhanuprakash ModemTo close the drm file descriptor, use igt helper drm_close_driver() instead of using close().
--- tests/chamelium/kms_chamelium_audio.c | 2 +- tests/chamelium/kms_chamelium_edid.c | 2 +- tests/chamelium/kms_chamelium_frames.c | 2 +- tests/chamelium/kms_chamelium_hpd.c | 2 +- tests/i915/kms_big_fb.c | 2 +- tests/i915/kms_big_joiner.c | 2 +- tests/i915/kms_busy.c | 2 +- tests/i915/kms_ccs.c | 2 +- tests/i915/kms_cdclk.c | 2 +- tests/i915/kms_draw_crc.c | 2 +- tests/i915/kms_dsc.c | 2 +- tests/i915/kms_fbcon_fbt.c | 2 +- tests/i915/kms_fence_pin_leak.c | 2 +- tests/i915/kms_flip_scaled_crc.c | 2 +- tests/i915/kms_flip_tiling.c | 2 +- tests/i915/kms_frontbuffer_tracking.c | 2 +- tests/i915/kms_legacy_colorkey.c | 2 +- tests/i915/kms_mmap_write_crc.c | 2 +- tests/i915/kms_pipe_b_c_ivb.c | 2 +- tests/i915/kms_psr.c | 2 +- tests/i915/kms_psr2_sf.c | 2 +- tests/i915/kms_psr2_su.c | 2 +- tests/i915/kms_psr_stress_test.c | 2 +- tests/i915/kms_pwrite_crc.c | 2 +- tests/kms_3d.c | 2 +- tests/kms_addfb_basic.c | 4 ++-- tests/kms_async_flips.c | 2 +- tests/kms_atomic.c | 2 +- tests/kms_atomic_interruptible.c | 2 +- tests/kms_atomic_transition.c | 2 +- tests/kms_color.c | 2 +- tests/kms_concurrent.c | 2 +- tests/kms_content_protection.c | 2 +- tests/kms_cursor_crc.c | 2 +- tests/kms_cursor_edge_walk.c | 2 +- tests/kms_cursor_legacy.c | 2 +- tests/kms_dither.c | 2 +- tests/kms_dp_aux_dev.c | 2 +- tests/kms_dp_tiled_display.c | 2 +- tests/kms_flip.c | 2 +- tests/kms_flip_event_leak.c | 4 ++-- tests/kms_force_connector_basic.c | 4 ++-- tests/kms_getfb.c | 4 ++-- tests/kms_hdmi_inject.c | 2 +- tests/kms_hdr.c | 2 +- tests/kms_invalid_mode.c | 2 +- tests/kms_lease.c | 4 ++-- tests/kms_panel_fitting.c | 2 +- tests/kms_pipe_crc_basic.c | 2 +- tests/kms_plane.c | 2 +- tests/kms_plane_alpha_blend.c | 2 +- tests/kms_plane_cursor.c | 2 +- tests/kms_plane_lowres.c | 2 +- tests/kms_plane_multiple.c | 2 +- tests/kms_plane_scaling.c | 2 +- tests/kms_prime.c | 6 +++--- tests/kms_prop_blob.c | 8 ++++---- tests/kms_properties.c | 2 +- tests/kms_rmfb.c | 4 ++-- tests/kms_rotation_crc.c | 2 +- tests/kms_scaling_modes.c | 2 +- tests/kms_sequence.c | 2 +- tests/kms_setmode.c | 2 +- tests/kms_tv_load_detect.c | 2 +- tests/kms_universal_plane.c | 2 +- tests/kms_vblank.c | 2 +- tests/kms_vrr.c | 1 + tests/kms_writeback.c | 1 + 68 files changed, 79 insertions(+), 77 deletions(-)
tests/chamelium/kms_chamelium_audio.c +1 -1
@@ -870,6 +870,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/chamelium/kms_chamelium_edid.c +1 -1
@@ -585,6 +585,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/chamelium/kms_chamelium_frames.c +1 -1
@@ -1102,6 +1102,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/chamelium/kms_chamelium_hpd.c +1 -1
@@ -564,6 +564,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_big_fb.c +1 -1
@@ -1010,6 +1010,6 @@ igt_main igt_fixture {igt_display_fini (&data.display);buf_ops_destroy (data.bops); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_big_joiner.c +1 -1
@@ -302,6 +302,6 @@ igt_main igt_fixture {igt_remove_fb (data.drm_fd, &data.fb);igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_busy.c +1 -1
@@ -506,6 +506,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL) igt_fixture {gpu_engines_restore_timeouts (fd, num_engines, saved_gpu_timeouts);igt_display_fini (&display); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }
tests/i915/kms_ccs.c +1 -1
@@ -708,6 +708,6 @@ igt_main_args("cs:", NULL, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_cdclk.c +1 -1
@@ -397,6 +397,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_draw_crc.c +1 -1
@@ -242,7 +242,7 @@ static void teardown_environment(void)buf_ops_destroy (bops); -close (drm_fd); +drm_close_driver (drm_fd); }static const char *format_str (int format_index)
tests/i915/kms_dsc.c +1 -1
@@ -316,6 +316,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_fbcon_fbt.c +1 -1
@@ -408,7 +408,7 @@ static void teardown_environment(struct drm_info *drm)drmModeFreeResources (drm->res);close (drm->debugfs_fd); -close (drm->fd); +drm_close_driver (drm->fd);kmstest_restore_vt_mode (); }
tests/i915/kms_fence_pin_leak.c +1 -1
@@ -238,5 +238,5 @@ igt_simple_mainbuf_ops_destroy (data.bops);igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); }
tests/i915/kms_flip_scaled_crc.c +1 -1
@@ -694,6 +694,6 @@ igt_main }kmstest_set_vt_text_mode ();igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_flip_tiling.c +1 -1
@@ -240,6 +240,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_frontbuffer_tracking.c +1 -1
@@ -1351,7 +1351,7 @@ static void teardown_drm(void) {buf_ops_destroy (drm.bops);igt_display_fini (&drm.display); -close (drm.fd); +drm_close_driver (drm.fd); }static void setup_modeset (void )
tests/i915/kms_legacy_colorkey.c +1 -1
@@ -87,6 +87,6 @@ igt_main igt_fixture {igt_display_fini (&display); -close (drm_fd); +drm_close_driver (drm_fd); } }
tests/i915/kms_mmap_write_crc.c +1 -1
@@ -303,7 +303,7 @@ igt_main_args("n", NULL, NULL, opt_handler, NULL) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd);igt_stop_helper (&hog); }
tests/i915/kms_pipe_b_c_ivb.c +1 -1
@@ -291,6 +291,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_psr.c +1 -1
@@ -670,6 +670,6 @@ igt_main_args("", long_options, help_str, opt_handler, &data)close (data.debugfs_fd);buf_ops_destroy (data.bops);display_fini (&data); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_psr2_sf.c +1 -1
@@ -1298,6 +1298,6 @@ igt_main igt_fixture {close (data.debugfs_fd);display_fini (&data); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_psr2_su.c +1 -1
@@ -373,6 +373,6 @@ igt_main igt_fixture {close (data.debugfs_fd);display_fini (&data); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_psr_stress_test.c +1 -1
@@ -378,6 +378,6 @@ igt_mainbuf_ops_destroy (data.bops);igt_display_fini (&data.display);close (data.debugfs_fd); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/kms_pwrite_crc.c +1 -1
@@ -193,5 +193,5 @@ igt_simple_mainrun_test (&data);igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); }
tests/kms_3d.c +1 -1
@@ -119,5 +119,5 @@ igt_simple_mainif (is_xe_device (drm_fd))xe_device_put (drm_fd); -close (drm_fd); +drm_close_driver (drm_fd); }
tests/kms_addfb_basic.c +2 -2
@@ -933,7 +933,7 @@ static void master_tests(int fd)do_ioctl_err (master2_fd,DRM_IOCTL_MODE_RMFB , &f.fb_id,ENOENT );igt_device_drop_master (master2_fd); -close (master2_fd); +drm_close_driver (master2_fd);igt_device_set_master (fd); }
@@ -1012,6 +1012,6 @@ igt_mainif (is_xe_device (fd))xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/kms_async_flips.c +1 -1
@@ -668,6 +668,6 @@ igt_main_args("e", NULL, help_str, opt_handler, &data)igt_display_reset (&data.display);igt_display_commit (&data.display);igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_atomic.c +1 -1
@@ -1460,6 +1460,6 @@ igt_mainigt_remove_fb (display.drm_fd, &fb);igt_display_fini (&display); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }
tests/kms_atomic_interruptible.c +1 -1
@@ -389,6 +389,6 @@ igt_main/* TODO: legacy gamma_set/get, object set/getprop, getcrtc, getconnector */ igt_fixture {igt_display_fini (&display); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }
tests/kms_atomic_transition.c +1 -1
@@ -1182,6 +1182,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_color.c +1 -1
@@ -1069,6 +1069,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_concurrent.c +1 -1
@@ -400,6 +400,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)if (is_intel_device (data.drm_fd))intel_allocator_multiprocess_stop ();igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_content_protection.c +1 -1
@@ -884,6 +884,6 @@ igt_main igt_fixture {test_content_protection_cleanup ();igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_cursor_crc.c +1 -1
@@ -1010,6 +1010,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL) }igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_cursor_edge_walk.c +1 -1
@@ -391,6 +391,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_cursor_legacy.c +1 -1
@@ -1843,6 +1843,6 @@ igt_mainif (intel_psr2_restore)i915_psr2_sel_fetch_restore (display.drm_fd);igt_display_fini (&display); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }
tests/kms_dither.c +1 -1
@@ -247,6 +247,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_dp_aux_dev.c +1 -1
@@ -147,5 +147,5 @@ igt_simple_mainigt_require (valid_connectors);drmModeFreeResources (res); -close (drm_fd); +drm_close_driver (drm_fd); }
tests/kms_dp_tiled_display.c +1 -1
@@ -502,6 +502,6 @@ igt_mainfree (data.conns);kmstest_restore_vt_mode ();igt_display_fini (data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_flip.c +1 -1
@@ -1930,6 +1930,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL)if (is_xe_device (drm_fd))xe_device_put (drm_fd); -close (drm_fd); +drm_close_driver (drm_fd); } }
tests/kms_flip_event_leak.c +2 -2
@@ -79,7 +79,7 @@ static void test(data_t *data, enum pipe pipe, igt_output_t *output)if (is_xe_device (fd))xe_device_put (fd); - ret =close (fd); + ret =drm_close_driver (fd);igt_assert_eq (ret,0 );igt_device_set_master (data->drm_fd);
@@ -121,6 +121,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_force_connector_basic.c +2 -2
@@ -65,7 +65,7 @@ static void reset_connectors(void)free (param); } -close (drm_fd); +drm_close_driver (drm_fd); }static void force_load_detect (int drm_fd,drmModeConnectorPtr connector,drmModeRes *res)
@@ -415,7 +415,7 @@ end: igt_fixture {drmModeFreeConnector (connector); -close (drm_fd); +drm_close_driver (drm_fd);reset_connectors (); }
tests/kms_getfb.c +2 -2
@@ -452,7 +452,7 @@ static void test_handle_protection(void) {if (is_xe_device (non_master_fd))xe_device_get (non_master_fd); -close (non_master_fd); +drm_close_driver (non_master_fd); } }
@@ -484,6 +484,6 @@ igt_mainif (is_xe_device (fd))xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/kms_hdmi_inject.c +1 -1
@@ -227,6 +227,6 @@ igt_mainif (is_xe_device (drm_fd))xe_device_put (drm_fd); -close (drm_fd); +drm_close_driver (drm_fd); } }
tests/kms_hdr.c +1 -1
@@ -666,6 +666,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.fd); +drm_close_driver (data.fd); } }
tests/kms_invalid_mode.c +1 -1
@@ -300,6 +300,6 @@ igt_mainigt_display_fini (&data.display);igt_reset_connectors ();drmModeFreeResources (data.res); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_lease.c +2 -2
@@ -1082,7 +1082,7 @@ static void multimaster_lease(data_t *data)drmSetClientCap (master2_fd,DRM_CLIENT_CAP_UNIVERSAL_PLANES ,1 ); lease2_fd =create_simple_lease (master2_fd, data); -close (master2_fd);/* close is an implicit DropMaster */ +drm_close_driver (master2_fd);/* close is an implicit DropMaster */ igt_assert (!is_master (lease2_fd));igt_device_set_master (data->master.fd);
@@ -1278,6 +1278,6 @@ igt_main igt_fixture {igt_display_fini (display); -close (data.master.fd); +drm_close_driver (data.master.fd); } }
tests/kms_panel_fitting.c +1 -1
@@ -288,6 +288,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_pipe_crc_basic.c +1 -1
@@ -491,6 +491,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_plane.c +1 -1
@@ -1318,6 +1318,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_plane_alpha_blend.c +1 -1
@@ -715,6 +715,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL) COMMIT_ATOMIC : COMMIT_LEGACY);igt_display_fini (&data.display); -close (data.gfx_fd); +drm_close_driver (data.gfx_fd); } }
tests/kms_plane_cursor.c +1 -1
@@ -331,6 +331,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_plane_lowres.c +1 -1
@@ -342,6 +342,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_plane_multiple.c +1 -1
@@ -478,6 +478,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_plane_scaling.c +1 -1
@@ -1324,6 +1324,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_prime.c +3 -3
@@ -431,7 +431,7 @@ igt_mainif (kms_poll_disabled)kms_poll_state_restore (); -close (second_fd_hybrid); +drm_close_driver (second_fd_hybrid); } }
@@ -454,9 +454,9 @@ igt_main }igt_fixture -close (second_fd_vgem ); +drm_close_driver (second_fd_vgem ); }igt_fixture -close (first_fd ); +drm_close_driver (first_fd ); }
tests/kms_prop_blob.c +4 -4
@@ -182,7 +182,7 @@ test_lifetime(int fd)/* Make sure properties are cleaned up on client exit. */ prop_id2 =create_prop (fd2);igt_assert_eq (validate_prop (fd, prop_id2),0 ); -igt_assert_eq (close (fd2),0 ); +igt_assert_eq (drm_close_driver (fd2),0 );igt_assert_eq (validate_prop (fd, prop_id2),ENOENT );igt_assert_eq (validate_prop (fd, prop_id),0 );
@@ -210,7 +210,7 @@ test_multiple(int fd)igt_assert_eq (destroy_prop (fd2, prop_ids[i]),0 );igt_assert_eq (validate_prop (fd2, prop_ids[i]),ENOENT ); } -igt_assert_eq (close (fd2),0 ); +igt_assert_eq (drm_close_driver (fd2),0 ); fd2 =drm_open_driver (DRIVER_ANY );igt_assert_fd (fd2);
@@ -221,7 +221,7 @@ test_multiple(int fd)igt_assert_eq (validate_prop (fd, prop_ids[i]),0 );igt_assert_eq (validate_prop (fd2, prop_ids[i]),0 ); } -igt_assert_eq (close (fd2),0 ); +igt_assert_eq (drm_close_driver (fd2),0 );for (i =0 ; i <ARRAY_SIZE (prop_ids); i++)igt_assert_eq (validate_prop (fd, prop_ids[i]),ENOENT );
@@ -350,5 +350,5 @@ igt_mainprop_tests (fd);igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/kms_properties.c +1 -1
@@ -810,6 +810,6 @@ igt_main igt_fixture {igt_display_fini (&display); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }
tests/kms_rmfb.c +2 -2
@@ -121,7 +121,7 @@ test_rmfb(struct rmfb_data *data, igt_output_t *output, enum pipe pipe, bool reodrmModeFreeCrtc (crtc);if (reopen) { -close (data->drm_fd); +drm_close_driver (data->drm_fd); data->drm_fd =drm_open_driver_master (DRIVER_ANY );drmSetClientCap (data->drm_fd,DRM_CLIENT_CAP_UNIVERSAL_PLANES ,1 );
@@ -204,6 +204,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_rotation_crc.c +1 -1
@@ -1279,6 +1279,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.gfx_fd); +drm_close_driver (data.gfx_fd); } }
tests/kms_scaling_modes.c +1 -1
@@ -138,6 +138,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_sequence.c +1 -1
@@ -303,6 +303,6 @@ igt_main } igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/kms_setmode.c +1 -1
@@ -978,6 +978,6 @@ igt_main_args("det:", NULL, help_str, opt_handler, NULL)if (is_xe_device (drm_fd))xe_device_put (drm_fd); -close (drm_fd); +drm_close_driver (drm_fd); } }
tests/kms_tv_load_detect.c +1 -1
@@ -84,6 +84,6 @@ igt_main igt_fixture {drmModeFreeConnector (tv_connector); -close (drm_fd); +drm_close_driver (drm_fd); } }
tests/kms_universal_plane.c +1 -1
@@ -918,6 +918,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/kms_vblank.c +1 -1
@@ -601,6 +601,6 @@ igt_mainrun_subtests_for_pipe (&data); igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/kms_vrr.c +1 -0
@@ -528,5 +528,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.drm_fd); } }
tests/kms_writeback.c +1 -0
@@ -606,5 +606,6 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)detach_crtc (&display, output);igt_remove_fb (display.drm_fd, &input_fb);igt_display_fini (&display); +drm_close_driver (display.drm_fd); } }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 15/20] tests/kms: Use drm_close_driver() to close the drm fd
Hi Bhanuprakash,
few nits, see below.
Quoted 9 lines · Bhanuprakash Modem
To close the drm file descriptor, use igt helper
drm_close_driver()instead of usingclose().Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/chamelium/kms_chamelium_audio.c | 2 +- tests/chamelium/kms_chamelium_edid.c | 2 +- tests/chamelium/kms_chamelium_frames.c | 2 +- tests/chamelium/kms_chamelium_hpd.c | 2 +-
imho you should split chamelium into separate patchset and cc Mark Yacoub.
Quoted 957 lines
tests/i915/kms_big_fb.c | 2 +- tests/i915/kms_big_joiner.c | 2 +- tests/i915/kms_busy.c | 2 +- tests/i915/kms_ccs.c | 2 +- tests/i915/kms_cdclk.c | 2 +- tests/i915/kms_draw_crc.c | 2 +- tests/i915/kms_dsc.c | 2 +- tests/i915/kms_fbcon_fbt.c | 2 +- tests/i915/kms_fence_pin_leak.c | 2 +- tests/i915/kms_flip_scaled_crc.c | 2 +- tests/i915/kms_flip_tiling.c | 2 +- tests/i915/kms_frontbuffer_tracking.c | 2 +- tests/i915/kms_legacy_colorkey.c | 2 +- tests/i915/kms_mmap_write_crc.c | 2 +- tests/i915/kms_pipe_b_c_ivb.c | 2 +- tests/i915/kms_psr.c | 2 +- tests/i915/kms_psr2_sf.c | 2 +- tests/i915/kms_psr2_su.c | 2 +- tests/i915/kms_psr_stress_test.c | 2 +- tests/i915/kms_pwrite_crc.c | 2 +- tests/kms_3d.c | 2 +- tests/kms_addfb_basic.c | 4 ++-- tests/kms_async_flips.c | 2 +- tests/kms_atomic.c | 2 +- tests/kms_atomic_interruptible.c | 2 +- tests/kms_atomic_transition.c | 2 +- tests/kms_color.c | 2 +- tests/kms_concurrent.c | 2 +- tests/kms_content_protection.c | 2 +- tests/kms_cursor_crc.c | 2 +- tests/kms_cursor_edge_walk.c | 2 +- tests/kms_cursor_legacy.c | 2 +- tests/kms_dither.c | 2 +- tests/kms_dp_aux_dev.c | 2 +- tests/kms_dp_tiled_display.c | 2 +- tests/kms_flip.c | 2 +- tests/kms_flip_event_leak.c | 4 ++-- tests/kms_force_connector_basic.c | 4 ++-- tests/kms_getfb.c | 4 ++-- tests/kms_hdmi_inject.c | 2 +- tests/kms_hdr.c | 2 +- tests/kms_invalid_mode.c | 2 +- tests/kms_lease.c | 4 ++-- tests/kms_panel_fitting.c | 2 +- tests/kms_pipe_crc_basic.c | 2 +- tests/kms_plane.c | 2 +- tests/kms_plane_alpha_blend.c | 2 +- tests/kms_plane_cursor.c | 2 +- tests/kms_plane_lowres.c | 2 +- tests/kms_plane_multiple.c | 2 +- tests/kms_plane_scaling.c | 2 +- tests/kms_prime.c | 6 +++--- tests/kms_prop_blob.c | 8 ++++---- tests/kms_properties.c | 2 +- tests/kms_rmfb.c | 4 ++-- tests/kms_rotation_crc.c | 2 +- tests/kms_scaling_modes.c | 2 +- tests/kms_sequence.c | 2 +- tests/kms_setmode.c | 2 +- tests/kms_tv_load_detect.c | 2 +- tests/kms_universal_plane.c | 2 +- tests/kms_vblank.c | 2 +- tests/kms_vrr.c | 1 + tests/kms_writeback.c | 1 + 68 files changed, 79 insertions(+), 77 deletions(-)tests/chamelium/kms_chamelium_audio.c +1
-1@@ -870,6 +870,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/chamelium/kms_chamelium_edid.c +1
-1@@ -585,6 +585,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/chamelium/kms_chamelium_frames.c +1
-1@@ -1102,6 +1102,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/chamelium/kms_chamelium_hpd.c +1
-1@@ -564,6 +564,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_big_fb.c +1
-1@@ -1010,6 +1010,6 @@ igt_main igt_fixture {igt_display_fini (&data.display);buf_ops_destroy (data.bops); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_big_joiner.c +1
-1@@ -302,6 +302,6 @@ igt_main igt_fixture {igt_remove_fb (data.drm_fd, &data.fb);igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_busy.c +1
-1@@ -506,6 +506,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL) igt_fixture {gpu_engines_restore_timeouts (fd, num_engines, saved_gpu_timeouts);igt_display_fini (&display); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }tests/i915/kms_ccs.c +1
-1@@ -708,6 +708,6 @@ igt_main_args("cs:", NULL, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_cdclk.c +1
-1@@ -397,6 +397,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_draw_crc.c +1
-1@@ -242,7 +242,7 @@ static void teardown_environment(void)buf_ops_destroy (bops); -close (drm_fd); +drm_close_driver (drm_fd); }static const char *format_str (int format_index)tests/i915/kms_dsc.c +1
-1@@ -316,6 +316,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_fbcon_fbt.c +1
-1@@ -408,7 +408,7 @@ static void teardown_environment(struct drm_info *drm)drmModeFreeResources (drm->res);close (drm->debugfs_fd); -close (drm->fd); +drm_close_driver (drm->fd);kmstest_restore_vt_mode (); }tests/i915/kms_fence_pin_leak.c +1
-1@@ -238,5 +238,5 @@ igt_simple_mainbuf_ops_destroy (data.bops);igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); }tests/i915/kms_flip_scaled_crc.c +1
-1@@ -694,6 +694,6 @@ igt_main }kmstest_set_vt_text_mode ();igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_flip_tiling.c +1
-1@@ -240,6 +240,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_frontbuffer_tracking.c +1
-1@@ -1351,7 +1351,7 @@ static void teardown_drm(void) {buf_ops_destroy (drm.bops);igt_display_fini (&drm.display); -close (drm.fd); +drm_close_driver (drm.fd); }static void setup_modeset (void )tests/i915/kms_legacy_colorkey.c +1
-1@@ -87,6 +87,6 @@ igt_main igt_fixture {igt_display_fini (&display); -close (drm_fd); +drm_close_driver (drm_fd); } }tests/i915/kms_mmap_write_crc.c +1
-1@@ -303,7 +303,7 @@ igt_main_args("n", NULL, NULL, opt_handler, NULL) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd);igt_stop_helper (&hog); }tests/i915/kms_pipe_b_c_ivb.c +1
-1@@ -291,6 +291,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_psr.c +1
-1@@ -670,6 +670,6 @@ igt_main_args("", long_options, help_str, opt_handler, &data)close (data.debugfs_fd);buf_ops_destroy (data.bops);display_fini (&data); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_psr2_sf.c +1
-1@@ -1298,6 +1298,6 @@ igt_main igt_fixture {close (data.debugfs_fd);display_fini (&data); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_psr2_su.c +1
-1@@ -373,6 +373,6 @@ igt_main igt_fixture {close (data.debugfs_fd);display_fini (&data); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_psr_stress_test.c +1
-1@@ -378,6 +378,6 @@ igt_mainbuf_ops_destroy (data.bops);igt_display_fini (&data.display);close (data.debugfs_fd); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/kms_pwrite_crc.c +1
-1@@ -193,5 +193,5 @@ igt_simple_mainrun_test (&data);igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); }tests/kms_3d.c +1
-1@@ -119,5 +119,5 @@ igt_simple_mainif (is_xe_device (drm_fd))xe_device_put (drm_fd); -close (drm_fd); +drm_close_driver (drm_fd); }tests/kms_addfb_basic.c +2
-2@@ -933,7 +933,7 @@ static void master_tests(int fd)do_ioctl_err (master2_fd,DRM_IOCTL_MODE_RMFB , &f.fb_id,ENOENT );igt_device_drop_master (master2_fd); -close (master2_fd); +drm_close_driver (master2_fd);igt_device_set_master (fd); }@@ -1012,6 +1012,6 @@ igt_mainif (is_xe_device (fd))xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/kms_async_flips.c +1
-1@@ -668,6 +668,6 @@ igt_main_args("e", NULL, help_str, opt_handler, &data)igt_display_reset (&data.display);igt_display_commit (&data.display);igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_atomic.c +1
-1@@ -1460,6 +1460,6 @@ igt_mainigt_remove_fb (display.drm_fd, &fb);igt_display_fini (&display); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }tests/kms_atomic_interruptible.c +1
-1@@ -389,6 +389,6 @@ igt_main/* TODO: legacy gamma_set/get, object set/getprop, getcrtc, getconnector */ igt_fixture {igt_display_fini (&display); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }tests/kms_atomic_transition.c +1
-1@@ -1182,6 +1182,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_color.c +1
-1@@ -1069,6 +1069,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_concurrent.c +1
-1@@ -400,6 +400,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)if (is_intel_device (data.drm_fd))intel_allocator_multiprocess_stop ();igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_content_protection.c +1
-1@@ -884,6 +884,6 @@ igt_main igt_fixture {test_content_protection_cleanup ();igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_cursor_crc.c +1
-1@@ -1010,6 +1010,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL) }igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_cursor_edge_walk.c +1
-1@@ -391,6 +391,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_cursor_legacy.c +1
-1@@ -1843,6 +1843,6 @@ igt_mainif (intel_psr2_restore)i915_psr2_sel_fetch_restore (display.drm_fd);igt_display_fini (&display); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }tests/kms_dither.c +1
-1@@ -247,6 +247,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_dp_aux_dev.c +1
-1@@ -147,5 +147,5 @@ igt_simple_mainigt_require (valid_connectors);drmModeFreeResources (res); -close (drm_fd); +drm_close_driver (drm_fd); }tests/kms_dp_tiled_display.c +1
-1@@ -502,6 +502,6 @@ igt_mainfree (data.conns);kmstest_restore_vt_mode ();igt_display_fini (data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_flip.c +1
-1@@ -1930,6 +1930,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL)if (is_xe_device (drm_fd))xe_device_put (drm_fd); -close (drm_fd); +drm_close_driver (drm_fd); } }tests/kms_flip_event_leak.c +2
-2@@ -79,7 +79,7 @@ static void test(data_t *data, enum pipe pipe, igt_output_t *output)if (is_xe_device (fd))xe_device_put (fd); - ret =close (fd); + ret =drm_close_driver (fd);igt_assert_eq (ret,0 );igt_device_set_master (data->drm_fd);@@ -121,6 +121,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_force_connector_basic.c +2
-2@@ -65,7 +65,7 @@ static void reset_connectors(void)free (param); } -close (drm_fd); +drm_close_driver (drm_fd); }static void force_load_detect (int drm_fd,drmModeConnectorPtr connector,drmModeRes *res)@@ -415,7 +415,7 @@ end: igt_fixture {drmModeFreeConnector (connector); -close (drm_fd); +drm_close_driver (drm_fd);reset_connectors (); }tests/kms_getfb.c +2
-2@@ -452,7 +452,7 @@ static void test_handle_protection(void) {if (is_xe_device (non_master_fd))xe_device_get (non_master_fd); -close (non_master_fd); +drm_close_driver (non_master_fd); } }@@ -484,6 +484,6 @@ igt_mainif (is_xe_device (fd))xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/kms_hdmi_inject.c +1
-1@@ -227,6 +227,6 @@ igt_mainif (is_xe_device (drm_fd))xe_device_put (drm_fd); -close (drm_fd); +drm_close_driver (drm_fd); } }tests/kms_hdr.c +1
-1@@ -666,6 +666,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.fd); +drm_close_driver (data.fd); } }tests/kms_invalid_mode.c +1
-1@@ -300,6 +300,6 @@ igt_mainigt_display_fini (&data.display);igt_reset_connectors ();drmModeFreeResources (data.res); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_lease.c +2
-2@@ -1082,7 +1082,7 @@ static void multimaster_lease(data_t *data)drmSetClientCap (master2_fd,DRM_CLIENT_CAP_UNIVERSAL_PLANES ,1 ); lease2_fd =create_simple_lease (master2_fd, data); -close (master2_fd);/* close is an implicit DropMaster */ +drm_close_driver (master2_fd);/* close is an implicit DropMaster */ igt_assert (!is_master (lease2_fd));igt_device_set_master (data->master.fd);@@ -1278,6 +1278,6 @@ igt_main igt_fixture {igt_display_fini (display); -close (data.master.fd); +drm_close_driver (data.master.fd); } }tests/kms_panel_fitting.c +1
-1@@ -288,6 +288,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_pipe_crc_basic.c +1
-1@@ -491,6 +491,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_plane.c +1
-1@@ -1318,6 +1318,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_plane_alpha_blend.c +1
-1@@ -715,6 +715,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL) COMMIT_ATOMIC : COMMIT_LEGACY);igt_display_fini (&data.display); -close (data.gfx_fd); +drm_close_driver (data.gfx_fd); } }tests/kms_plane_cursor.c +1
-1@@ -331,6 +331,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_plane_lowres.c +1
-1@@ -342,6 +342,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_plane_multiple.c +1
-1@@ -478,6 +478,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_plane_scaling.c +1
-1@@ -1324,6 +1324,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_prime.c +3
-3@@ -431,7 +431,7 @@ igt_mainif (kms_poll_disabled)kms_poll_state_restore (); -close (second_fd_hybrid); +drm_close_driver (second_fd_hybrid); } }@@ -454,9 +454,9 @@ igt_main }igt_fixture -close (second_fd_vgem ); +drm_close_driver (second_fd_vgem ); }igt_fixture -close (first_fd ); +drm_close_driver (first_fd ); }tests/kms_prop_blob.c +4
-4@@ -182,7 +182,7 @@ test_lifetime(int fd)/* Make sure properties are cleaned up on client exit. */ prop_id2 =create_prop (fd2);igt_assert_eq (validate_prop (fd, prop_id2),0 ); -igt_assert_eq (close (fd2),0 ); +igt_assert_eq (drm_close_driver (fd2),0 );igt_assert_eq (validate_prop (fd, prop_id2),ENOENT );igt_assert_eq (validate_prop (fd, prop_id),0 );@@ -210,7 +210,7 @@ test_multiple(int fd)igt_assert_eq (destroy_prop (fd2, prop_ids[i]),0 );igt_assert_eq (validate_prop (fd2, prop_ids[i]),ENOENT ); } -igt_assert_eq (close (fd2),0 ); +igt_assert_eq (drm_close_driver (fd2),0 ); fd2 =drm_open_driver (DRIVER_ANY );igt_assert_fd (fd2);@@ -221,7 +221,7 @@ test_multiple(int fd)igt_assert_eq (validate_prop (fd, prop_ids[i]),0 );igt_assert_eq (validate_prop (fd2, prop_ids[i]),0 ); } -igt_assert_eq (close (fd2),0 ); +igt_assert_eq (drm_close_driver (fd2),0 );for (i =0 ; i <ARRAY_SIZE (prop_ids); i++)igt_assert_eq (validate_prop (fd, prop_ids[i]),ENOENT );@@ -350,5 +350,5 @@ igt_mainprop_tests (fd);igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/kms_properties.c +1
-1@@ -810,6 +810,6 @@ igt_main igt_fixture {igt_display_fini (&display); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }tests/kms_rmfb.c +2
-2@@ -121,7 +121,7 @@ test_rmfb(struct rmfb_data *data, igt_output_t *output, enum pipe pipe, bool reodrmModeFreeCrtc (crtc);if (reopen) { -close (data->drm_fd); +drm_close_driver (data->drm_fd); data->drm_fd =drm_open_driver_master (DRIVER_ANY );drmSetClientCap (data->drm_fd,DRM_CLIENT_CAP_UNIVERSAL_PLANES ,1 );@@ -204,6 +204,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_rotation_crc.c +1
-1@@ -1279,6 +1279,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) igt_fixture {igt_display_fini (&data.display); -close (data.gfx_fd); +drm_close_driver (data.gfx_fd); } }tests/kms_scaling_modes.c +1
-1@@ -138,6 +138,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_sequence.c +1
-1@@ -303,6 +303,6 @@ igt_main } igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/kms_setmode.c +1
-1@@ -978,6 +978,6 @@ igt_main_args("det:", NULL, help_str, opt_handler, NULL)if (is_xe_device (drm_fd))xe_device_put (drm_fd); -close (drm_fd); +drm_close_driver (drm_fd); } }tests/kms_tv_load_detect.c +1
-1@@ -84,6 +84,6 @@ igt_main igt_fixture {drmModeFreeConnector (tv_connector); -close (drm_fd); +drm_close_driver (drm_fd); } }tests/kms_universal_plane.c +1
-1@@ -918,6 +918,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/kms_vblank.c +1
-1@@ -601,6 +601,6 @@ igt_mainrun_subtests_for_pipe (&data); igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/kms_vrr.c +0
-0
tests/kms_vrr.c igt_main · line 531
Quoted 4 lines
tests/kms_vrr.c +1
-0@@ -528,5 +528,6 @@ igt_main igt_fixture {igt_display_fini (&data.display); +drm_close_driver (data.drm_fd);
This is a fix, send it in separate patch.
tests/kms_writeback.c igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL) · line 609
Quoted 11 lines
tests/kms_vrr.c +0
-0} }tests/kms_writeback.c +1
-0@@ -606,5 +606,6 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)detach_crtc (&display, output);igt_remove_fb (display.drm_fd, &input_fb);igt_display_fini (&display); +drm_close_driver (display.drm_fd);
Also a fix for separate patch.
Rest looks good.
Regards,
Kamil
Quoted 5 lines
tests/kms_writeback.c +0
-0} }Signature · 1 line
2.40.0
PATCH 16/20 tests/xe: Use drm_close_driver() to close the drm fd
In reply to Bhanuprakash ModemTo close the drm file descriptor, use igt helper drm_close_driver() instead of using close().
--- tests/testdisplay.c | 4 ++-- tests/xe/xe_compute.c | 2 +- tests/xe/xe_create.c | 2 +- tests/xe/xe_debugfs.c | 2 +- tests/xe/xe_dma_buf_sync.c | 4 ++-- tests/xe/xe_evict.c | 6 +++--- tests/xe/xe_exec_balancer.c | 2 +- tests/xe/xe_exec_basic.c | 2 +- tests/xe/xe_exec_compute_mode.c | 2 +- tests/xe/xe_exec_fault_mode.c | 2 +- tests/xe/xe_exec_reset.c | 8 ++++---- tests/xe/xe_exec_threads.c | 8 ++++---- tests/xe/xe_guc_pc.c | 2 +- tests/xe/xe_huc_copy.c | 2 +- tests/xe/xe_intel_bb.c | 2 +- tests/xe/xe_mmap.c | 2 +- tests/xe/xe_mmio.c | 2 +- tests/xe/xe_module_load.c | 2 +- tests/xe/xe_noexec_ping_pong.c | 2 +- tests/xe/xe_pm.c | 2 +- tests/xe/xe_prime_self_import.c | 30 +++++++++++++++--------------- tests/xe/xe_query.c | 2 +- tests/xe/xe_vm.c | 2 +- tests/xe/xe_waitfence.c | 2 +- 24 files changed, 48 insertions(+), 48 deletions(-)
tests/testdisplay.c +2 -2
@@ -548,7 +548,7 @@ int update_display(bool probe)__noreturn static void cleanup_and_exit (int ret) { -close (drm_fd); +drm_close_driver (drm_fd);exit (ret); }
@@ -779,7 +779,7 @@ out_hotplug: out_mainloop:g_main_loop_unref (mainloop); out_close: -close (drm_fd); +drm_close_driver (drm_fd);igt_assert_eq (ret,0 ); }
tests/xe/xe_compute.c +1 -1
@@ -45,6 +45,6 @@ igt_main igt_fixture {xe_device_put (xe); -close (xe); +drm_close_driver (xe); } }
tests/xe/xe_create.c +1 -1
@@ -127,6 +127,6 @@ igt_main igt_fixture {xe_device_put (xe); -close (xe); +drm_close_driver (xe); } }
tests/xe/xe_debugfs.c +1 -1
@@ -270,6 +270,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_dma_buf_sync.c +2 -2
@@ -220,7 +220,7 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0,for (i =0 ; i <N_FD ; ++i) {xe_device_put (fd[i]); -close (fd[i]); +drm_close_driver (fd[i]); } }
@@ -257,6 +257,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_evict.c +3 -3
@@ -201,7 +201,7 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,xe_vm_destroy (fd, vm3); }xe_device_put (fd); -close (fd); +drm_close_driver (fd); } static void
@@ -369,7 +369,7 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci,if (flags &MULTI_VM )xe_vm_destroy (fd, vm2);xe_device_put (fd); -close (fd); +drm_close_driver (fd); }struct thread_data {
@@ -701,5 +701,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/xe/xe_exec_balancer.c +1 -1
@@ -708,6 +708,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_exec_basic.c +1 -1
@@ -353,6 +353,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_exec_compute_mode.c +1 -1
@@ -361,6 +361,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_exec_fault_mode.c +1 -1
@@ -570,6 +570,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_exec_reset.c +4 -4
@@ -294,7 +294,7 @@ test_balancer(int fd, int gt, int class, int n_engines, int n_execs,xe_engine_destroy (fd, engines[i]); }xe_device_put (fd); -close (fd); +drm_close_driver (fd);/* FIXME: wait for idle */ usleep (150000 );return ;
@@ -475,7 +475,7 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci,xe_engine_destroy (fd, engines[i]); }xe_device_put (fd); -close (fd); +drm_close_driver (fd);/* FIXME: wait for idle */ usleep (150000 );return ;
@@ -655,7 +655,7 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,xe_engine_destroy (fd, engines[i]); }xe_device_put (fd); -close (fd); +drm_close_driver (fd);/* FIXME: wait for idle */ usleep (150000 );return ;
@@ -946,6 +946,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_exec_threads.c +4 -4
@@ -245,7 +245,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,xe_vm_destroy (fd, vm);if (owns_fd) {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
@@ -454,7 +454,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,xe_vm_destroy (fd, vm);if (owns_fd) {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
@@ -698,7 +698,7 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,xe_vm_destroy (fd, vm);if (owns_fd) {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
@@ -1403,6 +1403,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_guc_pc.c +1 -1
@@ -496,6 +496,6 @@ igt_main }close (sysfs);xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_huc_copy.c +1 -1
@@ -192,6 +192,6 @@ igt_main igt_fixture {xe_device_put (xe); -close (xe); +drm_close_driver (xe); } }
tests/xe/xe_intel_bb.c +1 -1
@@ -1180,6 +1180,6 @@ igt_main_args("dpib", NULL, help_str, opt_handler, NULL) igt_fixture {xe_device_put (xe);buf_ops_destroy (bops); -close (xe); +drm_close_driver (xe); } }
tests/xe/xe_mmap.c +1 -1
@@ -77,6 +77,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_mmio.c +1 -1
@@ -89,6 +89,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_module_load.c +1 -1
@@ -86,7 +86,7 @@ static void load_and_check_xe(const char *opts)/* driver is ready, check if it's bound */ drm_fd =__drm_open_driver (DRIVER_XE );igt_fail_on_f (drm_fd <0 ,"Cannot open the xe DRM driver after modprobing xe.\n" ); -close (drm_fd); +drm_close_driver (drm_fd); }static const char *const unwanted_drivers[] = {
tests/xe/xe_noexec_ping_pong.c +1 -1
@@ -104,5 +104,5 @@ igt_simple_maintest_ping_pong (fd,xe_hw_engine (fd,0 ));xe_device_put (fd); -close (fd); +drm_close_driver (fd); }
tests/xe/xe_pm.c +1 -1
@@ -441,6 +441,6 @@ igt_mainset_d3cold_allowed (device.pci_xe, d3cold_allowed);igt_restore_runtime_pm ();xe_device_put (device.fd_xe); -close (device.fd_xe); +drm_close_driver (device.fd_xe); } }
tests/xe/xe_prime_self_import.c +15 -15
@@ -122,9 +122,9 @@ static void test_with_fd_dup(void)check_bo (fd2, handle_import, fd2, handle_import);xe_device_put (fd1); -close (fd1); +drm_close_driver (fd1);xe_device_put (fd2); -close (fd2); +drm_close_driver (fd2); }/**
@@ -166,9 +166,9 @@ static void test_with_two_bos(void)check_bo (fd2, handle_import, fd2, handle_import);xe_device_put (fd1); -close (fd1); +drm_close_driver (fd1);xe_device_put (fd2); -close (fd2); +drm_close_driver (fd2); }/**
@@ -202,9 +202,9 @@ static void test_with_one_bo_two_files(void)igt_assert_eq_u32 (handle_import, handle_open);xe_device_put (fd1); -close (fd1); +drm_close_driver (fd1);xe_device_put (fd2); -close (fd2); +drm_close_driver (fd2);close (dma_buf_fd1);close (dma_buf_fd2); }
@@ -259,10 +259,10 @@ static void test_with_one_bo(void)/* Completely rip out exporting fd. */ xe_device_put (fd1); -close (fd1); +drm_close_driver (fd1);check_bo (fd2, handle_import1, fd2, handle_import1);xe_device_put (fd2); -close (fd2); +drm_close_driver (fd2); }static void *thread_fn_reimport_vs_close (void *p)
@@ -335,7 +335,7 @@ static void *thread_fn_reimport_vs_close(void *p)pthread_barrier_destroy (&g_barrier);xe_device_put (fds[0 ]); -close (fds[0 ]); +drm_close_driver (fds[0 ]);close (fds[1 ]);/* TODO: Read object count */
@@ -343,7 +343,7 @@ static void *thread_fn_reimport_vs_close(void *p)igt_info ("leaked %i objects\n" , obj_count); -close (fake); +drm_close_driver (fake);igt_assert_eq (obj_count,0 ); }
@@ -429,7 +429,7 @@ static void test_export_close_race(void)pthread_barrier_destroy (&g_barrier);xe_device_put (fd); -close (fd); +drm_close_driver (fd);/* TODO: Read object count */ obj_count =0 ;
@@ -437,7 +437,7 @@ static void test_export_close_race(void)igt_info ("leaked %i objects\n" , obj_count);xe_device_put (fake); -close (fake); +drm_close_driver (fake);igt_assert_eq (obj_count,0 ); }
@@ -474,7 +474,7 @@ static void test_llseek_size(void) }xe_device_put (fd); -close (fd); +drm_close_driver (fd); }/**
@@ -511,7 +511,7 @@ static void test_llseek_bad(void)close (dma_buf_fd);xe_device_put (fd); -close (fd); +drm_close_driver (fd); } igt_main
@@ -544,6 +544,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_query.c +1 -1
@@ -491,6 +491,6 @@ igt_main igt_fixture {xe_device_put (xe); -close (xe); +drm_close_driver (xe); } }
tests/xe/xe_vm.c +1 -1
@@ -1839,6 +1839,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
tests/xe/xe_waitfence.c +1 -1
@@ -98,6 +98,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 16/20] tests/xe: Use drm_close_driver() to close the drm fd
LGTM
Quoted 533 lines
-----Original Message-----
From: Modem, Bhanuprakash <[email protected]>
Sent: 16 May 2023 22:21
To: [email protected]; [email protected]; Kumar, Janga Rahul <[email protected]>
Cc: Modem, Bhanuprakash <[email protected]>
Subject: [i-g-t 16/20] tests/xe: Usedrm_close_driver()to close the drm fdTo close the drm file descriptor, use igt helper
drm_close_driver()instead of usingclose().Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/testdisplay.c | 4 ++-- tests/xe/xe_compute.c | 2 +- tests/xe/xe_create.c | 2 +- tests/xe/xe_debugfs.c | 2 +- tests/xe/xe_dma_buf_sync.c | 4 ++-- tests/xe/xe_evict.c | 6 +++--- tests/xe/xe_exec_balancer.c | 2 +- tests/xe/xe_exec_basic.c | 2 +- tests/xe/xe_exec_compute_mode.c | 2 +- tests/xe/xe_exec_fault_mode.c | 2 +- tests/xe/xe_exec_reset.c | 8 ++++---- tests/xe/xe_exec_threads.c | 8 ++++---- tests/xe/xe_guc_pc.c | 2 +- tests/xe/xe_huc_copy.c | 2 +- tests/xe/xe_intel_bb.c | 2 +- tests/xe/xe_mmap.c | 2 +- tests/xe/xe_mmio.c | 2 +- tests/xe/xe_module_load.c | 2 +- tests/xe/xe_noexec_ping_pong.c | 2 +- tests/xe/xe_pm.c | 2 +- tests/xe/xe_prime_self_import.c | 30 +++++++++++++++--------------- tests/xe/xe_query.c | 2 +- tests/xe/xe_vm.c | 2 +- tests/xe/xe_waitfence.c | 2 +- 24 files changed, 48 insertions(+), 48 deletions(-)tests/testdisplay.c index ee272dfb2..294d4c604 renamed from tests/testdisplay.c +0
-0100644
tests/testdisplay.c +2
-2@@ -548,7 +548,7 @@ int update_display(bool probe)__noreturn static void cleanup_and_exit (int ret) { -close (drm_fd); +drm_close_driver (drm_fd);exit (ret); }@@ -779,7 +779,7 @@ out_hotplug: out_mainloop:g_main_loop_unref (mainloop); out_close: -close (drm_fd); +drm_close_driver (drm_fd);igt_assert_eq (ret,0 ); }tests/xe/xe_compute.c index renamed from tests/xe/xe_compute.c +0
-0
7ac64dfe3..5e6cd8529100644tests/xe/xe_compute.c +1
-1@@ -45,6 +45,6 @@ igt_main igt_fixture {xe_device_put (xe); -close (xe); +drm_close_driver (xe); } }tests/xe/xe_create.c index renamed from tests/xe/xe_create.c +0
-0
5effabc83..959dd27e7100644tests/xe/xe_create.c +1
-1@@ -127,6 +127,6 @@ igt_main igt_fixture {xe_device_put (xe); -close (xe); +drm_close_driver (xe); } }tests/xe/xe_debugfs.c index renamed from tests/xe/xe_debugfs.c +0
-0
6bdd3ef06..4006981c6100644tests/xe/xe_debugfs.c +1
-1@@ -270,6 +270,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); }}
tests/xe/xe_dma_buf_sync.c index renamed from tests/xe/xe_dma_buf_sync.c +0
-0
8920b141b..81ece2428100644tests/xe/xe_dma_buf_sync.c +1
-1@@ -220,7 +220,7 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0, for (i = 0; i < N_FD; ++i) {xe_device_put (fd[i]); -close (fd[i]); +drm_close_driver (fd[i]); }}
tests/xe/xe_dma_buf_sync.c +1
-1@@ -257,6 +257,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/xe/xe_evict.c index renamed from tests/xe/xe_evict.c +0
-0
7fef4efc5..4b66dd683100644tests/xe/xe_evict.c +1
-1@@ -201,7 +201,7 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,xe_vm_destroy (fd, vm3); }xe_device_put (fd); -close (fd); +drm_close_driver (fd); }static void
tests/xe/xe_evict.c +1
-1@@ -369,7 +369,7 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci, if (flags & MULTI_VM)xe_vm_destroy (fd, vm2);xe_device_put (fd); -close (fd); +drm_close_driver (fd); }struct
thread_data{tests/xe/xe_evict.c +1
-1@@ -701,5 +701,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/xe/xe_exec_balancer.c index renamed from tests/xe/xe_exec_balancer.c +0
-0
2018c8104..fb4592903100644tests/xe/xe_exec_balancer.c +1
-1@@ -708,6 +708,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/xe/xe_exec_basic.c index renamed from tests/xe/xe_exec_basic.c +0
-0
2a176a5b3..d14a764f4100644tests/xe/xe_exec_basic.c +1
-1@@ -353,6 +353,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }(quoted diff) +0
-0
b/tests/xe/xe_exec_compute_mode.cindex 685193990..950cb6159 100644tests/xe/xe_exec_compute_mode.c +1
-1@@ -361,6 +361,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/xe/xe_exec_fault_mode.c +1
-1@@ -570,6 +570,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/xe/xe_exec_reset.c index renamed from tests/xe/xe_exec_reset.c +0
-0
0d72a3f20..3700b8dce100644tests/xe/xe_exec_reset.c +1
-1@@ -294,7 +294,7 @@ test_balancer(int fd, int gt, int class, int n_engines, int n_execs,xe_engine_destroy (fd, engines[i]); }xe_device_put (fd); -close (fd); +drm_close_driver (fd);/* FIXME: wait for idle */ usleep (150000 );tests/xe/xe_exec_reset.c +1
-1return ;@@ -475,7 +475,7 @@ test_legacy_mode(int fd, structdrm_xe_engine_class_instance *eci,xe_engine_destroy (fd ,engines [i]); }xe_device_put (fd); -close (fd); +drm_close_driver (fd);/* FIXME: wait for idle */ usleep (150000 );tests/xe/xe_exec_reset.c +1
-1return ;@@ -655,7 +655,7 @@ test_compute_mode(int fd, structdrm_xe_engine_class_instance *eci,xe_engine_destroy (fd ,engines [i]); }xe_device_put (fd); -close (fd); +drm_close_driver (fd);/* FIXME: wait for idle */ usleep (150000 );tests/xe/xe_exec_reset.c +1
-1return ;@@ -946,6 +946,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/xe/xe_exec_threads.c index renamed from tests/xe/xe_exec_threads.c +0
-0
3f2c2de9e..bde92a9c5100644tests/xe/xe_exec_threads.c +4
-4@@ -245,7 +245,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr,uint64_t userptr,xe_vm_destroy (fd ,vm );if (owns_fd) {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }@@ -454,7 +454,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr,uint64_t userptr,xe_vm_destroy (fd ,vm );if (owns_fd) {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }@@ -698,7 +698,7 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr,uint64_t userptr,xe_vm_destroy (fd ,vm );if (owns_fd) {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }@@ -1403,6 +1403,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/xe/xe_guc_pc.c index renamed from tests/xe/xe_guc_pc.c +0
-0
5c71ae147..56d4f9190100644tests/xe/xe_guc_pc.c +1
-1@@ -496,6 +496,6 @@ igt_main }close (sysfs);xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/xe/xe_huc_copy.c index renamed from tests/xe/xe_huc_copy.c +0
-0
fdac907d6..ccdfe8622100644tests/xe/xe_huc_copy.c +1
-1@@ -192,6 +192,6 @@ igt_main igt_fixture {xe_device_put (xe); -close (xe); +drm_close_driver (xe); } }tests/xe/xe_intel_bb.c index renamed from tests/xe/xe_intel_bb.c +0
-0
35d61608e..f43beb1a8100644tests/xe/xe_intel_bb.c +1
-1@@ -1180,6 +1180,6 @@ igt_main_args("dpib", NULL, help_str, opt_handler, NULL) igt_fixture {xe_device_put (xe);buf_ops_destroy (bops); -close (xe); +drm_close_driver (xe); }}
tests/xe/xe_mmap.c index renamed from tests/xe/xe_mmap.c +0
-0
6b313a189..352cbcab4100644tests/xe/xe_mmap.c +1
-1@@ -77,6 +77,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/xe/xe_mmio.c index renamed from tests/xe/xe_mmio.c +0
-0
42b6241b1..77a38b8d1100644tests/xe/xe_mmio.c +1
-1@@ -89,6 +89,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/xe/xe_module_load.c index renamed from tests/xe/xe_module_load.c +0
-0
c2d43cc20..16432c78f100644tests/xe/xe_module_load.c +1
-1@@ -86,7 +86,7 @@ static void load_and_check_xe(const char *opts)/* driver is ready, check if it's bound */ drm_fd =__drm_open_driver (DRIVER_XE ); igt_fail_on_f(drm_fd < 0, "Cannot open the xe DRM driver after modprobing xe.\n"); -close (drm_fd); +drm_close_driver (drm_fd); }static const char * const unwanted_drivers[] = { diff --git
a/tests/xe/xe_noexec_ping_pong.cb/tests/xe/xe_noexec_ping_pong.cindex 367671883..f276e694c 100644tests/xe/xe_noexec_ping_pong.c +1
-1@@ -104,5 +104,5 @@ igt_simple_maintest_ping_pong (fd,xe_hw_engine (fd,0 ));xe_device_put (fd); -close (fd); +drm_close_driver (fd); }tests/xe/xe_pm.c index 44154143c..7bec294ed renamed from tests/xe/xe_pm.c +0
-0100644
tests/xe/xe_pm.c +1
-1@@ -441,6 +441,6 @@ igt_mainset_d3cold_allowed (device.pci_xe, d3cold_allowed);igt_restore_runtime_pm ();xe_device_put (device.fd_xe); -close (device.fd_xe); +drm_close_driver (device.fd_xe); } }tests/xe/xe_prime_self_import.c +8
-8@@ -122,9 +122,9 @@ static void test_with_fd_dup(void)check_bo (fd2, handle_import, fd2, handle_import);xe_device_put (fd1); -close (fd1); +drm_close_driver (fd1);xe_device_put (fd2); -close (fd2); +drm_close_driver (fd2); }/** @@ -166,9 +166,9 @@ static void test_with_two_bos(void)check_bo (fd2, handle_import, fd2, handle_import);xe_device_put (fd1); -close (fd1); +drm_close_driver (fd1);xe_device_put (fd2); -close (fd2); +drm_close_driver (fd2); }/** @@ -202,9 +202,9 @@ static void test_with_one_bo_two_files(void)igt_assert_eq_u32 (handle_import, handle_open);xe_device_put (fd1); -close (fd1); +drm_close_driver (fd1);xe_device_put (fd2); -close (fd2); +drm_close_driver (fd2);close (dma_buf_fd1);close (dma_buf_fd2); }@@ -259,10 +259,10 @@ static void test_with_one_bo(void)/* Completely rip out exporting fd. */ xe_device_put (fd1); -close (fd1); +drm_close_driver (fd1);check_bo (fd2, handle_import1, fd2, handle_import1);xe_device_put (fd2); -close (fd2); +drm_close_driver (fd2); } static void *thread_fn_reimport_vs_close(void *p) @@ -335,7 +335,7 @@static void *thread_fn_reimport_vs_close(void *p)
tests/xe/xe_prime_self_import.c +7
-7pthread_barrier_destroy (&g_barrier);xe_device_put (fds[0 ]); -close (fds[0 ]); +drm_close_driver (fds[0 ]);close (fds[1 ]);/* TODO: Read object count */ @@ -343,7 +343,7 @@ static void *thread_fn_reimport_vs_close(void *p)igt_info ("leaked %i objects\n" , obj_count); -close (fake); +drm_close_driver (fake);igt_assert_eq (obj_count,0 ); }@@ -429,7 +429,7 @@ static void test_export_close_race(void)pthread_barrier_destroy (&g_barrier);xe_device_put (fd); -close (fd); +drm_close_driver (fd);/* TODO: Read object count */ obj_count =0 ;@@ -437,7 +437,7 @@ static void test_export_close_race(void)igt_info ("leaked %i objects\n" , obj_count);xe_device_put (fake); -close (fake); +drm_close_driver (fake);igt_assert_eq (obj_count,0 ); }@@ -474,7 +474,7 @@ static void test_llseek_size(void) }xe_device_put (fd); -close (fd); +drm_close_driver (fd); }/** @@ -511,7 +511,7 @@ static void test_llseek_bad(void)close (dma_buf_fd);xe_device_put (fd); -close (fd); +drm_close_driver (fd); } igt_main@@ -544,6 +544,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/xe/xe_query.c index renamed from tests/xe/xe_query.c +0
-0
87990370f..1c06534d4100644tests/xe/xe_query.c +1
-1@@ -491,6 +491,6 @@ igt_main igt_fixture {xe_device_put (xe); -close (xe); +drm_close_driver (xe); } }tests/xe/xe_vm.c index d4cec104e..9015a5a57 renamed from tests/xe/xe_vm.c +0
-0100644
tests/xe/xe_vm.c +1
-1@@ -1839,6 +1839,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } }tests/xe/xe_waitfence.c index renamed from tests/xe/xe_waitfence.c +0
-0
cdfcacdb4..8bfb741f6100644tests/xe/xe_waitfence.c +1
-2@@ -98,6 +98,6 @@ igt_main igt_fixture {xe_device_put (fd); -close (fd); +drm_close_driver (fd); } } --2.40.0
PATCH 17/20 tests/i915: Use drm_close_driver() to close the drm fd
In reply to Bhanuprakash ModemTo close the drm file descriptor, use igt helper drm_close_driver() instead of using close().
--- tests/core_auth.c | 10 +++---- tests/core_getclient.c | 2 +- tests/core_getstats.c | 2 +- tests/core_getversion.c | 2 +- tests/core_setmaster.c | 6 ++-- tests/core_setmaster_vs_auth.c | 6 ++-- tests/debugfs_test.c | 2 +- tests/dumb_buffer.c | 2 +- tests/eviction_common.c | 2 +- tests/fbdev.c | 2 +- tests/i915/api_intel_allocator.c | 6 ++-- tests/i915/api_intel_bb.c | 2 +- tests/i915/drm_fdinfo.c | 2 +- tests/i915/gem_bad_reloc.c | 2 +- tests/i915/gem_barrier_race.c | 2 +- tests/i915/gem_basic.c | 2 +- tests/i915/gem_blits.c | 2 +- tests/i915/gem_busy.c | 2 +- tests/i915/gem_caching.c | 2 +- tests/i915/gem_ccs.c | 2 +- tests/i915/gem_close_race.c | 14 ++++----- tests/i915/gem_cs_tlb.c | 2 +- tests/i915/gem_ctx_bad_destroy.c | 2 +- tests/i915/gem_ctx_create.c | 4 +-- tests/i915/gem_ctx_exec.c | 2 +- tests/i915/gem_ctx_param.c | 2 +- tests/i915/gem_ctx_persistence.c | 6 ++-- tests/i915/gem_ctx_shared.c | 2 +- tests/i915/gem_ctx_sseu.c | 2 +- tests/i915/gem_ctx_switch.c | 2 +- tests/i915/gem_eio.c | 16 +++++------ tests/i915/gem_evict_alignment.c | 2 +- tests/i915/gem_evict_everything.c | 2 +- tests/i915/gem_exec_alignment.c | 2 +- tests/i915/gem_exec_async.c | 2 +- tests/i915/gem_exec_await.c | 2 +- tests/i915/gem_exec_basic.c | 2 +- tests/i915/gem_exec_big.c | 2 +- tests/i915/gem_exec_capture.c | 2 +- tests/i915/gem_exec_create.c | 2 +- tests/i915/gem_exec_fair.c | 2 +- tests/i915/gem_exec_fence.c | 4 +-- tests/i915/gem_exec_flush.c | 2 +- tests/i915/gem_exec_gttfill.c | 4 +-- tests/i915/gem_exec_latency.c | 2 +- tests/i915/gem_exec_nop.c | 2 +- tests/i915/gem_exec_parallel.c | 4 +-- tests/i915/gem_exec_params.c | 2 +- tests/i915/gem_exec_reloc.c | 2 +- tests/i915/gem_exec_schedule.c | 2 +- tests/i915/gem_exec_store.c | 2 +- tests/i915/gem_exec_suspend.c | 2 +- tests/i915/gem_exec_whisper.c | 6 ++-- tests/i915/gem_exercise_blt.c | 2 +- tests/i915/gem_fd_exhaustion.c | 2 +- tests/i915/gem_fence_thrash.c | 2 +- tests/i915/gem_fenced_exec_thrash.c | 2 +- tests/i915/gem_flink_basic.c | 4 +-- tests/i915/gem_flink_race.c | 6 ++-- tests/i915/gem_gtt_cpu_tlb.c | 2 +- tests/i915/gem_gtt_hog.c | 2 +- tests/i915/gem_gtt_speed.c | 2 +- tests/i915/gem_huc_copy.c | 2 +- tests/i915/gem_lmem_evict.c | 4 +-- tests/i915/gem_lmem_swapping.c | 10 +++---- tests/i915/gem_madvise.c | 12 ++++---- tests/i915/gem_media_fill.c | 2 +- tests/i915/gem_mmap.c | 2 +- tests/i915/gem_mmap_gtt.c | 6 ++-- tests/i915/gem_mmap_offset.c | 8 +++--- tests/i915/gem_mmap_wc.c | 2 +- tests/i915/gem_partial_pwrite_pread.c | 2 +- tests/i915/gem_pipe_control_store_loop.c | 2 +- tests/i915/gem_ppgtt.c | 8 +++--- tests/i915/gem_pread.c | 2 +- tests/i915/gem_pread_after_blit.c | 2 +- tests/i915/gem_pwrite.c | 2 +- tests/i915/gem_pwrite_snooped.c | 2 +- tests/i915/gem_pxp.c | 2 +- tests/i915/gem_read_read_speed.c | 2 +- tests/i915/gem_readwrite.c | 2 +- tests/i915/gem_reg_read.c | 2 +- tests/i915/gem_render_copy.c | 2 +- tests/i915/gem_render_copy_redux.c | 2 +- tests/i915/gem_reset_stats.c | 32 ++++++++++----------- tests/i915/gem_ringfill.c | 2 +- tests/i915/gem_set_tiling_vs_blt.c | 2 +- tests/i915/gem_set_tiling_vs_gtt.c | 2 +- tests/i915/gem_set_tiling_vs_pwrite.c | 2 +- tests/i915/gem_shrink.c | 14 ++++----- tests/i915/gem_softpin.c | 4 +-- tests/i915/gem_spin_batch.c | 2 +- tests/i915/gem_streaming_writes.c | 2 +- tests/i915/gem_stress.c | 2 +- tests/i915/gem_sync.c | 2 +- tests/i915/gem_tiled_blits.c | 2 +- tests/i915/gem_tiled_fence_blits.c | 2 +- tests/i915/gem_tiled_partial_pwrite_pread.c | 2 +- tests/i915/gem_tiled_pread_basic.c | 2 +- tests/i915/gem_tiled_pread_pwrite.c | 2 +- tests/i915/gem_tiled_swapping.c | 2 +- tests/i915/gem_tiled_wb.c | 2 +- tests/i915/gem_tiled_wc.c | 2 +- tests/i915/gem_tiling_max_stride.c | 2 +- tests/i915/gem_unfence_active_buffers.c | 2 +- tests/i915/gem_unref_active_buffers.c | 2 +- tests/i915/gem_userptr_blits.c | 6 ++-- tests/i915/gem_vm_create.c | 4 +-- tests/i915/gem_wait.c | 2 +- tests/i915/gem_watchdog.c | 2 +- tests/i915/gem_workarounds.c | 2 +- tests/i915/gen7_exec_parse.c | 4 +-- tests/i915/gen9_exec_parse.c | 2 +- tests/i915/i915_fb_tiling.c | 2 +- tests/i915/i915_getparams_basic.c | 2 +- tests/i915/i915_hangman.c | 4 +-- tests/i915/i915_hwmon.c | 2 +- tests/i915/i915_module_load.c | 8 +++--- tests/i915/i915_pciid.c | 2 +- tests/i915/i915_pm_backlight.c | 2 +- tests/i915/i915_pm_dc.c | 2 +- tests/i915/i915_pm_freq_api.c | 2 +- tests/i915/i915_pm_freq_mult.c | 2 +- tests/i915/i915_pm_lpsp.c | 2 +- tests/i915/i915_pm_rc6_residency.c | 2 +- tests/i915/i915_pm_rps.c | 2 +- tests/i915/i915_pm_sseu.c | 2 +- tests/i915/i915_power.c | 2 +- tests/i915/i915_query.c | 2 +- tests/i915/i915_suspend.c | 6 ++-- tests/i915/perf.c | 6 ++-- tests/i915/perf_pmu.c | 6 ++-- tests/i915/sysfs_defaults.c | 2 +- tests/i915/sysfs_heartbeat_interval.c | 2 +- tests/i915/sysfs_preempt_timeout.c | 2 +- tests/i915/sysfs_timeslice_duration.c | 2 +- tests/prime_busy.c | 2 +- tests/prime_mmap.c | 2 +- tests/prime_mmap_coherency.c | 4 +-- tests/prime_mmap_kms.c | 2 +- tests/prime_self_import.c | 26 ++++++++--------- tests/prime_vgem.c | 4 +-- tests/syncobj_basic.c | 2 +- tests/syncobj_timeline.c | 2 +- tests/syncobj_wait.c | 2 +- tests/template.c | 2 +- tests/vgem_basic.c | 6 ++-- tests/vgem_slow.c | 2 +- 148 files changed, 252 insertions(+), 252 deletions(-)
tests/core_auth.c +5 -5
@@ -189,7 +189,7 @@ static void test_basic_auth(int master)igt_assert (drmGetMagic (slave, &magic) ==0 );igt_assert_eq (magic, old_magic); -close (slave); +drm_close_driver (slave); } igt_main
@@ -201,7 +201,7 @@ igt_mainigt_assert (check_auth (fd) == true); -close (fd); +drm_close_driver (fd); }igt_describe ("Use 2 clients, check second is authenticated even when first dropped." );
@@ -211,11 +211,11 @@ igt_mainigt_assert (check_auth (fd2) == true); -close (fd); +drm_close_driver (fd);igt_assert (check_auth (fd2) == true); -close (fd2); +drm_close_driver (fd2); }/* above tests require that no drm fd is open */
@@ -224,7 +224,7 @@ igt_mainigt_fixture master =drm_open_driver_master (DRIVER_ANY ); - +igt_describe ("Test magic numbers for master and slave." ); igt_subtest("basic-auth")test_basic_auth (master);
tests/core_getclient.c +1 -1
@@ -58,5 +58,5 @@ igt_simple_main ret =ioctl (fd,DRM_IOCTL_GET_CLIENT , &client);igt_assert (ret ==-1 && errno ==EINVAL ); -close (fd); +drm_close_driver (fd); }
tests/core_getstats.c +1 -1
@@ -52,5 +52,5 @@ igt_simple_main ret =ioctl (fd,DRM_IOCTL_GET_STATS , &stats);igt_assert (ret ==0 ); -close (fd); +drm_close_driver (fd); }
tests/core_getversion.c +1 -1
@@ -46,5 +46,5 @@ igt_simple_mainigt_assert_lte (1 , v->version_major);drmFree (v); -close (fd); +drm_close_driver (fd); }
tests/core_setmaster.c +3 -3
@@ -85,7 +85,7 @@ static void check_drop_set(void)igt_assert_eq (drmDropMaster (master),0 );igt_assert_eq (drmSetMaster (master),0 ); -close (master); +drm_close_driver (master); }static unsigned tweak_perm (uint8_t *saved_perm,unsigned max_perm,bool save)
@@ -206,10 +206,10 @@ igt_mainigt_assert_eq (drmSetMaster (master),-1 );igt_assert_eq (errno,EACCES ); -close (master); +drm_close_driver (master); }igt_waitchildren (); -close (master); +drm_close_driver (master); } }
tests/core_setmaster_vs_auth.c +3 -3
@@ -66,7 +66,7 @@ igt_simple_mainigt_assert_neq (drmAuthMagic (master2, magic),0 );igt_assert_eq (errno,EINVAL ); -close (client); -close (master2); -close (master1); +drm_close_driver (client); +drm_close_driver (master2); +drm_close_driver (master1); }
tests/debugfs_test.c +1 -1
@@ -213,6 +213,6 @@ igt_main igt_fixture {close (sysfs);close (debugfs); -close (fd); +drm_close_driver (fd); } }
tests/dumb_buffer.c +1 -1
@@ -394,6 +394,6 @@ igt_mainalways_clear (fd,30 ); igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/eviction_common.c +1 -1
@@ -300,7 +300,7 @@ static int forking_evictions(int fd, struct igt_eviction_test_ops *ops,/* drmfd closing will take care of additional bo refs */ if (flags &FORKING_EVICTIONS_DUP_DRMFD ) -close (realfd); +drm_close_driver (realfd); }igt_waitchildren ();
tests/fbdev.c +1 -1
@@ -443,6 +443,6 @@ igt_main } igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/i915/api_intel_allocator.c +3 -3
@@ -502,7 +502,7 @@ static void reopen(int fd)__reopen_allocs (fd, fd2, true); -close (fd2); +drm_close_driver (fd2); }#define REOPEN_TIMEOUT 3
@@ -528,7 +528,7 @@ static void reopen_fork(int fd)/* Check references at the end */ __reopen_allocs (fd, fd2, true); -close (fd2); +drm_close_driver (fd2);intel_allocator_multiprocess_stop (); }
@@ -847,5 +847,5 @@ igt_maingem_pool (fd);igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/api_intel_bb.c +1 -1
@@ -1701,6 +1701,6 @@ igt_main_args("dpibc:", NULL, help_str, opt_handler, NULL) igt_fixture {buf_ops_destroy (bops); -close (i915); +drm_close_driver (i915); } }
tests/i915/drm_fdinfo.c +1 -1
@@ -866,6 +866,6 @@ igt_main igt_fixture {intel_ctx_destroy (i915, ctx); -close (i915); +drm_close_driver (i915); } }
tests/i915/gem_bad_reloc.c +1 -1
@@ -212,5 +212,5 @@ igt_mainnegative_reloc_blt (fd);igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_barrier_race.c +1 -1
@@ -108,7 +108,7 @@ static void intel_context_first_pin_last_unpin_loop(int fd, uint64_t engine, int }while (!READ_ONCE (*done)); -close (fd); +drm_close_driver (fd); }static void test_remote_request (int fd,uint64_t engine,unsigned int timeout)
tests/i915/gem_basic.c +1 -1
@@ -108,7 +108,7 @@ igt_main gpu_fd =__drm_open_driver_another (child,DRIVER_INTEL );igt_assert_f (gpu_fd >0 ,"cannot open gpu-%d, errno=%d\n" , child, errno);test_create_close (gpu_fd); -close (gpu_fd); +drm_close_driver (gpu_fd); }igt_waitchildren ();
tests/i915/gem_blits.c +1 -1
@@ -893,6 +893,6 @@ igt_main igt_fixture {put_ahnd (device.ahnd); -close (device.fd); +drm_close_driver (device.fd); } }
tests/i915/gem_busy.c +1 -1
@@ -562,6 +562,6 @@ igt_main igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_caching.c +1 -1
@@ -340,6 +340,6 @@ igt_mainintel_buf_destroy (scratch_buf);intel_buf_destroy (staging_buf);buf_ops_destroy (data.bops); -close (data.fd); +drm_close_driver (data.fd); } }
tests/i915/gem_ccs.c +1 -1
@@ -731,6 +731,6 @@ igt_main_args("bf:pst:W:H:", NULL, help_str, opt_handler, NULL) igt_fixture {igt_disallow_hang (i915, hang); -close (i915); +drm_close_driver (i915); } }
tests/i915/gem_close_race.c +7 -7
@@ -248,7 +248,7 @@ static void thread(int fd, struct drm_gem_open name, n++; }while (1 ); -close (crashme.fd); +drm_close_driver (crashme.fd); }timer_delete (timer);
@@ -274,7 +274,7 @@ static void multigpu_threads(int timeout, unsigned int flags, int gpu_count)igt_waitchildren ();gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); }igt_waitchildren ();
@@ -293,7 +293,7 @@ static void threads(int timeout, unsigned int flags)igt_waitchildren ();gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); } igt_main
@@ -317,7 +317,7 @@ igt_main gpu_count =igt_device_filter_count ();igt_fork_hang_detector (fd); -close (fd); +drm_close_driver (fd); }igt_describe ("Basic workload submission." );
@@ -329,7 +329,7 @@ igt_mainigt_waitchildren ();gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); }igt_describe ("Basic workload submission on multi-GPU machine." );
@@ -342,7 +342,7 @@ igt_mainigt_assert (fd >0 );process (fd, child);gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); }igt_waitchildren ();
@@ -369,7 +369,7 @@ igt_mainigt_waitchildren ();gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); } igt_describe("Share buffer handle across different drm fd's and trying to race"
tests/i915/gem_cs_tlb.c +1 -1
@@ -162,5 +162,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_ctx_bad_destroy.c +1 -1
@@ -80,5 +80,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_ctx_create.c +2 -2
@@ -117,7 +117,7 @@ static void files(int core, const intel_ctx_cfg_t *cfg,gem_execbuf (fd, &execbuf);intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); count++;clock_gettime (CLOCK_MONOTONIC , &end);
@@ -667,6 +667,6 @@ igt_main igt_fixture {igt_stop_hang_detector (); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_ctx_exec.c +1 -1
@@ -344,7 +344,7 @@ static void nohangcheck_hostile(int i915)put_ahnd (ahnd);close (dir); -close (i915); +drm_close_driver (i915); }static void close_race (int i915)
tests/i915/gem_ctx_param.c +1 -1
@@ -472,5 +472,5 @@ igt_maintest_get_invalid_param (fd,I915_CONTEXT_PARAM_ENGINES );igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_ctx_persistence.c +3 -3
@@ -604,7 +604,7 @@ static void test_nonpersistent_file(int i915)gem_context_set_persistence (i915,0 , false); spin = igt_spin_new(i915, .ahnd = ahnd, .flags = IGT_SPIN_FENCE_OUT); -close (i915); +drm_close_driver (i915);flush_delayed_fput (debugfs);igt_assert_eq (wait_for_status (spin->out_fence, reset_timeout_ms), -EIO );
@@ -1087,7 +1087,7 @@ static void __smoker(int i915, const intel_ctx_cfg_t *cfg,intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd);flush_delayed_fput (i915);igt_spin_end (spin);
@@ -1383,6 +1383,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }
tests/i915/gem_ctx_shared.c +1 -1
@@ -246,7 +246,7 @@ static void exhaust_shared_gtt(int i915, unsigned int flags)igt_info ("Created %lu shared contexts, before %d (%s)\n" , count, err,strerror (-err)); } -close (i915); +drm_close_driver (i915);igt_waitchildren (); }
tests/i915/gem_ctx_sseu.c +1 -1
@@ -545,6 +545,6 @@ igt_main } igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_ctx_switch.c +1 -1
@@ -440,6 +440,6 @@ igt_mainigt_stop_hang_detector ();gem_close (fd, heavy);gem_close (fd, light); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_eio.c +8 -8
@@ -461,7 +461,7 @@ static void test_banned(int fd) { fd =reopen_device (fd);__test_banned (fd); -close (fd); +drm_close_driver (fd); }#define TEST_WEDGE (1)
@@ -495,7 +495,7 @@ static void test_wait(int fd, unsigned int flags, unsigned int wait)igt_require (i915_reset_control (fd, true));trigger_reset (fd); -close (fd); +drm_close_driver (fd); }static void test_suspend (int fd,int state)
@@ -513,7 +513,7 @@ static void test_suspend(int fd, int state)igt_require (i915_reset_control (fd, true));trigger_reset (fd); -close (fd); +drm_close_driver (fd); }static void test_inflight (int fd,unsigned int wait)
@@ -577,7 +577,7 @@ static void test_inflight(int fd, unsigned int wait)trigger_reset (fd);gem_close (fd, obj[1 ].handle); -close (fd); +drm_close_driver (fd); } }
@@ -638,7 +638,7 @@ static void test_inflight_suspend(int fd)igt_assert (i915_reset_control (fd, true));trigger_reset (fd); -close (fd); +drm_close_driver (fd); }static const intel_ctx_t *context_create_safe (int i915)
@@ -728,7 +728,7 @@ static void test_inflight_contexts(int fd, unsigned int wait)for (unsigned int n =0 ; n <ARRAY_SIZE (ctx); n++)intel_ctx_destroy (fd, ctx[n]); -close (fd); +drm_close_driver (fd); } }
@@ -784,7 +784,7 @@ static void test_inflight_external(int fd)put_ahnd (ahnd);igt_assert (i915_reset_control (fd, true));trigger_reset (fd); -close (fd); +drm_close_driver (fd); }static void test_inflight_internal (int fd,unsigned int wait)
@@ -834,7 +834,7 @@ static void test_inflight_internal(int fd, unsigned int wait)igt_assert (i915_reset_control (fd, true));trigger_reset (fd); -close (fd); +drm_close_driver (fd); } static void reset_stress(int fd, uint64_t ahnd, const intel_ctx_t *ctx0,
tests/i915/gem_evict_alignment.c +1 -1
@@ -265,6 +265,6 @@ igt_main igt_fixture {igt_stop_hang_helper (); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_evict_everything.c +1 -1
@@ -290,6 +290,6 @@ igt_main igt_fixture {igt_stop_hang_helper (); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_exec_alignment.c +1 -1
@@ -465,7 +465,7 @@ static void forked(int i915, int timeout)igt_waitchildren_timeout (3 * timeout,NULL );free (obj); -close (i915); +drm_close_driver (i915); }static void single (int fd)
tests/i915/gem_exec_async.c +1 -1
@@ -213,6 +213,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_exec_await.c +1 -1
@@ -287,6 +287,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (device, ctx); -close (device); +drm_close_driver (device); } }
tests/i915/gem_exec_basic.c +1 -1
@@ -98,6 +98,6 @@ igt_mainigt_collection_destroy (set);igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_exec_big.c +1 -1
@@ -326,5 +326,5 @@ igt_mainexhaustive (i915);igt_fixture -close (i915 ); +drm_close_driver (i915 ); }
tests/i915/gem_exec_capture.c +1 -1
@@ -1013,6 +1013,6 @@ igt_mainclose (dir);igt_disallow_hang (fd, hang);intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_exec_create.c +1 -1
@@ -225,6 +225,6 @@ igt_main igt_fixture {igt_stop_hang_detector (); -close (device); +drm_close_driver (device); } }
tests/i915/gem_exec_fair.c +1 -1
@@ -1348,6 +1348,6 @@ igt_main igt_fixture {igt_stop_hang_detector (); -close (i915); +drm_close_driver (i915); } }
tests/i915/gem_exec_fence.c +2 -2
@@ -1768,7 +1768,7 @@ static void test_invalid_timeline_fence_array(int fd)igt_assert_eq (__gem_execbuf (fd, &execbuf), -EFAULT );munmap (ptr,4096 ); -close (fd); +drm_close_driver (fd); } static const char *test_syncobj_timeline_unused_fence_desc =
@@ -3351,6 +3351,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }
tests/i915/gem_exec_flush.c +1 -1
@@ -711,6 +711,6 @@ igt_main igt_fixture {igt_stop_hang_detector (); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_exec_gttfill.c +2 -2
@@ -279,7 +279,7 @@ igt_main// release resources igt_stop_hang_detector ();intel_ctx_destroy (g_fd, ctx); -close (g_fd); +drm_close_driver (g_fd); }igt_waitchildren ();
@@ -287,6 +287,6 @@ igt_main igt_fixture {intel_allocator_multiprocess_stop (); -close (i915); +drm_close_driver (i915); } }
tests/i915/gem_exec_latency.c +1 -1
@@ -971,6 +971,6 @@ igt_main igt_fixture {intel_register_access_fini (&mmio_data);intel_ctx_destroy (device, ctx); -close (device); +drm_close_driver (device); } }
tests/i915/gem_exec_nop.c +1 -1
@@ -1083,6 +1083,6 @@ igt_mainigt_stop_hang_detector ();gem_close (device, handle);intel_ctx_destroy (device, ctx); -close (device); +drm_close_driver (device); } }
tests/i915/gem_exec_parallel.c +2 -2
@@ -181,7 +181,7 @@ static void *thread(void *data)intel_ctx_destroy (fd, tmp_ctx);gem_close (fd, obj[1 ].handle);if (t->flags &FDS ) -close (fd); +drm_close_driver (fd); t->used = used;return NULL ;
@@ -364,6 +364,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_exec_params.c +1 -1
@@ -646,6 +646,6 @@ igt_main igt_fixture {gem_close (fd, handle); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_exec_reloc.c +1 -1
@@ -1178,5 +1178,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_exec_schedule.c +1 -1
@@ -3369,6 +3369,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_exec_store.c +1 -1
@@ -455,6 +455,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_exec_suspend.c +1 -1
@@ -411,6 +411,6 @@ igt_mainigt_collection_destroy (set);igt_disallow_hang (fd, hang);intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_exec_whisper.c +3 -3
@@ -178,7 +178,7 @@ static void fini_hang(struct hang *h)put_offset (h->ahnd, h->obj.handle);put_ahnd (h->ahnd);intel_ctx_destroy (h->fd, h->ctx); -close (h->fd); +drm_close_driver (h->fd); }static void ctx_set_random_priority (int fd,uint32_t ctx)
@@ -550,7 +550,7 @@ static void whisper(int fd, const intel_ctx_t *ctx,gem_close (fd, batches[n].handle);if (flags &FDS ) {for (n =0 ; n <64 ; n++) -close (fds[n]); +drm_close_driver (fds[n]); } }
@@ -660,6 +660,6 @@ igt_main igt_fixture {intel_allocator_multiprocess_stop ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_exercise_blt.c +1 -1
@@ -381,6 +381,6 @@ igt_main_args("b:pst:W:H:", NULL, help_str, opt_handler, NULL) } igt_fixture { -close (i915); +drm_close_driver (i915); } }
tests/i915/gem_fd_exhaustion.c +1 -1
@@ -69,5 +69,5 @@ igt_simple_mainigt_waitchildren (); -close (fd); +drm_close_driver (fd); }
tests/i915/gem_fence_thrash.c +1 -1
@@ -225,7 +225,7 @@ static int run_test(int threads_per_fence, void *f, int tiling,igt_assert (func (&t) == (void *)0 ); } -close (t.fd); +drm_close_driver (t.fd);return 0 ; }
tests/i915/gem_fenced_exec_thrash.c +1 -1
@@ -199,5 +199,5 @@ igt_mainrun_test (fd, num_fences +1 ,intel_gen (devid) >=4 ?0 :ENOBUFS ,0 );igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_flink_basic.c +2 -2
@@ -147,7 +147,7 @@ test_flink_lifetime(int fd)igt_assert_eq (ret,0 );igt_assert (open_struct.handle !=0 ); -close (fd2); +drm_close_driver (fd2); fd2 =drm_open_driver (DRIVER_INTEL );/* Flink name remains valid due to the second reference */
@@ -156,7 +156,7 @@ test_flink_lifetime(int fd)igt_assert_eq (ret,0 );igt_assert (open_struct.handle !=0 ); -close (fd2); +drm_close_driver (fd2); } igt_main
tests/i915/gem_flink_race.c +3 -3
@@ -127,7 +127,7 @@ static void test_flink_name(int timeout) igt_stats_get_max(&stats));igt_stats_fini (&stats); -close (fd); +drm_close_driver (fd); }static void *thread_fn_flink_close (void *p)
@@ -188,13 +188,13 @@ static void test_flink_close(void)igt_assert (status ==0 ); } -close (fd); +drm_close_driver (fd); obj_count =igt_get_stable_obj_count (fake) - obj_count;igt_info ("leaked %i objects\n" , obj_count); -close (fake); +drm_close_driver (fake);igt_assert_eq (obj_count,0 ); }
tests/i915/gem_gtt_cpu_tlb.c +1 -1
@@ -105,5 +105,5 @@ igt_simple_mainfor (i =0 ; i <OBJ_SIZE /4 ; i++)igt_assert (ptr[i] == i); -close (fd); +drm_close_driver (fd); }
tests/i915/gem_gtt_hog.c +1 -1
@@ -164,7 +164,7 @@ igt_simple_mainint fd =drm_open_driver (DRIVER_INTEL );igt_require_gem (fd);gem_require_mappable_ggtt (fd); -close (fd); +drm_close_driver (fd); data.fd =drm_open_driver (DRIVER_INTEL ); data.devid =intel_get_drm_devid (data.fd);
tests/i915/gem_gtt_speed.c +1 -1
@@ -515,5 +515,5 @@ igt_simple_main_args("s:", NULL, help_str, opt_handler, NULL) }gem_close (fd, handle); -close (fd); +drm_close_driver (fd); }
tests/i915/gem_huc_copy.c +1 -1
@@ -139,6 +139,6 @@ igt_main igt_fixture {put_ahnd (ahnd); -close (drm_fd); +drm_close_driver (drm_fd); } }
tests/i915/gem_lmem_evict.c +2 -2
@@ -93,7 +93,7 @@ igt_mainigt_require_fd (i915);igt_require_gem (i915);igt_require (gem_has_lmem (i915)); -close (i915); +drm_close_driver (i915); }igt_i915_driver_unload ();
@@ -132,7 +132,7 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915);igt_i915_driver_unload (); } }
tests/i915/gem_lmem_swapping.c +5 -5
@@ -551,7 +551,7 @@ static void test_evict(int i915,igt_waitchildren ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd);intel_allocator_multiprocess_stop (); }else {__do_evict (i915, ctx, ®ion->region, ¶ms, params.seed);
@@ -623,7 +623,7 @@ static void test_smem_oom(int i915, params.seed + child + 1);intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); }/* smem memory hog process, respawn till the lmem process completes */
@@ -644,7 +644,7 @@ static void test_smem_oom(int i915,break ;gem_leak (fd, alloc); } -close (fd); +drm_close_driver (fd); }/* * Wait for grand-child processes to finish or be
@@ -736,7 +736,7 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)igt_require_fd (i915);igt_require_gem (i915);igt_require (gem_has_lmem (i915)); -close (i915); +drm_close_driver (i915); }igt_i915_driver_unload ();
@@ -781,7 +781,7 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) igt_fixture {intel_ctx_destroy (i915, ctx);free (regions); -close (i915); +drm_close_driver (i915);igt_i915_driver_unload (); }
tests/i915/gem_madvise.c +6 -6
@@ -77,7 +77,7 @@ dontneed_before_mmap(void)PROT_READ |PROT_WRITE , t->type); -close (fd); +drm_close_driver (fd);if (!ptr)continue ;
@@ -99,7 +99,7 @@ dontneed_before_mmap(void) fd =drm_open_driver (DRIVER_INTEL ); } -close (fd); +drm_close_driver (fd); } static void
@@ -123,7 +123,7 @@ dontneed_after_mmap(void) t->type);gem_madvise (fd, handle,I915_MADV_DONTNEED ); -close (fd); +drm_close_driver (fd);if (!ptr)continue ;
@@ -145,7 +145,7 @@ dontneed_after_mmap(void) fd =drm_open_driver (DRIVER_INTEL ); } -close (fd); +drm_close_driver (fd); } static void
@@ -161,7 +161,7 @@ dontneed_before_pwrite(void)igt_assert_eq (__gem_write (fd, handle,0 , &bbe,sizeof (bbe)), -EFAULT ); -close (fd); +drm_close_driver (fd); } static void
@@ -185,7 +185,7 @@ dontneed_before_exec(void) execbuf.batch_len =sizeof (buf);igt_assert_eq (__gem_execbuf (fd, &execbuf), -EFAULT ); -close (fd); +drm_close_driver (fd); } igt_main
tests/i915/gem_media_fill.c +1 -1
@@ -173,6 +173,6 @@ igt_main igt_fixture {igt_collection_destroy (set);igt_stop_hang_detector (); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/gem_mmap.c +1 -1
@@ -315,5 +315,5 @@ igt_maintest_huge_bo (2 );igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_mmap_gtt.c +3 -3
@@ -381,13 +381,13 @@ test_isolation(int i915)igt_info ("B: {fd:%d, handle:%d, offset:%" PRIx64"}\n" ,B , b, offset_b); -close (B ); +drm_close_driver (B ); ptr =mmap (0 ,4096 ,PROT_READ ,MAP_SHARED ,A , offset_a);igt_assert (ptr !=MAP_FAILED );munmap (ptr,4096 ); -close (A ); +drm_close_driver (A ); ptr =mmap (0 ,4096 ,PROT_READ ,MAP_SHARED ,A , offset_a);igt_assert (ptr ==MAP_FAILED );
@@ -1491,5 +1491,5 @@ igt_mainigt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_mmap_offset.c +4 -4
@@ -346,13 +346,13 @@ static void isolation(int i915)igt_assert_eq (errno,EACCES ); } -close (B ); +drm_close_driver (B ); ptr =mmap (0 ,4096 ,PROT_READ ,MAP_SHARED ,A , offset_a);igt_assert (ptr !=MAP_FAILED );munmap (ptr,4096 ); -close (A ); +drm_close_driver (A ); ptr =mmap (0 ,4096 ,PROT_READ ,MAP_SHARED ,A , offset_a);igt_assert (ptr ==MAP_FAILED );
@@ -647,7 +647,7 @@ static void open_flood(int i915, int timeout)mmap_offset_ioctl (i915, &arg); } -close (tmp); +drm_close_driver (tmp); count++; }
@@ -925,6 +925,6 @@ igt_mainblt_coherency (i915); igt_fixture { -close (i915); +drm_close_driver (i915); } }
tests/i915/gem_mmap_wc.c +1 -1
@@ -620,5 +620,5 @@ igt_maintest_set_cache_level (fd);igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_partial_pwrite_pread.c +1 -1
@@ -326,6 +326,6 @@ igt_mainintel_buf_destroy (scratch_buf);intel_buf_destroy (staging_buf);buf_ops_destroy (data.bops); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/gem_pipe_control_store_loop.c +1 -1
@@ -183,6 +183,6 @@ igt_main igt_fixture {buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_ppgtt.c +4 -4
@@ -251,8 +251,8 @@ static void flink_and_close(void)igt_assert_eq (offset, offset_new);gem_close (fd, bo); -close (fd); -close (fd2); +drm_close_driver (fd); +drm_close_driver (fd2); }#define PAGE_SIZE 4096
@@ -385,7 +385,7 @@ static bool has_contexts(void) fd =drm_open_driver (DRIVER_INTEL ); result =gem_has_contexts (fd); -close (fd); +drm_close_driver (fd);return result; }
@@ -398,7 +398,7 @@ igt_mainint fd =drm_open_driver (DRIVER_INTEL );igt_require_gem (fd);gem_require_blitter (fd); -close (fd); +drm_close_driver (fd); } igt_subtest("blt-vs-render-ctx0") {
tests/i915/gem_pread.c +1 -1
@@ -350,6 +350,6 @@ igt_main_args("s:", NULL, help_str, opt_handler, NULL)free (src);gem_close (fd, dst); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_pread_after_blit.c +1 -1
@@ -252,5 +252,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_pwrite.c +1 -1
@@ -572,5 +572,5 @@ igt_main_args("s:", NULL, help_str, opt_handler, NULL) }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_pwrite_snooped.c +1 -1
@@ -140,5 +140,5 @@ igt_simple_maintest (256 ,256 );buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); }
tests/i915/gem_pxp.c +1 -1
@@ -1293,6 +1293,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }
tests/i915/gem_read_read_speed.c +1 -1
@@ -214,6 +214,6 @@ igt_main igt_fixture {buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_readwrite.c +1 -1
@@ -143,5 +143,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_reg_read.c +1 -1
@@ -170,6 +170,6 @@ igt_main } igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_render_copy.c +1 -1
@@ -879,6 +879,6 @@ igt_main_args("dac", NULL, help_str, opt_handler, NULL)igt_stop_hang_detector ();buf_ops_destroy (data.bops);igt_collection_destroy (set); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/gem_render_copy_redux.c +1 -1
@@ -81,7 +81,7 @@ static void data_init(data_t *data)static void data_fini (data_t *data) {buf_ops_destroy (data->bops); -close (data->fd); +drm_close_driver (data->fd); } static void scratch_buf_init(data_t *data, struct intel_buf *buf,
tests/i915/gem_reset_stats.c +16 -16
@@ -297,7 +297,7 @@ static void test_rs(const struct intel_execution_ring *e,igt_assert (igt_seconds_elapsed (&ts_injected) <=30 );for (i =0 ; i < num_fds; i++) -close (fd[i]); +drm_close_driver (fd[i]); }#define MAX_CTX 100
@@ -373,7 +373,7 @@ static void test_rs_ctx(const struct intel_execution_ring *e,for (i =0 ; i < num_fds; i++) {assert_reset_status (i, fd[i],0 ,RS_NO_ERROR ); -close (fd[i]); +drm_close_driver (fd[i]); } }
@@ -427,8 +427,8 @@ static void test_ban(const struct intel_execution_ring *e)igt_assert_eq (gem_reset_stats (fd_good,0 , &rs_good),0 );igt_assert_eq (rs_good.batch_active,0 ); -close (fd_bad); -close (fd_good); +drm_close_driver (fd_bad); +drm_close_driver (fd_good); }static void test_ban_ctx (const struct intel_execution_ring *e)
@@ -486,7 +486,7 @@ static void test_ban_ctx(const struct intel_execution_ring *e)igt_assert_eq (gem_reset_stats (fd, ctx_good, &rs_good),0 );igt_assert_eq (rs_good.batch_active,0 ); -close (fd); +drm_close_driver (fd); }static void test_unrelated_ctx (const struct intel_execution_ring *e)
@@ -512,8 +512,8 @@ static void test_unrelated_ctx(const struct intel_execution_ring *e)assert_reset_status (0 , fd1, ctx_guilty,RS_BATCH_ACTIVE );assert_reset_status (1 , fd2, ctx_unrelated,RS_NO_ERROR ); -close (fd1); -close (fd2); +drm_close_driver (fd1); +drm_close_driver (fd2); }static int get_reset_count (int fd,int ctx)
@@ -539,7 +539,7 @@ static void test_close_pending_ctx(const struct intel_execution_ring *e)gem_context_destroy (fd, ctx);igt_assert_eq (__gem_context_destroy (fd, ctx), -ENOENT ); -close (fd); +drm_close_driver (fd); }static void test_close_pending (const struct intel_execution_ring *e)
@@ -549,7 +549,7 @@ static void test_close_pending(const struct intel_execution_ring *e)assert_reset_status (fd, fd,0 ,RS_NO_ERROR );inject_hang (fd,0 , e,0 ); -close (fd); +drm_close_driver (fd); }static void noop_on_each_ring (int fd,const bool reverse)
@@ -611,7 +611,7 @@ static void test_close_pending_fork(const struct intel_execution_ring *e,* when gpu is reset and ring lists are cleared. */ noop_on_each_ring (fd2, reverse); -close (fd2); +drm_close_driver (fd2);pause ();exit (0 ); }else {
@@ -624,7 +624,7 @@ static void test_close_pending_fork(const struct intel_execution_ring *e, }igt_post_hang_ring (fd, hang); -close (fd); +drm_close_driver (fd); } static void test_reset_count(const struct intel_execution_ring *e,
@@ -664,7 +664,7 @@ static void test_reset_count(const struct intel_execution_ring *e,if (create_ctx)gem_context_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); }static int _test_params (int fd,int ctx,uint32_t flags,uint32_t pad)
@@ -735,7 +735,7 @@ static void test_params_ctx(void) fd =drm_reopen_driver (device);_test_param (fd,gem_context_create (fd)); -close (fd); +drm_close_driver (fd); }static void test_params (void )
@@ -744,7 +744,7 @@ static void test_params(void) fd =drm_reopen_driver (device);_test_param (fd,0 ); -close (fd); +drm_close_driver (fd); } static const struct intel_execution_ring *
@@ -790,7 +790,7 @@ static void defer_hangcheck(const struct intel_execution_ring *engine)igt_assert_lt (count_start, count_end); -close (fd); +drm_close_driver (fd); }static bool gem_has_reset_stats (int fd)
@@ -999,6 +999,6 @@ igt_main } igt_fixture {igt_assert (igt_params_set (device,"reset" ,"%d" ,INT_MAX /* any reset method */ )); -close (device); +drm_close_driver (device); } }
tests/i915/gem_ringfill.c +1 -1
@@ -401,6 +401,6 @@ igt_main igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_set_tiling_vs_blt.c +1 -1
@@ -261,6 +261,6 @@ igt_main igt_fixture{buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_set_tiling_vs_gtt.c +1 -1
@@ -130,5 +130,5 @@ igt_simple_mainmunmap (ptr,OBJECT_SIZE ); -close (fd); +drm_close_driver (fd); }
tests/i915/gem_set_tiling_vs_pwrite.c +1 -1
@@ -99,5 +99,5 @@ igt_simple_mainmunmap (ptr,OBJECT_SIZE ); -close (fd); +drm_close_driver (fd); }
tests/i915/gem_shrink.c +7 -7
@@ -270,7 +270,7 @@ static bool has_userptr(void)if (drmIoctl (fd,DRM_IOCTL_I915_GEM_USERPTR , &userptr)) err = errno; -close (fd); +drm_close_driver (fd);return err ==EFAULT ; }
@@ -319,7 +319,7 @@ static void run_test(int nchildren, uint64_t alloc,int fd =drm_open_driver (DRIVER_INTEL );for (int pass =0 ; pass < nchildren; pass++)leak (fd, alloc); -close (fd); +drm_close_driver (fd); } } }
@@ -331,7 +331,7 @@ static void run_test(int nchildren, uint64_t alloc,int fd =drm_open_driver (DRIVER_INTEL );for (int pass =0 ; pass < nchildren; pass++)userptr (fd, alloc,0 ); -close (fd); +drm_close_driver (fd); } } nchildren = (nchildren +1 )/2 ;
@@ -344,7 +344,7 @@ static void run_test(int nchildren, uint64_t alloc,int fd =drm_open_driver (DRIVER_INTEL );for (int pass =0 ; pass < nchildren; pass++)userptr (fd, alloc,UDIRTY ); -close (fd); +drm_close_driver (fd); } } nchildren = (nchildren +1 )/2 ;
@@ -356,7 +356,7 @@ static void run_test(int nchildren, uint64_t alloc,int fd =drm_open_driver (DRIVER_INTEL );for (int pass =0 ; pass < nchildren; pass++)func (fd, alloc); -close (fd); +drm_close_driver (fd); } }igt_waitchildren ();
@@ -399,7 +399,7 @@ static void reclaim(unsigned engine, int timeout)munmap ((void *)shared,4096 );close (debugfs); -close (fd); +drm_close_driver (fd); } igt_main
@@ -456,7 +456,7 @@ igt_main num_processes, alloc_size); alloc_size <<=20 ; -close (fd); +drm_close_driver (fd); }igt_subtest ("reclaim" )
tests/i915/gem_softpin.c +2 -2
@@ -1217,7 +1217,7 @@ static void *thread(void *data) fd, ctx->id, t->engine, succeeded);intel_ctx_destroy (fd, ctx);gem_close (fd, obj[1 ].handle); -close (fd); +drm_close_driver (fd);return (void *)from_user_pointer (ret); }
@@ -1531,6 +1531,6 @@ igt_main igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_spin_batch.c +1 -1
@@ -277,6 +277,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_streaming_writes.c +1 -1
@@ -419,5 +419,5 @@ igt_maintest_batch (fd,2 ,1 );igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_stress.c +1 -1
@@ -926,7 +926,7 @@ igt_simple_main_args("ds:g:c:t:rbuxmo:fp:",intel_bb_destroy (ibb);buf_ops_destroy (bops); -close (drm_fd); +drm_close_driver (drm_fd);igt_stop_signal_helper (); }
tests/i915/gem_sync.c +1 -1
@@ -1363,6 +1363,6 @@ igt_mainintel_allocator_multiprocess_stop ();igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_tiled_blits.c +1 -1
@@ -215,6 +215,6 @@ igt_main } igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_tiled_fence_blits.c +1 -1
@@ -320,5 +320,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_tiled_partial_pwrite_pread.c +1 -1
@@ -318,6 +318,6 @@ igt_mainintel_buf_destroy (tiled_staging_buf);buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_tiled_pread_basic.c +1 -1
@@ -222,5 +222,5 @@ igt_simple_main } } -close (fd); +drm_close_driver (fd); }
tests/i915/gem_tiled_pread_pwrite.c +1 -1
@@ -154,5 +154,5 @@ igt_simple_maingem_madvise (fd, handle,I915_MADV_DONTNEED ); } -close (fd); +drm_close_driver (fd); }
tests/i915/gem_tiled_swapping.c +1 -1
@@ -246,5 +246,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/gem_tiled_wb.c +1 -1
@@ -239,5 +239,5 @@ igt_simple_mainmunmap (linear, last_page - first_page); } -close (fd); +drm_close_driver (fd); }
tests/i915/gem_tiled_wc.c +1 -1
@@ -243,5 +243,5 @@ igt_simple_mainmunmap (linear, last_page - first_page); } -close (fd); +drm_close_driver (fd); }
tests/i915/gem_tiling_max_stride.c +1 -1
@@ -138,5 +138,5 @@ igt_simple_mainmunmap (ptr, size); -close (fd); +drm_close_driver (fd); }
tests/i915/gem_unfence_active_buffers.c +1 -1
@@ -99,5 +99,5 @@ igt_simple_mainigt_spin_free (i915, spin);put_ahnd (ahnd); -close (i915); +drm_close_driver (i915); }
tests/i915/gem_unref_active_buffers.c +1 -1
@@ -121,5 +121,5 @@ igt_simple_mainigt_spin_free (i915, spin);put_ahnd (ahnd); -close (i915); +drm_close_driver (i915); }
tests/i915/gem_userptr_blits.c +3 -3
@@ -730,7 +730,7 @@ static void test_nohangcheck_hostile(int i915)close (fence);close (dir); -close (i915); +drm_close_driver (i915); }static size_t hugepagesize (void )
@@ -1288,9 +1288,9 @@ static int test_dmabuf(void)/* destroy userptr object and expect SIGBUS */ free_userptr_bo (fd1, handle); -close (fd1); +drm_close_driver (fd1); -close (fd2); +drm_close_driver (fd2);reset_handle_ptr ();return 0 ;
tests/i915/gem_vm_create.c +2 -2
@@ -347,7 +347,7 @@ static void isolation(int i915)gem_read (i915, obj[0 ].handle,0 , &result,sizeof (result));igt_assert_eq (result,1 ); -close (other); +drm_close_driver (other);gem_close (i915, obj[1 ].handle);gem_close (i915, obj[0 ].handle);
@@ -388,6 +388,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }
tests/i915/gem_wait.c +1 -1
@@ -257,6 +257,6 @@ igt_main igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/i915/gem_watchdog.c +1 -1
@@ -586,6 +586,6 @@ igt_main igt_fixture {intel_ctx_destroy (i915, ctx); -close (i915); +drm_close_driver (i915); } }
tests/i915/gem_workarounds.c +1 -1
@@ -235,7 +235,7 @@ static void check_workarounds(int fd, enum operation op, unsigned int flags)if (flags &CONTEXT )intel_ctx_destroy (fd, ctx);if (flags &FD ) -close (fd); +drm_close_driver (fd); } igt_main
tests/i915/gen7_exec_parse.c +2 -2
@@ -445,7 +445,7 @@ static void hsw_load_register_reg(void) 0xabcdabc0); } -close (fd); +drm_close_driver (fd); } igt_main
@@ -717,6 +717,6 @@ igt_mainigt_stop_hang_detector ();gem_close (fd, handle); -close (fd); +drm_close_driver (fd); } }
tests/i915/gen9_exec_parse.c +1 -1
@@ -1252,6 +1252,6 @@ igt_mainigt_stop_hang_detector ();gem_close (i915, handle); -close (i915); +drm_close_driver (i915); } }
tests/i915/i915_fb_tiling.c +1 -1
@@ -44,5 +44,5 @@ igt_simple_mainigt_assert_eq (ret, -EBUSY );igt_remove_fb (drm_fd, &fb); -close (drm_fd); +drm_close_driver (drm_fd); }
tests/i915/i915_getparams_basic.c +1 -1
@@ -46,7 +46,7 @@ init(void)static void deinit (void ) { -close (drm_fd); +drm_close_driver (drm_fd); }
tests/i915/i915_hangman.c +2 -2
@@ -97,7 +97,7 @@ static void check_alive(void)put_ahnd (ahnd);intel_ctx_destroy (fd, ctx);gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); }static bool has_error_state (int dir)
@@ -580,6 +580,6 @@ igt_mainigt_disallow_hang (device, hang);intel_ctx_destroy (device, ctx); -close (device); +drm_close_driver (device); } }
tests/i915/i915_hwmon.c +1 -1
@@ -83,6 +83,6 @@ igt_main igt_fixture {close (hwm); -close (fd); +drm_close_driver (fd); } }
tests/i915/i915_module_load.c +4 -4
@@ -238,7 +238,7 @@ static void gem_sanitycheck(void)store_all (i915); errno =0 ; -close (i915); +drm_close_driver (i915);igt_assert_eq (err, expected); }
@@ -286,7 +286,7 @@ static void load_and_check_i915(void)/* make sure the GPU is idle */ gem_quiescent_gpu (drm_fd); -close (drm_fd); +drm_close_driver (drm_fd);/* make sure we can do basic memory ops */ gem_sanitycheck ();
@@ -327,7 +327,7 @@ static uint32_t driver_load_with_lmem_bar_size(uint32_t lmem_bar_size, bool che } } -close (i915); +drm_close_driver (i915);return lmem_bar_size; }
@@ -419,7 +419,7 @@ igt_mainigt_require_gem (i915);igt_require (gem_has_lmem (i915));igt_skip_on_f (igt_sysfs_get_num_gt (i915) >1 ,"Skips for more than one lmem instance.\n" ); -close (i915); +drm_close_driver (i915); }/* Test for lmem_bar_size modparam support */
tests/i915/i915_pciid.c +1 -1
@@ -65,5 +65,5 @@ igt_simple_mainigt_assert (has_known_intel_chipset (intel)); -close (intel); +drm_close_driver (intel); }
tests/i915/i915_pm_backlight.c +1 -1
@@ -332,6 +332,6 @@ igt_mainigt_display_fini (&display);igt_pm_restore_sata_link_power_management (); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }
tests/i915/i915_pm_dc.c +1 -1
@@ -689,7 +689,7 @@ igt_mainclose (data.debugfs_root_fd);close (data.msr_fd);display_fini (&data); -close (data.drm_fd); +drm_close_driver (data.drm_fd); }igt_exit ();
tests/i915/i915_pm_freq_api.c +1 -1
@@ -139,6 +139,6 @@ igt_mainigt_assert (set_freq (dirfd,RPS_MAX_FREQ_MHZ , stash_max[gt]) >0 );igt_assert (set_freq (dirfd,RPS_MIN_FREQ_MHZ , stash_min[gt]) >0 ); } -close (i915); +drm_close_driver (i915); } }
tests/i915/i915_pm_freq_mult.c +1 -1
@@ -167,6 +167,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }
tests/i915/i915_pm_lpsp.c +1 -1
@@ -211,6 +211,6 @@ igt_main igt_fixture {free (data.pwr_dmn_info);igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }
tests/i915/i915_pm_rc6_residency.c +1 -1
@@ -611,6 +611,6 @@ igt_main igt_fixture {intel_ctx_destroy (i915, ctx); -close (i915); +drm_close_driver (i915); } }
tests/i915/i915_pm_rps.c +1 -1
@@ -877,7 +877,7 @@ static void pm_rps_exit_handler(int sig)if (lh.igt_proc.running)load_helper_stop (); -close (drm_fd); +drm_close_driver (drm_fd); } igt_main
tests/i915/i915_pm_sseu.c +1 -1
@@ -315,7 +315,7 @@ gem_deinit(void)case 2 :buf_ops_destroy (gem.bops);case 1 : -close (gem.drm_fd); +drm_close_driver (gem.drm_fd); } }
tests/i915/i915_power.c +1 -1
@@ -76,6 +76,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }
tests/i915/i915_query.c +1 -1
@@ -1465,6 +1465,6 @@ igt_mainquery_parse_and_validate_hwconfig_table (fd); igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/i915/i915_suspend.c +3 -3
@@ -188,7 +188,7 @@ test_shrink(int fd, unsigned int mode)igt_system_suspend_autoresume (mode,SUSPEND_TEST_NONE );munmap (mem, size); -close (fd); +drm_close_driver (fd); }igt_waitchildren ();
@@ -232,7 +232,7 @@ test_suspend_without_i915(int state)igt_pm_get_d3cold_allowed (&card, d3cold_allowed);igt_pm_set_d3cold_allowed (&card,"0\n" ); } -close (fd); +drm_close_driver (fd);igt_kmsg (KMSG_INFO "Unloading i915\n" );igt_assert_eq (igt_i915_driver_unload (),0 );
@@ -315,5 +315,5 @@ igt_maintest_forcewake (fd, true);igt_fixture -close (fd ); +drm_close_driver (fd ); }
tests/i915/perf.c +3 -3
@@ -4518,7 +4518,7 @@ gen12_test_single_ctx_render_target_writes_a_counter(const struct intel_executioigt_drop_root ();gen12_single_ctx_helper (e); -close (drm_fd); +drm_close_driver (drm_fd); } child_ret =igt_wait_helper (&child); igt_assert(WEXITSTATUS(child_ret) == EAGAIN ||
@@ -5299,7 +5299,7 @@ test_i915_ref_count(void)igt_debug ("ref count after opening i915 perf stream = %u\n" , ref_count1);igt_assert (ref_count1 > ref_count0); -close (drm_fd); +drm_close_driver (drm_fd);close (sysfs); drm_fd =-1 ; sysfs =-1 ;
@@ -6008,6 +6008,6 @@ igt_mainput_engine_groups (perf_oa_groups, num_perf_oa_groups);intel_ctx_destroy (drm_fd, ctx); -close (drm_fd); +drm_close_driver (drm_fd); } }
tests/i915/perf_pmu.c +3 -3
@@ -2111,7 +2111,7 @@ static void test_unload(unsigned int num_engines)if (fd[count] !=-1 ) count++; -close (i915); +drm_close_driver (i915); buf =calloc (count,sizeof (uint64_t ));igt_assert (buf);
@@ -2436,13 +2436,13 @@ igt_main igt_fixture {intel_ctx_destroy (render_fd ,render_ctx ); -close (render_fd); +drm_close_driver (render_fd); } } igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } igt_subtest("module-unload") {
tests/i915/sysfs_defaults.c +1 -1
@@ -105,6 +105,6 @@ igt_main igt_fixture {close (engines); -close (i915); +drm_close_driver (i915); } }
tests/i915/sysfs_heartbeat_interval.c +1 -1
@@ -514,6 +514,6 @@ igt_main igt_fixture {close (engines); -close (i915); +drm_close_driver (i915); } }
tests/i915/sysfs_preempt_timeout.c +1 -1
@@ -343,6 +343,6 @@ igt_main igt_fixture {close (engines); -close (i915); +drm_close_driver (i915); } }
tests/i915/sysfs_timeslice_duration.c +1 -1
@@ -564,6 +564,6 @@ igt_main igt_fixture {close (engines); -close (i915); +drm_close_driver (i915); } }
tests/prime_busy.c +1 -1
@@ -162,6 +162,6 @@ igt_main igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }
tests/prime_mmap.c +1 -1
@@ -557,6 +557,6 @@ igt_mainfree (query_info);igt_collection_destroy (set);igt_collection_destroy (dma_buf_set); -close (fd); +drm_close_driver (fd); } }
tests/prime_mmap_coherency.c +2 -2
@@ -249,7 +249,7 @@ static void blit_and_cmp(void)intel_bb_destroy (local_batch);buf_ops_destroy (local_bops); -close (local_fd); +drm_close_driver (local_fd); }/*
@@ -346,6 +346,6 @@ igt_main igt_fixture {buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); } }
tests/prime_mmap_kms.c +1 -1
@@ -263,6 +263,6 @@ igt_main igt_fixture {igt_display_fini (&gpu.display); -close (gpu.drm_fd); +drm_close_driver (gpu.drm_fd); } }
tests/prime_self_import.c +13 -13
@@ -106,8 +106,8 @@ static void test_with_fd_dup(void)close (dma_buf_fd2);check_bo (fd2, handle_import, fd2, handle_import); -close (fd1); -close (fd2); +drm_close_driver (fd1); +drm_close_driver (fd2); }static void test_with_two_bos (void )
@@ -139,8 +139,8 @@ static void test_with_two_bos(void)check_bo (fd2, handle_import, fd2, handle_import); -close (fd1); -close (fd2); +drm_close_driver (fd1); +drm_close_driver (fd2); }static void test_with_one_bo_two_files (void )
@@ -164,8 +164,8 @@ static void test_with_one_bo_two_files(void)/* dma-buf self importing an flink bo should give the same handle */ igt_assert_eq_u32 (handle_import, handle_open); -close (fd1); -close (fd2); +drm_close_driver (fd1); +drm_close_driver (fd2);close (dma_buf_fd1);close (dma_buf_fd2); }
@@ -211,7 +211,7 @@ static void test_with_one_bo(void)check_bo (fd1, handle, fd2, handle_import1);/* Completely rip out exporting fd. */ -close (fd1); +drm_close_driver (fd1);check_bo (fd2, handle_import1, fd2, handle_import1); }
@@ -275,14 +275,14 @@ static void test_reimport_close_race(void)igt_assert (status ==0 ); } -close (fds[0 ]); +drm_close_driver (fds[0 ]);close (fds[1 ]); obj_count =igt_get_stable_obj_count (fake) - obj_count;igt_info ("leaked %i objects\n" , obj_count); -close (fake); +drm_close_driver (fake);igt_assert_eq (obj_count,0 ); }
@@ -357,13 +357,13 @@ static void test_export_close_race(void)igt_assert (status ==0 ); } -close (fd); +drm_close_driver (fd); obj_count =igt_get_stable_obj_count (fake) - obj_count;igt_info ("leaked %i objects\n" , obj_count); -close (fake); +drm_close_driver (fake);igt_assert_eq (obj_count,0 ); }
@@ -392,7 +392,7 @@ static void test_llseek_size(void)close (dma_buf_fd); } -close (fd); +drm_close_driver (fd); }static void test_llseek_bad (void )
@@ -421,7 +421,7 @@ static void test_llseek_bad(void)close (dma_buf_fd); -close (fd); +drm_close_driver (fd); } igt_main
tests/prime_vgem.c +2 -2
@@ -1200,7 +1200,7 @@ igt_main igt_fixture { -close (i915); -close (vgem); +drm_close_driver (i915); +drm_close_driver (vgem); } }
tests/syncobj_basic.c +1 -1
@@ -232,7 +232,7 @@ igt_maintest_valid_cycle (fd); igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/syncobj_timeline.c +1 -1
@@ -1538,6 +1538,6 @@ igt_maintest_32bits_limit (fd); igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/syncobj_wait.c +1 -1
@@ -914,6 +914,6 @@ igt_maintest_wait_interrupted (fd,WAIT_ALL ); igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/template.c +1 -1
@@ -76,6 +76,6 @@ igt_main*/ igt_fixture { -close (drm_fd); +drm_close_driver (drm_fd); } }
tests/vgem_basic.c +3 -3
@@ -64,8 +64,8 @@ static void test_setversion(int fd)static void test_client (int fd) { -close (drm_open_driver (DRIVER_VGEM )); -close (drm_open_driver_render (DRIVER_VGEM )); +drm_close_driver (drm_open_driver (DRIVER_VGEM )); +drm_close_driver (drm_open_driver_render (DRIVER_VGEM )); }static void test_create (int fd)
@@ -537,6 +537,6 @@ igt_maintest_debugfs_read (fd); igt_fixture { -close (fd); +drm_close_driver (fd); } }
tests/vgem_slow.c +1 -1
@@ -85,6 +85,6 @@ igt_maintest_nohang (fd); igt_fixture { -close (fd); +drm_close_driver (fd); } }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 17/20] tests/i915: Use drm_close_driver() to close the drm fd
Hi Bhanuprakash,
few nits, see below.
Quoted 4 lines · Bhanuprakash Modem
To close the drm file descriptor, use igt helper
drm_close_driver()instead of usingclose().Signed-off-by Bhanuprakash Modem <[email protected]>
Quoted 11 lines
--- tests/core_auth.c | 10 +++---- tests/core_getclient.c | 2 +- tests/core_getstats.c | 2 +- tests/core_getversion.c | 2 +- tests/core_setmaster.c | 6 ++-- tests/core_setmaster_vs_auth.c | 6 ++-- tests/debugfs_test.c | 2 +- tests/dumb_buffer.c | 2 +- tests/eviction_common.c | 2 +- tests/fbdev.c | 2 +-
Please split above (and some of below) to separate patch:
tests: Use drm_close_driver() to close the drm fd
and leave only i915 in
tests/i915: Use drm_close_driver() to close the drm fd
Quoted 118 lines
tests/i915/api_intel_allocator.c | 6 ++-- tests/i915/api_intel_bb.c | 2 +- tests/i915/drm_fdinfo.c | 2 +- tests/i915/gem_bad_reloc.c | 2 +- tests/i915/gem_barrier_race.c | 2 +- tests/i915/gem_basic.c | 2 +- tests/i915/gem_blits.c | 2 +- tests/i915/gem_busy.c | 2 +- tests/i915/gem_caching.c | 2 +- tests/i915/gem_ccs.c | 2 +- tests/i915/gem_close_race.c | 14 ++++----- tests/i915/gem_cs_tlb.c | 2 +- tests/i915/gem_ctx_bad_destroy.c | 2 +- tests/i915/gem_ctx_create.c | 4 +-- tests/i915/gem_ctx_exec.c | 2 +- tests/i915/gem_ctx_param.c | 2 +- tests/i915/gem_ctx_persistence.c | 6 ++-- tests/i915/gem_ctx_shared.c | 2 +- tests/i915/gem_ctx_sseu.c | 2 +- tests/i915/gem_ctx_switch.c | 2 +- tests/i915/gem_eio.c | 16 +++++------ tests/i915/gem_evict_alignment.c | 2 +- tests/i915/gem_evict_everything.c | 2 +- tests/i915/gem_exec_alignment.c | 2 +- tests/i915/gem_exec_async.c | 2 +- tests/i915/gem_exec_await.c | 2 +- tests/i915/gem_exec_basic.c | 2 +- tests/i915/gem_exec_big.c | 2 +- tests/i915/gem_exec_capture.c | 2 +- tests/i915/gem_exec_create.c | 2 +- tests/i915/gem_exec_fair.c | 2 +- tests/i915/gem_exec_fence.c | 4 +-- tests/i915/gem_exec_flush.c | 2 +- tests/i915/gem_exec_gttfill.c | 4 +-- tests/i915/gem_exec_latency.c | 2 +- tests/i915/gem_exec_nop.c | 2 +- tests/i915/gem_exec_parallel.c | 4 +-- tests/i915/gem_exec_params.c | 2 +- tests/i915/gem_exec_reloc.c | 2 +- tests/i915/gem_exec_schedule.c | 2 +- tests/i915/gem_exec_store.c | 2 +- tests/i915/gem_exec_suspend.c | 2 +- tests/i915/gem_exec_whisper.c | 6 ++-- tests/i915/gem_exercise_blt.c | 2 +- tests/i915/gem_fd_exhaustion.c | 2 +- tests/i915/gem_fence_thrash.c | 2 +- tests/i915/gem_fenced_exec_thrash.c | 2 +- tests/i915/gem_flink_basic.c | 4 +-- tests/i915/gem_flink_race.c | 6 ++-- tests/i915/gem_gtt_cpu_tlb.c | 2 +- tests/i915/gem_gtt_hog.c | 2 +- tests/i915/gem_gtt_speed.c | 2 +- tests/i915/gem_huc_copy.c | 2 +- tests/i915/gem_lmem_evict.c | 4 +-- tests/i915/gem_lmem_swapping.c | 10 +++---- tests/i915/gem_madvise.c | 12 ++++---- tests/i915/gem_media_fill.c | 2 +- tests/i915/gem_mmap.c | 2 +- tests/i915/gem_mmap_gtt.c | 6 ++-- tests/i915/gem_mmap_offset.c | 8 +++--- tests/i915/gem_mmap_wc.c | 2 +- tests/i915/gem_partial_pwrite_pread.c | 2 +- tests/i915/gem_pipe_control_store_loop.c | 2 +- tests/i915/gem_ppgtt.c | 8 +++--- tests/i915/gem_pread.c | 2 +- tests/i915/gem_pread_after_blit.c | 2 +- tests/i915/gem_pwrite.c | 2 +- tests/i915/gem_pwrite_snooped.c | 2 +- tests/i915/gem_pxp.c | 2 +- tests/i915/gem_read_read_speed.c | 2 +- tests/i915/gem_readwrite.c | 2 +- tests/i915/gem_reg_read.c | 2 +- tests/i915/gem_render_copy.c | 2 +- tests/i915/gem_render_copy_redux.c | 2 +- tests/i915/gem_reset_stats.c | 32 ++++++++++----------- tests/i915/gem_ringfill.c | 2 +- tests/i915/gem_set_tiling_vs_blt.c | 2 +- tests/i915/gem_set_tiling_vs_gtt.c | 2 +- tests/i915/gem_set_tiling_vs_pwrite.c | 2 +- tests/i915/gem_shrink.c | 14 ++++----- tests/i915/gem_softpin.c | 4 +-- tests/i915/gem_spin_batch.c | 2 +- tests/i915/gem_streaming_writes.c | 2 +- tests/i915/gem_stress.c | 2 +- tests/i915/gem_sync.c | 2 +- tests/i915/gem_tiled_blits.c | 2 +- tests/i915/gem_tiled_fence_blits.c | 2 +- tests/i915/gem_tiled_partial_pwrite_pread.c | 2 +- tests/i915/gem_tiled_pread_basic.c | 2 +- tests/i915/gem_tiled_pread_pwrite.c | 2 +- tests/i915/gem_tiled_swapping.c | 2 +- tests/i915/gem_tiled_wb.c | 2 +- tests/i915/gem_tiled_wc.c | 2 +- tests/i915/gem_tiling_max_stride.c | 2 +- tests/i915/gem_unfence_active_buffers.c | 2 +- tests/i915/gem_unref_active_buffers.c | 2 +- tests/i915/gem_userptr_blits.c | 6 ++-- tests/i915/gem_vm_create.c | 4 +-- tests/i915/gem_wait.c | 2 +- tests/i915/gem_watchdog.c | 2 +- tests/i915/gem_workarounds.c | 2 +- tests/i915/gen7_exec_parse.c | 4 +-- tests/i915/gen9_exec_parse.c | 2 +- tests/i915/i915_fb_tiling.c | 2 +- tests/i915/i915_getparams_basic.c | 2 +- tests/i915/i915_hangman.c | 4 +-- tests/i915/i915_hwmon.c | 2 +- tests/i915/i915_module_load.c | 8 +++--- tests/i915/i915_pciid.c | 2 +- tests/i915/i915_pm_backlight.c | 2 +- tests/i915/i915_pm_dc.c | 2 +- tests/i915/i915_pm_freq_api.c | 2 +- tests/i915/i915_pm_freq_mult.c | 2 +- tests/i915/i915_pm_lpsp.c | 2 +- tests/i915/i915_pm_rc6_residency.c | 2 +- tests/i915/i915_pm_rps.c | 2 +- tests/i915/i915_pm_sseu.c | 2 +- tests/i915/i915_power.c | 2 +-
Quoted 8 lines
tests/i915/i915_query.c | 2 +- tests/i915/i915_suspend.c | 6 ++-- tests/i915/perf.c | 6 ++-- tests/i915/perf_pmu.c | 6 ++-- tests/i915/sysfs_defaults.c | 2 +- tests/i915/sysfs_heartbeat_interval.c | 2 +- tests/i915/sysfs_preempt_timeout.c | 2 +- tests/i915/sysfs_timeslice_duration.c | 2 +-
Split below into separate one.
Quoted 5 lines
tests/prime_busy.c | 2 +- tests/prime_mmap.c | 2 +- tests/prime_mmap_coherency.c | 4 +-- tests/prime_mmap_kms.c | 2 +- tests/prime_self_import.c | 26 ++++++++---------
Quoted 9 lines
tests/prime_vgem.c | 4 +-- tests/syncobj_basic.c | 2 +- tests/syncobj_timeline.c | 2 +- tests/syncobj_wait.c | 2 +- tests/template.c | 2 +- tests/vgem_basic.c | 6 ++-- tests/vgem_slow.c | 2 +- 148 files changed, 252 insertions(+), 252 deletions(-)
One more nit, see below.
Quoted 37 lines
tests/core_auth.c +4
-4@@ -189,7 +189,7 @@ static void test_basic_auth(int master)igt_assert (drmGetMagic (slave, &magic) ==0 );igt_assert_eq (magic, old_magic); -close (slave); +drm_close_driver (slave); } igt_main@@ -201,7 +201,7 @@ igt_mainigt_assert (check_auth (fd) == true); -close (fd); +drm_close_driver (fd); }igt_describe ("Use 2 clients, check second is authenticated even when first dropped." );@@ -211,11 +211,11 @@ igt_mainigt_assert (check_auth (fd2) == true); -close (fd); +drm_close_driver (fd);igt_assert (check_auth (fd2) == true); -close (fd2); +drm_close_driver (fd2); }/* above tests require that no drm fd is open */
tests/core_auth.c igt_main · line 227
Quoted 5 lines
tests/core_auth.c +1
-1@@ -224,7 +224,7 @@ igt_mainigt_fixture master =drm_open_driver_master (DRIVER_ANY ); - +
Please do not mix fixups into functional changes.
Rest looks good.
Regards,
Kamil
Quoted 2,571 lines
tests/core_auth.c +0
-0igt_describe ("Test magic numbers for master and slave." ); igt_subtest("basic-auth")test_basic_auth (master);tests/core_getclient.c +1
-1@@ -58,5 +58,5 @@ igt_simple_main ret =ioctl (fd,DRM_IOCTL_GET_CLIENT , &client);igt_assert (ret ==-1 && errno ==EINVAL ); -close (fd); +drm_close_driver (fd); }tests/core_getstats.c +1
-1@@ -52,5 +52,5 @@ igt_simple_main ret =ioctl (fd,DRM_IOCTL_GET_STATS , &stats);igt_assert (ret ==0 ); -close (fd); +drm_close_driver (fd); }tests/core_getversion.c +1
-1@@ -46,5 +46,5 @@ igt_simple_mainigt_assert_lte (1 , v->version_major);drmFree (v); -close (fd); +drm_close_driver (fd); }tests/core_setmaster.c +3
-3@@ -85,7 +85,7 @@ static void check_drop_set(void)igt_assert_eq (drmDropMaster (master),0 );igt_assert_eq (drmSetMaster (master),0 ); -close (master); +drm_close_driver (master); }static unsigned tweak_perm (uint8_t *saved_perm,unsigned max_perm,bool save)@@ -206,10 +206,10 @@ igt_mainigt_assert_eq (drmSetMaster (master),-1 );igt_assert_eq (errno,EACCES ); -close (master); +drm_close_driver (master); }igt_waitchildren (); -close (master); +drm_close_driver (master); } }tests/core_setmaster_vs_auth.c +3
-3@@ -66,7 +66,7 @@ igt_simple_mainigt_assert_neq (drmAuthMagic (master2, magic),0 );igt_assert_eq (errno,EINVAL ); -close (client); -close (master2); -close (master1); +drm_close_driver (client); +drm_close_driver (master2); +drm_close_driver (master1); }tests/debugfs_test.c +1
-1@@ -213,6 +213,6 @@ igt_main igt_fixture {close (sysfs);close (debugfs); -close (fd); +drm_close_driver (fd); } }tests/dumb_buffer.c +1
-1@@ -394,6 +394,6 @@ igt_mainalways_clear (fd,30 ); igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/eviction_common.c +1
-1@@ -300,7 +300,7 @@ static int forking_evictions(int fd, struct igt_eviction_test_ops *ops,/* drmfd closing will take care of additional bo refs */ if (flags &FORKING_EVICTIONS_DUP_DRMFD ) -close (realfd); +drm_close_driver (realfd); }igt_waitchildren ();tests/fbdev.c +1
-1@@ -443,6 +443,6 @@ igt_main } igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/i915/api_intel_allocator.c +3
-3@@ -502,7 +502,7 @@ static void reopen(int fd)__reopen_allocs (fd, fd2, true); -close (fd2); +drm_close_driver (fd2); }#define REOPEN_TIMEOUT 3@@ -528,7 +528,7 @@ static void reopen_fork(int fd)/* Check references at the end */ __reopen_allocs (fd, fd2, true); -close (fd2); +drm_close_driver (fd2);intel_allocator_multiprocess_stop (); }@@ -847,5 +847,5 @@ igt_maingem_pool (fd);igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/api_intel_bb.c +1
-1@@ -1701,6 +1701,6 @@ igt_main_args("dpibc:", NULL, help_str, opt_handler, NULL) igt_fixture {buf_ops_destroy (bops); -close (i915); +drm_close_driver (i915); } }tests/i915/drm_fdinfo.c +1
-1@@ -866,6 +866,6 @@ igt_main igt_fixture {intel_ctx_destroy (i915, ctx); -close (i915); +drm_close_driver (i915); } }tests/i915/gem_bad_reloc.c +1
-1@@ -212,5 +212,5 @@ igt_mainnegative_reloc_blt (fd);igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_barrier_race.c +1
-1@@ -108,7 +108,7 @@ static void intel_context_first_pin_last_unpin_loop(int fd, uint64_t engine, int }while (!READ_ONCE (*done)); -close (fd); +drm_close_driver (fd); }static void test_remote_request (int fd,uint64_t engine,unsigned int timeout)tests/i915/gem_basic.c +1
-1@@ -108,7 +108,7 @@ igt_main gpu_fd =__drm_open_driver_another (child,DRIVER_INTEL );igt_assert_f (gpu_fd >0 ,"cannot open gpu-%d, errno=%d\n" , child, errno);test_create_close (gpu_fd); -close (gpu_fd); +drm_close_driver (gpu_fd); }igt_waitchildren ();tests/i915/gem_blits.c +1
-1@@ -893,6 +893,6 @@ igt_main igt_fixture {put_ahnd (device.ahnd); -close (device.fd); +drm_close_driver (device.fd); } }tests/i915/gem_busy.c +1
-1@@ -562,6 +562,6 @@ igt_main igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_caching.c +1
-1@@ -340,6 +340,6 @@ igt_mainintel_buf_destroy (scratch_buf);intel_buf_destroy (staging_buf);buf_ops_destroy (data.bops); -close (data.fd); +drm_close_driver (data.fd); } }tests/i915/gem_ccs.c +1
-1@@ -731,6 +731,6 @@ igt_main_args("bf:pst:W:H:", NULL, help_str, opt_handler, NULL) igt_fixture {igt_disallow_hang (i915, hang); -close (i915); +drm_close_driver (i915); } }tests/i915/gem_close_race.c +7
-7@@ -248,7 +248,7 @@ static void thread(int fd, struct drm_gem_open name, n++; }while (1 ); -close (crashme.fd); +drm_close_driver (crashme.fd); }timer_delete (timer);@@ -274,7 +274,7 @@ static void multigpu_threads(int timeout, unsigned int flags, int gpu_count)igt_waitchildren ();gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); }igt_waitchildren ();@@ -293,7 +293,7 @@ static void threads(int timeout, unsigned int flags)igt_waitchildren ();gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); } igt_main@@ -317,7 +317,7 @@ igt_main gpu_count =igt_device_filter_count ();igt_fork_hang_detector (fd); -close (fd); +drm_close_driver (fd); }igt_describe ("Basic workload submission." );@@ -329,7 +329,7 @@ igt_mainigt_waitchildren ();gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); }igt_describe ("Basic workload submission on multi-GPU machine." );@@ -342,7 +342,7 @@ igt_mainigt_assert (fd >0 );process (fd, child);gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); }igt_waitchildren ();@@ -369,7 +369,7 @@ igt_mainigt_waitchildren ();gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); } igt_describe("Share buffer handle across different drm fd's and trying to race"tests/i915/gem_cs_tlb.c +1
-1@@ -162,5 +162,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_ctx_bad_destroy.c +1
-1@@ -80,5 +80,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_ctx_create.c +2
-2@@ -117,7 +117,7 @@ static void files(int core, const intel_ctx_cfg_t *cfg,gem_execbuf (fd, &execbuf);intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); count++;clock_gettime (CLOCK_MONOTONIC , &end);@@ -667,6 +667,6 @@ igt_main igt_fixture {igt_stop_hang_detector (); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_ctx_exec.c +1
-1@@ -344,7 +344,7 @@ static void nohangcheck_hostile(int i915)put_ahnd (ahnd);close (dir); -close (i915); +drm_close_driver (i915); }static void close_race (int i915)tests/i915/gem_ctx_param.c +1
-1@@ -472,5 +472,5 @@ igt_maintest_get_invalid_param (fd,I915_CONTEXT_PARAM_ENGINES );igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_ctx_persistence.c +3
-3@@ -604,7 +604,7 @@ static void test_nonpersistent_file(int i915)gem_context_set_persistence (i915,0 , false); spin = igt_spin_new(i915, .ahnd = ahnd, .flags = IGT_SPIN_FENCE_OUT); -close (i915); +drm_close_driver (i915);flush_delayed_fput (debugfs);igt_assert_eq (wait_for_status (spin->out_fence, reset_timeout_ms), -EIO );@@ -1087,7 +1087,7 @@ static void __smoker(int i915, const intel_ctx_cfg_t *cfg,intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd);flush_delayed_fput (i915);igt_spin_end (spin);@@ -1383,6 +1383,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }tests/i915/gem_ctx_shared.c +1
-1@@ -246,7 +246,7 @@ static void exhaust_shared_gtt(int i915, unsigned int flags)igt_info ("Created %lu shared contexts, before %d (%s)\n" , count, err,strerror (-err)); } -close (i915); +drm_close_driver (i915);igt_waitchildren (); }tests/i915/gem_ctx_sseu.c +1
-1@@ -545,6 +545,6 @@ igt_main } igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/i915/gem_ctx_switch.c +1
-1@@ -440,6 +440,6 @@ igt_mainigt_stop_hang_detector ();gem_close (fd, heavy);gem_close (fd, light); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_eio.c +8
-8@@ -461,7 +461,7 @@ static void test_banned(int fd) { fd =reopen_device (fd);__test_banned (fd); -close (fd); +drm_close_driver (fd); }#define TEST_WEDGE (1)@@ -495,7 +495,7 @@ static void test_wait(int fd, unsigned int flags, unsigned int wait)igt_require (i915_reset_control (fd, true));trigger_reset (fd); -close (fd); +drm_close_driver (fd); }static void test_suspend (int fd,int state)@@ -513,7 +513,7 @@ static void test_suspend(int fd, int state)igt_require (i915_reset_control (fd, true));trigger_reset (fd); -close (fd); +drm_close_driver (fd); }static void test_inflight (int fd,unsigned int wait)@@ -577,7 +577,7 @@ static void test_inflight(int fd, unsigned int wait)trigger_reset (fd);gem_close (fd, obj[1 ].handle); -close (fd); +drm_close_driver (fd); } }@@ -638,7 +638,7 @@ static void test_inflight_suspend(int fd)igt_assert (i915_reset_control (fd, true));trigger_reset (fd); -close (fd); +drm_close_driver (fd); }static const intel_ctx_t *context_create_safe (int i915)@@ -728,7 +728,7 @@ static void test_inflight_contexts(int fd, unsigned int wait)for (unsigned int n =0 ; n <ARRAY_SIZE (ctx); n++)intel_ctx_destroy (fd, ctx[n]); -close (fd); +drm_close_driver (fd); } }@@ -784,7 +784,7 @@ static void test_inflight_external(int fd)put_ahnd (ahnd);igt_assert (i915_reset_control (fd, true));trigger_reset (fd); -close (fd); +drm_close_driver (fd); }static void test_inflight_internal (int fd,unsigned int wait)@@ -834,7 +834,7 @@ static void test_inflight_internal(int fd, unsigned int wait)igt_assert (i915_reset_control (fd, true));trigger_reset (fd); -close (fd); +drm_close_driver (fd); } static void reset_stress(int fd, uint64_t ahnd, const intel_ctx_t *ctx0,tests/i915/gem_evict_alignment.c +1
-1@@ -265,6 +265,6 @@ igt_main igt_fixture {igt_stop_hang_helper (); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_evict_everything.c +1
-1@@ -290,6 +290,6 @@ igt_main igt_fixture {igt_stop_hang_helper (); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_exec_alignment.c +1
-1@@ -465,7 +465,7 @@ static void forked(int i915, int timeout)igt_waitchildren_timeout (3 * timeout,NULL );free (obj); -close (i915); +drm_close_driver (i915); }static void single (int fd)tests/i915/gem_exec_async.c +1
-1@@ -213,6 +213,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_exec_await.c +1
-1@@ -287,6 +287,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (device, ctx); -close (device); +drm_close_driver (device); } }tests/i915/gem_exec_basic.c +1
-1@@ -98,6 +98,6 @@ igt_mainigt_collection_destroy (set);igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_exec_big.c +1
-1@@ -326,5 +326,5 @@ igt_mainexhaustive (i915);igt_fixture -close (i915 ); +drm_close_driver (i915 ); }tests/i915/gem_exec_capture.c +1
-1@@ -1013,6 +1013,6 @@ igt_mainclose (dir);igt_disallow_hang (fd, hang);intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_exec_create.c +1
-1@@ -225,6 +225,6 @@ igt_main igt_fixture {igt_stop_hang_detector (); -close (device); +drm_close_driver (device); } }tests/i915/gem_exec_fair.c +1
-1@@ -1348,6 +1348,6 @@ igt_main igt_fixture {igt_stop_hang_detector (); -close (i915); +drm_close_driver (i915); } }tests/i915/gem_exec_fence.c +2
-2@@ -1768,7 +1768,7 @@ static void test_invalid_timeline_fence_array(int fd)igt_assert_eq (__gem_execbuf (fd, &execbuf), -EFAULT );munmap (ptr,4096 ); -close (fd); +drm_close_driver (fd); } static const char *test_syncobj_timeline_unused_fence_desc =@@ -3351,6 +3351,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }tests/i915/gem_exec_flush.c +1
-1@@ -711,6 +711,6 @@ igt_main igt_fixture {igt_stop_hang_detector (); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_exec_gttfill.c +2
-2@@ -279,7 +279,7 @@ igt_main// release resources igt_stop_hang_detector ();intel_ctx_destroy (g_fd, ctx); -close (g_fd); +drm_close_driver (g_fd); }igt_waitchildren ();@@ -287,6 +287,6 @@ igt_main igt_fixture {intel_allocator_multiprocess_stop (); -close (i915); +drm_close_driver (i915); } }tests/i915/gem_exec_latency.c +1
-1@@ -971,6 +971,6 @@ igt_main igt_fixture {intel_register_access_fini (&mmio_data);intel_ctx_destroy (device, ctx); -close (device); +drm_close_driver (device); } }tests/i915/gem_exec_nop.c +1
-1@@ -1083,6 +1083,6 @@ igt_mainigt_stop_hang_detector ();gem_close (device, handle);intel_ctx_destroy (device, ctx); -close (device); +drm_close_driver (device); } }tests/i915/gem_exec_parallel.c +2
-2@@ -181,7 +181,7 @@ static void *thread(void *data)intel_ctx_destroy (fd, tmp_ctx);gem_close (fd, obj[1 ].handle);if (t->flags &FDS ) -close (fd); +drm_close_driver (fd); t->used = used;return NULL ;@@ -364,6 +364,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_exec_params.c +1
-1@@ -646,6 +646,6 @@ igt_main igt_fixture {gem_close (fd, handle); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_exec_reloc.c +1
-1@@ -1178,5 +1178,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_exec_schedule.c +1
-1@@ -3369,6 +3369,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_exec_store.c +1
-1@@ -455,6 +455,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_exec_suspend.c +1
-1@@ -411,6 +411,6 @@ igt_mainigt_collection_destroy (set);igt_disallow_hang (fd, hang);intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_exec_whisper.c +3
-3@@ -178,7 +178,7 @@ static void fini_hang(struct hang *h)put_offset (h->ahnd, h->obj.handle);put_ahnd (h->ahnd);intel_ctx_destroy (h->fd, h->ctx); -close (h->fd); +drm_close_driver (h->fd); }static void ctx_set_random_priority (int fd,uint32_t ctx)@@ -550,7 +550,7 @@ static void whisper(int fd, const intel_ctx_t *ctx,gem_close (fd, batches[n].handle);if (flags &FDS ) {for (n =0 ; n <64 ; n++) -close (fds[n]); +drm_close_driver (fds[n]); } }@@ -660,6 +660,6 @@ igt_main igt_fixture {intel_allocator_multiprocess_stop ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_exercise_blt.c +1
-1@@ -381,6 +381,6 @@ igt_main_args("b:pst:W:H:", NULL, help_str, opt_handler, NULL) } igt_fixture { -close (i915); +drm_close_driver (i915); } }tests/i915/gem_fd_exhaustion.c +1
-1@@ -69,5 +69,5 @@ igt_simple_mainigt_waitchildren (); -close (fd); +drm_close_driver (fd); }tests/i915/gem_fence_thrash.c +1
-1@@ -225,7 +225,7 @@ static int run_test(int threads_per_fence, void *f, int tiling,igt_assert (func (&t) == (void *)0 ); } -close (t.fd); +drm_close_driver (t.fd);return 0 ; }tests/i915/gem_fenced_exec_thrash.c +1
-1@@ -199,5 +199,5 @@ igt_mainrun_test (fd, num_fences +1 ,intel_gen (devid) >=4 ?0 :ENOBUFS ,0 );igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_flink_basic.c +2
-2@@ -147,7 +147,7 @@ test_flink_lifetime(int fd)igt_assert_eq (ret,0 );igt_assert (open_struct.handle !=0 ); -close (fd2); +drm_close_driver (fd2); fd2 =drm_open_driver (DRIVER_INTEL );/* Flink name remains valid due to the second reference */ @@ -156,7 +156,7 @@ test_flink_lifetime(int fd)igt_assert_eq (ret,0 );igt_assert (open_struct.handle !=0 ); -close (fd2); +drm_close_driver (fd2); } igt_maintests/i915/gem_flink_race.c +3
-3@@ -127,7 +127,7 @@ static void test_flink_name(int timeout) igt_stats_get_max(&stats));igt_stats_fini (&stats); -close (fd); +drm_close_driver (fd); }static void *thread_fn_flink_close (void *p)@@ -188,13 +188,13 @@ static void test_flink_close(void)igt_assert (status ==0 ); } -close (fd); +drm_close_driver (fd); obj_count =igt_get_stable_obj_count (fake) - obj_count;igt_info ("leaked %i objects\n" , obj_count); -close (fake); +drm_close_driver (fake);igt_assert_eq (obj_count,0 ); }tests/i915/gem_gtt_cpu_tlb.c +1
-1@@ -105,5 +105,5 @@ igt_simple_mainfor (i =0 ; i <OBJ_SIZE /4 ; i++)igt_assert (ptr[i] == i); -close (fd); +drm_close_driver (fd); }tests/i915/gem_gtt_hog.c +1
-1@@ -164,7 +164,7 @@ igt_simple_mainint fd =drm_open_driver (DRIVER_INTEL );igt_require_gem (fd);gem_require_mappable_ggtt (fd); -close (fd); +drm_close_driver (fd); data.fd =drm_open_driver (DRIVER_INTEL ); data.devid =intel_get_drm_devid (data.fd);tests/i915/gem_gtt_speed.c +1
-1@@ -515,5 +515,5 @@ igt_simple_main_args("s:", NULL, help_str, opt_handler, NULL) }gem_close (fd, handle); -close (fd); +drm_close_driver (fd); }tests/i915/gem_huc_copy.c +1
-1@@ -139,6 +139,6 @@ igt_main igt_fixture {put_ahnd (ahnd); -close (drm_fd); +drm_close_driver (drm_fd); } }tests/i915/gem_lmem_evict.c +2
-2@@ -93,7 +93,7 @@ igt_mainigt_require_fd (i915);igt_require_gem (i915);igt_require (gem_has_lmem (i915)); -close (i915); +drm_close_driver (i915); }igt_i915_driver_unload ();@@ -132,7 +132,7 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915);igt_i915_driver_unload (); } }tests/i915/gem_lmem_swapping.c +5
-5@@ -551,7 +551,7 @@ static void test_evict(int i915,igt_waitchildren ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd);intel_allocator_multiprocess_stop (); }else {__do_evict (i915, ctx, ®ion->region, ¶ms, params.seed);@@ -623,7 +623,7 @@ static void test_smem_oom(int i915, params.seed + child + 1);intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); }/* smem memory hog process, respawn till the lmem process completes */ @@ -644,7 +644,7 @@ static void test_smem_oom(int i915,break ;gem_leak (fd, alloc); } -close (fd); +drm_close_driver (fd); }/* * Wait for grand-child processes to finish or be @@ -736,7 +736,7 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)igt_require_fd (i915);igt_require_gem (i915);igt_require (gem_has_lmem (i915)); -close (i915); +drm_close_driver (i915); }igt_i915_driver_unload ();@@ -781,7 +781,7 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) igt_fixture {intel_ctx_destroy (i915, ctx);free (regions); -close (i915); +drm_close_driver (i915);igt_i915_driver_unload (); }tests/i915/gem_madvise.c +6
-6@@ -77,7 +77,7 @@ dontneed_before_mmap(void)PROT_READ |PROT_WRITE , t->type); -close (fd); +drm_close_driver (fd);if (!ptr)continue ;@@ -99,7 +99,7 @@ dontneed_before_mmap(void) fd =drm_open_driver (DRIVER_INTEL ); } -close (fd); +drm_close_driver (fd); } static void@@ -123,7 +123,7 @@ dontneed_after_mmap(void) t->type);gem_madvise (fd, handle,I915_MADV_DONTNEED ); -close (fd); +drm_close_driver (fd);if (!ptr)continue ;@@ -145,7 +145,7 @@ dontneed_after_mmap(void) fd =drm_open_driver (DRIVER_INTEL ); } -close (fd); +drm_close_driver (fd); } static void@@ -161,7 +161,7 @@ dontneed_before_pwrite(void)igt_assert_eq (__gem_write (fd, handle,0 , &bbe,sizeof (bbe)), -EFAULT ); -close (fd); +drm_close_driver (fd); } static void@@ -185,7 +185,7 @@ dontneed_before_exec(void) execbuf.batch_len =sizeof (buf);igt_assert_eq (__gem_execbuf (fd, &execbuf), -EFAULT ); -close (fd); +drm_close_driver (fd); } igt_maintests/i915/gem_media_fill.c +1
-1@@ -173,6 +173,6 @@ igt_main igt_fixture {igt_collection_destroy (set);igt_stop_hang_detector (); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/gem_mmap.c +1
-1@@ -315,5 +315,5 @@ igt_maintest_huge_bo (2 );igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_mmap_gtt.c +3
-3@@ -381,13 +381,13 @@ test_isolation(int i915)igt_info ("B: {fd:%d, handle:%d, offset:%" PRIx64"}\n" ,B , b, offset_b); -close (B ); +drm_close_driver (B ); ptr =mmap (0 ,4096 ,PROT_READ ,MAP_SHARED ,A , offset_a);igt_assert (ptr !=MAP_FAILED );munmap (ptr,4096 ); -close (A ); +drm_close_driver (A ); ptr =mmap (0 ,4096 ,PROT_READ ,MAP_SHARED ,A , offset_a);igt_assert (ptr ==MAP_FAILED );@@ -1491,5 +1491,5 @@ igt_mainigt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_mmap_offset.c +4
-4@@ -346,13 +346,13 @@ static void isolation(int i915)igt_assert_eq (errno,EACCES ); } -close (B ); +drm_close_driver (B ); ptr =mmap (0 ,4096 ,PROT_READ ,MAP_SHARED ,A , offset_a);igt_assert (ptr !=MAP_FAILED );munmap (ptr,4096 ); -close (A ); +drm_close_driver (A ); ptr =mmap (0 ,4096 ,PROT_READ ,MAP_SHARED ,A , offset_a);igt_assert (ptr ==MAP_FAILED );@@ -647,7 +647,7 @@ static void open_flood(int i915, int timeout)mmap_offset_ioctl (i915, &arg); } -close (tmp); +drm_close_driver (tmp); count++; }@@ -925,6 +925,6 @@ igt_mainblt_coherency (i915); igt_fixture { -close (i915); +drm_close_driver (i915); } }tests/i915/gem_mmap_wc.c +1
-1@@ -620,5 +620,5 @@ igt_maintest_set_cache_level (fd);igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_partial_pwrite_pread.c +1
-1@@ -326,6 +326,6 @@ igt_mainintel_buf_destroy (scratch_buf);intel_buf_destroy (staging_buf);buf_ops_destroy (data.bops); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/gem_pipe_control_store_loop.c +1
-1@@ -183,6 +183,6 @@ igt_main igt_fixture {buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_ppgtt.c +4
-4@@ -251,8 +251,8 @@ static void flink_and_close(void)igt_assert_eq (offset, offset_new);gem_close (fd, bo); -close (fd); -close (fd2); +drm_close_driver (fd); +drm_close_driver (fd2); }#define PAGE_SIZE 4096@@ -385,7 +385,7 @@ static bool has_contexts(void) fd =drm_open_driver (DRIVER_INTEL ); result =gem_has_contexts (fd); -close (fd); +drm_close_driver (fd);return result; }@@ -398,7 +398,7 @@ igt_mainint fd =drm_open_driver (DRIVER_INTEL );igt_require_gem (fd);gem_require_blitter (fd); -close (fd); +drm_close_driver (fd); } igt_subtest("blt-vs-render-ctx0") {tests/i915/gem_pread.c +1
-1@@ -350,6 +350,6 @@ igt_main_args("s:", NULL, help_str, opt_handler, NULL)free (src);gem_close (fd, dst); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_pread_after_blit.c +1
-1@@ -252,5 +252,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_pwrite.c +1
-1@@ -572,5 +572,5 @@ igt_main_args("s:", NULL, help_str, opt_handler, NULL) }igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_pwrite_snooped.c +1
-1@@ -140,5 +140,5 @@ igt_simple_maintest (256 ,256 );buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); }tests/i915/gem_pxp.c +1
-1@@ -1293,6 +1293,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }tests/i915/gem_read_read_speed.c +1
-1@@ -214,6 +214,6 @@ igt_main igt_fixture {buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_readwrite.c +1
-1@@ -143,5 +143,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_reg_read.c +1
-1@@ -170,6 +170,6 @@ igt_main } igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/i915/gem_render_copy.c +1
-1@@ -879,6 +879,6 @@ igt_main_args("dac", NULL, help_str, opt_handler, NULL)igt_stop_hang_detector ();buf_ops_destroy (data.bops);igt_collection_destroy (set); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/gem_render_copy_redux.c +1
-1@@ -81,7 +81,7 @@ static void data_init(data_t *data)static void data_fini (data_t *data) {buf_ops_destroy (data->bops); -close (data->fd); +drm_close_driver (data->fd); } static void scratch_buf_init(data_t *data, struct intel_buf *buf,tests/i915/gem_reset_stats.c +16
-16@@ -297,7 +297,7 @@ static void test_rs(const struct intel_execution_ring *e,igt_assert (igt_seconds_elapsed (&ts_injected) <=30 );for (i =0 ; i < num_fds; i++) -close (fd[i]); +drm_close_driver (fd[i]); }#define MAX_CTX 100@@ -373,7 +373,7 @@ static void test_rs_ctx(const struct intel_execution_ring *e,for (i =0 ; i < num_fds; i++) {assert_reset_status (i, fd[i],0 ,RS_NO_ERROR ); -close (fd[i]); +drm_close_driver (fd[i]); } }@@ -427,8 +427,8 @@ static void test_ban(const struct intel_execution_ring *e)igt_assert_eq (gem_reset_stats (fd_good,0 , &rs_good),0 );igt_assert_eq (rs_good.batch_active,0 ); -close (fd_bad); -close (fd_good); +drm_close_driver (fd_bad); +drm_close_driver (fd_good); }static void test_ban_ctx (const struct intel_execution_ring *e)@@ -486,7 +486,7 @@ static void test_ban_ctx(const struct intel_execution_ring *e)igt_assert_eq (gem_reset_stats (fd, ctx_good, &rs_good),0 );igt_assert_eq (rs_good.batch_active,0 ); -close (fd); +drm_close_driver (fd); }static void test_unrelated_ctx (const struct intel_execution_ring *e)@@ -512,8 +512,8 @@ static void test_unrelated_ctx(const struct intel_execution_ring *e)assert_reset_status (0 , fd1, ctx_guilty,RS_BATCH_ACTIVE );assert_reset_status (1 , fd2, ctx_unrelated,RS_NO_ERROR ); -close (fd1); -close (fd2); +drm_close_driver (fd1); +drm_close_driver (fd2); }static int get_reset_count (int fd,int ctx)@@ -539,7 +539,7 @@ static void test_close_pending_ctx(const struct intel_execution_ring *e)gem_context_destroy (fd, ctx);igt_assert_eq (__gem_context_destroy (fd, ctx), -ENOENT ); -close (fd); +drm_close_driver (fd); }static void test_close_pending (const struct intel_execution_ring *e)@@ -549,7 +549,7 @@ static void test_close_pending(const struct intel_execution_ring *e)assert_reset_status (fd, fd,0 ,RS_NO_ERROR );inject_hang (fd,0 , e,0 ); -close (fd); +drm_close_driver (fd); }static void noop_on_each_ring (int fd,const bool reverse)@@ -611,7 +611,7 @@ static void test_close_pending_fork(const struct intel_execution_ring *e,* when gpu is reset and ring lists are cleared. */ noop_on_each_ring (fd2, reverse); -close (fd2); +drm_close_driver (fd2);pause ();exit (0 ); }else {@@ -624,7 +624,7 @@ static void test_close_pending_fork(const struct intel_execution_ring *e, }igt_post_hang_ring (fd, hang); -close (fd); +drm_close_driver (fd); } static void test_reset_count(const struct intel_execution_ring *e,@@ -664,7 +664,7 @@ static void test_reset_count(const struct intel_execution_ring *e,if (create_ctx)gem_context_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); }static int _test_params (int fd,int ctx,uint32_t flags,uint32_t pad)@@ -735,7 +735,7 @@ static void test_params_ctx(void) fd =drm_reopen_driver (device);_test_param (fd,gem_context_create (fd)); -close (fd); +drm_close_driver (fd); }static void test_params (void )@@ -744,7 +744,7 @@ static void test_params(void) fd =drm_reopen_driver (device);_test_param (fd,0 ); -close (fd); +drm_close_driver (fd); } static const struct intel_execution_ring *@@ -790,7 +790,7 @@ static void defer_hangcheck(const struct intel_execution_ring *engine)igt_assert_lt (count_start, count_end); -close (fd); +drm_close_driver (fd); }static bool gem_has_reset_stats (int fd)@@ -999,6 +999,6 @@ igt_main } igt_fixture {igt_assert (igt_params_set (device,"reset" ,"%d" ,INT_MAX /* any reset method */ )); -close (device); +drm_close_driver (device); } }tests/i915/gem_ringfill.c +1
-1@@ -401,6 +401,6 @@ igt_main igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_set_tiling_vs_blt.c +1
-1@@ -261,6 +261,6 @@ igt_main igt_fixture{buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_set_tiling_vs_gtt.c +1
-1@@ -130,5 +130,5 @@ igt_simple_mainmunmap (ptr,OBJECT_SIZE ); -close (fd); +drm_close_driver (fd); }tests/i915/gem_set_tiling_vs_pwrite.c +1
-1@@ -99,5 +99,5 @@ igt_simple_mainmunmap (ptr,OBJECT_SIZE ); -close (fd); +drm_close_driver (fd); }tests/i915/gem_shrink.c +7
-7@@ -270,7 +270,7 @@ static bool has_userptr(void)if (drmIoctl (fd,DRM_IOCTL_I915_GEM_USERPTR , &userptr)) err = errno; -close (fd); +drm_close_driver (fd);return err ==EFAULT ; }@@ -319,7 +319,7 @@ static void run_test(int nchildren, uint64_t alloc,int fd =drm_open_driver (DRIVER_INTEL );for (int pass =0 ; pass < nchildren; pass++)leak (fd, alloc); -close (fd); +drm_close_driver (fd); } } }@@ -331,7 +331,7 @@ static void run_test(int nchildren, uint64_t alloc,int fd =drm_open_driver (DRIVER_INTEL );for (int pass =0 ; pass < nchildren; pass++)userptr (fd, alloc,0 ); -close (fd); +drm_close_driver (fd); } } nchildren = (nchildren +1 )/2 ;@@ -344,7 +344,7 @@ static void run_test(int nchildren, uint64_t alloc,int fd =drm_open_driver (DRIVER_INTEL );for (int pass =0 ; pass < nchildren; pass++)userptr (fd, alloc,UDIRTY ); -close (fd); +drm_close_driver (fd); } } nchildren = (nchildren +1 )/2 ;@@ -356,7 +356,7 @@ static void run_test(int nchildren, uint64_t alloc,int fd =drm_open_driver (DRIVER_INTEL );for (int pass =0 ; pass < nchildren; pass++)func (fd, alloc); -close (fd); +drm_close_driver (fd); } }igt_waitchildren ();@@ -399,7 +399,7 @@ static void reclaim(unsigned engine, int timeout)munmap ((void *)shared,4096 );close (debugfs); -close (fd); +drm_close_driver (fd); } igt_main@@ -456,7 +456,7 @@ igt_main num_processes, alloc_size); alloc_size <<=20 ; -close (fd); +drm_close_driver (fd); }igt_subtest ("reclaim" )tests/i915/gem_softpin.c +2
-2@@ -1217,7 +1217,7 @@ static void *thread(void *data) fd, ctx->id, t->engine, succeeded);intel_ctx_destroy (fd, ctx);gem_close (fd, obj[1 ].handle); -close (fd); +drm_close_driver (fd);return (void *)from_user_pointer (ret); }@@ -1531,6 +1531,6 @@ igt_main igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_spin_batch.c +1
-1@@ -277,6 +277,6 @@ igt_main igt_fixture {igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_streaming_writes.c +1
-1@@ -419,5 +419,5 @@ igt_maintest_batch (fd,2 ,1 );igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_stress.c +1
-1@@ -926,7 +926,7 @@ igt_simple_main_args("ds:g:c:t:rbuxmo:fp:",intel_bb_destroy (ibb);buf_ops_destroy (bops); -close (drm_fd); +drm_close_driver (drm_fd);igt_stop_signal_helper (); }tests/i915/gem_sync.c +1
-1@@ -1363,6 +1363,6 @@ igt_mainintel_allocator_multiprocess_stop ();igt_stop_hang_detector ();intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_tiled_blits.c +1
-1@@ -215,6 +215,6 @@ igt_main } igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/i915/gem_tiled_fence_blits.c +1
-1@@ -320,5 +320,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_tiled_partial_pwrite_pread.c +1
-1@@ -318,6 +318,6 @@ igt_mainintel_buf_destroy (tiled_staging_buf);buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_tiled_pread_basic.c +1
-1@@ -222,5 +222,5 @@ igt_simple_main } } -close (fd); +drm_close_driver (fd); }tests/i915/gem_tiled_pread_pwrite.c +1
-1@@ -154,5 +154,5 @@ igt_simple_maingem_madvise (fd, handle,I915_MADV_DONTNEED ); } -close (fd); +drm_close_driver (fd); }tests/i915/gem_tiled_swapping.c +1
-1@@ -246,5 +246,5 @@ igt_main }igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/gem_tiled_wb.c +1
-1@@ -239,5 +239,5 @@ igt_simple_mainmunmap (linear, last_page - first_page); } -close (fd); +drm_close_driver (fd); }tests/i915/gem_tiled_wc.c +1
-1@@ -243,5 +243,5 @@ igt_simple_mainmunmap (linear, last_page - first_page); } -close (fd); +drm_close_driver (fd); }tests/i915/gem_tiling_max_stride.c +1
-1@@ -138,5 +138,5 @@ igt_simple_mainmunmap (ptr, size); -close (fd); +drm_close_driver (fd); }tests/i915/gem_unfence_active_buffers.c +1
-1@@ -99,5 +99,5 @@ igt_simple_mainigt_spin_free (i915, spin);put_ahnd (ahnd); -close (i915); +drm_close_driver (i915); }tests/i915/gem_unref_active_buffers.c +1
-1@@ -121,5 +121,5 @@ igt_simple_mainigt_spin_free (i915, spin);put_ahnd (ahnd); -close (i915); +drm_close_driver (i915); }tests/i915/gem_userptr_blits.c +3
-3@@ -730,7 +730,7 @@ static void test_nohangcheck_hostile(int i915)close (fence);close (dir); -close (i915); +drm_close_driver (i915); }static size_t hugepagesize (void )@@ -1288,9 +1288,9 @@ static int test_dmabuf(void)/* destroy userptr object and expect SIGBUS */ free_userptr_bo (fd1, handle); -close (fd1); +drm_close_driver (fd1); -close (fd2); +drm_close_driver (fd2);reset_handle_ptr ();return 0 ;tests/i915/gem_vm_create.c +2
-2@@ -347,7 +347,7 @@ static void isolation(int i915)gem_read (i915, obj[0 ].handle,0 , &result,sizeof (result));igt_assert_eq (result,1 ); -close (other); +drm_close_driver (other);gem_close (i915, obj[1 ].handle);gem_close (i915, obj[0 ].handle);@@ -388,6 +388,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }tests/i915/gem_wait.c +1
-1@@ -257,6 +257,6 @@ igt_main igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/i915/gem_watchdog.c +1
-1@@ -586,6 +586,6 @@ igt_main igt_fixture {intel_ctx_destroy (i915, ctx); -close (i915); +drm_close_driver (i915); } }tests/i915/gem_workarounds.c +1
-1@@ -235,7 +235,7 @@ static void check_workarounds(int fd, enum operation op, unsigned int flags)if (flags &CONTEXT )intel_ctx_destroy (fd, ctx);if (flags &FD ) -close (fd); +drm_close_driver (fd); } igt_maintests/i915/gen7_exec_parse.c +2
-2@@ -445,7 +445,7 @@ static void hsw_load_register_reg(void) 0xabcdabc0); } -close (fd); +drm_close_driver (fd); } igt_main@@ -717,6 +717,6 @@ igt_mainigt_stop_hang_detector ();gem_close (fd, handle); -close (fd); +drm_close_driver (fd); } }tests/i915/gen9_exec_parse.c +1
-1@@ -1252,6 +1252,6 @@ igt_mainigt_stop_hang_detector ();gem_close (i915, handle); -close (i915); +drm_close_driver (i915); } }tests/i915/i915_fb_tiling.c +1
-1@@ -44,5 +44,5 @@ igt_simple_mainigt_assert_eq (ret, -EBUSY );igt_remove_fb (drm_fd, &fb); -close (drm_fd); +drm_close_driver (drm_fd); }tests/i915/i915_getparams_basic.c +1
-1@@ -46,7 +46,7 @@ init(void)static void deinit (void ) { -close (drm_fd); +drm_close_driver (drm_fd); }tests/i915/i915_hangman.c +2
-2@@ -97,7 +97,7 @@ static void check_alive(void)put_ahnd (ahnd);intel_ctx_destroy (fd, ctx);gem_quiescent_gpu (fd); -close (fd); +drm_close_driver (fd); }static bool has_error_state (int dir)@@ -580,6 +580,6 @@ igt_mainigt_disallow_hang (device, hang);intel_ctx_destroy (device, ctx); -close (device); +drm_close_driver (device); } }tests/i915/i915_hwmon.c +1
-1@@ -83,6 +83,6 @@ igt_main igt_fixture {close (hwm); -close (fd); +drm_close_driver (fd); } }tests/i915/i915_module_load.c +4
-4@@ -238,7 +238,7 @@ static void gem_sanitycheck(void)store_all (i915); errno =0 ; -close (i915); +drm_close_driver (i915);igt_assert_eq (err, expected); }@@ -286,7 +286,7 @@ static void load_and_check_i915(void)/* make sure the GPU is idle */ gem_quiescent_gpu (drm_fd); -close (drm_fd); +drm_close_driver (drm_fd);/* make sure we can do basic memory ops */ gem_sanitycheck ();@@ -327,7 +327,7 @@ static uint32_t driver_load_with_lmem_bar_size(uint32_t lmem_bar_size, bool che } } -close (i915); +drm_close_driver (i915);return lmem_bar_size; }@@ -419,7 +419,7 @@ igt_mainigt_require_gem (i915);igt_require (gem_has_lmem (i915));igt_skip_on_f (igt_sysfs_get_num_gt (i915) >1 ,"Skips for more than one lmem instance.\n" ); -close (i915); +drm_close_driver (i915); }/* Test for lmem_bar_size modparam support */ tests/i915/i915_pciid.c +1
-1@@ -65,5 +65,5 @@ igt_simple_mainigt_assert (has_known_intel_chipset (intel)); -close (intel); +drm_close_driver (intel); }tests/i915/i915_pm_backlight.c +1
-1@@ -332,6 +332,6 @@ igt_mainigt_display_fini (&display);igt_pm_restore_sata_link_power_management (); -close (display.drm_fd); +drm_close_driver (display.drm_fd); } }tests/i915/i915_pm_dc.c +1
-1@@ -689,7 +689,7 @@ igt_mainclose (data.debugfs_root_fd);close (data.msr_fd);display_fini (&data); -close (data.drm_fd); +drm_close_driver (data.drm_fd); }igt_exit ();tests/i915/i915_pm_freq_api.c +1
-1@@ -139,6 +139,6 @@ igt_mainigt_assert (set_freq (dirfd,RPS_MAX_FREQ_MHZ , stash_max[gt]) >0 );igt_assert (set_freq (dirfd,RPS_MIN_FREQ_MHZ , stash_min[gt]) >0 ); } -close (i915); +drm_close_driver (i915); } }tests/i915/i915_pm_freq_mult.c +1
-1@@ -167,6 +167,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }tests/i915/i915_pm_lpsp.c +1
-1@@ -211,6 +211,6 @@ igt_main igt_fixture {free (data.pwr_dmn_info);igt_display_fini (&data.display); -close (data.drm_fd); +drm_close_driver (data.drm_fd); } }tests/i915/i915_pm_rc6_residency.c +1
-1@@ -611,6 +611,6 @@ igt_main igt_fixture {intel_ctx_destroy (i915, ctx); -close (i915); +drm_close_driver (i915); } }tests/i915/i915_pm_rps.c +1
-1@@ -877,7 +877,7 @@ static void pm_rps_exit_handler(int sig)if (lh.igt_proc.running)load_helper_stop (); -close (drm_fd); +drm_close_driver (drm_fd); } igt_maintests/i915/i915_pm_sseu.c +1
-1@@ -315,7 +315,7 @@ gem_deinit(void)case 2 :buf_ops_destroy (gem.bops);case 1 : -close (gem.drm_fd); +drm_close_driver (gem.drm_fd); } }tests/i915/i915_power.c +1
-1@@ -76,6 +76,6 @@ igt_main } igt_fixture { -close (i915); +drm_close_driver (i915); } }tests/i915/i915_query.c +1
-1@@ -1465,6 +1465,6 @@ igt_mainquery_parse_and_validate_hwconfig_table (fd); igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/i915/i915_suspend.c +3
-3@@ -188,7 +188,7 @@ test_shrink(int fd, unsigned int mode)igt_system_suspend_autoresume (mode,SUSPEND_TEST_NONE );munmap (mem, size); -close (fd); +drm_close_driver (fd); }igt_waitchildren ();@@ -232,7 +232,7 @@ test_suspend_without_i915(int state)igt_pm_get_d3cold_allowed (&card, d3cold_allowed);igt_pm_set_d3cold_allowed (&card,"0\n" ); } -close (fd); +drm_close_driver (fd);igt_kmsg (KMSG_INFO "Unloading i915\n" );igt_assert_eq (igt_i915_driver_unload (),0 );@@ -315,5 +315,5 @@ igt_maintest_forcewake (fd, true);igt_fixture -close (fd ); +drm_close_driver (fd ); }tests/i915/perf.c +3
-3@@ -4518,7 +4518,7 @@ gen12_test_single_ctx_render_target_writes_a_counter(const struct intel_executioigt_drop_root ();gen12_single_ctx_helper (e); -close (drm_fd); +drm_close_driver (drm_fd); } child_ret =igt_wait_helper (&child); igt_assert(WEXITSTATUS(child_ret) == EAGAIN ||@@ -5299,7 +5299,7 @@ test_i915_ref_count(void)igt_debug ("ref count after opening i915 perf stream = %u\n" , ref_count1);igt_assert (ref_count1 > ref_count0); -close (drm_fd); +drm_close_driver (drm_fd);close (sysfs); drm_fd =-1 ; sysfs =-1 ;@@ -6008,6 +6008,6 @@ igt_mainput_engine_groups (perf_oa_groups, num_perf_oa_groups);intel_ctx_destroy (drm_fd, ctx); -close (drm_fd); +drm_close_driver (drm_fd); } }tests/i915/perf_pmu.c +3
-3@@ -2111,7 +2111,7 @@ static void test_unload(unsigned int num_engines)if (fd[count] !=-1 ) count++; -close (i915); +drm_close_driver (i915); buf =calloc (count,sizeof (uint64_t ));igt_assert (buf);@@ -2436,13 +2436,13 @@ igt_main igt_fixture {intel_ctx_destroy (render_fd ,render_ctx ); -close (render_fd); +drm_close_driver (render_fd); } } igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } igt_subtest("module-unload") {tests/i915/sysfs_defaults.c +1
-1@@ -105,6 +105,6 @@ igt_main igt_fixture {close (engines); -close (i915); +drm_close_driver (i915); } }tests/i915/sysfs_heartbeat_interval.c +1
-1@@ -514,6 +514,6 @@ igt_main igt_fixture {close (engines); -close (i915); +drm_close_driver (i915); } }tests/i915/sysfs_preempt_timeout.c +1
-1@@ -343,6 +343,6 @@ igt_main igt_fixture {close (engines); -close (i915); +drm_close_driver (i915); } }tests/i915/sysfs_timeslice_duration.c +1
-1@@ -564,6 +564,6 @@ igt_main igt_fixture {close (engines); -close (i915); +drm_close_driver (i915); } }tests/prime_busy.c +1
-1@@ -162,6 +162,6 @@ igt_main igt_fixture {intel_ctx_destroy (fd, ctx); -close (fd); +drm_close_driver (fd); } }tests/prime_mmap.c +1
-1@@ -557,6 +557,6 @@ igt_mainfree (query_info);igt_collection_destroy (set);igt_collection_destroy (dma_buf_set); -close (fd); +drm_close_driver (fd); } }tests/prime_mmap_coherency.c +2
-2@@ -249,7 +249,7 @@ static void blit_and_cmp(void)intel_bb_destroy (local_batch);buf_ops_destroy (local_bops); -close (local_fd); +drm_close_driver (local_fd); }/* @@ -346,6 +346,6 @@ igt_main igt_fixture {buf_ops_destroy (bops); -close (fd); +drm_close_driver (fd); } }tests/prime_mmap_kms.c +1
-1@@ -263,6 +263,6 @@ igt_main igt_fixture {igt_display_fini (&gpu.display); -close (gpu.drm_fd); +drm_close_driver (gpu.drm_fd); } }tests/prime_self_import.c +13
-13@@ -106,8 +106,8 @@ static void test_with_fd_dup(void)close (dma_buf_fd2);check_bo (fd2, handle_import, fd2, handle_import); -close (fd1); -close (fd2); +drm_close_driver (fd1); +drm_close_driver (fd2); }static void test_with_two_bos (void )@@ -139,8 +139,8 @@ static void test_with_two_bos(void)check_bo (fd2, handle_import, fd2, handle_import); -close (fd1); -close (fd2); +drm_close_driver (fd1); +drm_close_driver (fd2); }static void test_with_one_bo_two_files (void )@@ -164,8 +164,8 @@ static void test_with_one_bo_two_files(void)/* dma-buf self importing an flink bo should give the same handle */ igt_assert_eq_u32 (handle_import, handle_open); -close (fd1); -close (fd2); +drm_close_driver (fd1); +drm_close_driver (fd2);close (dma_buf_fd1);close (dma_buf_fd2); }@@ -211,7 +211,7 @@ static void test_with_one_bo(void)check_bo (fd1, handle, fd2, handle_import1);/* Completely rip out exporting fd. */ -close (fd1); +drm_close_driver (fd1);check_bo (fd2, handle_import1, fd2, handle_import1); }@@ -275,14 +275,14 @@ static void test_reimport_close_race(void)igt_assert (status ==0 ); } -close (fds[0 ]); +drm_close_driver (fds[0 ]);close (fds[1 ]); obj_count =igt_get_stable_obj_count (fake) - obj_count;igt_info ("leaked %i objects\n" , obj_count); -close (fake); +drm_close_driver (fake);igt_assert_eq (obj_count,0 ); }@@ -357,13 +357,13 @@ static void test_export_close_race(void)igt_assert (status ==0 ); } -close (fd); +drm_close_driver (fd); obj_count =igt_get_stable_obj_count (fake) - obj_count;igt_info ("leaked %i objects\n" , obj_count); -close (fake); +drm_close_driver (fake);igt_assert_eq (obj_count,0 ); }@@ -392,7 +392,7 @@ static void test_llseek_size(void)close (dma_buf_fd); } -close (fd); +drm_close_driver (fd); }static void test_llseek_bad (void )@@ -421,7 +421,7 @@ static void test_llseek_bad(void)close (dma_buf_fd); -close (fd); +drm_close_driver (fd); } igt_maintests/prime_vgem.c +2
-2@@ -1200,7 +1200,7 @@ igt_main igt_fixture { -close (i915); -close (vgem); +drm_close_driver (i915); +drm_close_driver (vgem); } }tests/syncobj_basic.c +1
-1@@ -232,7 +232,7 @@ igt_maintest_valid_cycle (fd); igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/syncobj_timeline.c +1
-1@@ -1538,6 +1538,6 @@ igt_maintest_32bits_limit (fd); igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/syncobj_wait.c +1
-1@@ -914,6 +914,6 @@ igt_maintest_wait_interrupted (fd,WAIT_ALL ); igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/template.c +1
-1@@ -76,6 +76,6 @@ igt_main*/ igt_fixture { -close (drm_fd); +drm_close_driver (drm_fd); } }tests/vgem_basic.c +3
-3@@ -64,8 +64,8 @@ static void test_setversion(int fd)static void test_client (int fd) { -close (drm_open_driver (DRIVER_VGEM )); -close (drm_open_driver_render (DRIVER_VGEM )); +drm_close_driver (drm_open_driver (DRIVER_VGEM )); +drm_close_driver (drm_open_driver_render (DRIVER_VGEM )); }static void test_create (int fd)@@ -537,6 +537,6 @@ igt_maintest_debugfs_read (fd); igt_fixture { -close (fd); +drm_close_driver (fd); } }tests/vgem_slow.c +1
-1@@ -85,6 +85,6 @@ igt_maintest_nohang (fd); igt_fixture { -close (fd); +drm_close_driver (fd); } }Signature · 1 line
2.40.0
PATCH 18/20 tests/xe/xe_debugfs: Use xe_config() helper to get the config
In reply to Bhanuprakash ModemUse xe_config() helper to get the config.
--- tests/xe/xe_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xe/xe_debugfs.c +1 -1
@@ -252,7 +252,7 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) } igt_subtest("base") { -test_base (fd, xe_dev->config); +test_base (fd,xe_config (fd)); }
Signature · 1 line
2.40.0
Re: [igt-dev] [i-g-t 18/20] tests/xe/xe_debugfs: Use xe_config() helper to get the config
Hi Bhanuprakash,
Quoted 12 lines · Bhanuprakash Modem
Use
xe_config()helper to get the config.Signed-off-by Bhanuprakash Modem <[email protected]>--- tests/xe/xe_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/xe/xe_debugfs.c +0
-0
tests/xe/xe_debugfs.c igt_main_args("", long_options, help_str, opt_handler, NULL) · line 255
Quoted 5 lines
tests/xe/xe_debugfs.c +1
-1@@ -252,7 +252,7 @@ igt_main_args("", long_options, help_str, opt_handler, NULL) } igt_subtest("base") { -test_base (fd, xe_dev->config); +test_base (fd,xe_config (fd));
Is this needed ? Old code looks good, I see no point in change. Maybe you should merge this with one removing xe_dev var ?
Regards,
Kamil
Quoted 6 lines
tests/xe/xe_debugfs.c +0
-0}Signature · 1 line
2.40.0
PATCH 19/20 tests: Drop xe_device get/put from test level
In reply to Bhanuprakash ModemAs xe_device get/put is already handled at driver open/close level, drop these checks from tests.
V2: - New patch for xe_config()
--- tests/kms_3d.c | 6 ------ tests/kms_addfb_basic.c | 9 +-------- tests/kms_flip.c | 9 +-------- tests/kms_flip_event_leak.c | 4 ---- tests/kms_getfb.c | 15 +-------------- tests/kms_hdmi_inject.c | 7 ------- tests/kms_setmode.c | 7 ------- tests/xe/xe_compute.c | 8 ++------ tests/xe/xe_create.c | 9 ++------- tests/xe/xe_debugfs.c | 6 +----- tests/xe/xe_dma_buf_sync.c | 11 ++--------- tests/xe/xe_evict.c | 5 ----- tests/xe/xe_exec_balancer.c | 8 ++------ tests/xe/xe_exec_basic.c | 8 ++------ tests/xe/xe_exec_compute_mode.c | 8 ++------ tests/xe/xe_exec_fault_mode.c | 5 +---- tests/xe/xe_exec_reset.c | 23 +++++------------------ tests/xe/xe_exec_threads.c | 20 ++++---------------- tests/xe/xe_gpgpu_fill.c | 3 --- tests/xe/xe_guc_pc.c | 2 -- tests/xe/xe_huc_copy.c | 8 ++------ tests/xe/xe_intel_bb.c | 2 -- tests/xe/xe_mmap.c | 8 ++------ tests/xe/xe_mmio.c | 8 ++------ tests/xe/xe_noexec_ping_pong.c | 2 -- tests/xe/xe_pm.c | 3 --- tests/xe/xe_prime_self_import.c | 31 +------------------------------ tests/xe/xe_query.c | 8 ++------ tests/xe/xe_vm.c | 5 +---- tests/xe/xe_waitfence.c | 8 ++------ 30 files changed, 38 insertions(+), 218 deletions(-)
tests/kms_3d.c +0 -6
@@ -37,9 +37,6 @@ igt_simple_main drm_fd =drm_open_driver_master (DRIVER_ANY ); -if (is_xe_device (drm_fd)) -xe_device_get (drm_fd); - res =drmModeGetResources (drm_fd);igt_require (res);
@@ -116,8 +113,5 @@ igt_simple_maindrmModeFreeConnector (connector); -if (is_xe_device (drm_fd)) -xe_device_put (drm_fd); -drm_close_driver (drm_fd); }
tests/kms_addfb_basic.c +1 -8
@@ -974,9 +974,6 @@ igt_main igt_fixture { fd =drm_open_driver_master (DRIVER_ANY );igt_require (has_addfb2_iface (fd)); - -if (is_xe_device (fd)) -xe_device_get (fd); }invalid_tests (fd);
@@ -1008,10 +1005,6 @@ igt_mainigt_display_fini (&display); } - igt_fixture { -if (is_xe_device (fd)) -xe_device_put (fd); - +igt_fixture drm_close_driver (fd ); - } }
tests/kms_flip.c +1 -8
@@ -1858,9 +1858,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL)igt_install_exit_handler (kms_flip_exit_handler);get_timestamp_format (); -if (is_xe_device (drm_fd)) -xe_device_get (drm_fd); -if (is_i915_device (drm_fd)) { bops =buf_ops_create (drm_fd); }
@@ -1926,10 +1923,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL) }igt_stop_signal_helper (); - igt_fixture { -if (is_xe_device (drm_fd)) -xe_device_put (drm_fd); - +igt_fixture drm_close_driver (drm_fd ); - } }
tests/kms_flip_event_leak.c +0 -4
@@ -65,8 +65,6 @@ static void test(data_t *data, enum pipe pipe, igt_output_t *output)igt_device_drop_master (data->drm_fd);igt_device_set_master (fd); -if (is_xe_device (fd)) -xe_device_get (fd); igt_create_fb(fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888,
@@ -77,8 +75,6 @@ static void test(data_t *data, enum pipe pipe, igt_output_t *output) data);igt_assert_eq (ret,0 ); -if (is_xe_device (fd)) -xe_device_put (fd); ret =drm_close_driver (fd);igt_assert_eq (ret,0 );
tests/kms_getfb.c +1 -14
@@ -399,9 +399,6 @@ static void test_handle_protection(void) { igt_fixture { non_master_fd =drm_open_driver (DRIVER_ANY ); -if (is_xe_device (non_master_fd)) -xe_device_get (non_master_fd); - non_master_add.width =1024 ; non_master_add.height =1024 ; non_master_add.pixel_format =DRM_FORMAT_XRGB8888 ;
@@ -449,9 +446,6 @@ static void test_handle_protection(void) {do_ioctl (non_master_fd,DRM_IOCTL_MODE_RMFB , &non_master_add.fb_id);gem_close (non_master_fd, non_master_add.handles[0 ]); -if (is_xe_device (non_master_fd)) -xe_device_get (non_master_fd); -drm_close_driver (non_master_fd); } }
@@ -463,9 +457,6 @@ igt_main igt_fixture { fd =drm_open_driver_master (DRIVER_ANY );igt_require (has_getfb_iface (fd)); - -if (is_xe_device (fd)) -xe_device_get (fd); } igt_subtest_group
@@ -480,10 +471,6 @@ igt_mainigt_subtest_group test_handle_protection (); - igt_fixture { -if (is_xe_device (fd)) -xe_device_put (fd); - +igt_fixture drm_close_driver (fd ); - } }
tests/kms_hdmi_inject.c +0 -7
@@ -206,9 +206,6 @@ igt_mainigt_require (connector);kmstest_unset_all_crtcs (drm_fd, res); - -if (is_xe_device (drm_fd)) -xe_device_get (drm_fd); } igt_describe("Make sure that 4K modes exposed by DRM match the "
@@ -223,10 +220,6 @@ igt_main igt_fixture {drmModeFreeConnector (connector); - -if (is_xe_device (drm_fd)) -xe_device_put (drm_fd); -drm_close_driver (drm_fd); } }
tests/kms_setmode.c +0 -7
@@ -955,9 +955,6 @@ igt_main_args("det:", NULL, help_str, opt_handler, NULL) drm_resources =drmModeGetResources (drm_fd);igt_require (drm_resources); - -if (is_xe_device (drm_fd)) -xe_device_get (drm_fd); }for (i =0 ; i <ARRAY_SIZE (tests); i++) {
@@ -974,10 +971,6 @@ igt_main_args("det:", NULL, help_str, opt_handler, NULL) igt_fixture {drmModeFreeResources (drm_resources); - -if (is_xe_device (drm_fd)) -xe_device_put (drm_fd); -drm_close_driver (drm_fd); } }
tests/xe/xe_compute.c +2 -6
@@ -35,16 +35,12 @@ igt_main {int xe; - igt_fixture { +igt_fixture xe =drm_open_driver (DRIVER_XE ); -xe_device_get (xe); - } igt_subtest("compute-square")test_compute_square (xe); - igt_fixture { -xe_device_put (xe); +igt_fixture drm_close_driver (xe ); - } }
tests/xe/xe_create.c +2 -7
@@ -111,10 +111,8 @@ igt_main {int xe; - igt_fixture { +igt_fixture xe =drm_open_driver (DRIVER_XE ); -xe_device_get (xe); - } igt_subtest("create-invalid-size") {create_invalid_size (xe);
@@ -124,9 +122,6 @@ igt_maincreate_massive_size (xe); } - - igt_fixture { -xe_device_put (xe); +igt_fixture drm_close_driver (xe ); - } }
tests/xe/xe_debugfs.c +1 -5
@@ -240,14 +240,12 @@ static int opt_handler(int option, int option_index, void *input) igt_main_args("", long_options, help_str, opt_handler, NULL) { -struct xe_device *xe_dev;char devnode[PATH_MAX ];int fd;int gt; igt_fixture { fd =drm_open_driver (DRIVER_XE ); - xe_dev =xe_device_get (fd);__igt_debugfs_dump (fd,"info" ,IGT_LOG_INFO ); }
@@ -268,8 +266,6 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)test_forcewake (fd); } - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_dma_buf_sync.c +2 -9
@@ -113,7 +113,6 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0,for (i =0 ; i <N_FD ; ++i) { fd[i] =drm_open_driver (DRIVER_XE ); -xe_device_get (fd[0 ]); vm[i] =xe_vm_create (fd[i],0 ,0 ); engine[i] =xe_engine_create (fd[i], vm[i], !i ? hwe0 : hwe1,0 ); }
@@ -218,11 +217,8 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0,close (dma_buf_fd[i]); } -for (i =0 ; i <N_FD ; ++i) { -xe_device_put (fd[i]); +for (i =0 ; i <N_FD ; ++i)drm_close_driver (fd[i]); - } - } igt_main
@@ -232,7 +228,6 @@ igt_main igt_fixture { fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd);xe_for_each_hw_engine (fd, hwe)if (hwe0 ==NULL ) {
@@ -255,8 +250,6 @@ igt_main igt_subtest("export-dma-buf-many-read-sync")test_export_dma_buf (hwe0, hwe1,16 ,READ_SYNC ); - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_evict.c +0 -5
@@ -62,7 +62,6 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,igt_assert (bo); fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); vm =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 );if (flags &BIND_ENGINE )
@@ -200,7 +199,6 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,xe_vm_destroy (fd, vm2);xe_vm_destroy (fd, vm3); } -xe_device_put (fd);drm_close_driver (fd); }
@@ -239,7 +237,6 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci,igt_assert (bo); fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); vm =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS |DRM_XE_VM_CREATE_COMPUTE_MODE ,0 );
@@ -368,7 +365,6 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci,xe_vm_destroy (fd, vm);if (flags &MULTI_VM )xe_vm_destroy (fd, vm2); -xe_device_put (fd);drm_close_driver (fd); }
@@ -668,7 +664,6 @@ igt_main igt_fixture { fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd);igt_require (xe_has_vram (fd)); vram_size =xe_vram_size (fd,0 );igt_assert (vram_size);
tests/xe/xe_exec_balancer.c +2 -6
@@ -626,10 +626,8 @@ igt_mainint class;int fd; - igt_fixture { +igt_fixture fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); - }igt_subtest ("virtual-all-active" ) xe_for_each_gt(fd, gt)
@@ -706,8 +704,6 @@ igt_maintest_cm (fd, gt, class,1 ,0 , s->flags); } - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_exec_basic.c +2 -6
@@ -311,10 +311,8 @@ igt_main };int fd; - igt_fixture { +igt_fixture fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); - }for (const struct section *s = sections; s->name; s++) {igt_subtest_f ("once-%s" , s->name)
@@ -351,8 +349,6 @@ igt_maintest_exec (fd, hwe,1 ,0 ,1 , s->flags); } - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_exec_compute_mode.c +2 -6
@@ -327,10 +327,8 @@ igt_main };int fd; - igt_fixture { +igt_fixture fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); - }for (const struct section *s = sections; s->name; s++) {igt_subtest_f ("once-%s" , s->name)
@@ -359,8 +357,6 @@ igt_main s->flags); } - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_exec_fault_mode.c +1 -4
@@ -524,7 +524,6 @@ igt_main igt_fixture { fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd);igt_require (xe_supports_faults (fd)); }
@@ -568,8 +567,6 @@ igt_mainxe_for_each_hw_engine (fd, hwe)test_atomic (fd, hwe,8 ,WAIT_ATOMIC ); - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_exec_reset.c +5 -18
@@ -178,10 +178,8 @@ test_balancer(int fd, int gt, int class, int n_engines, int n_execs,igt_assert (n_engines <=MAX_N_ENGINES ); -if (flags &CLOSE_FD ) { +if (flags &CLOSE_FD ) fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); - }xe_for_each_hw_engine (fd, hwe) {if (hwe->engine_class != class || hwe->gt_id != gt)
@@ -293,7 +291,6 @@ test_balancer(int fd, int gt, int class, int n_engines, int n_execs,for (i =0 ; i < n_engines; i++)xe_engine_destroy (fd, engines[i]); } -xe_device_put (fd);drm_close_driver (fd);/* FIXME: wait for idle */ usleep (150000 );
@@ -388,10 +385,8 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci,igt_assert (n_engines <=MAX_N_ENGINES ); -if (flags &CLOSE_FD ) { +if (flags &CLOSE_FD ) fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); - } vm =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); bo_size =sizeof (*data) * n_execs;
@@ -474,7 +469,6 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci,for (i =0 ; i < n_engines; i++)xe_engine_destroy (fd, engines[i]); } -xe_device_put (fd);drm_close_driver (fd);/* FIXME: wait for idle */ usleep (150000 );
@@ -566,10 +560,8 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,igt_assert (n_engines <=MAX_N_ENGINES ); -if (flags &CLOSE_FD ) { +if (flags &CLOSE_FD ) fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); - } vm =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS |DRM_XE_VM_CREATE_COMPUTE_MODE ,0 );
@@ -654,7 +646,6 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,for (i =0 ; i < n_engines; i++)xe_engine_destroy (fd, engines[i]); } -xe_device_put (fd);drm_close_driver (fd);/* FIXME: wait for idle */ usleep (150000 );
@@ -831,10 +822,8 @@ igt_mainint class;int fd; - igt_fixture { +igt_fixture fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); - }igt_subtest ("spin" ) xe_for_each_hw_engine(fd, hwe)
@@ -944,8 +933,6 @@ igt_main igt_subtest("gt-reset-stress")gt_reset (fd,4 ,1 ); - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_exec_threads.c +4 -16
@@ -73,7 +73,6 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,if (!fd) { fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); owns_fd = true; }
@@ -243,10 +242,8 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr, }if (owns_vm)xe_vm_destroy (fd, vm); -if (owns_fd) { -xe_device_put (fd); +if (owns_fd)drm_close_driver (fd); - } } static void
@@ -282,7 +279,6 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,if (!fd) { fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); owns_fd = true; }
@@ -453,7 +449,6 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,if (owns_vm)xe_vm_destroy (fd, vm);if (owns_fd) { -xe_device_put (fd);drm_close_driver (fd); } }
@@ -491,7 +486,6 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,if (!fd) { fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); owns_fd = true; }
@@ -696,10 +690,8 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr, }if (owns_vm)xe_vm_destroy (fd, vm); -if (owns_fd) { -xe_device_put (fd); +if (owns_fd)drm_close_driver (fd); - } }struct thread_data {
@@ -1391,18 +1383,14 @@ igt_main };int fd; - igt_fixture { +igt_fixture fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); - }for (const struct section *s = sections; s->name; s++) { igt_subtest_f("threads-%s", s->name)threads (fd, s->flags); } - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_gpgpu_fill.c +0 -3
@@ -120,8 +120,6 @@ igt_main fill_fn =igt_get_gpgpu_fillfunc (data.devid);igt_require_f (fill_fn,"no gpgpu-fill function\n" ); - -xe_device_get (data.drm_fd); } igt_subtest("basic") {
@@ -129,7 +127,6 @@ igt_main } igt_fixture { -xe_device_put (data.drm_fd);buf_ops_destroy (data.bops);drm_close_driver (data.drm_fd); }
tests/xe/xe_guc_pc.c +0 -2
@@ -387,7 +387,6 @@ igt_main igt_fixture { fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); sysfs =igt_sysfs_open (fd);igt_assert (sysfs !=-1 );
@@ -495,7 +494,6 @@ igt_mainset_freq (sysfs, gt,"max" , stash_max); }close (sysfs); -xe_device_put (fd);drm_close_driver (fd); } }
tests/xe/xe_huc_copy.c +2 -6
@@ -176,10 +176,8 @@ igt_main {int xe; - igt_fixture { +igt_fixture xe =drm_open_driver (DRIVER_XE ); -xe_device_get (xe); - } igt_subtest("huc_copy") {/*
@@ -190,8 +188,6 @@ igt_maintest_huc_copy (xe); } - igt_fixture { -xe_device_put (xe); +igt_fixture drm_close_driver (xe ); - } }
tests/xe/xe_intel_bb.c +0 -2
@@ -1105,7 +1105,6 @@ igt_main_args("dpib", NULL, help_str, opt_handler, NULL) igt_fixture { xe =drm_open_driver (DRIVER_XE ); bops =buf_ops_create (xe); -xe_device_get (xe); }igt_describe ("Ensure reset is possible on fresh bb" );
@@ -1178,7 +1177,6 @@ igt_main_args("dpib", NULL, help_str, opt_handler, NULL) } igt_fixture { -xe_device_put (xe);buf_ops_destroy (bops);drm_close_driver (xe); }
tests/xe/xe_mmap.c +2 -6
@@ -61,10 +61,8 @@ igt_main {int fd; - igt_fixture { +igt_fixture fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); - } igt_subtest("system")test_mmap (fd,system_memory (fd));
@@ -75,8 +73,6 @@ igt_main igt_subtest("vram-system")test_mmap (fd,vram_memory (fd,0 ) |system_memory (fd)); - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_mmio.c +2 -6
@@ -77,18 +77,14 @@ igt_main {int fd; - igt_fixture { +igt_fixture fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); - } igt_subtest("mmio-timestamp")test_xe_mmio_timestamp (fd); igt_subtest("mmio-invalid")test_xe_mmio_invalid (fd); - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_noexec_ping_pong.c +0 -2
@@ -99,10 +99,8 @@ igt_simple_main { fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd);test_ping_pong (fd,xe_hw_engine (fd,0 )); -xe_device_put (fd);drm_close_driver (fd); }
tests/xe/xe_pm.c +0 -3
@@ -370,8 +370,6 @@ igt_main device.pci_xe =igt_device_get_pci_device (device.fd_xe); device.pci_root =igt_device_get_pci_root_port (device.fd_xe); -xe_device_get (device.fd_xe); -/* Always perform initial once-basic exec checking for health */ xe_for_each_hw_engine (device.fd_xe, hwe)test_exec (device, hwe,1 ,1 ,NO_SUSPEND ,NO_RPM );
@@ -440,7 +438,6 @@ igt_main igt_fixture {set_d3cold_allowed (device.pci_xe, d3cold_allowed);igt_restore_runtime_pm (); -xe_device_put (device.fd_xe);drm_close_driver (device.fd_xe); } }
tests/xe/xe_prime_self_import.c +1 -30
@@ -104,9 +104,7 @@ static void test_with_fd_dup(void) counter =0 ; fd1 =drm_open_driver (DRIVER_XE ); -xe_device_get (fd1); fd2 =drm_open_driver (DRIVER_XE ); -xe_device_get (fd2); handle =xe_bo_create (fd1,0 ,0 ,BO_SIZE );
@@ -121,9 +119,7 @@ static void test_with_fd_dup(void)close (dma_buf_fd2);check_bo (fd2, handle_import, fd2, handle_import); -xe_device_put (fd1);drm_close_driver (fd1); -xe_device_put (fd2);drm_close_driver (fd2); }
@@ -143,9 +139,7 @@ static void test_with_two_bos(void) counter =0 ; fd1 =drm_open_driver (DRIVER_XE ); -xe_device_get (fd1); fd2 =drm_open_driver (DRIVER_XE ); -xe_device_get (fd2); handle1 =xe_bo_create (fd1,0 ,0 ,BO_SIZE ); handle2 =xe_bo_create (fd1,0 ,0 ,BO_SIZE );
@@ -165,9 +159,7 @@ static void test_with_two_bos(void)check_bo (fd2, handle_import, fd2, handle_import); -xe_device_put (fd1);drm_close_driver (fd1); -xe_device_put (fd2);drm_close_driver (fd2); }
@@ -185,9 +177,7 @@ static void test_with_one_bo_two_files(void)int dma_buf_fd1, dma_buf_fd2; fd1 =drm_open_driver (DRIVER_XE ); -xe_device_get (fd1); fd2 =drm_open_driver (DRIVER_XE ); -xe_device_get (fd2); handle_orig =xe_bo_create (fd1,0 ,0 ,BO_SIZE ); dma_buf_fd1 =prime_handle_to_fd (fd1, handle_orig);
@@ -201,9 +191,7 @@ static void test_with_one_bo_two_files(void)/* dma-buf self importing an flink bo should give the same handle */ igt_assert_eq_u32 (handle_import, handle_open); -xe_device_put (fd1);drm_close_driver (fd1); -xe_device_put (fd2);drm_close_driver (fd2);close (dma_buf_fd1);close (dma_buf_fd2);
@@ -222,9 +210,7 @@ static void test_with_one_bo(void)int dma_buf_fd; fd1 =drm_open_driver (DRIVER_XE ); -xe_device_get (fd1); fd2 =drm_open_driver (DRIVER_XE ); -xe_device_get (fd2); handle =xe_bo_create (fd1,0 ,0 ,BO_SIZE );
@@ -258,10 +244,8 @@ static void test_with_one_bo(void)check_bo (fd1, handle, fd2, handle_import1);/* Completely rip out exporting fd. */ -xe_device_put (fd1);drm_close_driver (fd1);check_bo (fd2, handle_import1, fd2, handle_import1); -xe_device_put (fd2);drm_close_driver (fd2); }
@@ -314,7 +298,6 @@ static void *thread_fn_reimport_vs_close(void *p) threads =calloc (num_threads,sizeof (pthread_t)); fds[0 ] =drm_open_driver (DRIVER_XE ); -xe_device_get (fds[0 ]); handle =xe_bo_create (fds[0 ],0 ,0 ,BO_SIZE );
@@ -334,7 +317,6 @@ static void *thread_fn_reimport_vs_close(void *p) }pthread_barrier_destroy (&g_barrier); -xe_device_put (fds[0 ]);drm_close_driver (fds[0 ]);close (fds[1 ]);
@@ -406,13 +388,11 @@ static void test_export_close_race(void)/* Allocate exit handler fds in here so that we dont screw * up the counts */ fake =drm_open_driver (DRIVER_XE ); -xe_device_get (fake);/* TODO: Read object count */ obj_count =0 ; fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd);pthread_barrier_init (&g_barrier,NULL , num_threads);for (i =0 ; i < num_threads; i++) {
@@ -428,7 +408,6 @@ static void test_export_close_race(void) }pthread_barrier_destroy (&g_barrier); -xe_device_put (fd);drm_close_driver (fd);/* TODO: Read object count */
@@ -436,7 +415,6 @@ static void test_export_close_race(void)igt_info ("leaked %i objects\n" , obj_count); -xe_device_put (fake);drm_close_driver (fake);igt_assert_eq (obj_count,0 );
@@ -458,7 +436,6 @@ static void test_llseek_size(void) counter =0 ; fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd);for (i =0 ; i <10 ; i++) {int bufsz =xe_get_default_alignment (fd) << i;
@@ -473,7 +450,6 @@ static void test_llseek_size(void)close (dma_buf_fd); } -xe_device_put (fd);drm_close_driver (fd); }
@@ -493,7 +469,6 @@ static void test_llseek_bad(void) counter =0 ; fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); handle =xe_bo_create (fd,0 ,0 ,BO_SIZE ); dma_buf_fd =prime_handle_to_fd (fd, handle);
@@ -510,7 +485,6 @@ static void test_llseek_bad(void)close (dma_buf_fd); -xe_device_put (fd);drm_close_driver (fd); }
@@ -534,7 +508,6 @@ igt_main igt_fixture { fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); }for (i =0 ; i <ARRAY_SIZE (tests); i++) {
@@ -542,8 +515,6 @@ igt_main tests[i].fn (); } - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_query.c +2 -6
@@ -457,10 +457,8 @@ igt_main {int xe; - igt_fixture { +igt_fixture xe =drm_open_driver (DRIVER_XE ); -xe_device_get (xe); - } igt_subtest("query-engines")test_query_engines (xe);
@@ -489,8 +487,6 @@ igt_main igt_subtest("query-invalid-extension")test_query_invalid_extension (xe); - igt_fixture { -xe_device_put (xe); +igt_fixture drm_close_driver (xe ); - } }
tests/xe/xe_vm.c +1 -4
@@ -1621,7 +1621,6 @@ igt_main igt_fixture { fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd);xe_for_each_hw_engine (fd, hwe)if (hwe->engine_class !=DRM_XE_ENGINE_CLASS_COPY ) {
@@ -1837,8 +1836,6 @@ igt_main } } - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
tests/xe/xe_waitfence.c +2 -6
@@ -88,16 +88,12 @@ igt_main {int fd; - igt_fixture { +igt_fixture fd =drm_open_driver (DRIVER_XE ); -xe_device_get (fd); - } igt_subtest("test")test (fd); - igt_fixture { -xe_device_put (fd); +igt_fixture drm_close_driver (fd ); - } }
Signature · 1 line
2.40.0