On Sun, 15 Sep 2019 04:24:41 -0700, Lionel Landwerlin wrote: > > On 14/09/2019 02:06, Umesh Nerlige Ramappa wrote: > > OA perf unit supports non-power of 2 report sizes. Enable support for > > these sizes in the driver. > > > > Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@xxxxxxxxx> > > --- > > drivers/gpu/drm/i915/i915_perf.c | 59 ++++++++++++-------------------- > > 1 file changed, 21 insertions(+), 38 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c > > index 50b6d154fd46..482fca3da7de 100644 > > --- a/drivers/gpu/drm/i915/i915_perf.c > > +++ b/drivers/gpu/drm/i915/i915_perf.c > > @@ -450,7 +450,7 @@ static bool oa_buffer_check_unlocked(struct i915_perf_stream *stream) > > u32 gtt_offset = i915_ggtt_offset(stream->oa_buffer.vma); > > int report_size = stream->oa_buffer.format_size; > > unsigned long flags; > > - u32 hw_tail; > > + u32 hw_tail, aging_tail; > > u64 now; > > /* We have to consider the (unlikely) possibility that read() > > errors > > @@ -459,16 +459,17 @@ static bool oa_buffer_check_unlocked(struct i915_perf_stream *stream) > > */ > > spin_lock_irqsave(&stream->oa_buffer.ptr_lock, flags); > > - hw_tail = dev_priv->perf.ops.oa_hw_tail_read(stream); > > + hw_tail = dev_priv->perf.ops.oa_hw_tail_read(stream) - gtt_offset; > > + aging_tail = stream->oa_buffer.aging_tail - gtt_offset; > > /* The tail pointer increases in 64 byte increments, > > * not in report_size steps... > > */ > > - hw_tail &= ~(report_size - 1); > > + hw_tail = OA_TAKEN(hw_tail, (OA_TAKEN(hw_tail, aging_tail) % report_size)); > > > I'm struggling to parse this line above and I'm not 100% sure it's correct. > > Could add a comment to explain what is going on? Also for efficiency perhaps the modulo (%) should be replaced by a increment, compare and wraparound? Thanks! -- Ashutosh _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx