Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp585241imm; Fri, 31 Aug 2018 08:03:51 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda0dy1QCMUN0bruFyk7tvczjngi2xSOhYldHHWn5y9Oj/LeMopg3OT/wcxNXVaEnL11U3oK X-Received: by 2002:a65:4043:: with SMTP id h3-v6mr10538900pgp.207.1535727831587; Fri, 31 Aug 2018 08:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535727831; cv=none; d=google.com; s=arc-20160816; b=Xib6ZWtCZ8ITiDkGZEG9LQrrPS7sczwdhw5Sw9zgz8t+N5suCSzD6zYy2HR4FcnfJL jJcJcIS3qR5peM0sYEvWecg1247Yqaks5HvQM1R+6jWiZ97GHjc6Y8EM+89iDZm5pynz j6VRRfIshtNSVjnmWoEoYeZWSRobwY9wk7x99p3GwEY0UTROmib4IoPHLVBaZ8YF5cpm /4JROW/C6EmLx3d17igH66m5OEM/X1CWXmm+5ykfRlWjuTQtlzJNFHZYQLKIWXUluPB2 EfflVd60xuA1RfA85w2wbqWC0UjdiwsanA1nXG6y9ljnsy1I728BgXJExng9q7jM4edg TQww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=TAxJtkFsiwCaD1aHw4vdZFH+sdERvrb7t4YLyggbMnc=; b=KNNFIs12HyJL+iAeVndC+WoEji/e1MMPRnFmEI8AaaKM9hjC37hTUtqneQdxdXhSpc TmmPpAOjhxmcuSNPQpeHo/HagaazBV4l4i8+HRPBRl7Dfl9fWNJlQxCPAaMzL+ibuE30 RWSiATlHhLKIHRt6Z4Oq9BgXjAGKRs/AI9KI3jtFXIugbZPgroAuj2Pa0hSPHCvGp98M I9GA2b1giexVPis4EM0GImfdQVLeF4xi3DUsM4bf4Ja4dfaH8J9DyJIwFCpozWb83Fpk SNOvCcAii+M5zXEp1Yoa1/E8mYDTn48MZCHsYG8mXeWriq6Zc/e+Cz3iMHtimPd6jonC f56Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=LHFx+VwL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5-v6si10636867pfg.90.2018.08.31.08.03.36; Fri, 31 Aug 2018 08:03:51 -0700 (PDT) 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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=LHFx+VwL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728779AbeHaSsl (ORCPT + 99 others); Fri, 31 Aug 2018 14:48:41 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:44524 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727573AbeHaSsk (ORCPT ); Fri, 31 Aug 2018 14:48:40 -0400 Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C901B1A8D; Fri, 31 Aug 2018 16:40:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1535726450; bh=4j1chr/qnHmRgnaCZZnSKXZl9lYKmysazAxTrdbubno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LHFx+VwLaBL9T6JPinYQuGvp37q2qUwQVgYyGRnULKkpGk+I4xgJWYmQ7p8YThl21 WwCYp7O+sjDkK0mVdEBtMPwlq1D766peKLYASu5C9mhyEtXZUIPWsYP8Rkbj63ASvJ 8LTCJ4ipdHfQb9rWWtbILFMyVz7Hivix/bNmgsjA= From: Kieran Bingham To: Laurent Pinchart , mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham Subject: [PATCH 2/6] media: vsp1: Correct the pitch on multiplanar formats Date: Fri, 31 Aug 2018 15:40:40 +0100 Message-Id: <20180831144044.31713-3-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180831144044.31713-1-kieran.bingham+renesas@ideasonboard.com> References: <20180831144044.31713-1-kieran.bingham+renesas@ideasonboard.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DRM pipelines now support tri-planar as well as packed formats with YCbCr, however the pitch calculation was not updated to support this. Correct this by adjusting the bytesperline accordingly when 3 planes are used. Fixes: 7863ac504bc5 ("drm: rcar-du: Add tri-planar memory formats support") Signed-off-by: Kieran Bingham --- drivers/media/platform/vsp1/vsp1_drm.c | 10 ++++++++++ include/media/vsp1.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index b9c0f695d002..b9afd98f6867 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -814,6 +814,16 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index, rpf->format.num_planes = fmtinfo->planes; rpf->format.plane_fmt[0].bytesperline = cfg->pitch; rpf->format.plane_fmt[1].bytesperline = cfg->pitch; + + /* + * Packed YUV formats are subsampled, but the packing of two components + * into a single plane compensates for this leaving the bytesperline + * to be the correct value. For multiplanar formats we must adjust the + * pitch accordingly. + */ + if (fmtinfo->planes == 3) + rpf->format.plane_fmt[1].bytesperline /= fmtinfo->hsub; + rpf->alpha = cfg->alpha; rpf->mem.addr[0] = cfg->mem[0]; diff --git a/include/media/vsp1.h b/include/media/vsp1.h index 3093b9cb9067..0ce19b595cc7 100644 --- a/include/media/vsp1.h +++ b/include/media/vsp1.h @@ -46,7 +46,7 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index, /** * struct vsp1_du_atomic_config - VSP atomic configuration parameters * @pixelformat: plane pixel format (V4L2 4CC) - * @pitch: line pitch in bytes, for all planes + * @pitch: line pitch in bytes * @mem: DMA memory address for each plane of the frame buffer * @src: source rectangle in the frame buffer (integer coordinates) * @dst: destination rectangle on the display (integer coordinates) -- 2.17.1