From patchwork Fri Jan 6 20:39:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 9501787 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 5BF9D60413 for ; Fri, 6 Jan 2017 20:54:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 506BA28520 for ; Fri, 6 Jan 2017 20:54:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44C0128526; Fri, 6 Jan 2017 20:54:27 +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.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 4E65628520 for ; Fri, 6 Jan 2017 20:54:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC2376E3A0; Fri, 6 Jan 2017 20:54:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0042.outbound.protection.outlook.com [104.47.41.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 00AEA6E3A0 for ; Fri, 6 Jan 2017 20:54:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1eFnfPOgm8j2h4L131+fCergrvCbQUTDpf2Igx7tiNk=; b=Ojl5VVL6SoDuEQFkziX2uDJ50xhXewA9/zVNbTVbyP8Qwfxv/Agihkt6omJh0ZR25/SuGOW/Qo4m5EvFNMiTtNHFezoxjtzrPEjE4is4yLoaxo0XU+cleKpXLl5abDCsRlFG9aImVL/JTNyDr5FR9Svur7l058ECQKaXZRpIAwo= Received: from CY1PR1201CA0028.namprd12.prod.outlook.com (10.169.17.166) by CY1PR12MB0442.namprd12.prod.outlook.com (10.163.91.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Fri, 6 Jan 2017 20:39:58 +0000 Received: from DM3NAM03FT055.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::209) by CY1PR1201CA0028.outlook.office365.com (2a01:111:e400:5b9a::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7 via Frontend Transport; Fri, 6 Jan 2017 20:39:58 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by DM3NAM03FT055.mail.protection.outlook.com (10.152.83.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.8 via Frontend Transport; Fri, 6 Jan 2017 20:39:57 +0000 Received: from SCYBEXDAG01.amd.com (10.34.11.11) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 6 Jan 2017 14:39:56 -0600 Received: from agrodzovsky-All-Series.amd.com (172.29.227.109) by SCYBEXDAG01.amd.com (10.34.11.11) with Microsoft SMTP Server id 14.3.319.2; Sat, 7 Jan 2017 04:39:51 +0800 From: Andrey Grodzovsky To: Subject: Re: [PATCH] drm/atomic: Add target_vblank support in atomic helpers (v2) Date: Fri, 6 Jan 2017 15:39:40 -0500 Message-ID: <1483735180-4173-1-git-send-email-Andrey.Grodzovsky@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <20170105075806.pkonqb7bjjcxfyov@phenom.ffwll.local> References: <20170105075806.pkonqb7bjjcxfyov@phenom.ffwll.local> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39860400002)(39840400002)(39450400003)(39850400002)(39410400002)(2980300002)(428002)(199003)(189002)(86362001)(5003940100001)(8676002)(81156014)(101416001)(81166006)(76176999)(92566002)(50986999)(8936002)(68736007)(356003)(50226002)(106466001)(105586002)(53416004)(2351001)(97736004)(4326007)(36756003)(47776003)(6666003)(110136003)(189998001)(77096006)(48376002)(50466002)(5660300001)(38730400001)(54906002)(2950100002)(6916009)(626004)(229853002)(305945005)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0442; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT055; 1:8AR88EIwbeVHZkcYkm9wwnEemCwH8mSEIeNw20e9FXR5yVhzCq1SAfE7Qfda+dxEDEV9h5f+/bYgygB2U7btN2m8l75SC642JOBqMjqEHwxE7P530RdeU68feLzGGNPFcXvs+U2cnLaBBn12GgTh46m+Gp4IqyweHD8TjjKYvF5FZ9KrT1Q+FyU3dR+ZZquiM1zkMM8aQCe83DutG6+PG3Gno6lvex4bTCOh81zahJTxWq7NdwtxDgZKYvZWhqezL6F8MJ2KPksqw/G9tG/pJW0EIx3i6xe4av07BBa52tz9DXiYRZ67GLcNjug1N96+GdfLtqtvvx8e5EoKzYWyGUrbZNeXQN4dtA1u0QlfzYaGkP6g9/8IhJI4ZHaOKUKwjFuSjFk7S1n2HO4szRYtvoXzVLyo3dZthdOtmitaCCB+RIVgdDm6u1uM1LGUdzi1O/j4uuPiNXmZqOmoLivHBw== X-MS-Office365-Filtering-Correlation-Id: 5e67d11f-79c5-4784-1d27-08d436742df3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR12MB0442; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0442; 3:v6NHCUE4qUWXVgliHwpIX0Z1N1rGLKdsn4evCfnqnk7aUZSIiCqpn4j0pPfm2B5oBUNYY26baBNfMgtoJ92+wSacj2L0/NcazX2PDd906j66njk+24VXWr0HzH4b7oVmXAuiFaw8iPlO78kj3GEp476yNYDnxX23Hzz66R0hFPJOBuurntwgMKqisunR+Tu4sKDeL6StctZ7LrMkUMH+T0hNgxqwt1+o2niP1pNdmGmNxRQpj2TVWMVVe3gMSvjW7c0ObOHNke6srLgfrOnp79pkN60xJZiP2VByhaJ3MhBmGywV13mnanemFqft/iZk1hMyt5+jdtvfJFLipBcAXlOuhj18p8ZfimT88KvadDNYJphJmEKLV6zIWPcP3y8r X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0442; 25:ywNGm9d0SL5RTfH3ASb1+/nwQcrFWPScW/VcFv+b2zqGqX34lh1Na/YpUPWX9zs/8vKIy55yeeUSzfIAqy7aRawSwp6aeBCktQ82JY7OlVibowzF118aO8X1ReSaysFu9F1z6nB++TFJib3fi68E9ePSNvsp7k/f79OmrFC8Gaf3QWX497BJDCBFyXJCpiypVt3TzMqI5P5VFcQr5luxhI5uSO236g25HMN0abPdY64WJkx+DgDsMdb0VIK7VVHpkXxHI3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gmGoMBFofsWCgcl4NnN/h4uNr+lVtYIBCnmxbKOcBy9+cF7lsTOHi7Q/jftHBuhhh+ol85Yf0eaJG7AYiH4g+uxYqa7MlJkx28JKifLkJhIo+J6Di7zyZ+wmpLaNddQ3wrOoLjCzljddw8usy938Q2ctoJ1lflwedw23WkXj2cGZGcoEUYrkdN0KcpZQDo9npB4m+Akab2pLnmEOVXzoS0cS5lwj+/eFtUonKsPzvnxVW5jvXA9xwSJfvkWEP0jB2ShW7VNRS5Id+UgGfYI2RIVzC9b3AQ6AP7ZS1n/4dHVMS0RHmqriiQgZw5f6zbNQ62XA++gMLQBTvU85XAw7uBgcRyL/5BMa6O4C X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13016025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:CY1PR12MB0442; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0442; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0442; 4:ukl6XckJ/Xp59vNTTkDXfl7zb4D3uV1UfgZtXbzxUcvw3mBxSexPB2tADSULsiTgasd6tILFnOVOMv9aOxRt37P+PfyjNFW0ah+ROVLHk2aeXqDoQZ6Rcx7TosdcLwXWNdIW9B8gBtHtWYtDQ8YLP0R9HvjHb2x+tAJoIZCwRcfppZvwKjPNe1ojjJSDaWM4uy1IkdPS/GdW55LaTwv5/G5O+qkIeVDnsIM98O6quSnq1nBB0fEnm3cQSpvwifRbFFLtXjDMN7r8Mu4DmFWn0iRNkhIZZSJS223kVvcq1zJNY+cSFhZSaqm1NQYeAKlWpqUxasEWXWSv03WB9STcW0qiXLbIIzSIVSpV8XliJH/o16VNwFbu8fqyePcWzdOYfxr37xK6af0BkHLfyKFg/eATPS69+8GeqWuOZlgLrdkBg658io7nssfnnrw4q6mDOciXDniIaLe21FsZc87Ps22ilavswHDmZ1iXSGI7Aogz46tn9jnjJ7yDf14kfaDwVc1/Yb3O+suOb34dlSlJyGk7jLUznxbaktMrVPrhJj0EYjrFQ5kWFuqh3YKnFiovGy9ToRlzHc23V3bYEaBBwocJ2CgPRyL343TKQ19Xo65dQWKvEJ+wCqPbNf89UmZVXKbSH8wnzx7jdM6e1vZr/5oZ93f9vMy/6/hj6a6TzTI= X-Forefront-PRVS: 01792087B6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR12MB0442; 23:3wcWJZpGt1TiqCTTr1EzYLsf4x20XW2AJ0Z9EX+0P?= =?us-ascii?Q?yR5HAw4FJM3DudEJHDHJwlJzSrLdZMczl8anaAeeMlYxXXavOWh8ui5Sh1in?= =?us-ascii?Q?Nd1xbDkaNLmoVeXxemmfuS6obR1vYqEVw9edeAJZv9LxEqnXgPkFbZOczaUe?= =?us-ascii?Q?g2nzVKefFr45Ri6F7rxXBq5yAc3fXJamXTUQV34JGcGNmv5DsBBXPxbmAyci?= =?us-ascii?Q?D9WwWO+naIiSzmVYDLgRJHlLgSmhp/sAPC7OML1Touen+sC8Iqw55oiTQQNj?= =?us-ascii?Q?Q3uFWzg+8ddtLc8AQyEYtyOGabD8HLJFCaivg6cZ0aqWoMm0DY4d7p/jg7Zl?= =?us-ascii?Q?TcEaCKTqWY31DDoR04mlGzXqT/EzumjfVFuPA4PGhTeTAHcvIu1xQgatUxh4?= =?us-ascii?Q?C5c5KL/0wWzZLL3Fk6om4jJaydpGzY2xQ8DPxRF5bBOLlCqEnf8Jo6Ec97EA?= =?us-ascii?Q?tdhlvJFJl143f/SwPsElRW8eSZhSGulscHBQa/VUa7IurUC5DsrUNBU2jpuE?= =?us-ascii?Q?3/PagiGEnoZnUEHjtEU8VgjVY1h6HUC4XMw3voNLYdbiIKUCSiRFWg8fjibR?= =?us-ascii?Q?nnQPXrrmiZOcGME7KTjElG0VohyfUKJf6UCtUv+f2rJyft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LqryJvuPWtQHwWDZU3leHnufcCoUPOWiDjRirJ3SxQIO+sQfhXMKsnQScKYG8e26OGZvVmcd/J/vXaOFgtqK3Dz6xfjsTyaYrR1RBHDG16YQ==; 5:VIyfMkE9hi17+kKklgDzNI25CohAh+33VR2JCYXgykfq3dBKZpoX2uTDWchyomAYLIXdLXx9c/FhiD1FkjThLPj0IkogD+Hws1PbpVlaSDBpJiscr1EfemJ3HzgXCSA9gSnzQGoIwBBn+sqd4ck4D4rdv/JxLC7y2rfgMFjSb/I=; 24:r31HARUq13GgSSdjLgizn6m1FLIBmxy+9uc72O53OAseLOb2lyArqXNNIn255UvS8DZhYtES8prCMOuqcAZkiU3dfkedfnbzrINsoVT7ic0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0442; 7:E4Wr+Px61UZzy1AkDHMFQcqEgU6QSVNgeWih2Gd+led4Or9rVUDCaC0XQxjODTu0FigB6niK/KAGyH6OvbjxELbVKzLeIwfxO/mYI1jvsuQm9nA0y3C/7JKK3JoVGkOjPG3xlKTp2fT3ftnBFd2/Yqgm2C7fvKtW8dmqW9m7b+lnFKsE9zzo26avv5DMwfotHUVsCkmiQVuMCAEnHPrXHEeqocGmGqiCZfkwebJwPZO3An2X/R7tf8pUtnXyRy5foviFtm5eXGM8KCse6ifxaxuxp4T3Jj4dmptHEhKYz176DENBq1zphINRn4pAkign0+f0SbvOGWePsYw5JXmLL/HvRi9/BHysWNquX2Qq1/w1ost5cToNR4Ap/q7xZJ7V4RsquPYRWsW4A2hIe3NlQ/Hf50FYP3shp1qF5GXJTA9sIXKYnsORIeGvbuQ9tk1C1pmWZNwjj0DEsqOlnSxvmw==; 20:GY6nz+mfygLU+9v97hYZdsejBKOYyK2+319HU7V1S/vGTMzTfTXllgcKVYQfEQhMzgIGor7cKT3IYWGrL9tHh+Rx7LP1JgyA4dwI60BIeKy6iYI0d6lCmU/MFM073OXfnehD0IuHT3zvUpHV/PEqfBPopk/XJFXrxlyEwu8OmDn0INeGs2EgCLhHf91N8Eh4+8ALNkxmKSnmXi6onICG/IxzKSpslB5uuEtjyn/P5fGc0pd473A9mes5zJCMpJE/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2017 20:39:57.9846 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0442 Cc: Alexander.Deucher@amd.com, daniel.vetter@ffwll.ch, Michel.Daenzer@amd.com, Andrey Grodzovsky 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 Allows usage of the new page_flip_target hook for drivers implementing the atomic path. Provides default atomic helper for the new hook. v2: Update code sharing logic between exsiting and the new flip hooks. Improve kerneldoc. Signed-off-by: Andrey Grodzovsky Acked-by: Alex Deucher --- drivers/gpu/drm/drm_atomic_helper.c | 133 ++++++++++++++++++++++++++++++------ include/drm/drm_atomic_helper.h | 6 ++ include/drm/drm_crtc.h | 9 +++ 3 files changed, 127 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 583f47f..a4e5477 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2733,6 +2733,44 @@ int drm_atomic_helper_resume(struct drm_device *dev, } EXPORT_SYMBOL(drm_atomic_helper_connector_set_property); +static int page_flip_common( + struct drm_atomic_state *state, + struct drm_crtc *crtc, + struct drm_framebuffer *fb, + struct drm_pending_vblank_event *event) +{ + struct drm_plane *plane = crtc->primary; + struct drm_plane_state *plane_state; + struct drm_crtc_state *crtc_state; + int ret = 0; + + crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(crtc_state)) + return PTR_ERR(crtc_state); + + crtc_state->event = event; + + plane_state = drm_atomic_get_plane_state(state, plane); + if (IS_ERR(plane_state)) + return PTR_ERR(plane_state); + + + ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); + if (ret != 0) + return ret; + drm_atomic_set_fb_for_plane(plane_state, fb); + + /* Make sure we don't accidentally do a full modeset. */ + state->allow_modeset = false; + if (!crtc_state->active) { + DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy flip\n", + crtc->base.id); + return -EINVAL; + } + + return ret; +} + /** * drm_atomic_helper_page_flip - execute a legacy page flip * @crtc: DRM crtc @@ -2740,7 +2778,8 @@ int drm_atomic_helper_resume(struct drm_device *dev, * @event: optional DRM event to signal upon completion * @flags: flip flags for non-vblank sync'ed updates * - * Provides a default page flip implementation using the atomic driver interface. + * Provides a default &drm_crtc_funcs.page_flip implementation + * using the atomic driver interface. * * Note that for now so called async page flips (i.e. updates which are not * synchronized to vblank) are not supported, since the atomic interfaces have @@ -2748,6 +2787,9 @@ int drm_atomic_helper_resume(struct drm_device *dev, * * Returns: * Returns 0 on success, negative errno numbers on failure. + * + * See also: + * drm_atomic_helper_page_flip_target() */ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, @@ -2756,8 +2798,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, { struct drm_plane *plane = crtc->primary; struct drm_atomic_state *state; - struct drm_plane_state *plane_state; - struct drm_crtc_state *crtc_state; int ret = 0; if (flags & DRM_MODE_PAGE_FLIP_ASYNC) @@ -2768,35 +2808,86 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, return -ENOMEM; state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); + retry: - crtc_state = drm_atomic_get_crtc_state(state, crtc); - if (IS_ERR(crtc_state)) { - ret = PTR_ERR(crtc_state); + ret = page_flip_common(state, crtc, fb, event); + if (ret != 0) goto fail; - } - crtc_state->event = event; - plane_state = drm_atomic_get_plane_state(state, plane); - if (IS_ERR(plane_state)) { - ret = PTR_ERR(plane_state); - goto fail; - } + ret = drm_atomic_nonblocking_commit(state); - ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); +fail: + if (ret == -EDEADLK) + goto backoff; + + drm_atomic_state_put(state); + return ret; + +backoff: + drm_atomic_state_clear(state); + drm_atomic_legacy_backoff(state); + + /* + * Someone might have exchanged the framebuffer while we dropped locks + * in the backoff code. We need to fix up the fb refcount tracking the + * core does for us. + */ + plane->old_fb = plane->fb; + + goto retry; +} +EXPORT_SYMBOL(drm_atomic_helper_page_flip); + +/** + * drm_atomic_helper_page_flip_target - do page flip on target vblank period. + * @crtc: DRM crtc + * @fb: DRM framebuffer + * @event: optional DRM event to signal upon completion + * @flags: flip flags for non-vblank sync'ed updates + * @target: specifying the target vblank period when the flip to take effect + * + * Provides a default &drm_crtc_funcs.page_flip_target implementation. + * Similar to drm_atomic_helper_page_flip() with extra parameter to specify + * target vblank period to flip. + * + * Returns: + * Returns 0 on success, negative errno numbers on failure. + */ +int drm_atomic_helper_page_flip_target( + struct drm_crtc *crtc, + struct drm_framebuffer *fb, + struct drm_pending_vblank_event *event, + uint32_t flags, + uint32_t target) +{ + struct drm_plane *plane = crtc->primary; + struct drm_atomic_state *state; + struct drm_crtc_state *crtc_state; + int ret = 0; + + if (flags & DRM_MODE_PAGE_FLIP_ASYNC) + return -EINVAL; + + state = drm_atomic_state_alloc(plane->dev); + if (!state) + return -ENOMEM; + + state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); + +retry: + ret = page_flip_common(state, crtc, fb, event); if (ret != 0) goto fail; - drm_atomic_set_fb_for_plane(plane_state, fb); - /* Make sure we don't accidentally do a full modeset. */ - state->allow_modeset = false; - if (!crtc_state->active) { - DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy flip\n", - crtc->base.id); + crtc_state = drm_atomic_get_existing_crtc_state(state, crtc); + if (WARN_ON(!crtc_state)) { ret = -EINVAL; goto fail; } + crtc_state->target_vblank = target; ret = drm_atomic_nonblocking_commit(state); + fail: if (ret == -EDEADLK) goto backoff; @@ -2817,7 +2908,7 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, goto retry; } -EXPORT_SYMBOL(drm_atomic_helper_page_flip); +EXPORT_SYMBOL(drm_atomic_helper_page_flip_target); /** * drm_atomic_helper_connector_dpms() - connector dpms helper implementation diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 7ff92b0..b3b3abe 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -124,6 +124,12 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_pending_vblank_event *event, uint32_t flags); +int drm_atomic_helper_page_flip_target( + struct drm_crtc *crtc, + struct drm_framebuffer *fb, + struct drm_pending_vblank_event *event, + uint32_t flags, + uint32_t target); int drm_atomic_helper_connector_dpms(struct drm_connector *connector, int mode); struct drm_encoder * diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 946672f..5c77c3f 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -157,6 +157,15 @@ struct drm_crtc_state { struct drm_property_blob *gamma_lut; /** + * @target_vblank: + * + * Target vertical blank period when a page flip + * should take effect. + */ + + u32 target_vblank; + + /** * @event: * * Optional pointer to a DRM event to signal upon completion of the