From a09db64961f1ff33b7ca25c3c5dc51151bf8381e Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Thu, 14 Jul 2011 22:13:52 -0400 Subject: [PATCH] WIP, SsbSipMfcEncAPI.c compiles Change-Id: I7f20bc7251020bccc6f9ca656466b3c15595572f --- .../video/mfc_c110/enc/src/SsbSipMfcEncAPI.c | 23 +++++++++++++------ .../video/mfc_c110/include/mfc_interface.h | 11 +++++++++ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c index 6e2473b..559998c 100644 --- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c +++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c @@ -411,14 +411,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle) pCTX = (_MFCLIB *)openHandle; if (pCTX->inter_buff_status & MFC_USE_YUV_BUFF) { - free_arg.args.mem_free.u_addr = pCTX->virFrmBuf.luma; + free_arg.args.mem_free.key = pCTX->virFrmBuf.luma - pCTX->mapped_addr; ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_FREE_BUF, &free_arg); } if (pCTX->inter_buff_status & MFC_USE_STRM_BUFF) { - free_arg.args.mem_free.u_addr = pCTX->virStrmBuf; + free_arg.args.mem_free.key = pCTX->virStrmBuf - pCTX->mapped_addr; ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_FREE_BUF, &free_arg); - free_arg.args.mem_free.u_addr = pCTX->virMvRefYC; + free_arg.args.mem_free.key = pCTX->virMvRefYC - pCTX->mapped_addr; ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_FREE_BUF, &free_arg); } @@ -446,7 +446,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU pCTX = (_MFCLIB *)openHandle; - user_addr_arg.args.mem_alloc.codec_type = pCTX->codecType; + user_addr_arg.args.mem_alloc.type = ENCODER; y_size = pCTX->width * pCTX->height; c_size = (pCTX->width * pCTX->height) >> 1; @@ -462,10 +462,19 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU LOGE("SsbSipMfcEncGetInBuf: IOCTL_MFC_GET_IN_BUF failed\n"); return MFC_RET_ENC_GET_INBUF_FAIL; } + + /* Get physical address information */ + phys_addr_arg.args.real_addr.key = user_addr_arg.args.mem_alloc.offset; + ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_REAL_ADDR, &phys_addr_arg); + if (ret_code < 0) { + LOGE("SsbSipMfcEncGetInBuf: IOCTL_MFC_GET_REAL_ADDR failed\n"); + return MFC_RET_ENC_GET_INBUF_FAIL; + } + pCTX->virFrmBuf.luma = user_addr_arg.args.mem_alloc.offset + pCTX->mapped_addr; - pCTX->virFrmBuf.chroma = user_addr_arg.args.mem_alloc.out_offset + pCTX->mapped_addr + (unsigned int)aligned_y_size; - pCTX->phyFrmBuf.luma = user_addr_arg.args.mem_alloc.addr; - pCTX->phyFrmBuf.chroma = user_addr_arg.args.mem_alloc.addr + (unsigned int)aligned_y_size; + pCTX->virFrmBuf.chroma = user_addr_arg.args.mem_alloc.offset + pCTX->mapped_addr + (unsigned int)aligned_y_size; + pCTX->phyFrmBuf.luma = phys_addr_arg.args.real_addr.addr; + pCTX->phyFrmBuf.chroma = phys_addr_arg.args.real_addr.addr + (unsigned int)aligned_y_size; pCTX->sizeFrmBuf.luma = (unsigned int)y_size; pCTX->sizeFrmBuf.chroma = (unsigned int)c_size; diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h index 809f517..815d787 100644 --- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h +++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h @@ -445,6 +445,7 @@ typedef struct struct mfc_frame_buf_arg virFrmBuf; unsigned int mapped_addr; unsigned int mapped_size; + unsigned int buf_key; struct mfc_common_args MfcArg; SSBSIP_MFC_CODEC_TYPE codecType; SSBSIP_MFC_DEC_OUTPUT_INFO decOutInfo; @@ -470,4 +471,14 @@ typedef struct #define ENC_PROFILE_LEVEL(profile, level) ((profile) | ((level) << 8)) #define ENC_RC_QBOUND(min_qp, max_qp) ((min_qp) | ((max_qp) << 8)) +#define ALIGN_TO_16B(x) ((((x) + (1 << 4) - 1) >> 4) << 4) +#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5) +#define ALIGN_TO_64B(x) ((((x) + (1 << 6) - 1) >> 6) << 6) +#define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7) +#define ALIGN_TO_2KB(x) ((((x) + (1 << 11) - 1) >> 11) << 11) +#define ALIGN_TO_4KB(x) ((((x) + (1 << 12) - 1) >> 12) << 12) +#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13) +#define ALIGN_TO_64KB(x) ((((x) + (1 << 16) - 1) >> 16) << 16) +#define ALIGN_TO_128KB(x) ((((x) + (1 << 17) - 1) >> 17) << 17) + #endif /* __MFC_INTERFACE_H */