aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi
diff options
context:
space:
mode:
authorDave Airlie <airlied@gmail.com>2013-02-24 23:47:55 -0500
committerDave Airlie <airlied@redhat.com>2013-04-11 23:51:07 -0400
commitf64122c1f6ade301585569863b4b3b18f6e4e332 (patch)
tree1eb6629931604584f6fff28c0b9a1c9a3d9024f3 /include/uapi
parentafe6804c045fbd69a1b75c681107b5d6df9190de (diff)
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop interface. The drivers uses GEM and TTM to manage memory, the qxl hw fencing however is quite different than normal TTM expects, we have to keep track of a number of non-linear fence ids per bo that we need to have released by the hardware. The releases are freed from a workqueue that wakes up and processes the release ring. releases are suballocated from a BO, there are 3 release categories, drawables, surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling. The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface ids. This requires a newer version of the QXL userspace driver, so shouldn't be enabled until that has been placed into your distro of choice. Authors: Dave Airlie, Alon Levy v1.1: fixup some issues in the ioctl interface with padding v1.2: add module device table v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq, don't try flush release ring (broken hw), fix -modesetting. v1.4: fbcon cpu usage reduction + suitable accel flags. Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/drm/Kbuild1
-rw-r--r--include/uapi/drm/qxl_drm.h152
2 files changed, 153 insertions, 0 deletions
diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild
index ba99ce3f7372..a042a957296d 100644
--- a/include/uapi/drm/Kbuild
+++ b/include/uapi/drm/Kbuild
@@ -8,6 +8,7 @@ header-y += i810_drm.h
8header-y += i915_drm.h 8header-y += i915_drm.h
9header-y += mga_drm.h 9header-y += mga_drm.h
10header-y += nouveau_drm.h 10header-y += nouveau_drm.h
11header-y += qxl_drm.h
11header-y += r128_drm.h 12header-y += r128_drm.h
12header-y += radeon_drm.h 13header-y += radeon_drm.h
13header-y += savage_drm.h 14header-y += savage_drm.h
diff --git a/include/uapi/drm/qxl_drm.h b/include/uapi/drm/qxl_drm.h
new file mode 100644
index 000000000000..ebebd36c4117
--- /dev/null
+++ b/include/uapi/drm/qxl_drm.h
@@ -0,0 +1,152 @@
1/*
2 * Copyright 2013 Red Hat
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24#ifndef QXL_DRM_H
25#define QXL_DRM_H
26
27#include <stddef.h>
28#include "drm/drm.h"
29
30/* Please note that modifications to all structs defined here are
31 * subject to backwards-compatibility constraints.
32 *
33 * Do not use pointers, use uint64_t instead for 32 bit / 64 bit user/kernel
34 * compatibility Keep fields aligned to their size
35 */
36
37#define QXL_GEM_DOMAIN_CPU 0
38#define QXL_GEM_DOMAIN_VRAM 1
39#define QXL_GEM_DOMAIN_SURFACE 2
40
41#define DRM_QXL_ALLOC 0x00
42#define DRM_QXL_MAP 0x01
43#define DRM_QXL_EXECBUFFER 0x02
44#define DRM_QXL_UPDATE_AREA 0x03
45#define DRM_QXL_GETPARAM 0x04
46#define DRM_QXL_CLIENTCAP 0x05
47
48#define DRM_QXL_ALLOC_SURF 0x06
49
50struct drm_qxl_alloc {
51 uint32_t size;
52 uint32_t handle; /* 0 is an invalid handle */
53};
54
55struct drm_qxl_map {
56 uint64_t offset; /* use for mmap system call */
57 uint32_t handle;
58 uint32_t pad;
59};
60
61/*
62 * dest is the bo we are writing the relocation into
63 * src is bo we are relocating.
64 * *(dest_handle.base_addr + dest_offset) = physical_address(src_handle.addr +
65 * src_offset)
66 */
67#define QXL_RELOC_TYPE_BO 1
68#define QXL_RELOC_TYPE_SURF 2
69
70struct drm_qxl_reloc {
71 uint64_t src_offset; /* offset into src_handle or src buffer */
72 uint64_t dst_offset; /* offset in dest handle */
73 uint32_t src_handle; /* dest handle to compute address from */
74 uint32_t dst_handle; /* 0 if to command buffer */
75 uint32_t reloc_type;
76 uint32_t pad;
77};
78
79struct drm_qxl_command {
80 uint64_t __user command; /* void* */
81 uint64_t __user relocs; /* struct drm_qxl_reloc* */
82 uint32_t type;
83 uint32_t command_size;
84 uint32_t relocs_num;
85 uint32_t pad;
86};
87
88/* XXX: call it drm_qxl_commands? */
89struct drm_qxl_execbuffer {
90 uint32_t flags; /* for future use */
91 uint32_t commands_num;
92 uint64_t __user commands; /* struct drm_qxl_command* */
93};
94
95struct drm_qxl_update_area {
96 uint32_t handle;
97 uint32_t top;
98 uint32_t left;
99 uint32_t bottom;
100 uint32_t right;
101 uint32_t pad;
102};
103
104#define QXL_PARAM_NUM_SURFACES 1 /* rom->n_surfaces */
105#define QXL_PARAM_MAX_RELOCS 2
106struct drm_qxl_getparam {
107 uint64_t param;
108 uint64_t value;
109};
110
111/* these are one bit values */
112struct drm_qxl_clientcap {
113 uint32_t index;
114 uint32_t pad;
115};
116
117struct drm_qxl_alloc_surf {
118 uint32_t format;
119 uint32_t width;
120 uint32_t height;
121 int32_t stride;
122 uint32_t handle;
123 uint32_t pad;
124};
125
126#define DRM_IOCTL_QXL_ALLOC \
127 DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC, struct drm_qxl_alloc)
128
129#define DRM_IOCTL_QXL_MAP \
130 DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_MAP, struct drm_qxl_map)
131
132#define DRM_IOCTL_QXL_EXECBUFFER \
133 DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_EXECBUFFER,\
134 struct drm_qxl_execbuffer)
135
136#define DRM_IOCTL_QXL_UPDATE_AREA \
137 DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_UPDATE_AREA,\
138 struct drm_qxl_update_area)
139
140#define DRM_IOCTL_QXL_GETPARAM \
141 DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_GETPARAM,\
142 struct drm_qxl_getparam)
143
144#define DRM_IOCTL_QXL_CLIENTCAP \
145 DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_CLIENTCAP,\
146 struct drm_qxl_clientcap)
147
148#define DRM_IOCTL_QXL_ALLOC_SURF \
149 DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC_SURF,\
150 struct drm_qxl_alloc_surf)
151
152#endif