Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp745051ybh; Sun, 12 Jul 2020 23:10:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE5mvIZ8dNx61V0mOdJUHeOtD40AazFRSU1eCLlCZfUjsJwZqSyWxYgscDUOJZHV7OMZHn X-Received: by 2002:a50:d7c1:: with SMTP id m1mr90968138edj.217.1594620636174; Sun, 12 Jul 2020 23:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594620636; cv=none; d=google.com; s=arc-20160816; b=FNVB/W/7MG3FGWCPC8RDkYyn9g3zs471QVA0nvUjKsFaoqu1rB+7yhtZNV+vzPKeQv 40dcTCHgELHssh5vr5IiKs+cPTdxzgnu7joOmv76t3QINBNnIuDQel9AxW+3mqxGijec WRprY+B7XleZPdkvuW5PaLPkJEl47xubfvWglRVuFmnqnsgnjc+TDfxAGlNb+vNYF/ao SoUdRHpCLORhrE5v4j6u0Q9dVGYEaWYamwQEKESiyrpZceYRZFKuDEHkMX6f3cCFePiB lD66BqTdUc7T6SQzRsrkPJaArIzMHBgMPeKa3QQSc2ngUxdUp7Aj04XefZ46uze0r70B s2rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IcRaprGcacmXEtaZDoYaeITf2CeXezTPgbu/TUwH/wk=; b=rIE27cWPzkjzc8cJ0CzzEFWKOq0cPbP/jTszbSco1F3TybHwPhXglp+vNZ7VAZr8Ms I+krv0Rs0t5NyC2TFnZSNJA/pp9JrvHejxsUQ2obPEWVQm74kclDyiuIb8wBdhYKL1Tq eHI/irCVMFL5l+aWuUSFVm69nUjsZygLLSZ/OMSN4aJ62h2ajhEOPsdLUeqMyZc208Xm eFziLQRaMi1gAmrmaLWvCHmgomT/5LTKVraSkr+0q9oMLyeLD3hP2hOKJY/eSN68EIDx CccvKcC4EAmO4/9k8Wm70N6x5Lm2Q1fizyJoM0exEy9iStf4ztD6EmOX9nOOrrvE2CD7 qt7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Xv7zUAsf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id y19si8030529edv.611.2020.07.12.23.10.13; Sun, 12 Jul 2020 23:10:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Xv7zUAsf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729303AbgGMGJn (ORCPT + 99 others); Mon, 13 Jul 2020 02:09:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729291AbgGMGJl (ORCPT ); Mon, 13 Jul 2020 02:09:41 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC357C08C5DB for ; Sun, 12 Jul 2020 23:09:41 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id cv18so6129091pjb.1 for ; Sun, 12 Jul 2020 23:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IcRaprGcacmXEtaZDoYaeITf2CeXezTPgbu/TUwH/wk=; b=Xv7zUAsfDC9egAaQ0BcClz2WM5+fh3wifI39ifJcxBbpA8Tr/TTSgpzxGJVYLaHGdo qZS7+EpYcY1t9audISeWq7atWgxE/xrCg0TyJ7lHPeGBthUGRHi7HFL9bpI+U1InEbYY CaoAO4AnZl60ZVzFyKYwEMqfAn6E4pgp4A7d8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IcRaprGcacmXEtaZDoYaeITf2CeXezTPgbu/TUwH/wk=; b=ES+670UriRfUEF2Ves5y8NnbixxoM32Qihxw3FBqI8H+9kjJK5awnNRUOYidVaMAvv QdncvcWXKyhYfME64SlvAzzHFIHgMvSLdL5Y54mpJo3Jo0FMkM1HhCkYKbUMqOedeAT1 hBtF4TqtRkOQJ1BHDxW+QePZMi7h+D2o9N6+AJMwqq+7HMSho8JvS8unP/igyT3ylmt1 BlYtm9x5vKoC/Ft3ktqzX51ya8NCan9g6zfBCki9KqsAaVzns4nDeUPr6SN+d8lujZ2g QRSXuzgdmUguqPZ77UgmzrC7KhNHkbDTn/nPXZEf51Z9cUl39IxbFO8yR86zFkdp30QY 1CvA== X-Gm-Message-State: AOAM530yZ3isGYNzRNCRlprOZNmmUnF0H57m2i3Tcqe+lpXS8hvJcD8S LxwwzRK6oX8XtRYl3kmFVnpagg== X-Received: by 2002:a17:902:7484:: with SMTP id h4mr26844856pll.243.1594620581371; Sun, 12 Jul 2020 23:09:41 -0700 (PDT) Received: from acourbot.tok.corp.google.com ([2401:fa00:8f:203:eeb1:d7ff:fe57:b7e5]) by smtp.gmail.com with ESMTPSA id c134sm13134934pfc.115.2020.07.12.23.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2020 23:09:40 -0700 (PDT) From: Alexandre Courbot To: Tiffany Lin , Andrew-CT Chen , Hans Verkuil , Yunfei Dong , Maoguang Meng Cc: linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot Subject: [PATCH v3 10/16] Revert "media: mtk-vcodec: Remove extra area allocation in an input buffer on encoding" Date: Mon, 13 Jul 2020 15:08:36 +0900 Message-Id: <20200713060842.471356-11-acourbot@chromium.org> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog In-Reply-To: <20200713060842.471356-1-acourbot@chromium.org> References: <20200713060842.471356-1-acourbot@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit 81735ecb62f882853a37a8c157407ec4aed44fd0. The hardware needs data to follow the previous alignment, so this extra space was not superfluous after all. Besides, this also made v4l2-compliance's G_FMT and S_FMT tests regress. Signed-off-by: Alexandre Courbot Acked-by: Tiffany Lin --- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 05743a745a11..f2ba19c32400 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -299,12 +299,14 @@ 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; + pix_fmt_mp->width * pix_fmt_mp->height + + ((ALIGN(pix_fmt_mp->width, 16) * 2) * 16); 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; + (pix_fmt_mp->width * pix_fmt_mp->height) / 2 + + (ALIGN(pix_fmt_mp->width, 16) * 16); pix_fmt_mp->plane_fmt[2].sizeimage = 0; pix_fmt_mp->plane_fmt[1].bytesperline = pix_fmt_mp->width; @@ -312,7 +314,8 @@ 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; + (pix_fmt_mp->width * pix_fmt_mp->height) / 4 + + ((ALIGN(pix_fmt_mp->width, 16) / 2) * 16); pix_fmt_mp->plane_fmt[1].bytesperline = pix_fmt_mp->plane_fmt[2].bytesperline = pix_fmt_mp->width / 2; -- 2.27.0.383.g050319c2ae-goog