From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEC81C433F5 for ; Wed, 3 Nov 2021 18:18:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 987CB61053 for ; Wed, 3 Nov 2021 18:18:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 987CB61053 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D9C8D73E5C; Wed, 3 Nov 2021 18:18:08 +0000 (UTC) Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 754E273E5C for ; Wed, 3 Nov 2021 18:18:07 +0000 (UTC) Received: by mail-io1-xd2b.google.com with SMTP id 2so587897iou.1 for ; Wed, 03 Nov 2021 11:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=O23yy0XNaLc0R410pYr/V33NeRlDl1su4/qTlADNJK0=; b=PmBMPAJMTJSzmZXAokQHOShr6T/x9odJ/mnPDhQPtu0T6DHU7qEVZ2d+NnBxFu2cSE EhRJmGI8N+/LE8ZNSh+n2bA8+Ux9UvMkyX68sz9/yHWeVKwHBKZOwQcn2/Uxjz1UUDuV H55yzHltcvoNicqIJr5fchzCbTGwoZxKAoyC1XkPKrT2GWPHyrnq+RdGM4ErHU9LLf0Q 79f0VeCtpYCHVVdvAhB0LLIJyKtJ1jAEZPtGuagY2nKL4anpRljWUSef4GMm+g7foEuY lr3iHGQNPYus41MMK/2slkqUBB7A4FN8Uaq5pkWNvbX54Cu6mIfQJ261M0jK1PFy5dLG bwHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=O23yy0XNaLc0R410pYr/V33NeRlDl1su4/qTlADNJK0=; b=WCxn4Rrfy2lbg969ueMyeatw+fNSqlPTNQ/v9tmITY8bpRskbCnYf6NxulIvLSagkP 8uzekQhSKcu438HSZo5ZstT5CjUEqTN0uATaLq2Kv7XRlXnUlo88nhmnksOuVfCba/lX rY+6EA0KonygFrDbOgiDYn6kcQt+xk4U07mvexPYS5En29OqTHQEPViHUbznTagnCWaH TnDvlwlF4EVgItmgz8nE7xEpCX7ufCunOVc52SWxB+5m1N/8D64kLhty26HsP7rSqFcu 6DtAhUIDFThoOtMrgAZldhQBvztbtgziCu+YmQ5Q2naN4RLUVFW2zCRFrWtdwgjZj1Il C9yg== X-Gm-Message-State: AOAM531lID+UG/T2OJA6hvWXBKxip050yMxidGS5l5SdYHpHny1xQH+r DKvW/OpPhBtJky24AhoyMxTYH+O1Ch5iNwS2HqwRgg== X-Google-Smtp-Source: ABdhPJzHbA7Bu2iKENsPydeGCqpNqdobu5r4ToGJSw9CwhawlRaQTsxDl3byqGQ9csTexqO7E7esD0HRWGe9sAqxpLc= X-Received: by 2002:a05:6602:19a:: with SMTP id m26mr15046938ioo.162.1635963486488; Wed, 03 Nov 2021 11:18:06 -0700 (PDT) MIME-Version: 1.0 References: <20211103033708.14469-1-yunfei.dong@mediatek.com> In-Reply-To: From: Steve Cho Date: Wed, 3 Nov 2021 11:17:30 -0700 Message-ID: Subject: Re: [PATCH v2] media: mtk-vcodec: Align width and height to 64 bytes To: Nicolas Dufresne Content-Type: multipart/alternative; boundary="0000000000007aad9405cfe66e78" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew-CT Chen , Dafna Hirschfeld , Yunfei Dong , dri-devel , Irui Wang , Tiffany Lin , Benjamin Gaignard , Project_Global_Chrome_Upstream_Group@mediatek.com, Fritz Koenig , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Tzung-Bi Shih , Tomasz Figa , Rob Herring , linux-mediatek@lists.infradead.org, Hsin-Yi Wang , Matthias Brugger , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, Alexandre Courbot , srv_heupstream@mediatek.com, linux-kernel@vger.kernel.org, Hans Verkuil Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --0000000000007aad9405cfe66e78 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you Yunfei for the update. Looks good to me. As mentioned earlier, I tested to verify that this fix resolved the corruption issue on Kukui. Tested-by: Steve Cho Thanks, Steve On Wed, Nov 3, 2021 at 8:23 AM Nicolas Dufresne wrote: > Le mercredi 03 novembre 2021 =C3=A0 11:37 +0800, Yunfei Dong a =C3=A9crit= : > > Width and height need to 64 bytes aligned when setting the format. > > Need to make sure all is 64 bytes align when use width and height to > > calculate buffer size. > > > > Signed-off-by: Yunfei Dong > > Change-Id: I39886b1a6b433c92565ddbf297eb193456eec1d2 > > Perhaps avoid this tag later ? Another perhaps, there is a tag to indicat= e > which > patch introduce that bug, if you add this tag, the patch will be > automatically > backported into relevant stable kernel. The format is: > > > Fixes: (" > Acked-by: Nicolas Dufresne > > > --- > > drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h | 1 + > > drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c | 4 ++-- > > 2 files changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h > b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h > > index e30806c1faea..66cd6d2242c3 100644 > > --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h > > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h > > @@ -11,6 +11,7 @@ > > #include > > #include > > > > +#define VCODEC_DEC_ALIGNED_64 64 > > #define VCODEC_CAPABILITY_4K_DISABLED 0x10 > > #define VCODEC_DEC_4K_CODED_WIDTH 4096U > > #define VCODEC_DEC_4K_CODED_HEIGHT 2304U > > diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c > b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c > > index d402fc4bda69..e1a3011772a9 100644 > > --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c > > +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c > > @@ -562,8 +562,8 @@ static void get_pic_info(struct vdec_h264_slice_ins= t > *inst, > > { > > struct mtk_vcodec_ctx *ctx =3D inst->ctx; > > > > - ctx->picinfo.buf_w =3D (ctx->picinfo.pic_w + 15) & 0xFFFFFFF0; > > - ctx->picinfo.buf_h =3D (ctx->picinfo.pic_h + 31) & 0xFFFFFFE0; > > + ctx->picinfo.buf_w =3D ALIGN(ctx->picinfo.pic_w, > VCODEC_DEC_ALIGNED_64); > > + ctx->picinfo.buf_h =3D ALIGN(ctx->picinfo.pic_h, > VCODEC_DEC_ALIGNED_64); > > ctx->picinfo.fb_sz[0] =3D ctx->picinfo.buf_w * ctx->picinfo.buf_h= ; > > ctx->picinfo.fb_sz[1] =3D ctx->picinfo.fb_sz[0] >> 1; > > inst->vsi_ctx.dec.cap_num_planes =3D > > --0000000000007aad9405cfe66e78 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you Yunfei for the update. Looks good to me.=C2= =A0
As mentioned earlier, I tested to verify that this fix resolv= ed the=C2=A0corruption issue on Kukui.

Tested-by: Steve= Cho <stevecho@chromium.org= >

Thanks,
Steve
=

On Wed, Nov 3, 2021 at 8:23 AM Nicolas Dufresne <= ;nicolas@ndufresne.ca> wrote= :
Le mercredi 03= novembre 2021 =C3=A0 11:37 +0800, Yunfei Dong a =C3=A9crit=C2=A0:
> Width and height need to 64 bytes aligned when setting the format.
> Need to make sure all is 64 bytes align when use width and height to > calculate buffer size.
>
> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> Change-Id: I39886b1a6b433c92565ddbf297eb193456eec1d2

Perhaps avoid this tag later ? Another perhaps, there is a tag to indicate = which
patch introduce that bug, if you add this tag, the patch will be automatica= lly
backported into relevant stable kernel. The format is:

> Fixes: <short-hash> ("<short commit description")
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> ---
>=C2=A0 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h=C2=A0 =C2=A0 = =C2=A0 =C2=A0 | 1 +
>=C2=A0 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c | 4 ++= --
>=C2=A0 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h b/driv= ers/media/platform/mtk-vcodec/mtk_vcodec_dec.h
> index e30806c1faea..66cd6d2242c3 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h
> @@ -11,6 +11,7 @@
>=C2=A0 #include <media/videobuf2-core.h>
>=C2=A0 #include <media/v4l2-mem2mem.h>
>=C2=A0
> +#define VCODEC_DEC_ALIGNED_64 64
>=C2=A0 #define VCODEC_CAPABILITY_4K_DISABLED=C2=A0 =C2=A0 =C2=A0 =C2=A0= 0x10
>=C2=A0 #define VCODEC_DEC_4K_CODED_WIDTH=C2=A0 =C2=A0 4096U
>=C2=A0 #define VCODEC_DEC_4K_CODED_HEIGHT=C2=A0 =C2=A02304U
> diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c= b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
> index d402fc4bda69..e1a3011772a9 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
> +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
> @@ -562,8 +562,8 @@ static void get_pic_info(struct vdec_h264_slice_in= st *inst,
>=C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0struct mtk_vcodec_ctx *ctx =3D inst->ctx;=
>=C2=A0
> -=C2=A0 =C2=A0 =C2=A0ctx->picinfo.buf_w =3D (ctx->picinfo.pic_w = + 15) & 0xFFFFFFF0;
> -=C2=A0 =C2=A0 =C2=A0ctx->picinfo.buf_h =3D (ctx->picinfo.pic_h = + 31) & 0xFFFFFFE0;
> +=C2=A0 =C2=A0 =C2=A0ctx->picinfo.buf_w =3D ALIGN(ctx->picinfo.p= ic_w, VCODEC_DEC_ALIGNED_64);
> +=C2=A0 =C2=A0 =C2=A0ctx->picinfo.buf_h =3D ALIGN(ctx->picinfo.p= ic_h, VCODEC_DEC_ALIGNED_64);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0ctx->picinfo.fb_sz[0] =3D ctx->picinfo= .buf_w * ctx->picinfo.buf_h;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0ctx->picinfo.fb_sz[1] =3D ctx->picinfo= .fb_sz[0] >> 1;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0inst->vsi_ctx.dec.cap_num_planes =3D

--0000000000007aad9405cfe66e78--