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

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

Merge "disp: msm: queue vblank work on event thread"

parents 51ff9080 68d8a319
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (C) 2013 Red Hat
 * Author: Rob Clark <robdclark@gmail.com>
 *
@@ -336,7 +336,8 @@ static int vblank_ctrl_queue_work(struct msm_drm_private *priv,
	cur_work->enable = enable;
	cur_work->priv = priv;

	kthread_queue_work(&priv->disp_thread[crtc_id].worker, &cur_work->work);
	kthread_queue_work(&priv->event_thread[crtc_id].worker,
						&cur_work->work);

	return 0;
}
+1 −7
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved.
 * Copyright (C) 2013 Red Hat
 * Author: Rob Clark <robdclark@gmail.com>
 *
@@ -3660,9 +3660,6 @@ static int _sde_crtc_vblank_enable_no_lock(

		drm_for_each_encoder_mask(enc, crtc->dev,
			crtc->state->encoder_mask) {
			if (enc->crtc != crtc)
				continue;

			SDE_EVT32(DRMID(&sde_crtc->base), DRMID(enc), enable,
					sde_crtc->enabled);

@@ -3672,9 +3669,6 @@ static int _sde_crtc_vblank_enable_no_lock(
	} else {
		drm_for_each_encoder_mask(enc, crtc->dev,
			crtc->state->encoder_mask) {
			if (enc->crtc != crtc)
				continue;

			SDE_EVT32(DRMID(&sde_crtc->base), DRMID(enc), enable,
					sde_crtc->enabled);

+32 −5
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 */

#define pr_fmt(fmt)	"[drm:%s:%d] " fmt, __func__, __LINE__
@@ -322,6 +322,8 @@ static void _sde_encoder_phys_cmd_setup_irq_hw_idx(
		struct sde_encoder_phys *phys_enc)
{
	struct sde_encoder_irq *irq;
	struct sde_kms *sde_kms = phys_enc->sde_kms;
	int ret = 0;

	if (!phys_enc || !phys_enc->hw_pp || !phys_enc->hw_ctl) {
		SDE_ERROR("invalid args %d %d\n", !phys_enc,
@@ -334,6 +336,21 @@ static void _sde_encoder_phys_cmd_setup_irq_hw_idx(
		return;
	}

	mutex_lock(&sde_kms->vblank_ctl_global_lock);

	if (atomic_read(&phys_enc->vblank_refcount)) {
		SDE_ERROR(
		"vblank_refcount mismatch detected, try to reset %d\n",
				atomic_read(&phys_enc->vblank_refcount));
		ret = sde_encoder_helper_unregister_irq(phys_enc,
				INTR_IDX_RDPTR);
		if (ret)
			SDE_ERROR(
				"control vblank irq registration error %d\n",
					ret);
	}
	atomic_set(&phys_enc->vblank_refcount, 0);

	irq = &phys_enc->irq[INTR_IDX_CTL_START];
	irq->hw_idx = phys_enc->hw_ctl->idx;
	irq->irq_idx = -EINVAL;
@@ -367,6 +384,8 @@ static void _sde_encoder_phys_cmd_setup_irq_hw_idx(
	else
		irq->hw_idx = phys_enc->hw_pp->idx;

	mutex_unlock(&sde_kms->vblank_ctl_global_lock);

}

static void sde_encoder_phys_cmd_cont_splash_mode_set(
@@ -802,13 +821,15 @@ static int sde_encoder_phys_cmd_control_vblank_irq(
		to_sde_encoder_phys_cmd(phys_enc);
	int ret = 0;
	int refcount;
	struct sde_kms *sde_kms;

	if (!phys_enc || !phys_enc->hw_pp) {
		SDE_ERROR("invalid encoder\n");
		return -EINVAL;
	}
	sde_kms = phys_enc->sde_kms;

	mutex_lock(phys_enc->vblank_ctl_lock);
	mutex_lock(&sde_kms->vblank_ctl_global_lock);
	refcount = atomic_read(&phys_enc->vblank_refcount);

	/* Slave encoders don't report vblank */
@@ -826,11 +847,17 @@ static int sde_encoder_phys_cmd_control_vblank_irq(
	SDE_EVT32(DRMID(phys_enc->parent), phys_enc->hw_pp->idx - PINGPONG_0,
			enable, refcount);

	if (enable && atomic_inc_return(&phys_enc->vblank_refcount) == 1)
	if (enable && atomic_inc_return(&phys_enc->vblank_refcount) == 1) {
		ret = sde_encoder_helper_register_irq(phys_enc, INTR_IDX_RDPTR);
	else if (!enable && atomic_dec_return(&phys_enc->vblank_refcount) == 0)
		if (ret)
			atomic_dec_return(&phys_enc->vblank_refcount);
	} else if (!enable &&
			atomic_dec_return(&phys_enc->vblank_refcount) == 0) {
		ret = sde_encoder_helper_unregister_irq(phys_enc,
				INTR_IDX_RDPTR);
		if (ret)
			atomic_inc_return(&phys_enc->vblank_refcount);
	}

end:
	if (ret) {
@@ -842,7 +869,7 @@ static int sde_encoder_phys_cmd_control_vblank_irq(
				enable, refcount, SDE_EVTLOG_ERROR);
	}

	mutex_unlock(phys_enc->vblank_ctl_lock);
	mutex_unlock(&sde_kms->vblank_ctl_global_lock);
	return ret;
}

+2 −0
Original line number Diff line number Diff line
@@ -3687,6 +3687,8 @@ static int sde_kms_hw_init(struct msm_kms *kms)
	dev->mode_config.max_height = sde_kms->catalog->max_display_height;

	mutex_init(&sde_kms->secure_transition_lock);
	mutex_init(&sde_kms->vblank_ctl_global_lock);

	atomic_set(&sde_kms->detach_sec_cb, 0);
	atomic_set(&sde_kms->detach_all_cb, 0);

+1 −0
Original line number Diff line number Diff line
@@ -289,6 +289,7 @@ struct sde_kms {
	atomic_t detach_sec_cb;
	atomic_t detach_all_cb;
	struct mutex secure_transition_lock;
	struct mutex vblank_ctl_global_lock;

	bool first_kickoff;
	bool qdss_enabled;