From: Lajos Molnar mol...@ti.com
This patch contains the TILER interface file and the documentation.
Signed-off-by: Lajos Molnar mol...@ti.com
Signed-off-by: David Sin david...@ti.com
---
Documentation/arm/OMAP/TILER | 126 ++
arch/arm/mach-omap2/include/mach/tiler.h | 173 ++
2 files changed, 299 insertions(+), 0 deletions(-)
create mode 100644 Documentation/arm/OMAP/TILER
create mode 100644 arch/arm/mach-omap2/include/mach/tiler.h
diff --git a/Documentation/arm/OMAP/TILER b/Documentation/arm/OMAP/TILER
new file mode 100644
index 000..2e94ad7
--- /dev/null
+++ b/Documentation/arm/OMAP/TILER
@@ -0,0 +1,126 @@
+Tiling and Isometric Lightweight Engine for Rotation (TILER) driver
+
+Dynamic Memory Manager (DMM) is a hardware block made by Texas Instruments.
+Within the DMM exists at least one TILER hardware component. Its purpose is to
+organize video/image memory in a 2-dimensional fashion to limit memory
+bandwidth and facilitate 0 effort rotation and mirroring. The TILER driver
+facilitates allocating, freeing, as well as mapping 2D blocks (areas) in the
+TILER container(s). It also facilitates rotating and mirroring the allocated
+blocks or its rectangular subsections.
+
+TERMINOLOGY
+
+slot
+
+The basic TILER driver operates on blocks of slots. A slot is the granularity
+of the TILER hardware device. For all current uses it is 4K, but could also be
+16 or 64K. The DMM-TILER TRM refers to this as page but we want to separate
+this concept from the MMU pages.
+
+page
+
+The granularity of the MMU, used by the kernel. This is 4K.
+
+block
+
+The TILER hardware component supports 1D and 2D blocks. A 2D block is a
+rectangular arrangement of slots with arbitrary width and height in a 2D
+container. A 1D block is a linear arrangement of slots with arbitrary length
+ in a 1D container. This TILER driver only supports 2D blocks.
+
+container
+
+The TILER driver supports an arbitrary TILER container size. However, for
+all current implementations it is 256 by 128 slots. The container currently
can
+only be used as a 2D container.
+
+reserved area
+
+Each block resides within a reserved area in the container. This area may
+be larger than the actual set of slots that a block occupies. The reason for
+this is to protect access from one block into another. Since TILER container
is
+mmap-ped into user space as individual pages, all slots that are spanned by
+that page become visible to the user. The tiler driver allows restricting the
+granularity of the reserved area (default alignment) as well as the mapped
+area (granularity).
+
+Using TILER driver KERNEL APIs:
+
+1. Allocating and freeing a 1080p YUV422 block
+
+struct tiler_block_t blk = {0};
+int res;
+
+blk.width = 1920;
+blk.height = 1080;
+res = tiler_alloc(blk, TILFMT_16BIT, 0, 0);
+
+tiler_free(blk);
+
+2. Allocating and freeing a 1080p YUV420p block
+
+struct tiler_block_t blk_Y = {0}, blk_UV = {0};
+int res;
+
+blk_Y.width = 1920;
+blk_Y.height = 1080;
+blk_UV.widht = 960;
+blk_UV.height = 540;
+res = tiler_alloc(blk_Y, TILFMT_8BIT, 0, 0) ? :
+tiler_alloc(blk_UV, TILFMT_16BIT, PAGE_SIZE,
+blk_y-phys ~PAGE_MASK);
+
+tiler_free(blk_Y);
+tiler_free(blk_UV);
+
+Note how we allocated the UV block at the same in-page offset as the Y buffer.
+This facilitates mmap-ping both Y and UV blocks into userspace as one
+contiguous buffer.
+
+3. Mmap-ing YUV420p block into user space
+
+static int my_mmap(struct file *file, struct vm_area_struct *vma)
+{
+unsigned long size = (vma-vm_end - vma-vm_start);
+unsigned long start = vma-vm_start;
+
+if (size != tiler_size(blk_Y) + tiler_size(blk_UV))
+return -EINVAL;
+
+return tiler_mmap_blk(blk_Y, 0, tiler_size(blk_Y), vma, 0) ?
+: tiler_mmap_blk(blk_UV, 0, tiler_size(blk_UV), vma,
+tiler_size(blk_Y));
+}
+
+CONFIGURATIONS
+
+The TILER driver allows specifying a container manager (tcm) for each
+pixel format. The same container manager can be specified for more than
+one pixel formats.
+
+Each container manager also operates on a Physical Address Translator PAT
+ instance. One can also specify a virtual PAT (with a linear preassigned
+ memory space no actual PAT programming), but it is not implemented.
+
+PARAMETERS
+
+The TILER driver allows specifying:
+
+granularity (tiler.grain, CONFIG_TILER_GRANULARITY):
+
+Each block is mapped in width-chunks of granularity.
+
+default alignment (tiler.align, CONFIG_TILER_ALIGNMENT):
+
+Default alignment if aligment is not specified (0). Otherwise,
+blocks are allocated at an address aligned to the value given plus an
+