mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-04 08:46:24 +08:00
[mpp_device]: Add MppDevPollCfg to poll function
Change-Id: I53ded32c3ebd70ba3842459b507782f3bd50105b Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -169,7 +169,7 @@ MPP_RET mpp_dev_ioctl(MppDev ctx, RK_S32 cmd, void *param)
|
||||
} break;
|
||||
case MPP_DEV_CMD_POLL : {
|
||||
if (api->cmd_poll)
|
||||
ret = api->cmd_poll(impl_ctx);
|
||||
ret = api->cmd_poll(impl_ctx, param);
|
||||
} break;
|
||||
default : {
|
||||
mpp_err_f("invalid cmd %d\n", cmd);
|
||||
|
@@ -637,18 +637,28 @@ MPP_RET mpp_service_cmd_send(void *ctx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
MPP_RET mpp_service_cmd_poll(void *ctx)
|
||||
MPP_RET mpp_service_cmd_poll(void *ctx, MppDevPollCfg *cfg)
|
||||
{
|
||||
MppDevMppService *p = (MppDevMppService *)ctx;
|
||||
MppReqV1 dev_req;
|
||||
MPP_RET ret = MPP_OK;
|
||||
|
||||
if (p->batch_io) {
|
||||
ret = mpp_server_wait_task(ctx, 0);
|
||||
} else {
|
||||
MppReqV1 dev_req;
|
||||
|
||||
memset(&dev_req, 0, sizeof(dev_req));
|
||||
dev_req.cmd = MPP_CMD_POLL_HW_FINISH;
|
||||
dev_req.flag |= MPP_FLAGS_LAST_MSG;
|
||||
|
||||
if (cfg) {
|
||||
dev_req.cmd = MPP_CMD_POLL_HW_IRQ;
|
||||
dev_req.flag |= MPP_FLAGS_LAST_MSG;
|
||||
dev_req.size = sizeof(*cfg) + cfg->count_max * sizeof(cfg->slice_len[0]);
|
||||
dev_req.offset = 0;
|
||||
dev_req.data_ptr = REQ_DATA_PTR(cfg);
|
||||
} else {
|
||||
dev_req.cmd = MPP_CMD_POLL_HW_FINISH;
|
||||
dev_req.flag |= MPP_FLAGS_LAST_MSG;
|
||||
}
|
||||
|
||||
ret = mpp_service_ioctl_request(p->server, &dev_req);
|
||||
if (ret) {
|
||||
|
@@ -652,7 +652,7 @@ MPP_RET vcodec_service_cmd_send(void *ctx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
MPP_RET vcodec_service_cmd_poll(void *ctx)
|
||||
MPP_RET vcodec_service_cmd_poll(void *ctx, MppDevPollCfg *cfg)
|
||||
{
|
||||
MppDevVcodecService *p = (MppDevVcodecService *)ctx;
|
||||
VcodecRegCfg *poll_cfg = &p->regs[p->reg_poll_idx];
|
||||
@@ -670,6 +670,7 @@ MPP_RET vcodec_service_cmd_poll(void *ctx)
|
||||
if (p->reg_poll_idx >= p->max_regs)
|
||||
p->reg_poll_idx = 0;
|
||||
|
||||
(void)cfg;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -82,6 +82,15 @@ typedef struct MppDevSetInfoCfg_t {
|
||||
RK_U64 data;
|
||||
} MppDevInfoCfg;
|
||||
|
||||
/* for MPP_DEV_POLL */
|
||||
typedef struct MppDevPollCfg_t {
|
||||
RK_S32 poll_type;
|
||||
RK_S32 poll_ret;
|
||||
RK_S32 count_max;
|
||||
RK_S32 count_ret;
|
||||
RK_S32 slice_len[];
|
||||
} MppDevPollCfg;
|
||||
|
||||
typedef struct MppDevApi_t {
|
||||
const char *name;
|
||||
RK_U32 ctx_size;
|
||||
@@ -106,7 +115,7 @@ typedef struct MppDevApi_t {
|
||||
MPP_RET (*cmd_send)(void *ctx);
|
||||
|
||||
/* poll cmd from hardware */
|
||||
MPP_RET (*cmd_poll)(void *ctx);
|
||||
MPP_RET (*cmd_poll)(void *ctx, MppDevPollCfg *cfg);
|
||||
} MppDevApi;
|
||||
|
||||
typedef void* MppDev;
|
||||
|
@@ -80,6 +80,7 @@ typedef enum MppServiceCmdType_e {
|
||||
|
||||
MPP_CMD_POLL_BASE = 0x300,
|
||||
MPP_CMD_POLL_HW_FINISH = MPP_CMD_POLL_BASE + 0,
|
||||
MPP_CMD_POLL_HW_IRQ = MPP_CMD_POLL_BASE + 1,
|
||||
MPP_CMD_POLL_BUTT,
|
||||
|
||||
MPP_CMD_CONTROL_BASE = 0x400,
|
||||
|
Reference in New Issue
Block a user