virtio-gpu-virgl: Add support for virgl video acceleration

Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
This commit is contained in:
Feng Jiang 2024-09-27 10:04:38 +08:00 committed by openkylin-cibot
parent fea43adc82
commit 0a817841f8
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,48 @@
From: Feng Jiang <jiangfeng@kylinos.cn>
Date: Fri, 27 Sep 2024 10:04:38 +0800
Subject: virtio-gpu-virgl: Add support for virgl video acceleration
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
---
hw/display/virtio-gpu-virgl.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index 9f34d0e..a3df55a 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -14,6 +14,7 @@
#include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qemu/iov.h"
+#include "qemu/drm.h"
#include "trace.h"
#include "hw/virtio/virtio.h"
#include "hw/virtio/virtio-gpu.h"
@@ -563,12 +564,18 @@ static int virgl_make_context_current(void *opaque, int scanout_idx,
qctx);
}
+static int virgl_get_drm_fd(void *opaque)
+{
+ return qemu_drm_rendernode_open(NULL);
+}
+
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)
@@ -638,6 +645,7 @@ int virtio_gpu_virgl_init(VirtIOGPU *g)
flags |= VIRGL_RENDERER_D3D11_SHARE_TEXTURE;
}
#endif
+ flags |= VIRGL_RENDERER_USE_VIDEO;
ret = virgl_renderer_init(g, flags, &virtio_gpu_3d_cbs);
if (ret != 0) {

View File

@ -1 +1,2 @@
0001-add-missing-files.patch
0002-virtio-gpu-virgl-Add-support-for-virgl-video-acceler.patch