disp: rotator: set priority for rotator threads

Set the rotator threads priority (commit and
done) to RT.

Change-Id: Ia2db4a86efe1d3ca990cade8424a5c72b3d4595b
Signed-off-by: Gaurav LNU <quic_glnu@quicinc.com>
This commit is contained in:
Gaurav LNU
2022-11-11 02:03:32 -08:00
committed by Wiktor Rudzki
parent 1525ed2b1b
commit 142f6f272b
2 changed files with 26 additions and 23 deletions

View File

@@ -1051,6 +1051,20 @@ static void sde_rotator_put_hw_resource(struct sde_rot_queue *queue,
entry->item.session_id, entry->item.sequence_id);
}
static void rotator_thread_priority_worker(struct kthread_work *work)
{
int ret = 0;
struct sched_param param = { 0 };
struct task_struct *task = current->group_leader;
param.sched_priority = 5;
ret = sched_setscheduler(task, SCHED_FIFO, &param);
if (ret)
SDEROT_ERR(
"pid:%d name:%s priority update failed %d\n",
current->tgid, task->comm, ret);
}
/*
* caller will need to call sde_rotator_deinit_queue when
* the function returns error
@@ -1059,8 +1073,6 @@ static int sde_rotator_init_queue(struct sde_rot_mgr *mgr)
{
int i, size, ret = 0;
char name[32];
struct sched_param param = { .sched_priority = 5 };
size = sizeof(struct sde_rot_queue) * mgr->queue_count;
mgr->commitq = devm_kzalloc(mgr->device, size, GFP_KERNEL);
if (!mgr->commitq)
@@ -1073,21 +1085,16 @@ static int sde_rotator_init_queue(struct sde_rot_mgr *mgr)
kthread_init_worker(&mgr->commitq[i].rot_kw);
mgr->commitq[i].rot_thread = kthread_run(kthread_worker_fn,
&mgr->commitq[i].rot_kw, name);
kthread_init_work(&mgr->thread_priority_work,
rotator_thread_priority_worker);
kthread_queue_work(&mgr->commitq[i].rot_kw,
&mgr->thread_priority_work);
kthread_flush_work(&mgr->thread_priority_work);
if (IS_ERR(mgr->commitq[i].rot_thread)) {
ret = -EPERM;
mgr->commitq[i].rot_thread = NULL;
break;
}
ret = sched_setscheduler(mgr->commitq[i].rot_thread,
SCHED_FIFO, &param);
if (ret) {
SDEROT_ERR(
"failed to set kthread priority for commitq %d\n",
ret);
break;
}
/* timeline not used */
mgr->commitq[i].timeline = NULL;
}
@@ -1104,21 +1111,16 @@ static int sde_rotator_init_queue(struct sde_rot_mgr *mgr)
kthread_init_worker(&mgr->doneq[i].rot_kw);
mgr->doneq[i].rot_thread = kthread_run(kthread_worker_fn,
&mgr->doneq[i].rot_kw, name);
kthread_init_work(&mgr->thread_priority_work,
rotator_thread_priority_worker);
kthread_queue_work(&mgr->commitq[i].rot_kw,
&mgr->thread_priority_work);
kthread_flush_work(&mgr->thread_priority_work);
if (IS_ERR(mgr->doneq[i].rot_thread)) {
ret = -EPERM;
mgr->doneq[i].rot_thread = NULL;
break;
}
ret = sched_setscheduler(mgr->doneq[i].rot_thread,
SCHED_FIFO, &param);
if (ret) {
SDEROT_ERR(
"failed to set kthread priority for doneq %d\n",
ret);
break;
}
/* timeline not used */
mgr->doneq[i].timeline = NULL;
}

View File

@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
/* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
*/
@@ -444,6 +444,7 @@ struct sde_rot_mgr {
atomic_t device_suspended;
struct platform_device *pdev;
struct device *device;
struct kthread_work thread_priority_work;
/*
* Managing rotation queues, depends on