aboutsummaryrefslogtreecommitdiff
path: root/hw/vfio/display.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-03-13 11:17:29 -0600
committerAlex Williamson <alex.williamson@redhat.com>2018-03-13 11:17:29 -0600
commita9994687cb9b5f72399398a0985419f4d2b95dc5 (patch)
tree402f3fb15d2af321750ff23eecf84854b77db14e /hw/vfio/display.c
parent92f86bff088dc6f0c0ed93b8e82d4d2459c35145 (diff)
downloadqemu-a9994687cb9b5f72399398a0985419f4d2b95dc5.zip
qemu-a9994687cb9b5f72399398a0985419f4d2b95dc5.tar.gz
qemu-a9994687cb9b5f72399398a0985419f4d2b95dc5.tar.bz2
vfio/display: core & wireup
Infrastructure for display support. Must be enabled using 'display' property. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed By: Kirti Wankhede <kwankhede@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio/display.c')
-rw-r--r--hw/vfio/display.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/hw/vfio/display.c b/hw/vfio/display.c
new file mode 100644
index 0000000..3e997f8
--- /dev/null
+++ b/hw/vfio/display.c
@@ -0,0 +1,56 @@
+/*
+ * display support for mdev based vgpu devices
+ *
+ * Copyright Red Hat, Inc. 2017
+ *
+ * Authors:
+ * Gerd Hoffmann
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include <linux/vfio.h>
+#include <sys/ioctl.h>
+
+#include "sysemu/sysemu.h"
+#include "ui/console.h"
+#include "qapi/error.h"
+#include "pci.h"
+
+int vfio_display_probe(VFIOPCIDevice *vdev, Error **errp)
+{
+ struct vfio_device_gfx_plane_info probe;
+ int ret;
+
+ memset(&probe, 0, sizeof(probe));
+ probe.argsz = sizeof(probe);
+ probe.flags = VFIO_GFX_PLANE_TYPE_PROBE | VFIO_GFX_PLANE_TYPE_DMABUF;
+ ret = ioctl(vdev->vbasedev.fd, VFIO_DEVICE_QUERY_GFX_PLANE, &probe);
+ if (ret == 0) {
+ error_setg(errp, "vfio-display: dmabuf support not implemented yet");
+ return -1;
+ }
+
+ memset(&probe, 0, sizeof(probe));
+ probe.argsz = sizeof(probe);
+ probe.flags = VFIO_GFX_PLANE_TYPE_PROBE | VFIO_GFX_PLANE_TYPE_REGION;
+ ret = ioctl(vdev->vbasedev.fd, VFIO_DEVICE_QUERY_GFX_PLANE, &probe);
+ if (ret == 0) {
+ error_setg(errp, "vfio-display: region support not implemented yet");
+ return -1;
+ }
+
+ if (vdev->display == ON_OFF_AUTO_AUTO) {
+ /* not an error in automatic mode */
+ return 0;
+ }
+
+ error_setg(errp, "vfio: device doesn't support any (known) display method");
+ return -1;
+}
+
+void vfio_display_finalize(VFIOPCIDevice *vdev)
+{
+}