[vpu_api]: integrate vpu_mem interface to vpu_api.h

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@85 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2015-08-12 07:44:06 +00:00
parent 0ee2c0ae1a
commit c7ec6746b0
3 changed files with 116 additions and 15 deletions

View File

@@ -35,6 +35,40 @@ typedef enum VPU_API_CMD
VPU_API_SET_INFO_CHANGE,
} VPU_API_CMD;
typedef struct
{
RK_U32 TimeLow;
RK_U32 TimeHigh;
} TIME_STAMP;
typedef struct VPUMem {
RK_U32 phy_addr;
RK_U32 *vir_addr;
RK_U32 size;
RK_U32 *offset;
} VPUMemLinear_t;
typedef struct tVPU_FRAME
{
RK_U32 FrameBusAddr[2]; // 0: Y address; 1: UV address;
RK_U32 FrameWidth; // buffer horizontal stride
RK_U32 FrameHeight; // buffer vertical stride
RK_U32 OutputWidth; // deprecated
RK_U32 OutputHeight; // deprecated
RK_U32 DisplayWidth; // valid width for display
RK_U32 DisplayHeight; // valid height for display
RK_U32 CodingType;
RK_U32 FrameType; // frame; top_field_first; bot_field_first
RK_U32 ColorType;
RK_U32 DecodeFrmNum;
TIME_STAMP ShowTime;
RK_U32 ErrorInfo; // error information
RK_U32 employ_cnt;
VPUMemLinear_t vpumem;
struct tVPU_FRAME *next_frame;
RK_U32 Res[4];
} VPU_FRAME;
typedef struct VideoPacket {
RK_S64 pts; /* with unit of us*/
RK_S64 dts; /* with unit of us*/
@@ -261,18 +295,28 @@ RK_S32 vpu_close_context(struct VpuCodecContext **ctx);
* vpu_mem api
*/
typedef struct VPUMem {
RK_U32 phy_addr;
RK_U32 *vir_addr;
RK_U32 size;
RK_U32 *offset;
} VPUMemLinear_t;
typedef struct vpu_display_mem_pool vpu_display_mem_pool;
struct vpu_display_mem_pool {
int (*commit_hdl)(vpu_display_mem_pool *p, int hdl, int size);
void* (*get_free)(vpu_display_mem_pool *p);
int (*inc_used)(vpu_display_mem_pool *p, int hdl);
int (*put_used)(vpu_display_mem_pool *p, int hdl);
int (*reset)(vpu_display_mem_pool *p);
int (*get_unused_num)(vpu_display_mem_pool *p);
int buff_size;
float version;
int res[18];
};
#ifdef __cplusplus
extern "C"
{
#endif
/*
* vpu memory handle interface
*/
RK_S32 VPUMallocLinear(VPUMemLinear_t *p, RK_U32 size);
RK_S32 VPUFreeLinear(VPUMemLinear_t *p);
RK_S32 VPUMemDuplicate(VPUMemLinear_t *dst, VPUMemLinear_t *src);
@@ -281,6 +325,14 @@ RK_S32 VPUMemFlush(VPUMemLinear_t *p);
RK_S32 VPUMemClean(VPUMemLinear_t *p);
RK_S32 VPUMemInvalidate(VPUMemLinear_t *p);
/*
* vpu memory allocator and manager interface
*/
vpu_display_mem_pool* open_vpu_memory_pool();
void close_vpu_memory_pool(vpu_display_mem_pool *p);
int create_vpu_memory_pool_allocator(vpu_display_mem_pool **ipool, int num, int size);
void release_vpu_memory_pool_allocator(vpu_display_mem_pool *ipool);
#ifdef __cplusplus
}
#endif

View File

@@ -240,3 +240,59 @@ RK_S32 vpu_close_context(VpuCodecContext **ctx)
return 0;
}
RK_S32 VPUMallocLinear(VPUMemLinear_t *p, RK_U32 size)
{
return 0;
}
RK_S32 VPUFreeLinear(VPUMemLinear_t *p)
{
return 0;
}
RK_S32 VPUMemDuplicate(VPUMemLinear_t *dst, VPUMemLinear_t *src)
{
return 0;
}
RK_S32 VPUMemLink(VPUMemLinear_t *p)
{
return 0;
}
RK_S32 VPUMemFlush(VPUMemLinear_t *p)
{
return 0;
}
RK_S32 VPUMemClean(VPUMemLinear_t *p)
{
return 0;
}
RK_S32 VPUMemInvalidate(VPUMemLinear_t *p)
{
return 0;
}
vpu_display_mem_pool* open_vpu_memory_pool()
{
return NULL;
}
void close_vpu_memory_pool(vpu_display_mem_pool *p)
{
}
int create_vpu_memory_pool_allocator(vpu_display_mem_pool **ipool, int num, int size)
{
return 0;
}
void release_vpu_memory_pool_allocator(vpu_display_mem_pool *ipool)
{
}

View File

@@ -478,14 +478,13 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
FILE* pOutFile = NULL;
struct VpuCodecContext* ctx = NULL;
RK_S32 fileSize =0, pkt_size =0;
RK_S32 ret = 0, frame_count = 0;
RK_S32 ret = 0;
RK_U32 frame_count = 0;
DecoderOut_t decOut;
VideoPacket_t demoPkt;
VideoPacket_t* pkt =NULL;
DecoderOut_t *pOut = NULL;
#if HAVE_VPU_FRME
VPU_FRAME *frame = NULL;
#endif
RK_S64 fakeTimeUs =0;
RK_U8* pExtra = NULL;
RK_U32 extraSize = 0;
@@ -536,13 +535,11 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
memset(&decOut, 0, sizeof(DecoderOut_t));
pOut = &decOut;
#if HAVE_VPU_FRAME
pOut->data = (RK_U8*)(malloc)(sizeof(VPU_FRAME));
if (pOut->data ==NULL) {
DECODE_ERR_RET(ERROR_MEMORY);
}
memset(pOut->data, 0, sizeof(VPU_FRAME));
#endif
ret = vpu_open_context(&ctx);
if (ret || (ctx ==NULL)) {
@@ -641,7 +638,6 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
** in structure named VPU_FRAME, if you want to use virtual address, make
** sure you have done VPUMemLink before.
*/
#if HAVE_VPU_FRAME
if ((pOut->size) && (pOut->data)) {
VPU_FRAME *frame = (VPU_FRAME *)(pOut->data);
VPUMemLink(&frame->vpumem);
@@ -664,9 +660,6 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
VPUFreeLinear(&frame->vpumem);
pOut->size = 0;
}
#else
(void)frame_count;
#endif
}
msleep(3);