[Intel-gfx] [RFC 5/8] drm/i915: Add support for forwarding ring id in sample metadata through perf
Chris Wilson
chris at chris-wilson.co.uk
Wed Aug 5 02:26:08 PDT 2015
On Wed, Aug 05, 2015 at 11:25:41AM +0530, sourab.gupta at intel.com wrote:
> @@ -542,18 +548,27 @@ static void forward_one_gen_pmu_sample(struct drm_i915_private *dev_priv,
> struct perf_sample_data data;
> struct perf_event *event = dev_priv->gen_pmu.exclusive_event;
> int snapshot_size;
> - u8 *snapshot;
> + u8 *snapshot, *current_ptr;
> struct drm_i915_ts_node_ctx_id *ctx_info;
> + struct drm_i915_ts_node_ring_id *ring_info;
> struct perf_raw_record raw;
>
> - BUILD_BUG_ON(TS_DATA_SIZE != 8);
> - BUILD_BUG_ON(CTX_INFO_SIZE != 8);
> + BUILD_BUG_ON((TS_DATA_SIZE != 8) || (CTX_INFO_SIZE != 8) ||
> + (RING_INFO_SIZE != 8));
>
> snapshot = dev_priv->gen_pmu.buffer.addr + node->offset;
> snapshot_size = TS_DATA_SIZE + CTX_INFO_SIZE;
>
> ctx_info = (struct drm_i915_ts_node_ctx_id *)(snapshot + TS_DATA_SIZE);
> ctx_info->ctx_id = node->ctx_id;
> + current_ptr = snapshot + snapshot_size;
> +
> + if (dev_priv->gen_pmu.sample_info_flags & I915_GEN_PMU_SAMPLE_RING) {
> + ring_info = (struct drm_i915_ts_node_ring_id *)current_ptr;
> + ring_info->ring = node->ring;
Stylewise I would be move familar with current_ptr = ring_info + 1, and
make current_ptr void*. snapshot_size is then redundant.
> + snapshot_size += RING_INFO_SIZE;
> + current_ptr = snapshot + snapshot_size;
> + }
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list