Changeset 83274 in vbox for trunk/src/VBox
- Timestamp:
- Mar 12, 2020 5:12:56 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
r83273 r83274 268 268 STAMCOUNTER StatR3CmdDefineCursor; 269 269 STAMCOUNTER StatR3CmdDefineAlphaCursor; 270 STAMCOUNTER StatR3CmdMoveCursor; 271 STAMCOUNTER StatR3CmdDisplayCursor; 270 272 STAMCOUNTER StatR3CmdEscape; 271 273 STAMCOUNTER StatR3CmdDefineScreen; … … 431 433 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatR3CmdDefineCursor), 432 434 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatR3CmdDefineAlphaCursor), 435 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatR3CmdMoveCursor), 436 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatR3CmdDisplayCursor), 433 437 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatR3CmdEscape), 434 438 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatR3CmdDefineScreen), … … 528 532 SSMFIELD_ENTRY( VMSVGAState, cbScanline), 529 533 SSMFIELD_ENTRY_VER( VMSVGAState, uScreenOffset, VGA_SAVEDSTATE_VERSION_VMSVGA), 534 SSMFIELD_ENTRY_VER( VMSVGAState, uCursorX, VGA_SAVEDSTATE_VERSION_VMSVGA_CURSOR), 535 SSMFIELD_ENTRY_VER( VMSVGAState, uCursorY, VGA_SAVEDSTATE_VERSION_VMSVGA_CURSOR), 536 SSMFIELD_ENTRY_VER( VMSVGAState, uCursorID, VGA_SAVEDSTATE_VERSION_VMSVGA_CURSOR), 537 SSMFIELD_ENTRY_VER( VMSVGAState, uCursorOn, VGA_SAVEDSTATE_VERSION_VMSVGA_CURSOR), 530 538 SSMFIELD_ENTRY( VMSVGAState, u32MaxWidth), 531 539 SSMFIELD_ENTRY( VMSVGAState, u32MaxHeight), … … 658 666 case SVGA_CMD_RECT_COPY: return "SVGA_CMD_RECT_COPY"; 659 667 case SVGA_CMD_DEFINE_CURSOR: return "SVGA_CMD_DEFINE_CURSOR"; 668 case SVGA_CMD_DISPLAY_CURSOR: return "SVGA_CMD_DISPLAY_CURSOR"; 669 case SVGA_CMD_MOVE_CURSOR: return "SVGA_CMD_MOVE_CURSOR"; 660 670 case SVGA_CMD_DEFINE_ALPHA_CURSOR: return "SVGA_CMD_DEFINE_ALPHA_CURSOR"; 661 671 case SVGA_CMD_UPDATE_VERBOSE: return "SVGA_CMD_UPDATE_VERBOSE"; … … 1298 1308 /* Mouse cursor support. */ 1299 1309 case SVGA_REG_CURSOR_ID: 1310 STAM_REL_COUNTER_INC(&pThis->svga.StatRegCursorIdRd); 1311 *pu32 = pThis->svga.uCursorID; 1312 break; 1313 1300 1314 case SVGA_REG_CURSOR_X: 1315 STAM_REL_COUNTER_INC(&pThis->svga.StatRegCursorXRd); 1316 *pu32 = pThis->svga.uCursorX; 1317 break; 1318 1301 1319 case SVGA_REG_CURSOR_Y: 1320 STAM_REL_COUNTER_INC(&pThis->svga.StatRegCursorYRd); 1321 *pu32 = pThis->svga.uCursorY; 1322 break; 1323 1302 1324 case SVGA_REG_CURSOR_ON: 1303 STAM_REL_COUNTER_INC(&pThis->svga.StatRegCursorXxxxRd); 1325 STAM_REL_COUNTER_INC(&pThis->svga.StatRegCursorOnRd); 1326 *pu32 = pThis->svga.uCursorOn; 1304 1327 break; 1305 1328 … … 1556 1579 1557 1580 #endif /* IN_RING0 || IN_RING3 */ 1581 1582 #ifdef IN_RING3 1583 1584 /** 1585 * Sends cursor position and visibility information from legacy 1586 * SVGA registers to the front-end. 1587 */ 1588 static void vmsvgaR3RegUpdateCursor(PVGASTATECC pThisCC, PVGASTATE pThis, uint32_t uCursorOn) 1589 { 1590 /* 1591 * Writing the X/Y/ID registers does not trigger changes; only writing the 1592 * SVGA_REG_CURSOR_ON register does. That minimizes the overhead. 1593 * We boldly assume that guests aren't stupid and aren't writing the CURSOR_ON 1594 * register if they don't have to. 1595 */ 1596 uint32_t x, y, idScreen; 1597 uint32_t fFlags = VBVA_CURSOR_VALID_DATA; 1598 1599 x = pThis->svga.uCursorX; 1600 y = pThis->svga.uCursorY; 1601 idScreen = SVGA_ID_INVALID; /* The old register interface is single screen only. */ 1602 1603 /* The original values for SVGA_REG_CURSOR_ON were off (0) and on (1); later, the values 1604 * were extended as follows: 1605 * 1606 * SVGA_CURSOR_ON_HIDE 0 1607 * SVGA_CURSOR_ON_SHOW 1 1608 * SVGA_CURSOR_ON_REMOVE_FROM_FB 2 - cursor on but not in the framebuffer 1609 * SVGA_CURSOR_ON_RESTORE_TO_FB 3 - cursor on, possibly in the framebuffer 1610 * 1611 * Since we never draw the cursor into the guest's framebuffer, we do not need to 1612 * distinguish between the non-zero values but still remember them. 1613 */ 1614 if (RT_BOOL(pThis->svga.uCursorOn) != RT_BOOL(uCursorOn)) 1615 { 1616 LogRel2(("vmsvgaR3RegUpdateCursor: uCursorOn %d prev CursorOn %d (%d,%d)\n", uCursorOn, pThis->svga.uCursorOn, x, y)); 1617 pThisCC->pDrv->pfnVBVAMousePointerShape(pThisCC->pDrv, RT_BOOL(uCursorOn), false, 0, 0, 0, 0, NULL); 1618 } 1619 pThis->svga.uCursorOn = uCursorOn; 1620 pThisCC->pDrv->pfnVBVAReportCursorPosition(pThisCC->pDrv, fFlags, idScreen, x, y); 1621 } 1622 1623 #endif /* IN_RING3 */ 1558 1624 1559 1625 … … 1803 1869 /* Mouse cursor support */ 1804 1870 case SVGA_REG_CURSOR_ID: 1871 STAM_REL_COUNTER_INC(&pThis->svga.StatRegCursorIdWr); 1872 pThis->svga.uCursorID = u32; 1873 break; 1874 1805 1875 case SVGA_REG_CURSOR_X: 1876 STAM_REL_COUNTER_INC(&pThis->svga.StatRegCursorXWr); 1877 pThis->svga.uCursorX = u32; 1878 break; 1879 1806 1880 case SVGA_REG_CURSOR_Y: 1881 STAM_REL_COUNTER_INC(&pThis->svga.StatRegCursorYWr); 1882 pThis->svga.uCursorY = u32; 1883 break; 1884 1807 1885 case SVGA_REG_CURSOR_ON: 1808 STAM_REL_COUNTER_INC(&pThis->svga.StatRegCursorXxxxWr); 1886 #ifdef IN_RING3 1887 /* The cursor is only updated when SVGA_REG_CURSOR_ON is written. */ 1888 STAM_REL_COUNTER_INC(&pThis->svga.StatRegCursorOnWr); 1889 vmsvgaR3RegUpdateCursor(pThisCC, pThis, u32); 1890 #else 1891 rc = VINF_IOM_R3_IOPORT_WRITE; 1892 #endif 1809 1893 break; 1810 1894 … … 3849 3933 } 3850 3934 3935 case SVGA_CMD_MOVE_CURSOR: 3936 { 3937 /* Deprecated; there should be no driver which *requires* this command. However, if 3938 * we do ecncounter this command, it might be useful to not get the FIFO completely out of 3939 * alignment. 3940 * May be issued by guest if SVGA_CAP_CURSOR_BYPASS is missing. 3941 */ 3942 SVGAFifoCmdMoveCursor *pMoveCursor; 3943 VMSVGAFIFO_GET_CMD_BUFFER_BREAK(pMoveCursor, SVGAFifoCmdMoveCursor, sizeof(*pMoveCursor)); 3944 STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdMoveCursor); 3945 3946 Log(("vmsvgaR3FifoLoop: MOVE CURSOR to %d,%d\n", pMoveCursor->pos.x, pMoveCursor->pos.y)); 3947 LogRelMax(4, ("Unsupported SVGA_CMD_MOVE_CURSOR command ignored.\n")); 3948 break; 3949 } 3950 3951 case SVGA_CMD_DISPLAY_CURSOR: 3952 { 3953 /* Deprecated; there should be no driver which *requires* this command. However, if 3954 * we do ecncounter this command, it might be useful to not get the FIFO completely out of 3955 * alignment. 3956 * May be issued by guest if SVGA_CAP_CURSOR_BYPASS is missing. 3957 */ 3958 SVGAFifoCmdDisplayCursor *pDisplayCursor; 3959 VMSVGAFIFO_GET_CMD_BUFFER_BREAK(pDisplayCursor, SVGAFifoCmdDisplayCursor, sizeof(*pDisplayCursor)); 3960 STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdDisplayCursor); 3961 3962 Log(("vmsvgaR3FifoLoop: DISPLAY CURSOR id=%d state=%d\n", pDisplayCursor->id, pDisplayCursor->state)); 3963 LogRelMax(4, ("Unsupported SVGA_CMD_DISPLAY_CURSOR command ignored.\n")); 3964 break; 3965 } 3966 3851 3967 case SVGA_CMD_ESCAPE: 3852 3968 { … … 5573 5689 pHlp->pfnPrintf(pHlp, "Cursor byte size: %u (%#x)\n", pSVGAState->Cursor.cbData, pSVGAState->Cursor.cbData); 5574 5690 5691 pHlp->pfnPrintf(pHlp, "Legacy cursor: ID %u, state %u\n", pThis->svga.uCursorID, pThis->svga.uCursorOn); 5692 pHlp->pfnPrintf(pHlp, "Legacy cursor at: %u,%u\n", pThis->svga.uCursorX, pThis->svga.uCursorY); 5575 5693 # ifdef VBOX_WITH_VMSVGA3D 5576 5694 pHlp->pfnPrintf(pHlp, "3D enabled: %RTbool\n", pThis->svga.f3DEnabled); … … 5973 6091 | SVGA_CAP_GMR2 5974 6092 | SVGA_CAP_CURSOR 6093 | SVGA_CAP_CURSOR_BYPASS 5975 6094 | SVGA_CAP_CURSOR_BYPASS_2 5976 6095 | SVGA_CAP_EXTENDED_FIFO … … 6414 6533 REG_CNT(&pSVGAState->StatR3CmdDefineAlphaCursor, "VMSVGA/Cmd/DefineAlphaCursor", "SVGA_CMD_DEFINE_ALPHA_CURSOR"); 6415 6534 REG_CNT(&pSVGAState->StatR3CmdDefineCursor, "VMSVGA/Cmd/DefineCursor", "SVGA_CMD_DEFINE_CURSOR"); 6535 REG_CNT(&pSVGAState->StatR3CmdMoveCursor, "VMSVGA/Cmd/MoveCursor", "SVGA_CMD_MOVE_CURSOR"); 6536 REG_CNT(&pSVGAState->StatR3CmdDisplayCursor, "VMSVGA/Cmd/DisplayCursor", "SVGA_CMD_DISPLAY_CURSOR"); 6416 6537 REG_CNT(&pSVGAState->StatR3CmdDefineGmr2, "VMSVGA/Cmd/DefineGmr2", "SVGA_CMD_DEFINE_GMR2"); 6417 6538 REG_CNT(&pSVGAState->StatR3CmdDefineGmr2Free, "VMSVGA/Cmd/DefineGmr2/Free", "Number of SVGA_CMD_DEFINE_GMR2 commands that only frees."); … … 6434 6555 REG_CNT(&pThis->svga.StatRegBitsPerPixelWr, "VMSVGA/Reg/BitsPerPixelWrite", "SVGA_REG_BITS_PER_PIXEL writes."); 6435 6556 REG_CNT(&pThis->svga.StatRegBusyWr, "VMSVGA/Reg/BusyWrite", "SVGA_REG_BUSY writes."); 6436 REG_CNT(&pThis->svga.StatRegCursorXxxxWr, "VMSVGA/Reg/CursorXxxxWrite", "SVGA_REG_CURSOR_XXXX writes."); 6557 REG_CNT(&pThis->svga.StatRegCursorXWr, "VMSVGA/Reg/CursorXWrite", "SVGA_REG_CURSOR_X writes."); 6558 REG_CNT(&pThis->svga.StatRegCursorYWr, "VMSVGA/Reg/CursorYWrite", "SVGA_REG_CURSOR_Y writes."); 6559 REG_CNT(&pThis->svga.StatRegCursorIdWr, "VMSVGA/Reg/CursorIdWrite", "SVGA_REG_CURSOR_ID writes."); 6560 REG_CNT(&pThis->svga.StatRegCursorOnWr, "VMSVGA/Reg/CursorOnWrite", "SVGA_REG_CURSOR_ON writes."); 6437 6561 REG_CNT(&pThis->svga.StatRegDepthWr, "VMSVGA/Reg/DepthWrite", "SVGA_REG_DEPTH writes."); 6438 6562 REG_CNT(&pThis->svga.StatRegDisplayHeightWr, "VMSVGA/Reg/DisplayHeightWrite", "SVGA_REG_DISPLAY_HEIGHT writes."); … … 6467 6591 REG_CNT(&pThis->svga.StatRegCapabilitesRd, "VMSVGA/Reg/CapabilitesRead", "SVGA_REG_CAPABILITIES reads."); 6468 6592 REG_CNT(&pThis->svga.StatRegConfigDoneRd, "VMSVGA/Reg/ConfigDoneRead", "SVGA_REG_CONFIG_DONE reads."); 6469 REG_CNT(&pThis->svga.StatRegCursorXxxxRd, "VMSVGA/Reg/CursorXxxxRead", "SVGA_REG_CURSOR_XXXX reads."); 6593 REG_CNT(&pThis->svga.StatRegCursorXRd, "VMSVGA/Reg/CursorXRead", "SVGA_REG_CURSOR_X reads."); 6594 REG_CNT(&pThis->svga.StatRegCursorYRd, "VMSVGA/Reg/CursorYRead", "SVGA_REG_CURSOR_Y reads."); 6595 REG_CNT(&pThis->svga.StatRegCursorIdRd, "VMSVGA/Reg/CursorIdRead", "SVGA_REG_CURSOR_ID reads."); 6596 REG_CNT(&pThis->svga.StatRegCursorOnRd, "VMSVGA/Reg/CursorOnRead", "SVGA_REG_CURSOR_ON reads."); 6470 6597 REG_CNT(&pThis->svga.StatRegDepthRd, "VMSVGA/Reg/DepthRead", "SVGA_REG_DEPTH reads."); 6471 6598 REG_CNT(&pThis->svga.StatRegDisplayHeightRd, "VMSVGA/Reg/DisplayHeightRead", "SVGA_REG_DISPLAY_HEIGHT reads."); -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h
r83156 r83274 251 251 uint32_t uScreenOffset; /* Used only for loading older saved states. */ 252 252 253 /** Legacy cursor state. */ 254 uint32_t uCursorX; 255 uint32_t uCursorY; 256 uint32_t uCursorID; 257 uint32_t uCursorOn; 258 253 259 /** Scratch array. 254 260 * Putting this at the end since it's big it probably not . */ … … 257 263 STAMCOUNTER StatRegBitsPerPixelWr; 258 264 STAMCOUNTER StatRegBusyWr; 259 STAMCOUNTER StatRegCursorXxxxWr; 265 STAMCOUNTER StatRegCursorXWr; 266 STAMCOUNTER StatRegCursorYWr; 267 STAMCOUNTER StatRegCursorIdWr; 268 STAMCOUNTER StatRegCursorOnWr; 260 269 STAMCOUNTER StatRegDepthWr; 261 270 STAMCOUNTER StatRegDisplayHeightWr; … … 290 299 STAMCOUNTER StatRegCapabilitesRd; 291 300 STAMCOUNTER StatRegConfigDoneRd; 292 STAMCOUNTER StatRegCursorXxxxRd; 301 STAMCOUNTER StatRegCursorXRd; 302 STAMCOUNTER StatRegCursorYRd; 303 STAMCOUNTER StatRegCursorIdRd; 304 STAMCOUNTER StatRegCursorOnRd; 293 305 STAMCOUNTER StatRegDepthRd; 294 306 STAMCOUNTER StatRegDisplayHeightRd; -
trunk/src/VBox/Devices/Graphics/DevVGASavedState.h
r82968 r83274 47 47 } while (0) 48 48 49 #define VGA_SAVEDSTATE_VERSION 21 49 #define VGA_SAVEDSTATE_VERSION 22 50 #define VGA_SAVEDSTATE_VERSION_VMSVGA_CURSOR 22 /* Legacy cursor registers. */ 50 51 #define VGA_SAVEDSTATE_VERSION_VMSVGA_SCREENS 21 /* Screen objects. */ 51 52 #define VGA_SAVEDSTATE_VERSION_VMSVGA 20 /* Multiple updates and fixes for VMSVGA saved state. */ -
trunk/src/VBox/Devices/Graphics/vmsvga/svga_reg.h
r76565 r83274 1013 1013 SVGA_CMD_RECT_COPY = 3, 1014 1014 SVGA_CMD_DEFINE_CURSOR = 19, 1015 SVGA_CMD_DISPLAY_CURSOR = 20, // Deprecated. 1016 SVGA_CMD_MOVE_CURSOR = 21, // Deprecated. 1015 1017 SVGA_CMD_DEFINE_ALPHA_CURSOR = 22, 1016 1018 SVGA_CMD_UPDATE_VERBOSE = 25, … … 1556 1558 SVGAFifoCmdRemapGMR2; 1557 1559 1560 /* 1561 * SVGA_CMD_DISPLAY_CURSOR -- 1562 * 1563 * Turn the cursor on or off. 1564 * 1565 * Deprecated. 1566 * 1567 * Availability: 1568 * SVGA_CAP_CURSOR? 1569 */ 1570 1571 typedef 1572 struct { 1573 uint32_t id; // Reserved, must be zero. 1574 uint32_t state; // 0=off 1575 } SVGAFifoCmdDisplayCursor; 1576 1577 /* 1578 * SVGA_CMD_MOVE_CURSOR -- 1579 * 1580 * Set the cursor position. 1581 * 1582 * Deprecated. 1583 * 1584 * Availability: 1585 * SVGA_CAP_CURSOR? 1586 */ 1587 1588 typedef 1589 struct { 1590 SVGASignedPoint pos; 1591 } SVGAFifoCmdMoveCursor; 1592 1558 1593 #endif /* !_SVGA_REG_H_ */
Note:
See TracChangeset
for help on using the changeset viewer.