summaryrefslogtreecommitdiff
path: root/drivers/video/omap2/omapfb/omapfb.h
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-12-13 15:19:05 +0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-12-13 15:19:05 +0400
commit3ed37d9aba486dece93e05d68f691b80ee100900 (patch)
tree3e391eb45694c948c608a9c5ce99bc2cc0b52164 /drivers/video/omap2/omapfb/omapfb.h
parentc7e1eae537652330cec3fbf5f8f50000b2f24269 (diff)
downloadlinux-3ed37d9aba486dece93e05d68f691b80ee100900.tar.xz
Revert "OMAPFB: simplify locking"
This reverts commit b41deecbda70067b26a3a7704fdf967a7940935b. The simpler locking causes huge latencies when two processes use the omapfb, even if they use different framebuffers. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/omapfb/omapfb.h')
-rw-r--r--drivers/video/omap2/omapfb/omapfb.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h
index 2b5264475ed4..623cd872a367 100644
--- a/drivers/video/omap2/omapfb/omapfb.h
+++ b/drivers/video/omap2/omapfb/omapfb.h
@@ -62,6 +62,8 @@ struct omapfb2_mem_region {
bool alloc; /* allocated by the driver */
bool map; /* kernel mapped by the driver */
atomic_t map_count;
+ struct rw_semaphore lock;
+ atomic_t lock_count;
};
/* appended to fb_info */
@@ -189,4 +191,18 @@ static inline int omapfb_overlay_enable(struct omap_overlay *ovl,
return ovl->disable(ovl);
}
+static inline struct omapfb2_mem_region *
+omapfb_get_mem_region(struct omapfb2_mem_region *rg)
+{
+ down_read_nested(&rg->lock, rg->id);
+ atomic_inc(&rg->lock_count);
+ return rg;
+}
+
+static inline void omapfb_put_mem_region(struct omapfb2_mem_region *rg)
+{
+ atomic_dec(&rg->lock_count);
+ up_read(&rg->lock);
+}
+
#endif