Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19339b3f authored by Clarence Ip's avatar Clarence Ip
Browse files

msm: sde: add inline rotation abort command



Add support for an inline rotation 'abort' command to
allow pending inline rotation requests to be aborted
after the hardware has been already kicked off.

Change-Id: I1842a9ae225fb168ae23021c60c75df548ae63a0
Signed-off-by: default avatarClarence Ip <cip@codeaurora.org>
parent ff4609ec
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -2513,6 +2513,45 @@ void sde_rotator_req_finish(struct sde_rot_mgr *mgr,
	req->finished = true;
}

void sde_rotator_abort_inline_request(struct sde_rot_mgr *mgr,
		struct sde_rot_file_private *private,
		struct sde_rot_entry_container *req)
{
	struct kthread_work *commit_work;
	struct kthread_work *done_work;
	struct sde_rot_entry *entry;
	struct sde_rot_hw_resource *hw;
	int i;

	if (!mgr || !private || !req || !req->entries)
		return;

	for (i = 0; i < req->count; i++) {
		entry = &req->entries[i];
		if (!entry)
			continue;

		commit_work = &entry->commit_work;
		done_work = &entry->done_work;

		hw = sde_rotator_get_hw_resource(entry->commitq, entry);
		if (!hw) {
			SDEROT_ERR("no hw for the queue\n");
			SDEROT_EVTLOG(i, req->count, SDE_ROT_EVTLOG_ERROR);
			continue;
		}

		SDEROT_EVTLOG(i, req->count);

		mgr->ops_abort_hw(hw, entry);

		sde_rot_mgr_unlock(mgr);
		kthread_flush_work(commit_work);
		kthread_flush_work(done_work);
		sde_rot_mgr_lock(mgr);
	}
}

int sde_rotator_handle_request_common(struct sde_rot_mgr *mgr,
	struct sde_rot_file_private *private,
	struct sde_rot_entry_container *req)
+15 −0
Original line number Diff line number Diff line
@@ -449,6 +449,8 @@ struct sde_rot_mgr {
			struct sde_rot_entry *entry);
	int (*ops_cancel_hw)(struct sde_rot_hw_resource *hw,
			struct sde_rot_entry *entry);
	int (*ops_abort_hw)(struct sde_rot_hw_resource *hw,
			struct sde_rot_entry *entry);
	int (*ops_kickoff_entry)(struct sde_rot_hw_resource *hw,
			struct sde_rot_entry *entry);
	int (*ops_wait_for_entry)(struct sde_rot_hw_resource *hw,
@@ -669,6 +671,19 @@ void sde_rotator_req_finish(struct sde_rot_mgr *mgr,
	struct sde_rot_file_private *private,
	struct sde_rot_entry_container *req);

/*
 * sde_rotator_abort_inline_request - abort inline rotation request after start
 *	This function allows inline rotation requests to be aborted after
 *	sde_rotator_req_set_start has already been issued.
 * @mgr: Pointer to rotator manager
 * @private: Pointer to rotator manager per file context
 * @req: Pointer to rotation request
 * return: none
 */
void sde_rotator_abort_inline_request(struct sde_rot_mgr *mgr,
		struct sde_rot_file_private *private,
		struct sde_rot_entry_container *req);

/*
 * sde_rotator_handle_request_common - add the given request to rotator
 *	manager and clean up completed requests
+10 −0
Original line number Diff line number Diff line
@@ -1731,6 +1731,16 @@ int sde_rotator_inline_commit(void *handle, struct sde_rotator_inline_cmd *cmd,

		sde_rotator_req_finish(rot_dev->mgr, ctx->private, req);
		sde_rotator_retire_request(request);
	} else if (cmd_type == SDE_ROTATOR_INLINE_CMD_ABORT) {
		if (!cmd->priv_handle) {
			ret = -EINVAL;
			SDEROT_ERR("invalid private handle\n");
			goto error_invalid_handle;
		}

		request = cmd->priv_handle;
		sde_rotator_abort_inline_request(rot_dev->mgr,
				ctx->private, request->req);
	}

	sde_rot_mgr_unlock(rot_dev->mgr);
+2 −0
Original line number Diff line number Diff line
@@ -27,12 +27,14 @@
 * @SDE_ROTATOR_INLINE_CMD_COMMIT: commit command to hardware
 * @SDE_ROTATOR_INLINE_CMD_START: ready to start inline rotation
 * @SDE_ROTATOR_INLINE_CMD_CLEANUP: cleanup after commit is done
 * @SDE_ROTATOR_INLINE_CMD_ABORT: abort current commit and reset
 */
enum sde_rotator_inline_cmd_type {
	SDE_ROTATOR_INLINE_CMD_VALIDATE,
	SDE_ROTATOR_INLINE_CMD_COMMIT,
	SDE_ROTATOR_INLINE_CMD_START,
	SDE_ROTATOR_INLINE_CMD_CLEANUP,
	SDE_ROTATOR_INLINE_CMD_ABORT,
};

/**
+7 −0
Original line number Diff line number Diff line
@@ -349,6 +349,12 @@ static int sde_rotator_cancel_hw(struct sde_rot_hw_resource *hw,
	return 0;
}

static int sde_rotator_abort_hw(struct sde_rot_hw_resource *hw,
	struct sde_rot_entry *entry)
{
	return 0;
}

static int sde_rotator_kickoff_entry(struct sde_rot_hw_resource *hw,
	struct sde_rot_entry *entry)
{
@@ -691,6 +697,7 @@ int sde_rotator_r1_init(struct sde_rot_mgr *mgr)
	mgr->hw_data = hw_data;
	mgr->ops_config_hw = sde_rotator_config_hw;
	mgr->ops_cancel_hw = sde_rotator_cancel_hw;
	mgr->ops_abort_hw = sde_rotator_abort_hw;
	mgr->ops_kickoff_entry = sde_rotator_kickoff_entry;
	mgr->ops_wait_for_entry = sde_rotator_wait_for_entry;
	mgr->ops_hw_alloc = sde_rotator_hw_alloc_ext;
Loading