From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: Gurchetan Singh <gurchetansingh@chromium.org>,
Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Cc: Yiwei Zhang <zzyiwei@chromium.org>,
Ryan Neph <ryanneph@chromium.org>,
Gerd Hoffmann <kraxel@redhat.com>,
Rob Clark <robdclark@gmail.com>, Huang Rui <ray.huang@amd.com>,
Sergio Lopez <slp@redhat.com>,
virtio-comment@lists.oasis-open.org
Subject: [virtio-comment] Re: [PATCH v1] virtio-gpu: Document new fence-passing feature
Date: Mon, 5 Feb 2024 17:53:25 +0300 [thread overview]
Message-ID: <7e1da0ce-d8ec-4f54-9426-ba24730b12cd@collabora.com> (raw)
In-Reply-To: <CAAfnVBnGCP2m2WoXY=NKAQ4vQncB19c4YVMrC51r5KdsSq7uxQ@mail.gmail.com>
On 2/1/24 19:59, Gurchetan Singh wrote:
> On Mon, Jan 29, 2024 at 9:21 PM Dmitry Osipenko <
> dmitry.osipenko@collabora.com> wrote:
>
>> On 1/30/24 04:34, Gurchetan Singh wrote:
>>> On Sun, Jan 28, 2024 at 11:12 AM Dmitry Osipenko <
>>> dmitry.osipenko@collabora.com> wrote:
>>>
>>>> Document new virtio-gpu protocol fence-passing feature that extends 3d
>>>> submit command with support of in-fences which are passed from guest to
>>>> host for waiting. This feature allows to offload waiting for in-fences
>>>> from guest to host, where it can be done more efficiently.
>>>>
>>>> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
>>>> ---
>>>> device-types/gpu/description.tex | 22 +++++++++++++++++++++-
>>>> 1 file changed, 21 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/device-types/gpu/description.tex
>>>> b/device-types/gpu/description.tex
>>>> index 443524851a05..e5e23b5c9072 100644
>>>> --- a/device-types/gpu/description.tex
>>>> +++ b/device-types/gpu/description.tex
>>>> @@ -37,6 +37,8 @@ \subsection{Feature bits}\label{sec:Device Types / GPU
>>>> Device / Feature bits}
>>>> resources is supported.
>>>> \item[VIRTIO_GPU_F_CONTEXT_INIT (4)] multiple context types and
>>>> synchronization timelines supported. Requires VIRTIO_GPU_F_VIRGL.
>>>> +\item[VIRTIO_GPU_F_FENCE_PASSING (5)] passing fence IDs from guest to
>> host
>>>> + for waiting supported. Requires VIRTIO_GPU_F_VIRGL.
>>>> \end{description}
>>>>
>>>> \subsection{Device configuration layout}\label{sec:Device Types / GPU
>>>> Device / Device configuration layout}
>>>> @@ -746,7 +748,25 @@ \subsubsection{Device Operation: controlq
>>>> (3d)}\label{sec:Device Types / GPU Dev
>>>>
>>>> \item[VIRTIO_GPU_CMD_SUBMIT_3D]
>>>> Submit an opaque command stream. The type of the command stream is
>>>> - determined when creating a context.
>>>> + determined when creating a context. Request data is
>>>> + \field{struct virtio_gpu_cmd_submit}. The \field{size} field
>> describes
>>>> + the size of \field{cmd_data} array in bytes. The
>> \field{num_in_fences}
>>>> + field is active only if VIRTIO_GPU_F_FENCE_PASSING is enabled,
>> otherwise
>>>> + \field{num_in_fences} is treated as zero. The array of
>>>> \field{in_fences}
>>>> + IDs is placed in between the \field{num_in_fences} field and the
>>>> + \field{cmd_data} array. The \field{in_fences} array contains
>> virtio-gpu
>>>> + \field{fence_id}'s corresponding to the out-fence IDs of a previous
>>>> + 3d submits.
>>>> +
>>>> +\begin{lstlisting}
>>>> +struct virtio_gpu_cmd_submit {
>>>> + struct virtio_gpu_ctrl_hdr hdr;
>>>> + le32 size;
>>>> + le32 num_in_fences;
>>>> + le64 in_fences[num_in_fences];
>>>> + u32 cmd_data[size/4];
>>>> +};
>>>> +\end{lstlisting}
>>>>
>>>
>>> Don't you need VIRTIO_GPU_FLAG_FENCE_SHAREABLE somewhere too?
>>
>> We haven't made use of this flag in the experimental/prototype version
>> that was made for the native contexts. The flag is unused by both Qemu
>> and CrosVM.
>>
>> We added Linux kernel UAPI flag VIRTGPU_EXECBUF_SHARED_FENCE and it's
>> deemed to be enough. If the UAPI flag isn't set for a job's out-fence,
>> then guest uses guest-side synchronization for this fence when it's
>> passed as in-fence for the further jobs.
>>
>> The FENCE_SHAREABLE flag isn't needed by nctx/virgl/venus protocols. All
>> fences are shareable by default. If VMM fails to export fence, it is
>> treated like fence was already signaled. In case of Venus, it's up to
>> Venus to decide internally which fences can be made shareable, i.e. both
>> guest and virglrenderer Venus implementations are responsible for making
>> decision whether fence should be made exportable. Venus won't make
>> out-fence exportable for internal intermediate jobs and will encode this
>> export-info within the Venus protocol.
>>
>> Whether FENCE_SHAREABLE virtio-gpu flag will be needed by gfxstream is
>> questionable. Gfxstream should be similar to Venus, i.e. you should be
>> able to add flag to the gfxstream. We'll need to be certain that the new
>> common flag is definitely needed by making use of it before specifying
>> it in the stable virtio-gpu protocol.
>>
>
> I don't think you've gotten fence passing working with display
> integration. Although passing external fences between two GPU instances
> does happen, the much more common and important case is passing a fence
> from the virtual GPU to virtual display.
>
> Let me describe the use case for you:
>
> 1. GPU creates a fence
> 2. rutabaga exports fence on creation via stream_renderer_export_fence /
> or virglrenderer_export_fence --> creates [fence_id --> descriptor
> mapping] when FLAG_SHAREABLE is set
> 3. SUBMIT_CMD + CROSS_DOMAIN_SEND --> takes the fence_ids and sends a
> fence to the compositor
>
> You also refer to
> https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1138#note_1996999
> .
>
> Once you have a working prototype that shares an out_fence with the
> display, then we can talk about whether FLAG_SHAREABLE is needed or not.
> So I suggest you focus on that before upstreaming uapis + virtio protocols.
AMD nctx uses fence-passing for multi-gpu job syncing. I don't think
Pierre-Eric uses it for display syncing on Qemu, Pierre don't you?
The point is that the negated variant of the flag (i.e.
FLAG_NOT_SHAREABLE) could be added later on if it will be needed. To my
knowledge, there is a lot of work to be done until we'll be able to test
the display path on CrOS. Hence it's more preferred not to block
enabling of the basic variant of the feature, given that we can extend
it in the future, IMO.
--
Best regards,
Dmitry
This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.
Subscribe: virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lists.oasis-open.org
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
next prev parent reply other threads:[~2024-02-05 14:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-28 19:12 [virtio-comment] [PATCH v1] virtio-gpu: Document new fence-passing feature Dmitry Osipenko
2024-01-30 1:34 ` [virtio-comment] " Gurchetan Singh
2024-01-30 5:21 ` Dmitry Osipenko
2024-02-01 16:59 ` Gurchetan Singh
[not found] ` <CAF6AEGtSGULUVVZ-45sdhUpffsqi7yM15aHSyPSt9=TMr8iEHw@mail.gmail.com>
2024-02-01 18:08 ` Gurchetan Singh
[not found] ` <CAF6AEGuQD-zuHjkjeBEuteyvQE33pGeF0XPDjGDZrZBrr=tNJg@mail.gmail.com>
2024-02-02 18:16 ` Gurchetan Singh
[not found] ` <CAF6AEGtmfFuh0iZpnzm9wbROeCcGx5hGU-BnnJKMcj0awhcZFQ@mail.gmail.com>
2024-02-07 0:09 ` Gurchetan Singh
[not found] ` <CAF6AEGu4tE5AoE9tjhbPYg94fyEyOLQAHhtsBK-DvC2ULRkgzQ@mail.gmail.com>
2024-02-09 18:02 ` Gurchetan Singh
[not found] ` <CAF6AEGsRremaP08tqKOmgfMK+yjgEkBsBpbNcgDkaZVUzE49OA@mail.gmail.com>
2024-02-13 0:19 ` Gurchetan Singh
[not found] ` <CAF6AEGv0CH6TvD1AbMQhsCa51Kr=xsx50etCjSinbqfCEbJ_wA@mail.gmail.com>
2024-02-13 22:37 ` Gurchetan Singh
2024-02-05 14:53 ` Dmitry Osipenko [this message]
2024-02-07 0:21 ` Gurchetan Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7e1da0ce-d8ec-4f54-9426-ba24730b12cd@collabora.com \
--to=dmitry.osipenko@collabora.com \
--cc=gurchetansingh@chromium.org \
--cc=kraxel@redhat.com \
--cc=pierre-eric.pelloux-prayer@amd.com \
--cc=ray.huang@amd.com \
--cc=robdclark@gmail.com \
--cc=ryanneph@chromium.org \
--cc=slp@redhat.com \
--cc=virtio-comment@lists.oasis-open.org \
--cc=zzyiwei@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox