All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] media: mediatek: vcodec: Use 4K frame size when supported by stateful decoder
@ 2023-03-14 10:22 ` Pin-yen Lin
  0 siblings, 0 replies; 4+ messages in thread
From: Pin-yen Lin @ 2023-03-14 10:22 UTC (permalink / raw)
  To: Tiffany Lin, Andrew-CT Chen, Yunfei Dong, Mauro Carvalho Chehab,
	Matthias Brugger
  Cc: linux-mediatek, linux-media, linux-kernel, Tzung-Bi Shih,
	Hans Verkuil, AngeloGioacchino Del Regno, linux-arm-kernel,
	Chen-Yu Tsai, Pin-yen Lin

After commit b018be06f3c7 ("media: mediatek: vcodec: Read max resolution
from dec_capability"), the stateful video decoder driver never really
sets its output frame size to 4K.

Parse the decoder capability reported by the firmware, and update the
output frame size in mtk_init_vdec_params to enable 4K frame size when
available.

Fixes: b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability")
Signed-off-by: Pin-yen Lin <treapking@chromium.org>

---

Changes in v2:
- Rebase to media_tree/master

 .../mediatek/vcodec/mtk_vcodec_dec_stateful.c        | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c
index 035c86e7809f..29991551cf61 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c
@@ -11,7 +11,7 @@
 #include "mtk_vcodec_dec_pm.h"
 #include "vdec_drv_if.h"
 
-static const struct mtk_video_fmt mtk_video_formats[] = {
+static struct mtk_video_fmt mtk_video_formats[] = {
 	{
 		.fourcc = V4L2_PIX_FMT_H264,
 		.type = MTK_FMT_DEC,
@@ -580,6 +580,16 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx)
 
 static void mtk_init_vdec_params(struct mtk_vcodec_ctx *ctx)
 {
+	unsigned int i;
+
+	if (!(ctx->dev->dec_capability & VCODEC_CAPABILITY_4K_DISABLED)) {
+		for (i = 0; i < num_supported_formats; i++) {
+			mtk_video_formats[i].frmsize.max_width =
+				VCODEC_DEC_4K_CODED_WIDTH;
+			mtk_video_formats[i].frmsize.max_height =
+				VCODEC_DEC_4K_CODED_HEIGHT;
+		}
+	}
 }
 
 static struct vb2_ops mtk_vdec_frame_vb2_ops = {
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] media: mediatek: vcodec: Use 4K frame size when supported by stateful decoder
@ 2023-03-14 10:22 ` Pin-yen Lin
  0 siblings, 0 replies; 4+ messages in thread
From: Pin-yen Lin @ 2023-03-14 10:22 UTC (permalink / raw)
  To: Tiffany Lin, Andrew-CT Chen, Yunfei Dong, Mauro Carvalho Chehab,
	Matthias Brugger
  Cc: linux-mediatek, linux-media, linux-kernel, Tzung-Bi Shih,
	Hans Verkuil, AngeloGioacchino Del Regno, linux-arm-kernel,
	Chen-Yu Tsai, Pin-yen Lin

After commit b018be06f3c7 ("media: mediatek: vcodec: Read max resolution
from dec_capability"), the stateful video decoder driver never really
sets its output frame size to 4K.

Parse the decoder capability reported by the firmware, and update the
output frame size in mtk_init_vdec_params to enable 4K frame size when
available.

Fixes: b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability")
Signed-off-by: Pin-yen Lin <treapking@chromium.org>

---

Changes in v2:
- Rebase to media_tree/master

 .../mediatek/vcodec/mtk_vcodec_dec_stateful.c        | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c
index 035c86e7809f..29991551cf61 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c
@@ -11,7 +11,7 @@
 #include "mtk_vcodec_dec_pm.h"
 #include "vdec_drv_if.h"
 
-static const struct mtk_video_fmt mtk_video_formats[] = {
+static struct mtk_video_fmt mtk_video_formats[] = {
 	{
 		.fourcc = V4L2_PIX_FMT_H264,
 		.type = MTK_FMT_DEC,
@@ -580,6 +580,16 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx)
 
 static void mtk_init_vdec_params(struct mtk_vcodec_ctx *ctx)
 {
+	unsigned int i;
+
+	if (!(ctx->dev->dec_capability & VCODEC_CAPABILITY_4K_DISABLED)) {
+		for (i = 0; i < num_supported_formats; i++) {
+			mtk_video_formats[i].frmsize.max_width =
+				VCODEC_DEC_4K_CODED_WIDTH;
+			mtk_video_formats[i].frmsize.max_height =
+				VCODEC_DEC_4K_CODED_HEIGHT;
+		}
+	}
 }
 
 static struct vb2_ops mtk_vdec_frame_vb2_ops = {
-- 
2.40.0.rc1.284.g88254d51c5-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] media: mediatek: vcodec: Use 4K frame size when supported by stateful decoder
  2023-03-14 10:22 ` Pin-yen Lin
@ 2023-03-14 14:44   ` AngeloGioacchino Del Regno
  -1 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-03-14 14:44 UTC (permalink / raw)
  To: Pin-yen Lin, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Matthias Brugger
  Cc: linux-mediatek, linux-media, linux-kernel, Tzung-Bi Shih,
	Hans Verkuil, linux-arm-kernel, Chen-Yu Tsai

Il 14/03/23 11:22, Pin-yen Lin ha scritto:
> After commit b018be06f3c7 ("media: mediatek: vcodec: Read max resolution
> from dec_capability"), the stateful video decoder driver never really
> sets its output frame size to 4K.
> 
> Parse the decoder capability reported by the firmware, and update the
> output frame size in mtk_init_vdec_params to enable 4K frame size when
> available.
> 
> Fixes: b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability")
> Signed-off-by: Pin-yen Lin <treapking@chromium.org>
> 

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] media: mediatek: vcodec: Use 4K frame size when supported by stateful decoder
@ 2023-03-14 14:44   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-03-14 14:44 UTC (permalink / raw)
  To: Pin-yen Lin, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Matthias Brugger
  Cc: linux-mediatek, linux-media, linux-kernel, Tzung-Bi Shih,
	Hans Verkuil, linux-arm-kernel, Chen-Yu Tsai

Il 14/03/23 11:22, Pin-yen Lin ha scritto:
> After commit b018be06f3c7 ("media: mediatek: vcodec: Read max resolution
> from dec_capability"), the stateful video decoder driver never really
> sets its output frame size to 4K.
> 
> Parse the decoder capability reported by the firmware, and update the
> output frame size in mtk_init_vdec_params to enable 4K frame size when
> available.
> 
> Fixes: b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability")
> Signed-off-by: Pin-yen Lin <treapking@chromium.org>
> 

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-14 14:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 10:22 [PATCH v2] media: mediatek: vcodec: Use 4K frame size when supported by stateful decoder Pin-yen Lin
2023-03-14 10:22 ` Pin-yen Lin
2023-03-14 14:44 ` AngeloGioacchino Del Regno
2023-03-14 14:44   ` AngeloGioacchino Del Regno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.