linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Keiichi Watanabe <keiichiw@chromium.org>
Cc: "Enrico Granata" <egranata@google.com>,
	"Dmitry Sepp" <dmitry.sepp@opensynergy.com>,
	virtio-dev@lists.oasis-open.org,
	"Tomasz Figa" <tfiga@chromium.org>,
	"Linux Media Mailing List" <linux-media@vger.kernel.org>,
	"Alexandre Courbot" <acourbot@chromium.org>,
	"Alex Lau" <alexlau@chromium.org>,
	"Dylan Reid" <dgreid@chromium.org>,
	"Stéphane Marchesin" <marcheu@chromium.org>,
	"Pawel Osciak" <posciak@chromium.org>,
	"David Stevens" <stevensd@chromium.org>,
	"Hans Verkuil" <hverkuil@xs4all.nl>,
	"Daniel Vetter" <daniel@ffwll.ch>
Subject: Re: [virtio-dev] [RFC RESEND] virtio-video: Add virtio video device specification
Date: Fri, 6 Dec 2019 08:32:05 +0100	[thread overview]
Message-ID: <20191206073205.4f3bbqbyeyxeipsx@sirius.home.kraxel.org> (raw)
In-Reply-To: <CAD90VcaTWvos-PPrniZn_AfFQrCEkMHNXvhR56ApD8kfdTSG9g@mail.gmail.com>

  Hi,

> > > > > +\subsection{Device ID}\label{sec:Device Types / Video Device / Device ID}
> > > > > +
> > > > > +TBD.
> > > >
> > > > I'm wondering how and when we can determine and reserve this ID?
> > >
> > > Grab the next free, update the spec accordingly, submit the one-line
> > > patch.
> 
> Thanks. I will do so at the next version of the patch.

No.  Submit as separate one-liner patch which does nothing but grabbing
an ID.

> > > > I'm wondering if we can use FOURCC instead. So, we can avoid reinventing a
> > > > mapping from formats to integers.
> > > > Also, I suppose the word "pixel formats" means only raw (decoded) formats.
> > > > But, it can be encoded format like H.264. So, I guess "image format" or
> > > > "fourcc" is a better word choice.
> > >
> > > Use separate pixel_format (fourcc) and stream_format (H.264 etc.) enums?
> > >
> 
> Fourcc is used for both raw and coded formats.
> I'm not sure if it makes much sense to define different enums for raw
> and coded formats, as
> we reuse any other structs for both types of formats.
> 
> What I'd suggest is like this:
> 
> #define FOURCC(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24))
> 
> enum virtio_video_fourcc {
>     VIRTIO_VIDEO_FOURCC_UNDEFINED = 0,
> 
>     /* Coded formats */
>     VIRTIO_VIDEO_FOURCC_H264 = FOURCC('H', '2', '6', '4'),
>     ...
> 
>     /* Raw formats */
>     VIRTIO_VIDEO_FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
>     ...
> }

Ok, that'll work.

I've linked fourcc to drm fourcc codes in my head, and drm hasn't codes
for the compressed formats.

When defining things this way we should of course make sure that the raw
format codes are identical to the ones drm uses.

Is there a formal standard for these codes btw?

> > As an interim solution, this form of "manual resource backing-store
> > management" could be specified as a feature flag.
> > Once there is an established solution for buffer sharing, we would
> > then go ahead and introduce a new feature flag for "works with the
> > buffer sharing mechanism", as an alternative to this manual mechanism.
> >
> > wdyt?
> 
> It'd be a good idea to change buffer management method by a feature flag.

I don't think so.  A device might want support multiple kinds of buffer
management, most notably both their own buffers and imported buffers.
Indicating which methods are available can be done with feature flags,
but actually picking one not.

> > > Well.  For buffer management there are a bunch of options.
> > >
> > >  (1) Simply stick the buffers (well, pointers to the buffer pages) into
> > >      the virtqueue.  This is the standard virtio way.
> > >
> > >  (2) Create resources, then put the resource ids into the virtqueue.
> > >      virtio-gpu uses that model.  First, because virtio-gpu needs an id
> > >      to reference resources in the rendering command stream
> > >      (virtio-video doesn't need this).  Also because (some kinds of)
> > >      resources are around for a long time and the guest-physical ->
> > >      host-virtual mapping needs to be done only once that way (which
> > >      I think would be the case for virtio-video too because v4l2
> > >      re-uses buffers in robin-round fashion).  Drawback is this
> > >      assumes shared memory between host and guest (which is the case
> > >      in typical use cases but it is not mandated by the virtio spec).
> > >
> > >  (3) Import external resources (from virtio-gpu for example).
> > >      Out of scope for now, will probably added as optional feature
> > >      later.
> > >
> > > I guess long-term we want support either (1)+(3) or (2)+(3).
> > >
> 
> In the first version of spec, we might want to support the minimal workable set
> of controls. Then, we'll be able to add additional controls with a new feature
> flag as Enrico suggested.
> 
> So, the problem is what's the simplest scenario and which types of controls are
> required there. I guess it's enough for (1) and (2) if we have T_RESOURCE_CREATE
> and T_RESOURCE_DESTROY.

For (1) you'll simply do a QUEUE_BUFFER.  The command carries references
to the buffer pages.  No resource management needed.

For (2) you'll have RESOURCE_CREATE + RESOURCE_DESTROY + QUEUE_RESOURCE,
where RESOURCE_CREATE passes the scatter list of buffer pages to the
host and QUEUE_RESOURCE will carry just the resource id.

For (3) you'll have RESOURCE_IMPORT + RESOURCE_DESTROY + QUEUE_RESOURCE.

cheers,
  Gerd


  reply	other threads:[~2019-12-06  7:32 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 19:19 [RFC RESEND] virtio-video: Add virtio video device specification Dmitry Sepp
2019-11-07  9:56 ` [virtio-dev] " Gerd Hoffmann
2019-11-07 13:09   ` Dmitry Sepp
2019-11-08  7:49     ` Gerd Hoffmann
2019-11-08  7:58       ` Tomasz Figa
2019-11-08  9:51       ` Dmitry Sepp
2019-11-08  7:50     ` Tomasz Figa
2019-11-08  9:05       ` Gerd Hoffmann
2019-11-08  9:28         ` Keiichi Watanabe
2019-11-20 11:29           ` Gerd Hoffmann
2019-11-21 10:54             ` Dmitry Sepp
2019-12-04  7:48               ` Keiichi Watanabe
2019-12-04  9:16                 ` Gerd Hoffmann
2019-12-04 19:11                   ` Enrico Granata
2019-12-05  8:21                     ` Keiichi Watanabe
2019-12-06  7:32                       ` Gerd Hoffmann [this message]
2019-12-06 12:30                         ` Keiichi Watanabe
2019-12-06 15:50                           ` Enrico Granata
2019-12-09 13:43                             ` Keiichi Watanabe
2019-12-09 10:46                           ` Gerd Hoffmann
2019-12-09 11:38                             ` Dmitry Sepp
2019-12-09 13:17                               ` Keiichi Watanabe
2019-12-09 14:19                   ` Dmitry Sepp
     [not found]                     ` <CAPR809t2X3eEZj14Y-0CdnmzGZFhWKt2vwFSZBrEZbChQpmU_w@mail.gmail.com>
2019-12-10 13:16                       ` Dmitry Sepp
2019-12-12  5:39                         ` Keiichi Watanabe
2019-12-12 10:34                           ` Dmitry Sepp
2019-12-13 14:20                             ` Keiichi Watanabe
2019-12-13 16:31                               ` Keiichi Watanabe
2019-12-20 14:24                                 ` Dmitry Sepp
2019-12-20 15:01                                   ` Keiichi Watanabe
2019-12-13 14:58                     ` Christophe de Dinechin
2019-12-16  8:09                   ` Tomasz Figa
2019-12-16 10:32                     ` Gerd Hoffmann
2019-12-17 13:15                       ` Tomasz Figa
2019-12-17 13:39                         ` Gerd Hoffmann
2019-12-17 14:09                           ` Keiichi Watanabe
2019-12-17 16:13                             ` Dmitry Sepp
2019-12-18  6:43                               ` 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=20191206073205.4f3bbqbyeyxeipsx@sirius.home.kraxel.org \
    --to=kraxel@redhat.com \
    --cc=acourbot@chromium.org \
    --cc=alexlau@chromium.org \
    --cc=daniel@ffwll.ch \
    --cc=dgreid@chromium.org \
    --cc=dmitry.sepp@opensynergy.com \
    --cc=egranata@google.com \
    --cc=hverkuil@xs4all.nl \
    --cc=keiichiw@chromium.org \
    --cc=linux-media@vger.kernel.org \
    --cc=marcheu@chromium.org \
    --cc=posciak@chromium.org \
    --cc=stevensd@chromium.org \
    --cc=tfiga@chromium.org \
    --cc=virtio-dev@lists.oasis-open.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;
as well as URLs for NNTP newsgroup(s).