mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-23 09:09:23 +08:00
[osal]: Use SET_SESSION_FD to implement batch cmd
1. Add SET_SESSION_FD cmd. 2. Support new delimit interface to send multi request in one ioctl. Change-Id: I07980cc9c70b5e31585254d1ffde7bc56a3007e2 Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#define MPP_DEVICE_DBG_DETAIL (0x00000004)
|
||||
#define MPP_DEVICE_DBG_REG (0x00000010)
|
||||
#define MPP_DEVICE_DBG_TIME (0x00000020)
|
||||
#define MPP_DEVICE_DBG_MSG (0x00000040)
|
||||
|
||||
#define mpp_dev_dbg(flag, fmt, ...) _mpp_dbg(mpp_device_debug, flag, fmt, ## __VA_ARGS__)
|
||||
#define mpp_dev_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpp_device_debug, flag, fmt, ## __VA_ARGS__)
|
||||
@@ -33,6 +34,7 @@
|
||||
#define mpp_dev_dbg_detail(fmt, ...) mpp_dev_dbg(MPP_DEVICE_DBG_DETAIL, fmt, ## __VA_ARGS__)
|
||||
#define mpp_dev_dbg_reg(fmt, ...) mpp_dev_dbg(MPP_DEVICE_DBG_REG, fmt, ## __VA_ARGS__)
|
||||
#define mpp_dev_dbg_time(fmt, ...) mpp_dev_dbg(MPP_DEVICE_DBG_TIME, fmt, ## __VA_ARGS__)
|
||||
#define mpp_dev_dbg_msg(fmt, ...) mpp_dev_dbg(MPP_DEVICE_DBG_MSG, fmt, ## __VA_ARGS__)
|
||||
|
||||
extern RK_U32 mpp_device_debug;
|
||||
|
||||
|
@@ -42,12 +42,21 @@ typedef struct MppDevMppService_t {
|
||||
RK_S32 batch_io;
|
||||
MppCbCtx *dev_cb;
|
||||
|
||||
MppReqV1 *reqs;
|
||||
RK_S32 req_max;
|
||||
RK_S32 req_cnt;
|
||||
|
||||
RegOffsetInfo *reg_offset_info;
|
||||
RK_S32 reg_offset_max;
|
||||
RK_S32 reg_offset_count;
|
||||
MppReqV1 reqs[MAX_REQ_NUM];
|
||||
RegOffsetInfo reg_offset_info[MAX_REG_OFFSET];
|
||||
RK_S32 reg_offset_pos;
|
||||
|
||||
RcbInfo *rcb_info;
|
||||
RK_S32 rcb_max;
|
||||
RK_S32 rcb_count;
|
||||
RcbInfo rcb_info[MAX_RCB_OFFSET];
|
||||
RK_S32 rcb_pos;
|
||||
|
||||
MppDevBatCmd bat_cmd;
|
||||
|
||||
RK_S32 info_count;
|
||||
MppDevInfoCfg info[MAX_INFO_COUNT];
|
||||
|
@@ -131,6 +131,10 @@ MPP_RET mpp_dev_ioctl(MppDev ctx, RK_S32 cmd, void *param)
|
||||
if (api->detach)
|
||||
ret = api->detach(impl_ctx);
|
||||
} break;
|
||||
case MPP_DEV_DELIMIT : {
|
||||
if (api->delimit)
|
||||
ret = api->delimit(impl_ctx);
|
||||
} break;
|
||||
case MPP_DEV_SET_CB_CTX: {
|
||||
if (api->set_cb_ctx)
|
||||
ret = api->set_cb_ctx(impl_ctx, param);
|
||||
|
@@ -66,12 +66,6 @@ typedef struct MppDevBatTask_t MppDevBatTask;
|
||||
typedef struct MppDevSession_t MppDevSession;
|
||||
typedef struct MppDevBatServ_t MppDevBatServ;
|
||||
|
||||
typedef struct MppDevBatCmd_t {
|
||||
RK_U64 flag;
|
||||
RK_S32 client;
|
||||
RK_S32 ret;
|
||||
} MppDevBatCmd;
|
||||
|
||||
struct MppDevTask_t {
|
||||
/* link to server */
|
||||
struct list_head link_server;
|
||||
@@ -107,8 +101,6 @@ struct MppDevBatTask_t {
|
||||
MppDevBatCmd *bat_cmd;
|
||||
MppReqV1 *send_reqs;
|
||||
MppReqV1 *wait_reqs;
|
||||
MppReqV1 send_req;
|
||||
MppReqV1 wait_req;
|
||||
|
||||
/* lock and clean by server */
|
||||
RK_S32 send_req_cnt;
|
||||
@@ -202,16 +194,6 @@ MppDevBatTask *batch_add(MppDevBatServ *server)
|
||||
batch->bat_cmd = (MppDevBatCmd *)(batch->wait_reqs +
|
||||
(server->max_task_in_batch * MAX_REQ_WAIT_CNT));
|
||||
|
||||
batch->send_req.cmd = MPP_CMD_BAT_CMD;
|
||||
batch->send_req.flag = 0;
|
||||
batch->send_req.offset = 0;
|
||||
batch->send_req.data_ptr = REQ_DATA_PTR(batch->send_reqs);
|
||||
|
||||
batch->wait_req.cmd = MPP_CMD_BAT_CMD;
|
||||
batch->wait_req.flag = MPP_FLAGS_LAST_MSG;
|
||||
batch->wait_req.offset = 0;
|
||||
batch->wait_req.data_ptr = REQ_DATA_PTR(batch->wait_reqs);
|
||||
|
||||
batch_reset(batch);
|
||||
list_add_tail(&batch->link_server, &server->list_batch_free);
|
||||
server->batch_free++;
|
||||
@@ -238,8 +220,8 @@ void batch_send(MppDevBatServ *server, MppDevBatTask *batch)
|
||||
RK_S32 ret = 0;
|
||||
|
||||
mpp_assert(batch->send_req_cnt);
|
||||
batch->send_req.size = batch->send_req_cnt * sizeof(batch->send_req);
|
||||
ret = mpp_service_ioctl_request(server->server_fd, &batch->send_req);
|
||||
|
||||
ret = mpp_service_ioctl_request(server->server_fd, batch->send_reqs);
|
||||
if (ret) {
|
||||
mpp_err_f("ioctl batch cmd failed ret %d errno %d %s\n",
|
||||
ret, errno, strerror(errno));
|
||||
@@ -276,8 +258,7 @@ void process_task(void *p)
|
||||
break;
|
||||
|
||||
mpp_assert(batch->wait_req_cnt);
|
||||
batch->wait_req.size = batch->wait_req_cnt * sizeof(batch->wait_req);
|
||||
ret = mpp_service_ioctl_request(server->server_fd, &batch->wait_req);
|
||||
ret = mpp_service_ioctl_request(server->server_fd, batch->wait_reqs);
|
||||
if (!ret) {
|
||||
MppDevTask *n;
|
||||
|
||||
@@ -430,7 +411,7 @@ try_proc_pending_task:
|
||||
/* add session info before each session task and then copy session request */
|
||||
req = &batch->send_reqs[batch->send_req_cnt++];
|
||||
req->cmd = MPP_CMD_SET_SESSION_FD;
|
||||
req->flag = 0;
|
||||
req->flag = MPP_FLAGS_MULTI_MSG;
|
||||
req->offset = 0;
|
||||
req->size = sizeof(*bat_cmd);
|
||||
req->data_ptr = REQ_DATA_PTR(bat_cmd);
|
||||
@@ -447,14 +428,14 @@ try_proc_pending_task:
|
||||
/* setup poll request */
|
||||
req = &batch->wait_reqs[batch->wait_req_cnt++];
|
||||
req->cmd = MPP_CMD_SET_SESSION_FD;
|
||||
req->flag = 0;
|
||||
req->flag = MPP_FLAGS_MULTI_MSG;
|
||||
req->offset = 0;
|
||||
req->size = sizeof(*bat_cmd);
|
||||
req->data_ptr = REQ_DATA_PTR(bat_cmd);
|
||||
|
||||
req = &batch->wait_reqs[batch->wait_req_cnt++];
|
||||
req->cmd = MPP_CMD_POLL_HW_FINISH;
|
||||
req->flag = MPP_FLAGS_POLL_NON_BLOCK | MPP_FLAGS_LAST_MSG;
|
||||
req->flag = MPP_FLAGS_POLL_NON_BLOCK | MPP_FLAGS_MULTI_MSG | MPP_FLAGS_LAST_MSG;
|
||||
req->offset = 0;
|
||||
req->size = 0;
|
||||
req->data_ptr = 0;
|
||||
@@ -617,8 +598,7 @@ MppDevServer::MppDevServer() :
|
||||
sizeof(MppDevBatCmd));
|
||||
|
||||
mCmdCap = mpp_get_mpp_service_cmd_cap();
|
||||
if (MPP_OK != mpp_service_check_cmd_valid(MPP_CMD_BAT_CMD, mCmdCap) ||
|
||||
MPP_OK != mpp_service_check_cmd_valid(MPP_CMD_SET_SESSION_FD, mCmdCap)) {
|
||||
if (MPP_OK != mpp_service_check_cmd_valid(MPP_CMD_SET_SESSION_FD, mCmdCap)) {
|
||||
mServerError = "mpp_service cmd not support";
|
||||
return;
|
||||
}
|
||||
@@ -768,6 +748,12 @@ MPP_RET MppDevServer::bat_server_put(MppClientType client_type)
|
||||
mpp_assert(list_empty(&server->list_batch));
|
||||
mpp_assert(server->pending_count == 0);
|
||||
|
||||
/* stop thread first */
|
||||
if (server->timer) {
|
||||
mpp_timer_put(server->timer);
|
||||
server->timer = NULL;
|
||||
}
|
||||
|
||||
if (server->batch_free) {
|
||||
list_for_each_entry_safe(batch, n, &server->list_batch_free, MppDevBatTask, link_server) {
|
||||
batch_del(server, batch);
|
||||
@@ -776,11 +762,6 @@ MPP_RET MppDevServer::bat_server_put(MppClientType client_type)
|
||||
mpp_assert(list_empty(&server->list_batch_free));
|
||||
}
|
||||
|
||||
if (server->timer) {
|
||||
mpp_timer_put(server->timer);
|
||||
server->timer = NULL;
|
||||
}
|
||||
|
||||
if (server->server_fd >= 0) {
|
||||
close(server->server_fd);
|
||||
server->server_fd = -1;
|
||||
|
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "mpp_log.h"
|
||||
#include "mpp_env.h"
|
||||
#include "mpp_mem.h"
|
||||
#include "mpp_common.h"
|
||||
#include "osal_2str.h"
|
||||
|
||||
@@ -188,6 +189,74 @@ void check_mpp_service_cap(RK_U32 *codec_type, RK_U32 *hw_ids, MppServiceCmdCap
|
||||
}
|
||||
}
|
||||
|
||||
MppReqV1 *mpp_service_next_req(MppDevMppService *p)
|
||||
{
|
||||
MppReqV1 *mpp_req = NULL;
|
||||
|
||||
if (p->req_cnt >= p->req_max) {
|
||||
mpp_dev_dbg_msg("enlarge request count %d -> %d\n",
|
||||
p->req_max, p->req_max * 2);
|
||||
p->reqs = mpp_realloc(p->reqs, MppReqV1, p->req_max * 2);
|
||||
if (NULL == p->reqs) {
|
||||
mpp_err_f("failed to enlarge request buffer\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p->req_max *= 2;
|
||||
}
|
||||
|
||||
mpp_req = &p->reqs[p->req_cnt++];
|
||||
|
||||
return mpp_req;
|
||||
}
|
||||
|
||||
RegOffsetInfo *mpp_service_next_reg_offset(MppDevMppService *p)
|
||||
{
|
||||
RegOffsetInfo *info = NULL;
|
||||
|
||||
if (p->reg_offset_count + p->reg_offset_pos >= p->reg_offset_max) {
|
||||
mpp_dev_dbg_msg("enlarge reg offset count %d -> %d\n",
|
||||
p->reg_offset_max, p->reg_offset_max * 2);
|
||||
p->reg_offset_info = mpp_realloc(p->reg_offset_info, RegOffsetInfo, p->reg_offset_max * 2);
|
||||
if (NULL == p->reg_offset_info) {
|
||||
mpp_err_f("failed to enlarge request buffer\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p->reg_offset_max *= 2;
|
||||
}
|
||||
|
||||
info = &p->reg_offset_info[p->reg_offset_count + p->reg_offset_pos];
|
||||
mpp_dev_dbg_msg("reg offset %d : %d\n", p->reg_offset_pos, p->reg_offset_count);
|
||||
p->reg_offset_count++;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
RcbInfo *mpp_service_next_rcb_info(MppDevMppService *p)
|
||||
{
|
||||
RcbInfo *info = NULL;
|
||||
|
||||
if (p->rcb_count + p->rcb_pos >= p->rcb_max) {
|
||||
mpp_dev_dbg_msg("enlarge rcb info count %d -> %d\n",
|
||||
p->rcb_max, p->rcb_max * 2);
|
||||
p->rcb_info = mpp_realloc(p->rcb_info, RcbInfo, p->rcb_max * 2);
|
||||
if (NULL == p->rcb_info) {
|
||||
mpp_err_f("failed to enlarge request buffer\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p->rcb_max *= 2;
|
||||
}
|
||||
|
||||
info = &p->rcb_info[p->rcb_count + p->rcb_pos];
|
||||
mpp_dev_dbg_msg("rcb info %d : %d\n", p->rcb_pos, p->rcb_count);
|
||||
p->rcb_count++;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
MPP_RET mpp_service_init(void *ctx, MppClientType type)
|
||||
{
|
||||
MppDevMppService *p = (MppDevMppService *)ctx;
|
||||
@@ -218,6 +287,35 @@ MPP_RET mpp_service_init(void *ctx, MppClientType type)
|
||||
p->serv_ctx = NULL;
|
||||
p->dev_cb = NULL;
|
||||
|
||||
p->bat_cmd.flag = 0;
|
||||
p->bat_cmd.client = p->client;
|
||||
p->bat_cmd.ret = 0;
|
||||
|
||||
p->req_max = MAX_REQ_NUM;
|
||||
p->reqs = mpp_malloc(MppReqV1, p->req_max);
|
||||
if (NULL == p->reqs) {
|
||||
mpp_err("create request buffer failed\n");
|
||||
ret = MPP_ERR_MALLOC;
|
||||
}
|
||||
|
||||
p->reg_offset_max = MAX_REG_OFFSET;
|
||||
p->reg_offset_info = mpp_malloc(RegOffsetInfo, p->reg_offset_max);
|
||||
if (NULL == p->reg_offset_info) {
|
||||
mpp_err("create register offset buffer failed\n");
|
||||
ret = MPP_ERR_MALLOC;
|
||||
}
|
||||
p->reg_offset_pos = 0;
|
||||
p->reg_offset_count = 0;
|
||||
|
||||
p->rcb_max = MAX_RCB_OFFSET;
|
||||
p->rcb_info = mpp_malloc(RcbInfo, p->rcb_max);
|
||||
if (NULL == p->rcb_info) {
|
||||
mpp_err("create rcb info buffer failed\n");
|
||||
ret = MPP_ERR_MALLOC;
|
||||
}
|
||||
p->rcb_pos = 0;
|
||||
p->rcb_count = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -231,6 +329,10 @@ MPP_RET mpp_service_deinit(void *ctx)
|
||||
if (p->client)
|
||||
close(p->client);
|
||||
|
||||
MPP_FREE(p->reqs);
|
||||
MPP_FREE(p->reg_offset_info);
|
||||
MPP_FREE(p->rcb_info);
|
||||
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
@@ -264,6 +366,47 @@ MPP_RET mpp_service_detach(void *ctx)
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
MPP_RET mpp_service_delimit(void *ctx)
|
||||
{
|
||||
MppDevMppService *p = (MppDevMppService *)ctx;
|
||||
MppReqV1 *mpp_req = NULL;
|
||||
|
||||
/* set fd trans info if needed */
|
||||
if (p->reg_offset_count) {
|
||||
mpp_req = mpp_service_next_req(p);
|
||||
|
||||
mpp_req->cmd = MPP_CMD_SET_REG_ADDR_OFFSET;
|
||||
mpp_req->flag = MPP_FLAGS_REG_OFFSET_ALONE;
|
||||
mpp_req->size = (p->reg_offset_count) * sizeof(RegOffsetInfo);
|
||||
mpp_req->offset = 0;
|
||||
mpp_req->data_ptr = REQ_DATA_PTR(&p->reg_offset_info[p->reg_offset_pos]);
|
||||
p->reg_offset_pos += p->reg_offset_count;
|
||||
p->reg_offset_count = 0;
|
||||
}
|
||||
|
||||
/* set rcb offst info if needed */
|
||||
if (p->rcb_count) {
|
||||
mpp_req = mpp_service_next_req(p);
|
||||
|
||||
mpp_req->cmd = MPP_CMD_SET_RCB_INFO;
|
||||
mpp_req->flag = 0;
|
||||
mpp_req->size = p->rcb_count * sizeof(RcbInfo);
|
||||
mpp_req->offset = 0;
|
||||
mpp_req->data_ptr = REQ_DATA_PTR(&p->rcb_info[p->rcb_pos]);
|
||||
p->rcb_pos += p->rcb_count;
|
||||
p->rcb_count = 0;
|
||||
}
|
||||
|
||||
mpp_req = mpp_service_next_req(p);
|
||||
mpp_req->cmd = MPP_CMD_SET_SESSION_FD;
|
||||
mpp_req->flag = MPP_FLAGS_MULTI_MSG;
|
||||
mpp_req->offset = 0;
|
||||
mpp_req->size = sizeof(p->bat_cmd);
|
||||
mpp_req->data_ptr = REQ_DATA_PTR(&p->bat_cmd);
|
||||
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
MPP_RET mpp_service_set_cb_ctx(void *ctx, MppCbCtx *cb_ctx)
|
||||
{
|
||||
MppDevMppService *p = (MppDevMppService *)ctx;
|
||||
@@ -276,18 +419,13 @@ MPP_RET mpp_service_set_cb_ctx(void *ctx, MppCbCtx *cb_ctx)
|
||||
MPP_RET mpp_service_reg_wr(void *ctx, MppDevRegWrCfg *cfg)
|
||||
{
|
||||
MppDevMppService *p = (MppDevMppService *)ctx;
|
||||
|
||||
if (!p->req_cnt)
|
||||
memset(p->reqs, 0, sizeof(p->reqs));
|
||||
|
||||
MppReqV1 *mpp_req = &p->reqs[p->req_cnt];
|
||||
MppReqV1 *mpp_req = mpp_service_next_req(p);
|
||||
|
||||
mpp_req->cmd = MPP_CMD_SET_REG_WRITE;
|
||||
mpp_req->flag = 0;
|
||||
mpp_req->size = cfg->size;
|
||||
mpp_req->offset = cfg->offset;
|
||||
mpp_req->data_ptr = REQ_DATA_PTR(cfg->reg);
|
||||
p->req_cnt++;
|
||||
|
||||
return MPP_OK;
|
||||
}
|
||||
@@ -295,18 +433,13 @@ MPP_RET mpp_service_reg_wr(void *ctx, MppDevRegWrCfg *cfg)
|
||||
MPP_RET mpp_service_reg_rd(void *ctx, MppDevRegRdCfg *cfg)
|
||||
{
|
||||
MppDevMppService *p = (MppDevMppService *)ctx;
|
||||
|
||||
if (!p->req_cnt)
|
||||
memset(p->reqs, 0, sizeof(p->reqs));
|
||||
|
||||
MppReqV1 *mpp_req = &p->reqs[p->req_cnt];
|
||||
MppReqV1 *mpp_req = mpp_service_next_req(p);
|
||||
|
||||
mpp_req->cmd = MPP_CMD_SET_REG_READ;
|
||||
mpp_req->flag = 0;
|
||||
mpp_req->size = cfg->size;
|
||||
mpp_req->offset = cfg->offset;
|
||||
mpp_req->data_ptr = REQ_DATA_PTR(cfg->reg);
|
||||
p->req_cnt++;
|
||||
|
||||
return MPP_OK;
|
||||
}
|
||||
@@ -314,8 +447,8 @@ MPP_RET mpp_service_reg_rd(void *ctx, MppDevRegRdCfg *cfg)
|
||||
MPP_RET mpp_service_reg_offset(void *ctx, MppDevRegOffsetCfg *cfg)
|
||||
{
|
||||
MppDevMppService *p = (MppDevMppService *)ctx;
|
||||
RK_S32 i;
|
||||
RegOffsetInfo *info;
|
||||
RK_S32 i;
|
||||
|
||||
if (!cfg->offset)
|
||||
return MPP_OK;
|
||||
@@ -326,7 +459,7 @@ MPP_RET mpp_service_reg_offset(void *ctx, MppDevRegOffsetCfg *cfg)
|
||||
}
|
||||
|
||||
for (i = 0; i < p->reg_offset_count; i++) {
|
||||
info = &p->reg_offset_info[i];
|
||||
info = &p->reg_offset_info[p->reg_offset_pos + i];
|
||||
|
||||
if (info->reg_idx == cfg->reg_idx) {
|
||||
mpp_err_f("reg[%d] offset has been set, cover old %d -> %d\n",
|
||||
@@ -336,10 +469,10 @@ MPP_RET mpp_service_reg_offset(void *ctx, MppDevRegOffsetCfg *cfg)
|
||||
}
|
||||
}
|
||||
|
||||
info = &p->reg_offset_info[p->reg_offset_count++];
|
||||
|
||||
info = mpp_service_next_reg_offset(p);;
|
||||
info->reg_idx = cfg->reg_idx;
|
||||
info->offset = cfg->offset;
|
||||
p->reg_offset_count++;
|
||||
|
||||
return MPP_OK;
|
||||
}
|
||||
@@ -361,7 +494,7 @@ MPP_RET mpp_service_rcb_info(void *ctx, MppDevRcbInfoCfg *cfg)
|
||||
return MPP_NOK;
|
||||
}
|
||||
|
||||
RcbInfo *info = &p->rcb_info[p->rcb_count++];
|
||||
RcbInfo *info = mpp_service_next_rcb_info(p);
|
||||
|
||||
info->reg_idx = cfg->reg_idx;
|
||||
info->size = cfg->size;
|
||||
@@ -390,7 +523,7 @@ MPP_RET mpp_service_cmd_send(void *ctx)
|
||||
MPP_RET ret = MPP_OK;
|
||||
MppDevMppService *p = (MppDevMppService *)ctx;
|
||||
|
||||
if (p->req_cnt <= 0 || p->req_cnt > MAX_REQ_NUM) {
|
||||
if (p->req_cnt <= 0 || p->req_cnt > p->req_max) {
|
||||
mpp_err_f("ctx %p invalid request count %d\n", ctx, p->req_cnt);
|
||||
return MPP_ERR_VALUE;
|
||||
}
|
||||
@@ -404,6 +537,7 @@ MPP_RET mpp_service_cmd_send(void *ctx)
|
||||
mpp_req.size = p->info_count * sizeof(p->info[0]);
|
||||
mpp_req.offset = 0;
|
||||
mpp_req.data_ptr = REQ_DATA_PTR(p->info);
|
||||
|
||||
ret = mpp_service_ioctl_request(p->client, &mpp_req);
|
||||
if (ret)
|
||||
p->support_set_info = 0;
|
||||
@@ -413,26 +547,26 @@ MPP_RET mpp_service_cmd_send(void *ctx)
|
||||
|
||||
/* set fd trans info if needed */
|
||||
if (p->reg_offset_count) {
|
||||
MppReqV1 *mpp_req = &p->reqs[p->req_cnt];
|
||||
MppReqV1 *mpp_req = mpp_service_next_req(p);
|
||||
|
||||
mpp_req->cmd = MPP_CMD_SET_REG_ADDR_OFFSET;
|
||||
mpp_req->flag = MPP_FLAGS_REG_OFFSET_ALONE;
|
||||
mpp_req->size = p->reg_offset_count * sizeof(p->reg_offset_info[0]);
|
||||
mpp_req->size = (p->reg_offset_count) * sizeof(RegOffsetInfo);
|
||||
mpp_req->offset = 0;
|
||||
mpp_req->data_ptr = REQ_DATA_PTR(&p->reg_offset_info[0]);
|
||||
p->req_cnt++;
|
||||
mpp_req->data_ptr = REQ_DATA_PTR(&p->reg_offset_info[p->reg_offset_pos]);
|
||||
p->reg_offset_pos += p->reg_offset_count;
|
||||
}
|
||||
|
||||
/* set rcb offst info if needed */
|
||||
if (p->rcb_count) {
|
||||
MppReqV1 *mpp_req = &p->reqs[p->req_cnt];
|
||||
MppReqV1 *mpp_req = mpp_service_next_req(p);
|
||||
|
||||
mpp_req->cmd = MPP_CMD_SET_RCB_INFO;
|
||||
mpp_req->flag = 0;
|
||||
mpp_req->size = p->rcb_count * sizeof(p->rcb_info[0]);
|
||||
mpp_req->size = p->rcb_count * sizeof(RcbInfo);
|
||||
mpp_req->offset = 0;
|
||||
mpp_req->data_ptr = REQ_DATA_PTR(&p->rcb_info[0]);
|
||||
p->req_cnt++;
|
||||
mpp_req->data_ptr = REQ_DATA_PTR(&p->rcb_info[p->rcb_pos]);
|
||||
p->rcb_pos += p->rcb_count;
|
||||
}
|
||||
|
||||
/* setup flag for multi message request */
|
||||
@@ -459,6 +593,9 @@ MPP_RET mpp_service_cmd_send(void *ctx)
|
||||
|
||||
p->req_cnt = 0;
|
||||
p->reg_offset_count = 0;
|
||||
p->reg_offset_pos = 0;
|
||||
p->rcb_count = 0;
|
||||
p->rcb_pos = 0;
|
||||
p->rcb_count = 0;
|
||||
return ret;
|
||||
}
|
||||
@@ -494,6 +631,7 @@ const MppDevApi mpp_service_api = {
|
||||
mpp_service_deinit,
|
||||
mpp_service_attach,
|
||||
mpp_service_detach,
|
||||
mpp_service_delimit,
|
||||
mpp_service_set_cb_ctx,
|
||||
mpp_service_reg_wr,
|
||||
mpp_service_reg_rd,
|
||||
|
@@ -702,6 +702,7 @@ const MppDevApi vcodec_service_api = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
vcodec_service_reg_wr,
|
||||
vcodec_service_reg_rd,
|
||||
vcodec_service_fd_trans,
|
||||
|
@@ -25,6 +25,7 @@ typedef enum MppDevIoctlCmd_e {
|
||||
/* device batch mode config */
|
||||
MPP_DEV_BATCH_ON,
|
||||
MPP_DEV_BATCH_OFF,
|
||||
MPP_DEV_DELIMIT,
|
||||
MPP_DEV_SET_CB_CTX,
|
||||
|
||||
/* hardware operation setup config */
|
||||
@@ -82,6 +83,7 @@ typedef struct MppDevApi_t {
|
||||
/* bat mode function */
|
||||
MPP_RET (*attach)(void *ctx);
|
||||
MPP_RET (*detach)(void *ctx);
|
||||
MPP_RET (*delimit)(void *ctx);
|
||||
MPP_RET (*set_cb_ctx)(void *ctx, MppCbCtx *cb);
|
||||
|
||||
/* config the cmd on preparing */
|
||||
|
@@ -110,6 +110,12 @@ typedef struct MppServiceCmdCap_t {
|
||||
RK_U32 ctrl_cmd;
|
||||
} MppServiceCmdCap;
|
||||
|
||||
typedef struct MppDevBatCmd_t {
|
||||
RK_U64 flag;
|
||||
RK_S32 client;
|
||||
RK_S32 ret;
|
||||
} MppDevBatCmd;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user