aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhnaradla <hanumantha.naradla@linaro.org>2014-07-22 17:46:45 +0530
committerhnaradla <hanumantha.naradla@linaro.org>2014-07-22 17:46:45 +0530
commitddb952c9721f90579476d96e91fe06f29ab31082 (patch)
tree3ec9b7a0f05cd45eec7f70b1a111f0c2c5f3d413
parenta33cb3d4edc29b0b2306af553cc362b0365d5469 (diff)
downloadvpb-ddb952c9721f90579476d96e91fe06f29ab31082.tar.gz
vpb: Integrate decodertest and modetest to make video playback test.
-rwxr-xr-xMakefile (renamed from modetest/Makefile)8
-rwxr-xr-xREADME (renamed from decodertest/README)0
-rwxr-xr-xbuffers.c (renamed from modetest/buffers.c)8
-rwxr-xr-xbuffers.h (renamed from modetest/buffers.h)0
-rwxr-xr-xdecoder_driver_test.c (renamed from decodertest/decoder_driver_test.c)363
-rwxr-xr-xdecoder_driver_test.h (renamed from decodertest/decoder_driver_test.h)14
-rwxr-xr-xdecodertest/Makefile15
-rwxr-xr-xdecodertest/ion.h75
-rwxr-xr-xdecodertest/msm_ion.h106
-rwxr-xr-xion.h (renamed from modetest/ion.h)0
-rwxr-xr-xlibmsm.c (renamed from modetest/libmsm.c)0
-rwxr-xr-xlibmsm.h (renamed from modetest/libmsm.h)0
-rwxr-xr-xmessage_queue.c (renamed from decodertest/message_queue.c)0
-rwxr-xr-xmessage_queue.h (renamed from decodertest/message_queue.h)0
-rwxr-xr-xmsm_ion.h323
-rwxr-xr-xmsm_vidc_dec.h (renamed from decodertest/msm_vidc_dec.h)0
-rwxr-xr-xmsmdumb.c (renamed from modetest/msmdumb.c)2
-rwxr-xr-xmsmdumb_priv.h (renamed from modetest/msmdumb_priv.h)0
-rwxr-xr-xmsmmodetest.c (renamed from modetest/msmmodetest.c)0
-rwxr-xr-xqueue.c (renamed from decodertest/queue.c)0
-rwxr-xr-xqueue.h (renamed from decodertest/queue.h)0
21 files changed, 357 insertions, 557 deletions
diff --git a/modetest/Makefile b/Makefile
index c64afa0..f86d22d 100755
--- a/modetest/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-all: msmmodetest
+all: vpbtest
IDIR =/usr/include/libdrm/
CFLAGS=-I$(IDIR)
@@ -7,11 +7,11 @@ LFLAGS = -L/usr/local/lib -L/usr/lib/arm-linux-gnueabihf
LIBS = -ldrm
-SRC=msmdumb.c libmsm.c buffers.c msmmodetest.c
+SRC=msmdumb.c libmsm.c buffers.c msmmodetest.c queue.c message_queue.c decoder_driver_test.c
OBJ=$(patsubst %.c,%.o,$(SRC))
CC = $(CROSS_COMPILE)gcc
-msmmodetest: $(OBJ)
+vpbtest: $(OBJ)
$(CC) -pthread $^ -o $@ $(CFLAGS) $(LFLAGS) $(LIBS)
%.o: %.c
@@ -19,4 +19,4 @@ msmmodetest: $(OBJ)
clean:
-rm -f $(OBJ)
- -rm -f msmmodetest
+ -rm -f vpbtest
diff --git a/decodertest/README b/README
index 534fb81..534fb81 100755
--- a/decodertest/README
+++ b/README
diff --git a/modetest/buffers.c b/buffers.c
index 7482afb..59be7b6 100755
--- a/modetest/buffers.c
+++ b/buffers.c
@@ -1005,8 +1005,8 @@ fill_pattern(unsigned int format, enum fill_pattern pattern, void *planes[3],
*
* Returns the file descriptor that can be passed around for sharing
*/
-static int
-ion_allocate_buffer(unsigned int width, unsigned int height)
+int
+ion_allocate_buffer_msm(unsigned int width, unsigned int height)
{
int ion_devicefd = 0;
struct ion_fd_data fd_data;
@@ -1074,7 +1074,7 @@ allocate_buffer(struct msm_driver *msm, unsigned int width, unsigned int height,
bo_attribs[1] = width;
bo_attribs[3] = height;
- buf_fd = ion_allocate_buffer(width, height);
+ buf_fd = ion_allocate_buffer_msm(width, height);
ret = msm_bo_create(msm, bo_attribs, &bo, buf_fd);
if (ret) {
fprintf(stderr, "failed to alloc buffer: %s\n",
@@ -1084,7 +1084,7 @@ allocate_buffer(struct msm_driver *msm, unsigned int width, unsigned int height,
ret = msm_bo_get_prop(bo, MSM_PITCH, stride);
if (ret) {
- fprintf(stderr, "failed to retreive buffer stride: %s\n",
+ fprintf(stderr, "failed to retrieve buffer stride: %s\n",
strerror(-ret));
msm_bo_destroy(&bo);
return NULL;
diff --git a/modetest/buffers.h b/buffers.h
index 81c6da6..81c6da6 100755
--- a/modetest/buffers.h
+++ b/buffers.h
diff --git a/decodertest/decoder_driver_test.c b/decoder_driver_test.c
index 74ebfaf..30d16a7 100755
--- a/decodertest/decoder_driver_test.c
+++ b/decoder_driver_test.c
@@ -45,7 +45,7 @@ static int Code_type;
static int total_frames = 0;
static unsigned int header_code = 0;
static pthread_mutex_t read_lock;
-int reconfig =0;
+
static unsigned int read_frame ( unsigned char *dataptr,unsigned int length,
FILE * inputBufferFile
);
@@ -75,10 +75,8 @@ int main (int argc, char **argv)
FILE *file_ptr = NULL;
int temp1 =0,temp2 =0;
int error = 1;
- unsigned int i = 0,type=0;
- reconfig = 0;
+ unsigned int i = 0;
- memset(&h264_mv_buff,0,sizeof(struct h264_mv_buffer));
/* Allocate memory for the decode context */
decoder_context = (struct video_decoder_context *) \
calloc (sizeof (struct video_decoder_context),1);
@@ -119,22 +117,10 @@ int main (int argc, char **argv)
}
/*As of now decoder type,frame_height and frame_width are hardcoded */
- type = atoi(argv [2]);
- if(type == 1)
- {
- decoder_context->decoder_format = VDEC_CODECTYPE_MPEG4;
- DEBUG_PRINT("\n codec format VDEC_CODECTYPE_MPEG4");
- Code_type = VDEC_CODECTYPE_MPEG4;
- }
- else if(type == 2)
- {
- DEBUG_PRINT("\n codec format VDEC_CODECTYPE_H264 ");
- decoder_context->decoder_format = VDEC_CODECTYPE_H264;
- Code_type = VDEC_CODECTYPE_H264;
- }
- // Code_type = atoi(argv [3]);
- decoder_context->video_resoultion.frame_height = atoi(argv [3]);
- decoder_context->video_resoultion.frame_width = atoi(argv [4]);
+ decoder_context->decoder_format = VDEC_CODECTYPE_MPEG4;
+ Code_type = 0;
+ decoder_context->video_resoultion.frame_height = 480;
+ decoder_context->video_resoultion.frame_width = 640;
/* All the inputs are all right now, start the decode */
@@ -247,7 +233,12 @@ int init_decoder ( struct video_decoder_context *init_decode )
return -1;
}
- /*Set the output format*/
+ if(ioctl(init_decode->video_driver_fd,VDEC_IOCTL_SET_CONT_ON_RECONFIG) < 0)
+ {
+ DEBUG_PRINT("\n ========== VDEC_IOCTL_SET_CONT_ON_RECONFIG FAILED....");
+ }
+
+ /*Set the output format*/
ioctl_msg.in = &output_format;
ioctl_msg.out = NULL;
@@ -282,7 +273,7 @@ int init_decoder ( struct video_decoder_context *init_decode )
return -1;
}
- DEBUG_PRINT("\n input Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %ld,meta_buffer_size=%d",\
+ DEBUG_PRINT("\n input Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %d,meta_buffer_size=%d",\
init_decode->input_buffer.buffer_size,\
init_decode->input_buffer.mincount,\
init_decode->input_buffer.actualcount,\
@@ -317,7 +308,7 @@ int init_decoder ( struct video_decoder_context *init_decode )
return -1;
}
- DEBUG_PRINT("\n output_buffer Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %ld,meta_buffer_size=%d",\
+ DEBUG_PRINT("\n output_buffer Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %d,meta_buffer_size=%d",\
init_decode->output_buffer.buffer_size,\
init_decode->output_buffer.mincount,\
init_decode->output_buffer.actualcount,\
@@ -326,15 +317,6 @@ int init_decoder ( struct video_decoder_context *init_decode )
init_decode->output_buffer.buf_poolid,\
init_decode->output_buffer.meta_buffer_size);
-/* init_decode->disable_dmx = 0;
- ioctl_msg.in = NULL;
- ioctl_msg.out = &init_decode->disable_dmx;
- if (ioctl(init_decode->video_driver_fd, VDEC_IOCTL_GET_DISABLE_DMX_SUPPORT, &ioctl_msg))
- {
- DEBUG_PRINT("Error VDEC_IOCTL_GET_DISABLE_DMX_SUPPORT");
- return -1;
- }
-*/
/*Create Queue related data structures*/
queue_ptr = &init_decode->queue_context;
queue_ptr->commandq_size = 50;
@@ -383,8 +365,6 @@ int free_buffer ( enum vdec_buffer buffer_dir,
{
unsigned int buffercount = 0,i=0;
struct vdec_bufferpayload *ptemp = NULL;
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- struct vdec_setbuffer_cmd setbuffers;
if (decode_context == NULL)
{
@@ -413,51 +393,11 @@ int free_buffer ( enum vdec_buffer buffer_dir,
buffercount = decode_context->output_buffer.actualcount;
ptemp = decode_context->ptr_outputbuffer;
- /* free mv buffers */
- if(h264_mv_buff.pmem_fd > 0)
- {
- if(ioctl(decode_context->video_driver_fd, VDEC_IOCTL_FREE_H264_MV_BUFFER,NULL) < 0)
- DEBUG_PRINT("VDEC_IOCTL_FREE_H264_MV_BUFFER failed");
- munmap(h264_mv_buff.buffer, h264_mv_buff.size);
-
- if (close(decode_context->h264_mv.fd_ion_data.fd)) {
- DEBUG_PRINT("\n ION: close(%d) failed",
- decode_context->h264_mv.fd_ion_data.fd);
- }
- if(ioctl(decode_context->h264_mv.ion_device_fd,ION_IOC_FREE,
- &decode_context->h264_mv.ion_alloc_data.handle)) {
- DEBUG_PRINT("\n ION: free failed, dev_fd = %d, handle = 0x%p",
- decode_context->h264_mv.ion_device_fd, decode_context->h264_mv.ion_alloc_data.handle);
- }
- decode_context->h264_mv.ion_device_fd = -1;
- decode_context->h264_mv.ion_alloc_data.handle = NULL;
- decode_context->h264_mv.fd_ion_data.fd = -1;
-
- DEBUG_PRINT("Cleaning H264_MV buffer of size %d",h264_mv_buff.size);
- h264_mv_buff.pmem_fd = -1;
- h264_mv_buff.offset = 0;
- h264_mv_buff.size = 0;
- h264_mv_buff.count = 0;
- h264_mv_buff.buffer = NULL;
- }
- /* free output buffers */
- ioctl_msg.in = &decode_context->output_buffer;
- ioctl_msg.out = NULL;
for (i=0;i<buffercount;i++)
{
if (ptemp [i].pmem_fd != -1)
{
- setbuffers.buffer_type = VDEC_BUFFER_TYPE_OUTPUT;
- memcpy (&setbuffers.buffer,&decode_context->ptr_outputbuffer[i],sizeof (struct vdec_bufferpayload));
- ioctl_msg.in = &setbuffers;
- ioctl_msg.out = NULL;
-
- if (ioctl (decode_context->video_driver_fd, VDEC_IOCTL_FREE_BUFFER,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Release output buffer failed in VCD");
- }
munmap ( ptemp [i].bufferaddr,ptemp [i].mmaped_size);
ptemp [i].bufferaddr = NULL;
close (ptemp [i].pmem_fd);
@@ -590,7 +530,7 @@ int ion_allocate_buffer ( enum vdec_buffer buffer_dir,
DEBUG_PRINT("\n Set Buffers Failed");
return -1;
}
- DEBUG_PRINT("\ninput ion_alloc: buf_addr = 0x%x, len = %d, size = %d, \n",\
+ DEBUG_PRINT("\ninput ion_alloc: buf_addr = %p, len = %d, size = %d, \n",\
buf_addr,decode_context->input_buffer.buffer_size,decode_context->input_buffer.buffer_size);
} /* for loop*/
DEBUG_PRINT ("\nInput buffers ion_allocate_buffer: Success");
@@ -649,6 +589,7 @@ int ion_allocate_buffer ( enum vdec_buffer buffer_dir,
decode_context->op_buf_ion_info[i].ion_device_fd = fd;
pmem_fd = decode_context->op_buf_ion_info[i].fd_ion_data.fd;
+
buf_addr = (unsigned char *)mmap(NULL,
decode_context->output_buffer.buffer_size,
PROT_READ|PROT_WRITE, MAP_SHARED, pmem_fd, 0);
@@ -675,7 +616,7 @@ int ion_allocate_buffer ( enum vdec_buffer buffer_dir,
DEBUG_PRINT("\n Set Buffers Failed");
return -1;
}
- DEBUG_PRINT("\noutput ion_alloc: buf_addr = 0x%x, len = %d, size = %d, \n",\
+ DEBUG_PRINT("\noutput ion_alloc: buf_addr = %p, len = %d, size = %d, \n",\
buf_addr,decode_context->output_buffer.buffer_size,decode_context->output_buffer.buffer_size);
} /* for loop */
@@ -684,7 +625,6 @@ int ion_allocate_buffer ( enum vdec_buffer buffer_dir,
return 1;
}
-
int start_decoding (struct video_decoder_context *decode_context)
{
struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
@@ -855,172 +795,7 @@ int deinit_decoder (struct video_decoder_context *init_decode)
DEBUG_PRINT("\n all threads are closed");
return 1;
}
-int test_vdec_alloc_h264_mv(void *context)
-{
- int pmem_fd = -1,fd=-1,rc=-1;
- int width, height, size, alignment;
- void *buf_addr = NULL;
- struct vdec_ioctl_msg ioctl_msg;
- // struct pmem_allocation allocation;
- struct vdec_h264_mv h264_mv;
- struct vdec_mv_buff_size mv_buff_size;
- struct video_decoder_context *decode_context = NULL;
-
- decode_context = (struct video_decoder_context *) context;
-
- decode_context->video_resoultion.stride = decode_context->video_resoultion.frame_width;
- decode_context->video_resoultion.scan_lines = decode_context->video_resoultion.frame_height;
-
- mv_buff_size.width = decode_context->video_resoultion.stride;
- mv_buff_size.height = decode_context->video_resoultion.scan_lines>>2;
-
- ioctl_msg.in = NULL;
- ioctl_msg.out = (void*)&mv_buff_size;
-
- if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_GET_MV_BUFFER_SIZE, (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n GET_MV_BUFFER_SIZE Failed for width: %d, Height %d" ,
- mv_buff_size.width, mv_buff_size.height);
- return -1;
- }
-
- DEBUG_PRINT("\nGET_MV_BUFFER_SIZE returned: Size: %d and alignment: %d",
- mv_buff_size.size, mv_buff_size.alignment);
-
- size = mv_buff_size.size * decode_context->output_buffer.actualcount;
- alignment = mv_buff_size.alignment;
-
- DEBUG_PRINT("\nEntered vdec_alloc_h264_mv act_width: %d, act_height: %d, size: %d, alignment %d",
- decode_context->video_resoultion.frame_width, decode_context->video_resoultion.frame_height,size,alignment);
-
- struct ion_allocation_data *alloc_data = &decode_context->h264_mv.ion_alloc_data;
- struct ion_fd_data *fd_data = &decode_context->h264_mv.fd_ion_data;
- fd = m_vdec_ion_devicefd;
- alloc_data->len = size;
- alloc_data->flags = 0x1;
- alloc_data->align = 8196;
- alloc_data->heap_mask = 0x2000000;
- rc = ioctl(fd,ION_IOC_ALLOC,alloc_data);
- if (rc || !alloc_data->handle) {
- DEBUG_PRINT("\n ION ALLOC failed, fd = %d, rc = %d, handle = 0x%p, "
- "errno ", fd, rc, alloc_data->handle);
- alloc_data->handle = NULL;
- return -1;
- }
- fd_data->handle = alloc_data->handle;
- rc = ioctl(fd,ION_IOC_MAP,fd_data);
- if (rc) {
- DEBUG_PRINT("\n ION MAP failed, fd = %d, handle = 0x%p, errno =",
- fd, fd_data->handle);
- fd_data->fd = -1;
- return -1;
- }
- decode_context->h264_mv.ion_device_fd = fd;
- pmem_fd = decode_context->h264_mv.fd_ion_data.fd;
-
- buf_addr = mmap(NULL, size,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, pmem_fd, 0);
-
- if (buf_addr == (void*) MAP_FAILED)
- {
- pmem_fd = -1;
- DEBUG_PRINT("Error returned in allocating recon buffers buf_addr: %p\n",buf_addr);
- return -1;
- }
- DEBUG_PRINT("Allocated virt:%p, FD: %d of size %d count: %d", buf_addr,
- pmem_fd, size, decode_context->output_buffer.actualcount);
-
- h264_mv.size = size;
- h264_mv.count = decode_context->output_buffer.actualcount;
- h264_mv.pmem_fd = pmem_fd;
- h264_mv.offset = 0;
-
- ioctl_msg.in = (void*)&h264_mv;
- ioctl_msg.out = NULL;
-
- if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_SET_H264_MV_BUFFER, (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("Failed to set the H264_mv_buffers\n");
- return -1;
- }
-
- h264_mv_buff.buffer = (unsigned char *) buf_addr;
- h264_mv_buff.size = size;
- h264_mv_buff.count = decode_context->output_buffer.actualcount;
- h264_mv_buff.offset = 0;
- h264_mv_buff.pmem_fd = pmem_fd;
- DEBUG_PRINT("Saving virt:%p, FD: %d of size %d count: %d", h264_mv_buff.buffer,
- h264_mv_buff.pmem_fd, h264_mv_buff.size, decode_context->output_buffer.actualcount);
- return 1;
-}
-int allocate_reconfig_buff(void *context)
-{
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- struct video_decoder_context *decode_context = NULL;
- struct vdec_input_frameinfo frameinfo;
- struct vdec_fillbuffer_cmd fillbuffer;
- unsigned int i = 0;
- unsigned int data_len =0;
-
- memset ((unsigned char*)&frameinfo,0,sizeof (struct vdec_input_frameinfo));
- memset ((unsigned char*)&fillbuffer,0,sizeof (struct vdec_fillbuffer_cmd));
-
- decode_context = (struct video_decoder_context *) context;
- decode_context->output_buffer.buffer_type = VDEC_BUFFER_TYPE_OUTPUT;
- ioctl_msg.in = NULL;
- ioctl_msg.out = &decode_context->output_buffer;
-
- if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_GET_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n 2nd time Requesting for output buffer requirements failed");
- return -1;
- }
-
- DEBUG_PRINT("\n 2nd time output_buffer Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %ld,meta_buffer_size=%d\n\n",\
- decode_context->output_buffer.buffer_size,\
- decode_context->output_buffer.mincount,\
- decode_context->output_buffer.actualcount,\
- decode_context->output_buffer.maxcount,\
- decode_context->output_buffer.alignment,\
- decode_context->output_buffer.buf_poolid,\
- decode_context->output_buffer.meta_buffer_size);
- test_vdec_alloc_h264_mv(decode_context);
- if ((ion_allocate_buffer(VDEC_BUFFER_TYPE_OUTPUT,
- decode_context)== -1))
- {
- DEBUG_PRINT("\n Error in output Buffer allocation");
- }
- i = 0;
- while (i < decode_context->output_buffer.mincount)
- {
- fillbuffer.buffer.buffer_len =
- decode_context->ptr_outputbuffer [i].buffer_len;
- fillbuffer.buffer.bufferaddr =
- decode_context->ptr_outputbuffer [i].bufferaddr;
- fillbuffer.buffer.offset =
- decode_context->ptr_outputbuffer [i].offset;
- fillbuffer.buffer.pmem_fd =
- decode_context->ptr_outputbuffer [i].pmem_fd;
- fillbuffer.client_data = (void *)&decode_context->ptr_respbuffer[i];
- DEBUG_PRINT ("\n Client Data on output = %p and bufferaddr = %p",fillbuffer.client_data,decode_context->ptr_outputbuffer [i].bufferaddr);
- ioctl_msg.in = &fillbuffer;
- ioctl_msg.out = NULL;
-
- if (ioctl (decode_context->video_driver_fd,
- VDEC_IOCTL_FILL_OUTPUT_BUFFER,&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Decoder frame failed");
- return -1;
- }
- i++;
- }
-
-
- return 1;
-}
static void* video_thread (void *context)
{
struct video_decoder_context *decode_context = NULL;
@@ -1054,10 +829,10 @@ static void* video_thread (void *context)
DEBUG_PRINT("\n FATAL ERROR ");
break;
case VDEC_MSG_RESP_INPUT_FLUSHED:
-// DEBUG_PRINT("\n Input Buffer Flushed");
+ DEBUG_PRINT("\n Input Buffer Flushed");
break;
case VDEC_MSG_RESP_OUTPUT_FLUSHED:
-// DEBUG_PRINT("\n Output buffer Flushed");
+ DEBUG_PRINT("\n Output buffer Flushed");
break;
case VDEC_MSG_RESP_START_DONE:
DEBUG_PRINT("\n recived start done command");
@@ -1112,19 +887,7 @@ static void* video_thread (void *context)
DEBUG_PRINT("\n Input buffer done send next buffer current value = %d",\
total_frames);
break;
-
- case VDEC_MSG_EVT_CONFIG_CHANGED:
- reconfig =1;
-
- ioctl_msg.in = &decode_context->output_buffer;
- ioctl_msg.out = NULL;
- if (ioctl(decode_context->video_driver_fd, VDEC_IOCTL_CMD_FLUSH, &ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n >>>>>>>>>>> Flush Port (%d) Failed ");
- }
- (void)free_buffer(VDEC_BUFFER_TYPE_OUTPUT,decode_context);
- break;
-
+// case VDEC_MSG_EVT_CONFIG_CHANGED:
case VDEC_MSG_RESP_OUTPUT_BUFFER_DONE:
outputbuffer = (struct vdec_output_frameinfo *)\
queueitem->clientdata;
@@ -1187,15 +950,8 @@ static void* video_thread (void *context)
break;
case VDEC_MSG_RESP_FLUSH_OUTPUT_DONE:
- DEBUG_PRINT("\n ---------- Flush output complete -----------------");
- if(reconfig == 1)
- {
- allocate_reconfig_buff(decode_context);
- DEBUG_PRINT("\n ---------- reconfig set to 0 -----------------");
- reconfig = 0;
- }
- else
- sem_post (&decode_context->sem_synchronize);
+ DEBUG_PRINT("\n Flush output complete");
+ sem_post (&decode_context->sem_synchronize);
break;
default :
DEBUG_PRINT("\n Video thread default case:: \n");
@@ -1211,7 +967,6 @@ static void* video_thread (void *context)
{
DEBUG_PRINT("\n Error condition recieved NULL from Queue");
}
-
}
}
@@ -1331,7 +1086,7 @@ static unsigned int read_frame (unsigned char *dataptr, unsigned int length,
return 0;
}
- if (Code_type == VDEC_CODECTYPE_MPEG4)
+ if (!Code_type)
{
/* Start of Critical Section*/
pthread_mutex_lock(&read_lock);
@@ -1346,6 +1101,7 @@ static unsigned int read_frame (unsigned char *dataptr, unsigned int length,
}
code <<= 8;
code |= (0x000000FF & dataptr[readOffset]);
+
//VOP start code comparision
if (readOffset>3)
{
@@ -1353,7 +1109,6 @@ static unsigned int read_frame (unsigned char *dataptr, unsigned int length,
{
if( VOP_START_CODE == code)
{
- DEBUG_PRINT ("\n Found VOP Code");
header_code = VOP_START_CODE;
}
else if ( (0xFFFFFC00 & code) == SHORT_HEADER_START_CODE )
@@ -1386,74 +1141,6 @@ static unsigned int read_frame (unsigned char *dataptr, unsigned int length,
/* End of Critical Section*/
if (found == 1)
{
- //DEBUG_PRINT ("Found a Frame");
- return (readOffset+1);
- }
- else
- {
- //DEBUG_PRINT ("No Frames detected");
- return 0;
- }
- }
- else if (Code_type == VDEC_CODECTYPE_H264)
- {
- /* Start of Critical Section*/
- pthread_mutex_lock(&read_lock);
- do
- {
- //Start codes are always byte aligned.
- bytes_read = fread(&dataptr[readOffset],1, 1,inputBufferFile);
- if( !bytes_read)
- {
- DEBUG_PRINT("\n Bytes read Zero \n");
- break;
- }
- code <<= 8;
- code |= (0x000000FF & dataptr[readOffset]);
-
- //VOP start code comparision
- if (readOffset>3)
- {
- if(!header_code )
- {
- if( H264_START_CODE == code)
- {
- header_code = H264_START_CODE;
- }
- else if ( (0xFFFFFC00 & code) == SHORT_HEADER_START_CODE )
- {
- DEBUG_PRINT ("\n prasanth Found SHORT_HEADER_START_CODE");
- header_code = SHORT_HEADER_START_CODE;
- }
- }
- //DEBUG_PRINT ("\n prasanth code : 0x%x",code);
- if ((header_code == H264_START_CODE) && (code == H264_START_CODE))
- {
- //Seek backwards by 4
- fseek(inputBufferFile, -4, SEEK_CUR);
- readOffset-=4;
- found = 1;
- DEBUG_PRINT ("\n ---------- prasanth code detected : 0x%x",code);
- break;
-
- }
- /* else if (( header_code == SHORT_HEADER_START_CODE ) &&
- ( SHORT_HEADER_START_CODE == (code & 0xFFFFFC00)))
- {
- //Seek backwards by 4
- fseek(inputBufferFile, -4, SEEK_CUR);
- readOffset-=4;
- found = 1;
- break;
- }*/
-
- }
- readOffset++;
- }while (readOffset < length);
- pthread_mutex_unlock(&read_lock);
- /* End of Critical Section*/
- if (found == 1)
- {
DEBUG_PRINT ("\nread_frame Found a Frame adn length : %d, code : 0x%x",readOffset,code);
return (readOffset+1);
}
@@ -1505,7 +1192,7 @@ static int Read_Buffer_From_DAT_File(unsigned char *dataptr, unsigned int length
inputFrameSize[cnt]='\0';
frameSize = atoi(inputFrameSize);
//length = 0;
- DEBUG_PRINT ("\n Frame Size is %d",frameSize);
+ DEBUG_PRINT ("\n Frame Size is %ld",frameSize);
/* get the frame length */
fseek(inputBufferFile, -1, SEEK_CUR);
diff --git a/decodertest/decoder_driver_test.h b/decoder_driver_test.h
index 9296b47..252532f 100755
--- a/decodertest/decoder_driver_test.h
+++ b/decoder_driver_test.h
@@ -45,15 +45,6 @@ struct vdec_ion
struct ion_allocation_data ion_alloc_data;
};
-struct h264_mv_buffer{
- unsigned char* buffer;
- int size;
- int count;
- int pmem_fd;
- int offset;
- };
-struct h264_mv_buffer h264_mv_buff;
-
struct video_decoder_context
{
enum vdec_codec decoder_format;
@@ -66,17 +57,12 @@ struct video_decoder_context
struct vdec_output_frameinfo *ptr_respbuffer;
struct video_queue_context queue_context;
int video_driver_fd;
-
struct vdec_ion *ip_buf_ion_info;
struct vdec_ion *op_buf_ion_info;
- struct vdec_ion h264_mv;
-
FILE * inputBufferFile;
FILE * outputBufferFile;
- unsigned disable_dmx;
-
pthread_t videothread_id;
pthread_t asyncthread_id;
sem_t sem_synchronize;
diff --git a/decodertest/Makefile b/decodertest/Makefile
deleted file mode 100755
index d6d4122..0000000
--- a/decodertest/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-all: vidctest
-
-SRC=queue.c message_queue.c decoder_driver_test.c
-OBJ=$(patsubst %.c,%.o,$(SRC))
-CC = $(CROSS_COMPILE)gcc
-
-vidctest: $(OBJ)
- $(CC) -pthread $^ -o $@
-
-%.o: %.c
- $(CC) -c -o $@ $<
-
-clean:
- -rm -f $(OBJ)
- -rm -f vidctest
diff --git a/decodertest/ion.h b/decodertest/ion.h
deleted file mode 100755
index f40abd0..0000000
--- a/decodertest/ion.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _LINUX_ION_H
-#define _LINUX_ION_H
-#include <linux/ioctl.h>
-#include <linux/types.h>
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct ion_handle;
-enum ion_heap_type {
- ION_HEAP_TYPE_SYSTEM,
- ION_HEAP_TYPE_SYSTEM_CONTIG,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- ION_HEAP_TYPE_CARVEOUT,
- ION_HEAP_TYPE_DMA,
- ION_HEAP_TYPE_CUSTOM,
- ION_NUM_HEAPS = 16,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM)
-#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
-#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ION_HEAP_TYPE_DMA_MASK (1 << ION_HEAP_TYPE_DMA)
-#define ION_FLAG_CACHED 1
-struct ion_allocation_data {
- size_t len;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- size_t align;
- unsigned int heap_mask;
- unsigned int flags;
- struct ion_handle *handle;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct ion_fd_data {
- struct ion_handle *handle;
- int fd;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct ion_handle_data {
- struct ion_handle *handle;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct ion_custom_data {
- unsigned int cmd;
- unsigned long arg;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ION_IOC_MAGIC 'I'
-#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_allocation_data)
-#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
-#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
-#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
-#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
-#define ION_IOC_SYNC _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#endif
-
diff --git a/decodertest/msm_ion.h b/decodertest/msm_ion.h
deleted file mode 100755
index 4292fa3..0000000
--- a/decodertest/msm_ion.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _LINUX_MSM_ION_H
-#define _LINUX_MSM_ION_H
-#include "ion.h"
-#define ION_HEAP_TYPE_MSM_START (ION_HEAP_TYPE_CUSTOM + 1)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ION_HEAP_TYPE_IOMMU (ION_HEAP_TYPE_MSM_START)
-#define ION_HEAP_TYPE_CP (ION_HEAP_TYPE_IOMMU + 1)
-enum ion_heap_ids {
- INVALID_HEAP_ID = -1,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- ION_CP_MM_HEAP_ID = 8,
- ION_CP_MFC_HEAP_ID = 12,
- ION_CP_WB_HEAP_ID = 16,
- ION_CAMERA_HEAP_ID = 20,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- ION_ADSP_HEAP_ID = 22,
- ION_SF_HEAP_ID = 24,
- ION_IOMMU_HEAP_ID = 25,
- ION_QSECOM_HEAP_ID = 27,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- ION_AUDIO_HEAP_ID = 28,
- ION_MM_FIRMWARE_HEAP_ID = 29,
- ION_SYSTEM_HEAP_ID = 30,
- ION_HEAP_ID_RESERVED = 31
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-enum ion_fixed_position {
- NOT_FIXED,
- FIXED_LOW,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- FIXED_MIDDLE,
- FIXED_HIGH,
-};
-enum cp_mem_usage {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- VIDEO_BITSTREAM = 0x1,
- VIDEO_PIXEL = 0x2,
- VIDEO_NONPIXEL = 0x3,
- MAX_USAGE = 0x4,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- UNKNOWN = 0x7FFFFFFF,
-};
-#define ION_HEAP_CP_MASK (1 << ION_HEAP_TYPE_CP)
-#define ION_SECURE (1 << ION_HEAP_ID_RESERVED)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ION_FORCE_CONTIGUOUS (1 << 30)
-#define ION_HEAP(bit) (1 << (bit))
-#define ION_ADSP_HEAP_NAME "adsp"
-#define ION_VMALLOC_HEAP_NAME "vmalloc"
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ION_AUDIO_HEAP_NAME "audio"
-#define ION_SF_HEAP_NAME "sf"
-#define ION_MM_HEAP_NAME "mm"
-#define ION_CAMERA_HEAP_NAME "camera_preview"
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ION_IOMMU_HEAP_NAME "iommu"
-#define ION_MFC_HEAP_NAME "mfc"
-#define ION_WB_HEAP_NAME "wb"
-#define ION_MM_FIRMWARE_HEAP_NAME "mm_fw"
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ION_QSECOM_HEAP_NAME "qsecom"
-#define ION_FMEM_HEAP_NAME "fmem"
-#define ION_SET_CACHED(__cache) (__cache | ION_FLAG_CACHED)
-#define ION_SET_UNCACHED(__cache) (__cache & ~ION_FLAG_CACHED)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ION_IS_CACHED(__flags) ((__flags) & ION_FLAG_CACHED)
-struct ion_flush_data {
- struct ion_handle *handle;
- int fd;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- void *vaddr;
- unsigned int offset;
- unsigned int length;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct ion_flag_data {
- struct ion_handle *handle;
- unsigned long flags;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ION_IOC_MSM_MAGIC 'M'
-#define ION_IOC_CLEAN_CACHES _IOWR(ION_IOC_MSM_MAGIC, 0, struct ion_flush_data)
-#define ION_IOC_INV_CACHES _IOWR(ION_IOC_MSM_MAGIC, 1, struct ion_flush_data)
-#define ION_IOC_CLEAN_INV_CACHES _IOWR(ION_IOC_MSM_MAGIC, 2, struct ion_flush_data)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ION_IOC_GET_FLAGS _IOWR(ION_IOC_MSM_MAGIC, 3, struct ion_flag_data)
-#endif
-
diff --git a/modetest/ion.h b/ion.h
index c32da12..c32da12 100755
--- a/modetest/ion.h
+++ b/ion.h
diff --git a/modetest/libmsm.c b/libmsm.c
index e92340f..e92340f 100755
--- a/modetest/libmsm.c
+++ b/libmsm.c
diff --git a/modetest/libmsm.h b/libmsm.h
index fde92bf..fde92bf 100755
--- a/modetest/libmsm.h
+++ b/libmsm.h
diff --git a/decodertest/message_queue.c b/message_queue.c
index 8cfa9fe..8cfa9fe 100755
--- a/decodertest/message_queue.c
+++ b/message_queue.c
diff --git a/decodertest/message_queue.h b/message_queue.h
index 7e15724..7e15724 100755
--- a/decodertest/message_queue.h
+++ b/message_queue.h
diff --git a/msm_ion.h b/msm_ion.h
new file mode 100755
index 0000000..2d21433
--- /dev/null
+++ b/msm_ion.h
@@ -0,0 +1,323 @@
+/*
+ *
+ * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_MSM_ION_H
+#define _LINUX_MSM_ION_H
+
+#include "ion.h"
+
+enum msm_ion_heap_types {
+ ION_HEAP_TYPE_MSM_START = ION_HEAP_TYPE_CUSTOM + 1,
+ ION_HEAP_TYPE_IOMMU = ION_HEAP_TYPE_MSM_START,
+ ION_HEAP_TYPE_CP,
+};
+
+/**
+ * These are the only ids that should be used for Ion heap ids.
+ * The ids listed are the order in which allocation will be attempted
+ * if specified. Don't swap the order of heap ids unless you know what
+ * you are doing!
+ * Id's are spaced by purpose to allow new Id's to be inserted in-between (for
+ * possible fallbacks)
+ */
+
+enum ion_heap_ids {
+ INVALID_HEAP_ID = -1,
+ ION_CP_MM_HEAP_ID = 8,
+ ION_CP_MFC_HEAP_ID = 12,
+ ION_CP_WB_HEAP_ID = 16, /* 8660 only */
+ ION_CAMERA_HEAP_ID = 20, /* 8660 only */
+ ION_ADSP_HEAP_ID = 22,
+ ION_SF_HEAP_ID = 24,
+ ION_IOMMU_HEAP_ID = 25,
+ ION_QSECOM_HEAP_ID = 27,
+ ION_AUDIO_HEAP_ID = 28,
+
+ ION_MM_FIRMWARE_HEAP_ID = 29,
+ ION_SYSTEM_HEAP_ID = 30,
+
+ ION_HEAP_ID_RESERVED = 31 /** Bit reserved for ION_SECURE flag */
+};
+
+enum ion_fixed_position {
+ NOT_FIXED,
+ FIXED_LOW,
+ FIXED_MIDDLE,
+ FIXED_HIGH,
+};
+
+enum cp_mem_usage {
+ VIDEO_BITSTREAM = 0x1,
+ VIDEO_PIXEL = 0x2,
+ VIDEO_NONPIXEL = 0x3,
+ MAX_USAGE = 0x4,
+ UNKNOWN = 0x7FFFFFFF,
+};
+
+#define ION_HEAP_CP_MASK (1 << ION_HEAP_TYPE_CP)
+
+/**
+ * Flag to use when allocating to indicate that a heap is secure.
+ */
+#define ION_SECURE (1 << ION_HEAP_ID_RESERVED)
+
+/**
+ * Flag for clients to force contiguous memort allocation
+ *
+ * Use of this flag is carefully monitored!
+ */
+#define ION_FORCE_CONTIGUOUS (1 << 30)
+
+/**
+ * Macro should be used with ion_heap_ids defined above.
+ */
+#define ION_HEAP(bit) (1 << (bit))
+
+#define ION_ADSP_HEAP_NAME "adsp"
+#define ION_VMALLOC_HEAP_NAME "vmalloc"
+#define ION_AUDIO_HEAP_NAME "audio"
+#define ION_SF_HEAP_NAME "sf"
+#define ION_MM_HEAP_NAME "mm"
+#define ION_CAMERA_HEAP_NAME "camera_preview"
+#define ION_IOMMU_HEAP_NAME "iommu"
+#define ION_MFC_HEAP_NAME "mfc"
+#define ION_WB_HEAP_NAME "wb"
+#define ION_MM_FIRMWARE_HEAP_NAME "mm_fw"
+#define ION_QSECOM_HEAP_NAME "qsecom"
+#define ION_FMEM_HEAP_NAME "fmem"
+
+#define ION_SET_CACHED(__cache) (__cache | ION_FLAG_CACHED)
+#define ION_SET_UNCACHED(__cache) (__cache & ~ION_FLAG_CACHED)
+
+#define ION_IS_CACHED(__flags) ((__flags) & ION_FLAG_CACHED)
+
+#ifdef __KERNEL__
+
+/*
+ * This flag allows clients when mapping into the IOMMU to specify to
+ * defer un-mapping from the IOMMU until the buffer memory is freed.
+ */
+#define ION_IOMMU_UNMAP_DELAYED 1
+
+/**
+ * struct ion_cp_heap_pdata - defines a content protection heap in the given
+ * platform
+ * @permission_type: Memory ID used to identify the memory to TZ
+ * @align: Alignment requirement for the memory
+ * @secure_base: Base address for securing the heap.
+ * Note: This might be different from actual base address
+ * of this heap in the case of a shared heap.
+ * @secure_size: Memory size for securing the heap.
+ * Note: This might be different from actual size
+ * of this heap in the case of a shared heap.
+ * @reusable Flag indicating whether this heap is reusable of not.
+ * (see FMEM)
+ * @mem_is_fmem Flag indicating whether this memory is coming from fmem
+ * or not.
+ * @fixed_position If nonzero, position in the fixed area.
+ * @virt_addr: Virtual address used when using fmem.
+ * @iommu_map_all: Indicates whether we should map whole heap into IOMMU.
+ * @iommu_2x_map_domain: Indicates the domain to use for overmapping.
+ * @request_region: function to be called when the number of allocations
+ * goes from 0 -> 1
+ * @release_region: function to be called when the number of allocations
+ * goes from 1 -> 0
+ * @setup_region: function to be called upon ion registration
+ * @memory_type:Memory type used for the heap
+ * @no_nonsecure_alloc: don't allow non-secure allocations from this heap
+ *
+ */
+struct ion_cp_heap_pdata {
+ enum ion_permission_type permission_type;
+ unsigned int align;
+ ion_phys_addr_t secure_base; /* Base addr used when heap is shared */
+ size_t secure_size; /* Size used for securing heap when heap is shared*/
+ int reusable;
+ int mem_is_fmem;
+ int is_cma;
+ enum ion_fixed_position fixed_position;
+ int iommu_map_all;
+ int iommu_2x_map_domain;
+ ion_virt_addr_t *virt_addr;
+ int (*request_region)(void *);
+ int (*release_region)(void *);
+ void *(*setup_region)(void);
+ enum ion_memory_types memory_type;
+ int no_nonsecure_alloc;
+};
+
+/**
+ * struct ion_co_heap_pdata - defines a carveout heap in the given platform
+ * @adjacent_mem_id: Id of heap that this heap must be adjacent to.
+ * @align: Alignment requirement for the memory
+ * @mem_is_fmem Flag indicating whether this memory is coming from fmem
+ * or not.
+ * @fixed_position If nonzero, position in the fixed area.
+ * @request_region: function to be called when the number of allocations
+ * goes from 0 -> 1
+ * @release_region: function to be called when the number of allocations
+ * goes from 1 -> 0
+ * @setup_region: function to be called upon ion registration
+ * @memory_type:Memory type used for the heap
+ *
+ */
+struct ion_co_heap_pdata {
+ int adjacent_mem_id;
+ unsigned int align;
+ int mem_is_fmem;
+ enum ion_fixed_position fixed_position;
+ int (*request_region)(void *);
+ int (*release_region)(void *);
+ void *(*setup_region)(void);
+ enum ion_memory_types memory_type;
+};
+
+#ifdef CONFIG_ION
+/**
+ * msm_ion_secure_heap - secure a heap. Wrapper around ion_secure_heap.
+ *
+ * @heap_id - heap id to secure.
+ *
+ * Secure a heap
+ * Returns 0 on success
+ */
+int msm_ion_secure_heap(int heap_id);
+
+/**
+ * msm_ion_unsecure_heap - unsecure a heap. Wrapper around ion_unsecure_heap.
+ *
+ * @heap_id - heap id to secure.
+ *
+ * Un-secure a heap
+ * Returns 0 on success
+ */
+int msm_ion_unsecure_heap(int heap_id);
+
+/**
+ * msm_ion_secure_heap_2_0 - secure a heap using 2.0 APIs
+ * Wrapper around ion_secure_heap.
+ *
+ * @heap_id - heap id to secure.
+ * @usage - usage hint to TZ
+ *
+ * Secure a heap
+ * Returns 0 on success
+ */
+int msm_ion_secure_heap_2_0(int heap_id, enum cp_mem_usage usage);
+
+/**
+ * msm_ion_unsecure_heap - unsecure a heap secured with 3.0 APIs.
+ * Wrapper around ion_unsecure_heap.
+ *
+ * @heap_id - heap id to secure.
+ * @usage - usage hint to TZ
+ *
+ * Un-secure a heap
+ * Returns 0 on success
+ */
+int msm_ion_unsecure_heap_2_0(int heap_id, enum cp_mem_usage usage);
+#else
+static inline int msm_ion_secure_heap(int heap_id)
+{
+ return -ENODEV;
+
+}
+
+static inline int msm_ion_unsecure_heap(int heap_id)
+{
+ return -ENODEV;
+}
+
+static inline int msm_ion_secure_heap_2_0(int heap_id, enum cp_mem_usage usage)
+{
+ return -ENODEV;
+}
+
+static inline int msm_ion_unsecure_heap_2_0(int heap_id,
+ enum cp_mem_usage usage)
+{
+ return -ENODEV;
+}
+#endif /* CONFIG_ION */
+
+#endif /* __KERNEL */
+
+/* struct ion_flush_data - data passed to ion for flushing caches
+ *
+ * @handle: handle with data to flush
+ * @fd: fd to flush
+ * @vaddr: userspace virtual address mapped with mmap
+ * @offset: offset into the handle to flush
+ * @length: length of handle to flush
+ *
+ * Performs cache operations on the handle. If p is the start address
+ * of the handle, p + offset through p + offset + length will have
+ * the cache operations performed
+ */
+struct ion_flush_data {
+ struct ion_handle *handle;
+ int fd;
+ void *vaddr;
+ unsigned int offset;
+ unsigned int length;
+};
+
+/* struct ion_flag_data - information about flags for this buffer
+ *
+ * @handle: handle to get flags from
+ * @flags: flags of this handle
+ *
+ * Takes handle as an input and outputs the flags from the handle
+ * in the flag field.
+ */
+struct ion_flag_data {
+ struct ion_handle *handle;
+ unsigned long flags;
+};
+
+#define ION_IOC_MSM_MAGIC 'M'
+
+/**
+ * DOC: ION_IOC_CLEAN_CACHES - clean the caches
+ *
+ * Clean the caches of the handle specified.
+ */
+#define ION_IOC_CLEAN_CACHES _IOWR(ION_IOC_MSM_MAGIC, 0, \
+ struct ion_flush_data)
+/**
+ * DOC: ION_IOC_INV_CACHES - invalidate the caches
+ *
+ * Invalidate the caches of the handle specified.
+ */
+#define ION_IOC_INV_CACHES _IOWR(ION_IOC_MSM_MAGIC, 1, \
+ struct ion_flush_data)
+/**
+ * DOC: ION_IOC_CLEAN_INV_CACHES - clean and invalidate the caches
+ *
+ * Clean and invalidate the caches of the handle specified.
+ */
+#define ION_IOC_CLEAN_INV_CACHES _IOWR(ION_IOC_MSM_MAGIC, 2, \
+ struct ion_flush_data)
+
+/**
+ * DOC: ION_IOC_GET_FLAGS - get the flags of the handle
+ *
+ * Gets the flags of the current handle which indicate cachability,
+ * secure state etc.
+ */
+#define ION_IOC_GET_FLAGS _IOWR(ION_IOC_MSM_MAGIC, 3, \
+ struct ion_flag_data)
+
+#endif
diff --git a/decodertest/msm_vidc_dec.h b/msm_vidc_dec.h
index 7092ccb..7092ccb 100755
--- a/decodertest/msm_vidc_dec.h
+++ b/msm_vidc_dec.h
diff --git a/modetest/msmdumb.c b/msmdumb.c
index 312a0fb..ac01227 100755
--- a/modetest/msmdumb.c
+++ b/msmdumb.c
@@ -76,7 +76,7 @@ dumb_bo_create(struct msm_driver *msm,
struct drm_mode_create_dumb arg;
struct dumb_bo *bo;
int i, ret;
- uint32_t prime_handle = 0;
+ uint32_t prime_handle = 0;
for (i = 0; attr[i]; i += 2) {
switch (attr[i]) {
diff --git a/modetest/msmdumb_priv.h b/msmdumb_priv.h
index 67cd90b..67cd90b 100755
--- a/modetest/msmdumb_priv.h
+++ b/msmdumb_priv.h
diff --git a/modetest/msmmodetest.c b/msmmodetest.c
index 0d8de7d..0d8de7d 100755
--- a/modetest/msmmodetest.c
+++ b/msmmodetest.c
diff --git a/decodertest/queue.c b/queue.c
index e0aeb9a..e0aeb9a 100755
--- a/decodertest/queue.c
+++ b/queue.c
diff --git a/decodertest/queue.h b/queue.h
index 195d9b2..195d9b2 100755
--- a/decodertest/queue.h
+++ b/queue.h