Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp415903ybx; Wed, 6 Nov 2019 19:42:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwevXJKkRvZzWU4VULzsPiQzyEw6J+rYyjH/TMa32VGw1WGaeyyCPpYqOv+5nST0ZQGQwje X-Received: by 2002:a17:907:205b:: with SMTP id pg27mr990038ejb.144.1573098164564; Wed, 06 Nov 2019 19:42:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573098164; cv=none; d=google.com; s=arc-20160816; b=ZUr6CzSXxT41kinqBDHyZMOvhvMEfSVTL2s6kH2ZgfQQyhsQHdrT44Z/DNWDI0Toeg yWXogMlZ8S+9AmN0v8xpy8pGqAfn/HrlommH7gZnNCNWnl+OotCG+GHPBJ4kzh48o2qj O5kmoUWQi9RsKPVFNYNjfOVbWKRRqx8hWaE2izY/+i/t5ewJWLVI2SElvIML8C5B5Wwa 4eapjgPcwFGtNtZr04LlAUsRNlWf7lcRVC6T7jZW8PxQ9WCBGG0iQZsqBeGy/p+K/KwF mY1XioAxaiGNAruEzJGWEgvToyHGD+uLFQpGmw7PSRhRsSbK5E2n323oc4wpiYW396jM II9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4QNlRTLGQr37mhizIFRLl8TgY9SBjAFUyhyF2JeZyVA=; b=jOj7AzSuPTocs1uUG/fss/N1I4W8f/FjT5u2BI2HdY0kwlyJr8FKYcsy8t/rWWLluA WLVM/IsLAil6HIZqpXwWlsqh3SCgBbCJkRy1G2vD7ZQ9pMYfV3K7pjKTt3A1jd2z1i1Z IDbibspV1bRGBLyTF5ng6OFPlb2W1VRaPPSuivzsaCAEoIkOVHpiLX+wyWkOC0ubRcww 8KSaPUx6wN3e7HoMekY4zaoFYgrorewGeLWIgPvZ8u/WnSLkzVh6NWfTAPPB3vSoxXO1 K2lqA/CpoM1uagLDtsyE7J1kDxY5xasqPMRudqIkxW6nxtJc+kKzZqHRKydQ0NG54JD7 BkGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Bz3+znqk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g13si482065eda.292.2019.11.06.19.42.20; Wed, 06 Nov 2019 19:42:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Bz3+znqk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733129AbfKGDj2 (ORCPT + 99 others); Wed, 6 Nov 2019 22:39:28 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:41640 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727751AbfKGDj1 (ORCPT ); Wed, 6 Nov 2019 22:39:27 -0500 Received: by mail-ed1-f67.google.com with SMTP id a21so671807edj.8 for ; Wed, 06 Nov 2019 19:39:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4QNlRTLGQr37mhizIFRLl8TgY9SBjAFUyhyF2JeZyVA=; b=Bz3+znqk7TnIZHoZzBYIEZeHa1gUhSjnWdchWVDNXV5CRRegeHogkTvHi39lad8Gde +AMSXXKWIiBiFwAEAJKqT1UDffdQSrskvm9w+5o8hjOGVEeFLYyCKwhNOZyaJyOHlMmF 97U6Blkq786w6QCPKD5KWleQKeLEKx/N//Po8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4QNlRTLGQr37mhizIFRLl8TgY9SBjAFUyhyF2JeZyVA=; b=K221PG1k2kIExPgNZRebqBgU/JzAaB6aoZjzM0CaKjHit0JqbTM8zhuPPQdE0qQPa3 hGwYoW3MwhGrfQ9fp8lrrIsxz4ijsHPw6QS12PQc+FYMGMgLGnC4MMSfMF0orIAPOu9a o65X/lV8fxFv11ZQFIZs9iW/lIJB5qil8ARIUpuPU83WCu0hiy7TlVuSqk0yylOLvffX MR/nisPJdNieBLgEBBWqHn2BiHwQptGPU0wfsuDwb6YXUAPlbRsC9bwmZgONbItTnIyt 4q4FoOdUSQYRl22t1vTDrfFUYrEfvgxA6MS8dlwlFMhU02VO7EfJu+/0zHZNgTFloMeC TG9w== X-Gm-Message-State: APjAAAXtTxeytiDR+5O4gWcSKNa90lpEBwHh7w39uxcAdoUnhuEhgPxZ CoNvxYgaXcrvSa5bnAFmLG78k/xmZPFfBw== X-Received: by 2002:a17:906:448:: with SMTP id e8mr979839eja.326.1573097965040; Wed, 06 Nov 2019 19:39:25 -0800 (PST) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com. [209.85.128.52]) by smtp.gmail.com with ESMTPSA id z4sm22518edx.7.2019.11.06.19.39.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Nov 2019 19:39:24 -0800 (PST) Received: by mail-wm1-f52.google.com with SMTP id t26so743319wmi.4 for ; Wed, 06 Nov 2019 19:39:24 -0800 (PST) X-Received: by 2002:a7b:cbd9:: with SMTP id n25mr816484wmi.64.1573097963552; Wed, 06 Nov 2019 19:39:23 -0800 (PST) MIME-Version: 1.0 References: <20191107033057.238603-1-hiroh@chromium.org> In-Reply-To: <20191107033057.238603-1-hiroh@chromium.org> From: Tomasz Figa Date: Thu, 7 Nov 2019 12:39:12 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] media: mtk-vcodec: Remove extra area allocation in an input buffer on encoding To: Hirokazu Honda Cc: Linux Media Mailing List , "moderated list:ARM/Mediatek SoC support" , Mauro Carvalho Chehab , =?UTF-8?B?VGlmZmFueSBMaW4gKOael+aFp+ePiik=?= , Alexandre Courbot , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 7, 2019 at 12:31 PM Hirokazu Honda wrote: > > MediaTek encoder allocates non pixel data area for an input buffer every > plane. As the input buffer should be read-only, the driver should not write > anything in the buffer. Therefore, the extra data should be unnecessary. > > Signed-off-by: Hirokazu Honda > --- > drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c > index fd8de027e83e..6aad53d97d74 100644 > --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c > @@ -332,14 +332,12 @@ static int vidioc_try_fmt(struct v4l2_format *f, > > pix_fmt_mp->num_planes = fmt->num_planes; > pix_fmt_mp->plane_fmt[0].sizeimage = > - pix_fmt_mp->width * pix_fmt_mp->height + > - ((ALIGN(pix_fmt_mp->width, 16) * 2) * 16); > + pix_fmt_mp->width * pix_fmt_mp->height; > pix_fmt_mp->plane_fmt[0].bytesperline = pix_fmt_mp->width; > > if (pix_fmt_mp->num_planes == 2) { > pix_fmt_mp->plane_fmt[1].sizeimage = > - (pix_fmt_mp->width * pix_fmt_mp->height) / 2 + > - (ALIGN(pix_fmt_mp->width, 16) * 16); > + (pix_fmt_mp->width * pix_fmt_mp->height) / 2; > pix_fmt_mp->plane_fmt[2].sizeimage = 0; > pix_fmt_mp->plane_fmt[1].bytesperline = > pix_fmt_mp->width; > @@ -347,8 +345,7 @@ static int vidioc_try_fmt(struct v4l2_format *f, > } else if (pix_fmt_mp->num_planes == 3) { > pix_fmt_mp->plane_fmt[1].sizeimage = > pix_fmt_mp->plane_fmt[2].sizeimage = > - (pix_fmt_mp->width * pix_fmt_mp->height) / 4 + > - ((ALIGN(pix_fmt_mp->width, 16) / 2) * 16); > + (pix_fmt_mp->width * pix_fmt_mp->height) / 4; > pix_fmt_mp->plane_fmt[1].bytesperline = > pix_fmt_mp->plane_fmt[2].bytesperline = > pix_fmt_mp->width / 2; > -- > 2.24.0.rc1.363.gb1bccd3e3d-goog > Thanks for the patch! Reviewed-by: Tomasz Figa Now I'd also appreciate if there is anyone who could help testing this further, especially on a platform that is not a Chromebook. Best regards, Tomasz