gstmemory: Need gstmemory flag for ignore CPU cache flush.
GStreamer need gstmemory flag for ignore CPU cache flush.
- CPU access the memory is cacheable.
- Need cache flush when transfer the memory to HW driver with dmabuf fd.
- Need ignore CPU cache flush when the memory isn't touched by CPU.
As only GStreamer level know if CPU accessed the memory, my proposal is add one memory flag to indicate CPU accessed the buffer and need flush cache when HW driver access it. Can we add one GST_MEMORY_FLAG_NEED_FLUCH_CACHE when gst_memory_map()? V4L2 also has below flag. But only GStreamer can know when use below flag. If the memory isn't be mapped every, we can set below flag to skip VPU cache flush to improve performance.
#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x00000800 #define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x00001000
I also remember _get_cached_eglimage() will cause cache flush issue. It will skip cache flush. we can decide if cache eglimage by memory flag: GST_MEMORY_FLAG_NEED_FLUCH_CACHE.