From patchwork Tue May 31 09:24:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 9144023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0ACC960761 for ; Tue, 31 May 2016 09:24:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F12902793B for ; Tue, 31 May 2016 09:24:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E611328188; Tue, 31 May 2016 09:24:56 +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=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71C282793B for ; Tue, 31 May 2016 09:24:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D24756E352; Tue, 31 May 2016 09:24:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0069.outbound.protection.outlook.com [65.55.169.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id E4B7A6E353 for ; Tue, 31 May 2016 09:24:50 +0000 (UTC) Received: from BY2PR03CA052.namprd03.prod.outlook.com (10.141.249.25) by BL2PR03MB194.namprd03.prod.outlook.com (10.255.230.142) with Microsoft SMTP Server (TLS) id 15.1.497.12; Tue, 31 May 2016 09:24:48 +0000 Received: from BN1BFFO11FD052.protection.gbl (2a01:111:f400:7c10::1:151) by BY2PR03CA052.outlook.office365.com (2a01:111:e400:2c5d::25) with Microsoft SMTP Server (TLS) id 15.1.501.7 via Frontend Transport; Tue, 31 May 2016 09:24:48 +0000 Authentication-Results: spf=softfail (sender IP is 192.88.158.2) smtp.mailfrom=gmail.com; ffwll.ch; dkim=none (message not signed) header.d=none; ffwll.ch; dmarc=fail action=none header.from=gmail.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning gmail.com discourages use of 192.88.158.2 as permitted sender) Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD052.mail.protection.outlook.com (10.58.145.7) with Microsoft SMTP Server (TLS) id 15.1.497.8 via Frontend Transport; Tue, 31 May 2016 09:24:47 +0000 Received: from victor.ap.freescale.net (victor.ap.freescale.net [10.192.241.62]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u4V9OfRL013844; Tue, 31 May 2016 02:24:45 -0700 From: Liu Ying To: Subject: [PATCH v2 01/10] drm/imx: ipuv3 plane: Check different types of plane separately Date: Tue, 31 May 2016 17:24:22 +0800 Message-ID: <1464686671-20299-2-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464686671-20299-1-git-send-email-gnuiyl@gmail.com> References: <1464686671-20299-1-git-send-email-gnuiyl@gmail.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131091602880060580; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(199003)(189002)(9170700003)(4326007)(8936002)(2351001)(8676002)(81166006)(48376002)(50466002)(586003)(11100500001)(86362001)(189998001)(92566002)(6806005)(73392002)(110136002)(104016004)(5003940100001)(33646002)(87936001)(19580395003)(19580405001)(5008740100001)(36756003)(50226002)(77096005)(61266001)(106466001)(83322999)(105596002)(2906002)(2950100001)(229853001)(87572001)(50986999)(73972006)(6260500002)(81442002)(76482005)(76176999)(47776003)(55446002)(82202001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR03MB194; H:az84smr01.freescale.net; FPR:; SPF:SoftFail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD052; 1:edM0ijxWOYdrO1QpP2YrPuh05O4IG8BtftXhmBoAbSTuRtNJWPvVA6kCns7mPWn3WWn+DVmiu0kFcPUss1F7ykdmUddPJZtSaj2+3swsWGCkYAaTgw7241QMhrQYG/dj+sn4avK8EG0Icpjjckc/Ahfdz8ZFMXgk4STVxS7AqiehdZ8E2xNGGnO4JQ3hZD9Zpi3ko0bDhF7DVafMQyP5ncI+5kgx+BwPR8uX5iBHlisz4oJ1kPQglWsTGwhINqLhN2nCYoY7qTmvm+izfpzx444jrrb6S55vXZJmD9WnY7s4MOSVzIU7Y7ZSSiuJzMF/mrcM3gTygnKEjel+ln7qGRqkJZt1HaUO7ljmETKsmVgHzRwL78DPnzHgAGmQjOA3pkNwApERV7DyKiRiW8w05D4L4G2o+PiDSWNQU6/0/sFKklJYlH8VJLWF/1EbMP3nLbeebpM/sgjg2eZrxFAnW9lfTuWwNzrrecid1DlF3dHUzS3w70kV+roc1dM+8nME5CBsCt5snjlsZ6lBxkDElkCvyRqFKpJfxCD5BqnCqN3CK1FynuPlgMUW4wMUL2H5 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: c873070b-8ac5-4808-7b46-08d389356928 X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB194; 2:/SVQmpLD9fBeyt/tNVreioGd3Tz34B+SDU4zH04FBkqw2748HkAtDll5DByC1lj9ZLAYZKS4AmlTV0W8obVbsoDvIWF4RX+vMSoAC+1T2MbikDHLLD8BCvt8NkwrD0mXaaW/K4gUHsSViY3NaxdDpa7y8Y9otcYASwjclthfOpgmVPUyJkowBsgBCyng1yR6; 3:zj7wdeL+mfLPMIcRqXuenfVZ64P7zfdOzelnVdj/CHHfJcPXF6jeOtOmlxksGxLpq3LXCuCBpx0eAdmsmm/3ev1/5Skxo8aXas5kFCe+eeBt3HGir436sUXqDKN97haB9etwzu4gKgcAFHajc5/XuYnsSRFEXzOqIk82uvvchS8w7XYZjY/x4llpLDZhDsKN4FFEdXsf1LeiXX7hD7Lbay8nZm+nCNaLrRHuuxmmIlM=; 25:8QtDVTDrwGNhlO8XTFGpLtA8WclLlHGh7Skt0MQRv9+X7SWtqa+6HCijKknCtx2xTO0H3ZZMyENsBphykR+pLsy2vvEAudTV5QvDjuc8cJ0iVY5khfEUmNVnqLZf70Ebf7pWylSFwlGeQEgDuXGijq9lq0s3yTB+5ozJ5kdhKjDYYz1qX+xzEn441UiRg7lQbTI2Z/XGiGDiAMoWEbxwJa71dmZncZ6LTvV601NT7BJWLJepBbnBx5iTThdHNxARybnlrg28zySS35FJfMox9poBUuD3W8aaCGR0xFkkkobg8FVud02TkPQg9zIp3rBNymowqI0x/4tzqEggi6zis40ieTDXdya41Ic8WbdTRKgCeoNpUTHQoPxjXbN15WwNjy31BZF1AZUZNKenFSQ7JyqkpSfvq8xOcCa2tvtWOcg= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB194; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13024025)(13023025)(13018025)(13017025)(8121501046)(13015025)(5005006)(10201501046)(3002001)(6055026); SRVR:BL2PR03MB194; BCL:0; PCL:0; RULEID:(400006); SRVR:BL2PR03MB194; X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB194; 4:Fxe7mVQPdVy1ydcDOynoZpampig7cZ9MrfjThH0DFOER9j2lJv21l1gWb9Fi919dMafHiLL1LwnNcx7Xil6akdv5BfkhV9chlUND8dIf5zDZSzd9A2/xXkkwRU1uX8cDxuUVO70AODhRmRBXcCS9fg2UXEOLElc4SJGsN1UUajLb1nVErIX7gabpffpeY4G8UBYAXGDDp2VmUdjTaNKU3qD3RuJEld/aaOtqJAWqZLIcR9QL+H0OQMPZwVjtKRSGNYTsaGtB+A+W36ezOdBUYmqJRkVXC7l/SbdUDXqzcyD4sKpE+Sa60aMoCgLyDFsBpVX1uJmvCqmugFhN5/dV/J0TOSx7+hBzETgDwaztXMlaJyQTOSs9ABHiA4Thf8x7bA09v+J27TJk0FVnj4kWsaqQaxwdb2t7kH9NY10R1PFK8AHr+xrKowsGowA+G9zvkyGizRrIQH/ksETteML4KwkK8lketJFgdn7MUrUtsD4= X-Forefront-PRVS: 095972DF2F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR03MB194; 23:tgAFI9pNYsUa0OB5UuHOln7Ov+YLKpOLS3lqx1B2b+?= =?us-ascii?Q?YM6h/63XjAU0jsZTr//ZdxW9rUvabg29PRlk4RcKxWfM5/uk7DuaRUZzZTlq?= =?us-ascii?Q?QG4GMWi/z6/BblHyJ9lh6so1Rv+VwUFI+ljEVrGS34GB1foc0upBnNfXqqgN?= =?us-ascii?Q?gNSHLWsBcK+uNlo9dFtZ+fB4aikluAHR8s02jl1wnvMNAIvF3EwOLrVc6I9G?= =?us-ascii?Q?SAyH+iCvMjyjShmOiXr7cTz7RONHk63xv0p1+yHKz/IfuIEezy8wNqcwIHhU?= =?us-ascii?Q?PzgQ3f0cp+eOGIgivL1JsFktJ7Rd+r3x3J7jIg4E9dE262HxgcLNPbt/ER38?= =?us-ascii?Q?TJKgfhePMnR2NM4ODz6WBhKSaXaz1O0Td2eST256sspxw8tRmFrnERR9mTiI?= =?us-ascii?Q?uoOM+yoEvHRLIkLtBbkw+dAfpSUlsJ5KQ2eR5scxuW61O79G/7h4uaw/R2ia?= =?us-ascii?Q?4uC5SorA7AVvLDLmC7HewXav1QoUDvU/ZtPGE8sk7j6b8QjokHYvHwFfWgom?= =?us-ascii?Q?1elzmuPbCyhP9HImXwamp2yDJWZxN+BjKdiF2OQqKwSF12h4Tikf0uFbFsRQ?= =?us-ascii?Q?0hkvaaZ5G9dswGMGkPOziJoC+oYeriwPGI6guM+oMlalbS3JBrBVzm7loxwh?= =?us-ascii?Q?/xDlcMLQr/cNF5q6IHn575oEEtEFw95ueX1ZGrONaHLUiS6UtDSGkHiDc9kG?= =?us-ascii?Q?RsDKRMI3GVR6K9U8v+bQoaJHNcpK+6Y9etV4ucFfaPOVGwwYLbjXATVp7Xab?= =?us-ascii?Q?NB7xzqOPiBhRdKJiHY7PQkQuLUad49wL44Tkjxc/+qys6MJAOkhqn8Tj3ojV?= =?us-ascii?Q?Jx82qGQA1RdrU+x8R6QkjqmfmnHx+rwLszNBPoMR2KdIHvWT9dH5f7FlD5Ef?= =?us-ascii?Q?v0GrJUzNeTtZbDQqmHDA30MTZgGeoOrRLYg3cAsqDErJloqEgASMhHZplrpQ?= =?us-ascii?Q?OmusI/A27boU4GHx0F2/OdQZcW9QQ46okB0UIwPwBFRkR6gRmdp8SmxXK4X8?= =?us-ascii?Q?5xPNCOsa2XHu2u6lHCTWbqfelg4Wt0G6oFLKROP+QnRVk/+osvDfEOBqlLia?= =?us-ascii?Q?bcRyiuFRwojlZg8fmC0OjLDBUQRWQf7PDoSAIk7KG7LK8sEJ568yBTOGifmK?= =?us-ascii?Q?x8StCmBGfJ8UhKplKrO4ApWFVFsYC8WGYUIrEkS65i7ia4DyNFkfPZth0dN3?= =?us-ascii?Q?jHsD73c35Dm7wVc/htT2wbpskeOH6Jsxft?= X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB194; 5:uszqhKNQ+M1xWW0D7CwN5mWxgUuWtlp31p18H7E58U/hTJSFWf6IXwbhR1U8vy5iZqC459TafnRTie692UYxlOStrhsNwK68GUi8XUD+2SlL5uO6LIukvratnwyUFtUu63f6T/R3jpJChXcPTQ7mcjG2UKeJsN04ekmGXH650h8=; 24:xLVlTFJiXBxeWW+NbF2EjyxZmVT4xMrN4uwsXa8DdiejyEIPRh+LeTp5b2LUrWuFNnarrWt4G8B00gSGxy8fhmMEdFYfrQwK7xHnYIs1CSE=; 7:u0DY/7fmRWSPMD5DUryhDxV9wOaE5rm0NCHLYPB4NqhYMGVVR9Hf7IXEc3AgBG5ZkY2TDvIDgggTE+qgWi40c2dCQ1QZW3OJLrJwouS18c6ovytBGW7MUufljHg6+JJouZ8CjmHAXrE6mvd7FwPRaUba/eAcdL/4g/rRbgLJObgELfpiQy7WRzKivzU/85LS SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2016 09:24:47.5224 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB194 Cc: Russell King , Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The IPUv3 primary plane doesn't support partial off screen. So, this patch separates plane check logics for primary plane and overlay plane and adds more limitations on the primary plane. Signed-off-by: Liu Ying --- v1->v2: * Remove an unnecessary copy to address Philipp's comment. drivers/gpu/drm/imx/ipuv3-plane.c | 67 ++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index a4bb441..cd7eb26 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c @@ -199,37 +199,46 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc, if (src_w != crtc_w || src_h != crtc_h) return -EINVAL; - /* clip to crtc bounds */ - if (crtc_x < 0) { - if (-crtc_x > crtc_w) + if (ipu_plane->base.type == DRM_PLANE_TYPE_PRIMARY) { + /* full plane doesn't support partial off screen */ + if (crtc_x || crtc_y || crtc_w != mode->hdisplay || + crtc_h != mode->vdisplay) return -EINVAL; - src_x += -crtc_x; - src_w -= -crtc_x; - crtc_w -= -crtc_x; - crtc_x = 0; - } - if (crtc_y < 0) { - if (-crtc_y > crtc_h) - return -EINVAL; - src_y += -crtc_y; - src_h -= -crtc_y; - crtc_h -= -crtc_y; - crtc_y = 0; - } - if (crtc_x + crtc_w > mode->hdisplay) { - if (crtc_x > mode->hdisplay) - return -EINVAL; - crtc_w = mode->hdisplay - crtc_x; - src_w = crtc_w; - } - if (crtc_y + crtc_h > mode->vdisplay) { - if (crtc_y > mode->vdisplay) + + /* full plane minimum width is 13 pixels */ + if (crtc_w < 13) return -EINVAL; - crtc_h = mode->vdisplay - crtc_y; - src_h = crtc_h; - } - /* full plane minimum width is 13 pixels */ - if (crtc_w < 13 && (ipu_plane->dp_flow != IPU_DP_FLOW_SYNC_FG)) + } else if (ipu_plane->base.type == DRM_PLANE_TYPE_OVERLAY) { + /* clip to crtc bounds */ + if (crtc_x < 0) { + if (-crtc_x > crtc_w) + return -EINVAL; + src_x += -crtc_x; + src_w -= -crtc_x; + crtc_w -= -crtc_x; + crtc_x = 0; + } + if (crtc_y < 0) { + if (-crtc_y > crtc_h) + return -EINVAL; + src_y += -crtc_y; + src_h -= -crtc_y; + crtc_h -= -crtc_y; + crtc_y = 0; + } + if (crtc_x + crtc_w > mode->hdisplay) { + if (crtc_x > mode->hdisplay) + return -EINVAL; + crtc_w = mode->hdisplay - crtc_x; + src_w = crtc_w; + } + if (crtc_y + crtc_h > mode->vdisplay) { + if (crtc_y > mode->vdisplay) + return -EINVAL; + crtc_h = mode->vdisplay - crtc_y; + src_h = crtc_h; + } + } else return -EINVAL; if (crtc_h < 2) return -EINVAL;