Received: by 10.223.176.5 with SMTP id f5csp722867wra; Tue, 6 Feb 2018 06:23:55 -0800 (PST) X-Google-Smtp-Source: AH8x226AxboEIIiBH5Ast55HKb2F8Hlyd0YbW6i6x/Smu+vwz8ytvPduW9CZMFJtQmFJ9HhJiGgc X-Received: by 10.101.72.129 with SMTP id n1mr2063650pgs.181.1517927035563; Tue, 06 Feb 2018 06:23:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517927035; cv=none; d=google.com; s=arc-20160816; b=GUFjcWtmS1uyog3iOuOybfwpQ4FHxAalanp1O00zFMi5UgcxA6azm+/YQsoASnK27M jRtWDE+XYXCiiFIHwNWyAl2kneBoVUUfMc4wbob5PiOxR1+NfGMBdgPwDhQKNMZmGbt7 6TOXzGkSLKMi7c51+IMIzEEk4wKstQF3XgWc8MbnoAuWimDnzlg7uRnx/O74Xv9R3hfD oFBy+48UkzjdyQQrbKzMxWuZyLXHucipIwxmbRTCsYZ7QzXaJGHvOmxuqhuf14yGuOnx P0nrSNXS0HZBdOpOXSU/91mMdZ5H+FXbLnfO61boeDk3VPWndam0pvwZvE6MInSk5G0i vKnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=zjku5sYTLuZffLabIF72CB6BolLLguCTnvbzy0AkvUk=; b=mch+BsNFF5V6/nirinUQQDkwaLjz7lJIFoWTSIHDdNZITAiR01ZE0NSWrk6PuUzdty DqxFcK7rpy8mqUMbpCxo0bqH/ybpXE8RR0w5ck8dT+fKDBl7S07cSItiu4r+aiut4qYl L8K4bvSc6haf9nBv3oQL3gQINNlHlb7fpb6ZMmCFpjr/drK9ioJkzDDARSWfmtkgGAzc 30ERjnrN7IEKk7f5z1sGrqfKcDxdZN/S0o0jTZRTyfCT7BBlRq4iISiZ/f8R7Hc7+fDr YqWnHyP7lEWg36lWf8/K+/kTIr9U9WlNA06nKuKOypZEVdcXrlhcz76Ei8mYp3CZl5vQ 86aw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si8083978pfl.34.2018.02.06.06.23.41; Tue, 06 Feb 2018 06:23:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751822AbeBFOXL (ORCPT + 99 others); Tue, 6 Feb 2018 09:23:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40136 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750990AbeBFOXG (ORCPT ); Tue, 6 Feb 2018 09:23:06 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0495981DE7; Tue, 6 Feb 2018 14:23:06 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CFE85C20B; Tue, 6 Feb 2018 14:23:03 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 57EB040BF4; Tue, 6 Feb 2018 15:23:02 +0100 (CET) Date: Tue, 6 Feb 2018 15:23:02 +0100 From: Gerd Hoffmann To: Tomeu Vizoso Cc: linux-kernel@vger.kernel.org, Zach Reizner , kernel@collabora.com, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, "Michael S. Tsirkin" , David Airlie , Jason Wang , Stefan Hajnoczi Subject: Re: [PATCH v3 1/2] drm/virtio: Add window server support Message-ID: <20180206142302.vdjyqmnoypydci4t@sirius.home.kraxel.org> References: <20180126135803.29781-1-tomeu.vizoso@collabora.com> <20180126135803.29781-2-tomeu.vizoso@collabora.com> <20180201163623.5cs2ysykg5wgulf4@sirius.home.kraxel.org> <49785e0d-936a-c3b4-62dd-aafc7083a942@collabora.com> <20180205122017.4vb5nlpodkq2uhxa@sirius.home.kraxel.org> <20180205160322.sntv5uoqp5o7flnh@sirius.home.kraxel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 06 Feb 2018 14:23:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > > Hmm? I'm assuming the wayland client (in the guest) talks to the > > wayland proxy, using the wayland protocol, like it would talk to a > > wayland display server. Buffers must be passed from client to > > server/proxy somehow, probably using fd passing, so where is the > > problem? > > > > Or did I misunderstand the role of the proxy? > > Hi Gerd, > > it's starting to look to me that we're talking a bit past the other, so I > have pasted below a few words describing my current plan regarding the 3 key > scenarios that I'm addressing. You are describing the details, but I'm missing the big picture ... So, virtualization aside, how do buffers work in wayland? As far I know it goes like this: (a) software rendering: client allocates shared memory buffer, renders into it, then passes a file handle for that shmem block together with some meta data (size, format, ...) to the wayland server. (b) gpu rendering: client opens a render node, allocates a buffer, asks the cpu to renders into it, exports the buffer as dma-buf (DRM_IOCTL_PRIME_HANDLE_TO_FD), passes this to the wayland server (again including meta data of course). Is that correct? Now, with virtualization added to the mix it becomes a bit more complicated. Client and server are unmodified. The client talks to the guest proxy (wayland protocol). The guest proxy talks to the host proxy (protocol to be defined). The host proxy talks to the server (wayland protocol). Buffers must be managed along the way, and we want avoid copying around the buffers. The host proxy could be implemented directly in qemu, or as separate process which cooperates with qemu for buffer management. Fine so far? > I really think that whatever we come up with needs to support 3D clients as > well. Lets start with 3d clients, I think these are easier. They simply use virtio-gpu for 3d rendering as usual. When they are done the rendered buffer already lives in a host drm buffer (because virgl runs the actual rendering on the host gpu). So the client passes the dma-buf to the guest proxy, the guest proxy imports it to look up the resource-id, passes the resource-id to the host proxy, the host proxy looks up the drm buffer and exports it as dma-buf, then passes it to the server. Done, without any extra data copies. > Creation of shareable buffer by guest > ------------------------------------------------- > > 1. Client requests virtio driver to create a buffer suitable for sharing > with host (DRM_VIRTGPU_RESOURCE_CREATE) client or guest proxy? > 4. QEMU maps that buffer to the guest's address space > (KVM_SET_USER_MEMORY_REGION), passes the guest PFN to the virtio driver That part is problematic. The host can't simply allocate something in the physical address space, because most physical address space management is done by the guest. All pci bars are mapped by the guest firmware for example (or by the guest OS in case of hotplug). > 4. QEMU pops data+buffers from the virtqueue, looks up shmem FD for each > resource, sends data + FDs to the compositor with SCM_RIGHTS BTW: Is there a 1:1 relationship between buffers and shmem blocks? Or does the wayland protocol allow for offsets in buffer meta data, so you can place multiple buffers in a single shmem block? cheers, Gerd