@@ -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
@@ -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);
@@ -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,
@@ -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)
@@ -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)
{
@@ -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);
@@ -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,
@@ -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
new file mode 100644
@@ -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 */
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