All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers
@ 2018-07-19 15:03 Ville Syrjala
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 02/25] tests/kms_ccs: Use igt_plane_has_format_mod() Ville Syrjala
                   ` (26 more replies)
  0 siblings, 27 replies; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:03 UTC (permalink / raw)
  To: igt-dev; +Cc: Ulrich Hecht

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

For drivers that don't support the IN_FORMATS blob we should just
consult the format list returned by getplane. Since we can't know
which modifiers are supported we'll assume linear-only. Obviously
that may not work for every driver out there, but not much more
we can do unless we start to actually probing with addfb.

Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_kms.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 476a786233c0..5641d8c1cf7c 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -4068,8 +4068,28 @@ static void igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t *plane
 	int idx = 0;
 	int count;
 
-	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS))
+	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS)) {
+		drmModePlanePtr p = plane->drm_plane;
+
+		count = p->count_formats;
+
+		plane->format_mod_count = count;
+		plane->formats = calloc(count, sizeof(plane->formats[0]));
+		igt_assert(plane->formats);
+		plane->modifiers = calloc(count, sizeof(plane->modifiers[0]));
+		igt_assert(plane->modifiers);
+
+		/*
+		 * We don't know which modifiers are
+		 * supported, so we'll assume linear only.
+		 */
+		for (int i = 0; i < count; i++) {
+			plane->formats[i] = p->formats[i];
+			plane->modifiers[i] = DRM_FORMAT_MOD_LINEAR;
+		}
+
 		return;
+	}
 
 	blob_id = igt_plane_get_prop(plane, IGT_PLANE_IN_FORMATS);
 
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 02/25] tests/kms_ccs: Use igt_plane_has_format_mod()
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
@ 2018-07-19 15:03 ` Ville Syrjala
  2018-09-20 20:56   ` Paulo Zanoni
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 03/25] tests/kms_plane: Add validate-in-formats subtest Ville Syrjala
                   ` (25 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:03 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the open coded IN_FORMATS parsing with
igt_plane_has_format_mod() now that we have such a thing.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_ccs.c | 50 +-------------------------------------------------
 1 file changed, 1 insertion(+), 49 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index e1ee58801ac3..fe21b3a866de 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -132,55 +132,7 @@ modifiers_ptr(struct local_drm_format_modifier_blob *blob)
 
 static bool plane_has_format_with_ccs(data_t *data, igt_plane_t *plane, uint32_t format)
 {
-	drmModePropertyBlobPtr blob;
-	struct local_drm_format_modifier_blob *blob_data;
-	struct local_drm_format_modifier *modifiers, *last_mod;
-	uint32_t *formats, *last_fmt;
-	uint64_t blob_id;
-	bool ret;
-	int fmt_idx = -1;
-
-	ret = kmstest_get_property(data->drm_fd, plane->drm_plane->plane_id,
-				   DRM_MODE_OBJECT_PLANE, "IN_FORMATS",
-				   NULL, &blob_id, NULL);
-	igt_skip_on_f(ret == false, "IN_FORMATS not supported by kernel\n");
-	igt_skip_on_f(blob_id == 0, "IN_FORMATS not supported by plane\n");
-	blob = drmModeGetPropertyBlob(data->drm_fd, blob_id);
-	igt_assert(blob);
-	igt_assert_lte(sizeof(struct local_drm_format_modifier_blob),
-		       blob->length);
-
-	blob_data = (struct local_drm_format_modifier_blob *) blob->data;
-	formats = formats_ptr(blob_data);
-	last_fmt = &formats[blob_data->count_formats];
-	igt_assert_lte(((char *) last_fmt - (char *) blob_data), blob->length);
-	for (int i = 0; i < blob_data->count_formats; i++) {
-		if (formats[i] == format) {
-			fmt_idx = i;
-			break;
-		}
-	}
-
-	if (fmt_idx == -1)
-		return false;
-
-	modifiers = modifiers_ptr(blob_data);
-	last_mod = &modifiers[blob_data->count_modifiers];
-	igt_assert_lte(((char *) last_mod - (char *) blob_data), blob->length);
-	for (int i = 0; i < blob_data->count_modifiers; i++) {
-		if (modifiers[i].modifier != LOCAL_I915_FORMAT_MOD_Y_TILED_CCS)
-			continue;
-
-		if (modifiers[i].offset > fmt_idx ||
-		    fmt_idx > modifiers[i].offset + 63)
-			continue;
-
-		if (modifiers[i].formats &
-		    (1UL << (fmt_idx - modifiers[i].offset)))
-			return true;
-	}
-
-	return false;
+	return igt_plane_has_format_mod(plane, format, LOCAL_I915_FORMAT_MOD_Y_TILED_CCS);
 }
 
 static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 03/25] tests/kms_plane: Add validate-in-formats subtest
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 02/25] tests/kms_ccs: Use igt_plane_has_format_mod() Ville Syrjala
@ 2018-07-19 15:03 ` Ville Syrjala
  2018-09-20 21:10   ` Paulo Zanoni
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 04/25] tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats Ville Syrjala
                   ` (24 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:03 UTC (permalink / raw)
  To: igt-dev; +Cc: Ulrich Hecht

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Cross check the format list in the IN_FORMATS blob vs. the
format list returned by getplane.

Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_plane.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index f9e123f0d1ea..e0625748186f 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -366,6 +366,53 @@ test_plane_panning(data_t *data, enum pipe pipe, unsigned int flags)
 	igt_skip_on(connected_outs == 0);
 }
 
+static void validate_plane_in_formats(igt_plane_t *plane)
+{
+	drmModePlanePtr drm_plane = plane->drm_plane;
+
+	igt_require(plane->format_mod_count);
+
+	/*
+	 * Make sure every format in the IN_FORMATS blob
+	 * also appears in the getplane formats.
+	 */
+	for (int i = 0; i < plane->format_mod_count; i++) {
+		int j;
+
+		for (j = 0; j < drm_plane->count_formats; j++) {
+			if (plane->formats[i] == drm_plane->formats[j])
+				break;
+		}
+		igt_assert_lt(j, drm_plane->count_formats);
+	}
+
+	/*
+	 * Make sure every format in getplane also
+	 * appears in the IN_FORMATS blob.
+	 */
+	for (int i = 0; i < drm_plane->count_formats; i++) {
+		int j;
+
+		for (j = 0; j < plane->format_mod_count; j++) {
+			if (drm_plane->formats[i] == plane->formats[j])
+				break;
+		}
+		igt_assert_lt(j, plane->format_mod_count);
+	}
+}
+
+static void validate_in_formats(data_t *data)
+{
+	enum pipe pipe;
+
+	for_each_pipe(&data->display, pipe) {
+		igt_plane_t *plane;
+
+		for_each_plane_on_pipe(&data->display, pipe, plane)
+			validate_plane_in_formats(plane);
+	}
+}
+
 static const color_t colors[] = {
 	{ 1.0f, 0.0f, 0.0f, },
 	{ 0.0f, 1.0f, 0.0f, },
@@ -592,6 +639,9 @@ igt_main
 		igt_display_init(&data.display, data.drm_fd);
 	}
 
+	igt_subtest_f("validate-in-formats")
+		validate_in_formats(&data);
+
 	for_each_pipe_static(pipe)
 		run_tests_for_pipe_plane(&data, pipe);
 
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 04/25] tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 02/25] tests/kms_ccs: Use igt_plane_has_format_mod() Ville Syrjala
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 03/25] tests/kms_plane: Add validate-in-formats subtest Ville Syrjala
@ 2018-07-19 15:03 ` Ville Syrjala
  2018-09-20 23:36   ` Paulo Zanoni
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 05/25] tests/gem_render_copy: Fix clipped height Ville Syrjala
                   ` (23 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:03 UTC (permalink / raw)
  To: igt-dev; +Cc: Ulrich Hecht

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Try to create a bunch of fbs with different formats/modfifiers and
make sure sure addfb2 accepts/rejects them in accordance with what
the plane IN_FORMATS blobifiers are advertizing.

We only check "easy" formats (ie. RGB/C8, no YUV/planar etc.). We
also assume that one can always create a 64x64 fb with stride of
64*8 bytes.

v2: Skip when blobifiers aren't supported

Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_addfb_basic.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 104 insertions(+), 3 deletions(-)

diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index 7d8852f02003..9e33d00346e0 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -41,6 +41,97 @@
 uint32_t gem_bo;
 uint32_t gem_bo_small;
 
+static const uint64_t modifiers[] = {
+	DRM_FORMAT_MOD_LINEAR,
+	I915_FORMAT_MOD_X_TILED,
+	I915_FORMAT_MOD_Y_TILED,
+	I915_FORMAT_MOD_Yf_TILED,
+	I915_FORMAT_MOD_Y_TILED_CCS,
+	I915_FORMAT_MOD_Yf_TILED_CCS,
+};
+
+static const uint32_t formats[] = {
+	DRM_FORMAT_C8,
+
+	DRM_FORMAT_RGB565,
+	DRM_FORMAT_BGR565,
+
+	DRM_FORMAT_RGB888,
+	DRM_FORMAT_BGR888,
+
+	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_XBGR8888,
+	DRM_FORMAT_RGBX8888,
+	DRM_FORMAT_BGRX8888,
+	DRM_FORMAT_ARGB8888,
+	DRM_FORMAT_ABGR8888,
+	DRM_FORMAT_RGBA8888,
+	DRM_FORMAT_BGRA8888,
+
+	DRM_FORMAT_XRGB2101010,
+	DRM_FORMAT_XBGR2101010,
+	DRM_FORMAT_RGBX1010102,
+	DRM_FORMAT_BGRX1010102,
+	DRM_FORMAT_ARGB2101010,
+	DRM_FORMAT_ABGR2101010,
+	DRM_FORMAT_RGBA1010102,
+	DRM_FORMAT_BGRA1010102,
+};
+
+#define IGT_FORMAT_FMT "%c%c%c%c (0x%08x)"
+#define IGT_FORMAT_ARGS(f) ((f) >> 0) & 0xff, ((f) >> 8) & 0xff, \
+		((f) >> 16) & 0xff, ((f) >> 24) & 0xff, (f)
+
+/*
+ * make sure addfb2 accepts/rejects every format/modifier
+ * in accordance with the plane IN_FORMATS properties.
+ */
+static void expected_formats(igt_display_t *display)
+{
+	int fd = display->drm_fd;
+	uint32_t handle;
+
+	igt_require(display->format_mod_count);
+
+	handle = gem_create(fd, 64*8*64);
+	igt_assert(handle);
+
+	for (int i = 0; i < ARRAY_SIZE(formats); i++) {
+		uint32_t format = formats[i];
+
+		for (int j = 0; j < ARRAY_SIZE(modifiers); j++) {
+			uint64_t modifier = modifiers[j];
+			struct drm_mode_fb_cmd2 f = {
+				.width = 64,
+				.height = 64,
+				.pixel_format = format,
+				.handles[0] = handle,
+				.pitches[0] = 64 * 8,
+				.modifier[0] = modifier,
+				.flags = DRM_MODE_FB_MODIFIERS,
+			};
+			int ret;
+
+			igt_info("Testing format " IGT_FORMAT_FMT " / modifier 0x%" PRIx64 "\n",
+				 IGT_FORMAT_ARGS(format), modifier);
+
+			ret = drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f);
+
+			if (igt_display_has_format_mod(display, format, modifier)) {
+				igt_assert_eq(ret, 0);
+				igt_assert_neq(f.fb_id, 0);
+			} else {
+				igt_assert_neq(ret, 0);
+				igt_assert_eq(f.fb_id, 0);
+			}
+
+			drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id);
+		}
+	}
+
+	gem_close(fd, handle);
+}
+
 static void invalid_tests(int fd)
 {
 	struct local_drm_mode_fb_cmd2 f = {};
@@ -539,13 +630,17 @@ static void prop_tests(int fd)
 
 }
 
-int fd;
+static igt_display_t display;
+static int fd;
 
 igt_main
 {
-	igt_fixture
+	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_ANY);
 
+		igt_display_init(&display, fd);
+	}
+
 	invalid_tests(fd);
 
 	pitch_tests(fd);
@@ -560,6 +655,12 @@ igt_main
 
 	prop_tests(fd);
 
-	igt_fixture
+	igt_subtest("expected-formats")
+		expected_formats(&display);
+
+	igt_fixture {
+		igt_display_fini(&display);
+
 		close(fd);
+	}
 }
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 05/25] tests/gem_render_copy: Fix clipped height
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (2 preceding siblings ...)
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 04/25] tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats Ville Syrjala
@ 2018-07-19 15:03 ` Ville Syrjala
  2018-08-24  3:17   ` Dhinakaran Pandiyan
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 06/25] lib/igt_fb: Respect the users choice of stride Ville Syrjala
                   ` (22 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:03 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Assign the clipped height to 'h', not 'w'. This didn't cause any
problems so far because we use square buffers.

Also get rid of the gcc variable shadowing warnings by not nesting the
min()/max().

Fixes: aaa23eff21a1 ("tests/gem_render_copy: Use a more elaborate pattern of pixels")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/gem_render_copy.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
index 238e70e97b5d..135375a90ec2 100644
--- a/tests/gem_render_copy.c
+++ b/tests/gem_render_copy.c
@@ -254,8 +254,11 @@ scratch_buf_copy(data_t *data,
 	linear_src = gem_mmap__gtt(data->drm_fd, src->bo->handle,
 				   src->bo->size, PROT_READ);
 
-	w = min(w, min(width - sx, width - dx));
-	w = min(h, min(height - sy, height - dy));
+	w = min(w, width - sx);
+	w = min(w, width - dx);
+
+	h = min(h, height - sy);
+	h = min(h, height - dy);
 
 	for (int y = 0; y < h; y++) {
 		igt_memcpy_from_wc(&linear_dst[(dy+y) * width + dx],
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 06/25] lib/igt_fb: Respect the users choice of stride
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (3 preceding siblings ...)
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 05/25] tests/gem_render_copy: Fix clipped height Ville Syrjala
@ 2018-07-19 15:03 ` Ville Syrjala
  2018-09-21  0:04   ` Paulo Zanoni
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 07/25] lib: Add DIV_ROUND_UP() Ville Syrjala
                   ` (21 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:03 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We prented to allow the caller to specify the stride explicitly for the
fb. But we don't actually use that user specified stride when we
calculate the require bo size. Fix that oversight.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ae71d9673228..6748357ad16b 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -215,11 +215,12 @@ static unsigned planar_height(struct format_desc_struct *format, unsigned height
 
 static void calc_fb_size_planar(int fd, int width, int height,
 				struct format_desc_struct *format,
-				uint64_t tiling, unsigned *size_ret,
-				unsigned *stride_ret, unsigned *offsets)
+				uint64_t tiling, unsigned stride,
+				unsigned *size_ret, unsigned *stride_ret,
+				unsigned *offsets)
 {
 	int plane;
-	unsigned stride = 0, tile_width, tile_height;
+	unsigned max_stride = 0, tile_width, tile_height;
 
 	*size_ret = 0;
 
@@ -229,10 +230,13 @@ static void calc_fb_size_planar(int fd, int width, int height,
 		igt_get_fb_tile_size(fd, tiling, format->plane_bpp[plane], &tile_width, &tile_height);
 
 		plane_stride = ALIGN(planar_stride(format, width, plane), tile_width);
-		if (stride < plane_stride)
-			stride = plane_stride;
+		if (max_stride < plane_stride)
+			max_stride = plane_stride;
 	}
 
+	if (!stride)
+		stride = max_stride;
+
 	for (plane = 0; plane < format->num_planes; plane++) {
 		if (offsets)
 			offsets[plane] = *size_ret;
@@ -251,9 +255,9 @@ static void calc_fb_size_planar(int fd, int width, int height,
 
 static void calc_fb_size_packed(int fd, int width, int height,
 				struct format_desc_struct *format, uint64_t tiling,
-				unsigned *size_ret, unsigned *stride_ret)
+				unsigned stride, unsigned *size_ret, unsigned *stride_ret)
 {
-	unsigned int tile_width, tile_height, stride, size;
+	unsigned int tile_width, tile_height, size;
 	int byte_width = width * (format->plane_bpp[0] / 8);
 
 	igt_get_fb_tile_size(fd, tiling, format->plane_bpp[0], &tile_width, &tile_height);
@@ -270,15 +274,18 @@ static void calc_fb_size_packed(int fd, int width, int height,
 		 * tiled. But then that failure is expected.
 		 */
 
-		v = byte_width;
-		for (stride = 512; stride < v; stride *= 2)
-			;
+		if (!stride) {
+			v = byte_width;
+			for (stride = 512; stride < v; stride *= 2)
+				;
+		}
 
 		v = stride * height;
 		for (size = 1024*1024; size < v; size *= 2)
 			;
 	} else {
-		stride = ALIGN(byte_width, tile_width);
+		if (!stride)
+			stride = ALIGN(byte_width, tile_width);
 		size = stride * ALIGN(height, tile_height);
 	}
 
@@ -306,9 +313,9 @@ void igt_calc_fb_size(int fd, int width, int height, uint32_t drm_format, uint64
 	igt_assert(format);
 
 	if (format->num_planes > 1)
-		calc_fb_size_planar(fd, width, height, format, tiling, size_ret, stride_ret, NULL);
+		calc_fb_size_planar(fd, width, height, format, tiling, 0, size_ret, stride_ret, NULL);
 	else
-		calc_fb_size_packed(fd, width, height, format, tiling, size_ret, stride_ret);
+		calc_fb_size_packed(fd, width, height, format, tiling, 0, size_ret, stride_ret);
 }
 
 /**
@@ -383,10 +390,10 @@ static int create_bo_for_fb(int fd, int width, int height,
 		unsigned calculated_size, calculated_stride;
 
 		if (format->num_planes > 1)
-			calc_fb_size_planar(fd, width, height, format, tiling,
+			calc_fb_size_planar(fd, width, height, format, tiling, stride,
 					    &calculated_size, &calculated_stride, offsets);
 		else
-			calc_fb_size_packed(fd, width, height, format, tiling,
+			calc_fb_size_packed(fd, width, height, format, tiling, stride,
 					    &calculated_size, &calculated_stride);
 
 		if (stride == 0)
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 07/25] lib: Add DIV_ROUND_UP()
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (4 preceding siblings ...)
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 06/25] lib/igt_fb: Respect the users choice of stride Ville Syrjala
@ 2018-07-19 15:03 ` Ville Syrjala
  2018-09-18 21:17   ` Paulo Zanoni
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 08/25] lib/igt_fb: Use fb_blit_upload as the base class for fb_convert_blit_upload Ville Syrjala
                   ` (20 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:03 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add DIV_ROUND_UP() and replace some hand rolled versions with it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_aux.h      | 2 ++
 lib/igt_fb.c       | 4 ++--
 tests/i915_query.c | 2 --
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index ef89faa9bd30..01c0be382f1a 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -287,4 +287,6 @@ void igt_lsof(const char *dpath);
 
 #define is_power_of_two(x)  (((x) & ((x)-1)) == 0)
 
+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+
 #endif /* IGT_AUX_H */
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 6748357ad16b..324cb624144b 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -193,7 +193,7 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 static unsigned planar_width(struct format_desc_struct *format, unsigned width, int plane)
 {
 	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
-		return (width + 1) / 2;
+		return DIV_ROUND_UP(width, 2);
 
 	return width;
 }
@@ -208,7 +208,7 @@ static unsigned planar_stride(struct format_desc_struct *format, unsigned width,
 static unsigned planar_height(struct format_desc_struct *format, unsigned height, int plane)
 {
 	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
-		return (height + 1) / 2;
+		return DIV_ROUND_UP(height, 2);
 
 	return height;
 }
diff --git a/tests/i915_query.c b/tests/i915_query.c
index c7de8cbd8371..08aabf946788 100644
--- a/tests/i915_query.c
+++ b/tests/i915_query.c
@@ -242,8 +242,6 @@ static void test_query_topology_unsupported(int fd)
 	igt_assert_eq(item.length, -ENODEV);
 }
 
-#define DIV_ROUND_UP(val, div) (ALIGN(val, div) / div)
-
 static bool
 slice_available(const struct drm_i915_query_topology_info *topo_info,
 		int s)
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 08/25] lib/igt_fb: Use fb_blit_upload as the base class for fb_convert_blit_upload
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (5 preceding siblings ...)
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 07/25] lib: Add DIV_ROUND_UP() Ville Syrjala
@ 2018-07-19 15:03 ` Ville Syrjala
  2018-09-21  0:15   ` Paulo Zanoni
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 09/25] lib/igt_fb: Pass fb_blit_upload to free_linear_mapping() Ville Syrjala
                   ` (19 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:03 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

fb_blit_upload already has everything we need, so let's use it as the
base class for fb_convert_blit_upload.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 57 +++++++++++++++++++++++++++------------------------------
 1 file changed, 27 insertions(+), 30 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 324cb624144b..b5eef1a23576 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1368,15 +1368,12 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
 }
 
 struct fb_convert_blit_upload {
-	int fd;
-	struct igt_fb *fb;
+	struct fb_blit_upload base;
 
 	struct {
 		uint8_t *map;
 		unsigned stride, size;
 	} rgb24;
-
-	struct fb_blit_linear linear;
 };
 
 static uint8_t clamprgb(float val)
@@ -1404,8 +1401,8 @@ static void convert_nv12_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
 	int i, j;
 	const uint8_t *y, *uv;
 	uint8_t *rgb24 = blit->rgb24.map;
-	unsigned rgb24_stride = blit->rgb24.stride, planar_stride = blit->linear.stride;
-	uint8_t *buf = malloc(blit->linear.size);
+	unsigned rgb24_stride = blit->rgb24.stride, planar_stride = blit->base.linear.stride;
+	uint8_t *buf = malloc(blit->base.linear.size);
 	struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb->color_encoding,
 						    fb->color_range);
 
@@ -1414,9 +1411,9 @@ static void convert_nv12_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
 	 * it's faster to copy the whole BO to a temporary buffer and convert
 	 * from there.
 	 */
-	igt_memcpy_from_wc(buf, blit->linear.map, blit->linear.size);
-	y = &buf[blit->linear.offsets[0]];
-	uv = &buf[blit->linear.offsets[1]];
+	igt_memcpy_from_wc(buf, blit->base.linear.map, blit->base.linear.size);
+	y = &buf[blit->base.linear.offsets[0]];
+	uv = &buf[blit->base.linear.offsets[1]];
 
 	for (i = 0; i < fb->height / 2; i++) {
 		for (j = 0; j < fb->width / 2; j++) {
@@ -1510,11 +1507,11 @@ static void convert_nv12_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
 static void convert_rgb24_to_nv12(struct igt_fb *fb, struct fb_convert_blit_upload *blit)
 {
 	int i, j;
-	uint8_t *y = &blit->linear.map[blit->linear.offsets[0]];
-	uint8_t *uv = &blit->linear.map[blit->linear.offsets[1]];
+	uint8_t *y = &blit->base.linear.map[blit->base.linear.offsets[0]];
+	uint8_t *uv = &blit->base.linear.map[blit->base.linear.offsets[1]];
 	const uint8_t *rgb24 = blit->rgb24.map;
 	unsigned rgb24_stride = blit->rgb24.stride;
-	unsigned planar_stride = blit->linear.stride;
+	unsigned planar_stride = blit->base.linear.stride;
 	struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb->color_encoding,
 						    fb->color_range);
 
@@ -1641,8 +1638,8 @@ static void convert_yuyv_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
 	int i, j;
 	const uint8_t *yuyv;
 	uint8_t *rgb24 = blit->rgb24.map;
-	unsigned rgb24_stride = blit->rgb24.stride, yuyv_stride = blit->linear.stride;
-	uint8_t *buf = malloc(blit->linear.size);
+	unsigned rgb24_stride = blit->rgb24.stride, yuyv_stride = blit->base.linear.stride;
+	uint8_t *buf = malloc(blit->base.linear.size);
 	struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb->color_encoding,
 						    fb->color_range);
 
@@ -1651,7 +1648,7 @@ static void convert_yuyv_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
 	 * it's faster to copy the whole BO to a temporary buffer and convert
 	 * from there.
 	 */
-	igt_memcpy_from_wc(buf, blit->linear.map, blit->linear.size);
+	igt_memcpy_from_wc(buf, blit->base.linear.map, blit->base.linear.size);
 	yuyv = buf;
 
 	for (i = 0; i < fb->height; i++) {
@@ -1698,10 +1695,10 @@ static void convert_rgb24_to_yuyv(struct igt_fb *fb, struct fb_convert_blit_uplo
 				  const unsigned char swz[4])
 {
 	int i, j;
-	uint8_t *yuyv = blit->linear.map;
+	uint8_t *yuyv = blit->base.linear.map;
 	const uint8_t *rgb24 = blit->rgb24.map;
 	unsigned rgb24_stride = blit->rgb24.stride;
-	unsigned yuyv_stride = blit->linear.stride;
+	unsigned yuyv_stride = blit->base.linear.stride;
 	struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb->color_encoding,
 						    fb->color_range);
 
@@ -1750,7 +1747,7 @@ static void convert_rgb24_to_yuyv(struct igt_fb *fb, struct fb_convert_blit_uplo
 static void destroy_cairo_surface__convert(void *arg)
 {
 	struct fb_convert_blit_upload *blit = arg;
-	struct igt_fb *fb = blit->fb;
+	struct igt_fb *fb = blit->base.fb;
 
 	/* Convert linear rgb back! */
 	switch(fb->drm_format) {
@@ -1770,10 +1767,10 @@ static void destroy_cairo_surface__convert(void *arg)
 
 	munmap(blit->rgb24.map, blit->rgb24.size);
 
-	if (blit->linear.handle)
-		free_linear_mapping(blit->fd, blit->fb, &blit->linear);
+	if (blit->base.linear.handle)
+		free_linear_mapping(blit->base.fd, blit->base.fb, &blit->base.linear);
 	else
-		gem_munmap(blit->linear.map, fb->size);
+		gem_munmap(blit->base.linear.map, fb->size);
 
 	free(blit);
 
@@ -1785,8 +1782,8 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	struct fb_convert_blit_upload *blit = malloc(sizeof(*blit));
 	igt_assert(blit);
 
-	blit->fd = fd;
-	blit->fb = fb;
+	blit->base.fd = fd;
+	blit->base.fb = fb;
 	blit->rgb24.stride = ALIGN(fb->width * 4, 16);
 	blit->rgb24.size = ALIGN(blit->rgb24.stride * fb->height, sysconf(_SC_PAGESIZE));
 	blit->rgb24.map = mmap(NULL, blit->rgb24.size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
@@ -1794,15 +1791,15 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 
 	if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
 	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
-		setup_linear_mapping(fd, fb, &blit->linear);
+		setup_linear_mapping(fd, fb, &blit->base.linear);
 	} else {
-		blit->linear.handle = 0;
-		blit->linear.map = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
+		blit->base.linear.handle = 0;
+		blit->base.linear.map = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
 					      PROT_READ | PROT_WRITE);
-		igt_assert(blit->linear.map);
-		blit->linear.stride = fb->stride;
-		blit->linear.size = fb->size;
-		memcpy(blit->linear.offsets, fb->offsets, sizeof(fb->offsets));
+		igt_assert(blit->base.linear.map);
+		blit->base.linear.stride = fb->stride;
+		blit->base.linear.size = fb->size;
+		memcpy(blit->base.linear.offsets, fb->offsets, sizeof(fb->offsets));
 	}
 
 	/* Convert to linear rgb! */
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 09/25] lib/igt_fb: Pass fb_blit_upload to free_linear_mapping()
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (6 preceding siblings ...)
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 08/25] lib/igt_fb: Use fb_blit_upload as the base class for fb_convert_blit_upload Ville Syrjala
@ 2018-07-19 15:03 ` Ville Syrjala
  2018-09-21  0:20   ` Paulo Zanoni
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 10/25] lib/igt_fb: s/planar_foo/fb_plane_foo/ Ville Syrjala
                   ` (18 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:03 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

With fb_blit_upload now being the base class of fb_convert_blit_upload
we can pass the entire structure down to free_linear_mapping().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index b5eef1a23576..c89a2c9e170d 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1208,8 +1208,11 @@ struct fb_blit_upload {
 	struct fb_blit_linear linear;
 };
 
-static void free_linear_mapping(int fd, struct igt_fb *fb, struct fb_blit_linear *linear)
+static void free_linear_mapping(struct fb_blit_upload *blit)
 {
+	int fd = blit->fd;
+	struct igt_fb *fb = blit->fb;
+	struct fb_blit_linear *linear = &blit->linear;
 	unsigned int obj_tiling = igt_fb_mod_to_tiling(fb->tiling);
 	int i;
 
@@ -1242,7 +1245,7 @@ static void destroy_cairo_surface__blit(void *arg)
 
 	blit->fb->cairo_surface = NULL;
 
-	free_linear_mapping(blit->fd, blit->fb, &blit->linear);
+	free_linear_mapping(blit);
 
 	free(blit);
 }
@@ -1768,7 +1771,7 @@ static void destroy_cairo_surface__convert(void *arg)
 	munmap(blit->rgb24.map, blit->rgb24.size);
 
 	if (blit->base.linear.handle)
-		free_linear_mapping(blit->base.fd, blit->base.fb, &blit->base.linear);
+		free_linear_mapping(&blit->base);
 	else
 		gem_munmap(blit->base.linear.map, fb->size);
 
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 10/25] lib/igt_fb: s/planar_foo/fb_plane_foo/
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (7 preceding siblings ...)
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 09/25] lib/igt_fb: Pass fb_blit_upload to free_linear_mapping() Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-09-21 21:58   ` Paulo Zanoni
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 11/25] lib/igt_fb: Add fb_plane_bpp() Ville Syrjala
                   ` (17 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Rename the planar_foo() functions to fb_plane_foo(). Makes it clear
they're perfectly usable with non-planar formts too.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index c89a2c9e170d..e8b8200cdaa5 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -190,7 +190,8 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 	}
 }
 
-static unsigned planar_width(struct format_desc_struct *format, unsigned width, int plane)
+static unsigned fb_plane_width(struct format_desc_struct *format,
+			       unsigned width, int plane)
 {
 	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
 		return DIV_ROUND_UP(width, 2);
@@ -198,14 +199,16 @@ static unsigned planar_width(struct format_desc_struct *format, unsigned width,
 	return width;
 }
 
-static unsigned planar_stride(struct format_desc_struct *format, unsigned width, int plane)
+static unsigned fb_plane_min_stride(struct format_desc_struct *format,
+				    unsigned width, int plane)
 {
 	unsigned cpp = format->plane_bpp[plane] / 8;
 
-	return planar_width(format, width, plane) * cpp;
+	return fb_plane_width(format, width, plane) * cpp;
 }
 
-static unsigned planar_height(struct format_desc_struct *format, unsigned height, int plane)
+static unsigned fb_plane_height(struct format_desc_struct *format,
+				unsigned height, int plane)
 {
 	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
 		return DIV_ROUND_UP(height, 2);
@@ -229,7 +232,7 @@ static void calc_fb_size_planar(int fd, int width, int height,
 
 		igt_get_fb_tile_size(fd, tiling, format->plane_bpp[plane], &tile_width, &tile_height);
 
-		plane_stride = ALIGN(planar_stride(format, width, plane), tile_width);
+		plane_stride = ALIGN(fb_plane_min_stride(format, width, plane), tile_width);
 		if (max_stride < plane_stride)
 			max_stride = plane_stride;
 	}
@@ -243,7 +246,7 @@ static void calc_fb_size_planar(int fd, int width, int height,
 
 		igt_get_fb_tile_size(fd, tiling, format->plane_bpp[plane], &tile_width, &tile_height);
 
-		*size_ret += stride * ALIGN(planar_height(format, height, plane), tile_height);
+		*size_ret += stride * ALIGN(fb_plane_height(format, height, plane), tile_height);
 	}
 
 	if (offsets)
@@ -258,7 +261,7 @@ static void calc_fb_size_packed(int fd, int width, int height,
 				unsigned stride, unsigned *size_ret, unsigned *stride_ret)
 {
 	unsigned int tile_width, tile_height, size;
-	int byte_width = width * (format->plane_bpp[0] / 8);
+	int byte_width = fb_plane_min_stride(format, width, 0);
 
 	igt_get_fb_tile_size(fd, tiling, format->plane_bpp[0], &tile_width, &tile_height);
 
@@ -885,8 +888,8 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 
 	for (i = 0; i < f->num_planes; i++) {
 		fb->plane_bpp[i] = f->plane_bpp[i];
-		fb->plane_height[i] = planar_height(f, height, i);
-		fb->plane_width[i] = planar_width(f, width, i);
+		fb->plane_height[i] = fb_plane_height(f, height, i);
+		fb->plane_width[i] = fb_plane_width(f, width, i);
 	}
 
 	return fb_id;
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 11/25] lib/igt_fb: Add fb_plane_bpp()
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (8 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 10/25] lib/igt_fb: s/planar_foo/fb_plane_foo/ Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-09-21 22:02   ` Paulo Zanoni
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 12/25] lib/igt_fb: Add fb_num_planes() Ville Syrjala
                   ` (16 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add another helper to get the bpp for a specific color plane. We'll
need this for ccs support later.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index e8b8200cdaa5..df43d9c66ded 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -199,10 +199,15 @@ static unsigned fb_plane_width(struct format_desc_struct *format,
 	return width;
 }
 
+static unsigned fb_plane_bpp(struct format_desc_struct *format, int plane)
+{
+	return format->plane_bpp[plane];
+}
+
 static unsigned fb_plane_min_stride(struct format_desc_struct *format,
 				    unsigned width, int plane)
 {
-	unsigned cpp = format->plane_bpp[plane] / 8;
+	unsigned cpp = fb_plane_bpp(format, plane) / 8;
 
 	return fb_plane_width(format, width, plane) * cpp;
 }
@@ -230,7 +235,8 @@ static void calc_fb_size_planar(int fd, int width, int height,
 	for (plane = 0; plane < format->num_planes; plane++) {
 		unsigned plane_stride;
 
-		igt_get_fb_tile_size(fd, tiling, format->plane_bpp[plane], &tile_width, &tile_height);
+		igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, plane),
+				     &tile_width, &tile_height);
 
 		plane_stride = ALIGN(fb_plane_min_stride(format, width, plane), tile_width);
 		if (max_stride < plane_stride)
@@ -244,7 +250,8 @@ static void calc_fb_size_planar(int fd, int width, int height,
 		if (offsets)
 			offsets[plane] = *size_ret;
 
-		igt_get_fb_tile_size(fd, tiling, format->plane_bpp[plane], &tile_width, &tile_height);
+		igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, plane),
+				     &tile_width, &tile_height);
 
 		*size_ret += stride * ALIGN(fb_plane_height(format, height, plane), tile_height);
 	}
@@ -263,7 +270,8 @@ static void calc_fb_size_packed(int fd, int width, int height,
 	unsigned int tile_width, tile_height, size;
 	int byte_width = fb_plane_min_stride(format, width, 0);
 
-	igt_get_fb_tile_size(fd, tiling, format->plane_bpp[0], &tile_width, &tile_height);
+	igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, 0),
+			     &tile_width, &tile_height);
 
 	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
 	    intel_gen(intel_get_drm_devid(fd)) <= 3) {
@@ -456,7 +464,7 @@ static int create_bo_for_fb(int fd, int width, int height,
 			*is_dumb = true;
 
 		return kmstest_dumb_create(fd, width, height,
-					   format->plane_bpp[0],
+					   fb_plane_bpp(format, 0),
 					   stride_ret, size_ret);
 	}
 }
@@ -887,7 +895,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 	fb->color_range = color_range;
 
 	for (i = 0; i < f->num_planes; i++) {
-		fb->plane_bpp[i] = f->plane_bpp[i];
+		fb->plane_bpp[i] = fb_plane_bpp(f, i);
 		fb->plane_height[i] = fb_plane_height(f, height, i);
 		fb->plane_width[i] = fb_plane_width(f, width, i);
 	}
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 12/25] lib/igt_fb: Add fb_num_planes()
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (9 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 11/25] lib/igt_fb: Add fb_plane_bpp() Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-09-21 22:05   ` Paulo Zanoni
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 13/25] lib/igt_fb: Extract calc_plane_stride() Ville Syrjala
                   ` (15 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add a helper to return the number of color planes. We'll need this
for ccs support later.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index df43d9c66ded..0319afa9749f 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -221,6 +221,11 @@ static unsigned fb_plane_height(struct format_desc_struct *format,
 	return height;
 }
 
+static int fb_num_planes(struct format_desc_struct *format)
+{
+	return format->num_planes;
+}
+
 static void calc_fb_size_planar(int fd, int width, int height,
 				struct format_desc_struct *format,
 				uint64_t tiling, unsigned stride,
@@ -232,7 +237,7 @@ static void calc_fb_size_planar(int fd, int width, int height,
 
 	*size_ret = 0;
 
-	for (plane = 0; plane < format->num_planes; plane++) {
+	for (plane = 0; plane < fb_num_planes(format); plane++) {
 		unsigned plane_stride;
 
 		igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, plane),
@@ -246,7 +251,7 @@ static void calc_fb_size_planar(int fd, int width, int height,
 	if (!stride)
 		stride = max_stride;
 
-	for (plane = 0; plane < format->num_planes; plane++) {
+	for (plane = 0; plane < fb_num_planes(format); plane++) {
 		if (offsets)
 			offsets[plane] = *size_ret;
 
@@ -323,7 +328,7 @@ void igt_calc_fb_size(int fd, int width, int height, uint32_t drm_format, uint64
 	struct format_desc_struct *format = lookup_drm_format(drm_format);
 	igt_assert(format);
 
-	if (format->num_planes > 1)
+	if (fb_num_planes(format) > 1)
 		calc_fb_size_planar(fd, width, height, format, tiling, 0, size_ret, stride_ret, NULL);
 	else
 		calc_fb_size_packed(fd, width, height, format, tiling, 0, size_ret, stride_ret);
@@ -400,7 +405,7 @@ static int create_bo_for_fb(int fd, int width, int height,
 	if (tiling || size || stride || igt_format_is_yuv(format->drm_id)) {
 		unsigned calculated_size, calculated_stride;
 
-		if (format->num_planes > 1)
+		if (fb_num_planes(format) > 1)
 			calc_fb_size_planar(fd, width, height, format, tiling, stride,
 					    &calculated_size, &calculated_stride, offsets);
 		else
@@ -874,7 +879,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 
 		handles[0] = fb->gem_handle;
 		pitches[0] = fb->stride;
-		for (i = 0; i < f->num_planes; i++) {
+		for (i = 0; i < fb_num_planes(f); i++) {
 			handles[i] = fb->gem_handle;
 			pitches[i] = fb->stride;
 		}
@@ -890,11 +895,11 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 	fb->drm_format = format;
 	fb->fb_id = fb_id;
 	fb->fd = fd;
-	fb->num_planes = f->num_planes;
+	fb->num_planes = fb_num_planes(f);
 	fb->color_encoding = color_encoding;
 	fb->color_range = color_range;
 
-	for (i = 0; i < f->num_planes; i++) {
+	for (i = 0; i < fb_num_planes(f); i++) {
 		fb->plane_bpp[i] = fb_plane_bpp(f, i);
 		fb->plane_height[i] = fb_plane_height(f, height, i);
 		fb->plane_width[i] = fb_plane_width(f, width, i);
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 13/25] lib/igt_fb: Extract calc_plane_stride()
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (10 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 12/25] lib/igt_fb: Add fb_num_planes() Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-09-21 22:33   ` Paulo Zanoni
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 14/25] lib/igt_fb: Consolidate fb size calculation to one function Ville Syrjala
                   ` (14 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Extract the stride calculation from calc_fb_size_packed() to its own
thing so that we can use it to calculate just the stride.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 53 ++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 40 insertions(+), 13 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 0319afa9749f..dd6cd1f6409c 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -226,6 +226,38 @@ static int fb_num_planes(struct format_desc_struct *format)
 	return format->num_planes;
 }
 
+static unsigned calc_plane_stride(int fd,
+				  struct format_desc_struct *format,
+				  int width, uint64_t tiling, int plane)
+{
+	uint32_t min_stride = fb_plane_min_stride(format, width, plane);
+
+	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
+	    intel_gen(intel_get_drm_devid(fd)) <= 3) {
+		uint32_t stride;
+
+		/* Round the tiling up to the next power-of-two and the region
+		 * up to the next pot fence size so that this works on all
+		 * generations.
+		 *
+		 * This can still fail if the framebuffer is too large to be
+		 * tiled. But then that failure is expected.
+		 */
+		for (stride = 512; stride < min_stride; stride *= 2)
+			;
+
+		return stride;
+	} else {
+		unsigned int tile_width, tile_height;
+
+		igt_get_fb_tile_size(fd, tiling,
+				     fb_plane_bpp(format, plane),
+				     &tile_width, &tile_height);
+
+		return ALIGN(min_stride, tile_width);
+	}
+}
+
 static void calc_fb_size_planar(int fd, int width, int height,
 				struct format_desc_struct *format,
 				uint64_t tiling, unsigned stride,
@@ -272,11 +304,10 @@ static void calc_fb_size_packed(int fd, int width, int height,
 				struct format_desc_struct *format, uint64_t tiling,
 				unsigned stride, unsigned *size_ret, unsigned *stride_ret)
 {
-	unsigned int tile_width, tile_height, size;
-	int byte_width = fb_plane_min_stride(format, width, 0);
+	unsigned int size;
 
-	igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, 0),
-			     &tile_width, &tile_height);
+	if (!stride)
+		stride = calc_plane_stride(fd, format, width, tiling, 0);
 
 	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
 	    intel_gen(intel_get_drm_devid(fd)) <= 3) {
@@ -289,19 +320,15 @@ static void calc_fb_size_packed(int fd, int width, int height,
 		 * This can still fail if the framebuffer is too large to be
 		 * tiled. But then that failure is expected.
 		 */
-
-		if (!stride) {
-			v = byte_width;
-			for (stride = 512; stride < v; stride *= 2)
-				;
-		}
-
 		v = stride * height;
 		for (size = 1024*1024; size < v; size *= 2)
 			;
 	} else {
-		if (!stride)
-			stride = ALIGN(byte_width, tile_width);
+		unsigned int tile_width, tile_height;
+
+		igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, 0),
+				     &tile_width, &tile_height);
+
 		size = stride * ALIGN(height, tile_height);
 	}
 
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 14/25] lib/igt_fb: Consolidate fb size calculation to one function
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (11 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 13/25] lib/igt_fb: Extract calc_plane_stride() Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 15/25] lib/kms: Pass strides[] to __kms_addfb Ville Syrjala
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Eliminate the planar vs. packed size calculation differences and just
use one function for the entire thing.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 131 ++++++++++++++++++++++++++---------------------------------
 1 file changed, 57 insertions(+), 74 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index dd6cd1f6409c..0221a0b9b040 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -258,60 +258,15 @@ static unsigned calc_plane_stride(int fd,
 	}
 }
 
-static void calc_fb_size_planar(int fd, int width, int height,
+static unsigned calc_plane_size(int fd, int width, int height,
 				struct format_desc_struct *format,
-				uint64_t tiling, unsigned stride,
-				unsigned *size_ret, unsigned *stride_ret,
-				unsigned *offsets)
+				uint64_t tiling, int plane,
+				uint32_t stride)
 {
-	int plane;
-	unsigned max_stride = 0, tile_width, tile_height;
-
-	*size_ret = 0;
-
-	for (plane = 0; plane < fb_num_planes(format); plane++) {
-		unsigned plane_stride;
-
-		igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, plane),
-				     &tile_width, &tile_height);
-
-		plane_stride = ALIGN(fb_plane_min_stride(format, width, plane), tile_width);
-		if (max_stride < plane_stride)
-			max_stride = plane_stride;
-	}
-
-	if (!stride)
-		stride = max_stride;
-
-	for (plane = 0; plane < fb_num_planes(format); plane++) {
-		if (offsets)
-			offsets[plane] = *size_ret;
-
-		igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, plane),
-				     &tile_width, &tile_height);
-
-		*size_ret += stride * ALIGN(fb_plane_height(format, height, plane), tile_height);
-	}
-
-	if (offsets)
-		for (; plane < ARRAY_SIZE(format->plane_bpp); plane++)
-			offsets[plane] = 0;
-
-	*stride_ret = stride;
-}
-
-static void calc_fb_size_packed(int fd, int width, int height,
-				struct format_desc_struct *format, uint64_t tiling,
-				unsigned stride, unsigned *size_ret, unsigned *stride_ret)
-{
-	unsigned int size;
-
-	if (!stride)
-		stride = calc_plane_stride(fd, format, width, tiling, 0);
-
 	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
 	    intel_gen(intel_get_drm_devid(fd)) <= 3) {
-		int v;
+		unsigned int min_size = stride * height;
+		unsigned int size;
 
 		/* Round the tiling up to the next power-of-two and the region
 		 * up to the next pot fence size so that this works on all
@@ -320,20 +275,48 @@ static void calc_fb_size_packed(int fd, int width, int height,
 		 * This can still fail if the framebuffer is too large to be
 		 * tiled. But then that failure is expected.
 		 */
-		v = stride * height;
-		for (size = 1024*1024; size < v; size *= 2)
+		for (size = 1024*1024; size < min_size; size *= 2)
 			;
+
+		return size;
 	} else {
 		unsigned int tile_width, tile_height;
 
-		igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, 0),
+		igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, plane),
 				     &tile_width, &tile_height);
 
-		size = stride * ALIGN(height, tile_height);
+		return stride * ALIGN(height, tile_height);
 	}
+}
+
+static unsigned calc_fb_size(int fd, int width, int height,
+			     struct format_desc_struct *format,
+			     uint64_t tiling,
+			     uint32_t strides[4], uint32_t offsets[4])
+{
+	unsigned int size = 0;
+	int plane;
+
+	for (plane = 0; plane < fb_num_planes(format); plane++) {
+		if (!strides[plane])
+			strides[plane] = calc_plane_stride(fd, format,
+							   width, tiling, plane);
 
-	*stride_ret = stride;
-	*size_ret = size;
+		if (offsets)
+			offsets[plane] = size;
+
+		size += calc_plane_size(fd, width, height,
+					format, tiling, plane,
+					strides[plane]);
+	}
+
+	for (; plane < ARRAY_SIZE(format->plane_bpp); plane++) {
+		strides[plane] = 0;
+		if (offsets)
+			offsets[plane] = 0;
+	}
+
+	return size;
 }
 
 /**
@@ -353,12 +336,12 @@ void igt_calc_fb_size(int fd, int width, int height, uint32_t drm_format, uint64
 		      unsigned *size_ret, unsigned *stride_ret)
 {
 	struct format_desc_struct *format = lookup_drm_format(drm_format);
+	uint32_t strides[4] = {};
+
 	igt_assert(format);
 
-	if (fb_num_planes(format) > 1)
-		calc_fb_size_planar(fd, width, height, format, tiling, 0, size_ret, stride_ret, NULL);
-	else
-		calc_fb_size_packed(fd, width, height, format, tiling, 0, size_ret, stride_ret);
+	*size_ret = calc_fb_size(fd, width, height, format, tiling, strides, NULL);
+	*stride_ret = strides[0];
 }
 
 /**
@@ -420,7 +403,7 @@ static int create_bo_for_fb(int fd, int width, int height,
 			    struct format_desc_struct *format,
 			    uint64_t tiling, unsigned size, unsigned stride,
 			    unsigned *size_ret, unsigned *stride_ret,
-			    uint32_t *offsets, bool *is_dumb)
+			    uint32_t offsets[4], bool *is_dumb)
 {
 	int bo;
 
@@ -430,17 +413,17 @@ static int create_bo_for_fb(int fd, int width, int height,
 		memset(offsets, 0, ARRAY_SIZE(format->plane_bpp) * sizeof(*offsets));
 
 	if (tiling || size || stride || igt_format_is_yuv(format->drm_id)) {
-		unsigned calculated_size, calculated_stride;
+		unsigned calculated_size;
+		uint32_t strides[4] = {
+			stride,
+		};
 
-		if (fb_num_planes(format) > 1)
-			calc_fb_size_planar(fd, width, height, format, tiling, stride,
-					    &calculated_size, &calculated_stride, offsets);
-		else
-			calc_fb_size_packed(fd, width, height, format, tiling, stride,
-					    &calculated_size, &calculated_stride);
+		calculated_size = calc_fb_size(fd, width, height,
+					       format, tiling,
+					       strides, offsets);
 
 		if (stride == 0)
-			stride = calculated_stride;
+			stride = strides[0];
 		if (size == 0)
 			size = calculated_size;
 
@@ -461,19 +444,19 @@ static int create_bo_for_fb(int fd, int width, int height,
 			switch (format->drm_id) {
 			case DRM_FORMAT_NV12:
 				memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
-				       calculated_stride * height);
+				       strides[0] * height);
 				memset(ptr + offsets[1], 0x80,
-				       calculated_stride * height/2);
+				       strides[1] * height/2);
 				break;
 			case DRM_FORMAT_YUYV:
 			case DRM_FORMAT_YVYU:
 				wmemset(ptr, full_range ? 0x80008000 : 0x80108010,
-					calculated_stride * height / sizeof(wchar_t));
+					strides[0] * height / sizeof(wchar_t));
 				break;
 			case DRM_FORMAT_UYVY:
 			case DRM_FORMAT_VYUY:
 				wmemset(ptr, full_range ? 0x00800080 : 0x10801080,
-					calculated_stride * height / sizeof(wchar_t));
+					strides[0] * height / sizeof(wchar_t));
 				break;
 			}
 			gem_munmap(ptr, size);
@@ -482,7 +465,7 @@ static int create_bo_for_fb(int fd, int width, int height,
 				*size_ret = size;
 
 			if (stride_ret)
-				*stride_ret = stride;
+				*stride_ret = strides[0];
 
 			return bo;
 		} else {
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 15/25] lib/kms: Pass strides[] to __kms_addfb
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (12 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 14/25] lib/igt_fb: Consolidate fb size calculation to one function Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-09-21 22:45   ` Paulo Zanoni
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 16/25] lib/kms: Pass the number of planes explicitly to __kms_addfb() Ville Syrjala
                   ` (12 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Make __kms_addfb() usable with planar formats by passing in the
stride for each plane.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c                    |  7 ++++++-
 lib/ioctl_wrappers.c            | 12 +++++++-----
 lib/ioctl_wrappers.h            |  8 +++++---
 tests/kms_available_modes_crc.c | 14 +++++++-------
 tests/kms_draw_crc.c            |  6 +++---
 tests/prime_vgem.c              |  8 ++++++--
 6 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 0221a0b9b040..5e687b95e265 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -877,8 +877,13 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 
 	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
 	    tiling != LOCAL_I915_FORMAT_MOD_X_TILED) {
+		uint32_t pitches[4];
+
+		for (i = 0; i < fb_num_planes(f); i++)
+			pitches[i] = fb->stride;
+
 		do_or_die(__kms_addfb(fd, fb->gem_handle, width, height,
-				      fb->stride, format, tiling, fb->offsets,
+				      format, tiling, pitches, fb->offsets,
 				      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id));
 	} else {
 		uint32_t handles[4];
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index d5d2a4e4c913..a34857266d92 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1670,9 +1670,11 @@ void igt_require_fb_modifiers(int fd)
 	igt_require(has_modifiers);
 }
 
-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 *offsets, uint32_t flags, uint32_t *buf_id)
+int __kms_addfb(int fd, uint32_t handle,
+		uint32_t width, uint32_t height,
+		uint32_t pixel_format, uint64_t modifier,
+		uint32_t strides[4], uint32_t offsets[4],
+		uint32_t flags, uint32_t *buf_id)
 {
 	struct drm_mode_fb_cmd2 f;
 	int ret, i;
@@ -1686,12 +1688,12 @@ int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height,
 	f.pixel_format = pixel_format;
 	f.flags = flags;
 	f.handles[0] = handle;
-	f.pitches[0] = stride;
+	f.pitches[0] = strides[0];
 	f.modifier[0] = modifier;
 
 	for (i = 1; i < 4 && offsets && offsets[i]; i++) {
 		f.handles[i] = handle;
-		f.pitches[i] = stride;
+		f.pitches[i] = strides[i];
 		f.modifier[i] = modifier;
 		f.offsets[i] = offsets[i];
 	}
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 8e2cd380b575..67bf50562bf3 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -235,9 +235,11 @@ void igt_require_fb_modifiers(int fd);
  *
  * Creates a framebuffer object.
  */
-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 *offsets, uint32_t flags, uint32_t *buf_id);
+int __kms_addfb(int fd, uint32_t handle,
+		uint32_t width, uint32_t height,
+		uint32_t pixel_format, uint64_t modifier,
+		uint32_t strides[4], uint32_t offsets[4],
+		uint32_t flags, uint32_t *buf_id);
 
 /**
  * to_user_pointer:
diff --git a/tests/kms_available_modes_crc.c b/tests/kms_available_modes_crc.c
index b70ef5d7d4c0..1c843c6cf691 100644
--- a/tests/kms_available_modes_crc.c
+++ b/tests/kms_available_modes_crc.c
@@ -255,7 +255,8 @@ static bool setup_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
 	drmModeModeInfo *mode;
 	uint64_t w, h;
 	signed ret, gemsize = 0;
-	unsigned tile_width, tile_height, stride;
+	unsigned tile_width, tile_height;
+	uint32_t strides[4] = {};
 	uint32_t offsets[4] = {};
 	uint64_t tiling;
 	int bpp = 0;
@@ -296,8 +297,8 @@ static bool setup_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
 
 	igt_get_fb_tile_size(data->gfx_fd, tiling, bpp,
 			     &tile_width, &tile_height);
-	stride = ALIGN(w * bpp / 8, tile_width);
-	gemsize = data->size = stride * ALIGN(h, tile_height);
+	strides[0] = ALIGN(w * bpp / 8, tile_width);
+	gemsize = data->size = strides[0] * ALIGN(h, tile_height);
 
 	if (fillers[i].bpp == P010 || fillers[i].bpp == NV12) {
 		offsets[1] = data->size;
@@ -306,14 +307,13 @@ static bool setup_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
 
 	data->gem_handle = gem_create(data->gfx_fd, gemsize);
 	ret = __gem_set_tiling(data->gfx_fd, data->gem_handle,
-			       igt_fb_mod_to_tiling(tiling), stride);
+			       igt_fb_mod_to_tiling(tiling), strides[0]);
 
 	igt_assert_eq(ret, 0);
 
 	ret = __kms_addfb(data->gfx_fd, data->gem_handle, w, h,
-			  stride, format, tiling,
-			  offsets, LOCAL_DRM_MODE_FB_MODIFIERS,
-			  &data->fb.fb_id);
+			  format, tiling, strides, offsets,
+			  LOCAL_DRM_MODE_FB_MODIFIERS, &data->fb.fb_id);
 
 	if(ret < 0) {
 		igt_info("Creating fb for format %s failed, return code %d\n",
diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
index 86dcf39285f3..fb10d7ccf8bc 100644
--- a/tests/kms_draw_crc.c
+++ b/tests/kms_draw_crc.c
@@ -156,14 +156,14 @@ static void get_method_crc(enum igt_draw_method method, uint32_t drm_format,
 static bool format_is_supported(uint32_t format, uint64_t modifier)
 {
 	uint32_t gem_handle, fb_id;
-	unsigned int stride;
+	unsigned int strides[4] = {};
 	int ret;
 
 	gem_handle = igt_create_bo_with_dimensions(drm_fd, 64, 64,
 						   format, modifier,
-						   0, NULL, &stride, NULL);
+						   0, NULL, &strides[0], NULL);
 	ret =  __kms_addfb(drm_fd, gem_handle, 64, 64,
-			   stride, format, modifier, NULL,
+			   format, modifier, strides, NULL,
 			   LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id);
 	drmModeRmFB(drm_fd, fb_id);
 	gem_close(drm_fd, gem_handle);
diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
index 763c62e606f6..1b7d8fb293ef 100644
--- a/tests/prime_vgem.c
+++ b/tests/prime_vgem.c
@@ -709,6 +709,7 @@ static void test_flip(int i915, int vgem, unsigned hang)
 	signal(SIGHUP, sighandler);
 
 	for (int i = 0; i < 2; i++) {
+		uint32_t strides[4] = {};
 		int fd;
 
 		bo[i].width = 1024;
@@ -721,9 +722,12 @@ static void test_flip(int i915, int vgem, unsigned hang)
 		igt_assert(handle[i]);
 		close(fd);
 
+		strides[0] = bo[i].pitch;
+
 		do_or_die(__kms_addfb(i915, handle[i],
-				      bo[i].width, bo[i].height, bo[i].pitch,
-				      DRM_FORMAT_XRGB8888, I915_TILING_NONE, NULL,
+				      bo[i].width, bo[i].height,
+				      DRM_FORMAT_XRGB8888, I915_TILING_NONE,
+				      strides, NULL,
 				      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id[i]));
 		igt_assert(fb_id[i]);
 	}
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 16/25] lib/kms: Pass the number of planes explicitly to __kms_addfb()
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (13 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 15/25] lib/kms: Pass strides[] to __kms_addfb Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-09-21 22:54   ` Paulo Zanoni
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 17/25] lib/igt_fb: Remove the hand rolled addfb2 Ville Syrjala
                   ` (11 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Currently __kms_addfb() assumes that only the first plane can be
at offset 0. I don't particularly like such assumptions so let's
just pass in the number of planes explicitly.

We'll also require offsets[] to be passed in always. Nothing really
to gain by making it optional.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c                    | 1 +
 lib/ioctl_wrappers.c            | 9 +++------
 lib/ioctl_wrappers.h            | 2 +-
 tests/kms_available_modes_crc.c | 5 ++++-
 tests/kms_draw_crc.c            | 3 ++-
 tests/prime_vgem.c              | 3 ++-
 6 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 5e687b95e265..77611b593a7e 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -884,6 +884,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 
 		do_or_die(__kms_addfb(fd, fb->gem_handle, width, height,
 				      format, tiling, pitches, fb->offsets,
+				      fb_num_planes(f),
 				      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id));
 	} else {
 		uint32_t handles[4];
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index a34857266d92..d992e015b9c8 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1674,7 +1674,7 @@ int __kms_addfb(int fd, uint32_t handle,
 		uint32_t width, uint32_t height,
 		uint32_t pixel_format, uint64_t modifier,
 		uint32_t strides[4], uint32_t offsets[4],
-		uint32_t flags, uint32_t *buf_id)
+		int num_planes, uint32_t flags, uint32_t *buf_id)
 {
 	struct drm_mode_fb_cmd2 f;
 	int ret, i;
@@ -1687,14 +1687,11 @@ int __kms_addfb(int fd, uint32_t handle,
 	f.height = height;
 	f.pixel_format = pixel_format;
 	f.flags = flags;
-	f.handles[0] = handle;
-	f.pitches[0] = strides[0];
-	f.modifier[0] = modifier;
 
-	for (i = 1; i < 4 && offsets && offsets[i]; i++) {
+	for (i = 0; i < num_planes; i++) {
 		f.handles[i] = handle;
-		f.pitches[i] = strides[i];
 		f.modifier[i] = modifier;
+		f.pitches[i] = strides[i];
 		f.offsets[i] = offsets[i];
 	}
 
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 67bf50562bf3..872e3056314b 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -239,7 +239,7 @@ int __kms_addfb(int fd, uint32_t handle,
 		uint32_t width, uint32_t height,
 		uint32_t pixel_format, uint64_t modifier,
 		uint32_t strides[4], uint32_t offsets[4],
-		uint32_t flags, uint32_t *buf_id);
+		int num_planes, uint32_t flags, uint32_t *buf_id);
 
 /**
  * to_user_pointer:
diff --git a/tests/kms_available_modes_crc.c b/tests/kms_available_modes_crc.c
index 1c843c6cf691..14170ef711e3 100644
--- a/tests/kms_available_modes_crc.c
+++ b/tests/kms_available_modes_crc.c
@@ -258,6 +258,7 @@ static bool setup_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
 	unsigned tile_width, tile_height;
 	uint32_t strides[4] = {};
 	uint32_t offsets[4] = {};
+	int num_planes = 1;
 	uint64_t tiling;
 	int bpp = 0;
 	int i;
@@ -303,6 +304,7 @@ static bool setup_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
 	if (fillers[i].bpp == P010 || fillers[i].bpp == NV12) {
 		offsets[1] = data->size;
 		gemsize = data->size * 2;
+		num_planes = 2;
 	}
 
 	data->gem_handle = gem_create(data->gfx_fd, gemsize);
@@ -313,7 +315,8 @@ static bool setup_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
 
 	ret = __kms_addfb(data->gfx_fd, data->gem_handle, w, h,
 			  format, tiling, strides, offsets,
-			  LOCAL_DRM_MODE_FB_MODIFIERS, &data->fb.fb_id);
+			  num_planes, LOCAL_DRM_MODE_FB_MODIFIERS,
+			  &data->fb.fb_id);
 
 	if(ret < 0) {
 		igt_info("Creating fb for format %s failed, return code %d\n",
diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
index fb10d7ccf8bc..90904714283c 100644
--- a/tests/kms_draw_crc.c
+++ b/tests/kms_draw_crc.c
@@ -156,6 +156,7 @@ static void get_method_crc(enum igt_draw_method method, uint32_t drm_format,
 static bool format_is_supported(uint32_t format, uint64_t modifier)
 {
 	uint32_t gem_handle, fb_id;
+	unsigned int offsets[4] = {};
 	unsigned int strides[4] = {};
 	int ret;
 
@@ -163,7 +164,7 @@ static bool format_is_supported(uint32_t format, uint64_t modifier)
 						   format, modifier,
 						   0, NULL, &strides[0], NULL);
 	ret =  __kms_addfb(drm_fd, gem_handle, 64, 64,
-			   format, modifier, strides, NULL,
+			   format, modifier, strides, offsets, 1,
 			   LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id);
 	drmModeRmFB(drm_fd, fb_id);
 	gem_close(drm_fd, gem_handle);
diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
index 1b7d8fb293ef..d06aa24b5ef2 100644
--- a/tests/prime_vgem.c
+++ b/tests/prime_vgem.c
@@ -710,6 +710,7 @@ static void test_flip(int i915, int vgem, unsigned hang)
 
 	for (int i = 0; i < 2; i++) {
 		uint32_t strides[4] = {};
+		uint32_t offsets[4] = {};
 		int fd;
 
 		bo[i].width = 1024;
@@ -727,7 +728,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,
 				      DRM_FORMAT_XRGB8888, I915_TILING_NONE,
-				      strides, NULL,
+				      strides, offsets, 1,
 				      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id[i]));
 		igt_assert(fb_id[i]);
 	}
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 17/25] lib/igt_fb: Remove the hand rolled addfb2
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (14 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 16/25] lib/kms: Pass the number of planes explicitly to __kms_addfb() Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-09-21 23:15   ` Paulo Zanoni
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 18/25] lib/igt_fb: Constify format_desc_struct Ville Syrjala
                   ` (10 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Just use __kms_addfb() always instead of hand rolling another
drmModeAddFB2() usage. __kms_addfb() demands support for modifiers
but we've had that for a long time now so it's not a problem.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 77611b593a7e..648f0a318c91 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -856,6 +856,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 	enum igt_color_encoding color_encoding = IGT_COLOR_YCBCR_BT709;
 	enum igt_color_range color_range = IGT_COLOR_YCBCR_LIMITED_RANGE;
 	struct format_desc_struct *f = lookup_drm_format(format);
+	uint32_t pitches[4];
 	uint32_t fb_id;
 	int i;
 
@@ -875,35 +876,13 @@ 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) {
-		uint32_t pitches[4];
-
-		for (i = 0; i < fb_num_planes(f); i++)
-			pitches[i] = fb->stride;
-
-		do_or_die(__kms_addfb(fd, fb->gem_handle, width, height,
-				      format, tiling, pitches, fb->offsets,
-				      fb_num_planes(f),
-				      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id));
-	} else {
-		uint32_t handles[4];
-		uint32_t pitches[4];
+	for (i = 0; i < fb_num_planes(f); i++)
+		pitches[i] = fb->stride;
 
-		memset(handles, 0, sizeof(handles));
-		memset(pitches, 0, sizeof(pitches));
-
-		handles[0] = fb->gem_handle;
-		pitches[0] = fb->stride;
-		for (i = 0; i < fb_num_planes(f); i++) {
-			handles[i] = fb->gem_handle;
-			pitches[i] = fb->stride;
-		}
-
-		do_or_die(drmModeAddFB2(fd, width, height, format,
-					handles, pitches, fb->offsets,
-					&fb_id, 0));
-	}
+	do_or_die(__kms_addfb(fd, fb->gem_handle, width, height,
+			      format, tiling, pitches, fb->offsets,
+			      fb_num_planes(f),
+			      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id));
 
 	fb->width = width;
 	fb->height = height;
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 18/25] lib/igt_fb: Constify format_desc_struct
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (15 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 17/25] lib/igt_fb: Remove the hand rolled addfb2 Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-09-21 23:20   ` Paulo Zanoni
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 19/25] lib/igt_fb: Pass around igt_fb internally Ville Syrjala
                   ` (9 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We don't want anyone to modify the format description structures. Make
them const.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 648f0a318c91..49e323b22d26 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -60,7 +60,7 @@
  */
 
 /* drm fourcc/cairo format maps */
-static struct format_desc_struct {
+static const struct format_desc_struct {
 	const char *name;
 	uint32_t drm_id;
 	cairo_format_t cairo_id;
@@ -108,9 +108,9 @@ static struct format_desc_struct {
 #define for_each_format(f)	\
 	for (f = format_desc; f - format_desc < ARRAY_SIZE(format_desc); f++)
 
-static struct format_desc_struct *lookup_drm_format(uint32_t drm_format)
+static const struct format_desc_struct *lookup_drm_format(uint32_t drm_format)
 {
-	struct format_desc_struct *format;
+	const struct format_desc_struct *format;
 
 	for_each_format(format) {
 		if (format->drm_id != drm_format)
@@ -190,8 +190,8 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 	}
 }
 
-static unsigned fb_plane_width(struct format_desc_struct *format,
-			       unsigned width, int plane)
+static unsigned fb_plane_width(const struct format_desc_struct *format,
+			       int plane, unsigned width)
 {
 	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
 		return DIV_ROUND_UP(width, 2);
@@ -199,21 +199,21 @@ static unsigned fb_plane_width(struct format_desc_struct *format,
 	return width;
 }
 
-static unsigned fb_plane_bpp(struct format_desc_struct *format, int plane)
+static unsigned fb_plane_bpp(const struct format_desc_struct *format, int plane)
 {
 	return format->plane_bpp[plane];
 }
 
-static unsigned fb_plane_min_stride(struct format_desc_struct *format,
-				    unsigned width, int plane)
+static unsigned fb_plane_min_stride(const struct format_desc_struct *format,
+				    int plane, unsigned width)
 {
 	unsigned cpp = fb_plane_bpp(format, plane) / 8;
 
 	return fb_plane_width(format, width, plane) * cpp;
 }
 
-static unsigned fb_plane_height(struct format_desc_struct *format,
-				unsigned height, int plane)
+static unsigned fb_plane_height(const struct format_desc_struct *format,
+				int plane, unsigned height)
 {
 	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
 		return DIV_ROUND_UP(height, 2);
@@ -221,13 +221,13 @@ static unsigned fb_plane_height(struct format_desc_struct *format,
 	return height;
 }
 
-static int fb_num_planes(struct format_desc_struct *format)
+static int fb_num_planes(const struct format_desc_struct *format)
 {
 	return format->num_planes;
 }
 
 static unsigned calc_plane_stride(int fd,
-				  struct format_desc_struct *format,
+				  const struct format_desc_struct *format,
 				  int width, uint64_t tiling, int plane)
 {
 	uint32_t min_stride = fb_plane_min_stride(format, width, plane);
@@ -259,7 +259,7 @@ static unsigned calc_plane_stride(int fd,
 }
 
 static unsigned calc_plane_size(int fd, int width, int height,
-				struct format_desc_struct *format,
+				const struct format_desc_struct *format,
 				uint64_t tiling, int plane,
 				uint32_t stride)
 {
@@ -290,7 +290,7 @@ static unsigned calc_plane_size(int fd, int width, int height,
 }
 
 static unsigned calc_fb_size(int fd, int width, int height,
-			     struct format_desc_struct *format,
+			     const struct format_desc_struct *format,
 			     uint64_t tiling,
 			     uint32_t strides[4], uint32_t offsets[4])
 {
@@ -335,7 +335,7 @@ static unsigned calc_fb_size(int fd, int width, int height,
 void igt_calc_fb_size(int fd, int width, int height, uint32_t drm_format, uint64_t tiling,
 		      unsigned *size_ret, unsigned *stride_ret)
 {
-	struct format_desc_struct *format = lookup_drm_format(drm_format);
+	const struct format_desc_struct *format = lookup_drm_format(drm_format);
 	uint32_t strides[4] = {};
 
 	igt_assert(format);
@@ -400,7 +400,7 @@ uint64_t igt_fb_tiling_to_mod(uint64_t tiling)
 static int create_bo_for_fb(int fd, int width, int height,
 			    enum igt_color_encoding color_encoding,
 			    enum igt_color_range color_range,
-			    struct format_desc_struct *format,
+			    const struct format_desc_struct *format,
 			    uint64_t tiling, unsigned size, unsigned stride,
 			    unsigned *size_ret, unsigned *stride_ret,
 			    uint32_t offsets[4], bool *is_dumb)
@@ -855,7 +855,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 	/* FIXME allow the caller to pass these in */
 	enum igt_color_encoding color_encoding = IGT_COLOR_YCBCR_BT709;
 	enum igt_color_range color_range = IGT_COLOR_YCBCR_LIMITED_RANGE;
-	struct format_desc_struct *f = lookup_drm_format(format);
+	const struct format_desc_struct *f = lookup_drm_format(format);
 	uint32_t pitches[4];
 	uint32_t fb_id;
 	int i;
@@ -1195,7 +1195,7 @@ unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
 
 static cairo_format_t drm_format_to_cairo(uint32_t drm_format)
 {
-	struct format_desc_struct *f;
+	const struct format_desc_struct *f;
 
 	for_each_format(f)
 		if (f->drm_id == drm_format)
@@ -1953,7 +1953,7 @@ void igt_remove_fb(int fd, struct igt_fb *fb)
  */
 uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth)
 {
-	struct format_desc_struct *f;
+	const struct format_desc_struct *f;
 
 	for_each_format(f)
 		if (f->plane_bpp[0] == bpp && f->depth == depth)
@@ -1974,7 +1974,7 @@ uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth)
  */
 uint32_t igt_drm_format_to_bpp(uint32_t drm_format)
 {
-	struct format_desc_struct *f = lookup_drm_format(drm_format);
+	const struct format_desc_struct *f = lookup_drm_format(drm_format);
 
 	igt_assert_f(f, "can't find a bpp format for %08x (%s)\n",
 		     drm_format, igt_format_str(drm_format));
@@ -1992,7 +1992,7 @@ uint32_t igt_drm_format_to_bpp(uint32_t drm_format)
  */
 const char *igt_format_str(uint32_t drm_format)
 {
-	struct format_desc_struct *f = lookup_drm_format(drm_format);
+	const struct format_desc_struct *f = lookup_drm_format(drm_format);
 
 	return f ? f->name : "invalid";
 }
@@ -2006,7 +2006,7 @@ const char *igt_format_str(uint32_t drm_format)
  */
 bool igt_fb_supported_format(uint32_t drm_format)
 {
-	struct format_desc_struct *f;
+	const struct format_desc_struct *f;
 
 	for_each_format(f)
 		if (f->drm_id == drm_format)
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 19/25] lib/igt_fb: Pass around igt_fb internally
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (16 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 18/25] lib/igt_fb: Constify format_desc_struct Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 20/25] lib/igt_fb: Refactor blitter usage Ville Syrjala
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Instead of passing around a boatload of integers everywhere let's
just pass around the igt_fb struct. That obviously means we have to
populate it first sufficiently, to which end we'll add a small helper.
Later on the stride/size calculations will consult the already
pre-populated igt_fb and fill in the rest as needed.

This makes the whole thing a lot less error prone as it's impossible
to accidentally pass the arguments in the wrong order when there's
just the one of them, and it's a pointer.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_draw.c                   |   2 +-
 lib/igt_fb.c                     | 405 +++++++++++++++++++--------------------
 lib/igt_fb.h                     |   4 +-
 tests/kms_ccs.c                  |   2 +-
 tests/kms_flip.c                 |   4 +-
 tests/kms_frontbuffer_tracking.c |   6 +-
 tests/pm_rpm.c                   |   2 +-
 7 files changed, 206 insertions(+), 219 deletions(-)

diff --git a/lib/igt_draw.c b/lib/igt_draw.c
index c7d5770dca28..05821480bc80 100644
--- a/lib/igt_draw.c
+++ b/lib/igt_draw.c
@@ -720,7 +720,7 @@ void igt_draw_rect_fb(int fd, drm_intel_bufmgr *bufmgr,
 		      enum igt_draw_method method, int rect_x, int rect_y,
 		      int rect_w, int rect_h, uint32_t color)
 {
-	igt_draw_rect(fd, bufmgr, context, fb->gem_handle, fb->size, fb->stride,
+	igt_draw_rect(fd, bufmgr, context, fb->gem_handle, fb->size, fb->strides[0],
 		      method, rect_x, rect_y, rect_w, rect_h, color,
 		      igt_drm_format_to_bpp(fb->drm_format));
 }
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 49e323b22d26..23f53caa0ad2 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -190,50 +190,72 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 	}
 }
 
-static unsigned fb_plane_width(const struct format_desc_struct *format,
-			       int plane, unsigned width)
+static unsigned fb_plane_width(const struct igt_fb *fb, int plane)
 {
-	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
-		return DIV_ROUND_UP(width, 2);
+	if (fb->drm_format == DRM_FORMAT_NV12 && plane == 1)
+		return DIV_ROUND_UP(fb->width, 2);
 
-	return width;
+	return fb->width;
 }
 
-static unsigned fb_plane_bpp(const struct format_desc_struct *format, int plane)
+static unsigned fb_plane_bpp(const struct igt_fb *fb, int plane)
 {
+	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
+
 	return format->plane_bpp[plane];
 }
 
-static unsigned fb_plane_min_stride(const struct format_desc_struct *format,
-				    int plane, unsigned width)
+static unsigned fb_plane_height(const struct igt_fb *fb, int plane)
 {
-	unsigned cpp = fb_plane_bpp(format, plane) / 8;
+	if (fb->drm_format == DRM_FORMAT_NV12 && plane == 1)
+		return DIV_ROUND_UP(fb->height, 2);
 
-	return fb_plane_width(format, width, plane) * cpp;
+	return fb->height;
 }
 
-static unsigned fb_plane_height(const struct format_desc_struct *format,
-				int plane, unsigned height)
+static int fb_num_planes(const struct igt_fb *fb)
 {
-	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
-		return DIV_ROUND_UP(height, 2);
+	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	return height;
+	return format->num_planes;
 }
 
-static int fb_num_planes(const struct format_desc_struct *format)
+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)
 {
-	return format->num_planes;
+	const struct format_desc_struct *f = lookup_drm_format(drm_format);
+
+	igt_assert_f(f, "DRM format %08x not found\n", drm_format);
+
+	memset(fb, 0, sizeof(*fb));
+
+	fb->width = width;
+	fb->height = height;
+	fb->tiling = modifier;
+	fb->drm_format = drm_format;
+	fb->fd = fd;
+	fb->num_planes = fb_num_planes(fb);
+	fb->color_encoding = color_encoding;
+	fb->color_range = color_range;
+
+	for (int i = 0; i < fb->num_planes; i++) {
+		fb->plane_bpp[i] = fb_plane_bpp(fb, i);
+		fb->plane_height[i] = fb_plane_height(fb, i);
+		fb->plane_width[i] = fb_plane_width(fb, i);
+	}
 }
 
-static unsigned calc_plane_stride(int fd,
-				  const struct format_desc_struct *format,
-				  int width, uint64_t tiling, int plane)
+static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
 {
-	uint32_t min_stride = fb_plane_min_stride(format, width, plane);
+	uint32_t min_stride = fb->plane_width[plane] *
+		(fb->plane_bpp[plane] / 8);
 
-	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
-	    intel_gen(intel_get_drm_devid(fd)) <= 3) {
+	if (fb->tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
+	    intel_gen(intel_get_drm_devid(fb->fd)) <= 3) {
 		uint32_t stride;
 
 		/* Round the tiling up to the next power-of-two and the region
@@ -250,22 +272,19 @@ static unsigned calc_plane_stride(int fd,
 	} else {
 		unsigned int tile_width, tile_height;
 
-		igt_get_fb_tile_size(fd, tiling,
-				     fb_plane_bpp(format, plane),
+		igt_get_fb_tile_size(fb->fd, fb->tiling, fb->plane_bpp[plane],
 				     &tile_width, &tile_height);
 
 		return ALIGN(min_stride, tile_width);
 	}
 }
 
-static unsigned calc_plane_size(int fd, int width, int height,
-				const struct format_desc_struct *format,
-				uint64_t tiling, int plane,
-				uint32_t stride)
+static unsigned calc_plane_size(struct igt_fb *fb, int plane)
 {
-	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
-	    intel_gen(intel_get_drm_devid(fd)) <= 3) {
-		unsigned int min_size = stride * height;
+	if (fb->tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
+	    intel_gen(intel_get_drm_devid(fb->fd)) <= 3) {
+		unsigned int min_size = fb->strides[plane] *
+			fb->plane_height[plane];
 		unsigned int size;
 
 		/* Round the tiling up to the next power-of-two and the region
@@ -282,38 +301,27 @@ static unsigned calc_plane_size(int fd, int width, int height,
 	} else {
 		unsigned int tile_width, tile_height;
 
-		igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, plane),
+		igt_get_fb_tile_size(fb->fd, fb->tiling, fb->plane_bpp[plane],
 				     &tile_width, &tile_height);
 
-		return stride * ALIGN(height, tile_height);
+		return fb->strides[plane] *
+			ALIGN(fb->plane_height[plane], tile_height);
 	}
 }
 
-static unsigned calc_fb_size(int fd, int width, int height,
-			     const struct format_desc_struct *format,
-			     uint64_t tiling,
-			     uint32_t strides[4], uint32_t offsets[4])
+static unsigned calc_fb_size(struct igt_fb *fb)
 {
 	unsigned int size = 0;
 	int plane;
 
-	for (plane = 0; plane < fb_num_planes(format); plane++) {
-		if (!strides[plane])
-			strides[plane] = calc_plane_stride(fd, format,
-							   width, tiling, plane);
+	for (plane = 0; plane < fb->num_planes; plane++) {
+		/* respect the stride requested by the caller */
+		if (!fb->strides[plane])
+			fb->strides[plane] = calc_plane_stride(fb, plane);
 
-		if (offsets)
-			offsets[plane] = size;
+		fb->offsets[plane] = size;
 
-		size += calc_plane_size(fd, width, height,
-					format, tiling, plane,
-					strides[plane]);
-	}
-
-	for (; plane < ARRAY_SIZE(format->plane_bpp); plane++) {
-		strides[plane] = 0;
-		if (offsets)
-			offsets[plane] = 0;
+		size += calc_plane_size(fb, plane);
 	}
 
 	return size;
@@ -335,13 +343,17 @@ static unsigned calc_fb_size(int fd, int width, int height,
 void igt_calc_fb_size(int fd, int width, int height, uint32_t drm_format, uint64_t tiling,
 		      unsigned *size_ret, unsigned *stride_ret)
 {
-	const struct format_desc_struct *format = lookup_drm_format(drm_format);
-	uint32_t strides[4] = {};
+	struct igt_fb fb;
+
+	fb_init(&fb, fd, width, height, drm_format, tiling,
+		IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
 
-	igt_assert(format);
+	fb.size = calc_fb_size(&fb);
 
-	*size_ret = calc_fb_size(fd, width, height, format, tiling, strides, NULL);
-	*stride_ret = strides[0];
+	if (size_ret)
+		*size_ret = fb.size;
+	if (stride_ret)
+		*stride_ret = fb.strides[0];
 }
 
 /**
@@ -397,77 +409,61 @@ uint64_t igt_fb_tiling_to_mod(uint64_t tiling)
 }
 
 /* helpers to create nice-looking framebuffers */
-static int create_bo_for_fb(int fd, int width, int height,
-			    enum igt_color_encoding color_encoding,
-			    enum igt_color_range color_range,
-			    const struct format_desc_struct *format,
-			    uint64_t tiling, unsigned size, unsigned stride,
-			    unsigned *size_ret, unsigned *stride_ret,
-			    uint32_t offsets[4], bool *is_dumb)
+static int create_bo_for_fb(struct igt_fb *fb)
 {
-	int bo;
+	int fd = fb->fd;
 
-	igt_assert(format);
+	if (fb->tiling || fb->size || fb->strides[0] || igt_format_is_yuv(fb->drm_format)) {
+		unsigned size;
 
-	if (offsets)
-		memset(offsets, 0, ARRAY_SIZE(format->plane_bpp) * sizeof(*offsets));
+		size = calc_fb_size(fb);
 
-	if (tiling || size || stride || igt_format_is_yuv(format->drm_id)) {
-		unsigned calculated_size;
-		uint32_t strides[4] = {
-			stride,
-		};
+		/* respect the size requested by the caller */
+		if (fb->size == 0)
+			fb->size = size;
 
-		calculated_size = calc_fb_size(fd, width, height,
-					       format, tiling,
-					       strides, offsets);
-
-		if (stride == 0)
-			stride = strides[0];
-		if (size == 0)
-			size = calculated_size;
-
-		if (is_dumb)
-			*is_dumb = false;
+		fb->is_dumb = false;
 
 		if (is_i915_device(fd)) {
 			void *ptr;
-			bool full_range = color_range == IGT_COLOR_YCBCR_FULL_RANGE;
+			bool full_range = fb->color_range == IGT_COLOR_YCBCR_FULL_RANGE;
 
-			bo = gem_create(fd, size);
-			gem_set_tiling(fd, bo, igt_fb_mod_to_tiling(tiling), stride);
+			fb->gem_handle = gem_create(fd, fb->size);
+
+			gem_set_tiling(fd, fb->gem_handle,
+				       igt_fb_mod_to_tiling(fb->tiling),
+				       fb->strides[0]);
 
 			/* Ensure the framebuffer is preallocated */
-			ptr = gem_mmap__gtt(fd, bo, size, PROT_READ | PROT_WRITE);
+			ptr = gem_mmap__gtt(fd, fb->gem_handle,
+					    fb->size, PROT_READ | PROT_WRITE);
 			igt_assert(*(uint32_t *)ptr == 0);
 
-			switch (format->drm_id) {
+			switch (fb->drm_format) {
 			case DRM_FORMAT_NV12:
-				memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
-				       strides[0] * height);
-				memset(ptr + offsets[1], 0x80,
-				       strides[1] * height/2);
+				memset(ptr + fb->offsets[0],
+				       full_range ? 0x00 : 0x10,
+				       fb->strides[0] * fb->plane_height[0]);
+				memset(ptr + fb->offsets[1],
+				       0x80,
+				       fb->strides[1] * fb->plane_height[1]);
 				break;
 			case DRM_FORMAT_YUYV:
 			case DRM_FORMAT_YVYU:
-				wmemset(ptr, full_range ? 0x80008000 : 0x80108010,
-					strides[0] * height / sizeof(wchar_t));
+				wmemset(ptr + fb->offsets[0],
+					full_range ? 0x80008000 : 0x80108010,
+					fb->strides[0] * fb->plane_height[0] / sizeof(wchar_t));
 				break;
 			case DRM_FORMAT_UYVY:
 			case DRM_FORMAT_VYUY:
-				wmemset(ptr, full_range ? 0x00800080 : 0x10801080,
-					strides[0] * height / sizeof(wchar_t));
+				wmemset(ptr + fb->offsets[0],
+					full_range ? 0x00800080 : 0x10801080,
+					fb->strides[0] * fb->plane_height[0] / sizeof(wchar_t));
 				break;
 			}
-			gem_munmap(ptr, size);
-
-			if (size_ret)
-				*size_ret = size;
+			gem_munmap(ptr, fb->size);
 
-			if (stride_ret)
-				*stride_ret = strides[0];
-
-			return bo;
+			return fb->gem_handle;
 		} else {
 			bool driver_has_gem_api = false;
 
@@ -475,12 +471,13 @@ static int create_bo_for_fb(int fd, int width, int height,
 			return -EINVAL;
 		}
 	} else {
-		if (is_dumb)
-			*is_dumb = true;
+		fb->is_dumb = true;
+
+		fb->gem_handle = kmstest_dumb_create(fd, fb->width, fb->height,
+						     fb->plane_bpp[0],
+						     &fb->strides[0], &fb->size);
 
-		return kmstest_dumb_create(fd, width, height,
-					   fb_plane_bpp(format, 0),
-					   stride_ret, size_ret);
+		return fb->gem_handle;
 	}
 }
 
@@ -507,11 +504,24 @@ int igt_create_bo_with_dimensions(int fd, int width, int height,
 				  unsigned stride, unsigned *size_ret,
 				  unsigned *stride_ret, bool *is_dumb)
 {
-	return create_bo_for_fb(fd, width, height,
-				IGT_COLOR_YCBCR_BT709,
-				IGT_COLOR_YCBCR_LIMITED_RANGE,
-				lookup_drm_format(format),
-				modifier, 0, stride, size_ret, stride_ret, NULL, is_dumb);
+	struct igt_fb fb;
+
+	fb_init(&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;
+
+	create_bo_for_fb(&fb);
+
+	if (size_ret)
+		*size_ret = fb.size;
+	if (stride_ret)
+		*stride_ret = fb.strides[0];
+	if (is_dumb)
+		*is_dumb = fb.is_dumb;
+
+	return fb.gem_handle;
 }
 
 /**
@@ -855,52 +865,32 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 	/* FIXME allow the caller to pass these in */
 	enum igt_color_encoding color_encoding = IGT_COLOR_YCBCR_BT709;
 	enum igt_color_range color_range = IGT_COLOR_YCBCR_LIMITED_RANGE;
-	const struct format_desc_struct *f = lookup_drm_format(format);
-	uint32_t pitches[4];
-	uint32_t fb_id;
-	int i;
 
-	igt_assert_f(f, "DRM format %08x not found\n", format);
+	fb_init(fb, fd, width, height, format, tiling,
+		color_encoding, color_range);
 
-	memset(fb, 0, sizeof(*fb));
+	for (int i = 0; i < fb->num_planes; i++)
+		fb->strides[i] = bo_stride;
+
+	fb->size = bo_size;
 
 	igt_debug("%s(width=%d, height=%d, format=0x%x, tiling=0x%"PRIx64", size=%d)\n",
 		  __func__, width, height, format, tiling, bo_size);
-	fb->gem_handle = create_bo_for_fb(fd, width, height,
-					  color_encoding, color_range,
-					  f, tiling, bo_size, bo_stride,
-					  &fb->size, &fb->stride,
-					  fb->offsets, &fb->is_dumb);
+
+	create_bo_for_fb(fb);
 	igt_assert(fb->gem_handle > 0);
 
 	igt_debug("%s(handle=%d, pitch=%d)\n",
-		  __func__, fb->gem_handle, fb->stride);
-
-	for (i = 0; i < fb_num_planes(f); i++)
-		pitches[i] = fb->stride;
-
-	do_or_die(__kms_addfb(fd, fb->gem_handle, width, height,
-			      format, tiling, pitches, fb->offsets,
-			      fb_num_planes(f),
-			      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id));
+		  __func__, fb->gem_handle, fb->strides[0]);
 
-	fb->width = width;
-	fb->height = height;
-	fb->tiling = tiling;
-	fb->drm_format = format;
-	fb->fb_id = fb_id;
-	fb->fd = fd;
-	fb->num_planes = fb_num_planes(f);
-	fb->color_encoding = color_encoding;
-	fb->color_range = color_range;
-
-	for (i = 0; i < fb_num_planes(f); i++) {
-		fb->plane_bpp[i] = fb_plane_bpp(f, i);
-		fb->plane_height[i] = fb_plane_height(f, height, i);
-		fb->plane_width[i] = fb_plane_width(f, width, i);
-	}
+	do_or_die(__kms_addfb(fb->fd, fb->gem_handle,
+			      fb->width, fb->height,
+			      fb->drm_format, fb->tiling,
+			      fb->strides, fb->offsets, fb->num_planes,
+			      LOCAL_DRM_MODE_FB_MODIFIERS,
+			      &fb->fb_id));
 
-	return fb_id;
+	return fb->fb_id;
 }
 
 /**
@@ -1206,11 +1196,8 @@ static cairo_format_t drm_format_to_cairo(uint32_t drm_format)
 }
 
 struct fb_blit_linear {
-	uint32_t handle;
-	unsigned size, stride;
+	struct igt_fb fb;
 	uint8_t *map;
-	bool is_dumb;
-	uint32_t offsets[4];
 };
 
 struct fb_blit_upload {
@@ -1227,27 +1214,27 @@ static void free_linear_mapping(struct fb_blit_upload *blit)
 	unsigned int obj_tiling = igt_fb_mod_to_tiling(fb->tiling);
 	int i;
 
-	gem_munmap(linear->map, linear->size);
-	gem_set_domain(fd, linear->handle,
+	gem_munmap(linear->map, linear->fb.size);
+	gem_set_domain(fd, linear->fb.gem_handle,
 		       I915_GEM_DOMAIN_GTT, 0);
 
 	for (i = 0; i < fb->num_planes; i++)
 		igt_blitter_fast_copy__raw(fd,
-					   linear->handle,
-					   linear->offsets[i],
-					   linear->stride,
+					   linear->fb.gem_handle,
+					   linear->fb.offsets[i],
+					   linear->fb.strides[i],
 					   I915_TILING_NONE,
 					   0, 0, /* src_x, src_y */
 					   fb->plane_width[i], fb->plane_height[i],
 					   fb->plane_bpp[i],
 					   fb->gem_handle,
 					   fb->offsets[i],
-					   fb->stride,
+					   fb->strides[i],
 					   obj_tiling,
 					   0, 0 /* dst_x, dst_y */);
 
-	gem_sync(fd, linear->handle);
-	gem_close(fd, linear->handle);
+	gem_sync(fd, linear->fb.gem_handle);
+	gem_close(fd, linear->fb.gem_handle);
 }
 
 static void destroy_cairo_surface__blit(void *arg)
@@ -1271,42 +1258,42 @@ static void setup_linear_mapping(int fd, struct igt_fb *fb, struct fb_blit_linea
 	 * cairo). This linear bo will be then blitted to its final
 	 * destination, tiling it at the same time.
 	 */
-	linear->handle = create_bo_for_fb(fd, fb->width, fb->height,
-					  fb->color_encoding, fb->color_range,
-					  lookup_drm_format(fb->drm_format),
-					  LOCAL_DRM_FORMAT_MOD_NONE, 0,
-					  0, &linear->size,
-					  &linear->stride,
-					  linear->offsets, &linear->is_dumb);
 
-	igt_assert(linear->handle > 0);
+	fb_init(&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);
+
+	igt_assert(linear->fb.gem_handle > 0);
 
 	/* Copy fb content to linear BO */
-	gem_set_domain(fd, linear->handle,
+	gem_set_domain(fd, linear->fb.gem_handle,
 			I915_GEM_DOMAIN_GTT, 0);
 
 	for (i = 0; i < fb->num_planes; i++)
 		igt_blitter_fast_copy__raw(fd,
-					  fb->gem_handle,
-					  fb->offsets[i],
-					  fb->stride,
-					  obj_tiling,
-					  0, 0, /* src_x, src_y */
-					  fb->plane_width[i], fb->plane_height[i],
-					  fb->plane_bpp[i],
-					  linear->handle, linear->offsets[i],
-					  linear->stride,
-					  I915_TILING_NONE,
-					  0, 0 /* dst_x, dst_y */);
-
-	gem_sync(fd, linear->handle);
-
-	gem_set_domain(fd, linear->handle,
+					   fb->gem_handle,
+					   fb->offsets[i],
+					   fb->strides[i],
+					   obj_tiling,
+					   0, 0, /* src_x, src_y */
+					   fb->plane_width[i], fb->plane_height[i],
+					   fb->plane_bpp[i],
+					   linear->fb.gem_handle,
+					   linear->fb.offsets[i],
+					   linear->fb.strides[i],
+					   I915_TILING_NONE,
+					   0, 0 /* dst_x, dst_y */);
+
+	gem_sync(fd, linear->fb.gem_handle);
+
+	gem_set_domain(fd, linear->fb.gem_handle,
 		       I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
 
 	/* Setup cairo context */
-	linear->map = gem_mmap__cpu(fd, linear->handle,
-				    0, linear->size, PROT_READ | PROT_WRITE);
+	linear->map = gem_mmap__cpu(fd, linear->fb.gem_handle,
+				    0, linear->fb.size, PROT_READ | PROT_WRITE);
 }
 
 static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
@@ -1326,7 +1313,7 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
 		cairo_image_surface_create_for_data(blit->linear.map,
 						    cairo_format,
 						    fb->width, fb->height,
-						    blit->linear.stride);
+						    blit->linear.fb.strides[0]);
 	fb->domain = I915_GEM_DOMAIN_GTT;
 
 	cairo_surface_set_user_data(fb->cairo_surface,
@@ -1373,7 +1360,7 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
 	fb->cairo_surface =
 		cairo_image_surface_create_for_data(ptr,
 						    drm_format_to_cairo(fb->drm_format),
-						    fb->width, fb->height, fb->stride);
+						    fb->width, fb->height, fb->strides[0]);
 	fb->domain = I915_GEM_DOMAIN_GTT;
 
 	cairo_surface_set_user_data(fb->cairo_surface,
@@ -1415,8 +1402,8 @@ static void convert_nv12_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
 	int i, j;
 	const uint8_t *y, *uv;
 	uint8_t *rgb24 = blit->rgb24.map;
-	unsigned rgb24_stride = blit->rgb24.stride, planar_stride = blit->base.linear.stride;
-	uint8_t *buf = malloc(blit->base.linear.size);
+	unsigned rgb24_stride = blit->rgb24.stride, planar_stride = blit->base.linear.fb.strides[0];
+	uint8_t *buf = malloc(blit->base.linear.fb.size);
 	struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb->color_encoding,
 						    fb->color_range);
 
@@ -1425,9 +1412,9 @@ static void convert_nv12_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
 	 * it's faster to copy the whole BO to a temporary buffer and convert
 	 * from there.
 	 */
-	igt_memcpy_from_wc(buf, blit->base.linear.map, blit->base.linear.size);
-	y = &buf[blit->base.linear.offsets[0]];
-	uv = &buf[blit->base.linear.offsets[1]];
+	igt_memcpy_from_wc(buf, blit->base.linear.map, blit->base.linear.fb.size);
+	y = &buf[blit->base.linear.fb.offsets[0]];
+	uv = &buf[blit->base.linear.fb.offsets[1]];
 
 	for (i = 0; i < fb->height / 2; i++) {
 		for (j = 0; j < fb->width / 2; j++) {
@@ -1521,11 +1508,11 @@ static void convert_nv12_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
 static void convert_rgb24_to_nv12(struct igt_fb *fb, struct fb_convert_blit_upload *blit)
 {
 	int i, j;
-	uint8_t *y = &blit->base.linear.map[blit->base.linear.offsets[0]];
-	uint8_t *uv = &blit->base.linear.map[blit->base.linear.offsets[1]];
+	uint8_t *y = &blit->base.linear.map[blit->base.linear.fb.offsets[0]];
+	uint8_t *uv = &blit->base.linear.map[blit->base.linear.fb.offsets[1]];
 	const uint8_t *rgb24 = blit->rgb24.map;
 	unsigned rgb24_stride = blit->rgb24.stride;
-	unsigned planar_stride = blit->base.linear.stride;
+	unsigned planar_stride = blit->base.linear.fb.strides[0];
 	struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb->color_encoding,
 						    fb->color_range);
 
@@ -1652,8 +1639,8 @@ static void convert_yuyv_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
 	int i, j;
 	const uint8_t *yuyv;
 	uint8_t *rgb24 = blit->rgb24.map;
-	unsigned rgb24_stride = blit->rgb24.stride, yuyv_stride = blit->base.linear.stride;
-	uint8_t *buf = malloc(blit->base.linear.size);
+	unsigned rgb24_stride = blit->rgb24.stride, yuyv_stride = blit->base.linear.fb.strides[0];
+	uint8_t *buf = malloc(blit->base.linear.fb.size);
 	struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb->color_encoding,
 						    fb->color_range);
 
@@ -1662,7 +1649,7 @@ static void convert_yuyv_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
 	 * it's faster to copy the whole BO to a temporary buffer and convert
 	 * from there.
 	 */
-	igt_memcpy_from_wc(buf, blit->base.linear.map, blit->base.linear.size);
+	igt_memcpy_from_wc(buf, blit->base.linear.map, blit->base.linear.fb.size);
 	yuyv = buf;
 
 	for (i = 0; i < fb->height; i++) {
@@ -1712,7 +1699,7 @@ static void convert_rgb24_to_yuyv(struct igt_fb *fb, struct fb_convert_blit_uplo
 	uint8_t *yuyv = blit->base.linear.map;
 	const uint8_t *rgb24 = blit->rgb24.map;
 	unsigned rgb24_stride = blit->rgb24.stride;
-	unsigned yuyv_stride = blit->base.linear.stride;
+	unsigned yuyv_stride = blit->base.linear.fb.strides[0];
 	struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb->color_encoding,
 						    fb->color_range);
 
@@ -1781,7 +1768,7 @@ static void destroy_cairo_surface__convert(void *arg)
 
 	munmap(blit->rgb24.map, blit->rgb24.size);
 
-	if (blit->base.linear.handle)
+	if (blit->base.linear.fb.gem_handle)
 		free_linear_mapping(&blit->base);
 	else
 		gem_munmap(blit->base.linear.map, fb->size);
@@ -1807,13 +1794,13 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
 		setup_linear_mapping(fd, fb, &blit->base.linear);
 	} else {
-		blit->base.linear.handle = 0;
+		blit->base.linear.fb.gem_handle = 0;
 		blit->base.linear.map = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
 					      PROT_READ | PROT_WRITE);
 		igt_assert(blit->base.linear.map);
-		blit->base.linear.stride = fb->stride;
-		blit->base.linear.size = fb->size;
-		memcpy(blit->base.linear.offsets, fb->offsets, sizeof(fb->offsets));
+		blit->base.linear.fb.size = fb->size;
+		memcpy(blit->base.linear.fb.strides, fb->strides, sizeof(fb->strides));
+		memcpy(blit->base.linear.fb.offsets, fb->offsets, sizeof(fb->offsets));
 	}
 
 	/* Convert to linear rgb! */
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index d28bc0c4110a..a6d8cfd9c702 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -47,12 +47,12 @@
  * @drm_format: DRM FOURCC code
  * @width: width in pixels
  * @height: height in pixels
- * @stride: line stride in bytes
  * @tiling: tiling mode as a DRM framebuffer modifier
  * @size: size in bytes of the underlying backing storage
  * @cairo_surface: optionally attached cairo drawing surface
  * @domain: current domain for cache flushing tracking on i915.ko
  * @num_planes: Amount of planes on this fb. >1 for planar formats.
+ * @strides: line stride for each plane in bytes
  * @offsets: Offset for each plane in bytes.
  * @plane_bpp: The bpp for each plane.
  * @plane_width: The width for each plane.
@@ -70,12 +70,12 @@ typedef struct igt_fb {
 	int height;
 	enum igt_color_encoding color_encoding;
 	enum igt_color_range color_range;
-	unsigned int stride;
 	uint64_t tiling;
 	unsigned int size;
 	cairo_surface_t *cairo_surface;
 	unsigned int domain;
 	unsigned int num_planes;
+	uint32_t strides[4];
 	uint32_t offsets[4];
 	unsigned int plane_bpp[4];
 	unsigned int plane_width[4];
diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index fe21b3a866de..f7a353b3098e 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -330,7 +330,7 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
 	fb->drm_format = f.pixel_format;
 	fb->width = f.width;
 	fb->height = f.height;
-	fb->stride = f.pitches[0];
+	fb->strides[0] = f.pitches[0];
 	fb->tiling = f.modifier[0];
 	fb->size = size[0];
 	fb->cairo_surface = NULL;
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 393d690ab535..f7d08a60aeea 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -592,7 +592,7 @@ static void recreate_fb(struct test_output *o)
 	igt_assert(r);
 
 	do_or_die(drmModeAddFB(drm_fd, o->fb_width, o->fb_height, o->depth,
-			       o->bpp, fb_info->stride,
+			       o->bpp, fb_info->strides[0],
 			       r->handle, &new_fb_id));
 
 	gem_close(drm_fd, r->handle);
@@ -612,7 +612,7 @@ static void set_y_tiling(struct test_output *o, int fb_idx)
 	r = drmModeGetFB(drm_fd, fb_info->fb_id);
 	igt_assert(r);
 	/* Newer kernels don't allow such shenagians any more, so skip the test. */
-	igt_require(__gem_set_tiling(drm_fd, r->handle, I915_TILING_Y, fb_info->stride) == 0);
+	igt_require(__gem_set_tiling(drm_fd, r->handle, I915_TILING_Y, fb_info->strides[0]) == 0);
 	gem_close(drm_fd, r->handle);
 	drmFree(r);
 }
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 1dfd7c1cee8d..823fb8453165 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -1161,7 +1161,7 @@ static void start_busy_thread(struct igt_fb *fb)
 	busy_thread.stop = false;
 	busy_thread.handle = fb->gem_handle;
 	busy_thread.size = fb->size;
-	busy_thread.stride = fb->stride;
+	busy_thread.stride = fb->strides[0];
 	busy_thread.width = fb->width;
 	busy_thread.height = fb->height;
 	busy_thread.color = pick_color(fb, COLOR_PRIM_BG);
@@ -2841,7 +2841,7 @@ static void badstride_subtest(const struct test_mode *t)
 
 	create_fb(t->format, params->primary.fb->width + 4096, params->primary.fb->height,
 		  opt.tiling, t->plane, &wide_fb);
-	igt_assert(wide_fb.stride > 16384);
+	igt_assert(wide_fb.strides[0] > 16384);
 
 	fill_fb(&wide_fb, COLOR_PRIM_BG);
 
@@ -2910,7 +2910,7 @@ static void stridechange_subtest(const struct test_mode *t)
 		  opt.tiling, t->plane, &new_fb);
 	fill_fb(&new_fb, COLOR_PRIM_BG);
 
-	igt_assert(old_fb->stride != new_fb.stride);
+	igt_assert(old_fb->strides[0] != new_fb.strides[0]);
 
 	/* We can't assert that FBC will be enabled since there may not be
 	 * enough space for the CFB, but we can check the CRC. */
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 4268bb19ac82..8f8b82a339ed 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -1518,7 +1518,7 @@ static void cursor_subtest(bool dpms)
 	 * hopefully it has some fences around it. */
 	rc = drmModeRmFB(drm_fd, cursor_fb3.fb_id);
 	igt_assert_eq(rc, 0);
-	gem_set_tiling(drm_fd, cursor_fb3.gem_handle, false, cursor_fb3.stride);
+	gem_set_tiling(drm_fd, cursor_fb3.gem_handle, false, cursor_fb3.strides[0]);
 	igt_assert(wait_for_suspended());
 
 	rc = drmModeSetCursor(drm_fd, crtc_id, cursor_fb3.gem_handle,
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 20/25] lib/igt_fb: Refactor blitter usage
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (17 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 19/25] lib/igt_fb: Pass around igt_fb internally Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-09-21 23:48   ` Paulo Zanoni
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 21/25] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
                   ` (7 subsequent siblings)
  26 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Deduplicate the blitter code.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 62 ++++++++++++++++++++++++++++--------------------------------
 1 file changed, 29 insertions(+), 33 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 23f53caa0ad2..a0859230f37f 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1206,32 +1206,44 @@ struct fb_blit_upload {
 	struct fb_blit_linear linear;
 };
 
+static void blitcopy(const struct igt_fb *dst_fb,
+		     const struct igt_fb *src_fb)
+{
+	igt_assert_eq(dst_fb->fd, src_fb->fd);
+	igt_assert_eq(dst_fb->num_planes, src_fb->num_planes);
+
+	for (int i = 0; i < dst_fb->num_planes; i++) {
+		igt_assert_eq(dst_fb->plane_bpp[i], src_fb->plane_bpp[i]);
+		igt_assert_eq(dst_fb->plane_width[i], src_fb->plane_width[i]);
+		igt_assert_eq(dst_fb->plane_height[i], src_fb->plane_height[i]);
+
+		igt_blitter_fast_copy__raw(dst_fb->fd,
+					   src_fb->gem_handle,
+					   src_fb->offsets[i],
+					   src_fb->strides[i],
+					   igt_fb_mod_to_tiling(src_fb->tiling),
+					   0, 0, /* src_x, src_y */
+					   dst_fb->plane_width[i], dst_fb->plane_height[i],
+					   dst_fb->plane_bpp[i],
+					   dst_fb->gem_handle,
+					   dst_fb->offsets[i],
+					   dst_fb->strides[i],
+					   igt_fb_mod_to_tiling(dst_fb->tiling),
+					   0, 0 /* dst_x, dst_y */);
+	}
+}
+
 static void free_linear_mapping(struct fb_blit_upload *blit)
 {
 	int fd = blit->fd;
 	struct igt_fb *fb = blit->fb;
 	struct fb_blit_linear *linear = &blit->linear;
-	unsigned int obj_tiling = igt_fb_mod_to_tiling(fb->tiling);
-	int i;
 
 	gem_munmap(linear->map, linear->fb.size);
 	gem_set_domain(fd, linear->fb.gem_handle,
 		       I915_GEM_DOMAIN_GTT, 0);
 
-	for (i = 0; i < fb->num_planes; i++)
-		igt_blitter_fast_copy__raw(fd,
-					   linear->fb.gem_handle,
-					   linear->fb.offsets[i],
-					   linear->fb.strides[i],
-					   I915_TILING_NONE,
-					   0, 0, /* src_x, src_y */
-					   fb->plane_width[i], fb->plane_height[i],
-					   fb->plane_bpp[i],
-					   fb->gem_handle,
-					   fb->offsets[i],
-					   fb->strides[i],
-					   obj_tiling,
-					   0, 0 /* dst_x, dst_y */);
+	blitcopy(fb, &linear->fb);
 
 	gem_sync(fd, linear->fb.gem_handle);
 	gem_close(fd, linear->fb.gem_handle);
@@ -1250,9 +1262,6 @@ static void destroy_cairo_surface__blit(void *arg)
 
 static void setup_linear_mapping(int fd, struct igt_fb *fb, struct fb_blit_linear *linear)
 {
-	unsigned int obj_tiling = igt_fb_mod_to_tiling(fb->tiling);
-	int i;
-
 	/*
 	 * We create a linear BO that we'll map for the CPU to write to (using
 	 * cairo). This linear bo will be then blitted to its final
@@ -1271,20 +1280,7 @@ static void setup_linear_mapping(int fd, struct igt_fb *fb, struct fb_blit_linea
 	gem_set_domain(fd, linear->fb.gem_handle,
 			I915_GEM_DOMAIN_GTT, 0);
 
-	for (i = 0; i < fb->num_planes; i++)
-		igt_blitter_fast_copy__raw(fd,
-					   fb->gem_handle,
-					   fb->offsets[i],
-					   fb->strides[i],
-					   obj_tiling,
-					   0, 0, /* src_x, src_y */
-					   fb->plane_width[i], fb->plane_height[i],
-					   fb->plane_bpp[i],
-					   linear->fb.gem_handle,
-					   linear->fb.offsets[i],
-					   linear->fb.strides[i],
-					   I915_TILING_NONE,
-					   0, 0 /* dst_x, dst_y */);
+	blitcopy(&linear->fb, fb);
 
 	gem_sync(fd, linear->fb.gem_handle);
 
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 21/25] lib/igt_fb: Don't use blitter for large buffers
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (18 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 20/25] lib/igt_fb: Refactor blitter usage Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 22/25] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy Ville Syrjala
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The blitter stride is limited to <32k. Fall back to gtt mmap if we're
about to exceed that.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index a0859230f37f..a81b6069a0b0 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1786,8 +1786,9 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	blit->rgb24.map = mmap(NULL, blit->rgb24.size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 	igt_assert(blit->rgb24.map != MAP_FAILED);
 
-	if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
+	if ((fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+	     fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) &&
+	    fb->strides[0] < 32768) {
 		setup_linear_mapping(fd, fb, &blit->base.linear);
 	} else {
 		blit->base.linear.fb.gem_handle = 0;
@@ -1842,8 +1843,9 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
 	if (fb->cairo_surface == NULL) {
 		if (igt_format_is_yuv(fb->drm_format))
 			create_cairo_surface__convert(fd, fb);
-		else if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-		    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED)
+		else if ((fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+			  fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) &&
+			 fb->strides[0] < 32768)
 			create_cairo_surface__blit(fd, fb);
 		else
 			create_cairo_surface__gtt(fd, fb);
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 22/25] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (19 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 21/25] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 23/25] tests/gem_render_copy: Test Yf tiling Ville Syrjala
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Set up the surface state accordingly to support Yf/Ys tiling.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/gen8_render.h     | 6 ++++--
 lib/rendercopy_gen9.c | 8 +++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/gen8_render.h b/lib/gen8_render.h
index c62047d86b25..372c52679861 100644
--- a/lib/gen8_render.h
+++ b/lib/gen8_render.h
@@ -121,9 +121,11 @@ struct gen8_surface_state
 	struct {
 		uint32_t mip_count:4;
 		uint32_t min_lod:4;
-		uint32_t pad3:6;
+		uint32_t mip_tail_start_lod:4; /* gen9+ */
+		uint32_t pad3:2;
 		uint32_t coherency_type:1;
-		uint32_t pad2:5;
+		uint32_t pad2:3;
+		uint32_t trmode:2; /* gen9+ */
 		uint32_t ewa_disable_for_cube:1;
 		uint32_t y_offset:3;
 		uint32_t pad0:1;
diff --git a/lib/rendercopy_gen9.c b/lib/rendercopy_gen9.c
index 0ed897768008..31710ecdd72e 100644
--- a/lib/rendercopy_gen9.c
+++ b/lib/rendercopy_gen9.c
@@ -168,9 +168,15 @@ gen8_bind_buf(struct intel_batchbuffer *batch, const struct igt_buf *buf,
 	ss->ss0.horizontal_alignment = 1; /* align 4 */
 	if (buf->tiling == I915_TILING_X)
 		ss->ss0.tiled_mode = 2;
-	else if (buf->tiling == I915_TILING_Y)
+	else if (buf->tiling != I915_TILING_NONE)
 		ss->ss0.tiled_mode = 3;
 
+	if (buf->tiling == I915_TILING_Yf)
+		ss->ss5.trmode = 1;
+	else if (buf->tiling == I915_TILING_Ys)
+		ss->ss5.trmode = 2;
+	ss->ss5.mip_tail_start_lod = 1; /* needed with trmode */
+
 	ss->ss8.base_addr = buf->bo->offset64;
 	ss->ss9.base_addr_hi = buf->bo->offset64 >> 32;
 
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 23/25] tests/gem_render_copy: Test Yf tiling
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (20 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 22/25] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 24/25] lib/igt_fb: Use rendercopy for rendering into compressed buffers Ville Syrjala
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Let's test Yf tiling now that rendercopy can handle it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/gem_render_copy.c | 245 ++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 194 insertions(+), 51 deletions(-)

diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
index 135375a90ec2..a6047119043a 100644
--- a/tests/gem_render_copy.c
+++ b/tests/gem_render_copy.c
@@ -72,11 +72,85 @@ static const char *make_filename(const char *filename)
 	return buf;
 }
 
-static void *linear_copy(data_t *data, struct igt_buf *buf)
+static void *yf_ptr(void *ptr,
+		    unsigned int x, unsigned int y,
+		    unsigned int stride, unsigned int cpp)
 {
-	void *map, *linear;
+       x *= cpp;
+
+       return ptr +
+	       ((y & ~0x1f) * stride) +
+	       ((y & 0x10) * 64) +
+	       ((y & 0x8) * 32) +
+	       ((y & 0x7) * 16) +
+	       ((x & ~0x3f) * 32) +
+	       ((x & 0x20) * 16) +
+	       ((x & 0x10) * 8) +
+	       (x & 0xf);
+}
 
-	igt_assert_eq(posix_memalign(&linear, 16, buf->bo->size), 0);
+static void copy_linear_to_yf(data_t *data, struct igt_buf *buf, const uint32_t *linear)
+{
+	int height = igt_buf_height(buf);
+	int width = igt_buf_width(buf);
+	void *map;
+
+	gem_set_domain(data->drm_fd, buf->bo->handle,
+		       I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
+	map = gem_mmap__cpu(data->drm_fd, buf->bo->handle, 0,
+			    buf->bo->size, PROT_READ | PROT_WRITE);
+
+	for (int y = 0; y < height; y++) {
+		for (int x = 0; x < width; x++) {
+			uint32_t *ptr = yf_ptr(map, x, y, buf->stride, 4);
+
+			*ptr = linear[y * width + x];
+		}
+	}
+
+	munmap(map, buf->bo->size);
+}
+
+static void copy_yf_to_linear(data_t *data, struct igt_buf *buf, uint32_t *linear)
+{
+	int height = igt_buf_height(buf);
+	int width = igt_buf_width(buf);
+	void *map;
+
+	gem_set_domain(data->drm_fd, buf->bo->handle,
+		       I915_GEM_DOMAIN_CPU, 0);
+	map = gem_mmap__cpu(data->drm_fd, buf->bo->handle, 0,
+			    buf->bo->size, PROT_READ);
+
+	for (int y = 0; y < height; y++) {
+		for (int x = 0; x < width; x++) {
+			uint32_t *ptr = yf_ptr(map, x, y, buf->stride, 4);
+
+			linear[y * width + x] = *ptr;
+		}
+	}
+
+	munmap(map, buf->bo->size);
+}
+
+static void copy_linear_to_gtt(data_t *data, struct igt_buf *buf, const uint32_t *linear)
+{
+	void *map;
+
+	gem_set_domain(data->drm_fd, buf->bo->handle,
+		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
+
+	map = gem_mmap__gtt(data->drm_fd, buf->bo->handle,
+			    buf->bo->size, PROT_READ | PROT_WRITE);
+
+	memcpy(map, linear, buf->bo->size);
+
+	munmap(map, buf->bo->size);
+}
+
+static void copy_gtt_to_linear(data_t *data, struct igt_buf *buf, uint32_t *linear)
+{
+	void *map;
 
 	gem_set_domain(data->drm_fd, buf->bo->handle,
 		       I915_GEM_DOMAIN_GTT, 0);
@@ -87,6 +161,18 @@ static void *linear_copy(data_t *data, struct igt_buf *buf)
 	igt_memcpy_from_wc(linear, map, buf->bo->size);
 
 	munmap(map, buf->bo->size);
+}
+
+static void *linear_copy(data_t *data, struct igt_buf *buf)
+{
+	void *linear;
+
+	igt_assert_eq(posix_memalign(&linear, 16, buf->bo->size), 0);
+
+	if (buf->tiling == I915_TILING_Yf)
+		copy_yf_to_linear(data, buf, linear);
+	else
+		copy_gtt_to_linear(data, buf, linear);
 
 	return linear;
 }
@@ -175,7 +261,7 @@ static void scratch_buf_draw_pattern(data_t *data, struct igt_buf *buf,
 	cairo_surface_t *surface;
 	cairo_pattern_t *pat;
 	cairo_t *cr;
-	void *map, *linear;
+	void *linear;
 
 	linear = linear_copy(data, buf);
 
@@ -218,15 +304,10 @@ static void scratch_buf_draw_pattern(data_t *data, struct igt_buf *buf,
 
 	cairo_surface_destroy(surface);
 
-	gem_set_domain(data->drm_fd, buf->bo->handle,
-		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
-
-	map = gem_mmap__gtt(data->drm_fd, buf->bo->handle,
-			    buf->bo->size, PROT_READ | PROT_WRITE);
-
-	memcpy(map, linear, buf->bo->size);
-
-	munmap(map, buf->bo->size);
+	if (buf->tiling == I915_TILING_Yf)
+		copy_linear_to_yf(data, buf, linear);
+	else
+		copy_linear_to_gtt(data, buf, linear);
 
 	free(linear);
 }
@@ -238,36 +319,59 @@ scratch_buf_copy(data_t *data,
 {
 	int width = igt_buf_width(dst);
 	int height  = igt_buf_height(dst);
-	uint32_t *linear_dst, *linear_src;
+	uint32_t *linear_dst;
 
 	igt_assert_eq(igt_buf_width(dst), igt_buf_width(src));
 	igt_assert_eq(igt_buf_height(dst), igt_buf_height(src));
 	igt_assert_eq(dst->bo->size, src->bo->size);
 
+	w = min(w, width - sx);
+	w = min(w, width - dx);
+
+	h = min(h, height - sy);
+	h = min(h, height - dy);
+
 	gem_set_domain(data->drm_fd, dst->bo->handle,
 		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
-	gem_set_domain(data->drm_fd, src->bo->handle,
-		       I915_GEM_DOMAIN_GTT, 0);
-
 	linear_dst = gem_mmap__gtt(data->drm_fd, dst->bo->handle,
 				   dst->bo->size, PROT_WRITE);
-	linear_src = gem_mmap__gtt(data->drm_fd, src->bo->handle,
-				   src->bo->size, PROT_READ);
 
-	w = min(w, width - sx);
-	w = min(w, width - dx);
+	if (src->tiling == I915_TILING_Yf) {
+		void *map;
 
-	h = min(h, height - sy);
-	h = min(h, height - dy);
+		gem_set_domain(data->drm_fd, src->bo->handle,
+			       I915_GEM_DOMAIN_CPU, 0);
+		map = gem_mmap__cpu(data->drm_fd, src->bo->handle, 0,
+				    src->bo->size, PROT_READ);
+
+		for (int y = 0; y < h; y++) {
+			for (int x = 0; x < w; x++) {
+				const uint32_t *ptr = yf_ptr(map, sx+x, sy+y, src->stride, 4);
+
+				linear_dst[(dy+y) * width + dx+x] = *ptr;
+			}
+		}
+
+		munmap(map, src->bo->size);
+	} else {
+		uint32_t *linear_src;
+
+		gem_set_domain(data->drm_fd, src->bo->handle,
+			       I915_GEM_DOMAIN_GTT, 0);
 
-	for (int y = 0; y < h; y++) {
-		igt_memcpy_from_wc(&linear_dst[(dy+y) * width + dx],
-				   &linear_src[(sy+y) * width + sx],
-				   w * 4);
+		linear_src = gem_mmap__gtt(data->drm_fd, src->bo->handle,
+					   src->bo->size, PROT_READ);
+
+		for (int y = 0; y < h; y++) {
+			igt_memcpy_from_wc(&linear_dst[(dy+y) * width + dx],
+					   &linear_src[(sy+y) * width + sx],
+					   w * 4);
+		}
+
+		munmap(linear_src, src->bo->size);
 	}
 
 	munmap(linear_dst, dst->bo->size);
-	munmap(linear_src, src->bo->size);
 }
 
 static void scratch_buf_init(data_t *data, struct igt_buf *buf,
@@ -284,7 +388,8 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
 		int size;
 
 		igt_require(intel_gen(data->devid) >= 9);
-		igt_assert_eq(tiling, I915_TILING_Y);
+		igt_assert(tiling == I915_TILING_Y ||
+			   tiling == I915_TILING_Yf);
 
 		buf->stride = ALIGN(width * 4, 128);
 		buf->size = buf->stride * height;
@@ -300,8 +405,20 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
 
 		buf->bo = drm_intel_bo_alloc(data->bufmgr, "", size, 4096);
 
-		drm_intel_bo_set_tiling(buf->bo, &tiling, buf->stride);
-		igt_assert_eq(tiling, req_tiling);
+		if (tiling == I915_TILING_Y) {
+			drm_intel_bo_set_tiling(buf->bo, &tiling, buf->stride);
+			igt_assert_eq(tiling, req_tiling);
+		}
+	} else if (req_tiling == I915_TILING_Yf) {
+		int size;
+
+		buf->stride = ALIGN(width * 4, 128);
+		buf->size = buf->stride * height;
+		buf->tiling = tiling;
+
+		size = buf->stride * ALIGN(height, 32);
+
+		buf->bo = drm_intel_bo_alloc(data->bufmgr, "", size, 4096);
 	} else {
 		buf->bo = drm_intel_bo_alloc_tiled(data->bufmgr, "",
 						   width, height, 4,
@@ -396,7 +513,7 @@ static void scratch_buf_aux_check(data_t *data,
 		     "Aux surface indicates that nothing was compressed\n");
 }
 
-static void test(data_t *data, uint32_t tiling, bool test_ccs)
+static void test(data_t *data, uint32_t tiling, uint64_t ccs_modifier)
 {
 	struct igt_buf dst, ccs, ref;
 	struct {
@@ -404,7 +521,7 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
 		const char *filename;
 		uint32_t tiling;
 		int x, y;
-	} src[3] = {
+	} src[] = {
 		{
 			.filename = "source-linear.png",
 			.tiling = I915_TILING_NONE,
@@ -420,18 +537,31 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
 			.tiling = I915_TILING_Y,
 			.x = WIDTH/2+1, .y = 1,
 		},
+		{
+			.filename = "source-yf-tiled.png",
+			.tiling = I915_TILING_Yf,
+			.x = 1, .y = 1,
+		},
 	};
 
 	int opt_dump_aub = igt_aub_dump_enabled();
+	int num_src = ARRAY_SIZE(src);
+
+	/* no Yf before gen9 */
+	if (intel_gen(data->devid) < 9)
+		num_src--;
+
+	if (tiling == I915_TILING_Yf || ccs_modifier)
+		igt_require(intel_gen(data->devid) >= 9);
 
-	for (int i = 0; i < ARRAY_SIZE(src); i++)
+	for (int i = 0; i < num_src; i++)
 		scratch_buf_init(data, &src[i].buf, WIDTH, HEIGHT, src[i].tiling, false);
 	scratch_buf_init(data, &dst, WIDTH, HEIGHT, tiling, false);
-	if (test_ccs)
-		scratch_buf_init(data, &ccs, WIDTH, HEIGHT, I915_TILING_Y, true);
+	if (ccs_modifier)
+		scratch_buf_init(data, &ccs, WIDTH, HEIGHT, ccs_modifier, true);
 	scratch_buf_init(data, &ref, WIDTH, HEIGHT, I915_TILING_NONE, false);
 
-	for (int i = 0; i < ARRAY_SIZE(src); i++)
+	for (int i = 0; i < num_src; i++)
 		scratch_buf_draw_pattern(data, &src[i].buf,
 					 0, 0, WIDTH, HEIGHT,
 					 0, 0, WIDTH, HEIGHT, true);
@@ -442,13 +572,13 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
 	scratch_buf_copy(data,
 			 &dst, 0, 0, WIDTH, HEIGHT,
 			 &ref, 0, 0);
-	for (int i = 0; i < ARRAY_SIZE(src); i++)
+	for (int i = 0; i < num_src; i++)
 		scratch_buf_copy(data,
 				 &src[i].buf, WIDTH/4, HEIGHT/4, WIDTH/2-2, HEIGHT/2-2,
 				 &ref, src[i].x, src[i].y);
 
 	if (opt_dump_png) {
-		for (int i = 0; i < ARRAY_SIZE(src); i++)
+		for (int i = 0; i < num_src; i++)
 			scratch_buf_write_to_png(data, &src[i].buf, src[i].filename);
 		scratch_buf_write_to_png(data, &dst, "destination.png");
 		scratch_buf_write_to_png(data, &ref, "reference.png");
@@ -468,24 +598,24 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
 	 *	 |dst|src|
 	 *	  -------
 	 */
-	if (test_ccs)
+	if (ccs_modifier)
 		data->render_copy(data->batch, NULL,
 				  &dst, 0, 0, WIDTH, HEIGHT,
 				  &ccs, 0, 0);
 
-	for (int i = 0; i < ARRAY_SIZE(src); i++)
+	for (int i = 0; i < num_src; i++)
 		data->render_copy(data->batch, NULL,
 				  &src[i].buf, WIDTH/4, HEIGHT/4, WIDTH/2-2, HEIGHT/2-2,
-				  test_ccs ? &ccs : &dst, src[i].x, src[i].y);
+				  ccs_modifier ? &ccs : &dst, src[i].x, src[i].y);
 
-	if (test_ccs)
+	if (ccs_modifier)
 		data->render_copy(data->batch, NULL,
 				  &ccs, 0, 0, WIDTH, HEIGHT,
 				  &dst, 0, 0);
 
 	if (opt_dump_png){
 		scratch_buf_write_to_png(data, &dst, "result.png");
-		if (test_ccs) {
+		if (ccs_modifier) {
 			scratch_buf_write_to_png(data, &ccs, "compressed.png");
 			scratch_buf_aux_write_to_png(data, &ccs, "compressed-aux.png");
 		}
@@ -505,7 +635,7 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
 		scratch_buf_check(data, &dst, &ref, WIDTH - 10, HEIGHT - 10);
 	}
 
-	if (test_ccs)
+	if (ccs_modifier)
 		scratch_buf_aux_check(data, &ccs);
 }
 
@@ -546,18 +676,31 @@ int main(int argc, char **argv)
 	}
 
 	igt_subtest("linear")
-		test(&data, I915_TILING_NONE, false);
+		test(&data, I915_TILING_NONE, 0);
 	igt_subtest("x-tiled")
-		test(&data, I915_TILING_X, false);
+		test(&data, I915_TILING_X, 0);
 	igt_subtest("y-tiled")
-		test(&data, I915_TILING_Y, false);
+		test(&data, I915_TILING_Y, 0);
+	igt_subtest("yf-tiled")
+		test(&data, I915_TILING_Yf, 0);
 
 	igt_subtest("y-tiled-ccs-to-linear")
-		test(&data, I915_TILING_NONE, true);
+		test(&data, I915_TILING_NONE, I915_TILING_Y);
 	igt_subtest("y-tiled-ccs-to-x-tiled")
-		test(&data, I915_TILING_X, true);
+		test(&data, I915_TILING_X, I915_TILING_Y);
 	igt_subtest("y-tiled-ccs-to-y-tiled")
-		test(&data, I915_TILING_Y, true);
+		test(&data, I915_TILING_Y, I915_TILING_Y);
+	igt_subtest("y-tiled-ccs-to-yf-tiled")
+		test(&data, I915_TILING_Yf, I915_TILING_Y);
+
+	igt_subtest("yf-tiled-ccs-to-linear")
+		test(&data, I915_TILING_NONE, I915_TILING_Yf);
+	igt_subtest("yf-tiled-ccs-to-x-tiled")
+		test(&data, I915_TILING_X, I915_TILING_Yf);
+	igt_subtest("yf-tiled-ccs-to-y-tiled")
+		test(&data, I915_TILING_Y, I915_TILING_Yf);
+	igt_subtest("yf-tiled-ccs-to-yf-tiled")
+		test(&data, I915_TILING_Yf, I915_TILING_Yf);
 
 	igt_fixture {
 		intel_batchbuffer_free(data.batch);
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 24/25] lib/igt_fb: Use rendercopy for rendering into compressed buffers
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (21 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 23/25] tests/gem_render_copy: Test Yf tiling Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 25/25] tests/kms_plane: Test all modifiers as well Ville Syrjala
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Plug in rendercopy to the cairo surface stuff so that we can
generate compressed buffers with cairo.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 130 insertions(+), 9 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index a81b6069a0b0..d49c2701b2f0 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -152,6 +152,7 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 		}
 		break;
 	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+	case LOCAL_I915_FORMAT_MOD_Y_TILED_CCS:
 		igt_require_intel(fd);
 		if (intel_gen(intel_get_drm_devid(fd)) == 2) {
 			*width_ret = 128;
@@ -165,6 +166,7 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 		}
 		break;
 	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
+	case LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS:
 		igt_require_intel(fd);
 		switch (fb_bpp) {
 		case 8:
@@ -190,8 +192,16 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 	}
 }
 
+static bool modifier_has_ccs(uint64_t modifier)
+{
+	return modifier == LOCAL_I915_FORMAT_MOD_Y_TILED_CCS ||
+		modifier == LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS;
+}
+
 static unsigned fb_plane_width(const struct igt_fb *fb, int plane)
 {
+	if (modifier_has_ccs(fb->tiling) && plane == 1)
+		return DIV_ROUND_UP(fb->width, 1024) * 128;
 	if (fb->drm_format == DRM_FORMAT_NV12 && plane == 1)
 		return DIV_ROUND_UP(fb->width, 2);
 
@@ -202,11 +212,16 @@ static unsigned fb_plane_bpp(const struct igt_fb *fb, int plane)
 {
 	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	return format->plane_bpp[plane];
+	if (modifier_has_ccs(fb->tiling) && plane == 1)
+		return 8;
+	else
+		return format->plane_bpp[plane];
 }
 
 static unsigned fb_plane_height(const struct igt_fb *fb, int plane)
 {
+	if (modifier_has_ccs(fb->tiling) && plane == 1)
+		return DIV_ROUND_UP(fb->height, 512) * 32;
 	if (fb->drm_format == DRM_FORMAT_NV12 && plane == 1)
 		return DIV_ROUND_UP(fb->height, 2);
 
@@ -217,7 +232,10 @@ static int fb_num_planes(const struct igt_fb *fb)
 {
 	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	return format->num_planes;
+	if (modifier_has_ccs(fb->tiling))
+		return 2;
+	else
+		return format->num_planes;
 }
 
 static void fb_init(struct igt_fb *fb,
@@ -374,8 +392,10 @@ uint64_t igt_fb_mod_to_tiling(uint64_t modifier)
 	case LOCAL_I915_FORMAT_MOD_X_TILED:
 		return I915_TILING_X;
 	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+	case LOCAL_I915_FORMAT_MOD_Y_TILED_CCS:
 		return I915_TILING_Y;
 	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
+	case LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS:
 		return I915_TILING_Yf;
 	default:
 		igt_assert(0);
@@ -1204,8 +1224,53 @@ struct fb_blit_upload {
 	int fd;
 	struct igt_fb *fb;
 	struct fb_blit_linear linear;
+	drm_intel_bufmgr *bufmgr;
+	struct intel_batchbuffer *batch;
 };
 
+static void init_buf(struct fb_blit_upload *blit,
+		     struct igt_buf *buf,
+		     const struct igt_fb *fb,
+		     const char *name)
+{
+	igt_assert_eq(fb->offsets[0], 0);
+
+	buf->bo = gem_handle_to_libdrm_bo(blit->bufmgr, blit->fd,
+					  name, fb->gem_handle);
+	buf->tiling = igt_fb_mod_to_tiling(fb->tiling);
+	buf->stride = fb->strides[0];
+	buf->size = fb->size;
+
+	if (modifier_has_ccs(fb->tiling)) {
+		igt_assert_eq(fb->strides[0] & 127, 0);
+		igt_assert_eq(fb->strides[1] & 127, 0);
+
+		buf->aux.offset = fb->offsets[1];
+		buf->aux.stride = fb->strides[1];
+	}
+}
+
+static void rendercopy(struct fb_blit_upload *blit,
+		       const struct igt_fb *dst_fb,
+		       const struct igt_fb *src_fb)
+{
+	struct igt_buf src = {}, dst = {};
+	igt_render_copyfunc_t render_copy =
+		igt_get_render_copyfunc(intel_get_drm_devid(blit->fd));
+
+	igt_require(render_copy);
+
+	igt_assert_eq(dst_fb->offsets[0], 0);
+	igt_assert_eq(src_fb->offsets[0], 0);
+
+	init_buf(blit, &src, src_fb, "cairo rendercopy src");
+	init_buf(blit, &dst, dst_fb, "cairo rendercopy dst");
+
+	render_copy(blit->batch, NULL,
+		    &src, 0, 0, dst_fb->plane_width[0], dst_fb->plane_height[0],
+		    &dst, 0, 0);
+}
+
 static void blitcopy(const struct igt_fb *dst_fb,
 		     const struct igt_fb *src_fb)
 {
@@ -1243,7 +1308,10 @@ static void free_linear_mapping(struct fb_blit_upload *blit)
 	gem_set_domain(fd, linear->fb.gem_handle,
 		       I915_GEM_DOMAIN_GTT, 0);
 
-	blitcopy(fb, &linear->fb);
+	if (blit->batch)
+		rendercopy(blit, fb, &linear->fb);
+	else
+		blitcopy(fb, &linear->fb);
 
 	gem_sync(fd, linear->fb.gem_handle);
 	gem_close(fd, linear->fb.gem_handle);
@@ -1260,8 +1328,26 @@ static void destroy_cairo_surface__blit(void *arg)
 	free(blit);
 }
 
-static void setup_linear_mapping(int fd, struct igt_fb *fb, struct fb_blit_linear *linear)
+static void destroy_cairo_surface__rendercopy(void *arg)
+{
+	struct fb_blit_upload *blit = arg;
+
+	blit->fb->cairo_surface = NULL;
+
+	free_linear_mapping(blit);
+
+	intel_batchbuffer_free(blit->batch);
+	drm_intel_bufmgr_destroy(blit->bufmgr);
+
+	free(blit);
+}
+
+static void setup_linear_mapping(struct fb_blit_upload *blit)
 {
+	int fd = blit->fd;
+	struct igt_fb *fb = blit->fb;
+	struct fb_blit_linear *linear = &blit->linear;
+
 	/*
 	 * We create a linear BO that we'll map for the CPU to write to (using
 	 * cairo). This linear bo will be then blitted to its final
@@ -1280,7 +1366,10 @@ static void setup_linear_mapping(int fd, struct igt_fb *fb, struct fb_blit_linea
 	gem_set_domain(fd, linear->fb.gem_handle,
 			I915_GEM_DOMAIN_GTT, 0);
 
-	blitcopy(&linear->fb, fb);
+	if (blit->batch)
+		rendercopy(blit, &linear->fb, fb);
+	else
+		blitcopy(&linear->fb, fb);
 
 	gem_sync(fd, linear->fb.gem_handle);
 
@@ -1297,12 +1386,12 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
 	struct fb_blit_upload *blit;
 	cairo_format_t cairo_format;
 
-	blit = malloc(sizeof(*blit));
+	blit = calloc(1, sizeof(*blit));
 	igt_assert(blit);
 
 	blit->fd = fd;
 	blit->fb = fb;
-	setup_linear_mapping(fd, fb, &blit->linear);
+	setup_linear_mapping(blit);
 
 	cairo_format = drm_format_to_cairo(fb->drm_format);
 	fb->cairo_surface =
@@ -1317,6 +1406,36 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
 				    blit, destroy_cairo_surface__blit);
 }
 
+static void create_cairo_surface__rendercopy(int fd, struct igt_fb *fb)
+{
+	struct fb_blit_upload *blit;
+	cairo_format_t cairo_format;
+
+	blit = calloc(1, sizeof(*blit));
+	igt_assert(blit);
+
+	blit->fd = fd;
+	blit->fb = fb;
+
+	blit->bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+	blit->batch = intel_batchbuffer_alloc(blit->bufmgr,
+					      intel_get_drm_devid(fd));
+
+	setup_linear_mapping(blit);
+
+	cairo_format = drm_format_to_cairo(fb->drm_format);
+	fb->cairo_surface =
+		cairo_image_surface_create_for_data(blit->linear.map,
+						    cairo_format,
+						    fb->width, fb->height,
+						    blit->linear.fb.strides[0]);
+	fb->domain = I915_GEM_DOMAIN_GTT;
+
+	cairo_surface_set_user_data(fb->cairo_surface,
+				    (cairo_user_data_key_t *)create_cairo_surface__rendercopy,
+				    blit, destroy_cairo_surface__rendercopy);
+}
+
 /**
  * igt_dirty_fb:
  * @fd: open drm file descriptor
@@ -1776,7 +1895,7 @@ static void destroy_cairo_surface__convert(void *arg)
 
 static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 {
-	struct fb_convert_blit_upload *blit = malloc(sizeof(*blit));
+	struct fb_convert_blit_upload *blit = calloc(1, sizeof(*blit));
 	igt_assert(blit);
 
 	blit->base.fd = fd;
@@ -1789,7 +1908,7 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	if ((fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
 	     fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) &&
 	    fb->strides[0] < 32768) {
-		setup_linear_mapping(fd, fb, &blit->base.linear);
+		setup_linear_mapping(&blit->base);
 	} else {
 		blit->base.linear.fb.gem_handle = 0;
 		blit->base.linear.map = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
@@ -1843,6 +1962,8 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
 	if (fb->cairo_surface == NULL) {
 		if (igt_format_is_yuv(fb->drm_format))
 			create_cairo_surface__convert(fd, fb);
+		else if (modifier_has_ccs(fb->tiling))
+			create_cairo_surface__rendercopy(fd, fb);
 		else if ((fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
 			  fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) &&
 			 fb->strides[0] < 32768)
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] [PATCH i-g-t 25/25] tests/kms_plane: Test all modifiers as well
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (22 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 24/25] lib/igt_fb: Use rendercopy for rendering into compressed buffers Ville Syrjala
@ 2018-07-19 15:04 ` Ville Syrjala
  2018-07-19 15:26 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Patchwork
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 52+ messages in thread
From: Ville Syrjala @ 2018-07-19 15:04 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Instead of just testing each pixel format let's test every
format+modifier combo.

Obviously testing with solid filled fbs isn't the most effective
way to detect tiling problems, but we can't really do much more if
we want to keep comparing YUV vs. RGB results (unless we start to
render the RGB content in a way that matches the YUV subsampling
behaviour of the hardware).

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_plane.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index e0625748186f..e483457f37f6 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -453,14 +453,15 @@ static void set_legacy_lut(data_t *data, enum pipe pipe,
 
 static void test_format_plane_color(data_t *data, enum pipe pipe,
 				    igt_plane_t *plane,
-				    uint32_t format, int width, int height,
+				    uint32_t format, uint64_t modifier,
+				    int width, int height,
 				    int color, igt_crc_t *crc, struct igt_fb *fb)
 {
 	const color_t *c = &colors[color];
 	struct igt_fb old_fb = *fb;
 
 	igt_create_color_fb(data->drm_fd, width, height,
-			    format, LOCAL_DRM_FORMAT_MOD_NONE,
+			    format, modifier,
 			    c->red, c->green, c->blue, fb);
 
 	igt_plane_set_fb(plane, fb);
@@ -483,6 +484,7 @@ static void test_format_plane(data_t *data, enum pipe pipe,
 	struct igt_fb fb = {};
 	drmModeModeInfo *mode;
 	uint32_t format, ref_format;
+	uint64_t modifier, ref_modifier;
 	uint64_t width, height;
 	igt_crc_t ref_crc[ARRAY_SIZE(colors)];
 
@@ -491,6 +493,7 @@ static void test_format_plane(data_t *data, enum pipe pipe,
 		width = mode->hdisplay;
 		height = mode->vdisplay;
 		ref_format = format = DRM_FORMAT_XRGB8888;
+		ref_modifier = modifier = DRM_FORMAT_MOD_NONE;
 	} else {
 		if (!plane->drm_plane) {
 			igt_debug("Only legacy cursor ioctl supported, skipping cursor plane\n");
@@ -499,6 +502,7 @@ static void test_format_plane(data_t *data, enum pipe pipe,
 		do_or_die(drmGetCap(data->drm_fd, DRM_CAP_CURSOR_WIDTH, &width));
 		do_or_die(drmGetCap(data->drm_fd, DRM_CAP_CURSOR_HEIGHT, &height));
 		ref_format = format = DRM_FORMAT_ARGB8888;
+		ref_modifier = modifier = DRM_FORMAT_MOD_NONE;
 	}
 
 	igt_debug("Testing connector %s on %s plane %s.%u\n",
@@ -519,34 +523,38 @@ static void test_format_plane(data_t *data, enum pipe pipe,
 	test_init(data, pipe);
 	igt_pipe_crc_start(data->pipe_crc);
 
-	igt_info("Testing format " IGT_FORMAT_FMT " on %s.%u\n",
-		 IGT_FORMAT_ARGS(format),
+	igt_info("Testing format " IGT_FORMAT_FMT " / modifier 0x%" PRIx64 " on %s.%u\n",
+		 IGT_FORMAT_ARGS(format), modifier,
 		 kmstest_pipe_name(pipe), plane->index);
 
 	for (int i = 0; i < ARRAY_SIZE(colors); i++) {
 		test_format_plane_color(data, pipe, plane,
-					format, width, height,
+					format, modifier,
+					width, height,
 					i, &ref_crc[i], &fb);
 	}
 
-	for (int i = 0; i < plane->drm_plane->count_formats; i++) {
+	for (int i = 0; i < plane->format_mod_count; i++) {
 		igt_crc_t crc;
 
-		format = plane->drm_plane->formats[i];
+		format = plane->formats[i];
+		modifier = plane->modifiers[i];
 
-		if (format == ref_format)
+		if (format == ref_format &&
+		    modifier == ref_modifier)
 			continue;
 
 		if (!igt_fb_supported_format(format))
 			continue;
 
-		igt_info("Testing format " IGT_FORMAT_FMT " on %s.%u\n",
-			 IGT_FORMAT_ARGS(format),
+		igt_info("Testing format " IGT_FORMAT_FMT " / modifier 0x%" PRIx64 " on %s.%u\n",
+			 IGT_FORMAT_ARGS(format), modifier,
 			 kmstest_pipe_name(pipe), plane->index);
 
 		for (int j = 0; j < ARRAY_SIZE(colors); j++) {
 			test_format_plane_color(data, pipe, plane,
-						format, width, height,
+						format, modifier,
+						width, height,
 						j, &crc, &fb);
 
 			igt_assert_crc_equal(&crc, &ref_crc[j]);
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (23 preceding siblings ...)
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 25/25] tests/kms_plane: Test all modifiers as well Ville Syrjala
@ 2018-07-19 15:26 ` Patchwork
  2018-07-19 17:40 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2018-09-20 20:26 ` [igt-dev] [PATCH i-g-t 01/25] " Paulo Zanoni
  26 siblings, 0 replies; 52+ messages in thread
From: Patchwork @ 2018-07-19 15:26 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers
URL   : https://patchwork.freedesktop.org/series/46876/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4509 -> IGTPW_1607 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46876/revisions/1/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1607 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-bxt-dsi:         PASS -> INCOMPLETE (fdo#103927)

    
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927


== Participating hosts (46 -> 41) ==

  Additional (1): fi-kbl-7560u 
  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-hsw-peppy fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 


== Build changes ==

    * IGT: IGT_4567 -> IGTPW_1607

  CI_DRM_4509: e84aa0b47beed78a5a12db93e76fb00eab5db160 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1607: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1607/
  IGT_4567: 7f85adc4050182f490c7a5c48db3d57cdb00af4e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@gem_render_copy@yf-tiled
+igt@gem_render_copy@yf-tiled-ccs-to-linear
+igt@gem_render_copy@yf-tiled-ccs-to-x-tiled
+igt@gem_render_copy@yf-tiled-ccs-to-yf-tiled
+igt@gem_render_copy@yf-tiled-ccs-to-y-tiled
+igt@gem_render_copy@y-tiled-ccs-to-yf-tiled
+igt@kms_addfb_basic@expected-formats
+igt@kms_plane@validate-in-formats

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1607/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (24 preceding siblings ...)
  2018-07-19 15:26 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Patchwork
@ 2018-07-19 17:40 ` Patchwork
  2018-09-20 20:26 ` [igt-dev] [PATCH i-g-t 01/25] " Paulo Zanoni
  26 siblings, 0 replies; 52+ messages in thread
From: Patchwork @ 2018-07-19 17:40 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers
URL   : https://patchwork.freedesktop.org/series/46876/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4567_full -> IGTPW_1607_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1607_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1607_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46876/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1607_full:

  === IGT changes ===

    ==== Possible regressions ====

    {igt@kms_addfb_basic@expected-formats}:
      shard-kbl:          NOTRUN -> FAIL
      shard-apl:          NOTRUN -> FAIL
      shard-snb:          NOTRUN -> FAIL
      shard-glk:          NOTRUN -> FAIL
      shard-hsw:          NOTRUN -> FAIL

    
    ==== Warnings ====

    igt@gem_mocs_settings@mocs-rc6-bsd2:
      shard-kbl:          PASS -> SKIP

    igt@kms_vblank@pipe-a-ts-continuation-suspend:
      shard-snb:          PASS -> SKIP

    igt@perf_pmu@rc6:
      shard-kbl:          SKIP -> PASS

    
== Known issues ==

  Here are the changes found in IGTPW_1607_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-glk:          NOTRUN -> FAIL (fdo#106641)

    igt@kms_cursor_legacy@pipe-b-torture-move:
      shard-snb:          PASS -> DMESG-WARN (fdo#107122)
      shard-kbl:          PASS -> DMESG-WARN (fdo#107122)

    igt@kms_flip@plain-flip-fb-recreate-interruptible:
      shard-glk:          PASS -> FAIL (fdo#100368) +3

    igt@kms_plane@pixel-format-pipe-c-planes:
      shard-glk:          PASS -> INCOMPLETE (fdo#103359, k.org#198133) +2

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-snb:          PASS -> FAIL (fdo#103166)

    
    ==== Possible fixes ====

    igt@kms_rotation_crc@primary-rotation-180:
      shard-snb:          FAIL (fdo#103925) -> PASS

    igt@kms_setmode@basic:
      shard-apl:          FAIL (fdo#99912) -> PASS

    igt@kms_vblank@pipe-a-ts-continuation-suspend:
      shard-hsw:          FAIL (fdo#104894) -> PASS

    igt@perf@polling:
      shard-hsw:          FAIL (fdo#102252) -> PASS

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
  fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#104894 https://bugs.freedesktop.org/show_bug.cgi?id=104894
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#107122 https://bugs.freedesktop.org/show_bug.cgi?id=107122
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4567 -> IGTPW_1607
    * Linux: CI_DRM_4507 -> CI_DRM_4509

  CI_DRM_4507: 3bbfaebaf3ba21d866c7823d9e4febf47b4b7b39 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4509: e84aa0b47beed78a5a12db93e76fb00eab5db160 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1607: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1607/
  IGT_4567: 7f85adc4050182f490c7a5c48db3d57cdb00af4e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1607/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 05/25] tests/gem_render_copy: Fix clipped height
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 05/25] tests/gem_render_copy: Fix clipped height Ville Syrjala
@ 2018-08-24  3:17   ` Dhinakaran Pandiyan
  2018-08-28 14:21     ` Ville Syrjälä
  0 siblings, 1 reply; 52+ messages in thread
From: Dhinakaran Pandiyan @ 2018-08-24  3:17 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev



On Thu, 2018-07-19 at 18:03 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Assign the clipped height to 'h', not 'w'. This didn't cause any
> problems so far because we use square buffers.
> 
> Also get rid of the gcc variable shadowing warnings by not nesting
> the
> min()/max().
> 
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

> Fixes: aaa23eff21a1 ("tests/gem_render_copy: Use a more elaborate
> pattern of pixels")
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  tests/gem_render_copy.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
> index 238e70e97b5d..135375a90ec2 100644
> --- a/tests/gem_render_copy.c
> +++ b/tests/gem_render_copy.c
> @@ -254,8 +254,11 @@ scratch_buf_copy(data_t *data,
>  	linear_src = gem_mmap__gtt(data->drm_fd, src->bo->handle,
>  				   src->bo->size, PROT_READ);
>  
> -	w = min(w, min(width - sx, width - dx));
> -	w = min(h, min(height - sy, height - dy));
> +	w = min(w, width - sx);
> +	w = min(w, width - dx);
> +
> +	h = min(h, height - sy);
> +	h = min(h, height - dy);
>  
>  	for (int y = 0; y < h; y++) {
>  		igt_memcpy_from_wc(&linear_dst[(dy+y) * width + dx],
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 05/25] tests/gem_render_copy: Fix clipped height
  2018-08-24  3:17   ` Dhinakaran Pandiyan
@ 2018-08-28 14:21     ` Ville Syrjälä
  0 siblings, 0 replies; 52+ messages in thread
From: Ville Syrjälä @ 2018-08-28 14:21 UTC (permalink / raw)
  To: Dhinakaran Pandiyan; +Cc: igt-dev

On Thu, Aug 23, 2018 at 08:17:54PM -0700, Dhinakaran Pandiyan wrote:
> 
> 
> On Thu, 2018-07-19 at 18:03 +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Assign the clipped height to 'h', not 'w'. This didn't cause any
> > problems so far because we use square buffers.
> > 
> > Also get rid of the gcc variable shadowing warnings by not nesting
> > the
> > min()/max().
> > 
> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

Thanks. Patch pushed.

> 
> > Fixes: aaa23eff21a1 ("tests/gem_render_copy: Use a more elaborate
> > pattern of pixels")
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  tests/gem_render_copy.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
> > index 238e70e97b5d..135375a90ec2 100644
> > --- a/tests/gem_render_copy.c
> > +++ b/tests/gem_render_copy.c
> > @@ -254,8 +254,11 @@ scratch_buf_copy(data_t *data,
> >  	linear_src = gem_mmap__gtt(data->drm_fd, src->bo->handle,
> >  				   src->bo->size, PROT_READ);
> >  
> > -	w = min(w, min(width - sx, width - dx));
> > -	w = min(h, min(height - sy, height - dy));
> > +	w = min(w, width - sx);
> > +	w = min(w, width - dx);
> > +
> > +	h = min(h, height - sy);
> > +	h = min(h, height - dy);
> >  
> >  	for (int y = 0; y < h; y++) {
> >  		igt_memcpy_from_wc(&linear_dst[(dy+y) * width + dx],

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 07/25] lib: Add DIV_ROUND_UP()
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 07/25] lib: Add DIV_ROUND_UP() Ville Syrjala
@ 2018-09-18 21:17   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-18 21:17 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add DIV_ROUND_UP() and replace some hand rolled versions with it.

Please also remove the redefinition inside gem_render_copy.c.

With that:
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_aux.h      | 2 ++
>  lib/igt_fb.c       | 4 ++--
>  tests/i915_query.c | 2 --
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> index ef89faa9bd30..01c0be382f1a 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -287,4 +287,6 @@ void igt_lsof(const char *dpath);
>  
>  #define is_power_of_two(x)  (((x) & ((x)-1)) == 0)
>  
> +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
> +
>  #endif /* IGT_AUX_H */
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 6748357ad16b..324cb624144b 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -193,7 +193,7 @@ void igt_get_fb_tile_size(int fd, uint64_t
> tiling, int fb_bpp,
>  static unsigned planar_width(struct format_desc_struct *format,
> unsigned width, int plane)
>  {
>  	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
> -		return (width + 1) / 2;
> +		return DIV_ROUND_UP(width, 2);
>  
>  	return width;
>  }
> @@ -208,7 +208,7 @@ static unsigned planar_stride(struct
> format_desc_struct *format, unsigned width,
>  static unsigned planar_height(struct format_desc_struct *format,
> unsigned height, int plane)
>  {
>  	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
> -		return (height + 1) / 2;
> +		return DIV_ROUND_UP(height, 2);
>  
>  	return height;
>  }
> diff --git a/tests/i915_query.c b/tests/i915_query.c
> index c7de8cbd8371..08aabf946788 100644
> --- a/tests/i915_query.c
> +++ b/tests/i915_query.c
> @@ -242,8 +242,6 @@ static void test_query_topology_unsupported(int
> fd)
>  	igt_assert_eq(item.length, -ENODEV);
>  }
>  
> -#define DIV_ROUND_UP(val, div) (ALIGN(val, div) / div)
> -
>  static bool
>  slice_available(const struct drm_i915_query_topology_info
> *topo_info,
>  		int s)
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers
  2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
                   ` (25 preceding siblings ...)
  2018-07-19 17:40 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2018-09-20 20:26 ` Paulo Zanoni
  2018-09-21 13:26   ` Ville Syrjälä
  26 siblings, 1 reply; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-20 20:26 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev; +Cc: Ulrich Hecht

Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> For drivers that don't support the IN_FORMATS blob we should just
> consult the format list returned by getplane. Since we can't know
> which modifiers are supported we'll assume linear-only. Obviously
> that may not work for every driver out there, but not much more
> we can do unless we start to actually probing with addfb.

Can you please elaborate on why we need that change? What exactly do we
gain from it? IMHO there's always the worry that this could be misused
in the future, restricting tests to linear only when other formats are
indeed possible. Having NULL buffers crashing the test is a good way to
prevent misuse.

What if we populate plane->formats like we do here but leave plane-
>modifiers NULL? It would allow other pieces of the code to rely on the
format list while not exposing the risk of the "linear only" incorrect
restriction.

That said, the patch is correct in the sense that it does what it
proposes to do.

> 
> Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_kms.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 476a786233c0..5641d8c1cf7c 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -4068,8 +4068,28 @@ static void
> igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t *plane
>  	int idx = 0;
>  	int count;
>  
> -	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS))
> +	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS)) {
> +		drmModePlanePtr p = plane->drm_plane;
> +
> +		count = p->count_formats;
> +
> +		plane->format_mod_count = count;
> +		plane->formats = calloc(count, sizeof(plane-
> >formats[0]));
> +		igt_assert(plane->formats);
> +		plane->modifiers = calloc(count, sizeof(plane-
> >modifiers[0]));
> +		igt_assert(plane->modifiers);
> +
> +		/*
> +		 * We don't know which modifiers are
> +		 * supported, so we'll assume linear only.
> +		 */
> +		for (int i = 0; i < count; i++) {
> +			plane->formats[i] = p->formats[i];
> +			plane->modifiers[i] = DRM_FORMAT_MOD_LINEAR;
> +		}
> +
>  		return;
> +	}
>  
>  	blob_id = igt_plane_get_prop(plane, IGT_PLANE_IN_FORMATS);
>  
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 02/25] tests/kms_ccs: Use igt_plane_has_format_mod()
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 02/25] tests/kms_ccs: Use igt_plane_has_format_mod() Ville Syrjala
@ 2018-09-20 20:56   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-20 20:56 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Replace the open coded IN_FORMATS parsing with
> igt_plane_has_format_mod() now that we have such a thing.

This patch removes a few of the igt_skip() and igt_assert() calls we
had. Previously explicit messages such as "IN_FORMATS not supported by
X" will become "requirement valid_tests == 0 failed", which IMHO is not
exactly an improvement to the code base.

Can you please keep the first kmstest_get_property() and the two
igt_skip_on() calls that follow it?

If we keep the assertions:
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>


> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  tests/kms_ccs.c | 50 +--------------------------------------------
> -----
>  1 file changed, 1 insertion(+), 49 deletions(-)
> 
> diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
> index e1ee58801ac3..fe21b3a866de 100644
> --- a/tests/kms_ccs.c
> +++ b/tests/kms_ccs.c
> @@ -132,55 +132,7 @@ modifiers_ptr(struct
> local_drm_format_modifier_blob *blob)
>  
>  static bool plane_has_format_with_ccs(data_t *data, igt_plane_t
> *plane, uint32_t format)
>  {
> -	drmModePropertyBlobPtr blob;
> -	struct local_drm_format_modifier_blob *blob_data;
> -	struct local_drm_format_modifier *modifiers, *last_mod;
> -	uint32_t *formats, *last_fmt;
> -	uint64_t blob_id;
> -	bool ret;
> -	int fmt_idx = -1;
> -
> -	ret = kmstest_get_property(data->drm_fd, plane->drm_plane-
> >plane_id,
> -				   DRM_MODE_OBJECT_PLANE,
> "IN_FORMATS",
> -				   NULL, &blob_id, NULL);
> -	igt_skip_on_f(ret == false, "IN_FORMATS not supported by
> kernel\n");
> -	igt_skip_on_f(blob_id == 0, "IN_FORMATS not supported by
> plane\n");
> -	blob = drmModeGetPropertyBlob(data->drm_fd, blob_id);
> -	igt_assert(blob);
> -	igt_assert_lte(sizeof(struct
> local_drm_format_modifier_blob),
> -		       blob->length);
> -
> -	blob_data = (struct local_drm_format_modifier_blob *) blob-
> >data;
> -	formats = formats_ptr(blob_data);
> -	last_fmt = &formats[blob_data->count_formats];
> -	igt_assert_lte(((char *) last_fmt - (char *) blob_data),
> blob->length);
> -	for (int i = 0; i < blob_data->count_formats; i++) {
> -		if (formats[i] == format) {
> -			fmt_idx = i;
> -			break;
> -		}
> -	}
> -
> -	if (fmt_idx == -1)
> -		return false;
> -
> -	modifiers = modifiers_ptr(blob_data);
> -	last_mod = &modifiers[blob_data->count_modifiers];
> -	igt_assert_lte(((char *) last_mod - (char *) blob_data),
> blob->length);
> -	for (int i = 0; i < blob_data->count_modifiers; i++) {
> -		if (modifiers[i].modifier !=
> LOCAL_I915_FORMAT_MOD_Y_TILED_CCS)
> -			continue;
> -
> -		if (modifiers[i].offset > fmt_idx ||
> -		    fmt_idx > modifiers[i].offset + 63)
> -			continue;
> -
> -		if (modifiers[i].formats &
> -		    (1UL << (fmt_idx - modifiers[i].offset)))
> -			return true;
> -	}
> -
> -	return false;
> +	return igt_plane_has_format_mod(plane, format,
> LOCAL_I915_FORMAT_MOD_Y_TILED_CCS);
>  }
>  
>  static void render_fb(data_t *data, uint32_t gem_handle, unsigned
> int size,
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 03/25] tests/kms_plane: Add validate-in-formats subtest
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 03/25] tests/kms_plane: Add validate-in-formats subtest Ville Syrjala
@ 2018-09-20 21:10   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-20 21:10 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev; +Cc: Ulrich Hecht

Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Cross check the format list in the IN_FORMATS blob vs. the
> format list returned by getplane.

Bikeshed: unnecessary braces on the j loops.

By the way, this test won't break if you follow my suggestion from
patch 01 of populating plane->formats while leaving plane->modifiers
NULL.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> 
> Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  tests/kms_plane.c | 50
> ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> index f9e123f0d1ea..e0625748186f 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -366,6 +366,53 @@ test_plane_panning(data_t *data, enum pipe pipe,
> unsigned int flags)
>  	igt_skip_on(connected_outs == 0);
>  }
>  
> +static void validate_plane_in_formats(igt_plane_t *plane)
> +{
> +	drmModePlanePtr drm_plane = plane->drm_plane;
> +
> +	igt_require(plane->format_mod_count);
> +
> +	/*
> +	 * Make sure every format in the IN_FORMATS blob
> +	 * also appears in the getplane formats.
> +	 */
> +	for (int i = 0; i < plane->format_mod_count; i++) {
> +		int j;
> +
> +		for (j = 0; j < drm_plane->count_formats; j++) {
> +			if (plane->formats[i] == drm_plane-
> >formats[j])
> +				break;
> +		}
> +		igt_assert_lt(j, drm_plane->count_formats);
> +	}
> +
> +	/*
> +	 * Make sure every format in getplane also
> +	 * appears in the IN_FORMATS blob.
> +	 */
> +	for (int i = 0; i < drm_plane->count_formats; i++) {
> +		int j;
> +
> +		for (j = 0; j < plane->format_mod_count; j++) {
> +			if (drm_plane->formats[i] == plane-
> >formats[j])
> +				break;
> +		}
> +		igt_assert_lt(j, plane->format_mod_count);
> +	}
> +}
> +
> +static void validate_in_formats(data_t *data)
> +{
> +	enum pipe pipe;
> +
> +	for_each_pipe(&data->display, pipe) {
> +		igt_plane_t *plane;
> +
> +		for_each_plane_on_pipe(&data->display, pipe, plane)
> +			validate_plane_in_formats(plane);
> +	}
> +}
> +
>  static const color_t colors[] = {
>  	{ 1.0f, 0.0f, 0.0f, },
>  	{ 0.0f, 1.0f, 0.0f, },
> @@ -592,6 +639,9 @@ igt_main
>  		igt_display_init(&data.display, data.drm_fd);
>  	}
>  
> +	igt_subtest_f("validate-in-formats")
> +		validate_in_formats(&data);
> +
>  	for_each_pipe_static(pipe)
>  		run_tests_for_pipe_plane(&data, pipe);
>  
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 04/25] tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 04/25] tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats Ville Syrjala
@ 2018-09-20 23:36   ` Paulo Zanoni
  2018-09-21 13:37     ` Ville Syrjälä
  0 siblings, 1 reply; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-20 23:36 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev; +Cc: Ulrich Hecht

Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Try to create a bunch of fbs with different formats/modfifiers and
> make sure sure addfb2 accepts/rejects them in accordance with what
> the plane IN_FORMATS blobifiers are advertizing.
> 
> We only check "easy" formats (ie. RGB/C8, no YUV/planar etc.). We
> also assume that one can always create a 64x64 fb with stride of
> 64*8 bytes.
> 
> v2: Skip when blobifiers aren't supported

Some trivial rebasing required.

More below.

> 
> Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  tests/kms_addfb_basic.c | 107
> ++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 104 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> index 7d8852f02003..9e33d00346e0 100644
> --- a/tests/kms_addfb_basic.c
> +++ b/tests/kms_addfb_basic.c
> @@ -41,6 +41,97 @@
>  uint32_t gem_bo;
>  uint32_t gem_bo_small;
>  
> +static const uint64_t modifiers[] = {
> +	DRM_FORMAT_MOD_LINEAR,
> +	I915_FORMAT_MOD_X_TILED,
> +	I915_FORMAT_MOD_Y_TILED,
> +	I915_FORMAT_MOD_Yf_TILED,
> +	I915_FORMAT_MOD_Y_TILED_CCS,
> +	I915_FORMAT_MOD_Yf_TILED_CCS,

For the buffers that support CCS, I see the test failing with the
Kernel complaining that we're not passing 2 planes (since .num_planes=2
in ccs_formats from intel_display.c). It looks like igt needs to craft
the aux buffer too.

More below.

> +};
> +
> +static const uint32_t formats[] = {
> +	DRM_FORMAT_C8,
> +
> +	DRM_FORMAT_RGB565,
> +	DRM_FORMAT_BGR565,
> +
> +	DRM_FORMAT_RGB888,
> +	DRM_FORMAT_BGR888,
> +
> +	DRM_FORMAT_XRGB8888,
> +	DRM_FORMAT_XBGR8888,
> +	DRM_FORMAT_RGBX8888,
> +	DRM_FORMAT_BGRX8888,
> +	DRM_FORMAT_ARGB8888,
> +	DRM_FORMAT_ABGR8888,
> +	DRM_FORMAT_RGBA8888,
> +	DRM_FORMAT_BGRA8888,
> +
> +	DRM_FORMAT_XRGB2101010,
> +	DRM_FORMAT_XBGR2101010,
> +	DRM_FORMAT_RGBX1010102,
> +	DRM_FORMAT_BGRX1010102,
> +	DRM_FORMAT_ARGB2101010,
> +	DRM_FORMAT_ABGR2101010,
> +	DRM_FORMAT_RGBA1010102,
> +	DRM_FORMAT_BGRA1010102,
> +};
> +
> +#define IGT_FORMAT_FMT "%c%c%c%c (0x%08x)"
> +#define IGT_FORMAT_ARGS(f) ((f) >> 0) & 0xff, ((f) >> 8) & 0xff, \
> +		((f) >> 16) & 0xff, ((f) >> 24) & 0xff, (f)
> +
> +/*
> + * make sure addfb2 accepts/rejects every format/modifier
> + * in accordance with the plane IN_FORMATS properties.
> + */
> +static void expected_formats(igt_display_t *display)
> +{
> +	int fd = display->drm_fd;
> +	uint32_t handle;
> +
> +	igt_require(display->format_mod_count);

After patch 01, this is really not skipping a lot.

Perhaps it would be better to igt_require(plane->modifiers) if you
implement my suggestion from patch 01? :)

> +
> +	handle = gem_create(fd, 64*8*64);

I'm assuming you have checked that this is sane.


> +	igt_assert(handle);
> +
> +	for (int i = 0; i < ARRAY_SIZE(formats); i++) {
> +		uint32_t format = formats[i];
> +
> +		for (int j = 0; j < ARRAY_SIZE(modifiers); j++) {
> +			uint64_t modifier = modifiers[j];
> +			struct drm_mode_fb_cmd2 f = {
> +				.width = 64,
> +				.height = 64,
> +				.pixel_format = format,
> +				.handles[0] = handle,
> +				.pitches[0] = 64 * 8,
> +				.modifier[0] = modifier,
> +				.flags = DRM_MODE_FB_MODIFIERS,
> +			};
> +			int ret;
> +
> +			igt_info("Testing format " IGT_FORMAT_FMT "
> / modifier 0x%" PRIx64 "\n",
> +				 IGT_FORMAT_ARGS(format), modifier);
> +
> +			ret = drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2,
> &f);
> +
> +			if (igt_display_has_format_mod(display,
> format, modifier)) {
> +				igt_assert_eq(ret, 0);
> +				igt_assert_neq(f.fb_id, 0);
> +			} else {
> +				igt_assert_neq(ret, 0);
> +				igt_assert_eq(f.fb_id, 0);
> +			}
> +

I was fine with this until I ran the test and it failed. My problem
with this style is that once you hit one of these assertions you stop
the test, so you don't get an idea of how bad your Kernel is. You could
simply igt_info() the failures, failures++ (or false_positives++ and
false_negatives++) and then igt_assert(failures == 0) outside the loop.
This way we can see all the bad combinations in one run, without having
to fix the first problem in order to uncover the next.

Everything else looks good.

> +			drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id);
> +		}
> +	}
> +
> +	gem_close(fd, handle);
> +}
> +
>  static void invalid_tests(int fd)
>  {
>  	struct local_drm_mode_fb_cmd2 f = {};
> @@ -539,13 +630,17 @@ static void prop_tests(int fd)
>  
>  }
>  
> -int fd;
> +static igt_display_t display;
> +static int fd;
>  
>  igt_main
>  {
> -	igt_fixture
> +	igt_fixture {
>  		fd = drm_open_driver_master(DRIVER_ANY);
>  
> +		igt_display_init(&display, fd);
> +	}
> +
>  	invalid_tests(fd);
>  
>  	pitch_tests(fd);
> @@ -560,6 +655,12 @@ igt_main
>  
>  	prop_tests(fd);
>  
> -	igt_fixture
> +	igt_subtest("expected-formats")
> +		expected_formats(&display);
> +
> +	igt_fixture {
> +		igt_display_fini(&display);
> +
>  		close(fd);
> +	}
>  }
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 06/25] lib/igt_fb: Respect the users choice of stride
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 06/25] lib/igt_fb: Respect the users choice of stride Ville Syrjala
@ 2018-09-21  0:04   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21  0:04 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We prented to allow the caller to specify the stride explicitly for
> the
> fb. But we don't actually use that user specified stride when we
> calculate the require bo size. Fix that oversight.
> 

Requires simple rebase.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c | 37 ++++++++++++++++++++++---------------
>  1 file changed, 22 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index ae71d9673228..6748357ad16b 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -215,11 +215,12 @@ static unsigned planar_height(struct
> format_desc_struct *format, unsigned height
>  
>  static void calc_fb_size_planar(int fd, int width, int height,
>  				struct format_desc_struct *format,
> -				uint64_t tiling, unsigned *size_ret,
> -				unsigned *stride_ret, unsigned
> *offsets)
> +				uint64_t tiling, unsigned stride,
> +				unsigned *size_ret, unsigned
> *stride_ret,
> +				unsigned *offsets)
>  {
>  	int plane;
> -	unsigned stride = 0, tile_width, tile_height;
> +	unsigned max_stride = 0, tile_width, tile_height;
>  
>  	*size_ret = 0;
>  
> @@ -229,10 +230,13 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
>  		igt_get_fb_tile_size(fd, tiling, format-
> >plane_bpp[plane], &tile_width, &tile_height);
>  
>  		plane_stride = ALIGN(planar_stride(format, width,
> plane), tile_width);
> -		if (stride < plane_stride)
> -			stride = plane_stride;
> +		if (max_stride < plane_stride)
> +			max_stride = plane_stride;
>  	}
>  
> +	if (!stride)
> +		stride = max_stride;
> +
>  	for (plane = 0; plane < format->num_planes; plane++) {
>  		if (offsets)
>  			offsets[plane] = *size_ret;
> @@ -251,9 +255,9 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
>  
>  static void calc_fb_size_packed(int fd, int width, int height,
>  				struct format_desc_struct *format,
> uint64_t tiling,
> -				unsigned *size_ret, unsigned
> *stride_ret)
> +				unsigned stride, unsigned *size_ret,
> unsigned *stride_ret)
>  {
> -	unsigned int tile_width, tile_height, stride, size;
> +	unsigned int tile_width, tile_height, size;
>  	int byte_width = width * (format->plane_bpp[0] / 8);
>  
>  	igt_get_fb_tile_size(fd, tiling, format->plane_bpp[0],
> &tile_width, &tile_height);
> @@ -270,15 +274,18 @@ static void calc_fb_size_packed(int fd, int
> width, int height,
>  		 * tiled. But then that failure is expected.
>  		 */
>  
> -		v = byte_width;
> -		for (stride = 512; stride < v; stride *= 2)
> -			;
> +		if (!stride) {
> +			v = byte_width;
> +			for (stride = 512; stride < v; stride *= 2)
> +				;
> +		}
>  
>  		v = stride * height;
>  		for (size = 1024*1024; size < v; size *= 2)
>  			;
>  	} else {
> -		stride = ALIGN(byte_width, tile_width);
> +		if (!stride)
> +			stride = ALIGN(byte_width, tile_width);
>  		size = stride * ALIGN(height, tile_height);
>  	}
>  
> @@ -306,9 +313,9 @@ void igt_calc_fb_size(int fd, int width, int
> height, uint32_t drm_format, uint64
>  	igt_assert(format);
>  
>  	if (format->num_planes > 1)
> -		calc_fb_size_planar(fd, width, height, format,
> tiling, size_ret, stride_ret, NULL);
> +		calc_fb_size_planar(fd, width, height, format,
> tiling, 0, size_ret, stride_ret, NULL);
>  	else
> -		calc_fb_size_packed(fd, width, height, format,
> tiling, size_ret, stride_ret);
> +		calc_fb_size_packed(fd, width, height, format,
> tiling, 0, size_ret, stride_ret);
>  }
>  
>  /**
> @@ -383,10 +390,10 @@ static int create_bo_for_fb(int fd, int width,
> int height,
>  		unsigned calculated_size, calculated_stride;
>  
>  		if (format->num_planes > 1)
> -			calc_fb_size_planar(fd, width, height,
> format, tiling,
> +			calc_fb_size_planar(fd, width, height,
> format, tiling, stride,
>  					    &calculated_size,
> &calculated_stride, offsets);
>  		else
> -			calc_fb_size_packed(fd, width, height,
> format, tiling,
> +			calc_fb_size_packed(fd, width, height,
> format, tiling, stride,
>  					    &calculated_size,
> &calculated_stride);
>  
>  		if (stride == 0)
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 08/25] lib/igt_fb: Use fb_blit_upload as the base class for fb_convert_blit_upload
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 08/25] lib/igt_fb: Use fb_blit_upload as the base class for fb_convert_blit_upload Ville Syrjala
@ 2018-09-21  0:15   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21  0:15 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> fb_blit_upload already has everything we need, so let's use it as the
> base class for fb_convert_blit_upload.
> 

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c | 57 +++++++++++++++++++++++++++-----------------------
> -------
>  1 file changed, 27 insertions(+), 30 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 324cb624144b..b5eef1a23576 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1368,15 +1368,12 @@ static void create_cairo_surface__gtt(int fd,
> struct igt_fb *fb)
>  }
>  
>  struct fb_convert_blit_upload {
> -	int fd;
> -	struct igt_fb *fb;
> +	struct fb_blit_upload base;
>  
>  	struct {
>  		uint8_t *map;
>  		unsigned stride, size;
>  	} rgb24;
> -
> -	struct fb_blit_linear linear;
>  };
>  
>  static uint8_t clamprgb(float val)
> @@ -1404,8 +1401,8 @@ static void convert_nv12_to_rgb24(struct igt_fb
> *fb, struct fb_convert_blit_uplo
>  	int i, j;
>  	const uint8_t *y, *uv;
>  	uint8_t *rgb24 = blit->rgb24.map;
> -	unsigned rgb24_stride = blit->rgb24.stride, planar_stride =
> blit->linear.stride;
> -	uint8_t *buf = malloc(blit->linear.size);
> +	unsigned rgb24_stride = blit->rgb24.stride, planar_stride =
> blit->base.linear.stride;
> +	uint8_t *buf = malloc(blit->base.linear.size);
>  	struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb-
> >color_encoding,
>  						    fb-
> >color_range);
>  
> @@ -1414,9 +1411,9 @@ static void convert_nv12_to_rgb24(struct igt_fb
> *fb, struct fb_convert_blit_uplo
>  	 * it's faster to copy the whole BO to a temporary buffer
> and convert
>  	 * from there.
>  	 */
> -	igt_memcpy_from_wc(buf, blit->linear.map, blit-
> >linear.size);
> -	y = &buf[blit->linear.offsets[0]];
> -	uv = &buf[blit->linear.offsets[1]];
> +	igt_memcpy_from_wc(buf, blit->base.linear.map, blit-
> >base.linear.size);
> +	y = &buf[blit->base.linear.offsets[0]];
> +	uv = &buf[blit->base.linear.offsets[1]];
>  
>  	for (i = 0; i < fb->height / 2; i++) {
>  		for (j = 0; j < fb->width / 2; j++) {
> @@ -1510,11 +1507,11 @@ static void convert_nv12_to_rgb24(struct
> igt_fb *fb, struct fb_convert_blit_uplo
>  static void convert_rgb24_to_nv12(struct igt_fb *fb, struct
> fb_convert_blit_upload *blit)
>  {
>  	int i, j;
> -	uint8_t *y = &blit->linear.map[blit->linear.offsets[0]];
> -	uint8_t *uv = &blit->linear.map[blit->linear.offsets[1]];
> +	uint8_t *y = &blit->base.linear.map[blit-
> >base.linear.offsets[0]];
> +	uint8_t *uv = &blit->base.linear.map[blit-
> >base.linear.offsets[1]];
>  	const uint8_t *rgb24 = blit->rgb24.map;
>  	unsigned rgb24_stride = blit->rgb24.stride;
> -	unsigned planar_stride = blit->linear.stride;
> +	unsigned planar_stride = blit->base.linear.stride;
>  	struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb-
> >color_encoding,
>  						    fb-
> >color_range);
>  
> @@ -1641,8 +1638,8 @@ static void convert_yuyv_to_rgb24(struct igt_fb
> *fb, struct fb_convert_blit_uplo
>  	int i, j;
>  	const uint8_t *yuyv;
>  	uint8_t *rgb24 = blit->rgb24.map;
> -	unsigned rgb24_stride = blit->rgb24.stride, yuyv_stride =
> blit->linear.stride;
> -	uint8_t *buf = malloc(blit->linear.size);
> +	unsigned rgb24_stride = blit->rgb24.stride, yuyv_stride =
> blit->base.linear.stride;
> +	uint8_t *buf = malloc(blit->base.linear.size);
>  	struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb-
> >color_encoding,
>  						    fb-
> >color_range);
>  
> @@ -1651,7 +1648,7 @@ static void convert_yuyv_to_rgb24(struct igt_fb
> *fb, struct fb_convert_blit_uplo
>  	 * it's faster to copy the whole BO to a temporary buffer
> and convert
>  	 * from there.
>  	 */
> -	igt_memcpy_from_wc(buf, blit->linear.map, blit-
> >linear.size);
> +	igt_memcpy_from_wc(buf, blit->base.linear.map, blit-
> >base.linear.size);
>  	yuyv = buf;
>  
>  	for (i = 0; i < fb->height; i++) {
> @@ -1698,10 +1695,10 @@ static void convert_rgb24_to_yuyv(struct
> igt_fb *fb, struct fb_convert_blit_uplo
>  				  const unsigned char swz[4])
>  {
>  	int i, j;
> -	uint8_t *yuyv = blit->linear.map;
> +	uint8_t *yuyv = blit->base.linear.map;
>  	const uint8_t *rgb24 = blit->rgb24.map;
>  	unsigned rgb24_stride = blit->rgb24.stride;
> -	unsigned yuyv_stride = blit->linear.stride;
> +	unsigned yuyv_stride = blit->base.linear.stride;
>  	struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb-
> >color_encoding,
>  						    fb-
> >color_range);
>  
> @@ -1750,7 +1747,7 @@ static void convert_rgb24_to_yuyv(struct igt_fb
> *fb, struct fb_convert_blit_uplo
>  static void destroy_cairo_surface__convert(void *arg)
>  {
>  	struct fb_convert_blit_upload *blit = arg;
> -	struct igt_fb *fb = blit->fb;
> +	struct igt_fb *fb = blit->base.fb;
>  
>  	/* Convert linear rgb back! */
>  	switch(fb->drm_format) {
> @@ -1770,10 +1767,10 @@ static void
> destroy_cairo_surface__convert(void *arg)
>  
>  	munmap(blit->rgb24.map, blit->rgb24.size);
>  
> -	if (blit->linear.handle)
> -		free_linear_mapping(blit->fd, blit->fb, &blit-
> >linear);
> +	if (blit->base.linear.handle)
> +		free_linear_mapping(blit->base.fd, blit->base.fb,
> &blit->base.linear);
>  	else
> -		gem_munmap(blit->linear.map, fb->size);
> +		gem_munmap(blit->base.linear.map, fb->size);
>  
>  	free(blit);
>  
> @@ -1785,8 +1782,8 @@ static void create_cairo_surface__convert(int
> fd, struct igt_fb *fb)
>  	struct fb_convert_blit_upload *blit = malloc(sizeof(*blit));
>  	igt_assert(blit);
>  
> -	blit->fd = fd;
> -	blit->fb = fb;
> +	blit->base.fd = fd;
> +	blit->base.fb = fb;
>  	blit->rgb24.stride = ALIGN(fb->width * 4, 16);
>  	blit->rgb24.size = ALIGN(blit->rgb24.stride * fb->height,
> sysconf(_SC_PAGESIZE));
>  	blit->rgb24.map = mmap(NULL, blit->rgb24.size, PROT_READ |
> PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> @@ -1794,15 +1791,15 @@ static void create_cairo_surface__convert(int
> fd, struct igt_fb *fb)
>  
>  	if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
>  	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
> -		setup_linear_mapping(fd, fb, &blit->linear);
> +		setup_linear_mapping(fd, fb, &blit->base.linear);
>  	} else {
> -		blit->linear.handle = 0;
> -		blit->linear.map = gem_mmap__gtt(fd, fb->gem_handle, 
> fb->size,
> +		blit->base.linear.handle = 0;
> +		blit->base.linear.map = gem_mmap__gtt(fd, fb-
> >gem_handle, fb->size,
>  					      PROT_READ |
> PROT_WRITE);
> -		igt_assert(blit->linear.map);
> -		blit->linear.stride = fb->stride;
> -		blit->linear.size = fb->size;
> -		memcpy(blit->linear.offsets, fb->offsets, sizeof(fb-
> >offsets));
> +		igt_assert(blit->base.linear.map);
> +		blit->base.linear.stride = fb->stride;
> +		blit->base.linear.size = fb->size;
> +		memcpy(blit->base.linear.offsets, fb->offsets,
> sizeof(fb->offsets));
>  	}
>  
>  	/* Convert to linear rgb! */
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 09/25] lib/igt_fb: Pass fb_blit_upload to free_linear_mapping()
  2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 09/25] lib/igt_fb: Pass fb_blit_upload to free_linear_mapping() Ville Syrjala
@ 2018-09-21  0:20   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21  0:20 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> With fb_blit_upload now being the base class of
> fb_convert_blit_upload
> we can pass the entire structure down to free_linear_mapping().

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index b5eef1a23576..c89a2c9e170d 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1208,8 +1208,11 @@ struct fb_blit_upload {
>  	struct fb_blit_linear linear;
>  };
>  
> -static void free_linear_mapping(int fd, struct igt_fb *fb, struct
> fb_blit_linear *linear)
> +static void free_linear_mapping(struct fb_blit_upload *blit)
>  {
> +	int fd = blit->fd;
> +	struct igt_fb *fb = blit->fb;
> +	struct fb_blit_linear *linear = &blit->linear;
>  	unsigned int obj_tiling = igt_fb_mod_to_tiling(fb->tiling);
>  	int i;
>  
> @@ -1242,7 +1245,7 @@ static void destroy_cairo_surface__blit(void
> *arg)
>  
>  	blit->fb->cairo_surface = NULL;
>  
> -	free_linear_mapping(blit->fd, blit->fb, &blit->linear);
> +	free_linear_mapping(blit);
>  
>  	free(blit);
>  }
> @@ -1768,7 +1771,7 @@ static void destroy_cairo_surface__convert(void
> *arg)
>  	munmap(blit->rgb24.map, blit->rgb24.size);
>  
>  	if (blit->base.linear.handle)
> -		free_linear_mapping(blit->base.fd, blit->base.fb,
> &blit->base.linear);
> +		free_linear_mapping(&blit->base);
>  	else
>  		gem_munmap(blit->base.linear.map, fb->size);
>  
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers
  2018-09-20 20:26 ` [igt-dev] [PATCH i-g-t 01/25] " Paulo Zanoni
@ 2018-09-21 13:26   ` Ville Syrjälä
  2018-09-21 21:39     ` Paulo Zanoni
  0 siblings, 1 reply; 52+ messages in thread
From: Ville Syrjälä @ 2018-09-21 13:26 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: igt-dev, Ulrich Hecht

On Thu, Sep 20, 2018 at 01:26:42PM -0700, Paulo Zanoni wrote:
> Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > For drivers that don't support the IN_FORMATS blob we should just
> > consult the format list returned by getplane. Since we can't know
> > which modifiers are supported we'll assume linear-only. Obviously
> > that may not work for every driver out there, but not much more
> > we can do unless we start to actually probing with addfb.
> 
> Can you please elaborate on why we need that change? What exactly do we
> gain from it?

We gain the ability to write tests without worrying about IN_FORMATS
everywhere.

> IMHO there's always the worry that this could be misused
> in the future, restricting tests to linear only when other formats are
> indeed possible. Having NULL buffers crashing the test is a good way to
> prevent misuse.

I don't know what kind of misuse you're thinking of. Actually not
sure what misuse in this context would mean really.

> 
> What if we populate plane->formats like we do here but leave plane-
> >modifiers NULL? It would allow other pieces of the code to rely on the
> format list while not exposing the risk of the "linear only" incorrect
> restriction.

So every test would have to check for !modifiers and come up with
some kind of fallback mechanism? What would such a fallback mechanism
even be other than "let's assume linear"? I see no reason to inflict
that pain on every test that just wants to know "is this format
supported?".

Also any driver that advertizes formats that don't support linear
and doesn't expose IN_FORMATS clearly doesn't care about supporting
driver/hw agnostic userspace, so having some tests fail for them
seems perfectly reasonable to me.

> 
> That said, the patch is correct in the sense that it does what it
> proposes to do.
> 
> > 
> > Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  lib/igt_kms.c | 22 +++++++++++++++++++++-
> >  1 file changed, 21 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> > index 476a786233c0..5641d8c1cf7c 100644
> > --- a/lib/igt_kms.c
> > +++ b/lib/igt_kms.c
> > @@ -4068,8 +4068,28 @@ static void
> > igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t *plane
> >  	int idx = 0;
> >  	int count;
> >  
> > -	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS))
> > +	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS)) {
> > +		drmModePlanePtr p = plane->drm_plane;
> > +
> > +		count = p->count_formats;
> > +
> > +		plane->format_mod_count = count;
> > +		plane->formats = calloc(count, sizeof(plane-
> > >formats[0]));
> > +		igt_assert(plane->formats);
> > +		plane->modifiers = calloc(count, sizeof(plane-
> > >modifiers[0]));
> > +		igt_assert(plane->modifiers);
> > +
> > +		/*
> > +		 * We don't know which modifiers are
> > +		 * supported, so we'll assume linear only.
> > +		 */
> > +		for (int i = 0; i < count; i++) {
> > +			plane->formats[i] = p->formats[i];
> > +			plane->modifiers[i] = DRM_FORMAT_MOD_LINEAR;
> > +		}
> > +
> >  		return;
> > +	}
> >  
> >  	blob_id = igt_plane_get_prop(plane, IGT_PLANE_IN_FORMATS);
> >  

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 04/25] tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats
  2018-09-20 23:36   ` Paulo Zanoni
@ 2018-09-21 13:37     ` Ville Syrjälä
  0 siblings, 0 replies; 52+ messages in thread
From: Ville Syrjälä @ 2018-09-21 13:37 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: igt-dev, Ulrich Hecht

On Thu, Sep 20, 2018 at 04:36:13PM -0700, Paulo Zanoni wrote:
> Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Try to create a bunch of fbs with different formats/modfifiers and
> > make sure sure addfb2 accepts/rejects them in accordance with what
> > the plane IN_FORMATS blobifiers are advertizing.
> > 
> > We only check "easy" formats (ie. RGB/C8, no YUV/planar etc.). We
> > also assume that one can always create a 64x64 fb with stride of
> > 64*8 bytes.
> > 
> > v2: Skip when blobifiers aren't supported
> 
> Some trivial rebasing required.
> 
> More below.
> 
> > 
> > Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  tests/kms_addfb_basic.c | 107
> > ++++++++++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 104 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> > index 7d8852f02003..9e33d00346e0 100644
> > --- a/tests/kms_addfb_basic.c
> > +++ b/tests/kms_addfb_basic.c
> > @@ -41,6 +41,97 @@
> >  uint32_t gem_bo;
> >  uint32_t gem_bo_small;
> >  
> > +static const uint64_t modifiers[] = {
> > +	DRM_FORMAT_MOD_LINEAR,
> > +	I915_FORMAT_MOD_X_TILED,
> > +	I915_FORMAT_MOD_Y_TILED,
> > +	I915_FORMAT_MOD_Yf_TILED,
> > +	I915_FORMAT_MOD_Y_TILED_CCS,
> > +	I915_FORMAT_MOD_Yf_TILED_CCS,
> 
> For the buffers that support CCS, I see the test failing with the
> Kernel complaining that we're not passing 2 planes (since .num_planes=2
> in ccs_formats from intel_display.c). It looks like igt needs to craft
> the aux buffer too.

I shouldn't have included CCS here, for the same reason I didn't include
planar formats in formats[]. I guess I never ran this in skl+.

> 
> More below.
> 
> > +};
> > +
> > +static const uint32_t formats[] = {
> > +	DRM_FORMAT_C8,
> > +
> > +	DRM_FORMAT_RGB565,
> > +	DRM_FORMAT_BGR565,
> > +
> > +	DRM_FORMAT_RGB888,
> > +	DRM_FORMAT_BGR888,
> > +
> > +	DRM_FORMAT_XRGB8888,
> > +	DRM_FORMAT_XBGR8888,
> > +	DRM_FORMAT_RGBX8888,
> > +	DRM_FORMAT_BGRX8888,
> > +	DRM_FORMAT_ARGB8888,
> > +	DRM_FORMAT_ABGR8888,
> > +	DRM_FORMAT_RGBA8888,
> > +	DRM_FORMAT_BGRA8888,
> > +
> > +	DRM_FORMAT_XRGB2101010,
> > +	DRM_FORMAT_XBGR2101010,
> > +	DRM_FORMAT_RGBX1010102,
> > +	DRM_FORMAT_BGRX1010102,
> > +	DRM_FORMAT_ARGB2101010,
> > +	DRM_FORMAT_ABGR2101010,
> > +	DRM_FORMAT_RGBA1010102,
> > +	DRM_FORMAT_BGRA1010102,
> > +};
> > +
> > +#define IGT_FORMAT_FMT "%c%c%c%c (0x%08x)"
> > +#define IGT_FORMAT_ARGS(f) ((f) >> 0) & 0xff, ((f) >> 8) & 0xff, \
> > +		((f) >> 16) & 0xff, ((f) >> 24) & 0xff, (f)
> > +
> > +/*
> > + * make sure addfb2 accepts/rejects every format/modifier
> > + * in accordance with the plane IN_FORMATS properties.
> > + */
> > +static void expected_formats(igt_display_t *display)
> > +{
> > +	int fd = display->drm_fd;
> > +	uint32_t handle;
> > +
> > +	igt_require(display->format_mod_count);
> 
> After patch 01, this is really not skipping a lot.

Yeah, I wrote this before that patch probably.

> 
> Perhaps it would be better to igt_require(plane->modifiers) if you
> implement my suggestion from patch 01? :)
> 
> > +
> > +	handle = gem_create(fd, 64*8*64);
> 
> I'm assuming you have checked that this is sane.

Should be fairly reasonable.

> 
> 
> > +	igt_assert(handle);
> > +
> > +	for (int i = 0; i < ARRAY_SIZE(formats); i++) {
> > +		uint32_t format = formats[i];
> > +
> > +		for (int j = 0; j < ARRAY_SIZE(modifiers); j++) {
> > +			uint64_t modifier = modifiers[j];
> > +			struct drm_mode_fb_cmd2 f = {
> > +				.width = 64,
> > +				.height = 64,
> > +				.pixel_format = format,
> > +				.handles[0] = handle,
> > +				.pitches[0] = 64 * 8,
> > +				.modifier[0] = modifier,
> > +				.flags = DRM_MODE_FB_MODIFIERS,
> > +			};
> > +			int ret;
> > +
> > +			igt_info("Testing format " IGT_FORMAT_FMT "
> > / modifier 0x%" PRIx64 "\n",
> > +				 IGT_FORMAT_ARGS(format), modifier);
> > +
> > +			ret = drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2,
> > &f);
> > +
> > +			if (igt_display_has_format_mod(display,
> > format, modifier)) {
> > +				igt_assert_eq(ret, 0);
> > +				igt_assert_neq(f.fb_id, 0);
> > +			} else {
> > +				igt_assert_neq(ret, 0);
> > +				igt_assert_eq(f.fb_id, 0);
> > +			}
> > +
> 
> I was fine with this until I ran the test and it failed. My problem
> with this style is that once you hit one of these assertions you stop
> the test, so you don't get an idea of how bad your Kernel is. You could
> simply igt_info() the failures, failures++ (or false_positives++ and
> false_negatives++) and then igt_assert(failures == 0) outside the loop.
> This way we can see all the bad combinations in one run, without having
> to fix the first problem in order to uncover the next.

I prefer to assert on the first error. Then you can easily run it
under gdb and examine the full state when the failure occurs.

> 
> Everything else looks good.
> 
> > +			drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id);
> > +		}
> > +	}
> > +
> > +	gem_close(fd, handle);
> > +}
> > +
> >  static void invalid_tests(int fd)
> >  {
> >  	struct local_drm_mode_fb_cmd2 f = {};
> > @@ -539,13 +630,17 @@ static void prop_tests(int fd)
> >  
> >  }
> >  
> > -int fd;
> > +static igt_display_t display;
> > +static int fd;
> >  
> >  igt_main
> >  {
> > -	igt_fixture
> > +	igt_fixture {
> >  		fd = drm_open_driver_master(DRIVER_ANY);
> >  
> > +		igt_display_init(&display, fd);
> > +	}
> > +
> >  	invalid_tests(fd);
> >  
> >  	pitch_tests(fd);
> > @@ -560,6 +655,12 @@ igt_main
> >  
> >  	prop_tests(fd);
> >  
> > -	igt_fixture
> > +	igt_subtest("expected-formats")
> > +		expected_formats(&display);
> > +
> > +	igt_fixture {
> > +		igt_display_fini(&display);
> > +
> >  		close(fd);
> > +	}
> >  }

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers
  2018-09-21 13:26   ` Ville Syrjälä
@ 2018-09-21 21:39     ` Paulo Zanoni
  2018-11-27 20:30       ` Kazlauskas, Nicholas
  0 siblings, 1 reply; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21 21:39 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: igt-dev, Ulrich Hecht

Em Sex, 2018-09-21 às 16:26 +0300, Ville Syrjälä escreveu:
> On Thu, Sep 20, 2018 at 01:26:42PM -0700, Paulo Zanoni wrote:
> > Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > For drivers that don't support the IN_FORMATS blob we should just
> > > consult the format list returned by getplane. Since we can't know
> > > which modifiers are supported we'll assume linear-only. Obviously
> > > that may not work for every driver out there, but not much more
> > > we can do unless we start to actually probing with addfb.
> > 
> > Can you please elaborate on why we need that change? What exactly
> > do we
> > gain from it?
> 
> We gain the ability to write tests without worrying about IN_FORMATS
> everywhere.
> 
> > IMHO there's always the worry that this could be misused
> > in the future, restricting tests to linear only when other formats
> > are
> > indeed possible. Having NULL buffers crashing the test is a good
> > way to
> > prevent misuse.
> 
> I don't know what kind of misuse you're thinking of. Actually not
> sure what misuse in this context would mean really.


Thinking that everything is linear only when in fact other formats are
actually supported.


> 
> > 
> > What if we populate plane->formats like we do here but leave plane-
> > > modifiers NULL? It would allow other pieces of the code to rely
> > > on the
> > 
> > format list while not exposing the risk of the "linear only"
> > incorrect
> > restriction.
> 
> So every test would have to check for !modifiers and come up with
> some kind of fallback mechanism?

Yes, if IN_FORMATS is not present you have to fallback to the old "try
it until you don't get an EINVAL". Isn't this the old protocol?


>  What would such a fallback mechanism
> even be other than "let's assume linear"?

The same mechanism we used before we created IN_FORMATS.


>  I see no reason to inflict
> that pain on every test that just wants to know "is this format
> supported?".

The way I see, not populating a wrong table helps the test more than
setting a table with data that may not reflect reality.

> 
> Also any driver that advertizes formats that don't support linear
> and doesn't expose IN_FORMATS clearly doesn't care about supporting
> driver/hw agnostic userspace, so having some tests fail for them
> seems perfectly reasonable to me.

So older i915 didn't care about supporting driver/hw agnostic user
space?

> 
> > 
> > That said, the patch is correct in the sense that it does what it
> > proposes to do.
> > 
> > > 
> > > Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  lib/igt_kms.c | 22 +++++++++++++++++++++-
> > >  1 file changed, 21 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> > > index 476a786233c0..5641d8c1cf7c 100644
> > > --- a/lib/igt_kms.c
> > > +++ b/lib/igt_kms.c
> > > @@ -4068,8 +4068,28 @@ static void
> > > igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t
> > > *plane
> > >  	int idx = 0;
> > >  	int count;
> > >  
> > > -	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS))
> > > +	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS)) {
> > > +		drmModePlanePtr p = plane->drm_plane;
> > > +
> > > +		count = p->count_formats;
> > > +
> > > +		plane->format_mod_count = count;
> > > +		plane->formats = calloc(count, sizeof(plane-
> > > > formats[0]));
> > > 
> > > +		igt_assert(plane->formats);
> > > +		plane->modifiers = calloc(count, sizeof(plane-
> > > > modifiers[0]));
> > > 
> > > +		igt_assert(plane->modifiers);
> > > +
> > > +		/*
> > > +		 * We don't know which modifiers are
> > > +		 * supported, so we'll assume linear only.
> > > +		 */
> > > +		for (int i = 0; i < count; i++) {
> > > +			plane->formats[i] = p->formats[i];
> > > +			plane->modifiers[i] =
> > > DRM_FORMAT_MOD_LINEAR;
> > > +		}
> > > +
> > >  		return;
> > > +	}
> > >  
> > >  	blob_id = igt_plane_get_prop(plane,
> > > IGT_PLANE_IN_FORMATS);
> > >  
> 
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 10/25] lib/igt_fb: s/planar_foo/fb_plane_foo/
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 10/25] lib/igt_fb: s/planar_foo/fb_plane_foo/ Ville Syrjala
@ 2018-09-21 21:58   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21 21:58 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:04 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Rename the planar_foo() functions to fb_plane_foo(). Makes it clear
> they're perfectly usable with non-planar formts too.

s/formts/formats/

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index c89a2c9e170d..e8b8200cdaa5 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -190,7 +190,8 @@ void igt_get_fb_tile_size(int fd, uint64_t
> tiling, int fb_bpp,
>  	}
>  }
>  
> -static unsigned planar_width(struct format_desc_struct *format,
> unsigned width, int plane)
> +static unsigned fb_plane_width(struct format_desc_struct *format,
> +			       unsigned width, int plane)
>  {
>  	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
>  		return DIV_ROUND_UP(width, 2);
> @@ -198,14 +199,16 @@ static unsigned planar_width(struct
> format_desc_struct *format, unsigned width,
>  	return width;
>  }
>  
> -static unsigned planar_stride(struct format_desc_struct *format,
> unsigned width, int plane)
> +static unsigned fb_plane_min_stride(struct format_desc_struct
> *format,
> +				    unsigned width, int plane)
>  {
>  	unsigned cpp = format->plane_bpp[plane] / 8;
>  
> -	return planar_width(format, width, plane) * cpp;
> +	return fb_plane_width(format, width, plane) * cpp;
>  }
>  
> -static unsigned planar_height(struct format_desc_struct *format,
> unsigned height, int plane)
> +static unsigned fb_plane_height(struct format_desc_struct *format,
> +				unsigned height, int plane)
>  {
>  	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
>  		return DIV_ROUND_UP(height, 2);
> @@ -229,7 +232,7 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
>  
>  		igt_get_fb_tile_size(fd, tiling, format-
> >plane_bpp[plane], &tile_width, &tile_height);
>  
> -		plane_stride = ALIGN(planar_stride(format, width,
> plane), tile_width);
> +		plane_stride = ALIGN(fb_plane_min_stride(format,
> width, plane), tile_width);
>  		if (max_stride < plane_stride)
>  			max_stride = plane_stride;
>  	}
> @@ -243,7 +246,7 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
>  
>  		igt_get_fb_tile_size(fd, tiling, format-
> >plane_bpp[plane], &tile_width, &tile_height);
>  
> -		*size_ret += stride * ALIGN(planar_height(format,
> height, plane), tile_height);
> +		*size_ret += stride * ALIGN(fb_plane_height(format,
> height, plane), tile_height);
>  	}
>  
>  	if (offsets)
> @@ -258,7 +261,7 @@ static void calc_fb_size_packed(int fd, int
> width, int height,
>  				unsigned stride, unsigned *size_ret,
> unsigned *stride_ret)
>  {
>  	unsigned int tile_width, tile_height, size;
> -	int byte_width = width * (format->plane_bpp[0] / 8);
> +	int byte_width = fb_plane_min_stride(format, width, 0);
>  
>  	igt_get_fb_tile_size(fd, tiling, format->plane_bpp[0],
> &tile_width, &tile_height);
>  
> @@ -885,8 +888,8 @@ igt_create_fb_with_bo_size(int fd, int width, int
> height,
>  
>  	for (i = 0; i < f->num_planes; i++) {
>  		fb->plane_bpp[i] = f->plane_bpp[i];
> -		fb->plane_height[i] = planar_height(f, height, i);
> -		fb->plane_width[i] = planar_width(f, width, i);
> +		fb->plane_height[i] = fb_plane_height(f, height, i);
> +		fb->plane_width[i] = fb_plane_width(f, width, i);
>  	}
>  
>  	return fb_id;
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 11/25] lib/igt_fb: Add fb_plane_bpp()
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 11/25] lib/igt_fb: Add fb_plane_bpp() Ville Syrjala
@ 2018-09-21 22:02   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21 22:02 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:04 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add another helper to get the bpp for a specific color plane. We'll
> need this for ccs support later.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index e8b8200cdaa5..df43d9c66ded 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -199,10 +199,15 @@ static unsigned fb_plane_width(struct
> format_desc_struct *format,
>  	return width;
>  }
>  
> +static unsigned fb_plane_bpp(struct format_desc_struct *format, int
> plane)
> +{
> +	return format->plane_bpp[plane];
> +}
> +
>  static unsigned fb_plane_min_stride(struct format_desc_struct
> *format,
>  				    unsigned width, int plane)
>  {
> -	unsigned cpp = format->plane_bpp[plane] / 8;
> +	unsigned cpp = fb_plane_bpp(format, plane) / 8;
>  
>  	return fb_plane_width(format, width, plane) * cpp;
>  }
> @@ -230,7 +235,8 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
>  	for (plane = 0; plane < format->num_planes; plane++) {
>  		unsigned plane_stride;
>  
> -		igt_get_fb_tile_size(fd, tiling, format-
> >plane_bpp[plane], &tile_width, &tile_height);
> +		igt_get_fb_tile_size(fd, tiling,
> fb_plane_bpp(format, plane),
> +				     &tile_width, &tile_height);
>  
>  		plane_stride = ALIGN(fb_plane_min_stride(format,
> width, plane), tile_width);
>  		if (max_stride < plane_stride)
> @@ -244,7 +250,8 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
>  		if (offsets)
>  			offsets[plane] = *size_ret;
>  
> -		igt_get_fb_tile_size(fd, tiling, format-
> >plane_bpp[plane], &tile_width, &tile_height);
> +		igt_get_fb_tile_size(fd, tiling,
> fb_plane_bpp(format, plane),
> +				     &tile_width, &tile_height);
>  
>  		*size_ret += stride * ALIGN(fb_plane_height(format,
> height, plane), tile_height);
>  	}
> @@ -263,7 +270,8 @@ static void calc_fb_size_packed(int fd, int
> width, int height,
>  	unsigned int tile_width, tile_height, size;
>  	int byte_width = fb_plane_min_stride(format, width, 0);
>  
> -	igt_get_fb_tile_size(fd, tiling, format->plane_bpp[0],
> &tile_width, &tile_height);
> +	igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, 0),
> +			     &tile_width, &tile_height);
>  
>  	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
>  	    intel_gen(intel_get_drm_devid(fd)) <= 3) {
> @@ -456,7 +464,7 @@ static int create_bo_for_fb(int fd, int width,
> int height,
>  			*is_dumb = true;
>  
>  		return kmstest_dumb_create(fd, width, height,
> -					   format->plane_bpp[0],
> +					   fb_plane_bpp(format, 0),
>  					   stride_ret, size_ret);
>  	}
>  }
> @@ -887,7 +895,7 @@ igt_create_fb_with_bo_size(int fd, int width, int
> height,
>  	fb->color_range = color_range;
>  
>  	for (i = 0; i < f->num_planes; i++) {
> -		fb->plane_bpp[i] = f->plane_bpp[i];
> +		fb->plane_bpp[i] = fb_plane_bpp(f, i);
>  		fb->plane_height[i] = fb_plane_height(f, height, i);
>  		fb->plane_width[i] = fb_plane_width(f, width, i);
>  	}
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 12/25] lib/igt_fb: Add fb_num_planes()
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 12/25] lib/igt_fb: Add fb_num_planes() Ville Syrjala
@ 2018-09-21 22:05   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21 22:05 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:04 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add a helper to return the number of color planes. We'll need this
> for ccs support later.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index df43d9c66ded..0319afa9749f 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -221,6 +221,11 @@ static unsigned fb_plane_height(struct
> format_desc_struct *format,
>  	return height;
>  }
>  
> +static int fb_num_planes(struct format_desc_struct *format)
> +{
> +	return format->num_planes;
> +}
> +
>  static void calc_fb_size_planar(int fd, int width, int height,
>  				struct format_desc_struct *format,
>  				uint64_t tiling, unsigned stride,
> @@ -232,7 +237,7 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
>  
>  	*size_ret = 0;
>  
> -	for (plane = 0; plane < format->num_planes; plane++) {
> +	for (plane = 0; plane < fb_num_planes(format); plane++) {
>  		unsigned plane_stride;
>  
>  		igt_get_fb_tile_size(fd, tiling,
> fb_plane_bpp(format, plane),
> @@ -246,7 +251,7 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
>  	if (!stride)
>  		stride = max_stride;
>  
> -	for (plane = 0; plane < format->num_planes; plane++) {
> +	for (plane = 0; plane < fb_num_planes(format); plane++) {
>  		if (offsets)
>  			offsets[plane] = *size_ret;
>  
> @@ -323,7 +328,7 @@ void igt_calc_fb_size(int fd, int width, int
> height, uint32_t drm_format, uint64
>  	struct format_desc_struct *format =
> lookup_drm_format(drm_format);
>  	igt_assert(format);
>  
> -	if (format->num_planes > 1)
> +	if (fb_num_planes(format) > 1)
>  		calc_fb_size_planar(fd, width, height, format,
> tiling, 0, size_ret, stride_ret, NULL);
>  	else
>  		calc_fb_size_packed(fd, width, height, format,
> tiling, 0, size_ret, stride_ret);
> @@ -400,7 +405,7 @@ static int create_bo_for_fb(int fd, int width,
> int height,
>  	if (tiling || size || stride || igt_format_is_yuv(format-
> >drm_id)) {
>  		unsigned calculated_size, calculated_stride;
>  
> -		if (format->num_planes > 1)
> +		if (fb_num_planes(format) > 1)
>  			calc_fb_size_planar(fd, width, height,
> format, tiling, stride,
>  					    &calculated_size,
> &calculated_stride, offsets);
>  		else
> @@ -874,7 +879,7 @@ igt_create_fb_with_bo_size(int fd, int width, int
> height,
>  
>  		handles[0] = fb->gem_handle;
>  		pitches[0] = fb->stride;
> -		for (i = 0; i < f->num_planes; i++) {
> +		for (i = 0; i < fb_num_planes(f); i++) {
>  			handles[i] = fb->gem_handle;
>  			pitches[i] = fb->stride;
>  		}
> @@ -890,11 +895,11 @@ igt_create_fb_with_bo_size(int fd, int width,
> int height,
>  	fb->drm_format = format;
>  	fb->fb_id = fb_id;
>  	fb->fd = fd;
> -	fb->num_planes = f->num_planes;
> +	fb->num_planes = fb_num_planes(f);
>  	fb->color_encoding = color_encoding;
>  	fb->color_range = color_range;
>  
> -	for (i = 0; i < f->num_planes; i++) {
> +	for (i = 0; i < fb_num_planes(f); i++) {
>  		fb->plane_bpp[i] = fb_plane_bpp(f, i);
>  		fb->plane_height[i] = fb_plane_height(f, height, i);
>  		fb->plane_width[i] = fb_plane_width(f, width, i);
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 13/25] lib/igt_fb: Extract calc_plane_stride()
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 13/25] lib/igt_fb: Extract calc_plane_stride() Ville Syrjala
@ 2018-09-21 22:33   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21 22:33 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:04 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Extract the stride calculation from calc_fb_size_packed() to its own
> thing so that we can use it to calculate just the stride.

I think it makes more sense to wait for the rebased versions before
giving r-b tags to patches 13 and 14. Patch 13 looks good, but 14 is
starting to get hard to review without applying it locally.


> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c | 53 ++++++++++++++++++++++++++++++++++++++++--------
> -----
>  1 file changed, 40 insertions(+), 13 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 0319afa9749f..dd6cd1f6409c 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -226,6 +226,38 @@ static int fb_num_planes(struct
> format_desc_struct *format)
>  	return format->num_planes;
>  }
>  
> +static unsigned calc_plane_stride(int fd,
> +				  struct format_desc_struct *format,
> +				  int width, uint64_t tiling, int
> plane)
> +{
> +	uint32_t min_stride = fb_plane_min_stride(format, width,
> plane);
> +
> +	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
> +	    intel_gen(intel_get_drm_devid(fd)) <= 3) {
> +		uint32_t stride;
> +
> +		/* Round the tiling up to the next power-of-two and
> the region
> +		 * up to the next pot fence size so that this works
> on all
> +		 * generations.
> +		 *
> +		 * This can still fail if the framebuffer is too
> large to be
> +		 * tiled. But then that failure is expected.
> +		 */
> +		for (stride = 512; stride < min_stride; stride *= 2)
> +			;
> +
> +		return stride;
> +	} else {
> +		unsigned int tile_width, tile_height;
> +
> +		igt_get_fb_tile_size(fd, tiling,
> +				     fb_plane_bpp(format, plane),
> +				     &tile_width, &tile_height);
> +
> +		return ALIGN(min_stride, tile_width);
> +	}
> +}
> +
>  static void calc_fb_size_planar(int fd, int width, int height,
>  				struct format_desc_struct *format,
>  				uint64_t tiling, unsigned stride,
> @@ -272,11 +304,10 @@ static void calc_fb_size_packed(int fd, int
> width, int height,
>  				struct format_desc_struct *format,
> uint64_t tiling,
>  				unsigned stride, unsigned *size_ret,
> unsigned *stride_ret)
>  {
> -	unsigned int tile_width, tile_height, size;
> -	int byte_width = fb_plane_min_stride(format, width, 0);
> +	unsigned int size;
>  
> -	igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, 0),
> -			     &tile_width, &tile_height);
> +	if (!stride)
> +		stride = calc_plane_stride(fd, format, width,
> tiling, 0);
>  
>  	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
>  	    intel_gen(intel_get_drm_devid(fd)) <= 3) {
> @@ -289,19 +320,15 @@ static void calc_fb_size_packed(int fd, int
> width, int height,
>  		 * This can still fail if the framebuffer is too
> large to be
>  		 * tiled. But then that failure is expected.
>  		 */
> -
> -		if (!stride) {
> -			v = byte_width;
> -			for (stride = 512; stride < v; stride *= 2)
> -				;
> -		}
> -
>  		v = stride * height;
>  		for (size = 1024*1024; size < v; size *= 2)
>  			;
>  	} else {
> -		if (!stride)
> -			stride = ALIGN(byte_width, tile_width);
> +		unsigned int tile_width, tile_height;
> +
> +		igt_get_fb_tile_size(fd, tiling,
> fb_plane_bpp(format, 0),
> +				     &tile_width, &tile_height);
> +
>  		size = stride * ALIGN(height, tile_height);
>  	}
>  
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 15/25] lib/kms: Pass strides[] to __kms_addfb
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 15/25] lib/kms: Pass strides[] to __kms_addfb Ville Syrjala
@ 2018-09-21 22:45   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21 22:45 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:04 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Make __kms_addfb() usable with planar formats by passing in the
> stride for each plane.

I'm hoping later in this series we'll just use
drmModeAddFB2WithModifiers() :)

Or at least unify the Y vs X/linear cases below.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c                    |  7 ++++++-
>  lib/ioctl_wrappers.c            | 12 +++++++-----
>  lib/ioctl_wrappers.h            |  8 +++++---
>  tests/kms_available_modes_crc.c | 14 +++++++-------
>  tests/kms_draw_crc.c            |  6 +++---
>  tests/prime_vgem.c              |  8 ++++++--
>  6 files changed, 34 insertions(+), 21 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 0221a0b9b040..5e687b95e265 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -877,8 +877,13 @@ igt_create_fb_with_bo_size(int fd, int width,
> int height,
>  
>  	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
>  	    tiling != LOCAL_I915_FORMAT_MOD_X_TILED) {
> +		uint32_t pitches[4];
> +
> +		for (i = 0; i < fb_num_planes(f); i++)
> +			pitches[i] = fb->stride;
> +
>  		do_or_die(__kms_addfb(fd, fb->gem_handle, width,
> height,
> -				      fb->stride, format, tiling,
> fb->offsets,
> +				      format, tiling, pitches, fb-
> >offsets,
>  				      LOCAL_DRM_MODE_FB_MODIFIERS,
> &fb_id));
>  	} else {
>  		uint32_t handles[4];
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index d5d2a4e4c913..a34857266d92 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -1670,9 +1670,11 @@ void igt_require_fb_modifiers(int fd)
>  	igt_require(has_modifiers);
>  }
>  
> -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 *offsets, uint32_t flags, uint32_t *buf_id)
> +int __kms_addfb(int fd, uint32_t handle,
> +		uint32_t width, uint32_t height,
> +		uint32_t pixel_format, uint64_t modifier,
> +		uint32_t strides[4], uint32_t offsets[4],
> +		uint32_t flags, uint32_t *buf_id)
>  {
>  	struct drm_mode_fb_cmd2 f;
>  	int ret, i;
> @@ -1686,12 +1688,12 @@ int __kms_addfb(int fd, uint32_t handle,
> uint32_t width, uint32_t height,
>  	f.pixel_format = pixel_format;
>  	f.flags = flags;
>  	f.handles[0] = handle;
> -	f.pitches[0] = stride;
> +	f.pitches[0] = strides[0];
>  	f.modifier[0] = modifier;
>  
>  	for (i = 1; i < 4 && offsets && offsets[i]; i++) {
>  		f.handles[i] = handle;
> -		f.pitches[i] = stride;
> +		f.pitches[i] = strides[i];
>  		f.modifier[i] = modifier;
>  		f.offsets[i] = offsets[i];
>  	}
> diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
> index 8e2cd380b575..67bf50562bf3 100644
> --- a/lib/ioctl_wrappers.h
> +++ b/lib/ioctl_wrappers.h
> @@ -235,9 +235,11 @@ void igt_require_fb_modifiers(int fd);
>   *
>   * Creates a framebuffer object.
>   */
> -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 *offsets, uint32_t flags, uint32_t
> *buf_id);
> +int __kms_addfb(int fd, uint32_t handle,
> +		uint32_t width, uint32_t height,
> +		uint32_t pixel_format, uint64_t modifier,
> +		uint32_t strides[4], uint32_t offsets[4],
> +		uint32_t flags, uint32_t *buf_id);
>  
>  /**
>   * to_user_pointer:
> diff --git a/tests/kms_available_modes_crc.c
> b/tests/kms_available_modes_crc.c
> index b70ef5d7d4c0..1c843c6cf691 100644
> --- a/tests/kms_available_modes_crc.c
> +++ b/tests/kms_available_modes_crc.c
> @@ -255,7 +255,8 @@ static bool setup_fb(data_t *data, igt_output_t
> *output, igt_plane_t *plane,
>  	drmModeModeInfo *mode;
>  	uint64_t w, h;
>  	signed ret, gemsize = 0;
> -	unsigned tile_width, tile_height, stride;
> +	unsigned tile_width, tile_height;
> +	uint32_t strides[4] = {};
>  	uint32_t offsets[4] = {};
>  	uint64_t tiling;
>  	int bpp = 0;
> @@ -296,8 +297,8 @@ static bool setup_fb(data_t *data, igt_output_t
> *output, igt_plane_t *plane,
>  
>  	igt_get_fb_tile_size(data->gfx_fd, tiling, bpp,
>  			     &tile_width, &tile_height);
> -	stride = ALIGN(w * bpp / 8, tile_width);
> -	gemsize = data->size = stride * ALIGN(h, tile_height);
> +	strides[0] = ALIGN(w * bpp / 8, tile_width);
> +	gemsize = data->size = strides[0] * ALIGN(h, tile_height);
>  
>  	if (fillers[i].bpp == P010 || fillers[i].bpp == NV12) {
>  		offsets[1] = data->size;
> @@ -306,14 +307,13 @@ static bool setup_fb(data_t *data, igt_output_t
> *output, igt_plane_t *plane,
>  
>  	data->gem_handle = gem_create(data->gfx_fd, gemsize);
>  	ret = __gem_set_tiling(data->gfx_fd, data->gem_handle,
> -			       igt_fb_mod_to_tiling(tiling),
> stride);
> +			       igt_fb_mod_to_tiling(tiling),
> strides[0]);
>  
>  	igt_assert_eq(ret, 0);
>  
>  	ret = __kms_addfb(data->gfx_fd, data->gem_handle, w, h,
> -			  stride, format, tiling,
> -			  offsets, LOCAL_DRM_MODE_FB_MODIFIERS,
> -			  &data->fb.fb_id);
> +			  format, tiling, strides, offsets,
> +			  LOCAL_DRM_MODE_FB_MODIFIERS, &data-
> >fb.fb_id);
>  
>  	if(ret < 0) {
>  		igt_info("Creating fb for format %s failed, return
> code %d\n",
> diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
> index 86dcf39285f3..fb10d7ccf8bc 100644
> --- a/tests/kms_draw_crc.c
> +++ b/tests/kms_draw_crc.c
> @@ -156,14 +156,14 @@ static void get_method_crc(enum igt_draw_method
> method, uint32_t drm_format,
>  static bool format_is_supported(uint32_t format, uint64_t modifier)
>  {
>  	uint32_t gem_handle, fb_id;
> -	unsigned int stride;
> +	unsigned int strides[4] = {};
>  	int ret;
>  
>  	gem_handle = igt_create_bo_with_dimensions(drm_fd, 64, 64,
>  						   format, modifier,
> -						   0, NULL, &stride,
> NULL);
> +						   0, NULL,
> &strides[0], NULL);
>  	ret =  __kms_addfb(drm_fd, gem_handle, 64, 64,
> -			   stride, format, modifier, NULL,
> +			   format, modifier, strides, NULL,
>  			   LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id);
>  	drmModeRmFB(drm_fd, fb_id);
>  	gem_close(drm_fd, gem_handle);
> diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
> index 763c62e606f6..1b7d8fb293ef 100644
> --- a/tests/prime_vgem.c
> +++ b/tests/prime_vgem.c
> @@ -709,6 +709,7 @@ static void test_flip(int i915, int vgem,
> unsigned hang)
>  	signal(SIGHUP, sighandler);
>  
>  	for (int i = 0; i < 2; i++) {
> +		uint32_t strides[4] = {};
>  		int fd;
>  
>  		bo[i].width = 1024;
> @@ -721,9 +722,12 @@ static void test_flip(int i915, int vgem,
> unsigned hang)
>  		igt_assert(handle[i]);
>  		close(fd);
>  
> +		strides[0] = bo[i].pitch;
> +
>  		do_or_die(__kms_addfb(i915, handle[i],
> -				      bo[i].width, bo[i].height,
> bo[i].pitch,
> -				      DRM_FORMAT_XRGB8888,
> I915_TILING_NONE, NULL,
> +				      bo[i].width, bo[i].height,
> +				      DRM_FORMAT_XRGB8888,
> I915_TILING_NONE,
> +				      strides, NULL,
>  				      LOCAL_DRM_MODE_FB_MODIFIERS,
> &fb_id[i]));
>  		igt_assert(fb_id[i]);
>  	}
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 16/25] lib/kms: Pass the number of planes explicitly to __kms_addfb()
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 16/25] lib/kms: Pass the number of planes explicitly to __kms_addfb() Ville Syrjala
@ 2018-09-21 22:54   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21 22:54 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:04 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Currently __kms_addfb() assumes that only the first plane can be
> at offset 0. I don't particularly like such assumptions so let's
> just pass in the number of planes explicitly.
> 
> We'll also require offsets[] to be passed in always. Nothing really
> to gain by making it optional.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c                    | 1 +
>  lib/ioctl_wrappers.c            | 9 +++------
>  lib/ioctl_wrappers.h            | 2 +-
>  tests/kms_available_modes_crc.c | 5 ++++-
>  tests/kms_draw_crc.c            | 3 ++-
>  tests/prime_vgem.c              | 3 ++-
>  6 files changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 5e687b95e265..77611b593a7e 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -884,6 +884,7 @@ igt_create_fb_with_bo_size(int fd, int width, int
> height,
>  
>  		do_or_die(__kms_addfb(fd, fb->gem_handle, width,
> height,
>  				      format, tiling, pitches, fb-
> >offsets,
> +				      fb_num_planes(f),
>  				      LOCAL_DRM_MODE_FB_MODIFIERS,
> &fb_id));
>  	} else {
>  		uint32_t handles[4];
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index a34857266d92..d992e015b9c8 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -1674,7 +1674,7 @@ int __kms_addfb(int fd, uint32_t handle,
>  		uint32_t width, uint32_t height,
>  		uint32_t pixel_format, uint64_t modifier,
>  		uint32_t strides[4], uint32_t offsets[4],
> -		uint32_t flags, uint32_t *buf_id)
> +		int num_planes, uint32_t flags, uint32_t *buf_id)
>  {
>  	struct drm_mode_fb_cmd2 f;
>  	int ret, i;
> @@ -1687,14 +1687,11 @@ int __kms_addfb(int fd, uint32_t handle,
>  	f.height = height;
>  	f.pixel_format = pixel_format;
>  	f.flags = flags;
> -	f.handles[0] = handle;
> -	f.pitches[0] = strides[0];
> -	f.modifier[0] = modifier;
>  
> -	for (i = 1; i < 4 && offsets && offsets[i]; i++) {
> +	for (i = 0; i < num_planes; i++) {
>  		f.handles[i] = handle;
> -		f.pitches[i] = strides[i];
>  		f.modifier[i] = modifier;
> +		f.pitches[i] = strides[i];
>  		f.offsets[i] = offsets[i];
>  	}
>  
> diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
> index 67bf50562bf3..872e3056314b 100644
> --- a/lib/ioctl_wrappers.h
> +++ b/lib/ioctl_wrappers.h
> @@ -239,7 +239,7 @@ int __kms_addfb(int fd, uint32_t handle,
>  		uint32_t width, uint32_t height,
>  		uint32_t pixel_format, uint64_t modifier,
>  		uint32_t strides[4], uint32_t offsets[4],
> -		uint32_t flags, uint32_t *buf_id);
> +		int num_planes, uint32_t flags, uint32_t *buf_id);
>  
>  /**
>   * to_user_pointer:
> diff --git a/tests/kms_available_modes_crc.c
> b/tests/kms_available_modes_crc.c
> index 1c843c6cf691..14170ef711e3 100644
> --- a/tests/kms_available_modes_crc.c
> +++ b/tests/kms_available_modes_crc.c
> @@ -258,6 +258,7 @@ static bool setup_fb(data_t *data, igt_output_t
> *output, igt_plane_t *plane,
>  	unsigned tile_width, tile_height;
>  	uint32_t strides[4] = {};
>  	uint32_t offsets[4] = {};
> +	int num_planes = 1;
>  	uint64_t tiling;
>  	int bpp = 0;
>  	int i;
> @@ -303,6 +304,7 @@ static bool setup_fb(data_t *data, igt_output_t
> *output, igt_plane_t *plane,
>  	if (fillers[i].bpp == P010 || fillers[i].bpp == NV12) {
>  		offsets[1] = data->size;
>  		gemsize = data->size * 2;
> +		num_planes = 2;
>  	}
>  
>  	data->gem_handle = gem_create(data->gfx_fd, gemsize);
> @@ -313,7 +315,8 @@ static bool setup_fb(data_t *data, igt_output_t
> *output, igt_plane_t *plane,
>  
>  	ret = __kms_addfb(data->gfx_fd, data->gem_handle, w, h,
>  			  format, tiling, strides, offsets,
> -			  LOCAL_DRM_MODE_FB_MODIFIERS, &data-
> >fb.fb_id);
> +			  num_planes, LOCAL_DRM_MODE_FB_MODIFIERS,
> +			  &data->fb.fb_id);
>  
>  	if(ret < 0) {
>  		igt_info("Creating fb for format %s failed, return
> code %d\n",
> diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
> index fb10d7ccf8bc..90904714283c 100644
> --- a/tests/kms_draw_crc.c
> +++ b/tests/kms_draw_crc.c
> @@ -156,6 +156,7 @@ static void get_method_crc(enum igt_draw_method
> method, uint32_t drm_format,
>  static bool format_is_supported(uint32_t format, uint64_t modifier)
>  {
>  	uint32_t gem_handle, fb_id;
> +	unsigned int offsets[4] = {};
>  	unsigned int strides[4] = {};
>  	int ret;
>  
> @@ -163,7 +164,7 @@ static bool format_is_supported(uint32_t format,
> uint64_t modifier)
>  						   format, modifier,
>  						   0, NULL,
> &strides[0], NULL);
>  	ret =  __kms_addfb(drm_fd, gem_handle, 64, 64,
> -			   format, modifier, strides, NULL,
> +			   format, modifier, strides, offsets, 1,
>  			   LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id);
>  	drmModeRmFB(drm_fd, fb_id);
>  	gem_close(drm_fd, gem_handle);
> diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
> index 1b7d8fb293ef..d06aa24b5ef2 100644
> --- a/tests/prime_vgem.c
> +++ b/tests/prime_vgem.c
> @@ -710,6 +710,7 @@ static void test_flip(int i915, int vgem,
> unsigned hang)
>  
>  	for (int i = 0; i < 2; i++) {
>  		uint32_t strides[4] = {};
> +		uint32_t offsets[4] = {};
>  		int fd;
>  
>  		bo[i].width = 1024;
> @@ -727,7 +728,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,
>  				      DRM_FORMAT_XRGB8888,
> I915_TILING_NONE,
> -				      strides, NULL,
> +				      strides, offsets, 1,
>  				      LOCAL_DRM_MODE_FB_MODIFIERS,
> &fb_id[i]));
>  		igt_assert(fb_id[i]);
>  	}
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 17/25] lib/igt_fb: Remove the hand rolled addfb2
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 17/25] lib/igt_fb: Remove the hand rolled addfb2 Ville Syrjala
@ 2018-09-21 23:15   ` Paulo Zanoni
  2018-10-03 10:56     ` Petri Latvala
  0 siblings, 1 reply; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21 23:15 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:04 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Just use __kms_addfb() always instead of hand rolling another
> drmModeAddFB2() usage. __kms_addfb() demands support for modifiers
> but we've had that for a long time now so it's not a problem.

Dear IGT mainainers, do we have any specific rules/requirements about
running new IGT in older Kernels? A minimum/maximum age?

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c | 35 +++++++----------------------------
>  1 file changed, 7 insertions(+), 28 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 77611b593a7e..648f0a318c91 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -856,6 +856,7 @@ igt_create_fb_with_bo_size(int fd, int width, int
> height,
>  	enum igt_color_encoding color_encoding =
> IGT_COLOR_YCBCR_BT709;
>  	enum igt_color_range color_range =
> IGT_COLOR_YCBCR_LIMITED_RANGE;
>  	struct format_desc_struct *f = lookup_drm_format(format);
> +	uint32_t pitches[4];
>  	uint32_t fb_id;
>  	int i;
>  
> @@ -875,35 +876,13 @@ 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) {
> -		uint32_t pitches[4];
> -
> -		for (i = 0; i < fb_num_planes(f); i++)
> -			pitches[i] = fb->stride;
> -
> -		do_or_die(__kms_addfb(fd, fb->gem_handle, width,
> height,
> -				      format, tiling, pitches, fb-
> >offsets,
> -				      fb_num_planes(f),
> -				      LOCAL_DRM_MODE_FB_MODIFIERS,
> &fb_id));
> -	} else {
> -		uint32_t handles[4];
> -		uint32_t pitches[4];
> +	for (i = 0; i < fb_num_planes(f); i++)
> +		pitches[i] = fb->stride;
>  
> -		memset(handles, 0, sizeof(handles));
> -		memset(pitches, 0, sizeof(pitches));
> -
> -		handles[0] = fb->gem_handle;
> -		pitches[0] = fb->stride;
> -		for (i = 0; i < fb_num_planes(f); i++) {
> -			handles[i] = fb->gem_handle;
> -			pitches[i] = fb->stride;
> -		}
> -
> -		do_or_die(drmModeAddFB2(fd, width, height, format,
> -					handles, pitches, fb-
> >offsets,
> -					&fb_id, 0));
> -	}
> +	do_or_die(__kms_addfb(fd, fb->gem_handle, width, height,
> +			      format, tiling, pitches, fb->offsets,

So the real difference is that we now pass "tiling" as a modifier as
opposed to nothing, for the X and linear formats. A quick look at
intel_framebuffer_init() suggests that this is fine (and required).

As long as maintainers don't block it:
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

But now __kms_addfb() is almost a reimplementation of of
drmModeAddFB2WithModifiers(), maybe we could use it instead.

> +			      fb_num_planes(f),
> +			      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id));
>  
>  	fb->width = width;
>  	fb->height = height;
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 18/25] lib/igt_fb: Constify format_desc_struct
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 18/25] lib/igt_fb: Constify format_desc_struct Ville Syrjala
@ 2018-09-21 23:20   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21 23:20 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:04 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We don't want anyone to modify the format description structures.
> Make
> them const.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c | 44 ++++++++++++++++++++++----------------------
>  1 file changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 648f0a318c91..49e323b22d26 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -60,7 +60,7 @@
>   */
>  
>  /* drm fourcc/cairo format maps */
> -static struct format_desc_struct {
> +static const struct format_desc_struct {
>  	const char *name;
>  	uint32_t drm_id;
>  	cairo_format_t cairo_id;
> @@ -108,9 +108,9 @@ static struct format_desc_struct {
>  #define for_each_format(f)	\
>  	for (f = format_desc; f - format_desc <
> ARRAY_SIZE(format_desc); f++)
>  
> -static struct format_desc_struct *lookup_drm_format(uint32_t
> drm_format)
> +static const struct format_desc_struct *lookup_drm_format(uint32_t
> drm_format)
>  {
> -	struct format_desc_struct *format;
> +	const struct format_desc_struct *format;
>  
>  	for_each_format(format) {
>  		if (format->drm_id != drm_format)
> @@ -190,8 +190,8 @@ void igt_get_fb_tile_size(int fd, uint64_t
> tiling, int fb_bpp,
>  	}
>  }
>  
> -static unsigned fb_plane_width(struct format_desc_struct *format,
> -			       unsigned width, int plane)
> +static unsigned fb_plane_width(const struct format_desc_struct
> *format,
> +			       int plane, unsigned width)
>  {
>  	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
>  		return DIV_ROUND_UP(width, 2);
> @@ -199,21 +199,21 @@ static unsigned fb_plane_width(struct
> format_desc_struct *format,
>  	return width;
>  }
>  
> -static unsigned fb_plane_bpp(struct format_desc_struct *format, int
> plane)
> +static unsigned fb_plane_bpp(const struct format_desc_struct
> *format, int plane)
>  {
>  	return format->plane_bpp[plane];
>  }
>  
> -static unsigned fb_plane_min_stride(struct format_desc_struct
> *format,
> -				    unsigned width, int plane)
> +static unsigned fb_plane_min_stride(const struct format_desc_struct
> *format,
> +				    int plane, unsigned width)
>  {
>  	unsigned cpp = fb_plane_bpp(format, plane) / 8;
>  
>  	return fb_plane_width(format, width, plane) * cpp;
>  }
>  
> -static unsigned fb_plane_height(struct format_desc_struct *format,
> -				unsigned height, int plane)
> +static unsigned fb_plane_height(const struct format_desc_struct
> *format,
> +				int plane, unsigned height)
>  {
>  	if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
>  		return DIV_ROUND_UP(height, 2);
> @@ -221,13 +221,13 @@ static unsigned fb_plane_height(struct
> format_desc_struct *format,
>  	return height;
>  }
>  
> -static int fb_num_planes(struct format_desc_struct *format)
> +static int fb_num_planes(const struct format_desc_struct *format)
>  {
>  	return format->num_planes;
>  }
>  
>  static unsigned calc_plane_stride(int fd,
> -				  struct format_desc_struct *format,
> +				  const struct format_desc_struct
> *format,
>  				  int width, uint64_t tiling, int
> plane)
>  {
>  	uint32_t min_stride = fb_plane_min_stride(format, width,
> plane);
> @@ -259,7 +259,7 @@ static unsigned calc_plane_stride(int fd,
>  }
>  
>  static unsigned calc_plane_size(int fd, int width, int height,
> -				struct format_desc_struct *format,
> +				const struct format_desc_struct
> *format,
>  				uint64_t tiling, int plane,
>  				uint32_t stride)
>  {
> @@ -290,7 +290,7 @@ static unsigned calc_plane_size(int fd, int
> width, int height,
>  }
>  
>  static unsigned calc_fb_size(int fd, int width, int height,
> -			     struct format_desc_struct *format,
> +			     const struct format_desc_struct
> *format,
>  			     uint64_t tiling,
>  			     uint32_t strides[4], uint32_t
> offsets[4])
>  {
> @@ -335,7 +335,7 @@ static unsigned calc_fb_size(int fd, int width,
> int height,
>  void igt_calc_fb_size(int fd, int width, int height, uint32_t
> drm_format, uint64_t tiling,
>  		      unsigned *size_ret, unsigned *stride_ret)
>  {
> -	struct format_desc_struct *format =
> lookup_drm_format(drm_format);
> +	const struct format_desc_struct *format =
> lookup_drm_format(drm_format);
>  	uint32_t strides[4] = {};
>  
>  	igt_assert(format);
> @@ -400,7 +400,7 @@ uint64_t igt_fb_tiling_to_mod(uint64_t tiling)
>  static int create_bo_for_fb(int fd, int width, int height,
>  			    enum igt_color_encoding color_encoding,
>  			    enum igt_color_range color_range,
> -			    struct format_desc_struct *format,
> +			    const struct format_desc_struct *format,
>  			    uint64_t tiling, unsigned size, unsigned
> stride,
>  			    unsigned *size_ret, unsigned
> *stride_ret,
>  			    uint32_t offsets[4], bool *is_dumb)
> @@ -855,7 +855,7 @@ igt_create_fb_with_bo_size(int fd, int width, int
> height,
>  	/* FIXME allow the caller to pass these in */
>  	enum igt_color_encoding color_encoding =
> IGT_COLOR_YCBCR_BT709;
>  	enum igt_color_range color_range =
> IGT_COLOR_YCBCR_LIMITED_RANGE;
> -	struct format_desc_struct *f = lookup_drm_format(format);
> +	const struct format_desc_struct *f =
> lookup_drm_format(format);
>  	uint32_t pitches[4];
>  	uint32_t fb_id;
>  	int i;
> @@ -1195,7 +1195,7 @@ unsigned int igt_create_stereo_fb(int drm_fd,
> drmModeModeInfo *mode,
>  
>  static cairo_format_t drm_format_to_cairo(uint32_t drm_format)
>  {
> -	struct format_desc_struct *f;
> +	const struct format_desc_struct *f;
>  
>  	for_each_format(f)
>  		if (f->drm_id == drm_format)
> @@ -1953,7 +1953,7 @@ void igt_remove_fb(int fd, struct igt_fb *fb)
>   */
>  uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth)
>  {
> -	struct format_desc_struct *f;
> +	const struct format_desc_struct *f;
>  
>  	for_each_format(f)
>  		if (f->plane_bpp[0] == bpp && f->depth == depth)
> @@ -1974,7 +1974,7 @@ uint32_t igt_bpp_depth_to_drm_format(int bpp,
> int depth)
>   */
>  uint32_t igt_drm_format_to_bpp(uint32_t drm_format)
>  {
> -	struct format_desc_struct *f =
> lookup_drm_format(drm_format);
> +	const struct format_desc_struct *f =
> lookup_drm_format(drm_format);
>  
>  	igt_assert_f(f, "can't find a bpp format for %08x (%s)\n",
>  		     drm_format, igt_format_str(drm_format));
> @@ -1992,7 +1992,7 @@ uint32_t igt_drm_format_to_bpp(uint32_t
> drm_format)
>   */
>  const char *igt_format_str(uint32_t drm_format)
>  {
> -	struct format_desc_struct *f =
> lookup_drm_format(drm_format);
> +	const struct format_desc_struct *f =
> lookup_drm_format(drm_format);
>  
>  	return f ? f->name : "invalid";
>  }
> @@ -2006,7 +2006,7 @@ const char *igt_format_str(uint32_t drm_format)
>   */
>  bool igt_fb_supported_format(uint32_t drm_format)
>  {
> -	struct format_desc_struct *f;
> +	const struct format_desc_struct *f;
>  
>  	for_each_format(f)
>  		if (f->drm_id == drm_format)
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 20/25] lib/igt_fb: Refactor blitter usage
  2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 20/25] lib/igt_fb: Refactor blitter usage Ville Syrjala
@ 2018-09-21 23:48   ` Paulo Zanoni
  0 siblings, 0 replies; 52+ messages in thread
From: Paulo Zanoni @ 2018-09-21 23:48 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Em Qui, 2018-07-19 às 18:04 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Deduplicate the blitter code.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c | 62 ++++++++++++++++++++++++++++--------------------
> ------------
>  1 file changed, 29 insertions(+), 33 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 23f53caa0ad2..a0859230f37f 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1206,32 +1206,44 @@ struct fb_blit_upload {
>  	struct fb_blit_linear linear;
>  };
>  
> +static void blitcopy(const struct igt_fb *dst_fb,
> +		     const struct igt_fb *src_fb)
> +{
> +	igt_assert_eq(dst_fb->fd, src_fb->fd);
> +	igt_assert_eq(dst_fb->num_planes, src_fb->num_planes);
> +
> +	for (int i = 0; i < dst_fb->num_planes; i++) {
> +		igt_assert_eq(dst_fb->plane_bpp[i], src_fb-
> >plane_bpp[i]);
> +		igt_assert_eq(dst_fb->plane_width[i], src_fb-
> >plane_width[i]);
> +		igt_assert_eq(dst_fb->plane_height[i], src_fb-
> >plane_height[i]);
> +
> +		igt_blitter_fast_copy__raw(dst_fb->fd,
> +					   src_fb->gem_handle,
> +					   src_fb->offsets[i],
> +					   src_fb->strides[i],
> +					   igt_fb_mod_to_tiling(src_
> fb->tiling),
> +					   0, 0, /* src_x, src_y */
> +					   dst_fb->plane_width[i],
> dst_fb->plane_height[i],
> +					   dst_fb->plane_bpp[i],
> +					   dst_fb->gem_handle,
> +					   dst_fb->offsets[i],
> +					   dst_fb->strides[i],
> +					   igt_fb_mod_to_tiling(dst_
> fb->tiling),
> +					   0, 0 /* dst_x, dst_y */);
> +	}
> +}
> +
>  static void free_linear_mapping(struct fb_blit_upload *blit)
>  {
>  	int fd = blit->fd;
>  	struct igt_fb *fb = blit->fb;
>  	struct fb_blit_linear *linear = &blit->linear;
> -	unsigned int obj_tiling = igt_fb_mod_to_tiling(fb->tiling);
> -	int i;
>  
>  	gem_munmap(linear->map, linear->fb.size);
>  	gem_set_domain(fd, linear->fb.gem_handle,
>  		       I915_GEM_DOMAIN_GTT, 0);
>  
> -	for (i = 0; i < fb->num_planes; i++)
> -		igt_blitter_fast_copy__raw(fd,
> -					   linear->fb.gem_handle,
> -					   linear->fb.offsets[i],
> -					   linear->fb.strides[i],
> -					   I915_TILING_NONE,
> -					   0, 0, /* src_x, src_y */
> -					   fb->plane_width[i], fb-
> >plane_height[i],
> -					   fb->plane_bpp[i],
> -					   fb->gem_handle,
> -					   fb->offsets[i],
> -					   fb->strides[i],
> -					   obj_tiling,
> -					   0, 0 /* dst_x, dst_y */);
> +	blitcopy(fb, &linear->fb);
>  
>  	gem_sync(fd, linear->fb.gem_handle);
>  	gem_close(fd, linear->fb.gem_handle);
> @@ -1250,9 +1262,6 @@ static void destroy_cairo_surface__blit(void
> *arg)
>  
>  static void setup_linear_mapping(int fd, struct igt_fb *fb, struct
> fb_blit_linear *linear)
>  {
> -	unsigned int obj_tiling = igt_fb_mod_to_tiling(fb->tiling);
> -	int i;
> -
>  	/*
>  	 * We create a linear BO that we'll map for the CPU to write
> to (using
>  	 * cairo). This linear bo will be then blitted to its final
> @@ -1271,20 +1280,7 @@ static void setup_linear_mapping(int fd,
> struct igt_fb *fb, struct fb_blit_linea
>  	gem_set_domain(fd, linear->fb.gem_handle,
>  			I915_GEM_DOMAIN_GTT, 0);
>  
> -	for (i = 0; i < fb->num_planes; i++)
> -		igt_blitter_fast_copy__raw(fd,
> -					   fb->gem_handle,
> -					   fb->offsets[i],
> -					   fb->strides[i],
> -					   obj_tiling,
> -					   0, 0, /* src_x, src_y */
> -					   fb->plane_width[i], fb-
> >plane_height[i],
> -					   fb->plane_bpp[i],
> -					   linear->fb.gem_handle,
> -					   linear->fb.offsets[i],
> -					   linear->fb.strides[i],
> -					   I915_TILING_NONE,
> -					   0, 0 /* dst_x, dst_y */);
> +	blitcopy(&linear->fb, fb);
>  
>  	gem_sync(fd, linear->fb.gem_handle);
>  
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 17/25] lib/igt_fb: Remove the hand rolled addfb2
  2018-09-21 23:15   ` Paulo Zanoni
@ 2018-10-03 10:56     ` Petri Latvala
  0 siblings, 0 replies; 52+ messages in thread
From: Petri Latvala @ 2018-10-03 10:56 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: igt-dev

On Fri, Sep 21, 2018 at 04:15:34PM -0700, Paulo Zanoni wrote:
> Em Qui, 2018-07-19 às 18:04 +0300, Ville Syrjala escreveu:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Just use __kms_addfb() always instead of hand rolling another
> > drmModeAddFB2() usage. __kms_addfb() demands support for modifiers
> > but we've had that for a long time now so it's not a problem.
> 
> Dear IGT mainainers, do we have any specific rules/requirements about
> running new IGT in older Kernels? A minimum/maximum age?


Nothing specific written down. The thumb rule is that tests must
behave well on all kernels, and particularly well on at least
linus/master and a couple of LTS kernels.

What behave means is the gist of the question. If the poked interface
is not available, the test must skip, and otherwise it should produce
a pass/fail based on the observed effects; when the interface is used
like actual userspace would use it.

If I'm reading this right, this patch will change test results from
pass to skip on really really old kernels (how long is "a long time"
here?). In this particular case, Arek is telling me it's somewhere
around 3.19 so hey.

In the general case, considering the main use of IGT tests is
regression testing in CI, stable should already be in a working
condition (YMMV) so close to zero coverage is lost by requiring modern
stuff. As long as the change is towards skip, not towards failing.

tl;dr: Case-by-case basis, keep stuff working if you can, require more
if you must for making improvements in tests.



-- 
Petri Latvala


> 
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  lib/igt_fb.c | 35 +++++++----------------------------
> >  1 file changed, 7 insertions(+), 28 deletions(-)
> > 
> > diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> > index 77611b593a7e..648f0a318c91 100644
> > --- a/lib/igt_fb.c
> > +++ b/lib/igt_fb.c
> > @@ -856,6 +856,7 @@ igt_create_fb_with_bo_size(int fd, int width, int
> > height,
> >  	enum igt_color_encoding color_encoding =
> > IGT_COLOR_YCBCR_BT709;
> >  	enum igt_color_range color_range =
> > IGT_COLOR_YCBCR_LIMITED_RANGE;
> >  	struct format_desc_struct *f = lookup_drm_format(format);
> > +	uint32_t pitches[4];
> >  	uint32_t fb_id;
> >  	int i;
> >  
> > @@ -875,35 +876,13 @@ 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) {
> > -		uint32_t pitches[4];
> > -
> > -		for (i = 0; i < fb_num_planes(f); i++)
> > -			pitches[i] = fb->stride;
> > -
> > -		do_or_die(__kms_addfb(fd, fb->gem_handle, width,
> > height,
> > -				      format, tiling, pitches, fb-
> > >offsets,
> > -				      fb_num_planes(f),
> > -				      LOCAL_DRM_MODE_FB_MODIFIERS,
> > &fb_id));
> > -	} else {
> > -		uint32_t handles[4];
> > -		uint32_t pitches[4];
> > +	for (i = 0; i < fb_num_planes(f); i++)
> > +		pitches[i] = fb->stride;
> >  
> > -		memset(handles, 0, sizeof(handles));
> > -		memset(pitches, 0, sizeof(pitches));
> > -
> > -		handles[0] = fb->gem_handle;
> > -		pitches[0] = fb->stride;
> > -		for (i = 0; i < fb_num_planes(f); i++) {
> > -			handles[i] = fb->gem_handle;
> > -			pitches[i] = fb->stride;
> > -		}
> > -
> > -		do_or_die(drmModeAddFB2(fd, width, height, format,
> > -					handles, pitches, fb-
> > >offsets,
> > -					&fb_id, 0));
> > -	}
> > +	do_or_die(__kms_addfb(fd, fb->gem_handle, width, height,
> > +			      format, tiling, pitches, fb->offsets,
> 
> So the real difference is that we now pass "tiling" as a modifier as
> opposed to nothing, for the X and linear formats. A quick look at
> intel_framebuffer_init() suggests that this is fine (and required).
> 
> As long as maintainers don't block it:
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> But now __kms_addfb() is almost a reimplementation of of
> drmModeAddFB2WithModifiers(), maybe we could use it instead.
> 
> > +			      fb_num_planes(f),
> > +			      LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id));
> >  
> >  	fb->width = width;
> >  	fb->height = height;
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers
  2018-09-21 21:39     ` Paulo Zanoni
@ 2018-11-27 20:30       ` Kazlauskas, Nicholas
  2018-11-27 21:20         ` Ville Syrjälä
  0 siblings, 1 reply; 52+ messages in thread
From: Kazlauskas, Nicholas @ 2018-11-27 20:30 UTC (permalink / raw)
  To: Paulo Zanoni, Ville Syrjälä; +Cc: igt-dev, Ulrich Hecht

On 9/21/18 5:39 PM, Paulo Zanoni wrote:
> Em Sex, 2018-09-21 às 16:26 +0300, Ville Syrjälä escreveu:
>> On Thu, Sep 20, 2018 at 01:26:42PM -0700, Paulo Zanoni wrote:
>>> Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
>>>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>>>
>>>> For drivers that don't support the IN_FORMATS blob we should just
>>>> consult the format list returned by getplane. Since we can't know
>>>> which modifiers are supported we'll assume linear-only. Obviously
>>>> that may not work for every driver out there, but not much more
>>>> we can do unless we start to actually probing with addfb.
>>>
>>> Can you please elaborate on why we need that change? What exactly
>>> do we
>>> gain from it?
>>
>> We gain the ability to write tests without worrying about IN_FORMATS
>> everywhere.
>>
>>> IMHO there's always the worry that this could be misused
>>> in the future, restricting tests to linear only when other formats
>>> are
>>> indeed possible. Having NULL buffers crashing the test is a good
>>> way to
>>> prevent misuse.
>>
>> I don't know what kind of misuse you're thinking of. Actually not
>> sure what misuse in this context would mean really.
> 
> 
> Thinking that everything is linear only when in fact other formats are
> actually supported.
> 
> 
>>
>>>
>>> What if we populate plane->formats like we do here but leave plane-
>>>> modifiers NULL? It would allow other pieces of the code to rely
>>>> on the
>>>
>>> format list while not exposing the risk of the "linear only"
>>> incorrect
>>> restriction.
>>
>> So every test would have to check for !modifiers and come up with
>> some kind of fallback mechanism?
> 
> Yes, if IN_FORMATS is not present you have to fallback to the old "try
> it until you don't get an EINVAL". Isn't this the old protocol?
> 
> 
>>   What would such a fallback mechanism
>> even be other than "let's assume linear"?
> 
> The same mechanism we used before we created IN_FORMATS.
> 
> 
>>   I see no reason to inflict
>> that pain on every test that just wants to know "is this format
>> supported?".
> 
> The way I see, not populating a wrong table helps the test more than
> setting a table with data that may not reflect reality.
> 
>>
>> Also any driver that advertizes formats that don't support linear
>> and doesn't expose IN_FORMATS clearly doesn't care about supporting
>> driver/hw agnostic userspace, so having some tests fail for them
>> seems perfectly reasonable to me.
> 
> So older i915 didn't care about supporting driver/hw agnostic user
> space?
> 
>>
>>>
>>> That said, the patch is correct in the sense that it does what it
>>> proposes to do.
>>>
>>>>
>>>> Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
>>>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

This patch allows for the igt_plane_has_format_mod and 
igt_display_has_format_mod helpers to be used on drivers that don't 
support IN_FORMATS (amdgpu being an example).

The helpers are really useful for fixing up IGT tests that run and fail 
on hardware that isn't i915 but use i915 tiling modifiers. This allows 
helps remove a lot of the genid checks to see if y/yf tiling is supported.

Without this patch the supported modifier list for these helpers is 
empty so everything ends up skipping.

I've tested this patch with amdgpu along with the helpers and it works well.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>

>>>> ---
>>>>   lib/igt_kms.c | 22 +++++++++++++++++++++-
>>>>   1 file changed, 21 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>>>> index 476a786233c0..5641d8c1cf7c 100644
>>>> --- a/lib/igt_kms.c
>>>> +++ b/lib/igt_kms.c
>>>> @@ -4068,8 +4068,28 @@ static void
>>>> igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t
>>>> *plane
>>>>   	int idx = 0;
>>>>   	int count;
>>>>   
>>>> -	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS))
>>>> +	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS)) {
>>>> +		drmModePlanePtr p = plane->drm_plane;
>>>> +
>>>> +		count = p->count_formats;
>>>> +
>>>> +		plane->format_mod_count = count;
>>>> +		plane->formats = calloc(count, sizeof(plane-
>>>>> formats[0]));
>>>>
>>>> +		igt_assert(plane->formats);
>>>> +		plane->modifiers = calloc(count, sizeof(plane-
>>>>> modifiers[0]));
>>>>
>>>> +		igt_assert(plane->modifiers);
>>>> +
>>>> +		/*
>>>> +		 * We don't know which modifiers are
>>>> +		 * supported, so we'll assume linear only.
>>>> +		 */
>>>> +		for (int i = 0; i < count; i++) {
>>>> +			plane->formats[i] = p->formats[i];
>>>> +			plane->modifiers[i] =
>>>> DRM_FORMAT_MOD_LINEAR;
>>>> +		}
>>>> +
>>>>   		return;
>>>> +	}
>>>>   
>>>>   	blob_id = igt_plane_get_prop(plane,
>>>> IGT_PLANE_IN_FORMATS);
>>>>   
>>
>>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
> 

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers
  2018-11-27 20:30       ` Kazlauskas, Nicholas
@ 2018-11-27 21:20         ` Ville Syrjälä
  0 siblings, 0 replies; 52+ messages in thread
From: Ville Syrjälä @ 2018-11-27 21:20 UTC (permalink / raw)
  To: Kazlauskas, Nicholas; +Cc: igt-dev, Ulrich Hecht

On Tue, Nov 27, 2018 at 08:30:39PM +0000, Kazlauskas, Nicholas wrote:
> On 9/21/18 5:39 PM, Paulo Zanoni wrote:
> > Em Sex, 2018-09-21 às 16:26 +0300, Ville Syrjälä escreveu:
> >> On Thu, Sep 20, 2018 at 01:26:42PM -0700, Paulo Zanoni wrote:
> >>> Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> >>>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >>>>
> >>>> For drivers that don't support the IN_FORMATS blob we should just
> >>>> consult the format list returned by getplane. Since we can't know
> >>>> which modifiers are supported we'll assume linear-only. Obviously
> >>>> that may not work for every driver out there, but not much more
> >>>> we can do unless we start to actually probing with addfb.
> >>>
> >>> Can you please elaborate on why we need that change? What exactly
> >>> do we
> >>> gain from it?
> >>
> >> We gain the ability to write tests without worrying about IN_FORMATS
> >> everywhere.
> >>
> >>> IMHO there's always the worry that this could be misused
> >>> in the future, restricting tests to linear only when other formats
> >>> are
> >>> indeed possible. Having NULL buffers crashing the test is a good
> >>> way to
> >>> prevent misuse.
> >>
> >> I don't know what kind of misuse you're thinking of. Actually not
> >> sure what misuse in this context would mean really.
> > 
> > 
> > Thinking that everything is linear only when in fact other formats are
> > actually supported.
> > 
> > 
> >>
> >>>
> >>> What if we populate plane->formats like we do here but leave plane-
> >>>> modifiers NULL? It would allow other pieces of the code to rely
> >>>> on the
> >>>
> >>> format list while not exposing the risk of the "linear only"
> >>> incorrect
> >>> restriction.
> >>
> >> So every test would have to check for !modifiers and come up with
> >> some kind of fallback mechanism?
> > 
> > Yes, if IN_FORMATS is not present you have to fallback to the old "try
> > it until you don't get an EINVAL". Isn't this the old protocol?
> > 
> > 
> >>   What would such a fallback mechanism
> >> even be other than "let's assume linear"?
> > 
> > The same mechanism we used before we created IN_FORMATS.
> > 
> > 
> >>   I see no reason to inflict
> >> that pain on every test that just wants to know "is this format
> >> supported?".
> > 
> > The way I see, not populating a wrong table helps the test more than
> > setting a table with data that may not reflect reality.
> > 
> >>
> >> Also any driver that advertizes formats that don't support linear
> >> and doesn't expose IN_FORMATS clearly doesn't care about supporting
> >> driver/hw agnostic userspace, so having some tests fail for them
> >> seems perfectly reasonable to me.
> > 
> > So older i915 didn't care about supporting driver/hw agnostic user
> > space?
> > 
> >>
> >>>
> >>> That said, the patch is correct in the sense that it does what it
> >>> proposes to do.
> >>>
> >>>>
> >>>> Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> >>>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> This patch allows for the igt_plane_has_format_mod and 
> igt_display_has_format_mod helpers to be used on drivers that don't 
> support IN_FORMATS (amdgpu being an example).
> 
> The helpers are really useful for fixing up IGT tests that run and fail 
> on hardware that isn't i915 but use i915 tiling modifiers. This allows 
> helps remove a lot of the genid checks to see if y/yf tiling is supported.
> 
> Without this patch the supported modifier list for these helpers is 
> empty so everything ends up skipping.
> 
> I've tested this patch with amdgpu along with the helpers and it works well.
> 
> Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>

Thanks. Pushed.

> 
> >>>> ---
> >>>>   lib/igt_kms.c | 22 +++++++++++++++++++++-
> >>>>   1 file changed, 21 insertions(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> >>>> index 476a786233c0..5641d8c1cf7c 100644
> >>>> --- a/lib/igt_kms.c
> >>>> +++ b/lib/igt_kms.c
> >>>> @@ -4068,8 +4068,28 @@ static void
> >>>> igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t
> >>>> *plane
> >>>>   	int idx = 0;
> >>>>   	int count;
> >>>>   
> >>>> -	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS))
> >>>> +	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS)) {
> >>>> +		drmModePlanePtr p = plane->drm_plane;
> >>>> +
> >>>> +		count = p->count_formats;
> >>>> +
> >>>> +		plane->format_mod_count = count;
> >>>> +		plane->formats = calloc(count, sizeof(plane-
> >>>>> formats[0]));
> >>>>
> >>>> +		igt_assert(plane->formats);
> >>>> +		plane->modifiers = calloc(count, sizeof(plane-
> >>>>> modifiers[0]));
> >>>>
> >>>> +		igt_assert(plane->modifiers);
> >>>> +
> >>>> +		/*
> >>>> +		 * We don't know which modifiers are
> >>>> +		 * supported, so we'll assume linear only.
> >>>> +		 */
> >>>> +		for (int i = 0; i < count; i++) {
> >>>> +			plane->formats[i] = p->formats[i];
> >>>> +			plane->modifiers[i] =
> >>>> DRM_FORMAT_MOD_LINEAR;
> >>>> +		}
> >>>> +
> >>>>   		return;
> >>>> +	}
> >>>>   
> >>>>   	blob_id = igt_plane_get_prop(plane,
> >>>> IGT_PLANE_IN_FORMATS);
> >>>>   
> >>
> >>
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> > 
> 

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2018-11-27 21:20 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 02/25] tests/kms_ccs: Use igt_plane_has_format_mod() Ville Syrjala
2018-09-20 20:56   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 03/25] tests/kms_plane: Add validate-in-formats subtest Ville Syrjala
2018-09-20 21:10   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 04/25] tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats Ville Syrjala
2018-09-20 23:36   ` Paulo Zanoni
2018-09-21 13:37     ` Ville Syrjälä
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 05/25] tests/gem_render_copy: Fix clipped height Ville Syrjala
2018-08-24  3:17   ` Dhinakaran Pandiyan
2018-08-28 14:21     ` Ville Syrjälä
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 06/25] lib/igt_fb: Respect the users choice of stride Ville Syrjala
2018-09-21  0:04   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 07/25] lib: Add DIV_ROUND_UP() Ville Syrjala
2018-09-18 21:17   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 08/25] lib/igt_fb: Use fb_blit_upload as the base class for fb_convert_blit_upload Ville Syrjala
2018-09-21  0:15   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 09/25] lib/igt_fb: Pass fb_blit_upload to free_linear_mapping() Ville Syrjala
2018-09-21  0:20   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 10/25] lib/igt_fb: s/planar_foo/fb_plane_foo/ Ville Syrjala
2018-09-21 21:58   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 11/25] lib/igt_fb: Add fb_plane_bpp() Ville Syrjala
2018-09-21 22:02   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 12/25] lib/igt_fb: Add fb_num_planes() Ville Syrjala
2018-09-21 22:05   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 13/25] lib/igt_fb: Extract calc_plane_stride() Ville Syrjala
2018-09-21 22:33   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 14/25] lib/igt_fb: Consolidate fb size calculation to one function Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 15/25] lib/kms: Pass strides[] to __kms_addfb Ville Syrjala
2018-09-21 22:45   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 16/25] lib/kms: Pass the number of planes explicitly to __kms_addfb() Ville Syrjala
2018-09-21 22:54   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 17/25] lib/igt_fb: Remove the hand rolled addfb2 Ville Syrjala
2018-09-21 23:15   ` Paulo Zanoni
2018-10-03 10:56     ` Petri Latvala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 18/25] lib/igt_fb: Constify format_desc_struct Ville Syrjala
2018-09-21 23:20   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 19/25] lib/igt_fb: Pass around igt_fb internally Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 20/25] lib/igt_fb: Refactor blitter usage Ville Syrjala
2018-09-21 23:48   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 21/25] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 22/25] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 23/25] tests/gem_render_copy: Test Yf tiling Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 24/25] lib/igt_fb: Use rendercopy for rendering into compressed buffers Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 25/25] tests/kms_plane: Test all modifiers as well Ville Syrjala
2018-07-19 15:26 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Patchwork
2018-07-19 17:40 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-09-20 20:26 ` [igt-dev] [PATCH i-g-t 01/25] " Paulo Zanoni
2018-09-21 13:26   ` Ville Syrjälä
2018-09-21 21:39     ` Paulo Zanoni
2018-11-27 20:30       ` Kazlauskas, Nicholas
2018-11-27 21:20         ` Ville Syrjälä

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.