Skip to content

Commit a211da9

Browse files
committed
drm/i915/gt: Make timeslicing an explicit engine property
In order to allow userspace to rely on timeslicing to reorder their batches, we must support preemption of those user batches. Declare timeslicing as an explicit property that is a combination of having the kernel support and HW support. Suggested-by: Tvrtko Ursulin <[email protected]> Fixes: 8ee36e0 ("drm/i915/execlists: Minimalistic timeslicing") Signed-off-by: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 3b55cde commit a211da9

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

drivers/gpu/drm/i915/gt/intel_engine.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,4 @@ intel_engine_has_preempt_reset(const struct intel_engine_cs *engine)
332332
return intel_engine_has_preemption(engine);
333333
}
334334

335-
static inline bool
336-
intel_engine_has_timeslices(const struct intel_engine_cs *engine)
337-
{
338-
if (!IS_ACTIVE(CONFIG_DRM_I915_TIMESLICE_DURATION))
339-
return false;
340-
341-
return intel_engine_has_semaphores(engine);
342-
}
343-
344335
#endif /* _INTEL_RINGBUFFER_H_ */

drivers/gpu/drm/i915/gt/intel_engine_types.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,11 @@ struct intel_engine_cs {
492492
#define I915_ENGINE_SUPPORTS_STATS BIT(1)
493493
#define I915_ENGINE_HAS_PREEMPTION BIT(2)
494494
#define I915_ENGINE_HAS_SEMAPHORES BIT(3)
495-
#define I915_ENGINE_NEEDS_BREADCRUMB_TASKLET BIT(4)
496-
#define I915_ENGINE_IS_VIRTUAL BIT(5)
497-
#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(6)
498-
#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(7)
495+
#define I915_ENGINE_HAS_TIMESLICES BIT(4)
496+
#define I915_ENGINE_NEEDS_BREADCRUMB_TASKLET BIT(5)
497+
#define I915_ENGINE_IS_VIRTUAL BIT(6)
498+
#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(7)
499+
#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(8)
499500
unsigned int flags;
500501

501502
/*
@@ -593,6 +594,15 @@ intel_engine_has_semaphores(const struct intel_engine_cs *engine)
593594
return engine->flags & I915_ENGINE_HAS_SEMAPHORES;
594595
}
595596

597+
static inline bool
598+
intel_engine_has_timeslices(const struct intel_engine_cs *engine)
599+
{
600+
if (!IS_ACTIVE(CONFIG_DRM_I915_TIMESLICE_DURATION))
601+
return false;
602+
603+
return engine->flags & I915_ENGINE_HAS_TIMESLICES;
604+
}
605+
596606
static inline bool
597607
intel_engine_needs_breadcrumb_tasklet(const struct intel_engine_cs *engine)
598608
{

drivers/gpu/drm/i915/gt/intel_lrc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4801,8 +4801,11 @@ void intel_execlists_set_default_submission(struct intel_engine_cs *engine)
48014801
engine->flags |= I915_ENGINE_SUPPORTS_STATS;
48024802
if (!intel_vgpu_active(engine->i915)) {
48034803
engine->flags |= I915_ENGINE_HAS_SEMAPHORES;
4804-
if (HAS_LOGICAL_RING_PREEMPTION(engine->i915))
4804+
if (HAS_LOGICAL_RING_PREEMPTION(engine->i915)) {
48054805
engine->flags |= I915_ENGINE_HAS_PREEMPTION;
4806+
if (IS_ACTIVE(CONFIG_DRM_I915_TIMESLICE_DURATION))
4807+
engine->flags |= I915_ENGINE_HAS_TIMESLICES;
4808+
}
48064809
}
48074810

48084811
if (INTEL_GEN(engine->i915) >= 12)

0 commit comments

Comments
 (0)