All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/8] drm/i915: GTT remapping for display
@ 2019-05-09 12:21 Ville Syrjala
  2019-05-09 12:21 ` [PATCH v4 1/8] drm/i915: Add a new "remapped" gtt_view Ville Syrjala
                   ` (11 more replies)
  0 siblings, 12 replies; 19+ messages in thread
From: Ville Syrjala @ 2019-05-09 12:21 UTC (permalink / raw)
  To: intel-gfx

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

Here's a new version of the GTT remapping series.

Changes since last time:
- Split up some code shuffling from the main patch
- Made the dumb stride alignment proper
- Finished the test case
- Fixed a few bugs found in testing

The one thing I didn't do is make remapping always happen.
The main reason is that it would break FBC, and I don't
want to rewrite the FBC code right now.

Test-with: 20190508162906.20808-1-ville.syrjala@linux.intel.com

Ville Syrjälä (8):
  drm/i915: Add a new "remapped" gtt_view
  drm/i915/selftests: Add mock selftest for remapped vmas
  drm/i915/selftests: Add live vma selftest
  drm/i915: Shuffle stride checking code around
  drm/i915: Overcome display engine stride limits via GTT remapping
  drm/i915: Align dumb buffer stride to 4k to allow for gtt remapping
  drm/i915: Bump fb stride limit to 128KiB for gen4+ and 256KiB for
    gen7+
  drm/i915: Bump gen7+ fb size limits to 16kx16k

 drivers/gpu/drm/i915/i915_debugfs.c           |  12 +
 drivers/gpu/drm/i915/i915_drv.h               |   4 +
 drivers/gpu/drm/i915/i915_gem.c               |  43 +-
 drivers/gpu/drm/i915/i915_gem_gtt.c           |  88 ++++
 drivers/gpu/drm/i915/i915_gem_gtt.h           |  25 +-
 drivers/gpu/drm/i915/i915_vma.c               |  10 +-
 drivers/gpu/drm/i915/i915_vma.h               |   3 +
 drivers/gpu/drm/i915/intel_display.c          | 453 ++++++++++++++----
 drivers/gpu/drm/i915/intel_display.h          |   4 +
 drivers/gpu/drm/i915/intel_drv.h              |   1 +
 drivers/gpu/drm/i915/intel_sprite.c           |  34 +-
 .../drm/i915/selftests/i915_live_selftests.h  |   1 +
 drivers/gpu/drm/i915/selftests/i915_vma.c     | 246 +++++++++-
 13 files changed, 798 insertions(+), 126 deletions(-)

-- 
2.21.0

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

^ permalink raw reply	[flat|nested] 19+ messages in thread
* [PATCH v3 2/8] drm/i915/selftests: Add mock selftest for remapped vmas
@ 2019-01-18 15:27 Ville Syrjala
  2019-01-24 18:58 ` [PATCH v4 " Ville Syrjala
  0 siblings, 1 reply; 19+ messages in thread
From: Ville Syrjala @ 2019-01-18 15:27 UTC (permalink / raw)
  To: intel-gfx

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

Extend the rotated vma mock selftest to cover remapped vmas as
well.

TODO: reindent the loops I guess? Left like this for now to
ease review

v2: Include the vma type in the error message (Chris)
v3: Deal with trimmed sg

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_vma.c | 105 ++++++++++++++++++++--
 1 file changed, 97 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c b/drivers/gpu/drm/i915/selftests/i915_vma.c
index 4fc49c27f13c..063143fa51bf 100644
--- a/drivers/gpu/drm/i915/selftests/i915_vma.c
+++ b/drivers/gpu/drm/i915/selftests/i915_vma.c
@@ -58,7 +58,7 @@ static bool assert_vma(struct i915_vma *vma,
 static struct i915_vma *
 checked_vma_instance(struct drm_i915_gem_object *obj,
 		     struct i915_address_space *vm,
-		     struct i915_ggtt_view *view)
+		     const struct i915_ggtt_view *view)
 {
 	struct i915_vma *vma;
 	bool ok = true;
@@ -395,13 +395,81 @@ assert_rotated(struct drm_i915_gem_object *obj,
 	return sg;
 }
 
+static unsigned long remapped_index(const struct intel_remapped_info *r,
+				    unsigned int n,
+				    unsigned int x,
+				    unsigned int y)
+{
+	return (r->plane[n].stride * y +
+		r->plane[n].offset + x);
+}
+
+static struct scatterlist *
+assert_remapped(struct drm_i915_gem_object *obj,
+		const struct intel_remapped_info *r, unsigned int n,
+		struct scatterlist *sg)
+{
+	unsigned int x, y;
+	unsigned int left = 0;
+	unsigned int offset;
+
+	for (y = 0; y < r->plane[n].height; y++) {
+		for (x = 0; x < r->plane[n].width; x++) {
+			unsigned long src_idx;
+			dma_addr_t src;
+
+			if (!sg) {
+				pr_err("Invalid sg table: too short at plane %d, (%d, %d)!\n",
+				       n, x, y);
+				return ERR_PTR(-EINVAL);
+			}
+			if (!left) {
+				offset = 0;
+				left = sg_dma_len(sg);
+			}
+
+			DRM_DEBUG_KMS("sg %p start left %d\n", sg, left);
+
+			src_idx = remapped_index(r, n, x, y);
+			src = i915_gem_object_get_dma_address(obj, src_idx);
+
+			DRM_DEBUG_KMS("sg %p %d %d %d %llx\n", sg, n, x, y, src);
+
+			if (left < PAGE_SIZE || left & (PAGE_SIZE-1)) {
+				pr_err("Invalid sg.length, found %d, expected %lu for remapped page (%d, %d) [src index %lu]\n",
+				       sg_dma_len(sg), PAGE_SIZE,
+				       x, y, src_idx);
+				return ERR_PTR(-EINVAL);
+			}
+
+			DRM_DEBUG_KMS("sg %p dma %llx off = %d\n", sg, sg_dma_address(sg), offset);
+
+			if (sg_dma_address(sg) + offset != src) {
+				pr_err("Invalid address for remapped page (%d, %d) [src index %lu]\n",
+				       x, y, src_idx);
+				return ERR_PTR(-EINVAL);
+			}
+			DRM_DEBUG_KMS("sg %p end left %d\n", sg, left);
+
+			left -= PAGE_SIZE;
+			offset += PAGE_SIZE;
+
+
+			if (!left)
+				sg = sg_next(sg);
+		}
+	}
+
+	return sg;
+}
+
 static unsigned int rotated_size(const struct intel_remapped_plane_info *a,
 				 const struct intel_remapped_plane_info *b)
 {
 	return a->width * a->height + b->width * b->height;
 }
 
-static int igt_vma_rotate(void *arg)
+static int igt_vma_rotate_remap(void *arg)
 {
 	struct drm_i915_private *i915 = arg;
 	struct i915_address_space *vm = &i915->ggtt.vm;
@@ -424,6 +492,11 @@ static int igt_vma_rotate(void *arg)
 		{ .width = 6, .height = 4, .stride = 6 },
 		{ }
 	}, *a, *b;
+	enum i915_ggtt_view_type types[] = {
+		I915_GGTT_VIEW_ROTATED,
+		I915_GGTT_VIEW_REMAPPED,
+		0,
+	}, *t;
 	const unsigned int max_pages = 64;
 	int err = -ENOMEM;
 
@@ -435,6 +508,7 @@ static int igt_vma_rotate(void *arg)
 	if (IS_ERR(obj))
 		goto out;
 
+	for (t = types; *t; t++) {
 	for (a = planes; a->width; a++) {
 		for (b = planes + ARRAY_SIZE(planes); b-- != planes; ) {
 			struct i915_ggtt_view view;
@@ -445,7 +519,7 @@ static int igt_vma_rotate(void *arg)
 			GEM_BUG_ON(max_offset > max_pages);
 			max_offset = max_pages - max_offset;
 
-			view.type = I915_GGTT_VIEW_ROTATED;
+			view.type = *t;
 			view.rotated.plane[0] = *a;
 			view.rotated.plane[1] = *b;
 
@@ -466,14 +540,23 @@ static int igt_vma_rotate(void *arg)
 						goto out_object;
 					}
 
-					if (vma->size != rotated_size(a, b) * PAGE_SIZE) {
+					if (view.type == I915_GGTT_VIEW_ROTATED &&
+					    vma->size != rotated_size(a, b) * PAGE_SIZE) {
 						pr_err("VMA is wrong size, expected %lu, found %llu\n",
 						       PAGE_SIZE * rotated_size(a, b), vma->size);
 						err = -EINVAL;
 						goto out_object;
 					}
 
-					if (vma->pages->nents != rotated_size(a, b)) {
+					if (view.type == I915_GGTT_VIEW_REMAPPED &&
+					    vma->size > rotated_size(a, b) * PAGE_SIZE) {
+						pr_err("VMA is wrong size, expected %lu, found %llu\n",
+						       PAGE_SIZE * rotated_size(a, b), vma->size);
+						err = -EINVAL;
+						goto out_object;
+					}
+
+					if (vma->pages->nents > rotated_size(a, b)) {
 						pr_err("sg table is wrong sizeo, expected %u, found %u nents\n",
 						       rotated_size(a, b), vma->pages->nents);
 						err = -EINVAL;
@@ -495,9 +578,14 @@ static int igt_vma_rotate(void *arg)
 
 					sg = vma->pages->sgl;
 					for (n = 0; n < ARRAY_SIZE(view.rotated.plane); n++) {
-						sg = assert_rotated(obj, &view.rotated, n, sg);
+						if (view.type == I915_GGTT_VIEW_ROTATED)
+							sg = assert_rotated(obj, &view.rotated, n, sg);
+						else
+							sg = assert_remapped(obj, &view.remapped, n, sg);
 						if (IS_ERR(sg)) {
-							pr_err("Inconsistent VMA pages for plane %d: [(%d, %d, %d, %d), (%d, %d, %d, %d)]\n", n,
+							pr_err("Inconsistent %s VMA pages for plane %d: [(%d, %d, %d, %d), (%d, %d, %d, %d)]\n",
+							       view.type == I915_GGTT_VIEW_ROTATED ?
+							       "rotated" : "remapped", n,
 							       view.rotated.plane[0].width,
 							       view.rotated.plane[0].height,
 							       view.rotated.plane[0].stride,
@@ -516,6 +604,7 @@ static int igt_vma_rotate(void *arg)
 			}
 		}
 	}
+	}
 
 out_object:
 	i915_gem_object_put(obj);
@@ -719,7 +808,7 @@ int i915_vma_mock_selftests(void)
 	static const struct i915_subtest tests[] = {
 		SUBTEST(igt_vma_create),
 		SUBTEST(igt_vma_pin1),
-		SUBTEST(igt_vma_rotate),
+		SUBTEST(igt_vma_rotate_remap),
 		SUBTEST(igt_vma_partial),
 	};
 	struct drm_i915_private *i915;
-- 
2.19.2

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

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

end of thread, other threads:[~2019-05-20 15:14 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-09 12:21 [PATCH v4 0/8] drm/i915: GTT remapping for display Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 1/8] drm/i915: Add a new "remapped" gtt_view Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 2/8] drm/i915/selftests: Add mock selftest for remapped vmas Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 3/8] drm/i915/selftests: Add live vma selftest Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 4/8] drm/i915: Shuffle stride checking code around Ville Syrjala
2019-05-10  8:37   ` Daniel Vetter
2019-05-09 12:21 ` [PATCH v4 5/8] drm/i915: Overcome display engine stride limits via GTT remapping Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 6/8] drm/i915: Align dumb buffer stride to 4k to allow for gtt remapping Ville Syrjala
2019-05-10  8:40   ` Daniel Vetter
2019-05-09 12:21 ` [PATCH v4 7/8] drm/i915: Bump fb stride limit to 128KiB for gen4+ and 256KiB for gen7+ Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 8/8] drm/i915: Bump gen7+ fb size limits to 16kx16k Ville Syrjala
2019-05-16 16:33   ` Maarten Lankhorst
2019-05-20 15:14     ` Ville Syrjälä
2019-05-09 14:54 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: GTT remapping for display Patchwork
2019-05-09 14:58 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-05-09 15:14 ` ✓ Fi.CI.BAT: success " Patchwork
2019-05-09 23:36 ` ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-01-18 15:27 [PATCH v3 2/8] drm/i915/selftests: Add mock selftest for remapped vmas Ville Syrjala
2019-01-24 18:58 ` [PATCH v4 " Ville Syrjala
2019-01-24 23:22   ` Chris Wilson

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.