mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-18 06:33:43 -04:00
drm/virtio: rework resource creation workflow.
This patch moves the virtio_gpu_cmd_create_resource() call (which notifies the host about the new resource created) into the virtio_gpu_object_create() function. That way we can call virtio_gpu_cmd_create_resource() before ttm_bo_init(), so the host already knows about the object when ttm initializes the object and calls our driver callbacks. Specifically the object is already created when the virtio_gpu_ttm_tt_bind() callback invokes virtio_gpu_object_attach(), so the extra virtio_gpu_object_attach() calls done after virtio_gpu_object_create() are not needed any more. The fence support for the create ioctl becomes a bit more tricky though. The code moved into virtio_gpu_object_create() too. We first submit the (fenced) virtio_gpu_cmd_create_resource() command, then initialize the ttm object, and finally attach just created object to the fence for the command in case it didn't finish yet. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Noralf Trønnes <noralf@tronnes.org> Link: http://patchwork.freedesktop.org/patch/msgid/20190318113332.10900-6-kraxel@redhat.com
This commit is contained in:
@@ -55,7 +55,9 @@ struct virtio_gpu_object_params {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
unsigned long size;
|
||||
bool dumb;
|
||||
/* 3d */
|
||||
bool virgl;
|
||||
uint32_t target;
|
||||
uint32_t bind;
|
||||
uint32_t depth;
|
||||
@@ -219,6 +221,9 @@ struct virtio_gpu_fpriv {
|
||||
/* virtio_ioctl.c */
|
||||
#define DRM_VIRTIO_NUM_IOCTLS 10
|
||||
extern struct drm_ioctl_desc virtio_gpu_ioctls[DRM_VIRTIO_NUM_IOCTLS];
|
||||
int virtio_gpu_object_list_validate(struct ww_acquire_ctx *ticket,
|
||||
struct list_head *head);
|
||||
void virtio_gpu_unref_list(struct list_head *head);
|
||||
|
||||
/* virtio_kms.c */
|
||||
int virtio_gpu_init(struct drm_device *dev);
|
||||
@@ -241,7 +246,8 @@ void virtio_gpu_gem_object_close(struct drm_gem_object *obj,
|
||||
struct drm_file *file);
|
||||
struct virtio_gpu_object*
|
||||
virtio_gpu_alloc_object(struct drm_device *dev,
|
||||
struct virtio_gpu_object_params *params);
|
||||
struct virtio_gpu_object_params *params,
|
||||
struct virtio_gpu_fence *fence);
|
||||
int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
|
||||
struct drm_device *dev,
|
||||
struct drm_mode_create_dumb *args);
|
||||
@@ -258,7 +264,8 @@ int virtio_gpu_alloc_vbufs(struct virtio_gpu_device *vgdev);
|
||||
void virtio_gpu_free_vbufs(struct virtio_gpu_device *vgdev);
|
||||
void virtio_gpu_cmd_create_resource(struct virtio_gpu_device *vgdev,
|
||||
struct virtio_gpu_object *bo,
|
||||
struct virtio_gpu_object_params *params);
|
||||
struct virtio_gpu_object_params *params,
|
||||
struct virtio_gpu_fence *fence);
|
||||
void virtio_gpu_cmd_unref_resource(struct virtio_gpu_device *vgdev,
|
||||
uint32_t resource_id);
|
||||
void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev,
|
||||
@@ -317,7 +324,8 @@ void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev,
|
||||
void
|
||||
virtio_gpu_cmd_resource_create_3d(struct virtio_gpu_device *vgdev,
|
||||
struct virtio_gpu_object *bo,
|
||||
struct virtio_gpu_object_params *params);
|
||||
struct virtio_gpu_object_params *params,
|
||||
struct virtio_gpu_fence *fence);
|
||||
void virtio_gpu_ctrl_ack(struct virtqueue *vq);
|
||||
void virtio_gpu_cursor_ack(struct virtqueue *vq);
|
||||
void virtio_gpu_fence_ack(struct virtqueue *vq);
|
||||
@@ -345,6 +353,7 @@ void virtio_gpu_ttm_fini(struct virtio_gpu_device *vgdev);
|
||||
int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma);
|
||||
|
||||
/* virtio_gpu_fence.c */
|
||||
bool virtio_fence_signaled(struct dma_fence *f);
|
||||
struct virtio_gpu_fence *virtio_gpu_fence_alloc(
|
||||
struct virtio_gpu_device *vgdev);
|
||||
int virtio_gpu_fence_emit(struct virtio_gpu_device *vgdev,
|
||||
@@ -356,7 +365,8 @@ void virtio_gpu_fence_event_process(struct virtio_gpu_device *vdev,
|
||||
/* virtio_gpu_object */
|
||||
int virtio_gpu_object_create(struct virtio_gpu_device *vgdev,
|
||||
struct virtio_gpu_object_params *params,
|
||||
struct virtio_gpu_object **bo_ptr);
|
||||
struct virtio_gpu_object **bo_ptr,
|
||||
struct virtio_gpu_fence *fence);
|
||||
void virtio_gpu_object_kunmap(struct virtio_gpu_object *bo);
|
||||
int virtio_gpu_object_kmap(struct virtio_gpu_object *bo);
|
||||
int virtio_gpu_object_get_sg_table(struct virtio_gpu_device *qdev,
|
||||
|
||||
Reference in New Issue
Block a user