[hal_h264e_rkv]: remove compile warnings on windows

1. add new ioctl interface SendReg2 in vpu.c
2. use Sendreg2 interface in hal_h264e_rkv, exclude ioctl.h

Change-Id: Id79716e0fca96141b8665d59244569b6de9dd39a
Signed-off-by: Lin Kesheng <lks@rock-chips.com>
This commit is contained in:
Lin Kesheng
2016-11-04 16:13:51 +08:00
committed by Herman Chen
parent 92ad1d5c7e
commit 2f9b18b0bd
3 changed files with 22 additions and 23 deletions

View File

@@ -112,6 +112,7 @@ typedef enum {
int VPUClientInit(VPU_CLIENT_TYPE type); int VPUClientInit(VPU_CLIENT_TYPE type);
RK_S32 VPUClientRelease(int socket); RK_S32 VPUClientRelease(int socket);
RK_S32 VPUClientSendReg(int socket, RK_U32 *regs, RK_U32 nregs); RK_S32 VPUClientSendReg(int socket, RK_U32 *regs, RK_U32 nregs);
RK_S32 VPUClientSendReg2(RK_S32 socket, RK_S32 offset, RK_S32 size, void *param);
RK_S32 VPUClientWaitResult(int socket, RK_U32 *regs, RK_U32 nregs, VPU_CMD_TYPE *cmd, RK_S32 *len); RK_S32 VPUClientWaitResult(int socket, RK_U32 *regs, RK_U32 nregs, VPU_CMD_TYPE *cmd, RK_S32 *len);
RK_S32 VPUClientGetHwCfg(int socket, RK_U32 *cfg, RK_U32 cfg_size); RK_S32 VPUClientGetHwCfg(int socket, RK_U32 *cfg, RK_U32 cfg_size);
RK_S32 VPUClientGetIOMMUStatus(); RK_S32 VPUClientGetIOMMUStatus();

View File

@@ -18,7 +18,6 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <sys/ioctl.h>
#include "vpu.h" #include "vpu.h"
#include "mpp_common.h" #include "mpp_common.h"
@@ -41,9 +40,8 @@
#define RKVENC_IS_TYPE_B(x) ((x)==RKVENC_FRAME_TYPE_B || (x)==RKVENC_FRAME_TYPE_BREF) #define RKVENC_IS_TYPE_B(x) ((x)==RKVENC_FRAME_TYPE_B || (x)==RKVENC_FRAME_TYPE_BREF)
#define RKVENC_IS_DISPOSABLE(type) ( type == RKVENC_FRAME_TYPE_B ) #define RKVENC_IS_DISPOSABLE(type) ( type == RKVENC_FRAME_TYPE_B )
#define H264E_IOC_MAGIC 'l' #define H264E_IOC_CUSTOM_BASE 0x1000
#define H264E_IOC_CUSTOM_BASE 0x1000 #define H264E_IOC_SET_OSD_PLT (H264E_IOC_CUSTOM_BASE + 1)
#define H264E_IOC_SET_OSD_PLT _IOW(H264E_IOC_MAGIC, H264E_IOC_CUSTOM_BASE+1, MppEncOSDPlt)
const RK_S32 h264e_csp_idx_map[H264E_RKV_CSP_BUTT] = {RKV_H264E_CSP2_BGRA, RKV_H264E_CSP2_BGR, RKV_H264E_CSP2_RGB, 0, RKV_H264E_CSP2_NV16, RKV_H264E_CSP2_I422, RKV_H264E_CSP2_NV12, const RK_S32 h264e_csp_idx_map[H264E_RKV_CSP_BUTT] = {RKV_H264E_CSP2_BGRA, RKV_H264E_CSP2_BGR, RKV_H264E_CSP2_RGB, 0, RKV_H264E_CSP2_NV16, RKV_H264E_CSP2_I422, RKV_H264E_CSP2_NV12,
@@ -296,24 +294,6 @@ static RK_U32 reg_idx2addr_map[132] = {
}; };
#endif #endif
static MPP_RET hal_h264e_rkv_cfg_hardware(RK_S32 socket, RK_U32 cmd, void *param)
{
RK_S32 ret = 0;
if (param == NULL) {
h264e_hal_log_err("input param is NULL");
return MPP_ERR_NULL_PTR;
}
ret = (RK_S32)ioctl(socket, cmd, param);
if (ret) {
h264e_hal_log_err("ioctl H264E_IOC_SET_OSDL_PLT failed ret %d", ret);
return MPP_NOK;
}
return MPP_OK;
}
static h264e_hal_rkv_csp_info hal_h264e_rkv_convert_csp(RK_S32 src_type) static h264e_hal_rkv_csp_info hal_h264e_rkv_convert_csp(RK_S32 src_type)
{ {
MppFrameFormat src_fmt = (MppFrameFormat)src_type; MppFrameFormat src_fmt = (MppFrameFormat)src_type;
@@ -2636,7 +2616,7 @@ static MPP_RET hal_h264e_rkv_set_osd_plt(h264e_hal_context *ctx, void *param)
h264e_hal_debug_enter(); h264e_hal_debug_enter();
if (plt->buf) { if (plt->buf) {
ctx->osd_plt_type = 0; ctx->osd_plt_type = 0;
if (MPP_OK != hal_h264e_rkv_cfg_hardware(ctx->vpu_socket, H264E_IOC_SET_OSD_PLT, param)) { if (MPP_OK != VPUClientSendReg2(ctx->vpu_socket, H264E_IOC_SET_OSD_PLT, sizeof(MppEncOSDPlt), param)) {
h264e_hal_log_err("set osd plt error"); h264e_hal_log_err("set osd plt error");
return MPP_NOK; return MPP_NOK;
} }

View File

@@ -28,11 +28,13 @@
#include "vpu.h" #include "vpu.h"
#define VPU_IOC_MAGIC 'l' #define VPU_IOC_MAGIC 'l'
#define VPU_IOC_SET_CLIENT_TYPE _IOW(VPU_IOC_MAGIC, 1, unsigned long) #define VPU_IOC_SET_CLIENT_TYPE _IOW(VPU_IOC_MAGIC, 1, unsigned long)
#define VPU_IOC_GET_HW_FUSE_STATUS _IOW(VPU_IOC_MAGIC, 2, unsigned long) #define VPU_IOC_GET_HW_FUSE_STATUS _IOW(VPU_IOC_MAGIC, 2, unsigned long)
#define VPU_IOC_SET_REG _IOW(VPU_IOC_MAGIC, 3, unsigned long) #define VPU_IOC_SET_REG _IOW(VPU_IOC_MAGIC, 3, unsigned long)
#define VPU_IOC_GET_REG _IOW(VPU_IOC_MAGIC, 4, unsigned long) #define VPU_IOC_GET_REG _IOW(VPU_IOC_MAGIC, 4, unsigned long)
#define VPU_IOC_PROBE_IOMMU_STATUS _IOR(VPU_IOC_MAGIC, 5, unsigned long) #define VPU_IOC_PROBE_IOMMU_STATUS _IOR(VPU_IOC_MAGIC, 5, unsigned long)
#define VPU_IOC_WRITE(nr, size) _IOC(_IOC_WRITE, VPU_IOC_MAGIC, (nr), (size))
typedef struct VPUReq { typedef struct VPUReq {
RK_U32 *req; RK_U32 *req;
@@ -140,6 +142,22 @@ RK_S32 VPUClientSendReg(int socket, RK_U32 *regs, RK_U32 nregs)
return ret; return ret;
} }
RK_S32 VPUClientSendReg2(RK_S32 socket, RK_S32 offset, RK_S32 size, void *param)
{
RK_S32 ret = 0;
if (param == NULL) {
mpp_err_f("input param is NULL");
return 1;
}
ret = (RK_S32)ioctl(socket, VPU_IOC_WRITE(offset, size), param);
if (ret)
mpp_err_f("ioctl VPU_IOC_WRITE failed ret %d", ret);
return ret;
}
RK_S32 VPUClientWaitResult(int socket, RK_U32 *regs, RK_U32 nregs, VPU_CMD_TYPE *cmd, RK_S32 *len) RK_S32 VPUClientWaitResult(int socket, RK_U32 *regs, RK_U32 nregs, VPU_CMD_TYPE *cmd, RK_S32 *len)
{ {
VPU_SERVICE_TEST; VPU_SERVICE_TEST;