diff options
author | Ilan Aelion <iaelion@nvidia.com> | 2012-08-08 12:25:52 -0600 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-08-14 17:05:15 -0700 |
commit | 548979770b46039b1f42502c18d34bbf1e0a96bb (patch) | |
tree | be2bc019323d92d417bc7ab3efe5367341863e72 | |
parent | 77c8da0aa18fad9e33fd8b1afb2013b1a476d74e (diff) |
misc: throughput: move client calls to work queue
Perform throughput notifications to clients on work queue rather than
synchronously to dc flip notifications.
Bug 1028850
Change-Id: Ib9446a4ab87a476230a90a1f23c260bcf98e01dc
Signed-off-by: Ilan Aelion <iaelion@nvidia.com>
(cherry picked from commit f48bec5168232d7a50ecfb193146a4be214af3d7)
Reviewed-on: http://git-master/r/#change,122160
Reviewed-on: http://git-master/r/123102
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
-rw-r--r-- | drivers/misc/tegra-throughput.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/misc/tegra-throughput.c b/drivers/misc/tegra-throughput.c index bff53235a74c..26573d8afc1a 100644 --- a/drivers/misc/tegra-throughput.c +++ b/drivers/misc/tegra-throughput.c @@ -34,9 +34,17 @@ static unsigned short target_frame_time; static unsigned short last_frame_time; static ktime_t last_flip; static unsigned int multiple_app_disable; - static spinlock_t lock; +static struct work_struct work; +static int throughput_hint; + +static void set_throughput_hint(struct work_struct *work) +{ + /* notify throughput hint clients here */ + nvhost_scale3d_set_throughput_hint(throughput_hint); +} + static int throughput_flip_notifier(struct notifier_block *nb, unsigned long val, void *data) @@ -47,7 +55,6 @@ static int throughput_flip_notifier(struct notifier_block *nb, else { long timediff; ktime_t now; - int throughput_hint; now = ktime_get(); if (last_flip.tv64 != 0) { @@ -66,8 +73,8 @@ static int throughput_flip_notifier(struct notifier_block *nb, throughput_hint = ((int) target_frame_time * 100)/last_frame_time; - /* notify throughput hint clients here */ - nvhost_scale3d_set_throughput_hint(throughput_hint); + if (!work_pending(&work)) + schedule_work(&work); } last_flip = now; } @@ -225,6 +232,7 @@ int __init throughput_init_miscdev(void) pr_debug("%s: initializing\n", __func__); spin_lock_init(&lock); + INIT_WORK(&work, set_throughput_hint); ret = misc_register(&throughput_miscdev); if (ret) { @@ -242,6 +250,8 @@ void __exit throughput_exit_miscdev(void) { pr_debug("%s: exiting\n", __func__); + cancel_work_sync(&work); + misc_deregister(&throughput_miscdev); } |