aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLajos Molnar <molnar@ti.com>2010-07-08 10:57:37 -0400
committerPaolo Pisati <paolo.pisati@canonical.com>2012-08-17 04:19:00 -0400
commit35e3c533393a511183c69b5d5a9c79fbea356bf5 (patch)
tree09fdcd3688c68042deddd47168de94a168a37e28
parentf39db895afab88d12cf17b40931fe407a917bbf8 (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>
-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)
98{ 98{
99 struct mem_info *mi = NULL; 99 struct mem_info *mi = NULL;
100 struct tiler_buf_info *b = &_b->buf_info; 100 struct tiler_buf_info *b = &_b->buf_info;
101 u32 i, num = b->num_blocks; 101 u32 i, num = b->num_blocks, offs;
102 102
103 /* check validity */ 103 /* check validity */
104 if (num > TILER_MAX_NUM_BLOCKS) 104 if (num > TILER_MAX_NUM_BLOCKS)
@@ -120,7 +120,9 @@ static s32 _m_register_buf(struct __buf_info *_b, struct process_info *pi)
120 } 120 }
121 121
122 /* if found all, register buffer */ 122 /* if found all, register buffer */
123 b->offset = _m_get_offs(pi, b->length); 123 offs = _b->mi[0]->blk.phys & ~PAGE_MASK;
124 b->offset = _m_get_offs(pi, b->length) + offs;
125 b->length -= offs;
124 126
125 list_add(&_b->by_pid, &pi->bufs); 127 list_add(&_b->by_pid, &pi->bufs);
126 128
@@ -247,8 +249,9 @@ static s32 tiler_mmap(struct file *filp, struct vm_area_struct *vma)
247 249
248 mutex_lock(&mtx); 250 mutex_lock(&mtx);
249 list_for_each_entry(_b, &pi->bufs, by_pid) { 251 list_for_each_entry(_b, &pi->bufs, by_pid) {
250 if (offs >= _b->buf_info.offset && 252 if (offs >= (_b->buf_info.offset & PAGE_MASK) &&
251 offs + size <= _b->buf_info.offset + _b->buf_info.length) { 253 offs + size <= PAGE_ALIGN(_b->buf_info.offset +
254 _b->buf_info.length)) {
252 b = &_b->buf_info; 255 b = &_b->buf_info;
253 break; 256 break;
254 } 257 }