All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gurchetan Singh <gurchetansingh@chromium.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Chad Versace <chadversary@chromium.org>,
	ML dri-devel <dri-devel@lists.freedesktop.org>,
	John Bates <jbates@chromium.org>
Subject: Re: [RFC PATCH 0/8] *** Per context fencing ***
Date: Tue, 10 Mar 2020 15:57:54 -0700	[thread overview]
Message-ID: <CAAfnVB=sw=u80mHnZUPf_+WDW-hGNTDSBWLfV+7y3KFN=s6beQ@mail.gmail.com> (raw)
In-Reply-To: <20200310074302.yx6anlvqvsg37yzs@sirius.home.kraxel.org>


[-- Attachment #1.1: Type: text/plain, Size: 3339 bytes --]

On Tue, Mar 10, 2020 at 12:43 AM Gerd Hoffmann <kraxel@redhat.com> wrote:

> On Mon, Mar 09, 2020 at 06:08:10PM -0700, Gurchetan Singh wrote:
> > We don't want fences from different 3D contexts/processes (GL, VK) to
> > be on the same timeline. Sending this out as a RFC to solicit feedback
> > on the general approach.
>
> NACK.
>
> virtio fences are global, period.  You can't simply change fence
> semantics like this.  At least not without a virtio protocol update
> because guest and host need to be on the same page here.


I should've been more clear -- this is an internal cleanup/preparation and
the per-context changes are invisible to host userspace.

Just look at
> virgl_renderer_callbacks->write_fences() and how it doesn't consider
> contexts at all.
>
> So one way out would be to add a virtio feature flag for this, so guest
> & host can negotiate whenever fences are global or per-context.
>

Yeah, we'll need something like VIRTIO_GPU_FLAG_FENCE_V2 eventually, which
means fences virgl_write_fence can not assume fence_id is the global
sequence number.  It's a bit tricky, and we have to consider a few cases:

1) Current kernel/current host userspace.  Everything works.

2) Newer kernel (with this series) on current host userspace.  For
that, fence_id needs to be a monotonically increasing value, which it
remains to be.  I ran the standard test apps (Unigine Valley, dEQP, etc.)
with this change and things seem fine.

3) Current kernel on newer host userspace.  New host won't see
VIRTIO_GPU_FLAG_FENCE_V2, everything should work as usual.

4) Newer kernel on new host host userspace.  virgl_write_fence signals
fences only in a specific context (or possibly only one fence at a time).
The guest kernel processing based on {fence_id, fence_context} will make a
difference in a multi-process environment.

If I have things right (and again, it's a bit tricky), so the virtio
protocol update will be required at (4).  It would be nice to get in
refactorings to avoid mega-changes if we agree on the general approach..

Side note:

Fences do have an associated context ID in virglrenderer [1], though we
don't pass down the correct ctx ID just yet [2].

[1]
https://gitlab.freedesktop.org/virgl/virglrenderer/-/blob/master/src/virglrenderer.h#L204
[2] https://github.com/qemu/qemu/blob/master/hw/display/virtio-gpu-3d.c#L490

Another approach would be to go multiqueue, with each virtqueue being
> roughly the same as a rendering pipeline on physical hardware, then have
> per-virtqueue fences.
>

Multi-queue sounds very interesting indeed, especially with VK
multi-threaded command submission.  That to me is V3 rather than V2.. let's
start easy!

When going multiqueue we might also rethink the cursor queue approach.
> I think it makes sense to simply allow sending cursor commands to any
> queue then.  A separate cursor queue continues to be an option for the
> guest then, but I'm not sure how useful that actually is in practice
> given that cursor image updates are regular resource updates and have to
> go through the control queue, so virtio_gpu_cursor_plane_update() has to
> wait for the resource update finish before it can queue the cursor
> command.  I suspect the idea to fast-track cursor updates with a
> separate queue doesn't work that well in practice because of that.
>
> cheers,
>   Gerd
>
>

[-- Attachment #1.2: Type: text/html, Size: 4798 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-03-10 22:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10  1:08 [RFC PATCH 0/8] *** Per context fencing *** Gurchetan Singh
2020-03-10  1:08 ` [RFC PATCH 1/8] drm/virtio: use fence_id when processing fences Gurchetan Singh
2020-03-10  1:08 ` [RFC PATCH 2/8] drm/virtio: allocate a fence context for every 3D context Gurchetan Singh
2020-03-10  1:08 ` [RFC PATCH 3/8] drm/virtio: plumb virtio_gpu_fpriv to virtio_gpu_fence_alloc Gurchetan Singh
2020-03-10  1:08 ` [RFC PATCH 4/8] drm/virtio: rename sync_seq and last_seq Gurchetan Singh
2020-03-10  1:08 ` [RFC PATCH 5/8] drm/virtio: track fence_id in virtio_gpu_fence Gurchetan Singh
2020-03-10  1:08 ` [RFC PATCH 6/8] virtio/drm: rework virtio_fence_signaled Gurchetan Singh
2020-03-10  1:08 ` [RFC PATCH 7/8] drm/virtio: check context when signaling Gurchetan Singh
2020-03-10  1:08 ` [RFC PATCH 8/8] drm/virtio: enable per context fencing Gurchetan Singh
2020-03-10  7:43 ` [RFC PATCH 0/8] *** Per context fencing *** Gerd Hoffmann
2020-03-10 22:57   ` Gurchetan Singh [this message]
2020-03-11 10:36     ` Gerd Hoffmann
2020-03-11 17:35       ` Chia-I Wu
2020-03-12  9:06         ` Gerd Hoffmann
2020-03-11 23:36       ` Gurchetan Singh
2020-03-12  0:43         ` Chia-I Wu
2020-03-12  9:10           ` Gerd Hoffmann
2020-03-12  9:29         ` Gerd Hoffmann
2020-03-12 23:08           ` Gurchetan Singh
2020-03-13 21:20             ` Chia-I Wu
2020-03-16  7:44               ` Gerd Hoffmann
2020-03-17 20:32                 ` Chia-I Wu
2020-03-18  6:40                   ` Gerd Hoffmann

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='CAAfnVB=sw=u80mHnZUPf_+WDW-hGNTDSBWLfV+7y3KFN=s6beQ@mail.gmail.com' \
    --to=gurchetansingh@chromium.org \
    --cc=chadversary@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jbates@chromium.org \
    --cc=kraxel@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.