[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC QEMU PATCH 17/18] virtio-gpu: Add video hardware accelerate support
From: |
Huang Rui |
Subject: |
[RFC QEMU PATCH 17/18] virtio-gpu: Add video hardware accelerate support for virgl |
Date: |
Sun, 12 Mar 2023 17:22:43 +0800 |
From: Honglei Huang <honglei1.huang@amd.com>
Add get_drm_fd callback let the guest OS can get render node to using hw accel
codec.
Signed-off-by: Honglei Huang <honglei1.huang@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
---
hw/display/virtio-gpu-virgl.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index d5214e0f43..aef735a427 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -13,6 +13,7 @@
#include "qemu/osdep.h"
#include "qemu/iov.h"
+#include "qemu/drm.h"
#include "trace.h"
#include "hw/virtio/virtio.h"
#include "hw/virtio/virtio-gpu.h"
@@ -827,12 +828,22 @@ static int virgl_make_context_current(void *opaque, int
scanout_idx,
qctx);
}
+static int virgl_get_drm_fd(void *opaque)
+{
+ int fd = -1;
+
+ fd = qemu_drm_rendernode_open(NULL);
+
+ return fd;
+}
+
static struct virgl_renderer_callbacks virtio_gpu_3d_cbs = {
.version = 1,
.write_fence = virgl_write_fence,
.create_gl_context = virgl_create_context,
.destroy_gl_context = virgl_destroy_context,
.make_current = virgl_make_context_current,
+ .get_drm_fd = virgl_get_drm_fd,
};
static void virtio_gpu_print_stats(void *opaque)
@@ -886,14 +897,20 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g)
virgl_renderer_reset();
}
+
+
int virtio_gpu_virgl_init(VirtIOGPU *g)
{
int ret;
+#ifndef VIRGL_RENDERER_USE_VIDEO
+#define VIRGL_RENDERER_USE_VIDEO (1 << 11)
+#endif
+
#ifdef VIRGL_RENDERER_VENUS
- ret = virgl_renderer_init(g, VIRGL_RENDERER_VENUS, &virtio_gpu_3d_cbs);
+ ret = virgl_renderer_init(g, VIRGL_RENDERER_VENUS |
VIRGL_RENDERER_USE_VIDEO, &virtio_gpu_3d_cbs);
#else
- ret = virgl_renderer_init(g, 0, &virtio_gpu_3d_cbs);
+ ret = virgl_renderer_init(g, 0 | VIRGL_RENDERER_USE_VIDEO,
&virtio_gpu_3d_cbs);
#endif
if (ret != 0) {
error_report("virgl could not be initialized: %d", ret);
--
2.25.1
- [RFC QEMU PATCH 07/18] virtio-gpu: Support Venus capset, (continued)
- [RFC QEMU PATCH 07/18] virtio-gpu: Support Venus capset, Huang Rui, 2023/03/12
- [RFC QEMU PATCH 08/18] virtio-gpu: Initialize Venus, Huang Rui, 2023/03/12
- [RFC QEMU PATCH 09/18] meson: Enable virglrenderer unstable APIs, Huang Rui, 2023/03/12
- [RFC QEMU PATCH 10/18] virtio-gpu: Handle set scanout blob command, Huang Rui, 2023/03/12
- [RFC QEMU PATCH 11/18] virtio-gpu: make blob scanout use dmabuf fd, Huang Rui, 2023/03/12
- [RFC QEMU PATCH 12/18] softmmu: Fix the size to map cache with xen for host virtual address, Huang Rui, 2023/03/12
- [RFC QEMU PATCH 13/18] hw/i386/xen/xen-hvm: Introduce xen_ram_block_check function, Huang Rui, 2023/03/12
- [RFC QEMU PATCH 14/18] softmmu: Add ram block check to map the xen ram memory, Huang Rui, 2023/03/12
- [RFC QEMU PATCH 16/18] virtio-gpu: fix hw-display-virtio-gpu.so undefined symbol virtio_gpu_virgl_resource_unmap, Huang Rui, 2023/03/12
- [RFC QEMU PATCH 17/18] virtio-gpu: Add video hardware accelerate support for virgl,
Huang Rui <=
- [RFC QEMU PATCH 18/18] xen: translate irq of host pci device to gsi, Huang Rui, 2023/03/12
- [RFC QEMU PATCH 15/18] softmmu: Enable qemu ram allocation with fd for Xen, Huang Rui, 2023/03/12