From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Brezillon Subject: Re: [PATCH v2 5/5] drm: don't block fb changes for async plane updates Date: Tue, 12 Mar 2019 07:44:11 +0100 Message-ID: <20190312074411.59174024@collabora.com> References: <20190312022204.2775-1-helen.koike@collabora.com> <20190312022204.2775-6-helen.koike@collabora.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190312022204.2775-6-helen.koike@collabora.com> Sender: stable-owner@vger.kernel.org To: Helen Koike Cc: dri-devel@lists.freedesktop.org, nicholas.kazlauskas@amd.com, andrey.grodzovsky@amd.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, Tomasz Figa , David Airlie , Sean Paul , kernel@collabora.com, harry.wentland@amd.com, =?UTF-8?B?U3TDqXBoYW5l?= Marchesin , stable@vger.kernel.org, Sean Paul , Sandy Huang , linux-rockchip@lists.infradead.org, linux-arm-msm@vger.kernel.org, eric@anholt.net, robdclark@gmail.com, amd-gfx@lists.freedesktop.org, Heiko =?UTF-8?B?U3TDvGJuZXI=?= , Maarten Lankhorst , Daniel Vetter , freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infra List-Id: linux-arm-msm@vger.kernel.org On Mon, 11 Mar 2019 23:22:03 -0300 Helen Koike wrote: > In the case of a normal sync update, the preparation of framebuffers (be > it calling drm_atomic_helper_prepare_planes() or doing setups with > drm_framebuffer_get()) are performed in the new_state and the respective > cleanups are performed in the old_state. > > In the case of async updates, the preparation is also done in the > new_state but the cleanups are done in the new_state (because updates > are performed in place, i.e. in the current state). > > The current code blocks async udpates when the fb is changed, turning > async updates into sync updates, slowing down cursor updates and > introducing regressions in igt tests with errors of type: > > "CRITICAL: completed 97 cursor updated in a period of 30 flips, we > expect to complete approximately 15360 updates, with the threshold set > at 7680" > > Fb changes in async updates were prevented to avoid the following scenario: > > - Async update, oldfb = NULL, newfb = fb1, prepare fb1, cleanup fb1 > - Async update, oldfb = fb1, newfb = fb2, prepare fb2, cleanup fb2 > - Non-async commit, oldfb = fb2, newfb = fb1, prepare fb1, cleanup fb2 (wrong) > Where we have a single call to prepare fb2 but double cleanup call to fb2. > > To solve the above problems, instead of blocking async fb changes, we > place the old framebuffer in the new_state object, so when the code > performs cleanups in the new_state it will cleanup the old_fb and we > will have the following scenario instead: > > - Async update, oldfb = NULL, newfb = fb1, prepare fb1, no cleanup > - Async update, oldfb = fb1, newfb = fb2, prepare fb2, cleanup fb1 > - Non-async commit, oldfb = fb2, newfb = fb1, prepare fb1, cleanup fb2 > > Where calls to prepare/cleanup are balanced. > > Cc: # v4.14+ > Fixes: 25dc194b34dd ("drm: Block fb changes for async plane updates") > Suggested-by: Boris Brezillon > Signed-off-by: Helen Koike Reviewed-by: Boris Brezillon > > --- > Hello, > > As mentioned in the cover letter, I tested in almost all platforms with > igt plane_cursor_legacy and kms_cursor_legacy and I didn't see any > regressions. But I couldn't test on MSM and AMD because I don't have > the hardware I would appreciate if anyone could help me testing those. > > Thanks! > Helen > > Changes in v2: > - Change the order of the patch in the series, add this as the last one. > - Add documentation > - s/ballanced/balanced > > drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++---------- > include/drm/drm_modeset_helper_vtables.h | 5 +++++ > 2 files changed, 15 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c > index 540a77a2ade9..e7eb96f1efc2 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -1608,15 +1608,6 @@ int drm_atomic_helper_async_check(struct drm_device *dev, > old_plane_state->crtc != new_plane_state->crtc) > return -EINVAL; > > - /* > - * FIXME: Since prepare_fb and cleanup_fb are always called on > - * the new_plane_state for async updates we need to block framebuffer > - * changes. This prevents use of a fb that's been cleaned up and > - * double cleanups from occuring. > - */ > - if (old_plane_state->fb != new_plane_state->fb) > - return -EINVAL; > - > funcs = plane->helper_private; > if (!funcs->atomic_async_update) > return -EINVAL; > @@ -1657,6 +1648,9 @@ void drm_atomic_helper_async_commit(struct drm_device *dev, > int i; > > for_each_new_plane_in_state(state, plane, plane_state, i) { > + struct drm_framebuffer *new_fb = plane_state->fb; > + struct drm_framebuffer *old_fb = plane->state->fb; > + > funcs = plane->helper_private; > funcs->atomic_async_update(plane, plane_state); > > @@ -1665,11 +1659,17 @@ void drm_atomic_helper_async_commit(struct drm_device *dev, > * plane->state in-place, make sure at least common > * properties have been properly updated. > */ > - WARN_ON_ONCE(plane->state->fb != plane_state->fb); > + WARN_ON_ONCE(plane->state->fb != new_fb); > WARN_ON_ONCE(plane->state->crtc_x != plane_state->crtc_x); > WARN_ON_ONCE(plane->state->crtc_y != plane_state->crtc_y); > WARN_ON_ONCE(plane->state->src_x != plane_state->src_x); > WARN_ON_ONCE(plane->state->src_y != plane_state->src_y); > + > + /* > + * Make sure the FBs have been swapped so that cleanups in the > + * new_state performs a cleanup in the old FB. > + */ > + WARN_ON_ONCE(plane_state->fb != old_fb); > } > } > EXPORT_SYMBOL(drm_atomic_helper_async_commit); > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h > index cfb7be40bed7..ce582e8e8f2f 100644 > --- a/include/drm/drm_modeset_helper_vtables.h > +++ b/include/drm/drm_modeset_helper_vtables.h > @@ -1174,6 +1174,11 @@ struct drm_plane_helper_funcs { > * current one with the new plane configurations in the new > * plane_state. > * > + * Drivers should also swap the framebuffers between plane state > + * and new_state. This is required because prepare and cleanup calls > + * are performed on the new_state object, then to cleanup the old > + * framebuffer, it needs to be placed inside the new_state object. > + * > * FIXME: > * - It only works for single plane updates > * - Async Pageflips are not supported yet From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2043CC10F00 for ; Tue, 12 Mar 2019 06:44:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E25BF214D8 for ; Tue, 12 Mar 2019 06:44:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727202AbfCLGoS (ORCPT ); Tue, 12 Mar 2019 02:44:18 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:57536 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726325AbfCLGoR (ORCPT ); Tue, 12 Mar 2019 02:44:17 -0400 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:b93f:9fae:b276:a89a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id D123D2802E8; Tue, 12 Mar 2019 06:44:14 +0000 (GMT) Date: Tue, 12 Mar 2019 07:44:11 +0100 From: Boris Brezillon To: Helen Koike Cc: dri-devel@lists.freedesktop.org, nicholas.kazlauskas@amd.com, andrey.grodzovsky@amd.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, Tomasz Figa , David Airlie , Sean Paul , kernel@collabora.com, harry.wentland@amd.com, =?UTF-8?B?U3TDqXBoYW5l?= Marchesin , stable@vger.kernel.org, Sean Paul , Sandy Huang , linux-rockchip@lists.infradead.org, linux-arm-msm@vger.kernel.org, eric@anholt.net, robdclark@gmail.com, amd-gfx@lists.freedesktop.org, Heiko =?UTF-8?B?U3TDvGJuZXI=?= , Maarten Lankhorst , Daniel Vetter , freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Maxime Ripard Subject: Re: [PATCH v2 5/5] drm: don't block fb changes for async plane updates Message-ID: <20190312074411.59174024@collabora.com> In-Reply-To: <20190312022204.2775-6-helen.koike@collabora.com> References: <20190312022204.2775-1-helen.koike@collabora.com> <20190312022204.2775-6-helen.koike@collabora.com> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 11 Mar 2019 23:22:03 -0300 Helen Koike wrote: > In the case of a normal sync update, the preparation of framebuffers (be > it calling drm_atomic_helper_prepare_planes() or doing setups with > drm_framebuffer_get()) are performed in the new_state and the respective > cleanups are performed in the old_state. > > In the case of async updates, the preparation is also done in the > new_state but the cleanups are done in the new_state (because updates > are performed in place, i.e. in the current state). > > The current code blocks async udpates when the fb is changed, turning > async updates into sync updates, slowing down cursor updates and > introducing regressions in igt tests with errors of type: > > "CRITICAL: completed 97 cursor updated in a period of 30 flips, we > expect to complete approximately 15360 updates, with the threshold set > at 7680" > > Fb changes in async updates were prevented to avoid the following scenario: > > - Async update, oldfb = NULL, newfb = fb1, prepare fb1, cleanup fb1 > - Async update, oldfb = fb1, newfb = fb2, prepare fb2, cleanup fb2 > - Non-async commit, oldfb = fb2, newfb = fb1, prepare fb1, cleanup fb2 (wrong) > Where we have a single call to prepare fb2 but double cleanup call to fb2. > > To solve the above problems, instead of blocking async fb changes, we > place the old framebuffer in the new_state object, so when the code > performs cleanups in the new_state it will cleanup the old_fb and we > will have the following scenario instead: > > - Async update, oldfb = NULL, newfb = fb1, prepare fb1, no cleanup > - Async update, oldfb = fb1, newfb = fb2, prepare fb2, cleanup fb1 > - Non-async commit, oldfb = fb2, newfb = fb1, prepare fb1, cleanup fb2 > > Where calls to prepare/cleanup are balanced. > > Cc: # v4.14+ > Fixes: 25dc194b34dd ("drm: Block fb changes for async plane updates") > Suggested-by: Boris Brezillon > Signed-off-by: Helen Koike Reviewed-by: Boris Brezillon > > --- > Hello, > > As mentioned in the cover letter, I tested in almost all platforms with > igt plane_cursor_legacy and kms_cursor_legacy and I didn't see any > regressions. But I couldn't test on MSM and AMD because I don't have > the hardware I would appreciate if anyone could help me testing those. > > Thanks! > Helen > > Changes in v2: > - Change the order of the patch in the series, add this as the last one. > - Add documentation > - s/ballanced/balanced > > drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++---------- > include/drm/drm_modeset_helper_vtables.h | 5 +++++ > 2 files changed, 15 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c > index 540a77a2ade9..e7eb96f1efc2 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -1608,15 +1608,6 @@ int drm_atomic_helper_async_check(struct drm_device *dev, > old_plane_state->crtc != new_plane_state->crtc) > return -EINVAL; > > - /* > - * FIXME: Since prepare_fb and cleanup_fb are always called on > - * the new_plane_state for async updates we need to block framebuffer > - * changes. This prevents use of a fb that's been cleaned up and > - * double cleanups from occuring. > - */ > - if (old_plane_state->fb != new_plane_state->fb) > - return -EINVAL; > - > funcs = plane->helper_private; > if (!funcs->atomic_async_update) > return -EINVAL; > @@ -1657,6 +1648,9 @@ void drm_atomic_helper_async_commit(struct drm_device *dev, > int i; > > for_each_new_plane_in_state(state, plane, plane_state, i) { > + struct drm_framebuffer *new_fb = plane_state->fb; > + struct drm_framebuffer *old_fb = plane->state->fb; > + > funcs = plane->helper_private; > funcs->atomic_async_update(plane, plane_state); > > @@ -1665,11 +1659,17 @@ void drm_atomic_helper_async_commit(struct drm_device *dev, > * plane->state in-place, make sure at least common > * properties have been properly updated. > */ > - WARN_ON_ONCE(plane->state->fb != plane_state->fb); > + WARN_ON_ONCE(plane->state->fb != new_fb); > WARN_ON_ONCE(plane->state->crtc_x != plane_state->crtc_x); > WARN_ON_ONCE(plane->state->crtc_y != plane_state->crtc_y); > WARN_ON_ONCE(plane->state->src_x != plane_state->src_x); > WARN_ON_ONCE(plane->state->src_y != plane_state->src_y); > + > + /* > + * Make sure the FBs have been swapped so that cleanups in the > + * new_state performs a cleanup in the old FB. > + */ > + WARN_ON_ONCE(plane_state->fb != old_fb); > } > } > EXPORT_SYMBOL(drm_atomic_helper_async_commit); > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h > index cfb7be40bed7..ce582e8e8f2f 100644 > --- a/include/drm/drm_modeset_helper_vtables.h > +++ b/include/drm/drm_modeset_helper_vtables.h > @@ -1174,6 +1174,11 @@ struct drm_plane_helper_funcs { > * current one with the new plane configurations in the new > * plane_state. > * > + * Drivers should also swap the framebuffers between plane state > + * and new_state. This is required because prepare and cleanup calls > + * are performed on the new_state object, then to cleanup the old > + * framebuffer, it needs to be placed inside the new_state object. > + * > * FIXME: > * - It only works for single plane updates > * - Async Pageflips are not supported yet From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47C29C43381 for ; Tue, 12 Mar 2019 06:44:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 17DD32147C for ; Tue, 12 Mar 2019 06:44:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vAe1HAtv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 17DD32147C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x4wH3oIZ+zpVKBHfBUI9sjr+V/gSflQnfW7Ihx6/C0w=; b=vAe1HAtv/YXn/k RoxcJiQGICrI6y9h+kpxtELyAGqH8IpBb1dlvOOK64T65tu95y86mREZa7v3SpJQRphSzI+YYnpU4 I3+yo8p5st7g5VvMK5pljcRHKch6U3zTLcNpZXGREGOTK2qPRFtqZ2hnQCR97lhS0JiKb8ZZlA8su BroPQZoCkYcUsXfjA2+h1drB2LQ76xOd2mzs/qpG/Y+ai8nHsZBlYBCvbez01NTysVNcIes/tXmn8 hJLSOgdl3rgP7+DKAoKjMmMsfqzr6E4RlymTomeBJpwZ9K8ulKsJvd5df/m/aQWCnVRkgC1UxQLqb v4GgtNg9GMxZ4a6uxO7A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3b9B-00031a-F4; Tue, 12 Mar 2019 06:44:21 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3b97-00030p-En; Tue, 12 Mar 2019 06:44:19 +0000 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:b93f:9fae:b276:a89a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id D123D2802E8; Tue, 12 Mar 2019 06:44:14 +0000 (GMT) Date: Tue, 12 Mar 2019 07:44:11 +0100 From: Boris Brezillon To: Helen Koike Subject: Re: [PATCH v2 5/5] drm: don't block fb changes for async plane updates Message-ID: <20190312074411.59174024@collabora.com> In-Reply-To: <20190312022204.2775-6-helen.koike@collabora.com> References: <20190312022204.2775-1-helen.koike@collabora.com> <20190312022204.2775-6-helen.koike@collabora.com> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190311_234417_762183_6B7C42B2 X-CRM114-Status: GOOD ( 29.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko =?UTF-8?B?U3TDvGJuZXI=?= , Sean Paul , David Airlie , daniel.vetter@ffwll.ch, dri-devel@lists.freedesktop.org, Sandy Huang , eric@anholt.net, kernel@collabora.com, Maxime Ripard , amd-gfx@lists.freedesktop.org, linux-rockchip@lists.infradead.org, harry.wentland@amd.com, andrey.grodzovsky@amd.com, linux-arm-msm@vger.kernel.org, Maarten Lankhorst , Sean Paul , linux-arm-kernel@lists.infradead.org, =?UTF-8?B?U3TDqXBoYW5l?= Marchesin , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Tomasz Figa , robdclark@gmail.com, Daniel Vetter , freedreno@lists.freedesktop.org, nicholas.kazlauskas@amd.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 11 Mar 2019 23:22:03 -0300 Helen Koike wrote: > In the case of a normal sync update, the preparation of framebuffers (be > it calling drm_atomic_helper_prepare_planes() or doing setups with > drm_framebuffer_get()) are performed in the new_state and the respective > cleanups are performed in the old_state. > > In the case of async updates, the preparation is also done in the > new_state but the cleanups are done in the new_state (because updates > are performed in place, i.e. in the current state). > > The current code blocks async udpates when the fb is changed, turning > async updates into sync updates, slowing down cursor updates and > introducing regressions in igt tests with errors of type: > > "CRITICAL: completed 97 cursor updated in a period of 30 flips, we > expect to complete approximately 15360 updates, with the threshold set > at 7680" > > Fb changes in async updates were prevented to avoid the following scenario: > > - Async update, oldfb = NULL, newfb = fb1, prepare fb1, cleanup fb1 > - Async update, oldfb = fb1, newfb = fb2, prepare fb2, cleanup fb2 > - Non-async commit, oldfb = fb2, newfb = fb1, prepare fb1, cleanup fb2 (wrong) > Where we have a single call to prepare fb2 but double cleanup call to fb2. > > To solve the above problems, instead of blocking async fb changes, we > place the old framebuffer in the new_state object, so when the code > performs cleanups in the new_state it will cleanup the old_fb and we > will have the following scenario instead: > > - Async update, oldfb = NULL, newfb = fb1, prepare fb1, no cleanup > - Async update, oldfb = fb1, newfb = fb2, prepare fb2, cleanup fb1 > - Non-async commit, oldfb = fb2, newfb = fb1, prepare fb1, cleanup fb2 > > Where calls to prepare/cleanup are balanced. > > Cc: # v4.14+ > Fixes: 25dc194b34dd ("drm: Block fb changes for async plane updates") > Suggested-by: Boris Brezillon > Signed-off-by: Helen Koike Reviewed-by: Boris Brezillon > > --- > Hello, > > As mentioned in the cover letter, I tested in almost all platforms with > igt plane_cursor_legacy and kms_cursor_legacy and I didn't see any > regressions. But I couldn't test on MSM and AMD because I don't have > the hardware I would appreciate if anyone could help me testing those. > > Thanks! > Helen > > Changes in v2: > - Change the order of the patch in the series, add this as the last one. > - Add documentation > - s/ballanced/balanced > > drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++---------- > include/drm/drm_modeset_helper_vtables.h | 5 +++++ > 2 files changed, 15 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c > index 540a77a2ade9..e7eb96f1efc2 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -1608,15 +1608,6 @@ int drm_atomic_helper_async_check(struct drm_device *dev, > old_plane_state->crtc != new_plane_state->crtc) > return -EINVAL; > > - /* > - * FIXME: Since prepare_fb and cleanup_fb are always called on > - * the new_plane_state for async updates we need to block framebuffer > - * changes. This prevents use of a fb that's been cleaned up and > - * double cleanups from occuring. > - */ > - if (old_plane_state->fb != new_plane_state->fb) > - return -EINVAL; > - > funcs = plane->helper_private; > if (!funcs->atomic_async_update) > return -EINVAL; > @@ -1657,6 +1648,9 @@ void drm_atomic_helper_async_commit(struct drm_device *dev, > int i; > > for_each_new_plane_in_state(state, plane, plane_state, i) { > + struct drm_framebuffer *new_fb = plane_state->fb; > + struct drm_framebuffer *old_fb = plane->state->fb; > + > funcs = plane->helper_private; > funcs->atomic_async_update(plane, plane_state); > > @@ -1665,11 +1659,17 @@ void drm_atomic_helper_async_commit(struct drm_device *dev, > * plane->state in-place, make sure at least common > * properties have been properly updated. > */ > - WARN_ON_ONCE(plane->state->fb != plane_state->fb); > + WARN_ON_ONCE(plane->state->fb != new_fb); > WARN_ON_ONCE(plane->state->crtc_x != plane_state->crtc_x); > WARN_ON_ONCE(plane->state->crtc_y != plane_state->crtc_y); > WARN_ON_ONCE(plane->state->src_x != plane_state->src_x); > WARN_ON_ONCE(plane->state->src_y != plane_state->src_y); > + > + /* > + * Make sure the FBs have been swapped so that cleanups in the > + * new_state performs a cleanup in the old FB. > + */ > + WARN_ON_ONCE(plane_state->fb != old_fb); > } > } > EXPORT_SYMBOL(drm_atomic_helper_async_commit); > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h > index cfb7be40bed7..ce582e8e8f2f 100644 > --- a/include/drm/drm_modeset_helper_vtables.h > +++ b/include/drm/drm_modeset_helper_vtables.h > @@ -1174,6 +1174,11 @@ struct drm_plane_helper_funcs { > * current one with the new plane configurations in the new > * plane_state. > * > + * Drivers should also swap the framebuffers between plane state > + * and new_state. This is required because prepare and cleanup calls > + * are performed on the new_state object, then to cleanup the old > + * framebuffer, it needs to be placed inside the new_state object. > + * > * FIXME: > * - It only works for single plane updates > * - Async Pageflips are not supported yet _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel