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

Commit fe619d57 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drm/msm/sde: Add refcount support for wb irq ctrl"

parents 0fab7536 0ad693e1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -271,6 +271,7 @@ struct sde_encoder_irq {
 * @enc_spinlock:	Virtual-Encoder-Wide Spin Lock for IRQ purposes
 * @enable_state:	Enable state tracking
 * @vblank_refcount:	Reference count of vblank request
 * @wbirq_refcount:	Reference count of wb irq request
 * @vsync_cnt:		Vsync count for the physical encoder
 * @underrun_cnt:	Underrun count for the physical encoder
 * @pending_kickoff_cnt:	Atomic counter tracking the number of kickoffs
@@ -315,6 +316,7 @@ struct sde_encoder_phys {
	enum sde_enc_enable_state enable_state;
	struct mutex *vblank_ctl_lock;
	atomic_t vblank_refcount;
	atomic_t wbirq_refcount;
	atomic_t vsync_cnt;
	atomic_t underrun_cnt;
	atomic_t pending_ctlstart_cnt;
+16 −5
Original line number Diff line number Diff line
@@ -1103,8 +1103,8 @@ static void sde_encoder_phys_wb_irq_ctrl(
{

	struct sde_encoder_phys_wb *wb_enc = to_sde_encoder_phys_wb(phys);
	int index = 0;
	int pp = 0;
	int index = 0, refcount;
	int ret = 0, pp = 0;

	if (!wb_enc)
		return;
@@ -1118,13 +1118,22 @@ static void sde_encoder_phys_wb_irq_ctrl(
		return;
	}

	if (enable) {
	refcount = atomic_read(&phys->wbirq_refcount);

	if (enable && atomic_inc_return(&phys->wbirq_refcount) == 1) {
		sde_encoder_helper_register_irq(phys, INTR_IDX_WB_DONE);
		if (ret)
			atomic_dec_return(&phys->wbirq_refcount);

		for (index = 0; index < CRTC_DUAL_MIXERS; index++)
			sde_encoder_helper_register_irq(phys,
				cwb_irq_tbl[index + pp]);
	} else {
	} else if (!enable &&
			atomic_dec_return(&phys->wbirq_refcount) == 0) {
		sde_encoder_helper_unregister_irq(phys, INTR_IDX_WB_DONE);
		if (ret)
			atomic_inc_return(&phys->wbirq_refcount);

		for (index = 0; index < CRTC_DUAL_MIXERS; index++)
			sde_encoder_helper_unregister_irq(phys,
				cwb_irq_tbl[index + pp]);
@@ -1556,12 +1565,13 @@ static void sde_encoder_phys_wb_disable(struct sde_encoder_phys *phys_enc)
		goto exit;

	sde_encoder_phys_wb_prepare_for_kickoff(phys_enc, NULL);

	sde_encoder_phys_wb_irq_ctrl(phys_enc, true);
	if (phys_enc->hw_ctl->ops.trigger_flush)
		phys_enc->hw_ctl->ops.trigger_flush(phys_enc->hw_ctl);

	sde_encoder_helper_trigger_start(phys_enc);
	sde_encoder_phys_wb_wait_for_commit_done(phys_enc);
	sde_encoder_phys_wb_irq_ctrl(phys_enc, false);
exit:
	phys_enc->enable_state = SDE_ENC_DISABLED;
	wb_enc->crtc = NULL;
@@ -1779,6 +1789,7 @@ struct sde_encoder_phys *sde_encoder_phys_wb_init(
	phys_enc->enc_spinlock = p->enc_spinlock;
	phys_enc->vblank_ctl_lock = p->vblank_ctl_lock;
	atomic_set(&phys_enc->pending_retire_fence_cnt, 0);
	atomic_set(&phys_enc->wbirq_refcount, 0);

	irq = &phys_enc->irq[INTR_IDX_WB_DONE];
	INIT_LIST_HEAD(&irq->cb.list);