From patchwork Mon Jul 4 07:40:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 9211843 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 0BE2F60572 for ; Mon, 4 Jul 2016 07:56:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F26AA28570 for ; Mon, 4 Jul 2016 07:56:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4EB628611; Mon, 4 Jul 2016 07:56:41 +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 AD51928570 for ; Mon, 4 Jul 2016 07:56:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7EFB6E3B6; Mon, 4 Jul 2016 07:56:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 932 seconds by postgrey-1.35 at gabe; Mon, 04 Jul 2016 07:56:36 UTC Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0080.outbound.protection.outlook.com [104.47.36.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id C469B89E69 for ; Mon, 4 Jul 2016 07:56:36 +0000 (UTC) Received: from DM2PR03CA0052.namprd03.prod.outlook.com (10.141.96.51) by BLUPR03MB581.namprd03.prod.outlook.com (10.141.79.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.523.12; Mon, 4 Jul 2016 07:40:58 +0000 Received: from BL2FFO11FD005.protection.gbl (2a01:111:f400:7c09::148) by DM2PR03CA0052.outlook.office365.com (2a01:111:e400:2428::51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.528.16 via Frontend Transport; Mon, 4 Jul 2016 07:40:58 +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 BL2FFO11FD005.mail.protection.outlook.com (10.173.161.1) with Microsoft SMTP Server (TLS) id 15.1.534.7 via Frontend Transport; Mon, 4 Jul 2016 07:40:57 +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 u647ep0Q026135; Mon, 4 Jul 2016 00:40:55 -0700 From: Liu Ying To: Subject: [PATCH v3 01/10] drm/imx: ipuv3 plane: Check different types of plane separately Date: Mon, 4 Jul 2016 15:40:30 +0800 Message-ID: <1467618039-7457-2-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467618039-7457-1-git-send-email-gnuiyl@gmail.com> References: <1467618039-7457-1-git-send-email-gnuiyl@gmail.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131120916575400061; (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)(7916002)(2980300002)(189002)(199003)(4326007)(61266001)(69596002)(87572001)(2906002)(86362001)(50986999)(76176999)(47776003)(73392002)(77096005)(586003)(55446002)(73972006)(36756003)(83322999)(48376002)(6806005)(5003940100001)(82202001)(50466002)(2950100001)(87936001)(81442002)(305945005)(356003)(229853001)(97736004)(106466001)(105596002)(81156014)(7846002)(189998001)(8676002)(76482005)(2351001)(81166006)(6260500002)(110136002)(19580395003)(92566002)(19580405001)(33646002)(11100500001)(104016004)(50226002)(8936002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB581; H:az84smr01.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD005; 1:O9HEt+ywBvLXYsVTBFW+JtEQSFQBREllK0W4tLUMYXgSf2Rn2THFK/jVBA4V60sQ4ey7ic50CHx83XUNcocV47eAuGz+rWpPnLYr8br138voZO/b340kTer+zXfmqNyaLx6j/jD1mEJz8U7lXCwVVP6VchnBixOZzbOo8huVtOiyU3GKm8UNtcQZjWaQEDsrhgE9eJADX9Byac638iPB+1TrxM7F96y84DnPg8JMWWSG8wkQjH+lH1r9pC5noqDs3DGOcUUuvJp0Dkw8lS3A0K9JGwJkDCXcSwpEqchN51u/k01tCjiIC8rOi8qyTiN4r8RSuIrsDW2e+h+rt5fc/PSCi70H9sQKUw+33eUNJ14unvSHA7iLAWwcCPA2A1rVySDW+tXFORuTM4PSSNiaB20O6TstFbD5O2VxiT11qA2bo88y/4w6nPJPSUQs6A3UZLiLkviWckfrAacepfHkIzJ0QWZJ6wYFk1fEJuzf1QrfMifLWvT97af8VIRxdHgWqyLMWIP5ce0iMzpFP7IO6tZJrjZup122Un2AXJCjNS1KluqVEvwh1X1Nk0eJdT6hVzdcjUWEQ+aQIe7UlJYHqw== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: a812f6f1-6510-4342-b07d-08d3a3de8990 X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB581; 2:oYfTzLWO6DSSvvQsFL1kWbY/LwZhUQpqJtCup9BZQU6IYFZ0k4Gp8Y4spPk6LMUv7OOzfUDOaQ2SxWilMxLDzSv3Jx1NbNcWDCyyC8IeWVRVCmQTz1BY7bs+z/ZKBBXeTcJnHUOAKuvYlGaSCTG7JnRh1TCFOWiqots+HaX+otUyAud63f9vAclScOalHhEd; 3:SUyt3fjto2ESjatGExNzGR44yLxgbN1CWiQG2bGRxTghdJ8Fcy3INzUGZ6qO+hxEExyIBJbn+m9R5sO1wv7OdhMGn41/U6IdOJE+vHGXXODgxa9Jc1+0lK1N8vgLjTu6+Vrn+IjTdALtUJRWh233u5cf7gtFXXeRuE1eMkA9sb68fBUCPGuYlo8XrNY9olMk4ir8eP0sDGTZ5kgTtQ3YL+Kj1VrttXc8a9Iw+yOaaLU= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB581; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB581; 25:8/ofjhnIAd8kedirUX30BAhBo8UUKWL0I7g+RK5foNMDn8pGp2VO2JuvNq453IJGLpfH8s08xE2YhEwzRIcB0bfkyFAEz9qKjqZUMDng+ACKVob1QpND5hQBr6BCmVXRXHuv83JB1XB43ksYB2M3BzTSpM+F4JgRZYN/wsmLuC88RD4LVQREmMYXAlUBH3G81JW4lIdDhazrtq/JEUckPIpeBqlEIG2/ak2KmtvI/ixFBvMG+aCBMS6VUesn1HcDUZu5vWsbyrPMUVORfIAL1neWpm7WkiUiNujA98V3RugjwDgVjOJhunAn8YS7hhrRGuttc3ENOSJhRh+PMmMofB+GvzxInwR35RJuBw1dNNVLZI2T2GBVUcdcGpR2EIWnoiSjPoEM71qAJ6Pxtt8BHCL+KsUzVft8WhTS9itXlXOIn8rSUYpHhFBvwi3CEya+GBJIwk5qqDmz3MEqmEJutFhJoMnxxYw3678sVn477YZtWW4QHIe2v0lQFsNcaEbagYHo5s9y6S6UvbQGvLMFPYtW8/F4NojrJgmxpNCckg02+Bdie8HMj2HAvvfbqah6ekJL6p2hk0M87YE91jDDoCN9R4zrV+c+1R8gMvHtFxqKYXSfSoX3SEhpJ2vGcXAiEAAVdzTon5aQpMQQhsadNDH/+CwB0nOl+YG3SybHmtDToAXGAL+yVwdJ6yvXfblLPQhipENGy3+oJn7Jmdi4WmuhP2vuAaA7mvTrDICtcVc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13018025)(13017025)(13024025)(13023025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:BLUPR03MB581; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR03MB581; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB581; 4:gEOBhiKH6mIAxsvWg3UVbfdHZbCPQ44MJj6lrrc2Lxw8ia3pcv0IoOi7xduKl4vfxSd479igcrHBN3tsF1qbU9eJ85akoF3hc9603iOIPFQfjuxsmbU9DnjUs/FBn7jahou9kH0gERCtCBiBWzYzr5Kc8uWuOFD5sCZRdklitSp8CASmN1BCFHXtAikLM+gmQHl8LZBIlTNbteOTVjoak0fyv5tNn0+3i63rJUzvErn2mlaNTulA9bw78lywG7aX4ILAf64IGIT/q1+LMlZi2Xp82IWX/Ej5uIMjB3h3RBlksPDUXndYAD3wjARATgurzAaw73JjxrlOKE9/JMa+yjiHf1a81jVAZhT07IHpaeraLwQMRNXYUnY27Ui0OR/JmYu2DzAnTgQTeiPhBaCA/FR6Ww/vGjM7RfoLHKW+X9e/bmTxNqgaa1DfhXDnZ31soX8cNjUQdRKM6W0FGqzhQlefZavFNJKDCNICIf9tXWo= X-Forefront-PRVS: 0993689CD1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB581; 23:jBCLoKnvLxdJtW9uN93gRvEkLYyo7wfuXUSNmGwzvO?= =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UzAsXWdTOe1YL66TMk=; 7:iU77tjIfY5z4/r5A+beOHkxB/8z5Mg30Wk27Z2gppj73BzZWkMElxTYYxoN30V5mbg5SZ8tRR3kJPBtlIsCS3BI9gpXg/QE2YrAnh8NUA4B2OCZ9tzKZ3V6YWDy3KL8hUk4m/4e0w5INiVbinw5SF3ecSe/0DZYefqohQlAFWi/JbDAJRb9KHLFteZ6z2q8e1x2z9O1lPrJp0an3jVoMFx4WJxplZFzOP7qj1bdSZKCLF4Q6wyMpqg4YU28UO5I1ofidrYyjZ+gDwC4EGuXdkg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2016 07:40:57.3216 (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: BLUPR03MB581 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 --- v2->v3: * None. 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;