All of lore.kernel.org
 help / color / mirror / Atom feed
From: Enric Balletbo Serra <eballetbo@gmail.com>
To: Alexandre Courbot <acourbot@chromium.org>
Cc: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	Yunfei Dong <yunfei.dong@mediatek.com>,
	Tiffany Lin <tiffany.lin@mediatek.com>,
	Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"moderated list:ARM/Mediatek SoC support" 
	<linux-mediatek@lists.infradead.org>,
	Hsin-Yi Wang <hsinyi@chromium.org>
Subject: Re: [PATCH v5 05/14] media: mtk-vcodec: venc: support START and STOP commands
Date: Tue, 6 Jul 2021 17:17:10 +0200	[thread overview]
Message-ID: <CAFqH_50PAEzH5_LT+aQusGUos7BGYATjx1qYVq2O5UYYkkNW2A@mail.gmail.com> (raw)
In-Reply-To: <CAPBb6MV35sJ-LY8w-nhpnndRHtJXapSN63xFzUiAbYQFLvm1dQ@mail.gmail.com>

Hi Dafna and Alex,

Now in text format, sorry for the noise.

Missatge de Alexandre Courbot <acourbot@chromium.org> del dia dl., 5
de jul. 2021 a les 7:05:
>
> Hi Dafna, sorry for (again) taking so long to come back to this! >_<
>
> On Fri, May 28, 2021 at 4:03 PM Dafna Hirschfeld
> <dafna.hirschfeld@collabora.com> wrote:
> >
> > Hi,
> >
> > I applied this patchset and tested the stateful encoder on debian with the command:
> >
> > [gst-master] root@debian:~/gst-build# gst-launch-1.0 filesrc location=images/jelly-800-640.YU12 ! rawvideoparse width=800 height=640 format=i420 ! videoconvert ! v4l2h264enc ! h264parse ! mp4mux ! filesink location=jelly-800-640.mp4
> >
> > I get:
> >
> > Setting pipeline[   79.703879] [MTK_V4L2] level=0 fops_vcodec_open(),190: encoder capability 10000000
> >   to PAUSED ...
> > Pipeline is PREROLLING ...
> > Redistribute latency...
> > [   80.621076] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.631232] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.640878] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.650766] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.660430] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.670194] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.680967] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.691376] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.701718] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.712106] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.722272] [MTK_V4L2] level=0 mtk_venc_set_param(),371: fmt 0x3, P/L 0/0, w/h 800/640, buf 800/640, fps/bps 25/4000000, gop 0, i_period 0
> > Pipeline is PREROLLED ...
> > Setting pipeline to PLAYING ...
> > New clock: GstSystemClock
> > [   81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0!
> > [   81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed
> > [   81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219: venc_if_encode failed=-5
> > [   82.974746] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0!
> > [   82.987392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed
> > [   82.994471] [MTK_V4L2][ERROR] mtk_venc_worker:1219: venc_if_encode failed=-5
> > [  104.163977] cros-ec-dev cros-ec-dev.2.auto: Some logs may have been dropped...
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > ^Chandling interrupt.
> >
> > And then the streaming hangs. The same error happens without this patchset, but without
> > this patchset the statful encoder does not support V4L2_ENC_CMD_STOP/START needed by the spec.
> > I am not sure what cause the error and wether those mtk-iommu erros has to do with that. The issue
> > could also come from the mtk-vpu used by the encoder.
> > Do you have any idea where this can come from?
>
> Mmm, this looks like the firmware is unhappy about something and
> hangs. I wonder if the IOMMU messages above could not be linked to
> that, I remember seeing similar problems when the buffers were not
> properly synced on the device side.
>
> I'll try and see if I can deploy gstreamer on the old MT8173
> Chromebook I am using to see if I have more success here, but no
> guarantee I can test in the same conditions as you unfortunately. :/
>
> The MTK folks are the most qualified to look into this issue though.
> Yunfei, do you have any idea about why this is happening?
>

Pending to test with the Dafna's environment. but looks like this
draft fix [1] (already under discussion in gerrit) needs to be applied
to mainline in order to have vcodec working. At least I am able to use
it now.

See https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2251840

diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c
b/drivers/media/platform/mtk-vpu/mtk_vpu.c
index c8a56271b259..af71fcf6fbae 100644
--- a/drivers/media/platform/mtk-vpu/mtk_vpu.c
+++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c
@@ -316,6 +316,7 @@ int vpu_ipi_send(struct platform_device *pdev,
 {
        struct mtk_vpu *vpu = platform_get_drvdata(pdev);
        struct share_obj __iomem *send_obj = vpu->send_buf;
+       unsigned char data[SHARE_BUF_SIZE];
        unsigned long timeout;
        int ret = 0;

@@ -349,7 +350,10 @@ int vpu_ipi_send(struct platform_device *pdev,
                }
        } while (vpu_cfg_readl(vpu, HOST_TO_VPU));

-       memcpy_toio(send_obj->share_buf, buf, len);
+       //memcpy_toio(send_obj->share_buf, buf, len);
+       memset(data, 0, sizeof(data));
+       memcpy(data, buf, len);
+       memcpy_toio(send_obj->share_buf, data, sizeof(data));
        writel(len, &send_obj->len);
        writel(id, &send_obj->id);

Thanks,
  Enric



>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID
From: Enric Balletbo Serra <eballetbo@gmail.com>
To: Alexandre Courbot <acourbot@chromium.org>
Cc: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	Yunfei Dong <yunfei.dong@mediatek.com>,
	 Tiffany Lin <tiffany.lin@mediatek.com>,
	Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	 Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Linux Media Mailing List <linux-media@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	 "moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	Hsin-Yi Wang <hsinyi@chromium.org>
Subject: Re: [PATCH v5 05/14] media: mtk-vcodec: venc: support START and STOP commands
Date: Tue, 6 Jul 2021 17:17:10 +0200	[thread overview]
Message-ID: <CAFqH_50PAEzH5_LT+aQusGUos7BGYATjx1qYVq2O5UYYkkNW2A@mail.gmail.com> (raw)
In-Reply-To: <CAPBb6MV35sJ-LY8w-nhpnndRHtJXapSN63xFzUiAbYQFLvm1dQ@mail.gmail.com>

Hi Dafna and Alex,

Now in text format, sorry for the noise.

Missatge de Alexandre Courbot <acourbot@chromium.org> del dia dl., 5
de jul. 2021 a les 7:05:
>
> Hi Dafna, sorry for (again) taking so long to come back to this! >_<
>
> On Fri, May 28, 2021 at 4:03 PM Dafna Hirschfeld
> <dafna.hirschfeld@collabora.com> wrote:
> >
> > Hi,
> >
> > I applied this patchset and tested the stateful encoder on debian with the command:
> >
> > [gst-master] root@debian:~/gst-build# gst-launch-1.0 filesrc location=images/jelly-800-640.YU12 ! rawvideoparse width=800 height=640 format=i420 ! videoconvert ! v4l2h264enc ! h264parse ! mp4mux ! filesink location=jelly-800-640.mp4
> >
> > I get:
> >
> > Setting pipeline[   79.703879] [MTK_V4L2] level=0 fops_vcodec_open(),190: encoder capability 10000000
> >   to PAUSED ...
> > Pipeline is PREROLLING ...
> > Redistribute latency...
> > [   80.621076] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.631232] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.640878] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.650766] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.660430] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.670194] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.680967] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.691376] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.701718] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.712106] mtk-iommu 10205000.iommu: Partial TLB flush timed out, falling back to full flush
> > [   80.722272] [MTK_V4L2] level=0 mtk_venc_set_param(),371: fmt 0x3, P/L 0/0, w/h 800/640, buf 800/640, fps/bps 25/4000000, gop 0, i_period 0
> > Pipeline is PREROLLED ...
> > Setting pipeline to PLAYING ...
> > New clock: GstSystemClock
> > [   81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0!
> > [   81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed
> > [   81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219: venc_if_encode failed=-5
> > [   82.974746] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0!
> > [   82.987392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed
> > [   82.994471] [MTK_V4L2][ERROR] mtk_venc_worker:1219: venc_if_encode failed=-5
> > [  104.163977] cros-ec-dev cros-ec-dev.2.auto: Some logs may have been dropped...
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > 0:00:00.4 / 99:99:99.
> > ^Chandling interrupt.
> >
> > And then the streaming hangs. The same error happens without this patchset, but without
> > this patchset the statful encoder does not support V4L2_ENC_CMD_STOP/START needed by the spec.
> > I am not sure what cause the error and wether those mtk-iommu erros has to do with that. The issue
> > could also come from the mtk-vpu used by the encoder.
> > Do you have any idea where this can come from?
>
> Mmm, this looks like the firmware is unhappy about something and
> hangs. I wonder if the IOMMU messages above could not be linked to
> that, I remember seeing similar problems when the buffers were not
> properly synced on the device side.
>
> I'll try and see if I can deploy gstreamer on the old MT8173
> Chromebook I am using to see if I have more success here, but no
> guarantee I can test in the same conditions as you unfortunately. :/
>
> The MTK folks are the most qualified to look into this issue though.
> Yunfei, do you have any idea about why this is happening?
>

Pending to test with the Dafna's environment. but looks like this
draft fix [1] (already under discussion in gerrit) needs to be applied
to mainline in order to have vcodec working. At least I am able to use
it now.

See https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2251840

diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c
b/drivers/media/platform/mtk-vpu/mtk_vpu.c
index c8a56271b259..af71fcf6fbae 100644
--- a/drivers/media/platform/mtk-vpu/mtk_vpu.c
+++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c
@@ -316,6 +316,7 @@ int vpu_ipi_send(struct platform_device *pdev,
 {
        struct mtk_vpu *vpu = platform_get_drvdata(pdev);
        struct share_obj __iomem *send_obj = vpu->send_buf;
+       unsigned char data[SHARE_BUF_SIZE];
        unsigned long timeout;
        int ret = 0;

@@ -349,7 +350,10 @@ int vpu_ipi_send(struct platform_device *pdev,
                }
        } while (vpu_cfg_readl(vpu, HOST_TO_VPU));

-       memcpy_toio(send_obj->share_buf, buf, len);
+       //memcpy_toio(send_obj->share_buf, buf, len);
+       memset(data, 0, sizeof(data));
+       memcpy(data, buf, len);
+       memcpy_toio(send_obj->share_buf, data, sizeof(data));
        writel(len, &send_obj->len);
        writel(id, &send_obj->id);

Thanks,
  Enric



>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  reply	other threads:[~2021-07-06 15:17 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 14:29 [PATCH v5 00/14] media: mtk-vcodec: support for MT8183 decoder Alexandre Courbot
2021-05-19 14:29 ` Alexandre Courbot
2021-05-19 14:29 ` [PATCH v5 01/14] media: mtk-vcodec: vdec: Support H264 profile control Alexandre Courbot
2021-05-19 14:29   ` Alexandre Courbot
2021-05-21 13:36   ` Tzung-Bi Shih
2021-05-21 13:36     ` Tzung-Bi Shih
2021-05-19 14:29 ` [PATCH v5 02/14] media: mtk-vcodec: vdec: use helpers in VIDIOC_(TRY_)DECODER_CMD Alexandre Courbot
2021-05-19 14:29   ` Alexandre Courbot
2021-05-21 13:37   ` Tzung-Bi Shih
2021-05-21 13:37     ` Tzung-Bi Shih
2021-05-19 14:30 ` [PATCH v5 03/14] media: mtk-vcodec: vdec: clamp OUTPUT resolution to hardware limits Alexandre Courbot
2021-05-19 14:30   ` Alexandre Courbot
2021-05-21 13:37   ` Tzung-Bi Shih
2021-05-21 13:37     ` Tzung-Bi Shih
2021-05-19 14:30 ` [PATCH v5 04/14] media: mtk-vcodec: make flush buffer reusable by encoder Alexandre Courbot
2021-05-19 14:30   ` Alexandre Courbot
2021-05-21 13:37   ` Tzung-Bi Shih
2021-05-21 13:37     ` Tzung-Bi Shih
2021-05-19 14:30 ` [PATCH v5 05/14] media: mtk-vcodec: venc: support START and STOP commands Alexandre Courbot
2021-05-19 14:30   ` Alexandre Courbot
2021-05-21 13:37   ` Tzung-Bi Shih
2021-05-21 13:37     ` Tzung-Bi Shih
2021-05-27 10:10     ` Alexandre Courbot
2021-05-27 10:10       ` Alexandre Courbot
2021-05-28  7:03   ` Dafna Hirschfeld
2021-05-28  7:03     ` Dafna Hirschfeld
2021-05-28  7:43     ` Dafna Hirschfeld
2021-05-28  7:43       ` Dafna Hirschfeld
2021-07-05  5:04       ` Alexandre Courbot
2021-07-05  5:04         ` Alexandre Courbot
2021-07-05  5:04     ` Alexandre Courbot
2021-07-05  5:04       ` Alexandre Courbot
2021-07-06 15:17       ` Enric Balletbo Serra [this message]
2021-07-06 15:17         ` Enric Balletbo Serra
2021-05-19 14:30 ` [PATCH v5 06/14] media: mtk-vcodec: vdec: move stateful ops into their own file Alexandre Courbot
2021-05-19 14:30   ` Alexandre Courbot
2021-05-21 13:37   ` Tzung-Bi Shih
2021-05-21 13:37     ` Tzung-Bi Shih
2021-05-27 10:10     ` Alexandre Courbot
2021-05-27 10:10       ` Alexandre Courbot
2021-05-19 14:30 ` [PATCH v5 07/14] media: mtk-vcodec: vdec: handle firmware version field Alexandre Courbot
2021-05-19 14:30   ` Alexandre Courbot
2021-05-21 13:37   ` Tzung-Bi Shih
2021-05-21 13:37     ` Tzung-Bi Shih
2021-05-19 14:30 ` [PATCH v5 08/14] media: mtk-vcodec: support version 2 of decoder firmware ABI Alexandre Courbot
2021-05-19 14:30   ` Alexandre Courbot
2021-05-21 13:37   ` Tzung-Bi Shih
2021-05-21 13:37     ` Tzung-Bi Shih
2021-05-19 14:30 ` [PATCH v5 09/14] media: add Mediatek's MM21 format Alexandre Courbot
2021-05-19 14:30   ` Alexandre Courbot
2021-05-21 13:37   ` Tzung-Bi Shih
2021-05-21 13:37     ` Tzung-Bi Shih
2021-05-19 14:30 ` [PATCH v5 10/14] media: mtk-vcodec: vdec: support stateless API Alexandre Courbot
2021-05-19 14:30   ` Alexandre Courbot
2021-05-21 13:38   ` Tzung-Bi Shih
2021-05-21 13:38     ` Tzung-Bi Shih
2021-05-19 14:30 ` [PATCH v5 11/14] media: mtk-vcodec: vdec: support stateless H.264 decoding Alexandre Courbot
2021-05-19 14:30   ` Alexandre Courbot
2021-05-21 13:38   ` Tzung-Bi Shih
2021-05-21 13:38     ` Tzung-Bi Shih
2021-05-27 10:10     ` Alexandre Courbot
2021-05-27 10:10       ` Alexandre Courbot
2021-05-19 14:30 ` [PATCH v5 12/14] media: mtk-vcodec: vdec: add media device if using stateless api Alexandre Courbot
2021-05-19 14:30   ` Alexandre Courbot
2021-05-21 13:38   ` Tzung-Bi Shih
2021-05-21 13:38     ` Tzung-Bi Shih
2021-05-19 14:30 ` [PATCH v5 13/14] dt-bindings: media: document mediatek,mt8183-vcodec-dec Alexandre Courbot
2021-05-19 14:30   ` [PATCH v5 13/14] dt-bindings: media: document mediatek, mt8183-vcodec-dec Alexandre Courbot
2021-05-19 14:30 ` [PATCH v5 14/14] media: mtk-vcodec: enable MT8183 decoder Alexandre Courbot
2021-05-19 14:30   ` Alexandre Courbot
2021-05-21 13:38   ` Tzung-Bi Shih
2021-05-21 13:38     ` Tzung-Bi Shih
2021-05-27  8:08 ` [PATCH v5 00/14] media: mtk-vcodec: support for " Hans Verkuil
2021-05-27  8:08   ` Hans Verkuil
2021-05-27 10:10   ` Alexandre Courbot
2021-05-27 10:10     ` Alexandre Courbot
2021-05-27 10:18     ` Hans Verkuil
2021-05-27 10:18       ` Hans Verkuil

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=CAFqH_50PAEzH5_LT+aQusGUos7BGYATjx1qYVq2O5UYYkkNW2A@mail.gmail.com \
    --to=eballetbo@gmail.com \
    --cc=acourbot@chromium.org \
    --cc=andrew-ct.chen@mediatek.com \
    --cc=dafna.hirschfeld@collabora.com \
    --cc=hsinyi@chromium.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=tiffany.lin@mediatek.com \
    --cc=yunfei.dong@mediatek.com \
    --subject='Re: [PATCH v5 05/14] media: mtk-vcodec: venc: support START and STOP commands' \
    /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

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.