mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-04 16:52:40 +08:00
feat[mpp_dmabuf]: Add dmabuf sync operation
sync_begin - cache invalidate, should be called before cpu read sync_end - cache flush, should be called after cpu write MppBuffer sync flow: 1. hw access 2. sync_begin 3. cpu access (read / write) 4. sync_end 5. hw access NOTE: readonly option is faster for read only buffer. Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com> Signed-off-by: Herman Chen <herman.chen@rock-chips.com> Change-Id: I253a6139e9bb30808c07075d64f17b5cfad8519a
This commit is contained in:
@@ -265,11 +265,29 @@ typedef struct MppBufferInfo_t {
|
||||
#define mpp_buffer_set_offset(buffer, offset) \
|
||||
mpp_buffer_set_offset_with_caller(buffer, offset, __FUNCTION__)
|
||||
|
||||
#define mpp_buffer_sync_begin(buffer) \
|
||||
mpp_buffer_sync_begin_f(buffer, 0, __FUNCTION__)
|
||||
#define mpp_buffer_sync_end(buffer) \
|
||||
mpp_buffer_sync_end_f(buffer, 0, __FUNCTION__)
|
||||
#define mpp_buffer_sync_partial_begin(buffer, offset, length) \
|
||||
mpp_buffer_sync_partial_begin_f(buffer, 0, offset, length, __FUNCTION__)
|
||||
#define mpp_buffer_sync_partial_end(buffer, offset, length) \
|
||||
mpp_buffer_sync_partial_end_f(buffer, 0, offset, length, __FUNCTION__)
|
||||
|
||||
#define mpp_buffer_sync_ro_begin(buffer) \
|
||||
mpp_buffer_sync_begin_f(buffer, 1, __FUNCTION__)
|
||||
#define mpp_buffer_sync_ro_end(buffer) \
|
||||
mpp_buffer_sync_end_f(buffer, 1, __FUNCTION__)
|
||||
#define mpp_buffer_sync_ro_partial_begin(buffer, offset, length) \
|
||||
mpp_buffer_sync_partial_begin_f(buffer, 1, offset, length, __FUNCTION__)
|
||||
#define mpp_buffer_sync_ro_partial_end(buffer, offset, length) \
|
||||
mpp_buffer_sync_partial_end_f(buffer, 1, offset, length, __FUNCTION__)
|
||||
|
||||
#define mpp_buffer_group_get_internal(group, type, ...) \
|
||||
mpp_buffer_group_get(group, type, MPP_BUFFER_INTERNAL, MODULE_TAG, __FUNCTION__)
|
||||
mpp_buffer_group_get(group, (MppBufferType)(type), MPP_BUFFER_INTERNAL, MODULE_TAG, __FUNCTION__)
|
||||
|
||||
#define mpp_buffer_group_get_external(group, type, ...) \
|
||||
mpp_buffer_group_get(group, type, MPP_BUFFER_EXTERNAL, MODULE_TAG, __FUNCTION__)
|
||||
mpp_buffer_group_get(group, (MppBufferType)(type), MPP_BUFFER_EXTERNAL, MODULE_TAG, __FUNCTION__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -302,6 +320,18 @@ MPP_RET mpp_buffer_set_index_with_caller(MppBuffer buffer, int index, const char
|
||||
size_t mpp_buffer_get_offset_with_caller(MppBuffer buffer, const char *caller);
|
||||
MPP_RET mpp_buffer_set_offset_with_caller(MppBuffer buffer, size_t offset, const char *caller);
|
||||
|
||||
/**
|
||||
* @brief MppBuffer cache operation function
|
||||
* @param buffer The MppBuffer to run the cache operation
|
||||
* @param ro for readonly option
|
||||
* @param offset partial sync data start offset
|
||||
* @param length partial sync data length
|
||||
*/
|
||||
MPP_RET mpp_buffer_sync_begin_f(MppBuffer buffer, RK_S32 ro, const char* caller);
|
||||
MPP_RET mpp_buffer_sync_end_f(MppBuffer buffer, RK_S32 ro, const char* caller);
|
||||
MPP_RET mpp_buffer_sync_partial_begin_f(MppBuffer buffer, RK_S32 ro, RK_U32 offset, RK_U32 length, const char* caller);
|
||||
MPP_RET mpp_buffer_sync_partial_end_f(MppBuffer buffer, RK_S32 ro, RK_U32 offset, RK_U32 length, const char* caller);
|
||||
|
||||
MPP_RET mpp_buffer_group_get(MppBufferGroup *group, MppBufferType type, MppBufferMode mode,
|
||||
const char *tag, const char *caller);
|
||||
MPP_RET mpp_buffer_group_put(MppBufferGroup group);
|
||||
|
Reference in New Issue
Block a user