aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtanas (Tony) Zlatinski <zlatinski@gmail.com>2012-02-09 00:19:04 -0600
committerZiyann <jaraidaniel@gmail.com>2014-10-01 12:57:25 +0200
commitd257cfe1cf8637b5b6055c1d30d8eded3d3135e9 (patch)
treedd2de0c877944d0fae0452b8dc847a2d7bce973b
parentf886410e80626b1e1974911f1ecfac749c32de7c (diff)
downloadkernel_samsung_tuna-d257cfe1cf8637b5b6055c1d30d8eded3d3135e9.zip
kernel_samsung_tuna-d257cfe1cf8637b5b6055c1d30d8eded3d3135e9.tar.gz
kernel_samsung_tuna-d257cfe1cf8637b5b6055c1d30d8eded3d3135e9.tar.bz2
OMAP4: TILER: Adds func to fill the virt. sizes
Adds public tiler_fill_virt_array() that deals with non-page-aligned addresses correctly. Change-Id: I31f4aa9a2e81cd84e393529b6534674811f99563 Signed-off-by: Atanas (Tony) Zlatinski <zlatinski@gmail.com>
-rw-r--r--arch/arm/mach-omap2/include/mach/tiler.h12
-rw-r--r--drivers/media/video/tiler/tiler-main.c45
2 files changed, 57 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/include/mach/tiler.h b/arch/arm/mach-omap2/include/mach/tiler.h
index 45e6bbe..f05fec7 100644
--- a/arch/arm/mach-omap2/include/mach/tiler.h
+++ b/arch/arm/mach-omap2/include/mach/tiler.h
@@ -483,6 +483,18 @@ s32 tiler_memsize(enum tiler_fmt fmt, u32 width, u32 height, u32 *alloc_pages,
*/
u32 tiler_block_vstride(tiler_blk_handle handle);
+/**
+ * Fills an array virtual size of a tiler block
+ *
+ * @param handle Handle to tiler block allocation
+ * @param virt_array Array of physical address for the start of each virtual
+ * page
+ * @param handle Pointer to the size of the virt_array array
+ * @return 0 for success. Non zero for error
+ */
+s32 tiler_fill_virt_array(tiler_blk_handle handle, u32 *virt_array,
+ u32 * array_size);
+
struct tiler_pa_info *user_block_to_pa(u32 usr_addr, u32 num_pg);
void tiler_pa_free(struct tiler_pa_info *pa);
diff --git a/drivers/media/video/tiler/tiler-main.c b/drivers/media/video/tiler/tiler-main.c
index f7887d4..e3aa694 100644
--- a/drivers/media/video/tiler/tiler-main.c
+++ b/drivers/media/video/tiler/tiler-main.c
@@ -562,6 +562,51 @@ void fill_virt_array(struct tiler_block_t *blk, u32 *virt_array)
}
}
+s32 tiler_fill_virt_array(tiler_blk_handle handle, u32 *virt_array,
+ u32 *array_size)
+{
+ u32 v, p, len, size, num_pages = 0;
+ u32 i = 0, offs = 0;
+ struct tiler_block_t *blk = &handle->blk;
+
+ if (!array_size)
+ return -1;
+
+ /* get page aligned stride */
+ v = tiler_vstride(blk);
+ p = tiler_pstride(blk);
+
+ /* get page aligned virtual size for the block */
+ size = PAGE_ALIGN(tiler_size(blk));
+
+ if(*array_size < (size/PAGE_SIZE) || !virt_array) {
+ *array_size = (size/PAGE_SIZE);
+ return -2;
+ }
+
+ offs = (blk->phys & PAGE_MASK);
+ while (size) {
+ /* set len to length of one row (2D), or full length if 1D */
+ len = v;
+
+ while (len && size) {
+ virt_array[i++] = offs;
+ num_pages++;
+ size -= PAGE_SIZE;
+ len -= PAGE_SIZE;
+ offs += PAGE_SIZE;
+ }
+
+ /* set offset to next row beginning */
+ offs += p - v;
+ }
+
+ *array_size = num_pages;
+
+ return 0;
+}
+EXPORT_SYMBOL(tiler_fill_virt_array);
+
/**
* Find a place where a 2D block would fit into a 2D area of the
* same height.