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

Commit 1345f2e5 authored by Raviteja Tamatam's avatar Raviteja Tamatam
Browse files

drm/msm/sde: queue pp work items to dedicated event thread



Histogram and AD pp feature works are queued in the interrupt context
to the same crtc_event thread as others like vblank work items.
This is causing delay in fence release as work items are serialized
which is further leading to performance issue. This change will allow
the works to run parallel in different dedicated event thread.

Change-Id: I040d1a446dc6644609c2ee31b051073245da1bba
Signed-off-by: default avatarRaviteja Tamatam <travitej@codeaurora.org>
parent 8b7300fd
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -668,6 +668,27 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
		}
	}

	/**
	 * Since pp interrupt is heavy weight, try to queue the work
	 * into a dedicated worker thread, so that they dont interrupt
	 * other important events.
	 */
	kthread_init_worker(&priv->pp_event_worker);
	priv->pp_event_thread = kthread_run(kthread_worker_fn,
			&priv->pp_event_worker, "pp_event");

	ret = sched_setscheduler(priv->pp_event_thread,
						SCHED_FIFO, &param);
	if (ret)
		pr_warn("pp_event thread priority update failed: %d\n",
								ret);

	if (IS_ERR(priv->pp_event_thread)) {
		dev_err(dev, "failed to create pp_event kthread\n");
		priv->pp_event_thread = NULL;
		goto fail;
	}

	ret = drm_vblank_init(ddev, priv->num_crtcs);
	if (ret < 0) {
		dev_err(dev, "failed to initialize vblank\n");
+4 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 * Copyright (C) 2013 Red Hat
 * Author: Rob Clark <robdclark@gmail.com>
 *
@@ -578,6 +578,9 @@ struct msm_drm_private {
	struct msm_drm_thread disp_thread[MAX_CRTCS];
	struct msm_drm_thread event_thread[MAX_CRTCS];

	struct task_struct *pp_event_thread;
	struct kthread_worker pp_event_worker;

	unsigned int num_encoders;
	struct drm_encoder *encoders[MAX_ENCODERS];

+4 −2
Original line number Diff line number Diff line
@@ -1573,7 +1573,8 @@ static void sde_cp_ad_interrupt_cb(void *arg, int irq_idx)
{
	struct sde_crtc *crtc = arg;

	sde_crtc_event_queue(&crtc->base, sde_cp_notify_ad_event, NULL);
	sde_crtc_event_queue(&crtc->base, sde_cp_notify_ad_event,
							NULL, true);
}

static void sde_cp_notify_ad_event(struct drm_crtc *crtc_drm, void *arg)
@@ -1834,7 +1835,8 @@ static void sde_cp_hist_interrupt_cb(void *arg, int irq_idx)
	}

	/* notify histogram event */
	sde_crtc_event_queue(crtc_drm, sde_cp_notify_hist_event, NULL);
	sde_crtc_event_queue(crtc_drm, sde_cp_notify_hist_event,
							NULL, true);
}

static void sde_cp_notify_hist_event(struct drm_crtc *crtc_drm, void *arg)
+7 −2
Original line number Diff line number Diff line
@@ -5893,7 +5893,8 @@ static void _sde_crtc_event_cb(struct kthread_work *work)
}

int sde_crtc_event_queue(struct drm_crtc *crtc,
		void (*func)(struct drm_crtc *crtc, void *usr), void *usr)
		void (*func)(struct drm_crtc *crtc, void *usr),
		void *usr, bool color_processing_event)
{
	unsigned long irq_flags;
	struct sde_crtc *sde_crtc;
@@ -5932,6 +5933,10 @@ int sde_crtc_event_queue(struct drm_crtc *crtc,

	/* queue new event request */
	kthread_init_work(&event->kt_work, _sde_crtc_event_cb);
	if (color_processing_event)
		kthread_queue_work(&priv->pp_event_worker,
			&event->kt_work);
	else
		kthread_queue_work(&priv->event_thread[crtc_id].worker,
			&event->kt_work);

+3 −1
Original line number Diff line number Diff line
@@ -664,10 +664,12 @@ static inline bool sde_crtc_is_reset_required(struct drm_crtc *crtc)
 * @crtc: Pointer to drm crtc structure
 * @func: Pointer to callback function
 * @usr: Pointer to user data to be passed to callback
 * @color_processing_event: True if color processing event
 * Returns: Zero on success
 */
int sde_crtc_event_queue(struct drm_crtc *crtc,
		void (*func)(struct drm_crtc *crtc, void *usr), void *usr);
		void (*func)(struct drm_crtc *crtc, void *usr),
		void *usr, bool color_processing_event);

/**
 * sde_crtc_res_add - add given resource to resource pool in crtc state