BACKPORT: media: videobuf2: add cache management members
Extend vb2_buffer and vb2_queue structs with cache management
members.
V4L2 UAPI already contains two buffer flags which user-space,
supposedly, can use to control buffer cache sync:
- V4L2_BUF_FLAG_NO_CACHE_INVALIDATE
- V4L2_BUF_FLAG_NO_CACHE_CLEAN
None of these, however, do anything at the moment. This patch
set is intended to change it.
Since user-space cache management hints are supposed to be
implemented on a per-buffer basis we need to extend vb2_buffer
struct with two new members ->need_cache_sync_on_prepare and
->need_cache_sync_on_finish, which will store corresponding
user-space hints.
In order to preserve the existing behaviour, user-space cache
managements flags will be handled only by those drivers that
permit user-space cache hints. That's the purpose of vb2_queue
->allow_cache_hints member. Driver must set ->allow_cache_hints
during queue initialisation to enable cache management hints
mechanism.
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
(cherry picked from commit 6d2199868a)
Conflicts:
include/media/videobuf2-core.h
Change-Id: I26952d567d599d23e3867e8c1fb735d70e4cae5c
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
parent
2a4bfd1585
commit
8061fe2a75
|
|
@ -250,6 +250,10 @@ struct vb2_buffer {
|
|||
/* private: internal use only
|
||||
*
|
||||
* state: current buffer state; do not change
|
||||
* need_cache_sync_on_prepare: when set buffer's ->prepare() function
|
||||
* performs cache sync/invalidation.
|
||||
* need_cache_sync_on_finish: when set buffer's ->finish() function
|
||||
* performs cache sync/invalidation.
|
||||
* queued_entry: entry on the queued buffers list, which holds
|
||||
* all buffers queued from userspace
|
||||
* done_entry: entry on the list that stores all buffers ready
|
||||
|
|
@ -257,6 +261,8 @@ struct vb2_buffer {
|
|||
* vb2_plane: per-plane information; do not change
|
||||
*/
|
||||
enum vb2_buffer_state state;
|
||||
unsigned int need_cache_sync_on_prepare:1;
|
||||
unsigned int need_cache_sync_on_finish:1;
|
||||
|
||||
struct vb2_plane planes[VB2_MAX_PLANES];
|
||||
struct list_head queued_entry;
|
||||
|
|
@ -449,6 +455,9 @@ struct vb2_buf_ops {
|
|||
* @quirk_poll_must_check_waiting_for_buffers: Return %EPOLLERR at poll when QBUF
|
||||
* has not been called. This is a vb1 idiom that has been adopted
|
||||
* also by vb2.
|
||||
* @allow_cache_hints: when set user-space can pass cache management hints in
|
||||
* order to skip cache flush/invalidation on ->prepare() or/and
|
||||
* ->finish().
|
||||
* @lock: pointer to a mutex that protects the &struct vb2_queue. The
|
||||
* driver can set this to a mutex to let the v4l2 core serialize
|
||||
* the queuing ioctls. If the driver wants to handle locking
|
||||
|
|
@ -516,6 +525,7 @@ struct vb2_queue {
|
|||
unsigned fileio_write_immediately:1;
|
||||
unsigned allow_zero_bytesused:1;
|
||||
unsigned quirk_poll_must_check_waiting_for_buffers:1;
|
||||
unsigned int allow_cache_hints:1;
|
||||
|
||||
struct mutex *lock;
|
||||
void *owner;
|
||||
|
|
|
|||
Loading…
Reference in New Issue