[igt-dev] [PATCH i-g-t v4 15/25] tests/kms_flip.c: Remove libdrm dependency

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Sep 23 13:07:43 UTC 2020


On Tue, Sep 22, 2020 at 01:52:19PM +0200, Dominik Grzegorzek wrote:
> Use intel_bb / intel_buf to remove libdrm dependency.
> 
> Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  tests/kms_flip.c | 22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index b33cfe9c..525cccc7 100755
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -86,8 +86,7 @@
>  
>  drmModeRes *resources;
>  int drm_fd;
> -static drm_intel_bufmgr *bufmgr;
> -struct intel_batchbuffer *batch;
> +static struct buf_ops *bops;
>  uint32_t devid;
>  int test_time = 3;
>  static bool monotonic_timestamp;
> @@ -211,20 +210,19 @@ static void emit_fence_stress(struct test_output *o)
>  	struct drm_i915_gem_execbuffer2 execbuf;
>  	struct drm_i915_gem_exec_object2 *exec;
>  	uint32_t buf[2] = { MI_BATCH_BUFFER_END, 0 };
> -	drm_intel_bo **bo;
> +	struct intel_buf **bo;
>  	int i;
>  
> -	igt_require(bufmgr);
> +	igt_require(bops);
>  
>  	igt_assert(num_fences);
>  	bo = calloc(sizeof(*bo), num_fences);
>  	exec = calloc(sizeof(*exec), num_fences+1);
>  	for (i = 0; i < num_fences - 1; i++) {
>  		uint32_t tiling = I915_TILING_X;
> -		unsigned long pitch = 0;
> -		bo[i] = drm_intel_bo_alloc_tiled(bufmgr,
> -						 "X tiled bo", 1024, 1024, 4,
> -						 &tiling, &pitch, 0);
> +		bo[i] = intel_buf_create(bops, 1024, 1024, 32, 4096, tiling,
> +					 I915_COMPRESSION_NONE);
> +

Small nit - 4096 above is for linear surface, so pass 0 here. And it is
stride alignment, not page. 

Fix above and you have:

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

>  		exec[i].handle = bo[i]->handle;
>  		exec[i].flags = EXEC_OBJECT_NEEDS_FENCE;
>  	}
> @@ -244,7 +242,7 @@ static void emit_fence_stress(struct test_output *o)
>  
>  	gem_close(drm_fd, exec[i].handle);
>  	for (i = 0; i < num_fences - 1; i++)
> -		drm_intel_bo_unreference(bo[i]);
> +		intel_buf_destroy(bo[i]);
>  	free(bo);
>  	free(exec);
>  }
> @@ -1664,11 +1662,7 @@ igt_main
>  		get_timestamp_format();
>  
>  		if (is_i915_device(drm_fd)) {
> -			bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
> -			if (bufmgr) {
> -				devid = intel_get_drm_devid(drm_fd);
> -				batch = intel_batchbuffer_alloc(bufmgr, devid);
> -			}
> +			bops = buf_ops_create(drm_fd);
>  		}
>  	}
>  
> -- 
> 2.20.1
> 


More information about the igt-dev mailing list