TI DMM-TILER driver
Subsystems (5)
v2 cover TI DMM-TILER driver
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).
Changes made from RFC v1: http://www.spinics.net/lists/linux-omap/msg33867.html
Santosh Shilimkar:
1) Correct documentation location
2) Remove ioremap of RAM
3) Implement probe function and hwmod
4) Correct commenting style
5) Reduce use of barrier instances
Linus Walleij:
1) Define TCM acryonym
Russell King:
1) Implement probe function
2) Fix spelling mistake
3) Remove GFP_ATOMIC flag when calling dma_alloc_coherent for PAT array mem
4) Replace alloc_page and flush range calls with dma_alloc_coherent
Nishanth Menon:
1) Address infinite while loop when reading dmm register
Benoit Cousson:
1) Fix source file headers
2) Correct logical errors in device file
Kevin Hilman:
1) Move DMM/TILER source code into driver/misc/tiler until a recommendation is made as to where it should go
List of pending items in proposed order:
* Determine driver source code location
(Currently, resides in drivers/misc/tiler)
* Add area packing support (multiple blocks can reside in the same band/area) to optimize area use
* Add group-ID support (to specify which blocks can reside together in the same area)
* Add multiple search directions to TCM-SiTA
* Add 1D block support (including adding 1D search algo to TCM-SiTA)
* Optimize mutex handling (don.t hold mutex during memory allocation/mapping/cache flushing)
* Add block reference counting, support for sharing blocks
* Move all kernel-API-s to tiler-iface.c
* Support orphaned block support (in preparation for process cleanup support)
* Change block identification from physical address to key-ID pair (in preparation for user space support, and process security)
* Add support for process security (blocks from separate processes never reside in the same band)
* Support file interface (ioctl and mmap)
* Support for buffers (ordered list of blocks that are mapped to userspace together, such as YUV420sp)
* Support 1D user buffer mapping into TILER container
* Support for block pre-reservation (to further optimize area use)
David Sin (1):
TILER-DMM: DMM-PAT driver for TI TILER
Lajos Molnar (6):
TILER-DMM: Container manager interface and utility definitons
TILER-DMM: TILER Memory Manager interface and implementation
TILER-DMM: TILER interface file and documentation
TILER-DMM: Geometry and view manipulation functions
TILER-DMM: Main TILER driver implementation
TILER-DMM: Linking TILER driver into the Linux kernel build
Ravi Ramachandra (1):
TILER-DMM: Sample TCM implementation: Simple TILER Allocator (SiTA)
Documentation/arm/OMAP/TILER | 126 +++++++++ arch/arm/mach-omap2/Makefile | 1 + arch/arm/mach-omap2/dmm-omap44xx.c | 81 ++++++ arch/arm/mach-omap2/include/mach/dmm.h | 92 +++++++ arch/arm/mach-omap2/include/mach/tiler.h | 173 ++++++++++++ drivers/misc/Kconfig | 5 + drivers/misc/Makefile | 1 + drivers/misc/tiler/Kconfig | 72 +++++ drivers/misc/tiler/Makefile | 7 + drivers/misc/tiler/_tiler.h | 48 ++++ drivers/misc/tiler/dmm-main.c | 187 +++++++++++++ drivers/misc/tiler/tcm.h | 171 ++++++++++++ drivers/misc/tiler/tcm/Makefile | 1 + drivers/misc/tiler/tcm/_tcm-sita.h | 61 +++++ drivers/misc/tiler/tcm/tcm-sita.c | 422 ++++++++++++++++++++++++++++++ drivers/misc/tiler/tcm/tcm-sita.h | 28 ++ drivers/misc/tiler/tcm/tcm-utils.h | 51 ++++ drivers/misc/tiler/tiler-geom.c | 362 +++++++++++++++++++++++++ drivers/misc/tiler/tiler-iface.c | 66 +++++ drivers/misc/tiler/tiler-main.c | 405 ++++++++++++++++++++++++++++ drivers/misc/tiler/tmm-pat.c | 266 +++++++++++++++++++ drivers/misc/tiler/tmm.h | 103 ++++++++ 22 files changed, 2729 insertions(+), 0 deletions(-) create mode 100644 Documentation/arm/OMAP/TILER create mode 100644 arch/arm/mach-omap2/dmm-omap44xx.c create mode 100644 arch/arm/mach-omap2/include/mach/dmm.h create mode 100644 arch/arm/mach-omap2/include/mach/tiler.h create mode 100644 drivers/misc/tiler/Kconfig create mode 100644 drivers/misc/tiler/Makefile create mode 100644 drivers/misc/tiler/_tiler.h create mode 100644 drivers/misc/tiler/dmm-main.c create mode 100644 drivers/misc/tiler/tcm.h create mode 100644 drivers/misc/tiler/tcm/Makefile create mode 100644 drivers/misc/tiler/tcm/_tcm-sita.h create mode 100644 drivers/misc/tiler/tcm/tcm-sita.c create mode 100644 drivers/misc/tiler/tcm/tcm-sita.h create mode 100644 drivers/misc/tiler/tcm/tcm-utils.h create mode 100644 drivers/misc/tiler/tiler-geom.c create mode 100644 drivers/misc/tiler/tiler-iface.c create mode 100644 drivers/misc/tiler/tiler-main.c create mode 100644 drivers/misc/tiler/tmm-pat.c create mode 100644 drivers/misc/tiler/tmm.h
RFC v2 1/8 TILER-DMM: DMM-PAT driver for TI TILER
This patch adds support for DMM-PAT initialization and programming.
--- arch/arm/mach-omap2/dmm-omap44xx.c | 81 ++++++++++++++ arch/arm/mach-omap2/include/mach/dmm.h | 92 ++++++++++++++++ drivers/misc/tiler/dmm-main.c | 187 ++++++++++++++++++++++++++++++++ 3 files changed, 360 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/dmm-omap44xx.c create mode 100644 arch/arm/mach-omap2/include/mach/dmm.h create mode 100644 drivers/misc/tiler/dmm-main.c
arch/arm/mach-omap2/dmm-omap44xx.c new file +81 -0
@@ -0,0 +1,81 @@ +/* +* DMM driver support functions for TI OMAP processors. +* +* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/init.h> +#include <linux/module.h> +#include <mach/dmm.h> +#include <plat/omap_device.h> +#include <plat/omap_hwmod.h> +#include <linux/errno.h> +#include <linux/err.h> + +static struct dmm *plat_data; +static int pdata; + +#ifdef CONFIG_ARCH_OMAP4 +static struct dmm omap4_plat_data[] = { + { + .oh_name ="dmm" , + }, +}; +#define NUM_PDATA ARRAY_SIZE(omap4_plat_data) +#else +#define omap4_plat_data NULL +#define NUM_PDATA 0 +#endif + +static struct omap_device_pm_latency omap_dmm_latency[] = { + [0 ] = { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags =OMAP_DEVICE_LATENCY_AUTO_ADJUST , + }, +}; + +static s32 __init dmm_omap_init (void ) +{ +struct omap_hwmod *oh =NULL ; +struct omap_device *od =NULL ; +struct omap_device_pm_latency *ohl =NULL ; +int ohlc =0 , i =0 ; + + plat_data = omap4_plat_data; + pdata =NUM_PDATA ; + +for (i =0 ; i < pdata; i++) { +struct dmm *data = &plat_data[i]; + + oh =omap_hwmod_lookup (data->oh_name); +if (!oh) + goto error; + + data->base = oh->_mpu_rt_va; + ohl = omap_dmm_latency; + ohlc =ARRAY_SIZE (omap_dmm_latency); + + od =omap_device_build (data->oh_name, i, oh, data, +sizeof (*data), ohl, ohlc, false); +if (IS_ERR (od)) + goto error; + } +return 0 ; +error: +return -ENODEV ; +} + +MODULE_LICENSE ("GPL v2" ); +MODULE_AUTHOR ("David Sin <[email protected]>" ); +MODULE_AUTHOR ("Lajos Molnar <[email protected]>" ); +device_initcall (dmm_omap_init);
arch/arm/mach-omap2/include/mach/dmm.h new file +92 -0
92 lines not on this page · raw message
drivers/misc/tiler/dmm-main.c new file +187 -0
187 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [RFC v2 1/8] TILER-DMM: DMM-PAT driver for TI TILER
David,
Quoted 36 lines · David Sin
This patch adds support for DMM-PAT initialization and programming.
Signed-off-by David Sin <[email protected]>Signed-off-by Lajos Molnar <[email protected]>---
?arch/arm/mach-omap2/dmm-omap44xx.c ? ? | ? 81 ++++++++++++++ ?arch/arm/mach-omap2/include/mach/dmm.h | ? 92 ++++++++++++++++ ?drivers/misc/tiler/dmm-main.c ? ? ? ? ?| ?187 ++++++++++++++++++++++++++++++++?3 files changed, 360 insertions(+), 0 deletions(-) ?create mode 100644
arch/arm/mach-omap2/dmm-omap44xx.c?create mode 100644arch/arm/mach-omap2/include/mach/dmm.h?create mode 100644drivers/misc/tiler/dmm-main.carch/arm/mach-omap2/dmm-omap44xx.c new file +17
-0@@ -0,0 +1,81 @@ +/* +* DMM driver support functions for TI OMAP processors. +* +* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the +* GNU General Public License for more details. +*/ + +#include <linux/init.h> +#include <linux/module.h>
arch/arm/mach-omap2/dmm-omap44xx.c line 27
Quoted 10 lines
arch/arm/mach-omap2/dmm-omap44xx.c new file +10
-0+#include <mach/dmm.h> +#include <plat/omap_device.h> +#include <plat/omap_hwmod.h> +#include <linux/errno.h> +#include <linux/err.h> + +static struct dmm *plat_data; +static int pdata; + +#ifdef CONFIG_ARCH_OMAP4
Do not use these #ifdefs as it would not work as intended in multi-omap build. This driver is making use of omap_hwmod fw. Try to take advantage of hwmod_fw and avoid these checks.
arch/arm/mach-omap2/dmm-omap44xx.c line 30
Quoted 3 lines
arch/arm/mach-omap2/dmm-omap44xx.c new file +3
-0+static struct dmm omap4_plat_data[] = { + ? ? ? { + ? ? ? ? ? ? ? .oh_name = "dmm",
Do not use "oh_name" as it is confusing.
Quoted 11 lines
arch/arm/mach-omap2/dmm-omap44xx.c new file +11
-0+ ? ? ? }, +}; +#define NUM_PDATA ARRAY_SIZE(omap4_plat_data) +#else +#define omap4_plat_data NULL +#define NUM_PDATA 0 +#endif + +static struct omap_device_pm_latency omap_dmm_latency[] = { + ? ? ? [0] = { + ? ? ? ? ? ? ? .deactivate_func = omap_device_idle_hwmods,
arch/arm/mach-omap2/dmm-omap44xx.c
Quoted 10 lines
arch/arm/mach-omap2/dmm-omap44xx.c new file +10
-0+ ? ? ? ? ? ? ? .activate_func = omap_device_enable_hwmods, + ? ? ? ? ? ? ? .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + ? ? ? }, +}; + +static s32 __init dmm_omap_init (void ) +{ + ? ? ? struct omap_hwmod *oh = NULL; + ? ? ? struct omap_device *od = NULL; + ? ? ? struct omap_device_pm_latency *ohl = NULL;
Any specific reson for not assigning it directly to omap_dmm_latency? I think this is redundant and omap_dmm_latency can be directly passed to omap_device_build()
arch/arm/mach-omap2/dmm-omap44xx.c line 55
Quoted 4 lines
arch/arm/mach-omap2/dmm-omap44xx.c new file +4
-0+ ? ? ? int ohlc = 0, i = 0; + + ? ? ? plat_data = omap4_plat_data; + ? ? ? pdata = NUM_PDATA;
name "pdata" is confusing. Also no need to iterate over the list of devices usingNUM_PDATA. If you have multiple devices, make use of hwmod class.
arch/arm/mach-omap2/dmm-omap44xx.c line 60
Quoted 5 lines
arch/arm/mach-omap2/dmm-omap44xx.c new file +5
-0+ + ? ? ? for (i = 0; i < pdata; i++) { + ? ? ? ? ? ? ? struct dmm *data = &plat_data[i]; + + ? ? ? ? ? ? ? oh = omap_hwmod_lookup(data->oh_name)
I do not find any other devices sharing same name for the device name and oh->name.
Normally the device's name is preferred to be "omap_devname.id" to be consistent across all drivers
and the oh->name is given as "devname(id)"
example: McSPI's device name could be "omap_mcspi" and it's hwmod name could be "mcspi"
arch/arm/mach-omap2/dmm-omap44xx.c line 64
Quoted 4 lines
arch/arm/mach-omap2/dmm-omap44xx.c new file +4
-0+ ? ? ? ? ? ? ? if (!oh) + ? ? ? ? ? ? ? ? ? ? ? goto error; + + ? ? ? ? ? ? ? data->base = oh->_mpu_rt_va;
not required. Make use of platform_get APIs in probe to extract the base, dma and irq info using pdev.
arch/arm/mach-omap2/dmm-omap44xx.c line 75
Quoted 11 lines
arch/arm/mach-omap2/dmm-omap44xx.c new file +11
-0+ ? ? ? ? ? ? ? ohl = omap_dmm_latency; + ? ? ? ? ? ? ? ohlc = ARRAY_SIZE(omap_dmm_latency); + + ? ? ? ? ? ? ? od = omap_device_build(data->oh_name, i, oh, data, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sizeof(*data), ohl, ohlc, false); + ? ? ? ? ? ? ? if (IS_ERR(od)) + ? ? ? ? ? ? ? ? ? ? ? goto error; + ? ? ? } + ? ? ? return 0; +error: + ? ? ? return -ENODEV;
print the error message.
arch/arm/mach-omap2/dmm-omap44xx.c line 81
Quoted 6 lines
arch/arm/mach-omap2/dmm-omap44xx.c new file +6
-0+} + +MODULE_LICENSE ("GPL v2" ); +MODULE_AUTHOR ("David Sin <[email protected]>" ); +MODULE_AUTHOR ("Lajos Molnar <[email protected]>" ); +device_initcall (dmm_omap_init);
<<snip>>
Re: [RFC v2 1/8] TILER-DMM: DMM-PAT driver for TI TILER
Quoted 10 lines · Charulatha
David,
Quoted 4 lines
+ ? ? ? ? ? ? ? if (!oh)
+ ? ? ? ? ? ? ? ? ? ? ? goto error;
+
+ ? ? ? ? ? ? ?data->base=oh->_mpu_rt_va;not required. Make use of
platform_getAPIs in probe to extract the base, dma and irq info using pdev.
Not sure about using platform_get APIs. I think one has to use omap_hwmod_get_mpu_rt_va to get the address, which internally returns oh-<_mpu_rt_va.omap_hwmod_get_mpu_rt_va was added so that the individual drivers can avoid doing the ioremap.
check the discussion regarding this.
http://www.spinics.net/lists/linux-omap/msg33048.html
Thank you,
Best regards,
Hari Kanigeri
Re: [RFC v2 1/8] TILER-DMM: DMM-PAT driver for TI TILER
Quoted 9 lines · Hari
Quoted 8 lines · Charulatha
David,
Quoted 4 lines
+ ? ? ? ? ? ? ? if (!oh)
+ ? ? ? ? ? ? ? ? ? ? ? goto error;
+
+ ? ? ? ? ? ? ?data->base=oh->_mpu_rt_va;
Quoted 6 lines
Quoted 2 lines
not required. Make use of
platform_getAPIs in probe to extract the base, dma and irq info using pdev.Not sure about using
platform_getAPIs. I think one has to useomap_hwmod_get_mpu_rt_vato get the address, which internally returns oh-<_mpu_rt_va.
small correction... omap_device_get_rt_va and not omap_hwmod_get_mpu_rt_va.
Thank you,
Best regards,
Hari Kanigeri
Re: [RFC v2 1/8] TILER-DMM: DMM-PAT driver for TI TILER
Quoted 10 lines · Hari
Quoted 9 lines · Hari
Quoted 8 lines · Charulatha
David,
Quoted 4 lines
+ ? ? ? ? ? ? ? if (!oh)
+ ? ? ? ? ? ? ? ? ? ? ? goto error;
+
+ ? ? ? ? ? ? ?data->base=oh->_mpu_rt_va;
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
not required. Make use of
platform_getAPIs in probe to extract the base, dma and irq info using pdev.Not sure about using
platform_getAPIs. I think one has to useomap_hwmod_get_mpu_rt_vato get the address, which internally returns oh-<_mpu_rt_va.small correction...
omap_device_get_rt_vaand notomap_hwmod_get_mpu_rt_va.
To get the base address & irq, you need not have to use omap_device_get_rt_va and pass it as
pdata and then use it during probe. Instead in probe, you may do something like the following:
static int __devinit dev_probe (*pdev) {
struct resource *res;
void __iomem *base;
u16 irq;
....
....
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (unlikely(!res)) {
....
return -ENODEV;}
base = ioremap(res->start, resource_size(res));
if (base) {
....
return -ENOMEM;
} res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (unlikely(!res)) {
....
return -ENODEV; }
irq = res->start;
....
....
}
-V Charulatha
Re: [RFC v2 1/8] TILER-DMM: DMM-PAT driver for TI TILER
Quoted 17 lines · Charulatha
Quoted 16 lines · Hari
Quoted 15 lines · Hari
Quoted 10 lines · Charulatha
David,
Quoted 4 lines
+ ? ? ? ? ? ? ? if (!oh)
+ ? ? ? ? ? ? ? ? ? ? ? goto error;
+
+ ? ? ? ? ? ? ?data->base=oh->_mpu_rt_va;not required. Make use of
platform_getAPIs in probe to extract the base, dma and irq info using pdev.Not sure about using
platform_getAPIs. I think one has to useomap_hwmod_get_mpu_rt_vato get the address, which internally returns oh-<_mpu_rt_va.
Quoted 6 lines
Quoted 1 line
small correction...
omap_device_get_rt_vaand notomap_hwmod_get_mpu_rt_va.To get the base address & irq, you need not have to use
omap_device_get_rt_vaand pass it as
pdata and then use it during probe. Instead in probe, you may do something like the following:
If hwmod framework is already doing the ioremap on device address, then it is better to use it rather than duplicating the ioremap part again in probe function.
Re: [RFC v2 1/8] TILER-DMM: DMM-PAT driver for TI TILER
Quoted 25 lines · Hari Kanigeri
Quoted 17 lines · Charulatha
Quoted 16 lines · Hari
Quoted 15 lines · Hari
Quoted 10 lines · Charulatha
David,
Quoted 4 lines
+ ? ? ? ? ? ? ? if (!oh)
+ ? ? ? ? ? ? ? ? ? ? ? goto error;
+
+ ? ? ? ? ? ? ?data->base=oh->_mpu_rt_va;not required. Make use of
platform_getAPIs in probe to extract the base, dma and irq info using pdev.Not sure about using
platform_getAPIs. I think one has to useomap_hwmod_get_mpu_rt_vato get the address, which internally returns oh-<_mpu_rt_va.Quoted 6 lines
Quoted 1 line
small correction...
omap_device_get_rt_vaand notomap_hwmod_get_mpu_rt_va.To get the base address & irq, you need not have to use
omap_device_get_rt_vaand pass it as
pdata and then use it during probe. Instead in probe, you may do something like the following:
Quoted 7 lines
If hwmod framework is already doing the ioremap on device address, then it is better to use it rather than duplicating the ioremap part again in probe function.
From what I understand regardingomap_device_get_rt_va()function, it is added so that Driver's can avoid doing ioremap.
check Santosh's comment on this API
http://www.spinics.net/lists/arm-kernel/msg92260.html
Okay. For base address, I agree, as it avoids redoing ioremap in drivers. For "irq" & "DMA", it is still required to use platform_get*() APIs.
Quoted 31 lines
Quoted 31 lines
static int
__devinit?dev_probe (*pdev) {
? struct resource *res;
? void__iomem*base;
? u16 irq;
? ....
? ....
? res =platform_get_resource(pdev, IORESOURCE_MEM, 0); ? if (unlikely(!res)) {
? ? ? ? ? ? ?....
? ? ? ? ? ? ?return-ENODEV;
? }? base =
ioremap(res->start, resource_size(res));
? if (base) {
? ? ? ? ? ? ? ....
? ? ? ? ? ? ? return-ENOMEM;
? }? res =
platform_get_resource(pdev, IORESOURCE_IRQ, 0); ? if (unlikely(!res)) {
? ? ? ? ? ? ? ....
? ? ? ? ? ? ? return-ENODEV;
? }
? irq =res->start;
? ....
? ....
}-V Charulatha
RFC v2 2/8 TILER-DMM: Container manager interface and utility definitons
In reply to David SinFrom: Lajos Molnar <[email protected]>
This patch defined the TILER Container Manager (TCM) interface and provides utility methods for implementing a TCM.
--- drivers/misc/tiler/tcm.h | 171 ++++++++++++++++++++++++++++++++++++ drivers/misc/tiler/tcm/tcm-utils.h | 51 +++++++++++ 2 files changed, 222 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/tiler/tcm.h create mode 100644 drivers/misc/tiler/tcm/tcm-utils.h
drivers/misc/tiler/tcm.h new file +171 -0
@@ -0,0 +1,171 @@ +/* +* TILER container manager specification and support functions for TI +* TILER driver. +* +* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef TCM_H +#define TCM_H + +struct tcm ; + +/* point */ +struct tcm_pt { +u16 x; +u16 y; +}; + +/* 2d area */ +struct tcm_area { +struct tcm *tcm;/* parent */ +struct tcm_pt p0; +struct tcm_pt p1; +}; + +struct tcm { +u16 width, height;/* container dimensions */ + +/* +* 'pvt' structure shall contain any tcm details (attr) along with +* linked list of allocated areas and mutex for mutually exclusive +* access to the list. It may also contain copies of width and height +* to notice any changes to the publicly available width and height +* fields. +*/ +void *pvt; + +/* function table */ +s32 (*reserve_2d)(struct tcm *tcm,u16 height,u16 width,u8 align, +struct tcm_area *area); +s32 (*free) (struct tcm *tcm,struct tcm_area *area); +void (*deinit) (struct tcm *tcm); +}; + +/* +* Since some basic parameter checking is done outside the TCM algorithms, +* TCM implementation do NOT have to check the following: +* +* area pointer is NULL +* width and height fits within container +* number of pages is more than the size of the container +*/ + +/* +* Template for <ALGO_NAME>_tcm_init method. Define as: +* TCM_INIT(<ALGO_NAME>_tcm_init) +* +* Allocates and initializes a tiler container manager. +* +* Pointer to the allocated and initialized container manager. +* NULL on failure. DO NOT leak any memory on failure! +*/ +#define TCM_INIT (name, attr_t) \ +struct tcm *name(u16 width, u16 height, typeof(attr_t) *attr); + +/* +* Deinitialize tiler container manager. +* +* The call should free as much memory as possible and meaningful +* even on failure. Some error codes: -ENODEV: invalid manager. +*/ +static inline void tcm_deinit (struct tcm *tcm) +{ +if (tcm) + tcm->deinit (tcm); +} + +/* +* Reserves a 2D area in the container. +* +* The tcm field of the area will be set to NULL on failure. +* Some error codes: -ENODEV: invalid manager, -EINVAL: +* invalid area, -ENOMEM: not enough space for allocation. +*/ +static inline s32 tcm_reserve_2d (struct tcm *tcm,u16 width,u16 height, +u16 align,struct tcm_area *area) +{ +/* perform rudimentary error checking */ +s32 res = (tcm ==NULL ? -ENODEV : + (area ==NULL || width ==0 || height ==0 || +/* align must be a 2 power */ + align & (align -1 )) ? -EINVAL : + (height > tcm->height || width > tcm->width) ? -ENOMEM : + tcm->reserve_2d (tcm, height, width, align, area)); + +if (area) + area->tcm = res ?NULL : tcm; + +return res; +} + +/* +* Free a previously reserved area from the container. +* +* The tcm field of the area is set to NULL on success +* to avoid subsequent freeing. This call will succeed +* even if supplying the area from a failed reserved call. +*/ +static inline s32 tcm_free (struct tcm_area *area) +{ +s32 res =0 ;/* free succeeds by default */ + +if (area && area->tcm) { + res = area->tcm->free (area->tcm, area); +if (res ==0 ) + area->tcm =NULL ; + } + +return res; +} + +/* Verify if a tcm area is logically valid */ +static inline bool tcm_area_is_valid (struct tcm_area *area) +{ +return area && area->tcm && +/* coordinate bounds */ + area->p1.x < area->tcm->width && + area->p1.y < area->tcm->height && + area->p0.y <= area->p1.y && + area->p0.x <= area->p1.x; +} + +/* see if a coordinate is within an area */ +static inline bool __tcm_is_in (struct tcm_pt *p,struct tcm_area *a) +{ +return p->x >= a->p0.x && p->x <= a->p1.x && + p->y >= a->p0.y && p->y <= a->p1.y; +} + +/* calculate area width */ +static inline u16 __tcm_area_width (struct tcm_area *area) +{ +return area->p1.x - area->p0.x +1 ; +} + +/* calculate area height */ +static inline u16 __tcm_area_height (struct tcm_area *area) +{ +return area->p1.y - area->p0.y +1 ; +} + +/* calculate number of slots in an area */ +static inline u16 __tcm_sizeof (struct tcm_area *area) +{ +return __tcm_area_width (area) *__tcm_area_height (area); +} +#define tcm_sizeof (area) __tcm_sizeof(&(area)) +#define tcm_awidth (area) __tcm_area_width(&(area)) +#define tcm_aheight (area) __tcm_area_height(&(area)) +#define tcm_is_in (pt, area) __tcm_is_in(&(pt), &(area)) + +#endif
drivers/misc/tiler/tcm/tcm-utils.h new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
1.7.0.4
RFC v2 3/8 TILER-DMM: Sample TCM implementation: Simple TILER Allocator (SiTA)
In reply to David SinFrom: Ravi Ramachandra <[email protected]>
This patch implements a simple TILER Container Manager (TCM).
--- drivers/misc/tiler/tcm/Makefile | 1 + drivers/misc/tiler/tcm/_tcm-sita.h | 61 +++++ drivers/misc/tiler/tcm/tcm-sita.c | 422 ++++++++++++++++++++++++++++++++++++ drivers/misc/tiler/tcm/tcm-sita.h | 28 +++ 4 files changed, 512 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/tiler/tcm/Makefile create mode 100644 drivers/misc/tiler/tcm/_tcm-sita.h create mode 100644 drivers/misc/tiler/tcm/tcm-sita.c create mode 100644 drivers/misc/tiler/tcm/tcm-sita.h
drivers/misc/tiler/tcm/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_TI_TILER) += tcm-sita.o
drivers/misc/tiler/tcm/_tcm-sita.h new file +61 -0
61 lines not on this page · raw message
drivers/misc/tiler/tcm/tcm-sita.c new file +422 -0
422 lines not on this page · raw message
drivers/misc/tiler/tcm/tcm-sita.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* SImple Tiler Allocator (SiTA) interface. +* +* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef TCM_SITA_H +#define TCM_SITA_H + +#include "../tcm.h" + +/* +* Create a SiTA tiler container manager. +*/ +struct tcm *sita_init (u16 width,u16 height,void *attr); + +TCM_INIT (sita_init, void); + +#endif
Signature · 1 line
1.7.0.4
RFC v2 4/8 TILER-DMM: TILER Memory Manager interface and implementation
In reply to David SinFrom: Lajos Molnar <[email protected]>
This patch defines the TILER Memory Manager (TMM) interface and provides implementation for a PAT-supporting TMM.
--- drivers/misc/tiler/tmm-pat.c | 266 ++++++++++++++++++++++++++++++++++++++++++ drivers/misc/tiler/tmm.h | 103 ++++++++++++++++ 2 files changed, 369 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/tiler/tmm-pat.c create mode 100644 drivers/misc/tiler/tmm.h
drivers/misc/tiler/tmm-pat.c new file +266 -0
@@ -0,0 +1,266 @@ +/* +* DMM driver support functions for TI TILER hardware block. +* +* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/init.h> +#include <linux/module.h> +#include <linux/mm.h> +#include <linux/mmzone.h> +#include <asm/cacheflush.h> +#include <linux/mutex.h> +#include <linux/list.h> +#include <linux/slab.h> +#include <linux/dma-mapping.h> + +#include "tmm.h" + +/* Page size granularity can be 4k, 16k, or 64k */ +#define DMM_PAGE SZ_4K + +/* Memory limit to cache free pages. TILER will eventually use this much */ +static u32 cache_limit =CONFIG_TILER_CACHE_LIMIT <<20 ; +module_param_named (cache, cache_limit, uint,0644 ); +MODULE_PARM_DESC (cache,"Cache free pages if total memory is under this limit" ); + +/* global state - statically initialized */ +static LIST_HEAD (free_list);/* page cache: list of free pages */ +static u32 total_mem;/* total memory allocated (free & used) */ +static u32 refs;/* number of tmm_pat instances */ +static DEFINE_MUTEX (mtx);/* global mutex */ + +/* The page struct pointer and physical address of each page.*/ +struct mem { +struct list_head list; +u32 *pg;/* page struct */ +dma_addr_t pa;/* physical address */ +}; + +/* Used to keep track of mem per tmm_pat_get_pages call */ +struct fast { +struct list_head list; +struct mem **mem;/* array of page info */ +u32 *pa;/* array of physical addresses */ +u32 num;/* number of pages */ +}; + +/* TMM PAT private structure */ +struct dmm_mem { +struct list_head fast_list; +struct dmm *dmm; +}; + +/* +* Frees pages in a fast structure. Moves pages to the free list if there +* are less pages used than max_to_keep. Otherwise, it frees the pages +*/ +static void free_fast (struct fast *f) +{ +s32 i =0 ; + +/* mutex is locked */ +for (i =0 ; i < f->num; i++) { +if (total_mem < cache_limit) { +/* cache free page if under the limit */ +list_add (&f->mem[i]->list, &free_list); + }else { +/* otherwise, free */ + total_mem -=PAGE_SIZE ; +dma_free_coherent (NULL ,DMM_PAGE , f->mem[i]->pg, + f->mem[i]->pa); + } + } +kfree (f->pa); +kfree (f->mem); +/* remove only if element was added */ +if (f->list.next) +list_del (&f->list); +kfree (f); +} + +/* allocate and flush a page */ +static struct mem *alloc_mem (void ) +{ +struct mem *m =kzalloc (sizeof (*m),GFP_KERNEL ); +if (!m) +return NULL ; + + m->pg =dma_alloc_coherent (NULL ,DMM_PAGE , &m->pa,GFP_KERNEL ); +if (!m->pg) { +kfree (m); +return NULL ; + } +wmb (); + +return m; +} + +static void free_page_cache (void ) +{ +struct mem *m, *m_; + +/* mutex is locked */ +list_for_each_entry_safe (m, m_, &free_list, list) { +dma_free_coherent (NULL ,DMM_PAGE , m->pg, m->pa); + total_mem -=PAGE_SIZE ; +list_del (&m->list); +kfree (m); + } +} + +static void tmm_pat_deinit (struct tmm *tmm) +{ +struct fast *f, *f_; +struct dmm_mem *pvt = (struct dmm_mem *) tmm->pvt; + +mutex_lock (&mtx); + +/* free all outstanding used memory */ +list_for_each_entry_safe (f, f_, &pvt->fast_list, list) +free_fast (f); + +/* if this is the last tmm_pat, free all memory */ +if (--refs ==0 ) +free_page_cache (); + +mutex_unlock (&mtx); +} + +static u32 *tmm_pat_get_pages (struct tmm *tmm,u32 n) +{ +struct mem *m; +struct fast *f; +struct dmm_mem *pvt = (struct dmm_mem *) tmm->pvt; + + f =kzalloc (sizeof (*f),GFP_KERNEL ); +if (!f) +return NULL ; + +/* array of mem struct pointers */ + f->mem =kzalloc (n *sizeof (*f->mem),GFP_KERNEL ); + +/* array of physical addresses */ + f->pa =kzalloc (n *sizeof (*f->pa),GFP_KERNEL ); + +/* no pages have been allocated yet (needed for cleanup) */ + f->num =0 ; + +if (!f->mem || !f->pa) + goto cleanup; + +/* fill out fast struct mem array with free pages */ +mutex_lock (&mtx); +while (f->num < n) { +/* if there is a free cached page use it */ +if (!list_empty (&free_list)) { +/* unbind first element from list */ + m =list_first_entry (&free_list,typeof (*m), list); +list_del (&m->list); + }else { +mutex_unlock (&mtx); + +/* +* Unlock mutex during allocation and cache flushing. +*/ + m =alloc_mem (); +if (!m) + goto cleanup; + +mutex_lock (&mtx); + total_mem +=PAGE_SIZE ; + } + + f->mem[f->num] = m; + f->pa[f->num++] = m->pa; + } + +list_add (&f->list, &pvt->fast_list); +mutex_unlock (&mtx); +return f->pa; + +cleanup: +free_fast (f); +return NULL ; +} + +static void tmm_pat_free_pages (struct tmm *tmm,u32 *page_list) +{ +struct dmm_mem *pvt = (struct dmm_mem *) tmm->pvt; +struct fast *f, *f_; + +mutex_lock (&mtx); +/* find fast struct based on 1st page */ +list_for_each_entry_safe (f, f_, &pvt->fast_list, list) { +if (f->pa[0 ] == page_list[0 ]) { +free_fast (f); +break ; + } + } +mutex_unlock (&mtx); +} + +static s32 tmm_pat_map (struct tmm *tmm,struct pat_area area,u32 page_pa) +{ +struct dmm_mem *pvt = (struct dmm_mem *) tmm->pvt; +struct pat pat_desc = {NULL }; + +/* send pat descriptor to dmm driver */ + pat_desc.ctrl.dir =0 ; + pat_desc.ctrl.ini =0 ; + pat_desc.ctrl.lut_id =0 ; + pat_desc.ctrl.start =1 ; + pat_desc.ctrl.sync =0 ; + pat_desc.area = area; + pat_desc.next =NULL ; + +/* must be a 16-byte aligned physical address */ + pat_desc.data = page_pa; +return dmm_pat_refill (pvt->dmm, &pat_desc,MANUAL ); +} + +struct tmm *tmm_pat_init (u32 pat_id) +{ +struct tmm *tmm =NULL ; +struct dmm_mem *pvt =NULL ; + +struct dmm *dmm =dmm_pat_init (pat_id); +if (dmm) + tmm =kzalloc (sizeof (*tmm),GFP_KERNEL ); +if (tmm) + pvt =kzalloc (sizeof (*pvt),GFP_KERNEL ); +if (pvt) { +/* private data */ + pvt->dmm = dmm; +INIT_LIST_HEAD (&pvt->fast_list); + +/* increate tmm_pat references */ +mutex_lock (&mtx); + refs++; +mutex_unlock (&mtx); + +/* public data */ + tmm->pvt = pvt; + tmm->deinit = tmm_pat_deinit; + tmm->get = tmm_pat_get_pages; + tmm->free = tmm_pat_free_pages; + tmm->map = tmm_pat_map; + tmm->clear =NULL ;/* not yet supported */ + +return tmm; + } + +kfree (pvt); +kfree (tmm); +return NULL ; +} +EXPORT_SYMBOL (tmm_pat_init);
drivers/misc/tiler/tmm.h new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
1.7.0.4
RFC v2 5/8 TILER-DMM: TILER interface file and documentation
In reply to David SinFrom: Lajos Molnar <[email protected]>
This patch contains the TILER interface file and the documentation.
--- 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
Documentation/arm/OMAP/TILER new file +126 -0
@@ -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 + offset within the alignment. + + cache limit (tiler.cache, CONFIG_TILER_CACHE_LIMIT): + + TILER driver keeps a cache of allocated pages to speed up allocation of + TILER blocks. You can set a limit of how much memory the TILER driver + should keep if there are no actual TILER allocations. This also means + that if there is less memory used than this limit, the pages of freed + tiler blocks will not actually be freed, but instead are put into this + cache.
arch/arm/mach-omap2/include/mach/tiler.h new file +173 -0
173 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [RFC v2 5/8] TILER-DMM: TILER interface file and documentation
Quoted 9 lines · David Sin
From: Lajos Molnar <[email protected]>
This patch contains the TILER interface file and the documentation.
Signed-off-by Lajos Molnar <[email protected]>Signed-off-by David Sin <[email protected]>--- Documentation/arm/OMAP/TILER | 126 ++++++++++++++++++++++ arch/arm/mach-omap2/include/mach/tiler.h | 173 ++++++++++++++++++++++++++++++
Shouldn't this .h file be in include/linux/ instead? Why is it arch specific?
thanks,
greg k-h
RFC v2 6/8 TILER-DMM: Geometry and view manipulation functions
In reply to David SinFrom: Lajos Molnar <[email protected]>
This patch contains information on TILER geometry, as well as tiler_view_t object manipulation functions.
It also contains an internal TILER header file to share geometric information with other TILER files.
--- drivers/misc/tiler/_tiler.h | 48 +++++ drivers/misc/tiler/tiler-geom.c | 362 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 410 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/tiler/_tiler.h create mode 100644 drivers/misc/tiler/tiler-geom.c
drivers/misc/tiler/_tiler.h new file +48 -0
@@ -0,0 +1,48 @@ +/* +* TI TILER driver internal shared definitions. +* +* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _TILER_H +#define _TILER_H + +#include <linux/kernel.h> +#include <mach/tiler.h> +#include "tcm.h" + +#define TILER_FORMATS (TILFMT_MAX - TILFMT_MIN + 1) + +/* tiler geometry information */ +struct tiler_geom { +u32 x_shft;/* unused X-bits (as part of bpp) */ +u32 y_shft;/* unused Y-bits (as part of bpp) */ +u32 bpp;/* bytes per pixel */ +u32 slot_w;/* width of each slot (in pixels) */ +u32 slot_h;/* height of each slot (in pixels) */ +}; + +/* methods and variables shared between source files */ +struct tiler_ops { +/* geometry operations */ +void (*xy) (u32 ssptr,u32 *x,u32 *y); +u32 (*addr) (enum tiler_fmt fmt,u32 x,u32 y); +const struct tiler_geom * (*geom) (enum tiler_fmt fmt); + +u32 page;/* page size */ +u32 width;/* container width */ +u32 height;/* container height */ +}; + +void tiler_geom_init (struct tiler_ops *tiler); + +#endif
drivers/misc/tiler/tiler-geom.c new file +362 -0
362 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [RFC v2 6/8] TILER-DMM: Geometry and view manipulation functions
Quoted 5 lines · David Sin
From: Lajos Molnar <[email protected]>
This patch contains information on TILER geometry, as well as
tiler_view_tobject manipulation functions.
Quoted 7 lines
It also contains an internal TILER header file to share geometric information with other TILER files.
Signed-off-by Lajos Molnar <[email protected]>Signed-off-by David Sin <[email protected]>--- drivers/misc/tiler/_tiler.h | 48 +++++
Ick, no, just name it "tiler.h" please. There should not be any need to put _ in front of a .h file.
drivers/misc/tiler/tiler-geom.c line 84
Quoted 4 lines
drivers/misc/tiler/tiler-geom.c new file +4
-0+u32 tiler_bpp (const struct tiler_block_t *b) +{ +enum tiler_fmt fmt =tiler_fmt (b->phys); +BUG_ON (fmt ==TILFMT_INVALID || fmt ==TILFMT_PAGE );
Don't cause the kernel to crash within a driver for no good reason like this. Please fix these to WARN_ON if it's really something that can happen.
If not, then just remove it.
drivers/misc/tiler/tiler-geom.c line 88
Quoted 4 lines
drivers/misc/tiler/tiler-geom.c new file +4
-0+ +return geom[fmt].bpp; +} +EXPORT_SYMBOL (tiler_bpp);
EXPORT_SYMBOL_GPL() perhaps for all of these?
thanks,
greg k-h
RFC v2 7/8 TILER-DMM: Main TILER driver implementation
In reply to David SinFrom: Lajos Molnar <[email protected]>
This patch contains the TILER driver and implementation of the TILER block manipulation and mapping functions.
It also contains the makefile and config file for the TILER driver.
--- arch/arm/mach-omap2/Makefile | 1 + drivers/misc/tiler/Kconfig | 72 +++++++ drivers/misc/tiler/Makefile | 7 + drivers/misc/tiler/tiler-iface.c | 66 ++++++ drivers/misc/tiler/tiler-main.c | 405 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 551 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/tiler/Kconfig create mode 100644 drivers/misc/tiler/Makefile create mode 100644 drivers/misc/tiler/tiler-iface.c create mode 100644 drivers/misc/tiler/tiler-main.c
arch/arm/mach-omap2/Makefile +1 -0
@@ -183,3 +183,4 @@ obj-y += $(nand-m) $(nand-y) smc91x-$(CONFIG_SMC91X) := gpmc-smc91x.o obj-y += $(smc91x-m) $(smc91x-y) obj-$(CONFIG_ARCH_OMAP4) += hwspinlocks.o +obj-$(CONFIG_ARCH_OMAP4) += dmm-omap44xx.o
drivers/misc/tiler/Kconfig new file +72 -0
72 lines not on this page · raw message
drivers/misc/tiler/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +obj-$(CONFIG_TI_DMM) += dmm.o +dmm-objs = dmm-main.o + +obj-$(CONFIG_TI_TILER) += tcm/ + +obj-$(CONFIG_TI_TILER) += tiler.o +tiler-objs = tiler-geom.o tiler-main.o tiler-iface.o tmm-pat.o
drivers/misc/tiler/tiler-iface.c new file +66 -0
66 lines not on this page · raw message
drivers/misc/tiler/tiler-main.c new file +405 -0
405 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [RFC v2 7/8] TILER-DMM: Main TILER driver implementation
Quoted 41 lines · On Tue, 30 Nov 2010 13:58:58 -0600 David Sin wrote:
From: Lajos Molnar <[email protected]>
This patch contains the TILER driver and implementation of the TILER block manipulation and mapping functions.
It also contains the makefile and config file for the TILER driver.
Signed-off-by Lajos Molnar <[email protected]>Signed-off-by David Sin <[email protected]>--- arch/arm/mach-omap2/Makefile | 1 + drivers/misc/tiler/Kconfig | 72 +++++++ drivers/misc/tiler/Makefile | 7 + drivers/misc/tiler/tiler-iface.c | 66 ++++++ drivers/misc/tiler/tiler-main.c | 405 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 551 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/tiler/Kconfig create mode 100644 drivers/misc/tiler/Makefile create mode 100644 drivers/misc/tiler/tiler-iface.c create mode 100644 drivers/misc/tiler/tiler-main.cdrivers/misc/tiler/Kconfig new file +13
-0@@ -0,0 +1,72 @@ +config HAVE_TI_DMM + bool + default y + depends on ARCH_OMAP4 + +menuconfig TI_DMM + tristate "TI DMM support" + default y + depends on HAVE_TI_DMM + help + DMM driver for TI chips. + +menuconfig TI_TILER
drivers/misc/tiler/Kconfig line 23
Quoted 10 lines
drivers/misc/tiler/Kconfig new file +10
-0+ tristate "TI TILER support" + default y + depends on TI_DMM + help + TILER driver for TI chips. The TI TILER device + enables video rotation on certain TI chips such as OMAP4 or + TI816x. Video rotation will be limited without TILER support. + +config TILER_GRANULARITY + int "Allocation granularity (2^n)"
Having (2^n) in the prompt makes me think that the value set here is "n", but that's not the case. I suggest removing (2^n) here...
drivers/misc/tiler/Kconfig line 35
Quoted 12 lines
drivers/misc/tiler/Kconfig new file +12
-0+ range 1 4096 + default 128 + depends on TI_TILER + help + This option sets the default TILER allocation granularity. It can + be overriden by the tiler.grain boot argument. + + The allocation granularity is the smallest TILER block size (in + bytes) managed distinctly by the TILER driver. TILER blocks of any + size are managed in chunks of at least this size. + + Must be a 2^n in the range of 1 to 4096; however, the TILER driver
and changing 2^n here to just say:
Must be a power of 2 in the range of 1 to 4096; however, ...
and then same 2 comments again repeated below.
Quoted 9 lines
drivers/misc/tiler/Kconfig new file +9
-0+ may use a larger supported granularity. + + Supported values are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, + 2048, 4096. + +config TILER_ALIGNMENT + int "Allocation alignment (2^n)" + range 1 4096 + default 4096
drivers/misc/tiler/Kconfig line 54
Quoted 10 lines
drivers/misc/tiler/Kconfig new file +10
-0+ depends on TI_TILER + help + This option sets the default TILER allocation alignment. It can + be overriden by the tiler.align boot argument. + + Must be a 2^n in the range of 1 to 4096; however, it is naturally + aligned to the TILER granularity. + + Supported values are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, + 2048, 4096.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
RFC v2 8/8 TILER-DMM: Linking TILER driver into the Linux kernel build
In reply to David SinFrom: Lajos Molnar <[email protected]>
This patch links the TILER driver into the Linux kernel build and config system.
--- drivers/misc/Kconfig | 5 +++++ drivers/misc/Makefile | 1 + 2 files changed, 6 insertions(+), 0 deletions(-)
drivers/misc/Kconfig +5 -0
@@ -378,4 +378,9 @@ source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig" source "drivers/misc/iwmc3200top/Kconfig" +# +# TI TILER driver support +# +source "drivers/misc/tiler/Kconfig" + endif # MISC_DEVICES
drivers/misc/Makefile +1 -0
@@ -33,3 +33,4 @@ obj-y += eeprom/ obj-y += cb710/ obj-$(CONFIG_VMWARE_BALLOON) += vmware_balloon.o obj-$(CONFIG_SENSORS_BH1780) += bh1780gli.o +obj-$(CONFIG_TI_TILER) += tiler/
Signature · 1 line
1.7.0.4
Re: [RFC v2 8/8] TILER-DMM: Linking TILER driver into the Linux kernel build
Quoted 17 lines · David Sin
From: Lajos Molnar <[email protected]>
This patch links the TILER driver into the Linux kernel build and config system.
Signed-off-by Lajos Molnar <[email protected]>Signed-off-by David Sin <[email protected]>--- drivers/misc/Kconfig | 5 +++++ drivers/misc/Makefile | 1 + 2 files changed, 6 insertions(+), 0 deletions(-)drivers/misc/Kconfig +0
-0
drivers/misc/Kconfig source "drivers/misc/eeprom/Kconfig" · line 383
Quoted 6 lines
drivers/misc/Kconfig +3
-0@@ -378,4 +378,9 @@ source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig" source "drivers/misc/iwmc3200top/Kconfig" +# +# TI TILER driver support +#
Comments not needed.
thanks,
greg k-h
Re: [RFC v2 8/8] TILER-DMM: Linking TILER driver into the Linux kernel build
Quoted 27 lines · Greg KH
Quoted 17 lines · David Sin
From: Lajos Molnar <[email protected]>
This patch links the TILER driver into the Linux kernel build and config system.
Signed-off-by Lajos Molnar <[email protected]>Signed-off-by David Sin <[email protected]>--- drivers/misc/Kconfig | 5 +++++ drivers/misc/Makefile | 1 + 2 files changed, 6 insertions(+), 0 deletions(-)drivers/misc/Kconfig +0
-0drivers/misc/Kconfig source "drivers/misc/eeprom/Kconfig" · line 383
Quoted 6 lines
drivers/misc/Kconfig +3
-0@@ -378,4 +378,9 @@ source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig" source "drivers/misc/iwmc3200top/Kconfig" +# +# TI TILER driver support +#Comments not needed.
Quoted 3 lines
thanks,
greg k-h
thanks, Greg, for the comments. I will make all of these changes in the next revision.
Signature · 1 line
David Sin
Quoted 148 lines · David Sin
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).
Changes made from RFC v1: http://www.spinics.net/lists/linux-omap/msg33867.html
Santosh Shilimkar:
1) Correct documentation location
2) Remove ioremap of RAM
3) Implement probe function and hwmod
4) Correct commenting style
5) Reduce use of barrier instancesLinus Walleij:
1) Define TCM acryonymRussell King:
1) Implement probe function
2) Fix spelling mistake
3) RemoveGFP_ATOMICflag when callingdma_alloc_coherentfor PAT array mem
4) Replacealloc_pageand flush range calls withdma_alloc_coherentNishanth Menon:
1) Address infinite while loop when reading dmm registerBenoit Cousson:
1) Fix source file headers
2) Correct logical errors in device fileKevin Hilman:
1) Move DMM/TILER source code into driver/misc/tiler until a recommendation is made as to where it should goList of pending items in proposed order:
* Determine driver source code location
?(Currently, resides indrivers/misc/tiler)
* Add area packing support (multiple blocks can reside in the same band/area) ?to optimize area use
* Add group-ID support (to specify which blocks can reside together in the ?same area)
* Add multiple search directions to TCM-SiTA
* Add 1D block support (including adding 1D search algo to TCM-SiTA)
* Optimize mutex handling (don.t hold mutex during memory ?allocation/mapping/cache flushing)
* Add block reference counting, support for sharing blocks
* Move all kernel-API-s totiler-iface.c
* Support orphaned block support (in preparation for process cleanup support)
* Change block identification from physical address to key-ID pair ?(in preparation for user space support, and process security)
* Add support for process security (blocks from separate processes never ?reside in the same band)
* Support file interface (ioctl and mmap)
* Support for buffers (ordered list of blocks that are mapped to userspace ?together, such as YUV420sp)
* Support 1D user buffer mapping into TILER container
* Support for block pre-reservation (to further optimize area use)David Sin (1):
?TILER-DMM: DMM-PAT driver for TI TILERLajos Molnar (6):
?TILER-DMM: Container manager interface and utility definitons ?TILER-DMM: TILER Memory Manager interface and implementation ?TILER-DMM: TILER interface file and documentation ?TILER-DMM: Geometry and view manipulation functions ?TILER-DMM: Main TILER driver implementation ?TILER-DMM: Linking TILER driver into the Linux kernel buildRavi Ramachandra (1):
?TILER-DMM: Sample TCM implementation: Simple TILER Allocator (SiTA)?Documentation/arm/OMAP/TILER ? ? ? ? ? ? | ?126 +++++++++ ?arch/arm/mach-omap2/Makefile ? ? ? ? ? ? | ? ?1 + ?arch/arm/mach-omap2/dmm-omap44xx.c ? ? ? | ? 81 ++++++ ?arch/arm/mach-omap2/include/mach/dmm.h ? | ? 92 +++++++ ?arch/arm/mach-omap2/include/mach/tiler.h | ?173 ++++++++++++ ?drivers/misc/Kconfig ? ? ? ? ? ? ? ? ? ? | ? ?5 + ?drivers/misc/Makefile ? ? ? ? ? ? ? ? ? ?| ? ?1 + ?drivers/misc/tiler/Kconfig ? ? ? ? ? ? ? | ? 72 +++++ ?drivers/misc/tiler/Makefile ? ? ? ? ? ? ?| ? ?7 + ?drivers/misc/tiler/_tiler.h ? ? ? ? ? ? ?| ? 48 ++++ ?drivers/misc/tiler/dmm-main.c ? ? ? ? ? ?| ?187 +++++++++++++ ?drivers/misc/tiler/tcm.h ? ? ? ? ? ? ? ? | ?171 ++++++++++++ ?drivers/misc/tiler/tcm/Makefile ? ? ? ? ?| ? ?1 + ?drivers/misc/tiler/tcm/_tcm-sita.h ? ? ? | ? 61 +++++ ?drivers/misc/tiler/tcm/tcm-sita.c ? ? ? ?| ?422 ++++++++++++++++++++++++++++++ ?drivers/misc/tiler/tcm/tcm-sita.h ? ? ? ?| ? 28 ++ ?drivers/misc/tiler/tcm/tcm-utils.h ? ? ? | ? 51 ++++ ?drivers/misc/tiler/tiler-geom.c ? ? ? ? ?| ?362 +++++++++++++++++++++++++ ?drivers/misc/tiler/tiler-iface.c ? ? ? ? | ? 66 +++++ ?drivers/misc/tiler/tiler-main.c ? ? ? ? ?| ?405 ++++++++++++++++++++++++++++ ?drivers/misc/tiler/tmm-pat.c ? ? ? ? ? ? | ?266 +++++++++++++++++++ ?drivers/misc/tiler/tmm.h ? ? ? ? ? ? ? ? | ?103 ++++++++?22 files changed, 2729 insertions(+), 0 deletions(-) ?create mode 100644
Documentation/arm/OMAP/TILER?create mode 100644arch/arm/mach-omap2/dmm-omap44xx.c?create mode 100644arch/arm/mach-omap2/include/mach/dmm.h?create mode 100644arch/arm/mach-omap2/include/mach/tiler.h?create mode 100644drivers/misc/tiler/Kconfig?create mode 100644drivers/misc/tiler/Makefile?create mode 100644drivers/misc/tiler/_tiler.h?create mode 100644drivers/misc/tiler/dmm-main.c?create mode 100644drivers/misc/tiler/tcm.h?create mode 100644drivers/misc/tiler/tcm/Makefile?create mode 100644drivers/misc/tiler/tcm/_tcm-sita.h
Quoted 8 lines
?create mode 100644
drivers/misc/tiler/tcm/tcm-sita.c?create mode 100644drivers/misc/tiler/tcm/tcm-sita.h?create mode 100644drivers/misc/tiler/tcm/tcm-utils.h?create mode 100644drivers/misc/tiler/tiler-geom.c?create mode 100644drivers/misc/tiler/tiler-iface.c?create mode 100644drivers/misc/tiler/tiler-main.c?create mode 100644drivers/misc/tiler/tmm-pat.c?create mode 100644drivers/misc/tiler/tmm.h
The dmm driver is making use of omap_hwmod fw. But I could not see a patch to add dmm hwmod data to omap4 hwmod base in this series. Is this patch series tested?
Quoted 5 lines · Charulatha
On Wed, Dec 1, 2010 at 01:28, David Sin <[email protected]> wrote:
The dmm driver is making use of
omap_hwmodfw. But I could not see a patch to add dmm hwmod data to omap4 hwmod base in this series. Is this patch series tested?
yes -- this code has been tested against the omap_hwmod fw. I will send out a patch in the next rev. Thanks for your comments.
Signature · 1 line
David Sin