From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark yao Subject: Re: [PATCH] drm/rockchip: Return -EBUSY if there's already a pending flip event v2 Date: Fri, 01 Apr 2016 19:26:33 +0800 Message-ID: <56FE5AE9.40806@rock-chips.com> References: <1459411680-6176-1-git-send-email-tomeu.vizoso@collabora.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0894040454==" Return-path: In-Reply-To: <1459411680-6176-1-git-send-email-tomeu.vizoso@collabora.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Tomeu Vizoso , linux-kernel@vger.kernel.org Cc: linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org List-Id: linux-rockchip.vger.kernel.org --===============0894040454== Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On 2016=E5=B9=B403=E6=9C=8831=E6=97=A5= 16:08, Tomeu Vizoso wrote:
As per the docs, atomic_commit should return -EBUSY =
"if an asycnhronous
updated is requested and there is an earlier updated pending".

v2: Use the status of the workqueue instead of vop->event, and don't a=
dd
a superfluous wait on the workqueue.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm=
/rockchip/rockchip_drm_fb.c
index 3b8f652698f8..285f8cd5afe1 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -282,6 +282,9 @@ int rockchip_drm_atomic_commit(struct drm_device *dev=
,
 	struct rockchip_atomic_commit *commit =3D &private->commit;
 	int ret;
=20
+	if (async && work_busy(&commit->work))
+		return -EBUSY;
+

Sorry for reply late.

There is a comment on work_busy function describe :

=C2=A0=C2=A0=C2=A0 "the test result is=C2=A0 unreliable and only usef= ul as advisory hints or for debugging."

I don't know if it's suitable to use it here, does some guys know it?

And then, the "flush_work(&commit->work);" is no needed if return -EBUSY here.
you can remove it at this patch.


 	ret =3D drm_atomic_helper_prepare_planes(dev, state);
 	if (ret)
 		return ret;



--=20
=EF=BC=ADark Yao
--===============0894040454== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0894040454==--