mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-12-24 11:50:58 +08:00
chore[kmpp_buffer]: Use new ioctl cmd macro
Signed-off-by: Herman Chen <herman.chen@rock-chips.com> Change-Id: I7be09f0b5f454c0040e772ae9405db6cef52052a
This commit is contained in:
@@ -32,12 +32,15 @@ typedef enum {
|
||||
* 4. kmpp_buf_grp_setup() to activate buffer group config
|
||||
* 5. kmpp_buf_grp_put() to release buffer group with group config
|
||||
*/
|
||||
#define KMPP_BUF_GRP_IOCTL_TABLE(prefix, IOC_CTX, IOC_IN_, IOC_OUT, IOC_IO_) \
|
||||
IOC_CTX(prefix, setup, 0)
|
||||
|
||||
#define KMPP_OBJ_NAME kmpp_buf_grp
|
||||
#define KMPP_OBJ_INTF_TYPE KmppBufGrp
|
||||
#define KMPP_OBJ_FUNC_IOCTL KMPP_BUF_GRP_IOCTL_TABLE
|
||||
#include "kmpp_obj_func.h"
|
||||
|
||||
KmppBufGrpCfg kmpp_buf_grp_to_cfg(KmppBufGrp grp);
|
||||
rk_s32 kmpp_buf_grp_setup(KmppBufGrp grp);
|
||||
|
||||
#define KMPP_BUF_GRP_CFG_ENTRY_TABLE(prefix, ENTRY, STRCT, EHOOK, SHOOK, ALIAS) \
|
||||
ENTRY(prefix, u32, rk_u32, flag, FLAG_NONE, flag) \
|
||||
@@ -66,14 +69,17 @@ rk_s32 kmpp_buf_grp_setup(KmppBufGrp grp);
|
||||
* 4. kmpp_buffer_setup() to activate buffer config
|
||||
* 5. kmpp_buffer_put() to release buffer with config
|
||||
*/
|
||||
#define KMPP_BUFFER_IOCTL_TABLE(prefix, IOC_CTX, IOC_IN_, IOC_OUT, IOC_IO_) \
|
||||
IOC_CTX(prefix, setup, 0) \
|
||||
IOC_CTX(prefix, inc_ref, 1) \
|
||||
IOC_CTX(prefix, flush, 2)
|
||||
|
||||
#define KMPP_OBJ_NAME kmpp_buffer
|
||||
#define KMPP_OBJ_INTF_TYPE KmppBuffer
|
||||
#define KMPP_OBJ_FUNC_IOCTL KMPP_BUFFER_IOCTL_TABLE
|
||||
#include "kmpp_obj_func.h"
|
||||
|
||||
KmppBufCfg kmpp_buffer_to_cfg(KmppBuffer buf);
|
||||
rk_s32 kmpp_buffer_setup(KmppBuffer buffer);
|
||||
rk_s32 kmpp_buffer_inc_ref(KmppBuffer buffer);
|
||||
rk_s32 kmpp_buffer_flush(KmppBuffer buffer);
|
||||
|
||||
#define KMPP_BUF_CFG_ENTRY_TABLE(prefix, ENTRY, STRCT, EHOOK, SHOOK, ALIAS) \
|
||||
ENTRY(prefix, u32, rk_u32, size, FLAG_NONE, size) \
|
||||
|
||||
@@ -34,16 +34,6 @@ KmppBufGrpCfg kmpp_buf_grp_to_cfg(KmppBufGrp grp)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rk_s32 kmpp_buf_grp_setup(KmppBufGrp group)
|
||||
{
|
||||
KmppBufGrpImpl *impl = kmpp_obj_to_entry(group);
|
||||
|
||||
if (!impl)
|
||||
mpp_loge_f("invalid NULL group\n");
|
||||
|
||||
return kmpp_obj_ioctl_f(group, 0, group, NULL);
|
||||
}
|
||||
|
||||
rk_s32 kmpp_buf_grp_impl_init(void *entry, KmppObj obj, const char *caller)
|
||||
{
|
||||
KmppBufGrpPriv *priv = (KmppBufGrpPriv *)kmpp_obj_to_priv(obj);
|
||||
@@ -96,6 +86,7 @@ rk_s32 kmpp_buf_grp_impl_deinit(void *entry, KmppObj obj, const char *caller)
|
||||
#define KMPP_OBJ_SGLN_ID MPP_SGLN_KMPP_BUF_GRP
|
||||
#define KMPP_OBJ_FUNC_INIT kmpp_buf_grp_impl_init
|
||||
#define KMPP_OBJ_FUNC_DEINIT kmpp_buf_grp_impl_deinit
|
||||
#define KMPP_OBJ_FUNC_IOCTL KMPP_BUF_GRP_IOCTL_TABLE
|
||||
#define KMPP_OBJ_PRIV_SIZE sizeof(KmppBufGrpPriv)
|
||||
#include "kmpp_obj_helper.h"
|
||||
|
||||
@@ -118,40 +109,6 @@ KmppBufCfg kmpp_buffer_to_cfg(KmppBuffer buf)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rk_s32 kmpp_buffer_setup(KmppBuffer buffer)
|
||||
{
|
||||
KmppBufferImpl *impl = (KmppBufferImpl *)kmpp_obj_to_entry(buffer);
|
||||
|
||||
if (!impl)
|
||||
mpp_loge_f("invalid NULL buffer\n");
|
||||
|
||||
return kmpp_obj_ioctl_f(buffer, 0, buffer, NULL);
|
||||
}
|
||||
|
||||
rk_s32 kmpp_buffer_inc_ref(KmppBuffer buffer)
|
||||
{
|
||||
KmppBufferImpl *impl = (KmppBufferImpl *)kmpp_obj_to_entry(buffer);
|
||||
|
||||
if (!impl) {
|
||||
mpp_loge_f("invalid NULL buffer\n");
|
||||
return rk_nok;
|
||||
}
|
||||
|
||||
return kmpp_obj_ioctl_f(buffer, 1, buffer, NULL);
|
||||
}
|
||||
|
||||
rk_s32 kmpp_buffer_flush(KmppBuffer buffer)
|
||||
{
|
||||
KmppBufferImpl *impl = (KmppBufferImpl *)kmpp_obj_to_entry(buffer);
|
||||
|
||||
if (!impl) {
|
||||
mpp_loge_f("invalid NULL buffer\n");
|
||||
return rk_nok;
|
||||
}
|
||||
|
||||
return kmpp_obj_ioctl_f(buffer, 2, buffer, NULL);
|
||||
}
|
||||
|
||||
rk_s32 kmpp_buffer_impl_init(void *entry, KmppObj obj, const char *caller)
|
||||
{
|
||||
KmppBufPriv *priv = (KmppBufPriv *)kmpp_obj_to_priv(obj);
|
||||
@@ -209,5 +166,6 @@ rk_s32 kmpp_buffer_impl_deinit(void *entry, KmppObj obj, const char *caller)
|
||||
#define KMPP_OBJ_SGLN_ID MPP_SGLN_KMPP_BUFFER
|
||||
#define KMPP_OBJ_FUNC_INIT kmpp_buffer_impl_init
|
||||
#define KMPP_OBJ_FUNC_DEINIT kmpp_buffer_impl_deinit
|
||||
#define KMPP_OBJ_FUNC_IOCTL KMPP_BUFFER_IOCTL_TABLE
|
||||
#define KMPP_OBJ_PRIV_SIZE sizeof(KmppBufPriv)
|
||||
#include "kmpp_obj_helper.h"
|
||||
|
||||
@@ -216,7 +216,7 @@ static rk_s32 kmpp_buffer_test(const char *name, rk_u32 flag)
|
||||
}
|
||||
|
||||
/* enable KmppBufferCfg by ioctl */
|
||||
ret = kmpp_obj_ioctl_f(buf, 0, buf, NULL);
|
||||
ret = kmpp_buffer_setup(buf);
|
||||
|
||||
test_detail("object %s ioctl ret %d\n", kmpp_obj_get_name(buf), ret);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user