Skip to contentSkip to conversation

Add support for NV12

PATCH In review Vidya Srinivas 3 participants 9 messages Oct 10, 2017 – Oct 13, 2017 Library code Page 1 of 5

lore
Share & tools
lore
#0 lore raw

cover Add support for NV12

This series adds NV12 support to IGT
and a test case for checking NV12 functionality.

The series is based on the initial version posted by Chandra Konduru during 2015 based on the IGT framework available then. Previous version reference links:
https://patchwork.freedesktop.org/patch/57590/
https://patchwork.freedesktop.org/patch/59067/

chandra konduru (2):
Prep work for adding NV12 testcase tests/test_nv12.c: Add test to cover NV12 format testing

 lib/igt_draw.c                   |   2 +-
 lib/igt_fb.c                     | 189 ++++++++++--
 lib/igt_fb.h                     |  14 +-
 lib/igt_kms.c                    |  50 +++-
 lib/igt_kms.h                    |   2 +
 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/Makefile.sources           |   1 +
 tests/NV12_Image0.png            | Bin 0 -> 42502 bytes
 tests/NV12_Image1.png            | Bin 0 -> 179559 bytes
 tests/NV12_Image2.png            | Bin 0 -> 6385 bytes
 tests/kms_draw_crc.c             |   2 +-
 tests/kms_frontbuffer_tracking.c |   6 +-
 tests/kms_render.c               |   4 +-
 tests/kms_rotation_crc.c         |   8 +-
 tests/prime_vgem.c               |   2 +-
 tests/test_nv12.c                | 621 +++++++++++++++++++++++++++++++++++++++
 20 files changed, 876 insertions(+), 53 deletions(-)
 create mode 100644 tests/NV12_Image0.png
 create mode 100644 tests/NV12_Image1.png
 create mode 100644 tests/NV12_Image2.png
 create mode 100644 tests/test_nv12.c
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/2 Prep work for adding NV12 testcase

From: chandra konduru <[email protected]>

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
- igt helper function to return plane id based on plane type and num
- 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/
initially floated 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)

v3: lib fixes for nv12 rotation
additional helper functions added to cover multiple plane testing

---
 lib/igt_draw.c                   |   2 +-
 lib/igt_fb.c                     | 189 ++++++++++++++++++++++++++++++++-------
 lib/igt_fb.h                     |  14 ++-
 lib/igt_kms.c                    |  50 ++++++++++-
 lib/igt_kms.h                    |   2 +
 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_draw_crc.c             |   2 +-
 tests/kms_frontbuffer_tracking.c |   6 +-
 tests/kms_render.c               |   4 +-
 tests/kms_rotation_crc.c         |   8 +-
 tests/prime_vgem.c               |   2 +-
 15 files changed, 254 insertions(+), 53 deletions(-)
lib/igt_draw.c +1 -1
index 76ffb6c..8a7dbea 100644
@@ -723,7 +723,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));
 }
 
 /**
lib/igt_fb.c +159 -30

263 lines not on this page · raw message

lib/igt_fb.h +11 -3
index 3f54903..998f4b0 100644
@@ -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,10 +98,13 @@ enum igt_text_align {
 	align_hcenter	= 0x08,
 };
 
+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);
 void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 			  unsigned *width_ret, unsigned *height_ret);
-void igt_calc_fb_size(int fd, int width, int height, int bpp, uint64_t tiling,
-		      unsigned *size_ret, unsigned *stride_ret);
 unsigned int
 igt_create_fb_with_bo_size(int fd, int width, int height,
 			   uint32_t format, uint64_t tiling,
@@ -156,9 +162,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__ */
 
lib/igt_kms.c +48 -2

63 lines not on this page · raw message

lib/igt_kms.h +2 -0
index 8dc118c..72343ca 100644
@@ -395,6 +395,8 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
 void igt_output_set_scaling_mode(igt_output_t *output, uint64_t scaling_mode);
 igt_plane_t *igt_output_get_plane(igt_output_t *output, int plane_idx);
 igt_plane_t *igt_output_get_plane_type(igt_output_t *output, int plane_type);
+igt_plane_t *igt_output_get_plane_type_with_id(igt_output_t *output,
+	int plane_type, int id);
 igt_output_t *igt_output_from_connector(igt_display_t *display,
     drmModeConnector *connector);
 igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int plane_type);
lib/intel_batchbuffer.c +9 -5
index 5344989..1e11e90 100644
@@ -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) &&
lib/intel_batchbuffer.h +2 -1
index 869747d..4bdac0e 100644
@@ -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,
lib/intel_reg.h +1 -0
index 3a28c08..c4c6775 100644
@@ -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)
lib/ioctl_wrappers.c +9 -0
index 87511fc..77017bc 100644
@@ -53,6 +53,7 @@
 #include "intel_io.h"
 #include "igt_debugfs.h"
 #include "config.h"
+#include "igt_fb.h"
 
 #ifdef HAVE_VALGRIND
 #include <valgrind/valgrind.h>
@@ -1829,6 +1830,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;
@@ -1846,6 +1848,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;
lib/ioctl_wrappers.h +1 -0
index 1663b7f..fdbc146 100644
@@ -254,6 +254,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);
 
 /**
tests/kms_draw_crc.c +1 -1
index 723e7a1..1490f0b 100644
@@ -163,7 +163,7 @@ static bool format_is_supported(uint32_t format, uint64_t modifier)
 						   format, modifier,
 						   0, NULL, &stride, NULL);
 	ret =  __kms_addfb(drm_fd, gem_handle, 64, 64,
-			   stride, format, modifier,
+			   stride, format, modifier, 0,
 			   LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id);
 	drmModeRmFB(drm_fd, fb_id);
 	gem_close(drm_fd, gem_handle);
tests/kms_frontbuffer_tracking.c +3 -3
index a068c8a..3961e5e 100644
@@ -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);
tests/kms_render.c +2 -2
index d2208e3..b56fff7 100644
@@ -78,8 +78,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);
tests/kms_rotation_crc.c +4 -4
index 5aec8fa..f89ac3e 100644
@@ -428,7 +428,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;
@@ -463,7 +463,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;
@@ -492,7 +492,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;
@@ -544,7 +544,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");
tests/prime_vgem.c +1 -1
index 0ffaee9..7e86ed8 100644
@@ -723,7 +723,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]);
 	}
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 2/2 tests/test_nv12.c: Add test to cover NV12 format testing

In reply to Vidya Srinivas

From: chandra konduru <[email protected]>

This adds test to cover NV12 format testing.
The test covers NV12 in combination with linear/tile-X/tile-Y tiling formats, rotation and NV12 on overlay. Reference has been taken from the initial version
https://patchwork.freedesktop.org/patch/59067/
posted by Chandra Konduru on Sept 9 2015 based on the IGT framework available at that time.

---
 tests/Makefile.sources |   1 +
 tests/NV12_Image0.png  | Bin 0 -> 42502 bytes
 tests/NV12_Image1.png  | Bin 0 -> 179559 bytes
 tests/NV12_Image2.png  | Bin 0 -> 6385 bytes
 tests/test_nv12.c      | 621 +++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 622 insertions(+)
 create mode 100644 tests/NV12_Image0.png
 create mode 100644 tests/NV12_Image1.png
 create mode 100644 tests/NV12_Image2.png
 create mode 100644 tests/test_nv12.c
tests/Makefile.sources +1 -0
index bb6652e..eda4430 100644
@@ -237,6 +237,7 @@ TESTS_progs = \
 	tools_test \
 	vgem_basic \
 	vgem_slow \
+	test_nv12 \
 	$(NULL)
 
 TESTS_progs_X = \
tests/NV12_Image0.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..d9735659005dcb434488818a4227449c082d4973
GIT binary patch
tests/NV12_Image1.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..3e6aab30a01116ac02ff4e0917ebf2af595f9480
GIT binary patch
tests/NV12_Image2.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..32012a26a54571b62a963d2849fef043485d88db
GIT binary patch
tests/test_nv12.c new file +621 -0

621 lines not on this page · raw message

Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH i-g-t 2/2] tests/test_nv12.c: Add test to cover NV12 format testing

Quoted 10 lines · Vidya Srinivas

From: chandra konduru <[email protected]>

This adds test to cover NV12 format testing.
The test covers NV12 in combination with linear/tile-X/tile-Y tiling formats, rotation and NV12 on overlay. Reference has been taken from the initial version
https://patchwork.freedesktop.org/patch/59067/
posted by Chandra Konduru on Sept 9 2015 based on the IGT framework available at that time.

Quoted 8 lines
---
 tests/Makefile.sources |   1 +
 tests/NV12_Image0.png  | Bin 0 -> 42502 bytes
 tests/NV12_Image1.png  | Bin 0 -> 179559 bytes
 tests/NV12_Image2.png  | Bin 0 -> 6385 bytes

Why do we need these binary images? Generating stuff at runtime is usually preferred (and makes for easier to understand testcases).

Wrt the tests itself, I'm not sure whether collecting all the nv12 tests in one test binary is a good organization. I think it'd be better if we group them into the right existing testcases, as new subtests exercising different formats.

E.g. for rotation we have kms_rotation already, for scaling there's kms_pipe_scaling, for atomic transitions there's the various kms_atomic_* tests.
-Daniel

Quoted 5,005 lines
 tests/test_nv12.c      | 621 +++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 622 insertions(+)
 create mode 100644 tests/NV12_Image0.png
 create mode 100644 tests/NV12_Image1.png
 create mode 100644 tests/NV12_Image2.png
 create mode 100644 tests/test_nv12.c
tests/Makefile.sources +1 -0
index bb6652e..eda4430 100644
@@ -237,6 +237,7 @@ TESTS_progs = \
 	tools_test \
 	vgem_basic \
 	vgem_slow \
+	test_nv12 \
 	$(NULL)
 
 TESTS_progs_X = \
tests/NV12_Image0.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..d9735659005dcb434488818a4227449c082d4973
GIT binary patch
tests/NV12_Image1.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..3e6aab30a01116ac02ff4e0917ebf2af595f9480
GIT binary patch
tests/NV12_Image2.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..32012a26a54571b62a963d2849fef043485d88db
GIT binary patch
tests/test_nv12.c new file +621 -0
new file mode 100644
index 0000000..b0a5050
@@ -0,0 +1,621 @@
+#include <stdbool.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <xf86drmMode.h>
+#include <cairo.h>
+#include "drm.h"
+#include "ioctl_wrappers.h"
+#include "drmtest.h"
+#include "igt.h"
+#include "igt_aux.h"
+#include "sw_sync.h"
+
+
+IGT_TEST_DESCRIPTION("Test flips, rotation and tiling scenarios NV12");
+
+uint32_t devid;
+
+typedef struct {
+	int drm_fd;
+	igt_display_t display;
+	int num_planes;
+	struct igt_fb fb1_nv12_p1, fb2_nv12_p1, fb1_nv12_p2, fb2_nv12_p2;
+	struct igt_fb fb1_p1, fb2_p1, fb3_p1;
+	struct igt_fb fb1_p2, fb2_p2, fb3_p2;
+	igt_plane_t *plane1_p1;
+	igt_plane_t *plane2_p1;
+	igt_plane_t *plane3_p1;
+	igt_plane_t *plane1_p2;
+	igt_plane_t *plane2_p2;
+	igt_plane_t *plane3_p2;
+	uint64_t tiled;
+	int rotation;
+} data_t;
+
+#define IMG_FILE_A_P0 "NV12_Image0.png"
+#define IMG_FILE_A_P1 "NV12_Image1.png"
+#define IMG_FILE_A_P2 "NV12_Image2.png"
+#define IMG_FILE_B_P0 "NV12_Image0.png"
+#define IMG_FILE_B_P1 "NV12_Image1.png"
+#define IMG_FILE_B_P2 "NV12_Image2.png"
+
+static void
+paint_image_file(data_t *d, struct igt_fb *fb, uint16_t w,
+	uint16_t h, const char *img_filename)
+{
+	cairo_t *cr;
+	cr = igt_get_cairo_ctx(d->drm_fd, fb);
+	igt_paint_image(cr, img_filename, 0, 0, w, h);
+	igt_info("Painted image %s\n", img_filename);
+	cairo_destroy(cr);
+}
+
+/* Test for RGB & Rotation & Sprite combination */
+static void test_rgb(data_t *d, bool test_sprite)
+{
+	igt_display_t *display = &d->display;
+	igt_output_t *output;
+	enum pipe pipe;
+	int valid_tests = 0, img_p1_w1, img_p1_h1, img_p1_w2, img_p1_h2;
+
+	for_each_pipe_with_valid_output(display, pipe, output) {
+		igt_output_set_pipe(output, pipe);
+
+		d->plane1_p1 = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+		igt_plane_set_rotation(d->plane1_p1, d->rotation);
+		igt_get_image_size(IMG_FILE_A_P0, &img_p1_w1, &img_p1_h1);
+		igt_create_fb(d->drm_fd, img_p1_w1, img_p1_h1,
+			DRM_FORMAT_XRGB8888, d->tiled, &d->fb1_p1);
+		paint_image_file(d, &d->fb1_p1, img_p1_w1, img_p1_h1, IMG_FILE_A_P0);
+
+		if (test_sprite) {
+			d->plane2_p1 = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
+			igt_plane_set_rotation(d->plane2_p1, d->rotation);
+			igt_get_image_size(IMG_FILE_A_P1, &img_p1_w2, &img_p1_h2);
+			igt_create_fb(d->drm_fd, img_p1_w2, img_p1_h2,
+				DRM_FORMAT_XRGB8888, d->tiled, &d->fb2_p1);
+			paint_image_file(d, &d->fb2_p1, img_p1_w2, img_p1_h2, IMG_FILE_A_P1);
+		}
+
+		igt_plane_set_fb(d->plane1_p1, &d->fb1_p1);
+		igt_fb_set_position(&d->fb1_p1, d->plane1_p1, 0, 0);
+		igt_fb_set_size(&d->fb1_p1, d->plane1_p1, d->fb1_p1.width, d->fb1_p1.height);
+		igt_plane_set_position(d->plane1_p1, 0, 0);
+		if (d->rotation == IGT_ROTATION_90 || d->rotation == IGT_ROTATION_270)
+			igt_plane_set_size(d->plane1_p1, d->fb1_p1.height, d->fb1_p1.width);
+		else
+			igt_plane_set_size(d->plane1_p1, d->fb1_p1.width, d->fb1_p1.height);
+
+		if (test_sprite) {
+			igt_plane_set_fb(d->plane2_p1, &d->fb2_p1);
+			igt_fb_set_position(&d->fb2_p1, d->plane2_p1, 0, 0);
+			igt_fb_set_size(&d->fb2_p1, d->plane2_p1, d->fb2_p1.width, d->fb2_p1.height);
+			igt_plane_set_position(d->plane2_p1, 0, 0);
+			if (d->rotation == IGT_ROTATION_90 || d->rotation == IGT_ROTATION_270)
+				igt_plane_set_size(d->plane2_p1, d->fb2_p1.height, d->fb2_p1.width);
+			else
+				igt_plane_set_size(d->plane2_p1, d->fb2_p1.width, d->fb2_p1.height);
+		}
+
+		igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+		valid_tests++;
+		while (getchar() != '\n');
+	}
+	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
+}
+
+/* Test NV12 & Rotation & Sprite combination */
+static void test_nv12(data_t *d, bool test_sprite)
+{
+	igt_display_t *display = &d->display;
+	igt_output_t *output;
+	enum pipe pipe;
+	int valid_tests = 0, img_p1_w1, img_p1_h1, img_p1_w2, img_p1_h2;
+
+	for_each_pipe_with_valid_output(display, pipe, output) {
+		igt_output_set_pipe(output, pipe);
+
+		d->plane1_p1 = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+		igt_plane_set_rotation(d->plane1_p1, d->rotation);
+		igt_get_image_size(IMG_FILE_A_P0, &img_p1_w1, &img_p1_h1);
+		igt_create_fb(d->drm_fd, img_p1_w1, img_p1_h1,
+			DRM_FORMAT_XRGB8888, d->tiled, &d->fb1_p1);
+		igt_create_fb(d->drm_fd, img_p1_w1, img_p1_h1,
+				DRM_FORMAT_NV12, d->tiled, &d->fb1_nv12_p1);
+		paint_image_file(d, &d->fb1_p1, img_p1_w1, img_p1_h1, IMG_FILE_A_P0);
+		igt_fb_csc_xrgb_to_nv12(d->drm_fd, &d->fb1_nv12_p1, &d->fb1_p1);
+
+		if (test_sprite) {
+			d->plane2_p1 = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
+			igt_plane_set_rotation(d->plane2_p1, d->rotation);
+			igt_get_image_size(IMG_FILE_A_P1, &img_p1_w2, &img_p1_h2);
+			igt_create_fb(d->drm_fd, img_p1_w2, img_p1_h2,
+				DRM_FORMAT_XRGB8888, d->tiled, &d->fb2_p1);
+			igt_create_fb(d->drm_fd, img_p1_w2, img_p1_h2,
+				DRM_FORMAT_NV12, d->tiled, &d->fb2_nv12_p1);
+			paint_image_file(d, &d->fb2_p1, img_p1_w2, img_p1_h2, IMG_FILE_A_P1);
+			igt_fb_csc_xrgb_to_nv12(d->drm_fd, &d->fb2_nv12_p1, &d->fb2_p1);
+		}
+
+		igt_plane_set_fb(d->plane1_p1, &d->fb1_nv12_p1);
+		igt_fb_set_position(&d->fb1_nv12_p1, d->plane1_p1, 0, 0);
+		igt_fb_set_size(&d->fb1_nv12_p1, d->plane1_p1,
+			d->fb1_nv12_p1.width, d->fb1_nv12_p1.height);
+		igt_plane_set_position(d->plane1_p1, 0, 0);
+		if (d->rotation == IGT_ROTATION_90  || d->rotation == IGT_ROTATION_270)
+			igt_plane_set_size(d->plane1_p1, d->fb1_nv12_p1.height, d->fb1_nv12_p1.width);
+		else
+			igt_plane_set_size(d->plane1_p1, d->fb1_nv12_p1.width, d->fb1_nv12_p1.height);
+
+		if (test_sprite) {
+			igt_plane_set_rotation(d->plane2_p1, d->rotation);
+			igt_plane_set_fb(d->plane2_p1, &d->fb2_nv12_p1);
+			igt_fb_set_position(&d->fb2_nv12_p1, d->plane2_p1, 0, 0);
+			igt_fb_set_size(&d->fb2_nv12_p1, d->plane2_p1,
+				d->fb2_nv12_p1.width, d->fb2_nv12_p1.height);
+			igt_plane_set_position(d->plane2_p1, 0, 0);
+			if (d->rotation == IGT_ROTATION_90 || d->rotation == IGT_ROTATION_270)
+				igt_plane_set_size(d->plane2_p1, d->fb2_nv12_p1.height, d->fb2_nv12_p1.width);
+			else
+				igt_plane_set_size(d->plane2_p1, d->fb2_nv12_p1.width, d->fb2_nv12_p1.height);
+		}
+
+		igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+		valid_tests++;
+		while (getchar() != '\n');
+	}
+	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
+}
+
+static void test_multi_pipe_plane(data_t *d, bool test_nv12)
+{
+	igt_display_t *display = &d->display;
+	igt_output_t *output1, *output2;
+	int img_p1_w1, img_p1_w2, img_p1_w3,
+		img_p1_h1, img_p1_h2, img_p1_h3,
+		img_p2_w1, img_p2_w2, img_p2_w3,
+		img_p2_h1, img_p2_h2, img_p2_h3;
+
+	if (display->n_outputs < 2) {
+		igt_info("Two connector required for this test\n");
+		return;
+	}
+
+	output1 = &(display)->outputs[0];
+	output2 = &(display)->outputs[1];
+
+	igt_output_set_pipe(output1, 0);
+	igt_output_set_pipe(output2, 1);
+
+	d->plane1_p1 = igt_output_get_plane_type_with_id(output1, DRM_PLANE_TYPE_PRIMARY, 0);
+	d->plane2_p1 = igt_output_get_plane_type_with_id(output1, DRM_PLANE_TYPE_OVERLAY, 0);
+	d->plane3_p1 = igt_output_get_plane_type_with_id(output1, DRM_PLANE_TYPE_OVERLAY, 1);
+	d->plane1_p2 = igt_output_get_plane_type_with_id(output2, DRM_PLANE_TYPE_PRIMARY, 0);
+	d->plane2_p2 = igt_output_get_plane_type_with_id(output2, DRM_PLANE_TYPE_OVERLAY, 0);
+	d->plane3_p2 = igt_output_get_plane_type_with_id(output2, DRM_PLANE_TYPE_OVERLAY, 1);
+
+	igt_get_image_size(IMG_FILE_A_P0, &img_p1_w1, &img_p1_h1);
+	igt_get_image_size(IMG_FILE_A_P1, &img_p1_w2, &img_p1_h2);
+	igt_get_image_size(IMG_FILE_A_P2, &img_p1_w3, &img_p1_h3);
+	igt_get_image_size(IMG_FILE_B_P0, &img_p2_w1, &img_p2_h1);
+	igt_get_image_size(IMG_FILE_B_P1, &img_p2_w2, &img_p2_h2);
+	igt_get_image_size(IMG_FILE_B_P2, &img_p2_w3, &img_p2_h3);
+
+	igt_create_fb(d->drm_fd, img_p1_w1, img_p1_h1,
+			 DRM_FORMAT_XRGB8888, d->tiled, &d->fb1_p1);
+	igt_create_fb(d->drm_fd, img_p1_w2, img_p1_h2,
+			 DRM_FORMAT_XRGB8888, d->tiled, &d->fb2_p1);
+	igt_create_fb(d->drm_fd, img_p1_w3, img_p1_h3,
+			 DRM_FORMAT_XRGB8888, d->tiled, &d->fb3_p1);
+	igt_create_fb(d->drm_fd, img_p2_w1, img_p2_h1,
+			 DRM_FORMAT_XRGB8888, d->tiled, &d->fb1_p2);
+	igt_create_fb(d->drm_fd, img_p2_w2, img_p2_h2,
+			 DRM_FORMAT_XRGB8888, d->tiled, &d->fb2_p2);
+	igt_create_fb(d->drm_fd, img_p2_w3, img_p2_h3,
+			 DRM_FORMAT_XRGB8888, d->tiled, &d->fb3_p2);
+
+	if (test_nv12) {
+		/* Lets display NV12 on primary, NV12 on sprite 0, RGB on sprite 1 */
+		igt_create_fb(d->drm_fd, img_p1_w1, img_p1_h1,
+				DRM_FORMAT_NV12, d->tiled, &d->fb1_nv12_p1);
+		igt_create_fb(d->drm_fd, img_p1_w2, img_p1_h2,
+				DRM_FORMAT_NV12, d->tiled, &d->fb2_nv12_p1);
+		igt_create_fb(d->drm_fd, img_p2_w1, img_p2_h1,
+				DRM_FORMAT_NV12, d->tiled, &d->fb1_nv12_p2);
+		igt_create_fb(d->drm_fd, img_p2_w2, img_p2_h2,
+				DRM_FORMAT_NV12, d->tiled, &d->fb2_nv12_p2);
+	}
+
+	paint_image_file(d, &d->fb1_p1, img_p1_w1, img_p1_h1, IMG_FILE_A_P0);
+	paint_image_file(d, &d->fb2_p1, img_p1_w2, img_p1_h2, IMG_FILE_A_P1);
+	paint_image_file(d, &d->fb3_p1, img_p1_w3, img_p1_h3, IMG_FILE_A_P2);
+	paint_image_file(d, &d->fb1_p2, img_p2_w1, img_p2_h1, IMG_FILE_B_P0);
+	paint_image_file(d, &d->fb2_p2, img_p2_w2, img_p2_h2, IMG_FILE_B_P1);
+	paint_image_file(d, &d->fb3_p2, img_p2_w3, img_p2_h3, IMG_FILE_B_P2);
+
+	if (test_nv12) {
+		igt_fb_csc_xrgb_to_nv12(d->drm_fd, &d->fb1_nv12_p1, &d->fb1_p1);
+		igt_fb_csc_xrgb_to_nv12(d->drm_fd, &d->fb2_nv12_p1, &d->fb2_p1);
+		igt_fb_csc_xrgb_to_nv12(d->drm_fd, &d->fb1_nv12_p2, &d->fb1_p2);
+		igt_fb_csc_xrgb_to_nv12(d->drm_fd, &d->fb2_nv12_p2, &d->fb2_p2);
+	}
+
+	if (test_nv12) {
+		/* NV12 on Primary - Pipe 1 */
+		igt_plane_set_fb(d->plane1_p1, &d->fb1_nv12_p1);
+		igt_fb_set_position(&d->fb1_nv12_p1, d->plane1_p1, 0, 0);
+		igt_fb_set_size(&d->fb1_nv12_p1, d->plane1_p1, d->fb1_nv12_p1.width, d->fb1_nv12_p1.height);
+		igt_plane_set_position(d->plane1_p1, 0, 0);
+		igt_plane_set_size(d->plane1_p1, d->fb1_nv12_p1.width, d->fb1_nv12_p1.height);
+
+		/* NV12 on Sprite 0 - Pipe 1 */
+		igt_plane_set_fb(d->plane2_p1, &d->fb2_nv12_p1);
+		igt_fb_set_position(&d->fb2_nv12_p1, d->plane2_p1, 0, 0);
+		igt_fb_set_size(&d->fb2_nv12_p1, d->plane2_p1, d->fb2_nv12_p1.width, d->fb2_nv12_p1.height);
+		igt_plane_set_position(d->plane2_p1, 0, 0);
+		igt_plane_set_size(d->plane2_p1, d->fb2_nv12_p1.width, d->fb2_nv12_p1.height);
+
+		/* NV12 on Primary - Pipe 2 */
+		igt_plane_set_fb(d->plane1_p2, &d->fb1_nv12_p2);
+		igt_fb_set_position(&d->fb1_nv12_p2, d->plane1_p2, 0, 0);
+		igt_fb_set_size(&d->fb1_nv12_p2, d->plane1_p2, d->fb1_nv12_p2.width, d->fb1_nv12_p2.height);
+		igt_plane_set_position(d->plane1_p2, 0, 0);
+		igt_plane_set_size(d->plane1_p2, d->fb1_nv12_p2.width, d->fb1_nv12_p2.height);
+
+		/* NV12 on Sprite 0 - Pipe 2 */
+		igt_plane_set_fb(d->plane2_p2, &d->fb2_nv12_p2);
+		igt_fb_set_position(&d->fb2_nv12_p2, d->plane2_p2, 0, 0);
+		igt_fb_set_size(&d->fb2_nv12_p2, d->plane2_p2, d->fb2_nv12_p2.width, d->fb2_nv12_p2.height);
+		igt_plane_set_position(d->plane2_p2, 0, 0);
+		igt_plane_set_size(d->plane2_p2, d->fb2_nv12_p2.width, d->fb2_nv12_p2.height);
+	} else {
+		/* RGB on Primary Pipe 1, Sprite 0 Pipe 1, Primary Pipe 2, Sprite Pipe 2 */
+		igt_plane_set_fb(d->plane1_p1, &d->fb1_p1);
+		igt_fb_set_position(&d->fb1_p1, d->plane1_p1, 0, 0);
+		igt_fb_set_size(&d->fb1_p1, d->plane1_p1, d->fb1_p1.width, d->fb1_p1.height);
+		igt_plane_set_position(d->plane1_p1, 0, 0);
+		igt_plane_set_size(d->plane1_p1, d->fb1_p1.width, d->fb1_p1.height);
+
+		igt_plane_set_fb(d->plane2_p1, &d->fb2_p1);
+		igt_fb_set_position(&d->fb2_p1, d->plane2_p1, 0, 0);
+		igt_fb_set_size(&d->fb2_p1, d->plane2_p1, d->fb2_p1.width, d->fb2_p1.height);
+		igt_plane_set_position(d->plane2_p1, 0, 0);
+		igt_plane_set_size(d->plane2_p1, d->fb2_p1.width, d->fb2_p1.height);
+
+		igt_plane_set_fb(d->plane1_p2, &d->fb1_p1);
+		igt_fb_set_position(&d->fb1_p2, d->plane1_p2, 0, 0);
+		igt_fb_set_size(&d->fb1_p2, d->plane1_p2, d->fb1_p2.width, d->fb1_p2.height);
+		igt_plane_set_position(d->plane1_p2, 0, 0);
+		igt_plane_set_size(d->plane1_p2, d->fb1_p2.width, d->fb1_p2.height);
+
+		igt_plane_set_fb(d->plane2_p2, &d->fb2_p2);
+		igt_fb_set_position(&d->fb2_p2, d->plane2_p2, 0, 0);
+		igt_fb_set_size(&d->fb2_p2, d->plane2_p2, d->fb2_p2.width, d->fb2_p2.height);
+		igt_plane_set_position(d->plane2_p2, 0, 0);
+		igt_plane_set_size(d->plane2_p2, d->fb2_p2.width, d->fb2_p2.height);
+	}
+
+	/* RGB on Sprite 1 - Pipe 1 */
+	igt_plane_set_fb(d->plane3_p1, &d->fb3_p1);
+	igt_fb_set_position(&d->fb3_p1, d->plane3_p1, 0, 0);
+	igt_fb_set_size(&d->fb3_p1, d->plane3_p1, d->fb3_p1.width, d->fb3_p1.height);
+	igt_plane_set_position(d->plane3_p1, 0, 0);
+	igt_plane_set_size(d->plane3_p1, d->fb3_p1.width, d->fb3_p1.height);
+
+	/* RGB on Sprite 1 - Pipe 2 */
+	igt_plane_set_fb(d->plane3_p2, &d->fb3_p2);
+	igt_fb_set_position(&d->fb3_p2, d->plane3_p2, 0, 0);
+	igt_fb_set_size(&d->fb3_p2, d->plane3_p2, d->fb3_p2.width, d->fb3_p2.height);
+	igt_plane_set_position(d->plane3_p2, 0, 0);
+	igt_plane_set_size(d->plane3_p2, d->fb3_p2.width, d->fb3_p2.height);
+
+	igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+	while (getchar() != '\n');
+}
+
+igt_main
+{
+	data_t data = {};
+	igt_skip_on_simulation();
+
+	igt_fixture {
+		data.drm_fd = drm_open_driver(DRIVER_INTEL);
+		kmstest_set_vt_graphics_mode();
+		igt_display_init(&data.display, data.drm_fd);
+		igt_require_gem(data.drm_fd);
+
+		devid = intel_get_drm_devid(data.drm_fd);
+		data.num_planes = 2;
+		igt_assert(intel_gen(devid) >= 9);
+	}
+
+	/* Rotation 0 RGB & Tiling */
+	data.rotation = IGT_ROTATION_0;
+	igt_subtest_f("rgb-plane-tile-linear") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_DRM_FORMAT_MOD_NONE;
+		test_rgb(&data, 0);
+	}
+	igt_subtest_f("rgb-plane-tile-x") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_X_TILED;
+		test_rgb(&data, 0);
+	}
+	igt_subtest_f("rgb-plane-tile-y") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_rgb(&data, 0);
+	}
+	igt_subtest_f("rgb-plane-tile-yf") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_rgb(&data, 0);
+	}
+
+	/* Rotation 90 RGB & Tiling - Y and Yf */
+	data.rotation = IGT_ROTATION_90;
+	igt_subtest_f("rgb-plane-tile-y_rot90") {
+		data.rotation = IGT_ROTATION_90;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_rgb(&data, 0);
+	}
+	igt_subtest_f("rgb-plane-tile-yf_rot90") {
+		data.rotation = IGT_ROTATION_90;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_rgb(&data, 0);
+	}
+
+	/* Rotation 180 RGB & Tiling */
+	igt_subtest_f("rgb-plane-tile-linear_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_DRM_FORMAT_MOD_NONE;
+		test_rgb(&data, 0);
+	}
+	igt_subtest_f("rgb-plane-tile-x_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_X_TILED;
+		test_rgb(&data, 0);
+	}
+	igt_subtest_f("rgb-plane-tile-y_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_rgb(&data, 0);
+	}
+	igt_subtest_f("rgb-plane-tile-yf_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_rgb(&data, 0);
+	}
+
+	/* Rotation 270 RGB & Tiling - Y and Yf */
+	data.rotation = IGT_ROTATION_270;
+	igt_subtest_f("rgb-plane-tile-y_rot270") {
+		data.rotation = IGT_ROTATION_270;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_rgb(&data, 0);
+	}
+	igt_subtest_f("rgb-plane-tile-yf_rot270") {
+		data.rotation = IGT_ROTATION_270;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_rgb(&data, 0);
+	}
+
+	/* Rotation 0 NV12 & Tiling */
+	igt_subtest_f("nv12-plane-tile-linear") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_DRM_FORMAT_MOD_NONE;
+		test_nv12(&data, 0);
+	}
+	igt_subtest_f("nv12-plane-tile-x") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_X_TILED;
+		test_nv12(&data, 0);
+	}
+	igt_subtest_f("nv12-plane-tile-y") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_nv12(&data, 0);
+	}
+	igt_subtest_f("nv12-plane-tile-yf") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_nv12(&data, 0);
+	}
+
+	/* Rotation 90 NV12 & Tiling - Y and Yf */
+	igt_subtest_f("nv12-plane-tile-y_rot90") {
+		data.rotation = IGT_ROTATION_90;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_nv12(&data, 0);
+	}
+	igt_subtest_f("nv12-plane-tile-yf_rot90") {
+		data.rotation = IGT_ROTATION_90;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_nv12(&data, 0);
+	}
+
+	/* Rotation 180 NV12 & Tiling */
+	igt_subtest_f("nv12-plane-tile-linear_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_DRM_FORMAT_MOD_NONE;
+		test_nv12(&data, 0);
+	}
+	igt_subtest_f("nv12-plane-tile-x_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_X_TILED;
+		test_nv12(&data, 0);
+	}
+	igt_subtest_f("nv12-plane-tile-y_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_nv12(&data, 0);
+	}
+	igt_subtest_f("nv12-plane-tile-yf_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_nv12(&data, 0);
+	}
+
+	/* Rotation 270 NV12 & Tiling - Y and Yf */
+	igt_subtest_f("nv12-plane-tile-y_rot270") {
+		data.rotation = IGT_ROTATION_270;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_nv12(&data, 0);
+	}
+	igt_subtest_f("nv12-plane-tile-yf_rot270") {
+		data.rotation = IGT_ROTATION_270;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_nv12(&data, 0);
+	}
+
+	/* Test Sprite/Overlay for NV12 with Tiling */
+	igt_subtest_f("sprite_nv12-plane-tile-linear") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_DRM_FORMAT_MOD_NONE;
+		test_nv12(&data, 1);
+	}
+	igt_subtest_f("sprite_nv12-plane-tile-x") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_X_TILED;
+		test_nv12(&data, 1);
+	}
+	igt_subtest_f("sprite_nv12-plane-tile-y") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_nv12(&data, 1);
+	}
+	igt_subtest_f("sprite_nv12-plane-tile-yf") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_nv12(&data, 1);
+	}
+
+	/* Test Sprite/Overlay for NV12 with Rotation */
+	igt_subtest_f("sprite_nv12-plane-tile-y_rot270") {
+		data.rotation = IGT_ROTATION_270;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_nv12(&data, 1);
+	}
+	igt_subtest_f("sprite_nv12-plane-tile-yf_rot270") {
+		data.rotation = IGT_ROTATION_270;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_nv12(&data, 1);
+	}
+	igt_subtest_f("sprite_nv12-plane-tile-y_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_nv12(&data, 1);
+	}
+	igt_subtest_f("sprite_nv12-plane-tile-yf_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_nv12(&data, 1);
+	}
+	igt_subtest_f("sprite_nv12-plane-tile-x_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_X_TILED;
+		test_nv12(&data, 1);
+	}
+	igt_subtest_f("sprite_nv12-plane-tile-linear_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_DRM_FORMAT_MOD_NONE;
+		test_nv12(&data, 1);
+	}
+	igt_subtest_f("sprite_nv12-plane-tile-y_rot90") {
+		data.rotation = IGT_ROTATION_90;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_nv12(&data, 1);
+	}
+	igt_subtest_f("sprite_nv12-plane-tile-yf_rot90") {
+		data.rotation = IGT_ROTATION_90;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_nv12(&data, 1);
+	}
+
+	/* Test Sprite/Overlay for RGB with Rotation */
+	igt_subtest_f("sprite_rgb-plane-tile-linear") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_DRM_FORMAT_MOD_NONE;
+		test_rgb(&data, 1);
+	}
+	igt_subtest_f("sprite_rgb-plane-tile-x") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_X_TILED;
+		test_rgb(&data, 1);
+	}
+	igt_subtest_f("sprite_rgb-plane-tile-y") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_rgb(&data, 1);
+	}
+	igt_subtest_f("sprite_rgb-plane-tile-yf") {
+		data.rotation = IGT_ROTATION_0;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_rgb(&data, 1);
+	}
+	igt_subtest_f("sprite_rgb-plane-tile-y_rot90") {
+		data.rotation = IGT_ROTATION_90;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_rgb(&data, 1);
+	}
+	igt_subtest_f("sprite_rgb-plane-tile-yf_rot90") {
+		data.rotation = IGT_ROTATION_90;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_rgb(&data, 1);
+	}
+	igt_subtest_f("sprite_rgb-plane-tile-y_rot270") {
+		data.rotation = IGT_ROTATION_270;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_rgb(&data, 1);
+	}
+	igt_subtest_f("sprite_rgb-plane-tile-yf_rot270") {
+		data.rotation = IGT_ROTATION_270;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_rgb(&data, 1);
+	}
+	igt_subtest_f("sprite_rgb-plane-tile-y_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		test_rgb(&data, 1);
+	}
+	igt_subtest_f("sprite_rgb-plane-tile-yf_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+		test_rgb(&data, 1);
+	}
+	igt_subtest_f("sprite_rgb-plane-tile-x_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_I915_FORMAT_MOD_X_TILED;
+		test_rgb(&data, 1);
+	}
+	igt_subtest_f("sprite_rgb-plane-tile-linear_rot180") {
+		data.rotation = IGT_ROTATION_180;
+		data.tiled = LOCAL_DRM_FORMAT_MOD_NONE;
+		test_rgb(&data, 1);
+	}
+
+	/* Test two pipes and two sprites for RGB */
+	igt_subtest_f("multi_pipe_sprite_rgb") {
+		data.tiled = LOCAL_DRM_FORMAT_MOD_NONE;
+		data.rotation = IGT_ROTATION_0;
+		test_multi_pipe_plane(&data, 0);
+	}
+
+	/* Test two pipes and two sprites combining RGB and NV12 */
+	igt_subtest_f("multi_pipe_sprite_nv12") {
+		data.tiled = LOCAL_DRM_FORMAT_MOD_NONE;
+		data.rotation = IGT_ROTATION_0;
+		test_multi_pipe_plane(&data, 1);
+	}
+
+	igt_fixture {
+		igt_display_fini(&data.display);
+	}
+}
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx