Commit eb5c10cb authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Remove I915_USER_PRIORITY_SHIFT

As we do not have any internal priority levels, the priority can be set
directed from the user values.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarAndi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210120121439.17600-2-chris@chris-wilson.co.ukSigned-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 2867ff6c
...@@ -11382,9 +11382,7 @@ int ...@@ -11382,9 +11382,7 @@ int
intel_prepare_plane_fb(struct drm_plane *_plane, intel_prepare_plane_fb(struct drm_plane *_plane,
struct drm_plane_state *_new_plane_state) struct drm_plane_state *_new_plane_state)
{ {
struct i915_sched_attr attr = { struct i915_sched_attr attr = { .priority = I915_PRIORITY_DISPLAY };
.priority = I915_USER_PRIORITY(I915_PRIORITY_DISPLAY),
};
struct intel_plane *plane = to_intel_plane(_plane); struct intel_plane *plane = to_intel_plane(_plane);
struct intel_plane_state *new_plane_state = struct intel_plane_state *new_plane_state =
to_intel_plane_state(_new_plane_state); to_intel_plane_state(_new_plane_state);
......
...@@ -679,7 +679,7 @@ __create_context(struct drm_i915_private *i915) ...@@ -679,7 +679,7 @@ __create_context(struct drm_i915_private *i915)
kref_init(&ctx->ref); kref_init(&ctx->ref);
ctx->i915 = i915; ctx->i915 = i915;
ctx->sched.priority = I915_USER_PRIORITY(I915_PRIORITY_NORMAL); ctx->sched.priority = I915_PRIORITY_NORMAL;
mutex_init(&ctx->mutex); mutex_init(&ctx->mutex);
INIT_LIST_HEAD(&ctx->link); INIT_LIST_HEAD(&ctx->link);
...@@ -1959,7 +1959,7 @@ static int set_priority(struct i915_gem_context *ctx, ...@@ -1959,7 +1959,7 @@ static int set_priority(struct i915_gem_context *ctx,
!capable(CAP_SYS_NICE)) !capable(CAP_SYS_NICE))
return -EPERM; return -EPERM;
ctx->sched.priority = I915_USER_PRIORITY(priority); ctx->sched.priority = priority;
context_apply_all(ctx, __apply_priority, ctx); context_apply_all(ctx, __apply_priority, ctx);
return 0; return 0;
...@@ -2463,7 +2463,7 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data, ...@@ -2463,7 +2463,7 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,
case I915_CONTEXT_PARAM_PRIORITY: case I915_CONTEXT_PARAM_PRIORITY:
args->size = 0; args->size = 0;
args->value = ctx->sched.priority >> I915_USER_PRIORITY_SHIFT; args->value = ctx->sched.priority;
break; break;
case I915_CONTEXT_PARAM_SSEU: case I915_CONTEXT_PARAM_SSEU:
......
...@@ -220,7 +220,7 @@ static int igt_fill_blt_thread(void *arg) ...@@ -220,7 +220,7 @@ static int igt_fill_blt_thread(void *arg)
return PTR_ERR(ctx); return PTR_ERR(ctx);
prio = i915_prandom_u32_max_state(I915_PRIORITY_MAX, prng); prio = i915_prandom_u32_max_state(I915_PRIORITY_MAX, prng);
ctx->sched.priority = I915_USER_PRIORITY(prio); ctx->sched.priority = prio;
} }
ce = i915_gem_context_get_engine(ctx, 0); ce = i915_gem_context_get_engine(ctx, 0);
...@@ -338,7 +338,7 @@ static int igt_copy_blt_thread(void *arg) ...@@ -338,7 +338,7 @@ static int igt_copy_blt_thread(void *arg)
return PTR_ERR(ctx); return PTR_ERR(ctx);
prio = i915_prandom_u32_max_state(I915_PRIORITY_MAX, prng); prio = i915_prandom_u32_max_state(I915_PRIORITY_MAX, prng);
ctx->sched.priority = I915_USER_PRIORITY(prio); ctx->sched.priority = prio;
} }
ce = i915_gem_context_get_engine(ctx, 0); ce = i915_gem_context_get_engine(ctx, 0);
......
...@@ -81,9 +81,7 @@ static void show_heartbeat(const struct i915_request *rq, ...@@ -81,9 +81,7 @@ static void show_heartbeat(const struct i915_request *rq,
static void heartbeat(struct work_struct *wrk) static void heartbeat(struct work_struct *wrk)
{ {
struct i915_sched_attr attr = { struct i915_sched_attr attr = { .priority = I915_PRIORITY_MIN };
.priority = I915_USER_PRIORITY(I915_PRIORITY_MIN),
};
struct intel_engine_cs *engine = struct intel_engine_cs *engine =
container_of(wrk, typeof(*engine), heartbeat.work.work); container_of(wrk, typeof(*engine), heartbeat.work.work);
struct intel_context *ce = engine->kernel_context; struct intel_context *ce = engine->kernel_context;
...@@ -127,7 +125,7 @@ static void heartbeat(struct work_struct *wrk) ...@@ -127,7 +125,7 @@ static void heartbeat(struct work_struct *wrk)
*/ */
attr.priority = 0; attr.priority = 0;
if (rq->sched.attr.priority >= attr.priority) if (rq->sched.attr.priority >= attr.priority)
attr.priority |= I915_USER_PRIORITY(I915_PRIORITY_HEARTBEAT); attr.priority = I915_PRIORITY_HEARTBEAT;
if (rq->sched.attr.priority >= attr.priority) if (rq->sched.attr.priority >= attr.priority)
attr.priority = I915_PRIORITY_BARRIER; attr.priority = I915_PRIORITY_BARRIER;
...@@ -285,9 +283,7 @@ int intel_engine_pulse(struct intel_engine_cs *engine) ...@@ -285,9 +283,7 @@ int intel_engine_pulse(struct intel_engine_cs *engine)
int intel_engine_flush_barriers(struct intel_engine_cs *engine) int intel_engine_flush_barriers(struct intel_engine_cs *engine)
{ {
struct i915_sched_attr attr = { struct i915_sched_attr attr = { .priority = I915_PRIORITY_MIN };
.priority = I915_USER_PRIORITY(I915_PRIORITY_MIN),
};
struct intel_context *ce = engine->kernel_context; struct intel_context *ce = engine->kernel_context;
struct i915_request *rq; struct i915_request *rq;
int err; int err;
......
...@@ -321,7 +321,7 @@ static int live_unlite_switch(void *arg) ...@@ -321,7 +321,7 @@ static int live_unlite_switch(void *arg)
static int live_unlite_preempt(void *arg) static int live_unlite_preempt(void *arg)
{ {
return live_unlite_restore(arg, I915_USER_PRIORITY(I915_PRIORITY_MAX)); return live_unlite_restore(arg, I915_PRIORITY_MAX);
} }
static int live_unlite_ring(void *arg) static int live_unlite_ring(void *arg)
...@@ -1311,9 +1311,7 @@ static int live_timeslice_queue(void *arg) ...@@ -1311,9 +1311,7 @@ static int live_timeslice_queue(void *arg)
goto err_pin; goto err_pin;
for_each_engine(engine, gt, id) { for_each_engine(engine, gt, id) {
struct i915_sched_attr attr = { struct i915_sched_attr attr = { .priority = I915_PRIORITY_MAX };
.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX),
};
struct i915_request *rq, *nop; struct i915_request *rq, *nop;
if (!intel_engine_has_preemption(engine)) if (!intel_engine_has_preemption(engine))
...@@ -1528,14 +1526,12 @@ static int live_busywait_preempt(void *arg) ...@@ -1528,14 +1526,12 @@ static int live_busywait_preempt(void *arg)
ctx_hi = kernel_context(gt->i915); ctx_hi = kernel_context(gt->i915);
if (!ctx_hi) if (!ctx_hi)
return -ENOMEM; return -ENOMEM;
ctx_hi->sched.priority = ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY;
I915_USER_PRIORITY(I915_CONTEXT_MAX_USER_PRIORITY);
ctx_lo = kernel_context(gt->i915); ctx_lo = kernel_context(gt->i915);
if (!ctx_lo) if (!ctx_lo)
goto err_ctx_hi; goto err_ctx_hi;
ctx_lo->sched.priority = ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY;
I915_USER_PRIORITY(I915_CONTEXT_MIN_USER_PRIORITY);
obj = i915_gem_object_create_internal(gt->i915, PAGE_SIZE); obj = i915_gem_object_create_internal(gt->i915, PAGE_SIZE);
if (IS_ERR(obj)) { if (IS_ERR(obj)) {
...@@ -1732,14 +1728,12 @@ static int live_preempt(void *arg) ...@@ -1732,14 +1728,12 @@ static int live_preempt(void *arg)
ctx_hi = kernel_context(gt->i915); ctx_hi = kernel_context(gt->i915);
if (!ctx_hi) if (!ctx_hi)
goto err_spin_lo; goto err_spin_lo;
ctx_hi->sched.priority = ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY;
I915_USER_PRIORITY(I915_CONTEXT_MAX_USER_PRIORITY);
ctx_lo = kernel_context(gt->i915); ctx_lo = kernel_context(gt->i915);
if (!ctx_lo) if (!ctx_lo)
goto err_ctx_hi; goto err_ctx_hi;
ctx_lo->sched.priority = ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY;
I915_USER_PRIORITY(I915_CONTEXT_MIN_USER_PRIORITY);
for_each_engine(engine, gt, id) { for_each_engine(engine, gt, id) {
struct igt_live_test t; struct igt_live_test t;
...@@ -1832,7 +1826,7 @@ static int live_late_preempt(void *arg) ...@@ -1832,7 +1826,7 @@ static int live_late_preempt(void *arg)
goto err_ctx_hi; goto err_ctx_hi;
/* Make sure ctx_lo stays before ctx_hi until we trigger preemption. */ /* Make sure ctx_lo stays before ctx_hi until we trigger preemption. */
ctx_lo->sched.priority = I915_USER_PRIORITY(1); ctx_lo->sched.priority = 1;
for_each_engine(engine, gt, id) { for_each_engine(engine, gt, id) {
struct igt_live_test t; struct igt_live_test t;
...@@ -1873,7 +1867,7 @@ static int live_late_preempt(void *arg) ...@@ -1873,7 +1867,7 @@ static int live_late_preempt(void *arg)
goto err_wedged; goto err_wedged;
} }
attr.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX); attr.priority = I915_PRIORITY_MAX;
engine->schedule(rq, &attr); engine->schedule(rq, &attr);
if (!igt_wait_for_spinner(&spin_hi, rq)) { if (!igt_wait_for_spinner(&spin_hi, rq)) {
...@@ -1954,7 +1948,7 @@ static int live_nopreempt(void *arg) ...@@ -1954,7 +1948,7 @@ static int live_nopreempt(void *arg)
return -ENOMEM; return -ENOMEM;
if (preempt_client_init(gt, &b)) if (preempt_client_init(gt, &b))
goto err_client_a; goto err_client_a;
b.ctx->sched.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX); b.ctx->sched.priority = I915_PRIORITY_MAX;
for_each_engine(engine, gt, id) { for_each_engine(engine, gt, id) {
struct i915_request *rq_a, *rq_b; struct i915_request *rq_a, *rq_b;
...@@ -2419,11 +2413,9 @@ static int live_preempt_cancel(void *arg) ...@@ -2419,11 +2413,9 @@ static int live_preempt_cancel(void *arg)
static int live_suppress_self_preempt(void *arg) static int live_suppress_self_preempt(void *arg)
{ {
struct i915_sched_attr attr = { .priority = I915_PRIORITY_MAX };
struct intel_gt *gt = arg; struct intel_gt *gt = arg;
struct intel_engine_cs *engine; struct intel_engine_cs *engine;
struct i915_sched_attr attr = {
.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX)
};
struct preempt_client a, b; struct preempt_client a, b;
enum intel_engine_id id; enum intel_engine_id id;
int err = -ENOMEM; int err = -ENOMEM;
...@@ -2554,9 +2546,7 @@ static int live_chain_preempt(void *arg) ...@@ -2554,9 +2546,7 @@ static int live_chain_preempt(void *arg)
goto err_client_hi; goto err_client_hi;
for_each_engine(engine, gt, id) { for_each_engine(engine, gt, id) {
struct i915_sched_attr attr = { struct i915_sched_attr attr = { .priority = I915_PRIORITY_MAX };
.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX),
};
struct igt_live_test t; struct igt_live_test t;
struct i915_request *rq; struct i915_request *rq;
int ring_size, count, i; int ring_size, count, i;
...@@ -2975,9 +2965,7 @@ static int live_preempt_gang(void *arg) ...@@ -2975,9 +2965,7 @@ static int live_preempt_gang(void *arg)
return -EIO; return -EIO;
do { do {
struct i915_sched_attr attr = { struct i915_sched_attr attr = { .priority = prio++ };
.priority = I915_USER_PRIORITY(prio++),
};
err = create_gang(engine, &rq); err = create_gang(engine, &rq);
if (err) if (err)
...@@ -3013,7 +3001,7 @@ static int live_preempt_gang(void *arg) ...@@ -3013,7 +3001,7 @@ static int live_preempt_gang(void *arg)
drm_info_printer(engine->i915->drm.dev); drm_info_printer(engine->i915->drm.dev);
pr_err("Failed to flush chain of %d requests, at %d\n", pr_err("Failed to flush chain of %d requests, at %d\n",
prio, rq_prio(rq) >> I915_USER_PRIORITY_SHIFT); prio, rq_prio(rq));
intel_engine_dump(engine, &p, intel_engine_dump(engine, &p,
"%s\n", engine->name); "%s\n", engine->name);
...@@ -3383,14 +3371,12 @@ static int live_preempt_timeout(void *arg) ...@@ -3383,14 +3371,12 @@ static int live_preempt_timeout(void *arg)
ctx_hi = kernel_context(gt->i915); ctx_hi = kernel_context(gt->i915);
if (!ctx_hi) if (!ctx_hi)
goto err_spin_lo; goto err_spin_lo;
ctx_hi->sched.priority = ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY;
I915_USER_PRIORITY(I915_CONTEXT_MAX_USER_PRIORITY);
ctx_lo = kernel_context(gt->i915); ctx_lo = kernel_context(gt->i915);
if (!ctx_lo) if (!ctx_lo)
goto err_ctx_hi; goto err_ctx_hi;
ctx_lo->sched.priority = ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY;
I915_USER_PRIORITY(I915_CONTEXT_MIN_USER_PRIORITY);
for_each_engine(engine, gt, id) { for_each_engine(engine, gt, id) {
unsigned long saved_timeout; unsigned long saved_timeout;
......
...@@ -24,9 +24,6 @@ enum { ...@@ -24,9 +24,6 @@ enum {
I915_PRIORITY_DISPLAY, I915_PRIORITY_DISPLAY,
}; };
#define I915_USER_PRIORITY_SHIFT 0
#define I915_USER_PRIORITY(x) ((x) << I915_USER_PRIORITY_SHIFT)
/* Smallest priority value that cannot be bumped. */ /* Smallest priority value that cannot be bumped. */
#define I915_PRIORITY_INVALID (INT_MIN) #define I915_PRIORITY_INVALID (INT_MIN)
......
...@@ -71,7 +71,6 @@ i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio) ...@@ -71,7 +71,6 @@ i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio)
lockdep_assert_held(&engine->active.lock); lockdep_assert_held(&engine->active.lock);
assert_priolists(execlists); assert_priolists(execlists);
prio >>= I915_USER_PRIORITY_SHIFT;
if (unlikely(execlists->no_priolist)) if (unlikely(execlists->no_priolist))
prio = I915_PRIORITY_NORMAL; prio = I915_PRIORITY_NORMAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment