[PATCH igt] lib/igt_draw: add support for RGB565 and XRGB2101010

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We need to test those pixel formats on the FBC code, so let's make
sure the drawing library works on them first.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx>
---
 lib/igt_draw.c                   | 162 +++++++++++++++++++++++++++------------
 lib/igt_draw.h                   |   2 +-
 tests/kms_draw_crc.c             | 113 +++++++++++++++++++++------
 tests/kms_frontbuffer_tracking.c |   2 +-
 4 files changed, 206 insertions(+), 73 deletions(-)

diff --git a/lib/igt_draw.c b/lib/igt_draw.c
index 2210f77..afb937f 100644
--- a/lib/igt_draw.c
+++ b/lib/igt_draw.c
@@ -57,6 +57,7 @@ struct buf_data {
 	uint32_t handle;
 	uint32_t size;
 	uint32_t stride;
+	int bpp;
 };
 
 struct rect {
@@ -133,27 +134,27 @@ static int swizzle_addr(int addr, int swizzle)
 
 /* It's all in "pixel coordinates", so make sure you multiply/divide by the bpp
  * if you need to. */
-static int linear_x_y_to_tiled_pos(int x, int y, uint32_t stride, int swizzle)
+static int linear_x_y_to_tiled_pos(int x, int y, uint32_t stride, int swizzle,
+				   int bpp)
 {
 	int x_tile_size, y_tile_size;
 	int x_tile_n, y_tile_n, x_tile_off, y_tile_off;
 	int line_size, tile_size;
 	int tile_n, tile_off;
 	int tiled_pos, tiles_per_line;
-	int bpp;
+	int pixel_size = bpp / 8;
 
 	line_size = stride;
 	x_tile_size = 512;
 	y_tile_size = 8;
 	tile_size = x_tile_size * y_tile_size;
 	tiles_per_line = line_size / x_tile_size;
-	bpp = sizeof(uint32_t);
 
 	y_tile_n = y / y_tile_size;
 	y_tile_off = y % y_tile_size;
 
-	x_tile_n = (x * bpp) / x_tile_size;
-	x_tile_off = (x * bpp) % x_tile_size;
+	x_tile_n = (x * pixel_size) / x_tile_size;
+	x_tile_off = (x * pixel_size) % x_tile_size;
 
 	tile_n = y_tile_n * tiles_per_line + x_tile_n;
 	tile_off = y_tile_off * x_tile_size + x_tile_off;
@@ -161,19 +162,19 @@ static int linear_x_y_to_tiled_pos(int x, int y, uint32_t stride, int swizzle)
 
 	tiled_pos = swizzle_addr(tiled_pos, swizzle);
 
-	return tiled_pos / bpp;
+	return tiled_pos / pixel_size;
 }
 
 /* It's all in "pixel coordinates", so make sure you multiply/divide by the bpp
  * if you need to. */
 static void tiled_pos_to_x_y_linear(int tiled_pos, uint32_t stride,
-				    int swizzle, int *x, int *y)
+				    int swizzle, int bpp, int *x, int *y)
 {
 	int tile_n, tile_off, tiles_per_line, line_size;
 	int x_tile_off, y_tile_off;
 	int x_tile_n, y_tile_n;
 	int x_tile_size, y_tile_size, tile_size;
-	int bpp;
+	int pixel_size = bpp / 8;
 
 	tiled_pos = swizzle_addr(tiled_pos, swizzle);
 
@@ -182,7 +183,6 @@ static void tiled_pos_to_x_y_linear(int tiled_pos, uint32_t stride,
 	y_tile_size = 8;
 	tile_size = x_tile_size * y_tile_size;
 	tiles_per_line = line_size / x_tile_size;
-	bpp = sizeof(uint32_t);
 
 	tile_n = tiled_pos / tile_size;
 	tile_off = tiled_pos % tile_size;
@@ -193,32 +193,45 @@ static void tiled_pos_to_x_y_linear(int tiled_pos, uint32_t stride,
 	x_tile_n = tile_n % tiles_per_line;
 	y_tile_n = tile_n / tiles_per_line;
 
-	*x = (x_tile_n * x_tile_size + x_tile_off) / bpp;
+	*x = (x_tile_n * x_tile_size + x_tile_off) / pixel_size;
 	*y = y_tile_n * y_tile_size + y_tile_off;
 }
 
-static void draw_rect_ptr_linear(uint32_t *ptr, uint32_t stride,
-				  struct rect *rect, uint32_t color)
+static void set_pixel(void *_ptr, int index, uint32_t color, int bpp)
+{
+	if (bpp == 16) {
+		uint16_t *ptr = _ptr;
+		ptr[index] = color;
+	} else if (bpp == 32) {
+		uint32_t *ptr = _ptr;
+		ptr[index] = color;
+	} else {
+		igt_assert_f(false, "bpp: %d\n", bpp);
+	}
+}
+
+static void draw_rect_ptr_linear(void *ptr, uint32_t stride,
+				 struct rect *rect, uint32_t color, int bpp)
 {
 	int x, y, line_begin;
 
 	for (y = rect->y; y < rect->y + rect->h; y++) {
-		line_begin = y * stride / sizeof(uint32_t);
+		line_begin = y * stride / (bpp / 8);
 		for (x = rect->x; x < rect->x + rect->w; x++)
-			ptr[line_begin + x] = color;
+			set_pixel(ptr, line_begin + x, color, bpp);
 	}
-
 }
 
-static void draw_rect_ptr_tiled(uint32_t *ptr, uint32_t stride, int swizzle,
-				 struct rect *rect, uint32_t color)
+static void draw_rect_ptr_tiled(void *ptr, uint32_t stride, int swizzle,
+				struct rect *rect, uint32_t color, int bpp)
 {
 	int x, y, pos;
 
 	for (y = rect->y; y < rect->y + rect->h; y++) {
 		for (x = rect->x; x < rect->x + rect->w; x++) {
-			pos = linear_x_y_to_tiled_pos(x, y, stride, swizzle);
-			ptr[pos] = color;
+			pos = linear_x_y_to_tiled_pos(x, y, stride, swizzle,
+						      bpp);
+			set_pixel(ptr, pos, color, bpp);
 		}
 	}
 }
@@ -242,10 +255,11 @@ static void draw_rect_mmap_cpu(int fd, struct buf_data *buf, struct rect *rect,
 
 	switch (tiling) {
 	case I915_TILING_NONE:
-		draw_rect_ptr_linear(ptr, buf->stride, rect, color);
+		draw_rect_ptr_linear(ptr, buf->stride, rect, color, buf->bpp);
 		break;
 	case I915_TILING_X:
-		draw_rect_ptr_tiled(ptr, buf->stride, swizzle, rect, color);
+		draw_rect_ptr_tiled(ptr, buf->stride, swizzle, rect, color,
+				    buf->bpp);
 		break;
 	default:
 		igt_assert(false);
@@ -268,7 +282,7 @@ static void draw_rect_mmap_gtt(int fd, struct buf_data *buf, struct rect *rect,
 	ptr = gem_mmap__gtt(fd, buf->handle, buf->size, PROT_READ | PROT_WRITE);
 	igt_assert(ptr);
 
-	draw_rect_ptr_linear(ptr, buf->stride, rect, color);
+	draw_rect_ptr_linear(ptr, buf->stride, rect, color, buf->bpp);
 
 	igt_assert(munmap(ptr, buf->size) == 0);
 }
@@ -293,10 +307,11 @@ static void draw_rect_mmap_wc(int fd, struct buf_data *buf, struct rect *rect,
 
 	switch (tiling) {
 	case I915_TILING_NONE:
-		draw_rect_ptr_linear(ptr, buf->stride, rect, color);
+		draw_rect_ptr_linear(ptr, buf->stride, rect, color, buf->bpp);
 		break;
 	case I915_TILING_X:
-		draw_rect_ptr_tiled(ptr, buf->stride, swizzle, rect, color);
+		draw_rect_ptr_tiled(ptr, buf->stride, swizzle, rect, color,
+				    buf->bpp);
 		break;
 	default:
 		igt_assert(false);
@@ -309,17 +324,16 @@ static void draw_rect_mmap_wc(int fd, struct buf_data *buf, struct rect *rect,
 static void draw_rect_pwrite_untiled(int fd, struct buf_data *buf,
 				     struct rect *rect, uint32_t color)
 {
-	uint32_t tmp[rect->w];
-	int i, y, offset, bpp;
-
-	bpp = sizeof(uint32_t);
+	int i, y, offset;
+	int pixel_size = buf->bpp / 8;
+	uint8_t tmp[rect->w * pixel_size];
 
 	for (i = 0; i < rect->w; i++)
-		tmp[i] = color;
+		set_pixel(tmp, i, color, buf->bpp);
 
 	for (y = rect->y; y < rect->y + rect->h; y++) {
-		offset = (y * buf->stride) + (rect->x * bpp);
-		gem_write(fd, buf->handle, offset, tmp, rect->w * bpp);
+		offset = (y * buf->stride) + (rect->x * pixel_size);
+		gem_write(fd, buf->handle, offset, tmp, rect->w * pixel_size);
 	}
 }
 
@@ -328,25 +342,27 @@ static void draw_rect_pwrite_tiled(int fd, struct buf_data *buf,
 				   uint32_t swizzle)
 {
 	int i;
-	int tiled_pos, bpp, x, y;
-	uint32_t tmp[1024];
-	int tmp_used = 0, tmp_size = ARRAY_SIZE(tmp);
+	int tiled_pos, x, y, pixel_size;
+	uint8_t tmp[4096];
+	int tmp_used = 0, tmp_size;
 	bool flush_tmp = false;
 	int tmp_start_pos = 0;
 
 	/* We didn't implement suport for the older tiling methods yet. */
 	igt_require(intel_gen(intel_get_drm_devid(fd)) >= 5);
 
-	bpp = sizeof(uint32_t);
+	pixel_size = buf->bpp / 8;
+	tmp_size = sizeof(tmp) / pixel_size;
 
 	/* Instead of doing one pwrite per pixel, we try to group the maximum
 	 * amount of consecutive pixels we can in a single pwrite: that's why we
 	 * use the "tmp" variables. */
 	for (i = 0; i < tmp_size; i++)
-		tmp[i] = color;
+		set_pixel(tmp, i, color, buf->bpp);
 
-	for (tiled_pos = 0; tiled_pos < buf->size; tiled_pos += bpp) {
-		tiled_pos_to_x_y_linear(tiled_pos, buf->stride, swizzle, &x, &y);
+	for (tiled_pos = 0; tiled_pos < buf->size; tiled_pos += pixel_size) {
+		tiled_pos_to_x_y_linear(tiled_pos, buf->stride, swizzle,
+					buf->bpp, &x, &y);
 
 		if (x >= rect->x && x < rect->x + rect->w &&
 		    y >= rect->y && y < rect->y + rect->h) {
@@ -359,7 +375,7 @@ static void draw_rect_pwrite_tiled(int fd, struct buf_data *buf,
 
 		if (tmp_used == tmp_size || (flush_tmp && tmp_used > 0)) {
 			gem_write(fd, buf->handle, tmp_start_pos, tmp,
-				  tmp_used * bpp);
+				  tmp_used * pixel_size);
 			flush_tmp = false;
 			tmp_used = 0;
 		}
@@ -392,7 +408,7 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data,
 {
 	drm_intel_bo *dst;
 	struct intel_batchbuffer *batch;
-	int blt_cmd_len, blt_cmd_tiling;
+	int blt_cmd_len, blt_cmd_tiling, blt_cmd_depth;
 	uint32_t devid = intel_get_drm_devid(fd);
 	int gen = intel_gen(devid);
 	uint32_t tiling, swizzle;
@@ -406,6 +422,20 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data,
 	batch = intel_batchbuffer_alloc(cmd_data->bufmgr, devid);
 	igt_assert(batch);
 
+	switch (buf->bpp) {
+	case 8:
+		blt_cmd_depth = 0;
+		break;
+	case 16: /* we're assuming 565 */
+		blt_cmd_depth = 1 << 24;
+		break;
+	case 32:
+		blt_cmd_depth = 3 << 24;
+		break;
+	default:
+		igt_assert(false);
+	}
+
 	blt_cmd_len = (gen >= 8) ?  0x5 : 0x4;
 	blt_cmd_tiling = (tiling) ? XY_COLOR_BLT_TILED : 0;
 	pitch = (tiling) ? buf->stride / 4 : buf->stride;
@@ -413,7 +443,7 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data,
 	BEGIN_BATCH(6, 1);
 	OUT_BATCH(XY_COLOR_BLT_CMD_NOLEN | XY_COLOR_BLT_WRITE_ALPHA |
 		  XY_COLOR_BLT_WRITE_RGB | blt_cmd_tiling | blt_cmd_len);
-	OUT_BATCH((3 << 24) | (0xF0 << 16) | pitch);
+	OUT_BATCH(blt_cmd_depth | (0xF0 << 16) | pitch);
 	OUT_BATCH((rect->y << 16) | rect->x);
 	OUT_BATCH(((rect->y + rect->h) << 16) | (rect->x + rect->w));
 	OUT_RELOC_FENCED(dst, 0, I915_GEM_DOMAIN_RENDER, 0);
@@ -435,15 +465,26 @@ static void draw_rect_render(int fd, struct cmd_data *cmd_data,
 	struct intel_batchbuffer *batch;
 	uint32_t tiling, swizzle;
 	struct buf_data tmp;
+	int pixel_size = buf->bpp / 8;
+	unsigned adjusted_w, adjusted_dst_x;
 
 	igt_skip_on(!rendercopy);
 
+	/* Rendercopy works at 32bpp, so if you try to do copies on buffers with
+	 * smaller bpps you won't succeeed if you need to copy "half" of a 32bpp
+	 * pixel or something similar. */
+	igt_skip_on(rect->x % (32 / buf->bpp) != 0 ||
+		    rect->y % (32 / buf->bpp) != 0 ||
+		    rect->w % (32 / buf->bpp) != 0 ||
+		    rect->h % (32 / buf->bpp) != 0);
+
 	gem_get_tiling(fd, buf->handle, &tiling, &swizzle);
 
 	/* We create a temporary buffer and copy from it using rendercopy. */
-	tmp.size = rect->w * rect->h * sizeof(uint32_t);
+	tmp.size = rect->w * rect->h * pixel_size;
 	tmp.handle = gem_create(fd, tmp.size);
-	tmp.stride = rect->w * sizeof(uint32_t);
+	tmp.stride = rect->w * pixel_size;
+	tmp.bpp = buf->bpp;
 	draw_rect_mmap_cpu(fd, &tmp, &(struct rect){0, 0, rect->w, rect->h},
 			   color);
 
@@ -464,8 +505,18 @@ static void draw_rect_render(int fd, struct cmd_data *cmd_data,
 	batch = intel_batchbuffer_alloc(cmd_data->bufmgr, devid);
 	igt_assert(batch);
 
-	rendercopy(batch, cmd_data->context, &src_buf, 0, 0, rect->w, rect->h,
-		   &dst_buf, rect->x, rect->y);
+	switch (buf->bpp) {
+	case 16:
+	case 32:
+		adjusted_w = rect->w / (32 / buf->bpp);
+		adjusted_dst_x = rect->x / (32 / buf->bpp);
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	rendercopy(batch, cmd_data->context, &src_buf, 0, 0, adjusted_w,
+		   rect->h, &dst_buf, adjusted_dst_x, rect->y);
 
 	intel_batchbuffer_free(batch);
 	gem_close(fd, tmp.handle);
@@ -486,6 +537,7 @@ static void draw_rect_render(int fd, struct cmd_data *cmd_data,
  * @rect_w: width of the rectangle
  * @rect_h: height of the rectangle
  * @color: color of the rectangle
+ * @bpp: bits per pixel
  *
  * This function draws a colored rectangle on the destination buffer, allowing
  * you to specify the method used to draw the rectangle. We assume 32 bit pixels
@@ -494,7 +546,7 @@ static void draw_rect_render(int fd, struct cmd_data *cmd_data,
 void igt_draw_rect(int fd, drm_intel_bufmgr *bufmgr, drm_intel_context *context,
 		   uint32_t buf_handle, uint32_t buf_size, uint32_t buf_stride,
 		   enum igt_draw_method method, int rect_x, int rect_y,
-		   int rect_w, int rect_h, uint32_t color)
+		   int rect_w, int rect_h, uint32_t color, int bpp)
 {
 	struct cmd_data cmd_data = {
 		.bufmgr = bufmgr,
@@ -504,6 +556,7 @@ void igt_draw_rect(int fd, drm_intel_bufmgr *bufmgr, drm_intel_context *context,
 		.handle = buf_handle,
 		.size = buf_size,
 		.stride = buf_stride,
+		.bpp = bpp,
 	};
 	struct rect rect = {
 		.x = rect_x,
@@ -537,6 +590,20 @@ void igt_draw_rect(int fd, drm_intel_bufmgr *bufmgr, drm_intel_context *context,
 	}
 }
 
+static int get_format_bpp(uint32_t drm_format)
+{
+	switch (drm_format) {
+	case DRM_FORMAT_RGB565:
+		return 16;
+	case DRM_FORMAT_XRGB8888:
+	case DRM_FORMAT_ARGB8888:
+	case DRM_FORMAT_XRGB2101010:
+		return 32;
+	default:
+		igt_assert(false);
+	}
+}
+
 /**
  * igt_draw_rect_fb:
  * @fd: the DRM file descriptor
@@ -560,7 +627,8 @@ void igt_draw_rect_fb(int fd, drm_intel_bufmgr *bufmgr,
 		      int rect_w, int rect_h, uint32_t color)
 {
 	igt_draw_rect(fd, bufmgr, context, fb->gem_handle, fb->size, fb->stride,
-		      method, rect_x, rect_y, rect_w, rect_h, color);
+		      method, rect_x, rect_y, rect_w, rect_h, color,
+		      get_format_bpp(fb->drm_format));
 }
 
 /**
diff --git a/lib/igt_draw.h b/lib/igt_draw.h
index 9d8413a..b030131 100644
--- a/lib/igt_draw.h
+++ b/lib/igt_draw.h
@@ -53,7 +53,7 @@ const char *igt_draw_get_method_name(enum igt_draw_method method);
 void igt_draw_rect(int fd, drm_intel_bufmgr *bufmgr, drm_intel_context *context,
 		   uint32_t buf_handle, uint32_t buf_size, uint32_t buf_stride,
 		   enum igt_draw_method method, int rect_x, int rect_y,
-		   int rect_w, int rect_h, uint32_t color);
+		   int rect_w, int rect_h, uint32_t color, int bpp);
 
 void igt_draw_rect_fb(int fd, drm_intel_bufmgr *bufmgr,
 		      drm_intel_context *context, struct igt_fb *fb,
diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
index 9fcf997..9c73077 100644
--- a/tests/kms_draw_crc.c
+++ b/tests/kms_draw_crc.c
@@ -45,8 +45,18 @@ drmModeConnectorPtr drm_connectors[MAX_CONNECTORS];
 drm_intel_bufmgr *bufmgr;
 igt_pipe_crc_t *pipe_crc;
 
-bool has_method_base_crc = false;
-igt_crc_t method_base_crc;
+#define N_FORMATS 3
+static const uint32_t formats[N_FORMATS] = {
+	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_RGB565,
+	DRM_FORMAT_XRGB2101010,
+};
+
+struct base_crc {
+	bool set;
+	igt_crc_t crc;
+};
+struct base_crc base_crcs[N_FORMATS];
 
 struct modeset_params ms;
 
@@ -77,26 +87,59 @@ static void find_modeset_params(void)
 
 }
 
-static void get_method_crc(enum igt_draw_method method, uint64_t tiling,
-			   igt_crc_t *crc)
+static uint32_t get_color(uint32_t drm_format, bool r, bool g, bool b)
+{
+	uint32_t color = 0;
+
+	switch (drm_format) {
+	case DRM_FORMAT_RGB565:
+		color |= r ? 0x1F << 11 : 0;
+		color |= g ? 0x3F << 5 : 0;
+		color |= b ? 0x1F : 0;
+		break;
+	case DRM_FORMAT_XRGB8888:
+		color |= r ? 0xFF << 16 : 0;
+		color |= g ? 0xFF << 8 : 0;
+		color |= b ? 0xFF : 0;
+		break;
+	case DRM_FORMAT_XRGB2101010:
+		color |= r ? 0x3FF << 20 : 0;
+		color |= g ? 0x3FF << 10 : 0;
+		color |= b ? 0x3FF : 0;
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	return color;
+}
+
+static void get_method_crc(enum igt_draw_method method, uint32_t drm_format,
+			   uint64_t tiling, igt_crc_t *crc)
 {
 	struct igt_fb fb;
 	int rc;
 
 	igt_create_fb(drm_fd, ms.mode->hdisplay, ms.mode->vdisplay,
-		      DRM_FORMAT_XRGB8888, tiling, &fb);
+		      drm_format, tiling, &fb);
 	igt_draw_rect_fb(drm_fd, bufmgr, NULL, &fb, method,
-			 0, 0, fb.width, fb.height, 0xFF);
+			 0, 0, fb.width, fb.height,
+			 get_color(drm_format, 0, 0, 1));
 
 	igt_draw_rect_fb(drm_fd, bufmgr, NULL, &fb, method,
 			 fb.width / 4, fb.height / 4,
-			 fb.width / 2, fb.height / 2, 0xFF00);
+			 fb.width / 2, fb.height / 2,
+			 get_color(drm_format, 0, 1, 0));
 	igt_draw_rect_fb(drm_fd, bufmgr, NULL, &fb, method,
 			 fb.width / 8, fb.height / 8,
-			 fb.width / 4, fb.height / 4, 0xFF0000);
+			 fb.width / 4, fb.height / 4,
+			 get_color(drm_format, 1, 0, 0));
 	igt_draw_rect_fb(drm_fd, bufmgr, NULL, &fb, method,
 			 fb.width / 2, fb.height / 2,
-			 fb.width / 3, fb.height / 3, 0xFF00FF);
+			 fb.width / 3, fb.height / 3,
+			 get_color(drm_format, 1, 0, 1));
+	igt_draw_rect_fb(drm_fd, bufmgr, NULL, &fb, method, 1, 1, 15, 15,
+			 get_color(drm_format, 0, 1, 1));
 
 	rc = drmModeSetCrtc(drm_fd, ms.crtc_id, fb.fb_id, 0, 0,
 			    &ms.connector_id, 1, ms.mode);
@@ -108,7 +151,8 @@ static void get_method_crc(enum igt_draw_method method, uint64_t tiling,
 	igt_remove_fb(drm_fd, &fb);
 }
 
-static void draw_method_subtest(enum igt_draw_method method, uint64_t tiling)
+static void draw_method_subtest(enum igt_draw_method method,
+				uint32_t format_index, uint64_t tiling)
 {
 	igt_crc_t crc;
 
@@ -119,14 +163,15 @@ static void draw_method_subtest(enum igt_draw_method method, uint64_t tiling)
 	/* Use IGT_DRAW_MMAP_GTT on an untiled buffer as the parameter for
 	 * comparison. Cache the value so we don't recompute it for every single
 	 * subtest. */
-	if (!has_method_base_crc) {
-		get_method_crc(IGT_DRAW_MMAP_GTT, LOCAL_DRM_FORMAT_MOD_NONE,
-			       &method_base_crc);
-		has_method_base_crc = true;
+	if (!base_crcs[format_index].set) {
+		get_method_crc(IGT_DRAW_MMAP_GTT, formats[format_index],
+			       LOCAL_DRM_FORMAT_MOD_NONE,
+			       &base_crcs[format_index].crc);
+		base_crcs[format_index].set = true;
 	}
 
-	get_method_crc(method, tiling, &crc);
-	igt_assert_crc_equal(&crc, &method_base_crc);
+	get_method_crc(method, formats[format_index], tiling, &crc);
+	igt_assert_crc_equal(&crc, &base_crcs[format_index].crc);
 }
 
 static void get_fill_crc(uint64_t tiling, igt_crc_t *crc)
@@ -219,21 +264,41 @@ static void teardown_environment(void)
 	close(drm_fd);
 }
 
+static const char *format_str(int format_index)
+{
+	switch (formats[format_index]) {
+	case DRM_FORMAT_RGB565:
+		return "rgb565";
+	case DRM_FORMAT_XRGB8888:
+		return "xrgb8888";
+	case DRM_FORMAT_XRGB2101010:
+		return "xrgb2101010";
+	default:
+		igt_assert(false);
+	}
+}
+
 igt_main
 {
 	enum igt_draw_method method;
+	int format_index;
 
 	igt_fixture
 		setup_environment();
 
-	for (method = 0; method < IGT_DRAW_METHOD_COUNT; method++) {
-		igt_subtest_f("draw-method-%s-untiled",
-			      igt_draw_get_method_name(method))
-			draw_method_subtest(method, LOCAL_DRM_FORMAT_MOD_NONE);
-		igt_subtest_f("draw-method-%s-tiled",
-			      igt_draw_get_method_name(method))
-			draw_method_subtest(method,
-					    LOCAL_I915_FORMAT_MOD_X_TILED);
+	for (format_index = 0; format_index < N_FORMATS; format_index++) {
+		for (method = 0; method < IGT_DRAW_METHOD_COUNT; method++) {
+			igt_subtest_f("draw-method-%s-%s-untiled",
+				      format_str(format_index),
+				      igt_draw_get_method_name(method))
+				draw_method_subtest(method, format_index,
+						    LOCAL_DRM_FORMAT_MOD_NONE);
+			igt_subtest_f("draw-method-%s-%s-tiled",
+				      format_str(format_index),
+				      igt_draw_get_method_name(method))
+				draw_method_subtest(method, format_index,
+						LOCAL_I915_FORMAT_MOD_X_TILED);
+		}
 	}
 
 	igt_subtest("fill-fb")
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index d1d5045..ca38ed8 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -908,7 +908,7 @@ static void *busy_thread_func(void *data)
 		igt_draw_rect(drm.fd, drm.bufmgr, NULL, busy_thread.handle,
 			      busy_thread.size, busy_thread.stride,
 			      IGT_DRAW_BLT, 0, 0, busy_thread.width,
-			      busy_thread.height, 0xFF);
+			      busy_thread.height, 0xFF, 32);
 
 	pthread_exit(0);
 }
-- 
2.4.6

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux