This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: mediatek/vcodec: Enable incoherent buffer allocation
Author:  Justin Green <greenjus...@chromium.org>
Date:    Mon Jun 6 18:24:11 2022 +0100

Set allow_cache_hints to 1 for the vb2_queue source and destination queues
in the mediatek vcodec V4L2 driver. This allows us to allocate buffers
with the V4L2_MEMORY_FLAG_NON_COHERENT set. On Mediatek SoCs, this enables
caching for this memory, which vastly improves performance when being read
from CPU. Read performance for these buffers is in turn important for
detiling MM21 video frames in userspace software, such as libyuv or
gstreamer.

This change should be safe from race conditions since videobuf2 already
invalidates or flushes the appropriate cache lines in its prepare() and
finish() methods.

Tested on a MT8183 SoC. Resulted in both correct detiling and a 10X
speedup.

Signed-off-by: Justin Green <greenjus...@chromium.org>
Suggested-by: Nicolas Dufresne <nicolas.dufre...@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mche...@kernel.org>

 drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c | 2 ++
 1 file changed, 2 insertions(+)

---

diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c 
b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
index 254649240b34..61412d0eeb33 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
@@ -979,6 +979,7 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue 
*src_vq,
        src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
        src_vq->lock            = &ctx->dev->dev_mutex;
        src_vq->dev             = &ctx->dev->plat_dev->dev;
+       src_vq->allow_cache_hints = 1;
 
        ret = vb2_queue_init(src_vq);
        if (ret) {
@@ -994,6 +995,7 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue 
*src_vq,
        dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
        dst_vq->lock            = &ctx->dev->dev_mutex;
        dst_vq->dev             = &ctx->dev->plat_dev->dev;
+       dst_vq->allow_cache_hints = 1;
 
        ret = vb2_queue_init(dst_vq);
        if (ret)

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to