mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-09-26 21:15:53 +08:00
fix[mpp_dmabuf]: fix align cache line size calculate err
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com> Change-Id: Ide7daa58b12b22dc115acbbb7a9b8e305a167d57
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#define MPP_SWAP(type, a, b) do {type SWAP_tmp = b; b = a; a = SWAP_tmp;} while(0)
|
||||
#define MPP_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
|
||||
#define MPP_ALIGN(x, a) (((x)+(a)-1)&~((a)-1))
|
||||
#define MPP_ALIGN_DOWN(x, a) ((x)&~((a)-1))
|
||||
#define MPP_ALIGN_GEN(x, a) (((x)+(a)-1)/(a)*(a))
|
||||
#define MPP_VSWAP(a, b) { a ^= b; b ^= a; a ^= b; }
|
||||
|
||||
|
@@ -72,8 +72,8 @@ MPP_RET mpp_dmabuf_sync_partial_begin(RK_S32 fd, RK_S32 ro, RK_U32 offset, RK_U3
|
||||
return MPP_OK;
|
||||
|
||||
sync.flags = DMA_BUF_SYNC_START | (ro ? DMA_BUF_SYNC_READ : DMA_BUF_SYNC_RW);
|
||||
sync.offset = offset / CACHE_LINE_SIZE;
|
||||
sync.len = MPP_ALIGN(length, CACHE_LINE_SIZE);
|
||||
sync.offset = MPP_ALIGN_DOWN(offset, CACHE_LINE_SIZE);
|
||||
sync.len = MPP_ALIGN(length + offset - sync.offset, CACHE_LINE_SIZE);
|
||||
|
||||
ret = ioctl(fd, DMA_BUF_IOCTL_SYNC_PARTIAL, &sync);
|
||||
if (ret) {
|
||||
@@ -103,8 +103,8 @@ MPP_RET mpp_dmabuf_sync_partial_end(RK_S32 fd, RK_S32 ro, RK_U32 offset, RK_U32
|
||||
return MPP_OK;
|
||||
|
||||
sync.flags = DMA_BUF_SYNC_END | (ro ? DMA_BUF_SYNC_READ : DMA_BUF_SYNC_RW);
|
||||
sync.offset = offset / CACHE_LINE_SIZE;
|
||||
sync.len = MPP_ALIGN(length, CACHE_LINE_SIZE);
|
||||
sync.offset = MPP_ALIGN_DOWN(offset, CACHE_LINE_SIZE);
|
||||
sync.len = MPP_ALIGN(length + offset - sync.offset, CACHE_LINE_SIZE);
|
||||
|
||||
ret = ioctl(fd, DMA_BUF_IOCTL_SYNC_PARTIAL, &sync);
|
||||
if (ret) {
|
||||
|
Reference in New Issue
Block a user