diff mbox

drm/i915: Tighten obj->map_and_fenceable

Message ID 1425045523-378-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Feb. 27, 2015, 1:58 p.m. UTC
For an object right on the boundary of mappable space, as the fenceable
size is stricly greater than the actual size, its fence region may extend
out of mappable space.

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

Comments

Daniel Vetter Feb. 27, 2015, 3:32 p.m. UTC | #1
On Fri, Feb 27, 2015 at 01:58:43PM +0000, Chris Wilson wrote:
> For an object right on the boundary of mappable space, as the fenceable
> size is stricly greater than the actual size, its fence region may extend
> out of mappable space.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Do you have a scenario where this could blow up? Given the pot alignment
and fence_size constraints these two should still be equivalent.

Ack if I do an s/tighten/clarify/ and amend your commit message?
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index df27234b5942..aa0d9e2c91f5 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4231,7 +4231,7 @@ i915_gem_object_pin_view(struct drm_i915_gem_object *obj,
>  		fenceable = (vma->node.size >= fence_size &&
>  			     (vma->node.start & (fence_alignment - 1)) == 0);
>  
> -		mappable = (vma->node.start + obj->base.size <=
> +		mappable = (vma->node.start + fence_size <=
>  			    dev_priv->gtt.mappable_end);
>  
>  		obj->map_and_fenceable = mappable && fenceable;
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson Feb. 27, 2015, 4:37 p.m. UTC | #2
On Fri, Feb 27, 2015 at 04:32:26PM +0100, Daniel Vetter wrote:
> On Fri, Feb 27, 2015 at 01:58:43PM +0000, Chris Wilson wrote:
> > For an object right on the boundary of mappable space, as the fenceable
> > size is stricly greater than the actual size, its fence region may extend
> > out of mappable space.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Do you have a scenario where this could blow up? Given the pot alignment
> and fence_size constraints these two should still be equivalent.

It could only concievably impact PNV (the only system where we have non-mappable
and fence_size > obj.base.size), and the alignment there is always the
fence size as well which would prevent the overlap.

> Ack if I do an s/tighten/clarify/ and amend your commit message?
Ok.
-Chris
Daniel Vetter Feb. 27, 2015, 6:02 p.m. UTC | #3
On Fri, Feb 27, 2015 at 04:37:29PM +0000, Chris Wilson wrote:
> On Fri, Feb 27, 2015 at 04:32:26PM +0100, Daniel Vetter wrote:
> > On Fri, Feb 27, 2015 at 01:58:43PM +0000, Chris Wilson wrote:
> > > For an object right on the boundary of mappable space, as the fenceable
> > > size is stricly greater than the actual size, its fence region may extend
> > > out of mappable space.
> > > 
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > 
> > Do you have a scenario where this could blow up? Given the pot alignment
> > and fence_size constraints these two should still be equivalent.
> 
> It could only concievably impact PNV (the only system where we have non-mappable
> and fence_size > obj.base.size), and the alignment there is always the
> fence size as well which would prevent the overlap.
> 
> > Ack if I do an s/tighten/clarify/ and amend your commit message?
> Ok.

Queued for -next, thanks for the patch.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index df27234b5942..aa0d9e2c91f5 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4231,7 +4231,7 @@  i915_gem_object_pin_view(struct drm_i915_gem_object *obj,
 		fenceable = (vma->node.size >= fence_size &&
 			     (vma->node.start & (fence_alignment - 1)) == 0);
 
-		mappable = (vma->node.start + obj->base.size <=
+		mappable = (vma->node.start + fence_size <=
 			    dev_priv->gtt.mappable_end);
 
 		obj->map_and_fenceable = mappable && fenceable;