From 359b9fa9ff02dd62dcdf073f226770596bb7eeea Mon Sep 17 00:00:00 2001 From: Kalyan Thota Date: Tue, 14 Dec 2021 07:17:01 -0800 Subject: [PATCH] disp: msm: reset thread priority work on every new run Reinit thread priority work before queueing on multiple display threads as the work stores the former worker thread. Also flush work such the next init is serialized. Change-Id: I51409d4d12d100be0cb30238f812a56ec064a339 Signed-off-by: Kalyan Thota --- techpack/display/msm/msm_drv.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/techpack/display/msm/msm_drv.c b/techpack/display/msm/msm_drv.c index 5ebf7f7ffab5..c502bad65f87 100644 --- a/techpack/display/msm/msm_drv.c +++ b/techpack/display/msm/msm_drv.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark @@ -621,7 +622,6 @@ static int msm_drm_display_thread_create(struct msm_drm_private *priv, struct dr { int i, ret = 0; - kthread_init_work(&priv->thread_priority_work, msm_drm_display_thread_priority_worker); for (i = 0; i < priv->num_crtcs; i++) { /* initialize display thread */ priv->disp_thread[i].crtc_id = priv->crtcs[i]->base.id; @@ -631,7 +631,10 @@ static int msm_drm_display_thread_create(struct msm_drm_private *priv, struct dr kthread_run(kthread_worker_fn, &priv->disp_thread[i].worker, "crtc_commit:%d", priv->disp_thread[i].crtc_id); + kthread_init_work(&priv->thread_priority_work, + msm_drm_display_thread_priority_worker); kthread_queue_work(&priv->disp_thread[i].worker, &priv->thread_priority_work); + kthread_flush_work(&priv->thread_priority_work); if (IS_ERR(priv->disp_thread[i].thread)) { dev_err(dev, "failed to create crtc_commit kthread\n"); @@ -653,7 +656,10 @@ static int msm_drm_display_thread_create(struct msm_drm_private *priv, struct dr * frame_pending counters beyond 2. This can lead to commit * failure at crtc commit level. */ + kthread_init_work(&priv->thread_priority_work, + msm_drm_display_thread_priority_worker); kthread_queue_work(&priv->event_thread[i].worker, &priv->thread_priority_work); + kthread_flush_work(&priv->thread_priority_work); if (IS_ERR(priv->event_thread[i].thread)) { dev_err(dev, "failed to create crtc_event kthread\n"); @@ -688,7 +694,9 @@ static int msm_drm_display_thread_create(struct msm_drm_private *priv, struct dr kthread_init_worker(&priv->pp_event_worker); priv->pp_event_thread = kthread_run(kthread_worker_fn, &priv->pp_event_worker, "pp_event"); + kthread_init_work(&priv->thread_priority_work, msm_drm_display_thread_priority_worker); kthread_queue_work(&priv->pp_event_worker, &priv->thread_priority_work); + kthread_flush_work(&priv->thread_priority_work); if (IS_ERR(priv->pp_event_thread)) { dev_err(dev, "failed to create pp_event kthread\n");