From: Thomas Zimmermann Subject: Re: [PATCH v2 5/9] drm/ast: Pin framebuffer BO during dirty update Date: Wed, 12 Jun 2019 09:35:32 +0200 Message-ID: <038d4a58-1980-3b76-ea53-9b354980723a@suse.de> References: <20190611130344.18988-1-tzimmermann@suse.de> <20190611130344.18988-6-tzimmermann@suse.de> <20190611202953.GA18315@ravnborg.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1723008435==" Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id C251289110 for ; Wed, 12 Jun 2019 07:35:38 +0000 (UTC) In-Reply-To: <20190611202953.GA18315@ravnborg.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Sam Ravnborg Cc: maxime.ripard@bootlin.com, dri-devel@lists.freedesktop.org, kraxel@redhat.com, airlied@redhat.com, sean@poorly.run List-Id: dri-devel@lists.freedesktop.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============1723008435== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sS1Hx6bimTLHfU3dFmBTCIDfRh4yrrh3F" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sS1Hx6bimTLHfU3dFmBTCIDfRh4yrrh3F Content-Type: multipart/mixed; boundary="7802NKn3Mlxyu3awESru6TcD03evH4NhX"; protected-headers="v1" From: Thomas Zimmermann To: Sam Ravnborg Cc: kraxel@redhat.com, airlied@redhat.com, daniel@ffwll.ch, maarten.lankhorst@linux.intel.com, maxime.ripard@bootlin.com, sean@poorly.run, dri-devel@lists.freedesktop.org Message-ID: <038d4a58-1980-3b76-ea53-9b354980723a@suse.de> Subject: Re: [PATCH v2 5/9] drm/ast: Pin framebuffer BO during dirty update References: <20190611130344.18988-1-tzimmermann@suse.de> <20190611130344.18988-6-tzimmermann@suse.de> <20190611202953.GA18315@ravnborg.org> In-Reply-To: <20190611202953.GA18315@ravnborg.org> --7802NKn3Mlxyu3awESru6TcD03evH4NhX Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi Am 11.06.19 um 22:29 schrieb Sam Ravnborg: > Hi Thomas. >=20 > On Tue, Jun 11, 2019 at 03:03:40PM +0200, Thomas Zimmermann wrote: >> Another explicit lock operation of a GEM VRAM BO is located in AST's >> framebuffer update code. Instead of locking the BO, we pin it to where= ver >> it is. >> >> v2: >> * update with pin flag of 0 >> >> Signed-off-by: Thomas Zimmermann >> --- >> drivers/gpu/drm/ast/ast_fb.c | 33 ++++++++++++++++----------------- >> 1 file changed, 16 insertions(+), 17 deletions(-) >> >> diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb= =2Ec >> index 05f45222b702..b404b51c2c55 100644 >> --- a/drivers/gpu/drm/ast/ast_fb.c >> +++ b/drivers/gpu/drm/ast/ast_fb.c >> @@ -48,32 +48,31 @@ static void ast_dirty_update(struct ast_fbdev *afb= dev, >> int x, int y, int width, int height) >> { >> int i; >> - struct drm_gem_object *obj; >> struct drm_gem_vram_object *gbo; >> int src_offset, dst_offset; >> int bpp =3D afbdev->afb.base.format->cpp[0]; >> - int ret =3D -EBUSY; >> + int ret; >> u8 *dst; >> bool unmap =3D false; >> bool store_for_later =3D false; >> int x2, y2; >> unsigned long flags; >> =20 >> - obj =3D afbdev->afb.obj; >> - gbo =3D drm_gem_vram_of_gem(obj); >> - >> - /* Try to lock the BO. If we fail with -EBUSY then >> - * the BO is being moved and we should store up the >> - * damage until later. >> - */ >> - if (drm_can_sleep()) >> - ret =3D drm_gem_vram_lock(gbo, true); >> - if (ret) { >> - if (ret !=3D -EBUSY) >> - return; >> - >> + gbo =3D drm_gem_vram_of_gem(afbdev->afb.obj); >> + >> + if (drm_can_sleep()) { >=20 > While touching this code, anyway we could get rid of drm_can_sleep()? > I only ask because Daniel V. said that we should not use it. > This was some months ago during some ehader file clean-up, so nothing > in particular related to the ast driver. I'm aware of what is commented in the header and the todo file. Do you have a link to this discussion? In any case, I'd prefer to fix this in a separate patch set. I have patches that replace the ast and mgag200 fbdev consoles with generic code. That might be the right place. Best regards Thomas >=20 > Sam >=20 >> + /* We pin the BO so it won't be moved during the >> + * update. The actual location, video RAM or system >> + * memory, is not important. >> + */ >> + ret =3D drm_gem_vram_pin(gbo, 0); >> + if (ret) { >> + if (ret !=3D -EBUSY) >> + return; >> + store_for_later =3D true; >> + } >> + } else >> store_for_later =3D true; >> - } >> =20 >> x2 =3D x + width - 1; >> y2 =3D y + height - 1; >> @@ -126,7 +125,7 @@ static void ast_dirty_update(struct ast_fbdev *afb= dev, >> drm_gem_vram_kunmap(gbo); >> =20 >> out: >> - drm_gem_vram_unlock(gbo); >> + drm_gem_vram_unpin(gbo); >> } >> =20 >> static void ast_fillrect(struct fb_info *info, >> --=20 >> 2.21.0 --=20 Thomas Zimmermann Graphics Driver Developer SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany GF: Felix Imend=C3=B6rffer, Mary Higgins, Sri Rasiah HRB 21284 (AG N=C3=BCrnberg) --7802NKn3Mlxyu3awESru6TcD03evH4NhX-- --sS1Hx6bimTLHfU3dFmBTCIDfRh4yrrh3F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAl0Aq0QACgkQaA3BHVML eiPCMgf+JZwpv65SgpuqG4Bd8WJaFA7FFXW6fGbj2pbg2HRPU8yzjeC0tVaYk3P1 j5S51yYyyZw2hxe5tGMw6nNjbDcn4TKLe1fJCpCq8RIgg3fdd29550ERB8QQp45g 4YlnmvbRI2KTaKNhuPXBxjy6xOvFxB/ZDOtaaGEtjcxKDmTsszR8oFME4A+RLviN ZnUU5gV4W8bg0hDrjZOLx+MjAodTF9owH5kzdFdaS90V95zxxYGTchQbZMNOiR8D 41xGBVadmQ+5lIRI8oxMYX0c1LqeWOtBjTj2QNUdawPSlMXSQDqDIaFcmgbdOPi4 R9o2S6qT5YXErMzfNL0WHXQKYeye1w== =6T4g -----END PGP SIGNATURE----- --sS1Hx6bimTLHfU3dFmBTCIDfRh4yrrh3F-- --===============1723008435== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVs --===============1723008435==--