From patchwork Fri Oct 12 16:35:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10638865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3FF21157A for ; Fri, 12 Oct 2018 16:36:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F9E42BEEE for ; Fri, 12 Oct 2018 16:36:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 230FA2BF8D; Fri, 12 Oct 2018 16:36:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B63D72BEEE for ; Fri, 12 Oct 2018 16:36:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC46C6E4CF; Fri, 12 Oct 2018 16:36:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on062b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 531AD6E4C7 for ; Fri, 12 Oct 2018 16:36:31 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Fri, 12 Oct 2018 16:36:28 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v4 5/9] drm: Extend framebuffer_check to handle formats with cpp/char_per_block 0 Date: Fri, 12 Oct 2018 17:35:56 +0100 Message-Id: <20181012163600.20331-6-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> References: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: CWLP265CA0200.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::20) To AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cea0787c-c0fb-4f17-2055-08d63060dc65 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2545; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 3:KIzmQY+9TrPQnjJ1jWnz22z4UyBwalob3Z07gcm64c28GNilq0WyaD3BsYDOl7yG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FW+7prGR+uq7PFJ39xV4YTcEbv74VnD70MeE2C3jELFOEXUCQHtRKz3hJsrqStluuXo0Am9I0DSionC3g6Pjss5j6kY092PIMcgLaMc9dy0J0ndFvXgpyYIISfcBsAVYkYLxV0OhHH8BjIqY2dp+JNSxkhuIkXK4sYMWSocr+ISESpMJ/cE79HVirAHI44rqWsQLAQD9rpZVEYTPk=; 4:lUCg8CAjpkiI5GtcQwp5JN8ulC0+j7pRbwf8PBP/3BR1BeEYbShudjoJNJ89a5TvQo7kcv9hy2rN0JIZWF0BISA+40yFE9B3I0vkkXwWEWFKA7flI5eHkJmqhgDxTBAHw+lm4Gyd2hWH59JVqYEGkn7MWb2wdBSNEpMoDC8EKqCQKnmfauJFPmLiedICt3z0ac1suLDLjUsTP/zDZJtUcDfURI7h3QbTB1FpTzidjsa7i/CZ6NTaY2x7s1XjZidIMIu4egbJPty/7H4c3TLXXcetEuWrWgZVHkXNqzUO1xnTM7TSIEmjnBcO36A4UTu/ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:AM5PR0802MB2545; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2545; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(6306002)(25786009)(4326008)(81156014)(72206003)(966005)(106356001)(105586002)(81166006)(478600001)(5660300001)(47776003)(97736004)(26005)(8936002)(50226002)(66066001)(476003)(16526019)(6486002)(186003)(2906002)(8676002)(316002)(16586007)(7696005)(50466002)(956004)(2616005)(575784001)(486006)(6666004)(7736002)(305945005)(52116002)(48376002)(68736007)(76176011)(51416003)(86362001)(36756003)(53936002)(386003)(446003)(1076002)(3846002)(6116002)(5024004)(11346002)(14444005)(6636002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2545; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2545; 23:mWbtDUPYw6NjepH0c1UAWekWafLlDESpfQY+3eJ?= CCqqr+ByoWlG4BzD7LXBTEOHpzc3hmPt16EsgGbii+3ubEurYU7I9JEWLlo/apfOGFrpfXG3u1+2PqteF2IkxUhIK4mUbBLLDS/VULlJYECvZtEU7FfUGOOC3JUHW9sAY0yvpbGETpOWzZCyfbqsMfp7x0u3A8MZfp0f9COY9E8eat5n9ZkVXc/ovYTg76Gpvr+vBqWVCg6g+FT1a2kKZerU88wow9IZayFhRwIZRVz7ZSBKRQK4mkYfRWxfvcpXUGaTes+M4N43BTNLFtnKWZvAfBOJtNoP7lE2M8zwxLrDZQYnTHFx/DeO+lTSXSwcKFkQMFbKpkqiw+fHV2rcQBKa9UGb7jFoc+ZmxGBlzLZJ+gp3y1RsnRUhOwWnc+jovD8I5cAd/us4iVceltIFzmwAxkw7WCtrppH/Y1O/4mjBKn+y5hkeK9QSitcOX9COw6UR+coyVFSbKPFY+fCemIxSesXHqtVw1sUeQxyneBKIm9zlKDff0hZpGQsGg4r/T3x/gvvsuDEuhuXoFXiyEanggR6e50xaxTKTHWq63ZZReYw08OMNa+pMxE+NsLDyCdcoqXRGzVwiLiMM8PBTEMRo1snKPvKmsndbq8zEVbsYvgzCj/jXIjkbzcmnIKPzQFmoVzFjZREqF2kjxKJ7HDSWfTlHMarHZJjvEPyqjcHXdqiIoFQTAYRLbEG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K9Pa6mzyYfp6VTF0DgFoAXIn+yamSVhlCElRuY/XzJKLuqGus2SD5ZDQoDar4YFmy5MDIreKzK3d5KMVR/P5opq/TeMuZrbXhZG+Ysmfj9XYlJPczg0lBluj1gE/HLfieXSuopffj+fDEbrShHgCOsO8UMi/o4h9snd0lprxPnJKvOa5oxHrnL6YXqaQmxYlHIFlmsC893AePbDyESvhZC107t4GSf6KeDzaCofNyWT/zwQFCrHu5QXmscKeAK/N/itiGx5E9mPgPyUm99d/a/eyqhvm9WE5JjutETax/m6vpS00wx3mlPt4iFV+uEg63wlmL7TtJvq/qm7gNvReG28IDxt8K+ekwUVh5VPSEZxE52p5Jr1PEdQaHm8Y6nsijqWX3jSHexo7b6zg==; 5:x6YQdXoVZ/5JK2ogvE845/aCf50gOi9LPM79H1fBNkNhFKy8OyKyw5SotZVazin9u5Z90k0jhr054V+oyOhuYmLViQ9Ml2aoZ0sWmWdmBKavUSVr9VvI66tQwMx905n4KmI6YIw1RlgOx7HFljmsDlUbMVmtITFUxgmvRGng+Fo=; 7:3QJyTLBf6yvZ9lDDwaccm+rC6stLvjo6sI8WjgRMIXmESHPVMGg/FAtHjJWq7kPCXIac/v0IFI/Y2o0LWf7xZjnoUVLZe4+widUZ5xrdoLkIdDwOl4P7TNeygnpkSu2l55s5q5WA1taNTqQIdYi2D1SwriF1wqSY8GLcwGTXAglb8uhwuhinQY/ZUI5mW2k5iC3ANJhySwRqscjcwhY3UaBi6eUlXBUnAAPN9+iFT2lbkvbHGdDArOEim2LxreUk SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 16:36:28.8659 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cea0787c-c0fb-4f17-2055-08d63060dc65 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2545 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP For formats that are supported only with non-linear modifiers it doesn't make to much sense to define cpp or char_per_block, so that will be set to 0. This patch adds a restriction to force having a modifier attached when cpp/char_per_block is 0, and to bypass checking the pitch restriction. This had been discussed here. [1] https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&highlight_names=&date=2018-09-13&show_html=true Signed-off-by: Alexandru Gheorghe --- drivers/gpu/drm/drm_framebuffer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 6aca8a1ccdb6..e346d0ad92e0 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -195,8 +195,13 @@ static int framebuffer_check(struct drm_device *dev, for (i = 0; i < info->num_planes; i++) { unsigned int width = fb_plane_width(r->width, info, i); unsigned int height = fb_plane_height(r->height, info, i); + unsigned int block_size = info->char_per_block[i]; u64 min_pitch = drm_format_info_min_pitch(info, i, width); + if (!block_size && (r->modifier[i] == DRM_FORMAT_MOD_LINEAR)) { + DRM_DEBUG_KMS("Format requires non-linear modifier for plane %d\n", i); + return -EINVAL; + } if (!r->handles[i]) { DRM_DEBUG_KMS("no buffer object handle for plane %d\n", i); return -EINVAL; @@ -208,7 +213,7 @@ static int framebuffer_check(struct drm_device *dev, if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX) return -ERANGE; - if (r->pitches[i] < min_pitch) { + if (block_size && r->pitches[i] < min_pitch) { DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i); return -EINVAL; }