diff options
-rw-r--r-- | drivers/gpu/drm/vmwgfx/svga_reg.h | 96 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 |
2 files changed, 99 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/svga_reg.h b/drivers/gpu/drm/vmwgfx/svga_reg.h index 1b96c2ec07dd..ec5aad9b6ed3 100644 --- a/drivers/gpu/drm/vmwgfx/svga_reg.h +++ b/drivers/gpu/drm/vmwgfx/svga_reg.h | |||
@@ -39,6 +39,15 @@ | |||
39 | #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405 | 39 | #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405 |
40 | 40 | ||
41 | /* | 41 | /* |
42 | * SVGA_REG_ENABLE bit definitions. | ||
43 | */ | ||
44 | #define SVGA_REG_ENABLE_DISABLE 0 | ||
45 | #define SVGA_REG_ENABLE_ENABLE 1 | ||
46 | #define SVGA_REG_ENABLE_HIDE 2 | ||
47 | #define SVGA_REG_ENABLE_ENABLE_HIDE (SVGA_REG_ENABLE_ENABLE |\ | ||
48 | SVGA_REG_ENABLE_HIDE) | ||
49 | |||
50 | /* | ||
42 | * Legal values for the SVGA_REG_CURSOR_ON register in old-fashioned | 51 | * Legal values for the SVGA_REG_CURSOR_ON register in old-fashioned |
43 | * cursor bypass mode. This is still supported, but no new guest | 52 | * cursor bypass mode. This is still supported, but no new guest |
44 | * drivers should use it. | 53 | * drivers should use it. |
@@ -158,7 +167,9 @@ enum { | |||
158 | SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44, | 167 | SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44, |
159 | 168 | ||
160 | SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */ | 169 | SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */ |
161 | SVGA_REG_TOP = 46, /* Must be 1 more than the last register */ | 170 | SVGA_REG_GMRS_MAX_PAGES = 46, /* Maximum number of 4KB pages for all GMRs */ |
171 | SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */ | ||
172 | SVGA_REG_TOP = 48, /* Must be 1 more than the last register */ | ||
162 | 173 | ||
163 | SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ | 174 | SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ |
164 | /* Next 768 (== 256*3) registers exist for colormap */ | 175 | /* Next 768 (== 256*3) registers exist for colormap */ |
@@ -370,6 +381,15 @@ struct SVGASignedPoint { | |||
370 | * Note the holes in the bitfield. Missing bits have been deprecated, | 381 | * Note the holes in the bitfield. Missing bits have been deprecated, |
371 | * and must not be reused. Those capabilities will never be reported | 382 | * and must not be reused. Those capabilities will never be reported |
372 | * by new versions of the SVGA device. | 383 | * by new versions of the SVGA device. |
384 | * | ||
385 | * SVGA_CAP_GMR2 -- | ||
386 | * Provides asynchronous commands to define and remap guest memory | ||
387 | * regions. Adds device registers SVGA_REG_GMRS_MAX_PAGES and | ||
388 | * SVGA_REG_MEMORY_SIZE. | ||
389 | * | ||
390 | * SVGA_CAP_SCREEN_OBJECT_2 -- | ||
391 | * Allow screen object support, and require backing stores from the | ||
392 | * guest for each screen object. | ||
373 | */ | 393 | */ |
374 | 394 | ||
375 | #define SVGA_CAP_NONE 0x00000000 | 395 | #define SVGA_CAP_NONE 0x00000000 |
@@ -387,6 +407,8 @@ struct SVGASignedPoint { | |||
387 | #define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000 // Legacy multi-monitor support | 407 | #define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000 // Legacy multi-monitor support |
388 | #define SVGA_CAP_GMR 0x00100000 | 408 | #define SVGA_CAP_GMR 0x00100000 |
389 | #define SVGA_CAP_TRACES 0x00200000 | 409 | #define SVGA_CAP_TRACES 0x00200000 |
410 | #define SVGA_CAP_GMR2 0x00400000 | ||
411 | #define SVGA_CAP_SCREEN_OBJECT_2 0x00800000 | ||
390 | 412 | ||
391 | 413 | ||
392 | /* | 414 | /* |
@@ -885,6 +907,8 @@ typedef enum { | |||
885 | SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38, | 907 | SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38, |
886 | SVGA_CMD_ANNOTATION_FILL = 39, | 908 | SVGA_CMD_ANNOTATION_FILL = 39, |
887 | SVGA_CMD_ANNOTATION_COPY = 40, | 909 | SVGA_CMD_ANNOTATION_COPY = 40, |
910 | SVGA_CMD_DEFINE_GMR2 = 41, | ||
911 | SVGA_CMD_REMAP_GMR2 = 42, | ||
888 | SVGA_CMD_MAX | 912 | SVGA_CMD_MAX |
889 | } SVGAFifoCmdId; | 913 | } SVGAFifoCmdId; |
890 | 914 | ||
@@ -1343,4 +1367,74 @@ struct { | |||
1343 | uint32 srcScreenId; | 1367 | uint32 srcScreenId; |
1344 | } SVGAFifoCmdAnnotationCopy; | 1368 | } SVGAFifoCmdAnnotationCopy; |
1345 | 1369 | ||
1370 | |||
1371 | /* | ||
1372 | * SVGA_CMD_DEFINE_GMR2 -- | ||
1373 | * | ||
1374 | * Define guest memory region v2. See the description of GMRs above. | ||
1375 | * | ||
1376 | * Availability: | ||
1377 | * SVGA_CAP_GMR2 | ||
1378 | */ | ||
1379 | |||
1380 | typedef | ||
1381 | struct { | ||
1382 | uint32 gmrId; | ||
1383 | uint32 numPages; | ||
1384 | } | ||
1385 | SVGAFifoCmdDefineGMR2; | ||
1386 | |||
1387 | |||
1388 | /* | ||
1389 | * SVGA_CMD_REMAP_GMR2 -- | ||
1390 | * | ||
1391 | * Remap guest memory region v2. See the description of GMRs above. | ||
1392 | * | ||
1393 | * This command allows guest to modify a portion of an existing GMR by | ||
1394 | * invalidating it or reassigning it to different guest physical pages. | ||
1395 | * The pages are identified by physical page number (PPN). The pages | ||
1396 | * are assumed to be pinned and valid for DMA operations. | ||
1397 | * | ||
1398 | * Description of command flags: | ||
1399 | * | ||
1400 | * SVGA_REMAP_GMR2_VIA_GMR: If enabled, references a PPN list in a GMR. | ||
1401 | * The PPN list must not overlap with the remap region (this can be | ||
1402 | * handled trivially by referencing a separate GMR). If flag is | ||
1403 | * disabled, PPN list is appended to SVGARemapGMR command. | ||
1404 | * | ||
1405 | * SVGA_REMAP_GMR2_PPN64: If set, PPN list is in PPN64 format, otherwise | ||
1406 | * it is in PPN32 format. | ||
1407 | * | ||
1408 | * SVGA_REMAP_GMR2_SINGLE_PPN: If set, PPN list contains a single entry. | ||
1409 | * A single PPN can be used to invalidate a portion of a GMR or | ||
1410 | * map it to to a single guest scratch page. | ||
1411 | * | ||
1412 | * Availability: | ||
1413 | * SVGA_CAP_GMR2 | ||
1414 | */ | ||
1415 | |||
1416 | typedef enum { | ||
1417 | SVGA_REMAP_GMR2_PPN32 = 0, | ||
1418 | SVGA_REMAP_GMR2_VIA_GMR = (1 << 0), | ||
1419 | SVGA_REMAP_GMR2_PPN64 = (1 << 1), | ||
1420 | SVGA_REMAP_GMR2_SINGLE_PPN = (1 << 2), | ||
1421 | } SVGARemapGMR2Flags; | ||
1422 | |||
1423 | typedef | ||
1424 | struct { | ||
1425 | uint32 gmrId; | ||
1426 | SVGARemapGMR2Flags flags; | ||
1427 | uint32 offsetPages; /* offset in pages to begin remap */ | ||
1428 | uint32 numPages; /* number of pages to remap */ | ||
1429 | /* | ||
1430 | * Followed by additional data depending on SVGARemapGMR2Flags. | ||
1431 | * | ||
1432 | * If flag SVGA_REMAP_GMR2_VIA_GMR is set, single SVGAGuestPtr follows. | ||
1433 | * Otherwise an array of page descriptors in PPN32 or PPN64 format | ||
1434 | * (according to flag SVGA_REMAP_GMR2_PPN64) follows. If flag | ||
1435 | * SVGA_REMAP_GMR2_SINGLE_PPN is set, array contains a single entry. | ||
1436 | */ | ||
1437 | } | ||
1438 | SVGAFifoCmdRemapGMR2; | ||
1439 | |||
1346 | #endif | 1440 | #endif |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 77e77b2b9d80..bff79326c3ec 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -189,6 +189,10 @@ static void vmw_print_capabilities(uint32_t capabilities) | |||
189 | DRM_INFO(" GMR.\n"); | 189 | DRM_INFO(" GMR.\n"); |
190 | if (capabilities & SVGA_CAP_TRACES) | 190 | if (capabilities & SVGA_CAP_TRACES) |
191 | DRM_INFO(" Traces.\n"); | 191 | DRM_INFO(" Traces.\n"); |
192 | if (capabilities & SVGA_CAP_GMR2) | ||
193 | DRM_INFO(" GMR2.\n"); | ||
194 | if (capabilities & SVGA_CAP_SCREEN_OBJECT_2) | ||
195 | DRM_INFO(" Screen Object 2.\n"); | ||
192 | } | 196 | } |
193 | 197 | ||
194 | static int vmw_request_device(struct vmw_private *dev_priv) | 198 | static int vmw_request_device(struct vmw_private *dev_priv) |