[PATCH i-g-t 2/2] tests/intel/xe_mmap: Use appropriate drm APIs

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri May 16 15:22:33 UTC 2025


Hi Kolanupaka,
On 2025-05-16 at 19:28:19 +0530, Kolanupaka Naveena wrote:

imho subject should rather read about fixing open/close:

[PATCH i-g-t 2/2] tests/intel/xe_mmap: Fix open/close calls

> Instead of using the standard drm_open and close APIs for driver
> open and close operations, use the appropriate drm_reopen and
> drm_close APIs to ensure the driver is opened and closed correctly.
> 

Also describe srand() removal here, for example:

Also while at this, drop srand() call as this is done by
igt_core.

With this fixed
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

Regards,
Kamil

> Suggested-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> Signed-off-by: Kolanupaka Naveena <kolanupaka.naveena at intel.com>
> ---
>  tests/intel/xe_mmap.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/intel/xe_mmap.c b/tests/intel/xe_mmap.c
> index 061b3de0a..abd144ac0 100644
> --- a/tests/intel/xe_mmap.c
> +++ b/tests/intel/xe_mmap.c
> @@ -436,8 +436,7 @@ igt_main
>  		uint32_t *ptr;
>  
>  		igt_require(is_pci_membarrier_supported(fd));
> -		xe = drm_open_driver(DRIVER_XE);
> -		srand(time(0));
> +		xe = drm_reopen_driver(fd);
>  		i = rand() % (PAGE_SIZE / sizeof(*ptr));
>  		fw_handle = igt_debugfs_open(fd, "forcewake_all", O_RDONLY);
>  		igt_assert_lte(0, fw_handle);
> @@ -447,7 +446,7 @@ igt_main
>  		igt_waitchildren();
>  
>  		close(fw_handle);
> -		close(xe);
> +		drm_close_driver(xe);
>  	}
>  
>  	igt_subtest("pci-membarrier-bad-pagesize") {
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list