Skip to content

Commit

Permalink
reduce flush range
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Feb 3, 2024
1 parent 6136f99 commit 76f5056
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions highgui/src/capture_v4l2_aw_isp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ class ion_allocator
int alloc(size_t size, struct ion_memory* mem);
int free(struct ion_memory* mem);

int flush(struct ion_memory* mem);
int flush(struct ion_memory* mem, int offset, int size);

public:
int ion_fd;
Expand Down Expand Up @@ -643,11 +643,11 @@ int ion_allocator::free(struct ion_memory* mem)
return ret;
}

int ion_allocator::flush(struct ion_memory* mem)
int ion_allocator::flush(struct ion_memory* mem, int offset, int size)
{
struct sunxi_cache_range range;
range.start = (long)mem->virt_addr;
range.end = range.start + mem->size;
range.start = (long)mem->virt_addr + offset;
range.end = range.start + size;
if (ioctl(ion_fd, ION_IOC_SUNXI_FLUSH_RANGE, (void*)&range))
{
fprintf(stderr, "ioctl ION_IOC_SUNXI_FLUSH_RANGE failed %d %s\n", errno, strerror(errno));
Expand Down Expand Up @@ -1469,7 +1469,7 @@ int capture_v4l2_aw_isp_impl::read_frame(unsigned char* bgrdata)
fprintf(stderr, "ioctl G2D_CMD_BITBLT_H failed %d %s\n", errno, strerror(errno));
}

ion.flush(&bgr_ion);
ion.flush(&bgr_ion, 0, output_width * output_height * 3);

// copy to bgrdata
memcpy(bgrdata, (const unsigned char*)bgr_ion.virt_addr, output_width * output_height * 3);
Expand Down

0 comments on commit 76f5056

Please sign in to comment.