summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLajos Molnar <molnar@ti.com>2011-04-07 08:41:38 +0100
committerAndy Green <andy.green@linaro.org>2011-04-07 08:41:38 +0100
commiteebe0bed12f0dfa35fc50ec8fa6da0e7184cdf69 (patch)
treee8f03c8ef6e42824611e9a4d7a5069567b3034e5 /drivers
parentc225bdc7bdd28b8fab1776ea4735b1a0388c048b (diff)
TILER: Add support for in-page offset for buffers.
Now that blocks are not necessarily page-aligned, and the physical addresses of blocks are not revealed, the buffer offset has to contain the in-page offset. This patch propagates the in-page offset into the buffer offset and adjusts the buffer size so still only the actual pages are used. It also adjusts the offset lookup to be able to deal with non-aligned buffer offsets and lengths. Signed-off-by: Lajos Molnar <molnar@ti.com> Signed-off-by: David Sin <davidsin@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/tiler/tiler-iface.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/media/video/tiler/tiler-iface.c b/drivers/media/video/tiler/tiler-iface.c
index c2b6e025030..c505c278be9 100644
--- a/drivers/media/video/tiler/tiler-iface.c
+++ b/drivers/media/video/tiler/tiler-iface.c
@@ -98,7 +98,7 @@ static s32 _m_register_buf(struct __buf_info *_b, struct process_info *pi)
{
struct mem_info *mi = NULL;
struct tiler_buf_info *b = &_b->buf_info;
- u32 i, num = b->num_blocks;
+ u32 i, num = b->num_blocks, offs;
/* check validity */
if (num > TILER_MAX_NUM_BLOCKS)
@@ -120,7 +120,9 @@ static s32 _m_register_buf(struct __buf_info *_b, struct process_info *pi)
}
/* if found all, register buffer */
- b->offset = _m_get_offs(pi, b->length);
+ offs = _b->mi[0]->blk.phys & ~PAGE_MASK;
+ b->offset = _m_get_offs(pi, b->length) + offs;
+ b->length -= offs;
list_add(&_b->by_pid, &pi->bufs);
@@ -247,8 +249,9 @@ static s32 tiler_mmap(struct file *filp, struct vm_area_struct *vma)
mutex_lock(&mtx);
list_for_each_entry(_b, &pi->bufs, by_pid) {
- if (offs >= _b->buf_info.offset &&
- offs + size <= _b->buf_info.offset + _b->buf_info.length) {
+ if (offs >= (_b->buf_info.offset & PAGE_MASK) &&
+ offs + size <= PAGE_ALIGN(_b->buf_info.offset +
+ _b->buf_info.length)) {
b = &_b->buf_info;
break;
}