svga_reg.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  1. /* SPDX-License-Identifier: GPL-2.0 OR MIT */
  2. /*
  3. * Copyright 1998-2021 VMware, Inc.
  4. *
  5. * Permission is hereby granted, free of charge, to any person
  6. * obtaining a copy of this software and associated documentation
  7. * files (the "Software"), to deal in the Software without
  8. * restriction, including without limitation the rights to use, copy,
  9. * modify, merge, publish, distribute, sublicense, and/or sell copies
  10. * of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be
  14. * included in all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  20. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  21. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  23. * SOFTWARE.
  24. *
  25. */
  26. /*
  27. * svga_reg.h --
  28. *
  29. * Virtual hardware definitions for the VMware SVGA II device.
  30. */
  31. #ifndef _SVGA_REG_H_
  32. #define _SVGA_REG_H_
  33. #include "vm_basic_types.h"
  34. typedef enum {
  35. SVGA_REG_ENABLE_DISABLE = 0,
  36. SVGA_REG_ENABLE_ENABLE = (1 << 0),
  37. SVGA_REG_ENABLE_HIDE = (1 << 1),
  38. } SvgaRegEnable;
  39. typedef uint32 SVGAMobId;
  40. #define SVGA_MAX_WIDTH 2560
  41. #define SVGA_MAX_HEIGHT 1600
  42. #define SVGA_MAX_BITS_PER_PIXEL 32
  43. #define SVGA_MAX_DEPTH 24
  44. #define SVGA_MAX_DISPLAYS 10
  45. #define SVGA_MAX_SCREEN_SIZE 8192
  46. #define SVGA_SCREEN_ROOT_LIMIT (SVGA_MAX_SCREEN_SIZE * SVGA_MAX_DISPLAYS)
  47. #define SVGA_CURSOR_ON_HIDE 0x0
  48. #define SVGA_CURSOR_ON_SHOW 0x1
  49. #define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2
  50. #define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3
  51. #define SVGA_FB_MAX_TRACEABLE_SIZE 0x1000000
  52. #define SVGA_MAX_PSEUDOCOLOR_DEPTH 8
  53. #define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH)
  54. #define SVGA_NUM_PALETTE_REGS (3 * SVGA_MAX_PSEUDOCOLORS)
  55. #define SVGA_MAGIC 0x900000UL
  56. #define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))
  57. #define SVGA_VERSION_3 3
  58. #define SVGA_ID_3 SVGA_MAKE_ID(SVGA_VERSION_3)
  59. #define SVGA_VERSION_2 2
  60. #define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2)
  61. #define SVGA_VERSION_1 1
  62. #define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1)
  63. #define SVGA_VERSION_0 0
  64. #define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0)
  65. #define SVGA_ID_INVALID 0xFFFFFFFF
  66. #define SVGA_INDEX_PORT 0x0
  67. #define SVGA_VALUE_PORT 0x1
  68. #define SVGA_BIOS_PORT 0x2
  69. #define SVGA_IRQSTATUS_PORT 0x8
  70. #define SVGA_IRQFLAG_ANY_FENCE (1 << 0)
  71. #define SVGA_IRQFLAG_FIFO_PROGRESS (1 << 1)
  72. #define SVGA_IRQFLAG_FENCE_GOAL (1 << 2)
  73. #define SVGA_IRQFLAG_COMMAND_BUFFER (1 << 3)
  74. #define SVGA_IRQFLAG_ERROR (1 << 4)
  75. #define SVGA_IRQFLAG_REG_FENCE_GOAL (1 << 5)
  76. #define SVGA_IRQFLAG_MAX (1 << 6)
  77. #define SVGA_MAX_CURSOR_CMD_BYTES (40 * 1024)
  78. #define SVGA_MAX_CURSOR_CMD_DIMENSION 1024
  79. enum {
  80. SVGA_REG_ID = 0,
  81. SVGA_REG_ENABLE = 1,
  82. SVGA_REG_WIDTH = 2,
  83. SVGA_REG_HEIGHT = 3,
  84. SVGA_REG_MAX_WIDTH = 4,
  85. SVGA_REG_MAX_HEIGHT = 5,
  86. SVGA_REG_DEPTH = 6,
  87. SVGA_REG_BITS_PER_PIXEL = 7,
  88. SVGA_REG_PSEUDOCOLOR = 8,
  89. SVGA_REG_RED_MASK = 9,
  90. SVGA_REG_GREEN_MASK = 10,
  91. SVGA_REG_BLUE_MASK = 11,
  92. SVGA_REG_BYTES_PER_LINE = 12,
  93. SVGA_REG_FB_START = 13,
  94. SVGA_REG_FB_OFFSET = 14,
  95. SVGA_REG_VRAM_SIZE = 15,
  96. SVGA_REG_FB_SIZE = 16,
  97. SVGA_REG_ID_0_TOP = 17,
  98. SVGA_REG_CAPABILITIES = 17,
  99. SVGA_REG_MEM_START = 18,
  100. SVGA_REG_MEM_SIZE = 19,
  101. SVGA_REG_CONFIG_DONE = 20,
  102. SVGA_REG_SYNC = 21,
  103. SVGA_REG_BUSY = 22,
  104. SVGA_REG_GUEST_ID = 23,
  105. SVGA_REG_DEAD = 24,
  106. SVGA_REG_CURSOR_X = 25,
  107. SVGA_REG_CURSOR_Y = 26,
  108. SVGA_REG_CURSOR_ON = 27,
  109. SVGA_REG_HOST_BITS_PER_PIXEL = 28,
  110. SVGA_REG_SCRATCH_SIZE = 29,
  111. SVGA_REG_MEM_REGS = 30,
  112. SVGA_REG_NUM_DISPLAYS = 31,
  113. SVGA_REG_PITCHLOCK = 32,
  114. SVGA_REG_IRQMASK = 33,
  115. SVGA_REG_NUM_GUEST_DISPLAYS = 34,
  116. SVGA_REG_DISPLAY_ID = 35,
  117. SVGA_REG_DISPLAY_IS_PRIMARY = 36,
  118. SVGA_REG_DISPLAY_POSITION_X = 37,
  119. SVGA_REG_DISPLAY_POSITION_Y = 38,
  120. SVGA_REG_DISPLAY_WIDTH = 39,
  121. SVGA_REG_DISPLAY_HEIGHT = 40,
  122. SVGA_REG_GMR_ID = 41,
  123. SVGA_REG_GMR_DESCRIPTOR = 42,
  124. SVGA_REG_GMR_MAX_IDS = 43,
  125. SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44,
  126. SVGA_REG_TRACES = 45,
  127. SVGA_REG_GMRS_MAX_PAGES = 46,
  128. SVGA_REG_MEMORY_SIZE = 47,
  129. SVGA_REG_COMMAND_LOW = 48,
  130. SVGA_REG_COMMAND_HIGH = 49,
  131. SVGA_REG_MAX_PRIMARY_MEM = 50,
  132. SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51,
  133. SVGA_REG_DEV_CAP = 52,
  134. SVGA_REG_CMD_PREPEND_LOW = 53,
  135. SVGA_REG_CMD_PREPEND_HIGH = 54,
  136. SVGA_REG_SCREENTARGET_MAX_WIDTH = 55,
  137. SVGA_REG_SCREENTARGET_MAX_HEIGHT = 56,
  138. SVGA_REG_MOB_MAX_SIZE = 57,
  139. SVGA_REG_BLANK_SCREEN_TARGETS = 58,
  140. SVGA_REG_CAP2 = 59,
  141. SVGA_REG_DEVEL_CAP = 60,
  142. SVGA_REG_GUEST_DRIVER_ID = 61,
  143. SVGA_REG_GUEST_DRIVER_VERSION1 = 62,
  144. SVGA_REG_GUEST_DRIVER_VERSION2 = 63,
  145. SVGA_REG_GUEST_DRIVER_VERSION3 = 64,
  146. SVGA_REG_CURSOR_MOBID = 65,
  147. SVGA_REG_CURSOR_MAX_BYTE_SIZE = 66,
  148. SVGA_REG_CURSOR_MAX_DIMENSION = 67,
  149. SVGA_REG_FIFO_CAPS = 68,
  150. SVGA_REG_FENCE = 69,
  151. SVGA_REG_CURSOR4_ON = 70,
  152. SVGA_REG_CURSOR4_X = 71,
  153. SVGA_REG_CURSOR4_Y = 72,
  154. SVGA_REG_CURSOR4_SCREEN_ID = 73,
  155. SVGA_REG_CURSOR4_SUBMIT = 74,
  156. SVGA_REG_SCREENDMA = 75,
  157. SVGA_REG_GBOBJECT_MEM_SIZE_KB = 76,
  158. SVGA_REG_REGS_START_HIGH32 = 77,
  159. SVGA_REG_REGS_START_LOW32 = 78,
  160. SVGA_REG_FB_START_HIGH32 = 79,
  161. SVGA_REG_FB_START_LOW32 = 80,
  162. SVGA_REG_MSHINT = 81,
  163. SVGA_REG_IRQ_STATUS = 82,
  164. SVGA_REG_DIRTY_TRACKING = 83,
  165. SVGA_REG_FENCE_GOAL = 84,
  166. SVGA_REG_TOP = 85,
  167. SVGA_PALETTE_BASE = 1024,
  168. SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS
  169. };
  170. typedef enum SVGARegGuestDriverId {
  171. SVGA_REG_GUEST_DRIVER_ID_UNKNOWN = 0,
  172. SVGA_REG_GUEST_DRIVER_ID_WDDM = 1,
  173. SVGA_REG_GUEST_DRIVER_ID_LINUX = 2,
  174. SVGA_REG_GUEST_DRIVER_ID_MAX,
  175. SVGA_REG_GUEST_DRIVER_ID_SUBMIT = MAX_UINT32,
  176. } SVGARegGuestDriverId;
  177. typedef enum SVGARegMSHint {
  178. SVGA_REG_MSHINT_DISABLED = 0,
  179. SVGA_REG_MSHINT_FULL = 1,
  180. SVGA_REG_MSHINT_RESOLVED = 2,
  181. } SVGARegMSHint;
  182. typedef enum SVGARegDirtyTracking {
  183. SVGA_REG_DIRTY_TRACKING_PER_IMAGE = 0,
  184. SVGA_REG_DIRTY_TRACKING_PER_SURFACE = 1,
  185. } SVGARegDirtyTracking;
  186. #define SVGA_GMR_NULL ((uint32)-1)
  187. #define SVGA_GMR_FRAMEBUFFER ((uint32)-2)
  188. #pragma pack(push, 1)
  189. typedef struct SVGAGuestMemDescriptor {
  190. uint32 ppn;
  191. uint32 numPages;
  192. } SVGAGuestMemDescriptor;
  193. #pragma pack(pop)
  194. #pragma pack(push, 1)
  195. typedef struct SVGAGuestPtr {
  196. uint32 gmrId;
  197. uint32 offset;
  198. } SVGAGuestPtr;
  199. #pragma pack(pop)
  200. #define SVGA_CB_MAX_SIZE_DEFAULT (KBYTES_2_BYTES(512))
  201. #define SVGA_CB_MAX_SIZE_4MB (MBYTES_2_BYTES(4))
  202. #define SVGA_CB_MAX_SIZE SVGA_CB_MAX_SIZE_4MB
  203. #define SVGA_CB_MAX_QUEUED_PER_CONTEXT 32
  204. #define SVGA_CB_MAX_COMMAND_SIZE (32 * 1024)
  205. #define SVGA_CB_CONTEXT_MASK 0x3f
  206. typedef enum {
  207. SVGA_CB_CONTEXT_DEVICE = 0x3f,
  208. SVGA_CB_CONTEXT_0 = 0x0,
  209. SVGA_CB_CONTEXT_1 = 0x1,
  210. SVGA_CB_CONTEXT_MAX = 0x2,
  211. } SVGACBContext;
  212. typedef enum {
  213. SVGA_CB_STATUS_NONE = 0,
  214. SVGA_CB_STATUS_COMPLETED = 1,
  215. SVGA_CB_STATUS_QUEUE_FULL = 2,
  216. SVGA_CB_STATUS_COMMAND_ERROR = 3,
  217. SVGA_CB_STATUS_CB_HEADER_ERROR = 4,
  218. SVGA_CB_STATUS_PREEMPTED = 5,
  219. SVGA_CB_STATUS_SUBMISSION_ERROR = 6,
  220. SVGA_CB_STATUS_PARTIAL_COMPLETE = 7,
  221. } SVGACBStatus;
  222. typedef enum {
  223. SVGA_CB_FLAG_NONE = 0,
  224. SVGA_CB_FLAG_NO_IRQ = 1 << 0,
  225. SVGA_CB_FLAG_DX_CONTEXT = 1 << 1,
  226. SVGA_CB_FLAG_MOB = 1 << 2,
  227. } SVGACBFlags;
  228. #pragma pack(push, 1)
  229. typedef struct {
  230. volatile SVGACBStatus status;
  231. volatile uint32 errorOffset;
  232. uint64 id;
  233. SVGACBFlags flags;
  234. uint32 length;
  235. union {
  236. PA pa;
  237. struct {
  238. SVGAMobId mobid;
  239. uint32 mobOffset;
  240. } mob;
  241. } ptr;
  242. uint32 offset;
  243. uint32 dxContext;
  244. uint32 mustBeZero[6];
  245. } SVGACBHeader;
  246. #pragma pack(pop)
  247. typedef enum {
  248. SVGA_DC_CMD_NOP = 0,
  249. SVGA_DC_CMD_START_STOP_CONTEXT = 1,
  250. SVGA_DC_CMD_PREEMPT = 2,
  251. SVGA_DC_CMD_START_QUEUE = 3,
  252. SVGA_DC_CMD_ASYNC_STOP_QUEUE = 4,
  253. SVGA_DC_CMD_EMPTY_CONTEXT_QUEUE = 5,
  254. SVGA_DC_CMD_MAX = 6
  255. } SVGADeviceContextCmdId;
  256. typedef struct SVGADCCmdStartStop {
  257. uint32 enable;
  258. SVGACBContext context;
  259. } SVGADCCmdStartStop;
  260. typedef struct SVGADCCmdPreempt {
  261. SVGACBContext context;
  262. uint32 ignoreIDZero;
  263. } SVGADCCmdPreempt;
  264. typedef struct SVGADCCmdStartQueue {
  265. SVGACBContext context;
  266. } SVGADCCmdStartQueue;
  267. typedef struct SVGADCCmdAsyncStopQueue {
  268. SVGACBContext context;
  269. } SVGADCCmdAsyncStopQueue;
  270. typedef struct SVGADCCmdEmptyQueue {
  271. SVGACBContext context;
  272. } SVGADCCmdEmptyQueue;
  273. typedef struct SVGAGMRImageFormat {
  274. union {
  275. struct {
  276. uint32 bitsPerPixel : 8;
  277. uint32 colorDepth : 8;
  278. uint32 reserved : 16;
  279. };
  280. uint32 value;
  281. };
  282. } SVGAGMRImageFormat;
  283. #pragma pack(push, 1)
  284. typedef struct SVGAGuestImage {
  285. SVGAGuestPtr ptr;
  286. uint32 pitch;
  287. } SVGAGuestImage;
  288. #pragma pack(pop)
  289. typedef struct SVGAColorBGRX {
  290. union {
  291. struct {
  292. uint32 b : 8;
  293. uint32 g : 8;
  294. uint32 r : 8;
  295. uint32 x : 8;
  296. };
  297. uint32 value;
  298. };
  299. } SVGAColorBGRX;
  300. #pragma pack(push, 1)
  301. typedef struct {
  302. int32 left;
  303. int32 top;
  304. int32 right;
  305. int32 bottom;
  306. } SVGASignedRect;
  307. #pragma pack(pop)
  308. #pragma pack(push, 1)
  309. typedef struct {
  310. int32 x;
  311. int32 y;
  312. } SVGASignedPoint;
  313. #pragma pack(pop)
  314. #pragma pack(push, 1)
  315. typedef struct {
  316. uint32 x;
  317. uint32 y;
  318. } SVGAUnsignedPoint;
  319. #pragma pack(pop)
  320. #define SVGA_CAP_NONE 0x00000000
  321. #define SVGA_CAP_RECT_COPY 0x00000002
  322. #define SVGA_CAP_CURSOR 0x00000020
  323. #define SVGA_CAP_CURSOR_BYPASS 0x00000040
  324. #define SVGA_CAP_CURSOR_BYPASS_2 0x00000080
  325. #define SVGA_CAP_8BIT_EMULATION 0x00000100
  326. #define SVGA_CAP_ALPHA_CURSOR 0x00000200
  327. #define SVGA_CAP_3D 0x00004000
  328. #define SVGA_CAP_EXTENDED_FIFO 0x00008000
  329. #define SVGA_CAP_MULTIMON 0x00010000
  330. #define SVGA_CAP_PITCHLOCK 0x00020000
  331. #define SVGA_CAP_IRQMASK 0x00040000
  332. #define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000
  333. #define SVGA_CAP_GMR 0x00100000
  334. #define SVGA_CAP_TRACES 0x00200000
  335. #define SVGA_CAP_GMR2 0x00400000
  336. #define SVGA_CAP_SCREEN_OBJECT_2 0x00800000
  337. #define SVGA_CAP_COMMAND_BUFFERS 0x01000000
  338. #define SVGA_CAP_DEAD1 0x02000000
  339. #define SVGA_CAP_CMD_BUFFERS_2 0x04000000
  340. #define SVGA_CAP_GBOBJECTS 0x08000000
  341. #define SVGA_CAP_DX 0x10000000
  342. #define SVGA_CAP_HP_CMD_QUEUE 0x20000000
  343. #define SVGA_CAP_NO_BB_RESTRICTION 0x40000000
  344. #define SVGA_CAP_CAP2_REGISTER 0x80000000
  345. #define SVGA_CAP2_NONE 0x00000000
  346. #define SVGA_CAP2_GROW_OTABLE 0x00000001
  347. #define SVGA_CAP2_INTRA_SURFACE_COPY 0x00000002
  348. #define SVGA_CAP2_DX2 0x00000004
  349. #define SVGA_CAP2_GB_MEMSIZE_2 0x00000008
  350. #define SVGA_CAP2_SCREENDMA_REG 0x00000010
  351. #define SVGA_CAP2_OTABLE_PTDEPTH_2 0x00000020
  352. #define SVGA_CAP2_NON_MS_TO_MS_STRETCHBLT 0x00000040
  353. #define SVGA_CAP2_CURSOR_MOB 0x00000080
  354. #define SVGA_CAP2_MSHINT 0x00000100
  355. #define SVGA_CAP2_CB_MAX_SIZE_4MB 0x00000200
  356. #define SVGA_CAP2_DX3 0x00000400
  357. #define SVGA_CAP2_FRAME_TYPE 0x00000800
  358. #define SVGA_CAP2_COTABLE_COPY 0x00001000
  359. #define SVGA_CAP2_TRACE_FULL_FB 0x00002000
  360. #define SVGA_CAP2_EXTRA_REGS 0x00004000
  361. #define SVGA_CAP2_LO_STAGING 0x00008000
  362. #define SVGA_CAP2_VIDEO_BLT 0x00010000
  363. #define SVGA_CAP2_RESERVED 0x80000000
  364. typedef enum {
  365. SVGABackdoorCapDeviceCaps = 0,
  366. SVGABackdoorCapFifoCaps = 1,
  367. SVGABackdoorCap3dHWVersion = 2,
  368. SVGABackdoorCapDeviceCaps2 = 3,
  369. SVGABackdoorCapDevelCaps = 4,
  370. SVGABackdoorCapDevCaps = 5,
  371. SVGABackdoorDevelRenderer = 6,
  372. SVGABackdoorDevelUsingISB = 7,
  373. SVGABackdoorCapMax = 8,
  374. } SVGABackdoorCapType;
  375. enum {
  376. SVGA_FIFO_MIN = 0,
  377. SVGA_FIFO_MAX,
  378. SVGA_FIFO_NEXT_CMD,
  379. SVGA_FIFO_STOP,
  380. SVGA_FIFO_CAPABILITIES = 4,
  381. SVGA_FIFO_FLAGS,
  382. SVGA_FIFO_FENCE,
  383. SVGA_FIFO_3D_HWVERSION,
  384. SVGA_FIFO_PITCHLOCK,
  385. SVGA_FIFO_CURSOR_ON,
  386. SVGA_FIFO_CURSOR_X,
  387. SVGA_FIFO_CURSOR_Y,
  388. SVGA_FIFO_CURSOR_COUNT,
  389. SVGA_FIFO_CURSOR_LAST_UPDATED,
  390. SVGA_FIFO_RESERVED,
  391. SVGA_FIFO_CURSOR_SCREEN_ID,
  392. SVGA_FIFO_DEAD,
  393. SVGA_FIFO_3D_HWVERSION_REVISED,
  394. SVGA_FIFO_3D_CAPS = 32,
  395. SVGA_FIFO_3D_CAPS_LAST = 32 + 255,
  396. SVGA_FIFO_GUEST_3D_HWVERSION,
  397. SVGA_FIFO_FENCE_GOAL,
  398. SVGA_FIFO_BUSY,
  399. SVGA_FIFO_NUM_REGS
  400. };
  401. #define SVGA_FIFO_3D_CAPS_SIZE (SVGA_FIFO_3D_CAPS_LAST - SVGA_FIFO_3D_CAPS + 1)
  402. #define SVGA3D_FIFO_CAPS_RECORD_DEVCAPS 0x100
  403. typedef uint32 SVGA3dFifoCapsRecordType;
  404. typedef uint32 SVGA3dFifoCapPair[2];
  405. #pragma pack(push, 1)
  406. typedef struct SVGA3dFifoCapsRecordHeader {
  407. uint32 length;
  408. SVGA3dFifoCapsRecordType type;
  409. } SVGA3dFifoCapsRecordHeader;
  410. #pragma pack(pop)
  411. #define SVGA_FIFO_EXTENDED_MANDATORY_REGS (SVGA_FIFO_3D_CAPS_LAST + 1)
  412. #define SVGA_FIFO_CAP_NONE 0
  413. #define SVGA_FIFO_CAP_FENCE (1 << 0)
  414. #define SVGA_FIFO_CAP_ACCELFRONT (1 << 1)
  415. #define SVGA_FIFO_CAP_PITCHLOCK (1 << 2)
  416. #define SVGA_FIFO_CAP_VIDEO (1 << 3)
  417. #define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1 << 4)
  418. #define SVGA_FIFO_CAP_ESCAPE (1 << 5)
  419. #define SVGA_FIFO_CAP_RESERVE (1 << 6)
  420. #define SVGA_FIFO_CAP_SCREEN_OBJECT (1 << 7)
  421. #define SVGA_FIFO_CAP_GMR2 (1 << 8)
  422. #define SVGA_FIFO_CAP_3D_HWVERSION_REVISED SVGA_FIFO_CAP_GMR2
  423. #define SVGA_FIFO_CAP_SCREEN_OBJECT_2 (1 << 9)
  424. #define SVGA_FIFO_CAP_DEAD (1 << 10)
  425. #define SVGA_FIFO_FLAG_NONE 0
  426. #define SVGA_FIFO_FLAG_ACCELFRONT (1 << 0)
  427. #define SVGA_FIFO_FLAG_RESERVED (1 << 31)
  428. #define SVGA_FIFO_RESERVED_UNKNOWN 0xffffffff
  429. #define SVGA_SCREENDMA_REG_UNDEFINED 0
  430. #define SVGA_SCREENDMA_REG_NOT_PRESENT 1
  431. #define SVGA_SCREENDMA_REG_PRESENT 2
  432. #define SVGA_SCREENDMA_REG_MAX 3
  433. #define SVGA_NUM_OVERLAY_UNITS 32
  434. #define SVGA_VIDEO_FLAG_COLORKEY 0x0001
  435. enum {
  436. SVGA_VIDEO_ENABLED = 0,
  437. SVGA_VIDEO_FLAGS,
  438. SVGA_VIDEO_DATA_OFFSET,
  439. SVGA_VIDEO_FORMAT,
  440. SVGA_VIDEO_COLORKEY,
  441. SVGA_VIDEO_SIZE,
  442. SVGA_VIDEO_WIDTH,
  443. SVGA_VIDEO_HEIGHT,
  444. SVGA_VIDEO_SRC_X,
  445. SVGA_VIDEO_SRC_Y,
  446. SVGA_VIDEO_SRC_WIDTH,
  447. SVGA_VIDEO_SRC_HEIGHT,
  448. SVGA_VIDEO_DST_X,
  449. SVGA_VIDEO_DST_Y,
  450. SVGA_VIDEO_DST_WIDTH,
  451. SVGA_VIDEO_DST_HEIGHT,
  452. SVGA_VIDEO_PITCH_1,
  453. SVGA_VIDEO_PITCH_2,
  454. SVGA_VIDEO_PITCH_3,
  455. SVGA_VIDEO_DATA_GMRID,
  456. SVGA_VIDEO_DST_SCREEN_ID,
  457. SVGA_VIDEO_NUM_REGS
  458. };
  459. #pragma pack(push, 1)
  460. typedef struct SVGAOverlayUnit {
  461. uint32 enabled;
  462. uint32 flags;
  463. uint32 dataOffset;
  464. uint32 format;
  465. uint32 colorKey;
  466. uint32 size;
  467. uint32 width;
  468. uint32 height;
  469. uint32 srcX;
  470. uint32 srcY;
  471. uint32 srcWidth;
  472. uint32 srcHeight;
  473. int32 dstX;
  474. int32 dstY;
  475. uint32 dstWidth;
  476. uint32 dstHeight;
  477. uint32 pitches[3];
  478. uint32 dataGMRId;
  479. uint32 dstScreenId;
  480. } SVGAOverlayUnit;
  481. #pragma pack(pop)
  482. #define SVGA_INVALID_DISPLAY_ID ((uint32)-1)
  483. typedef struct SVGADisplayTopology {
  484. uint16 displayId;
  485. uint16 isPrimary;
  486. uint32 width;
  487. uint32 height;
  488. uint32 positionX;
  489. uint32 positionY;
  490. } SVGADisplayTopology;
  491. #define SVGA_SCREEN_MUST_BE_SET (1 << 0)
  492. #define SVGA_SCREEN_HAS_ROOT SVGA_SCREEN_MUST_BE_SET
  493. #define SVGA_SCREEN_IS_PRIMARY (1 << 1)
  494. #define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2)
  495. #define SVGA_SCREEN_DEACTIVATE (1 << 3)
  496. #define SVGA_SCREEN_BLANKING (1 << 4)
  497. #pragma pack(push, 1)
  498. typedef struct {
  499. uint32 structSize;
  500. uint32 id;
  501. uint32 flags;
  502. struct {
  503. uint32 width;
  504. uint32 height;
  505. } size;
  506. struct {
  507. int32 x;
  508. int32 y;
  509. } root;
  510. SVGAGuestImage backingStore;
  511. uint32 cloneCount;
  512. } SVGAScreenObject;
  513. #pragma pack(pop)
  514. typedef enum {
  515. SVGA_CMD_INVALID_CMD = 0,
  516. SVGA_CMD_UPDATE = 1,
  517. SVGA_CMD_RECT_COPY = 3,
  518. SVGA_CMD_RECT_ROP_COPY = 14,
  519. SVGA_CMD_DEFINE_CURSOR = 19,
  520. SVGA_CMD_DEFINE_ALPHA_CURSOR = 22,
  521. SVGA_CMD_UPDATE_VERBOSE = 25,
  522. SVGA_CMD_FRONT_ROP_FILL = 29,
  523. SVGA_CMD_FENCE = 30,
  524. SVGA_CMD_ESCAPE = 33,
  525. SVGA_CMD_DEFINE_SCREEN = 34,
  526. SVGA_CMD_DESTROY_SCREEN = 35,
  527. SVGA_CMD_DEFINE_GMRFB = 36,
  528. SVGA_CMD_BLIT_GMRFB_TO_SCREEN = 37,
  529. SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38,
  530. SVGA_CMD_ANNOTATION_FILL = 39,
  531. SVGA_CMD_ANNOTATION_COPY = 40,
  532. SVGA_CMD_DEFINE_GMR2 = 41,
  533. SVGA_CMD_REMAP_GMR2 = 42,
  534. SVGA_CMD_DEAD = 43,
  535. SVGA_CMD_DEAD_2 = 44,
  536. SVGA_CMD_NOP = 45,
  537. SVGA_CMD_NOP_ERROR = 46,
  538. SVGA_CMD_MAX
  539. } SVGAFifoCmdId;
  540. #define SVGA_CMD_MAX_DATASIZE (256 * 1024)
  541. #define SVGA_CMD_MAX_ARGS 64
  542. #pragma pack(push, 1)
  543. typedef struct {
  544. uint32 x;
  545. uint32 y;
  546. uint32 width;
  547. uint32 height;
  548. } SVGAFifoCmdUpdate;
  549. #pragma pack(pop)
  550. #pragma pack(push, 1)
  551. typedef struct {
  552. uint32 srcX;
  553. uint32 srcY;
  554. uint32 destX;
  555. uint32 destY;
  556. uint32 width;
  557. uint32 height;
  558. } SVGAFifoCmdRectCopy;
  559. #pragma pack(pop)
  560. #pragma pack(push, 1)
  561. typedef struct {
  562. uint32 srcX;
  563. uint32 srcY;
  564. uint32 destX;
  565. uint32 destY;
  566. uint32 width;
  567. uint32 height;
  568. uint32 rop;
  569. } SVGAFifoCmdRectRopCopy;
  570. #pragma pack(pop)
  571. #pragma pack(push, 1)
  572. typedef struct {
  573. uint32 id;
  574. uint32 hotspotX;
  575. uint32 hotspotY;
  576. uint32 width;
  577. uint32 height;
  578. uint32 andMaskDepth;
  579. uint32 xorMaskDepth;
  580. } SVGAFifoCmdDefineCursor;
  581. #pragma pack(pop)
  582. #pragma pack(push, 1)
  583. typedef struct {
  584. uint32 id;
  585. uint32 hotspotX;
  586. uint32 hotspotY;
  587. uint32 width;
  588. uint32 height;
  589. } SVGAFifoCmdDefineAlphaCursor;
  590. #pragma pack(pop)
  591. #pragma pack(push, 1)
  592. typedef struct {
  593. uint32 hotspotX;
  594. uint32 hotspotY;
  595. uint32 width;
  596. uint32 height;
  597. uint32 andMaskDepth;
  598. uint32 xorMaskDepth;
  599. } SVGAGBColorCursorHeader;
  600. #pragma pack(pop)
  601. #pragma pack(push, 1)
  602. typedef struct {
  603. uint32 hotspotX;
  604. uint32 hotspotY;
  605. uint32 width;
  606. uint32 height;
  607. } SVGAGBAlphaCursorHeader;
  608. #pragma pack(pop)
  609. typedef enum {
  610. SVGA_COLOR_CURSOR = 0,
  611. SVGA_ALPHA_CURSOR = 1,
  612. } SVGAGBCursorType;
  613. #pragma pack(push, 1)
  614. typedef struct {
  615. SVGAGBCursorType type;
  616. union {
  617. SVGAGBColorCursorHeader colorHeader;
  618. SVGAGBAlphaCursorHeader alphaHeader;
  619. } header;
  620. uint32 sizeInBytes;
  621. } SVGAGBCursorHeader;
  622. #pragma pack(pop)
  623. #pragma pack(push, 1)
  624. typedef struct {
  625. uint32 x;
  626. uint32 y;
  627. uint32 width;
  628. uint32 height;
  629. uint32 reason;
  630. } SVGAFifoCmdUpdateVerbose;
  631. #pragma pack(pop)
  632. #pragma pack(push, 1)
  633. typedef struct {
  634. uint32 color;
  635. uint32 x;
  636. uint32 y;
  637. uint32 width;
  638. uint32 height;
  639. uint32 rop;
  640. } SVGAFifoCmdFrontRopFill;
  641. #pragma pack(pop)
  642. #pragma pack(push, 1)
  643. typedef struct {
  644. uint32 fence;
  645. } SVGAFifoCmdFence;
  646. #pragma pack(pop)
  647. #pragma pack(push, 1)
  648. typedef struct {
  649. uint32 nsid;
  650. uint32 size;
  651. } SVGAFifoCmdEscape;
  652. #pragma pack(pop)
  653. #pragma pack(push, 1)
  654. typedef struct {
  655. SVGAScreenObject screen;
  656. } SVGAFifoCmdDefineScreen;
  657. #pragma pack(pop)
  658. #pragma pack(push, 1)
  659. typedef struct {
  660. uint32 screenId;
  661. } SVGAFifoCmdDestroyScreen;
  662. #pragma pack(pop)
  663. #pragma pack(push, 1)
  664. typedef struct {
  665. SVGAGuestPtr ptr;
  666. uint32 bytesPerLine;
  667. SVGAGMRImageFormat format;
  668. } SVGAFifoCmdDefineGMRFB;
  669. #pragma pack(pop)
  670. #pragma pack(push, 1)
  671. typedef struct {
  672. SVGASignedPoint srcOrigin;
  673. SVGASignedRect destRect;
  674. uint32 destScreenId;
  675. } SVGAFifoCmdBlitGMRFBToScreen;
  676. #pragma pack(pop)
  677. #pragma pack(push, 1)
  678. typedef struct {
  679. SVGASignedPoint destOrigin;
  680. SVGASignedRect srcRect;
  681. uint32 srcScreenId;
  682. } SVGAFifoCmdBlitScreenToGMRFB;
  683. #pragma pack(pop)
  684. #pragma pack(push, 1)
  685. typedef struct {
  686. SVGAColorBGRX color;
  687. } SVGAFifoCmdAnnotationFill;
  688. #pragma pack(pop)
  689. #pragma pack(push, 1)
  690. typedef struct {
  691. SVGASignedPoint srcOrigin;
  692. uint32 srcScreenId;
  693. } SVGAFifoCmdAnnotationCopy;
  694. #pragma pack(pop)
  695. #pragma pack(push, 1)
  696. typedef struct {
  697. uint32 gmrId;
  698. uint32 numPages;
  699. } SVGAFifoCmdDefineGMR2;
  700. #pragma pack(pop)
  701. typedef enum {
  702. SVGA_REMAP_GMR2_PPN32 = 0,
  703. SVGA_REMAP_GMR2_VIA_GMR = (1 << 0),
  704. SVGA_REMAP_GMR2_PPN64 = (1 << 1),
  705. SVGA_REMAP_GMR2_SINGLE_PPN = (1 << 2),
  706. } SVGARemapGMR2Flags;
  707. #pragma pack(push, 1)
  708. typedef struct {
  709. uint32 gmrId;
  710. SVGARemapGMR2Flags flags;
  711. uint32 offsetPages;
  712. uint32 numPages;
  713. } SVGAFifoCmdRemapGMR2;
  714. #pragma pack(pop)
  715. #define SVGA_VRAM_MIN_SIZE (4 * 640 * 480)
  716. #define SVGA_VRAM_MIN_SIZE_3D (16 * 1024 * 1024)
  717. #define SVGA_VRAM_MAX_SIZE (128 * 1024 * 1024)
  718. #define SVGA_MEMORY_SIZE_MAX (1024 * 1024 * 1024)
  719. #define SVGA_FIFO_SIZE_MAX (2 * 1024 * 1024)
  720. #define SVGA_GRAPHICS_MEMORY_KB_MIN (32 * 1024)
  721. #define SVGA_GRAPHICS_MEMORY_KB_MAX_2GB (2 * 1024 * 1024)
  722. #define SVGA_GRAPHICS_MEMORY_KB_MAX_3GB (3 * 1024 * 1024)
  723. #define SVGA_GRAPHICS_MEMORY_KB_MAX_4GB (4 * 1024 * 1024)
  724. #define SVGA_GRAPHICS_MEMORY_KB_MAX_8GB (8 * 1024 * 1024)
  725. #define SVGA_GRAPHICS_MEMORY_KB_DEFAULT (256 * 1024)
  726. #define SVGA_VRAM_SIZE_W2K (64 * 1024 * 1024)
  727. #if defined(VMX86_SERVER)
  728. #define SVGA_VRAM_SIZE (4 * 1024 * 1024)
  729. #define SVGA_VRAM_SIZE_3D (64 * 1024 * 1024)
  730. #define SVGA_FIFO_SIZE (256 * 1024)
  731. #define SVGA_FIFO_SIZE_3D (516 * 1024)
  732. #define SVGA_MEMORY_SIZE_DEFAULT (160 * 1024 * 1024)
  733. #define SVGA_AUTODETECT_DEFAULT FALSE
  734. #else
  735. #define SVGA_VRAM_SIZE (16 * 1024 * 1024)
  736. #define SVGA_VRAM_SIZE_3D SVGA_VRAM_MAX_SIZE
  737. #define SVGA_FIFO_SIZE (2 * 1024 * 1024)
  738. #define SVGA_FIFO_SIZE_3D SVGA_FIFO_SIZE
  739. #define SVGA_MEMORY_SIZE_DEFAULT (768 * 1024 * 1024)
  740. #define SVGA_AUTODETECT_DEFAULT TRUE
  741. #endif
  742. #define SVGA_FIFO_SIZE_GBOBJECTS (256 * 1024)
  743. #define SVGA_VRAM_SIZE_GBOBJECTS (4 * 1024 * 1024)
  744. #endif