Skip to contentSkip to conversation

drm/i915: Make sure fb objects with rotated views are also fenceable

PATCH In review Vivek Kasireddy 6 participants 34 messages Sep 12, 2015 – Nov 5, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Make sure fb objects with rotated views are also fenceable

From: Vivek Kasireddy <[email protected]>

Currently, fb objects with rotated views are ignored while pinning. Therefore, include the rotated view type and use the view size instead of the object's size to determine if it is fenceable. And, look at the view and its offset while writing and pinning to the fence registers.

Cc Tvrtko Ursulin <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Matthew D Roper <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h            |  6 ++--
 drivers/gpu/drm/i915/i915_gem.c            | 13 +++++----
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  4 +--
 drivers/gpu/drm/i915/i915_gem_fence.c      | 47 ++++++++++++++++++++----------
 drivers/gpu/drm/i915/intel_display.c       |  4 +--
 5 files changed, 48 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -2
index df37e88..9bd8d11 100644
@@ -3101,10 +3101,12 @@ i915_gem_object_ggtt_unpin(struct drm_i915_gem_object *obj)
 }
 
 /* i915_gem_fence.c */
-int __must_check i915_gem_object_get_fence(struct drm_i915_gem_object *obj);
+int __must_check i915_gem_object_get_fence(struct drm_i915_gem_object *obj,
+				      const struct i915_ggtt_view *view);
 int __must_check i915_gem_object_put_fence(struct drm_i915_gem_object *obj);
 
-bool i915_gem_object_pin_fence(struct drm_i915_gem_object *obj);
+bool i915_gem_object_pin_fence(struct drm_i915_gem_object *obj,
+				     const struct i915_ggtt_view *view);
 void i915_gem_object_unpin_fence(struct drm_i915_gem_object *obj);
 
 void i915_gem_restore_fences(struct drm_device *dev);
drivers/gpu/drm/i915/i915_gem.c +8 -5
index 41263cd..c0c3441 100644
@@ -1789,7 +1789,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 	if (ret)
 		goto unpin;
 
-	ret = i915_gem_object_get_fence(obj);
+	ret = i915_gem_object_get_fence(obj, NULL);
 	if (ret)
 		goto unpin;
 
@@ -4054,16 +4054,19 @@ i915_gem_object_do_pin(struct drm_i915_gem_object *obj,
 			return ret;
 	}
 
-	if (ggtt_view && ggtt_view->type == I915_GGTT_VIEW_NORMAL &&
+	if (ggtt_view && (ggtt_view->type == I915_GGTT_VIEW_NORMAL ||
+	    ggtt_view->type == I915_GGTT_VIEW_ROTATED) &&
 	    (bound ^ vma->bound) & GLOBAL_BIND) {
 		bool mappable, fenceable;
-		u32 fence_size, fence_alignment;
+		u32 fence_size, fence_alignment, view_size;
+
+		view_size = i915_ggtt_view_size(obj, ggtt_view);
 
 		fence_size = i915_gem_get_gtt_size(obj->base.dev,
-						   obj->base.size,
+						   view_size,
 						   obj->tiling_mode);
 		fence_alignment = i915_gem_get_gtt_alignment(obj->base.dev,
-							     obj->base.size,
+							     view_size,
 							     obj->tiling_mode,
 							     true);
 
drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 -2
index a953d49..1566f88 100644
@@ -608,11 +608,11 @@ i915_gem_execbuffer_reserve_vma(struct i915_vma *vma,
 	entry->flags |= __EXEC_OBJECT_HAS_PIN;
 
 	if (entry->flags & EXEC_OBJECT_NEEDS_FENCE) {
-		ret = i915_gem_object_get_fence(obj);
+		ret = i915_gem_object_get_fence(obj, NULL);
 		if (ret)
 			return ret;
 
-		if (i915_gem_object_pin_fence(obj))
+		if (i915_gem_object_pin_fence(obj, NULL))
 			entry->flags |= __EXEC_OBJECT_HAS_FENCE;
 	}
 
drivers/gpu/drm/i915/i915_gem_fence.c +32 -15

119 lines not on this page · raw message

drivers/gpu/drm/i915/intel_display.c +2 -2
index 52fb3f2..b77074f 100644
@@ -2357,7 +2357,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
+	ret = i915_gem_object_get_fence(obj, &view);
 	if (ret == -EDEADLK) {
 		/*
 		 * -EDEADLK means there are no free fences
@@ -2372,7 +2372,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	} else if (ret)
 		goto err_unpin;
 
-	i915_gem_object_pin_fence(obj);
+	i915_gem_object_pin_fence(obj, &view);
 
 	dev_priv->mm.interruptible = true;
 	intel_runtime_pm_put(dev_priv);
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 11 lines · Vivek Kasireddy

From: Vivek Kasireddy <[email protected]>

Currently, fb objects with rotated views are ignored while pinning. Therefore, include the rotated view type and use the view size instead of the object's size to determine if it is fenceable. And, look at the view and its offset while writing and pinning to the fence registers.

Cc Tvrtko Ursulin <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Matthew D Roper <[email protected]>

No. The fenceable decision needs only be made on the vma, which can be separate for rotated views, partial views etc.

As usual I have such a patch...
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 14 lines · On Sat, 12 Sep 2015 08:49:08 +0100 Chris Wilson <[email protected]>…
Quoted 8 lines · Vivek Kasireddy

From: Vivek Kasireddy <[email protected]>

Currently, fb objects with rotated views are ignored while pinning. Therefore, include the rotated view type and use the view size instead of the object's size to determine if it is fenceable. And, look at the view and its offset while writing and pinning to the fence registers.

Quoted 4 lines
Cc Tvrtko Ursulin <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Matthew D Roper <[email protected]>
Quoted 5 lines

No. The fenceable decision needs only be made on the vma, which can be separate for rotated views, partial views etc.

As usual I have such a patch...
-Chris

The fenceable decision is indeed made on the vma; my patch doesn't change that behavior. I am just fixing the warning raised here:

if (WARN_ON(!obj->map_and_fenceable))

inside i915_gem_object_get_fence(). This warning is raised because i915_gem_object_do_pin() only looks at normal views and completely ignores the rotated views for the associated Y-tiled fb objects that are passed on by i915_gem_object_pin_to_display_plane().

Does your patch solve this problem in a different way? -Vivek

Quoted 1 line

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Vivek Kasireddy

Hi,

Quoted 6 lines · Vivek Kasireddy

From: Vivek Kasireddy <[email protected]>

Currently, fb objects with rotated views are ignored while pinning. Therefore, include the rotated view type and use the view size instead of the object's size to determine if it is fenceable. And, look at the view and its offset while writing and pinning to the fence registers.

I didn't figure out from the commit message if something is broken or?

AFAIR rotated views deliberately skip on fencing since rotated view has shuffled pages in memory so it would be a weird view for userspace to handle.

Especially this below:

Quoted 16 lines

static void i965_write_fence_reg(struct drm_device *dev, int reg,

drivers/gpu/drm/i915/i915_gem_fence.c +3 -1
-				 struct drm_i915_gem_object *obj)
+				 struct drm_i915_gem_object *obj,
+				 const struct i915_ggtt_view *view)
  {
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	int fence_reg;
  	int fence_pitch_shift;
+	const struct i915_ggtt_view *ggtt_view = view;
 
  	if (INTEL_INFO(dev)->gen >= 6) {
  		fence_reg = FENCE_REG_SANDYBRIDGE_0;
@@ -95,9 +97,13 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg,
  			size = (size / row_size) * row_size;
  		}
 

drivers/gpu/drm/i915/i915_gem_fence.c static void i965_write_fence_reg(struct drm_device *dev, int reg, · line 106

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_fence.c +7 -3
-		val = (uint64_t)((i915_gem_obj_ggtt_offset(obj) + size - 4096) &
-				 0xfffff000) << 32;
-		val |= i915_gem_obj_ggtt_offset(obj) & 0xfffff000;
+		if (!ggtt_view)
+			ggtt_view = &i915_ggtt_view_normal;
+
+		val = (uint64_t)((i915_gem_obj_ggtt_offset_view((obj), ggtt_view)
+				  + size - 4096) & 0xfffff000) << 32;
+		val |= i915_gem_obj_ggtt_offset_view((obj), ggtt_view) & 0xfffff000;
+

Looks like the code can be setting up a fence with a rotated view GGTT address which looks wrong? Is this really what is wanted and why?

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 12 lines · On Mon, 14 Sep 2015 10:08:19 +0100 Tvrtko Ursulin…

Hi,

Quoted 7 lines · Vivek Kasireddy

From: Vivek Kasireddy <[email protected]>

Currently, fb objects with rotated views are ignored while pinning. Therefore, include the rotated view type and use the view size instead of the object's size to determine if it is fenceable. And, look at the view and its offset while writing and pinning to the fence registers.

Quoted 5 lines

I didn't figure out from the commit message if something is broken or?

AFAIR rotated views deliberately skip on fencing since rotated view has shuffled pages in memory so it would be a weird view for userspace to handle.

Hi Tvrtko,
I apologize for the short and ambiguous commit message.
As I mentioned in my other reply to Chris, the reason for this patch is because of this:

	if (WARN_ON(!obj->map_and_fenceable))
		return -EINVAL;

inside i915_find_fence_reg(). I am trying to enable 90 degree rotation for the Weston compositor as part of which I need to allocate and flip a Y-tiled fb obj. This fails because i915_gem_object_do_pin() ignores the rotated view passed by i915_gem_object_pin_to_display_plane() and hence obj->map_and_fenceable never gets set.

Quoted 36 lines

Especially this below:

Quoted 28 lines

static void i965_write_fence_reg(struct drm_device *dev, int reg,

drivers/gpu/drm/i915/i915_gem_fence.c +3 -2
-				 struct drm_i915_gem_object *obj)
+				 struct drm_i915_gem_object *obj,
+				 const struct i915_ggtt_view *view)
  {
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	int fence_reg;
  	int fence_pitch_shift;
+	const struct i915_ggtt_view *ggtt_view = view;
 
  	if (INTEL_INFO(dev)->gen >= 6) {
  		fence_reg = FENCE_REG_SANDYBRIDGE_0;
@@ -95,9 +97,13 @@ static void i965_write_fence_reg(struct
 drm_device *dev, int reg, size = (size / row_size) * row_size;
  		}
 
-		val = (uint64_t)((i915_gem_obj_ggtt_offset(obj) +

size - 4096) &

drivers/gpu/drm/i915/i915_gem_fence.c +4 -2
-				 0xfffff000) << 32;
-		val |= i915_gem_obj_ggtt_offset(obj) & 0xfffff000;
+		if (!ggtt_view)
+			ggtt_view = &i915_ggtt_view_normal;
+
+		val =

(uint64_t)((i915_gem_obj_ggtt_offset_view((obj), ggtt_view)

(quoted diff) +1 -0
+				  + size - 4096) & 0xfffff000) <<

32;

(quoted diff) +1 -0
+		val |= i915_gem_obj_ggtt_offset_view((obj),
Quoted 1 line

ggtt_view) & 0xfffff000; +

Looks like the code can be setting up a fence with a rotated view GGTT address which looks wrong? Is this really what is wanted and why?

Quoted 3 lines

Regards,

Tvrtko

Well, i915_gem_obj_ggtt_offset() always calls i915_gem_obj_ggtt_offset_view() with the default normal view type which I suppose is incorrect right? When a rotated view is passed from i915_gem_object_pin_to_display_plane(), i915_gem_obj_ggtt_offset_view() will not be able to find the associated vma.

-Vivek

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 25 lines · Vivek Kasireddy
Quoted 12 lines · On Mon, 14 Sep 2015 10:08:19 +0100 Tvrtko Ursulin…

Hi,

Quoted 7 lines · Vivek Kasireddy

From: Vivek Kasireddy <[email protected]>

Currently, fb objects with rotated views are ignored while pinning. Therefore, include the rotated view type and use the view size instead of the object's size to determine if it is fenceable. And, look at the view and its offset while writing and pinning to the fence registers.

Quoted 5 lines

I didn't figure out from the commit message if something is broken or?

AFAIR rotated views deliberately skip on fencing since rotated view has shuffled pages in memory so it would be a weird view for userspace to handle.

Hi Tvrtko,
I apologize for the short and ambiguous commit message.
As I mentioned in my other reply to Chris, the reason for this patch is because of this:

Quoted 5 lines
	if (WARN_ON(!obj->map_and_fenceable))
		return -EINVAL;

inside i915_find_fence_reg(). I am trying to enable 90 degree rotation for the Weston compositor as part of which I need to allocate and flip a Y-tiled fb obj. This fails because i915_gem_object_do_pin() ignores

The use case itself has been exercised in general and it does work.

However I suspect you are using SET_TILING on the object to set it to Y tiled? That would explain i915_gem_object_get_fence trying to enable fencing.

This indeed looks like an omission in test coverage, needs a test case in kms_addfb_basic/addfb25 test group.

Quoted 39 lines

the rotated view passed by i915_gem_object_pin_to_display_plane() and hence obj->map_and_fenceable never gets set.

Quoted 36 lines

Especially this below:

Quoted 28 lines

static void i965_write_fence_reg(struct drm_device *dev, int reg,

drivers/gpu/drm/i915/i915_gem_fence.c +3 -2
-				 struct drm_i915_gem_object *obj)
+				 struct drm_i915_gem_object *obj,
+				 const struct i915_ggtt_view *view)
   {
   	struct drm_i915_private *dev_priv = dev->dev_private;
   	int fence_reg;
   	int fence_pitch_shift;
+	const struct i915_ggtt_view *ggtt_view = view;
 
   	if (INTEL_INFO(dev)->gen >= 6) {
   		fence_reg = FENCE_REG_SANDYBRIDGE_0;
@@ -95,9 +97,13 @@ static void i965_write_fence_reg(struct
 drm_device *dev, int reg, size = (size / row_size) * row_size;
   		}
 
-		val = (uint64_t)((i915_gem_obj_ggtt_offset(obj) +

size - 4096) &

drivers/gpu/drm/i915/i915_gem_fence.c +4 -2
-				 0xfffff000) << 32;
-		val |= i915_gem_obj_ggtt_offset(obj) & 0xfffff000;
+		if (!ggtt_view)
+			ggtt_view = &i915_ggtt_view_normal;
+
+		val =

(uint64_t)((i915_gem_obj_ggtt_offset_view((obj), ggtt_view)

(quoted diff) +1 -0
+				  + size - 4096) & 0xfffff000) <<

32;

(quoted diff) +1 -0
+		val |= i915_gem_obj_ggtt_offset_view((obj),
Quoted 1 line

ggtt_view) & 0xfffff000; +

Looks like the code can be setting up a fence with a rotated view GGTT address which looks wrong? Is this really what is wanted and why?

Quoted 8 lines
Quoted 3 lines

Regards,

Tvrtko

Well, i915_gem_obj_ggtt_offset() always calls i915_gem_obj_ggtt_offset_view() with the default normal view type which I suppose is incorrect right? When a rotated view is passed from i915_gem_object_pin_to_display_plane(), i915_gem_obj_ggtt_offset_view() will not be able to find the associated vma.

I think it is correct since for setting up fences we do want the normal view. What would you do that in userspace with fenced rotated view and would it even work? And it wouldn't even be predictable which type of view you got for your mmap since it would depend on view instantiation ordering, no?

I think what might work is that we skip fence creation on rotated view pinning, and instead do it when mmap is requested, instantiating a normal view at that time if not present.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Hi Tvrtko,

Quoted 35 lines · On Tue, 15 Sep 2015 10:29:27 +0100 Tvrtko Ursulin…
Quoted 26 lines · Vivek Kasireddy
Quoted 12 lines · On Mon, 14 Sep 2015 10:08:19 +0100 Tvrtko Ursulin…

Hi,

Quoted 7 lines · Vivek Kasireddy

From: Vivek Kasireddy <[email protected]>

Currently, fb objects with rotated views are ignored while pinning. Therefore, include the rotated view type and use the view size instead of the object's size to determine if it is fenceable. And, look at the view and its offset while writing and pinning to the fence registers.

Quoted 6 lines

I didn't figure out from the commit message if something is broken or?

AFAIR rotated views deliberately skip on fencing since rotated view has shuffled pages in memory so it would be a weird view for userspace to handle.

Hi Tvrtko,
I apologize for the short and ambiguous commit message. As I mentioned in my other reply to Chris, the reason for this patch is because of this:

Quoted 6 lines
	if (WARN_ON(!obj->map_and_fenceable))
		return -EINVAL;

inside i915_find_fence_reg(). I am trying to enable 90 degree rotation for the Weston compositor as part of which I need to allocate and flip a Y-tiled fb obj. This fails because i915_gem_object_do_pin() ignores

Quoted 5 lines

The use case itself has been exercised in general and it does work.

However I suspect you are using SET_TILING on the object to set it to Y tiled? That would explain i915_gem_object_get_fence trying to enable fencing.

Yes, I am using SET_TILING to set Y-tiling on the fb obj.

Quoted 62 lines

This indeed looks like an omission in test coverage, needs a test case in kms_addfb_basic/addfb25 test group.

Quoted 44 lines

the rotated view passed by i915_gem_object_pin_to_display_plane() and hence obj->map_and_fenceable never gets set.

Quoted 41 lines

Especially this below:

Quoted 30 lines

static void i965_write_fence_reg(struct drm_device *dev, int
reg,

drivers/gpu/drm/i915/i915_gem_fence.c +2 -1
-				 struct drm_i915_gem_object *obj)
+				 struct drm_i915_gem_object *obj,
+				 const struct i915_ggtt_view
*view) {
   	struct drm_i915_private *dev_priv = dev->dev_private;
   	int fence_reg;
   	int fence_pitch_shift;
drivers/gpu/drm/i915/i915_gem_fence.c +1 -1
+	const struct i915_ggtt_view *ggtt_view = view;
 
   	if (INTEL_INFO(dev)->gen >= 6) {
   		fence_reg = FENCE_REG_SANDYBRIDGE_0;
@@ -95,9 +97,13 @@ static void i965_write_fence_reg(struct
 drm_device *dev, int reg, size = (size / row_size) * row_size;
   		}
 
-		val = (uint64_t)((i915_gem_obj_ggtt_offset(obj) +

size - 4096) &

(quoted diff) +0 -2
-				 0xfffff000) << 32;
-		val |= i915_gem_obj_ggtt_offset(obj) &

0xfffff000;

drivers/gpu/drm/i915/i915_gem_fence.c +4 -0
+		if (!ggtt_view)
+			ggtt_view = &i915_ggtt_view_normal;
+
+		val =

(uint64_t)((i915_gem_obj_ggtt_offset_view((obj), ggtt_view)

(quoted diff) +1 -0
+				  + size - 4096) & 0xfffff000) <<

32;

(quoted diff) +1 -0
+		val |= i915_gem_obj_ggtt_offset_view((obj),
Quoted 1 line

ggtt_view) & 0xfffff000; +

Looks like the code can be setting up a fence with a rotated view GGTT address which looks wrong? Is this really what is wanted and why?

Regards,

Quoted 7 lines
Quoted 1 line

Tvrtko

Well, i915_gem_obj_ggtt_offset() always calls i915_gem_obj_ggtt_offset_view() with the default normal view type which I suppose is incorrect right? When a rotated view is passed from i915_gem_object_pin_to_display_plane(), i915_gem_obj_ggtt_offset_view() will not be able to find the associated vma.

I think it is correct since for setting up fences we do want the normal view. What would you do that in userspace with fenced rotated view and would it even work? And it wouldn't even be predictable which type of view you got for your mmap since it would depend on view instantiation ordering, no?

Quoted 3 lines

I think what might work is that we skip fence creation on rotated view pinning, and instead do it when mmap is requested, instantiating a normal view at that time if not present.

Skipping fence installation for fb objects with rotated views seems to fix the issue I am seeing. I'll send out a new patch that just does this.

Thanks,
Vivek

Quoted 4 lines

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

PATCH 1/1 drm/i915: Skip fence installation for objects with rotated views

In reply to Tvrtko Ursulin

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

---
 drivers/gpu/drm/i915/intel_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
index 52fb3f2..8b3e943 100644
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
+	ret = view.type == I915_GGTT_VIEW_NORMAL ?
+				i915_gem_object_get_fence(obj) : 0;
 	if (ret == -EDEADLK) {
 		/*
 		 * -EDEADLK means there are no free fences
Signature · 6 lines
2.4.3

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

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views

Quoted 18 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

---
 drivers/gpu/drm/i915/intel_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 52fb3f2..8b3e943 100644

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2361

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
+	ret = view.type == I915_GGTT_VIEW_NORMAL ?
+				i915_gem_object_get_fence(obj) : 0;

ret = 0;
if (vma->map_and_fenceable)

	ret = i915_gem_object_get_fence(obj);

is how I wrote it in my patch. One day that will become i915_vma_get_fence().
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views

Quoted 30 lines · On Wed, 16 Sep 2015 09:03:33 +0100 Chris Wilson <[email protected]>…
Quoted 21 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

---
 drivers/gpu/drm/i915/intel_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_display.c index 52fb3f2..8b3e943 100644

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane
 *plane,
 	 * framebuffer compression.  For simplicity, we always

install

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2361

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +2 -1
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
+	ret = view.type == I915_GGTT_VIEW_NORMAL ?
+				i915_gem_object_get_fence(obj) : 0;

ret = 0;
if (vma->map_and_fenceable)

Quoted 5 lines
	ret = i915_gem_object_get_fence(obj);

is how I wrote it in my patch. One day that will become i915_vma_get_fence().
-Chris

Hi Chris,

Looks like your solution to this problem -- and potentially others -- is better and more comprehensive. When do you plan on sending your patch out to the mailing list?

Thanks,
Vivek

Quoted 1 line

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views

Quoted 35 lines · Vivek Kasireddy
Quoted 32 lines · On Wed, 16 Sep 2015 09:03:33 +0100 Chris Wilson <[email protected]>…
Quoted 23 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

---
  drivers/gpu/drm/i915/intel_display.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_display.c index 52fb3f2..8b3e943 100644

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane
 *plane,
  	 * framebuffer compression.  For simplicity, we always

install
* a fence as the cost is not that onerous. */

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2361

Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +2 -1
-	ret = i915_gem_object_get_fence(obj);
+	ret = view.type == I915_GGTT_VIEW_NORMAL ?
+				i915_gem_object_get_fence(obj) : 0;

ret = 0;
if (vma->map_and_fenceable)

	ret = i915_gem_object_get_fence(obj);
Quoted 8 lines
Quoted 3 lines

is how I wrote it in my patch. One day that will become i915_vma_get_fence().
-Chris

Hi Chris,

Looks like your solution to this problem -- and potentially others -- is better and more comprehensive. When do you plan on sending your patch out to the mailing list?

For a quick fix maybe just respin this patch to use obj->map_and_fenceable criteria as Chris suggested?

You should also add a test case for this into igt/kms_addfb_basic.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views

Quoted 44 lines · On Thu, 17 Sep 2015 11:25:18 +0100 Tvrtko Ursulin…
Quoted 42 lines · Vivek Kasireddy
Quoted 32 lines · On Wed, 16 Sep 2015 09:03:33 +0100 Chris Wilson <[email protected]>…
Quoted 27 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

---
  drivers/gpu/drm/i915/intel_display.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_display.c index 52fb3f2..8b3e943 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c

(quoted diff) +0 -0
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane
 *plane,
  	 * framebuffer compression.  For simplicity, we always

install
* a fence as the cost is not that onerous. */

drivers/gpu/drm/i915/intel_display.c +2 -1
-	ret = i915_gem_object_get_fence(obj);
+	ret = view.type == I915_GGTT_VIEW_NORMAL ?
+				i915_gem_object_get_fence(obj) :
Quoted 1 line

0;

ret = 0;
if (vma->map_and_fenceable)

Quoted 5 lines
	ret = i915_gem_object_get_fence(obj);

is how I wrote it in my patch. One day that will become i915_vma_get_fence().
-Chris

Hi Chris,

Quoted 8 lines
Quoted 3 lines

Looks like your solution to this problem -- and potentially others -- is better and more comprehensive. When do you plan on sending your patch out to the mailing list?

For a quick fix maybe just respin this patch to use obj->map_and_fenceable criteria as Chris suggested?

You should also add a test case for this into igt/kms_addfb_basic.

Hi Tvrtko,
I'll send out a patch soon that will serve as as stop-gap measure until Chris revamps that part of the code. As far as the igt test case is concerned, I'll do that in the next few days.

Thanks,
Vivek

Quoted 4 lines

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

PATCH 1/1 drm/i915: Skip fence installation for objects with rotated views (v2)

In reply to Tvrtko Ursulin

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

v1:
While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
index 52fb3f2..108c000 100644
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)
+		ret = i915_gem_object_get_fence(obj);
 	if (ret == -EDEADLK) {
 		/*
 		 * -EDEADLK means there are no free fences
Signature · 6 lines
2.4.3

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

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

Quoted 10 lines · Vivek Kasireddy

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

v1:
While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

Quoted 3 lines
Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>

Where's the igt testcase for this bug that Tvrtko suggested? -Daniel

Quoted 25 lines
---
 drivers/gpu/drm/i915/intel_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
index 52fb3f2..108c000 100644
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)
+		ret = i915_gem_object_get_fence(obj);
 	if (ret == -EDEADLK) {
 		/*
 		 * -EDEADLK means there are no free fences
Signature · 6 lines
2.4.3

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

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

Quoted 11 lines · On Wed, 23 Sep 2015 10:46:39 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 10 lines · Vivek Kasireddy

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

v1:
While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

Quoted 6 lines
Quoted 3 lines
Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>

Where's the igt testcase for this bug that Tvrtko suggested? -Daniel

Hi Daniel,
I'll submit it in the next few days.

Thanks,
Vivek

Quoted 24 lines
Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_display.c index 52fb3f2..108c000 100644

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane
 *plane,
 	 * framebuffer compression.  For simplicity, we always

install

drivers/gpu/drm/i915/intel_display.c +2 -1
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)
+		ret = i915_gem_object_get_fence(obj);
 	if (ret == -EDEADLK) {
 		/*
 		 * -EDEADLK means there are no free fences
Signature · 1 line
2.4.3
Quoted 5 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#15 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

In reply to Vivek Kasireddy

Hi,

Quoted 23 lines · Vivek Kasireddy

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

v1:
While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
---
  drivers/gpu/drm/i915/intel_display.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 52fb3f2..108c000 100644

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2364

Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  	 * framebuffer compression.  For simplicity, we always install
  	 * a fence as the cost is not that onerous.
  	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)
+		ret = i915_gem_object_get_fence(obj);
  	if (ret == -EDEADLK) {
  		/*
  		 * -EDEADLK means there are no free fences

Looks correct to me. Ideally someone with perspective on old platforms, like Chris or Daniel could also R-B ?

But the commit message is unusual, v1 block should probably become the top section, without the v1 marking.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

PATCH 1/1 drm/i915: Skip fence installation for objects with rotated views (v2)

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
index 52fb3f2..108c000 100644
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)
+		ret = i915_gem_object_get_fence(obj);
 	if (ret == -EDEADLK) {
 		/*
 		 * -EDEADLK means there are no free fences
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#17 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

Quoted 23 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
---
  drivers/gpu/drm/i915/intel_display.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 52fb3f2..108c000 100644

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2364

Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  	 * framebuffer compression.  For simplicity, we always install
  	 * a fence as the cost is not that onerous.
  	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)
+		ret = i915_gem_object_get_fence(obj);
  	if (ret == -EDEADLK) {
  		/*
  		 * -EDEADLK means there are no free fences

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

In reply to Vivek Kasireddy
Quoted 22 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 52fb3f2..108c000 100644

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2360

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)

This will now get the fence and pin it for the 90/270 view as well, even though the fence doesn't even cover that particualr gtt mapping.

Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c +1 -0
+		ret = i915_gem_object_get_fence(obj);
 	if (ret == -EDEADLK) {
 		/*
 		 * -EDEADLK means there are no free fences
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
---
  drivers/gpu/drm/i915/intel_display.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2360

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
index 52fb3f2..108c000 100644
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  	 * framebuffer compression.  For simplicity, we always install
  	 * a fence as the cost is not that onerous.
  	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)

This will now get the fence and pin it for the 90/270 view as well, even though the fence doesn't even cover that particualr gtt mapping.

I don't follow. obj->map_and_fenceable will be true only when normal view exists, so this avoids setting up the fence when no normal view exists and so avoids the WARN_ON in i915_gem_object_get_fence.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#20 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

Quoted 34 lines · Tvrtko Ursulin
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
---
  drivers/gpu/drm/i915/intel_display.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2360

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
index 52fb3f2..108c000 100644
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  	 * framebuffer compression.  For simplicity, we always install
  	 * a fence as the cost is not that onerous.
  	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)

This will now get the fence and pin it for the 90/270 view as well, even though the fence doesn't even cover that particualr gtt mapping.

Quoted 3 lines

I don't follow. obj->map_and_fenceable will be true only when normal view exists, so this avoids setting up the fence when no normal view exists and so avoids the WARN_ON in i915_gem_object_get_fence.

Sure, but it's pointless to use up a fence if all we care about is the 90/270 mapping.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

Quoted 35 lines · Ville Syrjälä
Quoted 34 lines · Tvrtko Ursulin
Quoted 31 lines · Ville Syrjälä
Quoted 22 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
---
   drivers/gpu/drm/i915/intel_display.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 52fb3f2..108c000 100644

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2360

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
   	 * framebuffer compression.  For simplicity, we always install
   	 * a fence as the cost is not that onerous.
   	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)

This will now get the fence and pin it for the 90/270 view as well, even though the fence doesn't even cover that particualr gtt mapping.

Quoted 6 lines
Quoted 3 lines

I don't follow. obj->map_and_fenceable will be true only when normal view exists, so this avoids setting up the fence when no normal view exists and so avoids the WARN_ON in i915_gem_object_get_fence.

Sure, but it's pointless to use up a fence if all we care about is the 90/270 mapping.

After a brief IRC discussion we agreed that the patch doesn't introduce any new negative behaviours.

But in general it may be beneficial to revisit the approach of always installing fences. Especially as the number of pipes and planes grows and if number of fences remains static.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#22 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

Quoted 41 lines · Tvrtko Ursulin
Quoted 39 lines · Ville Syrjälä
Quoted 37 lines · Tvrtko Ursulin
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
---
  drivers/gpu/drm/i915/intel_display.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2360

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
index 52fb3f2..108c000 100644
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  	 * framebuffer compression.  For simplicity, we always install
  	 * a fence as the cost is not that onerous.
  	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)

This will now get the fence and pin it for the 90/270 view as well, even though the fence doesn't even cover that particualr gtt mapping.

I don't follow. obj->map_and_fenceable will be true only when normal view exists, so this avoids setting up the fence when no normal view exists and so avoids the WARN_ON in i915_gem_object_get_fence.

Quoted 5 lines
Quoted 2 lines

Sure, but it's pointless to use up a fence if all we care about is the 90/270 mapping.

After a brief IRC discussion we agreed that the patch doesn't introduce any new negative behaviours.

Urm, consider

intel_unpin_fb_obj():

	...
	i915_gem_object_unpin_fence(intel_fb_obj(obj));

So if the fb is bound both in rotated and non-rotated modes, we will have a fence for the object and try to unpin it twice => WARN (Daniel is being too nice, once upon a time that was rightfully a BUG for a major screwup).

We want to track the fence state on the vma and associated that vma with the plane_state so that the tracking doesn't get so easily confused. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#23 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

Quoted 45 lines · Chris Wilson
Quoted 44 lines · Tvrtko Ursulin
Quoted 41 lines · Ville Syrjälä
Quoted 34 lines · Tvrtko Ursulin
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
---
  drivers/gpu/drm/i915/intel_display.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2360

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
index 52fb3f2..108c000 100644
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  	 * framebuffer compression.  For simplicity, we always install
  	 * a fence as the cost is not that onerous.
  	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)

This will now get the fence and pin it for the 90/270 view as well, even though the fence doesn't even cover that particualr gtt mapping.

Quoted 3 lines

I don't follow. obj->map_and_fenceable will be true only when normal view exists, so this avoids setting up the fence when no normal view exists and so avoids the WARN_ON in i915_gem_object_get_fence.

Sure, but it's pointless to use up a fence if all we care about is the 90/270 mapping.

Quoted 8 lines
Quoted 2 lines

After a brief IRC discussion we agreed that the patch doesn't introduce any new negative behaviours.

Urm, consider

intel_unpin_fb_obj():

	...
	i915_gem_object_unpin_fence(intel_fb_obj(obj));

We'll have (pointlessly) pinned the fence too, so I think it'll end up working. I would have just put in view==NORMAL checks myself as an interim solution to avoid that, but whatever.

Quoted 13 lines

So if the fb is bound both in rotated and non-rotated modes, we will have a fence for the object and try to unpin it twice => WARN (Daniel is being too nice, once upon a time that was rightfully a BUG for a major screwup).

We want to track the fence state on the vma and associated that vma with the plane_state so that the tracking doesn't get so easily confused. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#24 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

Quoted 51 lines · Ville Syrjälä
Quoted 50 lines · Chris Wilson
Quoted 41 lines · Tvrtko Ursulin
Quoted 39 lines · Ville Syrjälä
Quoted 37 lines · Tvrtko Ursulin
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
---
  drivers/gpu/drm/i915/intel_display.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2360

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
index 52fb3f2..108c000 100644
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  	 * framebuffer compression.  For simplicity, we always install
  	 * a fence as the cost is not that onerous.
  	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)

This will now get the fence and pin it for the 90/270 view as well, even though the fence doesn't even cover that particualr gtt mapping.

I don't follow. obj->map_and_fenceable will be true only when normal view exists, so this avoids setting up the fence when no normal view exists and so avoids the WARN_ON in i915_gem_object_get_fence.

Quoted 5 lines
Quoted 2 lines

Sure, but it's pointless to use up a fence if all we care about is the 90/270 mapping.

After a brief IRC discussion we agreed that the patch doesn't introduce any new negative behaviours.

Urm, consider

Quoted 7 lines
Quoted 3 lines

intel_unpin_fb_obj():

	...
	i915_gem_object_unpin_fence(intel_fb_obj(obj));

We'll have (pointlessly) pinned the fence too, so I think it'll end up working. I would have just put in view==NORMAL checks myself as an interim solution to avoid that, but whatever.

No, it didn't. If we rotated first, we don't get a fence and so don't pin it. Then we attach an unrotated, grab a fence and pin it. Then we end up unpinning twice vs a single pin.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#25 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

Quoted 56 lines · Chris Wilson
Quoted 55 lines · Ville Syrjälä
Quoted 53 lines · Chris Wilson
Quoted 41 lines · Tvrtko Ursulin
Quoted 39 lines · Ville Syrjälä
Quoted 37 lines · Tvrtko Ursulin
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
---
  drivers/gpu/drm/i915/intel_display.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2360

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
index 52fb3f2..108c000 100644
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  	 * framebuffer compression.  For simplicity, we always install
  	 * a fence as the cost is not that onerous.
  	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)

This will now get the fence and pin it for the 90/270 view as well, even though the fence doesn't even cover that particualr gtt mapping.

I don't follow. obj->map_and_fenceable will be true only when normal view exists, so this avoids setting up the fence when no normal view exists and so avoids the WARN_ON in i915_gem_object_get_fence.

Quoted 5 lines
Quoted 2 lines

Sure, but it's pointless to use up a fence if all we care about is the 90/270 mapping.

After a brief IRC discussion we agreed that the patch doesn't introduce any new negative behaviours.

Urm, consider

intel_unpin_fb_obj():

	...
	i915_gem_object_unpin_fence(intel_fb_obj(obj));
Quoted 7 lines
Quoted 3 lines

We'll have (pointlessly) pinned the fence too, so I think it'll end up working. I would have just put in view==NORMAL checks myself as an interim solution to avoid that, but whatever.

No, it didn't. If we rotated first, we don't get a fence and so don't pin it. Then we attach an unrotated, grab a fence and pin it. Then we end up unpinning twice vs a single pin.

Oh, map_and_fenceable on the _object_ depends whether the normal view is bound, and yeah it could get bound only after the rotated view got used for scanout. So view==NORMAL for now seems like good enough solution for now to me. Anything else means a bigger rework of the code, and I for one don't want to got there until I've managed to land my already pending stuff.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#26 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2)

Quoted 65 lines · Ville Syrjälä
Quoted 56 lines · Chris Wilson
Quoted 55 lines · Ville Syrjälä
Quoted 53 lines · Chris Wilson
Quoted 41 lines · Tvrtko Ursulin
Quoted 39 lines · Ville Syrjälä
Quoted 37 lines · Tvrtko Ursulin
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
---
   drivers/gpu/drm/i915/intel_display.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2360

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
index 52fb3f2..108c000 100644
@@ -2357,7 +2357,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
   	 * framebuffer compression.  For simplicity, we always install
   	 * a fence as the cost is not that onerous.
   	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (obj->map_and_fenceable)

This will now get the fence and pin it for the 90/270 view as well, even though the fence doesn't even cover that particualr gtt mapping.

I don't follow. obj->map_and_fenceable will be true only when normal view exists, so this avoids setting up the fence when no normal view exists and so avoids the WARN_ON in i915_gem_object_get_fence.

Quoted 5 lines
Quoted 2 lines

Sure, but it's pointless to use up a fence if all we care about is the 90/270 mapping.

After a brief IRC discussion we agreed that the patch doesn't introduce any new negative behaviours.

Urm, consider

intel_unpin_fb_obj():

	...
	i915_gem_object_unpin_fence(intel_fb_obj(obj));
Quoted 7 lines
Quoted 3 lines

We'll have (pointlessly) pinned the fence too, so I think it'll end up working. I would have just put in view==NORMAL checks myself as an interim solution to avoid that, but whatever.

No, it didn't. If we rotated first, we don't get a fence and so don't pin it. Then we attach an unrotated, grab a fence and pin it. Then we end up unpinning twice vs a single pin.

Quoted 6 lines

Oh, map_and_fenceable on the _object_ depends whether the normal view is bound, and yeah it could get bound only after the rotated view got used for scanout. So view==NORMAL for now seems like good enough solution for now to me. Anything else means a bigger rework of the code, and I for one don't want to got there until I've managed to land my already pending stuff.

Right, so one WARN eliminated, one to go. :)

Vivek would you have the time to add a new test case which will hit a WARN in i915_gem_object_unpin_fence with the v2 of your patch and post a v3 which fixes it?

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#27 lore raw

PATCH 1/1 drm/i915: Skip fence installation for objects with rotated views (v3)

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

v3:
Pin and unpin a fence only if the current view type is normal.

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +5 -2
index 2fdfca1..ac06f8c 100644
@@ -2419,7 +2419,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (view.type == I915_GGTT_VIEW_NORMAL)
+		ret = i915_gem_object_get_fence(obj);
 	if (ret == -EDEADLK) {
 		/*
 		 * -EDEADLK means there are no free fences
@@ -2460,7 +2461,9 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,
 	ret = intel_fill_fb_ggtt_view(&view, fb, plane_state);
 	WARN_ONCE(ret, "Couldn't get view from plane state!");
 
-	i915_gem_object_unpin_fence(obj);
+	if (view.type == I915_GGTT_VIEW_NORMAL)
+		i915_gem_object_unpin_fence(obj);
+
 	i915_gem_object_unpin_from_display_plane(obj, &view);
 }
 
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#28 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v3)

Quoted 36 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

v3:
Pin and unpin a fence only if the current view type is normal.

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Ville Syrjala <[email protected]>
---
  drivers/gpu/drm/i915/intel_display.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
index 2fdfca1..ac06f8c 100644
@@ -2419,7 +2419,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  	 * framebuffer compression.  For simplicity, we always install
  	 * a fence as the cost is not that onerous.
  	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (view.type == I915_GGTT_VIEW_NORMAL)
+		ret = i915_gem_object_get_fence(obj);
  	if (ret == -EDEADLK) {
  		/*
  		 * -EDEADLK means there are no free fences

drivers/gpu/drm/i915/intel_display.c static void intel_unpin_fb_obj(struct drm_framebuffer *fb, · line 2469

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3 -1
@@ -2460,7 +2461,9 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,
  	ret = intel_fill_fb_ggtt_view(&view, fb, plane_state);
  	WARN_ONCE(ret, "Couldn't get view from plane state!");
 
-	i915_gem_object_unpin_fence(obj);
+	if (view.type == I915_GGTT_VIEW_NORMAL)
+		i915_gem_object_unpin_fence(obj);
+
  	i915_gem_object_unpin_from_display_plane(obj, &view);
  }
 

Ok to merge Chris and Ville ?

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#29 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v3)

In reply to Vivek Kasireddy
Quoted 25 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

v3:
Pin and unpin a fence only if the current view type is normal.

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 2fdfca1..ac06f8c 100644

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2423

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -2419,7 +2419,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (view.type == I915_GGTT_VIEW_NORMAL)
+		ret = i915_gem_object_get_fence(obj);

Missing the same check for the pin_fence().

Quoted 16 lines
drivers/gpu/drm/i915/intel_display.c +3 -1
 	if (ret == -EDEADLK) {
 		/*
 		 * -EDEADLK means there are no free fences
@@ -2460,7 +2461,9 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,
 	ret = intel_fill_fb_ggtt_view(&view, fb, plane_state);
 	WARN_ONCE(ret, "Couldn't get view from plane state!");
 
-	i915_gem_object_unpin_fence(obj);
+	if (view.type == I915_GGTT_VIEW_NORMAL)
+		i915_gem_object_unpin_fence(obj);
+
 	i915_gem_object_unpin_from_display_plane(obj, &view);
 }
 
Signature · 1 line
2.4.3
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#30 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v3)

Quoted 21 lines · Ville Syrjälä
Quoted 20 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

v3:
Pin and unpin a fence only if the current view type is normal.

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Ville Syrjala <[email protected]>
---
  drivers/gpu/drm/i915/intel_display.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/gpu/drm/i915/intel_display.c intel_pin_and_fence_fb_obj(struct drm_plane *plane, · line 2423

Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c +2 -1
index 2fdfca1..ac06f8c 100644
@@ -2419,7 +2419,8 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  	 * framebuffer compression.  For simplicity, we always install
  	 * a fence as the cost is not that onerous.
  	 */
-	ret = i915_gem_object_get_fence(obj);
+	if (view.type == I915_GGTT_VIEW_NORMAL)
+		ret = i915_gem_object_get_fence(obj);

Missing the same check for the pin_fence().

Well spotted. :(

So a fence leak and another testcase needed to exercise it.

Pin normal, then pin rotated, unpin both = leak one fence. Repeat num_fences times until no more fences and fail?

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#31 lore raw

PATCH 1/1 drm/i915: Skip fence installation for objects with rotated views (v4)

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

v3:
Pin and unpin a fence only if the current view type is normal.

v4:
Extend the "view type is normal" check for pin_fence as well.

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +20 -16
index 2fdfca1..9c80968 100644
@@ -2419,22 +2419,24 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
-	if (ret == -EDEADLK) {
-		/*
-		 * -EDEADLK means there are no free fences
-		 * no pending flips.
-		 *
-		 * This is propagated to atomic, but it uses
-		 * -EDEADLK to force a locking recovery, so
-		 * change the returned error to -EBUSY.
-		 */
-		ret = -EBUSY;
-		goto err_unpin;
-	} else if (ret)
-		goto err_unpin;
+	if (view.type == I915_GGTT_VIEW_NORMAL) {
+		ret = i915_gem_object_get_fence(obj);
+		if (ret == -EDEADLK) {
+			/*
+			 * -EDEADLK means there are no free fences
+			 * no pending flips.
+			 *
+			 * This is propagated to atomic, but it uses
+			 * -EDEADLK to force a locking recovery, so
+			 * change the returned error to -EBUSY.
+			 */
+			ret = -EBUSY;
+			goto err_unpin;
+		} else if (ret)
+			goto err_unpin;
 
-	i915_gem_object_pin_fence(obj);
+		i915_gem_object_pin_fence(obj);
+	}
 
 	dev_priv->mm.interruptible = true;
 	intel_runtime_pm_put(dev_priv);
@@ -2460,7 +2462,9 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,
 	ret = intel_fill_fb_ggtt_view(&view, fb, plane_state);
 	WARN_ONCE(ret, "Couldn't get view from plane state!");
 
-	i915_gem_object_unpin_fence(obj);
+	if (view.type == I915_GGTT_VIEW_NORMAL)
+		i915_gem_object_unpin_fence(obj);
+
 	i915_gem_object_unpin_from_display_plane(obj, &view);
 }
 
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#32 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v4)

Quoted 12 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

v3:
Pin and unpin a fence only if the current view type is normal.

Quoted 7 lines

v4:
Extend the "view type is normal" check for pin_fence as well.

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Ville Syrjala <[email protected]>

lgtm

Quoted 61 lines
---
 drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +20 -16
index 2fdfca1..9c80968 100644
@@ -2419,22 +2419,24 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
-	if (ret == -EDEADLK) {
-		/*
-		 * -EDEADLK means there are no free fences
-		 * no pending flips.
-		 *
-		 * This is propagated to atomic, but it uses
-		 * -EDEADLK to force a locking recovery, so
-		 * change the returned error to -EBUSY.
-		 */
-		ret = -EBUSY;
-		goto err_unpin;
-	} else if (ret)
-		goto err_unpin;
+	if (view.type == I915_GGTT_VIEW_NORMAL) {
+		ret = i915_gem_object_get_fence(obj);
+		if (ret == -EDEADLK) {
+			/*
+			 * -EDEADLK means there are no free fences
+			 * no pending flips.
+			 *
+			 * This is propagated to atomic, but it uses
+			 * -EDEADLK to force a locking recovery, so
+			 * change the returned error to -EBUSY.
+			 */
+			ret = -EBUSY;
+			goto err_unpin;
+		} else if (ret)
+			goto err_unpin;
 
-	i915_gem_object_pin_fence(obj);
+		i915_gem_object_pin_fence(obj);
+	}
 
 	dev_priv->mm.interruptible = true;
 	intel_runtime_pm_put(dev_priv);
@@ -2460,7 +2462,9 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,
 	ret = intel_fill_fb_ggtt_view(&view, fb, plane_state);
 	WARN_ONCE(ret, "Couldn't get view from plane state!");
 
-	i915_gem_object_unpin_fence(obj);
+	if (view.type == I915_GGTT_VIEW_NORMAL)
+		i915_gem_object_unpin_fence(obj);
+
 	i915_gem_object_unpin_from_display_plane(obj, &view);
 }
 
Signature · 1 line
2.4.3
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Applied
#33 lore raw

Re: [PATCH] drm/i915: Skip fence installation for objects with rotated views (v4)

Quoted 16 lines · Ville Syrjälä
Quoted 15 lines · Vivek Kasireddy

While pinning a fb object to the display plane, only install a fence if the object is using a normal view. This corresponds with the behavior found in i915_gem_object_do_pin() where the fencability criteria is determined only for objects with normal views.

v2:
Look at the object's map_and_fenceable flag to determine whether to install a fence or not (Chris).

v3:
Pin and unpin a fence only if the current view type is normal.

v4:
Extend the "view type is normal" check for pin_fence as well.

Quoted 7 lines
Quoted 4 lines
Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Ville Syrjala <[email protected]>

lgtm

Pushed to drm-intel-next-fixes, thanks for the patch and review.

BR,
Jani.

Quoted 62 lines
Quoted 62 lines
---
 drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +20 -16
index 2fdfca1..9c80968 100644
@@ -2419,22 +2419,24 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
 	 * framebuffer compression.  For simplicity, we always install
 	 * a fence as the cost is not that onerous.
 	 */
-	ret = i915_gem_object_get_fence(obj);
-	if (ret == -EDEADLK) {
-		/*
-		 * -EDEADLK means there are no free fences
-		 * no pending flips.
-		 *
-		 * This is propagated to atomic, but it uses
-		 * -EDEADLK to force a locking recovery, so
-		 * change the returned error to -EBUSY.
-		 */
-		ret = -EBUSY;
-		goto err_unpin;
-	} else if (ret)
-		goto err_unpin;
+	if (view.type == I915_GGTT_VIEW_NORMAL) {
+		ret = i915_gem_object_get_fence(obj);
+		if (ret == -EDEADLK) {
+			/*
+			 * -EDEADLK means there are no free fences
+			 * no pending flips.
+			 *
+			 * This is propagated to atomic, but it uses
+			 * -EDEADLK to force a locking recovery, so
+			 * change the returned error to -EBUSY.
+			 */
+			ret = -EBUSY;
+			goto err_unpin;
+		} else if (ret)
+			goto err_unpin;
 
-	i915_gem_object_pin_fence(obj);
+		i915_gem_object_pin_fence(obj);
+	}
 
 	dev_priv->mm.interruptible = true;
 	intel_runtime_pm_put(dev_priv);
@@ -2460,7 +2462,9 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,
 	ret = intel_fill_fb_ggtt_view(&view, fb, plane_state);
 	WARN_ONCE(ret, "Couldn't get view from plane state!");
 
-	i915_gem_object_unpin_fence(obj);
+	if (view.type == I915_GGTT_VIEW_NORMAL)
+		i915_gem_object_unpin_fence(obj);
+
 	i915_gem_object_unpin_from_display_plane(obj, &view);
 }
 
Signature · 1 line
2.4.3
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx