vidc: Support for secure encoding session (B-family).
- Add secure encoding to openmax layer for B-family devices
- All buffers will be allocated on the secure heap
Change-Id: I3f4e1bd3cdb49cc4a39dbd3af4bc3bc556f839fd
diff --git a/mm-core/src/8226/qc_registry_table_android.c b/mm-core/src/8226/qc_registry_table_android.c
index 1ca1408..d672607 100644
--- a/mm-core/src/8226/qc_registry_table_android.c
+++ b/mm-core/src/8226/qc_registry_table_android.c
@@ -312,7 +312,23 @@
"video_encoder.avc"
}
},
-{
+ {
+ "OMX.qcom.video.encoder.avc.secure",
+ NULL, // Create instance function
+ // Unique instance handle
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ },
+ NULL, // Shared object library handle
+ "libOmxVenc.so",
+ {
+ "video_encoder.avc"
+ }
+ },
+ {
"OMX.qcom.video.encoder.vp8",
NULL, // Create instance function
// Unique instance handle
diff --git a/mm-core/src/8974/qc_registry_table.c b/mm-core/src/8974/qc_registry_table.c
old mode 100755
new mode 100644
diff --git a/mm-core/src/8974/qc_registry_table_android.c b/mm-core/src/8974/qc_registry_table_android.c
index de963cf..ab12d82 100644
--- a/mm-core/src/8974/qc_registry_table_android.c
+++ b/mm-core/src/8974/qc_registry_table_android.c
@@ -327,7 +327,23 @@
"video_encoder.avc"
}
},
-{
+ {
+ "OMX.qcom.video.encoder.avc.secure",
+ NULL, // Create instance function
+ // Unique instance handle
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ },
+ NULL, // Shared object library handle
+ "libOmxVenc.so",
+ {
+ "video_encoder.avc"
+ }
+ },
+ {
"OMX.qcom.video.encoder.vp8",
NULL, // Create instance function
// Unique instance handle
diff --git a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
index 435e3e1..8474cea 100644
--- a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
+++ b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
@@ -139,11 +139,6 @@
#define MAX_NUM_INPUT_BUFFERS 32
#endif
void* message_thread(void *);
-#ifdef USE_ION
-int alloc_map_ion_memory(int size,struct ion_allocation_data *alloc_data,
- struct ion_fd_data *fd_data,int flag);
-void free_ion_memory(struct venc_ion *buf_ion_info);
-#endif
// OMX video class
class omx_video: public qc_omx_component
@@ -160,6 +155,7 @@
bool get_syntaxhdr_enable;
OMX_BUFFERHEADERTYPE *psource_frame;
OMX_BUFFERHEADERTYPE *pdest_frame;
+ bool secure_session;
class omx_c2d_conv
{
@@ -222,6 +218,7 @@
virtual bool dev_loaded_stop(void) = 0;
virtual bool dev_loaded_start_done(void) = 0;
virtual bool dev_loaded_stop_done(void) = 0;
+ virtual bool is_secure_session(void) = 0;
#ifdef _MSM8974_
virtual int dev_handle_extradata(void*, int) = 0;
virtual int dev_set_format(int) = 0;
@@ -524,6 +521,13 @@
void complete_pending_buffer_done_cbs();
+#ifdef USE_ION
+ int alloc_map_ion_memory(int size,
+ struct ion_allocation_data *alloc_data,
+ struct ion_fd_data *fd_data,int flag);
+ void free_ion_memory(struct venc_ion *buf_ion_info);
+#endif
+
//*************************************************************
//*******************MEMBER VARIABLES *************************
//*************************************************************
diff --git a/mm-video-v4l2/vidc/venc/inc/omx_video_encoder.h b/mm-video-v4l2/vidc/venc/inc/omx_video_encoder.h
index 789c01c..fa75adc 100644
--- a/mm-video-v4l2/vidc/venc/inc/omx_video_encoder.h
+++ b/mm-video-v4l2/vidc/venc/inc/omx_video_encoder.h
@@ -55,6 +55,7 @@
OMX_INDEXTYPE configIndex,
OMX_PTR configData);
OMX_ERRORTYPE component_deinit(OMX_HANDLETYPE hComp);
+ bool is_secure_session();
//OMX strucutres
OMX_U32 m_nVenc_format;
class venc_dev *handle;
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
index fe6ec2c..9a58e92 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
@@ -76,6 +76,10 @@
#define VC1_STRUCT_B_POS 24
#define VC1_SEQ_LAYER_SIZE 36
+#define SZ_4K 0x1000
+#define SZ_1M 0x100000
+#define SECURE_BUFPTR 0xDEADBEEF
+
typedef struct OMXComponentCapabilityFlagsType {
////////////////// OMX COMPONENT CAPABILITY RELATED MEMBERS
OMX_BOOL iIsOMXComponentMultiThreaded;
@@ -208,6 +212,7 @@
None.
========================================================================== */
omx_video::omx_video():
+ secure_session(false),
m_pInput_pmem(NULL),
m_pOutput_pmem(NULL),
#ifdef USE_ION
@@ -2066,17 +2071,23 @@
#endif
m_pInput_pmem[i].size = m_sInPortDef.nBufferSize;
m_pInput_pmem[i].offset = 0;
- m_pInput_pmem[i].buffer = (unsigned char *)mmap(NULL,m_pInput_pmem[i].size,PROT_READ|PROT_WRITE,
+
+ m_pInput_pmem[i].buffer = (OMX_U8 *)SECURE_BUFPTR;
+ if(!secure_session) {
+ m_pInput_pmem[i].buffer = (unsigned char *)mmap(
+ NULL,m_pInput_pmem[i].size,PROT_READ|PROT_WRITE,
MAP_SHARED,m_pInput_pmem[i].fd,0);
- if (m_pInput_pmem[i].buffer == MAP_FAILED) {
- DEBUG_PRINT_ERROR("\nERROR: mmap() Failed");
- close(m_pInput_pmem[i].fd);
+ if (m_pInput_pmem[i].buffer == MAP_FAILED) {
+ DEBUG_PRINT_ERROR("\nERROR: mmap() Failed");
+ close(m_pInput_pmem[i].fd);
#ifdef USE_ION
- free_ion_memory(&m_pInput_ion[i]);
+ free_ion_memory(&m_pInput_ion[i]);
#endif
- return OMX_ErrorInsufficientResources;
+ return OMX_ErrorInsufficientResources;
+ }
}
+
} else {
OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *pParam = reinterpret_cast<OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *>((*bufferHdr)->pAppPrivate);
DEBUG_PRINT_LOW("Inside qcom_ext with luma:(fd:%d,offset:0x%x)", pParam->pmem_fd, pParam->offset);
@@ -2222,7 +2233,7 @@
if (!m_use_output_pmem) {
#ifdef USE_ION
#ifdef _MSM8974_
- align_size = ((m_sOutPortDef.nBufferSize + 4095)/4096) * 4096;
+ align_size = (m_sOutPortDef.nBufferSize + (SZ_4K - 1)) & ~(SZ_4K - 1);
m_pOutput_ion[i].ion_device_fd = alloc_map_ion_memory(align_size,
&m_pOutput_ion[i].ion_alloc_data,
&m_pOutput_ion[i].fd_ion_data,0);
@@ -2251,20 +2262,26 @@
#endif
m_pOutput_pmem[i].size = m_sOutPortDef.nBufferSize;
m_pOutput_pmem[i].offset = 0;
+
+ m_pOutput_pmem[i].buffer = (OMX_U8 *)SECURE_BUFPTR;
+ if(!secure_session) {
#ifdef _MSM8974_
- m_pOutput_pmem[i].buffer = (unsigned char *)mmap(NULL,align_size,PROT_READ|PROT_WRITE,
+ m_pOutput_pmem[i].buffer = (unsigned char *)mmap(NULL,
+ align_size,PROT_READ|PROT_WRITE,
MAP_SHARED,m_pOutput_pmem[i].fd,0);
#else
- m_pOutput_pmem[i].buffer = (unsigned char *)mmap(NULL,m_pOutput_pmem[i].size,PROT_READ|PROT_WRITE,
+ m_pOutput_pmem[i].buffer = (unsigned char *)mmap(NULL,
+ m_pOutput_pmem[i].size,PROT_READ|PROT_WRITE,
MAP_SHARED,m_pOutput_pmem[i].fd,0);
#endif
- if (m_pOutput_pmem[i].buffer == MAP_FAILED) {
- DEBUG_PRINT_ERROR("\nERROR: mmap() Failed");
- close(m_pOutput_pmem[i].fd);
+ if (m_pOutput_pmem[i].buffer == MAP_FAILED) {
+ DEBUG_PRINT_ERROR("\nERROR: mmap() Failed");
+ close(m_pOutput_pmem[i].fd);
#ifdef USE_ION
- free_ion_memory(&m_pOutput_ion[i]);
+ free_ion_memory(&m_pOutput_ion[i]);
#endif
- return OMX_ErrorInsufficientResources;
+ return OMX_ErrorInsufficientResources;
+ }
}
} else {
OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *pParam = reinterpret_cast<OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO*>((*bufferHdr)->pAppPrivate);
@@ -2399,7 +2416,9 @@
if (index < m_sInPortDef.nBufferCountActual && m_pInput_pmem) {
if (m_pInput_pmem[index].fd > 0 && input_use_buffer == false) {
DEBUG_PRINT_LOW("\n FreeBuffer:: i/p AllocateBuffer case");
- munmap (m_pInput_pmem[index].buffer,m_pInput_pmem[index].size);
+ if(!secure_session) {
+ munmap (m_pInput_pmem[index].buffer,m_pInput_pmem[index].size);
+ }
close (m_pInput_pmem[index].fd);
#ifdef USE_ION
free_ion_memory(&m_pInput_ion[index]);
@@ -2411,7 +2430,9 @@
if (dev_free_buf(&m_pInput_pmem[index],PORT_INDEX_IN) != true) {
DEBUG_PRINT_ERROR("\nERROR: dev_free_buf() Failed for i/p buf");
}
- munmap (m_pInput_pmem[index].buffer,m_pInput_pmem[index].size);
+ if(!secure_session) {
+ munmap (m_pInput_pmem[index].buffer,m_pInput_pmem[index].size);
+ }
close (m_pInput_pmem[index].fd);
#ifdef USE_ION
free_ion_memory(&m_pInput_ion[index]);
@@ -2444,7 +2465,10 @@
if (index < m_sOutPortDef.nBufferCountActual && m_pOutput_pmem) {
if (m_pOutput_pmem[index].fd > 0 && output_use_buffer == false ) {
DEBUG_PRINT_LOW("\n FreeBuffer:: o/p AllocateBuffer case");
- munmap (m_pOutput_pmem[index].buffer,m_pOutput_pmem[index].size);
+ if(!secure_session) {
+ munmap (m_pOutput_pmem[index].buffer,
+ m_pOutput_pmem[index].size);
+ }
close (m_pOutput_pmem[index].fd);
#ifdef USE_ION
free_ion_memory(&m_pOutput_ion[index]);
@@ -2456,7 +2480,10 @@
if (dev_free_buf(&m_pOutput_pmem[index],PORT_INDEX_OUT) != true) {
DEBUG_PRINT_ERROR("ERROR: dev_free_buf Failed for o/p buf");
}
- munmap (m_pOutput_pmem[index].buffer,m_pOutput_pmem[index].size);
+ if(!secure_session) {
+ munmap (m_pOutput_pmem[index].buffer,
+ m_pOutput_pmem[index].size);
+ }
close (m_pOutput_pmem[index].fd);
#ifdef USE_ION
free_ion_memory(&m_pOutput_ion[index]);
@@ -2595,6 +2622,8 @@
(*bufferHdr)->nAllocLen = m_sInPortDef.nBufferSize;
(*bufferHdr)->pAppPrivate = appData;
(*bufferHdr)->nInputPortIndex = PORT_INDEX_IN;
+ // make fd available to app layer, help with testing
+ (*bufferHdr)->pInputPortPrivate = (OMX_PTR)&m_pInput_pmem[i];
#ifdef USE_ION
#ifdef _MSM8974_
@@ -2627,15 +2656,19 @@
m_pInput_pmem[i].size = m_sInPortDef.nBufferSize;
m_pInput_pmem[i].offset = 0;
- m_pInput_pmem[i].buffer = (unsigned char *)mmap(NULL,m_pInput_pmem[i].size,PROT_READ|PROT_WRITE,
+ m_pInput_pmem[i].buffer = (OMX_U8 *)SECURE_BUFPTR;
+ if(!secure_session) {
+ m_pInput_pmem[i].buffer = (unsigned char *)mmap(NULL,
+ m_pInput_pmem[i].size,PROT_READ|PROT_WRITE,
MAP_SHARED,m_pInput_pmem[i].fd,0);
- if (m_pInput_pmem[i].buffer == MAP_FAILED) {
- DEBUG_PRINT_ERROR("\nERROR: mmap FAILED= %d\n", errno);
- close(m_pInput_pmem[i].fd);
+ if (m_pInput_pmem[i].buffer == MAP_FAILED) {
+ DEBUG_PRINT_ERROR("\nERROR: mmap FAILED= %d\n", errno);
+ close(m_pInput_pmem[i].fd);
#ifdef USE_ION
- free_ion_memory(&m_pInput_ion[i]);
+ free_ion_memory(&m_pInput_ion[i]);
#endif
- return OMX_ErrorInsufficientResources;
+ return OMX_ErrorInsufficientResources;
+ }
}
(*bufferHdr)->pBuffer = (OMX_U8 *)m_pInput_pmem[i].buffer;
@@ -2722,6 +2755,8 @@
bufHdr->nFilledLen = 0;
bufHdr->pAppPrivate = appData;
bufHdr->nOutputPortIndex = PORT_INDEX_OUT;
+ // make fd available to app layer, help with testing
+ bufHdr->pOutputPortPrivate = (OMX_PTR)&m_pOutput_pmem[i];
bufHdr->pBuffer = NULL;
bufHdr++;
m_pOutput_pmem[i].fd = -1;
@@ -2776,20 +2811,26 @@
#endif
m_pOutput_pmem[i].size = m_sOutPortDef.nBufferSize;
m_pOutput_pmem[i].offset = 0;
+
+ m_pOutput_pmem[i].buffer = (OMX_U8 *)SECURE_BUFPTR;
+ if(!secure_session) {
#ifdef _MSM8974_
- m_pOutput_pmem[i].buffer = (unsigned char *)mmap(NULL,align_size,PROT_READ|PROT_WRITE,
+ m_pOutput_pmem[i].buffer = (unsigned char *)mmap(NULL,
+ align_size,PROT_READ|PROT_WRITE,
MAP_SHARED,m_pOutput_pmem[i].fd,0);
#else
- m_pOutput_pmem[i].buffer = (unsigned char *)mmap(NULL,m_pOutput_pmem[i].size,PROT_READ|PROT_WRITE,
+ m_pOutput_pmem[i].buffer = (unsigned char *)mmap(NULL,
+ m_pOutput_pmem[i].size,PROT_READ|PROT_WRITE,
MAP_SHARED,m_pOutput_pmem[i].fd,0);
#endif
- if (m_pOutput_pmem[i].buffer == MAP_FAILED) {
- DEBUG_PRINT_ERROR("\nERROR: MMAP_FAILED in o/p alloc buffer");
- close (m_pOutput_pmem[i].fd);
+ if (m_pOutput_pmem[i].buffer == MAP_FAILED) {
+ DEBUG_PRINT_ERROR("\nERROR: MMAP_FAILED in o/p alloc buffer");
+ close (m_pOutput_pmem[i].fd);
#ifdef USE_ION
- free_ion_memory(&m_pOutput_ion[i]);
+ free_ion_memory(&m_pOutput_ion[i]);
#endif
- return OMX_ErrorInsufficientResources;
+ return OMX_ErrorInsufficientResources;
+ }
}
*bufferHdr = (m_out_mem_ptr + i );
@@ -3749,13 +3790,16 @@
pending_output_buffers--;
- extra_data_handle.create_extra_data(buffer);
+ if(!secure_session) {
+ extra_data_handle.create_extra_data(buffer);
#ifndef _MSM8974_
- if (buffer->nFlags & OMX_BUFFERFLAG_EXTRADATA) {
- DEBUG_PRINT_LOW("parsing extradata");
- extra_data_handle.parse_extra_data(buffer);
- }
+ if (buffer->nFlags & OMX_BUFFERFLAG_EXTRADATA) {
+ DEBUG_PRINT_LOW("parsing extradata");
+ extra_data_handle.parse_extra_data(buffer);
+ }
#endif
+ }
+
/* For use buffer we need to copy the data */
if (m_pCallbacks.FillBufferDone) {
if (buffer->nFilledLen > 0) {
@@ -4024,7 +4068,8 @@
#endif
#ifdef USE_ION
-int alloc_map_ion_memory(int size,struct ion_allocation_data *alloc_data,
+int omx_video::alloc_map_ion_memory(int size,
+ struct ion_allocation_data *alloc_data,
struct ion_fd_data *fd_data,int flag)
{
struct venc_ion buf_ion_info;
@@ -4040,19 +4085,31 @@
DEBUG_PRINT_ERROR("\nERROR: ION Device open() Failed");
return ion_device_fd;
}
- alloc_data->len = size;
- alloc_data->align = 4096;
- alloc_data->flags = flag;
+
+ if(secure_session) {
+ alloc_data->len = (size + (SZ_1M - 1)) & ~(SZ_1M - 1);
+ alloc_data->align = SZ_1M;
+ alloc_data->flags = ION_SECURE;
+ alloc_data->heap_mask = ION_HEAP(ION_CP_MM_HEAP_ID);
+ DEBUG_PRINT_HIGH("ION ALLOC sec buf: size %d align %d flags %x\n",
+ alloc_data->len, alloc_data->align,alloc_data->flags);
+ } else {
+ alloc_data->len = (size + (SZ_4K - 1)) & ~(SZ_4K - 1);
+ alloc_data->align = SZ_4K;
+ alloc_data->flags = (flag & ION_FLAG_CACHED ? ION_FLAG_CACHED : 0);
#ifdef MAX_RES_720P
- alloc_data->len = (size + (alloc_data->align - 1)) & ~(alloc_data->align - 1);
- alloc_data->heap_mask = ION_HEAP(MEM_HEAP_ID);
+ alloc_data->heap_mask = ION_HEAP(MEM_HEAP_ID);
#else
- alloc_data->heap_mask = (ION_HEAP(MEM_HEAP_ID) |
- ION_HEAP(ION_IOMMU_HEAP_ID));
+ alloc_data->heap_mask = (ION_HEAP(MEM_HEAP_ID) |
+ ION_HEAP(ION_IOMMU_HEAP_ID));
#endif
+ DEBUG_PRINT_HIGH("ION ALLOC unsec buf: size %d align %d flags %x\n",
+ alloc_data->len, alloc_data->align,alloc_data->flags);
+ }
+
rc = ioctl(ion_device_fd,ION_IOC_ALLOC,alloc_data);
if (rc || !alloc_data->handle) {
- DEBUG_PRINT_ERROR("\n ION ALLOC memory failed ");
+ DEBUG_PRINT_ERROR("\n ION ALLOC memory failed 0x%x", rc);
alloc_data->handle =NULL;
close(ion_device_fd);
ion_device_fd = -1;
@@ -4072,7 +4129,7 @@
return ion_device_fd;
}
-void free_ion_memory(struct venc_ion *buf_ion_info)
+void omx_video::free_ion_memory(struct venc_ion *buf_ion_info)
{
if (!buf_ion_info) {
DEBUG_PRINT_ERROR("\n Invalid input to free_ion_memory");
@@ -4389,6 +4446,10 @@
DEBUG_PRINT_ERROR("\n convert_queue_buffer invalid params");
return OMX_ErrorBadParameter;
}
+ if (secure_session) {
+ DEBUG_PRINT_ERROR("cannot convert buffer during secure session");
+ return OMX_ErrorInvalidState;
+ }
if (!psource_frame->nFilledLen) {
if(psource_frame->nFlags & OMX_BUFFERFLAG_EOS) {
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
index a07e81e..c828b1a 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -113,6 +113,7 @@
DEBUG_PRINT_HIGH("\n omx_venc(): Inside component_init()");
// Copy the role information which provides the decoder m_nkind
strlcpy((char *)m_nkind,role,OMX_MAX_STRINGNAME_SIZE);
+ secure_session = false;
if (!strncmp((char *)m_nkind,"OMX.qcom.video.encoder.mpeg4",\
OMX_MAX_STRINGNAME_SIZE)) {
@@ -128,6 +129,12 @@
strlcpy((char *)m_cRole, "video_encoder.avc",OMX_MAX_STRINGNAME_SIZE);
codec_type = OMX_VIDEO_CodingAVC;
}
+ else if(!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.avc.secure",\
+ OMX_MAX_STRINGNAME_SIZE)) {
+ strlcpy((char *)m_cRole, "video_encoder.avc",OMX_MAX_STRINGNAME_SIZE);
+ codec_type = OMX_VIDEO_CodingAVC;
+ secure_session = true;
+ }
#ifdef _MSM8974_
else if (!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.vp8", \
OMX_MAX_STRINGNAME_SIZE)) {
@@ -1780,5 +1787,14 @@
bool omx_venc::dev_color_align(OMX_BUFFERHEADERTYPE *buffer,
OMX_U32 width, OMX_U32 height)
{
+ if(secure_session) {
+ DEBUG_PRINT_ERROR("Cannot align colors in secure session.");
+ return OMX_FALSE;
+ }
return handle->venc_color_align(buffer, width,height);
}
+
+bool omx_venc::is_secure_session()
+{
+ return secure_session;
+}
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
index cb4fe43..5ff7865 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -56,6 +56,9 @@
#define POLL_TIMEOUT 1000
#define MAX_SUPPORTED_SLICES_PER_FRAME 28 /* Max supported slices with 32 output buffers */
+#define SZ_4K 0x1000
+#define SZ_1M 0x100000
+
/* MPEG4 profile and level table*/
static const unsigned int mpeg4_profile_level_table[][5]= {
/*max mb per frame, max mb per sec, max bitrate, level, profile*/
@@ -473,12 +476,12 @@
if (extradata_info.ion.ion_alloc_data.handle) {
munmap((void *)extradata_info.uaddr, extradata_info.size);
close(extradata_info.ion.fd_ion_data.fd);
- free_ion_memory(&extradata_info.ion);
+ venc_handle->free_ion_memory(&extradata_info.ion);
}
extradata_info.size = (extradata_info.size + 4095) & (~4095);
- extradata_info.ion.ion_device_fd = alloc_map_ion_memory(
+ extradata_info.ion.ion_device_fd = venc_handle->alloc_map_ion_memory(
extradata_info.size,
&extradata_info.ion.ion_alloc_data,
&extradata_info.ion.fd_ion_data, 0);
@@ -496,7 +499,7 @@
if (extradata_info.uaddr == MAP_FAILED) {
DEBUG_PRINT_ERROR("Failed to map extradata memory\n");
close(extradata_info.ion.fd_ion_data.fd);
- free_ion_memory(&extradata_info.ion);
+ venc_handle->free_ion_memory(&extradata_info.ion);
return OMX_ErrorInsufficientResources;
}
}
@@ -513,7 +516,7 @@
if (extradata_info.uaddr) {
munmap((void *)extradata_info.uaddr, extradata_info.size);
close(extradata_info.ion.fd_ion_data.fd);
- free_ion_memory(&extradata_info.ion);
+ venc_handle->free_ion_memory(&extradata_info.ion);
}
memset(&extradata_info, 0, sizeof(extradata_info));
@@ -642,7 +645,13 @@
fdesc.index++;
}
- m_sOutput_buff_property.alignment=m_sInput_buff_property.alignment=4096;
+ if (venc_handle->is_secure_session()) {
+ m_sOutput_buff_property.alignment = SZ_1M;
+ m_sInput_buff_property.alignment = SZ_1M;
+ } else {
+ m_sOutput_buff_property.alignment = SZ_4K;
+ m_sInput_buff_property.alignment = SZ_4K;
+ }
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
fmt.fmt.pix_mp.height = m_sVenc_cfg.input_height;
fmt.fmt.pix_mp.width = m_sVenc_cfg.input_width;
@@ -679,6 +688,16 @@
ret = ioctl(m_nDriver_fd,VIDIOC_REQBUFS, &bufreq);
m_sOutput_buff_property.mincount = m_sOutput_buff_property.actualcount = bufreq.count;
+ if(venc_handle->is_secure_session()) {
+ control.id = V4L2_CID_MPEG_VIDC_VIDEO_SECURE;
+ control.value = 1;
+ DEBUG_PRINT_HIGH("ioctl: open secure device\n");
+ ret=ioctl(m_nDriver_fd, VIDIOC_S_CTRL,&control);
+ if (ret) {
+ DEBUG_PRINT_ERROR("ioctl: open secure dev fail, rc %d\n", ret);
+ return false;
+ }
+ }
resume_in_stopped = 0;
metadatamode = 0;