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

Commit 2ac887cc authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge bb6f15ba on remote branch

Change-Id: I8092c665fc2f44c12f4de4b0b508d6d69b4beddf
parents 5aa2fc0e bb6f15ba
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
 * Copyright (C) 2014 Red Hat
 * Author: Rob Clark <robdclark@gmail.com>
 *
@@ -689,6 +689,16 @@ int msm_atomic_commit(struct drm_device *dev,
		c->plane_mask |= (1 << drm_plane_index(plane));
	}

	/* Protection for prepare_fence callback */
retry:
	ret = drm_modeset_lock(&state->dev->mode_config.connection_mutex,
		state->acquire_ctx);

	if (ret == -EDEADLK) {
		drm_modeset_backoff(state->acquire_ctx);
		goto retry;
	}

	/*
	 * Wait for pending updates on any of the same crtc's and then
	 * mark our set of crtc's as busy:
+4 −0
Original line number Diff line number Diff line
@@ -6148,6 +6148,9 @@ static int _sde_debugfs_fence_status_show(struct seq_file *s, void *data)
	dev = crtc->dev;
	cstate = to_sde_crtc_state(crtc->state);

	if (!sde_crtc->kickoff_in_progress)
		goto skip_input_fence;

	/* Dump input fence info */
	seq_puts(s, "===Input fence===\n");
	drm_atomic_crtc_for_each_plane(plane, crtc) {
@@ -6175,6 +6178,7 @@ static int _sde_debugfs_fence_status_show(struct seq_file *s, void *data)
		}
	}

skip_input_fence:
	/* Dump release fence info */
	seq_puts(s, "\n");
	seq_puts(s, "===Release fence===\n");
+11 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
 */

#define pr_fmt(fmt)	"[drm:%s:%d] " fmt, __func__, __LINE__
@@ -1509,20 +1509,27 @@ static int _sde_encoder_phys_cmd_wait_for_wr_ptr(
	struct sde_encoder_phys_cmd *cmd_enc =
			to_sde_encoder_phys_cmd(phys_enc);
	struct sde_encoder_wait_info wait_info = {0};
	int ret;
	struct sde_connector *c_conn;
	bool frame_pending = true;
	struct sde_hw_ctl *ctl;
	unsigned long lock_flags;
	int ret, timeout_ms;

	if (!phys_enc || !phys_enc->hw_ctl) {
	if (!phys_enc || !phys_enc->hw_ctl || !phys_enc->connector) {
		SDE_ERROR("invalid argument(s)\n");
		return -EINVAL;
	}
	ctl = phys_enc->hw_ctl;
	c_conn = to_sde_connector(phys_enc->connector);
	timeout_ms = KICKOFF_TIMEOUT_MS;

	if (c_conn->lp_mode == SDE_MODE_DPMS_LP1 ||
		c_conn->lp_mode == SDE_MODE_DPMS_LP2)
		timeout_ms = (KICKOFF_TIMEOUT_MS) * 2;

	wait_info.wq = &phys_enc->pending_kickoff_wq;
	wait_info.atomic_cnt = &phys_enc->pending_retire_fence_cnt;
	wait_info.timeout_ms = KICKOFF_TIMEOUT_MS;
	wait_info.timeout_ms = timeout_ms;

	/* slave encoder doesn't enable for ppsplit */
	if (_sde_encoder_phys_is_ppsplit_slave(phys_enc))
+6 −11
Original line number Diff line number Diff line
@@ -1589,7 +1589,7 @@ static void sde_kms_prepare_fence(struct msm_kms *kms,
{
	struct drm_crtc *crtc;
	struct drm_crtc_state *old_crtc_state;
	int i, rc;
	int i;

	if (!kms || !old_state || !old_state->dev || !old_state->acquire_ctx) {
		SDE_ERROR("invalid argument(s)\n");
@@ -1597,15 +1597,6 @@ static void sde_kms_prepare_fence(struct msm_kms *kms,
	}

	SDE_ATRACE_BEGIN("sde_kms_prepare_fence");
retry:
	/* attempt to acquire ww mutex for connection */
	rc = drm_modeset_lock(&old_state->dev->mode_config.connection_mutex,
			       old_state->acquire_ctx);

	if (rc == -EDEADLK) {
		drm_modeset_backoff(old_state->acquire_ctx);
		goto retry;
	}

	/* old_state actually contains updated crtc pointers */
	for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) {
@@ -3501,6 +3492,11 @@ static void _sde_kms_pm_suspend_idle_helper(struct sde_kms *sde_kms,
		if (sde_encoder_in_clone_mode(conn->encoder))
			continue;

		crtc_id = drm_crtc_index(conn->state->crtc);
		if (priv->disp_thread[crtc_id].thread)
			kthread_flush_worker(
				&priv->disp_thread[crtc_id].worker);

		ret = sde_encoder_wait_for_event(conn->encoder,
						MSM_ENC_TX_COMPLETE);
		if (ret && ret != -EWOULDBLOCK) {
@@ -3508,7 +3504,6 @@ static void _sde_kms_pm_suspend_idle_helper(struct sde_kms *sde_kms,
				"[conn: %d] wait for commit done returned %d\n",
				conn->base.id, ret);
		} else if (!ret) {
			crtc_id = drm_crtc_index(conn->state->crtc);
			if (priv->event_thread[crtc_id].thread)
				kthread_flush_worker(
					&priv->event_thread[crtc_id].worker);
+27 −41
Original line number Diff line number Diff line
@@ -125,13 +125,15 @@ struct sde_rm_requirements {
 * @enc_id:	Reservations are tracked by Encoder DRM object ID.
 *		CRTCs may be connected to multiple Encoders.
 *		An encoder or connector id identifies the display path.
 * @topology	DRM<->HW topology use case
 * @topology:	DRM<->HW topology use case
 * @pending:	True for pending rsvp-nxt, cleared when the rsvp is committed
 */
struct sde_rm_rsvp {
	struct list_head list;
	uint32_t seq;
	uint32_t enc_id;
	enum sde_rm_topology_name topology;
	bool pending;
};

/**
@@ -274,9 +276,9 @@ static void _sde_rm_print_rsvps(
	SDE_DEBUG("%d\n", stage);

	list_for_each_entry(rsvp, &rm->rsvps, list) {
		SDE_DEBUG("%d rsvp[s%ue%u] topology %d\n", stage, rsvp->seq,
				rsvp->enc_id, rsvp->topology);
		SDE_EVT32(stage, rsvp->seq, rsvp->enc_id, rsvp->topology);
		SDE_DEBUG("%d rsvp%s[s%ue%u] topology %d\n", stage, rsvp->pending ? "_nxt" : "",
				rsvp->seq, rsvp->enc_id, rsvp->topology);
		SDE_EVT32(stage, rsvp->seq, rsvp->enc_id, rsvp->topology, rsvp->pending);
	}

	for (type = 0; type < SDE_HW_BLK_MAX; type++) {
@@ -1825,6 +1827,7 @@ static int _sde_rm_make_next_rsvp(struct sde_rm *rm, struct drm_encoder *enc,
	rsvp->seq = ++rm->rsvp_next_seq;
	rsvp->enc_id = enc->base.id;
	rsvp->topology = reqs->topology->top_name;
	rsvp->pending = true;
	list_add_tail(&rsvp->list, &rm->rsvps);

	ret = _sde_rm_make_lm_rsvp(rm, rsvp, reqs, splash_display);
@@ -2076,9 +2079,8 @@ static int _sde_rm_populate_requirements(
	return 0;
}

static struct sde_rm_rsvp *_sde_rm_get_rsvp(
		struct sde_rm *rm,
		struct drm_encoder *enc)
static struct sde_rm_rsvp *_sde_rm_get_rsvp(struct sde_rm *rm,
		 struct drm_encoder *enc, bool nxt)
{
	struct sde_rm_rsvp *i;

@@ -2091,30 +2093,22 @@ static struct sde_rm_rsvp *_sde_rm_get_rsvp(
		return NULL;

	list_for_each_entry(i, &rm->rsvps, list)
		if (i->enc_id == enc->base.id)
		if (i->pending == nxt && i->enc_id == enc->base.id)
			return i;

	return NULL;
}

static struct sde_rm_rsvp *_sde_rm_get_rsvp_nxt(
		struct sde_rm *rm,
static struct sde_rm_rsvp *_sde_rm_get_rsvp_nxt(struct sde_rm *rm,
		struct drm_encoder *enc)
{
	struct sde_rm_rsvp *i;

	if (list_empty(&rm->rsvps))
		return NULL;

	list_for_each_entry(i, &rm->rsvps, list)
		if (i->enc_id == enc->base.id)
			break;

	list_for_each_entry_continue(i, &rm->rsvps, list)
		if (i->enc_id == enc->base.id)
			return i;
	return _sde_rm_get_rsvp(rm, enc, true);
}

	return NULL;
static struct sde_rm_rsvp *_sde_rm_get_rsvp_cur(struct sde_rm *rm,
		 struct drm_encoder *enc)
{
	return _sde_rm_get_rsvp(rm, enc, false);
}

static struct drm_connector *_sde_rm_get_connector(
@@ -2312,10 +2306,7 @@ void sde_rm_release(struct sde_rm *rm, struct drm_encoder *enc, bool nxt)

	mutex_lock(&rm->rm_lock);

	if (nxt)
		rsvp = _sde_rm_get_rsvp_nxt(rm, enc);
	else
		rsvp = _sde_rm_get_rsvp(rm, enc);
	rsvp = _sde_rm_get_rsvp(rm, enc, nxt);
	if (!rsvp) {
		SDE_DEBUG("failed to find rsvp for enc %d, nxt %d",
				enc->base.id, nxt);
@@ -2353,14 +2344,13 @@ void sde_rm_release(struct sde_rm *rm, struct drm_encoder *enc, bool nxt)
	mutex_unlock(&rm->rm_lock);
}

static int _sde_rm_commit_rsvp(
static void _sde_rm_commit_rsvp(
		struct sde_rm *rm,
		struct sde_rm_rsvp *rsvp,
		struct drm_connector_state *conn_state)
{
	struct sde_rm_hw_blk *blk;
	enum sde_hw_blk_type type;
	int ret = 0;

	/* Swap next rsvp to be the active */
	for (type = 0; type < SDE_HW_BLK_MAX; type++) {
@@ -2375,15 +2365,11 @@ static int _sde_rm_commit_rsvp(
		}
	}

	if (!ret) {
		SDE_DEBUG("rsrv enc %d topology %d\n", rsvp->enc_id,
				rsvp->topology);
	rsvp->pending = false;
	SDE_DEBUG("rsrv enc %d topology %d\n", rsvp->enc_id, rsvp->topology);
	SDE_EVT32(rsvp->enc_id, rsvp->topology);
}

	return ret;
}

/* call this only after rm_mutex held */
struct sde_rm_rsvp *_sde_rm_poll_get_rsvp_nxt_locked(struct sde_rm *rm,
		struct drm_encoder *enc)
@@ -2420,7 +2406,7 @@ int sde_rm_reserve(
	struct msm_drm_private *priv;
	struct sde_kms *sde_kms;
	struct msm_compression_info *comp_info;
	int ret;
	int ret = 0;

	if (!rm || !enc || !crtc_state || !conn_state) {
		SDE_ERROR("invalid arguments\n");
@@ -2456,7 +2442,7 @@ int sde_rm_reserve(

	_sde_rm_print_rsvps(rm, SDE_RM_STAGE_BEGIN);

	rsvp_cur = _sde_rm_get_rsvp(rm, enc);
	rsvp_cur = _sde_rm_get_rsvp_cur(rm, enc);
	rsvp_nxt = _sde_rm_get_rsvp_nxt(rm, enc);

	/*
@@ -2545,7 +2531,7 @@ int sde_rm_reserve(

commit_rsvp:
	_sde_rm_release_rsvp(rm, rsvp_cur, conn_state->connector);
	ret = _sde_rm_commit_rsvp(rm, rsvp_nxt, conn_state);
	_sde_rm_commit_rsvp(rm, rsvp_nxt, conn_state);

end:
	kfree(comp_info);
@@ -2574,7 +2560,7 @@ int sde_rm_ext_blk_create_reserve(struct sde_rm *rm,

	mutex_lock(&rm->rm_lock);

	rsvp = _sde_rm_get_rsvp(rm, enc);
	rsvp = _sde_rm_get_rsvp_cur(rm, enc);
	if (!rsvp) {
		rsvp = kzalloc(sizeof(*rsvp), GFP_KERNEL);
		if (!rsvp) {
@@ -2625,7 +2611,7 @@ int sde_rm_ext_blk_destroy(struct sde_rm *rm,

	mutex_lock(&rm->rm_lock);

	rsvp = _sde_rm_get_rsvp(rm, enc);
	rsvp = _sde_rm_get_rsvp_cur(rm, enc);
	if (!rsvp) {
		ret = -ENOENT;
		SDE_ERROR("failed to find rsvp for enc %d\n", enc->base.id);
Loading