Re: [PATCHv6 2/8] videobuf2: inverse buffer cache_hints flags

From: Chen-Yu Tsai
Date: Tue Sep 28 2021 - 02:09:43 EST


Hi,

On Thu, Sep 09, 2021 at 08:24:24PM +0900, Sergey Senozhatsky wrote:
> It would be less error prone if the default cache hints value
> (we kzalloc() structs, so it's zeroed out by default) would be
> to "always sync/flush" caches. Inverse and rename cache hints
> flags.
>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
> ---
> .../media/common/videobuf2/videobuf2-core.c | 31 ++++++-------------
> .../media/common/videobuf2/videobuf2-v4l2.c | 17 +++-------
> include/media/videobuf2-core.h | 12 +++----
> 3 files changed, 21 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
> index c4ff356da600..9d57df348b5f 100644
> --- a/drivers/media/common/videobuf2/videobuf2-core.c
> +++ b/drivers/media/common/videobuf2/videobuf2-core.c

[...]

> @@ -415,17 +415,6 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory,
> vb->index = q->num_buffers + buffer;
> vb->type = q->type;
> vb->memory = memory;
> - /*
> - * We need to set these flags here so that the videobuf2 core
> - * will call ->prepare()/->finish() cache sync/flush on vb2
> - * buffers when appropriate. However, we can avoid explicit
> - * ->prepare() and ->finish() cache sync for DMABUF buffers,
> - * because DMA exporter takes care of it.
> - */
> - if (q->memory != VB2_MEMORY_DMABUF) {
> - vb->need_cache_sync_on_prepare = 1;
> - vb->need_cache_sync_on_finish = 1;
> - }

This hunk seems odd. It's not inverting the logic but just removing
the block wholesale. The end result is different. This seems to be fixed
in a following patch, but the change here doesn't match what the commit
log says.

ChenYu