[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 07/13] virtio-gpu: Add initial definitions for blob resources
From: |
Vivek Kasireddy |
Subject: |
[PATCH v4 07/13] virtio-gpu: Add initial definitions for blob resources |
Date: |
Tue, 11 May 2021 15:47:13 -0700 |
Add the property bit, configuration flag and other relevant
macros and definitions associated with this feature.
Based-on-patch-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
hw/display/virtio-gpu-base.c | 3 +++
hw/display/virtio-gpu.c | 14 ++++++++++++++
include/hw/virtio/virtio-gpu.h | 3 +++
3 files changed, 20 insertions(+)
diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
index afb3ee7d9a..dd294276cb 100644
--- a/hw/display/virtio-gpu-base.c
+++ b/hw/display/virtio-gpu-base.c
@@ -208,6 +208,9 @@ virtio_gpu_base_get_features(VirtIODevice *vdev, uint64_t
features,
if (virtio_gpu_edid_enabled(g->conf)) {
features |= (1 << VIRTIO_GPU_F_EDID);
}
+ if (virtio_gpu_blob_enabled(g->conf)) {
+ features |= (1 << VIRTIO_GPU_F_RESOURCE_BLOB);
+ }
return features;
}
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 7a0db3a860..f77a7fc7dd 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1108,6 +1108,18 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error
**errp)
VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
VirtIOGPU *g = VIRTIO_GPU(qdev);
+ if (virtio_gpu_blob_enabled(g->parent_obj.conf)) {
+ if (!virtio_gpu_have_udmabuf()) {
+ error_setg(errp, "cannot enable blob resources without udmabuf");
+ return;
+ }
+
+ if (virtio_gpu_virgl_enabled(g->parent_obj.conf)) {
+ error_setg(errp, "blobs and virgl are not compatible (yet)");
+ return;
+ }
+ }
+
if (!virtio_gpu_base_device_realize(qdev,
virtio_gpu_handle_ctrl_cb,
virtio_gpu_handle_cursor_cb,
@@ -1201,6 +1213,8 @@ static Property virtio_gpu_properties[] = {
VIRTIO_GPU_BASE_PROPERTIES(VirtIOGPU, parent_obj.conf),
DEFINE_PROP_SIZE("max_hostmem", VirtIOGPU, conf_max_hostmem,
256 * MiB),
+ DEFINE_PROP_BIT("blob", VirtIOGPU, parent_obj.conf.flags,
+ VIRTIO_GPU_FLAG_BLOB_ENABLED, false),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index dad9a1d221..66e7aaad0e 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -89,6 +89,7 @@ enum virtio_gpu_base_conf_flags {
VIRTIO_GPU_FLAG_STATS_ENABLED,
VIRTIO_GPU_FLAG_EDID_ENABLED,
VIRTIO_GPU_FLAG_DMABUF_ENABLED,
+ VIRTIO_GPU_FLAG_BLOB_ENABLED,
};
#define virtio_gpu_virgl_enabled(_cfg) \
@@ -99,6 +100,8 @@ enum virtio_gpu_base_conf_flags {
(_cfg.flags & (1 << VIRTIO_GPU_FLAG_EDID_ENABLED))
#define virtio_gpu_dmabuf_enabled(_cfg) \
(_cfg.flags & (1 << VIRTIO_GPU_FLAG_DMABUF_ENABLED))
+#define virtio_gpu_blob_enabled(_cfg) \
+ (_cfg.flags & (1 << VIRTIO_GPU_FLAG_BLOB_ENABLED))
struct virtio_gpu_base_conf {
uint32_t max_outputs;
--
2.30.2
- [PATCH v4 00/13] virtio-gpu: Add support for Blob resources feature (v4), Vivek Kasireddy, 2021/05/11
- [PATCH v4 02/13] headers: Add udmabuf.h, Vivek Kasireddy, 2021/05/11
- [PATCH v4 13/13] virtio-gpu: Update cursor data using blob, Vivek Kasireddy, 2021/05/11
- [PATCH v4 12/13] virtio-gpu: Add virtio_gpu_set_scanout_blob, Vivek Kasireddy, 2021/05/11
- [PATCH v4 01/13] ui: Get the fd associated with udmabuf driver, Vivek Kasireddy, 2021/05/11
- [PATCH v4 03/13] virtio-gpu: Add udmabuf helpers, Vivek Kasireddy, 2021/05/11
- [PATCH v4 04/13] virtio-gpu: Add virtio_gpu_find_check_resource, Vivek Kasireddy, 2021/05/11
- [PATCH v4 05/13] virtio-gpu: Refactor virtio_gpu_set_scanout, Vivek Kasireddy, 2021/05/11
- [PATCH v4 06/13] virtio-gpu: Refactor virtio_gpu_create_mapping_iov, Vivek Kasireddy, 2021/05/11
- [PATCH v4 08/13] virtio-gpu: Add virtio_gpu_resource_create_blob, Vivek Kasireddy, 2021/05/11
- [PATCH v4 07/13] virtio-gpu: Add initial definitions for blob resources,
Vivek Kasireddy <=
- [PATCH v4 09/13] ui/pixman: Add qemu_pixman_to_drm_format(), Vivek Kasireddy, 2021/05/11
- [PATCH v4 10/13] virtio-gpu: Add helpers to create and destroy dmabuf objects, Vivek Kasireddy, 2021/05/11
- [PATCH v4 11/13] virtio-gpu: Factor out update scanout, Vivek Kasireddy, 2021/05/11
- Re: [PATCH v4 00/13] virtio-gpu: Add support for Blob resources feature (v4), Gerd Hoffmann, 2021/05/18