From patchwork Fri Jul 8 09:40:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 9220329 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 B8AF760572 for ; Fri, 8 Jul 2016 09:41:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8E2128638 for ; Fri, 8 Jul 2016 09:41:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D6EB2863A; Fri, 8 Jul 2016 09:41:29 +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 4C94228638 for ; Fri, 8 Jul 2016 09:41:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8D9486E08F; Fri, 8 Jul 2016 09:41:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0073.outbound.protection.outlook.com [104.47.40.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 54C7A6E03B for ; Fri, 8 Jul 2016 09:41:22 +0000 (UTC) Received: from BN3PR0301CA0010.namprd03.prod.outlook.com (10.160.180.148) by BLUPR0301MB2019.namprd03.prod.outlook.com (10.164.22.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.528.16; Fri, 8 Jul 2016 09:41:20 +0000 Received: from BL2FFO11FD036.protection.gbl (2a01:111:f400:7c09::175) by BN3PR0301CA0010.outlook.office365.com (2a01:111:e400:4000::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.534.14 via Frontend Transport; Fri, 8 Jul 2016 09:41:20 +0000 Authentication-Results: spf=softfail (sender IP is 192.88.168.50) 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.168.50 as permitted sender) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD036.mail.protection.outlook.com (10.173.161.132) with Microsoft SMTP Server (TLS) id 15.1.523.9 via Frontend Transport; Fri, 8 Jul 2016 09:41:19 +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 u689fBMn003192; Fri, 8 Jul 2016 02:41:17 -0700 From: Liu Ying To: Subject: [PATCH v4 01/10] drm/imx: ipuv3 plane: Check different types of plane separately Date: Fri, 8 Jul 2016 17:40:53 +0800 Message-ID: <1467970862-28012-2-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467970862-28012-1-git-send-email-gnuiyl@gmail.com> References: <1467970862-28012-1-git-send-email-gnuiyl@gmail.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131124444795166630; (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)(7916002)(2980300002)(189002)(199003)(87572001)(61266001)(47776003)(2906002)(8676002)(2351001)(92566002)(33646002)(50226002)(4326007)(50986999)(11100500001)(86362001)(76176999)(50466002)(229853001)(83322999)(8936002)(586003)(73972006)(104016004)(6806005)(82202001)(55446002)(73392002)(2950100001)(36756003)(105596002)(305945005)(356003)(106466001)(6260500002)(76482005)(77096005)(97736004)(19580395003)(189998001)(48376002)(110136002)(68736007)(19580405001)(81156014)(81166006)(81442002)(7846002)(87936001)(5003940100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0301MB2019; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD036; 1:yL19OlIfTZXJ9ag5J+4AAAJchvEQTL22TmKkZ4AqxXJu+V5QXsg4MEgX8XNq5tho144ptFSxxUv0RI6WHGikVPtUQzs7SSfO4r1Q2S4aMmE2qDpyUbs+dnNqL739S/UGUrP1I55Iwh3dEcpMVtMzlXG9KpAJBEP9O70hxQx9W/6+p4iYbXk1pC6WTKt9A82pQWiy4ylXevkuZMyH3k2YYx+Ja+nl3QKsK+oMcOIOGOLsKZ5teObw8K6rCAzbAtavGCX2G0MFvCToDZ725w4YdF3/txNt0bug7B64Z0DYcqFiOs2hF0P2UrJuxI0XkwjYCav+TowolGHREcKTkgX7PMGTmntGhWsjHoPiueifMIAGST7yryiDtOrFCxMc+wLfV6+pTMusnAJShUU0jgrmGPujQK2q3T61rJHvZuXiXBz+EeK9meqMMq4hvKdAUp6E47Bpaw7Q/WYhOsTF7+EjNp02Pk/vVZQsHFdGrL1iiTR+sK6oFZmwbqE0OfjWAjTTMCcSkdMopZfAo7ra6xV3OwNiNWZIzyNkUJac0NU+bf7NytivG6rFWq3mL29Ng1kAMLEPSrBm7kb+GRUQ8STvYQ== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: cc059375-4f4c-454f-7e44-08d3a71403d7 X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301M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ehOLx4lapjz03b5QsmSIf5kxW8ogae+ETl+6FePMye4Wu1UY1Lw2L8Essc4ljfdLpygWMyp2RCJ5WEXapCLDlSMywC1eDg4nKm4dMy2qsXsJBfwJTXx41CcpjoLB597vl2gZqXme4Apwb0o/rpTNp2yyhXXJK8ht7beHM+cbsRUdND4GqL/brLiVLp7ewA3Q59lg1I3agS00=; 31:8Vd0J4MmktoKTd/iwhFP7ntOF2e0nHMrrF90cw7f9zC7dPMivnJzpW553yLK1en0aqNmuEuJfkOcc62F5Jlg2FlcR/SzwYMfmVI3+30Hbde9pPbKqrawm9h6yTK8orriCqcHuad8BJGlbGd0C4xcDfcQWnW3+/FdjgrQ9+H8ZkWQEl64zcWbz1j0UYbWkHuRrNIbksyDDi55FNs7zYXSRA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13018025)(13024025)(13015025)(13017025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:BLUPR0301MB2019; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR0301MB2019; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2019; 4:u2EPcORvagqNZL9KJf8ucT0C7sFsI11Mjo0Y7TeXLJruh7PojKgp5BcB9HkJ74fh5t6lqABAlHKbrwVQu6UKwgDzGZ5LHghgFDTpxSmfl1dA0TARmqMwERak7HwkBfHtdvVy90hPjok9zs1GTn43HBxbSuWTEgwZt9GOPTl88IBa2QVk5dADt3AHl/vr1aj6zsAuTELq6biZFaJSwRaxOqj40YvuzqnTSwuIpcM7nfB9sfSFMIpMT6ZM53J5191wiMwH5N6Ggl9MWQ4R4Jwe4lyDMbMwWSxjGWANhF6gfuesRw8dN7pn4oX+2qKwPCr1LsxQsG8v9wgoS1uOB3QERAJj8O/2ZKakBoNvRnc8FIH6xdsOJcEOFmU+sEkg9cVf6I5umVdYE2sH4l9VGGfUvaO11BHsfVGt+ng3aVl+lAVonv/cjYKYf6EoA6TMKrWEdNg++Yx2md8KCIFTz+VlndRngYSyMrp+7GTzjynBvO0= X-Forefront-PRVS: 0997523C40 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0301MB2019; 23:XS1bPaF/0wdaQJPG0iJYOWfjmvjP2lVkY2TWWK5?= =?us-ascii?Q?7UEnVbAemsgcGMXl0JE3XPWdbAVuQarfCiDqCmnhXXmnIuRkfNXJwrVgwo+P?= =?us-ascii?Q?GBjx9715zX3HnirPZj4p5x3oZGOlRcfiYDE8LgjkZs0CJCX9ItaT85DfEnJX?= =?us-ascii?Q?ScG8gkPhWpma+85GDHc1/4/N6BdXs8nk9ZonNdAgglmU8yUW7/C3RTFIHfM0?= =?us-ascii?Q?IFRAkyk0Y1I2KcxLIBA5UD+JScnNk5cBpfbc99AbSIk7tv238sbE9n5XUA7g?= =?us-ascii?Q?t9Xd1g8IPfxHu8P+3ph/RXoRxtYZ7xBeBOiURY62jV4gKl31OgjySsZ0ZVwC?= =?us-ascii?Q?9Rp7W6+MCD84tdLTwjzXTW4U2k8tTlVLuL4iTapa2IwiQCDArDsF8/rMq0CI?= =?us-ascii?Q?nxXLaVWOsq1SxIEgORUxrPE1SFevU1uiCkwmJCIhlZvstFW+rs5MXcQPccWq?= =?us-ascii?Q?y4A/othDBIl235+bJRPyANTjh74Wx/Ca4RAR0SSphsumJdfv7Z535QU/WZlD?= =?us-ascii?Q?s1iO9MhvaYwGJZAzeLAfVeNuNqNaulBJvo0Y7ktsp8o9q6MY/WQmpBkOjyKL?= =?us-ascii?Q?UVyFo9KdjB6kcSBJbvkFoamvXsaxi438cc7ya7azzB7pstqOAIIKQbZ0gHkD?= =?us-ascii?Q?PSTyjPj/4BKbdXiHaKU6saYv+ZoB6pYP6X+1rBiG+7d56eF9DGYU9NnoQ/UO?= =?us-ascii?Q?k6xNAwAb53QG80sl6P52qKswoC2nZ/0JLgkNPwm56iCIr6G4YwlOncrKNTWx?= =?us-ascii?Q?FyoTKFWCyV/YRAm5H4vi/HF30BV0pM8aw42MKynY8nB46+1huRCP7wnx568C?= =?us-ascii?Q?btVPxlCdm1YA0zuCDWP4phjmc99k+ME/CLcAysuH1enim8NDY3Wt0n16LRtQ?= =?us-ascii?Q?bfOGF7risOzwNDRlN3Pz8Dpv21ivhRNSVdTjlM/v2N6kuTTVPd+9jLup7Iud?= =?us-ascii?Q?UbErVQlVGw4LQr36l7u8an4Pr4qSGV1R4VziiRpnrFrpeWJCuedUQIEEJhLL?= =?us-ascii?Q?D5owa7y2+AjLUra5+BsOsXVMEro59RADxxWkm/IrzIyL4q1RbT65d0mRABoU?= =?us-ascii?Q?7OH4LN9s9AzQptcMyzWO3VOGv925Jhmzydhb18l2vNqBiJrk3/2hLDD5H7qV?= =?us-ascii?Q?irtQnRQKHXnoCSYUBPv3Ax67NNkDVDR51ff4Q0zOlrWiDjk4Z8KWvUdqHli8?= =?us-ascii?Q?WNWXWS/AUTScUGud+cSLWM1JllkTCXCoh/lBY69VKK76xUcedG4wwcvK2Eel?= =?us-ascii?Q?7Uyrrgd4mHp0WfEyEiys=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2019; 6:M8pxS2pqJi6rwNWTVP9QXufcju0ymHVFtfmCKpA8oniugAzdvvL0MOQcuXoDl4enqcjzVKN2gqrZezbe7R4iQZtP9OTW2395n5asBC51759f+JFRqHmqdU++rj5ca5Fg62RJnO9V1u9alf8tyhRqiA8nOL9wid5fflfW7wdLEqX3VNCW6SGSaA7BcljmfAJ70dUDWkRlV1SHVGLGkFo3pBThNIsz90NtE9uXQm1kElxFHsHfsQcnSGGKOsZZ5ihd//aNF24E2VZ9hK0VlSRLhK9872GoUYIB5tebh2nbIeE=; 5:EBNBACYWBm6/eowxcLigQLkGRwsxIpEwbfgAoepVavCBNYwIVduAaNX9hCMtrzobVGw5+eMlvm26u7jnxtiGz2zP4lTRrwB4c/C1F94T6EBIVvWqHbq0o4cgagQ1iNwhxNkt0TGIxF6hzVSkFQ2zS3a650dmNheSdZTk97tRDqg=; 24:kewxNvd4NAHn0pXIxZYo7zVuKmv8yb74LBFOPZqOAC/sWjqhqOB61SYomjNV5UHCIvNUwVPa/Az9/6c4y2OWtx6icIcmkZAGGEokubIaPCw=; 7:n/LcB39oR9RGIZRC/LsrBkXMI4j3tkyyE3O40fhG8UAC0i/P0akegU8d2/ZDtdYfIriO26V8oXRjr9fvHetoxyAvcjsih3ZPu4OKEp77RUE/8QIEMFd/i+S6CidQN5t9MMCLXlRRw+HSJAy87KHnXjoxBKp6CsXnJW4lzZ6KqyCyVMLfuwizXowqeT3gSqLKrOFIlQM0MGxUl3VJpsMcdbf8BJeKGOmlaHRaq9CodskcbI2Rwyl+FUqxVq5FzJU7 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2016 09:41:19.3450 (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: BLUPR0301MB2019 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 --- v3->v4: * None. 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;