Enable jpeg enc & dec multi-hardwares for MT8196
Subsystems (4)
cover Enable jpeg enc & dec multi-hardwares for MT8196
This series adds support for mt8196 multi-hardwares jpeg enc & dec, by first adding mt8196 jpegdec and jpegenc compatible to install kernel driver. Add smmu setting to support smmu and iommu at the same time.
Secondly refactor buffer and clock setting to support multi-hw jpeg working.
Lastly, fix some bugs, including resolution change handleing, stop streaming sw flow and others.
This series has been tested with MT8196 tast test. Encoding and decoding worked for this chip.
Patches 1-3 Adds jpeg encoder and decoder compatible. Patches 4 add jpeg smmu sid setting.
Patches 5 fix jpeg hw count setting to support different chips. Patches 6 refactor jpeg buffer payload setting to handle buffer size bug while resolution changed.
Patches 7 reconstruct jpeg dst buffer layout.
Patches 8 fix multi-core stop streaming flow
Patches 9 refactor multi-core clk suspend/resume setting Patches 10 fix decoding buffer number setting timing issue Patches 11 refactor decoding resolution change operation Patches 12 fix remove buffer operation
---
This series patches dependent on:
[1]
https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/
kyrie.wu (12):
dt-bindings: mediatek: Add mediatek, mt8196-jpgdec compatible
dt-bindings: mediatek: Add mediatek, mt8196-jpgenc compatible
media: mediatek: jpeg: add jpeg compatible
media: mediatek: jpeg: add jpeg smmu sid setting
media: mediatek: jpeg: fix jpeg hw count setting
media: mediatek: jpeg: refactor jpeg buffer payload setting
media: mediatek: jpeg: refactor jpeg dst buffer layout
media: mediatek: jpeg: fix stop streaming flow for multi-core
media: mediatek: jpeg: refactor multi-core clk suspend and resume
setting
media: mediatek: jpeg: fix decoding buffer number setting timing issue
media: mediatek: jpeg: refactor decoding resolution change operation
media: mediatek: jpeg: fix remove buffer operation for multi-core
....yaml => mediatek,multi-core-jpegdec.yaml} | 10 +-
....yaml => mediatek,multi-core-jpegenc.yaml} | 10 +-
.../platform/mediatek/jpeg/mtk_jpeg_core.c | 126 ++++++++++++------
.../platform/mediatek/jpeg/mtk_jpeg_core.h | 17 ++-
.../platform/mediatek/jpeg/mtk_jpeg_dec_hw.c | 115 +++++++++++++++-
.../platform/mediatek/jpeg/mtk_jpeg_dec_hw.h | 4 +
.../platform/mediatek/jpeg/mtk_jpeg_enc_hw.c | 112 +++++++++++++++-
.../platform/mediatek/jpeg/mtk_jpeg_enc_hw.h | 4 +
8 files changed, 341 insertions(+), 57 deletions(-)
rename Documentation/devicetree/bindings/media/{mediatek,mt8195-jpegdec.yaml => mediatek,multi-core-jpegdec.yaml} (95%)
rename Documentation/devicetree/bindings/media/{mediatek,mt8195-jpegenc.yaml => mediatek,multi-core-jpegenc.yaml} (94%)Signature · 1 line
2.46.0
PATCH RESEND 1/12 dt-bindings: mediatek: Add mediatek, mt8196-jpgdec compatible
Add mediatek,mt8196-jpgdec compatible to binding document.
---
...5-jpegdec.yaml => mediatek,multi-core-jpegdec.yaml} | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
rename Documentation/devicetree/bindings/media/{mediatek,mt8195-jpegdec.yaml => mediatek,multi-core-jpegdec.yaml} (95%)Documentation/devicetree/bindings/media/mediatek,multi-core-jpegdec.yaml renamed from Documentation/devicetree/bindings/media/mediatek,mt8195-jpegdec.yaml +7 -3
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/media/mediatek,mt8195-jpegdec.yaml# +$id: http://devicetree.org/schemas/media/mediatek,multi-core-jpegdec.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: MediaTek JPEG Decoder
@@ -14,7 +14,9 @@ description: properties: compatible: - const: mediatek,mt8195-jpgdec + enum: + - mediatek,mt8195-jpgdec + - mediatek,mt8196-jpgdec power-domains: maxItems: 1
@@ -44,7 +46,9 @@ patternProperties: properties: compatible: - const: mediatek,mt8195-jpgdec-hw + enum: + - mediatek,mt8195-jpgdec-hw + - mediatek,mt8196-jpgdec-hw reg: maxItems: 1
Signature · 1 line
2.46.0
Re: [RESEND,V1,01/12] dt-bindings: mediatek: Add mediatek, mt8196-jpgdec compatible
Quoted 4 lines · kyrie.wu
Add mediatek,mt8196-jpgdec compatible to binding document.
Signed-off-by kyrie.wu <[email protected]>---
No, why are you resending without improving anything here?
You got comments. Respond to them, implement them, not resend same stuff.
NAK
Best regards,
Krzysztof
Re: [RESEND,V1,01/12] dt-bindings: mediatek: Add mediatek, mt8196-jpgdec compatible
Quoted 12 lines · Krzysztof Kozlowski
External email : Please do not click links or open attachments until you have verified the sender or the content.
Quoted 4 lines · kyrie.wu
Add mediatek,mt8196-jpgdec compatible to binding document.
Signed-off-by kyrie.wu <[email protected]>---
No, why are you resending without improving anything here?
Quoted 7 lines
You got comments. Respond to them, implement them, not resend same stuff.
NAK
Best regards,
Krzysztof
Dear Krzysztof,
Thanks for your kind reminder. I made a mistake in the V1, so I resended it. I will correct all the comments in the V2.
Thank you!
Regards,
Kyrie.
Re: [RESEND,V1,01/12] dt-bindings: mediatek: Add mediatek, mt8196-jpgdec compatible
Quoted 18 lines · Kyrie Wu (吴晗)
Quoted 17 lines · Krzysztof Kozlowski
External email : Please do not click links or open attachments until you have verified the sender or the content.
Quoted 4 lines · kyrie.wu
Add mediatek,mt8196-jpgdec compatible to binding document.
Signed-off-by kyrie.wu <[email protected]>---
No, why are you resending without improving anything here?
You got comments. Respond to them, implement them, not resend same stuff.
NAK
Quoted 7 lines
Quoted 2 lines
Best regards,
KrzysztofDear Krzysztof,
Thanks for your kind reminder. I made a mistake in the V1, so I resended it. I will correct all the comments in the V2.
You got review within 30 minutes on v1. You did not respond and the *next* day (or after some hours) you resent it ignoring that review, so you totally ignored it.
All this was 3 months ago.
Best regards,
Krzysztof
PATCH RESEND 2/12 dt-bindings: mediatek: Add mediatek, mt8196-jpgenc compatible
In reply to kyrie.wuAdd mediatek,mt8196-jpgenc compatible to binding document.
---
...5-jpegenc.yaml => mediatek,multi-core-jpegenc.yaml} | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
rename Documentation/devicetree/bindings/media/{mediatek,mt8195-jpegenc.yaml => mediatek,multi-core-jpegenc.yaml} (94%)Documentation/devicetree/bindings/media/mediatek,multi-core-jpegenc.yaml renamed from Documentation/devicetree/bindings/media/mediatek,mt8195-jpegenc.yaml +7 -3
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/media/mediatek,mt8195-jpegenc.yaml# +$id: http://devicetree.org/schemas/media/mediatek,multi-core-jpegenc.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: MediaTek JPEG Encoder
@@ -14,7 +14,9 @@ description: properties: compatible: - const: mediatek,mt8195-jpgenc + enum: + - mediatek,mt8195-jpgenc + - mediatek,mt8196-jpgenc power-domains: maxItems: 1
@@ -44,7 +46,9 @@ patternProperties: properties: compatible: - const: mediatek,mt8195-jpgenc-hw + enum: + - mediatek,mt8195-jpgenc-hw + - mediatek,mt8196-jpgenc-hw reg: maxItems: 1
Signature · 1 line
2.46.0
PATCH RESEND 3/12 media: mediatek: jpeg: add jpeg compatible
In reply to kyrie.wuAdd jpeg dec and enc compatible for mt8196
--- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 8 ++++++++ drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c | 3 +++ drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c | 3 +++ 3 files changed, 14 insertions(+)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +8 -0
@@ -1996,6 +1996,14 @@ static const struct of_device_id mtk_jpeg_match[] = { .compatible = "mediatek,mt8188-jpgdec", .data = &mtk8188_jpegdec_drvdata, }, + { + .compatible = "mediatek,mt8196-jpgenc", + .data = &mtk8195_jpegenc_drvdata, + }, + { + .compatible = "mediatek,mt8196-jpgdec", + .data = &mtk8195_jpegdec_drvdata, + }, {}, };
drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c +3 -0
@@ -45,6 +45,9 @@ static const struct of_device_id mtk_jpegdec_hw_ids[] = { { .compatible = "mediatek,mt8195-jpgdec-hw", }, + { + .compatible = "mediatek,mt8196-jpgdec-hw", + }, {}, };MODULE_DEVICE_TABLE (of, mtk_jpegdec_hw_ids);
drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c +3 -0
@@ -52,6 +52,9 @@ static const struct of_device_id mtk_jpegenc_drv_ids[] = { { .compatible = "mediatek,mt8195-jpgenc-hw", }, + { + .compatible = "mediatek,mt8196-jpgenc-hw", + }, {}, };MODULE_DEVICE_TABLE (of, mtk_jpegenc_drv_ids);
Signature · 1 line
2.46.0
PATCH RESEND 4/12 media: mediatek: jpeg: add jpeg smmu sid setting
In reply to kyrie.wuAdd a configuration to set jpeg dec & enc smmu sid
--- .../platform/mediatek/jpeg/mtk_jpeg_core.c | 6 ++++ .../platform/mediatek/jpeg/mtk_jpeg_core.h | 11 +++++++ .../platform/mediatek/jpeg/mtk_jpeg_dec_hw.c | 30 +++++++++++++++++-- .../platform/mediatek/jpeg/mtk_jpeg_dec_hw.h | 4 +++ .../platform/mediatek/jpeg/mtk_jpeg_enc_hw.c | 26 ++++++++++++++++ .../platform/mediatek/jpeg/mtk_jpeg_enc_hw.h | 4 +++ 6 files changed, 78 insertions(+), 3 deletions(-)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +6 -0
@@ -1655,6 +1655,9 @@ static void mtk_jpegenc_worker(struct work_struct *work) jpeg_dst_buf->frame_num = ctx->total_frame_num; ctx->total_frame_num++;mtk_jpeg_enc_reset (comp_jpeg[hw_id]->reg_base); +#if IS_ENABLED (CONFIG_ARM_SMMU_V3 ) +mtk_jpeg_enc_set_smmu_sid (hw_id); +#endif mtk_jpeg_set_enc_dst (ctx, comp_jpeg[hw_id]->reg_base, &dst_buf->vb2_buf);
@@ -1771,6 +1774,9 @@ static void mtk_jpegdec_worker(struct work_struct *work)spin_lock_irqsave (&comp_jpeg[hw_id]->hw_lock, flags); ctx->total_frame_num++;mtk_jpeg_dec_reset (comp_jpeg[hw_id]->reg_base); +#if IS_ENABLED (CONFIG_ARM_SMMU_V3 ) +mtk_jpeg_dec_set_smmu_sid (hw_id); +#endif mtk_jpeg_dec_set_config(comp_jpeg[hw_id]->reg_base, jpeg->variant->support_34bit, &jpeg_src_buf->dec_param,
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h +11 -0
@@ -36,6 +36,17 @@#define MTK_JPEG_ADDR_MASK GENMASK(1, 0) +#if IS_ENABLED (CONFIG_ARM_SMMU_V3 ) +#define JPG_REG_CORE0_GUSER_ID 0x380d0000 +#define JPG_REG_CORE1_GUSER_ID 0x388d0000 +#define JPG_REG_GUSER_ID_MASK 0x7 +#define JPG_REG_GUSER_ID_DEC_SID 0x4 +#define JPG_REG_GUSER_ID_ENC_SID 0x5 +#define JPG_REG_DEC_GUSER_ID_SHIFT 8 +#define JPG_REG_ENC_GUSER_ID_SHIFT 4 +#define GUSER_ID_MAPRANGE 4 +#endif +/** * enum mtk_jpeg_ctx_state - states of the context state machine * @MTK_JPEG_INIT: current state is initialized
drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c +27 -3
@@ -274,6 +274,32 @@ void mtk_jpeg_dec_reset(void __iomem *base) }EXPORT_SYMBOL_GPL (mtk_jpeg_dec_reset); +#if IS_ENABLED (CONFIG_ARM_SMMU_V3 ) +void mtk_jpeg_dec_set_smmu_sid (int hwid) +{ +void __iomem *dec_reg_base; +u32 val, mask; + +if (hwid) + dec_reg_base =ioremap (JPG_REG_CORE1_GUSER_ID ,GUSER_ID_MAPRANGE ); +else + dec_reg_base =ioremap (JPG_REG_CORE0_GUSER_ID ,GUSER_ID_MAPRANGE ); +if (!dec_reg_base) { +pr_err ("Failed to map jpgdec JPG_REG_GUSER_ID\n" ); +return ; + } + + val =ioread32 (dec_reg_base); + mask = ~(JPG_REG_GUSER_ID_MASK <<JPG_REG_DEC_GUSER_ID_SHIFT ); + val &= mask; + val |= (JPG_REG_GUSER_ID_DEC_SID <<JPG_REG_DEC_GUSER_ID_SHIFT ); + +iowrite32 (val, dec_reg_base); +iounmap (dec_reg_base); +} +EXPORT_SYMBOL_GPL (mtk_jpeg_dec_set_smmu_sid); +#endif +static void mtk_jpeg_dec_set_brz_factor (void __iomem *base,u8 yscale_w,u8 yscale_h,u8 uvscale_w,u8 uvscale_h) {
@@ -552,7 +578,6 @@ static irqreturn_t mtk_jpegdec_hw_irq_handler(int irq, void *priv)struct vb2_v4l2_buffer *src_buf, *dst_buf;struct mtk_jpeg_src_buf *jpeg_src_buf;enum vb2_buffer_state buf_state; -struct mtk_jpeg_ctx *ctx;u32 dec_irq_ret;u32 irq_status;int i;
@@ -562,7 +587,6 @@ static irqreturn_t mtk_jpegdec_hw_irq_handler(int irq, void *priv)cancel_delayed_work (&jpeg->job_timeout_work); - ctx = jpeg->hw_param.curr_ctx; src_buf = jpeg->hw_param.src_buffer; dst_buf = jpeg->hw_param.dst_buffer;v4l2_m2m_buf_copy_metadata (src_buf, dst_buf, true);
@@ -585,7 +609,7 @@ static irqreturn_t mtk_jpegdec_hw_irq_handler(int irq, void *priv) buf_state =VB2_BUF_STATE_DONE ;v4l2_m2m_buf_done (src_buf, buf_state);mtk_jpegdec_put_buf (jpeg); -pm_runtime_put (ctx->jpeg->dev); +pm_runtime_put (jpeg->dev);clk_disable_unprepare (jpeg->jdec_clk.clks->clk); jpeg->hw_state =MTK_JPEG_HW_IDLE ;
drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.h +4 -0
@@ -79,4 +79,8 @@ void mtk_jpeg_dec_set_config(void __iomem *base,void mtk_jpeg_dec_reset (void __iomem *dec_reg_base);void mtk_jpeg_dec_start (void __iomem *dec_reg_base); +#if IS_ENABLED (CONFIG_ARM_SMMU_V3 ) +void mtk_jpeg_dec_set_smmu_sid (int hwid); +#endif +#endif /* _MTK_JPEG_HW_H */
drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c +26 -0
@@ -67,6 +67,32 @@ void mtk_jpeg_enc_reset(void __iomem *base) }EXPORT_SYMBOL_GPL (mtk_jpeg_enc_reset); +#if IS_ENABLED (CONFIG_ARM_SMMU_V3 ) +void mtk_jpeg_enc_set_smmu_sid (int hwid) +{ +void __iomem *enc_reg_base; +u32 val, mask; + +if (hwid) + enc_reg_base =ioremap (JPG_REG_CORE1_GUSER_ID ,GUSER_ID_MAPRANGE ); +else + enc_reg_base =ioremap (JPG_REG_CORE0_GUSER_ID ,GUSER_ID_MAPRANGE ); +if (!enc_reg_base) { +pr_err ("Failed to map jpgenc JPG_REG_GUSER_ID\n" ); +return ; + } + + val =ioread32 (enc_reg_base); + mask = ~(JPG_REG_GUSER_ID_MASK <<JPG_REG_ENC_GUSER_ID_SHIFT ); + val &= mask; + val |= (JPG_REG_GUSER_ID_ENC_SID <<JPG_REG_ENC_GUSER_ID_SHIFT ); + +iowrite32 (val, enc_reg_base); +iounmap (enc_reg_base); +} +EXPORT_SYMBOL_GPL (mtk_jpeg_enc_set_smmu_sid); +#endif +u32 mtk_jpeg_enc_get_file_size (void __iomem *base,bool support_34bit) {/*
drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.h +4 -0
@@ -93,4 +93,8 @@ void mtk_jpeg_set_enc_dst(struct mtk_jpeg_ctx *ctx, void __iomem *base, struct vb2_buffer *dst_buf);void mtk_jpeg_set_enc_params (struct mtk_jpeg_ctx *ctx,void __iomem *base); +#if IS_ENABLED (CONFIG_ARM_SMMU_V3 ) +void mtk_jpeg_enc_set_smmu_sid (int hwid); +#endif +#endif /* _MTK_JPEG_ENC_HW_H */
Signature · 1 line
2.46.0
PATCH RESEND 5/12 media: mediatek: jpeg: fix jpeg hw count setting
In reply to kyrie.wu1. different IC has different hw core;
2. use a parameter to set jpeg hw count.
--- .../platform/mediatek/jpeg/mtk_jpeg_core.c | 28 +++++++++++++++---- .../platform/mediatek/jpeg/mtk_jpeg_core.h | 2 ++ 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +23 -5
@@ -1468,7 +1468,7 @@ static int mtk_jpegenc_get_hw(struct mtk_jpeg_ctx *ctx)int i;spin_lock_irqsave (&jpeg->hw_lock, flags); -for (i =0 ; i <MTK_JPEGENC_HW_MAX ; i++) { +for (i =0 ; i < jpeg->variant->max_hw_count; i++) { comp_jpeg = jpeg->enc_hw_dev[i];if (comp_jpeg->hw_state ==MTK_JPEG_HW_IDLE ) { hw_id = i;
@@ -1515,7 +1515,7 @@ static int mtk_jpegdec_get_hw(struct mtk_jpeg_ctx *ctx)int i;spin_lock_irqsave (&jpeg->hw_lock, flags); -for (i =0 ; i <MTK_JPEGDEC_HW_MAX ; i++) { +for (i =0 ; i < jpeg->variant->max_hw_count; i++) { comp_jpeg = jpeg->dec_hw_dev[i];if (comp_jpeg->hw_state ==MTK_JPEG_HW_IDLE ) { hw_id = i;
@@ -1598,7 +1598,7 @@ static void mtk_jpegenc_worker(struct work_struct *work) jpeg_work);struct mtk_jpeg_dev *jpeg = ctx->jpeg; -for (i =0 ; i <MTK_JPEGENC_HW_MAX ; i++) +for (i =0 ; i < jpeg->variant->max_hw_count; i++) comp_jpeg[i] = jpeg->enc_hw_dev[i]; i =0 ;
@@ -1696,7 +1696,7 @@ static void mtk_jpegdec_worker(struct work_struct *work)struct mtk_jpeg_fb fb;unsigned long flags; -for (i =0 ; i <MTK_JPEGDEC_HW_MAX ; i++) +for (i =0 ; i < jpeg->variant->max_hw_count; i++) comp_jpeg[i] = jpeg->dec_hw_dev[i]; i =0 ;
@@ -1925,6 +1925,7 @@ static struct mtk_jpeg_variant mtk8195_jpegenc_drvdata = { .out_q_default_fourcc = V4L2_PIX_FMT_YUYV, .cap_q_default_fourcc = V4L2_PIX_FMT_JPEG, .multi_core = true, + .max_hw_count = 2, .jpeg_worker = mtk_jpegenc_worker, };
@@ -1938,6 +1939,21 @@ static const struct mtk_jpeg_variant mtk8195_jpegdec_drvdata = { .out_q_default_fourcc = V4L2_PIX_FMT_JPEG, .cap_q_default_fourcc = V4L2_PIX_FMT_YUV420M, .multi_core = true, + .max_hw_count = 3, + .jpeg_worker = mtk_jpegdec_worker, +}; + +static const struct mtk_jpeg_variant mtk8196_jpegdec_drvdata = { + .formats = mtk_jpeg_dec_formats, + .num_formats =MTK_JPEG_DEC_NUM_FORMATS , + .qops = &mtk_jpeg_dec_qops, + .m2m_ops = &mtk_jpeg_multicore_dec_m2m_ops, + .dev_name ="mtk-jpeg-dec" , + .ioctl_ops = &mtk_jpeg_dec_ioctl_ops, + .out_q_default_fourcc =V4L2_PIX_FMT_JPEG , + .cap_q_default_fourcc =V4L2_PIX_FMT_YUV420M , + .multi_core = true, + .max_hw_count =2 , .jpeg_worker = mtk_jpegdec_worker, };
@@ -1954,6 +1970,7 @@ static const struct mtk_jpeg_variant mtk8188_jpegenc_drvdata = { .ioctl_ops = &mtk_jpeg_enc_ioctl_ops, .out_q_default_fourcc = V4L2_PIX_FMT_YUYV, .cap_q_default_fourcc = V4L2_PIX_FMT_JPEG, + .max_hw_count = 1, .support_34bit = true, };
@@ -1970,6 +1987,7 @@ static const struct mtk_jpeg_variant mtk8188_jpegdec_drvdata = { .ioctl_ops = &mtk_jpeg_dec_ioctl_ops, .out_q_default_fourcc = V4L2_PIX_FMT_JPEG, .cap_q_default_fourcc = V4L2_PIX_FMT_YUV420M, + .max_hw_count = 1, .support_34bit = true, };
@@ -2008,7 +2026,7 @@ static const struct of_device_id mtk_jpeg_match[] = { }, { .compatible = "mediatek,mt8196-jpgdec", - .data = &mtk8195_jpegdec_drvdata, + .data = &mtk8196_jpegdec_drvdata, }, {}, };
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h +2 -0
@@ -74,6 +74,7 @@ enum mtk_jpeg_ctx_state {* @out_q_default_fourcc: output queue default fourcc * @cap_q_default_fourcc: capture queue default fourcc * @multi_core: mark jpeg hw is multi_core or not +* @max_hw_count: jpeg hw-core count * @jpeg_worker: jpeg dec or enc worker * @support_34bit: flag to check if support dma_address 34bit */
@@ -91,6 +92,7 @@ struct mtk_jpeg_variant {u32 out_q_default_fourcc;u32 cap_q_default_fourcc;bool multi_core; +u32 max_hw_count;void (*jpeg_worker)(struct work_struct *work);bool support_34bit; };
Signature · 1 line
2.46.0
PATCH RESEND 6/12 media: mediatek: jpeg: refactor jpeg buffer payload setting
In reply to kyrie.wu1. for multi-core jpegdec:
core0: |<-------- decoding buffer0 and resolution changed to smaller
core1: |<-------- decoding buffer1
core0: |<- handling resolution changing
core0: |<- vb2_set_plane_payload
2. the payload size is changed on the step of set format. Because core1 is running and streaming has not been stopped, the format cannot be set again, resulting in no change in the payload size.
3. at this time, the payload size is bigger than buffer length, it will print a warnning call trace
4. set payload size must less than buffer length
--- .../media/platform/mediatek/jpeg/mtk_jpeg_core.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +11 -3
@@ -719,10 +719,18 @@ static int mtk_jpeg_buf_prepare(struct vb2_buffer *vb) plane_fmt = q_data->pix_mp.plane_fmt[i];if (ctx->enable_exif && q_data->fmt->fourcc ==V4L2_PIX_FMT_JPEG ) -vb2_set_plane_payload (vb, i, plane_fmt.sizeimage + -MTK_JPEG_MAX_EXIF_SIZE ); +if (vb->planes[i].length > (plane_fmt.sizeimage + +MTK_JPEG_MAX_EXIF_SIZE )) +vb2_set_plane_payload (vb, i, plane_fmt.sizeimage + +MTK_JPEG_MAX_EXIF_SIZE ); +else +vb2_set_plane_payload (vb, i, vb->planes[i].length); +else -vb2_set_plane_payload (vb, i, plane_fmt.sizeimage); +if (vb->planes[i].length > plane_fmt.sizeimage) +vb2_set_plane_payload (vb, i, plane_fmt.sizeimage); +else +vb2_set_plane_payload (vb, i, vb->planes[i].length); }return 0 ;
Signature · 1 line
2.46.0
PATCH RESEND 7/12 media: mediatek: jpeg: refactor jpeg dst buffer layout
In reply to kyrie.wu1. change dst buffer size to same as struct mtk_jpeg_src_buf to make sure all params of mtk_jpeg_src_buf could get a memory.
2. For memory alloc operation:
the v4l2 framework malloc a memory, the base addr is vb2_buffer and the size is sizeof(struct mtk_jpeg_src_buf), mtk_jpeg_src_buf could get itself addr by container_of like that:vb2_buffer -> vb2_v4l2_buffer -> mtk_jpeg_src_buf. vb2_v4l2_buffer must keep on the top of mtk_jpeg_src_buf.
--- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 2 +- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +1 -1
@@ -1098,7 +1098,7 @@ static int mtk_jpeg_queue_init(void *priv, struct vb2_queue *src_vq, dst_vq->type =V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ; dst_vq->io_modes =VB2_DMABUF |VB2_MMAP ; dst_vq->drv_priv = ctx; - dst_vq->buf_struct_size =sizeof (struct v4l2_m2m_buffer ); + dst_vq->buf_struct_size =sizeof (struct mtk_jpeg_src_buf ); dst_vq->ops = jpeg->variant->qops; dst_vq->mem_ops = &vb2_dma_contig_memops; dst_vq->timestamp_flags =V4L2_BUF_FLAG_TIMESTAMP_COPY ;
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h +1 -1
@@ -98,10 +98,10 @@ struct mtk_jpeg_variant { };struct mtk_jpeg_src_buf { -u32 frame_num;struct vb2_v4l2_buffer b;struct list_head list;u32 bs_size; +u32 frame_num;struct mtk_jpeg_dec_param dec_param;struct mtk_jpeg_ctx *curr_ctx;
Signature · 1 line
2.46.0
PATCH RESEND 8/12 media: mediatek: jpeg: fix stop streaming flow for multi-core
In reply to kyrie.wu1. For multi-core jpegdec, the all hws may run at the same time, if one hw decoded firstly, the function of mtk_jpeg_dec_stop_streaming would be called, but others input buffers are decoding, this will cause some running buffers to be buffer done, causing errors;
2. add a parameter to calculate the decoding buffer counts, it wil decrease to 0 until the all buffers decoded and the mtk_jpeg_dec_stop_streaming could continue to be executed.
--- .../media/platform/mediatek/jpeg/mtk_jpeg_core.c | 16 ++++++++++++++++ .../media/platform/mediatek/jpeg/mtk_jpeg_core.h | 2 ++ .../platform/mediatek/jpeg/mtk_jpeg_dec_hw.c | 12 ++++++++++++ .../platform/mediatek/jpeg/mtk_jpeg_enc_hw.c | 11 ++++++++++- 4 files changed, 40 insertions(+), 1 deletion(-)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +16 -0
@@ -856,8 +856,12 @@ static struct vb2_v4l2_buffer *mtk_jpeg_buf_remove(struct mtk_jpeg_ctx *ctx,static void mtk_jpeg_enc_stop_streaming (struct vb2_queue *q) {struct mtk_jpeg_ctx *ctx =vb2_get_drv_priv (q); +struct mtk_jpeg_dev *jpeg = ctx->jpeg;struct vb2_v4l2_buffer *vb; +if (jpeg->variant->multi_core) +wait_event (jpeg->hw_wq, (atomic_read (&ctx->buf_list_cnt) ==0 )); +while ((vb =mtk_jpeg_buf_remove (ctx, q->type)))v4l2_m2m_buf_done (vb,VB2_BUF_STATE_ERROR ); }
@@ -865,6 +869,7 @@ static void mtk_jpeg_enc_stop_streaming(struct vb2_queue *q)static void mtk_jpeg_dec_stop_streaming (struct vb2_queue *q) {struct mtk_jpeg_ctx *ctx =vb2_get_drv_priv (q); +struct mtk_jpeg_dev *jpeg = ctx->jpeg;struct vb2_v4l2_buffer *vb;/*
@@ -872,6 +877,9 @@ static void mtk_jpeg_dec_stop_streaming(struct vb2_queue *q)* Before STREAMOFF, we still have to return the old resolution and * subsampling. Update capture queue when the stream is off. */ +if (jpeg->variant->multi_core) +wait_event (jpeg->hw_wq, (atomic_read (&ctx->buf_list_cnt) ==0 )); +if (ctx->state ==MTK_JPEG_SOURCE_CHANGE &&V4L2_TYPE_IS_CAPTURE (q->type)) {struct mtk_jpeg_src_buf *src_buf;
@@ -1181,6 +1189,7 @@ static int mtk_jpeg_open(struct file *file)v4l2_fh_init (&ctx->fh, vfd); file->private_data = &ctx->fh;v4l2_fh_add (&ctx->fh); +atomic_set (&ctx->buf_list_cnt,0 ); ctx->jpeg = jpeg; ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(jpeg->m2m_dev, ctx,
@@ -1563,6 +1572,11 @@ static int mtk_jpegdec_set_hw_param(struct mtk_jpeg_ctx *ctx,return 0 ; } +static void jpeg_buf_queue_inc (struct mtk_jpeg_ctx *ctx) +{ +atomic_inc (&ctx->buf_list_cnt); +} +static irqreturn_t mtk_jpeg_enc_done (struct mtk_jpeg_dev *jpeg) {struct mtk_jpeg_ctx *ctx;
@@ -1674,6 +1688,7 @@ static void mtk_jpegenc_worker(struct work_struct *work) &src_buf->vb2_buf);mtk_jpeg_set_enc_params (ctx, comp_jpeg[hw_id]->reg_base);mtk_jpeg_enc_start (comp_jpeg[hw_id]->reg_base); +jpeg_buf_queue_inc (ctx);v4l2_m2m_job_finish (jpeg->m2m_dev, ctx->fh.m2m_ctx);spin_unlock_irqrestore (&comp_jpeg[hw_id]->hw_lock, flags);
@@ -1792,6 +1807,7 @@ static void mtk_jpegdec_worker(struct work_struct *work) &bs, &fb);mtk_jpeg_dec_start (comp_jpeg[hw_id]->reg_base); +jpeg_buf_queue_inc (ctx);v4l2_m2m_job_finish (jpeg->m2m_dev, ctx->fh.m2m_ctx);spin_unlock_irqrestore (&comp_jpeg[hw_id]->hw_lock, flags);
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h +2 -0
@@ -299,6 +299,7 @@ struct mtk_jpeg_q_data {* @dst_done_queue: encoded frame buffer queue * @done_queue_lock: encoded frame operation spinlock * @last_done_frame_num: the last encoded frame number +* @buf_list_cnt: the frame buffer count own by jpeg driver */ struct mtk_jpeg_ctx {struct mtk_jpeg_dev *jpeg;
@@ -317,6 +318,7 @@ struct mtk_jpeg_ctx {/* spinlock protecting the encode done buffer */ spinlock_t done_queue_lock;u32 last_done_frame_num; + atomic_t buf_list_cnt; };#endif /* _MTK_JPEG_CORE_H */
drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c +12 -0
@@ -550,6 +550,11 @@ static void mtk_jpegdec_put_buf(struct mtk_jpegdec_comp_dev *jpeg)spin_unlock_irqrestore (&ctx->done_queue_lock, flags); } +static void jpeg_buf_queue_dec (struct mtk_jpeg_ctx *ctx) +{ +atomic_dec (&ctx->buf_list_cnt); +} +static void mtk_jpegdec_timeout_work (struct work_struct *work) {enum vb2_buffer_state buf_state =VB2_BUF_STATE_ERROR ;
@@ -558,9 +563,11 @@ static void mtk_jpegdec_timeout_work(struct work_struct *work) job_timeout_work.work);struct mtk_jpeg_dev *master_jpeg = cjpeg->master_dev;struct vb2_v4l2_buffer *src_buf, *dst_buf; +struct mtk_jpeg_ctx *ctx; src_buf = cjpeg->hw_param.src_buffer; dst_buf = cjpeg->hw_param.dst_buffer; + ctx = cjpeg->hw_param.curr_ctx;v4l2_m2m_buf_copy_metadata (src_buf, dst_buf, true);mtk_jpeg_dec_reset (cjpeg->reg_base);
@@ -571,6 +578,7 @@ static void mtk_jpegdec_timeout_work(struct work_struct *work)wake_up (&master_jpeg->hw_wq);v4l2_m2m_buf_done (src_buf, buf_state);mtk_jpegdec_put_buf (cjpeg); +jpeg_buf_queue_dec (ctx); }static irqreturn_t mtk_jpegdec_hw_irq_handler (int irq,void *priv)
@@ -578,12 +586,14 @@ static irqreturn_t mtk_jpegdec_hw_irq_handler(int irq, void *priv)struct vb2_v4l2_buffer *src_buf, *dst_buf;struct mtk_jpeg_src_buf *jpeg_src_buf;enum vb2_buffer_state buf_state; +struct mtk_jpeg_ctx *ctx;u32 dec_irq_ret;u32 irq_status;int i;struct mtk_jpegdec_comp_dev *jpeg = priv;struct mtk_jpeg_dev *master_jpeg = jpeg->master_dev; + ctx = jpeg->hw_param.curr_ctx;cancel_delayed_work (&jpeg->job_timeout_work);
@@ -609,6 +619,8 @@ static irqreturn_t mtk_jpegdec_hw_irq_handler(int irq, void *priv) buf_state =VB2_BUF_STATE_DONE ;v4l2_m2m_buf_done (src_buf, buf_state);mtk_jpegdec_put_buf (jpeg); +jpeg_buf_queue_dec (ctx); +pm_runtime_put (jpeg->dev);clk_disable_unprepare (jpeg->jdec_clk.clks->clk);
drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c +10 -1
@@ -290,6 +290,11 @@ static void mtk_jpegenc_put_buf(struct mtk_jpegenc_comp_dev *jpeg)spin_unlock_irqrestore (&ctx->done_queue_lock, flags); } +static void jpeg_buf_queue_dec (struct mtk_jpeg_ctx *ctx) +{ +atomic_dec (&ctx->buf_list_cnt); +} +static void mtk_jpegenc_timeout_work (struct work_struct *work) {struct delayed_work *dly_work =to_delayed_work (work);
@@ -300,9 +305,11 @@ static void mtk_jpegenc_timeout_work(struct work_struct *work)struct mtk_jpeg_dev *master_jpeg = cjpeg->master_dev;enum vb2_buffer_state buf_state =VB2_BUF_STATE_ERROR ;struct vb2_v4l2_buffer *src_buf, *dst_buf; +struct mtk_jpeg_ctx *ctx; src_buf = cjpeg->hw_param.src_buffer; dst_buf = cjpeg->hw_param.dst_buffer; + ctx = cjpeg->hw_param.curr_ctx;v4l2_m2m_buf_copy_metadata (src_buf, dst_buf, true);mtk_jpeg_enc_reset (cjpeg->reg_base);
@@ -313,6 +320,7 @@ static void mtk_jpegenc_timeout_work(struct work_struct *work)wake_up (&master_jpeg->hw_wq);v4l2_m2m_buf_done (src_buf, buf_state);mtk_jpegenc_put_buf (cjpeg); +jpeg_buf_queue_dec (ctx); }static irqreturn_t mtk_jpegenc_hw_irq_handler (int irq,void *priv)
@@ -346,7 +354,8 @@ static irqreturn_t mtk_jpegenc_hw_irq_handler(int irq, void *priv) buf_state =VB2_BUF_STATE_DONE ;v4l2_m2m_buf_done (src_buf, buf_state);mtk_jpegenc_put_buf (jpeg); -pm_runtime_put (ctx->jpeg->dev); +jpeg_buf_queue_dec (ctx); +pm_runtime_put (jpeg->dev);clk_disable_unprepare (jpeg->venc_clk.clks->clk); jpeg->hw_state =MTK_JPEG_HW_IDLE ;
Signature · 1 line
2.46.0
PATCH RESEND 9/12 media: mediatek: jpeg: refactor multi-core clk suspend and resume setting
In reply to kyrie.wurefactor jpeg clk suspend and resume setting for multi-core
--- .../platform/mediatek/jpeg/mtk_jpeg_core.c | 28 +++---- .../platform/mediatek/jpeg/mtk_jpeg_dec_hw.c | 75 +++++++++++++++++-- .../platform/mediatek/jpeg/mtk_jpeg_enc_hw.c | 73 +++++++++++++++++- 3 files changed, 147 insertions(+), 29 deletions(-)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +9 -19
@@ -1121,6 +1121,9 @@ static void mtk_jpeg_clk_on(struct mtk_jpeg_dev *jpeg) {int ret; +if (jpeg->variant->multi_core) +return ; + ret =clk_bulk_prepare_enable (jpeg->variant->num_clks, jpeg->variant->clks);if (ret)
@@ -1129,6 +1132,9 @@ static void mtk_jpeg_clk_on(struct mtk_jpeg_dev *jpeg)static void mtk_jpeg_clk_off (struct mtk_jpeg_dev *jpeg) { +if (jpeg->variant->multi_core) +return ; +clk_bulk_disable_unprepare (jpeg->variant->num_clks, jpeg->variant->clks); }
@@ -1658,13 +1664,6 @@ static void mtk_jpegenc_worker(struct work_struct *work) goto enc_end; } - ret =clk_prepare_enable (comp_jpeg[hw_id]->venc_clk.clks->clk); -if (ret) { -dev_err (jpeg->dev,"%s : %d, jpegenc clk_prepare_enable fail\n" , - __func__, __LINE__); - goto enc_end; - } -v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx);v4l2_m2m_dst_buf_remove (ctx->fh.m2m_ctx);
@@ -1765,20 +1764,13 @@ static void mtk_jpegdec_worker(struct work_struct *work) jpeg_dst_buf->frame_num = ctx->total_frame_num;mtk_jpegdec_set_hw_param (ctx, hw_id, src_buf, dst_buf); - ret =pm_runtime_get_sync (comp_jpeg[hw_id]->dev); + ret =pm_runtime_resume_and_get (comp_jpeg[hw_id]->dev);if (ret <0 ) {dev_err (jpeg->dev,"%s : %d, pm_runtime_get_sync fail !!!\n" , __func__, __LINE__); goto dec_end; } - ret =clk_prepare_enable (comp_jpeg[hw_id]->jdec_clk.clks->clk); -if (ret) { -dev_err (jpeg->dev,"%s : %d, jpegdec clk_prepare_enable fail\n" , - __func__, __LINE__); - goto clk_end; - } -v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx);v4l2_m2m_dst_buf_remove (ctx->fh.m2m_ctx);
@@ -1788,7 +1780,7 @@ static void mtk_jpegdec_worker(struct work_struct *work) &dst_buf->vb2_buf, &fb)) {dev_err (jpeg->dev,"%s : %d, mtk_jpeg_set_dec_dst fail\n" , __func__, __LINE__); - goto setdst_end; + goto set_dst_fail; } schedule_delayed_work(&comp_jpeg[hw_id]->job_timeout_work,
@@ -1813,9 +1805,7 @@ static void mtk_jpegdec_worker(struct work_struct *work)return ; -setdst_end: -clk_disable_unprepare (comp_jpeg[hw_id]->jdec_clk.clks->clk); -clk_end: +set_dst_fail:pm_runtime_put (comp_jpeg[hw_id]->dev); dec_end:v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx);
drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c +69 -6
111 lines not on this page · raw message
drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c +69 -4
110 lines not on this page · raw message
Signature · 1 line
2.46.0
PATCH RESEND 10/12 media: mediatek: jpeg: fix decoding buffer number setting timing issue
In reply to kyrie.wumove decoding buffer increase code into spinlock
protecting aera for multi-core
--- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 9 +++------ drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c | 1 + drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c | 1 + 3 files changed, 5 insertions(+), 6 deletions(-)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +3 -6
@@ -1749,7 +1749,6 @@ static void mtk_jpegdec_worker(struct work_struct *work)v4l2_m2m_buf_copy_metadata (src_buf, dst_buf, true); jpeg_src_buf =mtk_jpeg_vb2_to_srcbuf (&src_buf->vb2_buf); - jpeg_dst_buf =mtk_jpeg_vb2_to_srcbuf (&dst_buf->vb2_buf);if (mtk_jpeg_check_resolution_change (ctx, &jpeg_src_buf->dec_param)) {
@@ -1758,11 +1757,6 @@ static void mtk_jpegdec_worker(struct work_struct *work) goto getbuf_fail; } - jpeg_src_buf->curr_ctx = ctx; - jpeg_src_buf->frame_num = ctx->total_frame_num; - jpeg_dst_buf->curr_ctx = ctx; - jpeg_dst_buf->frame_num = ctx->total_frame_num; -mtk_jpegdec_set_hw_param (ctx, hw_id, src_buf, dst_buf); ret =pm_runtime_resume_and_get (comp_jpeg[hw_id]->dev);if (ret <0 ) {
@@ -1787,6 +1781,9 @@ static void mtk_jpegdec_worker(struct work_struct *work) msecs_to_jiffies(MTK_JPEG_HW_TIMEOUT_MSEC));spin_lock_irqsave (&comp_jpeg[hw_id]->hw_lock, flags); + jpeg_dst_buf =mtk_jpeg_vb2_to_srcbuf (&dst_buf->vb2_buf); + jpeg_dst_buf->curr_ctx = ctx; + jpeg_dst_buf->frame_num = ctx->total_frame_num; ctx->total_frame_num++;mtk_jpeg_dec_reset (comp_jpeg[hw_id]->reg_base);#if IS_ENABLED (CONFIG_ARM_SMMU_V3 )
drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c +1 -0
@@ -544,6 +544,7 @@ static void mtk_jpegdec_put_buf(struct mtk_jpegdec_comp_dev *jpeg)v4l2_m2m_buf_done (&tmp_dst_done_buf->b,VB2_BUF_STATE_DONE ); ctx->last_done_frame_num++; +break ; } } }
drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c +1 -0
@@ -284,6 +284,7 @@ static void mtk_jpegenc_put_buf(struct mtk_jpegenc_comp_dev *jpeg)v4l2_m2m_buf_done (&tmp_dst_done_buf->b,VB2_BUF_STATE_DONE ); ctx->last_done_frame_num++; +break ; } } }
Signature · 1 line
2.46.0
PATCH RESEND 11/12 media: mediatek: jpeg: refactor decoding resolution change operation
In reply to kyrie.wuFor multi-core:
1.if there are only two src buffers, hw0 and hw1 are decoding at the same time. When resolution change occurred on one hw, the src buffer cannot be got in the stop streaming function, which will cause a crash.
2.When a resolution change occurs, immediately set the new resolution parameter to save the new resolution;
3.After a resolution change occurred, decoding should not continue, needs to wait until new buffers are ready and the state machine changed.
--- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +7 -2
@@ -886,7 +886,8 @@ static void mtk_jpeg_dec_stop_streaming(struct vb2_queue *q) vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); src_buf =mtk_jpeg_vb2_to_srcbuf (&vb->vb2_buf); -mtk_jpeg_set_queue_data (ctx, &src_buf->dec_param); +if (!IS_ERR_OR_NULL (src_buf)) +mtk_jpeg_set_queue_data (ctx, &src_buf->dec_param); ctx->state =MTK_JPEG_RUNNING ; }else if (V4L2_TYPE_IS_OUTPUT (q->type)) { ctx->state =MTK_JPEG_INIT ;
@@ -1752,11 +1753,15 @@ static void mtk_jpegdec_worker(struct work_struct *work)if (mtk_jpeg_check_resolution_change (ctx, &jpeg_src_buf->dec_param)) { -mtk_jpeg_queue_src_chg_event (ctx); +mtk_jpeg_set_queue_data (ctx, &jpeg_src_buf->dec_param); ctx->state =MTK_JPEG_SOURCE_CHANGE ; +mtk_jpeg_queue_src_chg_event (ctx); goto getbuf_fail; } +if (ctx->state ==MTK_JPEG_SOURCE_CHANGE ) + goto getbuf_fail; +mtk_jpegdec_set_hw_param (ctx, hw_id, src_buf, dst_buf); ret =pm_runtime_resume_and_get (comp_jpeg[hw_id]->dev);if (ret <0 ) {
Signature · 1 line
2.46.0
PATCH RESEND 12/12 media: mediatek: jpeg: fix remove buffer operation for multi-core
In reply to kyrie.wumove remove buffer code to spinlock protect area for multi-core
--- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +4 -6
@@ -1665,9 +1665,6 @@ static void mtk_jpegenc_worker(struct work_struct *work) goto enc_end; } -v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx); -v4l2_m2m_dst_buf_remove (ctx->fh.m2m_ctx); -schedule_delayed_work (&comp_jpeg[hw_id]->job_timeout_work,msecs_to_jiffies (MTK_JPEG_HW_TIMEOUT_MSEC ));
@@ -1688,6 +1685,8 @@ static void mtk_jpegenc_worker(struct work_struct *work) &src_buf->vb2_buf);mtk_jpeg_set_enc_params (ctx, comp_jpeg[hw_id]->reg_base);mtk_jpeg_enc_start (comp_jpeg[hw_id]->reg_base); +v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx); +v4l2_m2m_dst_buf_remove (ctx->fh.m2m_ctx);jpeg_buf_queue_inc (ctx);v4l2_m2m_job_finish (jpeg->m2m_dev, ctx->fh.m2m_ctx);spin_unlock_irqrestore (&comp_jpeg[hw_id]->hw_lock, flags);
@@ -1770,9 +1769,6 @@ static void mtk_jpegdec_worker(struct work_struct *work) goto dec_end; } -v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx); -v4l2_m2m_dst_buf_remove (ctx->fh.m2m_ctx); -mtk_jpeg_set_dec_src (ctx, &src_buf->vb2_buf, &bs); if (mtk_jpeg_set_dec_dst(ctx, &jpeg_src_buf->dec_param,
@@ -1800,6 +1796,8 @@ static void mtk_jpegdec_worker(struct work_struct *work) jpeg_src_buf->bs_size, &bs, &fb); +v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx); +v4l2_m2m_dst_buf_remove (ctx->fh.m2m_ctx);mtk_jpeg_dec_start (comp_jpeg[hw_id]->reg_base);jpeg_buf_queue_inc (ctx);v4l2_m2m_job_finish (jpeg->m2m_dev, ctx->fh.m2m_ctx);
Signature · 1 line
2.46.0