summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 280d8a8)
raw | patch | inline | side by side (parent: 280d8a8)
author | vwan@ti.com <vwan@ti.com> | |
Mon, 17 Jun 2013 22:06:05 +0000 (15:06 -0700) | ||
committer | Chris Ring <cring@ti.com> | |
Tue, 18 Jun 2013 01:30:05 +0000 (18:30 -0700) |
Tiler is now [correctly] managed independent from IPC. This
commit removes tiler support from IPC.
commit removes tiler support from IPC.
95 files changed:
diff --git a/qnx/Makefile b/qnx/Makefile
index 327bc68f9a868377e2ace5a69faebaa64cb82bab..d48704b8a11c6f42ace10b07fd19b5c16ac022a9 100644 (file)
--- a/qnx/Makefile
+++ b/qnx/Makefile
ifeq ("$(PLATFORM)","omap5432")
SYSLINK_PLATFORM=omap5430
- TILER_PLATFORM=omap5430
else ifeq ("$(PLATFORM)","vayu")
SYSLINK_PLATFORM=$(PLATFORM)
- TILER_PLATFORM=$(PLATFORM)
endif
all: utils ipc3x_dev libs tests
ipc3x_dev: utils
@cd src/ipc3x_dev; \
- make SYSLINK_PLATFORM=$(SYSLINK_PLATFORM) TILER_PLATFORM=$(TILER_PLATFORM) SMP=1 VIRTIO=$(BUILD_FOR_VIRTIO)
+ make SYSLINK_PLATFORM=$(SYSLINK_PLATFORM) SMP=1 VIRTIO=$(BUILD_FOR_VIRTIO)
install:
@cd src/ipc3x_dev; make SYSLINK_PLATFORM=$(SYSLINK_PLATFORM) \
- TILER_PLATFORM=$(TILER_PLATFORM) SMP=1 VIRTIO=$(BUILD_FOR_VIRTIO) USE_INSTALL_ROOT=1 \
+ SMP=1 VIRTIO=$(BUILD_FOR_VIRTIO) USE_INSTALL_ROOT=1 \
INSTALL_ROOT_nto=$(DESTDIR) install
@cd src/tests; make USE_INSTALL_ROOT=1 DESTDIR=$(DESTDIR) \
INSTALL_ROOT_nto=$(DESTDIR) install
@cd src/utils; make clean
@cd src/tests; make clean
@cd src/ipc3x_dev; \
- make clean SYSLINK_PLATFORM=$(SYSLINK_PLATFORM) TILER_PLATFORM=$(TILER_PLATFORM) SMP=1 VIRTIO=$(BUILD_FOR_VIRTIO)
+ make clean SYSLINK_PLATFORM=$(SYSLINK_PLATFORM) SMP=1 VIRTIO=$(BUILD_FOR_VIRTIO)
index a4cfb2425ace7eb40620dece2121bb0f0d2197c4..88b507219a0869bb011aa49b6652700d7ab13896 100644 (file)
ti/syslink/samples/hlos/deh/usr/arm/le.v7/rpmsg-omx-errors
ti/syslink/samples/hlos/ti-ipc/arm/le.v7/ti-ipc-test
ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/arm/le.v7/rpmsg-rpc-stress
-tiler/resmgr/tiler/arm/le.v7/tiler
-tiler/usr/tests/memmgr/arm/le.v7/memmgr_test
-tiler/usr/tests/tiler/arm/le.v7/tiler_test
-tiler/usr/tests/tilerusr/arm/le.v7/tilerusr_test
-tiler/usr/tests/utils/arm/le.v7/utils_test
*.patch
index f6476745415c245b16d24bb0409366915e585524..cb08896bb04b900c686567b6f29a48f9108f3a61 100644 (file)
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-EARLY_DIRS=tiler perfutils
+EARLY_DIRS=perfutils
LATE_DIRS=ti
SYSLINK_BUILDOS=Qnx
diff --git a/qnx/src/ipc3x_dev/ReadMe.txt b/qnx/src/ipc3x_dev/ReadMe.txt
+++ /dev/null
@@ -1,522 +0,0 @@
- SysLink 3 / Tiler
-
-This is the Qnx SysLink IPC that uses the VirtQueue transport to communicate
-with the sys-bios rpmsg.
-
-Source Code:
-============
- - Qnx SysLink Source
- The source code is located in the gforge01 git tree.
-
- git clone ssh://<aid/xid>@gforge01.dal.design.ti.com/gitroot/syslink_qnx
- branch: sl3_dev
- Provide enterprise password when prompted.
-
- - BIOS RPMSG Source
- The source code is located in git.omapzoom.org
-
- branch: master
- tag: 2.00.11.31
- commit-id: 91f6379282230ef5d1818ce8363ce1e64f23cda2
- patches needed on top for Qnx can be found at:
- \\dta0866189\SHARE\sl3\patches\sl3_1.05.23\sysbios-rpmsg
- 0001-IPC-Protect-Message-Sending-to-Serialize-Messages.patch
- 0002-WIP-Add-j5-and-j5eco-support.patch
- 0003-Resources-Update-ti811x-resource-table-for-shmem-car.patch
- 0004-Update-number-of-HwSpinlocks.patch
-
- Note: For running the benchmarking test, follow the instructions at the
- top of the MPU-side benchmarking test app.
-
- Default firmware files are generated in
- /sysbios-rpmsg/src/ti/examples/srvmgr/ti_platform_<...>. The folder is
- named for the platform. For example, for the OMAP5 ipu firmware, the folder
- is named ti_platform_omap54xx_ipu.
-
-Tools:
-======
- - Qnx Momentics IDE 6.5.x
- For more information please refer to the Wiki:
- http://opbuwiki.dal.design.ti.com/index.php/QNX_Main_Page#Developer_Setup
- - OMAP5 BSP Information is available in thie Wiki:
- http://opbuwiki.dal.design.ti.com/index.php/OMAP5_QNX_BSP
- - J5Eco BSP Information can be found on this Wiki:
- http://opbuwiki.dal.design.ti.com/index.php/J5eco_QNX_RPMSG#QNX_J5_eco_BSP
- - Please refer to the ReadMe in the Bios RPMSG source for the tools
- required to build the BIOS RPMSG source.
-
-Build Instructions (Windows):
-=============================
- 1) Open a command prompt and change directory to the syslink project
- directory.
- 2) (Optional) To override the default install root, create a new file named
- qconf-override.mk with the following contents:
- INSTALL_ROOT_nto := C:/ide-4.7-workspace/trunk
- USE_INSTALL_ROOT = 1
- Set the environment variable QCONF_OVERRIDE as follows:
- set QCONF_OVERRIDE = C:\ide-4.7-workspace\trunk\qconf-override.mk
- 3) From the command prompt:
- To build for OMAP5:
- > make SYSLINK_PLATFORM=omap5430 TILER_PLATFORM=omap5430 SMP=1
- To build for TI811X (note, there is no tiler support for j5 eco):
- > make SYSLINK_PLATFORM=ti81xx SYSLINK_VARIANT=TI811X
- Note: To export the tiler headers and built binaries/libraries to the
- install root, you can instead run "make install"
-
-Note: To build the binaries/libraries with the debug compile options of -g and
- -O0, add the following to the build command:
-
- "SYSLINK_DEBUG=1 TILER_DEBUG=1".
-
-Clean Instructions (Windows):
-=============================
- 1) Open a command prompt and change directory to the syslink project
- directory.
- 3) From the command prompt:
- > make clean
-
-Build Output:
-=============
-
- Tiler binary and libs:
- ----------------------
- \tiler\resmgr\tiler\arm\le.v7\tiler Tiler Resource Manager
- \tiler\usr\memmgr\arm\so.le.v7\libmemmgr.so Tiler MemMgr API library
- \tiler\usr\tilerusr\arm\so.le.v7\libtilerusr.so Tiler TilerUsr API library
- \tiler\usr\utils\arm\so.le.v7\libmemmgr_utils.so Tiler MmemMgr Utils library
-
- Tiler samples:
- --------------
- \tiler\usr\tests\memmgr\arm\le.v7\memmgr_test Tiler MemMgr test
- \tiler\usr\tests\tiler\arm\le.v7\tiler_test Tiler parametric test
- \tiler\usr\tests\tilerusr\arm\le.v7\tilerusr_test Tiler TilerUsr test
- \tiler\usr\tests\utils\arm\le.v7\utils_test Tiler Utils test
-
- SharedMemAllocator binary and libs:
- -----------------------------------
- \sharedmemallocator\resmgr\arm\le.v7\shmemallocator ResMgr
- \sharedmemallocator\usr\arm\so.le.v7\libsharedmemallocator.so User Lib
-
- SharedMemAllocator samples:
- ---------------------------
- \sharedmemallocator\samples\sharedMemAllocator\usr\arm\le.v7\SharedMemoryAllocatorTestApp
-
- SysLink binary and lib (under \ti\syslink\build\Qnx\):
- ------------------------------------------------------
- resmgr\arm\le.v7\syslink Syslink Resource Manager
- lib\arm\so.le.v7\libsyslink_client.so Syslink client library (
- needed for using HWSpinLock API
- and running the
- MQCopy test app)
-
- SysLink samples (under \ti\syslink\samples\hlos\):
- --------------------------------------------------
- benchmark\usr\arm\le.v7\rpmsg-omx-benchmark Benchmark test
- MessageQCopy\usr\arm\le.v7\mqcopytestapp MessageQCopy test
- rpmsg-omx\usr\arm\le.v7\rpmsg-omx-test Rpmsg-omx interface test
- hwspinlock\usr\arm\le.v7\HwSpinLockTestApp HWSpinLock test
-
- Note: If an install root was specified, you will find the above mentioned binaries and
- libraries in the follwing paths in the install root:
-
- <install_root>\bin\
- -> syslink
- -> rpmsg-omx-benchmark
- -> mqcopytestapp
- -> rpmsg-omx-test
- -> HwSpinLockTestApp
- <install_root>\sbin\
- -> tiler
- -> memmgr_test
- -> tiler_test
- -> tilerusr_test
- -> utils_test
- <install_root>\usr\lib
- -> libmemmgr.so
- -> libtilerusr.so
- -> libmemmgr_utils.so
- -> libsyslink_client.so
-
-To Run SysLink/Tiler/SharedMemAllocator:
-========================================
-
- SharedMemAllocator
- ------------------
- On the target, sharedmemallocator can be started by running the following
- command
- # shmemallocator
- No additional command line arguments are required.
- The default carveouts will be created unless the resource manager
- source file is modified to define different carveouts.
- Note: If the source file is modified, then the carveouts will need to be
- modified in the syslink Platform.c file, and the sysbios-rpmsg resource
- table file in order for the carveouts to be visible to the remote core.
-
- Tiler
- -----
- On the target, tiler can be started by running the following command
- # tiler
- No additional command line arguments required. To see what options are
- available, run "use tiler" or view the tiler.use file.
-
- SysLink
- -------
- On the target, syslink can be started by running the following commad
- # syslink <proc_name> <ipu_firmware_file> ...
- The IPU firmware file to be loaded must be specified when starting syslink.
- The proc_name is the same as the MultiProc name for the proc that is to
- be loaded and is specific to the platform. Multiple proc_name/file pairs
- can be listed and all will be loaded.
- To see what other options may be available, run "use syslink" or view the
- syslink.use file.
- For example:
- - To start syslink with DSP for TI811X:
- # syslink DSP <dsp_firmware_file>
- For backward-compatibility with previous OMAP5 releases, the "-f" and "-d"
- options can be used instead to load IPU and DSP, respectively:
- # syslink -f <ipu_firmware_file> -d <dsp_firmware_file>
-
-Disabling Hibernation and Changing the Hibernation Timeout:
-=======================================
- To disable hibernation, use the "-H 0" option when starting syslink:
-
- # syslink -f <ducati_firmware_file> -H 0
-
- To change the hibernation timeout, use the "-T" option when starting syslink.
- The value should be in msec:
-
- # syslink -f <ducati_firmware_file> -T 10000
-
-Remote Core Traces:
-===================
- To see a dump of the remote core trace buffer, simply cat
- /dev/syslink-trace<proc_id>. Proc_id is the same as the MultiProc procId.
-
- For IPU traces for OMAP5:
- # cat /dev/syslink-trace2
-
- For DSP traces for OMAP5 or TI811X:
- # cat /dev/syslink-trace0
-
-Changing SharedMemAllocator Carveouts:
-======================================
- The carveouts used by the SharedMemAllocator are defined in
- \sharedmemallocator\resmgr\SharedMemoryAllocator.c at in the "blocks" array.
- In order to modify the addresses/sizes/number of the carveouts, modify this
- array and then re-build the module.
-
-Defining Carveouts for the Remote Cores:
-========================================
- In order to be able to perform the address translation and to have the
- carveout mapped into the MMU for the remote core, the carveouts must be
- defined in the sysbio-rpmsg resource table for the cores which need access
- to them. Carveouts should be added as "devmem" entries in the table, with
- the virtual and physical addresses given in the entry.
-
- The MPU-side Platform.c file for the target should also be updated to define
- the updated/new carveouts in the Syslink_Override_Params. The carveouts
- should be listed here for each core which needs access to them.
-
-Validating on the TARGET:
-=============================
-
- SysLink standalone tests:
- -------------------------------------
- 1) Setup the target:
- Copy the following files to the target:
- syslink
- mqcopytestapp
- rpmsg-omx-test
- libsyslink_client.so
- test_omx_ipu.xem3 (for OMAP5 IPU)
- test_omx_dsp.xe64T (for OMAP5 or TI811X DSP)
-
- Note: The binaries are from the sysbios-rpmsg tree, and
- can be found in the examples folder.
-
- 3) Start syslink from the terminal:
- For OMAP5:
- # /tmp/syslink -f /tmp/test_omx_ipu.xem3 -d /tmp/test_omx_dsp.xe64T -H 0
- For TI811X:
- # /tmp/syslink DSP /tmp/test_omx_dsp.xe64T -H 0
-
- You will see output like below on the console (OMAP5 output shown as example):
- # /tmp/syslink -f /tmp/test_omx_ipu.xem3 -d /tmp/test_omx_dsp.xe64T -H 0
- Starting syslink resource manager...
- RscTable_process: RscTable version is [1]
- RscTable_process: vring [256] @ [0xa0000000]
- RscTable_process: vring [256] @ [0xa0004000]
- RscTable_process: carveout [IPU_MEM_TEXT] @ da [0x00000000] pa [0xeda00000] len [0x600000]
- RscTable_process: carveout [IPU_MEM_DATA] @ da [0x80000000] pa [0xee000000] len [0x9c00000]
- RscTable_process: carveout [IPU_MEM_IPC_DATA] @ da [0x9f000000] pa [0xf7c00000] len [0x100000]
- RscTable_process: trace [trace:sysm3] @ da [0x9f000000] len [0x8000]
- RscTable_process: devmem [IPU_MEM_IPC_VRING] @ da [0xa0000000] pa [0xed900000] len [0x100000]
- RscTable_process: devmem [IPU_MEM_IOBUFS] @ da [0x90000000] pa [0xf7d00000] len [0x5a00000]
- RscTable_process: devmem [IPU_TILER_MODE_0_1] @ da [0x60000000] pa [0x60000000] len [0x10000000]
- RscTable_process: devmem [IPU_TILER_MODE_2] @ da [0x70000000] pa [0x70000000] len [0x8000000]
- RscTable_process: devmem [IPU_TILER_MODE_3] @ da [0x78000000] pa [0x78000000] len [0x8000000]
- RscTable_process: devmem [IPU_PERIPHERAL_L4CFG] @ da [0xaa000000] pa [0x4a000000] len [0x1000000]
- RscTable_process: devmem [IPU_PERIPHERAL_L4PER] @ da [0xa8000000] pa [0x48000000] len [0x1000000]
- RscTable_process: devmem [IPU_IVAHD_CONFIG] @ da [0xba000000] pa [0x5a000000] len [0x1000000]
- RscTable_process: devmem [IPU_IVAHD_SL2] @ da [0xbb000000] pa [0x5b000000] len [0x1000000]
- RscTable_process: devmem [IPU_PERIPHERAL_DMM] @ da [0xae000000] pa [0x4e000000] len [0x100000]
- << DLOAD >> WARNING: '' does not have a dynamic segment; assuming that it is a static executable and it cannot be relocated.
- Programming Benelli memory regions
- =========================================
- VA = [0xa0000000] of size [0x100000] at PA = [0xed900000]
- VA = [0x0] of size [0x600000] at PA = [0xeda00000]
- VA = [0x80000000] of size [0x9c00000] at PA = [0xee000000]
- VA = [0x9f000000] of size [0x100000] at PA = [0xf7c00000]
- Programming Benelli L4 peripherals
- =========================================
- PA [0x60000000] VA [0x60000000] size [0x10000000]
- PA [0x70000000] VA [0x70000000] size [0x8000000]
- PA [0x78000000] VA [0x78000000] size [0x8000000]
- PA [0x4a000000] VA [0xaa000000] size [0x1000000]
- PA [0x48000000] VA [0xa8000000] size [0x1000000]
- PA [0x4e000000] VA [0xae000000] size [0x100000]
- PA [0x5a000000] VA [0xba000000] size [0x1000000]
- PA [0x5b000000] VA [0xbb000000] size [0x1000000]
- PA [0x58000000] VA [0xb8000000] size [0x1000000]
- RscTable_process: RscTable version is [1]
- RscTable_process: vring [256] @ [0xa0000000]
- RscTable_process: vring [256] @ [0xa0004000]
- RscTable_process: carveout [DSP_MEM_TEXT] @ da [0x20000000] pa [0xe0d00000] len [0x100000]
- RscTable_process: carveout [DSP_MEM_DATA] @ da [0x90000000] pa [0xe0e00000] len [0x100000]
- RscTable_process: carveout [DSP_MEM_HEAP] @ da [0x90100000] pa [0xe0f00000] len [0x300000]
- RscTable_process: carveout [DSP_MEM_IPC_DATA] @ da [0x9f000000] pa [0xe1200000] len [0x100000]
- RscTable_process: trace [trace:dsp] @ da [0x9f000000] len [0x8000]
- RscTable_process: devmem [DSP_MEM_IPC_VRING] @ da [0xa0000000] pa [0xe0c00000] len [0x100000]
- RscTable_process: devmem [DSP_MEM_IOBUFS] @ da [0x80000000] pa [0xe1300000] len [0x5a00000]
- RscTable_process: devmem [DSP_TILER_MODE_0_1] @ da [0x60000000] pa [0x60000000] len [0x10000000]
- RscTable_process: devmem [DSP_TILER_MODE_2] @ da [0x70000000] pa [0x70000000] len [0x8000000]
- RscTable_process: devmem [DSP_TILER_MODE_3] @ da [0x78000000] pa [0x78000000] len [0x8000000]
- RscTable_process: devmem [DSP_PERIPHERAL_L4CFG] @ da [0x4a000000] pa [0x4a000000] len [0x1000000]
- RscTable_process: devmem [DSP_PERIPHERAL_L4PER] @ da [0x48000000] pa [0x48000000] len [0x1000000]
- RscTable_process: devmem [DSP_PERIPHERAL_DMM] @ da [0x4e000000] pa [0x4e000000] len [0x100000]
- << DLOAD >> WARNING: '' does not have a dynamic segment; assuming that it is a static executable and it cannot be relocated.
- Programming Tesla memory regions
- =========================================
- VA = [0xa0000000] of size [0x100000] at PA = [0xe0c00000]
- VA = [0x20000000] of size [0x100000] at PA = [0xe0d00000]
- VA = [0x90000000] of size [0x100000] at PA = [0xe0e00000]
- VA = [0x90100000] of size [0x300000] at PA = [0xe0f00000]
- VA = [0x9f000000] of size [0x100000] at PA = [0xe1200000]
- Programming L4 peripherals
- =========================================
- VA = [0x60000000] and PA [0x60000000] of size = [0x10000000]
- VA = [0x70000000] and PA [0x70000000] of size = [0x8000000]
- VA = [0x78000000] and PA [0x78000000] of size = [0x8000000]
- VA = [0x4a000000] and PA [0x4a000000] of size = [0x1000000]
- VA = [0x48000000] and PA [0x48000000] of size = [0x1000000]
- VA = [0x49000000] and PA [0x49000000] of size = [0x1000000]
- VA = [0xba000000] and PA [0x5a000000] of size = [0x1000000]
- Syslink resource manager started
- #
-
- 4) rpmsg-omx-test:
- # rpmsg-omx-test 1 10
-
- You will see output like below on the console:
- # rpmsg-omx-test 10
- omx_sample: Connected to OMX
- omx_sample (1): OMX_GetHandle (H264_decoder).
- msg_id: 99, fxn_idx: 5, data_size: 13, data: OMX_Callback
- omx_sample (1): Got omx_handle: 0x5c0ffee5
- omx_sample(1): OMX_SetParameter (0x5c0ffee5)
- omx_sample (1): Got result 0
- omx_sample (2): OMX_GetHandle (H264_decoder).
- msg_id: 99, fxn_idx: 5, data_size: 13, data: OMX_Callback
- omx_sample (2): Got omx_handle: 0x5c0ffee5
- omx_sample(2): OMX_SetParameter (0x5c0ffee5)
- omx_sample (2): Got result 0
-
- [...]
-
- omx_sample (10): OMX_GetHandle (H264_decoder).
- msg_id: 99, fxn_idx: 5, data_size: 13, data: OMX_Callback
- omx_sample (10): Got omx_handle: 0x5c0ffee5
- omx_sample(10): OMX_SetParameter (0x5c0ffee5)
- omx_sample (10): Got result 0
- omx_sample: Closed connection to OMX!
- #
-
- 5) mqcopytestapp:
- # mqcopytestapp 1
-
- To see the test app output, run sloginfo:
- Jan 01 00:00:00 4 42 0 MessageQCopyApp sample application
-
- Jan 01 00:00:00 4 42 0 Entered MessageQCopyApp_startup
-
- Jan 01 00:00:00 4 42 0 Leaving MessageQCopyApp_startup. Status [0x0]
-
- Jan 01 00:00:00 4 42 0 Entered MessageQCopyApp_execute
-
- Jan 01 00:00:00 4 42 0 <1>mqcopy_server_test_cb 0 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_server_test_cb 1 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_server_test_cb 2 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_server_test_cb 3 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_server_test_cb 4 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_server_test_cb 5 for handle 6141352 from 50 [hello world!]
-
- [...]
-
- Jan 01 00:00:00 4 42 0 <1>mqcopy_server_test_cb 495 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_server_test_cb 496 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_server_test_cb 497 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_server_test_cb 498 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_server_test_cb 499 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>_MessageQCopy_callback_bufReady: no object for endpoint: 103
-
- Jan 01 00:00:00 4 42 0 Leaving MessageQCopyApp_execute. Status [0x0]
-
- Jan 01 00:00:00 4 42 0 Entered MessageQCopyApp_shutdown
-
- Jan 01 00:00:00 4 42 0 Leaving MessageQCopyApp_shutdown. Status [0x0]
-
- # mqcopytestapp 2
-
- To see the test app output, run sloginfo:
- Jan 01 00:00:00 4 42 0 MessageQCopyApp sample application
-
- Jan 01 00:00:00 4 42 0 Entered MessageQCopyApp_startup
-
- Jan 01 00:00:00 4 42 0 Leaving MessageQCopyApp_startup. Status [0x0]
-
- Jan 01 00:00:00 4 42 0 Entered MessageQCopyApp_execute
-
- Jan 01 00:00:00 4 42 0 <1>mqcopy_client_test_cb 0 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_client_test_cb 1 for handle 6141352 from 51 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_client_test_cb 2 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_client_test_cb 3 for handle 6141352 from 51 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_client_test_cb 4 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_client_test_cb 5 for handle 6141352 from 51 [hello world!]
-
- [...]
-
- Jan 01 00:00:00 4 42 0 <1>mqcopy_client_test_cb 495 for handle 6141352 from 51 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_client_test_cb 496 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_client_test_cb 497 for handle 6141352 from 51 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_client_test_cb 498 for handle 6141352 from 50 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>mqcopy_client_test_cb 499 for handle 6141352 from 51 [hello world!]
- Jan 01 00:00:00 4 42 0 <1>_MessageQCopy_callback_bufReady: no object for endpoint: 103
-
- Jan 01 00:00:00 4 42 0 <1>_MessageQCopy_callback_bufReady: no object for endpoint: 103
-
- Jan 01 00:00:00 4 42 0 Leaving MessageQCopyApp_execute. Status [0x0]
-
- Jan 01 00:00:00 4 42 0 <1>_MessageQCopy_callback_bufReady: no object for endpoint: 103
-
- Jan 01 00:00:00 4 42 0 Entered MessageQCopyApp_shutdown
-
- Jan 01 00:00:00 4 42 0 Leaving MessageQCopyApp_shutdown. Status [0x0]
-
- 6) HwSpinLockTestApp:
- Note: Use the test_omx_dsp to run this test.
-
- # HwSpinLockTestApp
-
- You will see output like below on the console:
-
- # HwSpinLockTestApp
- PROC=> HwSpinlock_create(0) CREATED
-
- PROC=> lock (0) entered
-
- PROC=> return from HwSpinlock_leave(0)
- HwSpinlock_delete(token0): PASSED
-
- PROC=> HwSpinlock_create(1) CREATED
-
- PROC=> lock (1) entered
-
- PROC=> return from HwSpinlock_leave(1)
- HwSpinlock_delete(token1): PASSED
-
- PROC=> HwSpinlock_create(1) CREATED
-
- PROC=> lock (2) entered
-
- PROC=> return from HwSpinlock_leave(2)
- HwSpinlock_delete(token2): PASSED
- #
-
- Tiler Standalone Tests:
- -----------------------
-
- 1) Setup the target
-
- Copy the following to the target:
-
- tiler
- memmgr_test
- tilerusr_test
- utils_test
- libmemmgr.so
- libtilerusr.so
- libmemmgr_utils.so
-
- 2) Start tiler from the terminal:
- # tiler
-
- You will see output like below on the console:
- # tiler
- configured grow size is 16
- configured grow size is 16
- tiler: Unable to register to low memory event: Function not implemented
-
- 3) memmgr_test (Note: this test takes a long time on Virtio)
- # memmgr_test
- TEST # 1 - alloc_1D_test(4096, 0)
- TEST_DESC - Allocate & Free 4096b 1D buffer
- ==> TEST OK
- so far FAILED: 0, SUCCEEDED: 1, UNAVAILABLE: 0
- TEST # 2 - alloc_2D_test(64, 64, PIXEL_FMT_8BIT)
- TEST_DESC - Allocate & Free 64x64x1b 1D buffer
- ==> TEST OK
-
- [...]
-
- TEST # 103 - star_test(1000, 10)
- TEST_DESC - Random set of 1000 Allocs/Maps and Frees/UnMaps for 10 slots
- ==> TEST OK
- so far FAILED: 0, SUCCEEDED: 103, UNAVAILABLE: 0
- so far FAILED: 0, SUCCEEDED: 103, UNAVAILABLE: 0
- FAILED: 0, SUCCEEDED: 103, UNAVAILABLE: 0
-
- 4) tilerusr_test (Note: this test takes a long time on Virtio)
- # tilerusr_test
- TEST # 1 - alloc_1D_test(4096, 0)
- TEST_DESC - Allocate & Free 4096b 1D buffer
- ==> TEST OK
- so far FAILED: 0, SUCCEEDED: 1, UNAVAILABLE: 0
- TEST # 2 - alloc_2D_test(64, 64, PIXEL_FMT_8BIT)
- TEST_DESC - Allocate & Free 64x64x1b 1D buffer
- ==> TEST OK
-
- [...]
-
- TEST # 79 - star_test(1000, 10)
- TEST_DESC - Random set of 1000 Allocs/Maps and Frees/UnMaps for 10 slots
- ==> TEST OK
- so far FAILED: 0, SUCCEEDED: 79, UNAVAILABLE: 0
- so far FAILED: 0, SUCCEEDED: 79, UNAVAILABLE: 0
- FAILED: 0, SUCCEEDED: 79, UNAVAILABLE: 0
-
- 5) utils_test
- # utils_test
- TEST # 1 - test_new()
- TEST_DESC - ==> TEST OK
- so far FAILED: 0, SUCCEEDED: 1, UNAVAILABLE: 0
- TEST # 2 - test_list()
- TEST_DESC - ==> TEST OK
- so far FAILED: 0, SUCCEEDED: 2, UNAVAILABLE: 0
-
- [...]
-
- TEST # 7 - test_math()
- TEST_DESC - ==> TEST OK
- so far FAILED: 0, SUCCEEDED: 7, UNAVAILABLE: 0
- so far FAILED: 0, SUCCEEDED: 7, UNAVAILABLE: 0
- FAILED: 0, SUCCEEDED: 7, UNAVAILABLE: 0
diff --git a/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/common.mk b/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/common.mk
index adf6cd8fe7742a056941fd23f7e49e77a92a659a..3b64f2e114fb437f2477ed054c2979baf225ea46 100644 (file)
NAME=ipc
CCOPTS += -DSYSLINK_BUILDOS_QNX -DSYSLINK_BUILD_DEBUG -DSYSLINK_BUILD_HLOS
+
+# TODO: Is this macro used anymore? If not, remove it.
USE_MEMMGR=false
ifeq ("$(SYSLINK_DEBUG)", "1")
#enable debug build
endif # ifeq ("$(SYSLINK_PLATFORM)", "")
ifeq ("$(SYSLINK_PLATFORM)", "omap4430")
-CCOPTS += -DSYSLINK_PLATFORM_OMAP4430 -DARM_TARGET -DC60_TARGET -DSYSLINK_USE_IPU_PM -DUSE_MEMMGR
-USE_MEMMGR=true
+CCOPTS += -DSYSLINK_PLATFORM_OMAP4430 -DARM_TARGET -DC60_TARGET -DSYSLINK_USE_IPU_PM
endif # ifeq ("$(SYSLINK_PLATFORM)", "omap4430")
ifeq ("$(SYSLINK_PLATFORM)", "omap5430")
ifeq ("$(SMP)", "1")
CCOPTS += -DSYSLINK_SYSBIOS_SMP
endif # ifeq ("$(SMP)", "1")
-CCOPTS += -DSYSLINK_PLATFORM_OMAP5430 -DARM_TARGET -DC60_TARGET -DSYSLINK_USE_IPU_PM -DUSE_MEMMGR
-USE_MEMMGR=true
+CCOPTS += -DSYSLINK_PLATFORM_OMAP5430 -DARM_TARGET -DC60_TARGET -DSYSLINK_USE_IPU_PM
endif # ifeq ("$(SYSLINK_PLATFORM)", "omap5430")
ifeq ("$(SYSLINK_PLATFORM)", "ti81xx")
$(SYSLINK_ROOT)/ti/syslink/procMgr/hlos/knl/loaders/Elf/$(SYSLINK_BUILDOS)/DLOAD/DLOAD_SYM \
$(SYSLINK_ROOT)/ti/syslink/procMgr/hlos/knl/loaders/Elf/$(SYSLINK_BUILDOS)/dlw_client \
$(SYSLINK_ROOT)/ti/syslink/rpmsg-resmgr/hlos/knl/$(SYSLINK_BUILDOS)/family \
- $(SYSLINK_ROOT)/tiler/usr/memmgr/public \
- $(SYSLINK_ROOT)/tiler/resmgr/tiler/public \
$(SYSLINK_ROOT)/ti/syslink/resources \
$(SYSLINK_ROOT)/ti/syslink/family/common \
$(IPC_REPO)/qnx/include \
$(SYSLINK_ROOT)/ti/syslink/family/$(SYSLINK_PLATFORM)/$(SYSLINK_PLATFORM)ipu/$(SYSLINK_PLATFORM)core1
endif
-ifeq ("$(USE_MEMMGR)", "false")
-EXCLUDE_OBJS = SysLinkMemUtils.o
-endif
-
-ifeq ("$(USE_MEMMGR)", "false")
-EXCLUDE_OBJS = SysLinkMemUtils.o
-endif
-
include $(MKFILES_ROOT)/qtargets.mk
LDFLAGS += -M
EXTRA_LIBVPATH += $(INSTALL_ROOT_nto)/usr/lib
-EXTRA_LIBVPATH += $(SYSLINK_ROOT)/tiler/usr/memmgr/arm/so.le.v7
-
ifeq ("$(SYSLINK_DEBUG)", "1")
EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/utils/arm/a.g.le.v7
LIBS += utils_g
ifeq ("$(SYSLINK_PLATFORM)", "omap4430")
LIBS += powman camdrv login slog2
endif
-ifeq ("$(USE_MEMMGR)", "true")
-LIBS += memmgr
-endif
diff --git a/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c b/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c
index 0d4b6b8184167342ecd033c3e5d673a4acdf5b9b..e7ea7fe0a005311d3354cbd9ed17a68d36df72f7 100644 (file)
#include <sys/iofunc.h>
#include <sys/dispatch.h>
#include <sys/netmgr.h>
+#include <sys/mman.h>
#include <devctl.h>
/* Module headers */
#include "std_qnx.h"
#include <pthread.h>
-#include <memmgr/tilermem.h>
-#include <memmgr/tiler.h>
-
#include "rpmsg-rpc.h"
#include <rpmsg.h>
diff --git a/qnx/src/ipc3x_dev/tiler/Makefile b/qnx/src/ipc3x_dev/tiler/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (c) 2013, Texas Instruments Incorporated
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Texas Instruments Incorporated nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-include recurse.mk
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/Makefile b/qnx/src/ipc3x_dev/tiler/resmgr/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (c) 2013, Texas Instruments Incorporated
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Texas Instruments Incorporated nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-include recurse.mk
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/List.c b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/List.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * @file List.c
- *
- * @brief Creates a doubly linked list.
- *
- *
- * @ver 02.00.00.53_alpha2
- *
- * ============================================================================
- *
- * Copyright (c) 2010, Texas Instruments Incorporated
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * Contact information for paper mail:
- * Texas Instruments
- * Post Office Box 655303
- * Dallas, Texas 75265
- * Contact information:
- * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
- * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
- * ============================================================================
- *
- */
-
-
-#include "proto.h"
-#include "List.h"
-
-/* =============================================================================
- * All success and failure codes for the module. Defined here because they are
- * only used internally.
- * =============================================================================
- */
-
-/*!
- * @def List_S_BUSY
- * @brief The resource is still in use
- */
-#define List_S_BUSY 2
-
-/*!
- * @def List_S_ALREADYSETUP
- * @brief The module has been already setup
- */
-#define List_S_ALREADYSETUP 1
-
-/*!
- * @def List_S_SUCCESS
- * @brief Operation is successful.
- */
-#define List_S_SUCCESS 0
-
-/*!
- * @def List_E_FAIL
- * @brief Generic failure.
- */
-#define List_E_FAIL -1
-
-/*!
- * @def List_E_INVALIDARG
- * @brief Argument passed to function is invalid.
- */
-#define List_E_INVALIDARG -2
-
-/*!
- * @def List_E_MEMORY
- * @brief Operation resulted in memory failure.
- */
-#define List_E_MEMORY -3
-
-/*!
- * @def List_E_ALREADYEXISTS
- * @brief The specified entity already exists.
- */
-#define List_E_ALREADYEXISTS -4
-
-/*!
- * @def List_E_NOTFOUND
- * @brief Unable to find the specified entity.
- */
-#define List_E_NOTFOUND -5
-
-/*!
- * @def List_E_TIMEOUT
- * @brief Operation timed out.
- */
-#define List_E_TIMEOUT -6
-
-/*!
- * @def List_E_INVALIDSTATE
- * @brief Module is not initialized.
- */
-#define List_E_INVALIDSTATE -7
-
-/*!
- * @def List_E_OSFAILURE
- * @brief A failure occurred in an OS-specific call
- */
-#define List_E_OSFAILURE -8
-
-/*!
- * @def List_E_RESOURCE
- * @brief Specified resource is not available
- */
-#define List_E_RESOURCE -9
-
-/*!
- * @def List_E_RESTART
- * @brief Operation was interrupted. Please restart the operation
- */
-#define List_E_RESTART -10
-
-/* Function to remove specific elem from list */
-void
-List_elemClear (List_Elem * elem)
-{
- if (elem != NULL) {
- elem->next = elem->prev = elem;
- }
-}
-
-
-/* Function to check if list is empty */
-bool
-List_empty (List_Handle handle)
-{
- bool isEmpty = false;
- List_Elem * obj = (List_Elem *) handle;
- List_Elem *elem = NULL;
-
- if (handle != NULL) {
- elem = obj->next;
- if ((elem == obj) && (elem == obj->prev)) {
- /*! @retval TRUE List is empty */
- isEmpty = true;
- }
- }
-
- /*! @retval FALSE List is not empty */
- return isEmpty;
-}
-
-
-/* Function to get front element */
-List_Elem *
-List_get (List_Handle handle)
-{
- List_Elem * elem = NULL;
-
- if (handle != NULL) {
- elem = List_dequeue(handle);
- }
-
- /*! @retval Valid-pointer Pointer to first element */
- return elem ;
-}
-
-
-/* Function to put elem at the end */
-void
-List_put (List_Handle handle, List_Elem * elem)
-{
- if (handle != NULL && elem != NULL) {
- List_enqueue (handle, elem);
- }
-}
-
-
-
-/* Function to get next elem of current one (non-atomic) */
-List_Elem *
-List_next (List_Handle handle, List_Elem * elem)
-{
- List_Elem * retElem = NULL;
- List_Elem * obj = (List_Elem *) handle;
-
- if (handle != NULL) {
- /* elem == NULL -> start at the head */
- if (elem == NULL) {
- retElem = obj->next;
- }
- else {
- retElem = elem->next;
- }
-
- if (retElem == (List_Elem *) obj) {
- /*! @retval NULL List reached end or list is empty */
- retElem = NULL;
- }
-
- }
-
- /*! @retval Valid-pointer Pointer to the next element */
- return retElem;
-}
-
-
-/* Function to get previous elem of current one (non-atomic) */
-List_Elem *
-List_prev (List_Handle handle, List_Elem * elem)
-{
- List_Elem * retElem = NULL;
- List_Elem * obj = (List_Elem *) handle;
-
- if (handle != NULL && elem != NULL) {
- /* elem == NULL -> start at the head */
- if (elem == NULL) {
- retElem = obj->prev;
- }
- else {
- retElem = elem->prev;
- }
-
- if (retElem == (List_Elem *)obj) {
- /*! @retval NULL List reached end or list is empty */
- retElem = NULL;
- }
- }
-
- /*! @retval Valid-pointer Pointer to the prev element */
- return retElem;
-}
-
-
-/* Function to insert elem before existing elem */
-void
-List_insert (List_Handle handle, List_Elem * newElem, List_Elem * curElem)
-{
- if (handle != NULL && newElem != NULL && curElem != NULL) {
- /* Cannot directly call enqueue since the object has other fields */
- newElem->next = curElem;
- newElem->prev = curElem->prev;
- newElem->prev->next = newElem;
- curElem->prev = newElem;
- }
-}
-
-
-/* Function to remove specific elem from list */
-void
-List_remove (List_Handle handle, List_Elem * elem)
-{
- if (elem != NULL) {
- elem->prev->next = elem->next;
- elem->next->prev = elem->prev;
- }
-}
-
-
-/* Function to put element before head */
-void
-List_putHead (List_Handle handle, List_Elem *elem)
-{
- if (handle != NULL && elem != NULL) {
- List_enqueueHead (handle, elem);
- }
-}
-
-
-/* Get element from front of List (non-atomic) */
-List_Elem *
-List_dequeue (List_Handle handle)
-{
- List_Elem * elem = NULL;
- List_Elem * obj = (List_Elem *) handle;
-
- elem = obj->next;
- /* See if the List was empty */
- if (elem == (List_Elem *)obj) {
- /*! @retval NULL List is empty */
- elem = NULL;
- }
- else {
- obj->next = elem->next;
- elem->next->prev = obj;
- }
- return elem;
-}
-
-
-/* Put element at end of List (non-atomic) */
-void
-List_enqueue (List_Handle handle, List_Elem * elem)
-{
- List_Elem * obj = (List_Elem *) handle;
-
- if (handle != NULL && elem != NULL) {
- elem->next = obj;
- elem->prev = obj->prev;
- obj->prev->next = elem;
- obj->prev = elem;
- }
-}
-
-
-/* Put element at head of List (non-atomic) */
-void
-List_enqueueHead (List_Handle handle, List_Elem * elem)
-{
- List_Elem * obj = (List_Elem *) handle;
-
- if (handle != NULL && elem != NULL) {
- elem->next = obj->next;
- elem->prev = obj;
- obj->next->prev = elem;
- obj->next = elem;
- }
-}
-
-
-/* Move list element to new place in list (non-atomic) */
-void
-List_move(List_Handle handle, List_Elem *list)
-{
- List_remove(handle, list);
- List_enqueueHead(handle, list);
-}
-
-
-/* Check if the list has only one element (non-atomic) */
-int
-List_is_singular(List_Handle handle)
-{
- List_Elem *elem = (List_Elem *)handle;
- return !List_empty(handle) && (elem->next == elem->prev);
-}
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/List.h b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/List.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/**
- * @file List.h
- *
- * @brief Creates a doubly linked list. It works as utils for other
- * modules
- *
- *
- * @ver 02.00.00.53_alpha2
- *
- * ============================================================================
- *
- * Copyright (c) 2010, Texas Instruments Incorporated
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * Contact information for paper mail:
- * Texas Instruments
- * Post Office Box 655303
- * Dallas, Texas 75265
- * Contact information:
- * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
- * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
- * ============================================================================
- *
- */
-
-
-#ifndef LIST_H_0XB734
-#define LIST_H_0XB734
-
-#include <stdbool.h>
-
-/* =============================================================================
- * Macros and types
- * =============================================================================
- */
-/*!
- * @def List_traverse
- * @brief Traverse the full list till the last element.
- */
-#define List_traverse(x,y) for(x = (y)->next; \
- x != (y);\
- x = x->next)
-
-#define List_traverse_safe(x, y, z) for(x = (z)->next, \
- y = (x)->next; \
- x != z; \
- x = y, \
- y = (x)->next)
-
-#define List_elem(x,y,z) ((y *)((char *)(x)-(uint32_t)(&((y *)0)->z)))
-
-#define List_traverse_elem(a, b, c, d) for(a = List_elem((c)->next, typeof(*a), d), \
- b = List_elem(a->d.next, typeof(*a), d); \
- &a->d != (c); \
- a = b, b = List_elem(b->d.next, typeof(*b), d))
-
-/*!
- * @brief Structure defining object for the list element.
- */
-typedef struct List_Elem_tag {
- struct List_Elem_tag * prev; /*!< Pointer to the previous element */
- struct List_Elem_tag * next; /*!< Pointer to the next element */
-} List_Elem;
-
-/*! @brief Defines List handle type */
-typedef List_Elem * List_Handle;
-
-
-/* =============================================================================
- * APIs
- * =============================================================================
- */
-
-/*!
- * @brief Function to clear element contents.
- *
- * @param elem Element to be cleared
- *
- * @sa
- */
-void List_elemClear (List_Elem * elem);
-
-/*!
- * @brief Function to check if list is empty.
- *
- * @param handle Pointer to the list
- *
- * @retval TRUE List is empty
- * @retval FALSE List is not empty
- *
- * @sa
- */
-bool List_empty (List_Handle handle);
-
-/*!
- * @brief Function to get first element of List.
- *
- * @param handle Pointer to the list
- *
- * @retval NULL Operation failed
- * @retval Valid-pointer Pointer to first element
- *
- * @sa List_put
- */
-List_Elem * List_get (List_Handle handle);
-
-/*!
- * @brief Function to insert element at the end of List.
- *
- * @param handle Pointer to the list
- * @param elem Element to be inserted
- *
- * @sa List_get
- */
-void List_put (List_Handle handle, List_Elem * elem);
-
-/*!
- * @brief Function to traverse to the next element in the list (non
- * atomic)
- *
- * @param handle Pointer to the list
- * @param elem Pointer to the current element
- *
- * @retval NULL Operation failed
- * @retval Valid-pointer Pointer to next element
- *
- * @sa List_prev
- */
-List_Elem * List_next (List_Handle handle, List_Elem * elem);
-
-/*!
- * @brief Function to traverse to the previous element in the list (non
- * atomic)
- *
- * @param handle Pointer to the list
- * @param elem Pointer to the current element
- *
- * @retval NULL Operation failed
- * @retval Valid-pointer Pointer to previous element
- *
- * @sa List_next
- */
-List_Elem * List_prev (List_Handle handle, List_Elem * elem);
-
-/*!
- * @brief Function to insert element before the existing element
- * in the list.
- *
- * @param handle Pointer to the list
- * @param newElem Element to be inserted
- * @param curElem Existing element before which new one is to be inserted
- *
- * @sa List_remove
- */
-void List_insert (List_Handle handle, List_Elem * newElem, List_Elem * curElem);
-
-/*!
- * @brief Function to removes element from the List.
- *
- * @param handle Pointer to the list
- * @param elem Element to be removed
- *
- * @sa List_insert
- */
-void List_remove (List_Handle handle, List_Elem * elem);
-
-/*!
- * @brief Function to put the element before head.
- *
- * @param handle Pointer to the list
- * @param elem Element to be added at the head
- *
- * @sa List_put
- */
-void List_putHead (List_Handle handle, List_Elem * elem);
-
-/*!
- * @brief Get element from front of List (non-atomic)
- *
- * @param handle Pointer to the list
- *
- * @retval NULL Operation failed
- * @retval Valid-pointer Pointer to removed element
- *
- * @sa List_enqueue, List_enqueueHead
- */
-List_Elem* List_dequeue (List_Handle handle);
-
-/*!
- * @brief Put element at end of List (non-atomic)
- *
- * @param handle Pointer to the list
- * @param elem Element to be put
- *
- * @sa List_dequeue
- */
-void List_enqueue (List_Handle handle, List_Elem * elem);
-
-/*!
- * @brief Put element at head of List (non-atomic)
- *
- * @param handle Pointer to the list
- * @param elem Element to be added
- *
- * @sa List_dequeue
- */
-void List_enqueueHead (List_Handle handle, List_Elem * elem);
-
-/*!
- * @brief Move an element to a new place in the list (non-atomic)
- *
- * @param handle Pointer to the place to move the element after
- * @param elem Element to be moved
- *
- * @sa List_move
- */
-void List_move(List_Handle handle, List_Elem *list);
-
-/*!
- * @brief Check if the list has only one element (non-atomic)
- *
- * @param handle Pointer to list
- *
- * @sa List_is_singular
- */
-
-int List_is_singular(List_Handle handle);
-
-#endif /* LIST_H_0XB734 */
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/Makefile b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2013, Texas Instruments Incorporated
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Texas Instruments Incorporated nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-LIST=CPU
-include recurse.mk
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/arm/Makefile b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/arm/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright (c) 2013, Texas Instruments Incorporated
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Texas Instruments Incorporated nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-LIST=VARIANT
-ifndef QRECURSE
-QRECURSE=recurse.mk
-ifdef QCONFIG
-QRDIR=$(dir $(QCONFIG))
-endif
-endif
-include $(QRDIR)$(QRECURSE)
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/arm/le.v7/Makefile b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/arm/le.v7/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (c) 2013, Texas Instruments Incorporated
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Texas Instruments Incorporated nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-include ../../common.mk
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/common.mk b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/common.mk
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# Copyright (c) 2013, Texas Instruments Incorporated
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Texas Instruments Incorporated nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-ifndef QCONFIG
-QCONFIG=qconfig.mk
-endif
-include $(QCONFIG)
-
-define PINFO
-PINFO DESCRIPTION=TILER driver
-endef
-
-NAME = tiler
-INSTALLDIR = sbin
-
-ifeq ("$(TILER_DEBUG)", "1")
-#enable debug build
-CCOPTS += -g -O0
-endif # ifeq ("$(TILER_DEBUG)", "")
-
-ifeq ("$(TILER_PLATFORM)", "")
-#default value
-TILER_PLATFORM=omap4430
-endif # ifeq ("$(TILER_PLATFORM)", "")
-
-ifeq ("$(TILER_PLATFORM)", "omap4430")
-CCOPTS += -DTILER_PLATFORM_OMAP4
-endif # ifeq ("$(TILER_PLATFORM)", "omap4430")
-ifeq ("$(TILER_PLATFORM)", "omap5430")
-CCOPTS += -DTILER_PLATFORM_OMAP5
-endif # ifeq ("$(TILER_PLATFORM)", "omap5430")
-ifeq ("$(TILER_PLATFORM)", "vayu")
-CCOPTS += -DTILER_PLATFORM_OMAP5
-endif # ifeq ("$(TILER_PLATFORM)", "vayu")
-
-EXTRA_INCVPATH+=$(PROJECT_ROOT)/public \
- $(PROJECT_ROOT)/../../tiler_pat
-EXTRA_SRCVPATH+=$(PROJECT_ROOT)/tcm
-
-ifeq ("$(TILER_PLATFORM)", "omap4430")
-LIBS += login
-endif # ifneq ("$(TILER_PLATFORM)", "omap4430")
-
-include $(MKFILES_ROOT)/qtargets.mk
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/main.c b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/main.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-
-#include "proto.h"
-
-#include <stdarg.h>
-#include <signal.h>
-#if defined(TILER_PLATFORM_OMAP4)
-#include <login.h>
-#endif
-
-#define DENY_ALL \
- PROCMGR_ADN_ROOT \
- |PROCMGR_ADN_NONROOT \
- |PROCMGR_AOP_DENY \
- |PROCMGR_AOP_LOCK
-
-static resmgr_connect_funcs_t connect_funcs;
-static resmgr_io_funcs_t io_funcs;
-static iofunc_mount_t mattr;
-static iofunc_funcs_t ocb_funcs;
-static iofunc_attr_t attr;
-static volatile unsigned done = 0;
-
-static int lowmem_limit = 128 * 1024 * 1024;
-static int lowmem_current = INT_MAX;
-#if _NTO_VERSION >= 660
-static int lowmem_id = -1;
-static int lowmem_pulse_prio = -1;
-#endif
-
-int tiler_devctl(resmgr_context_t *ctp, io_devctl_t *msg, tiler_ocb_t *ocb);
-int tiler_read(resmgr_context_t *ctp, io_read_t *msg, tiler_ocb_t *ocb);
-
-#if _NTO_VERSION >= 660
-static int
-tiler_lowmem ( message_context_t *ctp, int code, unsigned flags, void *handle )
-{
- lowmem_current = procmgr_value_current(lowmem_id);
-#if 0
- slogf(99, 1, "current lowmem is %dM, limit is %dM", lowmem_current/1024/1024, lowmem_limit/1024/1024 );
-#endif
- if ( tiler_islowmem() ) {
- tiler_purge();
- }
- return EOK;
-}
-#endif
-
-int tiler_islowmem(void)
-{
- return lowmem_current < lowmem_limit;
-}
-
-int tiler_lowmem_init(dispatch_t *dpp)
-{
-#if _NTO_VERSION >= 660
- int code, coid;
- struct sigevent ev_lowmem;
-
- if((code = pulse_attach(dpp, MSG_FLAG_ALLOC_PULSE, 0, &tiler_lowmem, NULL)) == -1) {
- perror("tiler: Unable to setup lowmem event");
- return -1;
- }
-
- if ((coid = message_connect(dpp, MSG_FLAG_SIDE_CHANNEL)) == -1) {
- perror("tiler: Unable to connect to dpp channel");
- return -1;
- }
-
- SIGEV_PULSE_INIT(&ev_lowmem, coid, lowmem_pulse_prio, code, 0);
-
- lowmem_id = procmgr_value_notify_add(PROCMGR_VALUE_FREE_MEM|PROCMGR_VALUE_TRIGGER_DOWN|PROCMGR_VALUE_TRIGGER_UP, 0, lowmem_limit, &ev_lowmem);
- if ( lowmem_id == -1 ) {
- perror("tiler: Unable to register to low memory event");
- return -1;
- }
-#endif
- return 0;
-}
-
-int
-main(int argc, char *const argv[])
-{
- /* declare variables we'll be using */
- resmgr_attr_t resmgr_attr;
- dispatch_t *dpp;
- int id;
- int ret = 0;
- struct stat sbuf;
- thread_pool_attr_t tattr;
- thread_pool_t *tpool;
- sigset_t set;
- int32_t size = 0;
- int c;
- char *user_parm = NULL;
-
- while (1)
- {
- c = getopt (argc, argv, "S:L:U:");
- if (c == -1)
- break;
-
- switch (c)
- {
- case 'S':
- size = strtol (optarg, NULL, 0);
- break;
- case 'L':
- lowmem_limit = atoi(optarg) * 1024 * 1024;
- break;
- case 'U':
- user_parm = optarg;
- break;
- default:
- fprintf (stderr, "Unrecognized argument\n");
- }
- }
- /* Obtain I/O privity */
- ret = ThreadCtl_r (_NTO_TCTL_IO, 0);
- if (ret)
- {
- fprintf(stderr, "Unable to obtain I/O privity");
- return EXIT_FAILURE;
- }
-
- /* Only let one tiler run. */
- if (-1 != stat("/dev/tiler", &sbuf)) {
- return EXIT_FAILURE;
- }
-
- ret = tiler_init(size);
- if (ret) {
- fprintf(stderr, "tiler_init failed with status [%d]", ret);
- return EXIT_FAILURE;
- }
-
- /* initialize dispatch interface */
- if((dpp = dispatch_create()) == NULL) {
- fprintf(stderr,
- "%s: Unable to allocate dispatch handle.\n",
- argv[0]);
- return EXIT_FAILURE;
- }
-
- /* Initialize the thread pool */
- memset (&tattr, 0x00, sizeof (thread_pool_attr_t));
- tattr.handle = dpp;
- tattr.context_alloc = dispatch_context_alloc;
- tattr.context_free = dispatch_context_free;
- tattr.block_func = dispatch_block;
- tattr.unblock_func = dispatch_unblock;
- tattr.handler_func = dispatch_handler;
- tattr.lo_water = 2;
- tattr.hi_water = 8;
- tattr.increment = 1;
- tattr.maximum = 50;
-
- /* initialize resource manager attributes */
- memset(&resmgr_attr, 0, sizeof resmgr_attr);
- resmgr_attr.nparts_max = 10;
- resmgr_attr.msg_max_size = 16384;
- memset(&mattr, 0, sizeof(iofunc_mount_t));
- mattr.flags = 0;
- mattr.conf = IOFUNC_PC_CHOWN_RESTRICTED | IOFUNC_PC_NO_TRUNC | IOFUNC_PC_SYNC_IO;
- mattr.dev = 0;
- mattr.blocksize=0;
- mattr.funcs = &ocb_funcs;
- memset(&ocb_funcs, 0, sizeof(iofunc_funcs_t));
- ocb_funcs.nfuncs = _IOFUNC_NFUNCS;
- ocb_funcs.ocb_calloc = ocb_calloc;
- ocb_funcs.ocb_free = ocb_free;
- memset(&io_funcs, 0, sizeof(resmgr_io_funcs_t));
- iofunc_func_init(_RESMGR_CONNECT_NFUNCS, &connect_funcs, _RESMGR_IO_NFUNCS, &io_funcs);
- io_funcs.devctl = tiler_devctl;
- //io_funcs.mmap = tiler_mmap;
- io_funcs.read = tiler_read;
-
- iofunc_attr_init(&attr, S_IFNAM | 0777 , 0, 0);
- attr.mount = &mattr;
-
- if ( ( tpool = thread_pool_create(&tattr,0) ) == NULL )
- return EXIT_FAILURE;
-
- if (-1 != stat("/dev/tiler", &sbuf)) {
- return EXIT_FAILURE;
- }
-
- /* attach our device name */
- id = resmgr_attach(
- dpp, /* dispatch handle */
- &resmgr_attr, /* resource manager attrs */
- "/dev/tiler", /* device name */
- _FTYPE_ANY, /* open type */
- 0, /* flags */
- &connect_funcs, /* connect routines */
- &io_funcs, /* I/O routines */
- &attr); /* handle */
- if(id == -1) {
- fprintf(stderr, "%s: Unable to attach name.\n", argv[0]);
- return EXIT_FAILURE;
- }
-
- /* Setup low memory purger */
- tiler_lowmem_init(dpp);
-
- /* background the process */
- procmgr_daemon(0, PROCMGR_DAEMON_NOCLOSE|PROCMGR_DAEMON_NODEVNULL);
- thread_pool_start( tpool );
-
- /* Mask out unecessary signals */
- sigfillset (&set);
- sigdelset (&set, SIGINT);
- sigdelset (&set, SIGTERM);
- pthread_sigmask (SIG_BLOCK, &set, NULL);
-
- /* Wait for one of these signals */
- sigemptyset (&set);
- sigaddset (&set, SIGINT);
- sigaddset (&set, SIGQUIT);
- sigaddset (&set, SIGTERM);
-
-#if (_NTO_VERSION >= 800)
- /* Relinquish privileges */
- ret = procmgr_ability( 0,
- DENY_ALL | PROCMGR_AID_SPAWN,
- DENY_ALL | PROCMGR_AID_FORK,
- DENY_ALL | PROCMGR_AID_PROT_EXEC,
- PROCMGR_ADN_NONROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_MEM_PEER,
- PROCMGR_ADN_NONROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_MEM_PHYS,
- PROCMGR_ADN_NONROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_MEM_SPECIAL,
- PROCMGR_AID_EOL);
-
- if(ret != EOK) {
- fprintf(stderr, "procmgr_ability failed! errno=%d\n", ret);
- return EXIT_FAILURE;
- }
-
- /* Drop root privileges */
- if (user_parm != NULL) {
- if (set_ids_from_arg(user_parm) < 0) {
- fprintf(stderr, "unable to set uid/gid - %s\n", strerror(errno));
- return EXIT_FAILURE;
- }
- } else {
- // become nobody if nothing specified from command line
- if (setuid(99) != 0) {
- fprintf(stderr, "unable to set uid - %s\n", strerror(errno));
- }
- }
-#endif
-
- /* Wait for a signal */
- while (1)
- {
- switch (SignalWaitinfo (&set, NULL))
- {
- case SIGTERM:
- case SIGQUIT:
- case SIGINT:
- goto done;
- default:
- break;
- }
- }
-
-done:
- /* Received SIGTERM: clean up */
- resmgr_detach(dpp, id, _RESMGR_DETACH_ALL);
-
- tiler_exit();
-
- return 0;
-}
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/mmap_peer.c b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/mmap_peer.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * $QNXLicenseC$
-*/
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-/*
-* mmap_peer/munmap_peer implementation PR47400
-*/
-
-#include <unistd.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <sys/mman.h>
-#include <sys/memmsg.h>
-
-#include "proto.h"
-
-
-int memmgr_peer_sendnc( pid_t pid, int coid, void *smsg, size_t sbytes, void *rmsg, size_t rbytes )
-{
- mem_peer_t peer;
- iov_t siov[2];
-
- peer.i.type = _MEM_PEER;
- peer.i.peer_msg_len = sizeof(peer);
- peer.i.pid = pid;
-
- SETIOV(siov + 0, &peer, sizeof peer);
- SETIOV(siov + 1, smsg, sbytes);
- return MsgSendvsnc( coid, siov, 2, rmsg, rbytes );
-}
-
-void *
-_mmap2_peer(pid_t pid, void *addr, size_t len, int prot, int flags, int fd, off64_t off,
- unsigned align, unsigned pre_load, void **base, size_t *size) {
- mem_map_t msg;
-
- msg.i.type = _MEM_MAP;
- msg.i.zero = 0;
- msg.i.addr = (uintptr_t)addr;
- msg.i.len = len;
- msg.i.prot = prot;
- msg.i.flags = flags;
- msg.i.fd = fd;
- msg.i.offset = off;
- msg.i.align = align;
- msg.i.preload = pre_load;
- msg.i.reserved1 = 0;
- if(memmgr_peer_sendnc(pid, MEMMGR_COID, &msg.i, sizeof msg.i, &msg.o, sizeof msg.o) == -1) {
- return MAP_FAILED;
- }
- if(base) {
- *base = (void *)(uintptr_t)msg.o.real_addr;
- }
- if(size) {
- *size = msg.o.real_size;
- }
- return (void *)(uintptr_t)msg.o.addr;
-}
-
-
-void *
-mmap64_peer(pid_t pid, void *addr, size_t len, int prot, int flags, int fd, off64_t off) {
- return _mmap2_peer(pid, addr, len, prot, flags, fd, off, 0, 0, 0, 0);
-}
-
-
-// Make an unsigned version of the 'off_t' type so that we get a zero
-// extension down below.
-#if __OFF_BITS__ == 32
- typedef _Uint32t uoff_t;
-#elif __OFF_BITS__ == 64
- typedef _Uint64t uoff_t;
-#else
- #error Do not know what size to make uoff_t
-#endif
-
-void *
-mmap_peer(pid_t pid, void *addr, size_t len, int prot, int flags, int fd, off_t off) {
- return _mmap2_peer(pid, addr, len, prot, flags, fd, (uoff_t)off, 0, 0, 0, 0);
-}
-
-int
-munmap_flags_peer(pid_t pid, void *addr, size_t len, unsigned flags) {
- mem_ctrl_t msg;
-
- msg.i.type = _MEM_CTRL;
- msg.i.subtype = _MEM_CTRL_UNMAP;
- msg.i.addr = (uintptr_t)addr;
- msg.i.len = len;
- msg.i.flags = flags;
- return memmgr_peer_sendnc(pid, MEMMGR_COID, &msg.i, sizeof msg.i, 0, 0);
-}
-
-int
-munmap_peer(pid_t pid, void *addr, size_t len) {
- return munmap_flags_peer(pid, addr, len, 0);
-}
-
-int
-mem_offset64_peer(pid_t pid, const uintptr_t addr, size_t len,
- off64_t *offset, size_t *contig_len) {
- struct _peer_mem_off {
- struct _mem_peer peer;
- struct _mem_offset msg;
- };
- typedef union {
- struct _peer_mem_off i;
- struct _mem_offset_reply o;
- } memoffset_peer_t;
- memoffset_peer_t msg;
-
- msg.i.peer.type = _MEM_PEER;
- msg.i.peer.peer_msg_len = sizeof(msg.i.peer);
- msg.i.peer.pid = pid;
- msg.i.peer.reserved1 = 0;
-
- msg.i.msg.type = _MEM_OFFSET;
- msg.i.msg.subtype = _MEM_OFFSET_PHYS;
- msg.i.msg.addr = addr;
- msg.i.msg.reserved = -1;
- msg.i.msg.len = len;
- if(MsgSendnc(MEMMGR_COID, &msg.i, sizeof msg.i, &msg.o, sizeof msg.o) == -1) {
- return -1;
- }
- *offset = msg.o.offset;
- *contig_len = msg.o.size;
- return(0);
-}
-
-
-#if defined(__X86__)
-#define CPU_VADDR_SERVER_HINT 0x30000000u
-#elif defined(__ARM__)
-#define CPU_VADDR_SERVER_HINT 0x20000000u
-#else
-#error NO CPU SOUP FOR YOU!
-#endif
-
-/*
- * map the object into both client and server at the same virtual address
- */
-void *
-mmap64_join(pid_t pid, void *addr, size_t len, int prot, int flags, int fd, off64_t off) {
- void *svaddr, *cvaddr = MAP_FAILED;
- uintptr_t hint = (uintptr_t)addr;
- uintptr_t start_hint = hint;
-
- if ( hint == 0 ) hint = (uintptr_t)CPU_VADDR_SERVER_HINT;
-
- do {
- svaddr = mmap64( (void *)hint, len, prot, flags, fd, off );
- if ( svaddr == MAP_FAILED ) {
- break;
- }
- if ( svaddr == cvaddr ) {
- return svaddr;
- }
-
- cvaddr = mmap64_peer( pid, svaddr, len, prot, flags, fd, off );
- if ( cvaddr == MAP_FAILED ) {
- break;
- }
- if ( svaddr == cvaddr ) {
- return svaddr;
- }
-
- if ( munmap( svaddr, len ) == -1 ) {
- svaddr = MAP_FAILED;
- break;
- }
-
- svaddr = mmap64( cvaddr, len, prot, flags, fd, off );
- if ( svaddr == MAP_FAILED ) {
- break;
- }
- if ( svaddr == cvaddr ) {
- return svaddr;
- }
-
- if ( munmap( svaddr, len ) == -1 ) {
- svaddr = MAP_FAILED;
- break;
- }
- if ( munmap_peer( pid, cvaddr, len ) == -1 ) {
- cvaddr = MAP_FAILED;
- break;
- }
-
- hint += __PAGESIZE;
-
- } while(hint != start_hint); /* do we really want to wrap all the way */
-
- if ( svaddr != MAP_FAILED ) {
- munmap( svaddr, len );
- }
- if ( cvaddr != MAP_FAILED ) {
- munmap_peer( pid, cvaddr, len );
- }
- return MAP_FAILED;
-}
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/proto.h b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/proto.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-
-#ifndef _PROTO_H_INCLUDED
-#define _PROTO_H_INCLUDED
-
-struct _iofunc_attr;
-#define RESMGR_HANDLE_T struct _iofunc_attr
-struct tiler_ocb;
-#define IOFUNC_OCB_T struct tiler_ocb
-#define RESMGR_OCB_T struct tiler_ocb
-#define THREAD_POOL_PARAM_T dispatch_context_t
-
-#include <errno.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <atomic.h>
-#include <stdbool.h>
-#include <devctl.h>
-#include <fcntl.h>
-#include <stdint.h>
-#include <hw/inout.h>
-#include <sys/iofunc.h>
-#include <sys/dispatch.h>
-#include <sys/procmgr.h>
-#include <sys/mman.h>
-#include <sys/neutrino.h>
-#include <sys/siginfo.h>
-
-#include "tiler/tiler_devctl.h"
-#include "List.h"
-
-void *
-mmap64_peer(pid_t pid, void *addr, size_t len, int prot, int flags, int fd, off64_t off);
-void *
-mmap_peer(pid_t pid, void *addr, size_t len, int prot, int flags, int fd, off_t off);
-int
-munmap_peer(pid_t pid, void *addr, size_t len);
-int
-mem_offset64_peer(pid_t pid, const uintptr_t addr, size_t len,
- off64_t *offset, size_t *contig_len);
-
-typedef struct tiler_ocb {
- iofunc_ocb_t hdr;
- void *pi;
-} tiler_ocb_t;
-
-typedef struct tiler_dev {
- iofunc_attr_t hdr;
- dispatch_t *dpp;
- dispatch_context_t *ctp;
- int id;
- iofunc_notify_t notify[3];
- void *hdl;
- //struct blocking_notifier_head notifier;
-} tiler_dev_t;
-
-s32 tiler_init(u32 size);
-void tiler_exit(void);
-int tiler_islowmem(void);
-void tiler_purge(void);
-tiler_ocb_t * ocb_calloc (resmgr_context_t * ctp, IOFUNC_ATTR_T * device);
-void ocb_free (tiler_ocb_t * ocb);
-
-/* Over-ride alloc/free implementation */
-#define kmalloc(a,b) malloc(a)
-#define kzalloc(a,b) calloc(1,a)
-#define kfree(a) free(a)
-
-/* Over-ride mutex implementation */
-#define mutex_init(x) pthread_mutex_init(x, NULL)
-#define mutex_lock pthread_mutex_lock
-#define mutex_unlock pthread_mutex_unlock
-#define mutex_destroy pthread_mutex_destroy
-
-#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
-#define ALIGN(x, a) (((x) + ((typeof(x))(a) - 1)) & ~((typeof(x))(a) - 1))
-#define PAGE_ALIGN(a) (((a)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1)))
-
-/* Over-ride list implementation */
-struct list_head {
- struct list_head *prev;
- struct list_head *next;
-};
-#define list_add_tail(x, head) List_enqueue((List_Handle)head, (List_Elem *)x)
-#define list_add(x, head) List_enqueueHead((List_Handle)head, (List_Elem *)x)
-#define list_for_each_safe(a,b,c) List_traverse_safe(a,b,c)
-#define list_for_each_entry_safe(a,b,c,d) List_traverse_elem(a,b,c,d)
-#define list_entry(x,y,z) List_elem(x,y,z)
-#define list_del(x) List_remove(NULL,(List_Elem *)x)
-#define list_is_singular(x) List_is_singular((List_Handle)x)
-#define INIT_LIST_HEAD(x) List_elemClear((List_Elem *)x)
-#define LIST_HEAD(x) struct list_head x = { &(x), &(x) }
-#define list_empty(x) List_empty((List_Handle)x)
-#define list_empty_careful(x) List_empty((List_Handle)x)
-#define list_first_entry(ptr, type, member) List_elem((ptr)->next, type, member)
-#define list_move(x,y) List_move((List_Handle)y,(List_Elem *)x)
-
-/* Over-ride register read/write implementation */
-#define __raw_readl(x) *((volatile u32 *) (x))
-#define __raw_writel(x, y) *((volatile u32 *)(y))=x
-
-/* Over-ride mem barrier implementation */
-#define wmb __cpu_membarrier
-
-#endif
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/public/tiler/tiler_devctl.h b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/public/tiler/tiler_devctl.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-/*
- * tiler_devctl.h
- *
- * TILER driver support functions for TI OMAP processors.
- */
-
-#ifndef TILER_DEVCTL_H
-#define TILER_DEVCTL_H
-
-#include <errno.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <atomic.h>
-#include <stdbool.h>
-#include <devctl.h>
-#include <fcntl.h>
-#include <stdint.h>
-#include <hw/inout.h>
-#include <sys/dispatch.h>
-#include <sys/procmgr.h>
-#include <sys/mman.h>
-#include <sys/neutrino.h>
-#include <sys/siginfo.h>
-#include <sys/ioctl.h>
-#include <tiler/tiler_devctl_cmds.h>
-
-//#include "proto.h"
-
-typedef signed int s32;
-typedef unsigned int u32;
-typedef signed short s16;
-typedef unsigned short u16;
-typedef signed char s8;
-typedef unsigned char u8;
-typedef signed long long s64;
-typedef unsigned long long u64;
-
-#define TILER_MAX_NUM_BLOCKS 16
-
-enum tiler_fmt {
- TILFMT_MIN = -1,
- TILFMT_INVALID = -1,
- TILFMT_NONE = 0,
- TILFMT_8BIT = 1,
- TILFMT_16BIT = 2,
- TILFMT_32BIT = 3,
- TILFMT_PAGE = 4,
- TILFMT_MAX = 4
-};
-
-struct area {
- u16 width;
- u16 height;
-};
-
-struct tiler_block_info {
- enum tiler_fmt fmt;
- union {
- struct area area;
- u32 len;
- } dim;
- u32 stride;
- void *ptr;
- u32 ssptr;
-};
-
-struct tiler_buf_info {
- s32 num_blocks;
- struct tiler_block_info blocks[TILER_MAX_NUM_BLOCKS];
- s32 offset;
-};
-
-struct tiler_view_orient {
- u8 rotate_90;
- u8 x_invert;
- u8 y_invert;
-};
-
-struct tiler_mapx_info {
- enum tiler_fmt fmt;
- uint32_t width;
- uint32_t height;
- uint32_t gid;
- pid_t pid;
- uint32_t sys_addr;
- uint32_t usr_addr;
-};
-
-struct tiler_allocx_info {
- enum tiler_fmt fmt;
- uint32_t width;
- uint32_t height;
- uint32_t align;
- uint32_t offs;
- uint32_t gid;
- pid_t pid;
- uint32_t sys_addr;
-};
-
-struct tiler_alloc_block_area_info {
- enum tiler_fmt fmt;
- uint32_t width;
- uint32_t height;
- uint32_t gid;
- uint32_t sys_addr;
- uint32_t num_pages;
-};
-
-struct tiler_map_block_info {
- uint32_t sys_addr;
- uint32_t num_pages;
-};
-
-struct tiler_reservex_info {
- uint32_t n;
- struct tiler_buf_info b;
- pid_t pid;
-};
-
-struct tiler_allocp_info {
- int32_t count;
- enum tiler_fmt fmt;
- uint32_t width;
- uint32_t height;
- int32_t aligned;
-};
-
-struct tiler_allocpnv12_info {
- int32_t count;
- uint32_t width;
- uint32_t height;
- int32_t aligned;
-};
-
-struct tiler_reorient_info {
- uint32_t tsptr;
- struct tiler_view_orient orient;
-};
-
-struct tiler_reorient_tl_info {
- uint32_t tsptr;
- struct tiler_view_orient orient;
- uint32_t width;
- uint32_t height;
-};
-
-struct tiler_rotate_view_info {
- struct tiler_view_orient orient;
- uint32_t rotation;
-};
-
-struct tiler_regnotify_info {
- uint32_t cmd;
- char *name;
- uint32_t name_len;
-};
-
-struct tiler_regnotify_response {
- uint32_t event;
- pid_t pid;
-};
-
-#endif
-
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/public/tiler/tiler_devctl_cmds.h b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/public/tiler/tiler_devctl_cmds.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-/*
- * tiler_devctl_cmds.h
- *
- * TILER driver supported commands for TI OMAP processors.
- */
-
-#ifndef TILER_DEVCTL_CMDS_H
-#define TILER_DEVCTL_CMDS_H
-
-/* Event types */
-#define TILER_DEVICE_CLOSE 0
-
-#define TILIOC_BASE 100
-
-#define TILIOC_GBUF __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x00, struct tiler_block_info)
-#define TILIOC_FBUF __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x01, struct tiler_block_info)
-#define TILIOC_GSSP __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x02, uint32_t)
-#define TILIOC_MBUF __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x03, struct tiler_block_info)
-#define TILIOC_UMBUF __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x04, struct tiler_block_info)
-#define TILIOC_QBUF __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x05, struct tiler_buf_info)
-#define TILIOC_RBUF __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x06, struct tiler_buf_info)
-#define TILIOC_URBUF __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x07, struct tiler_buf_info)
-#define TILIOC_QUERY_BLK __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x08, struct tiler_block_info)
-#define TILIOC_MMAP __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x09, uint32_t)
-
-#define TILIOC_USRMX __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x0A, struct tiler_mapx_info)
-#define TILIOC_USRF __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x0B, uint32_t)
-#define TILIOC_USRGX __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x0C, struct tiler_allocx_info)
-#define TILIOC_USRRX __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x0D, struct tiler_reservex_info)
-#define TILIOC_USRGP __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x0E, struct tiler_allocp_info)
-#define TILIOC_USRGPNV12 __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x0F, struct tiler_allocpnv12_info)
-#define TILIOC_USRROA __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x10, struct tiler_reorient_info)
-#define TILIOC_USRGNA __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x11, uint32_t)
-#define TILIOC_USRROTL __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x12, struct tiler_reorient_tl_info)
-#define TILIOC_USRSTRIDE __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x13, uint32_t)
-#define TILIOC_USRRV __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x14, struct tiler_rotate_view_info)
-#define TILIOC_USRGPNV12OPT __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x15, struct tiler_allocpnv12_info)
-#define TILIOC_REGNOTIFY __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x16, struct tiler_regnotify_info)
-#define TILIOC_UNREGNOTIFY __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x17, struct tiler_regnotify_info)
-#define TILIOC_USRGB __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x19, struct tiler_alloc_block_area_info)
-#define TILIOC_USRFB __DIOTF(_DCMD_MISC, TILIOC_BASE + 0x1A, uint32_t)
-#define TILIOC_USRMB __DIOT(_DCMD_MISC, TILIOC_BASE + 0x1B, struct tiler_map_block_info)
-#define TILIOC_USRUMB __DIOT(_DCMD_MISC, TILIOC_BASE + 0x1C, uint32_t)
-
-#endif
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tcm/_tcm_sita.h b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tcm/_tcm_sita.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-/*
- * _tcm_sita.h
- *
- * SImple Tiler Allocator (SiTA) private structures.
- *
- * Author: Ravi Ramachandra <r.ramachandra@ti.com>
- */
-
-#ifndef _TCM_SITA_H_
-#define _TCM_SITA_H_
-
-#include "proto.h"
-#include "tcm.h"
-
-#define TL_CORNER 0
-#define TR_CORNER 1
-#define BL_CORNER 3
-#define BR_CORNER 4
-
-/*Provide inclusive length between co-ordinates */
-#define INCL_LEN(high, low) ((high) - (low) + 1)
-#define INCL_LEN_MOD(start, end) ((start) > (end) ? (start) - (end) + 1 : \
- (end) - (start) + 1)
-
-#define BOUNDARY(stat) ((stat)->top_boundary + (stat)->bottom_boundary + \
- (stat)->left_boundary + (stat)->right_boundary)
-#define OCCUPIED(stat) ((stat)->top_occupied + (stat)->bottom_occupied + \
- (stat)->left_occupied + (stat)->right_occupied)
-
-enum Criteria {
- CR_MAX_NEIGHS = 0x01,
- CR_FIRST_FOUND = 0x10,
- CR_BIAS_HORIZONTAL = 0x20,
- CR_BIAS_VERTICAL = 0x40,
- CR_DIAGONAL_BALANCE = 0x80
-};
-
-struct nearness_factor {
- s32 x;
- s32 y;
-};
-
-/*
- * Area info kept
- */
-struct area_spec {
- struct tcm_area area;
- struct list_head list;
-};
-
-/*
- * Everything is a rectangle with four sides and on
- * each side you could have a boundary or another Tile.
- * The tile could be Occupied or Not. These info is stored
- */
-struct neighbour_stats {
- u16 left_boundary;
- u16 left_occupied;
- u16 top_boundary;
- u16 top_occupied;
- u16 right_boundary;
- u16 right_occupied;
- u16 bottom_boundary;
- u16 bottom_occupied;
-};
-
-struct slot {
- u8 busy; /* is slot occupied */
- struct tcm_area parent; /* parent area */
- u32 reserved;
-};
-
-struct sita_pvt {
- u16 width;
- u16 height;
- struct list_head res; /* all allocations */
- //struct mutex mtx;
- pthread_mutex_t mtx;
- struct tcm_pt div_pt; /* divider point splitting container */
- struct slot **map; /* container slots */
-};
-
-#endif /* _TCM_SITA_H_ */
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tcm/tcm.h b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tcm/tcm.h
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-/*
- * tcm.h
- *
- * TILER container manager specification and support functions for TI
- * processors.
- */
-
-#ifndef _TCM_H_
-#define _TCM_H_
-#if 0
-#include <linux/init.h>
-#include <linux/module.h>
-#endif
-#include "proto.h"
-
-struct tcm;
-
-struct tcm_pt {
- u16 x;
- u16 y;
-};
-
-struct tcm_area {
- bool is2d; /* whether are is 1d or 2d */
- 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 (*reserve_1d)(struct tcm *tcm, u32 slots, struct tcm_area *area);
- s32 (*free) (struct tcm *tcm, struct tcm_area *area);
- s32 (*get_parent)(struct tcm *tcm, struct tcm_pt *pt,
- struct tcm_area *area);
- void (*deinit) (struct tcm *tcm);
-};
-
-/*=============================================================================
- BASIC TILER CONTAINER MANAGER INTERFACE
-=============================================================================*/
-
-/*
- * NOTE:
- *
- * 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.
- *
- * @param width Width of container
- * @param height Height of container
- * @param attr Container manager specific configuration
- * arguments. Please describe these in
- * your header file.
- *
- * @return 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.
- *
- * @author Ravi Ramachandra (3/1/2010)
- *
- * @param tcm Pointer to container manager.
- *
- * @return 0 on success, non-0 error value on error. 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.
- *
- * @author Ravi Ramachandra (3/1/2010)
- *
- * @param tcm Pointer to container manager.
- * @param height Height(in pages) of area to be reserved.
- * @param width Width(in pages) of area to be reserved.
- * @param align Alignment requirement for top-left corner of area. Not
- * all values may be supported by the container manager,
- * but it must support 0 (1), 32 and 64.
- * 0 value is equivalent to 1.
- * @param area Pointer to where the reserved area should be stored.
- *
- * @return 0 on success. Non-0 error code on failure. Also,
- * 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 ? -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;
-}
-
-/**
- * Reserves a 1D area in the container.
- *
- * @author Ravi Ramachandra (3/1/2010)
- *
- * @param tcm Pointer to container manager.
- * @param slots Number of (contiguous) slots to reserve.
- * @param area Pointer to where the reserved area should be stored.
- *
- * @return 0 on success. Non-0 error code on failure. Also,
- * 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_1d(struct tcm *tcm, u32 slots,
- struct tcm_area *area)
-{
- /* perform rudimentary error checking */
- s32 res = (tcm == NULL ? -ENODEV :
- area == NULL ? -EINVAL :
- slots > (tcm->width * (u32) tcm->height) ? -ENOMEM :
- tcm->reserve_1d(tcm, slots, area));
-
- if (area)
- area->tcm = res ? NULL : tcm;
-
- return res;
-}
-
-/**
- * Free a previously reserved area from the container.
- *
- * @author Ravi Ramachandra (3/1/2010)
- *
- * @param area Pointer to area reserved by a prior call to
- * tcm_reserve_1d or tcm_reserve_2d call, whether
- * it was successful or not. (Note: all fields of
- * the structure must match.)
- *
- * @return 0 on success. Non-0 error code on failure. Also, 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;
-}
-
-
-/**
- * Retrieves the parent area (1D or 2D) for a given co-ordinate in the
- * container.
- *
- * @author Ravi Ramachandra (3/1/2010)
- *
- * @param tcm Pointer to container manager.
- * @param pt Pointer to the coordinates of a slot in the container.
- * @param area Pointer to where the reserved area should be stored.
- *
- * @return 0 on success. Non-0 error code on failure. Also,
- * the tcm field of the area will be set to NULL on
- * failure. Some error codes: -ENODEV: invalid manager,
- * -EINVAL: invalid area, -ENOENT: coordinate is not part of any
- * active area.
- */
-static inline s32 tcm_get_parent(struct tcm *tcm, struct tcm_pt *pt,
- struct tcm_area *area)
-{
- s32 res = (tcm == NULL ? -ENODEV :
- area == NULL ? -EINVAL :
- (pt->x >= tcm->width || pt->y >= tcm->height) ? -ENOENT :
- tcm->get_parent(tcm, pt, area));
-
- if (area)
- area->tcm = res ? NULL : tcm;
-
- return res;
-}
-
-/*=============================================================================
- HELPER FUNCTION FOR ANY TILER CONTAINER MANAGER
-=============================================================================*/
-
-/**
- * This method slices off the topmost 2D slice from the parent area, and stores
- * it in the 'slice' parameter. The 'parent' parameter will get modified to
- * contain the remaining portion of the area. If the whole parent area can
- * fit in a 2D slice, its tcm pointer is set to NULL to mark that it is no
- * longer a valid area.
- *
- * @author Lajos Molnar (3/17/2010)
- *
- * @param parent Pointer to a VALID parent area that will get modified
- * @param slice Pointer to the slice area that will get modified
- */
-static inline void tcm_slice(struct tcm_area *parent, struct tcm_area *slice)
-{
- *slice = *parent;
-
- /* check if we need to slice */
- if (slice->tcm && !slice->is2d &&
- slice->p0.y != slice->p1.y &&
- (slice->p0.x || (slice->p1.x != slice->tcm->width - 1))) {
- /* set end point of slice (start always remains) */
- slice->p1.x = slice->tcm->width - 1;
- slice->p1.y = (slice->p0.x) ? slice->p0.y : slice->p1.y - 1;
- /* adjust remaining area */
- parent->p0.x = 0;
- parent->p0.y = slice->p1.y + 1;
- } else {
- /* mark this as the last slice */
- parent->tcm = NULL;
- }
-}
-
-/**
- * Verifies if a tcm area is logically valid.
- *
- * @param area Pointer to tcm area
- *
- * @return TRUE if area is logically valid, FALSE otherwise.
- */
-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 &&
- /* 1D coordinate relationship + p0.x check */
- ((!area->is2d &&
- area->p0.x < area->tcm->width &&
- area->p0.x + area->p0.y * area->tcm->width <=
- area->p1.x + area->p1.y * area->tcm->width) ||
- /* 2D coordinate relationship */
- (area->is2d &&
- 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)
-{
- u16 i;
-
- if (a->is2d) {
- return p->x >= a->p0.x && p->x <= a->p1.x &&
- p->y >= a->p0.y && p->y <= a->p1.y;
- } else {
- i = p->x + p->y * a->tcm->width;
- return i >= a->p0.x + a->p0.y * a->tcm->width &&
- i <= a->p1.x + a->p1.y * a->tcm->width;
- }
-}
-
-/* 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 area->is2d ?
- __tcm_area_width(area) * __tcm_area_height(area) :
- (area->p1.x - area->p0.x + 1) + (area->p1.y - area->p0.y) *
- area->tcm->width;
-}
-#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))
-
-/**
- * Iterate through 2D slices of a valid area. Behaves
- * syntactically as a for(;;) statement.
- *
- * @param var Name of a local variable of type 'struct
- * tcm_area *' that will get modified to
- * contain each slice.
- * @param area Pointer to the VALID parent area. This
- * structure will not get modified
- * throughout the loop.
- *
- */
-#define tcm_for_each_slice(var, area, safe) \
- for (safe = area, \
- tcm_slice(&safe, &var); \
- var.tcm; tcm_slice(&safe, &var))
-
-#endif /* _TCM_H_ */
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tcm/tcm_sita.c b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tcm/tcm_sita.c
+++ /dev/null
@@ -1,1378 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-/*
- * tcm_sita.c
- *
- * Author: Ravi Ramachandra <r.ramachandra@ti.com>
- *
- * SImple Tiler Allocator (SiTA): 2D and 1D allocation(reservation) algorithm
- *
- */
-#include "../proto.h"
-#include "_tcm_sita.h"
-#include "tcm_sita.h"
-
-#define TCM_ALG_NAME "tcm_sita"
-#include "tcm_utils.h"
-
-#define X_SCAN_LIMITER 1
-#define Y_SCAN_LIMITER 1
-
-#define ALIGN_DOWN(value, align) ((value) & ~((align) - 1))
-
-/* Individual selection criteria for different scan areas */
-static s32 CR_L2R_T2B = CR_BIAS_HORIZONTAL;
-static s32 CR_R2L_T2B = CR_DIAGONAL_BALANCE;
-#ifdef SCAN_BOTTOM_UP
-static s32 CR_R2L_B2T = CR_FIRST_FOUND;
-static s32 CR_L2R_B2T = CR_DIAGONAL_BALANCE;
-#endif
-
-/*********************************************
- * TCM API - Sita Implementation
- *********************************************/
-static s32 sita_reserve_2d(struct tcm *tcm, u16 h, u16 w, u8 align,
- struct tcm_area *area);
-static s32 sita_reserve_1d(struct tcm *tcm, u32 slots, struct tcm_area
- *area);
-static s32 sita_free(struct tcm *tcm, struct tcm_area *to_be_removed_area);
-static s32 sita_get_parent(struct tcm *tcm, struct tcm_pt *pt,
- struct tcm_area *area);
-static void sita_deinit(struct tcm *tcm);
-
-/*********************************************
- * Main Scanner functions
- *********************************************/
-static s32 scan_areas_and_find_fit(struct tcm *tcm, u16 w, u16 h, u16 stride,
- struct tcm_area *area);
-
-static s32 scan_l2r_t2b(struct tcm *tcm, u16 w, u16 h, u16 stride,
- struct tcm_area *field, struct tcm_area *area);
-
-static s32 scan_r2l_t2b(struct tcm *tcm, u16 w, u16 h, u16 stride,
- struct tcm_area *field, struct tcm_area *area);
-
-#ifdef SCAN_BOTTOM_UP
-static s32 scan_l2r_b2t(struct tcm *tcm, u16 w, u16 h, u16 stride,
- struct tcm_area *field, struct tcm_area *area);
-
-static s32 scan_r2l_b2t(struct tcm *tcm, u16 w, u16 h, u16 stride,
- struct tcm_area *field, struct tcm_area *area);
-#endif
-static s32 scan_r2l_b2t_one_dim(struct tcm *tcm, u32 num_pages,
- struct tcm_area *field, struct tcm_area *area);
-
-/*********************************************
- * Support Infrastructure Methods
- *********************************************/
-static s32 check_fit_r_and_b(struct tcm *tcm, u16 w, u16 h, u16 left_x,
- u16 top_y);
-
-static s32 check_fit_r_one_dim(struct tcm *tcm, u16 x, u16 y, u32 num_pages,
- u16 *busy_x, u16 *busy_y);
-
-static void select_candidate(struct tcm *tcm, u16 w, u16 h,
- struct list_head *maybes, struct tcm_area *field,
- s32 criteria, struct tcm_area *area);
-
-static void get_nearness_factor(struct tcm_area *field,
- struct tcm_area *candidate, struct nearness_factor *nf);
-
-static s32 get_busy_neigh_stats(struct tcm *tcm, u16 width, u16 height,
- struct tcm_area *top_left_corner,
- struct neighbour_stats *neighbour_stat);
-
-static void fill_1d_area(struct tcm *tcm,
- struct tcm_area *area, struct slot slot);
-
-static void fill_2d_area(struct tcm *tcm,
- struct tcm_area *area, struct slot slot);
-
-static s32 move_left(struct tcm *tcm, u16 x, u16 y, u32 num_pages,
- u16 *xx, u16 *yy);
-static s32 move_right(struct tcm *tcm, u16 x, u16 y, u32 num_pages,
- u16 *xx, u16 *yy);
-/*********************************************/
-
-/*********************************************
- * Utility Methods
- *********************************************/
-
-/* TODO: check if element allocation succeeded */
-
-/* insert a given area at the end of a given list */
-static
-struct area_spec *insert_element(struct list_head *head, struct tcm_area *area)
-{
- struct area_spec *elem;
-
- elem = kmalloc(sizeof(*elem), GFP_KERNEL);
- if (elem) {
- elem->area = *area;
- list_add_tail(&elem->list, head);
- }
- return elem;
-}
-
-static
-s32 rem_element_with_match(struct list_head *head,
- struct tcm_area *area, u16 *is2d)
-{
- struct area_spec *elem = NULL, *tmp = NULL;
-
- /*If the area to be removed matchs the list head itself,
- we need to put the next one as list head */
- list_for_each_entry_safe(elem, tmp, head, list) {
- if (elem->area.p0.x == area->p0.x
- && elem->area.p0.y == area->p0.y
- && elem->area.p1.x == area->p1.x
- && elem->area.p1.y == area->p1.y) {
-
- *is2d = elem->area.is2d;
- list_del(&elem->list);
-
- kfree(elem);
- return 0;
- }
- }
- return -ENOENT;
-}
-
-static
-void clean_list(struct list_head *head)
-{
- struct area_spec *elem = NULL, *elem_ = NULL;
-
- list_for_each_entry_safe(elem, elem_, head, list) {
- list_del(&elem->list);
- kfree(elem);
- }
-}
-
-#if 0
-static
-void dump_list_entries(struct list_head *head)
-{
- struct area_spec *elem = NULL, *tmp = NULL;
-
- P1("Printing List Entries:\n");
-
- list_for_each_entry_safe(elem, tmp, head, list) {
- fprintf(stderr, "%dD:" AREA_FMT "\n", elem->area.type,
- AREA(elem->area));
- }
-
- P1("List Finished\n");
-}
-
-static
-s32 dump_neigh_stats(struct neighbour_stats *neighbour)
-{
- P1("Top Occ:Boundary %d:%d\n", neighbour->top_occupied,
- neighbour->top_boundary);
- P1("Bot Occ:Boundary %d:%d\n", neighbour->bottom_occupied,
- neighbour->bottom_boundary);
- P1("Left Occ:Boundary %d:%d\n", neighbour->left_occupied,
- neighbour->left_boundary);
- P1("Rigt Occ:Boundary %d:%d\n", neighbour->right_occupied,
- neighbour->right_boundary);
- return 0;
-}
-#endif
-
-struct tcm *sita_init(u16 width, u16 height, struct tcm_pt *attr)
-{
- struct tcm *tcm = NULL;
- struct sita_pvt *pvt = NULL;
- struct slot init_tile = {0};
- struct tcm_area area = {0};
- s32 i = 0;
-
- if (width == 0 || height == 0)
- goto error;
-
- tcm = kmalloc(sizeof(*tcm), GFP_KERNEL);
- pvt = kmalloc(sizeof(*pvt), GFP_KERNEL);
- if (!tcm || !pvt)
- goto error;
-
- memset(tcm, 0, sizeof(*tcm));
- memset(pvt, 0, sizeof(*pvt));
-
- /* Updating the pointers to SiTA implementation APIs */
- tcm->height = height;
- tcm->width = width;
- tcm->reserve_2d = sita_reserve_2d;
- tcm->reserve_1d = sita_reserve_1d;
- tcm->get_parent = sita_get_parent;
- tcm->free = sita_free;
- tcm->deinit = sita_deinit;
- tcm->pvt = (void *)pvt;
-
- INIT_LIST_HEAD(&pvt->res);
- pvt->height = height;
- pvt->width = width;
-
- mutex_init(&(pvt->mtx));
-
- /* Creating tam map */
- pvt->map = kmalloc(sizeof(*pvt->map) * pvt->width, GFP_KERNEL);
-
- if (!pvt->map)
- goto error;
-
- for (i = 0; i < pvt->width; i++) {
- pvt->map[i] =
- kmalloc(sizeof(**pvt->map) * pvt->height,
- GFP_KERNEL);
- if (pvt->map[i] == NULL) {
- while (i--)
- kfree(pvt->map[i]);
- kfree(pvt->map);
- goto error;
- }
- }
-
- if (attr && attr->x <= pvt->width && attr->y <= pvt->height) {
- pvt->div_pt.x = attr->x;
- pvt->div_pt.y = attr->y;
-
- } else {
- /* Defaulting to 3:1 ratio on width for 2D area split */
- /* Defaulting to 3:1 ratio on height for 2D and 1D split */
- pvt->div_pt.x = (pvt->width * 3) / 4;
- pvt->div_pt.y = (pvt->height * 3) / 4;
- }
-
- area.p1.x = width - 1;
- area.p1.y = height - 1;
-
- mutex_lock(&(pvt->mtx));
- fill_2d_area(tcm, &area, init_tile);
- mutex_unlock(&(pvt->mtx));
- return tcm;
-
-error:
- kfree(tcm);
- kfree(pvt);
- return NULL;
-}
-
-static void sita_deinit(struct tcm *tcm)
-{
- struct slot init_tile = {0};
- struct sita_pvt *pvt = NULL;
- struct tcm_area area = {0};
- s32 i = 0;
-
- pvt = (struct sita_pvt *)tcm->pvt;
- if (pvt) {
- area.p1.x = pvt->width - 1;
- area.p1.y = pvt->height - 1;
-
- mutex_lock(&(pvt->mtx));
- fill_2d_area(tcm, &area, init_tile);
- mutex_unlock(&(pvt->mtx));
-
- mutex_destroy(&(pvt->mtx));
-
- for (i = 0; i < pvt->height; i++) {
- kfree(pvt->map[i]);
- pvt->map[i] = NULL;
- }
- kfree(pvt->map);
- pvt->map = NULL;
- kfree(pvt);
- }
-}
-
-/**
- * @description: Allocate 1d pages if the required number of pages are
- * available in the container
- *
- * @input:num_pages to be allocated
- *
- * @return 0 on success, non-0 error value on failure. On success
- * area contain co-ordinates of start and end Tiles(inclusive)
- */
-static s32 sita_reserve_1d(struct tcm *tcm, u32 num_pages,
- struct tcm_area *area)
-{
- s32 ret = 0;
- struct tcm_area field = {0};
- struct slot slot = {0};
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
-
- area->is2d = false;
-
- mutex_lock(&(pvt->mtx));
-#ifdef RESTRICT_1D
- /* scan within predefined 1D boundary */
- assign(&field, pvt->width - 1, pvt->height - 1, 0, pvt->div_pt.y);
-#else
- /* Scanning entire container */
- assign(&field, pvt->width - 1, pvt->height - 1, 0, 0);
-#endif
- ret = scan_r2l_b2t_one_dim(tcm, num_pages,
- &field, area);
- /* There is not much to select, we pretty much give the first one
- which accomodates */
- if (!ret) {
- slot.busy = true;
- slot.parent = *area;
- /* inserting into tiler container */
- fill_1d_area(tcm, area, slot);
- /* updating the list of allocations */
- insert_element(&pvt->res, area);
- }
- mutex_unlock(&(pvt->mtx));
- return ret;
-}
-
-/**
- * @description: Allocate 2d area on availability in the container
- *
- * @input:'w'idth and 'h'eight of the 2d area, 'align'ment specification
- *
- * @return 0 on success, non-0 error value on failure. On success
- * area contain co-ordinates of TL corner Tile and BR corner Tile of
- * the rectangle (inclusive)
- */
-static s32 sita_reserve_2d(struct tcm *tcm, u16 h, u16 w, u8 align,
- struct tcm_area *area)
-{
- s32 ret = 0;
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
- /* we only support 1, 32 and 64 as alignment */
- u16 stride = align <= 1 ? 1 : align <= 32 ? 32 : 64;
- struct slot slot = {0};
-
- area->is2d = true;
-
- /* align must be 2 power */
- if (align & (align - 1) || align > 64)
- return -EINVAL;
-
- mutex_lock(&(pvt->mtx));
- ret = scan_areas_and_find_fit(tcm, w, h, stride, area);
- if (!ret) {
- slot.busy = true;
- slot.parent = *area;
-
- fill_2d_area(tcm, area, slot);
- insert_element(&(pvt->res), area);
- }
- mutex_unlock(&(pvt->mtx));
- return ret;
-}
-
-/**
- * @description: unreserve 2d or 1D allocations if previously allocated
- *
- * @input:'area' specification: for 2D this should contain
- * TL Corner and BR Corner of the 2D area, or for 1D allocation this should
- * contain the start and end Tiles
- *
- * @return 0 on success, non-0 error value on failure. On success
- * the to_be_removed_area is removed from g_allocation_list and the
- * corresponding tiles are marked 'NOT_OCCUPIED'
- *
- */
-static s32 sita_free(struct tcm *tcm, struct tcm_area *area)
-{
- s32 ret = 0;
- struct slot slot = {0};
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
- u16 is2d;
-
- slot.busy = false;
- mutex_lock(&(pvt->mtx));
- /*First we check if the given Area is aleast valid in our list*/
- ret = rem_element_with_match(&(pvt->res), area, &is2d);
-
- /* If we found a positive match & removed the area details from list
- * then we clear the contents of the associated tiles in the global
- * container*/
- if (!ret) {
- if (is2d)
- fill_2d_area(tcm, area, slot);
- else
- fill_1d_area(tcm, area, slot);
- }
- mutex_unlock(&(pvt->mtx));
- return ret;
-}
-
-/**
- * @description: raster scan right to left from top to bottom; find if there is
- * a free area to fit a given w x h inside the 'scan area'. If there is a free
- * area, then adds to maybes candidates, which later is sent for selection
- * as per pre-defined criteria.
- *
- * @input:'w x h' width and height of the allocation area.
- * 'stride' - 64/32/None for start address alignment
- * 'field' - area in which the scan operation should take place
- *
- * @return 0 on success, non-0 error value on failure. On success
- * the 'area' area contains TL and BR corners of the allocated area
- *
- */
-static s32 scan_r2l_t2b(struct tcm *tcm, u16 w, u16 h, u16 stride,
- struct tcm_area *field, struct tcm_area *area)
-{
- s32 xx = 0, yy = 0;
- s16 start_x = -1, end_x = -1, start_y = -1, end_y = -1;
- s16 found_x = -1, found_y = -1;
- LIST_HEAD(maybes);
- struct tcm_area candidate = {0};
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
-
- PA(2, "scan_r2l_t2b:", field);
-
- start_x = field->p0.x;
- end_x = field->p1.x;
- start_y = field->p0.y;
- end_y = field->p1.y;
-
- /* check scan area co-ordinates */
- if (field->p0.x < field->p1.x ||
- field->p1.y < field->p0.y)
- return -EINVAL;
-
- /* check if allocation would fit in scan area */
- if (w > INCL_LEN(start_x, end_x) || h > INCL_LEN(end_y, start_y))
- return -ENOSPC;
-
- /* adjust start_x and end_y, as allocation would not fit beyond */
- start_x = ALIGN_DOWN(start_x - w + 1, stride); /* - 1 to be inclusive */
- end_y = end_y - h + 1;
-
- /* check if allocation would still fit in scan area */
- if (start_x < end_x)
- return -ENOSPC;
-
- P2("ali=%d x=%d..%d y=%d..%d", stride, start_x, end_x, start_y, end_y);
-
- /*
- * Start scanning: These scans are always inclusive ones so if we are
- * given a start x = 0 is a valid value so if we have a end_x = 255,
- * 255th element is also checked
- */
- for (yy = start_y; yy <= end_y; yy++) {
- for (xx = start_x; xx >= end_x; xx -= stride) {
- if (!pvt->map[xx][yy].busy) {
- if (check_fit_r_and_b(tcm, w, h, xx, yy)) {
- P3("found shoulder: %d,%d", xx, yy);
- found_x = xx;
- found_y = yy;
- /* Insert this candidate, it is just a
- co-ordinate, reusing Area */
- assign(&candidate, xx, yy, 0, 0);
- insert_element(&maybes, &candidate);
-#ifdef X_SCAN_LIMITER
- /* change upper x bound */
- end_x = xx + 1;
-#endif
- break;
- }
- } else {
- /* Optimization required only for Non Aligned,
- Aligned anyways skip by 32/64 tiles at a time */
- if (stride == 1 &&
- pvt->map[xx][yy].parent.is2d) {
- xx = pvt->map[xx][yy].parent.p0.x;
- P3("moving to: %d,%d", xx, yy);
- }
- }
- }
-
- /* if you find a free area shouldering the given scan area on
- then we can break */
-#ifdef Y_SCAN_LIMITER
- if (found_x == start_x)
- break;
-#endif
- }
-
- if (list_empty(&maybes))
- return -ENOSPC;
-
- select_candidate(tcm, w, h, &maybes, field, CR_R2L_T2B, area);
- /* dump_list_entries(maybes); */
- clean_list(&maybes);
- return 0;
-}
-
-#ifdef SCAN_BOTTOM_UP
-/**
- * @description: raster scan right to left from bottom to top; find if there is
- * a free area to fit a given w x h inside the 'scan area'. If there is a free
- * area, then adds to maybes candidates, which later is sent for selection
- * as per pre-defined criteria.
- *
- * @input:'w x h' width and height of the allocation area.
- * 'stride' - 64/32/None for start address alignment
- * 'field' - area in which the scan operation should take place
- *
- * @return 0 on success, non-0 error value on failure. On success
- * the 'area' area contains TL and BR corners of the allocated area
- *
- */
-static s32 scan_r2l_b2t(struct tcm *tcm, u16 w, u16 h, u16 stride,
- struct tcm_area *field, struct tcm_area *area)
-{
- /* TODO: Should I check scan area?
- * Might have to take it as input during initialization
- */
- s32 xx = 0, yy = 0;
- s16 start_x = -1, end_x = -1, start_y = -1, end_y = -1;
- s16 found_x = -1, found_y = -1;
- LIST_HEAD(maybes);
- struct tcm_area candidate = {0};
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
-
- PA(2, "scan_r2l_b2t:", field);
-
- start_x = field->p0.x;
- end_x = field->p1.x;
- start_y = field->p0.y;
- end_y = field->p1.y;
-
- /* check scan area co-ordinates */
- if (field->p1.x < field->p0.x ||
- field->p1.y < field->p0.y)
- return -EINVAL;
-
- /* check if allocation would fit in scan area */
- if (w > INCL_LEN(start_x, end_x) || h > INCL_LEN(start_y, end_y))
- return -ENOSPC;
-
- /* adjust start_x and start_y, as allocation would not fit beyond */
- start_x = ALIGN_DOWN(start_x - w + 1, stride); /* + 1 to be inclusive */
- start_y = start_y - h + 1;
-
- /* check if allocation would still fit in scan area */
- if (start_x < end_x)
- return -ENOSPC;
-
- P2("ali=%d x=%d..%d y=%d..%d", stride, start_x, end_x, start_y, end_y);
-
- /*
- * Start scanning: These scans are always inclusive ones so if we are
- * given a start x = 0 is a valid value so if we have a end_x = 255,
- * 255th element is also checked
- */
- for (yy = start_y; yy >= end_y; yy--) {
- for (xx = start_x; xx >= end_x; xx -= stride) {
- if (!pvt->map[xx][yy].busy) {
- if (check_fit_r_and_b(tcm, w, h, xx, yy)) {
- P3("found shoulder: %d,%d", xx, yy);
- found_x = xx;
- found_y = yy;
- /* Insert this candidate, it is just a
- co-ordinate, reusing Area */
- assign(&candidate, xx, yy, 0, 0);
- insert_element(&maybes, &candidate);
-#ifdef X_SCAN_LIMITER
- /* change upper x bound */
- end_x = xx + 1;
-#endif
- break;
- }
- } else {
- /* Optimization required only for Non Aligned,
- Aligned anyways skip by 32/64 tiles at a time */
- if (stride == 1 &&
- pvt->map[xx][yy].parent.is2d) {
- xx = pvt->map[xx][yy].parent.p0.x;
- P3("moving to: %d,%d", xx, yy);
- }
- }
-
- }
-
- /* if you find a free area shouldering the given scan area on
- then we can break */
-#ifdef Y_SCAN_LIMITER
- if (found_x == start_x)
- break;
-#endif
- }
-
- if (list_empty(&maybes))
- return -ENOSPC;
-
- select_candidate(tcm, w, h, &maybes, field, CR_R2L_B2T, area);
- /* dump_list_entries(maybes); */
- clean_list(&maybes);
- return 0;
-}
-#endif
-
-/**
- * @description: raster scan left to right from top to bottom; find if there is
- * a free area to fit a given w x h inside the 'scan area'. If there is a free
- * area, then adds to maybes candidates, which later is sent for selection
- * as per pre-defined criteria.
- *
- * @input:'w x h' width and height of the allocation area.
- * 'stride' - 64/32/None for start address alignment
- * 'field' - area in which the scan operation should take place
- *
- * @return 0 on success, non-0 error value on failure. On success
- * the 'area' area contains TL and BR corners of the allocated area
- *
- */
-s32 scan_l2r_t2b(struct tcm *tcm, u16 w, u16 h, u16 stride,
- struct tcm_area *field, struct tcm_area *area)
-{
- s32 xx = 0, yy = 0;
- s16 start_x = -1, end_x = -1, start_y = -1, end_y = -1;
- s16 found_x = -1, found_y = -1;
- LIST_HEAD(maybes);
- struct tcm_area candidate = {0};
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
-
- PA(2, "scan_l2r_t2b:", field);
-
- start_x = field->p0.x;
- end_x = field->p1.x;
- start_y = field->p0.y;
- end_y = field->p1.y;
-
- /* check scan area co-ordinates */
- if (field->p1.x < field->p0.x ||
- field->p1.y < field->p0.y)
- return -EINVAL;
-
- /* check if allocation would fit in scan area */
- if (w > INCL_LEN(end_x, start_x) || h > INCL_LEN(end_y, start_y))
- return -ENOSPC;
-
- start_x = ALIGN(start_x, stride);
-
- /* check if allocation would still fit in scan area */
- if (w > INCL_LEN(end_x, start_x))
- return -ENOSPC;
-
- /* adjust end_x and end_y, as allocation would not fit beyond */
- end_x = end_x - w + 1; /* + 1 to be inclusive */
- end_y = end_y - h + 1;
-
- P2("ali=%d x=%d..%d y=%d..%d", stride, start_x, end_x, start_y, end_y);
-
- /*
- * Start scanning: These scans are always inclusive ones so if we are
- * given a start x = 0 is a valid value so if we have a end_x = 255,
- * 255th element is also checked
- */
- for (yy = start_y; yy <= end_y; yy++) {
- for (xx = start_x; xx <= end_x; xx += stride) {
- /* if NOT occupied */
- if (!pvt->map[xx][yy].busy) {
- if (check_fit_r_and_b(tcm, w, h, xx, yy)) {
- P3("found shoulder: %d,%d", xx, yy);
- found_x = xx;
- found_y = yy;
- /* Insert this candidate, it is just a
- co-ordinate, reusing Area */
- assign(&candidate, xx, yy, 0, 0);
- insert_element(&maybes, &candidate);
-#ifdef X_SCAN_LIMITER
- /* change upper x bound */
- end_x = xx - 1;
-#endif
- break;
- }
- } else {
- /* Optimization required only for Non Aligned,
- Aligned anyways skip by 32/64 tiles at a time */
- if (stride == 1 &&
- pvt->map[xx][yy].parent.is2d) {
- xx = pvt->map[xx][yy].parent.p1.x;
- P3("moving to: %d,%d", xx, yy);
- }
- }
- }
- /* if you find a free area shouldering the given scan area on
- then we can break */
-#ifdef Y_SCAN_LIMITER
- if (found_x == start_x)
- break;
-#endif
- }
-
- if (list_empty(&maybes))
- return -ENOSPC;
-
- select_candidate(tcm, w, h, &maybes, field, CR_L2R_T2B, area);
- /* dump_list_entries(maybes); */
- clean_list(&maybes);
- return 0;
-}
-
-#ifdef SCAN_BOTTOM_UP
-/**
- * @description: raster scan left to right from bottom to top; find if there is
- * a free area to fit a given w x h inside the 'scan area'. If there is a free
- * area, then adds to maybes candidates, which later is sent for selection
- * as per pre-defined criteria.
- *
- * @input:'w x h' width and height of the allocation area.
- * 'stride' - 64/32/None for start address alignment
- * 'field' - area in which the scan operation should take place
- *
- * @return 0 on success, non-0 error value on failure. On success
- * the 'area' area contains TL and BR corners of the allocated area
- *
- */
-static s32 scan_l2r_b2t(struct tcm *tcm, u16 w, u16 h, u16 stride,
- struct tcm_area *field, struct tcm_area *area)
-{
- s32 xx = 0, yy = 0;
- s16 start_x = -1, end_x = -1, start_y = -1, end_y = -1;
- s16 found_x = -1, found_y = -1;
- LIST_HEAD(maybes);
- struct tcm_area candidate = {0};
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
-
- PA(2, "scan_l2r_b2t:", field);
-
- start_x = field->p0.x;
- end_x = field->p1.x;
- start_y = field->p0.y;
- end_y = field->p1.y;
-
- /* check scan area co-ordinates */
- if (field->p1.x < field->p0.x ||
- field->p0.y < field->p1.y)
- return -EINVAL;
-
- /* check if allocation would fit in scan area */
- if (w > INCL_LEN(end_x, start_x) || h > INCL_LEN(start_y, end_y))
- return -ENOSPC;
-
- start_x = ALIGN(start_x, stride);
-
- /* check if allocation would still fit in scan area */
- if (w > INCL_LEN(end_x, start_x))
- return -ENOSPC;
-
- /* adjust end_x and start_y, as allocation would not fit beyond */
- end_x = end_x - w + 1; /* + 1 to be inclusive */
- start_y = start_y - h + 1;
-
- P2("ali=%d x=%d..%d y=%d..%d", stride, start_x, end_x, start_y, end_y);
-
- /*
- * Start scanning: These scans are always inclusive ones so if we are
- * given a start x = 0 is a valid value so if we have a end_x = 255,
- * 255th element is also checked
- */
- for (yy = start_y; yy >= end_y; yy--) {
- for (xx = start_x; xx <= end_x; xx += stride) {
- /* if NOT occupied */
- if (!pvt->map[xx][yy].busy) {
- if (check_fit_r_and_b(tcm, w, h, xx, yy)) {
- P3("found shoulder: %d,%d", xx, yy);
- found_x = xx;
- found_y = yy;
- /* Insert this candidate, it is just a
- co-ordinate, reusing Area */
- assign(&candidate, xx, yy, 0, 0);
- insert_element(&maybes, &candidate);
-#ifdef X_SCAN_LIMITER
- /* change upper x bound */
- end_x = xx - 1;
-#endif
- break;
- }
- } else {
- /* Optimization required only for Non Aligned,
- Aligned anyways skip by 32/64 tiles at a time */
- if (stride == 1 &&
- pvt->map[xx][yy].parent.is2d) {
- xx = pvt->map[xx][yy].parent.p1.x;
- P3("moving to: %d,%d", xx, yy);
- }
- }
- }
-
- /* if you find a free area shouldering the given scan area on
- then we can break */
-#ifdef Y_SCAN_LIMITER
- if (found_x == start_x)
- break;
-#endif
- }
-
- if (list_empty(&maybes))
- return -ENOSPC;
-
- select_candidate(tcm, w, h, &maybes, field, CR_L2R_B2T, area);
- /* dump_list_entries(maybes); */
- clean_list(&maybes);
- return 0;
-}
-#endif
-/*
-Note: In General the cordinates specified in the scan area area relevant to the
-scan sweep directions. i.e A scan Area from Top Left Corner will have
-p0.x <= p1.x and p0.y <= p1.y. Where as A scan Area from bottom Right Corner
-will have p1.x <= p0.x and p1.y <= p0.y
-*/
-
-/**
- * @description: raster scan right to left from bottom to top; find if there are
- * continuous free pages(one slot is one page, continuity always from left to
- * right) inside the 'scan area'. If there are enough continous free pages,
- * then it returns the start and end Tile/page co-ordinates inside 'area'
- *
- * @input:'num_pages' required,
- * 'field' - area in which the scan operation should take place
- *
- * @return 0 on success, non-0 error value on failure. On success
- * the 'area' area contains start and end slot (inclusive).
- *
- */
-static s32 scan_r2l_b2t_one_dim(struct tcm *tcm, u32 num_pages,
- struct tcm_area *field, struct tcm_area *area)
-{
- s32 fit = false;
- u16 x, y;
- u16 left_x, left_y, busy_x, busy_y;
- s32 ret = 0;
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
-
- /* check scan area co-ordinates */
- if (field->p0.y < field->p1.y)
- return -EINVAL;
-
- PA(2, "scan_r2l_b2t_one_dim:", field);
-
- /* Note: Checking sanctity of scan area
- * The reason for checking this that 1D allocations assume that the X
- ranges the entire TilerSpace X ie ALL Columns
- * The scan area can limit only the Y ie, Num of Rows for 1D allocation.
- We also expect we could have only 1 row for 1D allocation
- * i.e our field p0.y and p1.y may have a same value.
- */
-
- /* only support full width 1d scan area */
- if (pvt->width != field->p0.x - field->p1.x + 1)
- return -EINVAL;
-
- /* check if allocation would fit in scan area */
- if (num_pages > pvt->width * INCL_LEN(field->p0.y, field->p1.y))
- return -ENOSPC;
-
- left_x = field->p0.x;
- left_y = field->p0.y;
- while (!ret) {
- x = left_x;
- y = left_y;
-
- if (!pvt->map[x][y].busy) {
- ret = move_left(tcm, x, y, num_pages - 1,
- &left_x, &left_y);
- if (ret)
- break; /* out of space */
-
- P3("moved left %d slots: %d,%d", num_pages - 1,
- left_x, left_y);
- fit = check_fit_r_one_dim(tcm, left_x, left_y,
- num_pages, &busy_x, &busy_y);
- if (fit) {
- assign(area, left_x, left_y,
- busy_x, busy_y);
- break;
- } else {
- /* no fit, continue at the busy slot */
- x = busy_x;
- y = busy_y;
- }
- }
-
- /* now the tile is occupied, skip busy region */
- if (pvt->map[x][y].parent.is2d) {
- busy_x = pvt->map[x][y].parent.p0.x;
- busy_y = y;
- } else {
- busy_x = pvt->map[x][y].parent.p0.x;
- busy_y = pvt->map[x][y].parent.p0.y;
- }
- x = busy_x;
- y = busy_y;
-
- P3("moving left from: %d,%d", x, y);
- ret = move_left(tcm, x, y, 1, &left_x, &left_y);
- }
-
- return fit ? 0 : -ENOSPC;
-}
-
-/**
- * @description:
- *
- *
- *
- *
- * @input:
- *
- *
- * @return 0 on success, non-0 error value on failure. On success
- */
-static s32 scan_areas_and_find_fit(struct tcm *tcm, u16 w, u16 h, u16 stride,
- struct tcm_area *area)
-{
- s32 ret = 0;
- struct tcm_area field = {0};
- u16 boundary_x = 0, boundary_y = 0;
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
- s32 need_scan = 2;
-
- if (stride > 1) {
- boundary_x = pvt->div_pt.x - 1;
- boundary_y = pvt->div_pt.y - 1;
-
- /* more intelligence here */
- if (w > pvt->div_pt.x) {
- boundary_x = pvt->width - 1;
- need_scan--;
- }
- if (h > pvt->div_pt.y) {
- boundary_y = pvt->height - 1;
- need_scan--;
- }
-
- assign(&field, 0, 0, boundary_x, boundary_y);
- ret = scan_l2r_t2b(tcm, w, h, stride, &field, area);
- if (ret != 0 && need_scan) {
- /* scan the entire container if nothing found */
- assign(&field, 0, 0, pvt->width - 1, pvt->height - 1);
- ret = scan_l2r_t2b(tcm, w, h, stride, &field, area);
- }
- } else if (stride == 1) {
- boundary_x = pvt->div_pt.x;
- boundary_y = pvt->div_pt.y - 1;
-
- /* more intelligence here */
- if (w > (pvt->width - pvt->div_pt.x)) {
- boundary_x = 0;
- need_scan--;
- }
- if (h > pvt->div_pt.y) {
- boundary_y = pvt->height - 1;
- need_scan--;
- }
-
- assign(&field, pvt->width - 1, 0, boundary_x, boundary_y);
- ret = scan_r2l_t2b(tcm, w, h, stride, &field, area);
-
- if (ret != 0 && need_scan) {
- /* scan the entire container if nothing found */
- assign(&field, pvt->width - 1, 0, 0,
- pvt->height - 1);
- ret = scan_r2l_t2b(tcm, w, h, stride, &field,
- area);
- }
- }
-
- /* 3/30/2010: moved aligned to left, and unaligned to right side. */
-#if 0
- else if (stride == 1) {
- /* use 64-align area so we don't grow down and shrink 1D area */
- if (h > pvt->div_pt.y) {
- need_scan -= 2;
- assign(&field, 0, 0, pvt->width - 1, pvt->height - 1);
- ret = scan_l2r_t2b(tcm, w, h, stride, &field, area);
- } else {
- assign(&field, 0, pvt->div_pt.y - 1, pvt->width - 1, 0);
- /* scan up in 64 and 32 areas accross whole width */
- ret = scan_l2r_b2t(tcm, w, h, stride, &field, area);
- }
-
- if (ret != 0 && need_scan) {
- assign(&field, 0, 0, pvt->width - 1, pvt->height - 1);
- ret = scan_l2r_t2b(tcm, w, h, stride, &field, area);
- }
- }
-#endif
- return ret;
-}
-
-static s32 check_fit_r_and_b(struct tcm *tcm, u16 w, u16 h, u16 left_x,
- u16 top_y)
-{
- u16 xx = 0, yy = 0;
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
-
- for (yy = top_y; yy < top_y + h; yy++) {
- for (xx = left_x; xx < left_x + w; xx++) {
- if (pvt->map[xx][yy].busy)
- return false;
- }
- }
- return true;
-}
-
-static s32 check_fit_r_one_dim(struct tcm *tcm, u16 x, u16 y, u32 num_pages,
- u16 *busy_x, u16 *busy_y)
-{
- s32 ret = 0;
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
- s32 i = 0;
- *busy_x = x;
- *busy_y = y;
-
- P2("checking fit for %d pages from %d,%d", num_pages, x, y);
- while (i < num_pages) {
- if (pvt->map[x][y].busy) {
- /* go to the start of the blocking allocation
- to avoid unecessary checking */
- if (pvt->map[x][y].parent.is2d) {
- *busy_x = pvt->map[x][y].parent.p0.x;
- *busy_y = y;
- } else {
- *busy_x = pvt->map[x][y].parent.p0.x;
- *busy_y = pvt->map[x][y].parent.p0.y;
- }
- /* TODO: Could also move left in case of 2D */
- P2("after busy slot at: %d,%d", *busy_x, *busy_y);
- return false;
- }
-
- i++;
-
- /* break here so busy_x, busy_y will be correct */
- if (i == num_pages)
- break;
-
- ret = move_right(tcm, x, y, 1, busy_x, busy_y);
- if (ret)
- return false;
-
- x = *busy_x;
- y = *busy_y;
- }
-
- return true;
-}
-
-static void fill_2d_area(struct tcm *tcm, struct tcm_area *area,
- struct slot slot)
-{
- s32 x, y;
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
-
- PA(2, "fill 2d area", area);
- for (x = area->p0.x; x <= area->p1.x; ++x)
- for (y = area->p0.y; y <= area->p1.y; ++y)
- pvt->map[x][y] = slot;
-}
-
-/* area should be a valid area */
-static void fill_1d_area(struct tcm *tcm, struct tcm_area *area,
- struct slot slot)
-{
- u16 x = 0, y = 0;
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
-
- PA(2, "fill 1d area", area);
- x = area->p0.x;
- y = area->p0.y;
-
- while (!(x == area->p1.x && y == area->p1.y)) {
- pvt->map[x++][y] = slot;
- if (x == pvt->width) {
- x = 0;
- y++;
- }
- }
- /* set the last slot */
- pvt->map[x][y] = slot;
-}
-
-static void select_candidate(struct tcm *tcm, u16 w, u16 h,
- struct list_head *maybes,
- struct tcm_area *field, s32 criteria,
- struct tcm_area *area)
-{
- /* bookkeeping the best match and the one evaluated */
- struct area_spec *best = NULL;
- struct nearness_factor best_factor = {0};
- struct neighbour_stats best_stats = {0};
- u16 win_neighs = 0;
-
- /* bookkeeping the current one being evaluated */
- struct area_spec *elem = NULL, *tmp = NULL;
- struct nearness_factor factor = {0};
- struct neighbour_stats stats = {0};
- u16 neighs = 0;
-
- bool better; /* whether current is better */
-
- /* we default to the 1st candidate */
- best = list_first_entry(maybes, struct area_spec, list);
-
- /*i f there is only one candidate then that is the selection*/
-
- /* If first found is enabled then we just provide bluntly the first
- found candidate
- * NOTE: For Horizontal bias we just give the first found, because our
- * scan is Horizontal raster based and the first candidate will always
- * be the same as if selecting the Horizontal one.
- */
- if (list_is_singular(maybes) ||
- criteria & CR_FIRST_FOUND || criteria & CR_BIAS_HORIZONTAL)
- /* Note: Sure we could have done this in the previous function,
- but just wanted this to be cleaner so having
- * one place where the selection is made. Here I am returning
- the first one
- */
- goto done;
-
- /* lets calculate for the first candidate and assign him the best and
- replace with the one who has better credentials w/ to the criteria */
-
- get_busy_neigh_stats(tcm, w, h, &best->area, &best_stats);
- win_neighs = BOUNDARY(&best_stats) +
- OCCUPIED(&best_stats);
- get_nearness_factor(field, &best->area, &best_factor);
-
- list_for_each_entry_safe(elem, tmp, maybes->next, list) {
- better = false;
-
- /* calculate required statistics */
- get_busy_neigh_stats(tcm, w, h, &elem->area, &stats);
- get_nearness_factor(field, &elem->area, &factor);
- neighs = BOUNDARY(&stats) + OCCUPIED(&stats);
-
- /* see if this are is better than the best so far */
-
- /* neighbor check */
- if ((criteria & CR_MAX_NEIGHS) &&
- neighs > win_neighs)
- better = true;
-
- /* vertical bias check */
- if ((criteria & CR_BIAS_VERTICAL) &&
- /*
- * NOTE: not checking if lengths are same, because that does not
- * find new shoulders on the same row after a fit
- */
- INCL_LEN_MOD(elem->area.p0.y, field->p0.y) >
- INCL_LEN_MOD(best->area.p0.y, field->p0.y))
- better = true;
-
- /* diagonal balance check */
- if ((criteria & CR_DIAGONAL_BALANCE) &&
- win_neighs <= neighs &&
- (win_neighs < neighs ||
- /* this implies that neighs and occupied match */
- OCCUPIED(&best_stats) < OCCUPIED(&stats) ||
- (OCCUPIED(&best_stats) == OCCUPIED(&stats) &&
- /* check the nearness factor */
- best_factor.x + best_factor.y > factor.x + factor.y)))
- better = true;
-
- if (better) {
- best = elem;
- best_factor = factor;
- best_stats = stats;
- win_neighs = neighs;
- }
- }
-
-done:
- assign(area, best->area.p0.x, best->area.p0.y,
- best->area.p0.x + w - 1, best->area.p0.y + h - 1);
-}
-
-/* get the nearness factor of an area in a search field */
-static void get_nearness_factor(struct tcm_area *field,
- struct tcm_area *area, struct nearness_factor *nf)
-{
- /* For the following calculation we need worry of +/- sign, the
- relative distances take of this. Multiplied by 1000, there
- is no floating point arithmetic used in kernel */
-
- nf->x = (s32)(area->p0.x - field->p0.x) * 1000 /
- (field->p1.x - field->p0.x);
- nf->y = (s32)(area->p0.y - field->p0.y) * 1000 /
- (field->p1.y - field->p0.y);
-}
-
-/* Neighbours
- *
- * |<-----T------>|
- * _ _______________ _
- * L | Ar | R
- * _ |______________|_
- * |<-----B------>|
- */
-static s32 get_busy_neigh_stats(struct tcm *tcm, u16 width, u16 height,
- struct tcm_area *top_left_corner,
- struct neighbour_stats *neighbour_stat)
-{
- s16 xx = 0, yy = 0;
- struct tcm_area left_edge;
- struct tcm_area right_edge;
- struct tcm_area top_edge;
- struct tcm_area bottom_edge;
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
-
- if (neighbour_stat == NULL)
- return -EINVAL;
-
- if (width == 0 || height == 0)
- return -EINVAL;
-
- /* Clearing any exisiting values */
- memset(neighbour_stat, 0, sizeof(*neighbour_stat));
-
- /* Finding Top Edge */
- assign(&top_edge, top_left_corner->p0.x, top_left_corner->p0.y,
- top_left_corner->p0.x + width - 1, top_left_corner->p0.y);
-
- /* Finding Bottom Edge */
- assign(&bottom_edge, top_left_corner->p0.x,
- top_left_corner->p0.y+height - 1,
- top_left_corner->p0.x + width - 1,
- top_left_corner->p0.y + height - 1);
-
- /* Finding Left Edge */
- assign(&left_edge, top_left_corner->p0.x, top_left_corner->p0.y,
- top_left_corner->p0.x, top_left_corner->p0.y + height - 1);
-
- /* Finding Right Edge */
- assign(&right_edge, top_left_corner->p0.x + width - 1,
- top_left_corner->p0.y,
- top_left_corner->p0.x + width - 1,
- top_left_corner->p0.y + height - 1);
-
- /* dump_area(&top_edge);
- dump_area(&right_edge);
- dump_area(&bottom_edge);
- dump_area(&left_edge);
- */
-
- /* Parsing through top & bottom edge */
- for (xx = top_edge.p0.x; xx <= top_edge.p1.x; xx++) {
- if (top_edge.p0.y - 1 < 0)
- neighbour_stat->top_boundary++;
- else if (pvt->map[xx][top_edge.p0.y - 1].busy)
- neighbour_stat->top_occupied++;
-
- if (bottom_edge.p0.y + 1 > pvt->height - 1)
- neighbour_stat->bottom_boundary++;
- else if (pvt->map[xx][bottom_edge.p0.y+1].busy)
- neighbour_stat->bottom_occupied++;
- }
-
- /* Parsing throught left and right edge */
- for (yy = left_edge.p0.y; yy <= left_edge.p1.y; ++yy) {
- if (left_edge.p0.x - 1 < 0)
- neighbour_stat->left_boundary++;
- else if (pvt->map[left_edge.p0.x - 1][yy].busy)
- neighbour_stat->left_occupied++;
-
- if (right_edge.p0.x + 1 > pvt->width - 1)
- neighbour_stat->right_boundary++;
- else if (pvt->map[right_edge.p0.x + 1][yy].busy)
- neighbour_stat->right_occupied++;
-
- }
-
- return 0;
-}
-
-/**
- @description: Retrieves the parent area of the page at p0.x, p0.y if
- occupied
- @input:co-ordinates of the page (p0.x, p0.y) whoes parent area
- is required
- @return 0 on success, non-0 error value on failure. On success
-
- parent will contain co-ordinates (TL & BR corner) of the parent
- area
-*/
-static s32 sita_get_parent(struct tcm *tcm, struct tcm_pt *pt,
- struct tcm_area *parent)
-{
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
- s32 res = 0;
-
- mutex_lock(&(pvt->mtx));
-
- if (pvt->map[pt->x][pt->y].busy) {
- *parent = pvt->map[pt->x][pt->y].parent;
- } else {
- memset(parent, 0, sizeof(*parent));
- res = -ENOENT;
- }
-
- mutex_unlock(&(pvt->mtx));
-
- return res;
-}
-
-static s32 move_left(struct tcm *tcm, u16 x, u16 y, u32 num_pages,
- u16 *xx, u16 *yy)
-{
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
- u32 pos = x + pvt->width * y;
-
- if (pos < num_pages)
- return -ENOSPC;
-
- pos -= num_pages;
- *xx = pos % pvt->width;
- *yy = pos / pvt->width;
- return 0;
-}
-
-static s32 move_right(struct tcm *tcm, u16 x, u16 y, u32 num_pages,
- u16 *xx, u16 *yy)
-{
- struct sita_pvt *pvt = (struct sita_pvt *)tcm->pvt;
- u32 pos = x + pvt->width * y;
-
- if (num_pages > pvt->width * pvt->height - pos)
- return -ENOSPC;
-
- pos += num_pages;
- *xx = pos % pvt->width;
- *yy = pos / pvt->width;
- return 0;
-}
-
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tcm/tcm_sita.h b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tcm/tcm_sita.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-/*
- * tcm_sita.h
- *
- * SImple Tiler Allocator (SiTA) interface.
- *
- * Author: Ravi Ramachandra <r.ramachandra@ti.com>
- */
-
-#ifndef TCM_SITA_H_
-#define TCM_SITA_H_
-
-#include "tcm.h"
-
-/**
- * Create a SiTA tiler container manager.
- *
- * @param width Container width
- * @param height Container height
- * @param attr preferred division point between 64-aligned
- * allocation (top left), 32-aligned allocations
- * (top right), and page mode allocations (bottom)
- *
- * @return TCM instance
- */
-struct tcm *sita_init(u16 width, u16 height, struct tcm_pt *attr);
-
-TCM_INIT(sita_init, struct tcm_pt);
-
-#endif /* TCM_SITA_H_ */
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tcm/tcm_utils.h b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tcm/tcm_utils.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-/*
- * tcm_utils.h
- *
- * Utility functions for implementing TILER container managers.
- */
-
-#ifndef _TCM_UTILS_H
-#define _TCM_UTILS_H
-
-#include <sys/slog.h>
-
-#include "proto.h"
-#include "tcm.h"
-
-#define AREA_FMT "(%03d %03d)-(%03d %03d)"
-#define AREA(area) (area).p0.x, (area).p0.y, (area).p1.x, (area).p1.y
-
-/* TCM_ALG_NAME must be defined to use the debug methods */
-
-#ifdef DEBUG
-#define IFDEBUG(x) x
-#else
-#define IFDEBUG(x) do { if (0) x; } while (0)
-#endif
-
-#define P(level, fmt, ...) \
- IFDEBUG(slogf(42, level, TCM_ALG_NAME ":%d:%s()" fmt "\n", \
- __LINE__, __func__, ##__VA_ARGS__))
-
-#define P1(fmt, ...) P(_SLOG_NOTICE, fmt, ##__VA_ARGS__)
-#define P2(fmt, ...) P(_SLOG_INFO, fmt, ##__VA_ARGS__)
-#define P3(fmt, ...) P(_SLOG_DEBUG1, fmt, ##__VA_ARGS__)
-
-#define PA(level, msg, p_area) P##level(msg " " AREA_FMT "\n", AREA(*(p_area)))
-
-/* assign coordinates to area */
-static inline
-void assign(struct tcm_area *a, u16 x0, u16 y0, u16 x1, u16 y1)
-{
- a->p0.x = x0;
- a->p0.y = y0;
- a->p1.x = x1;
- a->p1.y = y1;
-}
-
-static inline
-void dump_area(struct tcm_area *area)
-{
- fprintf(stderr, AREA_FMT "\n", AREA(*area));
-}
-
-#endif
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tiler.c b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tiler.c
+++ /dev/null
@@ -1,2765 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-/*
- * tiler.c
- *
- * TILER driver support functions for TI OMAP processors.
- */
-#include "proto.h"
-#include "List.h"
-
-#include "tiler.h"
-#include "dmm.h"
-#include "tmm.h"
-#include "tiler_def.h"
-#include "tcm/tcm_sita.h" /* Algo Specific header */
-#include <dlfcn.h>
-#include <arm/mmu.h>
-
-
-// TODO: replace with real bug checking
-#define BUG_ON
-
-/* per process (thread group) info */
-struct process_info {
- struct list_head list; /* other processes */
- struct list_head groups; /* my groups */
- struct list_head bufs; /* my registered buffers */
- pid_t pid; /* really: thread group ID */
- u32 refs; /* open tiler devices, 0 for processes
- tracked via kernel APIs */
- bool kernel; /* tracking kernel objects */
-};
-
-/* per group info (within a process) */
-struct gid_info {
- struct list_head by_pid; /* other groups */
- struct list_head areas; /* all areas in this pid/gid */
- struct list_head reserved; /* areas pre-reserved */
- struct list_head onedim; /* all 1D areas in this pid/gid */
- u32 gid; /* group ID */
- struct process_info *pi; /* parent */
-};
-
-static struct list_head blocks;
-static struct list_head procs;
-static struct list_head orphan_areas;
-static struct list_head orphan_onedim;
-
-struct area_info {
- struct list_head by_gid; /* areas in this pid/gid */
- struct list_head blocks; /* blocks in this area */
- u32 nblocks; /* # of blocks in this area */
-
- struct tcm_area area; /* area details */
- struct gid_info *gi; /* link to parent, if still alive */
-};
-
-struct til_mem_info {
- struct list_head global; /* reserved / global blocks */
- u32 sys_addr; /* system space (L3) tiler addr */
- u32 num_pg; /* number of pages in page-list */
- u32 usr; /* user space address */
- u32 *pg_ptr; /* list of mapped struct page pointers */
- struct tcm_area area;
- u32 *mem; /* list of alloced phys addresses */
- u32 refs; /* number of times referenced */
- bool alloced; /* still alloced */
-
- struct list_head by_area; /* blocks in the same area / 1D */
- void *parent; /* area info for 2D, else group info */
-};
-
-struct __buf_info {
- struct list_head by_pid; /* list of buffers per pid */
- struct tiler_buf_info buf_info;
- struct til_mem_info *mi[TILER_MAX_NUM_BLOCKS]; /* blocks */
-};
-
-struct reg_notif_info {
- struct list_head elem; /* list elem */
- tiler_notifier_cb cb_ptr; /* Callback fxn pointer. */
- void *arg; /* Usr private info */
-};
-
-struct list_head reg_notif;
-
-struct reg_notif_usr_info {
- struct list_head elem; /* list elem */
- int cmd; /* Command to send to user. */
- char *name; /* Name of user */
- pid_t pid; /* pid */
- int name_len; /* Length of Name of User */
-};
-
-struct list_head reg_notif_usr;
-
-#define TILER_FORMATS 4
-
-#define TILER_REGNOTIFY_MAX_NAME_LEN 16
-
-#define TILER_REGNOTIFY_MAX_REGISTERED 3
-
-void *tiler_pat_lib = NULL;
-int (*tiler_pat_init)(void);
-int (*tiler_pat_deinit)(void);
-int (*tiler_save_pat)(struct pat_area *, u32 *);
-
-#define MAX_CONTAINERS 2
-
-static u32 id;
-static pthread_mutex_t mtx;
-static struct tcm *tcm[TILER_FORMATS];
-static struct tmm *tmm[TILER_FORMATS];
-static u32 *dmac_va;
-static u32 dmac_pa;
-
-static u32 *dummy_va;
-static u32 dummy_pa;
-
-#define TCM(fmt) tcm[(fmt) - TILFMT_8BIT]
-#define TCM_SS(ssptr) TCM(TILER_GET_ACC_MODE(ssptr))
-#define TCM_SET(fmt, i) tcm[(fmt) - TILFMT_8BIT] = i
-#define TMM(fmt) tmm[(fmt) - TILFMT_8BIT]
-#define TMM_SS(ssptr) TMM(TILER_GET_ACC_MODE(ssptr))
-#define TMM_SET(fmt, i) tmm[(fmt) - TILFMT_8BIT] = i
-
-#ifdef TILER_PLATFORM_OMAP5
-char tiler_alloc_debug_buffer[34842];
-#else
-char tiler_alloc_debug_buffer[17421];
-#endif
-char *tiler_alloc_debug_buffer_ptr;
-
-static void fill_map(u16 **map, int div, struct tcm_area *a, u8 c, bool ovw,
- u8 col)
-{
- u16 val = c | ((u16) col << 8);
- int x, y;
- for (y = a->p0.y; y <= a->p1.y; y++)
- for (x = a->p0.x / div; x <= a->p1.x / div; x++)
- if (map[y][x] == ' ' || ovw)
- map[y][x] = val;
-}
-
-static void fill_map_pt(u16 **map, int div, struct tcm_pt *p, u8 c)
-{
- map[p->y][p->x / div] = (map[p->y][p->x / div] & 0xff00) | c;
-}
-
-static u8 read_map_pt(u16 **map, int div, struct tcm_pt *p)
-{
- return map[p->y][p->x / div] & 0xff;
-}
-
-static int map_width(int div, int x0, int x1)
-{
- return (x1 / div) - (x0 / div) + 1;
-}
-
-static void text_map(u16 **map, int div, char *nice, int y, int x0, int x1,
- u8 col)
-{
- u16 *p = map[y] + (x0 / div);
- int w = (map_width(div, x0, x1) - strlen(nice)) / 2;
- if (w >= 0) {
- p += w;
- while (*nice)
- *p++ = ((u16) col << 8) | (u8) *nice++;
- }
-}
-
-static void map_1d_info(u16 **map, int div, char *nice, struct tcm_area *a,
- u8 col)
-{
- sprintf(nice, "%dK", tcm_sizeof(*a) * 4);
- if (a->p0.y + 1 < a->p1.y) {
- text_map(map, div, nice, (a->p0.y + a->p1.y) / 2, 0,
- TILER_WIDTH - 1, col);
- } else if (a->p0.y < a->p1.y) {
- if (strlen(nice) < map_width(div, a->p0.x, TILER_WIDTH - 1))
- text_map(map, div, nice, a->p0.y, a->p0.x + div,
- TILER_WIDTH - 1, col);
- else if (strlen(nice) < map_width(div, 0, a->p1.x))
- text_map(map, div, nice, a->p1.y, 0, a->p1.y - div,
- col);
- } else if (strlen(nice) + 1 < map_width(div, a->p0.x, a->p1.x)) {
- text_map(map, div, nice, a->p0.y, a->p0.x, a->p1.x, col);
- }
-}
-
-static void map_2d_info(u16 **map, int div, char *nice, struct til_mem_info *mi,
- u8 col)
-{
- struct tcm_area *a = &mi->area;
- int y = (a->p0.y + a->p1.y) / 2;
- sprintf(nice, "(%d*%d)", tcm_awidth(*a), tcm_aheight(*a));
- if (strlen(nice) + 1 < map_width(div, a->p0.x, a->p1.x))
- text_map(map, div, nice, y, a->p0.x, a->p1.x, col);
-
- sprintf(nice, "<%s%d>", mi->alloced ? "a" : "", mi->refs);
- if (a->p1.y > a->p0.y + 1 &&
- strlen(nice) + 1 < map_width(div, a->p0.x, a->p1.x))
- text_map(map, div, nice, y + 1, a->p0.x, a->p1.x, col);
-}
-
-static void write_out(u16 **map, char *fmt, int y, bool color, char *nice)
-{
- u8 current_col = '\x0f';
- char *o = nice;
- u16 *d = map[y];
-
- /* boundary */
- if (color)
- o += sprintf(o, "\e[0;%d%sm", (y & 8) ? 34 : 36,
- (y & 16) ? ";1" : "");
- o += sprintf(o, fmt, y);
- o += sprintf(o, "%s:", color ? "\e[0;1m" : "");
-
- /* text */
- do {
- u16 p = *d ?: (':' | 0x0f00);
- u8 col_chg = current_col ^ (p >> 8);
- if (col_chg && color) {
- o += sprintf(o, "\e[");
- if ((col_chg & 0x88) && (p & 0x0800) == 0) {
- o += sprintf(o, "0;");
- col_chg = 0x07 ^ (p >> 8);
- }
- if (col_chg & 0x7)
- o += sprintf(o, "%d;", 30 + ((p >> 8) & 0x07));
- if (col_chg & 0x70)
- o += sprintf(o, "%d;", 40 + ((p >> 12) & 0x07));
- if (p & 0x0800)
- o += sprintf(o, "1;");
- o[-1] = 'm';
- }
- *o++ = p & 0xff;
- current_col = p >> 8;
- } while (*d++);
-
- if (color && current_col != 0x07)
- o += sprintf(o, "\e[0m");
- *o = 0;
- tiler_alloc_debug_buffer_ptr += sprintf(tiler_alloc_debug_buffer_ptr, "%s\n", nice);
-}
-
-static void print_allocation_map(bool color)
-{
- int div = 2;
- int i, j;
- u16 **map, *global_map;
- struct area_info *ai;
- struct til_mem_info *mi, *tmp;
- struct tcm_area a, p;
- static char *m2d = "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- static char *a2d = ".,:;'\"`~!^-+";
- static char *m1d_c = "\x47\x57\x67\xc7\xd7\xe7";
- static char *m2d_c = "\x17\x27\x37\x97\xa7\xb7";
- static char *a2d_c = "\x01\x02\x03\x09\x0a\x0b";
-
- char *m2dp = m2d, *a2dp = a2d;
- char *m2dp_c = m2d_c, *m1dp_c = m1d_c, *a2dp_c = a2d_c;
- char *nice;
-#ifdef TILER_PLATFORM_OMAP5
- u16 **map1d;
- char *nice1d;
-#endif
-
- /* allocate map */
- nice = kzalloc(TILER_WIDTH / div * 16, GFP_KERNEL);
- map = kzalloc((TILER_HEIGHT + 1) * sizeof(*map), GFP_KERNEL);
-#ifdef TILER_PLATFORM_OMAP5
- nice1d = kzalloc(TILER_WIDTH / div * 16, GFP_KERNEL);
- map1d = kzalloc((TILER_HEIGHT + 1) * sizeof(*map), GFP_KERNEL);
-
- global_map = kzalloc((TILER_WIDTH / div + 1)
- * (TILER_HEIGHT + 1) * 2 * sizeof(*global_map), GFP_KERNEL);
-#else
- global_map = kzalloc((TILER_WIDTH / div + 1)
- * (TILER_HEIGHT + 1) * sizeof(*global_map), GFP_KERNEL);
-#endif
-
-#ifdef TILER_PLATFORM_OMAP5
- if (!map || !map1d || !global_map || !nice || !nice1d) {
-#else
- if (!map || !global_map || !nice) {
-#endif
- fprintf(stderr, "could not allocate map for debug print\n");
- goto error;
- }
- for (i = 0; i <= TILER_HEIGHT; i++) {
- map[i] = global_map + i * (TILER_WIDTH / div + 1);
- for (j = 0; j < TILER_WIDTH / div; j++)
- map[i][j] = ' ';
- map[i][j] = 0;
- }
-#ifdef TILER_PLATFORM_OMAP5
- for (i = 0; i <= TILER_HEIGHT; i++) {
- map1d[i] = global_map + ((TILER_HEIGHT + 1) * (TILER_WIDTH / div + 1))
- + i * (TILER_WIDTH / div + 1);
- for (j = 0; j < TILER_WIDTH / div; j++)
- map1d[i][j] = ' ';
- map1d[i][j] = 0;
- }
-#endif
-
- /* get all allocations */
- mutex_lock(&mtx);
-
- list_for_each_entry_safe(mi, tmp, &blocks, global) {
- if (mi->area.is2d) {
- ai = mi->parent;
- fill_map(map, div, &ai->area, *a2dp, false, *a2dp_c);
- fill_map(map, div, &mi->area, *m2dp, true, *m2dp_c);
- map_2d_info(map, div, nice, mi, *m2dp_c | 0xf);
- if (!*++a2dp)
- a2dp = a2d;
- if (!*++a2dp_c)
- a2dp_c = a2d_c;
- if (!*++m2dp)
- m2dp = m2d;
- if (!*++m2dp_c)
- m2dp_c = m2d_c;
- } else {
-#ifdef TILER_PLATFORM_OMAP5
- bool start = read_map_pt(map1d, div, &mi->area.p0) == ' ';
- bool end = read_map_pt(map1d, div, &mi->area.p1) == ' ';
- tcm_for_each_slice(a, mi->area, p)
- fill_map(map1d, div, &a, '=', true, *m1dp_c);
- fill_map_pt(map1d, div, &mi->area.p0, start ? '<' : 'X');
- fill_map_pt(map1d, div, &mi->area.p1, end ? '>' : 'X');
- map_1d_info(map1d, div, nice1d, &mi->area, *m1dp_c | 0xf);
- if (!*++m1dp_c)
- m1dp_c = m1d_c;
-#else
- bool start = read_map_pt(map, div, &mi->area.p0) == ' ';
- bool end = read_map_pt(map, div, &mi->area.p1) == ' ';
- tcm_for_each_slice(a, mi->area, p)
- fill_map(map, div, &a, '=', true, *m1dp_c);
- fill_map_pt(map, div, &mi->area.p0, start ? '<' : 'X');
- fill_map_pt(map, div, &mi->area.p1, end ? '>' : 'X');
- map_1d_info(map, div, nice, &mi->area, *m1dp_c | 0xf);
- if (!*++m1dp_c)
- m1dp_c = m1d_c;
-#endif
- }
- }
-
- for (i = 0; i < TILER_WIDTH / div; i++)
- map[TILER_HEIGHT][i] = ':' | 0x0f00;
-#ifdef TILER_PLATFORM_OMAP5
- text_map(map, div, " BEGIN TILER 2D MAP ", TILER_HEIGHT, 0,
- TILER_WIDTH - 1, 0xf);
-#else
- text_map(map, div, " BEGIN TILER MAP ", TILER_HEIGHT, 0,
- TILER_WIDTH - 1, 0xf);
-#endif
-
- tiler_alloc_debug_buffer_ptr += sprintf(tiler_alloc_debug_buffer_ptr, "\n");
- write_out(map, " ", TILER_HEIGHT, color, nice);
- for (i = 0; i < TILER_HEIGHT; i++)
- write_out(map, "%03d", i, color, nice);
-
-#ifdef TILER_PLATFORM_OMAP5
- text_map(map, div, ": END TILER 2D MAP :", TILER_HEIGHT, 0,
- TILER_WIDTH - 1, 0xf);
-#else
- text_map(map, div, ": END TILER MAP :", TILER_HEIGHT, 0,
- TILER_WIDTH - 1, 0xf);
-#endif
- write_out(map, " ", TILER_HEIGHT, color, nice);
-
-#ifdef TILER_PLATFORM_OMAP5
- for (i = 0; i < TILER_WIDTH / div; i++)
- map1d[TILER_HEIGHT][i] = ':' | 0x0f00;
- text_map(map1d, div, " BEGIN TILER 1D MAP ", TILER_HEIGHT, 0,
- TILER_WIDTH - 1, 0xf);
- tiler_alloc_debug_buffer_ptr += sprintf(tiler_alloc_debug_buffer_ptr, "\n");
- write_out(map1d, " ", TILER_HEIGHT, color, nice);
- for (i = 0; i < TILER_HEIGHT; i++)
- write_out(map1d, "%03d", i, color, nice);
- text_map(map1d, div, ": END TILER 1D MAP :", TILER_HEIGHT, 0,
- TILER_WIDTH - 1, 0xf);
- write_out(map1d, " ", TILER_HEIGHT, color, nice);
-#endif
-
- mutex_unlock(&mtx);
-
-error:
- kfree(map);
-#ifdef TILER_PLATFORM_OMAP5
- kfree(map1d);
-#endif
- kfree(global_map);
- kfree(nice);
-#ifdef TILER_PLATFORM_OMAP5
- kfree(nice1d);
-#endif
-}
-
-static uint tiler_alloc_debug;
-int tiler_read(resmgr_context_t *ctp, io_read_t *msg, tiler_ocb_t *ocb)
-{
- int nbytes;
- int nparts;
- int status;
- int nleft;
-
- if ((status = iofunc_read_verify (ctp, msg, &ocb->hdr, NULL)) != EOK)
- return (status);
-
- if ((msg->i.xtype & _IO_XTYPE_MASK) != _IO_XTYPE_NONE)
- return (ENOSYS);
-
- if (ocb->hdr.offset > sizeof(tiler_alloc_debug_buffer))
- return (EINVAL);
-
- nleft = sizeof(tiler_alloc_debug_buffer) - ocb->hdr.offset;
- nbytes = min (msg->i.nbytes, nleft);
-
- /* Make sure the user has supplied a big enough buffer */
- if (nbytes > 0) {
- if (nleft == sizeof(tiler_alloc_debug_buffer)) {
- /* User hasn't tried to read yet. Refill the buffer with the latest info. */
- tiler_alloc_debug_buffer_ptr = tiler_alloc_debug_buffer;
- print_allocation_map(tiler_alloc_debug & 4);
- }
-
- /* set up the return data IOV */
- SETIOV (ctp->iov, tiler_alloc_debug_buffer + ocb->hdr.offset, nbytes);
-
- /* set up the number of bytes (returned by client's read()) */
- _IO_SET_READ_NBYTES (ctp, nbytes);
-
- ocb->hdr.offset += nbytes;
-
- nparts = 1;
- }
- else {
- _IO_SET_READ_NBYTES (ctp, 0);
-
- nparts = 0;
- }
-
- /* mark the access time as invalid (we just accessed it) */
-
- if (msg->i.nbytes > 0)
- ocb->hdr.attr->flags |= IOFUNC_ATTR_ATIME;
-
- return (_RESMGR_NPARTS (nparts));
-}
-
-/* get process info, and increment refs for device tracking */
-static struct process_info *__get_pi(pid_t pid, bool kernel)
-{
- struct process_info *pi, *tmp;
-
- /* find process context */
- mutex_lock(&mtx);
- list_for_each_entry_safe(pi, tmp, &procs, list) {
- if (pi->pid == pid && pi->kernel == kernel)
- goto done;
- }
-
- /* create process context */
- pi = kmalloc(sizeof(*pi), GFP_KERNEL);
- if (!pi)
- goto done;
-
- memset(pi, 0, sizeof(*pi));
- pi->pid = pid;
- pi->kernel = kernel;
- INIT_LIST_HEAD(&pi->groups);
- INIT_LIST_HEAD(&pi->bufs);
- list_add(&pi->list, &procs);
-done:
- if (pi && !kernel)
- pi->refs++;
- mutex_unlock(&mtx);
- return pi;
-}
-
-/* allocate an reserved area of size, alignment and link it to gi */
-static struct area_info *area_new(u16 width, u16 height, u16 align,
- struct tcm *tcm, struct gid_info *gi)
-{
- struct area_info *ai = kmalloc(sizeof(*ai), GFP_KERNEL);
- if (!ai)
- return NULL;
-
- /* set up empty area info */
- memset(ai, 0x0, sizeof(*ai));
- INIT_LIST_HEAD(&ai->blocks);
-
- /* reserve an allocation area */
- if (tcm_reserve_2d(tcm, width, height, align, &ai->area)) {
- kfree(ai);
- return NULL;
- }
-
- ai->gi = gi;
- mutex_lock(&mtx);
- list_add_tail(&ai->by_gid, &gi->areas);
- mutex_unlock(&mtx);
- return ai;
-}
-
-/* (must have mutex) free an area and return NULL */
-static inline void _m_area_free(struct area_info *ai)
-{
- if (ai) {
- list_del(&ai->by_gid);
- kfree(ai);
- }
-}
-
-static s32 __analyze_area(enum tiler_fmt fmt, u32 width, u32 height,
- u16 *x_area, u16 *y_area, u16 *band,
- u16 *align, u16 *offs)
-{
- /* input: width, height is in pixels, align, offs in bytes */
- /* output: x_area, y_area, band, align, offs in slots */
-
- /* slot width, height, and row size */
- u32 slot_w, slot_h, slot_row, bpp;
-
- /* align must be 2 power */
- if (*align & (*align - 1))
- return -1;
-
- /* width and height must be greater than 0 */
- if (!width || !height)
- return -1;
-
- switch (fmt) {
- case TILFMT_8BIT:
- slot_w = DMM_PAGE_DIMM_X_MODE_8;
- slot_h = DMM_PAGE_DIMM_Y_MODE_8;
- break;
- case TILFMT_16BIT:
- slot_w = DMM_PAGE_DIMM_X_MODE_16;
- slot_h = DMM_PAGE_DIMM_Y_MODE_16;
- break;
- case TILFMT_32BIT:
- slot_w = DMM_PAGE_DIMM_X_MODE_32;
- slot_h = DMM_PAGE_DIMM_Y_MODE_32;
- break;
- case TILFMT_PAGE:
- /* adjust size to accomodate offset, only do page alignment */
- *align = PAGE_SIZE;
- width += *offs & (PAGE_SIZE - 1);
-
- /* for 1D area keep the height (1), width is in tiler slots */
- *x_area = DIV_ROUND_UP(width, TILER_PAGE);
- *y_area = *band = 1;
-
- if (*x_area * *y_area > TILER_WIDTH * TILER_HEIGHT)
- return -1;
- return 0;
- default:
- return -EINVAL;
- }
-
- /* get the # of bytes per row in 1 slot */
- bpp = tilfmt_bpp(fmt);
- slot_row = slot_w * bpp;
-
- /* how many slots are can be accessed via one physical page */
- *band = PAGE_SIZE / slot_row;
-
- /* minimum alignment is 1 slot, default alignment is page size */
- *align = ALIGN(*align ? : PAGE_SIZE, slot_row);
-
- /* offset must be multiple of bpp */
- if (*offs & (bpp - 1))
- return -EINVAL;
-
- /* round down the offset to the nearest slot size, and increase width
- to allow space for having the correct offset */
- width += (*offs & (*align - 1)) / bpp;
- *offs &= ~(*align - 1);
-
- /* adjust to slots */
- *x_area = DIV_ROUND_UP(width, slot_w);
- *y_area = DIV_ROUND_UP(height, slot_h);
- *align /= slot_row;
- *offs /= slot_row;
-
- if (*x_area > TILER_WIDTH || *y_area > TILER_HEIGHT)
- return -1;
- return 0x0;
-}
-
-/**
- * Find a place where a 2D block would fit into a 2D area of the
- * same height.
- *
- * @author a0194118 (3/19/2010)
- *
- * @param w Width of the block.
- * @param align Alignment of the block.
- * @param offs Offset of the block (within alignment)
- * @param ai Pointer to area info
- * @param next Pointer to the variable where the next block
- * will be stored. The block should be inserted
- * before this block.
- *
- * @return the end coordinate (x1 + 1) where a block would fit,
- * or 0 if it does not fit.
- *
- * (must have mutex)
- */
-static u16 _m_blk_find_fit(u16 w, u16 align, u16 offs,
- struct area_info *ai, struct list_head **before)
-{
- int x = ai->area.p0.x + w + offs;
- struct til_mem_info *mi, *tmp;
-
- /* area blocks are sorted by x */
- list_for_each_entry_safe(mi, tmp, &ai->blocks, by_area) {
- /* check if buffer would fit before this area */
- if (x <= mi->area.p0.x) {
- *before = &mi->by_area;
- return x;
- }
- x = ALIGN(mi->area.p1.x + 1 - offs, align) + w + offs;
- }
- *before = &ai->blocks;
-
- /* check if buffer would fit after last area */
- return (x <= ai->area.p1.x + 1) ? x : 0;
-}
-
-/* (must have mutex) adds a block to an area with certain x coordinates */
-static inline
-struct til_mem_info *_m_add2area(struct til_mem_info *mi, struct area_info *ai,
- u16 x0, u16 x1, struct list_head *before)
-{
- mi->parent = ai;
- mi->area = ai->area;
- mi->area.p0.x = x0;
- mi->area.p1.x = x1;
- list_add_tail(&mi->by_area, before);
- ai->nblocks++;
- return mi;
-}
-
-static struct til_mem_info *get_2d_area(u16 w, u16 h, u16 align, u16 offs, u16 band,
- struct gid_info *gi, struct tcm *tcm) {
- struct area_info *ai = NULL, *ai_tmp = NULL;
- struct til_mem_info *mi = NULL, *tmp = NULL;
- struct list_head *before = NULL;
- u16 x = 0; /* this holds the end of a potential area */
-
- /* allocate map info */
-
- /* see if there is available prereserved space */
- mutex_lock(&mtx);
- list_for_each_entry_safe(mi, tmp, &gi->reserved, global) {
- if (mi->area.tcm == tcm &&
- tcm_aheight(mi->area) == h &&
- tcm_awidth(mi->area) == w &&
- (mi->area.p0.x & (align - 1)) == offs) {
- /* this area is already set up */
-
- /* remove from reserved list */
- list_del(&mi->global);
- if (tiler_alloc_debug & 1)
- fprintf(stderr, "(=2d (%d-%d,%d-%d) in (%d-%d,%d-%d) prereserved)\n",
- mi->area.p0.x, mi->area.p1.x,
- mi->area.p0.y, mi->area.p1.y,
- ((struct area_info *) mi->parent)->area.p0.x,
- ((struct area_info *) mi->parent)->area.p1.x,
- ((struct area_info *) mi->parent)->area.p0.y,
- ((struct area_info *) mi->parent)->area.p1.y);
- goto done;
- }
- }
- mutex_unlock(&mtx);
-
- /* if not, reserve a block struct */
- mi = kmalloc(sizeof(*mi), GFP_KERNEL);
- if (!mi)
- return mi;
- memset(mi, 0, sizeof(*mi));
-
- /* see if allocation fits in one of the existing areas */
- /* this sets x, ai and before */
- mutex_lock(&mtx);
- list_for_each_entry_safe(ai, ai_tmp, &gi->areas, by_gid) {
- if (ai->area.tcm == tcm &&
- tcm_aheight(ai->area) == h) {
- x = _m_blk_find_fit(w, align, offs, ai, &before);
- if (x) {
- _m_add2area(mi, ai, x - w, x - 1, before);
- if (tiler_alloc_debug & 1)
- fprintf(stderr, "(+2d (%d-%d,%d-%d) in (%d-%d,%d-%d) existing)\n",
- mi->area.p0.x, mi->area.p1.x,
- mi->area.p0.y, mi->area.p1.y,
- ((struct area_info *) mi->parent)->area.p0.x,
- ((struct area_info *) mi->parent)->area.p1.x,
- ((struct area_info *) mi->parent)->area.p0.y,
- ((struct area_info *) mi->parent)->area.p1.y);
- goto done;
- }
- }
- }
- mutex_unlock(&mtx);
-
- /* if no area fit, reserve a new one */
- ai = area_new(ALIGN(w + offs, max(band, align)), h,
- max(band, align), tcm, gi);
- if (ai) {
- mutex_lock(&mtx);
- _m_add2area(mi, ai, ai->area.p0.x + offs,
- ai->area.p0.x + offs + w - 1,
- &ai->blocks);
- if (tiler_alloc_debug & 1)
- fprintf(stderr, "(+2d (%d-%d,%d-%d) in (%d-%d,%d-%d) new)\n",
- mi->area.p0.x, mi->area.p1.x,
- mi->area.p0.y, mi->area.p1.y,
- ai->area.p0.x, ai->area.p1.x,
- ai->area.p0.y, ai->area.p1.y);
- } else {
- /* clean up */
- kfree(mi);
- return NULL;
- }
-
-done:
- mutex_unlock(&mtx);
- return mi;
-}
-
-/* (must have mutex) */
-static void _m_try_free_group(struct gid_info *gi)
-{
- if (gi && list_empty(&gi->areas) && list_empty(&gi->onedim)) {
- //WARN_ON(!list_empty(&gi->reserved));
- list_del(&gi->by_pid);
-
- /* if group is tracking kernel objects, we may free even
- the process info */
- if (gi->pi->kernel && list_empty(&gi->pi->groups)) {
- list_del(&gi->pi->list);
- kfree(gi->pi);
- }
-
- kfree(gi);
- }
-}
-
-static void clear_pat(struct tmm *tmm, struct tcm_area *area, enum tiler_fmt fmt)
-{
- struct pat_area p_area = {0};
- struct tcm_area slice, area_s;
- int i;
- u32 y_offset = 0;
-
-#ifdef TILER_PLATFORM_OMAP5
- if (fmt == TILFMT_PAGE)
- y_offset = 128;
-#endif
-
- tcm_for_each_slice(slice, *area, area_s) {
- p_area.x0 = slice.p0.x;
- p_area.y0 = slice.p0.y + y_offset;
- p_area.x1 = slice.p1.x;
- p_area.y1 = slice.p1.y + y_offset;
-
- for (i = 0; i<tcm_sizeof(slice); i++) {
- dmac_va[i] = dummy_pa;
- }
- /* save the info to use for context restore */
- (*tiler_save_pat)(&p_area, dmac_va);
-
- tmm_map(tmm, p_area, dmac_pa);
- }
-}
-
-/* (must have mutex) free block and any freed areas */
-static s32 _m_free(struct til_mem_info *mi)
-{
- struct area_info *ai = NULL;
- s32 res = 0;
-
- /* release memory */
- if (mi->pg_ptr) {
- kfree(mi->pg_ptr);
- } else if (mi->mem) {
- tmm_free(TMM_SS(mi->sys_addr), mi->mem);
- }
-
- /* safe deletion as list may not have been assigned */
- if (mi->global.next)
- list_del(&mi->global);
- if (mi->by_area.next)
- list_del(&mi->by_area);
-
- /* remove block from area first if 2D */
- if (mi->area.is2d) {
- ai = mi->parent;
-
- /* check to see if area needs removing also */
- if (ai && !--ai->nblocks) {
- if (tiler_alloc_debug & 1)
- fprintf(stderr, "(-2d (%d-%d,%d-%d) in (%d-%d,%d-%d) last)\n",
- mi->area.p0.x, mi->area.p1.x,
- mi->area.p0.y, mi->area.p1.y,
- ai->area.p0.x, ai->area.p1.x,
- ai->area.p0.y, ai->area.p1.y);
- clear_pat(TMM_SS(mi->sys_addr), &ai->area, TILER_GET_ACC_MODE(mi->sys_addr));
- res = tcm_free(&ai->area);
- list_del(&ai->by_gid);
- /* try to remove parent if it became empty */
- _m_try_free_group(ai->gi);
- kfree(ai);
- ai = NULL;
- } else if (tiler_alloc_debug & 1)
- fprintf(stderr, "(-2d (%d-%d,%d-%d) in (%d-%d,%d-%d) remaining)\n",
- mi->area.p0.x, mi->area.p1.x,
- mi->area.p0.y, mi->area.p1.y,
- ai->area.p0.x, ai->area.p1.x,
- ai->area.p0.y, ai->area.p1.y);
-
- } else {
- if (tiler_alloc_debug & 1)
- fprintf(stderr, "(-1d: %d,%d..%d,%d)\n",
- mi->area.p0.x, mi->area.p0.y,
- mi->area.p1.x, mi->area.p1.y);
- /* remove 1D area */
- clear_pat(TMM_SS(mi->sys_addr), &mi->area, TILER_GET_ACC_MODE(mi->sys_addr));
- res = tcm_free(&mi->area);
- /* try to remove parent if it became empty */
- _m_try_free_group(mi->parent);
- }
-
- kfree(mi);
- return res;
-}
-
-/* (must have mutex) returns true if block was freed */
-static bool _m_chk_ref(struct til_mem_info *mi)
-{
- /* check references */
- if (mi->refs)
- return 0;
-
- if (_m_free(mi))
- fprintf(stderr, "error while removing tiler block\n");
-
- return 1;
-}
-
-/* (must have mutex) */
-static inline s32 _m_dec_ref(struct til_mem_info *mi)
-{
- if (mi->refs-- <= 1)
- return _m_chk_ref(mi);
-
- return 0;
-}
-
-/* (must have mutex) */
-static inline void _m_inc_ref(struct til_mem_info *mi)
-{
- mi->refs++;
-}
-
-/* (must have mutex) returns true if block was freed */
-static inline bool _m_try_free(struct til_mem_info *mi)
-{
- if (mi->alloced) {
- mi->refs--;
- mi->alloced = false;
- }
- return _m_chk_ref(mi);
-}
-
-static s32 register_buf(struct __buf_info *_b, struct process_info *pi)
-{
- struct til_mem_info *mi = NULL, *tmp = NULL;
- struct tiler_buf_info *b = &_b->buf_info;
- u32 i, num = b->num_blocks, remain = num;
-
- /* check validity */
- if (num > TILER_MAX_NUM_BLOCKS)
- return -EINVAL;
-
- mutex_lock(&mtx);
-
- /* find each block */
- list_for_each_entry_safe(mi, tmp, &blocks, global) {
- for (i = 0; i < num; i++) {
- if (!_b->mi[i] && mi->sys_addr == b->blocks[i].ssptr) {
- _b->mi[i] = mi;
-
- /* quit if found all*/
- if (!--remain)
- break;
-
- }
- }
- }
-
- /* if found all, register buffer */
- if (!remain) {
- b->offset = id;
- id += 0x1000;
-
- list_add(&_b->by_pid, &pi->bufs);
-
- /* using each block */
- for (i = 0; i < num; i++)
- _m_inc_ref(_b->mi[i]);
- }
-
- mutex_unlock(&mtx);
-
- return remain ? -EACCES : 0;
-}
-
-/* must have mutex */
-static void _m_unregister_buf(struct __buf_info *_b)
-{
- u32 i;
-
- /* unregister */
- list_del(&_b->by_pid);
-
- /* no longer using the blocks */
- for (i = 0; i < _b->buf_info.num_blocks; i++)
- _m_dec_ref(_b->mi[i]);
-
- kfree(_b);
-}
-
-static int tiler_notify_event(int event, void *data)
-{
- struct list_head *elem, *tmp;
- struct reg_notif_info *info = NULL;
-
- /* TODO: need list protection */
- list_for_each_safe(elem, tmp, ®_notif) {
- info = (struct reg_notif_info *)elem;
- info->cb_ptr(event, data, info->arg);
- }
- /* TODO: need list protection */
-
- return 0;
-}
-
-static int tiler_notify_usr(int event_type, void *data, void *arg);
-
-/**
- * Free all info kept by a process:
- *
- * all registered buffers, allocated blocks, and unreferenced
- * blocks. Any blocks/areas still referenced will move to the
- * orphaned lists to avoid issues if a new process is created
- * with the same pid.
- *
- * (must have mutex)
- */
-static void _m_free_process_info(struct process_info *pi)
-{
- struct area_info *ai, *ai_;
- struct til_mem_info *mi, *mi_;
- struct gid_info *gi, *gi_;
- struct __buf_info *_b = NULL, *_b_ = NULL;
- bool ai_autofreed, need2free;
- struct list_head *elem, *tmp;
- struct reg_notif_usr_info *pvtInfo = NULL;
-
- list_for_each_safe(elem, tmp, ®_notif_usr) {
- pvtInfo = (struct reg_notif_usr_info *)elem;
- if (pvtInfo->pid == pi->pid) {
- tiler_unreg_notifier(&tiler_notify_usr, pvtInfo);
- list_del(elem);
- kfree(pvtInfo->name);
- kfree(pvtInfo);
- }
- }
-
- if (!list_empty(&pi->bufs))
- tiler_notify_event(TILER_DEVICE_CLOSE, (void *)pi->pid);
-
- /* unregister all buffers */
- list_for_each_entry_safe(_b, _b_, &pi->bufs, by_pid)
- _m_unregister_buf(_b);
-
- //WARN_ON(!list_empty(&pi->bufs));
-
- /* free all allocated blocks, and remove unreferenced ones */
- list_for_each_entry_safe(gi, gi_, &pi->groups, by_pid) {
-
- /*
- * Group info structs when they become empty on an _m_try_free.
- * However, if the group info is already empty, we need to
- * remove it manually
- */
- need2free = list_empty(&gi->areas) && list_empty(&gi->onedim);
- list_for_each_entry_safe(ai, ai_, &gi->areas, by_gid) {
- ai_autofreed = true;
- list_for_each_entry_safe(mi, mi_, &ai->blocks, by_area)
- ai_autofreed &= _m_try_free(mi);
-
- /* save orphaned areas for later removal */
- if (!ai_autofreed) {
- need2free = true;
- ai->gi = NULL;
- list_move(&ai->by_gid, &orphan_areas);
- }
- }
-
- list_for_each_entry_safe(mi, mi_, &gi->onedim, by_area) {
- if (!_m_try_free(mi)) {
- need2free = true;
- /* save orphaned 1D blocks */
- mi->parent = NULL;
- list_move(&mi->by_area, &orphan_onedim);
- }
- }
-
- /* if group is still alive reserved list should have been
- emptied as there should be no reference on those blocks */
- if (need2free) {
- //WARN_ON(!list_empty(&gi->onedim));
- //WARN_ON(!list_empty(&gi->areas));
- _m_try_free_group(gi);
- }
- }
-
- //WARN_ON(!list_empty(&pi->groups));
- list_del(&pi->list);
- kfree(pi);
-}
-
-static s32 get_area(u32 sys_addr, struct tcm_pt *pt)
-{
- enum tiler_fmt fmt;
-
- sys_addr &= TILER_ALIAS_VIEW_CLEAR;
- fmt = TILER_GET_ACC_MODE(sys_addr);
-
- switch (fmt) {
- case TILFMT_8BIT:
- pt->x = DMM_HOR_X_PAGE_COOR_GET_8(sys_addr);
- pt->y = DMM_HOR_Y_PAGE_COOR_GET_8(sys_addr);
- break;
- case TILFMT_16BIT:
- pt->x = DMM_HOR_X_PAGE_COOR_GET_16(sys_addr);
- pt->y = DMM_HOR_Y_PAGE_COOR_GET_16(sys_addr);
- break;
- case TILFMT_32BIT:
- pt->x = DMM_HOR_X_PAGE_COOR_GET_32(sys_addr);
- pt->y = DMM_HOR_Y_PAGE_COOR_GET_32(sys_addr);
- break;
- case TILFMT_PAGE:
- pt->x = (sys_addr & 0x7FFFFFF) >> 12;
- pt->y = pt->x / TILER_WIDTH;
- pt->x &= (TILER_WIDTH - 1);
- break;
- default:
- return -EFAULT;
- }
- return 0x0;
-}
-
-static u32 __get_alias_addr(enum tiler_fmt fmt, u16 x, u16 y)
-{
- u32 acc_mode = -1;
- u32 x_shft = -1, y_shft = -1;
-
- switch (fmt) {
- case TILFMT_8BIT:
- acc_mode = 0; x_shft = 6; y_shft = 20;
- break;
- case TILFMT_16BIT:
- acc_mode = 1; x_shft = 7; y_shft = 20;
- break;
- case TILFMT_32BIT:
- acc_mode = 2; x_shft = 7; y_shft = 20;
- break;
- case TILFMT_PAGE:
- acc_mode = 3; y_shft = 8;
- break;
- default:
- return 0;
- break;
- }
-
- if (fmt == TILFMT_PAGE)
- return (u32)TIL_ALIAS_ADDR((x | y << y_shft) << 12, acc_mode);
- else
- return (u32)TIL_ALIAS_ADDR(x << x_shft | y << y_shft, acc_mode);
-}
-
-/* must have mutex */
-static struct gid_info *_m_get_gi(struct process_info *pi, u32 gid)
-{
- struct gid_info *gi, *tmp;
-
- /* see if group already exist */
- list_for_each_entry_safe(gi, tmp, &pi->groups, by_pid) {
- if (gi->gid == gid)
- return gi;
- }
-
- /* create new group */
- gi = kmalloc(sizeof(*gi), GFP_KERNEL);
- if (!gi)
- return gi;
-
- memset(gi, 0, sizeof(*gi));
- INIT_LIST_HEAD(&gi->areas);
- INIT_LIST_HEAD(&gi->onedim);
- INIT_LIST_HEAD(&gi->reserved);
- gi->pi = pi;
- gi->gid = gid;
- list_add(&gi->by_pid, &pi->groups);
- return gi;
-}
-
-static struct til_mem_info *__get_area(enum tiler_fmt fmt, u32 width, u32 height,
- u16 align, u16 offs, struct gid_info *gi)
-{
- u16 x, y, band;
- struct til_mem_info *mi = NULL;
-
- /* calculate dimensions, band, offs and alignment in slots */
- if (__analyze_area(fmt, width, height, &x, &y, &band, &align, &offs))
- return NULL;
-
- if (fmt == TILFMT_PAGE) {
- /* 1D areas don't pack */
- mi = kmalloc(sizeof(*mi), GFP_KERNEL);
- if (!mi)
- return NULL;
- memset(mi, 0x0, sizeof(*mi));
-
- if (tcm_reserve_1d(TCM(fmt), x * y, &mi->area)) {
- kfree(mi);
- return NULL;
- }
- if (tiler_alloc_debug & 1)
- fprintf(stderr, "(+1d: %d,%d..%d,%d)\n",
- mi->area.p0.x, mi->area.p0.y,
- mi->area.p1.x, mi->area.p1.y);
- mutex_lock(&mtx);
- mi->parent = gi;
- list_add(&mi->by_area, &gi->onedim);
- } else {
- mi = get_2d_area(x, y, align, offs, band, gi, TCM(fmt));
- if (!mi)
- return NULL;
-
- mutex_lock(&mtx);
- }
-
- list_add(&mi->global, &blocks);
- mi->alloced = true;
- mi->refs++;
- mutex_unlock(&mtx);
-
- mi->sys_addr = __get_alias_addr(fmt, mi->area.p0.x, mi->area.p0.y);
- return mi;
-}
-
-#define PAGE_SHIFT 12
-
-int tiler_mmap(resmgr_context_t *ctp, uint32_t offset, tiler_ocb_t *ocb)
-{
- struct __buf_info *_b = NULL;
- struct tiler_buf_info *b = NULL;
- s32 i = 0, j = 0, k = 0, m = 0, p = 0, bpp = 1, size = 0;
- struct list_head *pos = NULL, *tmp = NULL;
- struct process_info *pi = ocb->pi;
- void *va = NULL;
- void *ret = NULL;
- int rc = 0;
-
- mutex_lock(&mtx);
- list_for_each_safe(pos, tmp, &pi->bufs) {
- _b = list_entry(pos, struct __buf_info, by_pid);
- if (offset == _b->buf_info.offset)
- break;
- }
- mutex_unlock(&mtx);
- if (!_b)
- return -ENXIO;
-
- /* First get the total size of the area to map. */
- b = &_b->buf_info;
- for (i = 0; i < b->num_blocks; i++) {
- if (b->blocks[i].fmt >= TILFMT_8BIT &&
- b->blocks[i].fmt <= TILFMT_32BIT) {
- /* get line width */
- bpp = (b->blocks[i].fmt == TILFMT_8BIT ? 1 :
- b->blocks[i].fmt == TILFMT_16BIT ? 2 : 4);
- p = PAGE_ALIGN(b->blocks[i].dim.area.width * bpp);
-
- for (j = 0; j < b->blocks[i].dim.area.height; j++) {
- size += p;
- }
- } else if (b->blocks[i].fmt == TILFMT_PAGE) {
- p = PAGE_ALIGN(b->blocks[i].dim.len);
- size += p;
- }
- }
-
- /* Do a dummy mapping of this area to get contiguous virtual mem. */
- va = mmap64_peer(ctp->info.pid, NULL, size, PROT_NOCACHE | PROT_NONE, MAP_ANON | MAP_LAZY, NOFD, 0);
- if (va == MAP_FAILED) {
- fprintf(stderr, "tiler_mmap: mmap failed.");
- return -EAGAIN;
- }
-
- i = 0;
- j = 0;
- k = 0;
- m = 0;
- p = 0;
- bpp = 1;
- b = &_b->buf_info;
- for (i = 0; i < b->num_blocks; i++) {
- if (b->blocks[i].fmt >= TILFMT_8BIT &&
- b->blocks[i].fmt <= TILFMT_32BIT) {
- /* get line width */
- bpp = (b->blocks[i].fmt == TILFMT_8BIT ? 1 :
- b->blocks[i].fmt == TILFMT_16BIT ? 2 : 4);
- p = PAGE_ALIGN(b->blocks[i].dim.area.width * bpp);
-
- for (j = 0; j < b->blocks[i].dim.area.height; j++) {
- /* map each page of the line */
- ret = mmap64_peer(ctp->info.pid, va + k, p,
- PROT_NOCACHE | PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_PHYS | MAP_SHARED, NOFD,
- (b->blocks[i].ssptr + m));
- if (ret != va + k) {
- /* TODO: should unmap any mapped regions upon failure? */
- return -EAGAIN;
- }
- k += p;
- if (b->blocks[i].fmt == TILFMT_8BIT)
- m += 64*TILER_WIDTH;
- else
- m += 2*64*TILER_WIDTH;
- }
- m = 0;
- } else if (b->blocks[i].fmt == TILFMT_PAGE) {
- p = PAGE_ALIGN(b->blocks[i].dim.len);
- /* protect shm_open/unlink, so that each open gets a
- * unique memory object */
- mutex_lock(&mtx);
- int fd = shm_open("tiler1dmem",
- O_RDWR|O_CREAT|O_TRUNC, 0600);
- if (fd == -1) {
- mutex_unlock(&mtx);
- perror("tiler_mmap: shm_open");
- return -EAGAIN;
- }
- shm_unlink("tiler1dmem");
- mutex_unlock(&mtx);
- /* Want non-cacheable, bufferable memory (Device memory)
- * This translates for ARMv7 to
- * TEX=0, C=0, B=1, S=ignored for device memory */
- int special = ARM_PTE_V6_SP_TEX(0) | ARM_PTE_B;
- rc = shm_ctl_special(fd, SHMCTL_PHYS,
- (unsigned)(b->blocks[i].ssptr),
- p, special);
- if (rc == -1) {
- perror("tiler_mmap: shm_ctl_special");
- close (fd);
- return -EAGAIN;
- }
- ret = mmap64_peer(ctp->info.pid, va + k, p,
- PROT_NOCACHE | PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_SHARED, fd, 0);
- close (fd);
- if (ret != va + k) {
- /* TODO: should unmap any mapped regions upon failure? */
- return -EAGAIN;
- }
- k += p;
- }
- }
-
- return (int)va;
-}
-
-static s32 refill_pat(struct tmm *tmm, struct tcm_area *area, u32 *ptr, enum tiler_fmt fmt)
-{
- s32 res = 0;
- struct pat_area p_area = {0};
- struct tcm_area slice, area_s;
- u32 y_offset = 0;
-
-#ifdef TILER_PLATFORM_OMAP5
- if (fmt == TILFMT_PAGE)
- y_offset = 128;
-#endif
-
- tcm_for_each_slice(slice, *area, area_s) {
- p_area.x0 = slice.p0.x;
- p_area.y0 = slice.p0.y + y_offset;
- p_area.x1 = slice.p1.x;
- p_area.y1 = slice.p1.y + y_offset;
-
- memcpy(dmac_va, ptr, sizeof(*ptr) * tcm_sizeof(slice));
- /* save the info to use for context restore */
- (*tiler_save_pat)(&p_area, ptr);
-
- ptr += tcm_sizeof(slice);
-
- if (tmm_map(tmm, p_area, dmac_pa)) {
- res = -EFAULT;
- break;
- }
- }
-
- return res;
-}
-
-static s32 map_block(enum tiler_fmt fmt, u32 width, u32 height, u32 gid,
- struct process_info *pi, u32 *sys_addr, u32 usr_addr)
-{
- u32 i = 0, j = 0, tmp = -1, len = 0, bytes = 0;
- s64 offset = 0;
- s32 res = -ENOMEM, status = 0;
- struct til_mem_info *mi = NULL;
- struct gid_info *gi = NULL;
-
- /* we only support mapping a user buffer in page mode */
- if (fmt != TILFMT_PAGE)
- return -EPERM;
-
- /* check if mapping is supported by tmm */
- if (!tmm_can_map(TMM(fmt)))
- return -EPERM;
-
- /* get group context */
- mutex_lock(&mtx);
- gi = _m_get_gi(pi, gid);
- mutex_unlock(&mtx);
-
- if (!gi)
- return -ENOMEM;
-
- /* reserve area in tiler container */
- mi = __get_area(fmt, width, height, 0, 0, gi);
- if (!mi) {
- mutex_lock(&mtx);
- _m_try_free_group(gi);
- mutex_unlock(&mtx);
- return -ENOMEM;
- }
-
- *sys_addr = mi->sys_addr;
- mi->usr = usr_addr;
-
- /* allocate pages */
- mi->num_pg = tcm_sizeof(mi->area);
-
- mi->pg_ptr = kmalloc(mi->num_pg * sizeof(*mi->pg_ptr), GFP_KERNEL);
- if (!mi->pg_ptr)
- goto done;
- memset(mi->pg_ptr, 0x0, sizeof(*mi->pg_ptr) * mi->num_pg);
-
- /*
- * Important Note: usr_addr is mapped from user
- * application process to current process - it must lie
- * completely within the current virtual memory address
- * space in order to be of use to us here.
- */
- res = -EFAULT;
-
- /*
- * It is observed that under some circumstances, the user
- * buffer is spread across several vmas, so loop through
- * and check if the entire user buffer is covered.
- */
- tmp = mi->usr;
- bytes = mi->num_pg * PAGE_SIZE;
- do {
- status = mem_offset64_peer(pi->pid, tmp, bytes, &offset, &len);
- if (status == 0) {
- for (j = 0; j < len/PAGE_SIZE; j++) {
- mi->pg_ptr[i++] = offset;
- offset += PAGE_SIZE;
- }
- tmp += len;
- bytes -= len;
- }
- else {
- fprintf(stderr, "mem_offset64_peer() failed %d", errno);
- goto fault;
- }
- } while (bytes > 0);
-
- /* Ensure the data reaches to main memory before PAT refill */
- wmb();
-
- mutex_lock(&mtx);
- if (refill_pat(TMM(fmt), &mi->area, mi->pg_ptr, fmt)) {
- mutex_unlock(&mtx);
- goto fault;
- }
- mutex_unlock(&mtx);
-
- res = 0;
- goto done;
-fault:
-done:
- if (res) {
- mutex_lock(&mtx);
- _m_free(mi);
- mutex_unlock(&mtx);
- }
- return res;
-}
-
-s32 tiler_mapx(enum tiler_fmt fmt, u32 width, u32 height, u32 gid,
- void *pi, u32 *sys_addr, u32 usr_addr)
-{
- return map_block(fmt, width, height, gid, (struct process_info *)pi,
- sys_addr, usr_addr);
-}
-
-s32 tiler_map(enum tiler_fmt fmt, u32 width, u32 height, u32 *sys_addr,
- u32 usr_addr)
-{
- return tiler_mapx(fmt, width, height, 0, NULL, sys_addr,
- usr_addr);
-}
-
-static s32 free_block(u32 sys_addr, struct process_info *pi)
-{
- struct gid_info *gi = NULL, *gi_tmp = NULL;
- struct area_info *ai = NULL, *ai_tmp = NULL;
- struct til_mem_info *mi = NULL, *mi_tmp = NULL;
- s32 res = -ENOENT;
-
- mutex_lock(&mtx);
-
- /* find block in process list and free it */
- list_for_each_entry_safe(gi, gi_tmp, &pi->groups, by_pid) {
- /* currently we know if block is 1D or 2D by the address */
- if (TILER_GET_ACC_MODE(sys_addr) == TILFMT_PAGE) {
- list_for_each_entry_safe(mi, mi_tmp, &gi->onedim, by_area) {
- if (mi->sys_addr == sys_addr) {
- _m_try_free(mi);
- res = 0;
- goto done;
- }
- }
- } else {
- list_for_each_entry_safe(ai, ai_tmp, &gi->areas, by_gid) {
- list_for_each_entry_safe(mi, mi_tmp, &ai->blocks, by_area) {
- if (mi->sys_addr == sys_addr) {
- _m_try_free(mi);
- res = 0;
- goto done;
- }
- }
- }
- }
- }
-
-done:
- mutex_unlock(&mtx);
-
- /* for debugging, we can set the PAT entries to DMM_LISA_MAP__0 */
- return res;
-}
-
-s32 tiler_free(u32 sys_addr)
-{
- struct til_mem_info *mi, *mi_tmp;
- s32 res = -ENOENT;
-
- mutex_lock(&mtx);
-
- /* find block in global list and free it */
- list_for_each_entry_safe(mi, mi_tmp, &blocks, global) {
- if (mi->sys_addr == sys_addr) {
- _m_try_free(mi);
- res = 0;
- break;
- }
- }
- mutex_unlock(&mtx);
-
- /* for debugging, we can set the PAT entries to DMM_LISA_MAP__0 */
- return res;
-}
-
-/* :TODO: Currently we do not track enough information from alloc to get back
- the actual width and height of the container, so we must make a guess. We
- do not even have enough information to get the virtual stride of the buffer,
- which is the real reason for this ioctl */
-static s32 find_block(u32 sys_addr, struct tiler_block_info *blk)
-{
- struct til_mem_info *i, *tmp;
- struct tcm_pt pt;
-
- if (get_area(sys_addr, &pt))
- return -EFAULT;
-
- list_for_each_entry_safe(i, tmp, &blocks, global) {
- if (tcm_is_in(pt, i->area))
- goto found;
- }
-
- blk->fmt = TILFMT_INVALID;
- blk->dim.len = blk->stride = blk->ssptr = 0;
- return -EFAULT;
-
-found:
- blk->ptr = NULL;
- blk->fmt = TILER_GET_ACC_MODE(sys_addr);
- blk->ssptr = __get_alias_addr(blk->fmt, i->area.p0.x, i->area.p0.y);
-
- if (blk->fmt == TILFMT_PAGE) {
- blk->dim.len = tcm_sizeof(i->area) * TILER_PAGE;
- blk->stride = 0;
- } else {
- blk->stride = blk->dim.area.width =
- tcm_awidth(i->area) * TILER_BLOCK_WIDTH;
- blk->dim.area.height = tcm_aheight(i->area)
- * TILER_BLOCK_HEIGHT;
- if (blk->fmt != TILFMT_8BIT) {
- blk->stride <<= 1;
- blk->dim.area.height >>= 1;
- if (blk->fmt == TILFMT_32BIT)
- blk->dim.area.width >>= 1;
- }
- blk->stride = PAGE_ALIGN(blk->stride);
- }
- return 0;
-}
-
-static s32 alloc_block(enum tiler_fmt fmt, u32 width, u32 height,
- u32 align, u32 offs, u32 gid, struct process_info *pi,
- u32 *sys_addr);
-
-int
-tiler_devctl(resmgr_context_t *ctp, io_devctl_t *msg, tiler_ocb_t *ocb)
-{
- int status;
- int nbytes=0;
- s32 r = -1;
- u32 til_addr = 0x0;
- struct process_info *pi = ocb->pi;
- u64 gssp_ptr = 0;
- u32 size = 0;
-
- struct __buf_info *_b = NULL, *_b_tmp = NULL;
- struct tiler_buf_info *buf_info;
- struct tiler_block_info *block_info;
- uint32_t *offset = NULL;
-
- if ((status = iofunc_devctl_default(ctp, msg, &ocb->hdr)) != _RESMGR_DEFAULT)
- return(_RESMGR_ERRNO(status));
- status=0;
-
- switch (msg->i.dcmd)
- {
- case TILIOC_MMAP:
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(uint32_t)) {
- msg->o.ret_val = (int32_t)MAP_FAILED;
- return (_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- offset = (uint32_t *)_DEVCTL_DATA(msg->i);
- msg->o.ret_val = tiler_mmap(ctp, *offset, ocb);
- if (msg->o.ret_val < 0) {
- msg->o.ret_val = (int32_t)MAP_FAILED;
- }
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(uint32_t)));
- break;
- case TILIOC_GBUF:
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_block_info)) {
- msg->o.ret_val = -EINVAL;
- return (_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- // get a pointer to the structure
- block_info = (struct tiler_block_info *)_DEVCTL_DATA(msg->i);
-
- switch (block_info->fmt) {
- case TILFMT_PAGE:
- r = alloc_block(block_info->fmt, block_info->dim.len, 1,
- 0, 0, 0, pi, &til_addr);
- if (r) {
- msg->o.ret_val = r;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_block_info)));
- }
- break;
- case TILFMT_8BIT:
- case TILFMT_16BIT:
- case TILFMT_32BIT:
- r = alloc_block(block_info->fmt,
- block_info->dim.area.width,
- block_info->dim.area.height,
- 0, 0, 0, pi, &til_addr);
- if (r) {
- msg->o.ret_val = r;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_block_info)));
- }
- break;
- default:
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_block_info)));
- }
-
- block_info->ssptr = til_addr;
- msg->o.ret_val = 0;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_block_info)));
- break;
- case TILIOC_FBUF:
- case TILIOC_UMBUF:
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_block_info)) {
- msg->o.ret_val = -EINVAL;
- return (_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- block_info = (struct tiler_block_info *)_DEVCTL_DATA(msg->i);
-
- /* search current process first, then all processes */
- free_block(block_info->ssptr, pi) ?
- tiler_free(block_info->ssptr) : 0;
-
- /* free always succeeds */
- msg->o.ret_val = 0;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_block_info)));
- break;
-
- case TILIOC_GSSP:
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(uint32_t)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- offset = (uint32_t *)_DEVCTL_DATA(msg->i);
- status = mem_offset64_peer(ctp->info.pid, *offset, 1, (s64 *)&gssp_ptr, &size);
- if (status < 0) {
- msg->o.ret_val = 0;
- }
- else {
- msg->o.ret_val = gssp_ptr;
- }
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(uint32_t)));
- break;
- case TILIOC_MBUF:
- if (ctp->info.msglen - sizeof(msg->i) < sizeof (struct tiler_block_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- block_info = (struct tiler_block_info *)_DEVCTL_DATA(msg->i);
-
- if (!block_info->ptr) {
- msg->o.ret_val = -EFAULT;
- return (_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_block_info)));
- }
-
- if (map_block(block_info->fmt, block_info->dim.len, 1, 0, pi,
- &block_info->ssptr, (u32)block_info->ptr)) {
- msg->o.ret_val = -ENOMEM;
- return (_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_block_info)));
- }
-
- msg->o.ret_val = 0;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_block_info)));
-
- break;
- case TILIOC_QBUF:
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_buf_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- buf_info = (struct tiler_buf_info *)_DEVCTL_DATA(msg->i);
-
- mutex_lock(&mtx);
- list_for_each_entry_safe(_b, _b_tmp, &pi->bufs, by_pid) {
- if (buf_info->offset == _b->buf_info.offset) {
- memcpy(buf_info, &_b->buf_info, sizeof(_b->buf_info));
- msg->o.ret_val = 0;
- mutex_unlock(&mtx);
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_buf_info)));
- }
- }
- mutex_unlock(&mtx);
- msg->o.ret_val = -EFAULT;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_buf_info)));
- break;
- case TILIOC_RBUF:
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_buf_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- _b = kmalloc(sizeof(*_b), GFP_KERNEL);
- if (!_b) {
- msg->o.ret_val = -ENOMEM;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_buf_info)));
- }
- memset(_b, 0x0, sizeof(*_b));
-
- buf_info = (struct tiler_buf_info *)_DEVCTL_DATA(msg->i);
- memcpy(&_b->buf_info, buf_info, sizeof(_b->buf_info));
-
- r = register_buf(_b, pi);
- if (r) {
- kfree(_b);
- msg->o.ret_val = -EACCES;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_buf_info)));
- }
-
- memcpy(buf_info, &_b->buf_info, sizeof(_b->buf_info));
- msg->o.ret_val = 0;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_buf_info)));
- break;
- case TILIOC_URBUF:
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_buf_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- buf_info = (struct tiler_buf_info *)_DEVCTL_DATA(msg->i);
-
- pthread_mutex_lock(&mtx);
- /* buffer registration is per process */
- list_for_each_entry_safe(_b, _b_tmp, &pi->bufs, by_pid) {
- if (buf_info->offset == _b->buf_info.offset) {
- _m_unregister_buf(_b);
- mutex_unlock(&mtx);
- msg->o.ret_val = 0;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_buf_info)));
- }
- }
- mutex_unlock(&mtx);
- msg->o.ret_val = -EFAULT;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_buf_info)));
- break;
- case TILIOC_QUERY_BLK:
- if (ctp->info.msglen - sizeof(msg->i) < sizeof (struct tiler_block_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- block_info = (struct tiler_block_info *)_DEVCTL_DATA(msg->i);
-
- if (find_block(block_info->ssptr, block_info)) {
- msg->o.ret_val = -EFAULT;
- return (_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_block_info)));
- }
-
- msg->o.ret_val = 0;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_block_info)));
- break;
- case TILIOC_USRMX:
- {
- struct tiler_mapx_info *info = (struct tiler_mapx_info *)_DEVCTL_DATA(msg->i);
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_mapx_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- msg->o.ret_val = tiler_mapx(info->fmt, info->width, info->height, info->gid,
- pi, &info->sys_addr, info->usr_addr);
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_mapx_info)));
- break;
- }
- case TILIOC_USRF:
- case TILIOC_USRFB:
- {
- u32 *free_addr = (u32 *)_DEVCTL_DATA(msg->i);
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(u32)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- msg->o.ret_val = tiler_free(*free_addr);
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(u32)));
- break;
- }
- case TILIOC_USRGX:
- {
- struct tiler_allocx_info *info = (struct tiler_allocx_info *)_DEVCTL_DATA(msg->i);
- if (ctp->info.msglen - sizeof(msg->i) < sizeof (struct tiler_allocx_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- msg->o.ret_val = tiler_allocx(info->fmt, info->width, info->height,
- info->align, info->offs, info->gid, (void *)pi, &info->sys_addr);
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_allocx_info)));
- break;
- }
- case TILIOC_USRRX:
- {
- struct tiler_reservex_info *info = (struct tiler_reservex_info *)_DEVCTL_DATA(msg->i);
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_reservex_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- msg->o.ret_val = tiler_reservex(info->n, &info->b, info->pid);
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_reservex_info)));
- break;
- }
- case TILIOC_USRGP:
- {
- struct tiler_allocp_info *info = (struct tiler_allocp_info *)_DEVCTL_DATA(msg->i);
- int count = 0;
- void **sysptr_info = (void **)(info+1);
- void **allocptr_info = (void **)(NULL);
- uint32_t total_bytes = 0;
-
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_allocp_info)) {
- msg->o.ret_val = -EINVAL;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
- count = info->count;
- total_bytes = sizeof(struct tiler_allocp_info) + 2 * sizeof(void*) * count;
- if (total_bytes <= count || ctp->info.msglen - sizeof(msg->i) < total_bytes) {
- msg->o.ret_val = -EINVAL;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
- allocptr_info = (void **)((sizeof(void*) * count) + (char *)(sysptr_info));
- tiler_alloc_packed(&info->count, info->fmt, info->width, info->height,
- sysptr_info, allocptr_info, info->aligned, ocb->pi);
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o) + sizeof(struct tiler_allocp_info));
- SETIOV(&ctp->iov[1], sysptr_info, sizeof(void*) * count);
- SETIOV(&ctp->iov[2], allocptr_info, sizeof(void*) * count);
- return _RESMGR_NPARTS(3);
- break;
- }
- case TILIOC_USRGPNV12OPT:
- {
- struct tiler_allocpnv12_info *info = (struct tiler_allocpnv12_info *)_DEVCTL_DATA(msg->i);
- int array_size = 0;
- int width = 0;
- int count = 0;
- int i = 0, j = 0;
- int bufsperpage = 0;
- void **y_sysptr_info = (void **)(info+1);
- void **uv_sysptr_info = (void **)(NULL);
- void **y_allocptr_info = (void **)(NULL);
- void **uv_allocptr_info = (void **)(NULL);
- uint32_t total_bytes = 0;
-
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_allocpnv12_info)) {
- msg->o.ret_val = -EINVAL;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
- array_size = info->count;
- width = info->width;
- count = info->count;
- total_bytes = sizeof(struct tiler_allocpnv12_info) + 4 * sizeof(void*) * array_size;
- if (total_bytes <= array_size || ctp->info.msglen - sizeof(msg->i) < total_bytes) {
- msg->o.ret_val = -EINVAL;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
- uv_sysptr_info = (void **)((sizeof(void*) * array_size) + (char *)(y_sysptr_info));
- y_allocptr_info = (void **)((sizeof(void*) * array_size) + (char *)(uv_sysptr_info));
- uv_allocptr_info = (void **)((sizeof(void*) * array_size) + (char *)(y_allocptr_info));
- if (info->width != 0) {
- bufsperpage = PAGE_SIZE / info->width;
- if (bufsperpage > 1 && info->count > 1) {
- /* we can do some creative packing */
- count = (info->count + bufsperpage - 1) / bufsperpage;
- width *= MIN(bufsperpage, info->count);
- info->count = count;
- }
- }
- tiler_alloc_packed_nv12(&info->count, width, info->height,
- y_sysptr_info, uv_sysptr_info,
- y_allocptr_info, uv_allocptr_info,
- info->aligned, ocb->pi);
- if (width > info->width) {
- void *ysys_info[info->count];
- void *uvsys_info[info->count];
- memcpy(ysys_info, y_sysptr_info, info->count * sizeof(void*));
- memcpy(uvsys_info, uv_sysptr_info, info->count * sizeof(void*));
- info->count = MIN(info->count * bufsperpage, array_size);
- for (i = 0; i < count; i++) {
- for (j = 0; j < bufsperpage && (i * bufsperpage + j) < info->count; j++) {
- y_sysptr_info[(i * bufsperpage) + j] = ysys_info[i] + (info->width * j);
- uv_sysptr_info[(i * bufsperpage) + j] = uvsys_info[i] + (info->width * j);
- }
- }
- }
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o) + sizeof(struct tiler_allocpnv12_info));
- SETIOV(&ctp->iov[1], y_sysptr_info, sizeof(void*) * array_size);
- SETIOV(&ctp->iov[2], uv_sysptr_info, sizeof(void*) * array_size);
- SETIOV(&ctp->iov[3], y_allocptr_info, sizeof(void*) * array_size);
- SETIOV(&ctp->iov[4], uv_allocptr_info, sizeof(void*) * array_size);
- return _RESMGR_NPARTS(5);
- break;
- }
- case TILIOC_USRGPNV12:
- {
- struct tiler_allocpnv12_info *info = (struct tiler_allocpnv12_info *)_DEVCTL_DATA(msg->i);
- int count = 0;
- void **y_sysptr_info = (void **)(info+1);
- void **uv_sysptr_info = (void **)(NULL);
- void **y_allocptr_info = (void **)(NULL);
- void **uv_allocptr_info = (void **)(NULL);
- uint32_t total_bytes = 0;
-
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_allocpnv12_info)) {
- msg->o.ret_val = -EINVAL;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
- count = info->count;
- total_bytes = sizeof(struct tiler_allocpnv12_info) + 4 * sizeof(void*) * count;
- if (total_bytes <= count || ctp->info.msglen - sizeof(msg->i) < total_bytes) {
- msg->o.ret_val = -EINVAL;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
- uv_sysptr_info = (void **)((sizeof(void*) * count) + (char *)(y_sysptr_info));
- y_allocptr_info = (void **)((sizeof(void*) * count) + (char *)(uv_sysptr_info));
- uv_allocptr_info = (void **)((sizeof(void*) * count) + (char *)(y_allocptr_info));
- tiler_alloc_packed_nv12(&info->count, info->width, info->height,
- y_sysptr_info, uv_sysptr_info,
- y_allocptr_info, uv_allocptr_info,
- info->aligned, ocb->pi);
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o) + sizeof(struct tiler_allocpnv12_info));
- SETIOV(&ctp->iov[1], y_sysptr_info, sizeof(void*) * count);
- SETIOV(&ctp->iov[2], uv_sysptr_info, sizeof(void*) * count);
- SETIOV(&ctp->iov[3], y_allocptr_info, sizeof(void*) * count);
- SETIOV(&ctp->iov[4], uv_allocptr_info, sizeof(void*) * count);
- return _RESMGR_NPARTS(5);
- break;
- }
- case TILIOC_USRROA:
- {
- struct tiler_reorient_info *info = (struct tiler_reorient_info *)_DEVCTL_DATA(msg->i);
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_reorient_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- msg->o.ret_val = tiler_reorient_addr(info->tsptr, info->orient);
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_reorient_info)));
- break;
- }
- case TILIOC_USRGNA:
- {
- u32 *nat_addr = (u32 *)_DEVCTL_DATA(msg->i);
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(u32)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- msg->o.ret_val = tiler_get_natural_addr((void *)*nat_addr);
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- break;
- }
- case TILIOC_USRROTL:
- {
- struct tiler_reorient_tl_info *info = (struct tiler_reorient_tl_info *)_DEVCTL_DATA(msg->i);
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_reorient_tl_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- msg->o.ret_val = tiler_reorient_topleft(info->tsptr, info->orient,
- info->width, info->height);
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_reorient_tl_info)));
- break;
- }
- case TILIOC_USRSTRIDE:
- {
- u32 *stride_val = (u32 *)_DEVCTL_DATA(msg->i);
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(u32)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- msg->o.ret_val = tiler_stride(*stride_val);
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(u32)));
- break;
- }
- case TILIOC_USRRV:
- {
- struct tiler_rotate_view_info *info = (struct tiler_rotate_view_info *)_DEVCTL_DATA(msg->i);
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(struct tiler_rotate_view_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- tiler_rotate_view(&info->orient, info->rotation);
- msg->o.ret_val = 0;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(struct tiler_rotate_view_info)));
- break;
- }
- case TILIOC_REGNOTIFY:
- {
- struct tiler_regnotify_info *info = (struct tiler_regnotify_info *)_DEVCTL_DATA(msg->i);
- char *name = (char *)(info + 1);
- struct list_head *elem, *tmp;
- int count = 0;
- struct reg_notif_usr_info *pvtInfo = NULL;
-
- if (ctp->info.msglen - sizeof(msg->i) < sizeof (struct tiler_regnotify_info)) {
- msg->o.ret_val = -EINVAL;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
- if (info->name_len > TILER_REGNOTIFY_MAX_NAME_LEN) {
- msg->o.ret_val = -EINVAL;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
- if (ctp->info.msglen - sizeof(msg->i) < sizeof (struct tiler_regnotify_info) + info->name_len) {
- msg->o.ret_val = -EINVAL;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
-
- /* Check if this process has already registered the max number of callbacks */
- list_for_each_safe(elem, tmp, ®_notif_usr) {
- pvtInfo = (struct reg_notif_usr_info *)elem;
- if (pvtInfo->pid == pi->pid) {
- count++;
- }
- }
- if (count >= TILER_REGNOTIFY_MAX_REGISTERED) {
- msg->o.ret_val = -EINVAL;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
-
- pvtInfo = NULL;
- pvtInfo = (struct reg_notif_usr_info *)kmalloc(sizeof(*pvtInfo), GFP_KERNEL);
- if (pvtInfo) {
- pvtInfo->cmd = info->cmd;
- pvtInfo->name_len = info->name_len;
- pvtInfo->pid = pi->pid;
- pvtInfo->name = (char *)kmalloc(sizeof(char) * info->name_len + 1, GFP_KERNEL);
- if (pvtInfo->name) {
- memset (pvtInfo->name, 0, info->name_len + 1);
- strncpy (pvtInfo->name, name, info->name_len);
- list_add(pvtInfo, ®_notif_usr);
- msg->o.ret_val = tiler_reg_notifier(&tiler_notify_usr, pvtInfo);
- }
- else {
- msg->o.ret_val = -ENOMEM;
- }
- }
- else {
- msg->o.ret_val = -ENOMEM;
- }
- if (msg->o.ret_val < 0) {
- if (pvtInfo) {
- if (pvtInfo->name) {
- list_del(pvtInfo);
- kfree (pvtInfo->name);
- }
- kfree (pvtInfo);
- }
- }
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o) + sizeof(struct tiler_regnotify_info));
- return _RESMGR_NPARTS(1);
- break;
- }
- case TILIOC_UNREGNOTIFY:
- {
- struct tiler_regnotify_info *info = (struct tiler_regnotify_info *)_DEVCTL_DATA(msg->i);
- char *name = (char *)(info + 1);
- struct list_head *elem, *tmp;
- struct reg_notif_usr_info *pvtInfo = NULL;
-
- if (ctp->info.msglen - sizeof(msg->i) < sizeof (struct tiler_regnotify_info)) {
- msg->o.ret_val = -ENOMEM;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
- if (ctp->info.msglen - sizeof(msg->i) < sizeof (struct tiler_regnotify_info) + info->name_len) {
- msg->o.ret_val = -ENOMEM;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o));
- return _RESMGR_NPARTS(1);
- }
-
- list_for_each_safe(elem, tmp, ®_notif_usr) {
- pvtInfo = (struct reg_notif_usr_info *)elem;
- if (pvtInfo->name_len == info->name_len &&
- pvtInfo->cmd == info->cmd &&
- !strncmp(pvtInfo->name, name, pvtInfo->name_len)) {
- break;
- }
- }
- if (elem != ®_notif_usr) {
- msg->o.ret_val = tiler_unreg_notifier(&tiler_notify_usr, pvtInfo);
- list_del(elem);
- kfree(pvtInfo->name);
- kfree(pvtInfo);
- }
- else
- msg->o.ret_val = -EINVAL;
- SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o) + sizeof(struct tiler_regnotify_info));
- return _RESMGR_NPARTS(1);
- break;
- }
- case TILIOC_USRGB:
- {
- struct tiler_alloc_block_area_info *info =
- (struct tiler_alloc_block_area_info *)_DEVCTL_DATA(msg->i);
- if (ctp->info.msglen - sizeof(msg->i) <
- sizeof (struct tiler_alloc_block_area_info)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- msg->o.ret_val = tiler_alloc_block_area(info->fmt,
- info->width, info->height,
- info->gid, (void *)pi,
- &info->sys_addr,
- &info->num_pages);
- return(_RESMGR_PTR(ctp, &msg->o,
- sizeof(msg->o) + sizeof(struct tiler_alloc_block_area_info)));
- break;
- }
- case TILIOC_USRMB:
- {
- struct tiler_map_block_info *info =
- (struct tiler_map_block_info *)_DEVCTL_DATA(msg->i);
- u32 *pa = (u32 *)(info+1);
- uint32_t total_bytes = 0;
- s32 ret = 0;
-
- if (ctp->info.msglen - sizeof(msg->i) <
- sizeof(struct tiler_map_block_info)) {
- return _RESMGR_ERRNO(EINVAL);
- }
- total_bytes = sizeof(struct tiler_map_block_info) +
- sizeof(u32) * info->num_pages;
- if (ctp->info.msglen - sizeof(msg->i) < total_bytes) {
- return _RESMGR_ERRNO(EINVAL);
- }
- ret = tiler_map_block(info->sys_addr, info->num_pages, pa);
- if (ret)
- return _RESMGR_ERRNO(-ret);
- else
- return _RESMGR_ERRNO(EOK);
- break;
- }
- case TILIOC_USRUMB:
- {
- u32 *unmap_addr = (u32 *)_DEVCTL_DATA(msg->i);
- if (ctp->info.msglen - sizeof(msg->i) < sizeof(u32)) {
- msg->o.ret_val = -EINVAL;
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
- }
- msg->o.ret_val = tiler_unmap_block(*unmap_addr);
- return(_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) + sizeof(u32)));
- break;
- }
- default:
- return (ENOSYS);
- }
- _IO_SET_WRITE_NBYTES (ctp, nbytes);
- return (_RESMGR_NPARTS(0));
-}
-
-static s32 alloc_block(enum tiler_fmt fmt, u32 width, u32 height,
- u32 align, u32 offs, u32 gid, struct process_info *pi,
- u32 *sys_addr)
-{
- struct til_mem_info *mi = NULL;
- struct gid_info *gi = NULL;
-
- /* only support up to page alignment */
- if (align > PAGE_SIZE || offs > align || !pi)
- return -EINVAL;
-
- /* get group context */
- mutex_lock(&mtx);
- gi = _m_get_gi(pi, gid);
- mutex_unlock(&mtx);
-
- if (!gi)
- return -ENOMEM;
-
- /* reserve area in tiler container */
- mi = __get_area(fmt, width, height, align, offs, gi);
- if (!mi) {
- mutex_lock(&mtx);
- _m_try_free_group(gi);
- mutex_unlock(&mtx);
- return -ENOMEM;
- }
-
- *sys_addr = mi->sys_addr;
-
- /* allocate and map if mapping is supported */
- if (tmm_can_map(TMM(fmt))) {
- mi->num_pg = tcm_sizeof(mi->area);
-
- mi->mem = tmm_get(TMM(fmt), mi->num_pg);
- if (!mi->mem)
- goto cleanup;
-
- /* Ensure the data reaches to main memory before PAT refill */
- wmb();
-
- /* program PAT */
- mutex_lock(&mtx);
- if (refill_pat(TMM(fmt), &mi->area, mi->mem, fmt)) {
- mutex_unlock(&mtx);
- goto cleanup;
- }
- mutex_unlock(&mtx);
- }
- return 0;
-
-cleanup:
- mutex_lock(&mtx);
- _m_free(mi);
- mutex_unlock(&mtx);
- return -ENOMEM;
-
-}
-
-s32 tiler_allocx(enum tiler_fmt fmt, u32 width, u32 height,
- u32 align, u32 offs, u32 gid, void *pi, u32 *sys_addr)
-{
- return alloc_block(fmt, width, height, align, offs, gid,
- (struct process_info *)pi, sys_addr);
-}
-
-s32 tiler_alloc(enum tiler_fmt fmt, u32 width, u32 height, u32 *sys_addr)
-{
- return tiler_allocx(fmt, width, height, 0, 0,
- 0, NULL, sys_addr);
-}
-
-static s32 alloc_block_area(enum tiler_fmt fmt, u32 width, u32 height,
- u32 align, u32 offs, u32 gid, struct process_info *pi,
- u32 *sys_addr, u32 *num_pages)
-{
- struct til_mem_info *mi = NULL;
- struct gid_info *gi = NULL;
-
- /* only support up to page alignment */
- if (align > PAGE_SIZE || offs > align || !pi)
- return -EINVAL;
-
- /* get group context */
- mutex_lock(&mtx);
- gi = _m_get_gi(pi, gid);
- mutex_unlock(&mtx);
-
- if (!gi)
- return -ENOMEM;
-
- /* reserve area in tiler container */
- mi = __get_area(fmt, width, height, align, offs, gi);
- if (!mi) {
- mutex_lock(&mtx);
- _m_try_free_group(gi);
- mutex_unlock(&mtx);
- return -ENOMEM;
- }
-
- *sys_addr = mi->sys_addr;
- *num_pages = tcm_sizeof(mi->area);
-
- return 0;
-}
-
-static void reserve_nv12_blocks(u32 n, u32 width, u32 height,
- u32 align, u32 offs, u32 gid, pid_t pid)
-{
-}
-
-static void reserve_blocks(u32 n, enum tiler_fmt fmt, u32 width, u32 height,
- u32 align, u32 offs, u32 gid, pid_t pid)
-{
-}
-
-/* reserve area for n identical buffers */
-s32 tiler_reservex(u32 n, struct tiler_buf_info *b, pid_t pid)
-{
- u32 i;
-
- if (b->num_blocks > TILER_MAX_NUM_BLOCKS || b->num_blocks < 0)
- return -EINVAL;
-
- for (i = 0; i < b->num_blocks; i++) {
- /* check for NV12 reservations */
- if (i + 1 < b->num_blocks &&
- b->blocks[i].fmt == TILFMT_8BIT &&
- b->blocks[i + 1].fmt == TILFMT_16BIT &&
- b->blocks[i].dim.area.height ==
- b->blocks[i + 1].dim.area.height &&
- b->blocks[i].dim.area.width ==
- b->blocks[i + 1].dim.area.width) {
- reserve_nv12_blocks(n,
- b->blocks[i].dim.area.width,
- b->blocks[i].dim.area.height,
- 0, /* align */
- 0, /* offs */
- 0, /* gid */
- pid);
- i++;
- } else if (b->blocks[i].fmt >= TILFMT_8BIT &&
- b->blocks[i].fmt <= TILFMT_32BIT) {
- /* other 2D reservations */
- reserve_blocks(n,
- b->blocks[i].fmt,
- b->blocks[i].dim.area.width,
- b->blocks[i].dim.area.height,
- 0, /* align */
- 0, /* offs */
- 0, /* gid */
- pid);
- } else {
- return -EINVAL;
- }
- }
- return 0;
-}
-
-s32 tiler_reserve(u32 n, struct tiler_buf_info *b)
-{
- return tiler_reservex(n, b, getgid());
-}
-
-static int tiler_notify_usr(int event_type, void *data, void *arg)
-{
- struct reg_notif_usr_info *info = (struct reg_notif_usr_info *)arg;
- struct tiler_regnotify_response response;
- int fd = -1;
- int ret = 0;
- fd = open(info->name, O_SYNC | O_RDWR);
- if (fd < 0)
- return -EINVAL;
- response.event = event_type;
- response.pid = (pid_t)data;
- ret = ioctl(fd, info->cmd, (&response));
- close(fd);
- return ret;
-}
-
-int tiler_reg_notifier(tiler_notifier_cb cb_ptr, void * arg)
-{
- struct reg_notif_info *info = NULL;
-
- if (!cb_ptr || !arg)
- return -EINVAL;
-
- info = kmalloc(sizeof(*info), GFP_KERNEL);
- if (!info)
- return -ENOMEM;
- info->cb_ptr = cb_ptr;
- info->arg = arg;
-
- list_add(info, ®_notif);
- return EOK;
-}
-
-int tiler_unreg_notifier(tiler_notifier_cb cb_ptr, void * arg)
-{
- struct list_head *elem, *tmp;
- struct reg_notif_info *info;
-
- if (!cb_ptr || !arg)
- return -EINVAL;
-
- list_for_each_safe(elem, tmp, ®_notif) {
- info = (struct reg_notif_info *)elem;
- if (info->cb_ptr == cb_ptr && info->arg == arg) {
- list_del(elem);
- kfree(info);
- return EOK;
- }
- }
- return -EINVAL;
-}
-
-void tiler_purge(void)
-{
- int i;
- mutex_lock(&mtx);
- for (i = TILFMT_8BIT; i <= TILFMT_MAX; i++) {
- tmm_purge(TMM(i));
- }
- mutex_unlock(&mtx);
-}
-
-s32 tiler_alloc_block_area(enum tiler_fmt fmt, u32 width, u32 height,
- u32 gid, void *pi,
- u32 *sys_addr, u32 *num_pages)
-{
- return alloc_block_area(fmt, width, height, 0, 0, gid,
- (struct process_info *)pi, sys_addr, num_pages);
-}
-
-s32 tiler_map_block(u32 sys_addr, u32 num_pages, u32 *pages)
-{
- struct til_mem_info *mi, *mi_tmp;
- s32 res = -ENOMEM;
-
- mutex_lock(&mtx);
-
- /* find block in global list */
- list_for_each_entry_safe(mi, mi_tmp, &blocks, global) {
- if (mi->sys_addr == sys_addr) {
- break;
- }
- }
- mutex_unlock(&mtx);
-
- if (mi == NULL) {
- res = -EINVAL;
- goto done;
- }
-
- /* map if mapping is supported and not already mapped */
- if (tmm_can_map(TMM(TILER_GET_ACC_MODE(mi->sys_addr))) && mi->pg_ptr == NULL) {
- mi->num_pg = tcm_sizeof(mi->area);
- if (num_pages != mi->num_pg) {
- res = -EINVAL;
- goto done;
- }
-
- mi->pg_ptr = kmalloc(mi->num_pg * sizeof(*mi->pg_ptr), GFP_KERNEL);
- if (!mi->pg_ptr)
- goto cleanup;
- memset(mi->pg_ptr, 0x0, sizeof(*mi->pg_ptr) * mi->num_pg);
- memcpy(mi->pg_ptr, pages, sizeof(*mi->pg_ptr) * mi->num_pg);
-
- /* Ensure the data reaches to main memory before PAT refill */
- wmb();
-
- /* program PAT */
- mutex_lock(&mtx);
- if (refill_pat(TMM_SS(mi->sys_addr), &mi->area, mi->pg_ptr,
- TILER_GET_ACC_MODE(mi->sys_addr))) {
- mutex_unlock(&mtx);
- goto cleanup;
- }
- mutex_unlock(&mtx);
- }
- else {
- res = -EPERM;
- goto done;
- }
- res = 0;
- goto done;
-cleanup:
- if (mi->pg_ptr) {
- kfree(mi->pg_ptr);
- mi->pg_ptr = NULL;
- }
-done:
- return res;
-}
-
-s32 tiler_unmap_block(u32 sys_addr)
-{
- struct til_mem_info *mi, *mi_tmp;
- struct area_info *ai = NULL;
- s32 res = -ENOMEM;
-
- mutex_lock(&mtx);
-
- /* find block in global list and free it */
- list_for_each_entry_safe(mi, mi_tmp, &blocks, global) {
- if (mi->sys_addr == sys_addr) {
- break;
- }
- }
- mutex_unlock(&mtx);
-
- if (mi == NULL) {
- res = -EINVAL;
- goto done;
- }
-
- if (mi->pg_ptr == NULL) {
- res = -EINVAL;
- goto done;
- }
-
- /* allocate and map if mapping is supported */
- if (tmm_can_map(TMM(TILER_GET_ACC_MODE(mi->sys_addr))) && mi->pg_ptr) {
- kfree(mi->pg_ptr);
- mi->pg_ptr = NULL;
- if (mi->area.is2d) {
- ai = mi->parent;
- mutex_lock(&mtx);
- clear_pat(TMM_SS(mi->sys_addr), &ai->area, TILER_GET_ACC_MODE(mi->sys_addr));
- mutex_unlock(&mtx);
- }
- else {
- mutex_lock(&mtx);
- clear_pat(TMM_SS(mi->sys_addr), &mi->area, TILFMT_PAGE);
- mutex_unlock(&mtx);
- }
- }
- else {
- res = -EPERM;
- goto done;
- }
- res = 0;
-done:
- return res;
-}
-
-void tiler_exit(void)
-{
- struct process_info *pi = NULL, *pi_ = NULL;
- int i, j;
-
- mutex_lock(&mtx);
-
- /* free all process data */
- list_for_each_entry_safe(pi, pi_, &procs, list)
- _m_free_process_info(pi);
-
- /* all lists should have cleared */
- //WARN_ON(!list_empty(&blocks));
- //WARN_ON(!list_empty(&procs));
- //WARN_ON(!list_empty(&orphan_onedim));
- //WARN_ON(!list_empty(&orphan_areas));
-
- mutex_unlock(&mtx);
-
- munmap(dmac_va, TILER_WIDTH * TILER_HEIGHT *
- sizeof(*dmac_va));
-
- dlclose (tiler_pat_lib);
-
- /* close containers only once */
- for (i = TILFMT_8BIT; i <= TILFMT_MAX; i++) {
- /* remove identical containers (tmm is unique per tcm) */
- for (j = i + 1; j <= TILFMT_MAX; j++)
- if (TCM(i) == TCM(j)) {
- TCM_SET(j, NULL);
- TMM_SET(j, NULL);
- }
-
- tcm_deinit(TCM(i));
- tmm_deinit(TMM(i));
- }
-
- mutex_destroy(&mtx);
-
- munmap(dummy_va, PAGE_SIZE);
-}
-
-tiler_ocb_t *
-ocb_calloc (resmgr_context_t * ctp, IOFUNC_ATTR_T * device)
-{
- tiler_ocb_t *ocb;
- struct process_info *pi;
-
- /* Allocate the OCB */
- ocb = (tiler_ocb_t *) calloc (1, sizeof (tiler_ocb_t));
- if (ocb == NULL){
- errno = ENOMEM;
- return (NULL);
- }
-
- pi = __get_pi(ctp->info.pid, false);
-
- if (!pi) {
- errno = ENOMEM;
- return (NULL);
- }
-
- ocb->pi = pi;
-
- return (ocb);
-}
-
-void
-ocb_free (tiler_ocb_t * ocb)
-{
- struct process_info *pi = (struct process_info *)ocb->pi;
-
- mutex_lock(&mtx);
- /* free resources if last device in this process */
- if (0 == --pi->refs)
- _m_free_process_info(pi);
-
- mutex_unlock(&mtx);
-
- free (ocb);
-}
-
-s32 tiler_init(u32 size)
-{
- s32 r = -1;
- struct tcm_pt div_pt;
- struct tcm *sita[MAX_CONTAINERS] = {0};
- struct tmm *tmm_pat[MAX_CONTAINERS] = {0};
- struct tcm_area area = {0};
- s32 ret = 0;
- u32 len = 0;
- s64 offset = 0;
-
- /**
- * Array of physical pages for PAT programming, which must be a 16-byte
- * aligned physical address
- */
- dmac_va = mmap64(NULL, TILER_WIDTH * TILER_HEIGHT *
- sizeof(*dmac_va), PROT_NOCACHE | PROT_READ | PROT_WRITE, MAP_ANON | MAP_PHYS | MAP_PRIVATE, NOFD, 0);
- if (dmac_va == MAP_FAILED) {
- return -ENOMEM;
- }
-
- ret = mem_offset64(dmac_va, NOFD, TILER_WIDTH * TILER_HEIGHT *
- sizeof(*dmac_va), &offset, &len);
- if (ret) {
- fprintf(stderr, "Tiler_init: Error from mem_offset [%d]\n", errno);
- return -ENOMEM;
- }
- else {
- dmac_pa = (u32)offset;
- }
-
- tiler_pat_lib = dlopen("tiler_pat.so", RTLD_NOW | RTLD_GLOBAL);
- if (tiler_pat_lib == NULL) {
- fprintf(stderr, "Tiler_init: Error opening shared lib [%d]\n", errno);
- return -ENOMEM;
- }
- tiler_pat_init = dlsym(tiler_pat_lib, "tiler_pat_init");
- if (tiler_pat_init == NULL) {
- fprintf(stderr, "Tiler_init: Error getting shared lib sym [%d]\n", errno);
- goto error;
- }
- (*tiler_pat_init)();
- tiler_save_pat = dlsym(tiler_pat_lib, "tiler_save_pat");
- if (tiler_save_pat == NULL) {
- fprintf(stderr, "Tiler_init: Error getting shared lib sym [%d]\n", errno);
- goto error;
- }
-
- /* Allocate tiler container manager (we share 1 on OMAP4) */
- div_pt.x = TILER_WIDTH; /* hardcoded default */
- div_pt.y = (3 * TILER_HEIGHT) / 4;
- sita[0] = sita_init(TILER_WIDTH, TILER_HEIGHT, (void *)&div_pt);
-
- /* Allocate tiler memory manager (must have 1 unique TMM per TCM ) */
- tmm_pat[0] = tmm_pat_init(0, size);
-
- if (!sita[0] || !tmm_pat[0]) {
- r = -ENOMEM;
- goto error;
- }
-
-#ifdef TILER_PLATFORM_OMAP5
- div_pt.y = TILER_HEIGHT;
- sita[1] = sita_init(TILER_WIDTH, TILER_HEIGHT, (void *)&div_pt);
- tmm_pat[1] = tmm_pat_init(0, size);
-
- if (!sita[1] || !tmm_pat[1]) {
- r = -ENOMEM;
- goto error;
- }
-#endif
-
- TCM_SET(TILFMT_8BIT, sita[0]);
- TCM_SET(TILFMT_16BIT, sita[0]);
- TCM_SET(TILFMT_32BIT, sita[0]);
-#ifdef TILER_PLATFORM_OMAP5
- TCM_SET(TILFMT_PAGE, sita[1]);
-#else
- TCM_SET(TILFMT_PAGE, sita[0]);
-#endif
-
- TMM_SET(TILFMT_8BIT, tmm_pat[0]);
- TMM_SET(TILFMT_16BIT, tmm_pat[0]);
- TMM_SET(TILFMT_32BIT, tmm_pat[0]);
-#ifdef TILER_PLATFORM_OMAP5
- TMM_SET(TILFMT_PAGE, tmm_pat[1]);
-#else
- TMM_SET(TILFMT_PAGE, tmm_pat[0]);
-#endif
-
- mutex_init(&mtx);
- INIT_LIST_HEAD(&blocks);
- INIT_LIST_HEAD(&procs);
- INIT_LIST_HEAD(&orphan_areas);
- INIT_LIST_HEAD(&orphan_onedim);
- INIT_LIST_HEAD(®_notif_usr);
- INIT_LIST_HEAD(®_notif);
- id = 0xda7a000;
-
- /* Dummy page for filling unused entries in dmm (dmac_va):
- */
- dummy_va = mmap64(NULL, PAGE_SIZE,
- PROT_NOCACHE | PROT_READ | PROT_WRITE, MAP_ANON | MAP_PHYS | MAP_PRIVATE, NOFD, 0);
- if (dummy_va == MAP_FAILED) {
- r = -ENOMEM;
- goto error;
- }
-
- ret = mem_offset64(dummy_va, NOFD, PAGE_SIZE, &offset, &len);
- if (ret) {
- fprintf(stderr, "Tiler_init: Error from mem_offset [%d]\n", errno);
- r = -ENOMEM;
- goto error;
- } else {
- dummy_pa = (u32)offset;
- }
-
- /* clear the entire dmm space:
- */
- area.tcm = sita[0];
- area.p0.x = 0;
- area.p0.y = 0;
- area.p1.x = TILER_WIDTH - 1;
- area.p1.y = TILER_HEIGHT - 1;
- clear_pat(tmm_pat[0], &area, TILFMT_8BIT);
-#ifdef TILER_PLATFORM_OMAP5
- area.tcm = sita[1];
- clear_pat(tmm_pat[1], &area, TILFMT_PAGE);
-#endif
- r = 0;
-
-error:
- /* TODO: error handling for device registration */
- if (r) {
-#ifdef TILER_PLATFORM_OMAP5
- if (sita[1])
- tcm_deinit(sita[1]);
- if (tmm_pat[1])
- tmm_deinit(tmm_pat[1]);
-#endif
- if (sita[0])
- tcm_deinit(sita[0]);
- if (tmm_pat[0])
- tmm_deinit(tmm_pat[0]);
- munmap(dmac_va, TILER_WIDTH * TILER_HEIGHT *
- sizeof(*dmac_va));
- }
-
- return r;
-}
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tiler.h b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tiler.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-/*
- * tiler.h
- *
- * TILER driver support functions for TI OMAP processors.
- *
- * Copyright (C) 2009-2010 Texas Instruments, Inc.
- */
-
-#ifndef TILER_H
-#define TILER_H
-
-#include <errno.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <atomic.h>
-#include <stdbool.h>
-#include <devctl.h>
-#include <fcntl.h>
-#include <stdint.h>
-#include <hw/inout.h>
-#include <sys/iofunc.h>
-#include <sys/dispatch.h>
-#include <sys/procmgr.h>
-#include <sys/mman.h>
-#include <sys/neutrino.h>
-#include <sys/siginfo.h>
-#include <sys/ioctl.h>
-
-#include "proto.h"
-
-#include "tiler/tiler_devctl.h"
-
-#define PAGE_SIZE 0x1000
-#define TILER_PAGE 0x1000
-#define TILER_WIDTH 256
-#define TILER_HEIGHT 128
-#define TILER_BLOCK_WIDTH 64
-#define TILER_BLOCK_HEIGHT 64
-#define TILER_LENGTH (TILER_WIDTH * TILER_HEIGHT * TILER_PAGE)
-
-
-/* utility functions */
-static inline u32 tilfmt_bpp(enum tiler_fmt fmt)
-{
- return fmt == TILFMT_8BIT ? 1 :
- fmt == TILFMT_16BIT ? 2 :
- fmt == TILFMT_32BIT ? 4 : 0;
-}
-
-/**
- * Prototype for notifier callback.
- *
- * @param event_type type of event that happened
- *
- * @param arg user private data
- *
- * @return error status
- */
-typedef s32 (*tiler_notifier_cb) (int event_type, void *data, void *arg);
-
-/**
- * Registers a notifier block with TILER driver.
- *
- * @param nb notifier_block
- *
- * @return error status
- */
-int tiler_reg_notifier(tiler_notifier_cb cb_ptr, void * arg);
-
-/**
- * Un-registers a notifier block with TILER driver.
- *
- * @param nb notifier_block
- *
- * @return error status
- */
-int tiler_unreg_notifier(tiler_notifier_cb cb_ptr, void * arg);
-
-/**
- * Reserves a 1D or 2D TILER block area and memory for the
- * current process with group ID 0.
- *
- * @param fmt TILER bit mode
- * @param width block width
- * @param height block height (must be 1 for 1D)
- * @param sys_addr pointer where system space (L3) address
- * will be stored.
- *
- * @return error status
- */
-s32 tiler_alloc(enum tiler_fmt fmt, u32 width, u32 height, u32 *sys_addr);
-
-/**
- * Reserves a 1D or 2D TILER block area and memory with extended
- * arguments.
- *
- * @param fmt TILER bit mode
- * @param width block width
- * @param height block height (must be 1 for 1D)
- * @param align block alignment (default: PAGE_SIZE)
- * @param offs block offset
- * @param gid group ID
- * @param pi process information
- * @param sys_addr pointer where system space (L3) address
- * will be stored.
- *
- * @return error status
- */
-s32 tiler_allocx(enum tiler_fmt fmt, u32 width, u32 height,
- u32 align, u32 offs, u32 gid, void *pi, u32 *sys_addr);
-
-/**
- * Maps an existing buffer to a 1D or 2D TILER area for the
- * current process with group ID 0.
- *
- * Currently, only 1D area mapping is supported.
- *
- * @param fmt TILER bit mode
- * @param width block width
- * @param height block height (must be 1 for 1D)
- * @param sys_addr pointer where system space (L3) address
- * will be stored.
- * @param usr_addr user space address of existing buffer.
- *
- * @return error status
- */
-s32 tiler_map(enum tiler_fmt fmt, u32 width, u32 height, u32 *sys_addr,
- u32 usr_addr);
-
-/**
- * Maps an existing buffer to a 1D or 2D TILER area with
- * extended arguments.
- *
- * Currently, only 1D area mapping is supported.
- *
- * NOTE: alignment is always PAGE_SIZE and offset is 0
- *
- * @param fmt TILER bit mode
- * @param width block width
- * @param height block height (must be 1 for 1D)
- * @param gid group ID
- * @param pid process information
- * @param sys_addr pointer where system space (L3) address
- * will be stored.
- * @param usr_addr user space address of existing buffer.
- *
- * @return error status
- */
-s32 tiler_mapx(enum tiler_fmt fmt, u32 width, u32 height,
- u32 gid, void *pi, u32 *sys_addr, u32 usr_addr);
-
-/**
- * Free TILER memory.
- *
- * @param sys_addr system space (L3) address.
- *
- * @return an error status.
- */
-s32 tiler_free(u32 sys_addr);
-
-/**
- * Reserves tiler area for n identical set of blocks (buffer)
- * for the current process. Use this method to get optimal
- * placement of multiple related tiler blocks; however, it may
- * not reserve area if tiler_alloc is equally efficient.
- *
- * @param n number of identical set of blocks
- * @param b information on the set of blocks (ptr, ssptr and
- * stride fields are ignored)
- *
- * @return error status
- */
-s32 tiler_reserve(u32 n, struct tiler_buf_info *b);
-
-/**
- * Reserves tiler area for n identical set of blocks (buffer) fo
- * a given process. Use this method to get optimal placement of
- * multiple related tiler blocks; however, it may not reserve
- * area if tiler_alloc is equally efficient.
- *
- * @param n number of identical set of blocks
- * @param b information on the set of blocks (ptr, ssptr and
- * stride fields are ignored)
- * @param pid process ID
- *
- * @return error status
- */
-s32 tiler_reservex(u32 n, struct tiler_buf_info *b, pid_t pid);
-
-u32 tiler_reorient_addr(u32 tsptr, struct tiler_view_orient orient);
-
-u32 tiler_get_natural_addr(void *sys_ptr);
-
-u32 tiler_reorient_topleft(u32 tsptr, struct tiler_view_orient orient,
- u32 width, u32 height);
-
-u32 tiler_stride(u32 tsptr);
-
-void tiler_rotate_view(struct tiler_view_orient *orient, u32 rotation);
-
-void tiler_alloc_packed(s32 *count, enum tiler_fmt fmt, u32 width, u32 height,
- void **sysptr, void **allocptr, s32 aligned, void *pi);
-
-void tiler_alloc_packed_nv12(s32 *count, u32 width, u32 height, void **y_sysptr,
- void **uv_sysptr, void **y_allocptr,
- void **uv_allocptr, s32 aligned, void *pi );
-
-/**
- * Reserves a 1D or 2D TILER block area with extended
- * arguments.
- *
- * @param fmt TILER bit mode
- * @param width block width
- * @param height block height (must be 1 for 1D)
- * @param gid group ID
- * @param pi process information
- * @param sys_addr pointer where system space (L3) address
- * will be stored.
- * @param num_pages pointer where the number of pages required to
- * program this area will be stored.
- *
- * @return error status
- */
-s32 tiler_alloc_block_area(enum tiler_fmt fmt, u32 width, u32 height, u32 gid,
- void *pi, u32 *sys_addr, u32 *num_pages);
-
-/**
- * Maps an array of physical pages to a 1D or 2D TILER area.
- *
- * @param sys_addr The system space (L3) address, previously
- * allocated with tiler_alloc_block_area, to which
- * the array of pages will be mapped.
- * @param num_pages number of pages in the pages array
- * @param pages array of pages to be mapped to sys_addr
- *
- * @return error status
- */
-s32 tiler_map_block(u32 sys_addr, u32 num_pages, u32 *pages);
-
-/**
- * Unmaps a block previously mapped with tiler_map_block.
- *
- * @param sys_addr The system space (L3) address, previously
- * mapped with tiler_map_block, that is to be unmapped.
- *
- * @return error status
- */
-s32 tiler_unmap_block(u32 sys_addr);
-
-#endif
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tiler.use b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tiler.use
+++ /dev/null
@@ -1,8 +0,0 @@
-Tiler - TILER Resource Manager
-
-Tiler [-SLU]
-Options:
- -S <page_grow_size> Size to grow tiler page allocations at a time (Default:16)
- -L <lowmem_limit> Limit (in Mbytes) below which to free any cached pages
- held by Tiler (Default:128M)
- -U <user_param> User param to use to set uid/gid (Default:NULL)
diff --git a/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tiler_def.h b/qnx/src/ipc3x_dev/tiler/resmgr/tiler/tiler_def.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2010, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * */
-/*
- * tiler_def.h
- *
- * TILER driver support functions for TI OMAP processors.
- */
-
-#ifndef TILER_DEF_H
-#define TILER_DEF_H
-
-#define ROUND_UP_2P(a, b) (((a) + (b) - 1) & ~((b) - 1))
-#define DIVIDE_UP(a, b) (((a) + (b) - 1) / (b))
-#define ROUND_UP(a, b) (DIVIDE_UP(a, b) * (b))
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-
-#define TILER_ACC_MODE_SHIFT (27)
-#define TILER_ACC_MODE_MASK (3)
-#define TILER_GET_ACC_MODE(x) ((enum tiler_fmt) (1 + \
-(((u32)x & (TILER_ACC_MODE_MASK<<TILER_ACC_MODE_SHIFT))>>TILER_ACC_MODE_SHIFT)))
-
-#define TILER_ALIAS_BASE (0x60000000)
-#define TILER_ACC_MODE_SHIFT (27)
-#define DMM_ACC_MODE_SHIFT (27)
-
-#define TIL_ALIAS_ADDR(x, access_mode)\
-((void *)(TILER_ALIAS_BASE | (u32)x | (access_mode << TILER_ACC_MODE_SHIFT)))
-
-#define TIL_ADDR(x, r, yi, xi, a)\
-((void *)((u32)x | (r << DMM_ROTATION_SHIFT) |\
-(yi << DMM_Y_INVERT_SHIFT) | (xi << DMM_X_INVERT_SHIFT) |\
-(a << DMM_ACC_MODE_SHIFT)))
-
-#define TILER_ALIAS_VIEW_CLEAR (~0xE0000000)
-
-#define DMM_X_INVERT_SHIFT (29)
-#define DMM_GET_X_INVERTED(x) ((((u32)x & (1<<DMM_X_INVERT_SHIFT)) > 0) ? 1 : 0)
-#define DMM_Y_INVERT_SHIFT (30)
-#define DMM_GET_Y_INVERTED(x) ((((u32)x & (1<<DMM_Y_INVERT_SHIFT)) > 0) ? 1 : 0)
-
-#define DMM_ROTATION_SHIFT (31)
-#define DMM_GET_ROTATED(x)\
-((((u32)x & ((u32)1<<DMM_ROTATION_SHIFT)) > 0) ? 1 : 0)
-
-#define DMM_ALIAS_VIEW_CLEAR (~0xE0000000)
-
-#define DMM_TILE_DIMM_X_MODE_8 (32)
-#define DMM_TILE_DIMM_Y_MODE_8 (32)
-
-#define DMM_TILE_DIMM_X_MODE_16 (32)
-#define DMM_TILE_DIMM_Y_MODE_16 (16)
-
-#define DMM_TILE_DIMM_X_MODE_32 (16)
-#define DMM_TILE_DIMM_Y_MODE_32 (16)
-
-#define DMM_PAGE_DIMM_X_MODE_8 (DMM_TILE_DIMM_X_MODE_8*2)
-#define DMM_PAGE_DIMM_Y_MODE_8 (DMM_TILE_DIMM_Y_MODE_8*2)
-
-#define DMM_PAGE_DIMM_X_MODE_16 (DMM_TILE_DIMM_X_MODE_16*2)
-#define DMM_PAGE_DIMM_Y_MODE_16 (DMM_TILE_DIMM_Y_MODE_16*2)
-
-#define DMM_PAGE_DIMM_X_MODE_32 (DMM_TILE_DIMM_X_MODE_32*2)
-#define DMM_PAGE_DIMM_Y_MODE_32 (DMM_TILE_DIMM_Y_MODE_32*2)
-
-#define DMM_HOR_X_ADDRSHIFT_8 (0)
-#define DMM_HOR_X_ADDRMASK_8 (0x3FFF)
-#define DMM_HOR_X_COOR_GET_8(x)\
- (((unsigned long)x >> DMM_HOR_X_ADDRSHIFT_8) & DMM_HOR_X_ADDRMASK_8)
-#define DMM_HOR_X_PAGE_COOR_GET_8(x)\
- (DMM_HOR_X_COOR_GET_8(x)/DMM_PAGE_DIMM_X_MODE_8)
-
-#define DMM_HOR_Y_ADDRSHIFT_8 (14)
-#define DMM_HOR_Y_ADDRMASK_8 (0x1FFF)
-#define DMM_HOR_Y_COOR_GET_8(x)\
- (((unsigned long)x >> DMM_HOR_Y_ADDRSHIFT_8) & DMM_HOR_Y_ADDRMASK_8)
-#define DMM_HOR_Y_PAGE_COOR_GET_8(x)\
- (DMM_HOR_Y_COOR_GET_8(x)/DMM_PAGE_DIMM_Y_MODE_8)
-
-#define DMM_HOR_X_ADDRSHIFT_16 (1)
-#define DMM_HOR_X_ADDRMASK_16 (0x7FFE)
-#define DMM_HOR_X_COOR_GET_16(x) (((unsigned long)x >> \
- DMM_HOR_X_ADDRSHIFT_16) & DMM_HOR_X_ADDRMASK_16)
-#define DMM_HOR_X_PAGE_COOR_GET_16(x) (DMM_HOR_X_COOR_