summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIliyan Malchev <malchev@google.com>2011-08-22 13:57:42 -0700
committerIliyan Malchev <malchev@google.com>2011-08-23 08:27:36 -0700
commit1f1f957cc6768d24b09fd96f76aaec3884e1623e (patch)
treec99f0de2fb789bc92c72001a5be1b6d6c0a8c895
parentb83122f8b520028ec6d24215c47ab0c6cf76accf (diff)
downloadhardware_ti_omap4xxx-1f1f957cc6768d24b09fd96f76aaec3884e1623e.zip
hardware_ti_omap4xxx-1f1f957cc6768d24b09fd96f76aaec3884e1623e.tar.gz
hardware_ti_omap4xxx-1f1f957cc6768d24b09fd96f76aaec3884e1623e.tar.bz2
omap4xxx: tiler/camera cleanup
Change-Id: Ia63104950fdfbaf41254187dd0ee516fde8eb7d2 Signed-off-by: Iliyan Malchev <malchev@google.com>
-rw-r--r--camera/MemoryManager.cpp44
-rw-r--r--domx/domx/omx_proxy_common/src/omx_proxy_common.c14
-rwxr-xr-xdomx/omx_proxy_component/omx_camera/src/omx_proxy_camera.c2
-rw-r--r--tiler/Android.mk2
-rw-r--r--tiler/mem_types.h19
-rw-r--r--tiler/memmgr.c29
-rw-r--r--tiler/memmgr.h23
-rw-r--r--tiler/memmgr_test.c92
-rw-r--r--tiler/tilermgr.c2
-rw-r--r--tiler/tilermgr.h2
10 files changed, 97 insertions, 132 deletions
diff --git a/camera/MemoryManager.cpp b/camera/MemoryManager.cpp
index f86b263..d1e292f 100644
--- a/camera/MemoryManager.cpp
+++ b/camera/MemoryManager.cpp
@@ -41,9 +41,6 @@ namespace android {
#define ALLOCATION_2D 2
///Utility Macro Declarations
-#define ZERO_OUT_ARR(a,b) { for(unsigned int i=0;i<b;i++) a[i]=NULL;}
-
-#define ZERO_OUT_STRUCT(a, b) memset(a, 0, sizeof(b));
/*--------------------MemoryManager Class STARTS here-----------------------------*/
void* MemoryManager::allocateBuffer(int width, int height, const char* format, int &bytes, int numBufs)
@@ -53,11 +50,11 @@ void* MemoryManager::allocateBuffer(int width, int height, const char* format, i
///the buffers
const uint numArrayEntriesC = (uint)(numBufs+1);
- MemAllocBlock *tMemBlock;
-
+ MemAllocBlock tMemBlock[ALLOCATION_2D];
+ memset(tMemBlock, 0, sizeof(MemAllocBlock));
///Allocate a buffer array
- uint32_t *bufsArr = new uint32_t[numArrayEntriesC];
+ uint32_t *bufsArr = new uint32_t [numArrayEntriesC];
if(!bufsArr)
{
CAMHAL_LOGEB("Allocation failed when creating buffers array of %d uint32_t elements", numArrayEntriesC);
@@ -67,27 +64,16 @@ void* MemoryManager::allocateBuffer(int width, int height, const char* format, i
///Initialize the array with zeros - this will help us while freeing the array in case of error
///If a value of an array element is NULL, it means we didnt allocate it
- ZERO_OUT_ARR(bufsArr, numArrayEntriesC);
+ memset(bufsArr, 0, sizeof(*bufsArr) * numArrayEntriesC);
///If the bytes field is not zero, it means it is a 1-D tiler buffer request (possibly for image capture bit stream buffer)
if(bytes!=0)
{
- ///MemAllocBlock is the structure that describes the buffer alloc request to MemMgr
- tMemBlock = (MemAllocBlock*)malloc(sizeof(MemAllocBlock));
-
- if(!tMemBlock)
- {
- delete [] bufsArr;
- return NULL;
- }
-
- ZERO_OUT_STRUCT(tMemBlock, MemAllocBlock );
-
///1D buffers
for (int i = 0; i < numBufs; i++)
{
tMemBlock->dim.len = bytes;
- tMemBlock->pixelFormat = PIXEL_FMT_PAGE;
+ tMemBlock->fmt = PIXEL_FMT_PAGE;
tMemBlock->stride = 0;
CAMHAL_LOGDB("requested bytes = %d", bytes);
CAMHAL_LOGDB("tMemBlock.dim.len = %d", tMemBlock->dim.len);
@@ -107,16 +93,6 @@ void* MemoryManager::allocateBuffer(int width, int height, const char* format, i
else ///If bytes is not zero, then it is a 2-D tiler buffer request
{
///2D buffers
- ///MemAllocBlock is the structure that describes the buffer alloc request to MemMgr
- tMemBlock = (MemAllocBlock*)malloc(sizeof(MemAllocBlock)*ALLOCATION_2D);
-
- if(!tMemBlock)
- {
- delete [] bufsArr;
- return NULL;
- }
-
- memset(tMemBlock, 0, sizeof(MemAllocBlock)*ALLOCATION_2D);
for (int i = 0; i < numBufs; i++)
{
@@ -129,7 +105,6 @@ void* MemoryManager::allocateBuffer(int width, int height, const char* format, i
///YUV422I format
pixelFormat[0] = PIXEL_FMT_16BIT;
stride[0] = STRIDE_16BIT;
- numAllocs = 1;
}
else if(!strcmp(format,(const char *) CameraParameters::PIXEL_FORMAT_YUV420SP))
{
@@ -145,14 +120,12 @@ void* MemoryManager::allocateBuffer(int width, int height, const char* format, i
///RGB 565 format
pixelFormat[0] = PIXEL_FMT_16BIT;
stride[0] = STRIDE_16BIT;
- numAllocs = 1;
}
else if(!strcmp(format,(const char *) TICameraParameters::PIXEL_FORMAT_RAW))
{
///RAW format
pixelFormat[0] = PIXEL_FMT_16BIT;
stride[0] = STRIDE_16BIT;
- numAllocs = 1;
}
else
{
@@ -167,7 +140,7 @@ void* MemoryManager::allocateBuffer(int width, int height, const char* format, i
for(int index=0;index<numAllocs;index++)
{
- tMemBlock[index].pixelFormat = pixelFormat[index];
+ tMemBlock[index].fmt = pixelFormat[index];
tMemBlock[index].stride = stride[index];
tMemBlock[index].dim.area.width= width;/*width*/
tMemBlock[index].dim.area.height= height;/*height*/
@@ -184,15 +157,10 @@ void* MemoryManager::allocateBuffer(int width, int height, const char* format, i
CAMHAL_LOGDB("Allocated Tiler PAGED mode buffer address[%x]", bufsArr[i]);
}
}
-
}
LOG_FUNCTION_NAME_EXIT;
-
- ///Free the request structure before returning from the function
- free(tMemBlock);
-
return (void*)bufsArr;
error:
diff --git a/domx/domx/omx_proxy_common/src/omx_proxy_common.c b/domx/domx/omx_proxy_common/src/omx_proxy_common.c
index a72c462..9230bf3 100644
--- a/domx/domx/omx_proxy_common/src/omx_proxy_common.c
+++ b/domx/domx/omx_proxy_common/src/omx_proxy_common.c
@@ -634,12 +634,12 @@ static OMX_ERRORTYPE PROXY_AllocateBuffer(OMX_IN OMX_HANDLETYPE hComponent,
eError = PROXY_GetParameter(hComponent, (OMX_INDEXTYPE)OMX_TI_IndexParam2DBufferAllocDimension, &tParamRect);
if(eError == OMX_ErrorNone)
{
- blocks[0].pixelFormat = PIXEL_FMT_8BIT;
+ blocks[0].fmt = PIXEL_FMT_8BIT;
blocks[0].dim.area.width = tParamRect.nWidth;
blocks[0].dim.area.height = tParamRect.nHeight;
blocks[0].stride = 0;
- blocks[1].pixelFormat = PIXEL_FMT_16BIT;
+ blocks[1].fmt = PIXEL_FMT_16BIT;
blocks[1].dim.area.width = tParamRect.nWidth >> 1;
blocks[1].dim.area.height = tParamRect.nHeight >> 1;
blocks[1].stride = 0;
@@ -662,12 +662,12 @@ static OMX_ERRORTYPE PROXY_AllocateBuffer(OMX_IN OMX_HANDLETYPE hComponent,
return eError;
}
- blocks[0].pixelFormat = PIXEL_FMT_8BIT;
+ blocks[0].fmt = PIXEL_FMT_8BIT;
blocks[0].dim.area.width = tParamPortDef.format.video.nFrameWidth;
blocks[0].dim.area.height = tParamPortDef.format.video.nFrameHeight;
blocks[0].stride = 0;
- blocks[1].pixelFormat = PIXEL_FMT_16BIT;
+ blocks[1].fmt = PIXEL_FMT_16BIT;
blocks[1].dim.area.width = tParamPortDef.format.video.nFrameWidth >> 1;
blocks[1].dim.area.height = tParamPortDef.format.video.nFrameHeight >> 1;
blocks[1].stride = 0;
@@ -686,7 +686,7 @@ static OMX_ERRORTYPE PROXY_AllocateBuffer(OMX_IN OMX_HANDLETYPE hComponent,
}
else //Allocate 1D buffer
{
- block.pixelFormat = PIXEL_FMT_PAGE;
+ block.fmt = PIXEL_FMT_PAGE;
block.dim.len = nSize;
block.stride = 0;
@@ -966,7 +966,7 @@ static OMX_ERRORTYPE PROXY_UseBuffer(OMX_IN OMX_HANDLETYPE hComponent,
if(tMetaDataBuffer.bIsMetaDataEnabledOnPort)
{
- block.pixelFormat = PIXEL_FMT_PAGE;
+ block.fmt = PIXEL_FMT_PAGE;
block.dim.len = tMetaDataBuffer.nMetaDataSize;
((OMX_TI_PLATFORMPRIVATE *)pBufferHeader->
pPlatformPrivate)->pMetaDataBuffer = MemMgr_Alloc(&block, 1);
@@ -2240,7 +2240,7 @@ OMX_ERRORTYPE RPC_MapBuffer_Ducati(OMX_U8 * pBuf, OMX_U32 nBufLineSize,
{
DOMX_DEBUG
("Buffer is not mapped: Mapping as 1D buffer now..");
- block.pixelFormat = PIXEL_FMT_PAGE;
+ block.fmt = PIXEL_FMT_PAGE;
block.ptr = (OMX_PTR) (((OMX_U32) pBuf / LINUX_PAGE_SIZE) *
LINUX_PAGE_SIZE);
block.dim.len = (OMX_U32) ((((OMX_U32) pBuf + nBufLineSize +
diff --git a/domx/omx_proxy_component/omx_camera/src/omx_proxy_camera.c b/domx/omx_proxy_component/omx_camera/src/omx_proxy_camera.c
index 087bd47..fb1a7de 100755
--- a/domx/omx_proxy_component/omx_camera/src/omx_proxy_camera.c
+++ b/domx/omx_proxy_component/omx_camera/src/omx_proxy_camera.c
@@ -425,7 +425,7 @@ OMX_ERRORTYPE DCC_Init(OMX_HANDLETYPE hComponent)
OMX_ErrorInsufficientResources, "Malloc failed");
/* Allocate 1D Tiler buffer for 'N'DCC files */
- MemReqDescTiler[0].pixelFormat = PIXEL_FMT_PAGE;
+ MemReqDescTiler[0].fmt = PIXEL_FMT_PAGE;
MemReqDescTiler[0].dim.len = dccbuf_size;
MemReqDescTiler[0].stride = 0;
TilerAddr = MemMgr_Alloc(MemReqDescTiler, 1);
diff --git a/tiler/Android.mk b/tiler/Android.mk
index ecb8e62..ffd3105 100644
--- a/tiler/Android.mk
+++ b/tiler/Android.mk
@@ -9,6 +9,7 @@ LOCAL_MODULE := libtimemmgr
LOCAL_MODULE_TAGS := optional tests
include $(BUILD_HEAPTRACKED_SHARED_LIBRARY)
+ifeq (0,1)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := memmgr_test.c testlib.c
LOCAL_SHARED_LIBRARIES := libtimemmgr
@@ -29,5 +30,6 @@ LOCAL_SHARED_LIBRARIES := libtimemmgr
LOCAL_MODULE := tiler_ptest
LOCAL_MODULE_TAGS:= tests
include $(BUILD_HEAPTRACKED_EXECUTABLE)
+endif
endif
diff --git a/tiler/mem_types.h b/tiler/mem_types.h
index 18453bb..85b4c37 100644
--- a/tiler/mem_types.h
+++ b/tiler/mem_types.h
@@ -39,6 +39,7 @@
/* for bool definition */
#include <stdbool.h>
#include <stdint.h>
+#include <tiler.h>
/** ---------------------------------------------------------------------------
* Type definitions
@@ -59,18 +60,16 @@ typedef uint16_t pixels_t;
* Pixel format
*
* Page mode is encoded in the pixel format to handle different
- * set of buffers uniformly
+ * set of buffers uniformly.
*/
-enum pixel_fmt_t {
- PIXEL_FMT_MIN = 0,
- PIXEL_FMT_8BIT = 0,
- PIXEL_FMT_16BIT = 1,
- PIXEL_FMT_32BIT = 2,
- PIXEL_FMT_PAGE = 3,
- PIXEL_FMT_MAX = 3
-};
-typedef enum pixel_fmt_t pixel_fmt_t;
+#define PIXEL_FMT_8BIT TILFMT_8BIT
+#define PIXEL_FMT_16BIT TILFMT_16BIT
+#define PIXEL_FMT_32BIT TILFMT_32BIT
+#define PIXEL_FMT_PAGE TILFMT_PAGE
+#define PIXEL_FMT_MAX TILFMT_MAX
+
+typedef enum tiler_fmt pixel_fmt_t;
/**
* Ducati Space Virtual Address Pointer
diff --git a/tiler/memmgr.c b/tiler/memmgr.c
index 1f780cc..5eec95e 100644
--- a/tiler/memmgr.c
+++ b/tiler/memmgr.c
@@ -48,6 +48,7 @@
#define BUF_MAPPED 2
#define BUF_ANY ~0
+#include <mem_types.h>
#include <tiler.h>
typedef struct tiler_block_info tiler_block_info;
@@ -66,6 +67,12 @@ typedef struct tiler_block_info tiler_block_info;
#include "tilermem_utils.h"
#include "memmgr.h"
+#ifdef HEAPTRACKER
+extern void print_backtrace(const intptr_t *bt, int depth);
+#else
+static void print_backtrace(const intptr_t *bt, int depth) {}
+#endif
+
/* list of allocations */
struct _AllocData {
struct tiler_buf_info buf;
@@ -510,11 +517,16 @@ static void *tiler_mmap(struct tiler_block_info *blks, int num_blocks,
/* register buffer with tiler */
struct tiler_buf_info buf;
buf.num_blocks = num_blocks;
+
+ if (num_blocks > TILER_MAX_NUM_BLOCKS)
+ return NULL;
+
/* work on copy in buf */
memcpy(buf.blocks, blks, sizeof(tiler_block_info) * num_blocks);
#ifndef STUB_TILER
dump_buf(&buf, "==(RBUF)=>");
int ret = ioctl(td, TILIOC_RBUF, &buf);
+ print_backtrace(NULL, 0);
dump_buf(&buf, "<=(RBUF)==");
if (NOT_I(ret,==,0)) return NULL;
size = buf.length;
@@ -573,6 +585,7 @@ static void *tiler_mmap(struct tiler_block_info *blks, int num_blocks,
NOT_I(buf_cache_add(&buf, buf_type),==,0))
{
#ifndef STUB_TILER
+ print_backtrace(NULL, 0);
A_I(ioctl(td, TILIOC_URBUF, &buf),==,0);
#else
FREE(buf_c);
@@ -600,12 +613,10 @@ static void *tiler_mmap(struct tiler_block_info *blks, int num_blocks,
* sized (fit on whole pages).
* @return 0 on success, non-0 error value on failure.
*/
-static int check_block(tiler_block_info *blk, bool is_page_sized)
+static int check_block(const tiler_block_info *blk, bool is_page_sized)
{
/* check pixelformat */
- if (NOT_I(blk->fmt,>=,PIXEL_FMT_MIN) ||
- NOT_I(blk->fmt,<=,PIXEL_FMT_MAX)) return MEMMGR_ERR_GENERIC;
-
+ if (NOT_I(blk->fmt,<=,PIXEL_FMT_MAX)) return MEMMGR_ERR_GENERIC;
if (blk->fmt == PIXEL_FMT_PAGE)
{ /* check 1D buffers */
@@ -649,7 +660,7 @@ static int check_block(tiler_block_info *blk, bool is_page_sized)
*
* @return 0 on success, non-0 error value on failure.
*/
-static int check_blocks(struct tiler_block_info *blks, int num_blocks,
+static int check_blocks(const struct tiler_block_info *blks, int num_blocks,
int num_pagesize_blocks)
{
/* check arguments */
@@ -660,7 +671,7 @@ static int check_blocks(struct tiler_block_info *blks, int num_blocks,
int ix;
for (ix = 0; ix < num_blocks; ix++)
{
- struct tiler_block_info *blk = blks + ix;
+ const struct tiler_block_info *blk = blks + ix;
CHK_I(blk->ssptr,==,0);
CHK_I(blk->id,==,0);
int ret = check_block(blk, ix < num_pagesize_blocks);
@@ -714,7 +725,7 @@ void *MemMgr_Alloc(MemAllocBlock blocks[], int num_blocks)
void *bufPtr = NULL;
/* need to access ssptrs */
- struct tiler_block_info *blks = (tiler_block_info *) blocks;
+ struct tiler_block_info *blks = blocks;
/* check block allocation params, and state */
if (NOT_I(check_blocks(blks, num_blocks, num_blocks - 1),==,0) ||
@@ -769,6 +780,7 @@ int MemMgr_Free(void *bufPtr)
{
#ifndef STUB_TILER
dump_buf(&buf, "==(URBUF)=>");
+ print_backtrace(NULL, 0);
ret = A_I(ioctl(td, TILIOC_URBUF, &buf),==,0);
dump_buf(&buf, "<=(URBUF)==");
@@ -808,7 +820,7 @@ void *MemMgr_Map(MemAllocBlock blocks[], int num_blocks)
/* we only map 1 page aligned 1D buffer for now */
if (NOT_I(num_blocks,==,1) ||
- NOT_I(blocks[0].pixelFormat,==,PIXEL_FMT_PAGE) ||
+ NOT_I(blocks[0].fmt,==,PIXEL_FMT_PAGE) ||
NOT_I(blocks[0].dim.len & (PAGE_SIZE - 1),==,0) ||
#ifdef STUB_TILER
NOT_I(MemMgr_IsMapped(blocks[0].ptr),==,0) ||
@@ -867,6 +879,7 @@ int MemMgr_UnMap(void *bufPtr)
{
#ifndef STUB_TILER
dump_buf(&buf, "==(URBUF)=>");
+ print_backtrace(NULL, 0);
ret = A_I(ioctl(td, TILIOC_URBUF, &buf),==,0);
dump_buf(&buf, "<=(URBUF)==");
diff --git a/tiler/memmgr.h b/tiler/memmgr.h
index 8f99904..4a4b9b8 100644
--- a/tiler/memmgr.h
+++ b/tiler/memmgr.h
@@ -83,27 +83,10 @@
*
* @author a0194118 (9/1/2009)
*/
-struct MemAllocBlock {
- pixel_fmt_t pixelFormat; /* pixel format */
- union {
- struct {
- pixels_t width; /* width of 2D buffer */
- pixels_t height; /* height of 2D buffer */
- } area;
- bytes_t len; /* length of 1D buffer. Must be multiple of
- stride if stride is not 0. */
- } dim;
- uint32_t stride; /* must be multiple of page size. Can be 0 only
- if pixelFormat is PIXEL_FMT_PAGE. */
- void *ptr; /* pointer to beginning of buffer */
- uint32_t id; /* buffer ID - received at allocation */
- uint32_t key; /* buffer key - given at allocation */
- uint32_t group_id; /* group ID */
- /* alignment requirements for ssptr: ssptr & (align - 1) == offs */
- uint32_t reserved; /* system space address (used internally) */
-};
-typedef struct MemAllocBlock MemAllocBlock;
+#include <tiler.h>
+
+typedef struct tiler_block_info MemAllocBlock;
/**
* Returns the page size. This is required for allocating 1D
diff --git a/tiler/memmgr_test.c b/tiler/memmgr_test.c
index 2bb76b6..3998d54 100644
--- a/tiler/memmgr_test.c
+++ b/tiler/memmgr_test.c
@@ -196,14 +196,14 @@ static bytes_t def_stride(bytes_t width)
*
* @author a0194118 (9/4/2009)
*
- * @param pixelFormat Pixelformat
+ * @param.fmt Pixelformat
*
* @return Bytes per pixel
*/
-static bytes_t def_bpp(pixel_fmt_t pixelFormat)
+static bytes_t def_bpp(pixel_fmt_t fmt)
{
- return (pixelFormat == PIXEL_FMT_32BIT ? 4 :
- pixelFormat == PIXEL_FMT_16BIT ? 2 : 1);
+ return fmt == PIXEL_FMT_32BIT ? 4 :
+ (fmt == PIXEL_FMT_16BIT ? 2 : 1);
}
/**
@@ -229,7 +229,7 @@ void fill_mem(uint16_t start, MemAllocBlock *block)
IN;
uint16_t *ptr = (uint16_t *)block->ptr, delta = 1, step = 1;
bytes_t height, width, stride, i;
- if (block->pixelFormat == PIXEL_FMT_PAGE)
+ if (block->fmt == PIXEL_FMT_PAGE)
{
height = 1;
stride = width = block->dim.len;
@@ -240,7 +240,7 @@ void fill_mem(uint16_t start, MemAllocBlock *block)
width = block->dim.area.width;
stride = block->stride;
}
- width *= def_bpp(block->pixelFormat);
+ width *= def_bpp(block->fmt);
bytes_t size = height * stride;
P("(%p,0x%x*0x%x,s=0x%x)=0x%x", block->ptr, width, height, stride, start);
@@ -249,7 +249,7 @@ void fill_mem(uint16_t start, MemAllocBlock *block)
uint32_t *ptr32 = (uint32_t *)ptr;
while (height--)
{
- if (block->pixelFormat == PIXEL_FMT_32BIT)
+ if (block->fmt == PIXEL_FMT_32BIT)
{
for (i = 0; i < width; i += sizeof(uint32_t))
{
@@ -296,7 +296,7 @@ void fill_mem(uint16_t start, MemAllocBlock *block)
}
}
- CHK_P((block->pixelFormat == PIXEL_FMT_32BIT ? (void *)ptr32 : (void *)ptr),==,
+ CHK_P((block->fmt == PIXEL_FMT_32BIT ? (void *)ptr32 : (void *)ptr),==,
(block->ptr + size));
OUT;
}
@@ -317,7 +317,7 @@ int check_mem(uint16_t start, MemAllocBlock *block)
IN;
uint16_t *ptr = (uint16_t *)block->ptr, delta = 1, step = 1;
bytes_t height, width, stride, r, i;
- if (block->pixelFormat == PIXEL_FMT_PAGE)
+ if (block->fmt == PIXEL_FMT_PAGE)
{
height = 1;
stride = width = block->dim.len;
@@ -328,13 +328,13 @@ int check_mem(uint16_t start, MemAllocBlock *block)
width = block->dim.area.width;
stride = block->stride;
}
- width *= def_bpp(block->pixelFormat);
+ width *= def_bpp(block->fmt);
CHK_I(width,<=,stride);
uint32_t *ptr32 = (uint32_t *)ptr;
for (r = 0; r < height; r++)
{
- if (block->pixelFormat == PIXEL_FMT_32BIT)
+ if (block->fmt == PIXEL_FMT_32BIT)
{
for (i = 0; i < width; i += sizeof(uint32_t))
{
@@ -420,7 +420,7 @@ void *alloc_1D(bytes_t length, bytes_t stride, uint16_t val)
MemAllocBlock block;
memset(&block, 0, sizeof(block));
- block.pixelFormat = PIXEL_FMT_PAGE;
+ block.fmt = PIXEL_FMT_PAGE;
block.dim.len = length;
block.stride = stride;
@@ -431,9 +431,9 @@ void *alloc_1D(bytes_t length, bytes_t stride, uint16_t val)
NOT_I(MemMgr_Is1DBlock(bufPtr),!=,0) ||
NOT_I(MemMgr_Is2DBlock(bufPtr),==,0) ||
NOT_I(MemMgr_GetStride(bufPtr),==,block.stride) ||
- NOT_P(TilerMem_VirtToPhys(bufPtr),==,block.reserved) ||
+ NOT_P(TilerMem_VirtToPhys(bufPtr),==,block.ssptr) ||
NOT_I(TilerMem_GetStride(TilerMem_VirtToPhys(bufPtr)),==,PAGE_SIZE) ||
- NOT_L((PAGE_SIZE - 1) & (long)bufPtr,==,(PAGE_SIZE - 1) & block.reserved))
+ NOT_L((PAGE_SIZE - 1) & (long)bufPtr,==,(PAGE_SIZE - 1) & block.ssptr))
{
MemMgr_Free(bufPtr);
return NULL;
@@ -463,7 +463,7 @@ int free_1D(bytes_t length, bytes_t stride, uint16_t val, void *bufPtr)
MemAllocBlock block;
memset(&block, 0, sizeof(block));
- block.pixelFormat = PIXEL_FMT_PAGE;
+ block.fmt = PIXEL_FMT_PAGE;
block.dim.len = length;
block.stride = stride;
block.ptr = bufPtr;
@@ -501,7 +501,7 @@ void *alloc_2D(pixels_t width, pixels_t height, pixel_fmt_t fmt, bytes_t stride,
MemAllocBlock block;
memset(&block, 0, sizeof(block));
- block.pixelFormat = fmt;
+ block.fmt = fmt;
block.dim.area.width = width;
block.dim.area.height = height;
block.stride = stride;
@@ -518,9 +518,9 @@ void *alloc_2D(pixels_t width, pixels_t height, pixel_fmt_t fmt, bytes_t stride,
NOT_I(MemMgr_Is2DBlock(bufPtr),!=,0) ||
NOT_I(block.stride,!=,0) ||
NOT_I(MemMgr_GetStride(bufPtr),==,block.stride) ||
- NOT_P(TilerMem_VirtToPhys(bufPtr),==,block.reserved) ||
+ NOT_P(TilerMem_VirtToPhys(bufPtr),==,block.ssptr) ||
NOT_I(TilerMem_GetStride(TilerMem_VirtToPhys(bufPtr)),==,cstride) ||
- NOT_L((PAGE_SIZE - 1) & (long)bufPtr,==,(PAGE_SIZE - 1) & block.reserved))
+ NOT_L((PAGE_SIZE - 1) & (long)bufPtr,==,(PAGE_SIZE - 1) & block.ssptr))
{
MemMgr_Free(bufPtr);
return NULL;
@@ -553,7 +553,7 @@ int free_2D(pixels_t width, pixels_t height, pixel_fmt_t fmt, bytes_t stride,
MemAllocBlock block;
memset(&block, 0, sizeof(block));
- block.pixelFormat = fmt;
+ block.fmt = fmt;
block.dim.area.width = width;
block.dim.area.height = height;
block.stride = def_stride(width * def_bpp(fmt));
@@ -589,10 +589,10 @@ void *alloc_NV12(pixels_t width, pixels_t height, uint16_t val)
MemAllocBlock blocks[2];
ZERO(blocks);
- blocks[0].pixelFormat = PIXEL_FMT_8BIT;
+ blocks[0].fmt = PIXEL_FMT_8BIT;
blocks[0].dim.area.width = width;
blocks[0].dim.area.height = height;
- blocks[1].pixelFormat = PIXEL_FMT_16BIT;
+ blocks[1].fmt = PIXEL_FMT_16BIT;
blocks[1].dim.area.width = width >> 1;
blocks[1].dim.area.height = height >> 1;
@@ -611,12 +611,12 @@ void *alloc_NV12(pixels_t width, pixels_t height, uint16_t val)
NOT_I(blocks[1].stride,!=,0) ||
NOT_I(MemMgr_GetStride(bufPtr),==,blocks[0].stride) ||
NOT_I(MemMgr_GetStride(buf2),==,blocks[1].stride) ||
- NOT_P(TilerMem_VirtToPhys(bufPtr),==,blocks[0].reserved) ||
- NOT_P(TilerMem_VirtToPhys(buf2),==,blocks[1].reserved) ||
+ NOT_P(TilerMem_VirtToPhys(bufPtr),==,blocks[0].ssptr) ||
+ NOT_P(TilerMem_VirtToPhys(buf2),==,blocks[1].ssptr) ||
NOT_I(TilerMem_GetStride(TilerMem_VirtToPhys(bufPtr)),==,TILER_STRIDE_8BIT) ||
NOT_I(TilerMem_GetStride(TilerMem_VirtToPhys(buf2)),==,TILER_STRIDE_16BIT) ||
- NOT_L((PAGE_SIZE - 1) & (long)blocks[0].ptr,==,(PAGE_SIZE - 1) & blocks[0].reserved) ||
- NOT_L((PAGE_SIZE - 1) & (long)blocks[1].ptr,==,(PAGE_SIZE - 1) & blocks[1].reserved))
+ NOT_L((PAGE_SIZE - 1) & (long)blocks[0].ptr,==,(PAGE_SIZE - 1) & blocks[0].ssptr) ||
+ NOT_L((PAGE_SIZE - 1) & (long)blocks[1].ptr,==,(PAGE_SIZE - 1) & blocks[1].ssptr))
{
MemMgr_Free(bufPtr);
return NULL;
@@ -651,12 +651,12 @@ int free_NV12(pixels_t width, pixels_t height, uint16_t val, void *bufPtr)
MemAllocBlock blocks[2];
memset(blocks, 0, sizeof(blocks));
- blocks[0].pixelFormat = PIXEL_FMT_8BIT;
+ blocks[0].fmt = PIXEL_FMT_8BIT;
blocks[0].dim.area.width = width;
blocks[0].dim.area.height = height;
blocks[0].stride = def_stride(width);
blocks[0].ptr = bufPtr;
- blocks[1].pixelFormat = PIXEL_FMT_16BIT;
+ blocks[1].fmt = PIXEL_FMT_16BIT;
blocks[1].dim.area.width = width >> 1;
blocks[1].dim.area.height = height >> 1;
blocks[1].stride = def_stride(width);
@@ -697,7 +697,7 @@ void *map_1D(void *dataPtr, bytes_t length, bytes_t stride, uint16_t val)
MemAllocBlock block;
memset(&block, 0, sizeof(block));
- block.pixelFormat = PIXEL_FMT_PAGE;
+ block.fmt = PIXEL_FMT_PAGE;
block.dim.len = length;
block.stride = stride;
block.ptr = dataPtr;
@@ -710,10 +710,10 @@ void *map_1D(void *dataPtr, bytes_t length, bytes_t stride, uint16_t val)
NOT_I(MemMgr_Is1DBlock(bufPtr),!=,0) ||
NOT_I(MemMgr_Is2DBlock(bufPtr),==,0) ||
NOT_I(MemMgr_GetStride(bufPtr),==,block.stride) ||
- NOT_P(TilerMem_VirtToPhys(bufPtr),==,block.reserved) ||
+ NOT_P(TilerMem_VirtToPhys(bufPtr),==,block.ssptr) ||
NOT_I(TilerMem_GetStride(TilerMem_VirtToPhys(bufPtr)),==,PAGE_SIZE) ||
NOT_L((PAGE_SIZE - 1) & (long)bufPtr,==,0) ||
- NOT_L((PAGE_SIZE - 1) & block.reserved,==,0))
+ NOT_L((PAGE_SIZE - 1) & block.ssptr,==,0))
{
MemMgr_UnMap(bufPtr);
return NULL;
@@ -747,7 +747,7 @@ int unmap_1D(void *dataPtr, bytes_t length, bytes_t stride, uint16_t val, void *
MemAllocBlock block;
memset(&block, 0, sizeof(block));
- block.pixelFormat = PIXEL_FMT_PAGE;
+ block.fmt = PIXEL_FMT_PAGE;
block.dim.len = length;
block.stride = stride;
block.ptr = dataPtr;
@@ -1205,30 +1205,30 @@ int star_test(uint32_t num_ops, uint16_t num_slots)
switch (mem[ix].op)
{
case 0: case 1:
- blk.pixelFormat = PIXEL_FMT_PAGE;
+ blk.fmt = PIXEL_FMT_PAGE;
blk.dim.len = mem[ix].length;
break;
case 5:
- blk.pixelFormat = PIXEL_FMT_16BIT;
+ blk.fmt = PIXEL_FMT_16BIT;
blk.dim.area.width = mem[ix].width >> 1;
blk.dim.area.height = mem[ix].height >> 1;
blk.stride = def_stride(mem[ix].width); /* same for Y and UV */
blk.ptr = mem[ix].bufPtr + mem[ix].height * blk.stride;
check_mem(mem[ix].val, &blk);
case 2:
- blk.pixelFormat = PIXEL_FMT_8BIT;
+ blk.fmt = PIXEL_FMT_8BIT;
blk.dim.area.width = mem[ix].width;
blk.dim.area.height = mem[ix].height;
blk.stride = def_stride(mem[ix].width);
break;
case 3:
- blk.pixelFormat = PIXEL_FMT_16BIT;
+ blk.fmt = PIXEL_FMT_16BIT;
blk.dim.area.width = mem[ix].width;
blk.dim.area.height = mem[ix].height;
blk.stride = def_stride(mem[ix].width * 2);
break;
case 4:
- blk.pixelFormat = PIXEL_FMT_32BIT;
+ blk.fmt = PIXEL_FMT_32BIT;
blk.dim.area.width = mem[ix].width;
blk.dim.area.height = mem[ix].height;
blk.stride = def_stride(mem[ix].width * 4);
@@ -1406,14 +1406,14 @@ int neg_alloc_tests()
blk = block + num_blocks - 1;
P("/* bad pixel format */");
- blk->pixelFormat = PIXEL_FMT_MIN - 1;
+ blk->fmt = -1;
blk->dim.len = PAGE_SIZE;
ret |= NEGA(MemMgr_Alloc(block, num_blocks));
- blk->pixelFormat = PIXEL_FMT_MAX + 1;
+ blk->fmt = PIXEL_FMT_MAX + 1;
ret |= NEGA(MemMgr_Alloc(block, num_blocks));
P("/* bad 1D stride */");
- blk->pixelFormat = PIXEL_FMT_PAGE;
+ blk->fmt = PIXEL_FMT_PAGE;
blk->stride = PAGE_SIZE - 1;
ret |= NEGA(MemMgr_Alloc(block, num_blocks));
@@ -1422,7 +1422,7 @@ int neg_alloc_tests()
ret |= NEGA(MemMgr_Alloc(block, num_blocks));
P("/* bad 2D stride */");
- blk->pixelFormat = PIXEL_FMT_8BIT;
+ blk->fmt = PIXEL_FMT_8BIT;
blk->dim.area.width = PAGE_SIZE - 1;
blk->stride = PAGE_SIZE - 1;
blk->dim.area.height = 16;
@@ -1441,7 +1441,7 @@ int neg_alloc_tests()
blk->dim.area.height = 16;
}
- block[0].pixelFormat = block[1].pixelFormat = PIXEL_FMT_8BIT;
+ block[0].fmt = block[1].fmt = PIXEL_FMT_8BIT;
block[0].dim.area.width = 16384;
block[0].dim.area.height = block[1].dim.area.width = 16;
block[1].dim.area.height = 8192;
@@ -1509,14 +1509,14 @@ int neg_map_tests()
blk = block + num_blocks - 1;
P("/* bad pixel format */");
- blk->pixelFormat = PIXEL_FMT_MIN - 1;
+ blk->fmt = -1;
blk->dim.len = PAGE_SIZE;
ret |= NEGM(MemMgr_Map(block, num_blocks));
- blk->pixelFormat = PIXEL_FMT_MAX + 1;
+ blk->fmt = PIXEL_FMT_MAX + 1;
ret |= NEGM(MemMgr_Map(block, num_blocks));
P("/* bad 1D stride */");
- blk->pixelFormat = PIXEL_FMT_PAGE;
+ blk->fmt = PIXEL_FMT_PAGE;
blk->stride = PAGE_SIZE - 1;
ret |= NEGM(MemMgr_Map(block, num_blocks));
@@ -1525,7 +1525,7 @@ int neg_map_tests()
ret |= NEGM(MemMgr_Map(block, num_blocks));
P("/* bad 2D stride */");
- blk->pixelFormat = PIXEL_FMT_8BIT;
+ blk->fmt = PIXEL_FMT_8BIT;
blk->dim.area.width = PAGE_SIZE - 1;
blk->stride = PAGE_SIZE - 1;
blk->dim.area.height = 16;
@@ -1551,7 +1551,7 @@ int neg_map_tests()
ret |= NEGM(MemMgr_Map(block, 1));
P("/* 1 1D buffer with no address */");
- block[0].pixelFormat = PIXEL_FMT_PAGE;
+ block[0].fmt = PIXEL_FMT_PAGE;
block[0].dim.len = 2 * PAGE_SIZE;
block[0].ptr = NULL;
ret |= NEGM(MemMgr_Map(block, 1));
diff --git a/tiler/tilermgr.c b/tiler/tilermgr.c
index 470de5c..f946095 100644
--- a/tiler/tilermgr.c
+++ b/tiler/tilermgr.c
@@ -70,7 +70,7 @@ int TilerMgr_Open()
return TILERMGR_ERR_NONE;
}
-SSPtr TilerMgr_Alloc(enum pixel_fmt_t pixfmt, pixels_t width, pixels_t height)
+SSPtr TilerMgr_Alloc(pixel_fmt_t pixfmt, pixels_t width, pixels_t height)
{
int ret = -1;
struct tiler_block_info block = {0};
diff --git a/tiler/tilermgr.h b/tiler/tilermgr.h
index cd76822..4530eb0 100644
--- a/tiler/tilermgr.h
+++ b/tiler/tilermgr.h
@@ -43,7 +43,7 @@
int TilerMgr_Open();
int TilerMgr_Close();
-SSPtr TilerMgr_Alloc(enum pixel_fmt_t pixfmt, pixels_t width, pixels_t height);
+SSPtr TilerMgr_Alloc(pixel_fmt_t pixfmt, pixels_t width, pixels_t height);
int TilerMgr_Free(SSPtr ssptr);
SSPtr TilerMgr_PageModeAlloc(bytes_t length);
int TilerMgr_PageModeFree(SSPtr ssptr);