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

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.uk


Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 2867ff6c
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -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);

@@ -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;
@@ -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:
+2 −2
Original line number Diff line number Diff line
@@ -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);
@@ -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);
+3 −7
Original line number Diff line number Diff line
@@ -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;
@@ -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;

@@ -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;
+15 −29
Original line number Diff line number Diff line
@@ -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)
@@ -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))
@@ -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)) {
@@ -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;
@@ -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;
@@ -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)) {
@@ -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;
@@ -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;
@@ -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;
@@ -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)
@@ -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);

@@ -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;
Loading