[Intel-gfx] [PATCH 5/5] drm/i915: Add support for getting size of the stolen region
Chris Wilson
chris at chris-wilson.co.uk
Tue May 5 05:54:10 PDT 2015
On Tue, May 05, 2015 at 05:12:25PM +0530, Ankitprasad Sharma wrote:
> On Wed, 2015-04-29 at 11:27 +0100, Chris Wilson wrote:
> > On Wed, Apr 29, 2015 at 03:01:59PM +0530, ankitprasad.r.sharma at intel.com wrote:
> > > From: Ankitprasad Sharma <ankitprasad.r.sharma at intel.com>
> > >
> > > This patch extends the get_aperture_ioctl to add support
> > > for getting total size of the stolen region and available
> > > size of the stolen region.
> > >
> > > testcase: igt/gem_create_stolen
> > >
> > > Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma at intel.com>
> > > ---
> > > drivers/gpu/drm/i915/i915_drv.h | 6 ++++++
> > > drivers/gpu/drm/i915/i915_gem.c | 15 ++++++++++++++-
> > > include/uapi/drm/i915_drm.h | 6 ++++++
> > > 3 files changed, 26 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > > index a568cd1..a40b44f 100644
> > > --- a/drivers/gpu/drm/i915/i915_drv.h
> > > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > > @@ -3277,4 +3277,10 @@ inline static bool i915_gem_obj_is_prw_allowed(struct drm_i915_gem_object *obj)
> > > return !obj->userptr.mm;
> > > }
> > >
> > > +inline static bool i915_gem_obj_is_stolen_used(struct drm_i915_gem_object *obj)
> > > +{
> > > + return obj->stolen && (i915_gem_obj_is_pinned(obj)
> > > + || obj->madv == I915_MADV_WILLNEED);
> > > +}
> > > +
> > > #endif
> > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > > index 3491bd3..ee93508 100644
> > > --- a/drivers/gpu/drm/i915/i915_gem.c
> > > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > > @@ -150,17 +150,30 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
> > > struct drm_i915_private *dev_priv = dev->dev_private;
> > > struct drm_i915_gem_get_aperture *args = data;
> > > struct drm_i915_gem_object *obj;
> > > - size_t pinned;
> > > + size_t pinned, pinned_stolen;
> > >
> > > pinned = 0;
> > > + pinned_stolen = 0;
> > > mutex_lock(&dev->struct_mutex);
> > > list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list)
> > > if (i915_gem_obj_is_pinned(obj))
> > > pinned += i915_gem_obj_ggtt_size(obj);
> > > +
> > > + /* Calculating available stolen size */
> > > + list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list)
> > > + if (i915_gem_obj_is_stolen_used(obj))
> > > + pinned_stolen += i915_gem_obj_ggtt_size(obj);
> > > +
> > > + list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list)
> > > + if (i915_gem_obj_is_stolen_used(obj))
> > > + pinned_stolen += i915_gem_obj_ggtt_size(obj);
> >
> > Ah, here you will want to iterate over the stolen drm_mm range manager
> > to get an accurate count.
> >
> > Could you respin this on top of
> > id:1422276205-8532-5-git-send-email-rodrigo.vivi at intel.com ?
>
> I have incorporated the comments suggested by you, as well as I went through Rodrigo's patch and as such there is no dependency between the two patches.
>
> So how do I float this patch? Shall I resend this as a separate patch in the series (1422276205-8532-5-git-send-email-rodrigo.vivi at intel.com) rebasing on top of Rodrigo's changes Or as a part of this series only?
I see this patch as primarily improving the get-aperture ioctl, in which
case I would like to address the known deficiency in it as well. It can
be more than one patche, though the ABI will have an implicit dependency
on them all.
I honestly don't mind how you present it, I just want the mappable info
through an ioctl as well...
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list