Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b47c175e authored by Lingfeng Yang's avatar Lingfeng Yang Committed by Alistair Delva
Browse files

CHROMIUM: drm/virtgpu: expose new ioctls to userspace

These are necessary for creating new types of resources and
memories.

BUG=chromium:924405
TEST=compile

Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1629910


Reviewed-by: default avatarRobert Tarasov <tutankhamen@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: default avatarGurchetan Singh <gurchetansingh@chromium.org>
Bug: 153580313
Signed-off-by: default avatarLingfeng Yang <lfy@google.com>
Change-Id: Iec22f634000bad1a8713e690db3774d0ab96408d
parent 58d06488
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@ extern "C" {
#define DRM_VIRTGPU_TRANSFER_TO_HOST 0x07
#define DRM_VIRTGPU_WAIT     0x08
#define DRM_VIRTGPU_GET_CAPS  0x09
#define DRM_VIRTGPU_RESOURCE_CREATE_V2 0x0a
#define DRM_VIRTGPU_ALLOCATION_METADATA_REQUEST  0x0b
#define DRM_VIRTGPU_ALLOCATION_METADATA_RESPONSE 0x0c

#define VIRTGPU_EXECBUF_FENCE_FD_IN	0x01
#define VIRTGPU_EXECBUF_FENCE_FD_OUT	0x02
@@ -71,6 +74,19 @@ struct drm_virtgpu_execbuffer {

#define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */
#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */
#define VIRTGPU_PARAM_RESOURCE_V2 3
#define VIRTGPU_PARAM_SHARED_GUEST 4
#define VIRTGPU_PARAM_HOST_COHERENT 5

#define VIRTGPU_MEMORY_UNDEFINED 0
#define VIRTGPU_MEMORY_TRANSFER 1
#define VIRTGPU_MEMORY_SHARED_GUEST 2
#define VIRTGPU_MEMORY_HOST_COHERENT 3

#define VIRTGPU_UNDEFINED_CACHING 0
#define VIRTGPU_CACHED 1
#define VIRTGPU_WRITE_COMBINE 2
#define VIRTGPU_UNCACHED 3

struct drm_virtgpu_getparam {
	__u64 param;
@@ -140,6 +156,31 @@ struct drm_virtgpu_get_caps {
	__u32 pad;
};

struct drm_virtgpu_resource_create_v2 {
	__u32 resource_id;
	__u32 guest_memory_type;
	__u32 caching_type;
	__u32 args_size;
	__u32 gem_handle;
	__u64 size;
	__u64 args; /* void */
};

struct drm_virtgpu_allocation_metadata_request {
	__u32 request_id;
	__u32 pad;
	__u32 request_size;
	__u32 response_size;
	__u64 request; /* void */
};

struct drm_virtgpu_allocation_metadata_response {
	__u32 request_id;
	__u32 pad;
	__u32 response_size;
	__u64 response; /* void */
};

#define DRM_IOCTL_VIRTGPU_MAP \
	DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_MAP, struct drm_virtgpu_map)

@@ -175,6 +216,18 @@ struct drm_virtgpu_get_caps {
	DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_GET_CAPS, \
	struct drm_virtgpu_get_caps)

#define DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_V2 \
	DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_RESOURCE_CREATE_V2, \
	struct drm_virtgpu_resource_create_v2)

#define DRM_IOCTL_VIRTGPU_ALLOCATION_METADATA_REQUEST \
	DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_ALLOCATION_METADATA_REQUEST, \
	struct drm_virtgpu_allocation_metadata_request)

#define DRM_IOCTL_VIRTGPU_ALLOCATION_METADATA_RESPONSE \
	DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_ALLOCATION_METADATA_RESPONSE, \
	struct drm_virtgpu_allocation_metadata_response)

#if defined(__cplusplus)
}
#endif