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

Commit d0e0f538 authored by Dhaval Patel's avatar Dhaval Patel
Browse files

Revert "drm/msm/sde: modify RM to commit hw in check_only phase"



This reverts commit 361aacfe.
Change was causing compilation errors.

Change-Id: I86b21330cfab5d205f49b58b1f6402465ba29745
Signed-off-by: default avatarDhaval Patel <pdhaval@codeaurora.org>
parent a3323d0c
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -110,20 +110,6 @@ static inline struct sde_kms *_sde_crtc_get_kms(struct drm_crtc *crtc)
	return to_sde_kms(priv->kms);
}

static inline struct drm_encoder *_sde_crtc_get_encoder(struct drm_crtc *crtc)
{
	struct drm_encoder *enc;
	struct list_head *encoder_list;

	encoder_list = &crtc->dev->mode_config.encoder_list;

	list_for_each_entry(enc, encoder_list, head)
		if (enc->crtc == crtc)
			return enc;

	return NULL;
}

static inline int _sde_crtc_power_enable(struct sde_crtc *sde_crtc, bool enable)
{
	struct drm_crtc *crtc;
@@ -3121,8 +3107,6 @@ static void sde_crtc_destroy_state(struct drm_crtc *crtc,
{
	struct sde_crtc *sde_crtc;
	struct sde_crtc_state *cstate;
	struct drm_encoder *enc;
	struct sde_kms *sde_kms;

	if (!crtc || !state) {
		SDE_ERROR("invalid argument(s)\n");
@@ -3131,14 +3115,9 @@ static void sde_crtc_destroy_state(struct drm_crtc *crtc,

	sde_crtc = to_sde_crtc(crtc);
	cstate = to_sde_crtc_state(state);
	enc = _sde_crtc_get_encoder(crtc);
	sde_kms = _sde_crtc_get_kms(crtc);

	SDE_DEBUG("crtc%d\n", crtc->base.id);

	if (sde_kms && enc)
		sde_rm_release(&sde_kms->rm, enc, true);

	__drm_atomic_helper_crtc_destroy_state(state);

	/* destroy value helper */
+1 −1
Original line number Diff line number Diff line
@@ -3287,7 +3287,7 @@ static void sde_encoder_virt_disable(struct drm_encoder *drm_enc)

	SDE_DEBUG_ENC(sde_enc, "encoder disabled\n");

	sde_rm_release(&sde_kms->rm, drm_enc, false);
	sde_rm_release(&sde_kms->rm, drm_enc);
}

void sde_encoder_helper_phys_disable(struct sde_encoder_phys *phys_enc,
+15 −50
Original line number Diff line number Diff line
@@ -18,8 +18,7 @@
#include "sde_hw_dsc.h"

#define RESERVED_BY_OTHER(h, r) \
	(((h)->rsvp && ((h)->rsvp->enc_id != (r)->enc_id)) ||\
		((h)->rsvp_nxt && ((h)->rsvp_nxt->enc_id != (r)->enc_id)))
	((h)->rsvp && ((h)->rsvp->enc_id != (r)->enc_id))

#define RM_RQ_LOCK(r) ((r)->top_ctrl & BIT(SDE_RM_TOPCTL_RESERVE_LOCK))
#define RM_RQ_CLEAR(r) ((r)->top_ctrl & BIT(SDE_RM_TOPCTL_RESERVE_CLEAR))
@@ -1453,30 +1452,6 @@ static struct sde_rm_rsvp *_sde_rm_get_rsvp(
	return NULL;
}

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

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

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

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

	if (i && j && (i->seq != j->seq))
		return j;

	return NULL;
}

static struct drm_connector *_sde_rm_get_connector(
		struct drm_encoder *enc)
{
@@ -1564,7 +1539,7 @@ static void _sde_rm_release_rsvp(
	kfree(rsvp);
}

void sde_rm_release(struct sde_rm *rm, struct drm_encoder *enc, bool nxt)
void sde_rm_release(struct sde_rm *rm, struct drm_encoder *enc)
{
	struct sde_rm_rsvp *rsvp;
	struct drm_connector *conn;
@@ -1577,20 +1552,15 @@ 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);
	if (!rsvp) {
		SDE_ERROR("failed to find rsvp for enc %d, nxt %d",
				enc->base.id, nxt);
		SDE_ERROR("failed to find rsvp for enc %d\n", enc->base.id);
		goto end;
	}

	conn = _sde_rm_get_connector(enc);
	if (!conn) {
		SDE_ERROR("failed to get connector for enc %d, nxt %d",
				enc->base.id, nxt);
		SDE_ERROR("failed to get connector for enc %d\n", enc->base.id);
		goto end;
	}

@@ -1681,12 +1651,6 @@ int sde_rm_reserve(

	_sde_rm_print_rsvps(rm, SDE_RM_STAGE_BEGIN);

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

	if (!test_only && rsvp_nxt)
		goto commit_rsvp;

	ret = _sde_rm_populate_requirements(rm, enc, crtc_state,
			conn_state, &reqs);
	if (ret) {
@@ -1711,6 +1675,8 @@ int sde_rm_reserve(
		goto end;
	}

	rsvp_cur = _sde_rm_get_rsvp(rm, enc);

	/*
	 * User can request that we clear out any reservation during the
	 * atomic_check phase by using this CLEAR bit
@@ -1730,31 +1696,30 @@ int sde_rm_reserve(
	_sde_rm_print_rsvps(rm, SDE_RM_STAGE_AFTER_RSVPNEXT);

	if (ret) {
		SDE_ERROR("failed to reserve hw resources: %d, test_only %d\n",
				ret, test_only);
		SDE_ERROR("failed to reserve hw resources: %d\n", ret);
		_sde_rm_release_rsvp(rm, rsvp_nxt, conn_state->connector);
		goto end;
	} else if (test_only && !RM_RQ_LOCK(&reqs)) {
		/*
		 * Normally, if test_only, test the reservation and then undo
		 * However, if the user requests LOCK, then keep the reservation
		 * made during the atomic_check phase.
		 */
		SDE_DEBUG("test_only: rsvp[s%de%d]\n",
		SDE_DEBUG("test_only: discard test rsvp[s%de%d]\n",
				rsvp_nxt->seq, rsvp_nxt->enc_id);
		goto end;
		_sde_rm_release_rsvp(rm, rsvp_nxt, conn_state->connector);
	} else {
		if (test_only && RM_RQ_LOCK(&reqs))
			SDE_DEBUG("test_only & LOCK: lock rsvp[s%de%d]\n",
					rsvp_nxt->seq, rsvp_nxt->enc_id);
	}

commit_rsvp:
		_sde_rm_release_rsvp(rm, rsvp_cur, conn_state->connector);

		ret = _sde_rm_commit_rsvp(rm, rsvp_nxt, conn_state);
	}

end:
	_sde_rm_print_rsvps(rm, SDE_RM_STAGE_FINAL);

end:
	mutex_unlock(&rm->rm_lock);

	return ret;
+3 −4
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 */

#ifndef __SDE_RM_H__
@@ -184,14 +184,13 @@ int sde_rm_reserve(struct sde_rm *rm,
		bool test_only);

/**
 * sde_rm_release - Given the encoder for the display chain, release any
 * sde_rm_reserve - Given the encoder for the display chain, release any
 *	HW blocks previously reserved for that use case.
 * @rm: SDE Resource Manager handle
 * @enc: DRM Encoder handle
 * @nxt: Choose option to release rsvp_nxt
 * @Return: 0 on Success otherwise -ERROR
 */
void sde_rm_release(struct sde_rm *rm, struct drm_encoder *enc, bool nxt);
void sde_rm_release(struct sde_rm *rm, struct drm_encoder *enc);

/**
 * sde_rm_get_mdp - Retrieve HW block for MDP TOP.