summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c
Commit message (Collapse)AuthorAgeFilesLines
* media: mediatek: vcodec: separate decoder and encoderYunfei Dong2023-08-101-616/+0
| | | | | | | | | | | | | 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 <yunfei.dong@mediatek.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: mediatek: vcodec: remove unused include headerYunfei Dong2023-08-101-2/+0
| | | | | | | | | remove unused include header for .c files Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: mediatek: vcodec: separate struct mtk_vcodec_devYunfei Dong2023-08-101-3/+2
| | | | | | | | | | Adding different dev struct for encoder and decoder, remove 'struct mtk_vcodec_dev'. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: mediatek: vcodec: separate struct 'mtk_vcodec_ctx'Yunfei Dong2023-08-101-11/+11
| | | | | | | | | | Adding different context struct for encoder and decoder and removing struct 'mtk_vcodec_ctx'. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: mediatek: vcodec: replace pr_* with dev_* for v4l2 debug messageYunfei Dong2023-08-101-29/+33
| | | | | | | | | | | | | | 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 <yunfei.dong@mediatek.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: mediatek: vcodec: support stateless AV1 decoderXiaoyong Lu2023-06-091-1/+46
| | | | | | | | | | | | | Add mediatek av1 decoder linux driver which use the stateless API in MT8195. Signed-off-by: Xiaoyong Lu<xiaoyong.lu@mediatek.com> Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Avoid unneeded error loggingYunfei Dong2023-05-261-1/+1
| | | | | | | | | | | | | | | Since the LAT decoder works faster than its CORE, getting the trans buffer may be done only after CORE finishes processing: avoid printing an error if the decode function returns -EAGAIN, as this means that the buffer from CORE is not yet available, but will be at a later time. Also change the log level for calls to vdec_msg_queue_dqbuf() in H264 and VP9 LAT decoder drivers to avoid excessive logging. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: support stateless hevc decoderYunfei Dong2023-05-251-1/+58
| | | | | | | | | | | | Add mediatek hevc decoder linux driver which use the stateless API in MT8195. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: Nathan Hebert <nhebert@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil: add () around 'flag' in macro]
* media: mediatek: vcodec: change lat thread decode error conditionYunfei Dong2023-04-101-2/+4
| | | | | | | | | | | If lat thread can't get lat buffer, it should be that current instance don't be schedulded, the driver can't free the src buffer directly. Fixes: 7b182b8d9c85 ("media: mediatek: vcodec: Refactor get and put capture buffer flow") Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Make MM21 the default capture formatYunfei Dong2023-04-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Given that only the MM21 capture format is supported by userspace tools (like gstreamer and libyuv), make it the default capture format. This allows us to force the MM21 format even when a MM21 and MT21C capable firmware is available (which is needed while dynamic format switching isn't implemented in the driver), without causing the following regressions on v4l2-compliance: fail: v4l2-test-formats.cpp(478): pixelformat 3132544d (MT21) for buftype 9 not reported by ENUM_FMT test VIDIOC_G_FMT: FAIL fail: v4l2-test-formats.cpp(478): pixelformat 3132544d (MT21) for buftype 9 not reported by ENUM_FMT test VIDIOC_TRY_FMT: FAIL fail: v4l2-test-formats.cpp(478): pixelformat 3132544d (MT21) for buftype 9 not reported by ENUM_FMT test VIDIOC_S_FMT: FAIL Fixes: 7501edef6b1f ("media: mediatek: vcodec: Different codec using different capture format") Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: Nicolas F. R. A. Prado <nfraprado@collabora.com> Tested-by: Nicolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Can't set dst buffer to done when lat decode errorYunfei Dong2022-11-251-1/+1
| | | | | | | | | | | Core thread will call v4l2_m2m_buf_done to set dst buffer done for lat architecture. If lat call v4l2_m2m_buf_done_and_job_finish to free dst buffer when lat decode error, core thread will access kernel NULL pointer dereference, then crash. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Fix getting NULL pointer for dst bufferYunfei Dong2022-11-251-4/+7
| | | | | | | | | | | The driver may can't get v4l2 buffer when lat or core decode timeout, will lead to crash when call v4l2_m2m_buf_done to set dst buffer (NULL pointer) done. Fixes: 7b182b8d9c85 ("media: mediatek: vcodec: Refactor get and put capture buffer flow") Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: decoder: Embed framesize inside mtk_video_fmtChen-Yu Tsai2022-07-081-17/+6
| | | | | | | | | | | | | | | | | | | | | Right now the decoder maintains two separate lists for supported pixel formats and frame sizes. Getting the supported frame sizes for the current set format is a bit convoluted, requiring a search through the separate frame size list. The frame sizes are used to clamp and align requested resolutions. Instead, the frame size structure could be embedded inside the pixel format structure. Getting one also gets the other. And since the the driver already keeps pointers to the current set format, getting the frame sizes becomes straightforward. Do just that. Move v4l2_frmsize_stepwise inside mtk_video_fmt, and get rid of mtk_codec_framesizes. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: decoder: Fix 4K frame size enumerationChen-Yu Tsai2022-07-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability"). In this commit, the maximum resolution ended up being a function of both the firmware capability and the current set format. However, frame size enumeration for output (coded) formats should not depend on the format set, but should return supported resolutions for the format requested by userspace. Fix this so that the driver returns the supported resolutions correctly, even if the instance only has default settings, or if the output format is currently set to VP8F, which does not support 4K. This adds an copy of special casing for !VP8 and 4K support. The other existing copy will be removed when .max_{width,height} are removed from |struct mtk_vcodec_ctx| in a subsequent patch. Fixes: b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: decoder: Const-ify stepwise_fhdChen-Yu Tsai2022-07-081-1/+1
| | | | | | | | | | | stepwise_fhd is the reference framesize variable, and should not be altered. Make it constant. Fixes: ("76250b48de79 media: mediatek: vcodec: Getting supported decoder format types") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Support MT8186Yunfei Dong2022-05-131-0/+19
| | | | | | | | | Adds MT8186's compatible "mediatek,mt8186-vcodec-dec". Adds MT8186's device private data mtk_vdec_single_core_pdata. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: support stateless VP9 decodingYunfei Dong2022-05-131-3/+23
| | | | | | | | | | | Add support for VP9 decoding using the stateless API, as supported by MT8192. And the drivers is lat and core architecture. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Signed-off-by: George Sun <george.sun@mediatek.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: support stateless VP8 decodingYunfei Dong2022-05-131-2/+22
| | | | | | | | | | | Add support for VP8 decoding using the stateless API, as supported by MT8192. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Add format to support MT21CYunfei Dong2022-05-131-1/+6
| | | | | | | | | | Needs to use mediatek compressed mode for mt8192 decoder. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Getting supported decoder format typesYunfei Dong2022-05-131-34/+84
| | | | | | | | | | | Getting supported output and capture queue format types according to decoder capability. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Refactor supported vdec formats and framesizesYunfei Dong2022-05-131-6/+7
| | | | | | | | | | | Supported output and capture format types for mt8192 are different with mt8183. Redefine parameters to store them. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Refactor get and put capture buffer flowYunfei Dong2022-05-131-25/+63
| | | | | | | | | | | For lat and core decode in parallel, need to get capture buffer when core start to decode and put capture buffer to display list when core decode done. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: set each plane bytesused in buf prepareYunfei Dong2022-05-131-19/+0
| | | | | | | | | | call vb2_set_plane_payload to set each plane bytesused in buf prepare, need not to set independently for stateless and statefull architectures. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Using firmware type to separate different firmware ↵Yunfei Dong2022-05-131-2/+0
| | | | | | | | | | | | | | | architecture MT8173 platform use vpu firmware, mt8183/mt8192 will use scp firmware instead, using chip name is not reasonable to separate different firmware architecture. Using firmware type is much better. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: Tzung-Bi Shih<tzungbi@google.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: platform: rename mediatek/mtk-jpeg/ to mediatek/jpeg/Mauro Carvalho Chehab2022-03-181-0/+380
As the end goal is to have platform drivers split by vendor, rename mediatek/mtk-jpeg/ to mediatek/jpeg/. Requested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>