All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object
@ 2016-12-22 10:56 Chris Wilson
  2016-12-22 10:56 ` [PATCH 2/5] drm/i915: Convert i915_ggtt_view to use an anonymous union Chris Wilson
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Chris Wilson @ 2016-12-22 10:56 UTC (permalink / raw)
  To: intel-gfx

When creating a partial VMA assert that it first fits with the parent
object, and that if it covers the whole of the parent a normal view was
created instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_vma.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index cfec4222b04e..3229f37eabea 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -95,8 +95,13 @@ __i915_vma_create(struct drm_i915_gem_object *obj,
 	if (view) {
 		vma->ggtt_view = *view;
 		if (view->type == I915_GGTT_VIEW_PARTIAL) {
+			GEM_BUG_ON(range_overflows_t(u64,
+						     view->params.partial.offset,
+						     view->params.partial.size,
+						     obj->base.size >> PAGE_SHIFT));
 			vma->size = view->params.partial.size;
 			vma->size <<= PAGE_SHIFT;
+			GEM_BUG_ON(vma->size >= obj->base.size);
 		} else if (view->type == I915_GGTT_VIEW_ROTATED) {
 			vma->size =
 				intel_rotation_info_size(&view->params.rotated);
-- 
2.11.0

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

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

* [PATCH 2/5] drm/i915: Convert i915_ggtt_view to use an anonymous union
  2016-12-22 10:56 [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Chris Wilson
@ 2016-12-22 10:56 ` Chris Wilson
  2016-12-22 11:24   ` Joonas Lahtinen
  2016-12-22 10:56 ` [PATCH 3/5] drm/i915: Eliminate superfluous i915_ggtt_view_rotated Chris Wilson
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Chris Wilson @ 2016-12-22 10:56 UTC (permalink / raw)
  To: intel-gfx

Save a lot of characters by making the union anonymous, with the
side-effect of ignoring unset bits when comparing views.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c      |  8 ++++----
 drivers/gpu/drm/i915/i915_gem_gtt.c  |  9 ++++-----
 drivers/gpu/drm/i915/i915_gem_gtt.h  |  2 +-
 drivers/gpu/drm/i915/i915_vma.c      |  9 ++++-----
 drivers/gpu/drm/i915/i915_vma.h      | 15 ++++++++++++---
 drivers/gpu/drm/i915/intel_display.c |  2 +-
 6 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 32da5ac29cdb..a0dc8cbc2aa4 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1865,10 +1865,10 @@ int i915_gem_fault(struct vm_area_struct *area, struct vm_fault *vmf)
 
 		memset(&view, 0, sizeof(view));
 		view.type = I915_GGTT_VIEW_PARTIAL;
-		view.params.partial.offset = rounddown(page_offset, chunk_size);
-		view.params.partial.size =
+		view.partial.offset = rounddown(page_offset, chunk_size);
+		view.partial.size =
 			min_t(unsigned int, chunk_size,
-			      vma_pages(area) - view.params.partial.offset);
+			      vma_pages(area) - view.partial.offset);
 
 		/* If the partial covers the entire object, just create a
 		 * normal VMA.
@@ -1903,7 +1903,7 @@ int i915_gem_fault(struct vm_area_struct *area, struct vm_fault *vmf)
 
 	/* Finally, remap it using the new GTT offset */
 	ret = remap_io_mapping(area,
-			       area->vm_start + (vma->ggtt_view.params.partial.offset << PAGE_SHIFT),
+			       area->vm_start + (vma->ggtt_view.partial.offset << PAGE_SHIFT),
 			       (ggtt->mappable_base + vma->node.start) >> PAGE_SHIFT,
 			       min_t(u64, vma->size, area->vm_end - area->vm_start),
 			       &ggtt->mappable);
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 5eda33c17abc..d6fa8f740f23 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -3457,7 +3457,7 @@ intel_partial_pages(const struct i915_ggtt_view *view,
 {
 	struct sg_table *st;
 	struct scatterlist *sg, *iter;
-	unsigned int count = view->params.partial.size;
+	unsigned int count = view->partial.size;
 	unsigned int offset;
 	int ret = -ENOMEM;
 
@@ -3469,9 +3469,7 @@ intel_partial_pages(const struct i915_ggtt_view *view,
 	if (ret)
 		goto err_sg_alloc;
 
-	iter = i915_gem_object_get_sg(obj,
-				      view->params.partial.offset,
-				      &offset);
+	iter = i915_gem_object_get_sg(obj, view->partial.offset, &offset);
 	GEM_BUG_ON(!iter);
 
 	sg = st->sgl;
@@ -3523,7 +3521,8 @@ i915_get_ggtt_vma_pages(struct i915_vma *vma)
 		vma->pages = vma->obj->mm.pages;
 	else if (vma->ggtt_view.type == I915_GGTT_VIEW_ROTATED)
 		vma->pages =
-			intel_rotate_fb_obj_pages(&vma->ggtt_view.params.rotated, vma->obj);
+			intel_rotate_fb_obj_pages(&vma->ggtt_view.rotated,
+						  vma->obj);
 	else if (vma->ggtt_view.type == I915_GGTT_VIEW_PARTIAL)
 		vma->pages = intel_partial_pages(&vma->ggtt_view, vma->obj);
 	else
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 4c7bef07e38a..25614feccdba 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -164,7 +164,7 @@ struct i915_ggtt_view {
 			unsigned int size;
 		} partial;
 		struct intel_rotation_info rotated;
-	} params;
+	};
 };
 
 extern const struct i915_ggtt_view i915_ggtt_view_normal;
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 3229f37eabea..4c8f545d15ff 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -96,15 +96,14 @@ __i915_vma_create(struct drm_i915_gem_object *obj,
 		vma->ggtt_view = *view;
 		if (view->type == I915_GGTT_VIEW_PARTIAL) {
 			GEM_BUG_ON(range_overflows_t(u64,
-						     view->params.partial.offset,
-						     view->params.partial.size,
+						     view->partial.offset,
+						     view->partial.size,
 						     obj->base.size >> PAGE_SHIFT));
-			vma->size = view->params.partial.size;
+			vma->size = view->partial.size;
 			vma->size <<= PAGE_SHIFT;
 			GEM_BUG_ON(vma->size >= obj->base.size);
 		} else if (view->type == I915_GGTT_VIEW_ROTATED) {
-			vma->size =
-				intel_rotation_info_size(&view->params.rotated);
+			vma->size = intel_rotation_info_size(&view->rotated);
 			vma->size <<= PAGE_SHIFT;
 		}
 	}
diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
index e3b2b3b1e056..edd8b2647eb7 100644
--- a/drivers/gpu/drm/i915/i915_vma.h
+++ b/drivers/gpu/drm/i915/i915_vma.h
@@ -202,9 +202,18 @@ i915_vma_compare(struct i915_vma *vma,
 	if (vma->ggtt_view.type != view->type)
 		return vma->ggtt_view.type - view->type;
 
-	return memcmp(&vma->ggtt_view.params,
-		      &view->params,
-		      sizeof(view->params));
+	switch (view->type) {
+	case I915_GGTT_VIEW_ROTATED:
+		return memcmp(&vma->ggtt_view.rotated,
+			      &view->rotated,
+			      sizeof(view->rotated));
+	case I915_GGTT_VIEW_PARTIAL:
+		return memcmp(&vma->ggtt_view.partial,
+			      &view->partial,
+			      sizeof(view->partial));
+	default:
+		return 0;
+	}
 }
 
 int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ef5dde5ab1cf..3608787730c4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2140,7 +2140,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,
 {
 	if (drm_rotation_90_or_270(rotation)) {
 		*view = i915_ggtt_view_rotated;
-		view->params.rotated = to_intel_framebuffer(fb)->rot_info;
+		view->rotated = to_intel_framebuffer(fb)->rot_info;
 	} else {
 		*view = i915_ggtt_view_normal;
 	}
-- 
2.11.0

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

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

* [PATCH 3/5] drm/i915: Eliminate superfluous i915_ggtt_view_rotated
  2016-12-22 10:56 [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Chris Wilson
  2016-12-22 10:56 ` [PATCH 2/5] drm/i915: Convert i915_ggtt_view to use an anonymous union Chris Wilson
@ 2016-12-22 10:56 ` Chris Wilson
  2016-12-22 11:20   ` Joonas Lahtinen
  2016-12-22 10:56 ` [PATCH 4/5] drm/i915: Eliminate superfluous i915_ggtt_view_normal Chris Wilson
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Chris Wilson @ 2016-12-22 10:56 UTC (permalink / raw)
  To: intel-gfx

It is only being used to clear a struct and set the type, after which it
is overwritten. Since we no longer check the unset bits of the union,
skipping the clear is permissible.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c  | 3 ---
 drivers/gpu/drm/i915/i915_gem_gtt.h  | 1 -
 drivers/gpu/drm/i915/intel_display.c | 5 ++---
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index d6fa8f740f23..c2a79eb6f40c 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -102,9 +102,6 @@ i915_get_ggtt_vma_pages(struct i915_vma *vma);
 const struct i915_ggtt_view i915_ggtt_view_normal = {
 	.type = I915_GGTT_VIEW_NORMAL,
 };
-const struct i915_ggtt_view i915_ggtt_view_rotated = {
-	.type = I915_GGTT_VIEW_ROTATED,
-};
 
 int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
 			       	int enable_ppgtt)
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 25614feccdba..2af09cc63186 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -168,7 +168,6 @@ struct i915_ggtt_view {
 };
 
 extern const struct i915_ggtt_view i915_ggtt_view_normal;
-extern const struct i915_ggtt_view i915_ggtt_view_rotated;
 
 enum i915_cache_level;
 
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3608787730c4..f37b2c6e823a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2138,11 +2138,10 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,
 			const struct drm_framebuffer *fb,
 			unsigned int rotation)
 {
+	view->type = I915_GGTT_VIEW_NORMAL;
 	if (drm_rotation_90_or_270(rotation)) {
-		*view = i915_ggtt_view_rotated;
+		view->type = I915_GGTT_VIEW_ROTATED;
 		view->rotated = to_intel_framebuffer(fb)->rot_info;
-	} else {
-		*view = i915_ggtt_view_normal;
 	}
 }
 
-- 
2.11.0

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

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

* [PATCH 4/5] drm/i915: Eliminate superfluous i915_ggtt_view_normal
  2016-12-22 10:56 [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Chris Wilson
  2016-12-22 10:56 ` [PATCH 2/5] drm/i915: Convert i915_ggtt_view to use an anonymous union Chris Wilson
  2016-12-22 10:56 ` [PATCH 3/5] drm/i915: Eliminate superfluous i915_ggtt_view_rotated Chris Wilson
@ 2016-12-22 10:56 ` Chris Wilson
  2016-12-22 11:09   ` Joonas Lahtinen
  2016-12-22 10:56 ` [PATCH 5/5] drm/i915: Extact compute_partial_view() Chris Wilson
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Chris Wilson @ 2016-12-22 10:56 UTC (permalink / raw)
  To: intel-gfx

Since commit 058d88c4330f ("drm/i915: Track pinned VMA"), there is only
one user of i915_ggtt_view_normal rodate. Just treat NULL as no special
view in pin_to_display() like everywhere else.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c      | 2 +-
 drivers/gpu/drm/i915/i915_gem_gtt.c  | 4 ----
 drivers/gpu/drm/i915/i915_gem_gtt.h  | 2 --
 drivers/gpu/drm/i915/intel_overlay.c | 3 +--
 4 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a0dc8cbc2aa4..62719124840a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3513,7 +3513,7 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
 	 * try to preserve the existing ABI).
 	 */
 	vma = ERR_PTR(-ENOSPC);
-	if (view->type == I915_GGTT_VIEW_NORMAL)
+	if (!view || view->type == I915_GGTT_VIEW_NORMAL)
 		vma = i915_gem_object_ggtt_pin(obj, view, 0, alignment,
 					       PIN_MAPPABLE | PIN_NONBLOCK);
 	if (IS_ERR(vma)) {
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index c2a79eb6f40c..3d6e151e5d7a 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -99,10 +99,6 @@
 static int
 i915_get_ggtt_vma_pages(struct i915_vma *vma);
 
-const struct i915_ggtt_view i915_ggtt_view_normal = {
-	.type = I915_GGTT_VIEW_NORMAL,
-};
-
 int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
 			       	int enable_ppgtt)
 {
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 2af09cc63186..9ae9aa8aea2b 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -167,8 +167,6 @@ struct i915_ggtt_view {
 	};
 };
 
-extern const struct i915_ggtt_view i915_ggtt_view_normal;
-
 enum i915_cache_level;
 
 struct i915_vma;
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 489c14ff2cb9..934dafa9dfa1 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -753,8 +753,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
 	if (ret != 0)
 		return ret;
 
-	vma = i915_gem_object_pin_to_display_plane(new_bo, 0,
-						   &i915_ggtt_view_normal);
+	vma = i915_gem_object_pin_to_display_plane(new_bo, 0, NULL);
 	if (IS_ERR(vma))
 		return PTR_ERR(vma);
 
-- 
2.11.0

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

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

* [PATCH 5/5] drm/i915: Extact compute_partial_view()
  2016-12-22 10:56 [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Chris Wilson
                   ` (2 preceding siblings ...)
  2016-12-22 10:56 ` [PATCH 4/5] drm/i915: Eliminate superfluous i915_ggtt_view_normal Chris Wilson
@ 2016-12-22 10:56 ` Chris Wilson
  2016-12-22 11:14   ` Joonas Lahtinen
  2016-12-22 11:02 ` [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Joonas Lahtinen
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Chris Wilson @ 2016-12-22 10:56 UTC (permalink / raw)
  To: intel-gfx

In order to reuse the partial view for selftesting, extract the common
function for computing the view.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c | 48 +++++++++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 62719124840a..2ce53fec9ef9 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1778,6 +1778,32 @@ int i915_gem_mmap_gtt_version(void)
 	return 1;
 }
 
+static inline struct i915_ggtt_view
+compute_partial_view(struct drm_i915_gem_object *obj,
+		     struct vm_area_struct *area,
+		     pgoff_t page_offset,
+		     unsigned int chunk_size)
+{
+	struct i915_ggtt_view view;
+
+	if (i915_gem_object_is_tiled(obj))
+		chunk_size = roundup(chunk_size, tile_row_pages(obj));
+
+	view.type = I915_GGTT_VIEW_PARTIAL;
+	view.partial.offset = rounddown(page_offset, chunk_size);
+	view.partial.size =
+		min_t(unsigned int, chunk_size,
+		      vma_pages(area) - view.partial.offset);
+
+	/* If the partial covers the entire object, just create a
+	 * normal VMA.
+	 */
+	if (chunk_size >= obj->base.size >> PAGE_SHIFT)
+		view.type = I915_GGTT_VIEW_NORMAL;
+
+	return view;
+}
+
 /**
  * i915_gem_fault - fault a page into the GTT
  * @area: CPU VMA in question
@@ -1855,26 +1881,10 @@ int i915_gem_fault(struct vm_area_struct *area, struct vm_fault *vmf)
 	/* Now pin it into the GTT as needed */
 	vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, flags);
 	if (IS_ERR(vma)) {
-		struct i915_ggtt_view view;
-		unsigned int chunk_size;
-
 		/* Use a partial view if it is bigger than available space */
-		chunk_size = MIN_CHUNK_PAGES;
-		if (i915_gem_object_is_tiled(obj))
-			chunk_size = roundup(chunk_size, tile_row_pages(obj));
-
-		memset(&view, 0, sizeof(view));
-		view.type = I915_GGTT_VIEW_PARTIAL;
-		view.partial.offset = rounddown(page_offset, chunk_size);
-		view.partial.size =
-			min_t(unsigned int, chunk_size,
-			      vma_pages(area) - view.partial.offset);
-
-		/* If the partial covers the entire object, just create a
-		 * normal VMA.
-		 */
-		if (chunk_size >= obj->base.size >> PAGE_SHIFT)
-			view.type = I915_GGTT_VIEW_NORMAL;
+		struct i915_ggtt_view view =
+			compute_partial_view(obj, area,
+					     page_offset, MIN_CHUNK_PAGES);
 
 		/* Userspace is now writing through an untracked VMA, abandon
 		 * all hope that the hardware is able to track future writes.
-- 
2.11.0

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

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

* Re: [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object
  2016-12-22 10:56 [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Chris Wilson
                   ` (3 preceding siblings ...)
  2016-12-22 10:56 ` [PATCH 5/5] drm/i915: Extact compute_partial_view() Chris Wilson
@ 2016-12-22 11:02 ` Joonas Lahtinen
  2016-12-22 11:55 ` kbuild test robot
  2016-12-22 18:08 ` ✗ Fi.CI.BAT: failure for series starting with [1/5] " Patchwork
  6 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2016-12-22 11:02 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On to, 2016-12-22 at 10:56 +0000, Chris Wilson wrote:
> When creating a partial VMA assert that it first fits with the parent
> object, and that if it covers the whole of the parent a normal view was
> created instead.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 4/5] drm/i915: Eliminate superfluous i915_ggtt_view_normal
  2016-12-22 10:56 ` [PATCH 4/5] drm/i915: Eliminate superfluous i915_ggtt_view_normal Chris Wilson
@ 2016-12-22 11:09   ` Joonas Lahtinen
  0 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2016-12-22 11:09 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On to, 2016-12-22 at 10:56 +0000, Chris Wilson wrote:
> Since commit 058d88c4330f ("drm/i915: Track pinned VMA"), there is only
> one user of i915_ggtt_view_normal rodate. Just treat NULL as no special
> view in pin_to_display() like everywhere else.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

I had this queued up too.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 5/5] drm/i915: Extact compute_partial_view()
  2016-12-22 10:56 ` [PATCH 5/5] drm/i915: Extact compute_partial_view() Chris Wilson
@ 2016-12-22 11:14   ` Joonas Lahtinen
  0 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2016-12-22 11:14 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

Patch title, s/Extact/Extract/

On to, 2016-12-22 at 10:56 +0000, Chris Wilson wrote:
> In order to reuse the partial view for selftesting, extract the common
> function for computing the view.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

With that;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 3/5] drm/i915: Eliminate superfluous i915_ggtt_view_rotated
  2016-12-22 10:56 ` [PATCH 3/5] drm/i915: Eliminate superfluous i915_ggtt_view_rotated Chris Wilson
@ 2016-12-22 11:20   ` Joonas Lahtinen
  0 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2016-12-22 11:20 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On to, 2016-12-22 at 10:56 +0000, Chris Wilson wrote:
> It is only being used to clear a struct and set the type, after which it
> is overwritten. Since we no longer check the unset bits of the union,
> skipping the clear is permissible.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 2/5] drm/i915: Convert i915_ggtt_view to use an anonymous union
  2016-12-22 10:56 ` [PATCH 2/5] drm/i915: Convert i915_ggtt_view to use an anonymous union Chris Wilson
@ 2016-12-22 11:24   ` Joonas Lahtinen
  0 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2016-12-22 11:24 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: Daniel Vetter

On to, 2016-12-22 at 10:56 +0000, Chris Wilson wrote:
> Save a lot of characters by making the union anonymous, with the
> side-effect of ignoring unset bits when comparing views.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Daniel could A-b, as he specifically wanted all the bits initialized.

<SNIP>

> +++ b/drivers/gpu/drm/i915/i915_vma.h
> @@ -202,9 +202,18 @@ i915_vma_compare(struct i915_vma *vma,
>  	if (vma->ggtt_view.type != view->type)
>  		return vma->ggtt_view.type - view->type;
>  
> -	return memcmp(&vma->ggtt_view.params,
> -		      &view->params,
> -		      sizeof(view->params));
> +	switch (view->type) {
> +	case I915_GGTT_VIEW_ROTATED:
> +		return memcmp(&vma->ggtt_view.rotated,
> +			      &view->rotated,
> +			      sizeof(view->rotated));
> +	case I915_GGTT_VIEW_PARTIAL:
> +		return memcmp(&vma->ggtt_view.partial,
> +			      &view->partial,
> +			      sizeof(view->partial));

We can decide the amount of bytes to compare in switch and use one
memcmp for everything.

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object
  2016-12-22 10:56 [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Chris Wilson
                   ` (4 preceding siblings ...)
  2016-12-22 11:02 ` [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Joonas Lahtinen
@ 2016-12-22 11:55 ` kbuild test robot
  2016-12-22 18:08 ` ✗ Fi.CI.BAT: failure for series starting with [1/5] " Patchwork
  6 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2016-12-22 11:55 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx, kbuild-all

[-- Attachment #1: Type: text/plain, Size: 7480 bytes --]

Hi Chris,

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on next-20161222]
[cannot apply to v4.9]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-i915-Assert-that-the-partial-VMA-fits-within-the-object/20161222-190222
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-s1-201651 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/io-mapping.h:21,
                    from drivers/gpu/drm/i915/i915_vma.h:28,
                    from drivers/gpu/drm/i915/i915_vma.c:25:
   drivers/gpu/drm/i915/i915_vma.c: In function '__i915_vma_create':
>> drivers/gpu/drm/i915/i915_vma.c:98:15: error: implicit declaration of function 'range_overflows_t' [-Werror=implicit-function-declaration]
       GEM_BUG_ON(range_overflows_t(u64,
                  ^
   include/linux/compiler.h:139:45: note: in definition of macro 'unlikely'
    #  define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
                                                ^
>> drivers/gpu/drm/i915/i915_gem.h:29:26: note: in expansion of macro 'BUG_ON'
    #define GEM_BUG_ON(expr) BUG_ON(expr)
                             ^~~~~~
>> drivers/gpu/drm/i915/i915_vma.c:98:4: note: in expansion of macro 'GEM_BUG_ON'
       GEM_BUG_ON(range_overflows_t(u64,
       ^~~~~~~~~~
>> drivers/gpu/drm/i915/i915_vma.c:98:33: error: expected expression before 'u64'
       GEM_BUG_ON(range_overflows_t(u64,
                                    ^
   include/linux/compiler.h:139:45: note: in definition of macro 'unlikely'
    #  define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
                                                ^
>> drivers/gpu/drm/i915/i915_gem.h:29:26: note: in expansion of macro 'BUG_ON'
    #define GEM_BUG_ON(expr) BUG_ON(expr)
                             ^~~~~~
>> drivers/gpu/drm/i915/i915_vma.c:98:4: note: in expansion of macro 'GEM_BUG_ON'
       GEM_BUG_ON(range_overflows_t(u64,
       ^~~~~~~~~~
>> drivers/gpu/drm/i915/i915_vma.c:98:33: error: expected expression before 'u64'
       GEM_BUG_ON(range_overflows_t(u64,
                                    ^
   include/linux/compiler.h:139:53: note: in definition of macro 'unlikely'
    #  define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
                                                        ^
>> drivers/gpu/drm/i915/i915_gem.h:29:26: note: in expansion of macro 'BUG_ON'
    #define GEM_BUG_ON(expr) BUG_ON(expr)
                             ^~~~~~
>> drivers/gpu/drm/i915/i915_vma.c:98:4: note: in expansion of macro 'GEM_BUG_ON'
       GEM_BUG_ON(range_overflows_t(u64,
       ^~~~~~~~~~
>> drivers/gpu/drm/i915/i915_vma.c:98:33: error: expected expression before 'u64'
       GEM_BUG_ON(range_overflows_t(u64,
                                    ^
   include/linux/compiler.h:112:47: note: in definition of macro 'likely_notrace'
    #define likely_notrace(x) __builtin_expect(!!(x), 1)
                                                  ^
   include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
    #  define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
                                                             ^~~~~~~~~~~~~~~~
   include/asm-generic/bug.h:55:36: note: in expansion of macro 'unlikely'
    #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                       ^~~~~~~~
>> drivers/gpu/drm/i915/i915_gem.h:29:26: note: in expansion of macro 'BUG_ON'
    #define GEM_BUG_ON(expr) BUG_ON(expr)
                             ^~~~~~
>> drivers/gpu/drm/i915/i915_vma.c:98:4: note: in expansion of macro 'GEM_BUG_ON'
       GEM_BUG_ON(range_overflows_t(u64,
       ^~~~~~~~~~
   cc1: all warnings being treated as errors

vim +/range_overflows_t +98 drivers/gpu/drm/i915/i915_vma.c

    19	 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    20	 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
    21	 * IN THE SOFTWARE.
    22	 *
    23	 */
    24	 
  > 25	#include "i915_vma.h"
    26	
    27	#include "i915_drv.h"
    28	#include "intel_ringbuffer.h"
    29	#include "intel_frontbuffer.h"
    30	
    31	#include <drm/drm_gem.h>
    32	
    33	static void
    34	i915_vma_retire(struct i915_gem_active *active,
    35			struct drm_i915_gem_request *rq)
    36	{
    37		const unsigned int idx = rq->engine->id;
    38		struct i915_vma *vma =
    39			container_of(active, struct i915_vma, last_read[idx]);
    40		struct drm_i915_gem_object *obj = vma->obj;
    41	
    42		GEM_BUG_ON(!i915_vma_has_active_engine(vma, idx));
    43	
    44		i915_vma_clear_active(vma, idx);
    45		if (i915_vma_is_active(vma))
    46			return;
    47	
    48		list_move_tail(&vma->vm_link, &vma->vm->inactive_list);
    49		if (unlikely(i915_vma_is_closed(vma) && !i915_vma_is_pinned(vma)))
    50			WARN_ON(i915_vma_unbind(vma));
    51	
    52		GEM_BUG_ON(!i915_gem_object_is_active(obj));
    53		if (--obj->active_count)
    54			return;
    55	
    56		/* Bump our place on the bound list to keep it roughly in LRU order
    57		 * so that we don't steal from recently used but inactive objects
    58		 * (unless we are forced to ofc!)
    59		 */
    60		if (obj->bind_count)
    61			list_move_tail(&obj->global_link, &rq->i915->mm.bound_list);
    62	
    63		obj->mm.dirty = true; /* be paranoid  */
    64	
    65		if (i915_gem_object_has_active_reference(obj)) {
    66			i915_gem_object_clear_active_reference(obj);
    67			i915_gem_object_put(obj);
    68		}
    69	}
    70	
    71	static struct i915_vma *
    72	__i915_vma_create(struct drm_i915_gem_object *obj,
    73			  struct i915_address_space *vm,
    74			  const struct i915_ggtt_view *view)
    75	{
    76		struct i915_vma *vma;
    77		struct rb_node *rb, **p;
    78		int i;
    79	
    80		GEM_BUG_ON(vm->closed);
    81	
    82		vma = kmem_cache_zalloc(to_i915(obj->base.dev)->vmas, GFP_KERNEL);
    83		if (vma == NULL)
    84			return ERR_PTR(-ENOMEM);
    85	
    86		INIT_LIST_HEAD(&vma->exec_list);
    87		for (i = 0; i < ARRAY_SIZE(vma->last_read); i++)
    88			init_request_active(&vma->last_read[i], i915_vma_retire);
    89		init_request_active(&vma->last_fence, NULL);
    90		list_add(&vma->vm_link, &vm->unbound_list);
    91		vma->vm = vm;
    92		vma->obj = obj;
    93		vma->size = obj->base.size;
    94	
    95		if (view) {
    96			vma->ggtt_view = *view;
    97			if (view->type == I915_GGTT_VIEW_PARTIAL) {
  > 98				GEM_BUG_ON(range_overflows_t(u64,
    99							     view->params.partial.offset,
   100							     view->params.partial.size,
   101							     obj->base.size >> PAGE_SHIFT));

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33184 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

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

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

* ✗ Fi.CI.BAT: failure for series starting with [1/5] drm/i915: Assert that the partial VMA fits within the object
  2016-12-22 10:56 [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Chris Wilson
                   ` (5 preceding siblings ...)
  2016-12-22 11:55 ` kbuild test robot
@ 2016-12-22 18:08 ` Patchwork
  6 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2016-12-22 18:08 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/5] drm/i915: Assert that the partial VMA fits within the object
URL   : https://patchwork.freedesktop.org/series/17130/
State : failure

== Summary ==

Series 17130v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/17130/revisions/1/mbox/

Test drv_module_reload:
        Subgroup basic-reload-final:
                pass       -> FAIL       (fi-snb-2600)

fi-bdw-5557u     total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700     total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-j1900     total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r     total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ilk-650       total:246  pass:194  dwarn:0   dfail:0   fail:0   skip:52 
fi-ivb-3520m     total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770      total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6260u     total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:246  pass:222  dwarn:3   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600      total:246  pass:213  dwarn:0   dfail:0   fail:1   skip:32 

5486838e15ec59a57aa9a62f049f383cc3968e3f drm-tip: 2016y-12m-22d-13h-47m-26s UTC integration manifest
fd67808 drm/i915: Extact compute_partial_view()
9505e5c drm/i915: Eliminate superfluous i915_ggtt_view_normal
e1465d0 drm/i915: Eliminate superfluous i915_ggtt_view_rotated
47d76bb drm/i915: Convert i915_ggtt_view to use an anonymous union
309c2e0 drm/i915: Assert that the partial VMA fits within the object

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3372/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2016-12-22 18:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-22 10:56 [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Chris Wilson
2016-12-22 10:56 ` [PATCH 2/5] drm/i915: Convert i915_ggtt_view to use an anonymous union Chris Wilson
2016-12-22 11:24   ` Joonas Lahtinen
2016-12-22 10:56 ` [PATCH 3/5] drm/i915: Eliminate superfluous i915_ggtt_view_rotated Chris Wilson
2016-12-22 11:20   ` Joonas Lahtinen
2016-12-22 10:56 ` [PATCH 4/5] drm/i915: Eliminate superfluous i915_ggtt_view_normal Chris Wilson
2016-12-22 11:09   ` Joonas Lahtinen
2016-12-22 10:56 ` [PATCH 5/5] drm/i915: Extact compute_partial_view() Chris Wilson
2016-12-22 11:14   ` Joonas Lahtinen
2016-12-22 11:02 ` [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Joonas Lahtinen
2016-12-22 11:55 ` kbuild test robot
2016-12-22 18:08 ` ✗ Fi.CI.BAT: failure for series starting with [1/5] " Patchwork

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.