Dma-buf local display

Zhang, Tina tina.zhang at intel.com
Thu May 10 03:18:19 UTC 2018


You need to use “drmModeAddFB2WithModifiers()” instead of “drmModeAddFB()” in case your framebuffer needs to use fourcc codes as pixel format specifiers.
Thanks.

BR,
Tina

From: intel-gvt-dev [mailto:intel-gvt-dev-bounces at lists.freedesktop.org] On Behalf Of Charles Frey
Sent: Thursday, May 10, 2018 12:00 AM
To: intel-gvt-dev at lists.freedesktop.org
Subject: [Help] Dma-buf local display

Hi,
I'm trying to achieve local display of my guest dma-bufs without using a Qemu UI. My goal is to be able to directly display the framebuffers on a local display without necessiting an X server and Qemu UI such as GTK or spice.

Following the tutorial on https://01.org/igvt-g/blogs/wangbo85/2018/sharing-guest-framebuffer-host, I'm using the drm KMS API to get a framebuffer from a dma-buf FD, but can't get any display on my screen.

The way I'm implementing this is the following :

from qemu/hw/vfio/display.c, function vfio_display_get_dmabuf(), I get the following dma-buf FD and send it to a Unix socket that my DRM program listens to.

fd = ioctl(vdev->vbasedev.fd, VFIO_DEVICE_GET_GFX_DMABUF, &plane.dmabuf_id);

Then in my application, I get the corresponding handle with drmPrimeFDToHandle(dri_drm, fd, &device->handle), where dri_drm is the /dev/dri/card0 FD and device the struct representing it.
No error on this and I get a handle.

drmPrimeFDToHandle(dri_drm, fd, &device->handle);


When I try adding a framebuffer with drmModeAddFB() though, I get an error (-22, invalid argument).
The error is self explanatory as it is but I can't get to find which one is invalid, my height, width are correct. Is there a step I am missing?


Thanks for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20180510/62fef409/attachment-0001.html>


More information about the intel-gvt-dev mailing list