1 #ifndef _VMWARESVGA_HARDWARE_H
2 #define _VMWARESVGA_HARDWARE_H
4 #include <exec/libraries.h>
5 #include <exec/tasks.h>
10 #include "vmwaresvga_bitmap.h"
11 #include "vmwaresvga_mouse.h"
14 #define SVGA_LEGACY_BASE_PORT 0x4560
16 #define VENDOR_VMWARE 0x15ad
17 #define DEVICE_VMWARE0710 0x0710
18 #define DEVICE_VMWARE0405 0x0405
21 * Raster op codes (same encoding as X)
24 #define SVGA_ROP_CLEAR 0x00 /* 0 */
25 #define SVGA_ROP_AND 0x01 /* src AND dst */
26 #define SVGA_ROP_AND_REVERSE 0x02 /* src AND NOT dst */
27 #define SVGA_ROP_COPY 0x03 /* src */
28 #define SVGA_ROP_AND_INVERTED 0x04 /* NOT src AND dst */
29 #define SVGA_ROP_NOOP 0x05 /* dst */
30 #define SVGA_ROP_XOR 0x06 /* src XOR dst */
31 #define SVGA_ROP_OR 0x07 /* src OR dst */
32 #define SVGA_ROP_NOR 0x08 /* NOT src AND NOT dst */
33 #define SVGA_ROP_EQUIV 0x09 /* NOT src XOR dst */
34 #define SVGA_ROP_INVERT 0x0a /* NOT dst */
35 #define SVGA_ROP_OR_REVERSE 0x0b /* src OR NOT dst */
36 #define SVGA_ROP_COPY_INVERTED 0x0c /* NOT src */
37 #define SVGA_ROP_OR_INVERTED 0x0d /* NOT src OR dst */
38 #define SVGA_ROP_NAND 0x0e /* NOT src OR NOT dst */
39 #define SVGA_ROP_SET 0x0f /* 1 */
40 #define SVGA_ROP_UNSUPPORTED 0x10
42 #define SVGA_NUM_SUPPORTED_ROPS 16
45 * Commands in the command FIFO
48 #define SVGA_CMD_INVALID_CMD 0
50 <nothing> (well, undefined) */
52 #define SVGA_CMD_UPDATE 1
54 X, Y, Width, Height */
56 #define SVGA_CMD_RECT_FILL 2
58 Color, X, Y, Width, Height */
60 #define SVGA_CMD_RECT_COPY 3
62 Source X, Source Y, Dest X, Dest Y, Width, Height */
64 #define SVGA_CMD_DEFINE_BITMAP 4
66 Pixmap ID, Width, Height, <scanlines> */
68 #define SVGA_CMD_DEFINE_BITMAP_SCANLINE 5
70 Pixmap ID, Width, Height, Line #, scanline */
72 #define SVGA_CMD_DEFINE_PIXMAP 6
74 Pixmap ID, Width, Height, Depth, <scanlines> */
76 #define SVGA_CMD_DEFINE_PIXMAP_SCANLINE 7
78 Pixmap ID, Width, Height, Depth, Line #, scanline */
80 #define SVGA_CMD_RECT_BITMAP_FILL 8
82 Bitmap ID, X, Y, Width, Height, Foreground, Background */
84 #define SVGA_CMD_RECT_PIXMAP_FILL 9
86 Pixmap ID, X, Y, Width, Height */
88 #define SVGA_CMD_RECT_BITMAP_COPY 10
90 Bitmap ID, Source X, Source Y, Dest X, Dest Y,
91 Width, Height, Foreground, Background */
93 #define SVGA_CMD_RECT_PIXMAP_COPY 11
95 Pixmap ID, Source X, Source Y, Dest X, Dest Y, Width, Height */
97 #define SVGA_CMD_FREE_OBJECT 12
99 Object (pixmap, bitmap, ...) ID */
101 #define SVGA_CMD_RECT_ROP_FILL 13
103 Color, X, Y, Width, Height, ROP */
105 #define SVGA_CMD_RECT_ROP_COPY 14
107 Source X, Source Y, Dest X, Dest Y, Width, Height, ROP */
109 #define SVGA_CMD_RECT_ROP_BITMAP_FILL 15
111 ID, X, Y, Width, Height, Foreground, Background, ROP */
113 #define SVGA_CMD_RECT_ROP_PIXMAP_FILL 16
115 ID, X, Y, Width, Height, ROP */
117 #define SVGA_CMD_RECT_ROP_BITMAP_COPY 17
119 ID, Source X, Source Y,
120 Dest X, Dest Y, Width, Height, Foreground, Background, ROP */
122 #define SVGA_CMD_RECT_ROP_PIXMAP_COPY 18
124 ID, Source X, Source Y, Dest X, Dest Y, Width, Height, ROP */
126 #define SVGA_CMD_DEFINE_CURSOR 19
128 ID, Hotspot X, Hotspot Y, Width, Height,
129 Depth for AND mask, Depth for XOR mask,
130 <scanlines for AND mask>, <scanlines for XOR mask> */
132 #define SVGA_CMD_DISPLAY_CURSOR 20
134 ID, On/Off (1 or 0) */
136 #define SVGA_CMD_MOVE_CURSOR 21
140 #define SVGA_CMD_DEFINE_ALPHA_CURSOR 22
142 ID, Hotspot X, Hotspot Y, Width, Height,
145 #define SVGA_CMD_DRAW_GLYPH 23
147 X, Y, W, H, FGCOLOR, <stencil buffer> */
149 #define SVGA_CMD_DRAW_GLYPH_CLIPPED 24
151 X, Y, W, H, FGCOLOR, BGCOLOR, <cliprect>, <stencil buffer>
152 Transparent color expands are done by setting BGCOLOR to ~0 */
154 #define SVGA_CMD_UPDATE_VERBOSE 25
156 X, Y, Width, Height, Reason */
158 #define SVGA_CMD_SURFACE_FILL 26
160 color, dstSurfaceOffset, x, y, w, h, rop */
162 #define SVGA_CMD_SURFACE_COPY 27
164 srcSurfaceOffset, dstSurfaceOffset, srcX, srcY,
165 destX, destY, w, h, rop */
167 #define SVGA_CMD_SURFACE_ALPHA_BLEND 28
169 srcSurfaceOffset, dstSurfaceOffset, srcX, srcY,
170 destX, destY, w, h, op (SVGA_BLENDOP*), flags (SVGA_BLENDFLAGS*),
173 #define SVGA_CMD_FRONT_ROP_FILL 29
175 Color, X, Y, Width, Height, ROP */
177 #define SVGA_CMD_FENCE 30
185 #define SVGA_CAP_RECT_FILL 0x00001
186 #define SVGA_CAP_RECT_PAT_FILL 0x00004
187 #define SVGA_CAP_LEGACY_OFFSCREEN 0x00008
188 #define SVGA_CAP_RASTER_OP 0x00010
189 #define SVGA_CAP_GLYPH 0x00400
190 #define SVGA_CAP_GLYPH_CLIPPING 0x00800
191 #define SVGA_CAP_OFFSCREEN_1 0x01000
192 #define SVGA_CAP_ALPHA_BLEND 0x02000
194 struct VMWareSVGAFIFO
{
195 struct SignalSemaphore fifocmdsema
;
212 volatile struct VMWareSVGAFIFO fifocmdbuf
;
216 ULONG fifocapabilities
;
218 struct HIDD_ViewPortData
*shown
;
235 ULONG fboffset
; /* last byte in framebuffer of current screen mode */
239 UWORD display_height
;
240 ULONG bytes_per_line
;
242 ULONG txrmax
; /* max texture size */
250 struct Box delta_damage
;
251 struct Task
*render_task
;
252 struct SignalSemaphore damage_control
;
255 #define clearCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
256 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_CLEAR)
257 #define andCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
258 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_AND)
259 #define andReverseCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
260 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_AND_REVERSE)
261 #define copyCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
262 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_COPY)
263 #define andInvertedCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
264 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_AND_INVERTED)
265 #define noOpCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
266 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_NOOP)
267 #define xorCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
268 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_XOR)
269 #define orCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
270 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_OR)
271 #define norCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
272 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_NOR)
273 #define equivCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
274 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_EQUIV)
275 #define invertCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
276 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_INVERT)
277 #define orReverseCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
278 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_OR_REVERSE)
279 #define copyInvertedCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
280 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_COPY_INVERTED)
281 #define orInvertedCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
282 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_OR_INVERTED)
283 #define nandCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
284 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_NAND)
285 #define setCopyVMWareSVGA(d, sx, sy, dx, dy, w, h) \
286 ropCopyVMWareSVGA(d, sx, sy, dx, dy, w, h, SVGA_ROP_SET)
288 #define clearFillVMWareSVGA(d, c, x, y, w, h) \
289 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_CLEAR)
290 #define andFillVMWareSVGA(d, c, x, y, w, h) \
291 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_AND)
292 #define andReverseFillVMWareSVGA(d, c, x, y, w, h) \
293 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_AND_REVERSE)
294 #define copyFillVMWareSVGA(d, c, x, y, w, h) \
295 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_COPY)
296 #define andInvertedFillVMWareSVGA(d, c, x, y, w, h) \
297 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_AND_INVERTED)
298 #define noOpFillVMWareSVGA(d, c, x, y, w, h) \
299 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_NOOP)
300 #define xorFillVMWareSVGA(d, c, x, y, w, h) \
301 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_XOR)
302 #define orFillVMWareSVGA(d, c, x, y, w, h) \
303 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_OR)
304 #define norFillVMWareSVGA(d, c, x, y, w, h) \
305 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_NOR)
306 #define equivFillVMWareSVGA(d, c, x, y, w, h) \
307 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_EQUIV)
308 #define invertFillVMWareSVGA(d, c, x, y, w, h) \
309 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_INVERT)
310 #define orReverseFillVMWareSVGA(d, c, x, y, w, h) \
311 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_OR_REVERSE)
312 #define copyInvertedFillVMWareSVGA(d, c, x, y, w, h) \
313 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_COPY_INVERTED)
314 #define orInvertedFillVMWareSVGA(d, c, x, y, w, h) \
315 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_OR_INVERTED)
316 #define nandFillVMWareSVGA(d, c, x, y, w, h) \
317 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_NAND)
318 #define setFillVMWareSVGA(d, c, x, y, w, h) \
319 ropFillVMWareSVGA(d, c, x, y, w, h, SVGA_ROP_SET)
321 ULONG
vmwareReadReg(struct HWData
*, ULONG
);
322 void vmwareWriteReg(struct HWData
*, ULONG
, ULONG
);
324 VOID
enableVMWareSVGA(struct HWData
*);
325 VOID
disableVMWareSVGA(struct HWData
*);
327 BOOL
initVMWareSVGAHW(struct HWData
*, OOP_Object
*);
328 VOID
initDisplayVMWareSVGA(struct HWData
*);
329 VOID
getModeCfgVMWareSVGA(struct HWData
*);
330 VOID
setModeVMWareSVGA(struct HWData
*, ULONG
, ULONG
);
331 VOID
refreshAreaVMWareSVGA(struct HWData
*, struct Box
*);
333 APTR
VMWareSVGA_MemAlloc(struct HWData
*, ULONG
);
334 VOID
VMWareSVGA_MemFree(struct HWData
*, APTR
, ULONG
);
336 VOID
rectFillVMWareSVGA(struct HWData
*, ULONG
, LONG
, LONG
, LONG
, LONG
);
337 VOID
ropFillVMWareSVGA(struct HWData
*, ULONG
, LONG
, LONG
, LONG
, LONG
, ULONG
);
338 VOID
ropCopyVMWareSVGA(struct HWData
*, LONG
, LONG
, LONG
, LONG
, ULONG
, ULONG
, ULONG
);
340 VOID
defineCursorVMWareSVGA(struct HWData
*, struct MouseData
*);
341 VOID
displayCursorVMWareSVGA(struct HWData
*, LONG
);
342 VOID
moveCursorVMWareSVGA(struct HWData
*, LONG
, LONG
);
344 void waitVMWareSVGAFIFO(struct HWData
*);
345 APTR
reserveVMWareSVGAFIFO(struct HWData
*, ULONG
);
346 VOID
commitVMWareSVGAFIFO(struct HWData
*, ULONG
);
347 VOID
flushVMWareSVGAFIFO(struct HWData
*, ULONG
*);
348 VOID
writeVMWareSVGAFIFO(struct HWData
*, ULONG
);
349 VOID
syncVMWareSVGAFIFO(struct HWData
*);
351 ULONG
fenceVMWareSVGAFIFO(struct HWData
*);
352 VOID
syncfenceVMWareSVGAFIFO(struct HWData
*, ULONG
);
354 VOID
vmwareHandlerIRQ(struct HWData
*, void *);
356 VOID
VMWareSVGA_Damage_Reset(struct HWData
*);
357 VOID
VMWareSVGA_Damage_DeltaAdd(struct HWData
*, struct Box
*);
358 VOID
VMWareSVGA_RestartRenderTask(struct HWData
*);
360 #endif /* _VMWARESVGA_HARDWARE_H */