[RFC PATCH 0/8] *** Refactor struct virtgpu_object ***

Gerd Hoffmann kraxel at redhat.com
Fri Feb 28 10:28:10 UTC 2020


  Hi,

> > struct virtgpu_object {
> 
> Yeah, using "virtgpu_" rather than "virtio_gpu" makes sense.

It wasn't my intention to suggest a rename.  It's just that the kernel
is a bit inconsistent here and I picked the wrong name here.  Most
places use virtio_gpu but some use virtgpu (file names, ioctl api).

> > struct virtgpu_object_hostmem {
> >         struct virtgpu_object base;
> >         {offset, range};
> >         (...)
> 
> I'm a kernel newbie, so it's not obvious to me why struct
> drm_gem_shmem_object would be a base class for struct
> virtgpu_object_hostmem?

I think it is easier to just continue using virtio_gpu_object in most
places and cast to virtio_gpu_object_{shmem,hostmem} only if needed.
Makes it easier to deal with common fields like hw_res_handle.

In the hostmem case we would simply not use the drm_gem_shmem_object
fields except for drm_gem_shmem_object.base (which is drm_gem_object).

> Side question: is drm_gem_object_funcs.vmap(..) /
> drm_gem_object_funcs.vunmap(..) even possible for hostmem?

Sure.  Using ioremap should work, after asking the host to map the
object at some location in the pci bar.

cheers,
  Gerd



More information about the dri-devel mailing list