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

Commit e46d5d08 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: sde: avoid re-configuration during inline validate"

parents f148ff15 871fc489
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
@@ -2383,7 +2383,7 @@ static int sde_rotator_config_session(struct sde_rot_mgr *mgr,
	}

	SDEROT_DBG(
		"reconfig session id=%u in{%u,%u}f:%u out{%u,%u}f:%u fps:%d clk:%lu, bw:%llu\n",
		"reconfig session id=%u in{%u,%u}f:%x out{%u,%u}f:%x fps:%d clk:%lu bw:%llu\n",
		config->session_id, config->input.width, config->input.height,
		config->input.format, config->output.width,
		config->output.height, config->output.format,
@@ -3398,3 +3398,38 @@ int sde_rotator_session_config(struct sde_rot_mgr *mgr,

	return sde_rotator_config_session(mgr, private, config);
}

/*
 * sde_rotator_session_validate - validate session
 */
int sde_rotator_session_validate(struct sde_rot_mgr *mgr,
	struct sde_rot_file_private *private,
	struct sde_rotation_config *config)
{
	int ret;

	if (!mgr || !private || !config) {
		SDEROT_ERR("null parameters\n");
		return -EINVAL;
	}

	SDEROT_DBG(
		"validate session id=%u in{%u,%u}f:%x out{%u,%u}f:%x fps:%d\n",
		config->session_id, config->input.width, config->input.height,
		config->input.format, config->output.width,
		config->output.height, config->output.format,
		config->frame_rate);

	ret = sde_rotator_verify_config_all(mgr, config);
	if (ret) {
		SDEROT_WARN("rotator verify format failed %d\n", ret);
		return ret;
	}

	if (config->output.sbuf && mgr->sbuf_ctx != private && mgr->sbuf_ctx) {
		SDEROT_WARN("too many sbuf sessions\n");
		return -EBUSY;
	}

	return 0;
}
+11 −0
Original line number Diff line number Diff line
@@ -601,6 +601,17 @@ int sde_rotator_session_config(struct sde_rot_mgr *mgr,
	struct sde_rot_file_private *private,
	struct sde_rotation_config *config);

/*
 * sde_rotator_session_validate - validate session configuration
 * @mgr: Pointer to rotator manager
 * @private: Pointer to per file session
 * @config: Pointer to rotator configuration
 * return: 0 if success; error code otherwise
 */
int sde_rotator_session_validate(struct sde_rot_mgr *mgr,
	struct sde_rot_file_private *private,
	struct sde_rotation_config *config);

/*
 * sde_rotator_req_init - allocate a new request and initialzie with given
 *	array of rotation items
+21 −20
Original line number Diff line number Diff line
@@ -1460,9 +1460,10 @@ int sde_rotator_inline_commit(void *handle, struct sde_rotator_inline_cmd *cmd,
	struct sde_rotator_device *rot_dev;
	struct sde_rotator_request *request = NULL;
	struct sde_rot_entry_container *req = NULL;
	struct sde_rotation_config rotcfg;
	ktime_t *ts;
	u32 flags = 0;
	int i, ret;
	int i, ret = 0;

	if (!handle || !cmd) {
		SDEROT_ERR("invalid rotator handle/cmd\n");
@@ -1584,11 +1585,8 @@ int sde_rotator_inline_commit(void *handle, struct sde_rotator_inline_cmd *cmd,
			ret = -ENOMEM;
			goto error_init_request;
		}
	}

	if (cmd_type == SDE_ROTATOR_INLINE_CMD_VALIDATE) {
		struct sde_rotation_config rotcfg;

		/* initialize session configuration */
		memset(&rotcfg, 0, sizeof(struct sde_rotation_config));
		rotcfg.flags = flags;
		rotcfg.frame_rate = cmd->fps;
@@ -1606,25 +1604,16 @@ int sde_rotator_inline_commit(void *handle, struct sde_rotator_inline_cmd *cmd,
		rotcfg.output.comp_ratio.numer = 1;
		rotcfg.output.comp_ratio.denom = 1;
		rotcfg.output.sbuf = true;

		if (memcmp(&rotcfg, &ctx->rotcfg, sizeof(rotcfg))) {
			ret = sde_rotator_session_config(rot_dev->mgr,
					ctx->private, &rotcfg);
			if (ret) {
				SDEROT_WARN("fail session config s:%d\n",
						ctx->session_id);
				goto error_session_config;
	}

			ctx->rotcfg = rotcfg;
		}
	if (cmd_type == SDE_ROTATOR_INLINE_CMD_VALIDATE) {

		ret = sde_rotator_validate_request(rot_dev->mgr, ctx->private,
				req);
		ret = sde_rotator_session_validate(rot_dev->mgr,
				ctx->private, &rotcfg);
		if (ret) {
			SDEROT_WARN("fail validate request s:%d\n",
			SDEROT_WARN("fail session validation s:%d\n",
					ctx->session_id);
			goto error_validate_request;
			goto error_session_validate;
		}

		devm_kfree(rot_dev->dev, req);
@@ -1632,6 +1621,18 @@ int sde_rotator_inline_commit(void *handle, struct sde_rotator_inline_cmd *cmd,

	} else if (cmd_type == SDE_ROTATOR_INLINE_CMD_COMMIT) {

		if (memcmp(&rotcfg, &ctx->rotcfg, sizeof(rotcfg))) {
			ret = sde_rotator_session_config(rot_dev->mgr,
					ctx->private, &rotcfg);
			if (ret) {
				SDEROT_ERR("fail session config s:%d\n",
						ctx->session_id);
				goto error_session_config;
			}

			ctx->rotcfg = rotcfg;
		}

		request = list_first_entry_or_null(&ctx->retired_list,
				struct sde_rotator_request, list);
		if (!request) {
@@ -1745,7 +1746,7 @@ int sde_rotator_inline_commit(void *handle, struct sde_rotator_inline_cmd *cmd,
	sde_rotator_update_retire_sequence(request);
	sde_rotator_retire_request(request);
error_retired_list:
error_validate_request:
error_session_validate:
error_session_config:
	devm_kfree(rot_dev->dev, req);
error_invalid_handle: