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

Commit 7ba450fa authored by Yashwanth's avatar Yashwanth
Browse files

disp: msm: queue vblank work on disp thread during modeset



If vblank work is queued to event thread, during modeset,
there might be a case where vblank is enabled in between
resulting in vblank ref count mismatch. This change queues
vblank request to disp thread during modeset.

Change-Id: I98b87b4209e1f7f535980eef22a50df17c346c23
Signed-off-by: default avatarYashwanth <yvulapu@codeaurora.org>
parent d92ce846
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -323,6 +323,8 @@ static int vblank_ctrl_queue_work(struct msm_drm_private *priv,
					int crtc_id, bool enable)
{
	struct vblank_work *cur_work;
	struct drm_crtc *crtc;
	struct kthread_worker *worker;

	if (!priv || crtc_id >= priv->num_crtcs)
		return -EINVAL;
@@ -331,14 +333,23 @@ static int vblank_ctrl_queue_work(struct msm_drm_private *priv,
	if (!cur_work)
		return -ENOMEM;

	crtc = priv->crtcs[crtc_id];

	kthread_init_work(&cur_work->work, vblank_ctrl_worker);
	cur_work->crtc_id = crtc_id;
	cur_work->enable = enable;
	cur_work->priv = priv;

	kthread_queue_work(&priv->event_thread[crtc_id].worker,
						&cur_work->work);
	/* During modeset scenario, vblank request is queued to
	 * display thread to avoid enabling irq resulting in
	 * vblank refcount mismatch
	 */
	if (crtc->state && drm_atomic_crtc_needs_modeset(crtc->state))
		worker = &priv->disp_thread[crtc_id].worker;
	else
		worker = &priv->event_thread[crtc_id].worker;

	kthread_queue_work(worker, &cur_work->work);
	return 0;
}