[Intel-gfx] [RFC 4/8] drm/i915: Insert commands for capturing timestamps in the ring

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 5 02:30:22 PDT 2015


On Wed, Aug 05, 2015 at 11:25:40AM +0530, sourab.gupta at intel.com wrote:
> From: Sourab Gupta <sourab.gupta at intel.com>
> 
> This patch adds the routines through which one can insert commands in the
> ringbuf for capturing timestamps, which are used to insert these commands
> around the batchbuffer.
> 
> While inserting the commands, we keep a reference of associated request.
> This will be released when we are forwarding the samples to userspace
> (or when the event is being destroyed).
> Also, an active reference of the destination buffer is taken here, so that
> we can be assured that the buffer is freed up only after GPU is done with
> it, even if the local reference of the buffer is released.
> 
> v2: Changes (as suggested by Chris):
>     - Passing in 'request' struct for emit report function
>     - Removed multiple calls to i915_gem_obj_to_ggtt(). Keeping hold of
>       pinned vma from start and using when required.
>     - Better nomenclature, and error handling.
> 
> @@ -919,6 +993,7 @@ static int init_gen_pmu_buffer(struct perf_event *event)
>  	dev_priv->gen_pmu.buffer.obj = bo;
>  	dev_priv->gen_pmu.buffer.gtt_offset =
>  				i915_gem_obj_ggtt_offset(bo);
> +	dev_priv->gen_pmu.buffer.vma = i915_gem_obj_to_ggtt(bo);
>  	dev_priv->gen_pmu.buffer.addr = vmap_oa_buffer(bo);
>  	INIT_LIST_HEAD(&dev_priv->gen_pmu.node_list);

Still calling i915_gem_obj_to_ggtt(bo) twice! With pmu_buffer.vma you
can drop pmu_buffer.gtt_offset and never be confused again.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list