From patchwork Tue May 24 10:10:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 9133411 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 6C49A607D3 for ; Tue, 24 May 2016 10:45:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D9C9281B4 for ; Tue, 24 May 2016 10:45:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 522BC28258; Tue, 24 May 2016 10:45:26 +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 D2AF9281B4 for ; Tue, 24 May 2016 10:45:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 223386E70F; Tue, 24 May 2016 10:45:22 +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-bl2on0060.outbound.protection.outlook.com [65.55.169.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4FC646E70F for ; Tue, 24 May 2016 10:45:19 +0000 (UTC) Received: from CH1PR03CA011.namprd03.prod.outlook.com (10.255.156.156) by BN1PR0301MB0594.namprd03.prod.outlook.com (10.160.170.21) with Microsoft SMTP Server (TLS) id 15.1.497.12; Tue, 24 May 2016 10:11:24 +0000 Received: from BY2FFO11FD030.protection.gbl (10.255.156.132) by CH1PR03CA011.outlook.office365.com (10.255.156.156) with Microsoft SMTP Server (TLS) id 15.1.501.7 via Frontend Transport; Tue, 24 May 2016 10:11:23 +0000 Authentication-Results: spf=softfail (sender IP is 192.88.168.50) smtp.mailfrom=gmail.com; arm.linux.org.uk; dkim=none (message not signed) header.d=none; arm.linux.org.uk; dmarc=fail action=none header.from=gmail.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning gmail.com discourages use of 192.88.168.50 as permitted sender) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD030.mail.protection.outlook.com (10.1.14.211) with Microsoft SMTP Server (TLS) id 15.1.497.8 via Frontend Transport; Tue, 24 May 2016 10:11:22 +0000 Received: from victor.ap.freescale.net (victor.ap.freescale.net [10.192.241.62]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u4OABCM2024148; Tue, 24 May 2016 03:11:20 -0700 From: Liu Ying To: Subject: [PATCH 03/14] drm: imx: ipuv3 plane: Check different types of plane separately Date: Tue, 24 May 2016 18:10:42 +0800 Message-ID: <1464084653-16684-4-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464084653-16684-1-git-send-email-gnuiyl@gmail.com> References: <1464084653-16684-1-git-send-email-gnuiyl@gmail.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131085582826959624; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(199003)(189002)(9170700003)(110136002)(189998001)(105596002)(33646002)(77096005)(229853001)(61266001)(47776003)(19580395003)(5003940100001)(106466001)(2351001)(50226002)(2950100001)(19580405001)(83322999)(8936002)(1220700001)(2906002)(81166006)(8676002)(87936001)(104016004)(5008740100001)(6806005)(87572001)(82202001)(81442002)(86362001)(50466002)(36756003)(4326007)(76482005)(73392002)(92566002)(76176999)(48376002)(50986999)(586003)(73972006); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0594; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD030; 1:DI3PDTubFl26XvyTii3yEqZuEjsFDq6ixYfVSCTksHvHW/Rbhp5EJx2jON2x+IRbrGzZonVJBm4nuxn4DudnJcSNSARoqdzL484pA1hJALN4KGie/tbM167QwMmUSe7AbM9w0GwtKNHUR906Nvt9yzY4RRLvE7PFC9Onykns9LOD6PxVVak2oX0efixdLPIS3Kj5GkgN4IAXvRJ+bOMy08BhRYJVf5LF5XksY0wl/yDTc6to0X6TXcaIaVfA1uXQTQtVc1w63Mr77fdwvuyluWKQcALegFY89rsWvVf62fIDJJqr7QmkT0QI9+A1fIGmdxbPDTx5FblL7uZNj4ep3NskXc94CzFpia9Gn22pFqixfXyfCbD0DD+qxl7wcnBpNFLL3RW3e0+Mqyq/veR3CMDfkFwRF3F8iMbC+3VsL04EA9WV53iiShVoEhQ2N2l31iZvl/KiChfSbgz3U0b3Y3jskp59RPWVyV2l+2oyu/zDikpVYvA6Tzckf2gLd8kMlKuugmH+5lh+WYSBZ8EGshxVWv0u7Aip0F3LW9ukYWSH6O7PZxDqAAc6Ef+a/3tK MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 0de9d1e4-ec8b-4191-8c23-08d383bbc1fe X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0594; 2:d0+hc9s53SVmVAchfLfCxkrQnYybHp2qslx4gB4ONuPSCGdSBM+ZQGJ1ss2Q83llkLMmBdL18dOQji7qe4yBQjAGHb6CvuPXKfW+QdUGkrBJO6Qd+/fnsrYwJCpkERYvoBIg9N4sDv8ctHon93nfZf/65Nl4LCmtfg05ywvg7duM8TxeLKKXGRmAqbSfQpVf; 3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qCC983qD3eFesQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13024025)(13023025)(13018025)(13017025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:BN1PR0301MB0594; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0594; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0594; 4:UMLi3xq7lSXMmPOGYAgY0SLQO0CaPWJvppokqe3+tASfrUXpBzwB6ofm7gcQJBhVXy6CKeVn+qqkBKiZ6DSfG1SBimC+WU7IU0N8n5KJDKnU21GoyCxhtg/Vcd0nWGLb422hnEyVJTNFoPlfHx011FgOEcHxN5wz0X9Fx8bXv2CYKstvUa5Vnk7B37hl8b1vvXdi5kbgrWiHzi0/crylOmnRpOZg+N8UISFefcxtNdyMbAFGfQ5E+S/EMuASJLpeDXnyAD1HqQCW21hhAFex60o9Ur1BDtfFxmam8Tqbj3BBG+6bb/djwmAmIqGajb1Iol0c39GU+rivvR/lRJsBOEAQEqkD8QYWNBpY4jnqMKoKGuPhj4QFKuveYunxJQUXNtoVEgs+LewkSEHlHeSvLdeUWdPVC8OxbnUQ8lK3jlou4F/BoIr/S9lphBtGpRe8QFVGjM6xJF4GDvlhAhFofc6w5wkkkpBlWeEhwgpE33w= X-Forefront-PRVS: 09525C61DB X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR0301MB0594; 23:O41s9hfPMbzG3XvgFdXN273OChJz5kG9UNKfyqB?= =?us-ascii?Q?0mmSa+QzyvXOnOgun9baqz8gYARFAprBPjBAF3HL9roqfZkiLb8KVxeWPGCw?= =?us-ascii?Q?GMaPZOMWjCO3wMvgvvcugKOpxMc7uUIbCFfzBPhjcgsqn7MvZ/jYZviYF9gx?= =?us-ascii?Q?Wj/Ie8Vnkdbe6r4Ry0s3o3hLwjmMpTRAAhsX5aKlfrClXuMSTX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jJx93/2eF6hOcSa/wTJOl2wRGLDgi319YmzE0+j2D?= =?us-ascii?Q?3p8pYOfcc7q5ZPBh4NHFy0QH4OTwGJ9RpX0GMwRHFB8adgxingdttKw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0594; 5:xG2if7Shd33jOYGCm+893QItubENeUS6d7DudxPlHvHD6Apo5gP/dFfW2+kgV4kmtgD6+3C/BtJwwtykTK5D9rcrh1fWf0dT+AXDHB3L1coVn1TIjpqRWMTHKIR+DJfQabimPQRG1CbN5Vz6rwUjXNUoQ9mittnVPwCI2JjuPos=; 24:9pK8OQHTYZqWi4KqDOTi0QNXxlaORhzaeZNTlMkIdjmi5aYY/V+NOUkplMtQQumpPH33Dx4exFmXQzxf+Ujy7/ZT/SYLAr+YNg3zPIHrTW0=; 7:FqhTqG1tVyjMT6O8NKASu0OfW5sppsd027IZe4U7YiUoueGEXddxBisuVqrsVj/F/yZeZaYZ7iF6Y+0slE1rSkvTP+dXprM35z43HqOc18UWkyp+HLhg3B4C/UgdvswLEvObM8EDyzVr73SzvMDu8ZSuavcEaqkhCYFxYf/cAGDSAE1UnL8VxMuI6KQIwKOs SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2016 10:11:22.4307 (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.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0301MB0594 Cc: Russell King 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 --- drivers/gpu/drm/imx/ipuv3-plane.c | 72 ++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index e6ec8eb..8f91b2e 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c @@ -190,44 +190,54 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h, bool interlaced) { - struct device *dev = ipu_plane->base.dev->dev; + struct drm_plane plane = ipu_plane->base; + struct device *dev = plane.dev->dev; int ret; /* no scaling */ 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 (plane.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 (plane.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; @@ -238,7 +248,7 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc, */ if (ipu_plane->enabled) { if (src_w != ipu_plane->w || src_h != ipu_plane->h || - fb->pixel_format != ipu_plane->base.fb->pixel_format) + fb->pixel_format != plane.fb->pixel_format) return -EINVAL; return ipu_plane_set_base(ipu_plane, fb, src_x, src_y);