[PATCH 1/2] drm/virtio: factor out the sg_table from virtio_gpu_object

Gurchetan Singh gurchetansingh at chromium.org
Wed Mar 4 02:09:15 UTC 2020


On Tue, Mar 3, 2020 at 1:56 AM Gerd Hoffmann <kraxel at redhat.com> wrote:

>   Hi,
>
> >  struct virtio_gpu_object {
> >       struct drm_gem_shmem_object base;
> >       uint32_t hw_res_handle;
> > -
> > -     struct sg_table *pages;
> >       uint32_t mapped;
> > -
> >       bool dumb;
> >       bool created;
> >  };
> >  #define gem_to_virtio_gpu_obj(gobj) \
> >       container_of((gobj), struct virtio_gpu_object, base.base)
> >
> > +struct virtio_gpu_object_shmem {
> > +     struct virtio_gpu_object base;
> > +     struct sg_table *pages;
> > +};
>
> mapped can be moved too.
>
> > @@ -600,10 +600,11 @@ void virtio_gpu_cmd_transfer_to_host_2d(struct
> virtio_gpu_device *vgdev,
>
> > +     struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo);
>
> Should we pass struct virtio_gpu_object_shmem to
> virtio_gpu_cmd_transfer_to_host_2d (+friends) instead?
>

It ends up being a little more complicated, due to casting to
virtio_gpu_object and then virtio_gpu_object_shmem in
virtio_gpu_transfer_to_host_ioctl, so I omitted it v2...


>
> hostmem will not need transfers ...
>
> cheers,
>   Gerd
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200303/987a483c/attachment-0001.htm>


More information about the dri-devel mailing list