[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190410114227.25846-4-kraxel@redhat.com>
Date: Wed, 10 Apr 2019 13:42:27 +0200
From: Gerd Hoffmann <kraxel@...hat.com>
To: dri-devel@...ts.freedesktop.org, virtio@...ts.oasis-open.org
Cc: David Airlie <airlied@...hat.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Marc-André Lureau <marcandre.lureau@...il.com>,
Tomeu Vizoso <tomeu.vizoso@...labora.com>,
Gurchetan Singh <gurchetansingh@...omium.org>,
Gerd Hoffmann <kraxel@...hat.com>,
Jason Wang <jasowang@...hat.com>,
David Airlie <airlied@...ux.ie>,
virtualization@...ts.linux-foundation.org (open list:VIRTIO CORE, NET
AND BLOCK DRIVERS), linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 3/3] virtio-gpu api: VIRTIO_GPU_F_RESSOURCE_V2
Add new command VIRTIO_GPU_CMD_RESOURCE_CREATE_V2 to create resources.
It adds (a) support planar resources and (b) returns stride and size of
the resource planes. The later will be needed in case we support
mapping host resources into the guest some day.
Signed-off-by: Gerd Hoffmann <kraxel@...hat.com>
---
include/uapi/linux/virtio_gpu.h | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/include/uapi/linux/virtio_gpu.h b/include/uapi/linux/virtio_gpu.h
index 732bb16a39f8..00010315e500 100644
--- a/include/uapi/linux/virtio_gpu.h
+++ b/include/uapi/linux/virtio_gpu.h
@@ -58,6 +58,11 @@
*/
#define VIRTIO_GPU_F_MEMORY 2
+/*
+ * VIRTIO_GPU_CMD_RESOURCE_CREATE_V2 command
+ */
+#define VIRTIO_GPU_F_RESSOURCE_V2 3
+
enum virtio_gpu_ctrl_type {
VIRTIO_GPU_UNDEFINED = 0,
@@ -76,6 +81,7 @@ enum virtio_gpu_ctrl_type {
VIRTIO_GPU_CMD_MEMORY_CREATE,
VIRTIO_GPU_CMD_MEMORY_UNREF,
VIRTIO_GPU_CMD_RESOURCE_ATTACH_MEMORY,
+ VIRTIO_GPU_CMD_RESOURCE_CREATE_V2,
/* 3d commands */
VIRTIO_GPU_CMD_CTX_CREATE = 0x0200,
@@ -97,6 +103,7 @@ enum virtio_gpu_ctrl_type {
VIRTIO_GPU_RESP_OK_CAPSET_INFO,
VIRTIO_GPU_RESP_OK_CAPSET,
VIRTIO_GPU_RESP_OK_EDID,
+ VIRTIO_GPU_RESP_OK_RESOURCE_INFO,
/* error responses */
VIRTIO_GPU_RESP_ERR_UNSPEC = 0x1200,
@@ -308,6 +315,30 @@ struct virtio_gpu_cmd_resource_attach_memory {
__le64 offset[4];
};
+/* VIRTIO_GPU_CMD_RESOURCE_CREATE_V2 */
+struct virtio_gpu_cmd_resource_create_v2 {
+ struct virtio_gpu_ctrl_hdr hdr;
+ __le32 resource_id;
+ __le32 format;
+ __le32 width;
+ __le32 height;
+ /* 3d only */
+ __le32 target;
+ __le32 bind;
+ __le32 depth;
+ __le32 array_size;
+ __le32 last_level;
+ __le32 nr_samples;
+ __le32 flags;
+};
+
+/* VIRTIO_GPU_RESP_OK_RESOURCE_INFO */
+struct virtio_gpu_resp_resource_info {
+ struct virtio_gpu_ctrl_hdr hdr;
+ __le32 stride[4];
+ __le32 size[4];
+};
+
#define VIRTIO_GPU_CAPSET_VIRGL 1
#define VIRTIO_GPU_CAPSET_VIRGL2 2
--
2.18.1
Powered by blists - more mailing lists