From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Justin Green <greenjustin@chromium.org>
Cc: linux-media@vger.kernel.org,
"tiffany.lin@mediatek.com" <tiffany.lin@mediatek.com>,
"andrew-ct.chen@mediatek.com" <andrew-ct.chen@mediatek.com>,
mchehab@kernel.org,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"nicolas.dufresne@collabora.com" <nicolas.dufresne@collabora.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH] mediatek/vcodec: Enable incoherent buffer allocation
Date: Wed, 1 Jun 2022 10:38:47 +0900 [thread overview]
Message-ID: <YpbDJ+PUmUTcOD3n@google.com> (raw)
In-Reply-To: <CAHC42RegxBFjqMwR2gv8EwqE0FG+oS7QA9rcopapktf7tD_y-g@mail.gmail.com>
On (22/05/31 17:10), Justin Green wrote:
> 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 software.
>
> 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.
Hi Justin,
It seems that something has happened to tabs and code formatting,
could you double check and resend?
> @@ -929,30 +929,32 @@ int mtk_vcodec_dec_queue_init(void *priv, struct
> vb2_queue *src_vq,
>
> mtk_v4l2_debug(3, "[%d]", ctx->id);
>
> - src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
> - src_vq->io_modes = VB2_DMABUF | VB2_MMAP;
> - src_vq->drv_priv = ctx;
> - src_vq->buf_struct_size = sizeof(struct mtk_video_dec_buf);
> - src_vq->ops = ctx->dev->vdec_pdata->vdec_vb2_ops;
> - src_vq->mem_ops = &vb2_dma_contig_memops;
> - 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->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
> + src_vq->io_modes = VB2_DMABUF | VB2_MMAP;
> + src_vq->drv_priv = ctx;
> + src_vq->buf_struct_size = sizeof(struct mtk_video_dec_buf);
> + src_vq->ops = ctx->dev->vdec_pdata->vdec_vb2_ops;
> + src_vq->mem_ops = &vb2_dma_contig_memops;
> + 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;
I guess it should look something like this
- src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
- src_vq->io_modes = VB2_DMABUF | VB2_MMAP;
- src_vq->drv_priv = ctx;
- src_vq->buf_struct_size = sizeof(struct mtk_video_dec_buf);
- src_vq->ops = ctx->dev->vdec_pdata->vdec_vb2_ops;
- src_vq->mem_ops = &vb2_dma_contig_memops;
- 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->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+ src_vq->io_modes = VB2_DMABUF | VB2_MMAP;
+ src_vq->drv_priv = ctx;
+ src_vq->buf_struct_size = sizeof(struct mtk_video_dec_buf);
+ src_vq->ops = ctx->dev->vdec_pdata->vdec_vb2_ops;
+ src_vq->mem_ops = &vb2_dma_contig_memops;
+ 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;
next prev parent reply other threads:[~2022-06-01 1:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-31 21:10 [PATCH] mediatek/vcodec: Enable incoherent buffer allocation Justin Green
2022-06-01 1:38 ` Sergey Senozhatsky [this message]
2022-06-01 14:00 ` Justin Green
2022-06-01 15:13 ` Nicolas Dufresne
2022-06-07 9:57 ` Sergey Senozhatsky
2022-06-08 14:12 ` Nicolas Dufresne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YpbDJ+PUmUTcOD3n@google.com \
--to=senozhatsky@chromium.org \
--cc=andrew-ct.chen@mediatek.com \
--cc=greenjustin@chromium.org \
--cc=linux-media@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=nicolas.dufresne@collabora.com \
--cc=tiffany.lin@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).