drm/msm: validate display and event threads
While creating display and event threads per crtc, validate them before setting their priorities. changes in v2: - use dev_warn (Abhinav Kumar) changes in v3: - fix compilation error changes in v4: - Remove Change-Id (Sean Paul) - Keep logging within 80 char limit (Sean Paul) Reviewed-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Sean Paul <seanpaul@chromium.org>
This commit is contained in:
parent
3b712e43e3
commit
7f9743abaa
1 changed files with 16 additions and 33 deletions
|
@ -553,17 +553,18 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
|
||||||
kthread_run(kthread_worker_fn,
|
kthread_run(kthread_worker_fn,
|
||||||
&priv->disp_thread[i].worker,
|
&priv->disp_thread[i].worker,
|
||||||
"crtc_commit:%d", priv->disp_thread[i].crtc_id);
|
"crtc_commit:%d", priv->disp_thread[i].crtc_id);
|
||||||
ret = sched_setscheduler(priv->disp_thread[i].thread,
|
|
||||||
SCHED_FIFO, ¶m);
|
|
||||||
if (ret)
|
|
||||||
pr_warn("display thread priority update failed: %d\n",
|
|
||||||
ret);
|
|
||||||
|
|
||||||
if (IS_ERR(priv->disp_thread[i].thread)) {
|
if (IS_ERR(priv->disp_thread[i].thread)) {
|
||||||
dev_err(dev, "failed to create crtc_commit kthread\n");
|
dev_err(dev, "failed to create crtc_commit kthread\n");
|
||||||
priv->disp_thread[i].thread = NULL;
|
priv->disp_thread[i].thread = NULL;
|
||||||
|
goto err_msm_uninit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = sched_setscheduler(priv->disp_thread[i].thread,
|
||||||
|
SCHED_FIFO, ¶m);
|
||||||
|
if (ret)
|
||||||
|
dev_warn(dev, "disp_thread set priority failed: %d\n",
|
||||||
|
ret);
|
||||||
|
|
||||||
/* initialize event thread */
|
/* initialize event thread */
|
||||||
priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id;
|
priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id;
|
||||||
kthread_init_worker(&priv->event_thread[i].worker);
|
kthread_init_worker(&priv->event_thread[i].worker);
|
||||||
|
@ -572,6 +573,12 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
|
||||||
kthread_run(kthread_worker_fn,
|
kthread_run(kthread_worker_fn,
|
||||||
&priv->event_thread[i].worker,
|
&priv->event_thread[i].worker,
|
||||||
"crtc_event:%d", priv->event_thread[i].crtc_id);
|
"crtc_event:%d", priv->event_thread[i].crtc_id);
|
||||||
|
if (IS_ERR(priv->event_thread[i].thread)) {
|
||||||
|
dev_err(dev, "failed to create crtc_event kthread\n");
|
||||||
|
priv->event_thread[i].thread = NULL;
|
||||||
|
goto err_msm_uninit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event thread should also run at same priority as disp_thread
|
* event thread should also run at same priority as disp_thread
|
||||||
* because it is handling frame_done events. A lower priority
|
* because it is handling frame_done events. A lower priority
|
||||||
|
@ -582,32 +589,8 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
|
||||||
ret = sched_setscheduler(priv->event_thread[i].thread,
|
ret = sched_setscheduler(priv->event_thread[i].thread,
|
||||||
SCHED_FIFO, ¶m);
|
SCHED_FIFO, ¶m);
|
||||||
if (ret)
|
if (ret)
|
||||||
pr_warn("display event thread priority update failed: %d\n",
|
dev_warn(dev, "event_thread set priority failed:%d\n",
|
||||||
ret);
|
ret);
|
||||||
|
|
||||||
if (IS_ERR(priv->event_thread[i].thread)) {
|
|
||||||
dev_err(dev, "failed to create crtc_event kthread\n");
|
|
||||||
priv->event_thread[i].thread = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((!priv->disp_thread[i].thread) ||
|
|
||||||
!priv->event_thread[i].thread) {
|
|
||||||
/* clean up previously created threads if any */
|
|
||||||
for ( ; i >= 0; i--) {
|
|
||||||
if (priv->disp_thread[i].thread) {
|
|
||||||
kthread_stop(
|
|
||||||
priv->disp_thread[i].thread);
|
|
||||||
priv->disp_thread[i].thread = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->event_thread[i].thread) {
|
|
||||||
kthread_stop(
|
|
||||||
priv->event_thread[i].thread);
|
|
||||||
priv->event_thread[i].thread = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
goto err_msm_uninit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = drm_vblank_init(ddev, priv->num_crtcs);
|
ret = drm_vblank_init(ddev, priv->num_crtcs);
|
||||||
|
|
Loading…
Add table
Reference in a new issue