@@ -2120,6 +2120,8 @@ struct i915_perf_stream {
struct {
struct i915_vma *vma;
u8 *vaddr;
+#define I915_PERF_CMD_STREAM_BUF_STATUS_OVERFLOW (1<<0)
+ u32 status;
} cs_buffer;
struct list_head cs_samples;
@@ -613,8 +613,11 @@ static void i915_perf_stream_patch_request(struct i915_perf_stream *stream,
while (sample_id < MAX_REQUEST_SAMPLE_ID) {
spin_lock_irqsave(&stream->samples_lock, flags);
- if (list_empty(&stream->free_samples))
+ if (list_empty(&stream->free_samples)) {
+ stream->cs_buffer.status |=
+ I915_PERF_CMD_STREAM_BUF_STATUS_OVERFLOW;
release_perf_sample(stream);
+ }
sample = list_first_entry_or_null(&stream->free_samples,
struct i915_perf_cs_sample, link);
WARN_ON(sample == NULL);
@@ -1572,6 +1575,17 @@ static int append_cs_buffer_samples(struct i915_perf_stream *stream,
LIST_HEAD(free_list);
int ret = 0;
unsigned long flags;
+ u32 status = stream->cs_buffer.status;
+
+ if (unlikely(status & I915_PERF_CMD_STREAM_BUF_STATUS_OVERFLOW)) {
+ ret = append_oa_status(stream, buf, count, offset,
+ DRM_I915_PERF_RECORD_OA_BUFFER_LOST);
+ if (ret)
+ return ret;
+
+ stream->cs_buffer.status &=
+ ~I915_PERF_CMD_STREAM_BUF_STATUS_OVERFLOW;
+ }
spin_lock_irqsave(&stream->samples_lock, flags);
if (list_empty(&stream->cs_samples)) {