RFC: drm/virtio: Dummy virtio GPU
Subsystems (3)
Hi,
I'd like to get comments on this before I polish it. This is a simple way to get something similar with vkms but it heavily reuse the code provided by virtio-gpu. Please feel free to give me any feedbacks or comments.
Thanks!
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 RFC: drm/virtio: Dummy virtio GPU
The idea here is: if we run the vm headless, we don't really need to communicate with VMM, and we even don't need any VMM support for virtio-gpu. Of course, only 2d works. But it's enough for some use case. And this looks simpler than vkms.
--- drivers/gpu/drm/virtio/Kconfig | 9 ++ drivers/gpu/drm/virtio/Makefile | 3 + drivers/gpu/drm/virtio/virtgpu_dummy.c | 161 +++++++++++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 drivers/gpu/drm/virtio/virtgpu_dummy.c
drivers/gpu/drm/virtio/Kconfig +9 -0
@@ -9,3 +9,12 @@ config DRM_VIRTIO_GPU QEMU based VMMs (like KVM or Xen). If unsure say M. + +config DRM_VIRTIO_GPU_DUMMY + tristate "Virtio dummy GPU driver" + depends on DRM_VIRTIO_GPU + help + This add a new virtio GPU device which handles the virtio ring buffers + inline so it doesn't rely on VMM to provide the virtio GPU device. + Currently it only handle VIRTIO_GPU_CMD_GET_DISPLAY_INFO which is enough + for a dummy 2D VGA device.
drivers/gpu/drm/virtio/Makefile +3 -0
@@ -8,4 +8,7 @@ virtio-gpu-y := virtgpu_drv.o virtgpu_kms.o virtgpu_gem.o \ virtgpu_fence.o virtgpu_object.o virtgpu_debugfs.o virtgpu_plane.o \ virtgpu_ioctl.o virtgpu_prime.o virtgpu_trace_points.o +virtio-gpu-dummy-y := virtgpu_dummy.o + obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio-gpu.o +obj-$(CONFIG_DRM_VIRTIO_GPU_DUMMY) += virtio-gpu-dummy.o
drivers/gpu/drm/virtio/virtgpu_dummy.c new file +161 -0
161 lines not on this page · raw message
Signature · 6 lines
2.25.0.265.gbab2e86ba0-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerQuoted 6 lines · Lepton Wu
Hi,
I'd like to get comments on this before I polish it. This is a simple way to get something similar with vkms but it heavily reuse the code provided by virtio-gpu. Please feel free to give me any feedbacks or comments.
No.
First, what is wrong with vkms?
Second, if you really want something simple with the minimal set of drm features possible you can write a rather small but still self-contained driver when using all the drm helpers (shmem, simple display pipe) we have these days. Copy cirrus, strip it down: drop modesetting code, drop blit-from-shmem-to-vram code, drop pci probing. Maybe add module options for max/default video mode. Done.
What is the use case btw?
cheers,
Gerd
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Gerd Hoffmann
Quoted 2 lines · Lepton Wu
Hi,
Quoted 8 lines
Quoted 4 lines
I'd like to get comments on this before I polish it. This is a simple way to get something similar with vkms but it heavily reuse the code provided by virtio-gpu. Please feel free to give me any feedbacks or comments.
No.
First, what is wrong with vkms?
The total lines of vkms driver is 1.2k+. I think it doesn't work along itself to provide things like mmap on prime fd? (I tried it months ago). Of course, that could be fixed, but then it will bring more code. While my "dummy
virtio" code is only around 100 lines. And more, my "dummy virtio" device actually doesn't really depends on drm system so it's easier to back port to old kernel.
Quoted 8 lines
Second, if you really want something simple with the minimal set of drm features possible you can write a rather small but still self-contained driver when using all the drm helpers (shmem, simple display pipe) we have these days. Copy cirrus, strip it down: drop modesetting code, drop blit-from-shmem-to-vram code, drop pci probing. Maybe add module options for max/default video mode. Done.
I need features like prime export/import, mmap on prime fd etc. And I'd like the code could work on different kernel version. So if go with this ways, the actually add more maintain cost in the long term? since any
changes at drm frame work could need change to it.
Quoted 2 lines
What is the use case btw?
We have images works well under qemu + virtio vga, we'd like to run these images on public cloud service like Google GCE directly. So I got the idea that if some how we can run virtio stack without vmm support. That
actually would help and also let the same image run on other cloud services.
Quoted 4 lines
cheers,
Gerd
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerQuoted 4 lines
Quoted 3 lines
No.
First, what is wrong with vkms?
The total lines of vkms driver is 1.2k+.
Which is small for a drm driver.
Quoted 3 lines
I think it doesn't work along
itself to provide things like mmap on prime fd? (I tried it months ago).
Seems vkms only supports prime import, not prime export. Maybe vgem works for you?
Quoted 3 lines
And more, my "dummy virtio"
device actually doesn't really depends on drm system so it's easier to back port to old kernel.
It depends on the virtio driver, which in turn *does* depend on drm system. So you have a indirect instead of a direct dependency. I still don't see the point ...
Quoted 7 lines
Quoted 6 lines
Second, if you really want something simple with the minimal set of drm features possible you can write a rather small but still self-contained driver when using all the drm helpers (shmem, simple display pipe) we have these days. Copy cirrus, strip it down: drop modesetting code, drop blit-from-shmem-to-vram code, drop pci probing. Maybe add module options for max/default video mode. Done.
I need features like prime export/import, mmap on prime fd etc.
The shmem helpers support that just fine.
Quoted 2 lines
And I'd like the code could work on different kernel version. So if go with this ways, the actually add more maintain cost in the long term?
Depends on which kernel version you need. Backporting to 5.4-lts should be easy, 4.4-lts lacks alot of the drm helpers though.
Quoted 3 lines
Quoted 1 line
What is the use case btw?
We have images works well under qemu + virtio vga, we'd like to run these images on public cloud service like Google GCE directly.
What do these images need a drm device for? It seems not to be hardware-accelerated rendering. It also seems not to be a virtual display.
cheers,
Gerd
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): CALqoU4z7GYNu3DWRQcK=boGFZ=n7yHLEhEeOgXHZQ=17DMrjzQ@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CALqoU4ztV6KGZDYdd2-fUY2+bJgie3-RhrgoC8B9anqTUO06zQ@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Gerd Hoffmann
Quoted 9 lines
Quoted 4 lines
Hmm, yes, I can see loopback virtio being useful for various cases. Testing being one. A dummy virtio-gpu could be done too, or a more advanced version which exports the display as vnc.
So what's your suggestion on this? Changing this to
drivers/virtiodir and then add some user space api? I am thinking about introducing a new/dev/dummy-virtio, then user space can open it, use ioctl to create new virtio hardware, and can handle the virtio traffic with read/write to simulate the different virtio hardware.
Quoted 7 lines
Yep, sounds useful. You might want check out the uinput driver which does something simliar for input devices. I wouldn't name this dummy, maybe uvirtio.
cheers,
Gerd
Add back mail list so other people can follow.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel