[Intel-gfx] [PATCH 02/12] drm/i915: Introduce i915_gem_object_get_dma_address()
Chris Wilson
chris at chris-wilson.co.uk
Wed Apr 20 12:08:44 UTC 2016
On Wed, Apr 20, 2016 at 04:47:29PM +0530, ankitprasad.r.sharma at intel.com wrote:
> From: Chris Wilson <chris at chris-wilson.co.uk>
>
> This utility function is a companion to i915_gem_object_get_page() that
> uses the same cached iterator for the scatterlist to perform fast
> sequential lookup of the dma address associated with any page within the
> object.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma at intel.com>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index b9ed1b3..883b706 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2977,6 +2977,23 @@ static inline int __sg_page_count(struct scatterlist *sg)
> struct page *
> i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n);
>
> +static inline dma_addr_t
> +i915_gem_object_get_dma_address(struct drm_i915_gem_object *obj, int n)
s/int n/unsigned long n/
> +{
Most recently, I felt this was too big to be inlined and stuck
lockdep_assert_held(&obj->base.dev->struct_mutex);
GEM_BUG_ON(n >= obj->base.size >> PAGE_SHIFT);
GEM_BUG_ON(obj->pages_pin_count == 0);
in here as well.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list