Skip to content

Commit

Permalink
drm/i915: Remove I915_USER_PRIORITY_SHIFT
Browse files Browse the repository at this point in the history
As we do not have any internal priority levels, the priority can be set
directed from the user values.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210120121439.17600-2-chris@chris-wilson.co.uk
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Chris Wilson authored and Daniel Vetter committed Mar 24, 2021
1 parent 2867ff6 commit eb5c10c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 48 deletions.
4 changes: 1 addition & 3 deletions drivers/gpu/drm/i915/display/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -11382,9 +11382,7 @@ int
intel_prepare_plane_fb(struct drm_plane *_plane,
struct drm_plane_state *_new_plane_state)
{
struct i915_sched_attr attr = {
.priority = I915_USER_PRIORITY(I915_PRIORITY_DISPLAY),
};
struct i915_sched_attr attr = { .priority = I915_PRIORITY_DISPLAY };
struct intel_plane *plane = to_intel_plane(_plane);
struct intel_plane_state *new_plane_state =
to_intel_plane_state(_new_plane_state);
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/gem/i915_gem_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ __create_context(struct drm_i915_private *i915)

kref_init(&ctx->ref);
ctx->i915 = i915;
ctx->sched.priority = I915_USER_PRIORITY(I915_PRIORITY_NORMAL);
ctx->sched.priority = I915_PRIORITY_NORMAL;
mutex_init(&ctx->mutex);
INIT_LIST_HEAD(&ctx->link);

Expand Down Expand Up @@ -1959,7 +1959,7 @@ static int set_priority(struct i915_gem_context *ctx,
!capable(CAP_SYS_NICE))
return -EPERM;

ctx->sched.priority = I915_USER_PRIORITY(priority);
ctx->sched.priority = priority;
context_apply_all(ctx, __apply_priority, ctx);

return 0;
Expand Down Expand Up @@ -2463,7 +2463,7 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,

case I915_CONTEXT_PARAM_PRIORITY:
args->size = 0;
args->value = ctx->sched.priority >> I915_USER_PRIORITY_SHIFT;
args->value = ctx->sched.priority;
break;

case I915_CONTEXT_PARAM_SSEU:
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static int igt_fill_blt_thread(void *arg)
return PTR_ERR(ctx);

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);
Expand Down Expand Up @@ -338,7 +338,7 @@ static int igt_copy_blt_thread(void *arg)
return PTR_ERR(ctx);

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);
Expand Down
10 changes: 3 additions & 7 deletions drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ static void show_heartbeat(const struct i915_request *rq,

static void heartbeat(struct work_struct *wrk)
{
struct i915_sched_attr attr = {
.priority = I915_USER_PRIORITY(I915_PRIORITY_MIN),
};
struct i915_sched_attr attr = { .priority = I915_PRIORITY_MIN };
struct intel_engine_cs *engine =
container_of(wrk, typeof(*engine), heartbeat.work.work);
struct intel_context *ce = engine->kernel_context;
Expand Down Expand Up @@ -127,7 +125,7 @@ static void heartbeat(struct work_struct *wrk)
*/
attr.priority = 0;
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)
attr.priority = I915_PRIORITY_BARRIER;

Expand Down Expand Up @@ -285,9 +283,7 @@ int intel_engine_pulse(struct intel_engine_cs *engine)

int intel_engine_flush_barriers(struct intel_engine_cs *engine)
{
struct i915_sched_attr attr = {
.priority = I915_USER_PRIORITY(I915_PRIORITY_MIN),
};
struct i915_sched_attr attr = { .priority = I915_PRIORITY_MIN };
struct intel_context *ce = engine->kernel_context;
struct i915_request *rq;
int err;
Expand Down
44 changes: 15 additions & 29 deletions drivers/gpu/drm/i915/gt/selftest_execlists.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ static int live_unlite_switch(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)
Expand Down Expand Up @@ -1311,9 +1311,7 @@ static int live_timeslice_queue(void *arg)
goto err_pin;

for_each_engine(engine, gt, id) {
struct i915_sched_attr attr = {
.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX),
};
struct i915_sched_attr attr = { .priority = I915_PRIORITY_MAX };
struct i915_request *rq, *nop;

if (!intel_engine_has_preemption(engine))
Expand Down Expand Up @@ -1528,14 +1526,12 @@ static int live_busywait_preempt(void *arg)
ctx_hi = kernel_context(gt->i915);
if (!ctx_hi)
return -ENOMEM;
ctx_hi->sched.priority =
I915_USER_PRIORITY(I915_CONTEXT_MAX_USER_PRIORITY);
ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY;

ctx_lo = kernel_context(gt->i915);
if (!ctx_lo)
goto err_ctx_hi;
ctx_lo->sched.priority =
I915_USER_PRIORITY(I915_CONTEXT_MIN_USER_PRIORITY);
ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY;

obj = i915_gem_object_create_internal(gt->i915, PAGE_SIZE);
if (IS_ERR(obj)) {
Expand Down Expand Up @@ -1732,14 +1728,12 @@ static int live_preempt(void *arg)
ctx_hi = kernel_context(gt->i915);
if (!ctx_hi)
goto err_spin_lo;
ctx_hi->sched.priority =
I915_USER_PRIORITY(I915_CONTEXT_MAX_USER_PRIORITY);
ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY;

ctx_lo = kernel_context(gt->i915);
if (!ctx_lo)
goto err_ctx_hi;
ctx_lo->sched.priority =
I915_USER_PRIORITY(I915_CONTEXT_MIN_USER_PRIORITY);
ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY;

for_each_engine(engine, gt, id) {
struct igt_live_test t;
Expand Down Expand Up @@ -1832,7 +1826,7 @@ static int live_late_preempt(void *arg)
goto err_ctx_hi;

/* 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) {
struct igt_live_test t;
Expand Down Expand Up @@ -1873,7 +1867,7 @@ static int live_late_preempt(void *arg)
goto err_wedged;
}

attr.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX);
attr.priority = I915_PRIORITY_MAX;
engine->schedule(rq, &attr);

if (!igt_wait_for_spinner(&spin_hi, rq)) {
Expand Down Expand Up @@ -1954,7 +1948,7 @@ static int live_nopreempt(void *arg)
return -ENOMEM;
if (preempt_client_init(gt, &b))
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) {
struct i915_request *rq_a, *rq_b;
Expand Down Expand Up @@ -2419,11 +2413,9 @@ static int live_preempt_cancel(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_engine_cs *engine;
struct i915_sched_attr attr = {
.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX)
};
struct preempt_client a, b;
enum intel_engine_id id;
int err = -ENOMEM;
Expand Down Expand Up @@ -2554,9 +2546,7 @@ static int live_chain_preempt(void *arg)
goto err_client_hi;

for_each_engine(engine, gt, id) {
struct i915_sched_attr attr = {
.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX),
};
struct i915_sched_attr attr = { .priority = I915_PRIORITY_MAX };
struct igt_live_test t;
struct i915_request *rq;
int ring_size, count, i;
Expand Down Expand Up @@ -2975,9 +2965,7 @@ static int live_preempt_gang(void *arg)
return -EIO;

do {
struct i915_sched_attr attr = {
.priority = I915_USER_PRIORITY(prio++),
};
struct i915_sched_attr attr = { .priority = prio++ };

err = create_gang(engine, &rq);
if (err)
Expand Down Expand Up @@ -3013,7 +3001,7 @@ static int live_preempt_gang(void *arg)
drm_info_printer(engine->i915->drm.dev);

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,
"%s\n", engine->name);

Expand Down Expand Up @@ -3383,14 +3371,12 @@ static int live_preempt_timeout(void *arg)
ctx_hi = kernel_context(gt->i915);
if (!ctx_hi)
goto err_spin_lo;
ctx_hi->sched.priority =
I915_USER_PRIORITY(I915_CONTEXT_MAX_USER_PRIORITY);
ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY;

ctx_lo = kernel_context(gt->i915);
if (!ctx_lo)
goto err_ctx_hi;
ctx_lo->sched.priority =
I915_USER_PRIORITY(I915_CONTEXT_MIN_USER_PRIORITY);
ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY;

for_each_engine(engine, gt, id) {
unsigned long saved_timeout;
Expand Down
3 changes: 0 additions & 3 deletions drivers/gpu/drm/i915/i915_priolist_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ enum {
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. */
#define I915_PRIORITY_INVALID (INT_MIN)

Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/i915/i915_scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio)
lockdep_assert_held(&engine->active.lock);
assert_priolists(execlists);

prio >>= I915_USER_PRIORITY_SHIFT;
if (unlikely(execlists->no_priolist))
prio = I915_PRIORITY_NORMAL;

Expand Down

0 comments on commit eb5c10c

Please sign in to comment.