From patchwork Mon Aug 15 08:41:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 9280473 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 90C7860780 for ; Mon, 15 Aug 2016 08:56:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E6D728BE6 for ; Mon, 15 Aug 2016 08:56:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72AA228BEB; Mon, 15 Aug 2016 08:56:09 +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]) (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 37E7628BE6 for ; Mon, 15 Aug 2016 08:56:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A9AA6E3A6; Mon, 15 Aug 2016 08:56:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0069.outbound.protection.outlook.com [104.47.33.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id F27E06E3A6 for ; Mon, 15 Aug 2016 08:56:05 +0000 (UTC) Received: from BN3PR0301CA0013.namprd03.prod.outlook.com (10.160.180.151) by CY1PR0301MB0844.namprd03.prod.outlook.com (10.160.163.150) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Mon, 15 Aug 2016 08:41:20 +0000 Received: from BL2FFO11FD056.protection.gbl (2a01:111:f400:7c09::115) by BN3PR0301CA0013.outlook.office365.com (2a01:111:e400:4000::23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21 via Frontend Transport; Mon, 15 Aug 2016 08:41:21 +0000 Authentication-Results: spf=softfail (sender IP is 192.88.158.2) smtp.mailfrom=gmail.com; gmail.com; dkim=none (message not signed) header.d=none; gmail.com; 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 BL2FFO11FD056.mail.protection.outlook.com (10.173.161.184) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.567.7 via Frontend Transport; Mon, 15 Aug 2016 08:41:21 +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 u7F8fHoV002768; Mon, 15 Aug 2016 01:41:18 -0700 From: Liu Ying To: Subject: [PATCH v2] drm/imx: Add active plane reconfiguration support Date: Mon, 15 Aug 2016 16:41:13 +0800 Message-ID: <1471250473-29841-1-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131157240817599574; (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)(189998001)(87572001)(19580395003)(626004)(73972006)(92566002)(87936001)(105596002)(86362001)(50986999)(19580405001)(2906002)(81442002)(7846002)(8936002)(73392002)(305945005)(69596002)(50226002)(5003940100001)(11100500001)(83322999)(76482005)(4326007)(97736004)(33646002)(106466001)(48376002)(229853001)(356003)(68736007)(8676002)(2351001)(6260500002)(77096005)(104016004)(50466002)(47776003)(81156014)(55446002)(110136002)(586003)(82202001)(61266001)(81166006)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB0844; H:az84smr01.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD056; 1:YdQ/AWsNbZ42vUpFVH6D/AvnAJM6VfFWhYZ3xuMvuCFMznqx1ZW05La4XWi6ajWT/+pPqC1KAmJziQJTcBHaDtdHgUVQBnLc0W0MCB2722iHhUebf6S2G4K2ZLelqoeY8ExqKcVo6ZK5s5Nv3E2VBZBX8CCHJpnGH+Np5Ebohkpxz7Q0yPs3iBccBA4eBBo7BtkAdCj1K/VPXVJLYuw3HI8vYFMDRPFGybPsy4nlMXKjiOcBBBZC6FW1q83n4l/k4Em6yIrnlXxezRUYU1NTtaDW8aYXCs5uFNWAQAeoIkxU/O8wuv2RVOSSrEsLQa3vcrMRMdwUwHfzeS5V6lVqld5Ln9BjyStZxTikFQVSgmG9QH5rGtLtHdJxzwcxwVbqkECdKhhSUZDo20kz7A70kVf2tz3aFDFDUWlZCI45sijJr3SWM5d+ba6Fx2QPkuqUl+Ak9ePuSRsqLrg2iRraypclJ2QpnAi8X5EC+VfLutJYoTYr6LLnY+XvNDwOgWC/qpEm/CIJTSC4HXZOOrp8YkoIO+j5Aa7yxnOcls6+Ib42+MOeGmBQpWYwmCLoIasPUBONhpFtS1d9ETVGdcHRjA4R2Ifw0EGAZpNvKtrs+2dA06r9UarDMtLksS3VcNzQ/y/VXjUTtABLJwC54N/AaQ== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: f3a15cc8-e65d-4ce8-e2f8-08d3c4e7ef1b X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0844; 2:XNVa7DcSKfL8a49aIWlB5/pbh566DVEpTn3t2kPQJ+9cJuU20IqQ5sNmjAUknejLjTkZ/sAF1E2eQ0R1e8fX0R3STBN7WF29MYnu6BUACQY+mC83jDBuXRnObukvtDl2HyceKNnaCGdC5XmKVJJBwiEnTiZk6Dx3RNi0oh2Sd4HcHAg0rmmvZaLG1+p387sX; 3:nbpcdK4Z5W2Au/0/YdclpqEBug+oKElZbz6erxTRTnalK2qd37xPwL3H0YW182iYeP/fEWlKQ0LlB6jiTi2d9HIkGvmv+wtr4RiVL0jm9BVpsYK88aC4tf0Te9E0ggSNeJXG4sh60i941Rkr5PzbTnoSVqW3aYg8oXIFHxK2IPCdMMF5yA3p3HaXvW/YtomiTgLpHPhHQaeOkryqWXxY3e7ARaPCRKu8Qwz71DO3Yu8=; 25:mB3WrXGSCiy3+GvxneTR1V4FahC0MXIrO+siwY9H2AZiAa9Acp3X0nuxLUSFLm0q8ThW1BzuyM6fJoI8GsKYKg3gMJfUEHKfXc5XclRuN/zrahfCzF4om0bDJFRBQFDasVHuM+P2y258yz7sOCj1NV38lmrTfK7X9ZB/Cs0mM0dvykwkndx2mAFgtXz3QqSCA4+mgLSWGICaGQmNhwM+93d6YESMCtOPgW8bZKhqg8k49qSCvYm8R4HvoHo8eSZBMsLTmcpQhkZg4uwvmGcCg9s4HyT+Vp7Z8VlLjmTPzFzbRegYxHg7bak/c29/b0NvLKbNXI6TsIbQTHdYi6Rzv3u/TLHTqkrHmfzvAPpGtk/VuNBGWwQGvJsRD0WqZzE3Qc1LihYLmKJQHk7x4+REcMKgAf9c+EpUIWDhKyIUnVU= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0844; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0844; 31:kvtC3qzcxd91lNHSj29AW94PCgNKVZJMJmssiOUWwrBY82ewD61JfgZEIt9iQXQRiR7vN66+9R5bV6PXH2ZDIhyJZkbv914Ty32J3s7RTQb33Jq7445C+FCcJcd0K5OfRReK0xz6lyBc6h5B1Ifa0+flx1smUE/2xcFFJuPmcgTFvcGZyxv40JJSAi4S6JfsSd5SSW0rzlmPBtAX2S79DWpOfKTiiDRRDTtC7BR6WFc=; 4:HeKOEBQieo5Kpx74ijekey1rirpRxObal90ZgRtzXKRHb3PBQzDm6Rcae8GLHQ0gNsRN0/x5Wirt5532omiqVeU9I17r3iyVKrPxsRQm4cb8rODeGqe7RSFKFhDVgQWAX18JECaH7Nei3SZ/nFnezgFZ5jTVxbP/7tjrKC/Ysgrhf2vgLjay5qDP15ysourPHVakQksy4Drm2QXdHpH64hez28Arpr8hfYuD/UecLY1g58vkjNa/LjzenmoFxRHkU7MZjKKhwDcUnquh8VvSl+rLbS1FSA1h0MkAnGy1Mhsw7aDSzR/EoOvfTdqKrrWVZ+Kzo7xKDaV6HSf3bGP8HBmVrzsJ5gjO37g0uk7tmXTNfp8bN47LLfBADjSbxu8eLbPSsnknkJ0UQP0vcDA3kwHivJUNWPSszgqrVum8MPnOuTE0YIRA/ATVFuv2epzK9+yxH/1EaJo2MRrzaieaOW6QNCcb5nEXCgfNPjZm0a9r1X6aSAUQgt775naPwnX6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13018025)(8121501046)(5005006)(13017025)(13023025)(13024025)(13015025)(3002001)(10201501046)(6055026); SRVR:CY1PR0301MB0844; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB0844; X-Forefront-PRVS: 0035B15214 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB0844; 23:Gt9SwGJCzvQA/tAughc621fU4SY/vxbcGIwRR9E?= =?us-ascii?Q?qE4sphxcNJS5/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PIZI6N1Fj5UHY14O4Tj6IJEBzL3Sk3HmwmXrsz1vRa/XADgiImQa4xWx6s6vMatP0S552JXdZjEhHGU1Dq2wTLCM7Lw2e1Xv8fgiXPR2I8pH4y4sqxuUbycYAT6AAmLbbsM+B0SQjluV363hALScqee21U+Yh06HwIatV9zgDJgNNzxE3S8KcKGecsqHGNKJa+XXjuhl/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2016 08:41:21.5259 (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: CY1PR0301MB0844 Cc: Daniel Vetter , Peter Senna Tschudin , 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 We don't support configuring active plane on-the-fly for imx-drm. The relevant CRTC should be disabled before the plane configuration. Of course, the plane itself should be disabled as well. This patch adds active plane reconfiguration support by forcing CRTC mode change and disabling-enabling plane in plane's ->atomic_update callback. Suggested-by: Daniel Vetter Cc: Philipp Zabel Cc: David Airlie Cc: Russell King Cc: Daniel Vetter Cc: Peter Senna Tschudin Signed-off-by: Liu Ying Tested-by: Peter Senna Tschudin Tested-by: Lucas Stach --- v1->v2: * Do not reject reconfiguring an active overlay plane. drivers/gpu/drm/imx/imx-drm-core.c | 26 +++++++++++++++++++++++++- drivers/gpu/drm/imx/ipuv3-plane.c | 21 ++++++++++++++------- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 9f7dafc..7bf90e9 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -171,10 +171,34 @@ static void imx_drm_output_poll_changed(struct drm_device *drm) drm_fbdev_cma_hotplug_event(imxdrm->fbhelper); } +static int imx_drm_atomic_check(struct drm_device *dev, + struct drm_atomic_state *state) +{ + int ret; + + ret = drm_atomic_helper_check_modeset(dev, state); + if (ret) + return ret; + + ret = drm_atomic_helper_check_planes(dev, state); + if (ret) + return ret; + + /* + * Check modeset again in case crtc_state->mode_changed is + * updated in plane's ->atomic_check callback. + */ + ret = drm_atomic_helper_check_modeset(dev, state); + if (ret) + return ret; + + return ret; +} + static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = { .fb_create = drm_fb_cma_create, .output_poll_changed = imx_drm_output_poll_changed, - .atomic_check = drm_atomic_helper_check, + .atomic_check = imx_drm_atomic_check, .atomic_commit = drm_atomic_helper_commit, }; diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index 4ad67d0..29423e75 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c @@ -319,13 +319,14 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, return -EINVAL; /* - * since we cannot touch active IDMAC channels, we do not support - * resizing the enabled plane or changing its format + * We support resizing active plane or changing its format by + * forcing CRTC mode change and disabling-enabling plane in plane's + * ->atomic_update callback. */ if (old_fb && (state->src_w != old_state->src_w || state->src_h != old_state->src_h || fb->pixel_format != old_fb->pixel_format)) - return -EINVAL; + crtc_state->mode_changed = true; eba = drm_plane_state_to_eba(state); @@ -336,7 +337,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, return -EINVAL; if (old_fb && fb->pitches[0] != old_fb->pitches[0]) - return -EINVAL; + crtc_state->mode_changed = true; switch (fb->pixel_format) { case DRM_FORMAT_YUV420: @@ -372,7 +373,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, return -EINVAL; if (old_fb && old_fb->pitches[1] != fb->pitches[1]) - return -EINVAL; + crtc_state->mode_changed = true; } return 0; @@ -392,8 +393,14 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, enum ipu_color_space ics; if (old_state->fb) { - ipu_plane_atomic_set_base(ipu_plane, old_state); - return; + struct drm_crtc_state *crtc_state = state->crtc->state; + + if (!crtc_state->mode_changed) { + ipu_plane_atomic_set_base(ipu_plane, old_state); + return; + } + + ipu_disable_plane(plane); } switch (ipu_plane->dp_flow) {