All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Kasireddy <vivek.kasireddy@intel.com>
To: qemu-devel@nongnu.org
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH v3 07/20] virtio-gpu: Add initial definitions for blob resources
Date: Tue, 11 May 2021 01:08:05 -0700	[thread overview]
Message-ID: <20210511080818.366985-8-vivek.kasireddy@intel.com> (raw)
In-Reply-To: <20210511080818.366985-1-vivek.kasireddy@intel.com>

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 bff2eb1fdc..1c7b4171c8 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -87,6 +87,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) \
@@ -97,6 +98,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



  parent reply	other threads:[~2021-05-11  8:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11  8:07 [PATCH v3 00/20] virtio-gpu: Add support for Blob resources Vivek Kasireddy
2021-05-11  8:07 ` [PATCH v3 01/20] ui: Get the fd associated with udmabuf driver Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 02/20] headers: Add udmabuf.h Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 03/20] virtio-gpu: Add udmabuf helpers Vivek Kasireddy
2021-05-11 11:22   ` Gerd Hoffmann
2021-05-11  8:08 ` [PATCH v3 04/20] virtio-gpu: Add virtio_gpu_find_check_resource Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 05/20] virtio-gpu: Refactor virtio_gpu_set_scanout Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 06/20] virtio-gpu: Refactor virtio_gpu_create_mapping_iov Vivek Kasireddy
2021-05-11  8:08 ` Vivek Kasireddy [this message]
2021-05-11  8:08 ` [PATCH v3 08/20] virtio-gpu: Add virtio_gpu_resource_create_blob Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 09/20] ui/pixman: Add qemu_pixman_to_drm_format() Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 10/20] virtio-gpu: Add helpers to create and destroy dmabuf objects Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 11/20] virtio-gpu: Factor out update scanout Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 12/20] virtio-gpu: Add virtio_gpu_set_scanout_blob Vivek Kasireddy
2021-05-11 11:39   ` Gerd Hoffmann
2021-05-11 22:42     ` Kasireddy, Vivek
2021-05-11  8:08 ` [PATCH v3 13/20] virtio-gpu: Update cursor data using blob Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 14/20] virtio-gpu: Add initial definitions for explict flush feature Vivek Kasireddy
2021-05-11 11:42   ` Gerd Hoffmann
2021-05-11  8:08 ` [PATCH v3 15/20] virtio-gpu: Add dmabuf helpers for synchronization Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 16/20] virtio-gpu: Add virtio_gpu_wait_flush API Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 17/20] ui: Add egl helpers for synchronization Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 18/20] ui/gtk-egl: Wait for the draw signal for dmabuf blobs Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 19/20] ui/gtk: Create a common release_dmabuf helper Vivek Kasireddy
2021-05-11  8:08 ` [PATCH v3 20/20] virtio-gpu: Add gl_flushed callback Vivek Kasireddy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210511080818.366985-8-vivek.kasireddy@intel.com \
    --to=vivek.kasireddy@intel.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.