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

Commit 824bbc22 authored by Dhaval Patel's avatar Dhaval Patel Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm: move display and event threads to realtime priority



Display thread processes the work assigned by HAL for
screen update. Current logic selects the thread priority
to default and causes the frame drop. This patch moves
the display thread to realtime priority to process the display
work items at realtime. Event thread must follow the
display thread priority to avoid frame_pending counters
beyond 2.

Change-Id: I9154b749550cee52da1d16d22a8418676325e769
Signed-off-by: default avatarDhaval Patel <pdhaval@codeaurora.org>
parent a262fffa
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -534,6 +534,7 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
	struct msm_kms *kms;
	struct sde_dbg_power_ctrl dbg_power_ctrl = { 0 };
	int ret, i;
	struct sched_param param;

	ddev = drm_dev_alloc(drv, dev);
	if (!ddev) {
@@ -637,6 +638,12 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
	}
	ddev->mode_config.funcs = &mode_config_funcs;

	/**
	 * this priority was found during empiric testing to have appropriate
	 * realtime scheduling to process display updates and interact with
	 * other real time and normal priority task
	 */
	param.sched_priority = 16;
	for (i = 0; i < priv->num_crtcs; i++) {

		/* initialize display thread */
@@ -647,6 +654,11 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
			kthread_run(kthread_worker_fn,
				&priv->disp_thread[i].worker,
				"crtc_commit:%d", priv->disp_thread[i].crtc_id);
		ret = sched_setscheduler(priv->disp_thread[i].thread,
							SCHED_FIFO, &param);
		if (ret)
			pr_warn("display thread priority update failed: %d\n",
									ret);

		if (IS_ERR(priv->disp_thread[i].thread)) {
			dev_err(dev, "failed to create crtc_commit kthread\n");
@@ -661,6 +673,18 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
			kthread_run(kthread_worker_fn,
				&priv->event_thread[i].worker,
				"crtc_event:%d", priv->event_thread[i].crtc_id);
		/**
		 * event thread should also run at same priority as disp_thread
		 * because it is handling frame_done events. A lower priority
		 * event thread and higher priority disp_thread can causes
		 * frame_pending counters beyond 2. This can lead to commit
		 * failure at crtc commit level.
		 */
		ret = sched_setscheduler(priv->event_thread[i].thread,
							SCHED_FIFO, &param);
		if (ret)
			pr_warn("display event thread priority update failed: %d\n",
									ret);

		if (IS_ERR(priv->event_thread[i].thread)) {
			dev_err(dev, "failed to create crtc_event kthread\n");