Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'vmwgfx-next-4.19-3' of git://people.freedesktop.org/~thomash/linux into drm-next

This introduces a header update and support for multisample surfaces.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/d020efb8-776d-5e8f-9d9f-122591e074d6@vmware.com

+2083 -1020
+171 -59
drivers/gpu/drm/vmwgfx/device_include/svga3d_cmd.h
··· 47 47 * the SVGA3D protocol and remain reserved; they should not be used in the 48 48 * future. 49 49 * 50 - * IDs between 1040 and 1999 (inclusive) are available for use by the 50 + * IDs between 1040 and 2999 (inclusive) are available for use by the 51 51 * current SVGA3D protocol. 52 52 * 53 - * FIFO clients other than SVGA3D should stay below 1000, or at 2000 53 + * FIFO clients other than SVGA3D should stay below 1000, or at 3000 54 54 * and up. 55 55 */ 56 56 ··· 90 90 SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN = 1069, 91 91 SVGA_3D_CMD_SURFACE_DEFINE_V2 = 1070, 92 92 SVGA_3D_CMD_GENERATE_MIPMAPS = 1071, 93 - SVGA_3D_CMD_VIDEO_CREATE_DECODER = 1072, 94 - SVGA_3D_CMD_VIDEO_DESTROY_DECODER = 1073, 95 - SVGA_3D_CMD_VIDEO_CREATE_PROCESSOR = 1074, 96 - SVGA_3D_CMD_VIDEO_DESTROY_PROCESSOR = 1075, 97 - SVGA_3D_CMD_VIDEO_DECODE_START_FRAME = 1076, 98 - SVGA_3D_CMD_VIDEO_DECODE_RENDER = 1077, 99 - SVGA_3D_CMD_VIDEO_DECODE_END_FRAME = 1078, 100 - SVGA_3D_CMD_VIDEO_PROCESS_FRAME = 1079, 93 + SVGA_3D_CMD_DEAD4 = 1072, 94 + SVGA_3D_CMD_DEAD5 = 1073, 95 + SVGA_3D_CMD_DEAD6 = 1074, 96 + SVGA_3D_CMD_DEAD7 = 1075, 97 + SVGA_3D_CMD_DEAD8 = 1076, 98 + SVGA_3D_CMD_DEAD9 = 1077, 99 + SVGA_3D_CMD_DEAD10 = 1078, 100 + SVGA_3D_CMD_DEAD11 = 1079, 101 101 SVGA_3D_CMD_ACTIVATE_SURFACE = 1080, 102 102 SVGA_3D_CMD_DEACTIVATE_SURFACE = 1081, 103 103 SVGA_3D_CMD_SCREEN_DMA = 1082, 104 - SVGA_3D_CMD_SET_UNITY_SURFACE_COOKIE = 1083, 105 - SVGA_3D_CMD_OPEN_CONTEXT_SURFACE = 1084, 104 + SVGA_3D_CMD_DEAD1 = 1083, 105 + SVGA_3D_CMD_DEAD2 = 1084, 106 106 107 107 SVGA_3D_CMD_LOGICOPS_BITBLT = 1085, 108 108 SVGA_3D_CMD_LOGICOPS_TRANSBLT = 1086, ··· 218 218 SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW = 1177, 219 219 SVGA_3D_CMD_DX_PRED_COPY_REGION = 1178, 220 220 SVGA_3D_CMD_DX_PRED_COPY = 1179, 221 - SVGA_3D_CMD_DX_STRETCHBLT = 1180, 221 + SVGA_3D_CMD_DX_PRESENTBLT = 1180, 222 222 SVGA_3D_CMD_DX_GENMIPS = 1181, 223 223 SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE = 1182, 224 224 SVGA_3D_CMD_DX_READBACK_SUBRESOURCE = 1183, ··· 255 255 SVGA_3D_CMD_DX_READBACK_ALL_QUERY = 1214, 256 256 SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER = 1215, 257 257 SVGA_3D_CMD_DX_MOB_FENCE_64 = 1216, 258 - SVGA_3D_CMD_DX_BIND_SHADER_ON_CONTEXT = 1217, 258 + SVGA_3D_CMD_DX_BIND_ALL_SHADER = 1217, 259 259 SVGA_3D_CMD_DX_HINT = 1218, 260 260 SVGA_3D_CMD_DX_BUFFER_UPDATE = 1219, 261 261 SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET = 1220, ··· 263 263 SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET = 1222, 264 264 265 265 /* 266 - * Reserve some IDs to be used for the DX11 shader types. 266 + * Reserve some IDs to be used for the SM5 shader types. 267 267 */ 268 268 SVGA_3D_CMD_DX_RESERVED1 = 1223, 269 269 SVGA_3D_CMD_DX_RESERVED2 = 1224, 270 270 SVGA_3D_CMD_DX_RESERVED3 = 1225, 271 271 272 - SVGA_3D_CMD_DX_MAX = 1226, 273 - SVGA_3D_CMD_MAX = 1226, 272 + SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER = 1226, 273 + SVGA_3D_CMD_DX_MAX = 1227, 274 + 275 + SVGA_3D_CMD_SCREEN_COPY = 1227, 276 + 277 + /* 278 + * Reserve some IDs to be used for video. 279 + */ 280 + SVGA_3D_CMD_VIDEO_RESERVED1 = 1228, 281 + SVGA_3D_CMD_VIDEO_RESERVED2 = 1229, 282 + SVGA_3D_CMD_VIDEO_RESERVED3 = 1230, 283 + SVGA_3D_CMD_VIDEO_RESERVED4 = 1231, 284 + SVGA_3D_CMD_VIDEO_RESERVED5 = 1232, 285 + SVGA_3D_CMD_VIDEO_RESERVED6 = 1233, 286 + SVGA_3D_CMD_VIDEO_RESERVED7 = 1234, 287 + SVGA_3D_CMD_VIDEO_RESERVED8 = 1235, 288 + 289 + SVGA_3D_CMD_GROW_OTABLE = 1236, 290 + SVGA_3D_CMD_DX_GROW_COTABLE = 1237, 291 + SVGA_3D_CMD_INTRA_SURFACE_COPY = 1238, 292 + 293 + SVGA_3D_CMD_DEFINE_GB_SURFACE_V3 = 1239, 294 + 295 + SVGA_3D_CMD_DX_RESOLVE_COPY = 1240, 296 + SVGA_3D_CMD_DX_PRED_RESOLVE_COPY = 1241, 297 + SVGA_3D_CMD_DX_PRED_CONVERT_REGION = 1242, 298 + SVGA_3D_CMD_DX_PRED_CONVERT = 1243, 299 + SVGA_3D_CMD_WHOLE_SURFACE_COPY = 1244, 300 + 301 + SVGA_3D_CMD_MAX = 1245, 274 302 SVGA_3D_CMD_FUTURE_MAX = 3000 275 303 } SVGAFifo3dCmdId; 304 + 305 + #define SVGA_NUM_3D_CMD (SVGA_3D_CMD_MAX - SVGA_3D_CMD_BASE) 276 306 277 307 /* 278 308 * FIFO command format definitions: ··· 332 302 #include "vmware_pack_begin.h" 333 303 struct { 334 304 uint32 sid; 335 - SVGA3dSurfaceFlags surfaceFlags; 305 + SVGA3dSurface1Flags surfaceFlags; 336 306 SVGA3dSurfaceFormat format; 337 307 /* 338 308 * If surfaceFlags has SVGA3D_SURFACE_CUBEMAP bit set, all SVGA3dSurfaceFace ··· 358 328 #include "vmware_pack_begin.h" 359 329 struct { 360 330 uint32 sid; 361 - SVGA3dSurfaceFlags surfaceFlags; 331 + SVGA3dSurface1Flags surfaceFlags; 362 332 SVGA3dSurfaceFormat format; 363 333 /* 364 334 * If surfaceFlags has SVGA3D_SURFACE_CUBEMAP bit set, all SVGA3dSurfaceFace ··· 489 459 } 490 460 #include "vmware_pack_end.h" 491 461 SVGA3dCmdSurfaceCopy; /* SVGA_3D_CMD_SURFACE_COPY */ 462 + 463 + /* 464 + * Perform a surface copy within the same image. 465 + * The src/dest boxes are allowed to overlap. 466 + */ 467 + typedef 468 + #include "vmware_pack_begin.h" 469 + struct { 470 + SVGA3dSurfaceImageId surface; 471 + SVGA3dCopyBox box; 472 + } 473 + #include "vmware_pack_end.h" 474 + SVGA3dCmdIntraSurfaceCopy; /* SVGA_3D_CMD_INTRA_SURFACE_COPY */ 475 + 476 + typedef 477 + #include "vmware_pack_begin.h" 478 + struct { 479 + uint32 srcSid; 480 + uint32 destSid; 481 + } 482 + #include "vmware_pack_end.h" 483 + SVGA3dCmdWholeSurfaceCopy; /* SVGA_3D_CMD_WHOLE_SURFACE_COPY */ 492 484 493 485 typedef 494 486 #include "vmware_pack_begin.h" ··· 824 772 } 825 773 #include "vmware_pack_end.h" 826 774 SVGA3dVertexElement; 775 + 776 + /* 777 + * Should the vertex element respect the stream value? The high bit of the 778 + * stream should be set to indicate that the stream should be respected. If 779 + * the high bit is not set, the stream will be ignored and replaced by the index 780 + * of the position of the currently considered vertex element. 781 + * 782 + * All guests should set this bit and correctly specify the stream going 783 + * forward. 784 + */ 785 + #define SVGA3D_VERTEX_ELEMENT_RESPECT_STREAM (1 << 7) 827 786 828 787 typedef 829 788 #include "vmware_pack_begin.h" ··· 1166 1103 #include "vmware_pack_end.h" 1167 1104 SVGA3dCmdGenerateMipmaps; /* SVGA_3D_CMD_GENERATE_MIPMAPS */ 1168 1105 1169 - 1170 - 1171 1106 typedef 1172 1107 #include "vmware_pack_begin.h" 1173 1108 struct { ··· 1207 1146 } 1208 1147 #include "vmware_pack_end.h" 1209 1148 SVGA3dCmdScreenDMA; /* SVGA_3D_CMD_SCREEN_DMA */ 1210 - 1211 - /* 1212 - * Set Unity Surface Cookie 1213 - * 1214 - * Associates the supplied cookie with the surface id for use with 1215 - * Unity. This cookie is a hint from guest to host, there is no way 1216 - * for the guest to readback the cookie and the host is free to drop 1217 - * the cookie association at will. The default value for the cookie 1218 - * on all surfaces is 0. 1219 - */ 1220 - 1221 - typedef 1222 - #include "vmware_pack_begin.h" 1223 - struct SVGA3dCmdSetUnitySurfaceCookie { 1224 - uint32 sid; 1225 - uint64 cookie; 1226 - } 1227 - #include "vmware_pack_end.h" 1228 - SVGA3dCmdSetUnitySurfaceCookie; /* SVGA_3D_CMD_SET_UNITY_SURFACE_COOKIE */ 1229 - 1230 - /* 1231 - * Open a context-specific surface in a non-context-specific manner. 1232 - */ 1233 - 1234 - typedef 1235 - #include "vmware_pack_begin.h" 1236 - struct SVGA3dCmdOpenContextSurface { 1237 - uint32 sid; 1238 - } 1239 - #include "vmware_pack_end.h" 1240 - SVGA3dCmdOpenContextSurface; /* SVGA_3D_CMD_OPEN_CONTEXT_SURFACE */ 1241 - 1242 1149 1243 1150 /* 1244 1151 * Logic ops ··· 1354 1325 #include "vmware_pack_begin.h" 1355 1326 struct { 1356 1327 SVGA3dSurfaceFormat format; 1357 - SVGA3dSurfaceFlags surfaceFlags; 1328 + SVGA3dSurface1Flags surface1Flags; 1358 1329 uint32 numMipLevels; 1359 1330 uint32 multisampleCount; 1360 1331 SVGA3dTextureFilter autogenFilter; ··· 1362 1333 SVGAMobId mobid; 1363 1334 uint32 arraySize; 1364 1335 uint32 mobPitch; 1365 - uint32 pad[5]; 1336 + SVGA3dSurface2Flags surface2Flags; 1337 + uint8 multisamplePattern; 1338 + uint8 qualityLevel; 1339 + uint8 pad0[2]; 1340 + uint32 pad1[3]; 1366 1341 } 1367 1342 #include "vmware_pack_end.h" 1368 1343 SVGAOTableSurfaceEntry; ··· 1394 1361 SVGAOTableShaderEntry; 1395 1362 #define SVGA3D_OTABLE_SHADER_ENTRY_SIZE (sizeof(SVGAOTableShaderEntry)) 1396 1363 1397 - #define SVGA_STFLAG_PRIMARY (1 << 0) 1364 + #define SVGA_STFLAG_PRIMARY (1 << 0) 1365 + #define SVGA_STFLAG_RESERVED (1 << 1) /* Added with cap SVGA_CAP_HP_CMD_QUEUE */ 1398 1366 typedef uint32 SVGAScreenTargetFlags; 1399 1367 1400 1368 typedef ··· 1563 1529 #include "vmware_pack_end.h" 1564 1530 SVGA3dCmdSetOTableBase64; /* SVGA_3D_CMD_SET_OTABLE_BASE64 */ 1565 1531 1532 + /* 1533 + * Guests using SVGA_3D_CMD_GROW_OTABLE are promising that 1534 + * the new OTable contains the same contents as the old one, except possibly 1535 + * for some new invalid entries at the end. 1536 + * 1537 + * (Otherwise, guests should use one of the SetOTableBase commands.) 1538 + */ 1539 + typedef 1540 + #include "vmware_pack_begin.h" 1541 + struct { 1542 + SVGAOTableType type; 1543 + PPN64 baseAddress; 1544 + uint32 sizeInBytes; 1545 + uint32 validSizeInBytes; 1546 + SVGAMobFormat ptDepth; 1547 + } 1548 + #include "vmware_pack_end.h" 1549 + SVGA3dCmdGrowOTable; /* SVGA_3D_CMD_GROW_OTABLE */ 1550 + 1566 1551 typedef 1567 1552 #include "vmware_pack_begin.h" 1568 1553 struct { ··· 1669 1616 #include "vmware_pack_begin.h" 1670 1617 struct SVGA3dCmdDefineGBSurface { 1671 1618 uint32 sid; 1672 - SVGA3dSurfaceFlags surfaceFlags; 1619 + SVGA3dSurface1Flags surfaceFlags; 1673 1620 SVGA3dSurfaceFormat format; 1674 1621 uint32 numMipLevels; 1675 1622 uint32 multisampleCount; ··· 1678 1625 } 1679 1626 #include "vmware_pack_end.h" 1680 1627 SVGA3dCmdDefineGBSurface; /* SVGA_3D_CMD_DEFINE_GB_SURFACE */ 1628 + 1629 + /* 1630 + * Defines a guest-backed surface, adding the arraySize field. 1631 + */ 1632 + typedef 1633 + #include "vmware_pack_begin.h" 1634 + struct SVGA3dCmdDefineGBSurface_v2 { 1635 + uint32 sid; 1636 + SVGA3dSurface1Flags surfaceFlags; 1637 + SVGA3dSurfaceFormat format; 1638 + uint32 numMipLevels; 1639 + uint32 multisampleCount; 1640 + SVGA3dTextureFilter autogenFilter; 1641 + SVGA3dSize size; 1642 + uint32 arraySize; 1643 + uint32 pad; 1644 + } 1645 + #include "vmware_pack_end.h" 1646 + SVGA3dCmdDefineGBSurface_v2; /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 */ 1647 + 1648 + /* 1649 + * Defines a guest-backed surface, adding the larger flags. 1650 + */ 1651 + typedef 1652 + #include "vmware_pack_begin.h" 1653 + struct SVGA3dCmdDefineGBSurface_v3 { 1654 + uint32 sid; 1655 + SVGA3dSurfaceAllFlags surfaceFlags; 1656 + SVGA3dSurfaceFormat format; 1657 + uint32 numMipLevels; 1658 + uint32 multisampleCount; 1659 + SVGA3dMSPattern multisamplePattern; 1660 + SVGA3dMSQualityLevel qualityLevel; 1661 + SVGA3dTextureFilter autogenFilter; 1662 + SVGA3dSize size; 1663 + uint32 arraySize; 1664 + } 1665 + #include "vmware_pack_end.h" 1666 + SVGA3dCmdDefineGBSurface_v3; /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V3 */ 1681 1667 1682 1668 /* 1683 1669 * Destroy a guest-backed surface. ··· 1765 1673 1766 1674 typedef 1767 1675 #include "vmware_pack_begin.h" 1768 - struct{ 1676 + struct SVGA3dCmdCondBindGBSurface { 1769 1677 uint32 sid; 1770 1678 SVGAMobId testMobid; 1771 1679 SVGAMobId mobid; ··· 2159 2067 uint32 mobOffset; 2160 2068 } 2161 2069 #include "vmware_pack_end.h" 2162 - SVGA3dCmdGBMobFence; /* SVGA_3D_CMD_GB_MOB_FENCE*/ 2070 + SVGA3dCmdGBMobFence; /* SVGA_3D_CMD_GB_MOB_FENCE */ 2071 + 2072 + typedef 2073 + #include "vmware_pack_begin.h" 2074 + struct { 2075 + uint32 stid; 2076 + SVGA3dSurfaceImageId dest; 2077 + 2078 + uint32 statusMobId; 2079 + uint32 statusMobOffset; 2080 + 2081 + /* Reserved fields */ 2082 + uint32 mustBeInvalidId; 2083 + uint32 mustBeZero; 2084 + } 2085 + #include "vmware_pack_end.h" 2086 + SVGA3dCmdScreenCopy; /* SVGA_3D_CMD_SCREEN_COPY */ 2087 + 2088 + #define SVGA_SCREEN_COPY_STATUS_FAILURE 0x00 2089 + #define SVGA_SCREEN_COPY_STATUS_SUCCESS 0x01 2090 + #define SVGA_SCREEN_COPY_STATUS_INVALID 0xFFFFFFFF 2163 2091 2164 2092 #endif /* _SVGA3D_CMD_H_ */
+53 -30
drivers/gpu/drm/vmwgfx/device_include/svga3d_devcaps.h
··· 230 230 SVGA3D_DEVCAP_DEAD2 = 94, 231 231 232 232 /* 233 - * Does the device support the DX commands? 233 + * Does the device support DXContexts? 234 234 */ 235 - SVGA3D_DEVCAP_DX = 95, 235 + SVGA3D_DEVCAP_DXCONTEXT = 95, 236 236 237 237 /* 238 238 * What is the maximum size of a texture array? ··· 242 242 SVGA3D_DEVCAP_MAX_TEXTURE_ARRAY_SIZE = 96, 243 243 244 244 /* 245 - * What is the maximum number of vertex buffers that can 246 - * be used in the DXContext inputAssembly? 245 + * What is the maximum number of vertex buffers or vertex input registers 246 + * that can be expected to work correctly with a DXContext? 247 + * 248 + * The guest is allowed to set up to SVGA3D_DX_MAX_VERTEXBUFFERS, but 249 + * anything in excess of this cap is not guaranteed to render correctly. 250 + * 251 + * Similarly, the guest can set up to SVGA3D_DX_MAX_VERTEXINPUTREGISTERS 252 + * input registers without the SVGA3D_DEVCAP_SM4_1 cap, or 253 + * SVGA3D_DX_SM41_MAX_VERTEXINPUTREGISTERS with the SVGA3D_DEVCAP_SM4_1, 254 + * but only the registers up to this cap value are guaranteed to render 255 + * correctly. 256 + * 257 + * If guest-drivers are able to expose a lower-limit, it's recommended 258 + * that they clamp to this value. Otherwise, the host will make a 259 + * best-effort on case-by-case basis if guests exceed this. 247 260 */ 248 261 SVGA3D_DEVCAP_DX_MAX_VERTEXBUFFERS = 97, 249 262 250 263 /* 251 - * What is the maximum number of constant buffers 252 - * that can be expected to work correctly with a 253 - * DX context? 264 + * What is the maximum number of constant buffers that can be expected to 265 + * work correctly with a DX context? 266 + * 267 + * The guest is allowed to set up to SVGA3D_DX_MAX_CONSTBUFFERS, but 268 + * anything in excess of this cap is not guaranteed to render correctly. 269 + * 270 + * If guest-drivers are able to expose a lower-limit, it's recommended 271 + * that they clamp to this value. Otherwise, the host will make a 272 + * best-effort on case-by-case basis if guests exceed this. 254 273 */ 255 274 SVGA3D_DEVCAP_DX_MAX_CONSTANT_BUFFERS = 98, 256 275 257 276 /* 258 277 * Does the device support provoking vertex control? 259 - * If zero, the first vertex will always be the provoking vertex. 278 + * 279 + * If this cap is present, the provokingVertexLast field in the 280 + * rasterizer state is enabled. (Guests can then set it to FALSE, 281 + * meaning that the first vertex is the provoking vertex, or TRUE, 282 + * meaning that the last verteix is the provoking vertex.) 283 + * 284 + * If this cap is FALSE, then guests should set the provokingVertexLast 285 + * to FALSE, otherwise rendering behavior is undefined. 260 286 */ 261 287 SVGA3D_DEVCAP_DX_PROVOKING_VERTEX = 99, 262 288 ··· 308 282 SVGA3D_DEVCAP_DXFMT_BUMPU8V8 = 119, 309 283 SVGA3D_DEVCAP_DXFMT_BUMPL6V5U5 = 120, 310 284 SVGA3D_DEVCAP_DXFMT_BUMPX8L8V8U8 = 121, 311 - SVGA3D_DEVCAP_DXFMT_BUMPL8V8U8 = 122, 285 + SVGA3D_DEVCAP_DXFMT_FORMAT_DEAD1 = 122, 312 286 SVGA3D_DEVCAP_DXFMT_ARGB_S10E5 = 123, 313 287 SVGA3D_DEVCAP_DXFMT_ARGB_S23E8 = 124, 314 288 SVGA3D_DEVCAP_DXFMT_A2R10G10B10 = 125, ··· 347 321 SVGA3D_DEVCAP_DXFMT_R32G32_SINT = 158, 348 322 SVGA3D_DEVCAP_DXFMT_R32G8X24_TYPELESS = 159, 349 323 SVGA3D_DEVCAP_DXFMT_D32_FLOAT_S8X24_UINT = 160, 350 - SVGA3D_DEVCAP_DXFMT_R32_FLOAT_X8X24_TYPELESS = 161, 351 - SVGA3D_DEVCAP_DXFMT_X32_TYPELESS_G8X24_UINT = 162, 324 + SVGA3D_DEVCAP_DXFMT_R32_FLOAT_X8X24 = 161, 325 + SVGA3D_DEVCAP_DXFMT_X32_G8X24_UINT = 162, 352 326 SVGA3D_DEVCAP_DXFMT_R10G10B10A2_TYPELESS = 163, 353 327 SVGA3D_DEVCAP_DXFMT_R10G10B10A2_UINT = 164, 354 328 SVGA3D_DEVCAP_DXFMT_R11G11B10_FLOAT = 165, ··· 366 340 SVGA3D_DEVCAP_DXFMT_R32_SINT = 177, 367 341 SVGA3D_DEVCAP_DXFMT_R24G8_TYPELESS = 178, 368 342 SVGA3D_DEVCAP_DXFMT_D24_UNORM_S8_UINT = 179, 369 - SVGA3D_DEVCAP_DXFMT_R24_UNORM_X8_TYPELESS = 180, 370 - SVGA3D_DEVCAP_DXFMT_X24_TYPELESS_G8_UINT = 181, 343 + SVGA3D_DEVCAP_DXFMT_R24_UNORM_X8 = 180, 344 + SVGA3D_DEVCAP_DXFMT_X24_G8_UINT = 181, 371 345 SVGA3D_DEVCAP_DXFMT_R8G8_TYPELESS = 182, 372 346 SVGA3D_DEVCAP_DXFMT_R8G8_UNORM = 183, 373 347 SVGA3D_DEVCAP_DXFMT_R8G8_UINT = 184, ··· 431 405 SVGA3D_DEVCAP_DXFMT_BC4_UNORM = 242, 432 406 SVGA3D_DEVCAP_DXFMT_BC5_UNORM = 243, 433 407 408 + /* 409 + * Advertises shaderModel 4.1 support, independent blend-states, 410 + * cube-map arrays, and a higher vertex input registers limit. 411 + * 412 + * (See documentation on SVGA3D_DEVCAP_DX_MAX_VERTEXBUFFERS.) 413 + */ 414 + SVGA3D_DEVCAP_SM41 = 244, 415 + 416 + SVGA3D_DEVCAP_MULTISAMPLE_2X = 245, 417 + SVGA3D_DEVCAP_MULTISAMPLE_4X = 246, 418 + 434 419 SVGA3D_DEVCAP_MAX /* This must be the last index. */ 435 420 } SVGA3dDevCapIndex; 436 421 ··· 457 420 * MIPS: Does the format support mip levels? 458 421 * ARRAY: Does the format support texture arrays? 459 422 * VOLUME: Does the format support having volume? 460 - * MULTISAMPLE_2: Does the format support 2x multisample? 461 - * MULTISAMPLE_4: Does the format support 4x multisample? 462 - * MULTISAMPLE_8: Does the format support 8x multisample? 423 + * MULTISAMPLE: Does the format support multisample? 463 424 */ 464 425 #define SVGA3D_DXFMT_SUPPORTED (1 << 0) 465 426 #define SVGA3D_DXFMT_SHADER_SAMPLE (1 << 1) ··· 468 433 #define SVGA3D_DXFMT_ARRAY (1 << 6) 469 434 #define SVGA3D_DXFMT_VOLUME (1 << 7) 470 435 #define SVGA3D_DXFMT_DX_VERTEX_BUFFER (1 << 8) 471 - #define SVGADX_DXFMT_MULTISAMPLE_2 (1 << 9) 472 - #define SVGADX_DXFMT_MULTISAMPLE_4 (1 << 10) 473 - #define SVGADX_DXFMT_MULTISAMPLE_8 (1 << 11) 474 - #define SVGADX_DXFMT_MAX (1 << 12) 475 - 476 - /* 477 - * Convenience mask for any multisample capability. 478 - * 479 - * The multisample bits imply both load and render capability. 480 - */ 481 - #define SVGA3D_DXFMT_MULTISAMPLE ( \ 482 - SVGADX_DXFMT_MULTISAMPLE_2 | \ 483 - SVGADX_DXFMT_MULTISAMPLE_4 | \ 484 - SVGADX_DXFMT_MULTISAMPLE_8 ) 436 + #define SVGA3D_DXFMT_MULTISAMPLE (1 << 9) 437 + #define SVGA3D_DXFMT_MAX (1 << 10) 485 438 486 439 typedef union { 487 440 Bool b;
+222 -75
drivers/gpu/drm/vmwgfx/device_include/svga3d_dx.h
··· 57 57 #define SVGA3D_RESOURCE_TYPE_MAX 7 58 58 typedef uint32 SVGA3dResourceType; 59 59 60 + #define SVGA3D_COLOR_WRITE_ENABLE_RED (1 << 0) 61 + #define SVGA3D_COLOR_WRITE_ENABLE_GREEN (1 << 1) 62 + #define SVGA3D_COLOR_WRITE_ENABLE_BLUE (1 << 2) 63 + #define SVGA3D_COLOR_WRITE_ENABLE_ALPHA (1 << 3) 64 + #define SVGA3D_COLOR_WRITE_ENABLE_ALL (SVGA3D_COLOR_WRITE_ENABLE_RED | \ 65 + SVGA3D_COLOR_WRITE_ENABLE_GREEN | \ 66 + SVGA3D_COLOR_WRITE_ENABLE_BLUE | \ 67 + SVGA3D_COLOR_WRITE_ENABLE_ALPHA) 68 + typedef uint8 SVGA3dColorWriteEnable; 69 + 60 70 #define SVGA3D_DEPTH_WRITE_MASK_ZERO 0 61 71 #define SVGA3D_DEPTH_WRITE_MASK_ALL 1 62 72 typedef uint8 SVGA3dDepthWriteMask; ··· 99 89 #define SVGA3D_COMPARISON_MAX 9 100 90 typedef uint8 SVGA3dComparisonFunc; 101 91 92 + /* 93 + * SVGA3D_MULTISAMPLE_RAST_DISABLE disables MSAA for all primitives. 94 + * SVGA3D_MULTISAMPLE_RAST_DISABLE_LINE, which is supported in SM41, 95 + * disables MSAA for lines only. 96 + */ 97 + #define SVGA3D_MULTISAMPLE_RAST_DISABLE 0 98 + #define SVGA3D_MULTISAMPLE_RAST_ENABLE 1 99 + #define SVGA3D_MULTISAMPLE_RAST_DX_MAX 1 100 + #define SVGA3D_MULTISAMPLE_RAST_DISABLE_LINE 2 101 + #define SVGA3D_MULTISAMPLE_RAST_MAX 2 102 + typedef uint8 SVGA3dMultisampleRastEnable; 103 + 102 104 #define SVGA3D_DX_MAX_VERTEXBUFFERS 32 105 + #define SVGA3D_DX_MAX_VERTEXINPUTREGISTERS 16 106 + #define SVGA3D_DX_SM41_MAX_VERTEXINPUTREGISTERS 32 103 107 #define SVGA3D_DX_MAX_SOTARGETS 4 104 108 #define SVGA3D_DX_MAX_SRVIEWS 128 105 109 #define SVGA3D_DX_MAX_CONSTBUFFERS 16 106 110 #define SVGA3D_DX_MAX_SAMPLERS 16 107 111 108 - /* Id limits */ 109 - static const uint32 SVGA3dBlendObjectCountPerContext = 4096; 110 - static const uint32 SVGA3dDepthStencilObjectCountPerContext = 4096; 112 + #define SVGA3D_DX_MAX_CONSTBUF_BINDING_SIZE (4096 * 4 * (uint32)sizeof(uint32)) 111 113 112 - typedef uint32 SVGA3dSurfaceId; 113 114 typedef uint32 SVGA3dShaderResourceViewId; 114 115 typedef uint32 SVGA3dRenderTargetViewId; 115 116 typedef uint32 SVGA3dDepthStencilViewId; ··· 213 192 } 214 193 #include "vmware_pack_end.h" 215 194 SVGA3dCmdDXInvalidateContext; /* SVGA_3D_CMD_DX_INVALIDATE_CONTEXT */ 216 - 217 - typedef 218 - #include "vmware_pack_begin.h" 219 - struct SVGA3dReplyFormatData { 220 - uint32 formatSupport; 221 - uint32 msaa2xQualityLevels:5; 222 - uint32 msaa4xQualityLevels:5; 223 - uint32 msaa8xQualityLevels:5; 224 - uint32 msaa16xQualityLevels:5; 225 - uint32 msaa32xQualityLevels:5; 226 - uint32 pad:7; 227 - } 228 - #include "vmware_pack_end.h" 229 - SVGA3dReplyFormatData; 230 195 231 196 typedef 232 197 #include "vmware_pack_begin.h" ··· 632 625 633 626 typedef 634 627 #include "vmware_pack_begin.h" 628 + struct SVGA3dCmdDXPredConvertRegion { 629 + SVGA3dSurfaceId dstSid; 630 + uint32 dstSubResource; 631 + SVGA3dBox destBox; 632 + SVGA3dSurfaceId srcSid; 633 + uint32 srcSubResource; 634 + SVGA3dBox srcBox; 635 + } 636 + #include "vmware_pack_end.h" 637 + SVGA3dCmdDXPredConvertRegion; /* SVGA_3D_CMD_DX_PRED_CONVERT_REGION */ 638 + 639 + typedef 640 + #include "vmware_pack_begin.h" 641 + struct SVGA3dCmdDXPredConvert { 642 + SVGA3dSurfaceId dstSid; 643 + SVGA3dSurfaceId srcSid; 644 + } 645 + #include "vmware_pack_end.h" 646 + SVGA3dCmdDXPredConvert; /* SVGA_3D_CMD_DX_PRED_CONVERT */ 647 + 648 + typedef 649 + #include "vmware_pack_begin.h" 635 650 struct SVGA3dCmdDXBufferCopy { 636 651 SVGA3dSurfaceId dest; 637 652 SVGA3dSurfaceId src; ··· 665 636 SVGA3dCmdDXBufferCopy; 666 637 /* SVGA_3D_CMD_DX_BUFFER_COPY */ 667 638 668 - typedef uint32 SVGA3dDXStretchBltMode; 669 - #define SVGADX_STRETCHBLT_LINEAR (1 << 0) 670 - #define SVGADX_STRETCHBLT_FORCE_SRC_SRGB (1 << 1) 639 + /* 640 + * Perform a surface copy between a multisample, and a non-multisampled 641 + * surface. 642 + */ 643 + typedef 644 + #include "vmware_pack_begin.h" 645 + struct { 646 + SVGA3dSurfaceId dstSid; 647 + uint32 dstSubResource; 648 + SVGA3dSurfaceId srcSid; 649 + uint32 srcSubResource; 650 + SVGA3dSurfaceFormat copyFormat; 651 + } 652 + #include "vmware_pack_end.h" 653 + SVGA3dCmdDXResolveCopy; /* SVGA_3D_CMD_DX_RESOLVE_COPY */ 654 + 655 + /* 656 + * Perform a predicated surface copy between a multisample, and a 657 + * non-multisampled surface. 658 + */ 659 + typedef 660 + #include "vmware_pack_begin.h" 661 + struct { 662 + SVGA3dSurfaceId dstSid; 663 + uint32 dstSubResource; 664 + SVGA3dSurfaceId srcSid; 665 + uint32 srcSubResource; 666 + SVGA3dSurfaceFormat copyFormat; 667 + } 668 + #include "vmware_pack_end.h" 669 + SVGA3dCmdDXPredResolveCopy; /* SVGA_3D_CMD_DX_PRED_RESOLVE_COPY */ 670 + 671 + typedef uint32 SVGA3dDXPresentBltMode; 672 + #define SVGADX_PRESENTBLT_LINEAR (1 << 0) 673 + #define SVGADX_PRESENTBLT_FORCE_SRC_SRGB (1 << 1) 674 + #define SVGADX_PRESENTBLT_FORCE_SRC_XRBIAS (1 << 2) 675 + #define SVGADX_PRESENTBLT_MODE_MAX (1 << 3) 671 676 672 677 typedef 673 678 #include "vmware_pack_begin.h" 674 - struct SVGA3dCmdDXStretchBlt { 679 + struct SVGA3dCmdDXPresentBlt { 675 680 SVGA3dSurfaceId srcSid; 676 681 uint32 srcSubResource; 677 682 SVGA3dSurfaceId dstSid; 678 683 uint32 destSubResource; 679 684 SVGA3dBox boxSrc; 680 685 SVGA3dBox boxDest; 681 - SVGA3dDXStretchBltMode mode; 686 + SVGA3dDXPresentBltMode mode; 682 687 } 683 688 #include "vmware_pack_end.h" 684 - SVGA3dCmdDXStretchBlt; /* SVGA_3D_CMD_DX_STRETCHBLT */ 689 + SVGA3dCmdDXPresentBlt; /* SVGA_3D_CMD_DX_PRESENTBLT*/ 685 690 686 691 typedef 687 692 #include "vmware_pack_begin.h" ··· 724 661 } 725 662 #include "vmware_pack_end.h" 726 663 SVGA3dCmdDXGenMips; /* SVGA_3D_CMD_DX_GENMIPS */ 727 - 728 - /* 729 - * Defines a resource/DX surface. Resources share the surfaceId namespace. 730 - * 731 - */ 732 - typedef 733 - #include "vmware_pack_begin.h" 734 - struct SVGA3dCmdDefineGBSurface_v2 { 735 - uint32 sid; 736 - SVGA3dSurfaceFlags surfaceFlags; 737 - SVGA3dSurfaceFormat format; 738 - uint32 numMipLevels; 739 - uint32 multisampleCount; 740 - SVGA3dTextureFilter autogenFilter; 741 - SVGA3dSize size; 742 - uint32 arraySize; 743 - uint32 pad; 744 - } 745 - #include "vmware_pack_end.h" 746 - SVGA3dCmdDefineGBSurface_v2; /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 */ 747 664 748 665 /* 749 666 * Update a sub-resource in a guest-backed resource. ··· 768 725 769 726 /* 770 727 * Raw byte wise transfer from a buffer surface into another surface 771 - * of the requested box. 728 + * of the requested box. Supported if 3d is enabled and SVGA_CAP_DX 729 + * is set. This command does not take a context. 772 730 */ 773 731 typedef 774 732 #include "vmware_pack_begin.h" ··· 818 774 SVGA3dCmdDXSurfaceCopyAndReadback; 819 775 /* SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK */ 820 776 777 + /* 778 + * SVGA_DX_HINT_NONE: Does nothing. 779 + * 780 + * SVGA_DX_HINT_PREFETCH_OBJECT: 781 + * SVGA_DX_HINT_PREEVICT_OBJECT: 782 + * Consumes a SVGAObjectRef, and hints that the host should consider 783 + * fetching/evicting the specified object. 784 + * 785 + * An id of SVGA3D_INVALID_ID can be used if the guest isn't sure 786 + * what object was affected. (For instance, if the guest knows that 787 + * it is about to evict a DXShader, but doesn't know precisely which one, 788 + * the device can still use this to help limit it's search, or track 789 + * how many page-outs have happened.) 790 + * 791 + * SVGA_DX_HINT_PREFETCH_COBJECT: 792 + * SVGA_DX_HINT_PREEVICT_COBJECT: 793 + * Same as the above, except they consume an SVGACObjectRef. 794 + */ 795 + typedef uint32 SVGADXHintId; 796 + #define SVGA_DX_HINT_NONE 0 797 + #define SVGA_DX_HINT_PREFETCH_OBJECT 1 798 + #define SVGA_DX_HINT_PREEVICT_OBJECT 2 799 + #define SVGA_DX_HINT_PREFETCH_COBJECT 3 800 + #define SVGA_DX_HINT_PREEVICT_COBJECT 4 801 + #define SVGA_DX_HINT_MAX 5 802 + 803 + typedef 804 + #include "vmware_pack_begin.h" 805 + struct SVGAObjectRef { 806 + SVGAOTableType type; 807 + uint32 id; 808 + } 809 + #include "vmware_pack_end.h" 810 + SVGAObjectRef; 811 + 812 + typedef 813 + #include "vmware_pack_begin.h" 814 + struct SVGACObjectRef { 815 + SVGACOTableType type; 816 + uint32 cid; 817 + uint32 id; 818 + } 819 + #include "vmware_pack_end.h" 820 + SVGACObjectRef; 821 + 822 + typedef 823 + #include "vmware_pack_begin.h" 824 + struct SVGA3dCmdDXHint { 825 + SVGADXHintId hintId; 826 + 827 + /* 828 + * Followed by variable sized data depending on the hintId. 829 + */ 830 + } 831 + #include "vmware_pack_end.h" 832 + SVGA3dCmdDXHint; 833 + /* SVGA_3D_CMD_DX_HINT */ 834 + 835 + typedef 836 + #include "vmware_pack_begin.h" 837 + struct SVGA3dCmdDXBufferUpdate { 838 + SVGA3dSurfaceId sid; 839 + uint32 x; 840 + uint32 width; 841 + } 842 + #include "vmware_pack_end.h" 843 + SVGA3dCmdDXBufferUpdate; 844 + /* SVGA_3D_CMD_DX_BUFFER_UPDATE */ 845 + 846 + typedef 847 + #include "vmware_pack_begin.h" 848 + struct SVGA3dCmdDXSetConstantBufferOffset { 849 + uint32 slot; 850 + uint32 offsetInBytes; 851 + } 852 + #include "vmware_pack_end.h" 853 + SVGA3dCmdDXSetConstantBufferOffset; 854 + 855 + typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetVSConstantBufferOffset; 856 + /* SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET */ 857 + 858 + typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetPSConstantBufferOffset; 859 + /* SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET */ 860 + 861 + typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetGSConstantBufferOffset; 862 + /* SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET */ 863 + 821 864 822 865 typedef 823 866 #include "vmware_pack_begin.h" ··· 921 790 uint32 firstArraySlice; 922 791 uint32 mipLevels; 923 792 uint32 arraySize; 924 - } tex; 793 + } tex; /* 1d, 2d, 3d, cube */ 925 794 struct { 926 795 uint32 firstElement; 927 796 uint32 numElements; ··· 976 845 struct { 977 846 uint32 firstElement; 978 847 uint32 numElements; 848 + uint32 padding0; 979 849 } buffer; 980 850 struct { 981 851 uint32 mipSlice; ··· 1097 965 typedef 1098 966 #include "vmware_pack_begin.h" 1099 967 struct { 1100 - /* 1101 - * XXX: How many of these can there be? 1102 - */ 1103 968 uint32 elid; 1104 969 uint32 numDescs; 1105 970 SVGA3dInputElementDesc desc[32]; ··· 1137 1008 uint8 srcBlendAlpha; 1138 1009 uint8 destBlendAlpha; 1139 1010 uint8 blendOpAlpha; 1140 - uint8 renderTargetWriteMask; 1011 + SVGA3dColorWriteEnable renderTargetWriteMask; 1141 1012 uint8 logicOpEnable; 1142 1013 uint8 logicOp; 1143 1014 uint16 pad0; ··· 1255 1126 float slopeScaledDepthBias; 1256 1127 uint8 depthClipEnable; 1257 1128 uint8 scissorEnable; 1258 - uint8 multisampleEnable; 1129 + SVGA3dMultisampleRastEnable multisampleEnable; 1259 1130 uint8 antialiasedLineEnable; 1260 1131 float lineWidth; 1261 1132 uint8 lineStippleEnable; ··· 1282 1153 float slopeScaledDepthBias; 1283 1154 uint8 depthClipEnable; 1284 1155 uint8 scissorEnable; 1285 - uint8 multisampleEnable; 1156 + SVGA3dMultisampleRastEnable multisampleEnable; 1286 1157 uint8 antialiasedLineEnable; 1287 1158 float lineWidth; 1288 1159 uint8 lineStippleEnable; ··· 1352 1223 #include "vmware_pack_end.h" 1353 1224 SVGA3dCmdDXDestroySamplerState; /* SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE */ 1354 1225 1355 - /* 1356 - */ 1357 - typedef 1358 - #include "vmware_pack_begin.h" 1359 - struct SVGA3dSignatureEntry { 1360 - uint8 systemValue; 1361 - uint8 reg; /* register is a reserved word */ 1362 - uint16 mask; 1363 - uint8 registerComponentType; 1364 - uint8 minPrecision; 1365 - uint16 pad0; 1366 - } 1367 - #include "vmware_pack_end.h" 1368 - SVGA3dSignatureEntry; 1369 - 1370 1226 typedef 1371 1227 #include "vmware_pack_begin.h" 1372 1228 struct SVGA3dCmdDXDefineShader { ··· 1369 1255 uint32 sizeInBytes; 1370 1256 uint32 offsetInBytes; 1371 1257 SVGAMobId mobid; 1372 - uint32 numInputSignatureEntries; 1373 - uint32 numOutputSignatureEntries; 1374 - 1375 - uint32 numPatchConstantSignatureEntries; 1376 - 1377 - uint32 pad; 1258 + uint32 pad[4]; 1378 1259 } 1379 1260 #include "vmware_pack_end.h" 1380 1261 SVGACOTableDXShaderEntry; ··· 1392 1283 } 1393 1284 #include "vmware_pack_end.h" 1394 1285 SVGA3dCmdDXBindShader; /* SVGA_3D_CMD_DX_BIND_SHADER */ 1286 + 1287 + typedef 1288 + #include "vmware_pack_begin.h" 1289 + struct SVGA3dCmdDXBindAllShader { 1290 + uint32 cid; 1291 + SVGAMobId mobid; 1292 + } 1293 + #include "vmware_pack_end.h" 1294 + SVGA3dCmdDXBindAllShader; /* SVGA_3D_CMD_DX_BIND_ALL_SHADER */ 1295 + 1296 + typedef 1297 + #include "vmware_pack_begin.h" 1298 + struct SVGA3dCmdDXCondBindAllShader { 1299 + uint32 cid; 1300 + SVGAMobId testMobid; 1301 + SVGAMobId mobid; 1302 + } 1303 + #include "vmware_pack_end.h" 1304 + SVGA3dCmdDXCondBindAllShader; /* SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER */ 1395 1305 1396 1306 /* 1397 1307 * The maximum number of streamout decl's in each streamout entry. ··· 1485 1357 * 1486 1358 * This command allows the guest to bind a mob to a context-object table. 1487 1359 */ 1488 - 1489 1360 typedef 1490 1361 #include "vmware_pack_begin.h" 1491 1362 struct SVGA3dCmdDXSetCOTable { ··· 1495 1368 } 1496 1369 #include "vmware_pack_end.h" 1497 1370 SVGA3dCmdDXSetCOTable; /* SVGA_3D_CMD_DX_SET_COTABLE */ 1371 + 1372 + /* 1373 + * Guests using SVGA_3D_CMD_DX_GROW_COTABLE are promising that 1374 + * the new COTable contains the same contents as the old one, except possibly 1375 + * for some new invalid entries at the end. 1376 + * 1377 + * If there is an old cotable mob bound, it also has to still be valid. 1378 + * 1379 + * (Otherwise, guests should use the DXSetCOTableBase command.) 1380 + */ 1381 + typedef 1382 + #include "vmware_pack_begin.h" 1383 + struct SVGA3dCmdDXGrowCOTable { 1384 + uint32 cid; 1385 + uint32 mobid; 1386 + SVGACOTableType type; 1387 + uint32 validSizeInBytes; 1388 + } 1389 + #include "vmware_pack_end.h" 1390 + SVGA3dCmdDXGrowCOTable; /* SVGA_3D_CMD_DX_GROW_COTABLE */ 1498 1391 1499 1392 typedef 1500 1393 #include "vmware_pack_begin.h" ··· 1619 1472 SVGA3dQueryId queryID[SVGA3D_MAX_QUERY]; 1620 1473 1621 1474 SVGA3dCOTableData cotables[SVGA_COTABLE_MAX]; 1622 - uint32 pad7[381]; 1475 + uint32 pad7[380]; 1623 1476 } 1624 1477 #include "vmware_pack_end.h" 1625 1478 SVGADXContextMobFormat;
+3 -1
drivers/gpu/drm/vmwgfx/device_include/svga3d_limits.h
··· 63 63 * Maximum size in dwords of shader text the SVGA device will allow. 64 64 * Currently 8 MB. 65 65 */ 66 - #define SVGA3D_MAX_SHADER_MEMORY (8 * 1024 * 1024 / sizeof(uint32)) 66 + #define SVGA3D_MAX_SHADER_MEMORY_BYTES (8 * 1024 * 1024) 67 + #define SVGA3D_MAX_SHADER_MEMORY (SVGA3D_MAX_SHADER_MEMORY_BYTES / \ 68 + sizeof(uint32)) 67 69 68 70 #define SVGA3D_MAX_CLIP_PLANES 6 69 71
+681 -511
drivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 + /* 29 + * svga3d_surfacedefs.h -- 30 + * 31 + * Surface definitions and inlineable utilities for SVGA3d. 32 + */ 33 + 34 + #ifndef _SVGA3D_SURFACEDEFS_H_ 35 + #define _SVGA3D_SURFACEDEFS_H_ 36 + 37 + #define INCLUDE_ALLOW_USERLEVEL 38 + #define INCLUDE_ALLOW_MODULE 39 + #include "includeCheck.h" 40 + 28 41 #include <linux/kernel.h> 29 - 30 - #ifdef __KERNEL__ 31 - 32 42 #include <drm/vmwgfx_drm.h> 33 - #define surf_size_struct struct drm_vmw_size 34 - 35 - #else /* __KERNEL__ */ 36 - 37 - #ifndef ARRAY_SIZE 38 - #define ARRAY_SIZE(_A) (sizeof(_A) / sizeof((_A)[0])) 39 - #endif /* ARRAY_SIZE */ 40 - 41 - #define max_t(type, x, y) ((x) > (y) ? (x) : (y)) 42 - #define surf_size_struct SVGA3dSize 43 - #define u32 uint32 44 - 45 - #endif /* __KERNEL__ */ 46 43 47 44 #include "svga3d_reg.h" 48 45 46 + #define surf_size_struct struct drm_vmw_size 47 + 49 48 /* 50 - * enum svga3d_block_desc describes the active data channels in a block. 51 - * 52 - * There can be at-most four active channels in a block: 53 - * 1. Red, bump W, luminance and depth are stored in the first channel. 54 - * 2. Green, bump V and stencil are stored in the second channel. 55 - * 3. Blue and bump U are stored in the third channel. 56 - * 4. Alpha and bump Q are stored in the fourth channel. 57 - * 58 - * Block channels can be used to store compressed and buffer data: 59 - * 1. For compressed formats, only the data channel is used and its size 60 - * is equal to that of a singular block in the compression scheme. 61 - * 2. For buffer formats, only the data channel is used and its size is 62 - * exactly one byte in length. 63 - * 3. In each case the bit depth represent the size of a singular block. 64 - * 65 - * Note: Compressed and IEEE formats do not use the bitMask structure. 49 + * enum svga3d_block_desc - describes generic properties about formats. 66 50 */ 67 - 68 51 enum svga3d_block_desc { 69 - SVGA3DBLOCKDESC_NONE = 0, /* No channels are active */ 70 - SVGA3DBLOCKDESC_BLUE = 1 << 0, /* Block with red channel 71 - data */ 72 - SVGA3DBLOCKDESC_U = 1 << 0, /* Block with bump U channel 73 - data */ 74 - SVGA3DBLOCKDESC_UV_VIDEO = 1 << 7, /* Block with alternating video 75 - U and V */ 76 - SVGA3DBLOCKDESC_GREEN = 1 << 1, /* Block with green channel 77 - data */ 78 - SVGA3DBLOCKDESC_V = 1 << 1, /* Block with bump V channel 79 - data */ 80 - SVGA3DBLOCKDESC_STENCIL = 1 << 1, /* Block with a stencil 81 - channel */ 82 - SVGA3DBLOCKDESC_RED = 1 << 2, /* Block with blue channel 83 - data */ 84 - SVGA3DBLOCKDESC_W = 1 << 2, /* Block with bump W channel 85 - data */ 86 - SVGA3DBLOCKDESC_LUMINANCE = 1 << 2, /* Block with luminance channel 87 - data */ 88 - SVGA3DBLOCKDESC_Y = 1 << 2, /* Block with video luminance 89 - data */ 90 - SVGA3DBLOCKDESC_DEPTH = 1 << 2, /* Block with depth channel */ 91 - SVGA3DBLOCKDESC_ALPHA = 1 << 3, /* Block with an alpha 92 - channel */ 93 - SVGA3DBLOCKDESC_Q = 1 << 3, /* Block with bump Q channel 94 - data */ 95 - SVGA3DBLOCKDESC_BUFFER = 1 << 4, /* Block stores 1 byte of 96 - data */ 97 - SVGA3DBLOCKDESC_COMPRESSED = 1 << 5, /* Block stores n bytes of 98 - data depending on the 99 - compression method used */ 100 - SVGA3DBLOCKDESC_IEEE_FP = 1 << 6, /* Block stores data in an IEEE 101 - floating point 102 - representation in 103 - all channels */ 104 - SVGA3DBLOCKDESC_PLANAR_YUV = 1 << 8, /* Three separate blocks store 105 - data. */ 106 - SVGA3DBLOCKDESC_U_VIDEO = 1 << 9, /* Block with U video data */ 107 - SVGA3DBLOCKDESC_V_VIDEO = 1 << 10, /* Block with V video data */ 108 - SVGA3DBLOCKDESC_EXP = 1 << 11, /* Shared exponent */ 109 - SVGA3DBLOCKDESC_SRGB = 1 << 12, /* Data is in sRGB format */ 110 - SVGA3DBLOCKDESC_2PLANAR_YUV = 1 << 13, /* 2 planes of Y, UV, 111 - e.g., NV12. */ 112 - SVGA3DBLOCKDESC_3PLANAR_YUV = 1 << 14, /* 3 planes of separate 113 - Y, U, V, e.g., YV12. */ 52 + /* Nothing special can be said about this format. */ 53 + SVGA3DBLOCKDESC_NONE = 0, 114 54 115 - SVGA3DBLOCKDESC_RG = SVGA3DBLOCKDESC_RED | 116 - SVGA3DBLOCKDESC_GREEN, 117 - SVGA3DBLOCKDESC_RGB = SVGA3DBLOCKDESC_RG | 118 - SVGA3DBLOCKDESC_BLUE, 119 - SVGA3DBLOCKDESC_RGB_SRGB = SVGA3DBLOCKDESC_RGB | 120 - SVGA3DBLOCKDESC_SRGB, 121 - SVGA3DBLOCKDESC_RGBA = SVGA3DBLOCKDESC_RGB | 122 - SVGA3DBLOCKDESC_ALPHA, 123 - SVGA3DBLOCKDESC_RGBA_SRGB = SVGA3DBLOCKDESC_RGBA | 124 - SVGA3DBLOCKDESC_SRGB, 55 + /* Format contains Blue/U data */ 56 + SVGA3DBLOCKDESC_BLUE = 1 << 0, 57 + SVGA3DBLOCKDESC_W = 1 << 0, 58 + SVGA3DBLOCKDESC_BUMP_L = 1 << 0, 59 + 60 + /* Format contains Green/V data */ 61 + SVGA3DBLOCKDESC_GREEN = 1 << 1, 62 + SVGA3DBLOCKDESC_V = 1 << 1, 63 + 64 + /* Format contains Red/W/Luminance data */ 65 + SVGA3DBLOCKDESC_RED = 1 << 2, 66 + SVGA3DBLOCKDESC_U = 1 << 2, 67 + SVGA3DBLOCKDESC_LUMINANCE = 1 << 2, 68 + 69 + /* Format contains Alpha/Q data */ 70 + SVGA3DBLOCKDESC_ALPHA = 1 << 3, 71 + SVGA3DBLOCKDESC_Q = 1 << 3, 72 + 73 + /* Format is a buffer */ 74 + SVGA3DBLOCKDESC_BUFFER = 1 << 4, 75 + 76 + /* Format is compressed */ 77 + SVGA3DBLOCKDESC_COMPRESSED = 1 << 5, 78 + 79 + /* Format uses IEEE floating point */ 80 + SVGA3DBLOCKDESC_FP = 1 << 6, 81 + 82 + /* Three separate blocks store data. */ 83 + SVGA3DBLOCKDESC_PLANAR_YUV = 1 << 7, 84 + 85 + /* 2 planes of Y, UV, e.g., NV12. */ 86 + SVGA3DBLOCKDESC_2PLANAR_YUV = 1 << 8, 87 + 88 + /* 3 planes of separate Y, U, V, e.g., YV12. */ 89 + SVGA3DBLOCKDESC_3PLANAR_YUV = 1 << 9, 90 + 91 + /* Block with a stencil channel */ 92 + SVGA3DBLOCKDESC_STENCIL = 1 << 11, 93 + 94 + /* Typeless format */ 95 + SVGA3DBLOCKDESC_TYPELESS = 1 << 12, 96 + 97 + /* Channels are signed integers */ 98 + SVGA3DBLOCKDESC_SINT = 1 << 13, 99 + 100 + /* Channels are unsigned integers */ 101 + SVGA3DBLOCKDESC_UINT = 1 << 14, 102 + 103 + /* Channels are normalized (when sampling) */ 104 + SVGA3DBLOCKDESC_NORM = 1 << 15, 105 + 106 + /* Channels are in SRGB */ 107 + SVGA3DBLOCKDESC_SRGB = 1 << 16, 108 + 109 + /* Shared exponent */ 110 + SVGA3DBLOCKDESC_EXP = 1 << 17, 111 + 112 + /* Format contains color data. */ 113 + SVGA3DBLOCKDESC_COLOR = 1 << 18, 114 + /* Format contains depth data. */ 115 + SVGA3DBLOCKDESC_DEPTH = 1 << 19, 116 + /* Format contains bump data. */ 117 + SVGA3DBLOCKDESC_BUMP = 1 << 20, 118 + 119 + /* Format contains YUV video data. */ 120 + SVGA3DBLOCKDESC_YUV_VIDEO = 1 << 21, 121 + 122 + /* For mixed unsigned/signed formats. */ 123 + SVGA3DBLOCKDESC_MIXED = 1 << 22, 124 + 125 + /* For distingushing CxV8U8. */ 126 + SVGA3DBLOCKDESC_CX = 1 << 23, 127 + 128 + /* Different compressed format groups. */ 129 + SVGA3DBLOCKDESC_BC1 = 1 << 24, 130 + SVGA3DBLOCKDESC_BC2 = 1 << 25, 131 + SVGA3DBLOCKDESC_BC3 = 1 << 26, 132 + SVGA3DBLOCKDESC_BC4 = 1 << 27, 133 + SVGA3DBLOCKDESC_BC5 = 1 << 28, 134 + 135 + SVGA3DBLOCKDESC_A_UINT = SVGA3DBLOCKDESC_ALPHA | 136 + SVGA3DBLOCKDESC_UINT | 137 + SVGA3DBLOCKDESC_COLOR, 138 + SVGA3DBLOCKDESC_A_UNORM = SVGA3DBLOCKDESC_A_UINT | 139 + SVGA3DBLOCKDESC_NORM, 140 + SVGA3DBLOCKDESC_R_UINT = SVGA3DBLOCKDESC_RED | 141 + SVGA3DBLOCKDESC_UINT | 142 + SVGA3DBLOCKDESC_COLOR, 143 + SVGA3DBLOCKDESC_R_UNORM = SVGA3DBLOCKDESC_R_UINT | 144 + SVGA3DBLOCKDESC_NORM, 145 + SVGA3DBLOCKDESC_R_SINT = SVGA3DBLOCKDESC_RED | 146 + SVGA3DBLOCKDESC_SINT | 147 + SVGA3DBLOCKDESC_COLOR, 148 + SVGA3DBLOCKDESC_R_SNORM = SVGA3DBLOCKDESC_R_SINT | 149 + SVGA3DBLOCKDESC_NORM, 150 + SVGA3DBLOCKDESC_G_UINT = SVGA3DBLOCKDESC_GREEN | 151 + SVGA3DBLOCKDESC_UINT | 152 + SVGA3DBLOCKDESC_COLOR, 153 + SVGA3DBLOCKDESC_RG_UINT = SVGA3DBLOCKDESC_RED | 154 + SVGA3DBLOCKDESC_GREEN | 155 + SVGA3DBLOCKDESC_UINT | 156 + SVGA3DBLOCKDESC_COLOR, 157 + SVGA3DBLOCKDESC_RG_UNORM = SVGA3DBLOCKDESC_RG_UINT | 158 + SVGA3DBLOCKDESC_NORM, 159 + SVGA3DBLOCKDESC_RG_SINT = SVGA3DBLOCKDESC_RED | 160 + SVGA3DBLOCKDESC_GREEN | 161 + SVGA3DBLOCKDESC_SINT | 162 + SVGA3DBLOCKDESC_COLOR, 163 + SVGA3DBLOCKDESC_RG_SNORM = SVGA3DBLOCKDESC_RG_SINT | 164 + SVGA3DBLOCKDESC_NORM, 165 + SVGA3DBLOCKDESC_RGB_UINT = SVGA3DBLOCKDESC_RED | 166 + SVGA3DBLOCKDESC_GREEN | 167 + SVGA3DBLOCKDESC_BLUE | 168 + SVGA3DBLOCKDESC_UINT | 169 + SVGA3DBLOCKDESC_COLOR, 170 + SVGA3DBLOCKDESC_RGB_SINT = SVGA3DBLOCKDESC_RED | 171 + SVGA3DBLOCKDESC_GREEN | 172 + SVGA3DBLOCKDESC_BLUE | 173 + SVGA3DBLOCKDESC_SINT | 174 + SVGA3DBLOCKDESC_COLOR, 175 + SVGA3DBLOCKDESC_RGB_UNORM = SVGA3DBLOCKDESC_RGB_UINT | 176 + SVGA3DBLOCKDESC_NORM, 177 + SVGA3DBLOCKDESC_RGB_UNORM_SRGB = SVGA3DBLOCKDESC_RGB_UNORM | 178 + SVGA3DBLOCKDESC_SRGB, 179 + SVGA3DBLOCKDESC_RGBA_UINT = SVGA3DBLOCKDESC_RED | 180 + SVGA3DBLOCKDESC_GREEN | 181 + SVGA3DBLOCKDESC_BLUE | 182 + SVGA3DBLOCKDESC_ALPHA | 183 + SVGA3DBLOCKDESC_UINT | 184 + SVGA3DBLOCKDESC_COLOR, 185 + SVGA3DBLOCKDESC_RGBA_UNORM = SVGA3DBLOCKDESC_RGBA_UINT | 186 + SVGA3DBLOCKDESC_NORM, 187 + SVGA3DBLOCKDESC_RGBA_UNORM_SRGB = SVGA3DBLOCKDESC_RGBA_UNORM | 188 + SVGA3DBLOCKDESC_SRGB, 189 + SVGA3DBLOCKDESC_RGBA_SINT = SVGA3DBLOCKDESC_RED | 190 + SVGA3DBLOCKDESC_GREEN | 191 + SVGA3DBLOCKDESC_BLUE | 192 + SVGA3DBLOCKDESC_ALPHA | 193 + SVGA3DBLOCKDESC_SINT | 194 + SVGA3DBLOCKDESC_COLOR, 195 + SVGA3DBLOCKDESC_RGBA_SNORM = SVGA3DBLOCKDESC_RGBA_SINT | 196 + SVGA3DBLOCKDESC_NORM, 197 + SVGA3DBLOCKDESC_RGBA_FP = SVGA3DBLOCKDESC_RED | 198 + SVGA3DBLOCKDESC_GREEN | 199 + SVGA3DBLOCKDESC_BLUE | 200 + SVGA3DBLOCKDESC_ALPHA | 201 + SVGA3DBLOCKDESC_FP | 202 + SVGA3DBLOCKDESC_COLOR, 125 203 SVGA3DBLOCKDESC_UV = SVGA3DBLOCKDESC_U | 126 - SVGA3DBLOCKDESC_V, 204 + SVGA3DBLOCKDESC_V | 205 + SVGA3DBLOCKDESC_BUMP, 127 206 SVGA3DBLOCKDESC_UVL = SVGA3DBLOCKDESC_UV | 128 - SVGA3DBLOCKDESC_LUMINANCE, 207 + SVGA3DBLOCKDESC_BUMP_L | 208 + SVGA3DBLOCKDESC_MIXED | 209 + SVGA3DBLOCKDESC_BUMP, 129 210 SVGA3DBLOCKDESC_UVW = SVGA3DBLOCKDESC_UV | 130 - SVGA3DBLOCKDESC_W, 211 + SVGA3DBLOCKDESC_W | 212 + SVGA3DBLOCKDESC_BUMP, 131 213 SVGA3DBLOCKDESC_UVWA = SVGA3DBLOCKDESC_UVW | 132 - SVGA3DBLOCKDESC_ALPHA, 214 + SVGA3DBLOCKDESC_ALPHA | 215 + SVGA3DBLOCKDESC_MIXED | 216 + SVGA3DBLOCKDESC_BUMP, 133 217 SVGA3DBLOCKDESC_UVWQ = SVGA3DBLOCKDESC_U | 134 - SVGA3DBLOCKDESC_V | 135 - SVGA3DBLOCKDESC_W | 136 - SVGA3DBLOCKDESC_Q, 137 - SVGA3DBLOCKDESC_LA = SVGA3DBLOCKDESC_LUMINANCE | 138 - SVGA3DBLOCKDESC_ALPHA, 218 + SVGA3DBLOCKDESC_V | 219 + SVGA3DBLOCKDESC_W | 220 + SVGA3DBLOCKDESC_Q | 221 + SVGA3DBLOCKDESC_BUMP, 222 + SVGA3DBLOCKDESC_L_UNORM = SVGA3DBLOCKDESC_LUMINANCE | 223 + SVGA3DBLOCKDESC_UINT | 224 + SVGA3DBLOCKDESC_NORM | 225 + SVGA3DBLOCKDESC_COLOR, 226 + SVGA3DBLOCKDESC_LA_UNORM = SVGA3DBLOCKDESC_LUMINANCE | 227 + SVGA3DBLOCKDESC_ALPHA | 228 + SVGA3DBLOCKDESC_UINT | 229 + SVGA3DBLOCKDESC_NORM | 230 + SVGA3DBLOCKDESC_COLOR, 139 231 SVGA3DBLOCKDESC_R_FP = SVGA3DBLOCKDESC_RED | 140 - SVGA3DBLOCKDESC_IEEE_FP, 232 + SVGA3DBLOCKDESC_FP | 233 + SVGA3DBLOCKDESC_COLOR, 141 234 SVGA3DBLOCKDESC_RG_FP = SVGA3DBLOCKDESC_R_FP | 142 - SVGA3DBLOCKDESC_GREEN, 235 + SVGA3DBLOCKDESC_GREEN | 236 + SVGA3DBLOCKDESC_COLOR, 143 237 SVGA3DBLOCKDESC_RGB_FP = SVGA3DBLOCKDESC_RG_FP | 144 - SVGA3DBLOCKDESC_BLUE, 145 - SVGA3DBLOCKDESC_RGBA_FP = SVGA3DBLOCKDESC_RGB_FP | 146 - SVGA3DBLOCKDESC_ALPHA, 147 - SVGA3DBLOCKDESC_DS = SVGA3DBLOCKDESC_DEPTH | 148 - SVGA3DBLOCKDESC_STENCIL, 149 - SVGA3DBLOCKDESC_YUV = SVGA3DBLOCKDESC_UV_VIDEO | 150 - SVGA3DBLOCKDESC_Y, 238 + SVGA3DBLOCKDESC_BLUE | 239 + SVGA3DBLOCKDESC_COLOR, 240 + SVGA3DBLOCKDESC_YUV = SVGA3DBLOCKDESC_YUV_VIDEO | 241 + SVGA3DBLOCKDESC_COLOR, 151 242 SVGA3DBLOCKDESC_AYUV = SVGA3DBLOCKDESC_ALPHA | 152 - SVGA3DBLOCKDESC_Y | 153 - SVGA3DBLOCKDESC_U_VIDEO | 154 - SVGA3DBLOCKDESC_V_VIDEO, 155 - SVGA3DBLOCKDESC_RGBE = SVGA3DBLOCKDESC_RGB | 156 - SVGA3DBLOCKDESC_EXP, 157 - SVGA3DBLOCKDESC_COMPRESSED_SRGB = SVGA3DBLOCKDESC_COMPRESSED | 158 - SVGA3DBLOCKDESC_SRGB, 159 - SVGA3DBLOCKDESC_NV12 = SVGA3DBLOCKDESC_PLANAR_YUV | 160 - SVGA3DBLOCKDESC_2PLANAR_YUV, 161 - SVGA3DBLOCKDESC_YV12 = SVGA3DBLOCKDESC_PLANAR_YUV | 162 - SVGA3DBLOCKDESC_3PLANAR_YUV, 243 + SVGA3DBLOCKDESC_YUV_VIDEO | 244 + SVGA3DBLOCKDESC_COLOR, 245 + SVGA3DBLOCKDESC_RGB_EXP = SVGA3DBLOCKDESC_RED | 246 + SVGA3DBLOCKDESC_GREEN | 247 + SVGA3DBLOCKDESC_BLUE | 248 + SVGA3DBLOCKDESC_EXP | 249 + SVGA3DBLOCKDESC_COLOR, 250 + 251 + SVGA3DBLOCKDESC_COMP_TYPELESS = SVGA3DBLOCKDESC_COMPRESSED | 252 + SVGA3DBLOCKDESC_TYPELESS, 253 + SVGA3DBLOCKDESC_COMP_UNORM = SVGA3DBLOCKDESC_COMPRESSED | 254 + SVGA3DBLOCKDESC_UINT | 255 + SVGA3DBLOCKDESC_NORM | 256 + SVGA3DBLOCKDESC_COLOR, 257 + SVGA3DBLOCKDESC_COMP_SNORM = SVGA3DBLOCKDESC_COMPRESSED | 258 + SVGA3DBLOCKDESC_SINT | 259 + SVGA3DBLOCKDESC_NORM | 260 + SVGA3DBLOCKDESC_COLOR, 261 + SVGA3DBLOCKDESC_COMP_UNORM_SRGB = SVGA3DBLOCKDESC_COMP_UNORM | 262 + SVGA3DBLOCKDESC_SRGB, 263 + SVGA3DBLOCKDESC_BC1_COMP_TYPELESS = SVGA3DBLOCKDESC_BC1 | 264 + SVGA3DBLOCKDESC_COMP_TYPELESS, 265 + SVGA3DBLOCKDESC_BC1_COMP_UNORM = SVGA3DBLOCKDESC_BC1 | 266 + SVGA3DBLOCKDESC_COMP_UNORM, 267 + SVGA3DBLOCKDESC_BC1_COMP_UNORM_SRGB = SVGA3DBLOCKDESC_BC1_COMP_UNORM | 268 + SVGA3DBLOCKDESC_SRGB, 269 + SVGA3DBLOCKDESC_BC2_COMP_TYPELESS = SVGA3DBLOCKDESC_BC2 | 270 + SVGA3DBLOCKDESC_COMP_TYPELESS, 271 + SVGA3DBLOCKDESC_BC2_COMP_UNORM = SVGA3DBLOCKDESC_BC2 | 272 + SVGA3DBLOCKDESC_COMP_UNORM, 273 + SVGA3DBLOCKDESC_BC2_COMP_UNORM_SRGB = SVGA3DBLOCKDESC_BC2_COMP_UNORM | 274 + SVGA3DBLOCKDESC_SRGB, 275 + SVGA3DBLOCKDESC_BC3_COMP_TYPELESS = SVGA3DBLOCKDESC_BC3 | 276 + SVGA3DBLOCKDESC_COMP_TYPELESS, 277 + SVGA3DBLOCKDESC_BC3_COMP_UNORM = SVGA3DBLOCKDESC_BC3 | 278 + SVGA3DBLOCKDESC_COMP_UNORM, 279 + SVGA3DBLOCKDESC_BC3_COMP_UNORM_SRGB = SVGA3DBLOCKDESC_BC3_COMP_UNORM | 280 + SVGA3DBLOCKDESC_SRGB, 281 + SVGA3DBLOCKDESC_BC4_COMP_TYPELESS = SVGA3DBLOCKDESC_BC4 | 282 + SVGA3DBLOCKDESC_COMP_TYPELESS, 283 + SVGA3DBLOCKDESC_BC4_COMP_UNORM = SVGA3DBLOCKDESC_BC4 | 284 + SVGA3DBLOCKDESC_COMP_UNORM, 285 + SVGA3DBLOCKDESC_BC4_COMP_SNORM = SVGA3DBLOCKDESC_BC4 | 286 + SVGA3DBLOCKDESC_COMP_SNORM, 287 + SVGA3DBLOCKDESC_BC5_COMP_TYPELESS = SVGA3DBLOCKDESC_BC5 | 288 + SVGA3DBLOCKDESC_COMP_TYPELESS, 289 + SVGA3DBLOCKDESC_BC5_COMP_UNORM = SVGA3DBLOCKDESC_BC5 | 290 + SVGA3DBLOCKDESC_COMP_UNORM, 291 + SVGA3DBLOCKDESC_BC5_COMP_SNORM = SVGA3DBLOCKDESC_BC5 | 292 + SVGA3DBLOCKDESC_COMP_SNORM, 293 + 294 + SVGA3DBLOCKDESC_NV12 = SVGA3DBLOCKDESC_YUV_VIDEO | 295 + SVGA3DBLOCKDESC_PLANAR_YUV | 296 + SVGA3DBLOCKDESC_2PLANAR_YUV | 297 + SVGA3DBLOCKDESC_COLOR, 298 + SVGA3DBLOCKDESC_YV12 = SVGA3DBLOCKDESC_YUV_VIDEO | 299 + SVGA3DBLOCKDESC_PLANAR_YUV | 300 + SVGA3DBLOCKDESC_3PLANAR_YUV | 301 + SVGA3DBLOCKDESC_COLOR, 302 + 303 + SVGA3DBLOCKDESC_DEPTH_UINT = SVGA3DBLOCKDESC_DEPTH | 304 + SVGA3DBLOCKDESC_UINT, 305 + SVGA3DBLOCKDESC_DEPTH_UNORM = SVGA3DBLOCKDESC_DEPTH_UINT | 306 + SVGA3DBLOCKDESC_NORM, 307 + SVGA3DBLOCKDESC_DS = SVGA3DBLOCKDESC_DEPTH | 308 + SVGA3DBLOCKDESC_STENCIL, 309 + SVGA3DBLOCKDESC_DS_UINT = SVGA3DBLOCKDESC_DEPTH | 310 + SVGA3DBLOCKDESC_STENCIL | 311 + SVGA3DBLOCKDESC_UINT, 312 + SVGA3DBLOCKDESC_DS_UNORM = SVGA3DBLOCKDESC_DS_UINT | 313 + SVGA3DBLOCKDESC_NORM, 314 + SVGA3DBLOCKDESC_DEPTH_FP = SVGA3DBLOCKDESC_DEPTH | 315 + SVGA3DBLOCKDESC_FP, 316 + 317 + SVGA3DBLOCKDESC_UV_UINT = SVGA3DBLOCKDESC_UV | 318 + SVGA3DBLOCKDESC_UINT, 319 + SVGA3DBLOCKDESC_UV_SNORM = SVGA3DBLOCKDESC_UV | 320 + SVGA3DBLOCKDESC_SINT | 321 + SVGA3DBLOCKDESC_NORM, 322 + SVGA3DBLOCKDESC_UVCX_SNORM = SVGA3DBLOCKDESC_UV_SNORM | 323 + SVGA3DBLOCKDESC_CX, 324 + SVGA3DBLOCKDESC_UVWQ_SNORM = SVGA3DBLOCKDESC_UVWQ | 325 + SVGA3DBLOCKDESC_SINT | 326 + SVGA3DBLOCKDESC_NORM, 163 327 }; 164 328 165 - /* 166 - * SVGA3dSurfaceDesc describes the actual pixel data. 167 - * 168 - * This structure provides the following information: 169 - * 1. Block description. 170 - * 2. Dimensions of a block in the surface. 171 - * 3. Size of block in bytes. 172 - * 4. Bit depth of the pixel data. 173 - * 5. Channel bit depths and masks (if applicable). 174 - */ 175 329 struct svga3d_channel_def { 176 330 union { 177 331 u8 blue; 178 - u8 u; 332 + u8 w_bump; 333 + u8 l_bump; 179 334 u8 uv_video; 180 335 u8 u_video; 181 336 }; 182 337 union { 183 338 u8 green; 184 - u8 v; 185 339 u8 stencil; 340 + u8 v_bump; 186 341 u8 v_video; 187 342 }; 188 343 union { 189 344 u8 red; 190 - u8 w; 345 + u8 u_bump; 191 346 u8 luminance; 192 - u8 y; 347 + u8 y_video; 193 348 u8 depth; 194 349 u8 data; 195 350 }; 196 351 union { 197 352 u8 alpha; 198 - u8 q; 353 + u8 q_bump; 199 354 u8 exp; 200 355 }; 201 356 }; 202 357 358 + /* 359 + * struct svga3d_surface_desc - describes the actual pixel data. 360 + * 361 + * @format: Format 362 + * @block_desc: Block description 363 + * @block_size: Dimensions in pixels of a block 364 + * @bytes_per_block: Size of block in bytes 365 + * @pitch_bytes_per_block: Size of a block in bytes for purposes of pitch 366 + * @bit_depth: Channel bit depths 367 + * @bit_offset: Channel bit masks (in bits offset from the start of the pointer) 368 + */ 203 369 struct svga3d_surface_desc { 204 370 SVGA3dSurfaceFormat format; 205 371 enum svga3d_block_desc block_desc; 372 + 206 373 surf_size_struct block_size; 207 374 u32 bytes_per_block; 208 375 u32 pitch_bytes_per_block; 209 376 210 - u32 total_bit_depth; 211 377 struct svga3d_channel_def bit_depth; 212 378 struct svga3d_channel_def bit_offset; 213 379 }; ··· 381 215 static const struct svga3d_surface_desc svga3d_surface_descs[] = { 382 216 {SVGA3D_FORMAT_INVALID, SVGA3DBLOCKDESC_NONE, 383 217 {1, 1, 1}, 0, 0, 384 - 0, {{0}, {0}, {0}, {0}}, 218 + {{0}, {0}, {0}, {0}}, 385 219 {{0}, {0}, {0}, {0}}}, 386 220 387 - {SVGA3D_X8R8G8B8, SVGA3DBLOCKDESC_RGB, 221 + {SVGA3D_X8R8G8B8, SVGA3DBLOCKDESC_RGB_UNORM, 388 222 {1, 1, 1}, 4, 4, 389 - 24, {{8}, {8}, {8}, {0}}, 223 + {{8}, {8}, {8}, {0}}, 390 224 {{0}, {8}, {16}, {24}}}, 391 225 392 - {SVGA3D_A8R8G8B8, SVGA3DBLOCKDESC_RGBA, 226 + {SVGA3D_A8R8G8B8, SVGA3DBLOCKDESC_RGBA_UNORM, 393 227 {1, 1, 1}, 4, 4, 394 - 32, {{8}, {8}, {8}, {8}}, 228 + {{8}, {8}, {8}, {8}}, 395 229 {{0}, {8}, {16}, {24}}}, 396 230 397 - {SVGA3D_R5G6B5, SVGA3DBLOCKDESC_RGB, 231 + {SVGA3D_R5G6B5, SVGA3DBLOCKDESC_RGB_UNORM, 398 232 {1, 1, 1}, 2, 2, 399 - 16, {{5}, {6}, {5}, {0}}, 233 + {{5}, {6}, {5}, {0}}, 400 234 {{0}, {5}, {11}, {0}}}, 401 235 402 - {SVGA3D_X1R5G5B5, SVGA3DBLOCKDESC_RGB, 236 + {SVGA3D_X1R5G5B5, SVGA3DBLOCKDESC_RGB_UNORM, 403 237 {1, 1, 1}, 2, 2, 404 - 15, {{5}, {5}, {5}, {0}}, 238 + {{5}, {5}, {5}, {0}}, 405 239 {{0}, {5}, {10}, {0}}}, 406 240 407 - {SVGA3D_A1R5G5B5, SVGA3DBLOCKDESC_RGBA, 241 + {SVGA3D_A1R5G5B5, SVGA3DBLOCKDESC_RGBA_UNORM, 408 242 {1, 1, 1}, 2, 2, 409 - 16, {{5}, {5}, {5}, {1}}, 243 + {{5}, {5}, {5}, {1}}, 410 244 {{0}, {5}, {10}, {15}}}, 411 245 412 - {SVGA3D_A4R4G4B4, SVGA3DBLOCKDESC_RGBA, 246 + {SVGA3D_A4R4G4B4, SVGA3DBLOCKDESC_RGBA_UNORM, 413 247 {1, 1, 1}, 2, 2, 414 - 16, {{4}, {4}, {4}, {4}}, 248 + {{4}, {4}, {4}, {4}}, 415 249 {{0}, {4}, {8}, {12}}}, 416 250 417 - {SVGA3D_Z_D32, SVGA3DBLOCKDESC_DEPTH, 251 + {SVGA3D_Z_D32, SVGA3DBLOCKDESC_DEPTH_UNORM, 418 252 {1, 1, 1}, 4, 4, 419 - 32, {{0}, {0}, {32}, {0}}, 253 + {{0}, {0}, {32}, {0}}, 420 254 {{0}, {0}, {0}, {0}}}, 421 255 422 - {SVGA3D_Z_D16, SVGA3DBLOCKDESC_DEPTH, 256 + {SVGA3D_Z_D16, SVGA3DBLOCKDESC_DEPTH_UNORM, 423 257 {1, 1, 1}, 2, 2, 424 - 16, {{0}, {0}, {16}, {0}}, 258 + {{0}, {0}, {16}, {0}}, 425 259 {{0}, {0}, {0}, {0}}}, 426 260 427 - {SVGA3D_Z_D24S8, SVGA3DBLOCKDESC_DS, 261 + {SVGA3D_Z_D24S8, SVGA3DBLOCKDESC_DS_UNORM, 428 262 {1, 1, 1}, 4, 4, 429 - 32, {{0}, {8}, {24}, {0}}, 430 - {{0}, {24}, {0}, {0}}}, 263 + {{0}, {8}, {24}, {0}}, 264 + {{0}, {0}, {8}, {0}}}, 431 265 432 - {SVGA3D_Z_D15S1, SVGA3DBLOCKDESC_DS, 266 + {SVGA3D_Z_D15S1, SVGA3DBLOCKDESC_DS_UNORM, 433 267 {1, 1, 1}, 2, 2, 434 - 16, {{0}, {1}, {15}, {0}}, 435 - {{0}, {15}, {0}, {0}}}, 268 + {{0}, {1}, {15}, {0}}, 269 + {{0}, {0}, {1}, {0}}}, 436 270 437 - {SVGA3D_LUMINANCE8, SVGA3DBLOCKDESC_LUMINANCE, 271 + {SVGA3D_LUMINANCE8, SVGA3DBLOCKDESC_L_UNORM, 438 272 {1, 1, 1}, 1, 1, 439 - 8, {{0}, {0}, {8}, {0}}, 273 + {{0}, {0}, {8}, {0}}, 440 274 {{0}, {0}, {0}, {0}}}, 441 275 442 - {SVGA3D_LUMINANCE4_ALPHA4, SVGA3DBLOCKDESC_LA, 443 - {1 , 1, 1}, 1, 1, 444 - 8, {{0}, {0}, {4}, {4}}, 276 + {SVGA3D_LUMINANCE4_ALPHA4, SVGA3DBLOCKDESC_LA_UNORM, 277 + {1, 1, 1}, 1, 1, 278 + {{0}, {0}, {4}, {4}}, 445 279 {{0}, {0}, {0}, {4}}}, 446 280 447 - {SVGA3D_LUMINANCE16, SVGA3DBLOCKDESC_LUMINANCE, 281 + {SVGA3D_LUMINANCE16, SVGA3DBLOCKDESC_L_UNORM, 448 282 {1, 1, 1}, 2, 2, 449 - 16, {{0}, {0}, {16}, {0}}, 283 + {{0}, {0}, {16}, {0}}, 450 284 {{0}, {0}, {0}, {0}}}, 451 285 452 - {SVGA3D_LUMINANCE8_ALPHA8, SVGA3DBLOCKDESC_LA, 286 + {SVGA3D_LUMINANCE8_ALPHA8, SVGA3DBLOCKDESC_LA_UNORM, 453 287 {1, 1, 1}, 2, 2, 454 - 16, {{0}, {0}, {8}, {8}}, 288 + {{0}, {0}, {8}, {8}}, 455 289 {{0}, {0}, {0}, {8}}}, 456 290 457 - {SVGA3D_DXT1, SVGA3DBLOCKDESC_COMPRESSED, 291 + {SVGA3D_DXT1, SVGA3DBLOCKDESC_BC1_COMP_UNORM, 458 292 {4, 4, 1}, 8, 8, 459 - 64, {{0}, {0}, {64}, {0}}, 293 + {{0}, {0}, {64}, {0}}, 460 294 {{0}, {0}, {0}, {0}}}, 461 295 462 - {SVGA3D_DXT2, SVGA3DBLOCKDESC_COMPRESSED, 296 + {SVGA3D_DXT2, SVGA3DBLOCKDESC_BC2_COMP_UNORM, 463 297 {4, 4, 1}, 16, 16, 464 - 128, {{0}, {0}, {128}, {0}}, 298 + {{0}, {0}, {128}, {0}}, 465 299 {{0}, {0}, {0}, {0}}}, 466 300 467 - {SVGA3D_DXT3, SVGA3DBLOCKDESC_COMPRESSED, 301 + {SVGA3D_DXT3, SVGA3DBLOCKDESC_BC2_COMP_UNORM, 468 302 {4, 4, 1}, 16, 16, 469 - 128, {{0}, {0}, {128}, {0}}, 303 + {{0}, {0}, {128}, {0}}, 470 304 {{0}, {0}, {0}, {0}}}, 471 305 472 - {SVGA3D_DXT4, SVGA3DBLOCKDESC_COMPRESSED, 306 + {SVGA3D_DXT4, SVGA3DBLOCKDESC_BC3_COMP_UNORM, 473 307 {4, 4, 1}, 16, 16, 474 - 128, {{0}, {0}, {128}, {0}}, 308 + {{0}, {0}, {128}, {0}}, 475 309 {{0}, {0}, {0}, {0}}}, 476 310 477 - {SVGA3D_DXT5, SVGA3DBLOCKDESC_COMPRESSED, 311 + {SVGA3D_DXT5, SVGA3DBLOCKDESC_BC3_COMP_UNORM, 478 312 {4, 4, 1}, 16, 16, 479 - 128, {{0}, {0}, {128}, {0}}, 313 + {{0}, {0}, {128}, {0}}, 480 314 {{0}, {0}, {0}, {0}}}, 481 315 482 - {SVGA3D_BUMPU8V8, SVGA3DBLOCKDESC_UV, 316 + {SVGA3D_BUMPU8V8, SVGA3DBLOCKDESC_UV_SNORM, 483 317 {1, 1, 1}, 2, 2, 484 - 16, {{0}, {0}, {8}, {8}}, 485 - {{0}, {0}, {0}, {8}}}, 318 + {{0}, {8}, {8}, {0}}, 319 + {{0}, {8}, {0}, {0}}}, 486 320 487 321 {SVGA3D_BUMPL6V5U5, SVGA3DBLOCKDESC_UVL, 488 322 {1, 1, 1}, 2, 2, 489 - 16, {{5}, {5}, {6}, {0}}, 490 - {{11}, {6}, {0}, {0}}}, 323 + {{6}, {5}, {5}, {0}}, 324 + {{10}, {5}, {0}, {0}}}, 491 325 492 326 {SVGA3D_BUMPX8L8V8U8, SVGA3DBLOCKDESC_UVL, 493 327 {1, 1, 1}, 4, 4, 494 - 32, {{8}, {8}, {8}, {0}}, 328 + {{8}, {8}, {8}, {0}}, 495 329 {{16}, {8}, {0}, {0}}}, 496 330 497 - {SVGA3D_BUMPL8V8U8, SVGA3DBLOCKDESC_UVL, 331 + {SVGA3D_FORMAT_DEAD1, SVGA3DBLOCKDESC_UVL, 498 332 {1, 1, 1}, 3, 3, 499 - 24, {{8}, {8}, {8}, {0}}, 333 + {{8}, {8}, {8}, {0}}, 500 334 {{16}, {8}, {0}, {0}}}, 501 335 502 336 {SVGA3D_ARGB_S10E5, SVGA3DBLOCKDESC_RGBA_FP, 503 337 {1, 1, 1}, 8, 8, 504 - 64, {{16}, {16}, {16}, {16}}, 338 + {{16}, {16}, {16}, {16}}, 505 339 {{32}, {16}, {0}, {48}}}, 506 340 507 341 {SVGA3D_ARGB_S23E8, SVGA3DBLOCKDESC_RGBA_FP, 508 342 {1, 1, 1}, 16, 16, 509 - 128, {{32}, {32}, {32}, {32}}, 343 + {{32}, {32}, {32}, {32}}, 510 344 {{64}, {32}, {0}, {96}}}, 511 345 512 - {SVGA3D_A2R10G10B10, SVGA3DBLOCKDESC_RGBA, 346 + {SVGA3D_A2R10G10B10, SVGA3DBLOCKDESC_RGBA_UNORM, 513 347 {1, 1, 1}, 4, 4, 514 - 32, {{10}, {10}, {10}, {2}}, 348 + {{10}, {10}, {10}, {2}}, 515 349 {{0}, {10}, {20}, {30}}}, 516 350 517 - {SVGA3D_V8U8, SVGA3DBLOCKDESC_UV, 351 + {SVGA3D_V8U8, SVGA3DBLOCKDESC_UV_SNORM, 518 352 {1, 1, 1}, 2, 2, 519 - 16, {{8}, {8}, {0}, {0}}, 520 - {{8}, {0}, {0}, {0}}}, 353 + {{0}, {8}, {8}, {0}}, 354 + {{0}, {8}, {0}, {0}}}, 521 355 522 - {SVGA3D_Q8W8V8U8, SVGA3DBLOCKDESC_UVWQ, 356 + {SVGA3D_Q8W8V8U8, SVGA3DBLOCKDESC_UVWQ_SNORM, 523 357 {1, 1, 1}, 4, 4, 524 - 32, {{8}, {8}, {8}, {8}}, 525 - {{24}, {16}, {8}, {0}}}, 358 + {{8}, {8}, {8}, {8}}, 359 + {{16}, {8}, {0}, {24}}}, 526 360 527 - {SVGA3D_CxV8U8, SVGA3DBLOCKDESC_UV, 361 + {SVGA3D_CxV8U8, SVGA3DBLOCKDESC_UVCX_SNORM, 528 362 {1, 1, 1}, 2, 2, 529 - 16, {{8}, {8}, {0}, {0}}, 530 - {{8}, {0}, {0}, {0}}}, 363 + {{0}, {8}, {8}, {0}}, 364 + {{0}, {8}, {0}, {0}}}, 531 365 532 366 {SVGA3D_X8L8V8U8, SVGA3DBLOCKDESC_UVL, 533 367 {1, 1, 1}, 4, 4, 534 - 24, {{8}, {8}, {8}, {0}}, 368 + {{8}, {8}, {8}, {0}}, 535 369 {{16}, {8}, {0}, {0}}}, 536 370 537 371 {SVGA3D_A2W10V10U10, SVGA3DBLOCKDESC_UVWA, 538 372 {1, 1, 1}, 4, 4, 539 - 32, {{10}, {10}, {10}, {2}}, 540 - {{0}, {10}, {20}, {30}}}, 373 + {{10}, {10}, {10}, {2}}, 374 + {{20}, {10}, {0}, {30}}}, 541 375 542 - {SVGA3D_ALPHA8, SVGA3DBLOCKDESC_ALPHA, 376 + {SVGA3D_ALPHA8, SVGA3DBLOCKDESC_A_UNORM, 543 377 {1, 1, 1}, 1, 1, 544 - 8, {{0}, {0}, {0}, {8}}, 378 + {{0}, {0}, {0}, {8}}, 545 379 {{0}, {0}, {0}, {0}}}, 546 380 547 381 {SVGA3D_R_S10E5, SVGA3DBLOCKDESC_R_FP, 548 382 {1, 1, 1}, 2, 2, 549 - 16, {{0}, {0}, {16}, {0}}, 383 + {{0}, {0}, {16}, {0}}, 550 384 {{0}, {0}, {0}, {0}}}, 551 385 552 386 {SVGA3D_R_S23E8, SVGA3DBLOCKDESC_R_FP, 553 387 {1, 1, 1}, 4, 4, 554 - 32, {{0}, {0}, {32}, {0}}, 388 + {{0}, {0}, {32}, {0}}, 555 389 {{0}, {0}, {0}, {0}}}, 556 390 557 391 {SVGA3D_RG_S10E5, SVGA3DBLOCKDESC_RG_FP, 558 392 {1, 1, 1}, 4, 4, 559 - 32, {{0}, {16}, {16}, {0}}, 393 + {{0}, {16}, {16}, {0}}, 560 394 {{0}, {16}, {0}, {0}}}, 561 395 562 396 {SVGA3D_RG_S23E8, SVGA3DBLOCKDESC_RG_FP, 563 397 {1, 1, 1}, 8, 8, 564 - 64, {{0}, {32}, {32}, {0}}, 398 + {{0}, {32}, {32}, {0}}, 565 399 {{0}, {32}, {0}, {0}}}, 566 400 567 401 {SVGA3D_BUFFER, SVGA3DBLOCKDESC_BUFFER, 568 402 {1, 1, 1}, 1, 1, 569 - 8, {{0}, {0}, {8}, {0}}, 403 + {{0}, {0}, {8}, {0}}, 570 404 {{0}, {0}, {0}, {0}}}, 571 405 572 - {SVGA3D_Z_D24X8, SVGA3DBLOCKDESC_DEPTH, 406 + {SVGA3D_Z_D24X8, SVGA3DBLOCKDESC_DEPTH_UNORM, 573 407 {1, 1, 1}, 4, 4, 574 - 32, {{0}, {0}, {24}, {0}}, 575 - {{0}, {24}, {0}, {0}}}, 408 + {{0}, {0}, {24}, {0}}, 409 + {{0}, {0}, {8}, {0}}}, 576 410 577 - {SVGA3D_V16U16, SVGA3DBLOCKDESC_UV, 411 + {SVGA3D_V16U16, SVGA3DBLOCKDESC_UV_SNORM, 578 412 {1, 1, 1}, 4, 4, 579 - 32, {{16}, {16}, {0}, {0}}, 580 - {{16}, {0}, {0}, {0}}}, 413 + {{0}, {16}, {16}, {0}}, 414 + {{0}, {16}, {0}, {0}}}, 581 415 582 - {SVGA3D_G16R16, SVGA3DBLOCKDESC_RG, 416 + {SVGA3D_G16R16, SVGA3DBLOCKDESC_RG_UNORM, 583 417 {1, 1, 1}, 4, 4, 584 - 32, {{0}, {16}, {16}, {0}}, 585 - {{0}, {0}, {16}, {0}}}, 418 + {{0}, {16}, {16}, {0}}, 419 + {{0}, {16}, {0}, {0}}}, 586 420 587 - {SVGA3D_A16B16G16R16, SVGA3DBLOCKDESC_RGBA, 421 + {SVGA3D_A16B16G16R16, SVGA3DBLOCKDESC_RGBA_UNORM, 588 422 {1, 1, 1}, 8, 8, 589 - 64, {{16}, {16}, {16}, {16}}, 423 + {{16}, {16}, {16}, {16}}, 590 424 {{32}, {16}, {0}, {48}}}, 591 425 592 426 {SVGA3D_UYVY, SVGA3DBLOCKDESC_YUV, 593 - {1, 1, 1}, 2, 2, 594 - 16, {{8}, {0}, {8}, {0}}, 427 + {2, 1, 1}, 4, 4, 428 + {{8}, {0}, {8}, {0}}, 595 429 {{0}, {0}, {8}, {0}}}, 596 430 597 431 {SVGA3D_YUY2, SVGA3DBLOCKDESC_YUV, 598 - {1, 1, 1}, 2, 2, 599 - 16, {{8}, {0}, {8}, {0}}, 432 + {2, 1, 1}, 4, 4, 433 + {{8}, {0}, {8}, {0}}, 600 434 {{8}, {0}, {0}, {0}}}, 601 435 602 436 {SVGA3D_NV12, SVGA3DBLOCKDESC_NV12, 603 437 {2, 2, 1}, 6, 2, 604 - 48, {{0}, {0}, {48}, {0}}, 438 + {{0}, {0}, {48}, {0}}, 605 439 {{0}, {0}, {0}, {0}}}, 606 440 607 441 {SVGA3D_AYUV, SVGA3DBLOCKDESC_AYUV, 608 442 {1, 1, 1}, 4, 4, 609 - 32, {{8}, {8}, {8}, {8}}, 443 + {{8}, {8}, {8}, {8}}, 610 444 {{0}, {8}, {16}, {24}}}, 611 445 612 - {SVGA3D_R32G32B32A32_TYPELESS, SVGA3DBLOCKDESC_RGBA, 446 + {SVGA3D_R32G32B32A32_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 613 447 {1, 1, 1}, 16, 16, 614 - 128, {{32}, {32}, {32}, {32}}, 448 + {{32}, {32}, {32}, {32}}, 615 449 {{64}, {32}, {0}, {96}}}, 616 450 617 - {SVGA3D_R32G32B32A32_UINT, SVGA3DBLOCKDESC_RGBA, 451 + {SVGA3D_R32G32B32A32_UINT, SVGA3DBLOCKDESC_RGBA_UINT, 618 452 {1, 1, 1}, 16, 16, 619 - 128, {{32}, {32}, {32}, {32}}, 453 + {{32}, {32}, {32}, {32}}, 620 454 {{64}, {32}, {0}, {96}}}, 621 455 622 - {SVGA3D_R32G32B32A32_SINT, SVGA3DBLOCKDESC_UVWQ, 456 + {SVGA3D_R32G32B32A32_SINT, SVGA3DBLOCKDESC_RGBA_SINT, 623 457 {1, 1, 1}, 16, 16, 624 - 128, {{32}, {32}, {32}, {32}}, 458 + {{32}, {32}, {32}, {32}}, 625 459 {{64}, {32}, {0}, {96}}}, 626 460 627 - {SVGA3D_R32G32B32_TYPELESS, SVGA3DBLOCKDESC_RGB, 461 + {SVGA3D_R32G32B32_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 628 462 {1, 1, 1}, 12, 12, 629 - 96, {{32}, {32}, {32}, {0}}, 463 + {{32}, {32}, {32}, {0}}, 630 464 {{64}, {32}, {0}, {0}}}, 631 465 632 466 {SVGA3D_R32G32B32_FLOAT, SVGA3DBLOCKDESC_RGB_FP, 633 467 {1, 1, 1}, 12, 12, 634 - 96, {{32}, {32}, {32}, {0}}, 468 + {{32}, {32}, {32}, {0}}, 635 469 {{64}, {32}, {0}, {0}}}, 636 470 637 - {SVGA3D_R32G32B32_UINT, SVGA3DBLOCKDESC_RGB, 471 + {SVGA3D_R32G32B32_UINT, SVGA3DBLOCKDESC_RGB_UINT, 638 472 {1, 1, 1}, 12, 12, 639 - 96, {{32}, {32}, {32}, {0}}, 473 + {{32}, {32}, {32}, {0}}, 640 474 {{64}, {32}, {0}, {0}}}, 641 475 642 - {SVGA3D_R32G32B32_SINT, SVGA3DBLOCKDESC_UVW, 476 + {SVGA3D_R32G32B32_SINT, SVGA3DBLOCKDESC_RGB_SINT, 643 477 {1, 1, 1}, 12, 12, 644 - 96, {{32}, {32}, {32}, {0}}, 478 + {{32}, {32}, {32}, {0}}, 645 479 {{64}, {32}, {0}, {0}}}, 646 480 647 - {SVGA3D_R16G16B16A16_TYPELESS, SVGA3DBLOCKDESC_RGBA, 481 + {SVGA3D_R16G16B16A16_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 648 482 {1, 1, 1}, 8, 8, 649 - 64, {{16}, {16}, {16}, {16}}, 483 + {{16}, {16}, {16}, {16}}, 650 484 {{32}, {16}, {0}, {48}}}, 651 485 652 - {SVGA3D_R16G16B16A16_UINT, SVGA3DBLOCKDESC_RGBA, 486 + {SVGA3D_R16G16B16A16_UINT, SVGA3DBLOCKDESC_RGBA_UINT, 653 487 {1, 1, 1}, 8, 8, 654 - 64, {{16}, {16}, {16}, {16}}, 488 + {{16}, {16}, {16}, {16}}, 655 489 {{32}, {16}, {0}, {48}}}, 656 490 657 - {SVGA3D_R16G16B16A16_SNORM, SVGA3DBLOCKDESC_UVWQ, 491 + {SVGA3D_R16G16B16A16_SNORM, SVGA3DBLOCKDESC_RGBA_SNORM, 658 492 {1, 1, 1}, 8, 8, 659 - 64, {{16}, {16}, {16}, {16}}, 493 + {{16}, {16}, {16}, {16}}, 660 494 {{32}, {16}, {0}, {48}}}, 661 495 662 - {SVGA3D_R16G16B16A16_SINT, SVGA3DBLOCKDESC_UVWQ, 496 + {SVGA3D_R16G16B16A16_SINT, SVGA3DBLOCKDESC_RGBA_SINT, 663 497 {1, 1, 1}, 8, 8, 664 - 64, {{16}, {16}, {16}, {16}}, 498 + {{16}, {16}, {16}, {16}}, 665 499 {{32}, {16}, {0}, {48}}}, 666 500 667 - {SVGA3D_R32G32_TYPELESS, SVGA3DBLOCKDESC_RG, 501 + {SVGA3D_R32G32_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 668 502 {1, 1, 1}, 8, 8, 669 - 64, {{0}, {32}, {32}, {0}}, 503 + {{0}, {32}, {32}, {0}}, 670 504 {{0}, {32}, {0}, {0}}}, 671 505 672 - {SVGA3D_R32G32_UINT, SVGA3DBLOCKDESC_RG, 506 + {SVGA3D_R32G32_UINT, SVGA3DBLOCKDESC_RG_UINT, 673 507 {1, 1, 1}, 8, 8, 674 - 64, {{0}, {32}, {32}, {0}}, 508 + {{0}, {32}, {32}, {0}}, 675 509 {{0}, {32}, {0}, {0}}}, 676 510 677 - {SVGA3D_R32G32_SINT, SVGA3DBLOCKDESC_UV, 511 + {SVGA3D_R32G32_SINT, SVGA3DBLOCKDESC_RG_SINT, 678 512 {1, 1, 1}, 8, 8, 679 - 64, {{0}, {32}, {32}, {0}}, 513 + {{0}, {32}, {32}, {0}}, 680 514 {{0}, {32}, {0}, {0}}}, 681 515 682 - {SVGA3D_R32G8X24_TYPELESS, SVGA3DBLOCKDESC_RG, 516 + {SVGA3D_R32G8X24_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 683 517 {1, 1, 1}, 8, 8, 684 - 64, {{0}, {8}, {32}, {0}}, 518 + {{0}, {8}, {32}, {0}}, 685 519 {{0}, {32}, {0}, {0}}}, 686 520 687 521 {SVGA3D_D32_FLOAT_S8X24_UINT, SVGA3DBLOCKDESC_DS, 688 522 {1, 1, 1}, 8, 8, 689 - 64, {{0}, {8}, {32}, {0}}, 523 + {{0}, {8}, {32}, {0}}, 690 524 {{0}, {32}, {0}, {0}}}, 691 525 692 - {SVGA3D_R32_FLOAT_X8X24_TYPELESS, SVGA3DBLOCKDESC_R_FP, 526 + {SVGA3D_R32_FLOAT_X8X24, SVGA3DBLOCKDESC_R_FP, 693 527 {1, 1, 1}, 8, 8, 694 - 64, {{0}, {0}, {32}, {0}}, 528 + {{0}, {0}, {32}, {0}}, 695 529 {{0}, {0}, {0}, {0}}}, 696 530 697 - {SVGA3D_X32_TYPELESS_G8X24_UINT, SVGA3DBLOCKDESC_GREEN, 531 + {SVGA3D_X32_G8X24_UINT, SVGA3DBLOCKDESC_G_UINT, 698 532 {1, 1, 1}, 8, 8, 699 - 64, {{0}, {8}, {0}, {0}}, 533 + {{0}, {8}, {0}, {0}}, 700 534 {{0}, {32}, {0}, {0}}}, 701 535 702 - {SVGA3D_R10G10B10A2_TYPELESS, SVGA3DBLOCKDESC_RGBA, 536 + {SVGA3D_R10G10B10A2_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 703 537 {1, 1, 1}, 4, 4, 704 - 32, {{10}, {10}, {10}, {2}}, 705 - {{0}, {10}, {20}, {30}}}, 538 + {{10}, {10}, {10}, {2}}, 539 + {{20}, {10}, {0}, {30}}}, 706 540 707 - {SVGA3D_R10G10B10A2_UINT, SVGA3DBLOCKDESC_RGBA, 541 + {SVGA3D_R10G10B10A2_UINT, SVGA3DBLOCKDESC_RGBA_UINT, 708 542 {1, 1, 1}, 4, 4, 709 - 32, {{10}, {10}, {10}, {2}}, 710 - {{0}, {10}, {20}, {30}}}, 543 + {{10}, {10}, {10}, {2}}, 544 + {{20}, {10}, {0}, {30}}}, 711 545 712 546 {SVGA3D_R11G11B10_FLOAT, SVGA3DBLOCKDESC_RGB_FP, 713 547 {1, 1, 1}, 4, 4, 714 - 32, {{10}, {11}, {11}, {0}}, 715 - {{0}, {10}, {21}, {0}}}, 548 + {{10}, {11}, {11}, {0}}, 549 + {{22}, {11}, {0}, {0}}}, 716 550 717 - {SVGA3D_R8G8B8A8_TYPELESS, SVGA3DBLOCKDESC_RGBA, 551 + {SVGA3D_R8G8B8A8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 718 552 {1, 1, 1}, 4, 4, 719 - 32, {{8}, {8}, {8}, {8}}, 553 + {{8}, {8}, {8}, {8}}, 720 554 {{16}, {8}, {0}, {24}}}, 721 555 722 - {SVGA3D_R8G8B8A8_UNORM, SVGA3DBLOCKDESC_RGBA, 556 + {SVGA3D_R8G8B8A8_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM, 723 557 {1, 1, 1}, 4, 4, 724 - 32, {{8}, {8}, {8}, {8}}, 558 + {{8}, {8}, {8}, {8}}, 725 559 {{16}, {8}, {0}, {24}}}, 726 560 727 - {SVGA3D_R8G8B8A8_UNORM_SRGB, SVGA3DBLOCKDESC_RGBA_SRGB, 561 + {SVGA3D_R8G8B8A8_UNORM_SRGB, SVGA3DBLOCKDESC_RGBA_UNORM_SRGB, 728 562 {1, 1, 1}, 4, 4, 729 - 32, {{8}, {8}, {8}, {8}}, 563 + {{8}, {8}, {8}, {8}}, 730 564 {{16}, {8}, {0}, {24}}}, 731 565 732 - {SVGA3D_R8G8B8A8_UINT, SVGA3DBLOCKDESC_RGBA, 566 + {SVGA3D_R8G8B8A8_UINT, SVGA3DBLOCKDESC_RGBA_UINT, 733 567 {1, 1, 1}, 4, 4, 734 - 32, {{8}, {8}, {8}, {8}}, 568 + {{8}, {8}, {8}, {8}}, 735 569 {{16}, {8}, {0}, {24}}}, 736 570 737 - {SVGA3D_R8G8B8A8_SINT, SVGA3DBLOCKDESC_RGBA, 571 + {SVGA3D_R8G8B8A8_SINT, SVGA3DBLOCKDESC_RGBA_SINT, 738 572 {1, 1, 1}, 4, 4, 739 - 32, {{8}, {8}, {8}, {8}}, 573 + {{8}, {8}, {8}, {8}}, 740 574 {{16}, {8}, {0}, {24}}}, 741 575 742 - {SVGA3D_R16G16_TYPELESS, SVGA3DBLOCKDESC_RG, 576 + {SVGA3D_R16G16_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 743 577 {1, 1, 1}, 4, 4, 744 - 32, {{0}, {16}, {16}, {0}}, 578 + {{0}, {16}, {16}, {0}}, 745 579 {{0}, {16}, {0}, {0}}}, 746 580 747 - {SVGA3D_R16G16_UINT, SVGA3DBLOCKDESC_RG_FP, 581 + {SVGA3D_R16G16_UINT, SVGA3DBLOCKDESC_RG_UINT, 748 582 {1, 1, 1}, 4, 4, 749 - 32, {{0}, {16}, {16}, {0}}, 583 + {{0}, {16}, {16}, {0}}, 750 584 {{0}, {16}, {0}, {0}}}, 751 585 752 - {SVGA3D_R16G16_SINT, SVGA3DBLOCKDESC_UV, 586 + {SVGA3D_R16G16_SINT, SVGA3DBLOCKDESC_RG_SINT, 753 587 {1, 1, 1}, 4, 4, 754 - 32, {{0}, {16}, {16}, {0}}, 588 + {{0}, {16}, {16}, {0}}, 755 589 {{0}, {16}, {0}, {0}}}, 756 590 757 - {SVGA3D_R32_TYPELESS, SVGA3DBLOCKDESC_RED, 591 + {SVGA3D_R32_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 758 592 {1, 1, 1}, 4, 4, 759 - 32, {{0}, {0}, {32}, {0}}, 593 + {{0}, {0}, {32}, {0}}, 760 594 {{0}, {0}, {0}, {0}}}, 761 595 762 - {SVGA3D_D32_FLOAT, SVGA3DBLOCKDESC_DEPTH, 596 + {SVGA3D_D32_FLOAT, SVGA3DBLOCKDESC_DEPTH_FP, 763 597 {1, 1, 1}, 4, 4, 764 - 32, {{0}, {0}, {32}, {0}}, 598 + {{0}, {0}, {32}, {0}}, 765 599 {{0}, {0}, {0}, {0}}}, 766 600 767 - {SVGA3D_R32_UINT, SVGA3DBLOCKDESC_RED, 601 + {SVGA3D_R32_UINT, SVGA3DBLOCKDESC_R_UINT, 768 602 {1, 1, 1}, 4, 4, 769 - 32, {{0}, {0}, {32}, {0}}, 603 + {{0}, {0}, {32}, {0}}, 770 604 {{0}, {0}, {0}, {0}}}, 771 605 772 - {SVGA3D_R32_SINT, SVGA3DBLOCKDESC_RED, 606 + {SVGA3D_R32_SINT, SVGA3DBLOCKDESC_R_SINT, 773 607 {1, 1, 1}, 4, 4, 774 - 32, {{0}, {0}, {32}, {0}}, 608 + {{0}, {0}, {32}, {0}}, 775 609 {{0}, {0}, {0}, {0}}}, 776 610 777 - {SVGA3D_R24G8_TYPELESS, SVGA3DBLOCKDESC_RG, 611 + {SVGA3D_R24G8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 778 612 {1, 1, 1}, 4, 4, 779 - 32, {{0}, {8}, {24}, {0}}, 613 + {{0}, {8}, {24}, {0}}, 780 614 {{0}, {24}, {0}, {0}}}, 781 615 782 - {SVGA3D_D24_UNORM_S8_UINT, SVGA3DBLOCKDESC_DS, 616 + {SVGA3D_D24_UNORM_S8_UINT, SVGA3DBLOCKDESC_DS_UNORM, 783 617 {1, 1, 1}, 4, 4, 784 - 32, {{0}, {8}, {24}, {0}}, 618 + {{0}, {8}, {24}, {0}}, 785 619 {{0}, {24}, {0}, {0}}}, 786 620 787 - {SVGA3D_R24_UNORM_X8_TYPELESS, SVGA3DBLOCKDESC_RED, 621 + {SVGA3D_R24_UNORM_X8, SVGA3DBLOCKDESC_R_UNORM, 788 622 {1, 1, 1}, 4, 4, 789 - 32, {{0}, {0}, {24}, {0}}, 623 + {{0}, {0}, {24}, {0}}, 790 624 {{0}, {0}, {0}, {0}}}, 791 625 792 - {SVGA3D_X24_TYPELESS_G8_UINT, SVGA3DBLOCKDESC_GREEN, 626 + {SVGA3D_X24_G8_UINT, SVGA3DBLOCKDESC_G_UINT, 793 627 {1, 1, 1}, 4, 4, 794 - 32, {{0}, {8}, {0}, {0}}, 628 + {{0}, {8}, {0}, {0}}, 795 629 {{0}, {24}, {0}, {0}}}, 796 630 797 - {SVGA3D_R8G8_TYPELESS, SVGA3DBLOCKDESC_RG, 631 + {SVGA3D_R8G8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 798 632 {1, 1, 1}, 2, 2, 799 - 16, {{0}, {8}, {8}, {0}}, 633 + {{0}, {8}, {8}, {0}}, 800 634 {{0}, {8}, {0}, {0}}}, 801 635 802 - {SVGA3D_R8G8_UNORM, SVGA3DBLOCKDESC_RG, 636 + {SVGA3D_R8G8_UNORM, SVGA3DBLOCKDESC_RG_UNORM, 803 637 {1, 1, 1}, 2, 2, 804 - 16, {{0}, {8}, {8}, {0}}, 638 + {{0}, {8}, {8}, {0}}, 805 639 {{0}, {8}, {0}, {0}}}, 806 640 807 - {SVGA3D_R8G8_UINT, SVGA3DBLOCKDESC_RG, 641 + {SVGA3D_R8G8_UINT, SVGA3DBLOCKDESC_RG_UINT, 808 642 {1, 1, 1}, 2, 2, 809 - 16, {{0}, {8}, {8}, {0}}, 643 + {{0}, {8}, {8}, {0}}, 810 644 {{0}, {8}, {0}, {0}}}, 811 645 812 - {SVGA3D_R8G8_SINT, SVGA3DBLOCKDESC_UV, 646 + {SVGA3D_R8G8_SINT, SVGA3DBLOCKDESC_RG_SINT, 813 647 {1, 1, 1}, 2, 2, 814 - 16, {{0}, {8}, {8}, {0}}, 648 + {{0}, {8}, {8}, {0}}, 815 649 {{0}, {8}, {0}, {0}}}, 816 650 817 - {SVGA3D_R16_TYPELESS, SVGA3DBLOCKDESC_RED, 651 + {SVGA3D_R16_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 818 652 {1, 1, 1}, 2, 2, 819 - 16, {{0}, {0}, {16}, {0}}, 653 + {{0}, {0}, {16}, {0}}, 820 654 {{0}, {0}, {0}, {0}}}, 821 655 822 - {SVGA3D_R16_UNORM, SVGA3DBLOCKDESC_RED, 656 + {SVGA3D_R16_UNORM, SVGA3DBLOCKDESC_R_UNORM, 823 657 {1, 1, 1}, 2, 2, 824 - 16, {{0}, {0}, {16}, {0}}, 658 + {{0}, {0}, {16}, {0}}, 825 659 {{0}, {0}, {0}, {0}}}, 826 660 827 - {SVGA3D_R16_UINT, SVGA3DBLOCKDESC_RED, 661 + {SVGA3D_R16_UINT, SVGA3DBLOCKDESC_R_UINT, 828 662 {1, 1, 1}, 2, 2, 829 - 16, {{0}, {0}, {16}, {0}}, 663 + {{0}, {0}, {16}, {0}}, 830 664 {{0}, {0}, {0}, {0}}}, 831 665 832 - {SVGA3D_R16_SNORM, SVGA3DBLOCKDESC_U, 666 + {SVGA3D_R16_SNORM, SVGA3DBLOCKDESC_R_SNORM, 833 667 {1, 1, 1}, 2, 2, 834 - 16, {{0}, {0}, {16}, {0}}, 668 + {{0}, {0}, {16}, {0}}, 835 669 {{0}, {0}, {0}, {0}}}, 836 670 837 - {SVGA3D_R16_SINT, SVGA3DBLOCKDESC_U, 671 + {SVGA3D_R16_SINT, SVGA3DBLOCKDESC_R_SINT, 838 672 {1, 1, 1}, 2, 2, 839 - 16, {{0}, {0}, {16}, {0}}, 673 + {{0}, {0}, {16}, {0}}, 840 674 {{0}, {0}, {0}, {0}}}, 841 675 842 - {SVGA3D_R8_TYPELESS, SVGA3DBLOCKDESC_RED, 676 + {SVGA3D_R8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 843 677 {1, 1, 1}, 1, 1, 844 - 8, {{0}, {0}, {8}, {0}}, 678 + {{0}, {0}, {8}, {0}}, 845 679 {{0}, {0}, {0}, {0}}}, 846 680 847 - {SVGA3D_R8_UNORM, SVGA3DBLOCKDESC_RED, 681 + {SVGA3D_R8_UNORM, SVGA3DBLOCKDESC_R_UNORM, 848 682 {1, 1, 1}, 1, 1, 849 - 8, {{0}, {0}, {8}, {0}}, 683 + {{0}, {0}, {8}, {0}}, 850 684 {{0}, {0}, {0}, {0}}}, 851 685 852 - {SVGA3D_R8_UINT, SVGA3DBLOCKDESC_RED, 686 + {SVGA3D_R8_UINT, SVGA3DBLOCKDESC_R_UINT, 853 687 {1, 1, 1}, 1, 1, 854 - 8, {{0}, {0}, {8}, {0}}, 688 + {{0}, {0}, {8}, {0}}, 855 689 {{0}, {0}, {0}, {0}}}, 856 690 857 - {SVGA3D_R8_SNORM, SVGA3DBLOCKDESC_U, 691 + {SVGA3D_R8_SNORM, SVGA3DBLOCKDESC_R_SNORM, 858 692 {1, 1, 1}, 1, 1, 859 - 8, {{0}, {0}, {8}, {0}}, 693 + {{0}, {0}, {8}, {0}}, 860 694 {{0}, {0}, {0}, {0}}}, 861 695 862 - {SVGA3D_R8_SINT, SVGA3DBLOCKDESC_U, 696 + {SVGA3D_R8_SINT, SVGA3DBLOCKDESC_R_SINT, 863 697 {1, 1, 1}, 1, 1, 864 - 8, {{0}, {0}, {8}, {0}}, 698 + {{0}, {0}, {8}, {0}}, 865 699 {{0}, {0}, {0}, {0}}}, 866 700 867 - {SVGA3D_P8, SVGA3DBLOCKDESC_RED, 701 + {SVGA3D_P8, SVGA3DBLOCKDESC_NONE, 868 702 {1, 1, 1}, 1, 1, 869 - 8, {{0}, {0}, {8}, {0}}, 703 + {{0}, {0}, {8}, {0}}, 870 704 {{0}, {0}, {0}, {0}}}, 871 705 872 - {SVGA3D_R9G9B9E5_SHAREDEXP, SVGA3DBLOCKDESC_RGBE, 706 + {SVGA3D_R9G9B9E5_SHAREDEXP, SVGA3DBLOCKDESC_RGB_EXP, 873 707 {1, 1, 1}, 4, 4, 874 - 32, {{9}, {9}, {9}, {5}}, 708 + {{9}, {9}, {9}, {5}}, 875 709 {{18}, {9}, {0}, {27}}}, 876 710 877 - {SVGA3D_R8G8_B8G8_UNORM, SVGA3DBLOCKDESC_RG, 878 - {1, 1, 1}, 2, 2, 879 - 16, {{0}, {8}, {8}, {0}}, 711 + {SVGA3D_R8G8_B8G8_UNORM, SVGA3DBLOCKDESC_NONE, 712 + {2, 1, 1}, 4, 4, 713 + {{0}, {8}, {8}, {0}}, 714 + {{0}, {0}, {8}, {0}}}, 715 + 716 + {SVGA3D_G8R8_G8B8_UNORM, SVGA3DBLOCKDESC_NONE, 717 + {2, 1, 1}, 4, 4, 718 + {{0}, {8}, {8}, {0}}, 880 719 {{0}, {8}, {0}, {0}}}, 881 720 882 - {SVGA3D_G8R8_G8B8_UNORM, SVGA3DBLOCKDESC_RG, 721 + {SVGA3D_BC1_TYPELESS, SVGA3DBLOCKDESC_BC1_COMP_TYPELESS, 722 + {4, 4, 1}, 8, 8, 723 + {{0}, {0}, {64}, {0}}, 724 + {{0}, {0}, {0}, {0}}}, 725 + 726 + {SVGA3D_BC1_UNORM_SRGB, SVGA3DBLOCKDESC_BC1_COMP_UNORM_SRGB, 727 + {4, 4, 1}, 8, 8, 728 + {{0}, {0}, {64}, {0}}, 729 + {{0}, {0}, {0}, {0}}}, 730 + 731 + {SVGA3D_BC2_TYPELESS, SVGA3DBLOCKDESC_BC2_COMP_TYPELESS, 732 + {4, 4, 1}, 16, 16, 733 + {{0}, {0}, {128}, {0}}, 734 + {{0}, {0}, {0}, {0}}}, 735 + 736 + {SVGA3D_BC2_UNORM_SRGB, SVGA3DBLOCKDESC_BC2_COMP_UNORM_SRGB, 737 + {4, 4, 1}, 16, 16, 738 + {{0}, {0}, {128}, {0}}, 739 + {{0}, {0}, {0}, {0}}}, 740 + 741 + {SVGA3D_BC3_TYPELESS, SVGA3DBLOCKDESC_BC3_COMP_TYPELESS, 742 + {4, 4, 1}, 16, 16, 743 + {{0}, {0}, {128}, {0}}, 744 + {{0}, {0}, {0}, {0}}}, 745 + 746 + {SVGA3D_BC3_UNORM_SRGB, SVGA3DBLOCKDESC_BC3_COMP_UNORM_SRGB, 747 + {4, 4, 1}, 16, 16, 748 + {{0}, {0}, {128}, {0}}, 749 + {{0}, {0}, {0}, {0}}}, 750 + 751 + {SVGA3D_BC4_TYPELESS, SVGA3DBLOCKDESC_BC4_COMP_TYPELESS, 752 + {4, 4, 1}, 8, 8, 753 + {{0}, {0}, {64}, {0}}, 754 + {{0}, {0}, {0}, {0}}}, 755 + 756 + {SVGA3D_ATI1, SVGA3DBLOCKDESC_BC4_COMP_UNORM, 757 + {4, 4, 1}, 8, 8, 758 + {{0}, {0}, {64}, {0}}, 759 + {{0}, {0}, {0}, {0}}}, 760 + 761 + {SVGA3D_BC4_SNORM, SVGA3DBLOCKDESC_BC4_COMP_SNORM, 762 + {4, 4, 1}, 8, 8, 763 + {{0}, {0}, {64}, {0}}, 764 + {{0}, {0}, {0}, {0}}}, 765 + 766 + {SVGA3D_BC5_TYPELESS, SVGA3DBLOCKDESC_BC5_COMP_TYPELESS, 767 + {4, 4, 1}, 16, 16, 768 + {{0}, {0}, {128}, {0}}, 769 + {{0}, {0}, {0}, {0}}}, 770 + 771 + {SVGA3D_ATI2, SVGA3DBLOCKDESC_BC5_COMP_UNORM, 772 + {4, 4, 1}, 16, 16, 773 + {{0}, {0}, {128}, {0}}, 774 + {{0}, {0}, {0}, {0}}}, 775 + 776 + {SVGA3D_BC5_SNORM, SVGA3DBLOCKDESC_BC5_COMP_SNORM, 777 + {4, 4, 1}, 16, 16, 778 + {{0}, {0}, {128}, {0}}, 779 + {{0}, {0}, {0}, {0}}}, 780 + 781 + {SVGA3D_R10G10B10_XR_BIAS_A2_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM, 782 + {1, 1, 1}, 4, 4, 783 + {{10}, {10}, {10}, {2}}, 784 + {{20}, {10}, {0}, {30}}}, 785 + 786 + {SVGA3D_B8G8R8A8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 787 + {1, 1, 1}, 4, 4, 788 + {{8}, {8}, {8}, {8}}, 789 + {{0}, {8}, {16}, {24}}}, 790 + 791 + {SVGA3D_B8G8R8A8_UNORM_SRGB, SVGA3DBLOCKDESC_RGBA_UNORM_SRGB, 792 + {1, 1, 1}, 4, 4, 793 + {{8}, {8}, {8}, {8}}, 794 + {{0}, {8}, {16}, {24}}}, 795 + 796 + {SVGA3D_B8G8R8X8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS, 797 + {1, 1, 1}, 4, 4, 798 + {{8}, {8}, {8}, {0}}, 799 + {{0}, {8}, {16}, {24}}}, 800 + 801 + {SVGA3D_B8G8R8X8_UNORM_SRGB, SVGA3DBLOCKDESC_RGB_UNORM_SRGB, 802 + {1, 1, 1}, 4, 4, 803 + {{8}, {8}, {8}, {0}}, 804 + {{0}, {8}, {16}, {24}}}, 805 + 806 + {SVGA3D_Z_DF16, SVGA3DBLOCKDESC_DEPTH_UNORM, 883 807 {1, 1, 1}, 2, 2, 884 - 16, {{0}, {8}, {8}, {0}}, 885 - {{0}, {8}, {0}, {0}}}, 886 - 887 - {SVGA3D_BC1_TYPELESS, SVGA3DBLOCKDESC_COMPRESSED, 888 - {4, 4, 1}, 8, 8, 889 - 64, {{0}, {0}, {64}, {0}}, 808 + {{0}, {0}, {16}, {0}}, 890 809 {{0}, {0}, {0}, {0}}}, 891 810 892 - {SVGA3D_BC1_UNORM_SRGB, SVGA3DBLOCKDESC_COMPRESSED_SRGB, 893 - {4, 4, 1}, 8, 8, 894 - 64, {{0}, {0}, {64}, {0}}, 895 - {{0}, {0}, {0}, {0}}}, 896 - 897 - {SVGA3D_BC2_TYPELESS, SVGA3DBLOCKDESC_COMPRESSED, 898 - {4, 4, 1}, 16, 16, 899 - 128, {{0}, {0}, {128}, {0}}, 900 - {{0}, {0}, {0}, {0}}}, 901 - 902 - {SVGA3D_BC2_UNORM_SRGB, SVGA3DBLOCKDESC_COMPRESSED_SRGB, 903 - {4, 4, 1}, 16, 16, 904 - 128, {{0}, {0}, {128}, {0}}, 905 - {{0}, {0}, {0}, {0}}}, 906 - 907 - {SVGA3D_BC3_TYPELESS, SVGA3DBLOCKDESC_COMPRESSED, 908 - {4, 4, 1}, 16, 16, 909 - 128, {{0}, {0}, {128}, {0}}, 910 - {{0}, {0}, {0}, {0}}}, 911 - 912 - {SVGA3D_BC3_UNORM_SRGB, SVGA3DBLOCKDESC_COMPRESSED_SRGB, 913 - {4, 4, 1}, 16, 16, 914 - 128, {{0}, {0}, {128}, {0}}, 915 - {{0}, {0}, {0}, {0}}}, 916 - 917 - {SVGA3D_BC4_TYPELESS, SVGA3DBLOCKDESC_COMPRESSED, 918 - {4, 4, 1}, 8, 8, 919 - 64, {{0}, {0}, {64}, {0}}, 920 - {{0}, {0}, {0}, {0}}}, 921 - 922 - {SVGA3D_ATI1, SVGA3DBLOCKDESC_COMPRESSED, 923 - {4, 4, 1}, 8, 8, 924 - 64, {{0}, {0}, {64}, {0}}, 925 - {{0}, {0}, {0}, {0}}}, 926 - 927 - {SVGA3D_BC4_SNORM, SVGA3DBLOCKDESC_COMPRESSED, 928 - {4, 4, 1}, 8, 8, 929 - 64, {{0}, {0}, {64}, {0}}, 930 - {{0}, {0}, {0}, {0}}}, 931 - 932 - {SVGA3D_BC5_TYPELESS, SVGA3DBLOCKDESC_COMPRESSED, 933 - {4, 4, 1}, 16, 16, 934 - 128, {{0}, {0}, {128}, {0}}, 935 - {{0}, {0}, {0}, {0}}}, 936 - 937 - {SVGA3D_ATI2, SVGA3DBLOCKDESC_COMPRESSED, 938 - {4, 4, 1}, 16, 16, 939 - 128, {{0}, {0}, {128}, {0}}, 940 - {{0}, {0}, {0}, {0}}}, 941 - 942 - {SVGA3D_BC5_SNORM, SVGA3DBLOCKDESC_COMPRESSED, 943 - {4, 4, 1}, 16, 16, 944 - 128, {{0}, {0}, {128}, {0}}, 945 - {{0}, {0}, {0}, {0}}}, 946 - 947 - {SVGA3D_R10G10B10_XR_BIAS_A2_UNORM, SVGA3DBLOCKDESC_RGBA, 811 + {SVGA3D_Z_DF24, SVGA3DBLOCKDESC_DEPTH_UNORM, 948 812 {1, 1, 1}, 4, 4, 949 - 32, {{10}, {10}, {10}, {2}}, 950 - {{0}, {10}, {20}, {30}}}, 813 + {{0}, {0}, {24}, {0}}, 814 + {{0}, {0}, {8}, {0}}}, 951 815 952 - {SVGA3D_B8G8R8A8_TYPELESS, SVGA3DBLOCKDESC_RGBA, 816 + {SVGA3D_Z_D24S8_INT, SVGA3DBLOCKDESC_DS_UNORM, 953 817 {1, 1, 1}, 4, 4, 954 - 32, {{8}, {8}, {8}, {8}}, 955 - {{0}, {8}, {16}, {24}}}, 956 - 957 - {SVGA3D_B8G8R8A8_UNORM_SRGB, SVGA3DBLOCKDESC_RGBA_SRGB, 958 - {1, 1, 1}, 4, 4, 959 - 32, {{8}, {8}, {8}, {8}}, 960 - {{0}, {8}, {16}, {24}}}, 961 - 962 - {SVGA3D_B8G8R8X8_TYPELESS, SVGA3DBLOCKDESC_RGB, 963 - {1, 1, 1}, 4, 4, 964 - 24, {{8}, {8}, {8}, {0}}, 965 - {{0}, {8}, {16}, {24}}}, 966 - 967 - {SVGA3D_B8G8R8X8_UNORM_SRGB, SVGA3DBLOCKDESC_RGB_SRGB, 968 - {1, 1, 1}, 4, 4, 969 - 24, {{8}, {8}, {8}, {0}}, 970 - {{0}, {8}, {16}, {24}}}, 971 - 972 - {SVGA3D_Z_DF16, SVGA3DBLOCKDESC_DEPTH, 973 - {1, 1, 1}, 2, 2, 974 - 16, {{0}, {0}, {16}, {0}}, 975 - {{0}, {0}, {0}, {0}}}, 976 - 977 - {SVGA3D_Z_DF24, SVGA3DBLOCKDESC_DEPTH, 978 - {1, 1, 1}, 4, 4, 979 - 32, {{0}, {8}, {24}, {0}}, 980 - {{0}, {24}, {0}, {0}}}, 981 - 982 - {SVGA3D_Z_D24S8_INT, SVGA3DBLOCKDESC_DS, 983 - {1, 1, 1}, 4, 4, 984 - 32, {{0}, {8}, {24}, {0}}, 985 - {{0}, {24}, {0}, {0}}}, 818 + {{0}, {8}, {24}, {0}}, 819 + {{0}, {0}, {8}, {0}}}, 986 820 987 821 {SVGA3D_YV12, SVGA3DBLOCKDESC_YV12, 988 822 {2, 2, 1}, 6, 2, 989 - 48, {{0}, {0}, {48}, {0}}, 823 + {{0}, {0}, {48}, {0}}, 990 824 {{0}, {0}, {0}, {0}}}, 991 825 992 826 {SVGA3D_R32G32B32A32_FLOAT, SVGA3DBLOCKDESC_RGBA_FP, 993 827 {1, 1, 1}, 16, 16, 994 - 128, {{32}, {32}, {32}, {32}}, 828 + {{32}, {32}, {32}, {32}}, 995 829 {{64}, {32}, {0}, {96}}}, 996 830 997 831 {SVGA3D_R16G16B16A16_FLOAT, SVGA3DBLOCKDESC_RGBA_FP, 998 832 {1, 1, 1}, 8, 8, 999 - 64, {{16}, {16}, {16}, {16}}, 833 + {{16}, {16}, {16}, {16}}, 1000 834 {{32}, {16}, {0}, {48}}}, 1001 835 1002 - {SVGA3D_R16G16B16A16_UNORM, SVGA3DBLOCKDESC_RGBA, 836 + {SVGA3D_R16G16B16A16_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM, 1003 837 {1, 1, 1}, 8, 8, 1004 - 64, {{16}, {16}, {16}, {16}}, 838 + {{16}, {16}, {16}, {16}}, 1005 839 {{32}, {16}, {0}, {48}}}, 1006 840 1007 841 {SVGA3D_R32G32_FLOAT, SVGA3DBLOCKDESC_RG_FP, 1008 842 {1, 1, 1}, 8, 8, 1009 - 64, {{0}, {32}, {32}, {0}}, 843 + {{0}, {32}, {32}, {0}}, 1010 844 {{0}, {32}, {0}, {0}}}, 1011 845 1012 - {SVGA3D_R10G10B10A2_UNORM, SVGA3DBLOCKDESC_RGBA, 846 + {SVGA3D_R10G10B10A2_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM, 1013 847 {1, 1, 1}, 4, 4, 1014 - 32, {{10}, {10}, {10}, {2}}, 1015 - {{0}, {10}, {20}, {30}}}, 848 + {{10}, {10}, {10}, {2}}, 849 + {{20}, {10}, {0}, {30}}}, 1016 850 1017 - {SVGA3D_R8G8B8A8_SNORM, SVGA3DBLOCKDESC_RGBA, 851 + {SVGA3D_R8G8B8A8_SNORM, SVGA3DBLOCKDESC_RGBA_SNORM, 1018 852 {1, 1, 1}, 4, 4, 1019 - 32, {{8}, {8}, {8}, {8}}, 1020 - {{24}, {16}, {8}, {0}}}, 853 + {{8}, {8}, {8}, {8}}, 854 + {{16}, {8}, {0}, {24}}}, 1021 855 1022 856 {SVGA3D_R16G16_FLOAT, SVGA3DBLOCKDESC_RG_FP, 1023 857 {1, 1, 1}, 4, 4, 1024 - 32, {{0}, {16}, {16}, {0}}, 858 + {{0}, {16}, {16}, {0}}, 1025 859 {{0}, {16}, {0}, {0}}}, 1026 860 1027 - {SVGA3D_R16G16_UNORM, SVGA3DBLOCKDESC_RG, 861 + {SVGA3D_R16G16_UNORM, SVGA3DBLOCKDESC_RG_UNORM, 1028 862 {1, 1, 1}, 4, 4, 1029 - 32, {{0}, {16}, {16}, {0}}, 1030 - {{0}, {0}, {16}, {0}}}, 863 + {{0}, {16}, {16}, {0}}, 864 + {{0}, {16}, {0}, {0}}}, 1031 865 1032 - {SVGA3D_R16G16_SNORM, SVGA3DBLOCKDESC_RG, 866 + {SVGA3D_R16G16_SNORM, SVGA3DBLOCKDESC_RG_SNORM, 1033 867 {1, 1, 1}, 4, 4, 1034 - 32, {{16}, {16}, {0}, {0}}, 1035 - {{16}, {0}, {0}, {0}}}, 868 + {{0}, {16}, {16}, {0}}, 869 + {{0}, {16}, {0}, {0}}}, 1036 870 1037 871 {SVGA3D_R32_FLOAT, SVGA3DBLOCKDESC_R_FP, 1038 872 {1, 1, 1}, 4, 4, 1039 - 32, {{0}, {0}, {32}, {0}}, 873 + {{0}, {0}, {32}, {0}}, 1040 874 {{0}, {0}, {0}, {0}}}, 1041 875 1042 - {SVGA3D_R8G8_SNORM, SVGA3DBLOCKDESC_RG, 876 + {SVGA3D_R8G8_SNORM, SVGA3DBLOCKDESC_RG_SNORM, 1043 877 {1, 1, 1}, 2, 2, 1044 - 16, {{8}, {8}, {0}, {0}}, 1045 - {{8}, {0}, {0}, {0}}}, 878 + {{0}, {8}, {8}, {0}}, 879 + {{0}, {8}, {0}, {0}}}, 1046 880 1047 881 {SVGA3D_R16_FLOAT, SVGA3DBLOCKDESC_R_FP, 1048 882 {1, 1, 1}, 2, 2, 1049 - 16, {{0}, {0}, {16}, {0}}, 883 + {{0}, {0}, {16}, {0}}, 1050 884 {{0}, {0}, {0}, {0}}}, 1051 885 1052 - {SVGA3D_D16_UNORM, SVGA3DBLOCKDESC_DEPTH, 886 + {SVGA3D_D16_UNORM, SVGA3DBLOCKDESC_DEPTH_UNORM, 1053 887 {1, 1, 1}, 2, 2, 1054 - 16, {{0}, {0}, {16}, {0}}, 888 + {{0}, {0}, {16}, {0}}, 1055 889 {{0}, {0}, {0}, {0}}}, 1056 890 1057 - {SVGA3D_A8_UNORM, SVGA3DBLOCKDESC_ALPHA, 891 + {SVGA3D_A8_UNORM, SVGA3DBLOCKDESC_A_UNORM, 1058 892 {1, 1, 1}, 1, 1, 1059 - 8, {{0}, {0}, {0}, {8}}, 893 + {{0}, {0}, {0}, {8}}, 1060 894 {{0}, {0}, {0}, {0}}}, 1061 895 1062 - {SVGA3D_BC1_UNORM, SVGA3DBLOCKDESC_COMPRESSED, 896 + {SVGA3D_BC1_UNORM, SVGA3DBLOCKDESC_BC1_COMP_UNORM, 1063 897 {4, 4, 1}, 8, 8, 1064 - 64, {{0}, {0}, {64}, {0}}, 898 + {{0}, {0}, {64}, {0}}, 1065 899 {{0}, {0}, {0}, {0}}}, 1066 900 1067 - {SVGA3D_BC2_UNORM, SVGA3DBLOCKDESC_COMPRESSED, 901 + {SVGA3D_BC2_UNORM, SVGA3DBLOCKDESC_BC2_COMP_UNORM, 1068 902 {4, 4, 1}, 16, 16, 1069 - 128, {{0}, {0}, {128}, {0}}, 903 + {{0}, {0}, {128}, {0}}, 1070 904 {{0}, {0}, {0}, {0}}}, 1071 905 1072 - {SVGA3D_BC3_UNORM, SVGA3DBLOCKDESC_COMPRESSED, 906 + {SVGA3D_BC3_UNORM, SVGA3DBLOCKDESC_BC3_COMP_UNORM, 1073 907 {4, 4, 1}, 16, 16, 1074 - 128, {{0}, {0}, {128}, {0}}, 908 + {{0}, {0}, {128}, {0}}, 1075 909 {{0}, {0}, {0}, {0}}}, 1076 910 1077 - {SVGA3D_B5G6R5_UNORM, SVGA3DBLOCKDESC_RGB, 911 + {SVGA3D_B5G6R5_UNORM, SVGA3DBLOCKDESC_RGB_UNORM, 1078 912 {1, 1, 1}, 2, 2, 1079 - 16, {{5}, {6}, {5}, {0}}, 913 + {{5}, {6}, {5}, {0}}, 1080 914 {{0}, {5}, {11}, {0}}}, 1081 915 1082 - {SVGA3D_B5G5R5A1_UNORM, SVGA3DBLOCKDESC_RGBA, 916 + {SVGA3D_B5G5R5A1_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM, 1083 917 {1, 1, 1}, 2, 2, 1084 - 16, {{5}, {5}, {5}, {1}}, 918 + {{5}, {5}, {5}, {1}}, 1085 919 {{0}, {5}, {10}, {15}}}, 1086 920 1087 - {SVGA3D_B8G8R8A8_UNORM, SVGA3DBLOCKDESC_RGBA, 921 + {SVGA3D_B8G8R8A8_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM, 1088 922 {1, 1, 1}, 4, 4, 1089 - 32, {{8}, {8}, {8}, {8}}, 923 + {{8}, {8}, {8}, {8}}, 1090 924 {{0}, {8}, {16}, {24}}}, 1091 925 1092 - {SVGA3D_B8G8R8X8_UNORM, SVGA3DBLOCKDESC_RGB, 926 + {SVGA3D_B8G8R8X8_UNORM, SVGA3DBLOCKDESC_RGB_UNORM, 1093 927 {1, 1, 1}, 4, 4, 1094 - 24, {{8}, {8}, {8}, {0}}, 928 + {{8}, {8}, {8}, {0}}, 1095 929 {{0}, {8}, {16}, {24}}}, 1096 930 1097 - {SVGA3D_BC4_UNORM, SVGA3DBLOCKDESC_COMPRESSED, 931 + {SVGA3D_BC4_UNORM, SVGA3DBLOCKDESC_BC4_COMP_UNORM, 1098 932 {4, 4, 1}, 8, 8, 1099 - 64, {{0}, {0}, {64}, {0}}, 933 + {{0}, {0}, {64}, {0}}, 1100 934 {{0}, {0}, {0}, {0}}}, 1101 935 1102 - {SVGA3D_BC5_UNORM, SVGA3DBLOCKDESC_COMPRESSED, 936 + {SVGA3D_BC5_UNORM, SVGA3DBLOCKDESC_BC5_COMP_UNORM, 1103 937 {4, 4, 1}, 16, 16, 1104 - 128, {{0}, {0}, {128}, {0}}, 938 + {{0}, {0}, {128}, {0}}, 1105 939 {{0}, {0}, {0}, {0}}}, 1106 - 1107 940 }; 1108 941 1109 942 static inline u32 clamped_umul32(u32 a, u32 b) ··· 1111 946 return (tmp > (uint64_t) ((u32) -1)) ? (u32) -1 : tmp; 1112 947 } 1113 948 949 + /** 950 + * svga3dsurface_get_desc - Look up the appropriate SVGA3dSurfaceDesc for the 951 + * given format. 952 + */ 1114 953 static inline const struct svga3d_surface_desc * 1115 954 svga3dsurface_get_desc(SVGA3dSurfaceFormat format) 1116 955 { ··· 1124 955 return &svga3d_surface_descs[SVGA3D_FORMAT_INVALID]; 1125 956 } 1126 957 1127 - /* 1128 - *---------------------------------------------------------------------- 1129 - * 1130 - * svga3dsurface_get_mip_size -- 1131 - * 1132 - * Given a base level size and the mip level, compute the size of 1133 - * the mip level. 1134 - * 1135 - * Results: 1136 - * See above. 1137 - * 1138 - * Side effects: 1139 - * None. 1140 - * 1141 - *---------------------------------------------------------------------- 958 + /** 959 + * svga3dsurface_get_mip_size - Given a base level size and the mip level, 960 + * compute the size of the mip level. 1142 961 */ 1143 - 1144 962 static inline surf_size_struct 1145 963 svga3dsurface_get_mip_size(surf_size_struct base_level, u32 mip_level) 1146 964 { ··· 1174 1018 return pitch; 1175 1019 } 1176 1020 1177 - /* 1178 - *----------------------------------------------------------------------------- 1021 + /** 1022 + * svga3dsurface_get_image_buffer_size - Calculates image buffer size. 1179 1023 * 1180 - * svga3dsurface_get_image_buffer_size -- 1024 + * Return the number of bytes of buffer space required to store one image of a 1025 + * surface, optionally using the specified pitch. 1181 1026 * 1182 - * Return the number of bytes of buffer space required to store 1183 - * one image of a surface, optionally using the specified pitch. 1027 + * If pitch is zero, it is assumed that rows are tightly packed. 1184 1028 * 1185 - * If pitch is zero, it is assumed that rows are tightly packed. 1186 - * 1187 - * This function is overflow-safe. If the result would have 1188 - * overflowed, instead we return MAX_UINT32. 1189 - * 1190 - * Results: 1191 - * Byte count. 1192 - * 1193 - * Side effects: 1194 - * None. 1195 - * 1196 - *----------------------------------------------------------------------------- 1029 + * This function is overflow-safe. If the result would have overflowed, instead 1030 + * we return MAX_UINT32. 1197 1031 */ 1198 - 1199 1032 static inline u32 1200 1033 svga3dsurface_get_image_buffer_size(const struct svga3d_surface_desc *desc, 1201 1034 const surf_size_struct *size, ··· 1212 1067 return total_size; 1213 1068 } 1214 1069 1070 + /** 1071 + * svga3dsurface_get_serialized_size - Get the serialized size for the image. 1072 + */ 1215 1073 static inline u32 1216 1074 svga3dsurface_get_serialized_size(SVGA3dSurfaceFormat format, 1217 1075 surf_size_struct base_level_size, ··· 1235 1087 return total_size * num_layers; 1236 1088 } 1237 1089 1090 + /** 1091 + * svga3dsurface_get_serialized_size_extended - Returns the number of bytes 1092 + * required for a surface with given parameters. Support for sample count. 1093 + */ 1094 + static inline u32 1095 + svga3dsurface_get_serialized_size_extended(SVGA3dSurfaceFormat format, 1096 + surf_size_struct base_level_size, 1097 + u32 num_mip_levels, 1098 + u32 num_layers, 1099 + u32 num_samples) 1100 + { 1101 + uint64_t total_size = 1102 + svga3dsurface_get_serialized_size(format, 1103 + base_level_size, 1104 + num_mip_levels, 1105 + num_layers); 1106 + total_size *= max_t(u32, 1, num_samples); 1107 + 1108 + return min_t(uint64_t, total_size, (uint64_t)U32_MAX); 1109 + } 1238 1110 1239 1111 /** 1240 1112 * svga3dsurface_get_pixel_offset - Compute the offset (in bytes) to a pixel ··· 1374 1206 } 1375 1207 return svga3dsurface_is_dx_screen_target_format(format); 1376 1208 } 1209 + 1210 + #endif /* _SVGA3D_SURFACEDEFS_H_ */
+221 -110
drivers/gpu/drm/vmwgfx/device_include/svga3d_types.h
··· 45 45 46 46 #define SVGA3D_INVALID_ID ((uint32)-1) 47 47 48 + typedef uint8 SVGABool8; /* 8-bit Bool definition */ 48 49 typedef uint32 SVGA3dBool; /* 32-bit Bool definition */ 49 50 typedef uint32 SVGA3dColor; /* a, r, g, b */ 51 + 52 + typedef uint32 SVGA3dSurfaceId; 53 + 54 + typedef 55 + #include "vmware_pack_begin.h" 56 + struct { 57 + uint32 numerator; 58 + uint32 denominator; 59 + } 60 + #include "vmware_pack_end.h" 61 + SVGA3dFraction64; 50 62 51 63 typedef 52 64 #include "vmware_pack_begin.h" ··· 158 146 SVGA3D_BUMPU8V8 = 20, 159 147 SVGA3D_BUMPL6V5U5 = 21, 160 148 SVGA3D_BUMPX8L8V8U8 = 22, 161 - SVGA3D_BUMPL8V8U8 = 23, 149 + SVGA3D_FORMAT_DEAD1 = 23, 162 150 163 151 SVGA3D_ARGB_S10E5 = 24, /* 16-bit floating-point ARGB */ 164 152 SVGA3D_ARGB_S23E8 = 25, /* 32-bit floating-point ARGB */ ··· 217 205 SVGA3D_R32G32_SINT = 59, 218 206 SVGA3D_R32G8X24_TYPELESS = 60, 219 207 SVGA3D_D32_FLOAT_S8X24_UINT = 61, 220 - SVGA3D_R32_FLOAT_X8X24_TYPELESS = 62, 221 - SVGA3D_X32_TYPELESS_G8X24_UINT = 63, 208 + SVGA3D_R32_FLOAT_X8X24 = 62, 209 + SVGA3D_X32_G8X24_UINT = 63, 222 210 SVGA3D_R10G10B10A2_TYPELESS = 64, 223 211 SVGA3D_R10G10B10A2_UINT = 65, 224 212 SVGA3D_R11G11B10_FLOAT = 66, ··· 236 224 SVGA3D_R32_SINT = 78, 237 225 SVGA3D_R24G8_TYPELESS = 79, 238 226 SVGA3D_D24_UNORM_S8_UINT = 80, 239 - SVGA3D_R24_UNORM_X8_TYPELESS = 81, 240 - SVGA3D_X24_TYPELESS_G8_UINT = 82, 227 + SVGA3D_R24_UNORM_X8 = 81, 228 + SVGA3D_X24_G8_UINT = 82, 241 229 SVGA3D_R8G8_TYPELESS = 83, 242 230 SVGA3D_R8G8_UNORM = 84, 243 231 SVGA3D_R8G8_UINT = 85, ··· 309 297 SVGA3D_FORMAT_MAX 310 298 } SVGA3dSurfaceFormat; 311 299 312 - typedef enum SVGA3dSurfaceFlags { 313 - SVGA3D_SURFACE_CUBEMAP = (1 << 0), 300 + /* 301 + * SVGA3d Surface Flags -- 302 + */ 303 + #define SVGA3D_SURFACE_CUBEMAP (1 << 0) 314 304 315 - /* 316 - * HINT flags are not enforced by the device but are useful for 317 - * performance. 318 - */ 319 - SVGA3D_SURFACE_HINT_STATIC = (1 << 1), 320 - SVGA3D_SURFACE_HINT_DYNAMIC = (1 << 2), 321 - SVGA3D_SURFACE_HINT_INDEXBUFFER = (1 << 3), 322 - SVGA3D_SURFACE_HINT_VERTEXBUFFER = (1 << 4), 323 - SVGA3D_SURFACE_HINT_TEXTURE = (1 << 5), 324 - SVGA3D_SURFACE_HINT_RENDERTARGET = (1 << 6), 325 - SVGA3D_SURFACE_HINT_DEPTHSTENCIL = (1 << 7), 326 - SVGA3D_SURFACE_HINT_WRITEONLY = (1 << 8), 327 - SVGA3D_SURFACE_MASKABLE_ANTIALIAS = (1 << 9), 328 - SVGA3D_SURFACE_AUTOGENMIPMAPS = (1 << 10), 329 - SVGA3D_SURFACE_DECODE_RENDERTARGET = (1 << 11), 305 + /* 306 + * HINT flags are not enforced by the device but are useful for 307 + * performance. 308 + */ 309 + #define SVGA3D_SURFACE_HINT_STATIC (CONST64U(1) << 1) 310 + #define SVGA3D_SURFACE_HINT_DYNAMIC (CONST64U(1) << 2) 311 + #define SVGA3D_SURFACE_HINT_INDEXBUFFER (CONST64U(1) << 3) 312 + #define SVGA3D_SURFACE_HINT_VERTEXBUFFER (CONST64U(1) << 4) 313 + #define SVGA3D_SURFACE_HINT_TEXTURE (CONST64U(1) << 5) 314 + #define SVGA3D_SURFACE_HINT_RENDERTARGET (CONST64U(1) << 6) 315 + #define SVGA3D_SURFACE_HINT_DEPTHSTENCIL (CONST64U(1) << 7) 316 + #define SVGA3D_SURFACE_HINT_WRITEONLY (CONST64U(1) << 8) 317 + #define SVGA3D_SURFACE_MASKABLE_ANTIALIAS (CONST64U(1) << 9) 318 + #define SVGA3D_SURFACE_AUTOGENMIPMAPS (CONST64U(1) << 10) 330 319 331 - /* 332 - * Is this surface using a base-level pitch for it's mob backing? 333 - * 334 - * This flag is not intended to be set by guest-drivers, but is instead 335 - * set by the device when the surface is bound to a mob with a specified 336 - * pitch. 337 - */ 338 - SVGA3D_SURFACE_MOB_PITCH = (1 << 12), 320 + #define SVGA3D_SURFACE_DECODE_RENDERTARGET (CONST64U(1) << 11) 339 321 340 - SVGA3D_SURFACE_INACTIVE = (1 << 13), 341 - SVGA3D_SURFACE_HINT_RT_LOCKABLE = (1 << 14), 342 - SVGA3D_SURFACE_VOLUME = (1 << 15), 322 + /* 323 + * Is this surface using a base-level pitch for it's mob backing? 324 + * 325 + * This flag is not intended to be set by guest-drivers, but is instead 326 + * set by the device when the surface is bound to a mob with a specified 327 + * pitch. 328 + */ 329 + #define SVGA3D_SURFACE_MOB_PITCH (CONST64U(1) << 12) 343 330 344 - /* 345 - * Required to be set on a surface to bind it to a screen target. 346 - */ 347 - SVGA3D_SURFACE_SCREENTARGET = (1 << 16), 331 + #define SVGA3D_SURFACE_INACTIVE (CONST64U(1) << 13) 332 + #define SVGA3D_SURFACE_HINT_RT_LOCKABLE (CONST64U(1) << 14) 333 + #define SVGA3D_SURFACE_VOLUME (CONST64U(1) << 15) 348 334 349 - /* 350 - * Align images in the guest-backing mob to 16-bytes. 351 - */ 352 - SVGA3D_SURFACE_ALIGN16 = (1 << 17), 335 + /* 336 + * Required to be set on a surface to bind it to a screen target. 337 + */ 338 + #define SVGA3D_SURFACE_SCREENTARGET (CONST64U(1) << 16) 353 339 354 - SVGA3D_SURFACE_1D = (1 << 18), 355 - SVGA3D_SURFACE_ARRAY = (1 << 19), 340 + /* 341 + * Align images in the guest-backing mob to 16-bytes. 342 + */ 343 + #define SVGA3D_SURFACE_ALIGN16 (CONST64U(1) << 17) 356 344 357 - /* 358 - * Bind flags. 359 - * These are enforced for any surface defined with DefineGBSurface_v2. 360 - */ 361 - SVGA3D_SURFACE_BIND_VERTEX_BUFFER = (1 << 20), 362 - SVGA3D_SURFACE_BIND_INDEX_BUFFER = (1 << 21), 363 - SVGA3D_SURFACE_BIND_CONSTANT_BUFFER = (1 << 22), 364 - SVGA3D_SURFACE_BIND_SHADER_RESOURCE = (1 << 23), 365 - SVGA3D_SURFACE_BIND_RENDER_TARGET = (1 << 24), 366 - SVGA3D_SURFACE_BIND_DEPTH_STENCIL = (1 << 25), 367 - SVGA3D_SURFACE_BIND_STREAM_OUTPUT = (1 << 26), 345 + #define SVGA3D_SURFACE_1D (CONST64U(1) << 18) 346 + #define SVGA3D_SURFACE_ARRAY (CONST64U(1) << 19) 368 347 369 - /* 370 - * A note on staging flags: 371 - * 372 - * The STAGING flags notes that the surface will not be used directly by the 373 - * drawing pipeline, i.e. that it will not be bound to any bind point. 374 - * Staging surfaces may be used by copy operations to move data in and out 375 - * of other surfaces. 376 - * 377 - * The HINT_INDIRECT_UPDATE flag suggests that the surface will receive 378 - * updates indirectly, i.e. the surface will not be updated directly, but 379 - * will receive copies from staging surfaces. 380 - */ 381 - SVGA3D_SURFACE_STAGING_UPLOAD = (1 << 27), 382 - SVGA3D_SURFACE_STAGING_DOWNLOAD = (1 << 28), 383 - SVGA3D_SURFACE_HINT_INDIRECT_UPDATE = (1 << 29), 348 + /* 349 + * Bind flags. 350 + * These are enforced for any surface defined with DefineGBSurface_v2. 351 + */ 352 + #define SVGA3D_SURFACE_BIND_VERTEX_BUFFER (CONST64U(1) << 20) 353 + #define SVGA3D_SURFACE_BIND_INDEX_BUFFER (CONST64U(1) << 21) 354 + #define SVGA3D_SURFACE_BIND_CONSTANT_BUFFER (CONST64U(1) << 22) 355 + #define SVGA3D_SURFACE_BIND_SHADER_RESOURCE (CONST64U(1) << 23) 356 + #define SVGA3D_SURFACE_BIND_RENDER_TARGET (CONST64U(1) << 24) 357 + #define SVGA3D_SURFACE_BIND_DEPTH_STENCIL (CONST64U(1) << 25) 358 + #define SVGA3D_SURFACE_BIND_STREAM_OUTPUT (CONST64U(1) << 26) 384 359 385 - /* 386 - * Setting this flag allow this surface to be used with the 387 - * SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER command. It is only valid for 388 - * buffer surfaces, an no bind flags are allowed to be set on surfaces 389 - * with this flag. 390 - */ 391 - SVGA3D_SURFACE_TRANSFER_FROM_BUFFER = (1 << 30), 360 + /* 361 + * The STAGING flags notes that the surface will not be used directly by the 362 + * drawing pipeline, i.e. that it will not be bound to any bind point. 363 + * Staging surfaces may be used by copy operations to move data in and out 364 + * of other surfaces. No bind flags may be set on surfaces with this flag. 365 + * 366 + * The HINT_INDIRECT_UPDATE flag suggests that the surface will receive 367 + * updates indirectly, i.e. the surface will not be updated directly, but 368 + * will receive copies from staging surfaces. 369 + */ 370 + #define SVGA3D_SURFACE_STAGING_UPLOAD (CONST64U(1) << 27) 371 + #define SVGA3D_SURFACE_STAGING_DOWNLOAD (CONST64U(1) << 28) 372 + #define SVGA3D_SURFACE_HINT_INDIRECT_UPDATE (CONST64U(1) << 29) 392 373 393 - /* 394 - * Marker for the last defined bit. 395 - */ 396 - SVGA3D_SURFACE_FLAG_MAX = (1 << 31), 397 - } SVGA3dSurfaceFlags; 374 + /* 375 + * Setting this flag allow this surface to be used with the 376 + * SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER command. It is only valid for 377 + * buffer surfaces, and no bind flags are allowed to be set on surfaces 378 + * with this flag. 379 + */ 380 + #define SVGA3D_SURFACE_TRANSFER_FROM_BUFFER (CONST64U(1) << 30) 381 + 382 + /* 383 + * Reserved for video operations. 384 + */ 385 + #define SVGA3D_SURFACE_RESERVED1 (CONST64U(1) << 31) 386 + 387 + /* 388 + * Specifies that a surface is multisample, and therefore requires the full 389 + * mob-backing to store all the samples. 390 + */ 391 + #define SVGA3D_SURFACE_MULTISAMPLE (CONST64U(1) << 32) 392 + 393 + #define SVGA3D_SURFACE_FLAG_MAX (CONST64U(1) << 33) 394 + 395 + /* 396 + * Surface flags types: 397 + * 398 + * SVGA3dSurface1Flags: Lower 32-bits of flags. 399 + * SVGA3dSurface2Flags: Upper 32-bits of flags. 400 + * SVGA3dSurfaceAllFlags: Full 64-bits of flags. 401 + */ 402 + typedef uint32 SVGA3dSurface1Flags; 403 + typedef uint32 SVGA3dSurface2Flags; 404 + typedef uint64 SVGA3dSurfaceAllFlags; 405 + 406 + #define SVGA3D_SURFACE_FLAGS1_MASK ((uint64_t)MAX_UINT32) 407 + #define SVGA3D_SURFACE_FLAGS2_MASK (MAX_UINT64 & ~SVGA3D_SURFACE_FLAGS1_MASK) 398 408 399 409 #define SVGA3D_SURFACE_HB_DISALLOWED_MASK \ 400 410 ( SVGA3D_SURFACE_MOB_PITCH | \ ··· 427 393 SVGA3D_SURFACE_STAGING_UPLOAD | \ 428 394 SVGA3D_SURFACE_STAGING_DOWNLOAD | \ 429 395 SVGA3D_SURFACE_HINT_INDIRECT_UPDATE | \ 430 - SVGA3D_SURFACE_TRANSFER_FROM_BUFFER \ 396 + SVGA3D_SURFACE_TRANSFER_FROM_BUFFER | \ 397 + SVGA3D_SURFACE_MULTISAMPLE \ 398 + ) 399 + 400 + #define SVGA3D_SURFACE_HB_PRESENT_DISALLOWED_MASK \ 401 + ( SVGA3D_SURFACE_1D | \ 402 + SVGA3D_SURFACE_MULTISAMPLE \ 431 403 ) 432 404 433 405 #define SVGA3D_SURFACE_2D_DISALLOWED_MASK \ 434 406 ( SVGA3D_SURFACE_CUBEMAP | \ 435 407 SVGA3D_SURFACE_MASKABLE_ANTIALIAS | \ 436 408 SVGA3D_SURFACE_AUTOGENMIPMAPS | \ 437 - SVGA3D_SURFACE_DECODE_RENDERTARGET | \ 438 409 SVGA3D_SURFACE_VOLUME | \ 439 410 SVGA3D_SURFACE_1D | \ 440 - SVGA3D_SURFACE_ARRAY | \ 441 411 SVGA3D_SURFACE_BIND_VERTEX_BUFFER | \ 442 412 SVGA3D_SURFACE_BIND_INDEX_BUFFER | \ 443 413 SVGA3D_SURFACE_BIND_CONSTANT_BUFFER | \ 444 414 SVGA3D_SURFACE_BIND_DEPTH_STENCIL | \ 445 415 SVGA3D_SURFACE_BIND_STREAM_OUTPUT | \ 446 - SVGA3D_SURFACE_TRANSFER_FROM_BUFFER \ 416 + SVGA3D_SURFACE_TRANSFER_FROM_BUFFER | \ 417 + SVGA3D_SURFACE_MULTISAMPLE \ 418 + ) 419 + 420 + #define SVGA3D_SURFACE_BASICOPS_DISALLOWED_MASK \ 421 + ( SVGA3D_SURFACE_CUBEMAP | \ 422 + SVGA3D_SURFACE_AUTOGENMIPMAPS | \ 423 + SVGA3D_SURFACE_VOLUME | \ 424 + SVGA3D_SURFACE_1D | \ 425 + SVGA3D_SURFACE_MULTISAMPLE \ 447 426 ) 448 427 449 428 #define SVGA3D_SURFACE_SCREENTARGET_DISALLOWED_MASK \ 450 429 ( SVGA3D_SURFACE_CUBEMAP | \ 451 430 SVGA3D_SURFACE_AUTOGENMIPMAPS | \ 452 - SVGA3D_SURFACE_DECODE_RENDERTARGET | \ 453 431 SVGA3D_SURFACE_VOLUME | \ 454 432 SVGA3D_SURFACE_1D | \ 455 433 SVGA3D_SURFACE_BIND_VERTEX_BUFFER | \ ··· 473 427 SVGA3D_SURFACE_STAGING_UPLOAD | \ 474 428 SVGA3D_SURFACE_STAGING_DOWNLOAD | \ 475 429 SVGA3D_SURFACE_HINT_INDIRECT_UPDATE | \ 476 - SVGA3D_SURFACE_TRANSFER_FROM_BUFFER \ 430 + SVGA3D_SURFACE_TRANSFER_FROM_BUFFER | \ 431 + SVGA3D_SURFACE_MULTISAMPLE \ 432 + ) 433 + 434 + #define SVGA3D_SURFACE_BUFFER_DISALLOWED_MASK \ 435 + ( SVGA3D_SURFACE_CUBEMAP | \ 436 + SVGA3D_SURFACE_AUTOGENMIPMAPS | \ 437 + SVGA3D_SURFACE_VOLUME | \ 438 + SVGA3D_SURFACE_1D | \ 439 + SVGA3D_SURFACE_MASKABLE_ANTIALIAS | \ 440 + SVGA3D_SURFACE_ARRAY | \ 441 + SVGA3D_SURFACE_MULTISAMPLE | \ 442 + SVGA3D_SURFACE_MOB_PITCH \ 443 + ) 444 + 445 + #define SVGA3D_SURFACE_MULTISAMPLE_DISALLOWED_MASK \ 446 + ( SVGA3D_SURFACE_CUBEMAP | \ 447 + SVGA3D_SURFACE_AUTOGENMIPMAPS | \ 448 + SVGA3D_SURFACE_VOLUME | \ 449 + SVGA3D_SURFACE_1D | \ 450 + SVGA3D_SURFACE_SCREENTARGET | \ 451 + SVGA3D_SURFACE_MOB_PITCH \ 477 452 ) 478 453 479 454 #define SVGA3D_SURFACE_DX_ONLY_MASK \ 480 455 ( SVGA3D_SURFACE_BIND_STREAM_OUTPUT | \ 456 + SVGA3D_SURFACE_STAGING_UPLOAD | \ 457 + SVGA3D_SURFACE_STAGING_DOWNLOAD | \ 481 458 SVGA3D_SURFACE_TRANSFER_FROM_BUFFER \ 459 + ) 482 460 483 461 #define SVGA3D_SURFACE_STAGING_MASK \ 484 462 ( SVGA3D_SURFACE_STAGING_UPLOAD | \ ··· 558 488 559 489 /* 560 490 * Indicates that this format can be converted to any RGB format for which 561 - * SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB is specified 491 + * SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB is specified. 562 492 */ 563 493 SVGA3DFORMAT_OP_CONVERT_TO_ARGB = 0x00002000, 564 494 ··· 569 499 570 500 /* 571 501 * Indicated that this format can be read as an SRGB texture (meaning that the 572 - * sampler will linearize the looked up data) 502 + * sampler will linearize the looked up data). 573 503 */ 574 504 SVGA3DFORMAT_OP_SRGBREAD = 0x00008000, 575 505 576 506 /* 577 - * Indicates that this format can be used in the bumpmap instructions 507 + * Indicates that this format can be used in the bumpmap instructions. 578 508 */ 579 509 SVGA3DFORMAT_OP_BUMPMAP = 0x00010000, 580 510 581 511 /* 582 - * Indicates that this format can be sampled by the displacement map sampler 512 + * Indicates that this format can be sampled by the displacement map sampler. 583 513 */ 584 514 SVGA3DFORMAT_OP_DMAP = 0x00020000, 585 515 586 516 /* 587 - * Indicates that this format cannot be used with texture filtering 517 + * Indicates that this format cannot be used with texture filtering. 588 518 */ 589 519 SVGA3DFORMAT_OP_NOFILTER = 0x00040000, 590 520 ··· 601 531 SVGA3DFORMAT_OP_SRGBWRITE = 0x00100000, 602 532 603 533 /* 604 - * Indicates that this format cannot be used with alpha blending 534 + * Indicates that this format cannot be used with alpha blending. 605 535 */ 606 536 SVGA3DFORMAT_OP_NOALPHABLEND = 0x00200000, 607 537 608 538 /* 609 539 * Indicates that the device can auto-generated sublevels for resources 610 - * of this format 540 + * of this format. 611 541 */ 612 542 SVGA3DFORMAT_OP_AUTOGENMIPMAP = 0x00400000, 613 543 614 544 /* 615 - * Indicates that this format can be used by vertex texture sampler 545 + * Indicates that this format can be used by vertex texture sampler. 616 546 */ 617 547 SVGA3DFORMAT_OP_VERTEXTEXTURE = 0x00800000, 618 548 ··· 1572 1502 #include "vmware_pack_end.h" 1573 1503 SVGADXQueryResultUnion; 1574 1504 1575 - 1576 1505 typedef enum { 1577 1506 SVGA3D_QUERYSTATE_PENDING = 0, /* Query is not finished yet */ 1578 1507 SVGA3D_QUERYSTATE_SUCCEEDED = 1, /* Completed successfully */ ··· 1603 1534 struct { 1604 1535 union { 1605 1536 struct { 1606 - uint16 function; /* SVGA3dFogFunction */ 1607 - uint8 type; /* SVGA3dFogType */ 1608 - uint8 base; /* SVGA3dFogBase */ 1537 + uint16 function; /* SVGA3dFogFunction */ 1538 + uint8 type; /* SVGA3dFogType */ 1539 + uint8 base; /* SVGA3dFogBase */ 1609 1540 }; 1610 1541 uint32 uintValue; 1611 1542 }; ··· 1617 1548 * Uniquely identify one image (a 1D/2D/3D array) from a surface. This 1618 1549 * is a surface ID as well as face/mipmap indices. 1619 1550 */ 1620 - 1621 1551 typedef 1622 1552 #include "vmware_pack_begin.h" 1623 1553 struct SVGA3dSurfaceImageId { 1624 - uint32 sid; 1625 - uint32 face; 1626 - uint32 mipmap; 1554 + uint32 sid; 1555 + uint32 face; 1556 + uint32 mipmap; 1627 1557 } 1628 1558 #include "vmware_pack_end.h" 1629 1559 SVGA3dSurfaceImageId; 1560 + 1561 + typedef 1562 + #include "vmware_pack_begin.h" 1563 + struct SVGA3dSubSurfaceId { 1564 + uint32 sid; 1565 + uint32 subResourceId; 1566 + } 1567 + #include "vmware_pack_end.h" 1568 + SVGA3dSubSurfaceId; 1630 1569 1631 1570 typedef 1632 1571 #include "vmware_pack_begin.h" ··· 1660 1583 SVGA_OTABLE_DX9_MAX = 5, 1661 1584 1662 1585 SVGA_OTABLE_DXCONTEXT = 5, 1663 - SVGA_OTABLE_MAX = 6 1664 - } SVGAOTableType; 1586 + SVGA_OTABLE_DX_MAX = 6, 1665 1587 1666 - /* 1667 - * Deprecated. 1668 - */ 1669 - #define SVGA_OTABLE_COUNT 4 1588 + SVGA_OTABLE_RESERVED1 = 6, 1589 + SVGA_OTABLE_RESERVED2 = 7, 1590 + 1591 + /* 1592 + * Additions to this table need to be tied to HW-version features and 1593 + * checkpointed accordingly. 1594 + */ 1595 + SVGA_OTABLE_DEVEL_MAX = 8, 1596 + SVGA_OTABLE_MAX = 8 1597 + } SVGAOTableType; 1670 1598 1671 1599 typedef enum { 1672 1600 SVGA_COTABLE_MIN = 0, ··· 1688 1606 SVGA_COTABLE_DXSHADER = 10, 1689 1607 SVGA_COTABLE_DX10_MAX = 11, 1690 1608 SVGA_COTABLE_UAVIEW = 11, 1691 - SVGA_COTABLE_MAX 1609 + SVGA_COTABLE_MAX = 12, 1692 1610 } SVGACOTableType; 1693 1611 1694 1612 /* ··· 1709 1627 SVGA3D_MOBFMT_PREDX_MAX = 7, 1710 1628 SVGA3D_MOBFMT_EMPTY = 7, 1711 1629 SVGA3D_MOBFMT_MAX, 1630 + 1631 + /* 1632 + * This isn't actually used by the guest, but is a mob-format used 1633 + * internally by the SVGA device (and is therefore not binary compatible). 1634 + */ 1635 + SVGA3D_MOBFMT_HB, 1712 1636 } SVGAMobFormat; 1713 1637 1714 1638 #define SVGA3D_MOB_EMPTY_BASE 1 1639 + 1640 + /* 1641 + * Multisample pattern types. 1642 + */ 1643 + 1644 + typedef enum SVGA3dMSPattern { 1645 + SVGA3D_MS_PATTERN_NONE = 0, 1646 + SVGA3D_MS_PATTERN_MIN = 0, 1647 + SVGA3D_MS_PATTERN_STANDARD = 1, 1648 + SVGA3D_MS_PATTERN_CENTER = 2, 1649 + SVGA3D_MS_PATTERN_MAX = 3, 1650 + } SVGA3dMSPattern; 1651 + 1652 + /* 1653 + * Precision settings for each sample. 1654 + */ 1655 + 1656 + typedef enum SVGA3dMSQualityLevel { 1657 + SVGA3D_MS_QUALITY_NONE = 0, 1658 + SVGA3D_MS_QUALITY_MIN = 0, 1659 + SVGA3D_MS_QUALITY_FULL = 1, 1660 + SVGA3D_MS_QUALITY_MAX = 2, 1661 + } SVGA3dMSQualityLevel; 1715 1662 1716 1663 #endif /* _SVGA3D_TYPES_H_ */
+146 -31
drivers/gpu/drm/vmwgfx/device_include/svga_reg.h
··· 64 64 #define SVGA_MAX_BITS_PER_PIXEL 32 65 65 #define SVGA_MAX_DEPTH 24 66 66 #define SVGA_MAX_DISPLAYS 10 67 + #define SVGA_MAX_SCREEN_SIZE 8192 68 + #define SVGA_SCREEN_ROOT_LIMIT (SVGA_MAX_SCREEN_SIZE * SVGA_MAX_DISPLAYS) 69 + 67 70 68 71 /* 69 72 * Legal values for the SVGA_REG_CURSOR_ON register in old-fashioned 70 73 * cursor bypass mode. This is still supported, but no new guest 71 74 * drivers should use it. 72 75 */ 73 - #define SVGA_CURSOR_ON_HIDE 0x0 /* Must be 0 to maintain backward compatibility */ 74 - #define SVGA_CURSOR_ON_SHOW 0x1 /* Must be 1 to maintain backward compatibility */ 75 - #define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2 /* Remove the cursor from the framebuffer because we need to see what's under it */ 76 - #define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3 /* Put the cursor back in the framebuffer so the user can see it */ 76 + #define SVGA_CURSOR_ON_HIDE 0x0 77 + #define SVGA_CURSOR_ON_SHOW 0x1 78 + 79 + /* 80 + * Remove the cursor from the framebuffer 81 + * because we need to see what's under it 82 + */ 83 + #define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2 84 + 85 + /* Put the cursor back in the framebuffer so the user can see it */ 86 + #define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3 77 87 78 88 /* 79 89 * The maximum framebuffer size that can traced for guests unless the ··· 112 102 #define SVGA_VERSION_0 0 113 103 #define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0) 114 104 115 - /* "Invalid" value for all SVGA IDs. (Version ID, screen object ID, surface ID...) */ 105 + /* 106 + * "Invalid" value for all SVGA IDs. 107 + * (Version ID, screen object ID, surface ID...) 108 + */ 116 109 #define SVGA_ID_INVALID 0xFFFFFFFF 117 110 118 111 /* Port offsets, relative to BAR0 */ ··· 168 155 SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */ 169 156 SVGA_REG_SYNC = 21, /* See "FIFO Synchronization Registers" */ 170 157 SVGA_REG_BUSY = 22, /* See "FIFO Synchronization Registers" */ 171 - SVGA_REG_GUEST_ID = 23, /* Set guest OS identifier */ 158 + SVGA_REG_GUEST_ID = 23, /* (Deprecated) */ 172 159 SVGA_REG_CURSOR_ID = 24, /* (Deprecated) */ 173 160 SVGA_REG_CURSOR_X = 25, /* (Deprecated) */ 174 161 SVGA_REG_CURSOR_Y = 26, /* (Deprecated) */ ··· 200 187 SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */ 201 188 SVGA_REG_COMMAND_LOW = 48, /* Lower 32 bits and submits commands */ 202 189 SVGA_REG_COMMAND_HIGH = 49, /* Upper 32 bits of command buffer PA */ 203 - SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM = 50, /* Max primary memory */ 190 + 191 + /* 192 + * Max primary memory. 193 + * See SVGA_CAP_NO_BB_RESTRICTION. 194 + */ 195 + SVGA_REG_MAX_PRIMARY_MEM = 50, 196 + SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM = 50, 197 + 204 198 SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51, /* Sugested limit on mob mem */ 205 199 SVGA_REG_DEV_CAP = 52, /* Write dev cap index, read value */ 206 200 SVGA_REG_CMD_PREPEND_LOW = 53, ··· 215 195 SVGA_REG_SCREENTARGET_MAX_WIDTH = 55, 216 196 SVGA_REG_SCREENTARGET_MAX_HEIGHT = 56, 217 197 SVGA_REG_MOB_MAX_SIZE = 57, 218 - SVGA_REG_TOP = 58, /* Must be 1 more than the last register */ 198 + SVGA_REG_BLANK_SCREEN_TARGETS = 58, 199 + SVGA_REG_CAP2 = 59, 200 + SVGA_REG_DEVEL_CAP = 60, 201 + SVGA_REG_TOP = 61, /* Must be 1 more than the last register */ 219 202 220 203 SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ 221 204 /* Next 768 (== 256*3) registers exist for colormap */ ··· 416 393 SVGA_CB_CONTEXT_0 = 0x0, 417 394 SVGA_CB_CONTEXT_1 = 0x1, /* Supported with SVGA_CAP_HP_CMD_QUEUE */ 418 395 SVGA_CB_CONTEXT_MAX = 0x2, 396 + SVGA_CB_CONTEXT_HP_MAX = 0x2, 419 397 } SVGACBContext; 420 398 421 399 ··· 473 449 * due to an error. No IRQ is raised. 474 450 */ 475 451 SVGA_CB_STATUS_SUBMISSION_ERROR = 6, 452 + 453 + /* 454 + * Written by the host when the host finished a 455 + * SVGA_DC_CMD_ASYNC_STOP_QUEUE request for this command buffer 456 + * queue. The offset of the first byte not processed is stored in 457 + * the errorOffset field of the command buffer header. All guest 458 + * visible side effects of commands till that point are guaranteed 459 + * to be finished before this is written. The 460 + * SVGA_IRQFLAG_COMMAND_BUFFER IRQ is raised as long as the 461 + * SVGA_CB_FLAG_NO_IRQ is not set. 462 + */ 463 + SVGA_CB_STATUS_PARTIAL_COMPLETE = 7, 476 464 } SVGACBStatus; 477 465 478 466 typedef enum { ··· 497 461 typedef 498 462 #include "vmware_pack_begin.h" 499 463 struct { 500 - volatile SVGACBStatus status; 501 - volatile uint32 errorOffset; 464 + volatile SVGACBStatus status; /* Modified by device. */ 465 + volatile uint32 errorOffset; /* Modified by device. */ 502 466 uint64 id; 503 467 SVGACBFlags flags; 504 468 uint32 length; ··· 509 473 uint32 mobOffset; 510 474 } mob; 511 475 } ptr; 512 - uint32 offset; /* Valid if CMD_BUFFERS_2 cap set, must be zero otherwise */ 476 + uint32 offset; /* Valid if CMD_BUFFERS_2 cap set, must be zero otherwise, 477 + * modified by device. 478 + */ 513 479 uint32 dxContext; /* Valid if DX_CONTEXT flag set, must be zero otherwise */ 514 480 uint32 mustBeZero[6]; 515 481 } ··· 522 484 SVGA_DC_CMD_NOP = 0, 523 485 SVGA_DC_CMD_START_STOP_CONTEXT = 1, 524 486 SVGA_DC_CMD_PREEMPT = 2, 525 - SVGA_DC_CMD_MAX = 3, 526 - SVGA_DC_CMD_FORCE_UINT = MAX_UINT32, 487 + SVGA_DC_CMD_START_QUEUE = 3, /* Requires SVGA_CAP_HP_CMD_QUEUE */ 488 + SVGA_DC_CMD_ASYNC_STOP_QUEUE = 4, /* Requires SVGA_CAP_HP_CMD_QUEUE */ 489 + SVGA_DC_CMD_EMPTY_CONTEXT_QUEUE = 5, /* Requires SVGA_CAP_HP_CMD_QUEUE */ 490 + SVGA_DC_CMD_MAX = 6, 527 491 } SVGADeviceContextCmdId; 528 492 529 - typedef struct { 493 + /* 494 + * Starts or stops both SVGA_CB_CONTEXT_0 and SVGA_CB_CONTEXT_1. 495 + */ 496 + 497 + typedef struct SVGADCCmdStartStop { 530 498 uint32 enable; 531 - SVGACBContext context; 499 + SVGACBContext context; /* Must be zero */ 532 500 } SVGADCCmdStartStop; 533 501 534 502 /* 535 503 * SVGADCCmdPreempt -- 536 504 * 537 505 * This command allows the guest to request that all command buffers 538 - * on the specified context be preempted that can be. After execution 506 + * on SVGA_CB_CONTEXT_0 be preempted that can be. After execution 539 507 * of this command all command buffers that were preempted will 540 508 * already have SVGA_CB_STATUS_PREEMPTED written into the status 541 509 * field. The device might still be processing a command buffer, ··· 551 507 * command buffer header set to zero. 552 508 */ 553 509 554 - typedef struct { 555 - SVGACBContext context; 510 + typedef struct SVGADCCmdPreempt { 511 + SVGACBContext context; /* Must be zero */ 556 512 uint32 ignoreIDZero; 557 513 } SVGADCCmdPreempt; 514 + 515 + /* 516 + * Starts the requested command buffer processing queue. Valid only 517 + * if the SVGA_CAP_HP_CMD_QUEUE cap is set. 518 + * 519 + * For a command queue to be considered runnable it must be enabled 520 + * and any corresponding higher priority queues must also be enabled. 521 + * For example in order for command buffers to be processed on 522 + * SVGA_CB_CONTEXT_0 both SVGA_CB_CONTEXT_0 and SVGA_CB_CONTEXT_1 must 523 + * be enabled. But for commands to be runnable on SVGA_CB_CONTEXT_1 524 + * only that queue must be enabled. 525 + */ 526 + 527 + typedef struct SVGADCCmdStartQueue { 528 + SVGACBContext context; 529 + } SVGADCCmdStartQueue; 530 + 531 + /* 532 + * Requests the SVGA device to stop processing the requested command 533 + * buffer queue as soon as possible. The guest knows the stop has 534 + * completed when one of the following happens. 535 + * 536 + * 1) A command buffer status of SVGA_CB_STATUS_PARTIAL_COMPLETE is returned 537 + * 2) A command buffer error is encountered with would stop the queue 538 + * regardless of the async stop request. 539 + * 3) All command buffers that have been submitted complete successfully. 540 + * 4) The stop completes synchronously if no command buffers are 541 + * active on the queue when it is issued. 542 + * 543 + * If the command queue is not in a runnable state there is no 544 + * guarentee this async stop will finish. For instance if the high 545 + * priority queue is not enabled and a stop is requested on the low 546 + * priority queue, the high priority queue must be reenabled to 547 + * guarantee that the async stop will finish. 548 + * 549 + * This command along with SVGA_DC_CMD_EMPTY_CONTEXT_QUEUE can be used 550 + * to implement mid command buffer preemption. 551 + * 552 + * Valid only if the SVGA_CAP_HP_CMD_QUEUE cap is set. 553 + */ 554 + 555 + typedef struct SVGADCCmdAsyncStopQueue { 556 + SVGACBContext context; 557 + } SVGADCCmdAsyncStopQueue; 558 + 559 + /* 560 + * Requests the SVGA device to throw away any full command buffers on 561 + * the requested command queue that have not been started. For a 562 + * driver to know which command buffers were thrown away a driver 563 + * should only issue this command when the queue is stopped, for 564 + * whatever reason. 565 + */ 566 + 567 + typedef struct SVGADCCmdEmptyQueue { 568 + SVGACBContext context; 569 + } SVGADCCmdEmptyQueue; 570 + 558 571 559 572 /* 560 573 * SVGAGMRImageFormat -- ··· 638 537 struct { 639 538 uint32 bitsPerPixel : 8; 640 539 uint32 colorDepth : 8; 641 - uint32 reserved : 16; /* Must be zero */ 540 + uint32 reserved : 16; /* Must be zero */ 642 541 }; 643 542 644 543 uint32 value; ··· 802 701 * large enough to express any possible topology without holes between 803 702 * monitors.) 804 703 * 704 + * SVGA_CAP_CAP2_REGISTER -- 705 + * If this cap is present, the SVGA_REG_CAP2 register is supported. 805 706 */ 806 707 807 708 #define SVGA_CAP_NONE 0x00000000 ··· 830 727 #define SVGA_CAP_DX 0x10000000 831 728 #define SVGA_CAP_HP_CMD_QUEUE 0x20000000 832 729 #define SVGA_CAP_NO_BB_RESTRICTION 0x40000000 730 + #define SVGA_CAP_CAP2_REGISTER 0x80000000 833 731 834 - #define SVGA_CAP_CMD_RESERVED 0x80000000 732 + /* 733 + * The SVGA_REG_CAP2 register is an additional set of SVGA capability bits. 734 + * 735 + * SVGA_CAP2_GROW_OTABLE -- 736 + * Allow the GrowOTable/DXGrowCOTable commands. 737 + * 738 + * SVGA_CAP2_INTRA_SURFACE_COPY -- 739 + * Allow the IntraSurfaceCopy command. 740 + * 741 + * SVGA_CAP2_DX2 -- 742 + * Allow the DefineGBSurface_v3, WholeSurfaceCopy. 743 + * 744 + * SVGA_CAP2_RESERVED -- 745 + * Reserve the last bit for extending the SVGA capabilities to some 746 + * future mechanisms. 747 + */ 748 + #define SVGA_CAP2_NONE 0x00000000 749 + #define SVGA_CAP2_GROW_OTABLE 0x00000001 750 + #define SVGA_CAP2_INTRA_SURFACE_COPY 0x00000002 751 + #define SVGA_CAP2_DX2 0x00000004 752 + #define SVGA_CAP2_RESERVED 0x80000000 835 753 836 754 837 755 /* ··· 874 750 SVGABackdoorCapDeviceCaps = 0, 875 751 SVGABackdoorCapFifoCaps = 1, 876 752 SVGABackdoorCap3dHWVersion = 2, 877 - SVGABackdoorCapMax = 3, 753 + SVGABackdoorCapDeviceCaps2 = 3, 754 + SVGABackdoorCapMax = 4, 878 755 } SVGABackdoorCapType; 879 756 880 757 ··· 2066 1941 #define SVGA_GRAPHICS_MEMORY_KB_DEFAULT (256 * 1024) 2067 1942 2068 1943 #define SVGA_VRAM_SIZE_W2K (64 * 1024 * 1024) /* 64 MB */ 2069 - 2070 - /* 2071 - * To simplify autoDetect display configuration, support a minimum of 2072 - * two 1920x1200 monitors, 32bpp, side-by-side, optionally rotated: 2073 - * numDisplays = 2 2074 - * maxWidth = numDisplay * 1920 = 3840 2075 - * maxHeight = rotated width of single monitor = 1920 2076 - * vramSize = maxWidth * maxHeight * 4 = 29491200 2077 - */ 2078 - #define SVGA_VRAM_SIZE_AUTODETECT (32 * 1024 * 1024) 2079 1944 2080 1945 #if defined(VMX86_SERVER) 2081 1946 #define SVGA_VRAM_SIZE (4 * 1024 * 1024)
+3
drivers/gpu/drm/vmwgfx/device_include/svga_types.h
··· 41 41 42 42 typedef bool Bool; 43 43 44 + #define MAX_UINT64 U64_MAX 44 45 #define MAX_UINT32 U32_MAX 45 46 #define MAX_UINT16 U16_MAX 47 + 48 + #define CONST64U(x) x##ULL 46 49 47 50 #endif
+46 -3
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
··· 137 137 #define DRM_IOCTL_VMW_CREATE_EXTENDED_CONTEXT \ 138 138 DRM_IOWR(DRM_COMMAND_BASE + DRM_VMW_CREATE_EXTENDED_CONTEXT, \ 139 139 struct drm_vmw_context_arg) 140 + #define DRM_IOCTL_VMW_GB_SURFACE_CREATE_EXT \ 141 + DRM_IOWR(DRM_COMMAND_BASE + DRM_VMW_GB_SURFACE_CREATE_EXT, \ 142 + union drm_vmw_gb_surface_create_ext_arg) 143 + #define DRM_IOCTL_VMW_GB_SURFACE_REF_EXT \ 144 + DRM_IOWR(DRM_COMMAND_BASE + DRM_VMW_GB_SURFACE_REF_EXT, \ 145 + union drm_vmw_gb_surface_reference_ext_arg) 140 146 141 147 /** 142 148 * The core DRM version of this macro doesn't account for ··· 230 224 VMW_IOCTL_DEF(VMW_CREATE_EXTENDED_CONTEXT, 231 225 vmw_extended_context_define_ioctl, 232 226 DRM_AUTH | DRM_RENDER_ALLOW), 227 + VMW_IOCTL_DEF(VMW_GB_SURFACE_CREATE_EXT, 228 + vmw_gb_surface_define_ext_ioctl, 229 + DRM_AUTH | DRM_RENDER_ALLOW), 230 + VMW_IOCTL_DEF(VMW_GB_SURFACE_REF_EXT, 231 + vmw_gb_surface_reference_ext_ioctl, 232 + DRM_AUTH | DRM_RENDER_ALLOW), 233 233 }; 234 234 235 235 static const struct pci_device_id vmw_pci_id_list[] = { ··· 269 257 MODULE_PARM_DESC(assume_16bpp, "Assume 16-bpp when filtering modes"); 270 258 module_param_named(assume_16bpp, vmw_assume_16bpp, int, 0600); 271 259 260 + 261 + static void vmw_print_capabilities2(uint32_t capabilities2) 262 + { 263 + DRM_INFO("Capabilities2:\n"); 264 + if (capabilities2 & SVGA_CAP2_GROW_OTABLE) 265 + DRM_INFO(" Grow oTable.\n"); 266 + if (capabilities2 & SVGA_CAP2_INTRA_SURFACE_COPY) 267 + DRM_INFO(" IntraSurface copy.\n"); 268 + } 272 269 273 270 static void vmw_print_capabilities(uint32_t capabilities) 274 271 { ··· 705 684 } 706 685 707 686 dev_priv->capabilities = vmw_read(dev_priv, SVGA_REG_CAPABILITIES); 687 + 688 + if (dev_priv->capabilities & SVGA_CAP_CAP2_REGISTER) { 689 + dev_priv->capabilities2 = vmw_read(dev_priv, SVGA_REG_CAP2); 690 + } 691 + 692 + 708 693 ret = vmw_dma_select_mode(dev_priv); 709 694 if (unlikely(ret != 0)) { 710 695 DRM_INFO("Restricting capabilities due to IOMMU setup.\n"); ··· 779 752 } 780 753 781 754 vmw_print_capabilities(dev_priv->capabilities); 755 + if (dev_priv->capabilities & SVGA_CAP_CAP2_REGISTER) 756 + vmw_print_capabilities2(dev_priv->capabilities2); 782 757 783 758 ret = vmw_dma_masks(dev_priv); 784 759 if (unlikely(ret != 0)) ··· 913 884 914 885 if (dev_priv->has_mob) { 915 886 spin_lock(&dev_priv->cap_lock); 916 - vmw_write(dev_priv, SVGA_REG_DEV_CAP, SVGA3D_DEVCAP_DX); 887 + vmw_write(dev_priv, SVGA_REG_DEV_CAP, SVGA3D_DEVCAP_DXCONTEXT); 917 888 dev_priv->has_dx = !!vmw_read(dev_priv, SVGA_REG_DEV_CAP); 918 889 spin_unlock(&dev_priv->cap_lock); 919 890 } ··· 928 899 if (ret) 929 900 goto out_no_fifo; 930 901 902 + if (dev_priv->has_dx) { 903 + /* 904 + * SVGA_CAP2_DX2 (DefineGBSurface_v3) is needed for SM4_1 905 + * support 906 + */ 907 + if ((dev_priv->capabilities2 & SVGA_CAP2_DX2) != 0) { 908 + vmw_write(dev_priv, SVGA_REG_DEV_CAP, 909 + SVGA3D_DEVCAP_SM41); 910 + dev_priv->has_sm4_1 = vmw_read(dev_priv, 911 + SVGA_REG_DEV_CAP); 912 + } 913 + } 914 + 931 915 DRM_INFO("DX: %s\n", dev_priv->has_dx ? "yes." : "no."); 932 - DRM_INFO("Atomic: %s\n", 933 - (dev->driver->driver_features & DRIVER_ATOMIC) ? "yes" : "no"); 916 + DRM_INFO("Atomic: %s\n", (dev->driver->driver_features & DRIVER_ATOMIC) 917 + ? "yes." : "no."); 918 + DRM_INFO("SM4_1: %s\n", dev_priv->has_sm4_1 ? "yes." : "no."); 934 919 935 920 snprintf(host_log, sizeof(host_log), "vmwgfx: %s-%s", 936 921 VMWGFX_REPO, VMWGFX_GIT_VERSION);
+18 -6
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
··· 43 43 #include <linux/sync_file.h> 44 44 45 45 #define VMWGFX_DRIVER_NAME "vmwgfx" 46 - #define VMWGFX_DRIVER_DATE "20180322" 46 + #define VMWGFX_DRIVER_DATE "20180704" 47 47 #define VMWGFX_DRIVER_MAJOR 2 48 - #define VMWGFX_DRIVER_MINOR 14 49 - #define VMWGFX_DRIVER_PATCHLEVEL 1 48 + #define VMWGFX_DRIVER_MINOR 15 49 + #define VMWGFX_DRIVER_PATCHLEVEL 0 50 50 #define VMWGFX_FILE_PAGE_OFFSET 0x00100000 51 51 #define VMWGFX_FIFO_STATIC_SIZE (1024*1024) 52 52 #define VMWGFX_MAX_RELOCATIONS 2048 ··· 83 83 struct vmw_fpriv { 84 84 struct drm_master *locked_master; 85 85 struct ttm_object_file *tfile; 86 - bool gb_aware; 86 + bool gb_aware; /* user-space is guest-backed aware */ 87 87 }; 88 88 89 89 struct vmw_buffer_object { ··· 166 166 167 167 struct vmw_surface { 168 168 struct vmw_resource res; 169 - uint32_t flags; 169 + SVGA3dSurfaceAllFlags flags; 170 170 uint32_t format; 171 171 uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES]; 172 172 struct drm_vmw_size base_size; ··· 180 180 SVGA3dTextureFilter autogen_filter; 181 181 uint32_t multisample_count; 182 182 struct list_head view_list; 183 + SVGA3dMSPattern multisample_pattern; 184 + SVGA3dMSQualityLevel quality_level; 183 185 }; 184 186 185 187 struct vmw_marker_queue { ··· 388 386 uint32_t initial_height; 389 387 u32 *mmio_virt; 390 388 uint32_t capabilities; 389 + uint32_t capabilities2; 391 390 uint32_t max_gmr_ids; 392 391 uint32_t max_gmr_pages; 393 392 uint32_t max_mob_pages; ··· 400 397 spinlock_t cap_lock; 401 398 bool has_dx; 402 399 bool assume_16bpp; 400 + bool has_sm4_1; 403 401 404 402 /* 405 403 * VGA registers. ··· 1080 1076 struct vmw_surface *srf); 1081 1077 int vmw_surface_gb_priv_define(struct drm_device *dev, 1082 1078 uint32_t user_accounting_size, 1083 - uint32_t svga3d_flags, 1079 + SVGA3dSurfaceAllFlags svga3d_flags, 1084 1080 SVGA3dSurfaceFormat format, 1085 1081 bool for_scanout, 1086 1082 uint32_t num_mip_levels, 1087 1083 uint32_t multisample_count, 1088 1084 uint32_t array_size, 1089 1085 struct drm_vmw_size size, 1086 + SVGA3dMSPattern multisample_pattern, 1087 + SVGA3dMSQualityLevel quality_level, 1090 1088 struct vmw_surface **srf_out); 1089 + extern int vmw_gb_surface_define_ext_ioctl(struct drm_device *dev, 1090 + void *data, 1091 + struct drm_file *file_priv); 1092 + extern int vmw_gb_surface_reference_ext_ioctl(struct drm_device *dev, 1093 + void *data, 1094 + struct drm_file *file_priv); 1091 1095 1092 1096 /* 1093 1097 * Shader management - vmwgfx_shader.c
+30 -2
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
··· 3116 3116 &cmd->body.destSid, NULL); 3117 3117 } 3118 3118 3119 + /** 3120 + * vmw_cmd_intra_surface_copy - 3121 + * Validate an SVGA_3D_CMD_INTRA_SURFACE_COPY command 3122 + * 3123 + * @dev_priv: Pointer to a device private struct. 3124 + * @sw_context: The software context being used for this batch. 3125 + * @header: Pointer to the command header in the command stream. 3126 + */ 3127 + static int vmw_cmd_intra_surface_copy(struct vmw_private *dev_priv, 3128 + struct vmw_sw_context *sw_context, 3129 + SVGA3dCmdHeader *header) 3130 + { 3131 + struct { 3132 + SVGA3dCmdHeader header; 3133 + SVGA3dCmdIntraSurfaceCopy body; 3134 + } *cmd = container_of(header, typeof(*cmd), header); 3135 + 3136 + if (!(dev_priv->capabilities2 & SVGA_CAP2_INTRA_SURFACE_COPY)) 3137 + return -EINVAL; 3138 + 3139 + return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, 3140 + user_surface_converter, 3141 + &cmd->body.surface.sid, NULL); 3142 + } 3143 + 3144 + 3119 3145 static int vmw_cmd_check_not_3d(struct vmw_private *dev_priv, 3120 3146 struct vmw_sw_context *sw_context, 3121 3147 void *buf, uint32_t *size) ··· 3256 3230 false, false, false), 3257 3231 VMW_CMD_DEF(SVGA_3D_CMD_SCREEN_DMA, &vmw_cmd_invalid, 3258 3232 false, false, false), 3259 - VMW_CMD_DEF(SVGA_3D_CMD_SET_UNITY_SURFACE_COOKIE, &vmw_cmd_invalid, 3233 + VMW_CMD_DEF(SVGA_3D_CMD_DEAD1, &vmw_cmd_invalid, 3260 3234 false, false, false), 3261 - VMW_CMD_DEF(SVGA_3D_CMD_OPEN_CONTEXT_SURFACE, &vmw_cmd_invalid, 3235 + VMW_CMD_DEF(SVGA_3D_CMD_DEAD2, &vmw_cmd_invalid, 3262 3236 false, false, false), 3263 3237 VMW_CMD_DEF(SVGA_3D_CMD_LOGICOPS_BITBLT, &vmw_cmd_invalid, 3264 3238 false, false, false), ··· 3496 3470 &vmw_cmd_pred_copy_check, true, false, true), 3497 3471 VMW_CMD_DEF(SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER, 3498 3472 &vmw_cmd_dx_transfer_from_buffer, 3473 + true, false, true), 3474 + VMW_CMD_DEF(SVGA_3D_CMD_INTRA_SURFACE_COPY, &vmw_cmd_intra_surface_copy, 3499 3475 true, false, true), 3500 3476 }; 3501 3477
+12 -9
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
··· 56 56 case DRM_VMW_PARAM_HW_CAPS: 57 57 param->value = dev_priv->capabilities; 58 58 break; 59 + case DRM_VMW_PARAM_HW_CAPS2: 60 + param->value = dev_priv->capabilities2; 61 + break; 59 62 case DRM_VMW_PARAM_FIFO_CAPS: 60 63 param->value = dev_priv->fifo.capabilities; 61 64 break; ··· 116 113 case DRM_VMW_PARAM_DX: 117 114 param->value = dev_priv->has_dx; 118 115 break; 116 + case DRM_VMW_PARAM_SM4_1: 117 + param->value = dev_priv->has_sm4_1; 118 + break; 119 119 default: 120 120 return -EINVAL; 121 121 } ··· 128 122 129 123 static u32 vmw_mask_multisample(unsigned int cap, u32 fmt_value) 130 124 { 131 - /* If the header is updated, update the format test as well! */ 132 - BUILD_BUG_ON(SVGA3D_DEVCAP_DXFMT_BC5_UNORM + 1 != SVGA3D_DEVCAP_MAX); 133 - 134 - if (cap >= SVGA3D_DEVCAP_DXFMT_X8R8G8B8 && 135 - cap <= SVGA3D_DEVCAP_DXFMT_BC5_UNORM) 136 - fmt_value &= ~(SVGADX_DXFMT_MULTISAMPLE_2 | 137 - SVGADX_DXFMT_MULTISAMPLE_4 | 138 - SVGADX_DXFMT_MULTISAMPLE_8); 139 - else if (cap == SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES) 125 + /* 126 + * A version of user-space exists which use MULTISAMPLE_MASKABLESAMPLES 127 + * to check the sample count supported by virtual device. Since there 128 + * never was support for multisample count for backing MOB return 0. 129 + */ 130 + if (cap == SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES) 140 131 return 0; 141 132 142 133 return fmt_value;
+11 -9
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
··· 1238 1238 content_base_size.depth = 1; 1239 1239 1240 1240 ret = vmw_surface_gb_priv_define(dev, 1241 - 0, /* kernel visible only */ 1242 - 0, /* flags */ 1243 - format, 1244 - true, /* can be a scanout buffer */ 1245 - 1, /* num of mip levels */ 1246 - 0, 1247 - 0, 1248 - content_base_size, 1249 - srf_out); 1241 + 0, /* kernel visible only */ 1242 + 0, /* flags */ 1243 + format, 1244 + true, /* can be a scanout buffer */ 1245 + 1, /* num of mip levels */ 1246 + 0, 1247 + 0, 1248 + content_base_size, 1249 + SVGA3D_MS_PATTERN_NONE, 1250 + SVGA3D_MS_QUALITY_NONE, 1251 + srf_out); 1250 1252 if (ret) { 1251 1253 DRM_ERROR("Failed to allocate proxy content buffer\n"); 1252 1254 return ret;
+5
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
··· 1157 1157 content_srf.flags = 0; 1158 1158 content_srf.mip_levels[0] = 1; 1159 1159 content_srf.multisample_count = 0; 1160 + content_srf.multisample_pattern = 1161 + SVGA3D_MS_PATTERN_NONE; 1162 + content_srf.quality_level = SVGA3D_MS_QUALITY_NONE; 1160 1163 } else { 1161 1164 content_srf = *new_vfbs->surface; 1162 1165 } ··· 1188 1185 content_srf.multisample_count, 1189 1186 0, 1190 1187 display_base_size, 1188 + content_srf.multisample_pattern, 1189 + content_srf.quality_level, 1191 1190 &vps->surf); 1192 1191 if (ret != 0) { 1193 1192 DRM_ERROR("Couldn't allocate STDU surface.\n");
+354 -174
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
··· 33 33 #include "vmwgfx_binding.h" 34 34 #include "device_include/svga3d_surfacedefs.h" 35 35 36 + #define SVGA3D_FLAGS_64(upper32, lower32) (((uint64_t)upper32 << 32) | lower32) 37 + #define SVGA3D_FLAGS_UPPER_32(svga3d_flags) (svga3d_flags >> 32) 38 + #define SVGA3D_FLAGS_LOWER_32(svga3d_flags) \ 39 + (svga3d_flags & ((uint64_t)U32_MAX)) 36 40 37 41 /** 38 42 * struct vmw_user_surface - User-space visible surface resource ··· 85 81 bool readback, 86 82 struct ttm_validate_buffer *val_buf); 87 83 static int vmw_gb_surface_destroy(struct vmw_resource *res); 88 - 84 + static int 85 + vmw_gb_surface_define_internal(struct drm_device *dev, 86 + struct drm_vmw_gb_surface_create_ext_req *req, 87 + struct drm_vmw_gb_surface_create_rep *rep, 88 + struct drm_file *file_priv); 89 + static int 90 + vmw_gb_surface_reference_internal(struct drm_device *dev, 91 + struct drm_vmw_surface_arg *req, 92 + struct drm_vmw_gb_surface_ref_ext_rep *rep, 93 + struct drm_file *file_priv); 89 94 90 95 static const struct vmw_user_resource_conv user_surface_conv = { 91 96 .object_type = VMW_RES_SURFACE, ··· 237 224 cmd->header.id = SVGA_3D_CMD_SURFACE_DEFINE; 238 225 cmd->header.size = cmd_len; 239 226 cmd->body.sid = srf->res.id; 240 - cmd->body.surfaceFlags = srf->flags; 227 + /* 228 + * Downcast of surfaceFlags, was upcasted when received from user-space, 229 + * since driver internally stores as 64 bit. 230 + * For legacy surface define only 32 bit flag is supported. 231 + */ 232 + cmd->body.surfaceFlags = (SVGA3dSurface1Flags)srf->flags; 241 233 cmd->body.format = srf->format; 242 234 for (i = 0; i < DRM_VMW_MAX_SURFACE_FACES; ++i) 243 235 cmd->body.face[i].numMipLevels = srf->mip_levels[i]; ··· 778 760 srf = &user_srf->srf; 779 761 res = &srf->res; 780 762 781 - srf->flags = req->flags; 763 + /* Driver internally stores as 64-bit flags */ 764 + srf->flags = (SVGA3dSurfaceAllFlags)req->flags; 782 765 srf->format = req->format; 783 766 srf->scanout = req->scanout; 784 767 ··· 804 785 srf->base_size = *srf->sizes; 805 786 srf->autogen_filter = SVGA3D_TEX_FILTER_NONE; 806 787 srf->multisample_count = 0; 788 + srf->multisample_pattern = SVGA3D_MS_PATTERN_NONE; 789 + srf->quality_level = SVGA3D_MS_QUALITY_NONE; 807 790 808 791 cur_bo_offset = 0; 809 792 cur_offset = srf->offsets; ··· 1011 990 user_srf = container_of(base, struct vmw_user_surface, prime.base); 1012 991 srf = &user_srf->srf; 1013 992 1014 - rep->flags = srf->flags; 993 + /* Downcast of flags when sending back to user space */ 994 + rep->flags = (uint32_t)srf->flags; 1015 995 rep->format = srf->format; 1016 996 memcpy(rep->mip_levels, srf->mip_levels, sizeof(srf->mip_levels)); 1017 997 user_sizes = (struct drm_vmw_size __user *)(unsigned long) ··· 1053 1031 SVGA3dCmdHeader header; 1054 1032 SVGA3dCmdDefineGBSurface_v2 body; 1055 1033 } *cmd2; 1034 + struct { 1035 + SVGA3dCmdHeader header; 1036 + SVGA3dCmdDefineGBSurface_v3 body; 1037 + } *cmd3; 1056 1038 1057 1039 if (likely(res->id != -1)) 1058 1040 return 0; ··· 1073 1047 goto out_no_fifo; 1074 1048 } 1075 1049 1076 - if (srf->array_size > 0) { 1050 + if (dev_priv->has_sm4_1 && srf->array_size > 0) { 1051 + cmd_id = SVGA_3D_CMD_DEFINE_GB_SURFACE_V3; 1052 + cmd_len = sizeof(cmd3->body); 1053 + submit_len = sizeof(*cmd3); 1054 + } else if (srf->array_size > 0) { 1077 1055 /* has_dx checked on creation time. */ 1078 1056 cmd_id = SVGA_3D_CMD_DEFINE_GB_SURFACE_V2; 1079 1057 cmd_len = sizeof(cmd2->body); ··· 1090 1060 1091 1061 cmd = vmw_fifo_reserve(dev_priv, submit_len); 1092 1062 cmd2 = (typeof(cmd2))cmd; 1063 + cmd3 = (typeof(cmd3))cmd; 1093 1064 if (unlikely(!cmd)) { 1094 1065 DRM_ERROR("Failed reserving FIFO space for surface " 1095 1066 "creation.\n"); ··· 1098 1067 goto out_no_fifo; 1099 1068 } 1100 1069 1101 - if (srf->array_size > 0) { 1070 + if (dev_priv->has_sm4_1 && srf->array_size > 0) { 1071 + cmd3->header.id = cmd_id; 1072 + cmd3->header.size = cmd_len; 1073 + cmd3->body.sid = srf->res.id; 1074 + cmd3->body.surfaceFlags = srf->flags; 1075 + cmd3->body.format = srf->format; 1076 + cmd3->body.numMipLevels = srf->mip_levels[0]; 1077 + cmd3->body.multisampleCount = srf->multisample_count; 1078 + cmd3->body.multisamplePattern = srf->multisample_pattern; 1079 + cmd3->body.qualityLevel = srf->quality_level; 1080 + cmd3->body.autogenFilter = srf->autogen_filter; 1081 + cmd3->body.size.width = srf->base_size.width; 1082 + cmd3->body.size.height = srf->base_size.height; 1083 + cmd3->body.size.depth = srf->base_size.depth; 1084 + cmd3->body.arraySize = srf->array_size; 1085 + } else if (srf->array_size > 0) { 1102 1086 cmd2->header.id = cmd_id; 1103 1087 cmd2->header.size = cmd_len; 1104 1088 cmd2->body.sid = srf->res.id; ··· 1302 1256 1303 1257 /** 1304 1258 * vmw_gb_surface_define_ioctl - Ioctl function implementing 1305 - * the user surface define functionality. 1259 + * the user surface define functionality. 1306 1260 * 1307 - * @dev: Pointer to a struct drm_device. 1308 - * @data: Pointer to data copied from / to user-space. 1309 - * @file_priv: Pointer to a drm file private structure. 1261 + * @dev: Pointer to a struct drm_device. 1262 + * @data: Pointer to data copied from / to user-space. 1263 + * @file_priv: Pointer to a drm file private structure. 1310 1264 */ 1311 1265 int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, 1312 1266 struct drm_file *file_priv) 1313 1267 { 1314 - struct vmw_private *dev_priv = vmw_priv(dev); 1315 - struct vmw_user_surface *user_srf; 1316 - struct vmw_surface *srf; 1317 - struct vmw_resource *res; 1318 - struct vmw_resource *tmp; 1319 1268 union drm_vmw_gb_surface_create_arg *arg = 1320 1269 (union drm_vmw_gb_surface_create_arg *)data; 1321 - struct drm_vmw_gb_surface_create_req *req = &arg->req; 1322 1270 struct drm_vmw_gb_surface_create_rep *rep = &arg->rep; 1323 - struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; 1324 - int ret; 1325 - uint32_t size; 1326 - uint32_t backup_handle = 0; 1271 + struct drm_vmw_gb_surface_create_ext_req req_ext; 1327 1272 1328 - if (req->multisample_count != 0) 1329 - return -EINVAL; 1273 + req_ext.base = arg->req; 1274 + req_ext.version = drm_vmw_gb_surface_v1; 1275 + req_ext.svga3d_flags_upper_32_bits = 0; 1276 + req_ext.multisample_pattern = SVGA3D_MS_PATTERN_NONE; 1277 + req_ext.quality_level = SVGA3D_MS_QUALITY_NONE; 1278 + req_ext.must_be_zero = 0; 1330 1279 1331 - if (req->mip_levels > DRM_VMW_MAX_MIP_LEVELS) 1332 - return -EINVAL; 1333 - 1334 - if (unlikely(vmw_user_surface_size == 0)) 1335 - vmw_user_surface_size = ttm_round_pot(sizeof(*user_srf)) + 1336 - 128; 1337 - 1338 - size = vmw_user_surface_size + 128; 1339 - 1340 - /* Define a surface based on the parameters. */ 1341 - ret = vmw_surface_gb_priv_define(dev, 1342 - size, 1343 - req->svga3d_flags, 1344 - req->format, 1345 - req->drm_surface_flags & drm_vmw_surface_flag_scanout, 1346 - req->mip_levels, 1347 - req->multisample_count, 1348 - req->array_size, 1349 - req->base_size, 1350 - &srf); 1351 - if (unlikely(ret != 0)) 1352 - return ret; 1353 - 1354 - user_srf = container_of(srf, struct vmw_user_surface, srf); 1355 - if (drm_is_primary_client(file_priv)) 1356 - user_srf->master = drm_master_get(file_priv->master); 1357 - 1358 - ret = ttm_read_lock(&dev_priv->reservation_sem, true); 1359 - if (unlikely(ret != 0)) 1360 - return ret; 1361 - 1362 - res = &user_srf->srf.res; 1363 - 1364 - 1365 - if (req->buffer_handle != SVGA3D_INVALID_ID) { 1366 - ret = vmw_user_bo_lookup(tfile, req->buffer_handle, 1367 - &res->backup, 1368 - &user_srf->backup_base); 1369 - if (ret == 0) { 1370 - if (res->backup->base.num_pages * PAGE_SIZE < 1371 - res->backup_size) { 1372 - DRM_ERROR("Surface backup buffer is too small.\n"); 1373 - vmw_bo_unreference(&res->backup); 1374 - ret = -EINVAL; 1375 - goto out_unlock; 1376 - } else { 1377 - backup_handle = req->buffer_handle; 1378 - } 1379 - } 1380 - } else if (req->drm_surface_flags & drm_vmw_surface_flag_create_buffer) 1381 - ret = vmw_user_bo_alloc(dev_priv, tfile, 1382 - res->backup_size, 1383 - req->drm_surface_flags & 1384 - drm_vmw_surface_flag_shareable, 1385 - &backup_handle, 1386 - &res->backup, 1387 - &user_srf->backup_base); 1388 - 1389 - if (unlikely(ret != 0)) { 1390 - vmw_resource_unreference(&res); 1391 - goto out_unlock; 1392 - } 1393 - 1394 - tmp = vmw_resource_reference(res); 1395 - ret = ttm_prime_object_init(tfile, res->backup_size, &user_srf->prime, 1396 - req->drm_surface_flags & 1397 - drm_vmw_surface_flag_shareable, 1398 - VMW_RES_SURFACE, 1399 - &vmw_user_surface_base_release, NULL); 1400 - 1401 - if (unlikely(ret != 0)) { 1402 - vmw_resource_unreference(&tmp); 1403 - vmw_resource_unreference(&res); 1404 - goto out_unlock; 1405 - } 1406 - 1407 - rep->handle = user_srf->prime.base.hash.key; 1408 - rep->backup_size = res->backup_size; 1409 - if (res->backup) { 1410 - rep->buffer_map_handle = 1411 - drm_vma_node_offset_addr(&res->backup->base.vma_node); 1412 - rep->buffer_size = res->backup->base.num_pages * PAGE_SIZE; 1413 - rep->buffer_handle = backup_handle; 1414 - } else { 1415 - rep->buffer_map_handle = 0; 1416 - rep->buffer_size = 0; 1417 - rep->buffer_handle = SVGA3D_INVALID_ID; 1418 - } 1419 - 1420 - vmw_resource_unreference(&res); 1421 - 1422 - out_unlock: 1423 - ttm_read_unlock(&dev_priv->reservation_sem); 1424 - return ret; 1280 + return vmw_gb_surface_define_internal(dev, &req_ext, rep, file_priv); 1425 1281 } 1426 1282 1427 1283 /** 1428 1284 * vmw_gb_surface_reference_ioctl - Ioctl function implementing 1429 - * the user surface reference functionality. 1285 + * the user surface reference functionality. 1430 1286 * 1431 - * @dev: Pointer to a struct drm_device. 1432 - * @data: Pointer to data copied from / to user-space. 1433 - * @file_priv: Pointer to a drm file private structure. 1287 + * @dev: Pointer to a struct drm_device. 1288 + * @data: Pointer to data copied from / to user-space. 1289 + * @file_priv: Pointer to a drm file private structure. 1434 1290 */ 1435 1291 int vmw_gb_surface_reference_ioctl(struct drm_device *dev, void *data, 1436 1292 struct drm_file *file_priv) 1437 1293 { 1438 - struct vmw_private *dev_priv = vmw_priv(dev); 1439 1294 union drm_vmw_gb_surface_reference_arg *arg = 1440 1295 (union drm_vmw_gb_surface_reference_arg *)data; 1441 1296 struct drm_vmw_surface_arg *req = &arg->req; 1442 1297 struct drm_vmw_gb_surface_ref_rep *rep = &arg->rep; 1443 - struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; 1444 - struct vmw_surface *srf; 1445 - struct vmw_user_surface *user_srf; 1446 - struct ttm_base_object *base; 1447 - uint32_t backup_handle; 1448 - int ret = -EINVAL; 1298 + struct drm_vmw_gb_surface_ref_ext_rep rep_ext; 1299 + int ret; 1449 1300 1450 - ret = vmw_surface_handle_reference(dev_priv, file_priv, req->sid, 1451 - req->handle_type, &base); 1301 + ret = vmw_gb_surface_reference_internal(dev, req, &rep_ext, file_priv); 1302 + 1452 1303 if (unlikely(ret != 0)) 1453 1304 return ret; 1454 1305 1455 - user_srf = container_of(base, struct vmw_user_surface, prime.base); 1456 - srf = &user_srf->srf; 1457 - if (!srf->res.backup) { 1458 - DRM_ERROR("Shared GB surface is missing a backup buffer.\n"); 1459 - goto out_bad_resource; 1460 - } 1461 - 1462 - mutex_lock(&dev_priv->cmdbuf_mutex); /* Protect res->backup */ 1463 - ret = vmw_user_bo_reference(tfile, srf->res.backup, &backup_handle); 1464 - mutex_unlock(&dev_priv->cmdbuf_mutex); 1465 - 1466 - if (unlikely(ret != 0)) { 1467 - DRM_ERROR("Could not add a reference to a GB surface " 1468 - "backup buffer.\n"); 1469 - (void) ttm_ref_object_base_unref(tfile, base->hash.key, 1470 - TTM_REF_USAGE); 1471 - goto out_bad_resource; 1472 - } 1473 - 1474 - rep->creq.svga3d_flags = srf->flags; 1475 - rep->creq.format = srf->format; 1476 - rep->creq.mip_levels = srf->mip_levels[0]; 1477 - rep->creq.drm_surface_flags = 0; 1478 - rep->creq.multisample_count = srf->multisample_count; 1479 - rep->creq.autogen_filter = srf->autogen_filter; 1480 - rep->creq.array_size = srf->array_size; 1481 - rep->creq.buffer_handle = backup_handle; 1482 - rep->creq.base_size = srf->base_size; 1483 - rep->crep.handle = user_srf->prime.base.hash.key; 1484 - rep->crep.backup_size = srf->res.backup_size; 1485 - rep->crep.buffer_handle = backup_handle; 1486 - rep->crep.buffer_map_handle = 1487 - drm_vma_node_offset_addr(&srf->res.backup->base.vma_node); 1488 - rep->crep.buffer_size = srf->res.backup->base.num_pages * PAGE_SIZE; 1489 - 1490 - out_bad_resource: 1491 - ttm_base_object_unref(&base); 1306 + rep->creq = rep_ext.creq.base; 1307 + rep->crep = rep_ext.crep; 1492 1308 1493 1309 return ret; 1494 1310 } ··· 1368 1460 * @multisample_count: 1369 1461 * @array_size: Surface array size. 1370 1462 * @size: width, heigh, depth of the surface requested 1463 + * @multisample_pattern: Multisampling pattern when msaa is supported 1464 + * @quality_level: Precision settings 1371 1465 * @user_srf_out: allocated user_srf. Set to NULL on failure. 1372 1466 * 1373 1467 * GB surfaces allocated by this function will not have a user mode handle, and ··· 1379 1469 */ 1380 1470 int vmw_surface_gb_priv_define(struct drm_device *dev, 1381 1471 uint32_t user_accounting_size, 1382 - uint32_t svga3d_flags, 1472 + SVGA3dSurfaceAllFlags svga3d_flags, 1383 1473 SVGA3dSurfaceFormat format, 1384 1474 bool for_scanout, 1385 1475 uint32_t num_mip_levels, 1386 1476 uint32_t multisample_count, 1387 1477 uint32_t array_size, 1388 1478 struct drm_vmw_size size, 1479 + SVGA3dMSPattern multisample_pattern, 1480 + SVGA3dMSQualityLevel quality_level, 1389 1481 struct vmw_surface **srf_out) 1390 1482 { 1391 1483 struct vmw_private *dev_priv = vmw_priv(dev); ··· 1398 1486 }; 1399 1487 struct vmw_surface *srf; 1400 1488 int ret; 1401 - u32 num_layers; 1489 + u32 num_layers = 1; 1490 + u32 sample_count = 1; 1402 1491 1403 1492 *srf_out = NULL; 1404 1493 ··· 1474 1561 srf->autogen_filter = SVGA3D_TEX_FILTER_NONE; 1475 1562 srf->array_size = array_size; 1476 1563 srf->multisample_count = multisample_count; 1564 + srf->multisample_pattern = multisample_pattern; 1565 + srf->quality_level = quality_level; 1477 1566 1478 1567 if (array_size) 1479 1568 num_layers = array_size; 1480 1569 else if (svga3d_flags & SVGA3D_SURFACE_CUBEMAP) 1481 1570 num_layers = SVGA3D_MAX_SURFACE_FACES; 1482 - else 1483 - num_layers = 1; 1571 + 1572 + if (srf->flags & SVGA3D_SURFACE_MULTISAMPLE) 1573 + sample_count = srf->multisample_count; 1484 1574 1485 1575 srf->res.backup_size = 1486 - svga3dsurface_get_serialized_size(srf->format, 1487 - srf->base_size, 1488 - srf->mip_levels[0], 1489 - num_layers); 1576 + svga3dsurface_get_serialized_size_extended(srf->format, 1577 + srf->base_size, 1578 + srf->mip_levels[0], 1579 + num_layers, 1580 + sample_count); 1490 1581 1491 1582 if (srf->flags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT) 1492 1583 srf->res.backup_size += sizeof(SVGA3dDXSOState); ··· 1513 1596 1514 1597 out_unlock: 1515 1598 ttm_read_unlock(&dev_priv->reservation_sem); 1599 + return ret; 1600 + } 1601 + 1602 + /** 1603 + * vmw_gb_surface_define_ext_ioctl - Ioctl function implementing 1604 + * the user surface define functionality. 1605 + * 1606 + * @dev: Pointer to a struct drm_device. 1607 + * @data: Pointer to data copied from / to user-space. 1608 + * @file_priv: Pointer to a drm file private structure. 1609 + */ 1610 + int vmw_gb_surface_define_ext_ioctl(struct drm_device *dev, void *data, 1611 + struct drm_file *file_priv) 1612 + { 1613 + union drm_vmw_gb_surface_create_ext_arg *arg = 1614 + (union drm_vmw_gb_surface_create_ext_arg *)data; 1615 + struct drm_vmw_gb_surface_create_ext_req *req = &arg->req; 1616 + struct drm_vmw_gb_surface_create_rep *rep = &arg->rep; 1617 + 1618 + return vmw_gb_surface_define_internal(dev, req, rep, file_priv); 1619 + } 1620 + 1621 + /** 1622 + * vmw_gb_surface_reference_ext_ioctl - Ioctl function implementing 1623 + * the user surface reference functionality. 1624 + * 1625 + * @dev: Pointer to a struct drm_device. 1626 + * @data: Pointer to data copied from / to user-space. 1627 + * @file_priv: Pointer to a drm file private structure. 1628 + */ 1629 + int vmw_gb_surface_reference_ext_ioctl(struct drm_device *dev, void *data, 1630 + struct drm_file *file_priv) 1631 + { 1632 + union drm_vmw_gb_surface_reference_ext_arg *arg = 1633 + (union drm_vmw_gb_surface_reference_ext_arg *)data; 1634 + struct drm_vmw_surface_arg *req = &arg->req; 1635 + struct drm_vmw_gb_surface_ref_ext_rep *rep = &arg->rep; 1636 + 1637 + return vmw_gb_surface_reference_internal(dev, req, rep, file_priv); 1638 + } 1639 + 1640 + /** 1641 + * vmw_gb_surface_define_internal - Ioctl function implementing 1642 + * the user surface define functionality. 1643 + * 1644 + * @dev: Pointer to a struct drm_device. 1645 + * @req: Request argument from user-space. 1646 + * @rep: Response argument to user-space. 1647 + * @file_priv: Pointer to a drm file private structure. 1648 + */ 1649 + static int 1650 + vmw_gb_surface_define_internal(struct drm_device *dev, 1651 + struct drm_vmw_gb_surface_create_ext_req *req, 1652 + struct drm_vmw_gb_surface_create_rep *rep, 1653 + struct drm_file *file_priv) 1654 + { 1655 + struct vmw_private *dev_priv = vmw_priv(dev); 1656 + struct vmw_user_surface *user_srf; 1657 + struct vmw_surface *srf; 1658 + struct vmw_resource *res; 1659 + struct vmw_resource *tmp; 1660 + struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; 1661 + int ret; 1662 + uint32_t size; 1663 + uint32_t backup_handle = 0; 1664 + SVGA3dSurfaceAllFlags svga3d_flags_64 = 1665 + SVGA3D_FLAGS_64(req->svga3d_flags_upper_32_bits, 1666 + req->base.svga3d_flags); 1667 + 1668 + if (!dev_priv->has_sm4_1) { 1669 + /* 1670 + * If SM4_1 is not support then cannot send 64-bit flag to 1671 + * device. 1672 + */ 1673 + if (req->svga3d_flags_upper_32_bits != 0) 1674 + return -EINVAL; 1675 + 1676 + if (req->base.multisample_count != 0) 1677 + return -EINVAL; 1678 + 1679 + if (req->multisample_pattern != SVGA3D_MS_PATTERN_NONE) 1680 + return -EINVAL; 1681 + 1682 + if (req->quality_level != SVGA3D_MS_QUALITY_NONE) 1683 + return -EINVAL; 1684 + } 1685 + 1686 + if ((svga3d_flags_64 & SVGA3D_SURFACE_MULTISAMPLE) && 1687 + req->base.multisample_count == 0) 1688 + return -EINVAL; 1689 + 1690 + if (req->base.mip_levels > DRM_VMW_MAX_MIP_LEVELS) 1691 + return -EINVAL; 1692 + 1693 + if (unlikely(vmw_user_surface_size == 0)) 1694 + vmw_user_surface_size = ttm_round_pot(sizeof(*user_srf)) + 1695 + 128; 1696 + 1697 + size = vmw_user_surface_size + 128; 1698 + 1699 + /* Define a surface based on the parameters. */ 1700 + ret = vmw_surface_gb_priv_define(dev, 1701 + size, 1702 + svga3d_flags_64, 1703 + req->base.format, 1704 + req->base.drm_surface_flags & 1705 + drm_vmw_surface_flag_scanout, 1706 + req->base.mip_levels, 1707 + req->base.multisample_count, 1708 + req->base.array_size, 1709 + req->base.base_size, 1710 + req->multisample_pattern, 1711 + req->quality_level, 1712 + &srf); 1713 + if (unlikely(ret != 0)) 1714 + return ret; 1715 + 1716 + user_srf = container_of(srf, struct vmw_user_surface, srf); 1717 + if (drm_is_primary_client(file_priv)) 1718 + user_srf->master = drm_master_get(file_priv->master); 1719 + 1720 + ret = ttm_read_lock(&dev_priv->reservation_sem, true); 1721 + if (unlikely(ret != 0)) 1722 + return ret; 1723 + 1724 + res = &user_srf->srf.res; 1725 + 1726 + if (req->base.buffer_handle != SVGA3D_INVALID_ID) { 1727 + ret = vmw_user_bo_lookup(tfile, req->base.buffer_handle, 1728 + &res->backup, 1729 + &user_srf->backup_base); 1730 + if (ret == 0) { 1731 + if (res->backup->base.num_pages * PAGE_SIZE < 1732 + res->backup_size) { 1733 + DRM_ERROR("Surface backup buffer too small.\n"); 1734 + vmw_bo_unreference(&res->backup); 1735 + ret = -EINVAL; 1736 + goto out_unlock; 1737 + } else { 1738 + backup_handle = req->base.buffer_handle; 1739 + } 1740 + } 1741 + } else if (req->base.drm_surface_flags & 1742 + drm_vmw_surface_flag_create_buffer) 1743 + ret = vmw_user_bo_alloc(dev_priv, tfile, 1744 + res->backup_size, 1745 + req->base.drm_surface_flags & 1746 + drm_vmw_surface_flag_shareable, 1747 + &backup_handle, 1748 + &res->backup, 1749 + &user_srf->backup_base); 1750 + 1751 + if (unlikely(ret != 0)) { 1752 + vmw_resource_unreference(&res); 1753 + goto out_unlock; 1754 + } 1755 + 1756 + tmp = vmw_resource_reference(res); 1757 + ret = ttm_prime_object_init(tfile, res->backup_size, &user_srf->prime, 1758 + req->base.drm_surface_flags & 1759 + drm_vmw_surface_flag_shareable, 1760 + VMW_RES_SURFACE, 1761 + &vmw_user_surface_base_release, NULL); 1762 + 1763 + if (unlikely(ret != 0)) { 1764 + vmw_resource_unreference(&tmp); 1765 + vmw_resource_unreference(&res); 1766 + goto out_unlock; 1767 + } 1768 + 1769 + rep->handle = user_srf->prime.base.hash.key; 1770 + rep->backup_size = res->backup_size; 1771 + if (res->backup) { 1772 + rep->buffer_map_handle = 1773 + drm_vma_node_offset_addr(&res->backup->base.vma_node); 1774 + rep->buffer_size = res->backup->base.num_pages * PAGE_SIZE; 1775 + rep->buffer_handle = backup_handle; 1776 + } else { 1777 + rep->buffer_map_handle = 0; 1778 + rep->buffer_size = 0; 1779 + rep->buffer_handle = SVGA3D_INVALID_ID; 1780 + } 1781 + 1782 + vmw_resource_unreference(&res); 1783 + 1784 + out_unlock: 1785 + ttm_read_unlock(&dev_priv->reservation_sem); 1786 + return ret; 1787 + } 1788 + 1789 + /** 1790 + * vmw_gb_surface_reference_internal - Ioctl function implementing 1791 + * the user surface reference functionality. 1792 + * 1793 + * @dev: Pointer to a struct drm_device. 1794 + * @req: Pointer to user-space request surface arg. 1795 + * @rep: Pointer to response to user-space. 1796 + * @file_priv: Pointer to a drm file private structure. 1797 + */ 1798 + static int 1799 + vmw_gb_surface_reference_internal(struct drm_device *dev, 1800 + struct drm_vmw_surface_arg *req, 1801 + struct drm_vmw_gb_surface_ref_ext_rep *rep, 1802 + struct drm_file *file_priv) 1803 + { 1804 + struct vmw_private *dev_priv = vmw_priv(dev); 1805 + struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; 1806 + struct vmw_surface *srf; 1807 + struct vmw_user_surface *user_srf; 1808 + struct ttm_base_object *base; 1809 + uint32_t backup_handle; 1810 + int ret = -EINVAL; 1811 + 1812 + ret = vmw_surface_handle_reference(dev_priv, file_priv, req->sid, 1813 + req->handle_type, &base); 1814 + if (unlikely(ret != 0)) 1815 + return ret; 1816 + 1817 + user_srf = container_of(base, struct vmw_user_surface, prime.base); 1818 + srf = &user_srf->srf; 1819 + if (!srf->res.backup) { 1820 + DRM_ERROR("Shared GB surface is missing a backup buffer.\n"); 1821 + goto out_bad_resource; 1822 + } 1823 + 1824 + mutex_lock(&dev_priv->cmdbuf_mutex); /* Protect res->backup */ 1825 + ret = vmw_user_bo_reference(tfile, srf->res.backup, &backup_handle); 1826 + mutex_unlock(&dev_priv->cmdbuf_mutex); 1827 + 1828 + if (unlikely(ret != 0)) { 1829 + DRM_ERROR("Could not add a reference to a GB surface " 1830 + "backup buffer.\n"); 1831 + (void) ttm_ref_object_base_unref(tfile, base->hash.key, 1832 + TTM_REF_USAGE); 1833 + goto out_bad_resource; 1834 + } 1835 + 1836 + rep->creq.base.svga3d_flags = SVGA3D_FLAGS_LOWER_32(srf->flags); 1837 + rep->creq.base.format = srf->format; 1838 + rep->creq.base.mip_levels = srf->mip_levels[0]; 1839 + rep->creq.base.drm_surface_flags = 0; 1840 + rep->creq.base.multisample_count = srf->multisample_count; 1841 + rep->creq.base.autogen_filter = srf->autogen_filter; 1842 + rep->creq.base.array_size = srf->array_size; 1843 + rep->creq.base.buffer_handle = backup_handle; 1844 + rep->creq.base.base_size = srf->base_size; 1845 + rep->crep.handle = user_srf->prime.base.hash.key; 1846 + rep->crep.backup_size = srf->res.backup_size; 1847 + rep->crep.buffer_handle = backup_handle; 1848 + rep->crep.buffer_map_handle = 1849 + drm_vma_node_offset_addr(&srf->res.backup->base.vma_node); 1850 + rep->crep.buffer_size = srf->res.backup->base.num_pages * PAGE_SIZE; 1851 + 1852 + rep->creq.version = drm_vmw_gb_surface_v1; 1853 + rep->creq.svga3d_flags_upper_32_bits = 1854 + SVGA3D_FLAGS_UPPER_32(srf->flags); 1855 + rep->creq.multisample_pattern = srf->multisample_pattern; 1856 + rep->creq.quality_level = srf->quality_level; 1857 + rep->creq.must_be_zero = 0; 1858 + 1859 + out_bad_resource: 1860 + ttm_base_object_unref(&base); 1861 + 1516 1862 return ret; 1517 1863 }
+107
include/uapi/drm/vmwgfx_drm.h
··· 69 69 #define DRM_VMW_GB_SURFACE_REF 24 70 70 #define DRM_VMW_SYNCCPU 25 71 71 #define DRM_VMW_CREATE_EXTENDED_CONTEXT 26 72 + #define DRM_VMW_GB_SURFACE_CREATE_EXT 27 73 + #define DRM_VMW_GB_SURFACE_REF_EXT 28 72 74 73 75 /*************************************************************************/ 74 76 /** ··· 82 80 * 83 81 * DRM_VMW_PARAM_OVERLAY_IOCTL: 84 82 * Does the driver support the overlay ioctl. 83 + * 84 + * DRM_VMW_PARAM_SM4_1 85 + * SM4_1 support is enabled. 85 86 */ 86 87 87 88 #define DRM_VMW_PARAM_NUM_STREAMS 0 ··· 100 95 #define DRM_VMW_PARAM_MAX_MOB_SIZE 10 101 96 #define DRM_VMW_PARAM_SCREEN_TARGET 11 102 97 #define DRM_VMW_PARAM_DX 12 98 + #define DRM_VMW_PARAM_HW_CAPS2 13 99 + #define DRM_VMW_PARAM_SM4_1 14 103 100 104 101 /** 105 102 * enum drm_vmw_handle_type - handle type for ref ioctls ··· 1110 1103 __u32 pad64; 1111 1104 }; 1112 1105 #define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg 1106 + 1107 + /*************************************************************************/ 1108 + /** 1109 + * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface. 1110 + * 1111 + * Allocates a surface handle and queues a create surface command 1112 + * for the host on the first use of the surface. The surface ID can 1113 + * be used as the surface ID in commands referencing the surface. 1114 + * 1115 + * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version 1116 + * parameter and 64 bit svga flag. 1117 + */ 1118 + 1119 + /** 1120 + * enum drm_vmw_surface_version 1121 + * 1122 + * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with 1123 + * svga3d surface flags split into 2, upper half and lower half. 1124 + */ 1125 + enum drm_vmw_surface_version { 1126 + drm_vmw_gb_surface_v1 1127 + }; 1128 + 1129 + /** 1130 + * struct drm_vmw_gb_surface_create_ext_req 1131 + * 1132 + * @base: Surface create parameters. 1133 + * @version: Version of surface create ioctl. 1134 + * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags. 1135 + * @multisample_pattern: Multisampling pattern when msaa is supported. 1136 + * @quality_level: Precision settings for each sample. 1137 + * @must_be_zero: Reserved for future usage. 1138 + * 1139 + * Input argument to the DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl. 1140 + * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl. 1141 + */ 1142 + struct drm_vmw_gb_surface_create_ext_req { 1143 + struct drm_vmw_gb_surface_create_req base; 1144 + enum drm_vmw_surface_version version; 1145 + uint32_t svga3d_flags_upper_32_bits; 1146 + SVGA3dMSPattern multisample_pattern; 1147 + SVGA3dMSQualityLevel quality_level; 1148 + uint64_t must_be_zero; 1149 + }; 1150 + 1151 + /** 1152 + * union drm_vmw_gb_surface_create_ext_arg 1153 + * 1154 + * @req: Input argument as described above. 1155 + * @rep: Output argument as described above. 1156 + * 1157 + * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl. 1158 + */ 1159 + union drm_vmw_gb_surface_create_ext_arg { 1160 + struct drm_vmw_gb_surface_create_rep rep; 1161 + struct drm_vmw_gb_surface_create_ext_req req; 1162 + }; 1163 + 1164 + /*************************************************************************/ 1165 + /** 1166 + * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface. 1167 + * 1168 + * Puts a reference on a host surface with a given handle, as previously 1169 + * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl. 1170 + * A reference will make sure the surface isn't destroyed while we hold 1171 + * it and will allow the calling client to use the surface handle in 1172 + * the command stream. 1173 + * 1174 + * On successful return, the Ioctl returns the surface information given 1175 + * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl. 1176 + */ 1177 + 1178 + /** 1179 + * struct drm_vmw_gb_surface_ref_ext_rep 1180 + * 1181 + * @creq: The data used as input when the surface was created, as described 1182 + * above at "struct drm_vmw_gb_surface_create_ext_req" 1183 + * @crep: Additional data output when the surface was created, as described 1184 + * above at "struct drm_vmw_gb_surface_create_rep" 1185 + * 1186 + * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl. 1187 + */ 1188 + struct drm_vmw_gb_surface_ref_ext_rep { 1189 + struct drm_vmw_gb_surface_create_ext_req creq; 1190 + struct drm_vmw_gb_surface_create_rep crep; 1191 + }; 1192 + 1193 + /** 1194 + * union drm_vmw_gb_surface_reference_ext_arg 1195 + * 1196 + * @req: Input data as described above at "struct drm_vmw_surface_arg" 1197 + * @rep: Output data as described above at 1198 + * "struct drm_vmw_gb_surface_ref_ext_rep" 1199 + * 1200 + * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl. 1201 + */ 1202 + union drm_vmw_gb_surface_reference_ext_arg { 1203 + struct drm_vmw_gb_surface_ref_ext_rep rep; 1204 + struct drm_vmw_surface_arg req; 1205 + }; 1113 1206 1114 1207 #if defined(__cplusplus) 1115 1208 }