diff mbox series

[8/9] drm/virtio: split out vq functions from virtgpu_drv.h

Message ID 20191218005929.6709-9-gurchetansingh@chromium.org (mailing list archive)
State New, archived
Headers show
Series *** virtgpu cleanups *** | expand

Commit Message

Gurchetan Singh Dec. 18, 2019, 12:59 a.m. UTC
virtgpu_drv.h is getting very big, let's try to split it into
smaller header files.  Start with virtgpu_vq.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_display.c |   1 +
 drivers/gpu/drm/virtio/virtgpu_drv.h     |  79 ------------------
 drivers/gpu/drm/virtio/virtgpu_gem.c     |   1 +
 drivers/gpu/drm/virtio/virtgpu_ioctl.c   |   1 +
 drivers/gpu/drm/virtio/virtgpu_kms.c     |   1 +
 drivers/gpu/drm/virtio/virtgpu_object.c  |   1 +
 drivers/gpu/drm/virtio/virtgpu_plane.c   |   1 +
 drivers/gpu/drm/virtio/virtgpu_vq.c      |   1 +
 drivers/gpu/drm/virtio/virtgpu_vq.h      | 100 +++++++++++++++++++++++
 9 files changed, 107 insertions(+), 79 deletions(-)
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_vq.h
diff mbox series

Patch

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index 0966208ec30d..03cd5e40bfa1 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -33,6 +33,7 @@ 
 #include <drm/drm_vblank.h>
 
 #include "virtgpu_drv.h"
+#include "virtgpu_vq.h"
 
 #define XRES_MIN    32
 #define YRES_MIN    32
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 7e447784e493..cd98df412cda 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -250,85 +250,6 @@  void virtio_gpu_array_put_free_delayed(struct virtio_gpu_device *vgdev,
 				       struct virtio_gpu_object_array *objs);
 void virtio_gpu_array_put_free_work(struct work_struct *work);
 
-/* virtio vg */
-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_array *objs,
-				    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,
-					uint64_t offset,
-					uint32_t width, uint32_t height,
-					uint32_t x, uint32_t y,
-					struct virtio_gpu_object_array *objs,
-					struct virtio_gpu_fence *fence);
-void virtio_gpu_cmd_resource_flush(struct virtio_gpu_device *vgdev,
-				   uint32_t resource_id,
-				   uint32_t x, uint32_t y,
-				   uint32_t width, uint32_t height);
-void virtio_gpu_cmd_set_scanout(struct virtio_gpu_device *vgdev,
-				uint32_t scanout_id, uint32_t resource_id,
-				uint32_t width, uint32_t height,
-				uint32_t x, uint32_t y);
-int virtio_gpu_object_attach(struct virtio_gpu_device *vgdev,
-			     struct virtio_gpu_object *obj,
-			     struct virtio_gpu_fence *fence);
-void virtio_gpu_object_detach(struct virtio_gpu_device *vgdev,
-			      struct virtio_gpu_object *obj);
-int virtio_gpu_attach_status_page(struct virtio_gpu_device *vgdev);
-int virtio_gpu_detach_status_page(struct virtio_gpu_device *vgdev);
-void virtio_gpu_cursor_ping(struct virtio_gpu_device *vgdev,
-			    struct virtio_gpu_output *output);
-int virtio_gpu_cmd_get_display_info(struct virtio_gpu_device *vgdev);
-int virtio_gpu_cmd_get_capset_info(struct virtio_gpu_device *vgdev, int idx);
-int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev,
-			      int idx, int version,
-			      struct virtio_gpu_drv_cap_cache **cache_p);
-int virtio_gpu_cmd_get_edids(struct virtio_gpu_device *vgdev);
-void virtio_gpu_cmd_context_create(struct virtio_gpu_device *vgdev, uint32_t id,
-				   uint32_t nlen, const char *name);
-void virtio_gpu_cmd_context_destroy(struct virtio_gpu_device *vgdev,
-				    uint32_t id);
-void virtio_gpu_cmd_context_attach_resource(struct virtio_gpu_device *vgdev,
-					    uint32_t ctx_id,
-					    struct virtio_gpu_object_array *objs);
-void virtio_gpu_cmd_context_detach_resource(struct virtio_gpu_device *vgdev,
-					    uint32_t ctx_id,
-					    struct virtio_gpu_object_array *objs);
-void virtio_gpu_cmd_submit(struct virtio_gpu_device *vgdev,
-			   void *data, uint32_t data_size,
-			   uint32_t ctx_id,
-			   struct virtio_gpu_object_array *objs,
-			   struct virtio_gpu_fence *fence);
-void virtio_gpu_cmd_transfer_from_host_3d(struct virtio_gpu_device *vgdev,
-					  uint32_t ctx_id,
-					  uint64_t offset, uint32_t level,
-					  struct drm_virtgpu_3d_box *box,
-					  struct virtio_gpu_object_array *objs,
-					  struct virtio_gpu_fence *fence);
-void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev,
-					uint32_t ctx_id,
-					uint64_t offset, uint32_t level,
-					struct drm_virtgpu_3d_box *box,
-					struct virtio_gpu_object_array *objs,
-					struct virtio_gpu_fence *fence);
-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_array *objs,
-				  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);
-void virtio_gpu_dequeue_ctrl_func(struct work_struct *work);
-void virtio_gpu_dequeue_cursor_func(struct work_struct *work);
-void virtio_gpu_dequeue_fence_func(struct work_struct *work);
-
 /* virtio_gpu_display.c */
 void virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev);
 void virtio_gpu_modeset_fini(struct virtio_gpu_device *vgdev);
diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
index 0a2b62279647..409dd3863c7b 100644
--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
@@ -27,6 +27,7 @@ 
 #include <drm/drm_fourcc.h>
 
 #include "virtgpu_drv.h"
+#include "virtgpu_vq.h"
 
 int virtio_gpu_gem_create(struct drm_file *file,
 			  struct drm_device *dev,
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 205ec4abae2b..0108945b5cae 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -32,6 +32,7 @@ 
 #include <drm/virtgpu_drm.h>
 
 #include "virtgpu_drv.h"
+#include "virtgpu_vq.h"
 
 static int virtio_gpu_map_ioctl(struct drm_device *dev, void *data,
 				struct drm_file *file_priv)
diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c
index 2f5773e43557..2013002d3c2f 100644
--- a/drivers/gpu/drm/virtio/virtgpu_kms.c
+++ b/drivers/gpu/drm/virtio/virtgpu_kms.c
@@ -29,6 +29,7 @@ 
 #include <drm/drm_file.h>
 
 #include "virtgpu_drv.h"
+#include "virtgpu_vq.h"
 
 static void virtio_gpu_config_changed_work_func(struct work_struct *work)
 {
diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c
index 017a9e0fc3bb..8df93f40d282 100644
--- a/drivers/gpu/drm/virtio/virtgpu_object.c
+++ b/drivers/gpu/drm/virtio/virtgpu_object.c
@@ -26,6 +26,7 @@ 
 #include <linux/moduleparam.h>
 
 #include "virtgpu_drv.h"
+#include "virtgpu_vq.h"
 
 static int virtio_gpu_virglrenderer_workaround = 1;
 module_param_named(virglhack, virtio_gpu_virglrenderer_workaround, int, 0400);
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index bc4bc4475a8c..384796db9373 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -28,6 +28,7 @@ 
 #include <drm/drm_plane_helper.h>
 
 #include "virtgpu_drv.h"
+#include "virtgpu_vq.h"
 
 static const uint32_t virtio_gpu_formats[] = {
 	DRM_FORMAT_HOST_XRGB8888,
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
index 9274c4063c70..4d1c357ada07 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -33,6 +33,7 @@ 
 
 #include "virtgpu_drv.h"
 #include "virtgpu_trace.h"
+#include "virtgpu_vq.h"
 
 #define MAX_INLINE_CMD_SIZE   96
 #define MAX_INLINE_RESP_SIZE  24
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.h b/drivers/gpu/drm/virtio/virtgpu_vq.h
new file mode 100644
index 000000000000..06af7ef7f062
--- /dev/null
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.h
@@ -0,0 +1,100 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef VIRTIO_VQ_H
+#define VIRTIO_VQ_H
+
+struct drm_virtgpu_3d_box;
+
+struct virtio_gpu_device;
+struct virtio_gpu_drv_cap_cache;
+
+struct virtio_gpu_fence;
+struct virtio_gpu_framebuffer;
+
+struct virtio_gpu_object;
+struct virtio_gpu_object_params;
+struct virtio_gpu_object_array;
+struct virtio_gpu_output;
+
+struct virtqueue;
+
+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_array *objs,
+				    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,
+					uint64_t offset,
+					uint32_t width, uint32_t height,
+					uint32_t x, uint32_t y,
+					struct virtio_gpu_object_array *objs,
+					struct virtio_gpu_fence *fence);
+void virtio_gpu_cmd_resource_flush(struct virtio_gpu_device *vgdev,
+				   uint32_t resource_id,
+				   uint32_t x, uint32_t y,
+				   uint32_t width, uint32_t height);
+void virtio_gpu_cmd_set_scanout(struct virtio_gpu_device *vgdev,
+				uint32_t scanout_id, uint32_t resource_id,
+				uint32_t width, uint32_t height,
+				uint32_t x, uint32_t y);
+int virtio_gpu_object_attach(struct virtio_gpu_device *vgdev,
+			     struct virtio_gpu_object *obj,
+			     struct virtio_gpu_fence *fence);
+void virtio_gpu_object_detach(struct virtio_gpu_device *vgdev,
+			      struct virtio_gpu_object *obj);
+int virtio_gpu_attach_status_page(struct virtio_gpu_device *vgdev);
+int virtio_gpu_detach_status_page(struct virtio_gpu_device *vgdev);
+void virtio_gpu_cursor_ping(struct virtio_gpu_device *vgdev,
+			    struct virtio_gpu_output *output);
+int virtio_gpu_cmd_get_display_info(struct virtio_gpu_device *vgdev);
+int virtio_gpu_cmd_get_capset_info(struct virtio_gpu_device *vgdev, int idx);
+int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev,
+			      int idx, int version,
+			      struct virtio_gpu_drv_cap_cache **cache_p);
+int virtio_gpu_cmd_get_edids(struct virtio_gpu_device *vgdev);
+void virtio_gpu_cmd_context_create(struct virtio_gpu_device *vgdev, uint32_t id,
+				   uint32_t nlen, const char *name);
+void virtio_gpu_cmd_context_destroy(struct virtio_gpu_device *vgdev,
+				    uint32_t id);
+void
+virtio_gpu_cmd_context_attach_resource(struct virtio_gpu_device *vgdev,
+				       uint32_t ctx_id,
+				       struct virtio_gpu_object_array *objs);
+void
+virtio_gpu_cmd_context_detach_resource(struct virtio_gpu_device *vgdev,
+				       uint32_t ctx_id,
+				       struct virtio_gpu_object_array *objs);
+void virtio_gpu_cmd_submit(struct virtio_gpu_device *vgdev,
+			   void *data, uint32_t data_size,
+			   uint32_t ctx_id,
+			   struct virtio_gpu_object_array *objs,
+			   struct virtio_gpu_fence *fence);
+void virtio_gpu_cmd_transfer_from_host_3d(struct virtio_gpu_device *vgdev,
+					  uint32_t ctx_id,
+					  uint64_t offset, uint32_t level,
+					  struct drm_virtgpu_3d_box *box,
+					  struct virtio_gpu_object_array *objs,
+					  struct virtio_gpu_fence *fence);
+void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev,
+					uint32_t ctx_id,
+					uint64_t offset, uint32_t level,
+					struct drm_virtgpu_3d_box *box,
+					struct virtio_gpu_object_array *objs,
+					struct virtio_gpu_fence *fence);
+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_array *objs,
+				  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);
+void virtio_gpu_dequeue_ctrl_func(struct work_struct *work);
+void virtio_gpu_dequeue_cursor_func(struct work_struct *work);
+void virtio_gpu_dequeue_fence_func(struct work_struct *work);
+
+#endif /* VIRTIO_GPU_VQ_H */