drm/i915: add infrastructure to hold off preemption on a request

We want to set this flag in the next commit on requests containing
perf queries so that the result of the perf query can just be a delta
of global counters, rather than doing post processing of the OA
buffer.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
[ickle: add basic selftest for nopreempt]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190709164227.25859-1-chris@chris-wilson.co.uk
This commit is contained in:
Lionel Landwerlin
2019-07-09 17:42:27 +01:00
committed by Chris Wilson
parent 46c5847e3d
commit 2a98f4e65b
7 changed files with 161 additions and 6 deletions

View File

@@ -216,7 +216,9 @@ struct i915_request {
/** Time at which this request was emitted, in jiffies. */
unsigned long emitted_jiffies;
bool waitboost;
unsigned long flags;
#define I915_REQUEST_WAITBOOST BIT(0)
#define I915_REQUEST_NOPREEMPT BIT(1)
/** timeline->request entry for this request */
struct list_head link;
@@ -430,6 +432,17 @@ static inline void i915_request_mark_complete(struct i915_request *rq)
rq->hwsp_seqno = (u32 *)&rq->fence.seqno; /* decouple from HWSP */
}
static inline bool i915_request_has_waitboost(const struct i915_request *rq)
{
return rq->flags & I915_REQUEST_WAITBOOST;
}
static inline bool i915_request_has_nopreempt(const struct i915_request *rq)
{
/* Preemption should only be disabled very rarely */
return unlikely(rq->flags & I915_REQUEST_NOPREEMPT);
}
bool i915_retire_requests(struct drm_i915_private *i915);
#endif /* I915_REQUEST_H */