Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6363039pxb; Wed, 17 Feb 2021 02:25:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvcyvH/4WzrDKs9Qgsc14Q9t3J6jXzdleCDjA4YvLhESQeqTFEsL24Sq59pnvM1doowVYh X-Received: by 2002:a17:907:9483:: with SMTP id dm3mr24805662ejc.120.1613557555934; Wed, 17 Feb 2021 02:25:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613557555; cv=none; d=google.com; s=arc-20160816; b=JQPMZ+EBNjEVOr3sZzdK9zEQvjZKA/o15oFCk5pIKr6tWgCX0cj6t6DTJuRj99CeJy n4Qq4hJSPEnRQVgsJjjLQ/ykfStLRZAcMSFcFEu4+Dc8eff/Lvb5Z60zusB+rCb8grvd j6rr9Gi1c6X3Dof5e6JjMnN4fo9yCbAIraJmlByObrC9SNVs/wT+H9VEj+T/Rqxu2gdm 94+FrCLDQDOSOvD4VAnfa3jpdvWFtvd/0EkcCj8nGX5DuVat0ulD3+Q8Ewutp+8ZuVDz koOmenrSy9NbOop8uqdLdHrEEHEALbFHVSKnvqgKoTy2croU8uwGJwItuDJDou8/ZLeS TOew== 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:from:references:cc:to; bh=l5VCw+F8WXaqgq2dltSi4ciYdphBevodHRDPVkt2y8I=; b=mvMt0MQxCFwVoloiziBoOtQ0D3bQIx4FsTMzCuTDRHeZBTQiwJgrwVWccHl1IAvhz9 59+hmbqJgibpiX6Hrweb414S0gH7mFUf9PSk8av2/GE2YwHkf9Eoyiqmpe0dDnz+AoS5 Iw1VSEcD52oEKybnHwd0z0MAnQA4HVuunC9TiyJBkus952GqpxuC5VyF2shm4l9jJiga t7EJaRGFgfbJ3U16HhJeRFUcrPucevOSte16UAE/IRrUzmIaFQcsOhSyxyYjXb2Cwv0r PlmgjJ5a9+58tlTxhOgJ3i+MS7V6vt1PJiCtC4a70v+pduTjwIKFRaJAhqPCA1XLxtJw aFbg== 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 e2si892292edl.307.2021.02.17.02.25.31; Wed, 17 Feb 2021 02:25:55 -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 S232237AbhBQKYX (ORCPT + 99 others); Wed, 17 Feb 2021 05:24:23 -0500 Received: from mx2.suse.de ([195.135.220.15]:33968 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232161AbhBQKYX (ORCPT ); Wed, 17 Feb 2021 05:24:23 -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 2B120B141; Wed, 17 Feb 2021 10:23:42 +0000 (UTC) To: Gerd Hoffmann Cc: David Airlie , open list , dri-devel@lists.freedesktop.org, "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , Dave Airlie , "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> <20210217100206.fh5422uz4gnixyif@sirius.home.kraxel.org> From: Thomas Zimmermann Subject: Re: [PATCH 09/10] drm/qxl: map/unmap framebuffers in prepare_fb+cleanup_fb callbacks. Message-ID: Date: Wed, 17 Feb 2021 11:23:40 +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: <20210217100206.fh5422uz4gnixyif@sirius.home.kraxel.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="h0WnoFNYi1f9XmooDNTQLjyMjFkKtPyL9" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --h0WnoFNYi1f9XmooDNTQLjyMjFkKtPyL9 Content-Type: multipart/mixed; boundary="LnSnfig26KmIAW6LDR29DlBQ6koKWqp5s"; protected-headers="v1" From: Thomas Zimmermann To: Gerd Hoffmann Cc: David Airlie , open list , dri-devel@lists.freedesktop.org, "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , Dave Airlie , "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> <20210217100206.fh5422uz4gnixyif@sirius.home.kraxel.org> In-Reply-To: <20210217100206.fh5422uz4gnixyif@sirius.home.kraxel.org> --LnSnfig26KmIAW6LDR29DlBQ6koKWqp5s Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi Am 17.02.21 um 11:02 schrieb Gerd Hoffmann: > On Tue, Feb 16, 2021 at 02:46:21PM +0100, Thomas Zimmermann wrote: >> >> >> Am 16.02.21 um 14:27 schrieb Thomas Zimmermann: >>> Hi >>> >>> this is a shadow-buffered plane. Did you consider using the new helpe= rs >>> for shadow-buffered planes? They will map the user BO for you and >>> provide the mapping in the plane state. >>> >>> From there, you should implement your own plane state on top of str= uct >>> drm_shadow_plane_state, and also move all the other allocations and >>> vmaps into prepare_fb and cleanup_fb. Most of this is not actually >>> allowed in commit tails. All we'd have to do is to export the reset, >>> duplicate and destroy code; similar to what >>> __drm_atomic_helper_plane_reset() does. >> >> AFAICT the cursor_bo is used to implement double buffering for the cur= sor >> 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 the >> allocation and mapping headaches. >=20 > Just waded through the ast patches. I just received your ack. Thanks a lot for looking at the ast patches. >=20 > It is not that simple for qxl. You have to send a command to the > virtualization host and take care of the host accessing that memory > when processing the command, so you can't reuse the memory until the > host signals it is fine to do so. >=20 > But, yes, it should be possible to handle cursor_bo creation in > prepare_fb without too much effort. I've been thinking about this issue and here's an idea: If you take the ast code as a blueprint, you'd store two cursor bo in a=20 cursor-plane structure. Aditionally each of these BOs would have a=20 pointer to a fence associated with it. One idea for the fencing code would be to allocate each new fence in=20 prepare_fb and store it in the cursor plane state. In atomic_update,=20 pick the unused BO in the cursor plane and wait on its fence. This=20 should guarantee that the BO is available. (?) Then swap the BO's fence=20 with the one in the cursor plane state. Setup the new fence for=20 synchronization with the host. Next time you pick this cursor BO, the=20 fence will be there for synchronization. The old fence from the cursor=20 BO will now be stored in the cursor-plane state and can be freed in=20 cleanup_fb(). My main interest here is to move all fail-able/locking calls out of the=20 atomic_update function. I might be missing some crucial corner case, but = this should resolve the issue. (?) In any case, it's maybe worth a=20 separate patchset. Best regards Thomas >=20 > take care, > Gerd >=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 --LnSnfig26KmIAW6LDR29DlBQ6koKWqp5s-- --h0WnoFNYi1f9XmooDNTQLjyMjFkKtPyL9 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+AFAmAs7q0FAwAAAAAACgkQlh/E3EQov+DV 7g//UOrMSWgXBRPsci1jInSlvHBHkSG+Nszzjkh4QC5ipANPk4Too/BNFHrXMMM2Ase+jthizq7I 1pxbiXRfg6sY/6oqieukJpvDLWx/DYZyhLVISr978Wbr/5ZKqDdf1bm0xQwCmnGqTxQM2qyoXhKr +uXr64a9oaUFZar1jfEJ2GLqQc5PDhk52pZck49EGnasfg9XBk/CWvLq5qXp4YdQz4eZeBQCHtGP R9jFPA6tWWGTFO8ozLPDoyaA34z741aFTDWgFPjxWb2uhooprmVONEwfAUBHNYw7rqRhXXHTxZXc SO8jzJKu5+0gvvfQaE2qF1x7pxDHPJwqqcfYYOvzPXq9iHfEoIiBUvhtn3bjyvoBgahsY9LG/GUJ hR3DsuMNledIR/V9Qr6n/Fcui2ZivVkgSVhxrwaTUSzKYfzR1yxgZUay4Cq7teL26P2J4V96fnAj 94wQCxyp+p0osecAtsdkEAYswUzsYyRgSK3vnA17DVAnHWHHojH8yPr2Rf0PiMfXqPsZ93g8l7my 5xretITk7n8a4E1I00SHKwM+TW3jZcZil6czWkPaosV00KNnnJWqPe+0ole8dx9vhlf7av5ql7iD QVVZPQEWhHONTKCYH+Oql9maQLyL8PUWBrRbmHEdfj5cMyxKbuW6MKLCITYr98XL1RCKTZLNiR25 aMk= =i3Bx -----END PGP SIGNATURE----- --h0WnoFNYi1f9XmooDNTQLjyMjFkKtPyL9--