mirror of
https://github.com/torvalds/linux.git
synced 2026-05-02 13:32:40 -04:00
drm/virtio: Support virtgpu exported resources
Add support for UUID-based resource sharing mechanism to virtgpu. This implements the new virtgpu commands and hooks them up to dma-buf's get_uuid callback. Signed-off-by: David Stevens <stevensd@chromium.org> Acked-by: Michael S. Tsirkin <mst@redhat.com> Link: http://patchwork.freedesktop.org/patch/msgid/20200818071343.3461203-4-stevensd@chromium.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
committed by
Gerd Hoffmann
parent
592d9fba33
commit
c84adb304c
@@ -49,6 +49,10 @@
|
||||
#define DRIVER_MINOR 1
|
||||
#define DRIVER_PATCHLEVEL 0
|
||||
|
||||
#define UUID_INITIALIZING 0
|
||||
#define UUID_INITIALIZED 1
|
||||
#define UUID_INITIALIZATION_FAILED 2
|
||||
|
||||
struct virtio_gpu_object_params {
|
||||
uint32_t format;
|
||||
uint32_t width;
|
||||
@@ -71,6 +75,9 @@ struct virtio_gpu_object {
|
||||
uint32_t hw_res_handle;
|
||||
bool dumb;
|
||||
bool created;
|
||||
|
||||
int uuid_state;
|
||||
uuid_t uuid;
|
||||
};
|
||||
#define gem_to_virtio_gpu_obj(gobj) \
|
||||
container_of((gobj), struct virtio_gpu_object, base.base)
|
||||
@@ -200,6 +207,7 @@ struct virtio_gpu_device {
|
||||
bool has_virgl_3d;
|
||||
bool has_edid;
|
||||
bool has_indirect;
|
||||
bool has_resource_assign_uuid;
|
||||
|
||||
struct work_struct config_changed_work;
|
||||
|
||||
@@ -210,6 +218,9 @@ struct virtio_gpu_device {
|
||||
struct virtio_gpu_drv_capset *capsets;
|
||||
uint32_t num_capsets;
|
||||
struct list_head cap_cache;
|
||||
|
||||
/* protects resource state when exporting */
|
||||
spinlock_t resource_export_lock;
|
||||
};
|
||||
|
||||
struct virtio_gpu_fpriv {
|
||||
@@ -336,6 +347,10 @@ void virtio_gpu_dequeue_fence_func(struct work_struct *work);
|
||||
|
||||
void virtio_gpu_notify(struct virtio_gpu_device *vgdev);
|
||||
|
||||
int
|
||||
virtio_gpu_cmd_resource_assign_uuid(struct virtio_gpu_device *vgdev,
|
||||
struct virtio_gpu_object_array *objs);
|
||||
|
||||
/* virtgpu_display.c */
|
||||
void virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev);
|
||||
void virtio_gpu_modeset_fini(struct virtio_gpu_device *vgdev);
|
||||
@@ -367,6 +382,12 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev,
|
||||
bool virtio_gpu_is_shmem(struct virtio_gpu_object *bo);
|
||||
|
||||
/* virtgpu_prime.c */
|
||||
struct dma_buf *virtgpu_gem_prime_export(struct drm_gem_object *obj,
|
||||
int flags);
|
||||
struct drm_gem_object *virtgpu_gem_prime_import(struct drm_device *dev,
|
||||
struct dma_buf *buf);
|
||||
int virtgpu_gem_prime_get_uuid(struct drm_gem_object *obj,
|
||||
uuid_t *uuid);
|
||||
struct drm_gem_object *virtgpu_gem_prime_import_sg_table(
|
||||
struct drm_device *dev, struct dma_buf_attachment *attach,
|
||||
struct sg_table *sgt);
|
||||
|
||||
Reference in New Issue
Block a user