Re: [virtio-dev] Re: [PATCH v2 0/1] VirtIO video device specification

Gerd Hoffmann
2020-01-21T06:44:50Z

> > > Can't this problem be solved by adding "offset" field in virtio_video_mem_entry?
> > >
> > > struct virtio_video_mem_entry {
> > > le64 addr;
> > > le32 length;
> > > le32 offset;
> > > u8 padding[4];
> > > };
> > >
> > > Here, "addr" must be the same in every mem_entry for (1) hardware.
> >
> > No. virtio_video_mem_entry is basically a scatter list entry, you use
> > an *array* of these entries to describe your buffer (unless you are
> > using CMA due to hardware requirements, in this special case you have
> > only one entry in your array).
>
> I see. I forgot about scatter list.
> However, I'm still not sure about the usage for CMA.
> if we're using CMA for a multiplanar format, how can the device know
> where the second plane start from?
> In my understanding, the number of entries in this case should be the
> same with the number of planes and
> "entries[0].addr + entries[0].length == entries[1].addr" should hold.

With the one-buffer-per-frame model you could add a plane_offsets[4]
field to virtio_video_resource_create.

The virtio_video_mem_entry array describes the whole buffer for all
planes, the plane_offsets array says where the individual planes start
inside the buffer.

cheers,
Gerd