Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
rib committed Jul 28, 2016
1 parent 5fbf53e commit efd883a
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions drivers/gpu/drm/i915/i915_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,32 +384,44 @@ static int gen8_oa_read(struct i915_perf_stream *stream,
tail = I915_READ(GEN8_OATAILPTR) & GEN8_OATAILPTR_MASK;
oastatus = I915_READ(GEN8_OASTATUS);

if (unlikely(oastatus & (GEN8_OASTATUS_OABUFFER_OVERFLOW |
GEN8_OASTATUS_REPORT_LOST))) {

if (oastatus & GEN8_OASTATUS_OABUFFER_OVERFLOW) {
ret = append_oa_status(stream, read_state,
DRM_I915_PERF_RECORD_OA_BUFFER_LOST);
if (ret)
return ret;
/* We treat OABUFFER_OVERFLOW as a significant error:
*
* Although theoretically we could handle this more gracefully
* sometimes, some Gens don't correctly suppress certain
* automatically triggered reports in this condition and so we
* have to assume that old reports are now being trampled
* over.
*
* Considering how we don't currently give userspace control
* over the OA buffer size and always configure a large 16MB
* buffer, then a buffer overflow does anyway likely indicate
* that something has gone quite badly wrong.
*/
if (oastatus & GEN8_OASTATUS_OABUFFER_OVERFLOW) {
ret = append_oa_status(stream, read_state,
DRM_I915_PERF_RECORD_OA_BUFFER_LOST);
if (ret)
return ret;

oastatus &= ~GEN8_OASTATUS_OABUFFER_OVERFLOW;
}
DRM_ERROR("OA buffer overflow: force restart");

if (oastatus & GEN8_OASTATUS_REPORT_LOST) {
ret = append_oa_status(stream, read_state,
DRM_I915_PERF_RECORD_OA_REPORT_LOST);
if (ret == 0)
oastatus &= ~GEN8_OASTATUS_REPORT_LOST;
}
dev_priv->perf.oa.ops.oa_disable(dev_priv);
dev_priv->perf.oa.ops.oa_enable(dev_priv);

I915_WRITE(GEN8_OASTATUS, oastatus);
oastatus = I915_READ(GEN8_OASTATUS);

if (ret)
return ret;
head = I915_READ(GEN8_OAHEADPTR) & GEN8_OAHEADPTR_MASK;
tail = I915_READ(GEN8_OATAILPTR) & GEN8_OATAILPTR_MASK;
}

/* If there is still buffer space */
if (oastatus & GEN8_OASTATUS_REPORT_LOST) {
ret = append_oa_status(stream, read_state,
DRM_I915_PERF_RECORD_OA_REPORT_LOST);
if (ret == 0) {
I915_WRITE(GEN8_OASTATUS,
oastatus & ~GEN8_OASTATUS_REPORT_LOST);
}
}

ret = gen8_append_oa_reports(stream, read_state, &head, tail);

Expand Down

0 comments on commit efd883a

Please sign in to comment.