Home | History | Annotate | Line # | Download | only in qxl
      1  1.2  riastrad /*	$NetBSD: qxl_drv.h,v 1.3 2021/12/18 23:45:42 riastradh Exp $	*/
      2  1.2  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright 2013 Red Hat Inc.
      5  1.1  riastrad  *
      6  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      7  1.1  riastrad  * copy of this software and associated documentation files (the "Software"),
      8  1.1  riastrad  * to deal in the Software without restriction, including without limitation
      9  1.1  riastrad  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  1.1  riastrad  * and/or sell copies of the Software, and to permit persons to whom the
     11  1.1  riastrad  * Software is furnished to do so, subject to the following conditions:
     12  1.1  riastrad  *
     13  1.1  riastrad  * The above copyright notice and this permission notice shall be included in
     14  1.1  riastrad  * all copies or substantial portions of the Software.
     15  1.1  riastrad  *
     16  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  1.1  riastrad  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  1.1  riastrad  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  1.1  riastrad  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  1.1  riastrad  * OTHER DEALINGS IN THE SOFTWARE.
     23  1.1  riastrad  *
     24  1.1  riastrad  * Authors: Dave Airlie
     25  1.1  riastrad  *          Alon Levy
     26  1.1  riastrad  */
     27  1.1  riastrad 
     28  1.1  riastrad #ifndef QXL_DRV_H
     29  1.1  riastrad #define QXL_DRV_H
     30  1.1  riastrad 
     31  1.1  riastrad /*
     32  1.1  riastrad  * Definitions taken from spice-protocol, plus kernel driver specific bits.
     33  1.1  riastrad  */
     34  1.1  riastrad 
     35  1.3  riastrad #include <linux/dma-fence.h>
     36  1.1  riastrad #include <linux/firmware.h>
     37  1.1  riastrad #include <linux/platform_device.h>
     38  1.3  riastrad #include <linux/workqueue.h>
     39  1.1  riastrad 
     40  1.3  riastrad #include <drm/drm_crtc.h>
     41  1.3  riastrad #include <drm/drm_encoder.h>
     42  1.3  riastrad #include <drm/drm_fb_helper.h>
     43  1.3  riastrad #include <drm/drm_gem_ttm_helper.h>
     44  1.3  riastrad #include <drm/drm_ioctl.h>
     45  1.2  riastrad #include <drm/drm_gem.h>
     46  1.3  riastrad #include <drm/qxl_drm.h>
     47  1.3  riastrad #include <drm/ttm/ttm_bo_api.h>
     48  1.3  riastrad #include <drm/ttm/ttm_bo_driver.h>
     49  1.3  riastrad #include <drm/ttm/ttm_execbuf_util.h>
     50  1.3  riastrad #include <drm/ttm/ttm_module.h>
     51  1.3  riastrad #include <drm/ttm/ttm_placement.h>
     52  1.2  riastrad 
     53  1.1  riastrad #include "qxl_dev.h"
     54  1.1  riastrad 
     55  1.1  riastrad #define DRIVER_AUTHOR		"Dave Airlie"
     56  1.1  riastrad 
     57  1.1  riastrad #define DRIVER_NAME		"qxl"
     58  1.1  riastrad #define DRIVER_DESC		"RH QXL"
     59  1.1  riastrad #define DRIVER_DATE		"20120117"
     60  1.1  riastrad 
     61  1.1  riastrad #define DRIVER_MAJOR 0
     62  1.1  riastrad #define DRIVER_MINOR 1
     63  1.1  riastrad #define DRIVER_PATCHLEVEL 0
     64  1.1  riastrad 
     65  1.1  riastrad #define QXL_DEBUGFS_MAX_COMPONENTS		32
     66  1.1  riastrad 
     67  1.1  riastrad extern int qxl_num_crtc;
     68  1.3  riastrad extern int qxl_max_ioctls;
     69  1.1  riastrad 
     70  1.1  riastrad #define QXL_INTERRUPT_MASK (\
     71  1.1  riastrad 	QXL_INTERRUPT_DISPLAY |\
     72  1.1  riastrad 	QXL_INTERRUPT_CURSOR |\
     73  1.1  riastrad 	QXL_INTERRUPT_IO_CMD |\
     74  1.1  riastrad 	QXL_INTERRUPT_CLIENT_MONITORS_CONFIG)
     75  1.1  riastrad 
     76  1.1  riastrad struct qxl_bo {
     77  1.3  riastrad 	struct ttm_buffer_object	tbo;
     78  1.3  riastrad 
     79  1.1  riastrad 	/* Protected by gem.mutex */
     80  1.1  riastrad 	struct list_head		list;
     81  1.1  riastrad 	/* Protected by tbo.reserved */
     82  1.2  riastrad 	struct ttm_place		placements[3];
     83  1.1  riastrad 	struct ttm_placement		placement;
     84  1.1  riastrad 	struct ttm_bo_kmap_obj		kmap;
     85  1.3  riastrad 	unsigned int pin_count;
     86  1.1  riastrad 	void				*kptr;
     87  1.3  riastrad 	unsigned int                    map_count;
     88  1.1  riastrad 	int                             type;
     89  1.2  riastrad 
     90  1.1  riastrad 	/* Constant after initialization */
     91  1.3  riastrad 	unsigned int is_primary:1; /* is this now a primary surface */
     92  1.3  riastrad 	unsigned int is_dumb:1;
     93  1.3  riastrad 	struct qxl_bo *shadow;
     94  1.3  riastrad 	unsigned int hw_surf_alloc:1;
     95  1.1  riastrad 	struct qxl_surface surf;
     96  1.1  riastrad 	uint32_t surface_id;
     97  1.1  riastrad 	struct qxl_release *surf_create;
     98  1.1  riastrad };
     99  1.3  riastrad #define gem_to_qxl_bo(gobj) container_of((gobj), struct qxl_bo, tbo.base)
    100  1.1  riastrad #define to_qxl_bo(tobj) container_of((tobj), struct qxl_bo, tbo)
    101  1.1  riastrad 
    102  1.1  riastrad struct qxl_gem {
    103  1.1  riastrad 	struct mutex		mutex;
    104  1.1  riastrad 	struct list_head	objects;
    105  1.1  riastrad };
    106  1.1  riastrad 
    107  1.1  riastrad struct qxl_bo_list {
    108  1.1  riastrad 	struct ttm_validate_buffer tv;
    109  1.1  riastrad };
    110  1.1  riastrad 
    111  1.1  riastrad struct qxl_crtc {
    112  1.1  riastrad 	struct drm_crtc base;
    113  1.1  riastrad 	int index;
    114  1.3  riastrad 
    115  1.3  riastrad 	struct qxl_bo *cursor_bo;
    116  1.1  riastrad };
    117  1.1  riastrad 
    118  1.1  riastrad struct qxl_output {
    119  1.1  riastrad 	int index;
    120  1.1  riastrad 	struct drm_connector base;
    121  1.1  riastrad 	struct drm_encoder enc;
    122  1.1  riastrad };
    123  1.1  riastrad 
    124  1.1  riastrad #define to_qxl_crtc(x) container_of(x, struct qxl_crtc, base)
    125  1.1  riastrad #define drm_connector_to_qxl_output(x) container_of(x, struct qxl_output, base)
    126  1.1  riastrad #define drm_encoder_to_qxl_output(x) container_of(x, struct qxl_output, enc)
    127  1.1  riastrad 
    128  1.1  riastrad struct qxl_mman {
    129  1.1  riastrad 	struct ttm_bo_device		bdev;
    130  1.1  riastrad };
    131  1.1  riastrad 
    132  1.1  riastrad struct qxl_memslot {
    133  1.3  riastrad 	int             index;
    134  1.3  riastrad 	const char      *name;
    135  1.1  riastrad 	uint8_t		generation;
    136  1.1  riastrad 	uint64_t	start_phys_addr;
    137  1.3  riastrad 	uint64_t	size;
    138  1.1  riastrad 	uint64_t	high_bits;
    139  1.3  riastrad 	uint64_t        gpu_offset;
    140  1.1  riastrad };
    141  1.1  riastrad 
    142  1.1  riastrad enum {
    143  1.1  riastrad 	QXL_RELEASE_DRAWABLE,
    144  1.1  riastrad 	QXL_RELEASE_SURFACE_CMD,
    145  1.1  riastrad 	QXL_RELEASE_CURSOR_CMD,
    146  1.1  riastrad };
    147  1.1  riastrad 
    148  1.1  riastrad /* drm_ prefix to differentiate from qxl_release_info in
    149  1.1  riastrad  * spice-protocol/qxl_dev.h */
    150  1.1  riastrad #define QXL_MAX_RES 96
    151  1.1  riastrad struct qxl_release {
    152  1.3  riastrad 	struct dma_fence base;
    153  1.2  riastrad 
    154  1.1  riastrad 	int id;
    155  1.1  riastrad 	int type;
    156  1.3  riastrad 	struct qxl_bo *release_bo;
    157  1.1  riastrad 	uint32_t release_offset;
    158  1.1  riastrad 	uint32_t surface_release_id;
    159  1.1  riastrad 	struct ww_acquire_ctx ticket;
    160  1.1  riastrad 	struct list_head bos;
    161  1.1  riastrad };
    162  1.1  riastrad 
    163  1.1  riastrad struct qxl_drm_chunk {
    164  1.1  riastrad 	struct list_head head;
    165  1.1  riastrad 	struct qxl_bo *bo;
    166  1.1  riastrad };
    167  1.1  riastrad 
    168  1.1  riastrad struct qxl_drm_image {
    169  1.1  riastrad 	struct qxl_bo *bo;
    170  1.1  riastrad 	struct list_head chunk_list;
    171  1.1  riastrad };
    172  1.1  riastrad 
    173  1.1  riastrad struct qxl_fb_image {
    174  1.1  riastrad 	struct qxl_device *qdev;
    175  1.1  riastrad 	uint32_t pseudo_palette[16];
    176  1.1  riastrad 	struct fb_image fb_image;
    177  1.1  riastrad 	uint32_t visual;
    178  1.1  riastrad };
    179  1.1  riastrad 
    180  1.1  riastrad struct qxl_draw_fill {
    181  1.1  riastrad 	struct qxl_device *qdev;
    182  1.1  riastrad 	struct qxl_rect rect;
    183  1.1  riastrad 	uint32_t color;
    184  1.1  riastrad 	uint16_t rop;
    185  1.1  riastrad };
    186  1.1  riastrad 
    187  1.1  riastrad /*
    188  1.1  riastrad  * Debugfs
    189  1.1  riastrad  */
    190  1.1  riastrad struct qxl_debugfs {
    191  1.1  riastrad 	struct drm_info_list	*files;
    192  1.3  riastrad 	unsigned int num_files;
    193  1.1  riastrad };
    194  1.1  riastrad 
    195  1.1  riastrad int qxl_debugfs_add_files(struct qxl_device *rdev,
    196  1.1  riastrad 			     struct drm_info_list *files,
    197  1.3  riastrad 			     unsigned int nfiles);
    198  1.1  riastrad int qxl_debugfs_fence_init(struct qxl_device *rdev);
    199  1.1  riastrad 
    200  1.1  riastrad struct qxl_device;
    201  1.1  riastrad 
    202  1.1  riastrad struct qxl_device {
    203  1.3  riastrad 	struct drm_device ddev;
    204  1.1  riastrad 
    205  1.1  riastrad 	resource_size_t vram_base, vram_size;
    206  1.1  riastrad 	resource_size_t surfaceram_base, surfaceram_size;
    207  1.1  riastrad 	resource_size_t rom_base, rom_size;
    208  1.1  riastrad 	struct qxl_rom *rom;
    209  1.1  riastrad 
    210  1.1  riastrad 	struct qxl_mode *modes;
    211  1.1  riastrad 	struct qxl_bo *monitors_config_bo;
    212  1.1  riastrad 	struct qxl_monitors_config *monitors_config;
    213  1.1  riastrad 
    214  1.1  riastrad 	/* last received client_monitors_config */
    215  1.1  riastrad 	struct qxl_monitors_config *client_monitors_config;
    216  1.1  riastrad 
    217  1.1  riastrad 	int io_base;
    218  1.1  riastrad 	void *ram;
    219  1.1  riastrad 	struct qxl_mman		mman;
    220  1.1  riastrad 	struct qxl_gem		gem;
    221  1.1  riastrad 
    222  1.1  riastrad 	void *ram_physical;
    223  1.1  riastrad 
    224  1.1  riastrad 	struct qxl_ring *release_ring;
    225  1.1  riastrad 	struct qxl_ring *command_ring;
    226  1.1  riastrad 	struct qxl_ring *cursor_ring;
    227  1.1  riastrad 
    228  1.1  riastrad 	struct qxl_ram_header *ram_header;
    229  1.1  riastrad 
    230  1.3  riastrad 	struct qxl_bo *primary_bo;
    231  1.3  riastrad 	struct qxl_bo *dumb_shadow_bo;
    232  1.3  riastrad 	struct qxl_head *dumb_heads;
    233  1.1  riastrad 
    234  1.3  riastrad 	struct qxl_memslot main_slot;
    235  1.3  riastrad 	struct qxl_memslot surfaces_slot;
    236  1.1  riastrad 
    237  1.2  riastrad 	spinlock_t	release_lock;
    238  1.1  riastrad 	struct idr	release_idr;
    239  1.2  riastrad 	uint32_t	release_seqno;
    240  1.1  riastrad 	spinlock_t release_idr_lock;
    241  1.1  riastrad 	struct mutex	async_io_mutex;
    242  1.1  riastrad 	unsigned int last_sent_io_cmd;
    243  1.1  riastrad 
    244  1.1  riastrad 	/* interrupt handling */
    245  1.1  riastrad 	atomic_t irq_received;
    246  1.1  riastrad 	atomic_t irq_received_display;
    247  1.1  riastrad 	atomic_t irq_received_cursor;
    248  1.1  riastrad 	atomic_t irq_received_io_cmd;
    249  1.3  riastrad 	unsigned int irq_received_error;
    250  1.1  riastrad 	wait_queue_head_t display_event;
    251  1.1  riastrad 	wait_queue_head_t cursor_event;
    252  1.1  riastrad 	wait_queue_head_t io_cmd_event;
    253  1.1  riastrad 	struct work_struct client_monitors_config_work;
    254  1.1  riastrad 
    255  1.1  riastrad 	/* debugfs */
    256  1.1  riastrad 	struct qxl_debugfs	debugfs[QXL_DEBUGFS_MAX_COMPONENTS];
    257  1.3  riastrad 	unsigned int debugfs_count;
    258  1.1  riastrad 
    259  1.1  riastrad 	struct mutex		update_area_mutex;
    260  1.1  riastrad 
    261  1.1  riastrad 	struct idr	surf_id_idr;
    262  1.1  riastrad 	spinlock_t surf_id_idr_lock;
    263  1.1  riastrad 	int last_alloced_surf_id;
    264  1.1  riastrad 
    265  1.1  riastrad 	struct mutex surf_evict_mutex;
    266  1.1  riastrad 	struct io_mapping *vram_mapping;
    267  1.1  riastrad 	struct io_mapping *surface_mapping;
    268  1.1  riastrad 
    269  1.1  riastrad 	/* */
    270  1.1  riastrad 	struct mutex release_mutex;
    271  1.1  riastrad 	struct qxl_bo *current_release_bo[3];
    272  1.1  riastrad 	int current_release_bo_offset[3];
    273  1.1  riastrad 
    274  1.1  riastrad 	struct work_struct gc_work;
    275  1.1  riastrad 
    276  1.1  riastrad 	struct drm_property *hotplug_mode_update_property;
    277  1.2  riastrad 	int monitors_config_width;
    278  1.2  riastrad 	int monitors_config_height;
    279  1.1  riastrad };
    280  1.1  riastrad 
    281  1.1  riastrad extern const struct drm_ioctl_desc qxl_ioctls[];
    282  1.1  riastrad extern int qxl_max_ioctl;
    283  1.1  riastrad 
    284  1.3  riastrad int qxl_device_init(struct qxl_device *qdev, struct drm_driver *drv,
    285  1.3  riastrad 		    struct pci_dev *pdev);
    286  1.3  riastrad void qxl_device_fini(struct qxl_device *qdev);
    287  1.1  riastrad 
    288  1.1  riastrad int qxl_modeset_init(struct qxl_device *qdev);
    289  1.1  riastrad void qxl_modeset_fini(struct qxl_device *qdev);
    290  1.1  riastrad 
    291  1.1  riastrad int qxl_bo_init(struct qxl_device *qdev);
    292  1.1  riastrad void qxl_bo_fini(struct qxl_device *qdev);
    293  1.1  riastrad 
    294  1.1  riastrad void qxl_reinit_memslots(struct qxl_device *qdev);
    295  1.1  riastrad int qxl_surf_evict(struct qxl_device *qdev);
    296  1.1  riastrad int qxl_vram_evict(struct qxl_device *qdev);
    297  1.1  riastrad 
    298  1.1  riastrad struct qxl_ring *qxl_ring_create(struct qxl_ring_header *header,
    299  1.1  riastrad 				 int element_size,
    300  1.1  riastrad 				 int n_elements,
    301  1.1  riastrad 				 int prod_notify,
    302  1.1  riastrad 				 bool set_prod_notify,
    303  1.1  riastrad 				 wait_queue_head_t *push_event);
    304  1.1  riastrad void qxl_ring_free(struct qxl_ring *ring);
    305  1.1  riastrad void qxl_ring_init_hdr(struct qxl_ring *ring);
    306  1.1  riastrad int qxl_check_idle(struct qxl_ring *ring);
    307  1.1  riastrad 
    308  1.1  riastrad static inline uint64_t
    309  1.1  riastrad qxl_bo_physical_address(struct qxl_device *qdev, struct qxl_bo *bo,
    310  1.1  riastrad 			unsigned long offset)
    311  1.1  riastrad {
    312  1.3  riastrad 	struct qxl_memslot *slot =
    313  1.3  riastrad 		(bo->tbo.mem.mem_type == TTM_PL_VRAM)
    314  1.3  riastrad 		? &qdev->main_slot : &qdev->surfaces_slot;
    315  1.3  riastrad 
    316  1.3  riastrad 	WARN_ON_ONCE((bo->tbo.offset & slot->gpu_offset) != slot->gpu_offset);
    317  1.1  riastrad 
    318  1.1  riastrad 	/* TODO - need to hold one of the locks to read tbo.offset */
    319  1.3  riastrad 	return slot->high_bits | (bo->tbo.offset - slot->gpu_offset + offset);
    320  1.1  riastrad }
    321  1.1  riastrad 
    322  1.1  riastrad /* qxl_display.c */
    323  1.1  riastrad void qxl_display_read_client_monitors_config(struct qxl_device *qdev);
    324  1.1  riastrad int qxl_create_monitors_object(struct qxl_device *qdev);
    325  1.1  riastrad int qxl_destroy_monitors_object(struct qxl_device *qdev);
    326  1.1  riastrad 
    327  1.1  riastrad /* qxl_gem.c */
    328  1.3  riastrad void qxl_gem_init(struct qxl_device *qdev);
    329  1.1  riastrad void qxl_gem_fini(struct qxl_device *qdev);
    330  1.1  riastrad int qxl_gem_object_create(struct qxl_device *qdev, int size,
    331  1.1  riastrad 			  int alignment, int initial_domain,
    332  1.1  riastrad 			  bool discardable, bool kernel,
    333  1.1  riastrad 			  struct qxl_surface *surf,
    334  1.1  riastrad 			  struct drm_gem_object **obj);
    335  1.1  riastrad int qxl_gem_object_create_with_handle(struct qxl_device *qdev,
    336  1.1  riastrad 				      struct drm_file *file_priv,
    337  1.1  riastrad 				      u32 domain,
    338  1.1  riastrad 				      size_t size,
    339  1.1  riastrad 				      struct qxl_surface *surf,
    340  1.1  riastrad 				      struct qxl_bo **qobj,
    341  1.1  riastrad 				      uint32_t *handle);
    342  1.1  riastrad void qxl_gem_object_free(struct drm_gem_object *gobj);
    343  1.1  riastrad int qxl_gem_object_open(struct drm_gem_object *obj, struct drm_file *file_priv);
    344  1.1  riastrad void qxl_gem_object_close(struct drm_gem_object *obj,
    345  1.1  riastrad 			  struct drm_file *file_priv);
    346  1.1  riastrad void qxl_bo_force_delete(struct qxl_device *qdev);
    347  1.1  riastrad int qxl_bo_kmap(struct qxl_bo *bo, void **ptr);
    348  1.1  riastrad 
    349  1.1  riastrad /* qxl_dumb.c */
    350  1.1  riastrad int qxl_mode_dumb_create(struct drm_file *file_priv,
    351  1.1  riastrad 			 struct drm_device *dev,
    352  1.1  riastrad 			 struct drm_mode_create_dumb *args);
    353  1.1  riastrad int qxl_mode_dumb_mmap(struct drm_file *filp,
    354  1.1  riastrad 		       struct drm_device *dev,
    355  1.1  riastrad 		       uint32_t handle, uint64_t *offset_p);
    356  1.1  riastrad 
    357  1.1  riastrad /* qxl ttm */
    358  1.1  riastrad int qxl_ttm_init(struct qxl_device *qdev);
    359  1.1  riastrad void qxl_ttm_fini(struct qxl_device *qdev);
    360  1.3  riastrad int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
    361  1.3  riastrad 			   struct ttm_mem_reg *mem);
    362  1.1  riastrad 
    363  1.1  riastrad /* qxl image */
    364  1.1  riastrad 
    365  1.1  riastrad int qxl_image_init(struct qxl_device *qdev,
    366  1.1  riastrad 		   struct qxl_release *release,
    367  1.1  riastrad 		   struct qxl_drm_image *dimage,
    368  1.1  riastrad 		   const uint8_t *data,
    369  1.1  riastrad 		   int x, int y, int width, int height,
    370  1.1  riastrad 		   int depth, int stride);
    371  1.1  riastrad int
    372  1.1  riastrad qxl_image_alloc_objects(struct qxl_device *qdev,
    373  1.1  riastrad 			struct qxl_release *release,
    374  1.1  riastrad 			struct qxl_drm_image **image_ptr,
    375  1.1  riastrad 			int height, int stride);
    376  1.1  riastrad void qxl_image_free_objects(struct qxl_device *qdev, struct qxl_drm_image *dimage);
    377  1.1  riastrad 
    378  1.1  riastrad void qxl_update_screen(struct qxl_device *qxl);
    379  1.1  riastrad 
    380  1.1  riastrad /* qxl io operations (qxl_cmd.c) */
    381  1.1  riastrad 
    382  1.1  riastrad void qxl_io_create_primary(struct qxl_device *qdev,
    383  1.1  riastrad 			   struct qxl_bo *bo);
    384  1.1  riastrad void qxl_io_destroy_primary(struct qxl_device *qdev);
    385  1.1  riastrad void qxl_io_memslot_add(struct qxl_device *qdev, uint8_t id);
    386  1.1  riastrad void qxl_io_notify_oom(struct qxl_device *qdev);
    387  1.1  riastrad 
    388  1.1  riastrad int qxl_io_update_area(struct qxl_device *qdev, struct qxl_bo *surf,
    389  1.1  riastrad 		       const struct qxl_rect *area);
    390  1.1  riastrad 
    391  1.1  riastrad void qxl_io_reset(struct qxl_device *qdev);
    392  1.1  riastrad void qxl_io_monitors_config(struct qxl_device *qdev);
    393  1.1  riastrad int qxl_ring_push(struct qxl_ring *ring, const void *new_elt, bool interruptible);
    394  1.1  riastrad void qxl_io_flush_release(struct qxl_device *qdev);
    395  1.1  riastrad void qxl_io_flush_surfaces(struct qxl_device *qdev);
    396  1.1  riastrad 
    397  1.1  riastrad union qxl_release_info *qxl_release_map(struct qxl_device *qdev,
    398  1.1  riastrad 					struct qxl_release *release);
    399  1.1  riastrad void qxl_release_unmap(struct qxl_device *qdev,
    400  1.1  riastrad 		       struct qxl_release *release,
    401  1.1  riastrad 		       union qxl_release_info *info);
    402  1.1  riastrad int qxl_release_list_add(struct qxl_release *release, struct qxl_bo *bo);
    403  1.1  riastrad int qxl_release_reserve_list(struct qxl_release *release, bool no_intr);
    404  1.1  riastrad void qxl_release_backoff_reserve_list(struct qxl_release *release);
    405  1.1  riastrad void qxl_release_fence_buffer_objects(struct qxl_release *release);
    406  1.1  riastrad 
    407  1.1  riastrad int qxl_alloc_surface_release_reserved(struct qxl_device *qdev,
    408  1.1  riastrad 				       enum qxl_surface_cmd_type surface_cmd_type,
    409  1.1  riastrad 				       struct qxl_release *create_rel,
    410  1.1  riastrad 				       struct qxl_release **release);
    411  1.1  riastrad int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size,
    412  1.1  riastrad 			       int type, struct qxl_release **release,
    413  1.1  riastrad 			       struct qxl_bo **rbo);
    414  1.1  riastrad 
    415  1.1  riastrad int
    416  1.1  riastrad qxl_push_command_ring_release(struct qxl_device *qdev, struct qxl_release *release,
    417  1.1  riastrad 			      uint32_t type, bool interruptible);
    418  1.1  riastrad int
    419  1.1  riastrad qxl_push_cursor_ring_release(struct qxl_device *qdev, struct qxl_release *release,
    420  1.1  riastrad 			     uint32_t type, bool interruptible);
    421  1.1  riastrad int qxl_alloc_bo_reserved(struct qxl_device *qdev,
    422  1.1  riastrad 			  struct qxl_release *release,
    423  1.1  riastrad 			  unsigned long size,
    424  1.1  riastrad 			  struct qxl_bo **_bo);
    425  1.1  riastrad /* qxl drawing commands */
    426  1.1  riastrad 
    427  1.1  riastrad void qxl_draw_dirty_fb(struct qxl_device *qdev,
    428  1.3  riastrad 		       struct drm_framebuffer *fb,
    429  1.1  riastrad 		       struct qxl_bo *bo,
    430  1.3  riastrad 		       unsigned int flags, unsigned int color,
    431  1.1  riastrad 		       struct drm_clip_rect *clips,
    432  1.3  riastrad 		       unsigned int num_clips, int inc,
    433  1.3  riastrad 		       uint32_t dumb_shadow_offset);
    434  1.1  riastrad 
    435  1.1  riastrad void qxl_release_free(struct qxl_device *qdev,
    436  1.1  riastrad 		      struct qxl_release *release);
    437  1.1  riastrad 
    438  1.1  riastrad /* used by qxl_debugfs_release */
    439  1.1  riastrad struct qxl_release *qxl_release_from_id_locked(struct qxl_device *qdev,
    440  1.1  riastrad 						   uint64_t id);
    441  1.1  riastrad 
    442  1.1  riastrad bool qxl_queue_garbage_collect(struct qxl_device *qdev, bool flush);
    443  1.1  riastrad int qxl_garbage_collect(struct qxl_device *qdev);
    444  1.1  riastrad 
    445  1.1  riastrad /* debugfs */
    446  1.1  riastrad 
    447  1.1  riastrad int qxl_debugfs_init(struct drm_minor *minor);
    448  1.3  riastrad int qxl_ttm_debugfs_init(struct qxl_device *qdev);
    449  1.1  riastrad 
    450  1.2  riastrad /* qxl_prime.c */
    451  1.2  riastrad int qxl_gem_prime_pin(struct drm_gem_object *obj);
    452  1.2  riastrad void qxl_gem_prime_unpin(struct drm_gem_object *obj);
    453  1.2  riastrad struct sg_table *qxl_gem_prime_get_sg_table(struct drm_gem_object *obj);
    454  1.2  riastrad struct drm_gem_object *qxl_gem_prime_import_sg_table(
    455  1.2  riastrad 	struct drm_device *dev, struct dma_buf_attachment *attach,
    456  1.2  riastrad 	struct sg_table *sgt);
    457  1.2  riastrad void *qxl_gem_prime_vmap(struct drm_gem_object *obj);
    458  1.2  riastrad void qxl_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
    459  1.2  riastrad int qxl_gem_prime_mmap(struct drm_gem_object *obj,
    460  1.2  riastrad 				struct vm_area_struct *vma);
    461  1.2  riastrad 
    462  1.1  riastrad /* qxl_irq.c */
    463  1.1  riastrad int qxl_irq_init(struct qxl_device *qdev);
    464  1.1  riastrad irqreturn_t qxl_irq_handler(int irq, void *arg);
    465  1.1  riastrad 
    466  1.1  riastrad int qxl_debugfs_add_files(struct qxl_device *qdev,
    467  1.1  riastrad 			  struct drm_info_list *files,
    468  1.3  riastrad 			  unsigned int nfiles);
    469  1.1  riastrad 
    470  1.1  riastrad int qxl_surface_id_alloc(struct qxl_device *qdev,
    471  1.1  riastrad 			 struct qxl_bo *surf);
    472  1.1  riastrad void qxl_surface_id_dealloc(struct qxl_device *qdev,
    473  1.1  riastrad 			    uint32_t surface_id);
    474  1.1  riastrad int qxl_hw_surface_alloc(struct qxl_device *qdev,
    475  1.3  riastrad 			 struct qxl_bo *surf);
    476  1.1  riastrad int qxl_hw_surface_dealloc(struct qxl_device *qdev,
    477  1.1  riastrad 			   struct qxl_bo *surf);
    478  1.1  riastrad 
    479  1.1  riastrad int qxl_bo_check_id(struct qxl_device *qdev, struct qxl_bo *bo);
    480  1.1  riastrad 
    481  1.1  riastrad struct qxl_drv_surface *
    482  1.1  riastrad qxl_surface_lookup(struct drm_device *dev, int surface_id);
    483  1.1  riastrad void qxl_surface_evict(struct qxl_device *qdev, struct qxl_bo *surf, bool freeing);
    484  1.1  riastrad 
    485  1.1  riastrad #endif
    486