Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp715970imm; Fri, 31 Aug 2018 11:14:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbI2F5C89uhrTDk/RhQrioXw9Co5dTzpHUYOCxO82d9DX6nsiCwXPTlewUZSUk8ZAkTgEA0 X-Received: by 2002:a62:9cd7:: with SMTP id u84-v6mr17108906pfk.90.1535739271016; Fri, 31 Aug 2018 11:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535739270; cv=none; d=google.com; s=arc-20160816; b=vXHLpaoVxfHthd1IWlF9ZvQHuVWH+YnQ/O2BsCzFrDpxdfqLI4b/P6Y8yd9QJZR5jd hfBVoaHrXAZkzZU6DGWFAypbrHpNIkRzIAH+CmYSCr5fcBL+kaETbPgSncT407JSIdf9 Le87yArkMYii5mJl5YZa1fFF7zIVauFR/kecRhSTDmubjvmgzHt04sThohJng/Ug7FD+ Gu+A6ilGNoG3x5zjE+IhyKJkJ4WAdvMHbQrFLa8/nxEAxEc/H4AJ4b9u3Pg2oRT/ETPB no5RgLHKW7RF+8VgirWZy101kXFO4cPMP5BSF4NZ7+FtqYxf5HwV0XATTEsWbiHOVjQS fdUQ== 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=UATc+TtxArXYLeEZ4jvGxyrBHlSlAbk0eN3jUQ/VAR4=; b=LK9tfAvPqwcNJ2/97R7JuEa+05zuiX4KukadR+1gH14CKpRTGP1Fy7yrmhF7vlobm1 6GA76/A5e7hFjdCErTJ0t90NMBpyd18BExq5QTADzzZ8tCZwlGdIoUyTwnnENxQcSxb6 lvgOSu/SV7oz3j5Z0sqwGKrQiMfmKXxwGj19EeEEWMxEP0aEQsOVFQuyLJOhlWOLWx9r msDmP2C1st5AkZXe1HQXkMJY/4UEEZnnQNjA7on+qlkP6Z79tVHiRPr9Gf7urZg+1F8a mPU4A3ZGm1AkM51+cBoyMWHFTRp/1tAl8mOC7AYmnr+irX15U6+tTyDfcma0/ku6K6B4 0ZpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=EUZ8XuMv; 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 e125-v6si9884127pgc.424.2018.08.31.11.14.16; Fri, 31 Aug 2018 11:14:30 -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=EUZ8XuMv; 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 S1727438AbeHaWVp (ORCPT + 99 others); Fri, 31 Aug 2018 18:21:45 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:46828 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727405AbeHaWVo (ORCPT ); Fri, 31 Aug 2018 18:21:44 -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 DC6EC1A9D; Fri, 31 Aug 2018 20:13:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1535739184; bh=HuZXVMaDz7OsWJH4waZjlCY/TDjzKogBXusv6dA8VzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EUZ8XuMvX4/Zsfyq1R6d/d3tweO6FOg9d65oun5sfABUUlIh0r0yxdNBVTI/n0867 YO+Nbvt2T7gEhcqQ9NNTkO/nlvgKShHG/z5sX3ETPeaB9CTqVl0SP2q/Kn4fI5sjPZ KOXMYEctarQTyV3JOBNnQpOs47cCXGad50iIzeOU= From: Kieran Bingham To: Laurent Pinchart Cc: David Airlie , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Laurent Pinchart , Kieran Bingham Subject: [PATCH 3/3] drm: rcar-du: Update framebuffer pitch and alignment limits for Gen3 Date: Fri, 31 Aug 2018 19:12:59 +0100 Message-Id: <20180831181259.29529-4-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180831181259.29529-1-kieran.bingham+renesas@ideasonboard.com> References: <20180831181259.29529-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 From: Laurent Pinchart The framebuffer pitch and alignment constraints reflect the limitations of the Gen2 DU hardware. On Gen3, the DU has no memory interface and thus doesn't impose any constraint. The limitations come instead from the VSP that has a limit of 65535 bytes for the pitch and no alignment constraint. Update the checks accordingly. Signed-off-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 35 ++++++++++++++++++--------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index d1bd174ec893..1d5f49503b93 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -204,7 +204,6 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv, const struct rcar_du_format_info *format; unsigned int max_pitch; unsigned int align; - unsigned int bpp; unsigned int i; format = rcar_du_format_info(mode_cmd->pixel_format); @@ -214,20 +213,32 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv, return ERR_PTR(-EINVAL); } - /* - * The pitch and alignment constraints are expressed in pixels on the - * hardware side and in bytes in the DRM API. - */ - bpp = format->planes == 1 ? format->bpp / 8 : 1; - max_pitch = 4096 * bpp; + if (rcdu->info->gen < 3) { + /* + * On Gen2 the DU limits the pitch to 4095 pixels and requires + * buffers to be aligned to a 16 pixels boundary (or 128 bytes + * on some platforms). + */ + unsigned int bpp = format->planes == 1 ? format->bpp / 8 : 1; - if (rcar_du_needs(rcdu, RCAR_DU_QUIRK_ALIGN_128B)) - align = 128; - else - align = 16 * bpp; + max_pitch = 4095 * bpp; + + if (rcar_du_needs(rcdu, RCAR_DU_QUIRK_ALIGN_128B)) + align = 128; + else + align = 16 * bpp; + } else { + /* + * On Gen3 the memory interface is handled by the VSP that + * limits the pitch to 65535 bytes and has no alignment + * constraint. + */ + max_pitch = 65535; + align = 1; + } if (mode_cmd->pitches[0] & (align - 1) || - mode_cmd->pitches[0] >= max_pitch) { + mode_cmd->pitches[0] > max_pitch) { dev_dbg(dev->dev, "invalid pitch value %u\n", mode_cmd->pitches[0]); return ERR_PTR(-EINVAL); -- 2.17.1