Message ID | 20240521095536.3869399-1-fshao@chromium.org |
---|---|
State | New |
Headers | show |
Series | media: mediatek: vcodec: Reduce msg queue trans buffer size | expand |
Le mardi 21 mai 2024 à 17:54 +0800, Fei Shao a écrit : > In the MediaTek HW vcodec pipeline, the `trans` buffer is used to > transfer the data decoded by the lat decoder to the core decoder. > > In the beginning, 6MB and 30MB were allocated for the trans buffer to > handle FHD and higher-resolution contents respectively, but it turns out > that's more than enough in practice and there's room for improvement. > > The buffer sizes were reduced to 5MB / 8MB respectively and the decoders > have been validated to work normally on the MediaTek Android products. > It's time to adopt that change in the upstream MediaTek vcodec driver. > > Reduce the msg queue trans buffer size to 5MB / 8MB respectively to > optimize the memory usage per decoder instance and improve the overall > system performance. I don't disagree with the change, but it feels like this is has hack over a hack. We have an entropy decoder (LAT) metadata buffer, which of course is resolution dependent, for which we hardcore two sizes. Any chance Mediatek can document this blob, or at least document the proper relation between the size and the resolution ? This way we could dynamically size the buffer for the chosen resolution and trust it to remain big enough for a long time. Removing the non scientific claim of "have been validated", which is producible for anyone hitting issue with that change in the future. Nicolas > > Signed-off-by: Fei Shao <fshao@chromium.org> > > CC: Yunfei Dong <yunfei.dong@mediatek.com> > > --- > I consulted Yunfei and he confirmed that these are the sizes they are > using today. > > .../media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c > index f283c4703dc6..e36741179a97 100644 > --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c > +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c > @@ -29,9 +29,9 @@ > static int vde_msg_queue_get_trans_size(int width, int height) > { > if (width > 1920 || height > 1088) > - return 30 * SZ_1M; > + return 8 * SZ_1M; > else > - return 6 * SZ_1M; > + return 5 * SZ_1M; > } > > void vdec_msg_queue_init_ctx(struct vdec_msg_queue_ctx *ctx, int hardware_index)
On Fri, May 31, 2024 at 8:47 PM Nicolas Dufresne <nicolas.dufresne@collabora.com> wrote: > > Le mardi 21 mai 2024 à 17:54 +0800, Fei Shao a écrit : > > In the MediaTek HW vcodec pipeline, the `trans` buffer is used to > > transfer the data decoded by the lat decoder to the core decoder. > > > > In the beginning, 6MB and 30MB were allocated for the trans buffer to > > handle FHD and higher-resolution contents respectively, but it turns out > > that's more than enough in practice and there's room for improvement. > > > > The buffer sizes were reduced to 5MB / 8MB respectively and the decoders > > have been validated to work normally on the MediaTek Android products. > > It's time to adopt that change in the upstream MediaTek vcodec driver. > > > > Reduce the msg queue trans buffer size to 5MB / 8MB respectively to > > optimize the memory usage per decoder instance and improve the overall > > system performance. > > I don't disagree with the change, but it feels like this is has hack over a > hack. We have an entropy decoder (LAT) metadata buffer, which of course is > resolution dependent, for which we hardcore two sizes. > > Any chance Mediatek can document this blob, or at least document the proper > relation between the size and the resolution ? This way we could dynamically > size the buffer for the chosen resolution and trust it to remain big enough for > a long time. Removing the non scientific claim of "have been validated", which > is producible for anyone hitting issue with that change in the future. > > Nicolas > Sorry for the delayed reply. I totally agree with your point, but last time I was told these are what they are using internally so I guess it's not there... or it could be me that didn't ask the right question (we want to do this with finer granularity or dynamically). If we don't get an answer here, I can also bring this up to MediaTek next time and see if they can provide more details. Regards, Fei
Hi Sebastian,
On Thu, Aug 22, 2024 at 10:24 PM Sebastian Fricke
<sebastian.fricke@collabora.com> wrote:
> So are you going to send a new version for this?
Sorry for the delayed response.
Not likely in a short period. I haven't had a more detailed discussion
with MediaTek about their buffer requirements on this.
I'll resend a new version after I have a better picture of a more
dynamic implementation based on the resolution size.
Feel free to archive or ignore this patch as needed.
Thanks,
Fei
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c index f283c4703dc6..e36741179a97 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c @@ -29,9 +29,9 @@ static int vde_msg_queue_get_trans_size(int width, int height) { if (width > 1920 || height > 1088) - return 30 * SZ_1M; + return 8 * SZ_1M; else - return 6 * SZ_1M; + return 5 * SZ_1M; } void vdec_msg_queue_init_ctx(struct vdec_msg_queue_ctx *ctx, int hardware_index)
In the MediaTek HW vcodec pipeline, the `trans` buffer is used to transfer the data decoded by the lat decoder to the core decoder. In the beginning, 6MB and 30MB were allocated for the trans buffer to handle FHD and higher-resolution contents respectively, but it turns out that's more than enough in practice and there's room for improvement. The buffer sizes were reduced to 5MB / 8MB respectively and the decoders have been validated to work normally on the MediaTek Android products. It's time to adopt that change in the upstream MediaTek vcodec driver. Reduce the msg queue trans buffer size to 5MB / 8MB respectively to optimize the memory usage per decoder instance and improve the overall system performance. Signed-off-by: Fei Shao <fshao@chromium.org> CC: Yunfei Dong <yunfei.dong@mediatek.com> --- I consulted Yunfei and he confirmed that these are the sizes they are using today. .../media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)