Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1419033pxb; Fri, 10 Sep 2021 05:38:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsX3gBwRQkhLXcFxGE+9B7dWmYM/ZNi8i0txw6iyBA/TQljzJK0zljnAngR08ZJz6xSNfz X-Received: by 2002:a02:2402:: with SMTP id f2mr4300730jaa.28.1631277528466; Fri, 10 Sep 2021 05:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631277528; cv=none; d=google.com; s=arc-20160816; b=CPmBg9opsMacQ2rw+zAt2JheeYYNhNctPsNaZ8x8XPP6ceYuL0AM9ZAUacLDj3YvIX HoTCdQOxF9SyFPmUiCWH/u5rlhOdNrlCYWYJ/bbXw9B1W1ASUqqu8F7LTs2v1qdQpoZx 5c0shIJIvu+rBGICkE7VqEqm/DslXKVNxbDWZ27G5C3HNq3FfqHWplA+JJyCK6lhCsqZ zIUbE3bCvljBHxrdgoWOFR23ajGhbdQ73VYZrWSgFWz8jHBq2V/oVZ8H9apG4Vle4Ove 1cxr4I1O1TecIw1CLL70qJ2AOxvST9ZL9lzsBGhPaqRTYA186g1QNgq+6L2oZ0mh0iOB Dgew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QwUFH287rIspq61XaF+pIMEDFR8zB9KrFlriw13Mcvo=; b=czPAQ07aQhphuFwMROotUMaqn610NZfo9Oeh8HIq66q9qbdunnFxROrtlrgQyLUe+h CZ4+8uwOD1RPyUq3eJ/NHMOWzS731Kbiil+dOs1GenmEGuRhZhqVgnDilxW2dKT8mo2B rssdolRY1qEvbx3PDNAzrthamZZEVoIKrz+SmYS2Aok5biW4sHYDCiMZFfqbUFmjsVCf ft7XIQBHVGp2teY+M16c5HibBevJLGSdH6lfwCfda61/m03XwWFWfD4ng1nt5RAn7jTa eqgVXDvvL8xusHuCjWWh+DIyGzAX1Yo5GZC23vwNUXc16ANa2ZeAIYUwrD3JNYTL/pvI hP6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Snj8xRIU; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h33si5052283jav.17.2021.09.10.05.38.36; Fri, 10 Sep 2021 05:38:48 -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=@linuxfoundation.org header.s=korg header.b=Snj8xRIU; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234964AbhIJMhr (ORCPT + 99 others); Fri, 10 Sep 2021 08:37:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:55272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234550AbhIJMgP (ORCPT ); Fri, 10 Sep 2021 08:36:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 41C2161207; Fri, 10 Sep 2021 12:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631277304; bh=9kJQP3kDazEVJswsuuU6kyZ7aIsHLDddyN3en8ooMZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Snj8xRIUpV14/O5gqTlW/K3QPgKfBBBegyjpzTDQoODujNhPskfK2Z6LLtc5PoGr5 7k7pJqtCyY9VhGJU31ybf/RN3EFDAYjlxa6HknO/Z18iBEqs21TmVuwiiOB1J3w+0v mapRSv8o5TsLxpfWT/gZVc8PxJfwNg4wvfS04lq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Halasa , Philipp Zabel , Sasha Levin Subject: [PATCH 5.4 08/37] gpu: ipu-v3: Fix i.MX IPU-v3 offset calculations for (semi)planar U/V formats Date: Fri, 10 Sep 2021 14:30:11 +0200 Message-Id: <20210910122917.446770697@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210910122917.149278545@linuxfoundation.org> References: <20210910122917.149278545@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof HaƂasa [ Upstream commit 7cca7c8096e2c8a4149405438329b5035d0744f0 ] Video captured in 1400x1050 resolution (bytesperline aka stride = 1408 bytes) is invalid. Fix it. Signed-off-by: Krzysztof Halasa Link: https://lore.kernel.org/r/m3y2bmq7a4.fsf@t19.piap.pl [p.zabel@pengutronix.de: added "gpu: ipu-v3:" prefix to commit description] Signed-off-by: Philipp Zabel Signed-off-by: Sasha Levin --- drivers/gpu/ipu-v3/ipu-cpmem.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-cpmem.c b/drivers/gpu/ipu-v3/ipu-cpmem.c index a1c85d1521f5..82b244cb313e 100644 --- a/drivers/gpu/ipu-v3/ipu-cpmem.c +++ b/drivers/gpu/ipu-v3/ipu-cpmem.c @@ -585,21 +585,21 @@ static const struct ipu_rgb def_bgra_16 = { .bits_per_pixel = 16, }; -#define Y_OFFSET(pix, x, y) ((x) + pix->width * (y)) -#define U_OFFSET(pix, x, y) ((pix->width * pix->height) + \ - (pix->width * ((y) / 2) / 2) + (x) / 2) -#define V_OFFSET(pix, x, y) ((pix->width * pix->height) + \ - (pix->width * pix->height / 4) + \ - (pix->width * ((y) / 2) / 2) + (x) / 2) -#define U2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ - (pix->width * (y) / 2) + (x) / 2) -#define V2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ - (pix->width * pix->height / 2) + \ - (pix->width * (y) / 2) + (x) / 2) -#define UV_OFFSET(pix, x, y) ((pix->width * pix->height) + \ - (pix->width * ((y) / 2)) + (x)) -#define UV2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ - (pix->width * y) + (x)) +#define Y_OFFSET(pix, x, y) ((x) + pix->bytesperline * (y)) +#define U_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ + (pix->bytesperline * ((y) / 2) / 2) + (x) / 2) +#define V_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ + (pix->bytesperline * pix->height / 4) + \ + (pix->bytesperline * ((y) / 2) / 2) + (x) / 2) +#define U2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ + (pix->bytesperline * (y) / 2) + (x) / 2) +#define V2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ + (pix->bytesperline * pix->height / 2) + \ + (pix->bytesperline * (y) / 2) + (x) / 2) +#define UV_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ + (pix->bytesperline * ((y) / 2)) + (x)) +#define UV2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ + (pix->bytesperline * y) + (x)) #define NUM_ALPHA_CHANNELS 7 -- 2.30.2