summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAmit Kamath <akamath@nvidia.com>2011-04-27 17:53:43 +0530
committerNiket Sirsi <nsirsi@nvidia.com>2011-05-09 18:00:08 -0700
commit6d750e0fafe6833b7d59abf576e5a9c536919e02 (patch)
tree3c4bf5ca532fe6fbeffeb813e927d7cbe4db9781 /drivers
parent52e7d11bc42abb7643191bccf55fc9fc66b640d2 (diff)
video: tegra: dc: handle error condition
Do not handle requests further for displays that are not enabled Bug 813310 Bug 813728 Reviewed-on: http://git-master/r/29515 (cherry picked from commit 22578f1d7065ea84855fdbcaf09a792e9f9d3856) Change-Id: I1fa907e33f2d250fff64752c8f0e26de51f3655b Reviewed-on: http://git-master/r/30672 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/tegra/dc/overlay.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/video/tegra/dc/overlay.c b/drivers/video/tegra/dc/overlay.c
index 47a6f498938f..0a7bd4de124e 100644
--- a/drivers/video/tegra/dc/overlay.c
+++ b/drivers/video/tegra/dc/overlay.c
@@ -38,6 +38,8 @@
#include "../nvmap/nvmap.h"
#include "overlay.h"
+DEFINE_MUTEX(tegra_flip_lock);
+
struct overlay_client;
struct overlay {
@@ -297,7 +299,7 @@ static void tegra_overlay_flip_worker(struct work_struct *work)
tegra_dc_sync_windows(wins, nr_win);
}
- tegra_dc_incr_syncpt_min(overlay->dc, data->syncpt_max);
+ tegra_dc_incr_syncpt_min(overlay->dc, data->syncpt_max);
/* unpin and deref previous front buffers */
for (i = 0; i < nr_unpin; i++) {
@@ -320,10 +322,17 @@ static int tegra_overlay_flip(struct tegra_overlay_info *overlay,
if (WARN_ON(!overlay->ndev))
return -EFAULT;
+ mutex_lock(&tegra_flip_lock);
+ if (!overlay->dc->enabled) {
+ mutex_unlock(&tegra_flip_lock);
+ return -EFAULT;
+ }
+
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (data == NULL) {
dev_err(&overlay->ndev->dev,
"can't allocate memory for flip\n");
+ mutex_unlock(&tegra_flip_lock);
return -ENOMEM;
}
@@ -354,6 +363,7 @@ static int tegra_overlay_flip(struct tegra_overlay_info *overlay,
args->post_syncpt_val = syncpt_max;
args->post_syncpt_id = tegra_dc_get_syncpt_id(overlay->dc);
+ mutex_unlock(&tegra_flip_lock);
return 0;
@@ -367,6 +377,7 @@ surf_err:
}
}
kfree(data);
+ mutex_unlock(&tegra_flip_lock);
return err;
}
static void tegra_overlay_set_emc_freq(struct tegra_overlay_info *dev)
@@ -725,5 +736,7 @@ void tegra_overlay_unregister(struct tegra_overlay_info *info)
void tegra_overlay_disable(struct tegra_overlay_info *overlay_info)
{
+ mutex_lock(&tegra_flip_lock);
flush_workqueue(overlay_info->flip_wq);
+ mutex_unlock(&tegra_flip_lock);
}