Re: [PATCH 079/190] drm/i915: Reduce the pointer dance of i915_is_ggtt()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 15, 2016 at 12:12:15PM +0000, Dave Gordon wrote:
> On 11/01/16 09:17, Chris Wilson wrote:
> >The multiple levels of indirect do nothing but hinder the compiler and
> >the pointer chasing turns to be quite painful but painless to fix.
> >
> >Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> >---
> >  drivers/gpu/drm/i915/i915_debugfs.c        | 13 ++++++-------
> >  drivers/gpu/drm/i915/i915_drv.h            |  7 -------
> >  drivers/gpu/drm/i915/i915_gem.c            | 18 +++++++-----------
> >  drivers/gpu/drm/i915/i915_gem_execbuffer.c |  5 ++---
> >  drivers/gpu/drm/i915/i915_gem_gtt.c        | 12 +++++-------
> >  drivers/gpu/drm/i915/i915_gem_gtt.h        |  5 +++++
> >  drivers/gpu/drm/i915/i915_trace.h          | 27 ++++++++-------------------
> >  7 files changed, 33 insertions(+), 54 deletions(-)
> 
> [snip]
> 
> >diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> >index c9c1a5cdc1e5..f840cc55f1ab 100644
> >--- a/drivers/gpu/drm/i915/i915_drv.h
> >+++ b/drivers/gpu/drm/i915/i915_drv.h
> >@@ -2905,18 +2905,11 @@ bool i915_gem_obj_is_pinned(struct drm_i915_gem_object *obj);
> >  /* Some GGTT VM helpers */
> >  #define i915_obj_to_ggtt(obj) \
> >  	(&((struct drm_i915_private *)(obj)->base.dev->dev_private)->gtt.base)
> >-static inline bool i915_is_ggtt(struct i915_address_space *vm)
> >-{
> >-	struct i915_address_space *ggtt =
> >-		&((struct drm_i915_private *)(vm)->dev->dev_private)->gtt.base;
> >-	return vm == ggtt;
> >-}
> 
> >diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> >index b5c3bbe6dc2a..06117bd0fc00 100644
> >--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> >+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> >@@ -3150,6 +3150,7 @@ int i915_gem_gtt_init(struct drm_device *dev)
> >  	}
> >
> >  	gtt->base.dev = dev;
> >+	gtt->base.is_ggtt = true;
> 
> So, it looks like the plan here is that when we need to determine
> whether something is the special distinguished instance of a type,
> then instead of comparing its address against the global pointer to
> the distinguished instance, we'll just look for a flag /inside/ the
> object itself, which is set /only/ on the distinguished instance.
> 
> Now why didn't I think of that? That looks like such a good idea, we
> should apply it in other CONTEXTs!

But we already have that flag in contexts! It also happens to be useful
for other tracking as well. And we demonstrated that we didn't even need
the checks for the kernel context anyway.

You will also note this is a small stepping patch after which we
transition away from i915_address_space.is_ggtt to using the owner.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux