[Intel-gfx] [PATCH i-g-t 1/2] Prep work for adding NV12 testcase

Vidya Srinivas vidya.srinivas at intel.com
Wed Jul 26 08:47:12 UTC 2017


From: chandra konduru <chandra.konduru at intel.com>

This patch adds necessary prep work for nv12 testcase:
- updated fb allocation functions to handle NV12 format
- igt helper function to return png image size
- igt helper function to calculate start of uv in a given NV12 buffer
- igt helper function to map buffer for host access
- populates fb->...[4] parameters for NV12
- igt helper function to convert RGB data to NV12
- updated drm_format to bpp to handle NV12
- updated fast copy blit function to deal NV12 subplanes
- made an update to few tests due to above changes

v1: Reference https://patchwork.freedesktop.org/patch/57590/
	Was previously posted by Chandra Konduru
	on Aug 20 2015 based on the IGT
	framework available at that time.

v2: Rebased as per the current IGT framework/changes (me)

Signed-off-by: Chandra Konduru <chandra.konduru at intel.com>
Signed-off-by: Vidya Srinivas <vidya.srinivas at intel.com>
---
 lib/igt_draw.c                   |   2 +-
 lib/igt_fb.c                     | 189 ++++++++++++++++++++++++++++++++-------
 lib/igt_fb.h                     |  12 ++-
 lib/intel_batchbuffer.c          |  14 +--
 lib/intel_batchbuffer.h          |   3 +-
 lib/intel_reg.h                  |   1 +
 lib/ioctl_wrappers.c             |   9 ++
 lib/ioctl_wrappers.h             |   1 +
 tests/kms_frontbuffer_tracking.c |   6 +-
 tests/kms_render.c               |   4 +-
 tests/kms_rotation_crc.c         |   8 +-
 tests/prime_vgem.c               |   2 +-
 12 files changed, 202 insertions(+), 49 deletions(-)

diff --git a/lib/igt_draw.c b/lib/igt_draw.c
index db55cd9..512e964 100644
--- a/lib/igt_draw.c
+++ b/lib/igt_draw.c
@@ -652,7 +652,7 @@ void igt_draw_rect_fb(int fd, drm_intel_bufmgr *bufmgr,
 {
 	igt_draw_rect(fd, bufmgr, context, fb->gem_handle, fb->size, fb->stride,
 		      method, rect_x, rect_y, rect_w, rect_h, color,
-		      igt_drm_format_to_bpp(fb->drm_format));
+		      igt_drm_format_to_bpp(fb->drm_format, 0));
 }
 
 /**
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 93e21c1..f313289 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -131,6 +131,33 @@ static void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 	}
 }
 
+void igt_fb_calc_uv(struct igt_fb *fb)
+{
+	if (fb->drm_format != DRM_FORMAT_NV12)
+		return;
+
+	switch (fb->tiling) {
+		case LOCAL_DRM_FORMAT_MOD_NONE:
+			fb->uv_y_start = fb->height;
+			break;
+		case LOCAL_I915_FORMAT_MOD_X_TILED:
+			fb->uv_y_start = fb->height;
+			break;
+		case LOCAL_I915_FORMAT_MOD_Y_TILED:
+			fb->uv_y_start = fb->height;
+			break;
+		case LOCAL_I915_FORMAT_MOD_Yf_TILED:
+			if (fb->height % 64)
+				fb->uv_y_start = (fb->height + 63) & ~63;
+			else
+				fb->uv_y_start = fb->height;
+			break;
+		default:
+			igt_assert(0);
+	}
+	fb->uv_offset = fb->uv_y_start * fb->stride;
+}
+
 /**
  * igt_calc_fb_size:
  * @fd: the DRM file descriptor
@@ -144,7 +171,7 @@ static void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
  * This function returns valid stride and size values for a framebuffer with the
  * specified parameters.
  */
-void igt_calc_fb_size(int fd, int width, int height, int bpp, uint64_t tiling,
+void igt_calc_fb_size(int fd, int width, int height, int bpp, uint32_t format, uint64_t tiling,
 		      unsigned *size_ret, unsigned *stride_ret)
 {
 	unsigned int tile_width, tile_height, stride, size;
@@ -168,12 +195,13 @@ void igt_calc_fb_size(int fd, int width, int height, int bpp, uint64_t tiling,
 		for (stride = 512; stride < v; stride *= 2)
 			;
 
-		v = stride * height;
+		/* planar formats height is 1.5x */
+		v = stride * (format == DRM_FORMAT_NV12 ? (height * 3) / 2 : height);
 		for (size = 1024*1024; size < v; size *= 2)
 			;
 	} else {
 		stride = ALIGN(byte_width, tile_width);
-		size = stride * ALIGN(height, tile_height);
+		size = stride * (format == DRM_FORMAT_NV12 ? (ALIGN(height, tile_height) * 3) / 2 : ALIGN(height, tile_height));
 	}
 
 	*stride_ret = stride;
@@ -212,13 +240,13 @@ static int create_bo_for_fb(int fd, int width, int height, uint32_t format,
 			    unsigned *size_ret, unsigned *stride_ret,
 			    bool *is_dumb)
 {
-	int bpp = igt_drm_format_to_bpp(format);
+	int bpp = igt_drm_format_to_bpp(format, 0);
 	int bo;
 
-	if (tiling || size || stride) {
+	if (tiling || size || stride || (format == DRM_FORMAT_NV12)) {
 		unsigned calculated_size, calculated_stride;
 
-		igt_calc_fb_size(fd, width, height, bpp, tiling,
+		igt_calc_fb_size(fd, width, height, bpp, format, tiling,
 				 &calculated_size, &calculated_stride);
 		if (stride == 0)
 			stride = calculated_stride;
@@ -547,6 +575,22 @@ stdio_read_func(void *closure, unsigned char* data, unsigned int size)
 	return CAIRO_STATUS_SUCCESS;
 }
 
+void igt_get_image_size(const char *filename, int *width, int *height)
+{
+	cairo_surface_t *image;
+	FILE* f;
+
+	f = igt_fopen_data(filename);
+	image = cairo_image_surface_create_from_png_stream(&stdio_read_func, f);
+	igt_assert(cairo_surface_status(image) == CAIRO_STATUS_SUCCESS);
+
+	*width = cairo_image_surface_get_width(image);
+	*height = cairo_image_surface_get_height(image);
+
+	cairo_surface_destroy(image);
+	fclose(f);
+}
+
 /**
  * igt_paint_image:
  * @cr: cairo drawing context
@@ -633,38 +677,112 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 	igt_debug("%s(handle=%d, pitch=%d)\n",
 		  __func__, fb->gem_handle, fb->stride);
 
-	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
-	    tiling != LOCAL_I915_FORMAT_MOD_X_TILED) {
-		do_or_die(__kms_addfb(fd, fb->gem_handle, width, height,
-				      fb->stride, format, tiling,
-				      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id));
-	} else {
-		uint32_t handles[4];
-		uint32_t pitches[4];
-		uint32_t offsets[4];
-
-		memset(handles, 0, sizeof(handles));
-		memset(pitches, 0, sizeof(pitches));
-		memset(offsets, 0, sizeof(offsets));
-
-		handles[0] = fb->gem_handle;
-		pitches[0] = fb->stride;
-
-		do_or_die(drmModeAddFB2(fd, width, height, format,
-					handles, pitches, offsets,
-					&fb_id, 0));
-	}
-
 	fb->width = width;
 	fb->height = height;
 	fb->tiling = tiling;
 	fb->drm_format = format;
-	fb->fb_id = fb_id;
 	fb->fd = fd;
 
+	igt_fb_calc_uv(fb);
+
+	do_or_die(__kms_addfb(fd, fb->gem_handle, width, height,
+				      fb->stride, format, tiling, fb->uv_offset,
+				      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id));
+
+	fb->fb_id = fb_id;
+
 	return fb_id;
 }
 
+void igt_fb_gem_mmap(int fd, struct igt_fb *fb)
+{
+	if (!fb->mmap_gtt)
+		fb->mmap_gtt = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
+		PROT_READ | PROT_WRITE);
+	igt_assert(fb->mmap_gtt);
+}
+
+void igt_fb_csc_xrgb_to_nv12(int fd, struct igt_fb *dst_fb, struct igt_fb *src_fb)
+{
+	unsigned char *nv12;
+	unsigned char *xrgb;
+	unsigned char y, v, u;
+	float yf, vf, uf;
+	unsigned char r, g, b;
+	int i, j, xrgb_pos, y_pos, uv_pos, uv_base;
+	unsigned int obj_tiling;
+	struct igt_fb *temp_src_fb, *temp_dst_fb;
+	struct igt_fb fb1, fb2;
+	int temp_src_id, temp_dst_id;
+
+	if (src_fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+		src_fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
+		temp_src_fb = &fb1;
+		temp_dst_fb = &fb2;
+		temp_src_id = igt_create_fb(fd, src_fb->width, src_fb->height,
+						src_fb->drm_format, LOCAL_DRM_FORMAT_MOD_NONE, temp_src_fb);
+		temp_dst_id = igt_create_fb(fd, dst_fb->width, dst_fb->height,
+						dst_fb->drm_format, LOCAL_DRM_FORMAT_MOD_NONE, temp_dst_fb);
+		if (src_fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED)
+			obj_tiling = I915_TILING_Y;
+		else
+			obj_tiling = I915_TILING_Yf;
+
+		igt_blitter_fast_copy__raw(fd, src_fb->gem_handle, src_fb->stride, obj_tiling,
+					0, 0, temp_src_fb->width, temp_src_fb->height, igt_drm_format_to_bpp(temp_src_fb->drm_format, 0),
+					temp_src_fb->gem_handle, temp_src_fb->stride, I915_TILING_NONE, 0, 0);
+	}
+	else {
+		temp_src_fb = src_fb;
+		temp_dst_fb = dst_fb;
+	}
+
+	igt_fb_gem_mmap(fd, temp_src_fb);
+	igt_fb_gem_mmap(fd, temp_dst_fb);
+
+	xrgb = (unsigned char *) temp_src_fb->mmap_gtt;
+	nv12 = (unsigned char *) temp_dst_fb->mmap_gtt;
+	uv_base = temp_dst_fb->stride * temp_dst_fb->height;
+
+	for (i = 0; i < temp_src_fb->height; i++) {
+		xrgb_pos = i * temp_src_fb->stride;
+		y_pos = i * temp_dst_fb->stride;
+		uv_pos = temp_dst_fb->stride * i / 2;
+		for (j = 0; j < temp_src_fb->width; j++) {
+			b = xrgb[xrgb_pos++];
+			g = xrgb[xrgb_pos++];
+			r = xrgb[xrgb_pos++];
+			xrgb_pos++;
+			yf =  (0.257 * r) + (0.504 * g) + (0.098 * b) + 16;
+			uf = -(0.148 * r) - (0.291 * g) + (0.439 * b) + 128;
+			vf =  (0.439 * r) - (0.368 * g) - (0.071 * b) + 128;
+			y = (unsigned char) yf;
+			u = (unsigned char) uf;
+			v = (unsigned char) vf;
+			nv12[y_pos++] = y;
+			if (!(j % 2) && !(i % 2)) {
+				nv12[uv_base + uv_pos++] = u;
+				nv12[uv_base + uv_pos++] = v;
+			}
+		}
+	}
+
+	if (dst_fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+		dst_fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
+		igt_blitter_fast_copy__raw(fd, temp_dst_fb->gem_handle, temp_dst_fb->stride,
+				I915_TILING_NONE, 0, 0, dst_fb->width, dst_fb->height,
+				igt_drm_format_to_bpp(dst_fb->drm_format, 0), dst_fb->gem_handle,
+				dst_fb->stride, obj_tiling, 0, 0);
+		igt_blitter_fast_copy__raw(fd, temp_dst_fb->gem_handle, temp_dst_fb->stride,
+				I915_TILING_NONE, 0, temp_dst_fb->uv_y_start, dst_fb->width, dst_fb->height,
+				igt_drm_format_to_bpp(dst_fb->drm_format, 1), dst_fb->gem_handle,
+				dst_fb->stride, obj_tiling, 0, dst_fb->uv_y_start);
+
+		igt_remove_fb(fd, temp_src_fb);
+		igt_remove_fb(fd, temp_dst_fb);
+	}
+}
+
 /**
  * igt_create_fb:
  * @fd: open i915 drm file descriptor
@@ -1000,6 +1118,7 @@ static void destroy_cairo_surface__blit(void *arg)
 				   I915_TILING_NONE,
 				   0, 0, /* src_x, src_y */
 				   fb->width, fb->height,
+				   0,
 				   fb->gem_handle,
 				   fb->stride,
 				   obj_tiling,
@@ -1047,6 +1166,7 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
 				   obj_tiling,
 				   0, 0, /* src_x, src_y */
 				   fb->width, fb->height,
+				   igt_drm_format_to_bpp(fb->drm_format, 0),
 				   blit->linear.handle,
 				   blit->linear.stride,
 				   I915_TILING_NONE,
@@ -1229,10 +1349,19 @@ uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth)
  * The bits per pixel for the given drm fourcc pixel format code. Fails hard if
  * no match was found.
  */
-uint32_t igt_drm_format_to_bpp(uint32_t drm_format)
+uint32_t igt_drm_format_to_bpp(uint32_t drm_format, int plane)
 {
 	struct format_desc_struct *f;
 
+	if (drm_format == DRM_FORMAT_NV12 && plane == 0)
+		return 8;
+
+	else if(drm_format == DRM_FORMAT_NV12 && plane == 1)
+		return 16;
+
+	if (plane)
+		return 0;
+
 	for_each_format(f)
 		if (f->drm_id == drm_format)
 			return f->bpp;
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index f8a845c..0e93d80 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -72,6 +72,9 @@ typedef struct igt_fb {
 	uint64_t tiling;
 	unsigned int size;
 	cairo_surface_t *cairo_surface;
+	void *mmap_gtt;
+	uint32_t uv_y_start;
+	uint32_t uv_offset;
 	unsigned int domain;
 } igt_fb_t;
 
@@ -95,7 +98,10 @@ enum igt_text_align {
 	align_hcenter	= 0x08,
 };
 
-void igt_calc_fb_size(int fd, int width, int height, int bpp, uint64_t tiling,
+void igt_fb_gem_mmap(int fd, struct igt_fb *fb);
+void igt_fb_csc_xrgb_to_nv12(int fd, struct igt_fb *dst, struct igt_fb *src);
+void igt_fb_calc_uv(struct igt_fb *fb);
+void igt_calc_fb_size(int fd, int width, int height, int bpp, uint32_t format, uint64_t tiling,
 		      unsigned *size_ret, unsigned *stride_ret);
 unsigned int
 igt_create_fb_with_bo_size(int fd, int width, int height,
@@ -152,9 +158,11 @@ int igt_cairo_printf_line(cairo_t *cr, enum igt_text_align align,
 
 /* helpers to handle drm fourcc codes */
 uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth);
-uint32_t igt_drm_format_to_bpp(uint32_t drm_format);
+uint32_t igt_drm_format_to_bpp(uint32_t drm_format, int plane);
 const char *igt_format_str(uint32_t drm_format);
 void igt_get_all_cairo_formats(const uint32_t **formats, int *format_count);
 
+void igt_get_image_size(const char *filename, int *width, int *height);
+
 #endif /* __IGT_FB_H__ */
 
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 5344989..1e11e90 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -519,7 +519,7 @@ static uint32_t fast_copy_dword0(unsigned int src_tiling,
 }
 
 static uint32_t fast_copy_dword1(unsigned int src_tiling,
-				 unsigned int dst_tiling)
+				 unsigned int dst_tiling, uint32_t color_depth)
 {
 	uint32_t dword1 = 0;
 
@@ -528,7 +528,10 @@ static uint32_t fast_copy_dword1(unsigned int src_tiling,
 	if (dst_tiling == I915_TILING_Yf)
 		dword1 |= XY_FAST_COPY_DST_TILING_Yf;
 
-	dword1 |= XY_FAST_COPY_COLOR_DEPTH_32;
+	if (color_depth == 8)
+		dword1 |= XY_FAST_COPY_COLOR_DEPTH_8;
+	else
+		dword1 |= XY_FAST_COPY_COLOR_DEPTH_32;
 
 	return dword1;
 }
@@ -603,6 +606,7 @@ void igt_blitter_fast_copy__raw(int fd,
 
 				/* size */
 				unsigned int width, unsigned int height,
+				uint32_t color_depth,
 
 				/* dst */
 				uint32_t dst_handle,
@@ -621,7 +625,7 @@ void igt_blitter_fast_copy__raw(int fd,
 	src_pitch = fast_copy_pitch(src_stride, src_tiling);
 	dst_pitch = fast_copy_pitch(dst_stride, dst_tiling);
 	dword0 = fast_copy_dword0(src_tiling, dst_tiling);
-	dword1 = fast_copy_dword1(src_tiling, dst_tiling);
+	dword1 = fast_copy_dword1(src_tiling, dst_tiling, color_depth);
 
 #define CHECK_RANGE(x)	((x) >= 0 && (x) < (1 << 15))
 	assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) &&
@@ -681,7 +685,7 @@ void igt_blitter_fast_copy__raw(int fd,
  */
 void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
 			   struct igt_buf *src, unsigned src_x, unsigned src_y,
-			   unsigned width, unsigned height,
+			   unsigned width, unsigned height, uint32_t color_depth,
 			   struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
 {
 	uint32_t src_pitch, dst_pitch;
@@ -690,7 +694,7 @@ void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
 	src_pitch = fast_copy_pitch(src->stride, src->tiling);
 	dst_pitch = fast_copy_pitch(dst->stride, src->tiling);
 	dword0 = fast_copy_dword0(src->tiling, dst->tiling);
-	dword1 = fast_copy_dword1(src->tiling, dst->tiling);
+	dword1 = fast_copy_dword1(src->tiling, dst->tiling, color_depth);
 
 #define CHECK_RANGE(x)	((x) >= 0 && (x) < (1 << 15))
 	assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) &&
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index 869747d..4bdac0e 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -227,7 +227,7 @@ unsigned igt_buf_height(struct igt_buf *buf);
 
 void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
 			  struct igt_buf *src, unsigned src_x, unsigned src_y,
-			  unsigned width, unsigned height,
+			  unsigned width, unsigned height, uint32_t color_depth,
 			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y);
 
 void igt_blitter_fast_copy__raw(int fd,
@@ -239,6 +239,7 @@ void igt_blitter_fast_copy__raw(int fd,
 
 				/* size */
 				unsigned int width, unsigned int height,
+				uint32_t color_depth,
 
 				/* dst */
 				uint32_t dst_handle,
diff --git a/lib/intel_reg.h b/lib/intel_reg.h
index 3a28c08..c4c6775 100644
--- a/lib/intel_reg.h
+++ b/lib/intel_reg.h
@@ -2530,6 +2530,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 /* dword 1 */
 #define   XY_FAST_COPY_SRC_TILING_Yf			(1 <<  31)
 #define   XY_FAST_COPY_DST_TILING_Yf			(1 <<  30)
+#define   XY_FAST_COPY_COLOR_DEPTH_8            (0  << 24)
 #define   XY_FAST_COPY_COLOR_DEPTH_32			(3  << 24)
 
 #define MI_STORE_DWORD_IMM		((0x20<<23)|2)
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 51000ba..85a3d1b 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -55,6 +55,7 @@
 #include "intel_io.h"
 #include "igt_debugfs.h"
 #include "config.h"
+#include "igt_fb.h"
 
 #ifdef HAVE_VALGRIND
 #include <valgrind/valgrind.h>
@@ -1827,6 +1828,7 @@ void igt_require_fb_modifiers(int fd)
 
 int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height,
 		uint32_t stride, uint32_t pixel_format, uint64_t modifier,
+		uint32_t uv_offset,
 		uint32_t flags, uint32_t *buf_id)
 {
 	struct local_drm_mode_fb_cmd2 f;
@@ -1844,6 +1846,13 @@ int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height,
 	f.pitches[0] = stride;
 	f.modifier[0] = modifier;
 
+	if (pixel_format == DRM_FORMAT_NV12) {
+		f.handles[1] = handle;
+		f.pitches[1] = stride;
+		f.offsets[1] = uv_offset;
+		f.modifier[1] = modifier;
+	}
+
 	ret = igt_ioctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f);
 
 	*buf_id = f.fb_id;
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 8915edc..944f302 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -253,6 +253,7 @@ void igt_require_fb_modifiers(int fd);
  */
 int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height,
 		uint32_t stride, uint32_t pixel_format, uint64_t modifier,
+		uint32_t uv_offset,
 		uint32_t flags, uint32_t *buf_id);
 
 /**
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index e03524f..45d3870 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -576,13 +576,13 @@ static void create_fb(enum pixel_format pformat, int width, int height,
 	 * the same size regardless of tiling since we want to properly exercise
 	 * the Kernel's specific tiling-checking code paths without accidentally
 	 * hitting size-checking ones first. */
-	bpp = igt_drm_format_to_bpp(format);
+	bpp = igt_drm_format_to_bpp(format, 0);
 	if (plane == PLANE_CUR)
 		tiling_for_size = LOCAL_DRM_FORMAT_MOD_NONE;
 	else
 		tiling_for_size = opt.tiling;
 
-	igt_calc_fb_size(drm.fd, width, height, bpp, tiling_for_size, &size,
+	igt_calc_fb_size(drm.fd, width, height, bpp, format, tiling_for_size, &size,
 			 &stride);
 
 	igt_create_fb_with_bo_size(drm.fd, width, height, format, tiling, fb,
@@ -1208,7 +1208,7 @@ static void start_busy_thread(struct igt_fb *fb)
 	busy_thread.width = fb->width;
 	busy_thread.height = fb->height;
 	busy_thread.color = pick_color(fb, COLOR_PRIM_BG);
-	busy_thread.bpp = igt_drm_format_to_bpp(fb->drm_format);
+	busy_thread.bpp = igt_drm_format_to_bpp(fb->drm_format, 0);
 
 	rc = pthread_create(&busy_thread.thread, NULL, busy_thread_func, NULL);
 	igt_assert_eq(rc, 0);
diff --git a/tests/kms_render.c b/tests/kms_render.c
index fd33dfb..e959e88 100644
--- a/tests/kms_render.c
+++ b/tests/kms_render.c
@@ -80,8 +80,8 @@ static void gpu_blit(struct igt_fb *dst_fb, struct igt_fb *src_fb)
 
 	igt_assert(dst_fb->drm_format == src_fb->drm_format);
 	igt_assert(src_fb->drm_format == DRM_FORMAT_RGB565 ||
-	       igt_drm_format_to_bpp(src_fb->drm_format) != 16);
-	bpp = igt_drm_format_to_bpp(src_fb->drm_format);
+	       igt_drm_format_to_bpp(src_fb->drm_format, 0) != 16);
+	bpp = igt_drm_format_to_bpp(src_fb->drm_format, 0);
 	dst_bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "destination",
 					 dst_fb->gem_handle);
 	igt_assert(dst_bo);
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 83e37f1..40e50aa 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -391,7 +391,7 @@ static void test_plane_rotation_ytiled_obj(data_t *data,
 	igt_display_t *display = &data->display;
 	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
 	uint32_t format = DRM_FORMAT_XRGB8888;
-	int bpp = igt_drm_format_to_bpp(format);
+	int bpp = igt_drm_format_to_bpp(format, 0);
 	enum igt_commit_style commit = COMMIT_LEGACY;
 	int fd = data->gfx_fd;
 	igt_plane_t *plane;
@@ -426,7 +426,7 @@ static void test_plane_rotation_ytiled_obj(data_t *data,
 	igt_assert_eq(ret, 0);
 
 	do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
-		  format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+		  format, tiling, 0, LOCAL_DRM_MODE_FB_MODIFIERS,
 		  &data->fb.fb_id));
 	data->fb.width = w;
 	data->fb.height = h;
@@ -461,7 +461,7 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
 	igt_display_t *display = &data->display;
 	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
 	uint32_t format = DRM_FORMAT_XRGB8888;
-	int bpp = igt_drm_format_to_bpp(format);
+	int bpp = igt_drm_format_to_bpp(format, 0);
 	enum igt_commit_style commit = COMMIT_LEGACY;
 	int fd = data->gfx_fd;
 	igt_plane_t *plane;
@@ -513,7 +513,7 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
 		}
 
 		ret = (__kms_addfb(fd, gem_handle, w, h, stride,
-		       format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+		       format, tiling, 0, LOCAL_DRM_MODE_FB_MODIFIERS,
 		       &data2[i].fb.fb_id));
 		if (ret) {
 			igt_warn("failed to create framebuffer\n");
diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
index 95557ef..e01d44a 100644
--- a/tests/prime_vgem.c
+++ b/tests/prime_vgem.c
@@ -695,7 +695,7 @@ static void test_flip(int i915, int vgem, unsigned hang)
 
 		do_or_die(__kms_addfb(i915, handle[i],
 				      bo[i].width, bo[i].height, bo[i].pitch,
-				      DRM_FORMAT_XRGB8888, I915_TILING_NONE,
+				      DRM_FORMAT_XRGB8888, I915_TILING_NONE, 0,
 				      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id[i]));
 		igt_assert(fb_id[i]);
 	}
-- 
1.9.1



More information about the Intel-gfx mailing list