[igt-dev] [PATCH i-g-t] i915/gem_tiled_wc: Reuse common gem_get_tiling

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Fri Jan 11 14:01:15 UTC 2019


On 11/01/2019 13:57, Chris Wilson wrote:
> get_tiling == gem_get_tiling + igt_require; so do that instead of
> opencoding the ioctl.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>   tests/i915/gem_tiled_wc.c | 23 +----------------------
>   1 file changed, 1 insertion(+), 22 deletions(-)
> 
> diff --git a/tests/i915/gem_tiled_wc.c b/tests/i915/gem_tiled_wc.c
> index 65ac38510..21390729d 100644
> --- a/tests/i915/gem_tiled_wc.c
> +++ b/tests/i915/gem_tiled_wc.c
> @@ -104,27 +104,6 @@ calculate_expected(int offset)
>   	return (base_y + tile_y) * WIDTH + base_x + tile_x;
>   }
>   
> -static void
> -get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle)
> -{
> -	struct drm_i915_gem_get_tiling2 {
> -		uint32_t handle;
> -		uint32_t tiling_mode;
> -		uint32_t swizzle_mode;
> -		uint32_t phys_swizzle_mode;
> -	} arg;
> -#define DRM_IOCTL_I915_GEM_GET_TILING2	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling2)
> -
> -	memset(&arg, 0, sizeof(arg));
> -	arg.handle = handle;
> -
> -	do_ioctl(fd, DRM_IOCTL_I915_GEM_GET_TILING2, &arg);
> -	igt_require(arg.phys_swizzle_mode == arg.swizzle_mode);
> -
> -	*tiling = arg.tiling_mode;
> -	*swizzle = arg.swizzle_mode;
> -}
> -
>   igt_simple_main
>   {
>   	int fd;
> @@ -136,7 +115,7 @@ igt_simple_main
>   	gem_require_mmap_wc(fd);
>   
>   	handle = create_bo(fd);
> -	get_tiling(fd, handle, &tiling, &swizzle);
> +	igt_require(gem_get_tiling(fd, handle, &tiling, &swizzle));
>   
>   	if (IS_GEN2(intel_get_drm_devid(fd))) {
>   		tile_height = 16;
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Regards,

Tvrtko


More information about the igt-dev mailing list