<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-next.git/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c, branch master</title>
<subtitle>Linux kernel latest source</subtitle>
<id>http://mirrors.hust.edu.cn/git/linux-next.git/atom?h=master</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/linux-next.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/'/>
<updated>2023-08-10T05:58:34+00:00</updated>
<entry>
<title>media: mediatek: vcodec: separate decoder and encoder</title>
<updated>2023-08-10T05:58:34+00:00</updated>
<author>
<name>Yunfei Dong</name>
<email>yunfei.dong@mediatek.com</email>
</author>
<published>2023-07-29T02:55:14+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=0934d37596151edce115c6d0843a9ad7d5e5d232'/>
<id>urn:sha1:0934d37596151edce115c6d0843a9ad7d5e5d232</id>
<content type='text'>
Move all decoder files to folder decoder.
Move all encoder files to folder encoder.
Move common files which shared for encoder and decoder to folder common.

Change include header files and Makefile to fix build error.

Signed-off-by: Yunfei Dong &lt;yunfei.dong@mediatek.com&gt;
Reviewed-by: Nicolas Dufresne &lt;nicolas.dufresne@collabora.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: mediatek: vcodec: separate struct mtk_vcodec_dev</title>
<updated>2023-08-10T05:58:33+00:00</updated>
<author>
<name>Yunfei Dong</name>
<email>yunfei.dong@mediatek.com</email>
</author>
<published>2023-07-29T02:55:11+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=31272a3984475615b37ec740eabebb89303f472c'/>
<id>urn:sha1:31272a3984475615b37ec740eabebb89303f472c</id>
<content type='text'>
Adding different dev struct for encoder and decoder, remove
'struct mtk_vcodec_dev'.

Signed-off-by: Yunfei Dong &lt;yunfei.dong@mediatek.com&gt;
Reviewed-by: Nicolas Dufresne &lt;nicolas.dufresne@collabora.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: mediatek: vcodec: separate struct 'mtk_vcodec_ctx'</title>
<updated>2023-08-10T05:58:33+00:00</updated>
<author>
<name>Yunfei Dong</name>
<email>yunfei.dong@mediatek.com</email>
</author>
<published>2023-07-29T02:55:10+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=01abf5fbb081c07c25ba69fce2e856197f729695'/>
<id>urn:sha1:01abf5fbb081c07c25ba69fce2e856197f729695</id>
<content type='text'>
Adding different context struct for encoder and decoder and removing
struct 'mtk_vcodec_ctx'.

Signed-off-by: Yunfei Dong &lt;yunfei.dong@mediatek.com&gt;
Reviewed-by: Nicolas Dufresne &lt;nicolas.dufresne@collabora.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: mediatek: vcodec: replace pr_* with dev_* for v4l2 debug message</title>
<updated>2023-08-10T05:58:33+00:00</updated>
<author>
<name>Yunfei Dong</name>
<email>yunfei.dong@mediatek.com</email>
</author>
<published>2023-07-29T02:55:09+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=41f03c673cb7b5f075fb6d56bb670b237064f557'/>
<id>urn:sha1:41f03c673cb7b5f075fb6d56bb670b237064f557</id>
<content type='text'>
Adding different macro mtk_v4l2_vdec_dbg and mtk_v4l2_venc_dbg for
encoder and decoder. Then calling the common macro mtk_v4l2_debug to
print debug message.

Replace pr_err with dev_err for 'mtk_v4l2_err' debug message.
Replace pr_debug with dev_dbg for 'mtk_v4l2_debug' debug message.

Signed-off-by: Yunfei Dong &lt;yunfei.dong@mediatek.com&gt;
Reviewed-by: Nicolas Dufresne &lt;nicolas.dufresne@collabora.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: mediatek: vcodec: fix resource leaks in vdec_msg_queue_init()</title>
<updated>2023-07-25T08:35:00+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@linaro.org</email>
</author>
<published>2023-06-14T13:06:47+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=cf10b0bb503c974ba049d6f888b21178be20a962'/>
<id>urn:sha1:cf10b0bb503c974ba049d6f888b21178be20a962</id>
<content type='text'>
If we encounter any error in the vdec_msg_queue_init() then we need
to set "msg_queue-&gt;wdma_addr.size = 0;".  Normally, this is done
inside the vdec_msg_queue_deinit() function.  However, if the
first call to allocate &amp;msg_queue-&gt;wdma_addr fails, then the
vdec_msg_queue_deinit() function is a no-op.  For that situation, just
set the size to zero explicitly and return.

There were two other error paths which did not clean up before returning.
Change those error paths to goto mem_alloc_err.

Fixes: b199fe46f35c ("media: mtk-vcodec: Add msg queue feature for lat and core architecture")
Fixes: 2f5d0aef37c6 ("media: mediatek: vcodec: support stateless AV1 decoder")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Reviewed-by: Nicolas Dufresne &lt;nicolas.dufresne@collabora.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: mediatek: vcodec: fix potential double free</title>
<updated>2023-07-25T08:35:00+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@linaro.org</email>
</author>
<published>2023-06-14T13:05:39+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=be40f524b6edac4fb9a98ef79620fd9b9497a998'/>
<id>urn:sha1:be40f524b6edac4fb9a98ef79620fd9b9497a998</id>
<content type='text'>
The "lat_buf-&gt;private_data" needs to be set to NULL to prevent a
double free.  How this would happen is if vdec_msg_queue_init() failed
twice in a row and on the second time it failed earlier than on the
first time.

The vdec_msg_queue_init() function has a loop which does:
	for (i = 0; i &lt; NUM_BUFFER_COUNT; i++) {

Each iteration initializes one element in the msg_queue-&gt;lat_buf[] array
and then the clean up function vdec_msg_queue_deinit() frees each
element of the msg_queue-&gt;lat_buf[] array.  This clean up code relies
on the assumption that every element is either initialized or zeroed.
Leaving a freed pointer which is non-zero breaks the assumption.

Fixes: b199fe46f35c ("media: mtk-vcodec: Add msg queue feature for lat and core architecture")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Reviewed-by: Nicolas Dufresne &lt;nicolas.dufresne@collabora.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: mediatek: vcodec: fix cancel_work_sync fail with fluster test</title>
<updated>2023-07-14T07:14:09+00:00</updated>
<author>
<name>Yunfei Dong</name>
<email>yunfei.dong@mediatek.com</email>
</author>
<published>2023-06-12T03:15:57+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=d05dea76d4a813eb959ba0a150c45246d54e7148'/>
<id>urn:sha1:d05dea76d4a813eb959ba0a150c45246d54e7148</id>
<content type='text'>
Will cause below warning then reboot when exercising the decoder with
fluster on mt8192-asurada-spherion.

This deinit function is called on the v4l2 release callback, even though
the work might not have been initialized as that only happens if/when the
codec specific 'decode' callback is called (as a result of device_run m2m
callback).

CPU: 5 PID: 2338 Comm: gst-launch-1.0 Tainted: G        W          6.4.0-rc5-next-20230607+ #475
Hardware name: Google Spherion (rev0 - 3) (DT)
pstate: 00400009 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __flush_work.isra.0+0x23c/0x258
lr : __cancel_work_timer+0x14c/0x1c8
sp : ffff8000896e3b00
x29: ffff8000896e3b00 x28: ffff57c3d4079f80 x27: 0000000000000000
x26: ffff57c3d4079f80 x25: ffffb76395b59dc8 x24: 0000000000000001
x23: ffffb763928daab8 x22: ffff57c3d4079f80 x21: 0000000000000000
x20: ffffb763955f6778 x19: ffff57c3cf06f4a0 x18: 0000000000000000
x17: 000000040044ffff x16: 005000f2b5503510 x15: 0000000000000000
x14: ffff57c3c03a1f80 x13: ffffa0616a2fc000 x12: 000000003464d91d
x11: 0000000000000000 x10: 0000000000001b10 x9 : ffffb763928de61c
x8 : ffff57c3d407baf0 x7 : 0000000000000000 x6 : ffff57c3d4079f80
x5 : ffff57c3d4079f80 x4 : 0000000000000000 x3 : 0000000000000000
x2 : ffff8000896e3bf0 x1 : 0000000000000011 x0 : 0000000000000000
Call trace:
 __flush_work.isra.0+0x23c/0x258
 __cancel_work_timer+0x14c/0x1c8
 cancel_work_sync+0x1c/0x30
 vdec_msg_queue_deinit+0xac/0xc8
 vdec_h264_slice_deinit+0x64/0xb8
 vdec_if_deinit+0x3c/0x68
 mtk_vcodec_dec_release+0x20/0x40
 fops_vcodec_release+0x50/0xd8
 v4l2_release+0x7c/0x100
 __fput+0x80/0x270
 ____fput+0x18/0x30
 task_work_run+0x78/0xe0
 do_notify_resume+0x29c/0x7f8
 el0_svc+0xa4/0xb8
 el0t_64_sync_handler+0xc0/0xc8
 el0t_64_sync+0x1a8/0x1b0
---[ end trace 0000000000000000 ]---

Fixes: 297160d411e3 ("media: mediatek: vcodec: move core context from device to each instance")
Reported-by: Nícolas F. R. A. Prado &lt;nfraprado@collabora.com&gt;
Signed-off-by: Yunfei Dong &lt;yunfei.dong@mediatek.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: mediatek: vcodec: support stateless AV1 decoder</title>
<updated>2023-06-09T15:21:36+00:00</updated>
<author>
<name>Xiaoyong Lu</name>
<email>xiaoyong.lu@mediatek.com</email>
</author>
<published>2023-05-30T07:55:00+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=2f5d0aef37c64c30da17a74a82cb782a4a943545'/>
<id>urn:sha1:2f5d0aef37c64c30da17a74a82cb782a4a943545</id>
<content type='text'>
Add mediatek av1 decoder linux driver which use the stateless API in
MT8195.

Signed-off-by: Xiaoyong Lu&lt;xiaoyong.lu@mediatek.com&gt;
Tested-by: Nicolas Dufresne &lt;nicolas.dufresne@collabora.com&gt;
Reviewed-by: Nicolas Dufresne &lt;nicolas.dufresne@collabora.com&gt;
Tested-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: mediatek: vcodec: using empty lat buffer as the last one</title>
<updated>2023-05-26T09:55:51+00:00</updated>
<author>
<name>Yunfei Dong</name>
<email>yunfei.dong@mediatek.com</email>
</author>
<published>2023-05-25T01:40:09+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=962508e31c77de6daee780233084e521b9724cd0'/>
<id>urn:sha1:962508e31c77de6daee780233084e521b9724cd0</id>
<content type='text'>
Adding one empty lat buffer with parameter 'is_empty_flag = true'
used to flush core work queue decode.

Queue the empty lat buffer to core list when driver need to flush decode.
It's mean core already decode all existed lat buffer when get empty lat
buffer, then wake up core decode done event, the driver will exit when
getting core dec done event.

Fixes: d227af847ac2 ("media: mediatek: vcodec: add core decode done event")
Signed-off-by: Yunfei Dong &lt;yunfei.dong@mediatek.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: mediatek: vcodec: move core context from device to each instance</title>
<updated>2023-05-26T09:55:30+00:00</updated>
<author>
<name>Yunfei Dong</name>
<email>yunfei.dong@mediatek.com</email>
</author>
<published>2023-05-25T01:40:08+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=297160d411e3271c5a6c7df2edda30a1508afb34'/>
<id>urn:sha1:297160d411e3271c5a6c7df2edda30a1508afb34</id>
<content type='text'>
There are so many lat buffer in core context list, some instances
maybe be scheduled for a very long time. Moving the core context to
each instance, it only be used to control lat buffer of each instance.
And the core work queue of each instance is scheduled by system.

Fixes: 2cfca6c1bf80 ("media: mediatek: vcodec: move lat_buf to the top of core list")
Signed-off-by: Yunfei Dong &lt;yunfei.dong@mediatek.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@kernel.org&gt;
</content>
</entry>
</feed>
