summaryrefslogtreecommitdiff
path: root/src/VBox/Devices/Graphics/vmsvga/svga_reg.h
blob: 6a1c69b47f1f4727a1b6d634d90e385e5c2993b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/*
 * VMware SVGA II hardware definitions
 */

#ifndef _SVGA_REG_H_
#define _SVGA_REG_H_

#define PCI_VENDOR_ID_VMWARE            0x15AD
#define PCI_DEVICE_ID_VMWARE_SVGA2      0x0405

#define SVGA_IRQFLAG_ANY_FENCE            0x1
#define SVGA_IRQFLAG_FIFO_PROGRESS        0x2
#define SVGA_IRQFLAG_FENCE_GOAL           0x4

#define SVGA_MAX_PSEUDOCOLOR_DEPTH      8
#define SVGA_MAX_PSEUDOCOLORS           (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH)
#define SVGA_NUM_PALETTE_REGS           (3 * SVGA_MAX_PSEUDOCOLORS)

#define SVGA_MAGIC         0x900000UL
#define SVGA_MAKE_ID(ver)  (SVGA_MAGIC << 8 | (ver))

#define SVGA_VERSION_2     2
#define SVGA_ID_2          SVGA_MAKE_ID(SVGA_VERSION_2)

#define SVGA_VERSION_1     1
#define SVGA_ID_1          SVGA_MAKE_ID(SVGA_VERSION_1)

#define SVGA_VERSION_0     0
#define SVGA_ID_0          SVGA_MAKE_ID(SVGA_VERSION_0)

#define SVGA_ID_INVALID    0xFFFFFFFF

#define SVGA_INDEX_PORT         0x0
#define SVGA_VALUE_PORT         0x1
#define SVGA_BIOS_PORT          0x2
#define SVGA_IRQSTATUS_PORT     0x8

#define SVGA_IRQFLAG_ANY_FENCE            0x1
#define SVGA_IRQFLAG_FIFO_PROGRESS        0x2
#define SVGA_IRQFLAG_FENCE_GOAL           0x4

enum
{
   SVGA_REG_ID = 0,
   SVGA_REG_ENABLE = 1,
   SVGA_REG_WIDTH = 2,
   SVGA_REG_HEIGHT = 3,
   SVGA_REG_MAX_WIDTH = 4,
   SVGA_REG_MAX_HEIGHT = 5,
   SVGA_REG_DEPTH = 6,
   SVGA_REG_BITS_PER_PIXEL = 7,
   SVGA_REG_PSEUDOCOLOR = 8,
   SVGA_REG_RED_MASK = 9,
   SVGA_REG_GREEN_MASK = 10,
   SVGA_REG_BLUE_MASK = 11,
   SVGA_REG_BYTES_PER_LINE = 12,
   SVGA_REG_FB_START = 13,
   SVGA_REG_FB_OFFSET = 14,
   SVGA_REG_VRAM_SIZE = 15,
   SVGA_REG_FB_SIZE = 16,
   SVGA_REG_CAPABILITIES = 17,
   SVGA_REG_MEM_START = 18,
   SVGA_REG_MEM_SIZE = 19,
   SVGA_REG_CONFIG_DONE = 20,
   SVGA_REG_SYNC = 21,
   SVGA_REG_BUSY = 22,
   SVGA_REG_GUEST_ID = 23,
   SVGA_REG_CURSOR_ID = 24,
   SVGA_REG_CURSOR_X = 25,
   SVGA_REG_CURSOR_Y = 26,
   SVGA_REG_CURSOR_ON = 27,
   SVGA_REG_HOST_BITS_PER_PIXEL = 28,
   SVGA_REG_SCRATCH_SIZE = 29,
   SVGA_REG_MEM_REGS = 30,
   SVGA_REG_NUM_DISPLAYS = 31,
   SVGA_REG_PITCHLOCK = 32,
   SVGA_REG_IRQMASK = 33,
   SVGA_REG_NUM_GUEST_DISPLAYS = 34,
   SVGA_REG_DISPLAY_ID = 35,
   SVGA_REG_DISPLAY_IS_PRIMARY = 36,
   SVGA_REG_DISPLAY_POSITION_X = 37,
   SVGA_REG_DISPLAY_POSITION_Y = 38,
   SVGA_REG_DISPLAY_WIDTH = 39,
   SVGA_REG_DISPLAY_HEIGHT = 40,
   SVGA_REG_GMR_ID = 41,
   SVGA_REG_GMR_DESCRIPTOR = 42,
   SVGA_REG_GMR_MAX_IDS = 43,
   SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44,
   SVGA_REG_TRACES = 45,
   SVGA_REG_GMRS_MAX_PAGES = 46,
   SVGA_REG_MEMORY_SIZE = 47,
   SVGA_REG_TOP = 48,
   SVGA_PALETTE_BASE = 1024,
   SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS
};

enum
{
   SVGA_FIFO_MIN = 0,
   SVGA_FIFO_MAX,
   SVGA_FIFO_NEXT_CMD,
   SVGA_FIFO_STOP,
   SVGA_FIFO_CAPABILITIES = 4,
   SVGA_FIFO_FLAGS,
   SVGA_FIFO_FENCE,
   SVGA_FIFO_3D_HWVERSION,
   SVGA_FIFO_PITCHLOCK,
   SVGA_FIFO_CURSOR_ON,
   SVGA_FIFO_CURSOR_X,
   SVGA_FIFO_CURSOR_Y,
   SVGA_FIFO_CURSOR_COUNT,
   SVGA_FIFO_CURSOR_LAST_UPDATED,
   SVGA_FIFO_RESERVED,
   SVGA_FIFO_CURSOR_SCREEN_ID,
   SVGA_FIFO_DEAD,
   SVGA_FIFO_3D_HWVERSION_REVISED,
   SVGA_FIFO_3D_CAPS      = 32,
   SVGA_FIFO_3D_CAPS_LAST = 32 + 255,
   SVGA_FIFO_GUEST_3D_HWVERSION,
   SVGA_FIFO_FENCE_GOAL,
   SVGA_FIFO_BUSY,
   SVGA_FIFO_NUM_REGS
};

typedef enum
{
   SVGA_CMD_INVALID_CMD           = 0,
   SVGA_CMD_UPDATE                = 1,
   SVGA_CMD_RECT_COPY             = 3,
   SVGA_CMD_DEFINE_CURSOR         = 19,
   SVGA_CMD_DEFINE_ALPHA_CURSOR   = 22,
   SVGA_CMD_UPDATE_VERBOSE        = 25,
   SVGA_CMD_FRONT_ROP_FILL        = 29,
   SVGA_CMD_FENCE                 = 30,
   SVGA_CMD_ESCAPE                = 33,
   SVGA_CMD_DEFINE_SCREEN         = 34,
   SVGA_CMD_DESTROY_SCREEN        = 35,
   SVGA_CMD_DEFINE_GMRFB          = 36,
   SVGA_CMD_BLIT_GMRFB_TO_SCREEN  = 37,
   SVGA_CMD_BLIT_SCREEN_TO_GMRFB  = 38,
   SVGA_CMD_ANNOTATION_FILL       = 39,
   SVGA_CMD_ANNOTATION_COPY       = 40,
   SVGA_CMD_DEFINE_GMR2           = 41,
   SVGA_CMD_REMAP_GMR2            = 42,
   SVGA_CMD_MAX
} SVGAFifoCmdId;

typedef struct SVGAColorBGRX
{
   union
   {
      struct
      {
         uint32_t b : 8;
         uint32_t g : 8;
         uint32_t r : 8;
         uint32_t x : 8;
      } s;

      uint32_t value;
   };
} SVGAColorBGRX;

typedef struct SVGASignedPoint
{
   int32_t  x;
   int32_t  y;
} SVGASignedPoint;

#define SVGA_CAP_NONE               0x00000000
#define SVGA_CAP_RECT_COPY          0x00000002
#define SVGA_CAP_CURSOR             0x00000020
#define SVGA_CAP_CURSOR_BYPASS      0x00000040
#define SVGA_CAP_CURSOR_BYPASS_2    0x00000080
#define SVGA_CAP_8BIT_EMULATION     0x00000100
#define SVGA_CAP_ALPHA_CURSOR       0x00000200
#define SVGA_CAP_3D                 0x00004000
#define SVGA_CAP_EXTENDED_FIFO      0x00008000
#define SVGA_CAP_MULTIMON           0x00010000
#define SVGA_CAP_PITCHLOCK          0x00020000
#define SVGA_CAP_IRQMASK            0x00040000
#define SVGA_CAP_DISPLAY_TOPOLOGY   0x00080000
#define SVGA_CAP_GMR                0x00100000
#define SVGA_CAP_TRACES             0x00200000
#define SVGA_CAP_GMR2               0x00400000
#define SVGA_CAP_SCREEN_OBJECT_2    0x00800000

#define SVGA_GMR_NULL         ((uint32_t) -1)
#define SVGA_GMR_FRAMEBUFFER  ((uint32_t) -2)

typedef struct SVGAGuestPtr
{
   uint32_t gmrId;
   uint32_t offset;
} SVGAGuestPtr;

typedef struct SVGAGMRImageFormat
{
   union
   {
      struct
      {
         uint32_t bitsPerPixel : 8;
         uint32_t colorDepth   : 8;
         uint32_t reserved     : 16;
      } s;

      uint32_t value;
   };
} SVGAGMRImageFormat;

typedef struct SVGAGuestImage
{
   SVGAGuestPtr         ptr;
   uint32_t pitch;
} SVGAGuestImage;

#define SVGA_SCREEN_MUST_BE_SET     (1 << 0)
#define SVGA_SCREEN_HAS_ROOT SVGA_SCREEN_MUST_BE_SET
#define SVGA_SCREEN_IS_PRIMARY      (1 << 1)
#define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2)
#define SVGA_SCREEN_DEACTIVATE  (1 << 3)
#define SVGA_SCREEN_BLANKING (1 << 4)

typedef struct SVGAScreenObject
{
   uint32_t structSize;
   uint32_t id;
   uint32_t flags;
   struct
   {
      uint32_t width;
      uint32_t height;
   } size;
   struct
   {
      int32_t x;
      int32_t y;
   } root;
   SVGAGuestImage backingStore;
   uint32_t cloneCount;
} SVGAScreenObject;

typedef struct
{
   uint32_t screenId;
} SVGAFifoCmdDestroyScreen;

typedef struct
{
   uint32_t x;
   uint32_t y;
   uint32_t width;
   uint32_t height;
} SVGAFifoCmdUpdate;

typedef struct
{
   uint32_t fence;
} SVGAFifoCmdFence;

typedef struct
{
   uint32_t nsid;
   uint32_t size;
} SVGAFifoCmdEscape;

typedef struct
{
   uint32_t id;
   uint32_t hotspotX;
   uint32_t hotspotY;
   uint32_t width;
   uint32_t height;
   uint32_t andMaskDepth;
   uint32_t xorMaskDepth;
} SVGAFifoCmdDefineCursor;

typedef struct
{
   uint32_t id;
   uint32_t hotspotX;
   uint32_t hotspotY;
   uint32_t width;
   uint32_t height;
} SVGAFifoCmdDefineAlphaCursor;

typedef struct
{
   SVGAScreenObject screen;
} SVGAFifoCmdDefineScreen;

typedef struct
{
   SVGAColorBGRX  color;
} SVGAFifoCmdAnnotationFill;

typedef struct
{
   SVGASignedPoint  srcOrigin;
   uint32_t           srcScreenId;
} SVGAFifoCmdAnnotationCopy;

#define SVGA_FIFO_CAP_NONE                  0
#define SVGA_FIFO_CAP_FENCE             (1<<0)
#define SVGA_FIFO_CAP_ACCELFRONT        (1<<1)
#define SVGA_FIFO_CAP_PITCHLOCK         (1<<2)
#define SVGA_FIFO_CAP_VIDEO             (1<<3)
#define SVGA_FIFO_CAP_CURSOR_BYPASS_3   (1<<4)
#define SVGA_FIFO_CAP_ESCAPE            (1<<5)
#define SVGA_FIFO_CAP_RESERVE           (1<<6)
#define SVGA_FIFO_CAP_SCREEN_OBJECT     (1<<7)
#define SVGA_FIFO_CAP_GMR2              (1<<8)
#define SVGA_FIFO_CAP_3D_HWVERSION_REVISED  SVGA_FIFO_CAP_GMR2
#define SVGA_FIFO_CAP_SCREEN_OBJECT_2   (1<<9)
#define SVGA_FIFO_CAP_DEAD              (1<<10)

#endif /* _SVGA_REG_H_ */