[igt-dev] [PATCH 1/2] lib: prepare helpers for generic prime test

Ser, Simon simon.ser at intel.com
Thu Jul 4 10:26:22 UTC 2019


On Thu, 2019-07-04 at 12:56 +0300, Oleg Vasilev wrote:
> - Add vkms to gpu providers list
> - Expose fb_init

Maybe this commit could be split into two?

> Signed-off-by: Oleg Vasilev <oleg.vasilev at intel.com>
> ---
>  lib/drmtest.c |  1 +
>  lib/drmtest.h |  1 +
>  lib/igt_fb.c  | 38 ++++++++++++++++++--------------------
>  lib/igt_fb.h  |  4 ++++
>  4 files changed, 24 insertions(+), 20 deletions(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 25f20353..81f4bf32 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -210,6 +210,7 @@ static const struct module {
>  	{ DRIVER_V3D, "v3d" },
>  	{ DRIVER_VC4, "vc4" },
>  	{ DRIVER_VGEM, "vgem" },
> +	{ DRIVER_VKMS, "vkms" },
>  	{ DRIVER_VIRTIO, "virtio_gpu", modprobe_virtio },
>  	{}
>  };
> diff --git a/lib/drmtest.h b/lib/drmtest.h
> index 6c4c3899..d4043ff1 100644
> --- a/lib/drmtest.h
> +++ b/lib/drmtest.h
> @@ -45,6 +45,7 @@
>  #define DRIVER_AMDGPU	(1 << 4)
>  #define DRIVER_V3D	(1 << 5)
>  #define DRIVER_PANFROST	(1 << 6)
> +#define DRIVER_VKMS	(1 << 7)
>  /*
>   * Exclude DRVER_VGEM from DRIVER_ANY since if you run on a system
>   * with vgem as well as a supported driver, you can end up with a
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 415a3d65..49c1dbe4 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -485,12 +485,10 @@ static int fb_num_planes(const struct igt_fb *fb)
>  		return format->num_planes;
>  }
>  
> -static void fb_init(struct igt_fb *fb,
> -		    int fd, int width, int height,
> -		    uint32_t drm_format,
> -		    uint64_t modifier,
> -		    enum igt_color_encoding color_encoding,
> -		    enum igt_color_range color_range)
> +void igt_init_fb(struct igt_fb *fb, int fd, int width, int height,
> +		 uint32_t drm_format, uint64_t modifier,
> +		 enum igt_color_encoding color_encoding,
> +		 enum igt_color_range color_range)
>  {
>  	const struct format_desc_struct *f = lookup_drm_format(drm_format);
>  
> @@ -627,8 +625,8 @@ void igt_calc_fb_size(int fd, int width, int height, uint32_t drm_format, uint64
>  {
>  	struct igt_fb fb;
>  
> -	fb_init(&fb, fd, width, height, drm_format, modifier,
> -		IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
> +	igt_init_fb(&fb, fd, width, height, drm_format, modifier,
> +		    IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
>  
>  	fb.size = calc_fb_size(&fb);
>  
> @@ -855,8 +853,8 @@ void igt_create_bo_for_fb(int fd, int width, int height,
>  			  uint32_t format, uint64_t modifier,
>  			  struct igt_fb *fb /* out */)
>  {
> -	fb_init(fb, fd, width, height, format, modifier,
> -		IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
> +	igt_init_fb(fb, fd, width, height, format, modifier,
> +		    IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
>  	create_bo_for_fb(fb);
>  }
>  
> @@ -885,8 +883,8 @@ int igt_create_bo_with_dimensions(int fd, int width, int height,
>  {
>  	struct igt_fb fb;
>  
> -	fb_init(&fb, fd, width, height, format, modifier,
> -		IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
> +	igt_init_fb(&fb, fd, width, height, format, modifier,
> +		    IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
>  
>  	for (int i = 0; i < fb.num_planes; i++)
>  		fb.strides[i] = stride;
> @@ -1440,8 +1438,8 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
>  	enum igt_color_range color_range = IGT_COLOR_YCBCR_LIMITED_RANGE;
>  	uint32_t flags = 0;
>  
> -	fb_init(fb, fd, width, height, format, modifier,
> -		color_encoding, color_range);
> +	igt_init_fb(fb, fd, width, height, format, modifier,
> +		    color_encoding, color_range);
>  
>  	for (int i = 0; i < fb->num_planes; i++)
>  		fb->strides[i] = bo_stride;
> @@ -1971,9 +1969,9 @@ static void setup_linear_mapping(struct fb_blit_upload *blit)
>  	 * destination, tiling it at the same time.
>  	 */
>  
> -	fb_init(&linear->fb, fb->fd, fb->width, fb->height,
> -		fb->drm_format, LOCAL_DRM_FORMAT_MOD_NONE,
> -		fb->color_encoding, fb->color_range);
> +	igt_init_fb(&linear->fb, fb->fd, fb->width, fb->height,
> +		    fb->drm_format, LOCAL_DRM_FORMAT_MOD_NONE,
> +		    fb->color_encoding, fb->color_range);
>  
>  	create_bo_for_fb(&linear->fb);
>  
> @@ -2127,9 +2125,9 @@ static void *igt_fb_create_cairo_shadow_buffer(int fd,
>  
>  	igt_assert(shadow);
>  
> -	fb_init(shadow, fd, width, height,
> -		drm_format, LOCAL_DRM_FORMAT_MOD_NONE,
> -		IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
> +	igt_init_fb(shadow, fd, width, height,
> +		    drm_format, LOCAL_DRM_FORMAT_MOD_NONE,
> +		    IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
>  
>  	shadow->strides[0] = ALIGN(width * (shadow->plane_bpp[0] / 8), 16);
>  	shadow->size = ALIGN((uint64_t)shadow->strides[0] * height,
> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> index be786911..3746fa1a 100644
> --- a/lib/igt_fb.h
> +++ b/lib/igt_fb.h
> @@ -117,6 +117,10 @@ void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
>  			  unsigned *width_ret, unsigned *height_ret);
>  void igt_calc_fb_size(int fd, int width, int height, uint32_t format, uint64_t modifier,
>  		      uint64_t *size_ret, unsigned *stride_ret);
> +void igt_init_fb(struct igt_fb *fb, int fd, int width, int height,
> +		 uint32_t drm_format, uint64_t modifier,
> +		 enum igt_color_encoding color_encoding,
> +		 enum igt_color_range color_range);
>  unsigned int
>  igt_create_fb_with_bo_size(int fd, int width, int height,
>  			   uint32_t format, uint64_t modifier,


More information about the igt-dev mailing list