Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp398737img; Mon, 18 Mar 2019 05:48:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9Doe/x7uCwgNlV8g/cVQE3Zzojc0x/HAzSi1ojvB1N2Agh/kFjS2FuEvavvxMFJw37xqk X-Received: by 2002:a63:2bc6:: with SMTP id r189mr17084081pgr.201.1552913324800; Mon, 18 Mar 2019 05:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552913324; cv=none; d=google.com; s=arc-20160816; b=hzMvt6bekXRO0w6IjJzH1J3dyxQFiK65RgKBYio88G/97JMH4mEr76RZDKa5QDZW9h MZ+biUz+8qmv6nnZhObYoqOrOShsuwTpdVGPdx9I/i0/tfSCzHzpWQQZPQXi8Trwme3C oGGwqAYCYHEo9FZf5Xpo1xViTC/huin5Dt2msh8bmKDoXZk4P4XsX/s7nNfPDGf83ffo 8809T7hJZzkepdg77RQEK31JY/MYKN7x5YPQcFnlICHuONu7m9iJpKxunf99x12R/dbH 33jyn3h5wK1i6phT/956sLhf2yq5ZxQy76phJ892k2q1l36IE6s1X4M40VN6dAd1Nzjh MAMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=qyZ6bi4SFzJJzADm11i8sTs4NXhyNpWHwKIb0BYHnrs=; b=zeCHUKTTpdVXiL684owmAX9jOmi62+xEyhm0bc9zGb1DLFsgcI78i4T+t2mJQPsdS1 7cS8hw1iaEpldXHWKd0QreEdPwbGQar1MZb1AzmE9ly8GiH6PL2Yqpvo7JKFo6bWhYE/ Ki6hv7Lxmp1VQdhZVa158/TY1Lz8RHLqBGCPJIipZbOasvvypEP8cOBMCVcDPm1f/LiH U6tQAS0rKqPyhqlcIGdYiO9/BHwj0OZ2hnHGb4lQTTCQ3W2oZolqQRqAZDFbZW5ZtCvd G/4cQ8CBs9lbdXnJpBZ2q44RzMlxIJba7dSTmV9vN9fig/VKSkvGXSI1hAIXJb8k3K4V ULKQ== 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s76si9227402pfs.52.2019.03.18.05.48.29; Mon, 18 Mar 2019 05:48:44 -0700 (PDT) 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727518AbfCRMrh (ORCPT + 99 others); Mon, 18 Mar 2019 08:47:37 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:59444 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725973AbfCRMrg (ORCPT ); Mon, 18 Mar 2019 08:47:36 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tomeu) with ESMTPSA id 9EE34268B3F Subject: Re: [PATCH v3 1/2] drm/virtio: Add window server support From: Tomeu Vizoso To: Gerd Hoffmann 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 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> Message-ID: Date: Mon, 18 Mar 2019 13:47:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <49785e0d-936a-c3b4-62dd-aafc7083a942@collabora.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Tomasz wants to comment, adding him to CC] On 2/5/18 9:19 AM, Tomeu Vizoso wrote: > On 1 February 2018 at 17:36, Gerd Hoffmann wrote: >> Hi, >> >> Sorry for joining the party late. Had a broken finger and was >> offline for a bunch of weeks (and a buif backlog afterwards ...). > > Hi, no problem, hope it's fine now. > >>> This is to allow clients running within VMs to be able to >>> communicate with a compositor in the host. Clients will use the >>> communication protocol that the compositor supports, and virtio-gpu >>> will assist with making buffers available in both sides, and >>> copying content as needed. >> >> Why not use virtio-vsock to run the wayland protocol? I don't like >> the idea to duplicate something with very simliar functionality in >> virtio-gpu. > > The reason for abandoning that approach was the type of objects that > could be shared via virtio-vsock would be extremely limited. Besides > that being potentially confusing to users, it would mean from the > implementation side that either virtio-vsock would gain a dependency on > the drm subsystem, or an appropriate abstraction for shareable buffers > would need to be added for little gain. > > Another factor that was taken into account was that the complexity > required for implementing passing protocol data around was very small > when compared with the buffer sharing mechanism. > >>> It is expected that a service in the guest will act as a proxy, >>> interacting with virtio-gpu to support unmodified clients. >> >> If you have a guest proxy anyway using virtio-sock for the protocol >> stream and virtio-gpu for buffer sharing (and some day 3d rendering >> too) should work fine I think. > > If I understand correctly your proposal, virtio-gpu would be used for > creating buffers that could be shared across domains, but something > equivalent to SCM_RIGHTS would still be needed in virtio-vsock? > > If so, that's what was planned initially, with the concern being that we > would be adding a bunch of complexity to virtio-vsock that would be only > used in this specific use case. Then we would also need to figure out > how virtio-vsock would be able to work with buffers from virtio-gpu > (either direct dependency or a new abstraction). > > If the mechanics of passing presentation data were very complex, I think > this approach would have more merit. But as you can see from the code, > it isn't that bad. > >>> When the client notifies the compositor that it can read from that > buffer, >>> the proxy should copy the contents from the SHM region to the >>> virtio-gpu resource and call DRM_VIRTGPU_TRANSFER_TO_HOST. >> >> What is the plan for the host side? I see basically two options. Either >> implement the host wayland proxy directly in qemu. Or >> implement it as separate process, which then needs some help from >> qemu to get access to the buffers. The later would allow qemu running >> independant from the desktop session. > > Regarding synchronizing buffers, this will stop becoming needed in > subsequent commits as all shared memory is allocated in the host and > mapped to the guest via KVM_SET_USER_MEMORY_REGION. > > This is already the case for buffers passed from the compositor to the > clients (see patch 2/2), and I'm working on the equivalent for buffers > from the guest to the host (clients still have to create buffers with > DRM_VIRTGPU_RESOURCE_CREATE but they will be only backend by host memory > so no calls to DRM_VIRTGPU_TRANSFER_TO_HOST are needed). > > But in the case that we still need a proxy for some reason on the host > side, I think it would be better to have it in the same process where > virtio-gpu is implemented. In crosvm's case it would be in a process > separate from the main VMM, as device processes are isolated from each > other with minijail (see > https://chromium.googlesource.com/chromiumos/platform/crosvm/ ). > > Regards, > > Tomeu >