Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5708427pxb; Tue, 16 Feb 2021 05:48:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxd+wF8DIkN9Jr5RFJ358vg0/r8cTkzIfjrGHO6VQXDWvXN8tMI1jr7nZoFQHKvO+yN2cr5 X-Received: by 2002:aa7:c0da:: with SMTP id j26mr20859081edp.253.1613483308653; Tue, 16 Feb 2021 05:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613483308; cv=none; d=google.com; s=arc-20160816; b=Oi2JbVqmEeG6QE/8452z3DTkgOhzf/CKTWVzNMhYz7Cvloutze1r4eF6qcgkMmhvPV xqM7AZIUlIQEXlzVNiVVZv60UmoBKP/5SujA4jrr2/RphXEpN3eQ7ecsl3PAD/bDt0lZ 12Hz+Ouu4qCL9pD2XnCoudBG7KQZZTfy16W4GxQFw28wdi+4/8F960kw6zQd7mfXyDfg Syrv+Ox84XLKeuhRgV/5FNVIwP/8KzH/4FdnnRkCHDKRAIpMheNP1IdE4vjvSFST7ok9 tZwI6/7fwlX/VUVy2JTNI6GtuiQiqF/Dt057X/0BvYfAg2GPmRNCy3KX0uFwoJPU/RsT s1dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:mime-version:user-agent:date :message-id:subject:references:cc:to:from; bh=O9Xxm4KRuI4UOGnzqgfcAjjikWMRHdgECkAOkQ+mCOM=; b=EpF/f1EN+Ofp3ZSmDfkbQy1P3aFcZsrfJkgtkZ2KZez1x2dv+r0cYACJuOOFag1V02 5ENUyCNvG7gHqzwMYgZBGcUHp+S9k24grXMEZTpUqr1KDQdf8a+hfBf3O8KXRJVBIxB0 f0qSs6OzJsFesJB06MTogsrfipAqyNUCMNSq4O5fxWRnZZiljKlPzqBdD+hKOPSvyBsR AntqM5RztCMl/GOQZVAJp2Hnc6GuMiI5foHPWKgn7hKWfsq0ZAShHYL64Wuk0+WwS3FS BvxM/BnPbIboJvUxPt2ELaMiJM41iYTuCQ/XmqEPdW1UqLdTn7CfjBP5/uZ5fhQ85KMC mi+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r16si2336368ejc.439.2021.02.16.05.48.04; Tue, 16 Feb 2021 05:48:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229913AbhBPNrN (ORCPT + 99 others); Tue, 16 Feb 2021 08:47:13 -0500 Received: from mx2.suse.de ([195.135.220.15]:53448 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229830AbhBPNrG (ORCPT ); Tue, 16 Feb 2021 08:47:06 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B2DAEADFB; Tue, 16 Feb 2021 13:46:23 +0000 (UTC) From: Thomas Zimmermann To: Gerd Hoffmann , dri-devel@lists.freedesktop.org Cc: David Airlie , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , Dave Airlie , open list , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" References: <20210216113716.716996-1-kraxel@redhat.com> <20210216113716.716996-10-kraxel@redhat.com> <5baf096f-b1ee-46ba-5ee9-1c829b96e088@suse.de> Subject: Re: [PATCH 09/10] drm/qxl: map/unmap framebuffers in prepare_fb+cleanup_fb callbacks. Message-ID: Date: Tue, 16 Feb 2021 14:46:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <5baf096f-b1ee-46ba-5ee9-1c829b96e088@suse.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="x9v9IxdRWQigs6L1TOinW9XyRZLUO4a8x" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --x9v9IxdRWQigs6L1TOinW9XyRZLUO4a8x Content-Type: multipart/mixed; boundary="Ntn8b3fwwJhazhId2T2oMQUzaoUmTo7m0"; protected-headers="v1" From: Thomas Zimmermann To: Gerd Hoffmann , dri-devel@lists.freedesktop.org Cc: David Airlie , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , Dave Airlie , open list , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" Message-ID: Subject: Re: [PATCH 09/10] drm/qxl: map/unmap framebuffers in prepare_fb+cleanup_fb callbacks. References: <20210216113716.716996-1-kraxel@redhat.com> <20210216113716.716996-10-kraxel@redhat.com> <5baf096f-b1ee-46ba-5ee9-1c829b96e088@suse.de> In-Reply-To: <5baf096f-b1ee-46ba-5ee9-1c829b96e088@suse.de> --Ntn8b3fwwJhazhId2T2oMQUzaoUmTo7m0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Am 16.02.21 um 14:27 schrieb Thomas Zimmermann: > Hi >=20 > this is a shadow-buffered plane. Did you consider using the new helpers= =20 > for shadow-buffered planes? They will map the user BO for you and=20 > provide the mapping in the plane state. >=20 > From there, you should implement your own plane state on top of struct= =20 > drm_shadow_plane_state, and also move all the other allocations and=20 > vmaps into prepare_fb and cleanup_fb. Most of this is not actually=20 > allowed in commit tails. All we'd have to do is to export the reset,=20 > duplicate and destroy code; similar to what=20 > __drm_atomic_helper_plane_reset() does. AFAICT the cursor_bo is used to implement double buffering for the=20 cursor image. Ideally, you can do what ast does: pre-allocate/vmap 2 BOs at the end of = the vram. Then pageflip between them in atomic_update(). Resolves all=20 the allocation and mapping headaches. Best regards Thomas >=20 > Best regards > Thomas >=20 >=20 > Am 16.02.21 um 12:37 schrieb Gerd Hoffmann: >> We don't have to map in atomic_update callback then, >> making locking a bit less complicated. >> >> Signed-off-by: Gerd Hoffmann >> --- >> =C2=A0 drivers/gpu/drm/qxl/qxl_display.c | 14 +++++--------- >> =C2=A0 1 file changed, 5 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/gpu/drm/qxl/qxl_display.c=20 >> b/drivers/gpu/drm/qxl/qxl_display.c >> index 7500560db8e4..39b8c5116d34 100644 >> --- a/drivers/gpu/drm/qxl/qxl_display.c >> +++ b/drivers/gpu/drm/qxl/qxl_display.c >> @@ -584,7 +584,6 @@ static void qxl_cursor_atomic_update(struct=20 >> drm_plane *plane, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct drm_gem_object *obj; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct qxl_bo *cursor_bo =3D NULL, *use= r_bo =3D NULL, *old_cursor_bo=20 >> =3D NULL; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int ret; >> -=C2=A0=C2=A0=C2=A0 struct dma_buf_map user_map; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct dma_buf_map cursor_map; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 void *user_ptr; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int size =3D 64*64*4; >> @@ -599,11 +598,8 @@ static void qxl_cursor_atomic_update(struct=20 >> drm_plane *plane, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 obj =3D fb->obj= [0]; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 user_bo =3D gem= _to_qxl_bo(obj); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* pinning is done in the = prepare/cleanup framevbuffer */ >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ret =3D qxl_bo_kmap_locked= (user_bo, &user_map); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (ret) >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 go= to out_free_release; >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 user_ptr =3D user_map.vadd= r; /* TODO: Use mapping abstraction=20 >> properly */ >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* mapping is done in the = prepare/cleanup framevbuffer */ >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 user_ptr =3D user_bo->map.= vaddr; /* TODO: Use mapping=20 >> abstraction properly */ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ret =3D qxl_all= oc_bo_reserved(qdev, release, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 sizeof(struct qxl_cursor) + size, >> @@ -639,7 +635,6 @@ static void qxl_cursor_atomic_update(struct=20 >> drm_plane *plane, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cursor->chunk.d= ata_size =3D size; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 memcpy(cursor->= chunk.data, user_ptr, size); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qxl_bo_kunmap_l= ocked(cursor_bo); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qxl_bo_kunmap_locked(user_= bo); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cmd =3D (struct= qxl_cursor_cmd *) qxl_release_map(qdev, release); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cmd->u.set.visi= ble =3D 1; >> @@ -778,6 +773,7 @@ static int qxl_plane_prepare_fb(struct drm_plane=20 >> *plane, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct drm_gem_object *obj; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct qxl_bo *user_bo; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct qxl_surface surf; >> +=C2=A0=C2=A0=C2=A0 struct dma_buf_map unused; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (!new_state->fb) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0; >> @@ -815,7 +811,7 @@ static int qxl_plane_prepare_fb(struct drm_plane=20 >> *plane, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >> -=C2=A0=C2=A0=C2=A0 return qxl_bo_pin(user_bo); >> +=C2=A0=C2=A0=C2=A0 return qxl_bo_kmap(user_bo, &unused); >> =C2=A0 } >> =C2=A0 static void qxl_plane_cleanup_fb(struct drm_plane *plane, >> @@ -834,7 +830,7 @@ static void qxl_plane_cleanup_fb(struct drm_plane = >> *plane, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 obj =3D old_state->fb->obj[0]; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 user_bo =3D gem_to_qxl_bo(obj); >> -=C2=A0=C2=A0=C2=A0 qxl_bo_unpin(user_bo); >> +=C2=A0=C2=A0=C2=A0 qxl_bo_kunmap(user_bo); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (old_state->fb !=3D plane->state->fb= && user_bo->shadow) { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qxl_bo_unpin(us= er_bo->shadow); >> >=20 >=20 > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel >=20 --=20 Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany (HRB 36809, AG N=C3=BCrnberg) Gesch=C3=A4ftsf=C3=BChrer: Felix Imend=C3=B6rffer --Ntn8b3fwwJhazhId2T2oMQUzaoUmTo7m0-- --x9v9IxdRWQigs6L1TOinW9XyRZLUO4a8x Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEExndm/fpuMUdwYFFolh/E3EQov+AFAmArzK0FAwAAAAAACgkQlh/E3EQov+Dh WQ//fUuC7dIUW2wfGhqz/qBrTYHstG3t4bjZ5svg9dezZB3CccYP7BEx4UAjnLakEI3P9oxCyDAE 3eNt+JVA2+FeHplWREImJegTtHL6kdunRBUDDhbLGBHO0+lWS6FdA6sk6ayr9mx8a0CsSSbPRnvf l0DQFghY6/DiRuWx9hGTupU0hwJ1+C3H1iJwEG4dBj5775CDTyzGbXMnii7WwelyVsCHsejM7d6Q 4CMRiosBk0iqiM0xogojNAQrzGRl9yhATJHccMvn+YD0WzL7DDpxelb/gaFBdDT2f6ZIioBNr9Xp hzzLZw29ctfr0KYym7rEZI1awnDGJAZ2UDWDgEb8jYSgXNGYFMbHlweEXXzQIGIj0MWl4s0vNac8 hxxsParp/9ZJaiZDIosZDMMcntTfDIlZ+hI5d651jXD6vmLLIjcDpmU5ZuyMuGtiOzkroxapGa7q ecd8FM1a4KLh63wiC1BREGZLOGDm5vdR/0aX91ozc01yRr6mg/0xc9zxwBMUFpeXdsEjiyjs1F4O aAyH5o3qi1Cb867ynpZmHBwrU7Y1LOWXPGSj9tPJW6WZLyPQQ3Wh4T/mF4iNr7v8M7QpXstjoMB/ J+Q6+6Yw5E4O7S2AoHcLlfO3Ub1VdAjKKTngaEknAl8kbhg5MDCjTD0kTgt2utp3vzXNhI+VDAXl KwY= =sXRs -----END PGP SIGNATURE----- --x9v9IxdRWQigs6L1TOinW9XyRZLUO4a8x--