- Timestamp:
- Nov 21, 2019 9:59:57 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 5 edited
-
DevVGA-SVGA.cpp (modified) (1 diff)
-
DevVGA-SVGA.h (modified) (1 diff)
-
DevVGA.cpp (modified) (202 diffs)
-
DevVGA.h (modified) (2 diffs)
-
DevVGA_VBVA.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
r82086 r82088 707 707 * @interface_method_impl{PDMIDISPLAYPORT,pfnSetViewport} 708 708 */ 709 DECLCALLBACK(void) vmsvga PortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t idScreen, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy)709 DECLCALLBACK(void) vmsvgaR3PortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t idScreen, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy) 710 710 { 711 711 PVGASTATE pThis = RT_FROM_MEMBER(pInterface, VGASTATE, IPort); -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h
r82086 r82088 366 366 DECLCALLBACK(VBOXSTRICTRC) vmsvgaIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb); 367 367 368 DECLCALLBACK(void) vmsvga PortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t uScreenId,368 DECLCALLBACK(void) vmsvgaR3PortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t uScreenId, 369 369 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy); 370 370 -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r82086 r82088 259 259 #endif /* IN_RING3 */ 260 260 261 262 #ifndef VBOX_DEVICE_STRUCT_TESTCASE 263 264 265 /** 266 * Set a VRAM page dirty. 267 * 268 * @param pThis VGA instance data. 269 * @param offVRAM The VRAM offset of the page to set. 270 */ 271 DECLINLINE(void) vga_set_dirty(PVGASTATE pThis, RTGCPHYS offVRAM) 272 { 273 AssertMsg(offVRAM < pThis->vram_size, ("offVRAM = %p, pThis->vram_size = %p\n", offVRAM, pThis->vram_size)); 274 ASMBitSet(&pThis->au32DirtyBitmap[0], offVRAM >> PAGE_SHIFT); 275 pThis->fHasDirtyBits = true; 276 } 277 278 /** 279 * Tests if a VRAM page is dirty. 280 * 281 * @returns true if dirty. 282 * @returns false if clean. 283 * @param pThis VGA instance data. 284 * @param offVRAM The VRAM offset of the page to check. 285 */ 286 DECLINLINE(bool) vga_is_dirty(PVGASTATE pThis, RTGCPHYS offVRAM) 287 { 288 AssertMsg(offVRAM < pThis->vram_size, ("offVRAM = %p, pThis->vram_size = %p\n", offVRAM, pThis->vram_size)); 289 return ASMBitTest(&pThis->au32DirtyBitmap[0], offVRAM >> PAGE_SHIFT); 290 } 291 292 #ifdef IN_RING3 293 /** 294 * Reset dirty flags in a give range. 295 * 296 * @param pThis VGA instance data. 297 * @param offVRAMStart Offset into the VRAM buffer of the first page. 298 * @param offVRAMEnd Offset into the VRAM buffer of the last page - exclusive. 299 */ 300 DECLINLINE(void) vga_reset_dirty(PVGASTATE pThis, RTGCPHYS offVRAMStart, RTGCPHYS offVRAMEnd) 301 { 302 Assert(offVRAMStart < pThis->vram_size); 303 Assert(offVRAMEnd <= pThis->vram_size); 304 Assert(offVRAMStart < offVRAMEnd); 305 ASMBitClearRange(&pThis->au32DirtyBitmap[0], offVRAMStart >> PAGE_SHIFT, offVRAMEnd >> PAGE_SHIFT); 306 } 307 #endif /* IN_RING3 */ 261 #ifndef VBOX_DEVICE_STRUCT_TESTCASE /* Till the end of the file - doesn't count indent wise. */ 308 262 309 263 #ifdef _MSC_VER … … 348 302 349 303 #define cbswap_32(__x) \ 350 ((uint32_t)( \ 351 (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ 304 ((uint32_t)((((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ 352 305 (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ 353 306 (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ … … 355 308 356 309 #ifdef WORDS_BIGENDIAN 357 # define PAT(x) cbswap_32(x)310 # define PAT(x) cbswap_32(x) 358 311 #else 359 # define PAT(x) (x)312 # define PAT(x) (x) 360 313 #endif 361 314 362 315 #ifdef WORDS_BIGENDIAN 363 # define BIG 1316 # define BIG 1 364 317 #else 365 # define BIG 0318 # define BIG 0 366 319 #endif 367 320 … … 394 347 395 348 #ifdef WORDS_BIGENDIAN 396 # define PAT(x) (x)349 # define PAT(x) (x) 397 350 #else 398 # define PAT(x) cbswap_32(x)351 # define PAT(x) cbswap_32(x) 399 352 #endif 400 353 … … 431 384 static uint8_t expand4to8[16]; 432 385 386 #endif /* IN_RING3 */ 387 388 389 /** 390 * Set a VRAM page dirty. 391 * 392 * @param pThis VGA instance data. 393 * @param offVRAM The VRAM offset of the page to set. 394 */ 395 DECLINLINE(void) vgaR3MarkDirty(PVGASTATE pThis, RTGCPHYS offVRAM) 396 { 397 AssertMsg(offVRAM < pThis->vram_size, ("offVRAM = %p, pThis->vram_size = %p\n", offVRAM, pThis->vram_size)); 398 ASMBitSet(&pThis->au32DirtyBitmap[0], offVRAM >> PAGE_SHIFT); 399 pThis->fHasDirtyBits = true; 400 } 401 402 /** 403 * Tests if a VRAM page is dirty. 404 * 405 * @returns true if dirty. 406 * @returns false if clean. 407 * @param pThis VGA instance data. 408 * @param offVRAM The VRAM offset of the page to check. 409 */ 410 DECLINLINE(bool) vgaIsDirty(PVGASTATE pThis, RTGCPHYS offVRAM) 411 { 412 AssertMsg(offVRAM < pThis->vram_size, ("offVRAM = %p, pThis->vram_size = %p\n", offVRAM, pThis->vram_size)); 413 return ASMBitTest(&pThis->au32DirtyBitmap[0], offVRAM >> PAGE_SHIFT); 414 } 415 416 #ifdef IN_RING3 417 /** 418 * Reset dirty flags in a give range. 419 * 420 * @param pThis VGA instance data. 421 * @param offVRAMStart Offset into the VRAM buffer of the first page. 422 * @param offVRAMEnd Offset into the VRAM buffer of the last page - exclusive. 423 */ 424 DECLINLINE(void) vgaR3ResetDirty(PVGASTATE pThis, RTGCPHYS offVRAMStart, RTGCPHYS offVRAMEnd) 425 { 426 Assert(offVRAMStart < pThis->vram_size); 427 Assert(offVRAMEnd <= pThis->vram_size); 428 Assert(offVRAMStart < offVRAMEnd); 429 ASMBitClearRange(&pThis->au32DirtyBitmap[0], offVRAMStart >> PAGE_SHIFT, offVRAMEnd >> PAGE_SHIFT); 430 } 433 431 #endif /* IN_RING3 */ 434 432 … … 819 817 case VBE_DISPI_CFG_ID_VRAM_SIZE: val = pThis->vram_size; break; 820 818 case VBE_DISPI_CFG_ID_3D: val = pThis->f3DEnabled; break; 821 # ifdef VBOX_WITH_VMSVGA819 # ifdef VBOX_WITH_VMSVGA 822 820 case VBE_DISPI_CFG_ID_VMSVGA: val = pThis->fVMSVGAEnabled; break; 823 # endif821 # endif 824 822 default: 825 823 return 0; /* Not supported. */ … … 889 887 } 890 888 891 # define VBE_PITCH_ALIGN4 /* Align pitch to 32 bits - Qt requires that. */889 # define VBE_PITCH_ALIGN 4 /* Align pitch to 32 bits - Qt requires that. */ 892 890 893 891 /* Calculate scanline pitch based on bit depth and width in pixels. */ … … 909 907 } 910 908 911 # ifdef SOME_UNUSED_FUNCTION909 # ifdef SOME_UNUSED_FUNCTION 912 910 /* Calculate line width in pixels based on bit depth and pitch. */ 913 911 static uint32_t calc_line_width(uint16_t bpp, uint32_t pitch) … … 922 920 return width; 923 921 } 924 # endif922 # endif 925 923 926 924 static void recalculate_data(PVGASTATE pThis) … … 979 977 val == VBE_DISPI_ID_VBOX_VIDEO || 980 978 val == VBE_DISPI_ID_ANYX || 981 # ifdef VBOX_WITH_HGSMI979 # ifdef VBOX_WITH_HGSMI 982 980 val == VBE_DISPI_ID_HGSMI || 983 # endif981 # endif 984 982 val == VBE_DISPI_ID_CFG) 985 983 { … … 1023 1021 pThis->bank_offset = (val << 16); 1024 1022 1025 # ifndef IN_RC1023 # ifndef IN_RC 1026 1024 /* The VGA region is (could be) affected by this change; reset all aliases we've created. */ 1027 1025 if (pThis->fRemappedVGA) … … 1030 1028 pThis->fRemappedVGA = false; 1031 1029 } 1032 # endif1030 # endif 1033 1031 break; 1034 1032 1035 1033 case VBE_DISPI_INDEX_ENABLE: 1036 # ifndef IN_RING31034 # ifndef IN_RING3 1037 1035 return VINF_IOM_R3_IOPORT_WRITE; 1038 # else1036 # else 1039 1037 { 1040 1038 if ((val & VBE_DISPI_ENABLED) && … … 1105 1103 /* sunlover 30.05.2007 1106 1104 * The ar_index remains with bit 0x20 cleared after a switch from fullscreen 1107 * DOS mode on Windows XP guest. That leads to GMODE_BLANK in vga _update_display.1105 * DOS mode on Windows XP guest. That leads to GMODE_BLANK in vgaR3UpdateDisplay. 1108 1106 * But the VBE mode is graphics, so not a blank anymore. 1109 1107 */ … … 1129 1127 */ 1130 1128 pThis->pDrv->pfnLFBModeChange(pThis->pDrv, (val & VBE_DISPI_ENABLED) != 0); 1131 # ifdef VBOX_WITH_HGSMI1129 # ifdef VBOX_WITH_HGSMI 1132 1130 VBVAOnVBEChanged(pThis); 1133 # endif1131 # endif 1134 1132 1135 1133 /* The VGA region is (could be) affected by this change; reset all aliases we've created. */ … … 1141 1139 break; 1142 1140 } 1143 # endif /* IN_RING3 */1141 # endif /* IN_RING3 */ 1144 1142 case VBE_DISPI_INDEX_VIRT_WIDTH: 1145 1143 case VBE_DISPI_INDEX_X_OFFSET: … … 1151 1149 break; 1152 1150 case VBE_DISPI_INDEX_VBOX_VIDEO: 1153 # ifndef IN_RING31151 # ifndef IN_RING3 1154 1152 return VINF_IOM_R3_IOPORT_WRITE; 1155 # else1153 # else 1156 1154 /* Changes in the VGA device are minimal. The device is bypassed. The driver does all work. */ 1157 1155 if (val == VBOX_VIDEO_DISABLE_ADAPTER_MEMORY) … … 1161 1159 else if ((val & 0xFFFF0000) == VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE) 1162 1160 pThis->pDrv->pfnProcessDisplayData(pThis->pDrv, pThis->CTX_SUFF(vram_ptr), val & 0xFFFF); 1163 # endif /* IN_RING3 */1161 # endif /* IN_RING3 */ 1164 1162 break; 1165 1163 case VBE_DISPI_INDEX_CFG: … … 1230 1228 /* If all planes are accessible, then map the page to the frame buffer and make it writable. */ 1231 1229 if ( (pThis->sr[2] & 3) == 3 1232 && !vga _is_dirty(pThis, addr)1230 && !vgaIsDirty(pThis, addr) 1233 1231 && pThis->GCPhysVRAM) 1234 1232 { … … 1238 1236 pThis->GCPhysVRAM + addr, X86_PTE_RW | X86_PTE_P); 1239 1237 /* Set as dirty as write accesses won't be noticed now. */ 1240 vga _set_dirty(pThis, addr);1238 vgaR3MarkDirty(pThis, addr); 1241 1239 pThis->fRemappedVGA = true; 1242 1240 } … … 1286 1284 } 1287 1285 1288 /* called for accesses between 0xa0000 and 0xc0000 */1286 /** called for accesses between 0xa0000 and 0xc0000 */ 1289 1287 static int vga_mem_writeb(PVGASTATE pThis, RTGCPHYS addr, uint32_t val) 1290 1288 { … … 1336 1334 /* If all planes are accessible, then map the page to the frame buffer and make it writable. */ 1337 1335 if ( (pThis->sr[2] & 3) == 3 1338 && !vga _is_dirty(pThis, addr)1336 && !vgaIsDirty(pThis, addr) 1339 1337 && pThis->GCPhysVRAM) 1340 1338 { … … 1362 1360 Log3(("vga: chain4: [0x%x]\n", addr)); 1363 1361 pThis->plane_updated |= mask; /* only used to detect font change */ 1364 vga _set_dirty(pThis, addr);1362 vgaR3MarkDirty(pThis, addr); 1365 1363 } 1366 1364 } else if (!(pThis->sr[4] & 0x04)) { /* Host access is controlled by SR4, not GR5! */ … … 1391 1389 Log3(("vga: odd/even: [0x%x]\n", addr)); 1392 1390 pThis->plane_updated |= mask; /* only used to detect font change */ 1393 vga _set_dirty(pThis, addr);1391 vgaR3MarkDirty(pThis, addr); 1394 1392 } 1395 1393 } else { … … 1477 1475 #endif 1478 1476 Log3(("vga: latch: [0x%x] mask=0x%08x val=0x%08x\n", addr * 4, write_mask, val)); 1479 vga _set_dirty(pThis, (addr * 4));1477 vgaR3MarkDirty(pThis, (addr * 4)); 1480 1478 } 1481 1479 … … 1553 1551 static unsigned int rgb_to_pixel32_dup(unsigned int r, unsigned int g, unsigned b) 1554 1552 { 1555 unsigned int col; 1556 col = rgb_to_pixel32(r, g, b); 1557 return col; 1558 } 1559 1560 /* return true if the palette was modified */ 1561 static bool update_palette16(PVGASTATE pThis) 1553 return rgb_to_pixel32(r, g, b); 1554 } 1555 1556 /** return true if the palette was modified */ 1557 static bool vgaR3UpdatePalette16(PVGASTATE pThis) 1562 1558 { 1563 1559 bool full_update = false; … … 1574 1570 v = v * 3; 1575 1571 col = pThis->rgb_to_pixel(c6_to_8(pThis->palette[v]), 1576 c6_to_8(pThis->palette[v + 1]),1577 c6_to_8(pThis->palette[v + 2]));1572 c6_to_8(pThis->palette[v + 1]), 1573 c6_to_8(pThis->palette[v + 2])); 1578 1574 if (col != palette[i]) { 1579 1575 full_update = true; … … 1584 1580 } 1585 1581 1586 /* return true if the palette was modified */1587 static bool update_palette256(PVGASTATE pThis)1582 /** return true if the palette was modified */ 1583 static bool vgaR3UpdatePalette256(PVGASTATE pThis) 1588 1584 { 1589 1585 bool full_update = false; … … 1599 1595 if (wide_dac) 1600 1596 col = pThis->rgb_to_pixel(pThis->palette[v], 1601 pThis->palette[v + 1],1602 pThis->palette[v + 2]);1597 pThis->palette[v + 1], 1598 pThis->palette[v + 2]); 1603 1599 else 1604 1600 col = pThis->rgb_to_pixel(c6_to_8(pThis->palette[v]), 1605 c6_to_8(pThis->palette[v + 1]),1606 c6_to_8(pThis->palette[v + 2]));1601 c6_to_8(pThis->palette[v + 1]), 1602 c6_to_8(pThis->palette[v + 2])); 1607 1603 if (col != palette[i]) { 1608 1604 full_update = true; … … 1614 1610 } 1615 1611 1616 static void vga _get_offsets(PVGASTATE pThis,1612 static void vgaR3GetOffsets(PVGASTATE pThis, 1617 1613 uint32_t *pline_offset, 1618 1614 uint32_t *pstart_addr, … … 1650 1646 } 1651 1647 1652 /* update start_addr and line_offset. Return TRUE if modified */1653 static bool update_basic_params(PVGASTATE pThis)1648 /** update start_addr and line_offset. Return TRUE if modified */ 1649 static bool vgaR3UpdateBasicParams(PVGASTATE pThis) 1654 1650 { 1655 1651 bool full_update = false; … … 1669 1665 } 1670 1666 1671 static inline int get_depth_index(int depth)1667 static inline int vgaR3GetDepthIndex(int depth) 1672 1668 { 1673 1669 switch(depth) { … … 1684 1680 } 1685 1681 1686 static vga_draw_glyph8_func * vga_draw_glyph8_table[4] = {1682 static vga_draw_glyph8_func * const vga_draw_glyph8_table[4] = { 1687 1683 vga_draw_glyph8_8, 1688 1684 vga_draw_glyph8_16, … … 1691 1687 }; 1692 1688 1693 static vga_draw_glyph8_func * vga_draw_glyph16_table[4] = {1689 static vga_draw_glyph8_func * const vga_draw_glyph16_table[4] = { 1694 1690 vga_draw_glyph16_8, 1695 1691 vga_draw_glyph16_16, … … 1698 1694 }; 1699 1695 1700 static vga_draw_glyph9_func * vga_draw_glyph9_table[4] = {1696 static vga_draw_glyph9_func * const vga_draw_glyph9_table[4] = { 1701 1697 vga_draw_glyph9_8, 1702 1698 vga_draw_glyph9_16, … … 1726 1722 static const uint8_t empty_glyph[32 * 4] = { 0 }; 1727 1723 1728 /* 1724 /** 1729 1725 * Text mode update 1730 1726 * Missing: 1731 1727 * - underline 1732 1728 */ 1733 static int vga_draw_text(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty, 1734 PDMIDISPLAYCONNECTOR *pDrv) 1729 static int vgaR3DrawText(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty, PDMIDISPLAYCONNECTOR *pDrv) 1735 1730 { 1736 1731 int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr; … … 1749 1744 bool blink_enabled, blink_do_redraw; 1750 1745 1751 full_update |= update_palette16(pThis);1746 full_update |= vgaR3UpdatePalette16(pThis); 1752 1747 palette = pThis->last_palette; 1753 1748 … … 1773 1768 full_update = true; 1774 1769 } 1775 full_update |= update_basic_params(pThis);1770 full_update |= vgaR3UpdateBasicParams(pThis); 1776 1771 1777 1772 line_offset = pThis->line_offset; … … 1839 1834 } 1840 1835 cursor_ptr = pThis->CTX_SUFF(vram_ptr) + (pThis->start_addr + cursor_offset) * 8; 1841 depth_index = get_depth_index(pDrv->cBits);1836 depth_index = vgaR3GetDepthIndex(pDrv->cBits); 1842 1837 if (cw == 16) 1843 1838 vga_draw_glyph8 = vga_draw_glyph16_table[depth_index]; … … 1905 1900 if (cw != 9) { 1906 1901 if (pThis->fRenderVRAM) 1907 vga_draw_glyph8(d1, linesize, 1908 font_ptr, cheight, fgcol, bgcol, dscan); 1902 vga_draw_glyph8(d1, linesize, font_ptr, cheight, fgcol, bgcol, dscan); 1909 1903 } else { 1910 1904 dup9 = 0; … … 1912 1906 dup9 = 1; 1913 1907 if (pThis->fRenderVRAM) 1914 vga_draw_glyph9(d1, linesize, 1915 font_ptr, cheight, fgcol, bgcol, dup9); 1908 vga_draw_glyph9(d1, linesize, font_ptr, cheight, fgcol, bgcol, dup9); 1916 1909 } 1917 1910 if (src == cursor_ptr && … … 1931 1924 if (cw != 9) { 1932 1925 if (pThis->fRenderVRAM) 1933 vga_draw_glyph8(d, linesize, 1934 cursor_glyph, h, fgcol, bgcol, dscan); 1926 vga_draw_glyph8(d, linesize, cursor_glyph, h, fgcol, bgcol, dscan); 1935 1927 } else { 1936 1928 if (pThis->fRenderVRAM) 1937 vga_draw_glyph9(d, linesize, 1938 cursor_glyph, h, fgcol, bgcol, 1); 1929 vga_draw_glyph9(d, linesize, cursor_glyph, h, fgcol, bgcol, 1); 1939 1930 } 1940 1931 } … … 1957 1948 /* Flush updates to display. */ 1958 1949 pDrv->pfnUpdateRect(pDrv, cx_min_upd * cw, cy_start * cheight, 1959 (cx_max_upd - cx_min_upd + 1) * cw, (cy - cy_start) * cheight);1950 (cx_max_upd - cx_min_upd + 1) * cw, (cy - cy_start) * cheight); 1960 1951 cy_start = -1; 1961 1952 cx_max_upd = -1; … … 1968 1959 /* Flush any remaining changes to display. */ 1969 1960 pDrv->pfnUpdateRect(pDrv, cx_min_upd * cw, cy_start * cheight, 1970 (cx_max_upd - cx_min_upd + 1) * cw, (cy - cy_start) * cheight);1961 (cx_max_upd - cx_min_upd + 1) * cw, (cy - cy_start) * cheight); 1971 1962 return VINF_SUCCESS; 1972 1963 } … … 1986 1977 }; 1987 1978 1988 static vga_draw_line_func * vga_draw_line_table[4 * VGA_DRAW_LINE_NB] = {1979 static vga_draw_line_func * const vga_draw_line_table[4 * VGA_DRAW_LINE_NB] = { 1989 1980 vga_draw_line2_8, 1990 1981 vga_draw_line2_16, … … 2038 2029 }; 2039 2030 2040 static int vga _get_bpp(PVGASTATE pThis)2031 static int vgaR3GetBpp(PVGASTATE pThis) 2041 2032 { 2042 2033 int ret; … … 2052 2043 } 2053 2044 2054 static void vga _get_resolution(PVGASTATE pThis, int *pwidth, int *pheight)2045 static void vgaR3GetResolution(PVGASTATE pThis, int *pwidth, int *pheight) 2055 2046 { 2056 2047 int width, height; … … 2072 2063 *pheight = height; 2073 2064 } 2065 2074 2066 2075 2067 /** … … 2086 2078 * @param pDrv The display connector. 2087 2079 */ 2088 static int vga_resize_graphic(PVGASTATE pThis, int cx, int cy, 2089 PDMIDISPLAYCONNECTOR *pDrv) 2080 static int vgaR3ResizeGraphic(PVGASTATE pThis, int cx, int cy, PDMIDISPLAYCONNECTOR *pDrv) 2090 2081 { 2091 2082 const unsigned cBits = pThis->get_bpp(pThis); … … 2145 2136 } 2146 2137 if (pThis->shift_control == 0) 2147 update_palette16(pThis);2138 vgaR3UpdatePalette16(pThis); 2148 2139 else if (pThis->shift_control == 1) 2149 update_palette16(pThis);2140 vgaR3UpdatePalette16(pThis); 2150 2141 return VINF_SUCCESS; 2151 2142 } … … 2153 2144 # ifdef VBOX_WITH_VMSVGA 2154 2145 2146 # if 0 /* unused? */ 2155 2147 int vgaR3UpdateDisplay(VGAState *s, unsigned xStart, unsigned yStart, unsigned cx, unsigned cy) 2156 2148 { … … 2198 2190 break; 2199 2191 } 2200 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(s->pDrv->cBits)];2192 vga_draw_line = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(s->pDrv->cBits)]; 2201 2193 2202 2194 uint32_t offSrc = (xStart * cBits) / 8 + s->svga.cbScanline * yStart; … … 2217 2209 return VINF_SUCCESS; 2218 2210 } 2219 2220 /* 2211 # endif 2212 2213 /** 2221 2214 * graphic modes 2222 2215 */ 2223 static int vmsvga _draw_graphic(PVGASTATE pThis, bool fFullUpdate, bool fFailOnResize, bool reset_dirty,2216 static int vmsvgaR3DrawGraphic(PVGASTATE pThis, bool fFullUpdate, bool fFailOnResize, bool reset_dirty, 2224 2217 PDMIDISPLAYCONNECTOR *pDrv) 2225 2218 { … … 2247 2240 case 8: 2248 2241 /* Note! experimental, not sure if this really works... */ 2249 /** @todo fFullUpdate |= update_palette256(pThis); - need fFullUpdate but not2242 /** @todo fFullUpdate |= vgaR3UpdatePalette256(pThis); - need fFullUpdate but not 2250 2243 * copying anything to last_palette. */ 2251 2244 v = VGA_DRAW_LINE8; … … 2269 2262 return VERR_NOT_IMPLEMENTED; 2270 2263 } 2271 vga_draw_line_func *pfnVgaDrawLine = vga_draw_line_table[v * 4 + get_depth_index(pDrv->cBits)];2264 vga_draw_line_func *pfnVgaDrawLine = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(pDrv->cBits)]; 2272 2265 2273 2266 Assert(!pThis->cursor_invalidate); … … 2293 2286 * anything wider than 2050 pixels @32bpp. Need to check all pages 2294 2287 * between the first and last one. */ 2295 bool fUpdate = fFullUpdate | vga _is_dirty(pThis, offPage0) | vga_is_dirty(pThis, offPage1);2288 bool fUpdate = fFullUpdate | vgaIsDirty(pThis, offPage0) | vgaIsDirty(pThis, offPage1); 2296 2289 if (offPage1 - offPage0 > PAGE_SIZE) 2297 2290 /* if wide line, can use another page */ 2298 fUpdate |= vga _is_dirty(pThis, offPage0 + PAGE_SIZE);2291 fUpdate |= vgaIsDirty(pThis, offPage0 + PAGE_SIZE); 2299 2292 /* explicit invalidation for the hardware cursor */ 2300 2293 fUpdate |= (pThis->invalidated_y_table[y >> 5] >> (y & 0x1f)) & 1; … … 2330 2323 /* reset modified pages */ 2331 2324 if (offPageMax != -1 && reset_dirty) 2332 vga _reset_dirty(pThis, offPageMin, offPageMax + PAGE_SIZE);2325 vgaR3ResetDirty(pThis, offPageMin, offPageMax + PAGE_SIZE); 2333 2326 memset(pThis->invalidated_y_table, 0, ((cy + 31) >> 5) * 4); 2334 2327 … … 2338 2331 # endif /* VBOX_WITH_VMSVGA */ 2339 2332 2340 /* 2333 /** 2341 2334 * graphic modes 2342 2335 */ 2343 static int vga _draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty,2336 static int vgaR3DrawGraphic(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty, 2344 2337 PDMIDISPLAYCONNECTOR *pDrv) 2345 2338 { … … 2351 2344 vga_draw_line_func *vga_draw_line; 2352 2345 2353 bool offsets_changed = update_basic_params(pThis);2346 bool offsets_changed = vgaR3UpdateBasicParams(pThis); 2354 2347 2355 2348 full_update |= offsets_changed; … … 2369 2362 2370 2363 if (shift_control == 0) { 2371 full_update |= update_palette16(pThis);2364 full_update |= vgaR3UpdatePalette16(pThis); 2372 2365 if (pThis->sr[0x01] & 8) { 2373 2366 v = VGA_DRAW_LINE4D2; … … 2378 2371 bits = 4; 2379 2372 } else if (shift_control == 1) { 2380 full_update |= update_palette16(pThis);2373 full_update |= vgaR3UpdatePalette16(pThis); 2381 2374 if (pThis->sr[0x01] & 8) { 2382 2375 v = VGA_DRAW_LINE2D2; … … 2390 2383 default: 2391 2384 case 0: 2392 full_update |= update_palette256(pThis);2385 full_update |= vgaR3UpdatePalette256(pThis); 2393 2386 v = VGA_DRAW_LINE8D2; 2394 2387 bits = 4; 2395 2388 break; 2396 2389 case 8: 2397 full_update |= update_palette256(pThis);2390 full_update |= vgaR3UpdatePalette256(pThis); 2398 2391 v = VGA_DRAW_LINE8; 2399 2392 bits = 8; … … 2427 2420 return VERR_TRY_AGAIN; 2428 2421 } 2429 int rc = vga _resize_graphic(pThis, disp_width, height, pDrv);2422 int rc = vgaR3ResizeGraphic(pThis, disp_width, height, pDrv); 2430 2423 if (rc != VINF_SUCCESS) /* Return any rc, particularly VINF_VGA_RESIZE_IN_PROGRESS, to the caller. */ 2431 2424 return rc; … … 2449 2442 } 2450 2443 2451 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(pDrv->cBits)];2444 vga_draw_line = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(pDrv->cBits)]; 2452 2445 2453 2446 if (pThis->cursor_invalidate) … … 2492 2485 * anything wider than 2050 pixels @32bpp. Need to check all pages 2493 2486 * between the first and last one. */ 2494 bool update = full_update | vga _is_dirty(pThis, page0) | vga_is_dirty(pThis, page1);2487 bool update = full_update | vgaIsDirty(pThis, page0) | vgaIsDirty(pThis, page1); 2495 2488 if (page1 - page0 > PAGE_SIZE) { 2496 2489 /* if wide line, can use another page */ 2497 update |= vga _is_dirty(pThis, page0 + PAGE_SIZE);2490 update |= vgaIsDirty(pThis, page0 + PAGE_SIZE); 2498 2491 } 2499 2492 /* explicit invalidation for the hardware cursor */ … … 2541 2534 /* reset modified pages */ 2542 2535 if (page_max != -1 && reset_dirty) { 2543 vga _reset_dirty(pThis, page_min, page_max + PAGE_SIZE);2536 vgaR3ResetDirty(pThis, page_min, page_max + PAGE_SIZE); 2544 2537 } 2545 2538 memset(pThis->invalidated_y_table, 0, ((height + 31) >> 5) * 4); … … 2547 2540 } 2548 2541 2549 /* 2542 /** 2550 2543 * blanked modes 2551 2544 */ 2552 static int vga _draw_blank(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty,2545 static int vgaR3DrawBlank(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty, 2553 2546 PDMIDISPLAYCONNECTOR *pDrv) 2554 2547 { … … 2576 2569 page_min = (pThis->start_addr * 4) & ~PAGE_OFFSET_MASK; 2577 2570 /* round up page_max by one page, as otherwise this can be -PAGE_SIZE, 2578 * which causes assertion trouble in vga _reset_dirty. */2571 * which causes assertion trouble in vgaR3ResetDirty. */ 2579 2572 page_max = ( pThis->start_addr * 4 + pThis->line_offset * pThis->last_scr_height 2580 2573 - 1 + PAGE_SIZE) & ~PAGE_OFFSET_MASK; 2581 vga _reset_dirty(pThis, page_min, page_max + PAGE_SIZE);2574 vgaR3ResetDirty(pThis, page_min, page_max + PAGE_SIZE); 2582 2575 } 2583 2576 if (pDrv->pbData == pThis->vram_ptrR3) /* Do not clear the VRAM itself. */ … … 2612 2605 #endif 2613 2606 2614 static int vga_update_display(PVGASTATE pThis, bool fUpdateAll, bool fFailOnResize, bool reset_dirty, 2607 /** 2608 * Worker for vgaR3PortUpdateDisplay(), vboxR3UpdateDisplayAllInternal() and 2609 * vgaR3PortTakeScreenshot(). 2610 */ 2611 static int vgaR3UpdateDisplay(PVGASTATE pThis, bool fUpdateAll, bool fFailOnResize, bool reset_dirty, 2615 2612 PDMIDISPLAYCONNECTOR *pDrv, int32_t *pcur_graphic_mode) 2616 2613 { … … 2654 2651 switch(graphic_mode) { 2655 2652 case GMODE_TEXT: 2656 rc = vga _draw_text(pThis, full_update, fFailOnResize, reset_dirty, pDrv);2653 rc = vgaR3DrawText(pThis, full_update, fFailOnResize, reset_dirty, pDrv); 2657 2654 break; 2658 2655 case GMODE_GRAPH: 2659 rc = vga _draw_graphic(pThis, full_update, fFailOnResize, reset_dirty, pDrv);2656 rc = vgaR3DrawGraphic(pThis, full_update, fFailOnResize, reset_dirty, pDrv); 2660 2657 break; 2661 2658 #ifdef VBOX_WITH_VMSVGA 2662 2659 case GMODE_SVGA: 2663 rc = vmsvga _draw_graphic(pThis, full_update, fFailOnResize, reset_dirty, pDrv);2660 rc = vmsvgaR3DrawGraphic(pThis, full_update, fFailOnResize, reset_dirty, pDrv); 2664 2661 break; 2665 2662 #endif 2666 2663 case GMODE_BLANK: 2667 2664 default: 2668 rc = vga _draw_blank(pThis, full_update, fFailOnResize, reset_dirty, pDrv);2665 rc = vgaR3DrawBlank(pThis, full_update, fFailOnResize, reset_dirty, pDrv); 2669 2666 break; 2670 2667 } … … 2673 2670 } 2674 2671 2672 /** 2673 * Worker for vgaR3SaveExec(). 2674 */ 2675 2675 static void vga_save(PCPDMDEVHLPR3 pHlp, PSSMHANDLE pSSM, PVGASTATE pThis) 2676 2676 { … … 2713 2713 } 2714 2714 2715 2716 /** 2717 * Worker for vgaR3LoadExec(). 2718 */ 2715 2719 static int vga_load(PCPDMDEVHLPR3 pHlp, PSSMHANDLE pSSM, PVGASTATE pThis, int version_id) 2716 2720 { … … 2782 2786 } 2783 2787 2784 /* see vgaR3Construct */ 2785 static void vga_init_expand(void) 2788 2789 /** 2790 * Worker for vgaR3Construct(). 2791 */ 2792 static void vgaR3InitExpand(void) 2786 2793 { 2787 2794 int i, j, v, b; … … 2811 2818 } 2812 2819 2813 #endif /* !IN_RING0*/2820 #endif /* IN_RING3 */ 2814 2821 2815 2822 … … 3205 3212 } 3206 3213 3207 #if def VBOX_WITH_HGSMI3208 # ifdef IN_RING3 3214 #if defined(VBOX_WITH_HGSMI) && defined(IN_RING3) 3215 3209 3216 /** 3210 3217 * @callback_method_impl{FNIOMIOPORTNEWOUT,HGSMI OUT handler.} … … 3237 3244 | HGSMIHOSTFLAGS_VSYNC 3238 3245 | HGSMIHOSTFLAGS_HOTPLUG 3239 | HGSMIHOSTFLAGS_CURSOR_CAPABILITIES 3240 ); 3246 | HGSMIHOSTFLAGS_CURSOR_CAPABILITIES); 3241 3247 } 3242 3248 else … … 3327 3333 return rc; 3328 3334 } 3329 # endif /* IN_RING3 */ 3330 #endif /* VBOX_WITH_HGSMI */3331 3332 3333 3334 3335 /* -=-=-=-=-=- Guest Context-=-=-=-=-=- */3335 3336 #endif /* VBOX_WITH_HGSMI && IN_RING3*/ 3337 3338 3339 3340 3341 /* -=-=-=-=-=- All Contexts -=-=-=-=-=- */ 3336 3342 3337 3343 /** … … 3340 3346 */ 3341 3347 #define APPLY_LOGICAL_AND_MASK(pThis, val, bit_mask) \ 3342 /* apply logical operation */ \3343 switch (pThis->gr[3] >> 3) \3344 { \3345 case 0: \3346 default: \3347 /* nothing to do */ \3348 break; \3349 case 1: \3350 /* and */ \3351 val &= pThis->latch; \3352 break; \3353 case 2: \3354 /* or */ \3355 val |= pThis->latch; \3356 break; \3357 case 3: \3358 /* xor */ \3359 val ^= pThis->latch; \3360 break; \3361 } \3362 /* apply bit mask */ \3348 /* apply logical operation */ \ 3349 switch (pThis->gr[3] >> 3)\ 3350 { \ 3351 case 0: \ 3352 default:\ 3353 /* nothing to do */ \ 3354 break; \ 3355 case 1: \ 3356 /* and */ \ 3357 val &= pThis->latch; \ 3358 break; \ 3359 case 2: \ 3360 /* or */ \ 3361 val |= pThis->latch; \ 3362 break; \ 3363 case 3: \ 3364 /* xor */ \ 3365 val ^= pThis->latch; \ 3366 break; \ 3367 } \ 3368 /* apply bit mask */ \ 3363 3369 val = (val & bit_mask) | (pThis->latch & ~bit_mask) 3364 3370 … … 3375 3381 * @param cItems Number of data items to write. 3376 3382 */ 3377 static int vgaInternalMMIOFill(PVGASTATE pThis, void *pvUser, RTGCPHYS GCPhysAddr, uint32_t u32Item, unsigned cbItem, unsigned cItems) 3383 static int vgaInternalMMIOFill(PVGASTATE pThis, void *pvUser, RTGCPHYS GCPhysAddr, 3384 uint32_t u32Item, unsigned cbItem, unsigned cItems) 3378 3385 { 3379 3386 uint32_t b; … … 3423 3430 { 3424 3431 pThis->CTX_SUFF(vram_ptr)[GCPhysAddr] = aVal[i]; 3425 vga _set_dirty(pThis, GCPhysAddr);3432 vgaR3MarkDirty(pThis, GCPhysAddr); 3426 3433 } 3427 3434 GCPhysAddr++; … … 3437 3444 RTGCPHYS PhysAddr2 = ((GCPhysAddr & ~1) * 4) | plane; 3438 3445 pThis->CTX_SUFF(vram_ptr)[PhysAddr2] = aVal[i]; 3439 vga _set_dirty(pThis, PhysAddr2);3446 vgaR3MarkDirty(pThis, PhysAddr2); 3440 3447 } 3441 3448 GCPhysAddr++; … … 3509 3516 { 3510 3517 ((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[0] & write_mask); 3511 vga _set_dirty(pThis, GCPhysAddr * 4);3518 vgaR3MarkDirty(pThis, GCPhysAddr * 4); 3512 3519 GCPhysAddr++; 3513 3520 } … … 3519 3526 { 3520 3527 ((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[0] & write_mask); 3521 vga _set_dirty(pThis, GCPhysAddr * 4);3528 vgaR3MarkDirty(pThis, GCPhysAddr * 4); 3522 3529 GCPhysAddr++; 3523 3530 3524 3531 ((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[1] & write_mask); 3525 vga _set_dirty(pThis, GCPhysAddr * 4);3532 vgaR3MarkDirty(pThis, GCPhysAddr * 4); 3526 3533 GCPhysAddr++; 3527 3534 } … … 3535 3542 { 3536 3543 ((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[i] & write_mask); 3537 vga _set_dirty(pThis, GCPhysAddr * 4);3544 vgaR3MarkDirty(pThis, GCPhysAddr * 4); 3538 3545 GCPhysAddr++; 3539 3546 } … … 3705 3712 * Set page dirty bit. 3706 3713 */ 3707 vga _set_dirty(pThis, GCPhys - pThis->GCPhysVRAM);3714 vgaR3MarkDirty(pThis, GCPhys - pThis->GCPhysVRAM); 3708 3715 pThis->fLFBUpdated = true; 3709 3716 … … 3919 3926 * @param pThis The VGA instance data. 3920 3927 */ 3921 static int vbeParseBitmap(PVGASTATE pThis) 3922 { 3923 uint16_t i; 3924 PBMPINFO bmpInfo; 3925 POS2HDR pOs2Hdr; 3926 POS22HDR pOs22Hdr; 3927 PWINHDR pWinHdr; 3928 3928 static int vbeR3ParseBitmap(PVGASTATE pThis) 3929 { 3929 3930 /* 3930 3931 * Get bitmap header data 3931 3932 */ 3932 bmpInfo = (PBMPINFO)(pThis->pbLogo + sizeof(LOGOHDR));3933 pWinHdr= (PWINHDR)(pThis->pbLogo + sizeof(LOGOHDR) + sizeof(BMPINFO));3934 3935 if ( bmpInfo->Type == BMP_ID)3933 PBMPINFO pBmpInfo = (PBMPINFO)(pThis->pbLogo + sizeof(LOGOHDR)); 3934 PWINHDR pWinHdr = (PWINHDR)(pThis->pbLogo + sizeof(LOGOHDR) + sizeof(BMPINFO)); 3935 3936 if (pBmpInfo->Type == BMP_ID) 3936 3937 { 3937 3938 switch (pWinHdr->Size) 3938 3939 { 3939 3940 case BMP_HEADER_OS21: 3940 pOs2Hdr = (POS2HDR)pWinHdr; 3941 { 3942 POS2HDR pOs2Hdr = (POS2HDR)pWinHdr; 3941 3943 pThis->cxLogo = pOs2Hdr->Width; 3942 3944 pThis->cyLogo = pOs2Hdr->Height; … … 3946 3948 pThis->cLogoUsedColors = 0; 3947 3949 break; 3950 } 3948 3951 3949 3952 case BMP_HEADER_OS22: 3950 pOs22Hdr = (POS22HDR)pWinHdr; 3953 { 3954 POS22HDR pOs22Hdr = (POS22HDR)pWinHdr; 3951 3955 pThis->cxLogo = pOs22Hdr->Width; 3952 3956 pThis->cyLogo = pOs22Hdr->Height; … … 3956 3960 pThis->cLogoUsedColors = pOs22Hdr->ClrUsed; 3957 3961 break; 3962 } 3958 3963 3959 3964 case BMP_HEADER_WIN3: … … 4004 4009 const uint8_t *pbPal = pThis->pbLogo + sizeof(LOGOHDR) + sizeof(BMPINFO) + pWinHdr->Size; /* ASSUMES Size location (safe) */ 4005 4010 4006 for ( i = 0; i < pThis->cLogoPalEntries; i++)4011 for (uint16_t i = 0; i < pThis->cLogoPalEntries; i++) 4007 4012 { 4008 4013 uint16_t j; … … 4024 4029 * Bitmap data offset 4025 4030 */ 4026 pThis->pbLogoBitmap = pThis->pbLogo + sizeof(LOGOHDR) + bmpInfo->Offset;4031 pThis->pbLogoBitmap = pThis->pbLogo + sizeof(LOGOHDR) + pBmpInfo->Offset; 4027 4032 } 4028 4033 else … … 4049 4054 * @param pbDst Destination buffer. 4050 4055 */ 4051 static void vbeShowBitmap(uint16_t cBits, uint16_t xLogo, uint16_t yLogo, uint16_t cxLogo, uint16_t cyLogo, 4052 bool fInverse, uint8_t iStep, 4053 const uint32_t *pu32Palette, const uint8_t *pbSrc, uint8_t *pbDst) 4056 static void vbeR3ShowBitmap(uint16_t cBits, uint16_t xLogo, uint16_t yLogo, uint16_t cxLogo, uint16_t cyLogo, 4057 bool fInverse, uint8_t iStep, const uint32_t *pu32Palette, const uint8_t *pbSrc, uint8_t *pbDst) 4054 4058 { 4055 4059 uint16_t i; … … 4233 4237 4234 4238 /* Show the bitmap. */ 4235 vbe ShowBitmap(pThis->cLogoBits, xLogo, yLogo,4239 vbeR3ShowBitmap(pThis->cLogoBits, xLogo, yLogo, 4236 4240 pThis->cxLogo, pThis->cyLogo, 4237 4241 false, iStep, &pThis->au32LogoPalette[0], … … 4240 4244 /* Show the 'Press F12...' text. */ 4241 4245 if (pLogoHdr->fu8ShowBootMenu == 2) 4242 vbe ShowBitmap(1, LOGO_F12TEXT_X, LOGO_F12TEXT_Y,4246 vbeR3ShowBitmap(1, LOGO_F12TEXT_X, LOGO_F12TEXT_Y, 4243 4247 LOGO_F12TEXT_WIDTH, LOGO_F12TEXT_HEIGHT, 4244 4248 pThis->fBootMenuInverse, iStep, &pThis->au32LogoPalette[0], … … 4260 4264 while (offDirty <= LOGO_MAX_SIZE) 4261 4265 { 4262 vga _set_dirty(pThis, offDirty);4266 vgaR3MarkDirty(pThis, offDirty); 4263 4267 offDirty += PAGE_SIZE; 4264 4268 } … … 4323 4327 * decode from the registers.} 4324 4328 */ 4325 static DECLCALLBACK(void) vga InfoState(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)4329 static DECLCALLBACK(void) vgaR3InfoState(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4326 4330 { 4327 4331 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); … … 4363 4367 uint32_t offStart; 4364 4368 uint32_t uLineCompareIgn; 4365 vga _get_offsets(pThis, &cbLine, &offStart, &uLineCompareIgn);4369 vgaR3GetOffsets(pThis, &cbLine, &offStart, &uLineCompareIgn); 4366 4370 if (!cbLine) 4367 4371 cbLine = 80 * 8; … … 4390 4394 pHlp->pfnPrintf(pHlp, "display refresh interval: %u ms\n", pThis->cMilliesRefreshInterval); 4391 4395 4392 # ifdef VBOX_WITH_VMSVGA4396 # ifdef VBOX_WITH_VMSVGA 4393 4397 if (pThis->svga.fEnabled) 4394 4398 pHlp->pfnPrintf(pHlp, pThis->svga.f3DEnabled ? "VMSVGA 3D enabled: %ux%ux%u\n" : "VMSVGA enabled: %ux%ux%u", 4395 4399 pThis->svga.uWidth, pThis->svga.uHeight, pThis->svga.uBpp); 4396 # endif4400 # endif 4397 4401 } 4398 4402 … … 4405 4409 * @param pszTitle The title text, NULL if none. 4406 4410 */ 4407 static void vga InfoTextPrintSeparatorLine(PCDBGFINFOHLP pHlp, size_t cCols, const char *pszTitle)4411 static void vgaR3InfoTextPrintSeparatorLine(PCDBGFINFOHLP pHlp, size_t cCols, const char *pszTitle) 4408 4412 { 4409 4413 if (pszTitle) … … 4432 4436 4433 4437 /** 4434 * Worker for vga InfoText.4438 * Worker for vgaR3InfoText. 4435 4439 * 4436 4440 * @param pThis The vga state. … … 4444 4448 * (exclusive). 4445 4449 */ 4446 static void vga InfoTextWorker(PVGASTATE pThis, PCDBGFINFOHLP pHlp,4447 uint32_t offStart, uint32_t cbLine,4448 uint32_t cCols, uint32_t cRows,4449 uint32_t iScrBegin, uint32_t iScrEnd)4450 static void vgaR3InfoTextWorker(PVGASTATE pThis, PCDBGFINFOHLP pHlp, 4451 uint32_t offStart, uint32_t cbLine, 4452 uint32_t cCols, uint32_t cRows, 4453 uint32_t iScrBegin, uint32_t iScrEnd) 4450 4454 { 4451 4455 /* Title, */ … … 4468 4472 4469 4473 if (iRow == 0) 4470 vga InfoTextPrintSeparatorLine(pHlp, cCols, szTitle);4474 vgaR3InfoTextPrintSeparatorLine(pHlp, cCols, szTitle); 4471 4475 else if (iRow == iScrBegin) 4472 vga InfoTextPrintSeparatorLine(pHlp, cCols, "screen start");4476 vgaR3InfoTextPrintSeparatorLine(pHlp, cCols, "screen start"); 4473 4477 else if (iRow == iScrEnd) 4474 vga InfoTextPrintSeparatorLine(pHlp, cCols, "screen end");4478 vgaR3InfoTextPrintSeparatorLine(pHlp, cCols, "screen end"); 4475 4479 4476 4480 uint8_t const *pbSrc = pbSrcOuter; … … 4487 4491 4488 4492 /* Final separator. */ 4489 vga InfoTextPrintSeparatorLine(pHlp, cCols, NULL);4493 vgaR3InfoTextPrintSeparatorLine(pHlp, cCols, NULL); 4490 4494 } 4491 4495 … … 4496 4500 * the first page.} 4497 4501 */ 4498 static DECLCALLBACK(void) vga InfoText(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)4502 static DECLCALLBACK(void) vgaR3InfoText(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4499 4503 { 4500 4504 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); … … 4537 4541 uint32_t offStart; 4538 4542 uint32_t uLineCompareIgn; 4539 vga _get_offsets(pThis, &cbLine, &offStart, &uLineCompareIgn);4543 vgaR3GetOffsets(pThis, &cbLine, &offStart, &uLineCompareIgn); 4540 4544 if (!cbLine) 4541 4545 cbLine = 80 * 8; … … 4553 4557 4554 4558 if (fAll) 4555 vga InfoTextWorker(pThis, pHlp, offStart - iScrBegin * cbLine, cbLine,4556 cCols, cRows, iScrBegin, iScrBegin + cScrRows);4559 vgaR3InfoTextWorker(pThis, pHlp, offStart - iScrBegin * cbLine, cbLine, 4560 cCols, cRows, iScrBegin, iScrBegin + cScrRows); 4557 4561 else 4558 vga InfoTextWorker(pThis, pHlp, offStart, cbLine, cCols, cScrRows, 0, cScrRows);4562 vgaR3InfoTextWorker(pThis, pHlp, offStart, cbLine, cCols, cScrRows, 0, cScrRows); 4559 4563 } 4560 4564 else … … 4569 4573 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VGA Sequencer registers.} 4570 4574 */ 4571 static DECLCALLBACK(void) vga InfoSR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)4575 static DECLCALLBACK(void) vgaR3InfoSR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4572 4576 { 4573 4577 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4574 unsigned i;4575 4578 NOREF(pszArgs); 4576 4579 4577 4580 pHlp->pfnPrintf(pHlp, "VGA Sequencer (3C5): SR index 3C4:%02X\n", pThis->sr_index); 4578 4581 Assert(sizeof(pThis->sr) >= 8); 4579 for ( i = 0; i < 8; ++i)4582 for (unsigned i = 0; i < 8; ++i) 4580 4583 pHlp->pfnPrintf(pHlp, " SR%02X:%02X", i, pThis->sr[i]); 4581 4584 pHlp->pfnPrintf(pHlp, "\n"); … … 4586 4589 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VGA CRTC registers.} 4587 4590 */ 4588 static DECLCALLBACK(void) vga InfoCR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)4591 static DECLCALLBACK(void) vgaR3InfoCR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4589 4592 { 4590 4593 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); … … 4610 4613 * Dumps VGA Graphics Controller registers.} 4611 4614 */ 4612 static DECLCALLBACK(void) vga InfoGR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)4615 static DECLCALLBACK(void) vgaR3InfoGR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4613 4616 { 4614 4617 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4615 unsigned i;4616 4618 NOREF(pszArgs); 4617 4619 4618 4620 pHlp->pfnPrintf(pHlp, "VGA Graphics Controller (3CF): GR index 3CE:%02X\n", pThis->gr_index); 4619 4621 Assert(sizeof(pThis->gr) >= 9); 4620 for (i = 0; i < 9; ++i) 4621 { 4622 for (unsigned i = 0; i < 9; ++i) 4622 4623 pHlp->pfnPrintf(pHlp, " GR%02X:%02X", i, pThis->gr[i]); 4623 }4624 4624 pHlp->pfnPrintf(pHlp, "\n"); 4625 4625 } … … 4630 4630 * Dumps VGA Attribute Controller registers.} 4631 4631 */ 4632 static DECLCALLBACK(void) vga InfoAR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)4632 static DECLCALLBACK(void) vgaR3InfoAR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4633 4633 { 4634 4634 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); … … 4652 4652 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VGA DAC registers.} 4653 4653 */ 4654 static DECLCALLBACK(void) vga InfoDAC(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)4654 static DECLCALLBACK(void) vgaR3InfoDAC(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4655 4655 { 4656 4656 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4657 unsigned i;4658 4657 NOREF(pszArgs); 4659 4658 4660 4659 pHlp->pfnPrintf(pHlp, "VGA DAC contents:\n"); 4661 for ( i = 0; i < 0x100; ++i)4660 for (unsigned i = 0; i < 0x100; ++i) 4662 4661 pHlp->pfnPrintf(pHlp, " %02X: %02X %02X %02X\n", 4663 4662 i, pThis->palette[i*3+0], pThis->palette[i*3+1], pThis->palette[i*3+2]); … … 4668 4667 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VBE registers.} 4669 4668 */ 4670 static DECLCALLBACK(void) vga InfoVBE(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)4669 static DECLCALLBACK(void) vgaR3InfoVBE(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4671 4670 { 4672 4671 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); … … 4674 4673 4675 4674 pHlp->pfnPrintf(pHlp, "LFB at %RGp\n", pThis->GCPhysVRAM); 4676 4677 4675 if (!(pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED)) 4678 {4679 4676 pHlp->pfnPrintf(pHlp, "VBE disabled\n"); 4680 return;4681 }4682 4683 pHlp->pfnPrintf(pHlp, "VBE state (chip ID 0x%04x):\n", pThis->vbe_regs[VBE_DISPI_INDEX_ID]);4684 pHlp->pfnPrintf(pHlp, " Display resolution: %d x %d @ %dbpp\n",4685 pThis->vbe_regs[VBE_DISPI_INDEX_XRES], pThis->vbe_regs[VBE_DISPI_INDEX_YRES],4686 pThis->vbe_regs[VBE_DISPI_INDEX_BPP]);4687 pHlp->pfnPrintf(pHlp, " Virtual resolution: %d x %d\n",4688 pThis->vbe_regs[VBE_DISPI_INDEX_VIRT_WIDTH], pThis->vbe_regs[VBE_DISPI_INDEX_VIRT_HEIGHT]);4689 pHlp->pfnPrintf(pHlp, " Display start addr: %d, %d\n",4690 pThis->vbe_regs[VBE_DISPI_INDEX_X_OFFSET], pThis->vbe_regs[VBE_DISPI_INDEX_Y_OFFSET]);4691 pHlp->pfnPrintf(pHlp, " Linear scanline pitch: 0x%04x\n", pThis->vbe_line_offset);4692 pHlp->pfnPrintf(pHlp, " Linear display start : 0x%04x\n", pThis->vbe_start_addr);4693 pHlp->pfnPrintf(pHlp, " Selected bank: 0x%04x\n", pThis->vbe_regs[VBE_DISPI_INDEX_BANK]);4677 else 4678 { 4679 pHlp->pfnPrintf(pHlp, "VBE state (chip ID 0x%04x):\n", pThis->vbe_regs[VBE_DISPI_INDEX_ID]); 4680 pHlp->pfnPrintf(pHlp, " Display resolution: %d x %d @ %dbpp\n", 4681 pThis->vbe_regs[VBE_DISPI_INDEX_XRES], pThis->vbe_regs[VBE_DISPI_INDEX_YRES], 4682 pThis->vbe_regs[VBE_DISPI_INDEX_BPP]); 4683 pHlp->pfnPrintf(pHlp, " Virtual resolution: %d x %d\n", 4684 pThis->vbe_regs[VBE_DISPI_INDEX_VIRT_WIDTH], pThis->vbe_regs[VBE_DISPI_INDEX_VIRT_HEIGHT]); 4685 pHlp->pfnPrintf(pHlp, " Display start addr: %d, %d\n", 4686 pThis->vbe_regs[VBE_DISPI_INDEX_X_OFFSET], pThis->vbe_regs[VBE_DISPI_INDEX_Y_OFFSET]); 4687 pHlp->pfnPrintf(pHlp, " Linear scanline pitch: 0x%04x\n", pThis->vbe_line_offset); 4688 pHlp->pfnPrintf(pHlp, " Linear display start : 0x%04x\n", pThis->vbe_start_addr); 4689 pHlp->pfnPrintf(pHlp, " Selected bank: 0x%04x\n", pThis->vbe_regs[VBE_DISPI_INDEX_BANK]); 4690 } 4694 4691 } 4695 4692 … … 4700 4697 * in human-readable form.} 4701 4698 */ 4702 static DECLCALLBACK(void) vga InfoPlanar(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)4699 static DECLCALLBACK(void) vgaR3InfoPlanar(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4703 4700 { 4704 4701 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4705 int val1, val2;4706 4702 NOREF(pszArgs); 4707 4703 4708 val1 = (pThis->gr[5] >> 3) & 1;4709 val2 = pThis->gr[5] & 3;4710 pHlp->pfnPrintf(pHlp, "read mode : % d write mode: %d\n", val1, val2);4704 unsigned val1 = (pThis->gr[5] >> 3) & 1; 4705 unsigned val2 = pThis->gr[5] & 3; 4706 pHlp->pfnPrintf(pHlp, "read mode : %u write mode: %u\n", val1, val2); 4711 4707 val1 = pThis->gr[0]; 4712 4708 val2 = pThis->gr[1]; … … 4714 4710 val1 = pThis->gr[2]; 4715 4711 val2 = pThis->gr[4] & 3; 4716 pHlp->pfnPrintf(pHlp, "color compare : %02X read map : % d\n", val1, val2);4712 pHlp->pfnPrintf(pHlp, "color compare : %02X read map : %u\n", val1, val2); 4717 4713 val1 = pThis->gr[3] & 7; 4718 4714 val2 = (pThis->gr[3] >> 3) & 3; 4719 pHlp->pfnPrintf(pHlp, "rotate : % d function : %d\n", val1, val2);4715 pHlp->pfnPrintf(pHlp, "rotate : %u function : %u\n", val1, val2); 4720 4716 val1 = pThis->gr[7]; 4721 4717 val2 = pThis->gr[8]; … … 4732 4728 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 4733 4729 */ 4734 static DECLCALLBACK(void *) vga PortQueryInterface(PPDMIBASE pInterface, const char *pszIID)4730 static DECLCALLBACK(void *) vgaR3PortQueryInterface(PPDMIBASE pInterface, const char *pszIID) 4735 4731 { 4736 4732 PVGASTATE pThis = RT_FROM_MEMBER(pInterface, VGASTATE, IBase); 4737 4733 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis->IBase); 4738 4734 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIDISPLAYPORT, &pThis->IPort); 4739 # if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_CRHGSMI))4735 # if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_CRHGSMI)) 4740 4736 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIDISPLAYVBVACALLBACKS, &pThis->IVBVACallbacks); 4741 # endif4737 # endif 4742 4738 PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds); 4743 4739 return NULL; 4744 4740 } 4745 4741 4742 4746 4743 /* -=-=-=-=-=- Ring 3: ILeds -=-=-=-=-=- */ 4747 #define ILEDPORTS_2_VGASTATE(pInterface) ( (PVGASTATE)((uintptr_t)pInterface - RT_OFFSETOF(VGASTATE, ILeds)) ) 4748 4749 /** 4750 * Gets the pointer to the status LED of a unit. 4751 * 4752 * @returns VBox status code. 4753 * @param pInterface Pointer to the interface structure containing the called function pointer. 4754 * @param iLUN The unit which status LED we desire. 4755 * @param ppLed Where to store the LED pointer. 4756 */ 4757 static DECLCALLBACK(int) vgaPortQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) 4758 { 4759 PVGASTATE pThis = ILEDPORTS_2_VGASTATE(pInterface); 4744 4745 /** 4746 * @interface_method_impl{PDMILEDPORTS,pfnQueryStatusLed} 4747 */ 4748 static DECLCALLBACK(int) vgaR3PortQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) 4749 { 4750 PVGASTATE pThis = RT_FROM_MEMBER(pInterface, VGASTATE, ILeds); 4760 4751 switch (iLUN) 4761 4752 { … … 4769 4760 4770 4761 default: 4771 AssertMsgFailed(("Invalid LUN #% d\n", iLUN));4762 AssertMsgFailed(("Invalid LUN #%u\n", iLUN)); 4772 4763 return VERR_PDM_NO_SUCH_LUN; 4773 4764 } 4774 4765 } 4775 4766 4767 4776 4768 /* -=-=-=-=-=- Ring 3: Dummy IDisplayConnector -=-=-=-=-=- */ 4777 4769 4778 4770 /** 4779 * Resize the display. 4780 * This is called when the resolution changes. This usually happens on 4781 * request from the guest os, but may also happen as the result of a reset. 4782 * 4783 * @param pInterface Pointer to this interface. 4784 * @param bpp Bits per pixel. 4785 * @param pvVRAM VRAM. 4786 * @param cbLine Number of bytes per line. 4787 * @param cx New display width. 4788 * @param cy New display height 4789 * @thread The emulation thread. 4790 */ 4791 static DECLCALLBACK(int) vgaDummyResize(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, 4792 uint32_t cbLine, uint32_t cx, uint32_t cy) 4793 { 4794 NOREF(pInterface); NOREF(bpp); NOREF(pvVRAM); NOREF(cbLine); NOREF(cx); NOREF(cy); 4771 * @interface_method_impl{PDMIDISPLAYCONNECTOR,pfnResize} 4772 */ 4773 static DECLCALLBACK(int) vgaR3DummyResize(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, 4774 uint32_t cbLine, uint32_t cx, uint32_t cy) 4775 { 4776 RT_NOREF(pInterface, bpp, pvVRAM, cbLine, cx, cy); 4795 4777 return VINF_SUCCESS; 4796 4778 } … … 4798 4780 4799 4781 /** 4800 * Update a rectangle of the display. 4801 * PDMIDISPLAYPORT::pfnUpdateDisplay is the caller. 4802 * 4803 * @param pInterface Pointer to this interface. 4804 * @param x The upper left corner x coordinate of the rectangle. 4805 * @param y The upper left corner y coordinate of the rectangle. 4806 * @param cx The width of the rectangle. 4807 * @param cy The height of the rectangle. 4808 * @thread The emulation thread. 4809 */ 4810 static DECLCALLBACK(void) vgaDummyUpdateRect(PPDMIDISPLAYCONNECTOR pInterface, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy) 4811 { 4812 NOREF(pInterface); NOREF(x); NOREF(y); NOREF(cx); NOREF(cy); 4813 } 4814 4815 4816 /** 4817 * Refresh the display. 4818 * 4819 * The interval between these calls is set by 4820 * PDMIDISPLAYPORT::pfnSetRefreshRate(). The driver should call 4821 * PDMIDISPLAYPORT::pfnUpdateDisplay() if it wishes to refresh the 4822 * display. PDMIDISPLAYPORT::pfnUpdateDisplay calls pfnUpdateRect with 4823 * the changed rectangles. 4824 * 4825 * @param pInterface Pointer to this interface. 4826 * @thread The emulation thread. 4827 */ 4828 static DECLCALLBACK(void) vgaDummyRefresh(PPDMIDISPLAYCONNECTOR pInterface) 4782 * @interface_method_impl{PDMIDISPLAYCONNECTOR,pfnUpdateRect} 4783 */ 4784 static DECLCALLBACK(void) vgaR3DummyUpdateRect(PPDMIDISPLAYCONNECTOR pInterface, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy) 4785 { 4786 RT_NOREF(pInterface, x, y, cx, cy); 4787 } 4788 4789 4790 /** 4791 * @interface_method_impl{PDMIDISPLAYCONNECTOR,pfnRefresh} 4792 */ 4793 static DECLCALLBACK(void) vgaR3DummyRefresh(PPDMIDISPLAYCONNECTOR pInterface) 4829 4794 { 4830 4795 NOREF(pInterface); … … 4835 4800 4836 4801 /** Converts a display port interface pointer to a vga state pointer. */ 4837 #define IDISPLAYPORT_2_VGASTATE(pInterface) ( (PVGASTATE)((uintptr_t)pInterface - RT_OFFSETOF(VGASTATE, IPort)) ) 4838 4839 4840 /** 4841 * Update the display with any changed regions. 4842 * 4843 * @param pInterface Pointer to this interface. 4844 * @see PDMIKEYBOARDPORT::pfnUpdateDisplay() for details. 4845 */ 4846 static DECLCALLBACK(int) vgaPortUpdateDisplay(PPDMIDISPLAYPORT pInterface) 4802 # define IDISPLAYPORT_2_VGASTATE(pInterface) ( (PVGASTATE)((uintptr_t)pInterface - RT_OFFSETOF(VGASTATE, IPort)) ) 4803 4804 4805 /** 4806 * @interface_method_impl{PDMIDISPLAYPORT,pfnUpdateDisplay} 4807 */ 4808 static DECLCALLBACK(int) vgaR3PortUpdateDisplay(PPDMIDISPLAYPORT pInterface) 4847 4809 { 4848 4810 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); … … 4853 4815 AssertRC(rc); 4854 4816 4855 # ifdef VBOX_WITH_VMSVGA4817 # ifdef VBOX_WITH_VMSVGA 4856 4818 if ( pThis->svga.fEnabled 4857 4819 && !pThis->svga.fTraces) … … 4863 4825 #endif 4864 4826 4865 # ifndef VBOX_WITH_HGSMI4827 # ifndef VBOX_WITH_HGSMI 4866 4828 /* This should be called only in non VBVA mode. */ 4867 # else4829 # else 4868 4830 if (VBVAUpdateDisplay (pThis) == VINF_SUCCESS) 4869 4831 { … … 4871 4833 return VINF_SUCCESS; 4872 4834 } 4873 # endif /* VBOX_WITH_HGSMI */4835 # endif /* VBOX_WITH_HGSMI */ 4874 4836 4875 4837 STAM_COUNTER_INC(&pThis->StatUpdateDisp); … … 4885 4847 } 4886 4848 4887 rc = vga _update_display(pThis, false /*fUpdateAll*/, false /*fFailOnResize*/, true /*reset_dirty*/,4849 rc = vgaR3UpdateDisplay(pThis, false /*fUpdateAll*/, false /*fFailOnResize*/, true /*reset_dirty*/, 4888 4850 pThis->pDrv, &pThis->graphic_mode); 4889 4851 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); … … 4893 4855 4894 4856 /** 4895 * Internal vga PortUpdateDisplayAll worker called under pThis->CritSect.4896 */ 4897 static int updateDisplayAll(PVGASTATE pThis, bool fFailOnResize)4857 * Internal vgaR3PortUpdateDisplayAll worker called under pThis->CritSect. 4858 */ 4859 static int vboxR3UpdateDisplayAllInternal(PVGASTATE pThis, bool fFailOnResize) 4898 4860 { 4899 4861 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 4900 4862 4901 # ifdef VBOX_WITH_VMSVGA4863 # ifdef VBOX_WITH_VMSVGA 4902 4864 if ( !pThis->svga.fEnabled 4903 4865 || pThis->svga.fTraces) 4904 4866 { 4905 # endif4867 # endif 4906 4868 /* The dirty bits array has been just cleared, reset handlers as well. */ 4907 4869 if (pThis->GCPhysVRAM && pThis->GCPhysVRAM != NIL_RTGCPHYS) 4908 4870 PGMHandlerPhysicalReset(PDMDevHlpGetVM(pDevIns), pThis->GCPhysVRAM); 4909 # ifdef VBOX_WITH_VMSVGA4910 } 4911 # endif4871 # ifdef VBOX_WITH_VMSVGA 4872 } 4873 # endif 4912 4874 if (pThis->fRemappedVGA) 4913 4875 { … … 4918 4880 pThis->graphic_mode = -1; /* force full update */ 4919 4881 4920 return vga_update_display(pThis, true /*fUpdateAll*/, fFailOnResize, true /*reset_dirty*/, pThis->pDrv, &pThis->graphic_mode); 4921 } 4922 4923 4924 DECLCALLBACK(int) vgaUpdateDisplayAll(PVGASTATE pThis, bool fFailOnResize) 4925 { 4882 return vgaR3UpdateDisplay(pThis, true /*fUpdateAll*/, fFailOnResize, true /*reset_dirty*/, pThis->pDrv, &pThis->graphic_mode); 4883 } 4884 4885 4886 /** 4887 * @interface_method_impl{PDMIDISPLAYPORT,pfnUpdateDisplayAll} 4888 */ 4889 static DECLCALLBACK(int) vgaR3PortUpdateDisplayAll(PPDMIDISPLAYPORT pInterface, bool fFailOnResize) 4890 { 4891 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 4926 4892 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 4927 #ifdef DEBUG_sunlover 4928 LogFlow(("vgaPortUpdateDisplayAll\n")); 4929 #endif /* DEBUG_sunlover */ 4893 PDMDEV_ASSERT_EMT(pDevIns); 4894 4895 /* This is called both in VBVA mode and normal modes. */ 4896 4897 # ifdef DEBUG_sunlover 4898 LogFlow(("vgaR3PortUpdateDisplayAll\n")); 4899 # endif /* DEBUG_sunlover */ 4930 4900 4931 4901 int rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY); 4932 4902 AssertRC(rc); 4933 4903 4934 rc = updateDisplayAll(pThis, fFailOnResize);4904 rc = vboxR3UpdateDisplayAllInternal(pThis, fFailOnResize); 4935 4905 4936 4906 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); … … 4938 4908 } 4939 4909 4940 /** 4941 * Update the entire display. 4942 * 4943 * @param pInterface Pointer to this interface. 4944 * @param fFailOnResize Fail on resize. 4945 * @see PDMIKEYBOARDPORT::pfnUpdateDisplayAll() for details. 4946 */ 4947 static DECLCALLBACK(int) vgaPortUpdateDisplayAll(PPDMIDISPLAYPORT pInterface, bool fFailOnResize) 4948 { 4949 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 4950 PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis)); 4951 4952 /* This is called both in VBVA mode and normal modes. */ 4953 4954 return vgaUpdateDisplayAll(pThis, fFailOnResize); 4955 } 4956 4957 4958 /** 4959 * Sets the refresh rate and restart the timer. 4960 * 4961 * @returns VBox status code. 4962 * @param pInterface Pointer to this interface. 4963 * @param cMilliesInterval Number of millis between two refreshes. 4964 * @see PDMIDISPLAYPORT::pfnSetRefreshRate() for details. 4965 */ 4966 static DECLCALLBACK(int) vgaPortSetRefreshRate(PPDMIDISPLAYPORT pInterface, uint32_t cMilliesInterval) 4910 4911 /** 4912 * @interface_method_impl{PDMIDISPLAYPORT,pfnSetRefreshRate} 4913 */ 4914 static DECLCALLBACK(int) vgaR3PortSetRefreshRate(PPDMIDISPLAYPORT pInterface, uint32_t cMilliesInterval) 4967 4915 { 4968 4916 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); … … 4975 4923 ASMAtomicWriteU32(&pThis->cMilliesRefreshInterval, cMilliesInterval); 4976 4924 4977 # ifdef VBOX_WITH_VMSVGA4925 # ifdef VBOX_WITH_VMSVGA 4978 4926 if (pThis->svga.fFIFOThreadSleeping) 4979 4927 PDMDevHlpSUPSemEventSignal(pDevIns, pThis->svga.hFIFORequestSem); 4980 # endif4928 # endif 4981 4929 4982 4930 if (cMilliesInterval) … … 4986 4934 4987 4935 4988 /** @interface_method_impl{PDMIDISPLAYPORT,pfnQueryVideoMode} */ 4989 static DECLCALLBACK(int) vgaPortQueryVideoMode(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits, uint32_t *pcx, uint32_t *pcy) 4936 /** 4937 * @interface_method_impl{PDMIDISPLAYPORT,pfnQueryVideoMode} 4938 */ 4939 static DECLCALLBACK(int) vgaR3PortQueryVideoMode(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits, uint32_t *pcx, uint32_t *pcy) 4990 4940 { 4991 4941 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); … … 4993 4943 if (!pcBits) 4994 4944 return VERR_INVALID_PARAMETER; 4995 *pcBits = vga _get_bpp(pThis);4945 *pcBits = vgaR3GetBpp(pThis); 4996 4946 if (pcx) 4997 4947 *pcx = pThis->last_scr_width; … … 5003 4953 5004 4954 /** 5005 * Create a 32-bbp screenshot of the display. Size of the bitmap scanline in bytes is 4*width. 5006 * 5007 * @param pInterface Pointer to this interface. 5008 * @param ppbData Where to store the pointer to the allocated 5009 * buffer. 5010 * @param pcbData Where to store the actual size of the bitmap. 5011 * @param pcx Where to store the width of the bitmap. 5012 * @param pcy Where to store the height of the bitmap. 5013 * @see PDMIDISPLAYPORT::pfnTakeScreenshot() for details. 5014 */ 5015 static DECLCALLBACK(int) vgaPortTakeScreenshot(PPDMIDISPLAYPORT pInterface, uint8_t **ppbData, size_t *pcbData, 5016 uint32_t *pcx, uint32_t *pcy) 4955 * @interface_method_impl{PDMIDISPLAYPORT,pfnTakeScreenshot} 4956 */ 4957 static DECLCALLBACK(int) vgaR3PortTakeScreenshot(PPDMIDISPLAYPORT pInterface, uint8_t **ppbData, size_t *pcbData, 4958 uint32_t *pcx, uint32_t *pcy) 5017 4959 { 5018 4960 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); … … 5020 4962 PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis)); 5021 4963 5022 LogFlow(("vga PortTakeScreenshot: ppbData=%p pcbData=%p pcx=%p pcy=%p\n", ppbData, pcbData, pcx, pcy));4964 LogFlow(("vgaR3PortTakeScreenshot: ppbData=%p pcbData=%p pcx=%p pcy=%p\n", ppbData, pcbData, pcx, pcy)); 5023 4965 5024 4966 /* … … 5033 4975 /* 5034 4976 * Get screenshot. This function will fail if a resize is required. 5035 * So there is not need to do a ' updateDisplayAll' before taking screenshot.4977 * So there is not need to do a 'vboxR3UpdateDisplayAllInternal' before taking screenshot. 5036 4978 */ 5037 4979 … … 5060 5002 Connector.cy = pThis->last_scr_height; 5061 5003 Connector.cbScanline = Connector.cx * 4; 5062 Connector.pfnRefresh = vga DummyRefresh;5063 Connector.pfnResize = vga DummyResize;5064 Connector.pfnUpdateRect = vga DummyUpdateRect;5004 Connector.pfnRefresh = vgaR3DummyRefresh; 5005 Connector.pfnResize = vgaR3DummyResize; 5006 Connector.pfnUpdateRect = vgaR3DummyUpdateRect; 5065 5007 5066 5008 int32_t cur_graphic_mode = -1; … … 5077 5019 * If there is a pending resize, the function will fail. 5078 5020 */ 5079 rc = vga _update_display(pThis, false /*fUpdateAll*/, true /*fFailOnResize*/, false /*reset_dirty*/,5021 rc = vgaR3UpdateDisplay(pThis, false /*fUpdateAll*/, true /*fFailOnResize*/, false /*reset_dirty*/, 5080 5022 &Connector, &cur_graphic_mode); 5081 5023 … … 5111 5053 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 5112 5054 5113 LogFlow(("vga PortTakeScreenshot: returns %Rrc (cbData=%d cx=%d cy=%d)\n", rc, *pcbData, *pcx, *pcy));5055 LogFlow(("vgaR3PortTakeScreenshot: returns %Rrc (cbData=%d cx=%d cy=%d)\n", rc, *pcbData, *pcx, *pcy)); 5114 5056 return rc; 5115 5057 } 5116 5058 5117 /** 5118 * Free a screenshot buffer allocated in vgaPortTakeScreenshot. 5119 * 5120 * @param pInterface Pointer to this interface. 5121 * @param pbData Pointer returned by vgaPortTakeScreenshot. 5122 * @see PDMIDISPLAYPORT::pfnFreeScreenshot() for details. 5123 */ 5124 static DECLCALLBACK(void) vgaPortFreeScreenshot(PPDMIDISPLAYPORT pInterface, uint8_t *pbData) 5059 5060 /** 5061 * @interface_method_impl{PDMIDISPLAYPORT,pfnFreeScreenshot} 5062 */ 5063 static DECLCALLBACK(void) vgaR3PortFreeScreenshot(PPDMIDISPLAYPORT pInterface, uint8_t *pbData) 5125 5064 { 5126 5065 NOREF(pInterface); 5127 5066 5128 LogFlow(("vga PortFreeScreenshot: pbData=%p\n", pbData));5067 LogFlow(("vgaR3PortFreeScreenshot: pbData=%p\n", pbData)); 5129 5068 5130 5069 RTMemFree(pbData); 5131 5070 } 5132 5071 5133 /** 5134 * Copy bitmap to the display. 5135 * 5136 * @param pInterface Pointer to this interface. 5137 * @param pvData Pointer to the bitmap bits. 5138 * @param x The upper left corner x coordinate of the destination rectangle. 5139 * @param y The upper left corner y coordinate of the destination rectangle. 5140 * @param cx The width of the source and destination rectangles. 5141 * @param cy The height of the source and destination rectangles. 5142 * @see PDMIDISPLAYPORT::pfnDisplayBlt() for details. 5143 */ 5144 static DECLCALLBACK(int) vgaPortDisplayBlt(PPDMIDISPLAYPORT pInterface, const void *pvData, uint32_t x, uint32_t y, 5145 uint32_t cx, uint32_t cy) 5072 5073 /** 5074 * @interface_method_impl{PDMIDISPLAYPORT,pfnDisplayBlt} 5075 */ 5076 static DECLCALLBACK(int) vgaR3PortDisplayBlt(PPDMIDISPLAYPORT pInterface, const void *pvData, 5077 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy) 5146 5078 { 5147 5079 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); … … 5149 5081 int rc; 5150 5082 PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis)); 5151 LogFlow(("vga PortDisplayBlt: pvData=%p x=%d y=%d cx=%d cy=%d\n", pvData, x, y, cx, cy));5083 LogFlow(("vgaR3PortDisplayBlt: pvData=%p x=%d y=%d cx=%d cy=%d\n", pvData, x, y, cx, cy)); 5152 5084 5153 5085 rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY); … … 5198 5130 uint8_t *pbDst = pThis->pDrv->pbData + y * cbLineDst + x * cbPixelDst; 5199 5131 uint32_t cyLeft = cy; 5200 vga_draw_line_func *pfnVgaDrawLine = vga_draw_line_table[VGA_DRAW_LINE32 * 4 + get_depth_index(pThis->pDrv->cBits)];5132 vga_draw_line_func *pfnVgaDrawLine = vga_draw_line_table[VGA_DRAW_LINE32 * 4 + vgaR3GetDepthIndex(pThis->pDrv->cBits)]; 5201 5133 Assert(pfnVgaDrawLine); 5202 5134 while (cyLeft-- > 0) … … 5218 5150 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 5219 5151 5220 LogFlow(("vga PortDisplayBlt: returns %Rrc\n", rc));5152 LogFlow(("vgaR3PortDisplayBlt: returns %Rrc\n", rc)); 5221 5153 return rc; 5222 5154 } 5223 5155 5224 static DECLCALLBACK(void) vgaPortUpdateDisplayRect(PPDMIDISPLAYPORT pInterface, int32_t x, int32_t y, uint32_t w, uint32_t h) 5156 5157 /** 5158 * @interface_method_impl{PDMIDISPLAYPORT,pfnUpdateDisplayRect} 5159 */ 5160 static DECLCALLBACK(void) vgaR3PortUpdateDisplayRect(PPDMIDISPLAYPORT pInterface, int32_t x, int32_t y, uint32_t cx, uint32_t cy) 5225 5161 { 5226 5162 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); … … 5238 5174 5239 5175 5240 # ifdef DEBUG_sunlover5241 LogFlow(("vga PortUpdateDisplayRect: %d,%d %dx%d\n", x, y, w, h));5242 # endif /* DEBUG_sunlover */5176 # ifdef DEBUG_sunlover 5177 LogFlow(("vgaR3PortUpdateDisplayRect: %d,%d %dx%d\n", x, y, cx, cy)); 5178 # endif /* DEBUG_sunlover */ 5243 5179 5244 5180 Assert(pInterface); … … 5251 5187 { 5252 5188 /* The framebuffer uses the guest VRAM directly. */ 5253 # ifdef DEBUG_sunlover5254 LogFlow(("vga PortUpdateDisplayRect: nothing to do fRender is false.\n"));5255 # endif /* DEBUG_sunlover */5189 # ifdef DEBUG_sunlover 5190 LogFlow(("vgaR3PortUpdateDisplayRect: nothing to do fRender is false.\n")); 5191 # endif /* DEBUG_sunlover */ 5256 5192 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 5257 5193 return; … … 5264 5200 if (x < 0) 5265 5201 { 5266 x += w; /* Compute xRight which is also the new width. */5267 w= (x < 0) ? 0 : x;5202 x += cx; /* Compute xRight which is also the new width. */ 5203 cx = (x < 0) ? 0 : x; 5268 5204 x = 0; 5269 5205 } … … 5271 5207 if (y < 0) 5272 5208 { 5273 y += h; /* Compute yBottom, which is also the new height. */5274 h= (y < 0) ? 0 : y;5209 y += cy; /* Compute yBottom, which is also the new height. */ 5210 cy = (y < 0) ? 0 : y; 5275 5211 y = 0; 5276 5212 } 5277 5213 5278 5214 /* Also check if coords are greater than the display resolution. */ 5279 if (x + w> pThis->pDrv->cx)5215 if (x + cx > pThis->pDrv->cx) 5280 5216 { 5281 5217 // x < 0 is not possible here 5282 w= pThis->pDrv->cx > (uint32_t)x? pThis->pDrv->cx - x: 0;5283 } 5284 5285 if (y + h> pThis->pDrv->cy)5218 cx = pThis->pDrv->cx > (uint32_t)x? pThis->pDrv->cx - x: 0; 5219 } 5220 5221 if (y + cy > pThis->pDrv->cy) 5286 5222 { 5287 5223 // y < 0 is not possible here 5288 h= pThis->pDrv->cy > (uint32_t)y? pThis->pDrv->cy - y: 0;5289 } 5290 5291 # ifdef DEBUG_sunlover5292 LogFlow(("vga PortUpdateDisplayRect: %d,%d %dx%d (corrected coords)\n", x, y, w, h));5293 # endif /* DEBUG_sunlover */5224 cy = pThis->pDrv->cy > (uint32_t)y? pThis->pDrv->cy - y: 0; 5225 } 5226 5227 # ifdef DEBUG_sunlover 5228 LogFlow(("vgaR3PortUpdateDisplayRect: %d,%d %dx%d (corrected coords)\n", x, y, cx, cy)); 5229 # endif 5294 5230 5295 5231 /* Check if there is something to do at all. */ 5296 if ( w == 0 || h== 0)5232 if (cx == 0 || cy == 0) 5297 5233 { 5298 5234 /* Empty rectangle. */ 5299 # ifdef DEBUG_sunlover5300 LogFlow(("vga PortUpdateDisplayRect: nothing to do: %dx%d\n", w, h));5301 #endif /* DEBUG_sunlover */5235 # ifdef DEBUG_sunlover 5236 LogFlow(("vgaR3PortUpdateDisplayRect: nothing to do: %dx%d\n", cx, cy)); 5237 #endif 5302 5238 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 5303 5239 return; … … 5337 5273 } 5338 5274 5339 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(pThis->pDrv->cBits)];5275 vga_draw_line = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(pThis->pDrv->cBits)]; 5340 5276 5341 5277 /* Compute source and destination addresses and pitches. */ … … 5356 5292 /* Render VRAM to framebuffer. */ 5357 5293 5358 # ifdef DEBUG_sunlover5359 LogFlow(("vga PortUpdateDisplayRect: dst: %p, %d, %d. src: %p, %d, %d\n", pbDst, cbLineDst, cbPixelDst, pbSrc, cbLineSrc, cbPixelSrc));5360 # endif /* DEBUG_sunlover */5361 5362 while ( h-- > 0)5363 { 5364 vga_draw_line (pThis, pbDst, pbSrc, w);5294 # ifdef DEBUG_sunlover 5295 LogFlow(("vgaR3PortUpdateDisplayRect: dst: %p, %d, %d. src: %p, %d, %d\n", pbDst, cbLineDst, cbPixelDst, pbSrc, cbLineSrc, cbPixelSrc)); 5296 # endif 5297 5298 while (cy-- > 0) 5299 { 5300 vga_draw_line (pThis, pbDst, pbSrc, cx); 5365 5301 pbDst += cbLineDst; 5366 5302 pbSrc += cbLineSrc; … … 5368 5304 5369 5305 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 5370 #ifdef DEBUG_sunlover 5371 LogFlow(("vgaPortUpdateDisplayRect: completed.\n")); 5372 #endif /* DEBUG_sunlover */ 5373 } 5374 5375 5306 # ifdef DEBUG_sunlover 5307 LogFlow(("vgaR3PortUpdateDisplayRect: completed.\n")); 5308 # endif 5309 } 5310 5311 5312 /** 5313 * @interface_method_impl{PDMIDISPLAYPORT,pfnCopyRect} 5314 */ 5376 5315 static DECLCALLBACK(int) 5377 vgaPortCopyRect(PPDMIDISPLAYPORT pInterface, 5378 uint32_t cx, 5379 uint32_t cy, 5380 const uint8_t *pbSrc, int32_t xSrc, int32_t ySrc, uint32_t cxSrc, uint32_t cySrc, 5381 uint32_t cbSrcLine, uint32_t cSrcBitsPerPixel, 5382 uint8_t *pbDst, int32_t xDst, int32_t yDst, uint32_t cxDst, uint32_t cyDst, 5383 uint32_t cbDstLine, uint32_t cDstBitsPerPixel) 5316 vgaR3PortCopyRect(PPDMIDISPLAYPORT pInterface, 5317 uint32_t cx, uint32_t cy, 5318 const uint8_t *pbSrc, int32_t xSrc, int32_t ySrc, uint32_t cxSrc, uint32_t cySrc, 5319 uint32_t cbSrcLine, uint32_t cSrcBitsPerPixel, 5320 uint8_t *pbDst, int32_t xDst, int32_t yDst, uint32_t cxDst, uint32_t cyDst, 5321 uint32_t cbDstLine, uint32_t cDstBitsPerPixel) 5384 5322 { 5385 5323 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); … … 5388 5326 vga_draw_line_func *vga_draw_line; 5389 5327 5390 # ifdef DEBUG_sunlover5391 LogFlow(("vga PortCopyRect: %d,%d %dx%d -> %d,%d\n", xSrc, ySrc, cx, cy, xDst, yDst));5392 # endif /* DEBUG_sunlover */5328 # ifdef DEBUG_sunlover 5329 LogFlow(("vgaR3PortCopyRect: %d,%d %dx%d -> %d,%d\n", xSrc, ySrc, cx, cy, xDst, yDst)); 5330 # endif 5393 5331 5394 5332 Assert(pInterface); … … 5428 5366 } 5429 5367 5430 # ifdef DEBUG_sunlover5431 LogFlow(("vga PortCopyRect: %d,%d %dx%d (corrected coords)\n", xSrcCorrected, ySrcCorrected, cxCorrected, cyCorrected));5432 # endif /* DEBUG_sunlover */5368 # ifdef DEBUG_sunlover 5369 LogFlow(("vgaR3PortCopyRect: %d,%d %dx%d (corrected coords)\n", xSrcCorrected, ySrcCorrected, cxCorrected, cyCorrected)); 5370 # endif 5433 5371 5434 5372 /* Check if there is something to do at all. */ … … 5436 5374 { 5437 5375 /* Empty rectangle. */ 5438 # ifdef DEBUG_sunlover5376 # ifdef DEBUG_sunlover 5439 5377 LogFlow(("vgaPortUpdateDisplayRectEx: nothing to do: %dx%d\n", cxCorrected, cyCorrected)); 5440 # endif /* DEBUG_sunlover */5378 # endif 5441 5379 return VINF_SUCCESS; 5442 5380 } … … 5469 5407 if ( (pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) == 0 5470 5408 && VBVAIsPaused(pThis) 5471 # ifdef VBOX_WITH_VMSVGA5409 # ifdef VBOX_WITH_VMSVGA 5472 5410 && !pThis->svga.fEnabled 5473 # endif5411 # endif 5474 5412 ) 5475 5413 { … … 5503 5441 } 5504 5442 5505 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(cDstBitsPerPixel)];5443 vga_draw_line = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(cDstBitsPerPixel)]; 5506 5444 5507 5445 /* Compute source and destination addresses and pitches. */ … … 5514 5452 const uint8_t *pbSrcCur = pbSrc + ySrcCorrected * cbLineSrc + xSrcCorrected * cbPixelSrc; 5515 5453 5516 # ifdef DEBUG_sunlover5517 LogFlow(("vga PortCopyRect: dst: %p, %d, %d. src: %p, %d, %d\n", pbDstCur, cbLineDst, cbPixelDst, pbSrcCur, cbLineSrc, cbPixelSrc));5518 # endif /* DEBUG_sunlover */5454 # ifdef DEBUG_sunlover 5455 LogFlow(("vgaR3PortCopyRect: dst: %p, %d, %d. src: %p, %d, %d\n", pbDstCur, cbLineDst, cbPixelDst, pbSrcCur, cbLineSrc, cbPixelSrc)); 5456 # endif 5519 5457 5520 5458 while (cyCorrected-- > 0) … … 5526 5464 5527 5465 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 5528 #ifdef DEBUG_sunlover 5529 LogFlow(("vgaPortCopyRect: completed.\n")); 5530 #endif /* DEBUG_sunlover */ 5531 5466 # ifdef DEBUG_sunlover 5467 LogFlow(("vgaR3PortCopyRect: completed.\n")); 5468 # endif 5532 5469 return VINF_SUCCESS; 5533 5470 } 5534 5471 5535 static DECLCALLBACK(void) vgaPortSetRenderVRAM(PPDMIDISPLAYPORT pInterface, bool fRender) 5472 5473 /** 5474 * @interface_method_impl{PDMIDISPLAYPORT,pfnSetRenderVRAM} 5475 */ 5476 static DECLCALLBACK(void) vgaR3PortSetRenderVRAM(PPDMIDISPLAYPORT pInterface, bool fRender) 5536 5477 { 5537 5478 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 5538 5479 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 5539 5480 5540 LogFlow(("vga PortSetRenderVRAM: fRender = %d\n", fRender));5481 LogFlow(("vgaR3PortSetRenderVRAM: fRender = %d\n", fRender)); 5541 5482 5542 5483 int rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY); … … 5548 5489 } 5549 5490 5550 static DECLCALLBACK(void) vgaPortReportHostCursorPosition(PPDMIDISPLAYPORT pInterface, uint32_t x, uint32_t y, bool fOutOfRange) 5491 5492 /** 5493 * @interface_method_impl{PDMIDISPLAYPORT,pfnReportHostCursorCapabilities} 5494 */ 5495 static DECLCALLBACK(void) vgaR3PortReportHostCursorCapabilities(PPDMIDISPLAYPORT pInterface, bool fSupportsRenderCursor, 5496 bool fSupportsMoveCursor) 5497 { 5498 RT_NOREF(pInterface, fSupportsRenderCursor, fSupportsMoveCursor); 5499 } 5500 5501 5502 /** 5503 * @interface_method_impl{PDMIDISPLAYPORT,pfnReportHostCursorPosition} 5504 */ 5505 static DECLCALLBACK(void) vgaR3PortReportHostCursorPosition(PPDMIDISPLAYPORT pInterface, uint32_t x, uint32_t y, bool fOutOfRange) 5551 5506 { 5552 5507 RT_NOREF(pInterface, x, y, fOutOfRange); 5553 5508 } 5554 5509 5555 static DECLCALLBACK(void) vgaPortReportHostCursorCapabilities(PPDMIDISPLAYPORT pInterface, bool fSupportsRenderCursor, bool fSupportsMoveCursor)5556 {5557 RT_NOREF(pInterface, fSupportsRenderCursor, fSupportsMoveCursor);5558 }5559 5510 5560 5511 /** … … 5575 5526 PDMDevHlpTimerSetMillies(pDevIns, pThis->hRefreshTimer, pThis->cMilliesRefreshInterval); 5576 5527 5577 # ifdef VBOX_WITH_VIDEOHWACCEL5528 # ifdef VBOX_WITH_VIDEOHWACCEL 5578 5529 vbvaTimerCb(pThis); 5579 # endif5580 5581 # ifdef VBOX_WITH_VMSVGA5530 # endif 5531 5532 # ifdef VBOX_WITH_VMSVGA 5582 5533 /* 5583 5534 * Call the VMSVGA FIFO poller/watchdog so we can wake up the thread if … … 5586 5537 if (pThis->svga.fFIFOThreadSleeping && pThis->svga.fEnabled && pThis->svga.fConfigured) 5587 5538 vmsvgaFIFOWatchdogTimer(pDevIns, pThis); 5588 #endif 5589 } 5590 5591 #ifdef VBOX_WITH_VMSVGA 5592 5539 # endif 5540 } 5541 5542 # ifdef VBOX_WITH_VMSVGA 5543 5544 /** 5545 * Helper for VMSVGA. 5546 */ 5593 5547 int vgaR3RegisterVRAMHandler(PVGASTATE pVGAState, uint64_t cbFrameBuffer) 5594 5548 { … … 5605 5559 } 5606 5560 5561 5562 /** 5563 * Helper for VMSVGA. 5564 */ 5607 5565 int vgaR3UnregisterVRAMHandler(PVGASTATE pVGAState) 5608 5566 { … … 5615 5573 } 5616 5574 5617 #endif /* PPDMDEVINS pDevIns */ 5575 # endif /* VBOX_WITH_VMSVGA */ 5576 5618 5577 5619 5578 /* -=-=-=-=-=- Ring 3: PCI Device -=-=-=-=-=- */ … … 5687 5646 5688 5647 5689 # ifdef VBOX_WITH_VMSVGA /* Currently not needed in the non-VMSVGA mode, but keeping it flexible for later. */5648 # ifdef VBOX_WITH_VMSVGA /* Currently not needed in the non-VMSVGA mode, but keeping it flexible for later. */ 5690 5649 /** 5691 5650 * @interface_method_impl{PDMPCIDEV,pfnRegionLoadChangeHookR3} … … 5697 5656 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5698 5657 5699 # ifdef VBOX_WITH_VMSVGA5658 # ifdef VBOX_WITH_VMSVGA 5700 5659 if (pThis->fVMSVGAEnabled) 5701 5660 { … … 5776 5735 } 5777 5736 } 5737 # endif /* VBOX_WITH_VMSVGA */ 5738 5739 return VERR_VGA_UNEXPECTED_PCI_REGION_LOAD_CHANGE; 5740 } 5778 5741 # endif /* VBOX_WITH_VMSVGA */ 5779 5780 return VERR_VGA_UNEXPECTED_PCI_REGION_LOAD_CHANGE;5781 }5782 #endif /* VBOX_WITH_VMSVGA */5783 5742 5784 5743 … … 5816 5775 static DECLCALLBACK(int) vgaR3SavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 5817 5776 { 5818 # ifdef VBOX_WITH_VIDEOHWACCEL5777 # ifdef VBOX_WITH_VIDEOHWACCEL 5819 5778 RT_NOREF(pSSM); 5820 5779 return vboxVBVASaveStatePrep(pDevIns); 5821 # else5780 # else 5822 5781 RT_NOREF(pDevIns, pSSM); 5823 5782 return VINF_SUCCESS; 5824 # endif5783 # endif 5825 5784 } 5826 5785 … … 5830 5789 static DECLCALLBACK(int) vgaR3SaveDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 5831 5790 { 5832 # ifdef VBOX_WITH_VIDEOHWACCEL5791 # ifdef VBOX_WITH_VIDEOHWACCEL 5833 5792 RT_NOREF(pSSM); 5834 5793 return vboxVBVASaveStateDone(pDevIns); 5835 # else5794 # else 5836 5795 RT_NOREF(pDevIns, pSSM); 5837 5796 return VINF_SUCCESS; 5838 # endif5797 # endif 5839 5798 } 5840 5799 … … 5847 5806 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 5848 5807 5849 # ifdef VBOX_WITH_VDMA5808 # ifdef VBOX_WITH_VDMA 5850 5809 vboxVDMASaveStateExecPrep(pThis->pVdma); 5851 # endif5810 # endif 5852 5811 5853 5812 vgaR3SaveConfig(pHlp, pThis, pSSM); … … 5855 5814 5856 5815 VGA_SAVED_STATE_PUT_MARKER(pSSM, 1); 5857 # ifdef VBOX_WITH_HGSMI5816 # ifdef VBOX_WITH_HGSMI 5858 5817 pHlp->pfnSSMPutBool(pSSM, true); 5859 5818 int rc = vboxVBVASaveStateExec(pDevIns, pSSM); 5860 # else5819 # else 5861 5820 int rc = pHlp->pfnSSMPutBool(pSSM, false); 5862 # endif5821 # endif 5863 5822 5864 5823 AssertRCReturn(rc, rc); 5865 5824 5866 5825 VGA_SAVED_STATE_PUT_MARKER(pSSM, 3); 5867 # ifdef VBOX_WITH_VDMA5826 # ifdef VBOX_WITH_VDMA 5868 5827 rc = pHlp->pfnSSMPutU32(pSSM, 1); 5869 5828 AssertRCReturn(rc, rc); 5870 5829 rc = vboxVDMASaveStateExecPerform(pHlp, pThis->pVdma, pSSM); 5871 # else5830 # else 5872 5831 rc = pHlp->pfnSSMPutU32(pSSM, 0); 5873 # endif5832 # endif 5874 5833 AssertRCReturn(rc, rc); 5875 5834 5876 # ifdef VBOX_WITH_VDMA5835 # ifdef VBOX_WITH_VDMA 5877 5836 vboxVDMASaveStateExecDone(pThis->pVdma); 5878 # endif5837 # endif 5879 5838 5880 5839 VGA_SAVED_STATE_PUT_MARKER(pSSM, 5); 5881 # ifdef VBOX_WITH_VMSVGA5840 # ifdef VBOX_WITH_VMSVGA 5882 5841 if (pThis->fVMSVGAEnabled) 5883 5842 { … … 5885 5844 AssertRCReturn(rc, rc); 5886 5845 } 5887 # endif5846 # endif 5888 5847 VGA_SAVED_STATE_PUT_MARKER(pSSM, 6); 5889 5848 … … 5938 5897 if (fWithHgsmi) 5939 5898 { 5940 # ifdef VBOX_WITH_HGSMI5899 # ifdef VBOX_WITH_HGSMI 5941 5900 rc = vboxVBVALoadStateExec(pDevIns, pSSM, uVersion); 5942 5901 AssertRCReturn(rc, rc); 5943 # else5902 # else 5944 5903 return pHlp->pfnSSMSetCfgError(pSSM, RT_SRC_POS, N_("HGSMI is not compiled in, but it is present in the saved state")); 5945 # endif5904 # endif 5946 5905 } 5947 5906 … … 5953 5912 if (u32) 5954 5913 { 5955 # ifdef VBOX_WITH_VDMA5914 # ifdef VBOX_WITH_VDMA 5956 5915 if (u32 == 1) 5957 5916 { … … 5960 5919 } 5961 5920 else 5962 # endif5921 # endif 5963 5922 { 5964 5923 LogRel(("invalid CmdVbva version info\n")); … … 5969 5928 5970 5929 VGA_SAVED_STATE_GET_MARKER_RETURN_ON_MISMATCH(pSSM, uVersion, 5); 5971 # ifdef VBOX_WITH_VMSVGA5930 # ifdef VBOX_WITH_VMSVGA 5972 5931 if (pThis->fVMSVGAEnabled) 5973 5932 { … … 5975 5934 AssertRCReturn(rc, rc); 5976 5935 } 5977 # endif5936 # endif 5978 5937 VGA_SAVED_STATE_GET_MARKER_RETURN_ON_MISMATCH(pSSM, uVersion, 6); 5979 5938 } … … 5990 5949 int rc = VINF_SUCCESS; 5991 5950 5992 # ifdef VBOX_WITH_HGSMI5951 # ifdef VBOX_WITH_HGSMI 5993 5952 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5994 5953 rc = vboxVBVALoadStateDone(pDevIns); … … 6000 5959 /* Now update the current VBVA state which depends on VBE registers. vboxVBVALoadStateDone cleared the state. */ 6001 5960 VBVAOnVBEChanged(pThis); 6002 # endif6003 # ifdef VBOX_WITH_VMSVGA5961 # endif 5962 # ifdef VBOX_WITH_VMSVGA 6004 5963 if (pThis->fVMSVGAEnabled) 6005 5964 { … … 6007 5966 AssertRCReturn(rc, rc); 6008 5967 } 6009 # endif5968 # endif 6010 5969 return rc; 6011 5970 } … … 6037 5996 vboxVDMAReset(pThis->pVdma); 6038 5997 6039 # ifdef VBOX_WITH_VMSVGA5998 # ifdef VBOX_WITH_VMSVGA 6040 5999 if (pThis->fVMSVGAEnabled) 6041 6000 vmsvgaReset(pDevIns); 6042 # endif6043 6044 # ifdef VBOX_WITH_HGSMI6001 # endif 6002 6003 # ifdef VBOX_WITH_HGSMI 6045 6004 VBVAReset(pThis); 6046 # endif /* VBOX_WITH_HGSMI */6005 # endif 6047 6006 6048 6007 … … 6071 6030 * Restore and re-init some bits. 6072 6031 */ 6073 pThis->get_bpp = vga _get_bpp;6074 pThis->get_offsets = vga _get_offsets;6075 pThis->get_resolution = vga _get_resolution;6032 pThis->get_bpp = vgaR3GetBpp; 6033 pThis->get_offsets = vgaR3GetOffsets; 6034 pThis->get_resolution = vgaR3GetResolution; 6076 6035 pThis->graphic_mode = -1; /* Force full update. */ 6077 # ifdef CONFIG_BOCHS_VBE6036 # ifdef CONFIG_BOCHS_VBE 6078 6037 pThis->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0; 6079 6038 pThis->vbe_regs[VBE_DISPI_INDEX_VBOX_VIDEO] = 0; 6080 6039 pThis->vbe_regs[VBE_DISPI_INDEX_FB_BASE_HI] = pThis->GCPhysVRAM >> 16; 6081 6040 pThis->vbe_bank_max = (pThis->vram_size >> 16) - 1; 6082 # endif /* CONFIG_BOCHS_VBE */6041 # endif /* CONFIG_BOCHS_VBE */ 6083 6042 6084 6043 /* … … 6132 6091 { 6133 6092 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6134 # ifdef VBOX_WITH_VMSVGA6093 # ifdef VBOX_WITH_VMSVGA 6135 6094 vmsvgaR3PowerOn(pDevIns); 6136 # endif6095 # endif 6137 6096 VBVAOnResume(pThis); 6138 6097 } … … 6197 6156 rc = VERR_INTERNAL_ERROR; 6198 6157 } 6199 # ifdef VBOX_WITH_VIDEOHWACCEL6158 # ifdef VBOX_WITH_VIDEOHWACCEL 6200 6159 if(rc == VINF_SUCCESS) 6201 6160 { … … 6204 6163 AssertRC(rc); 6205 6164 } 6206 # endif6165 # endif 6207 6166 } 6208 6167 else … … 6274 6233 # endif 6275 6234 6276 # ifdef VBOX_WITH_VMSVGA6235 # ifdef VBOX_WITH_VMSVGA 6277 6236 if (pThis->fVMSVGAEnabled) 6278 6237 vmsvgaDestruct(pDevIns); 6279 # endif6280 6281 # ifdef VBOX_WITH_HGSMI6238 # endif 6239 6240 # ifdef VBOX_WITH_HGSMI 6282 6241 VBVADestroy(pThis); 6283 # endif6242 # endif 6284 6243 6285 6244 /* … … 6315 6274 } 6316 6275 6276 # if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_VDMA) || defined(VBOX_WITH_WDDM) 6317 6277 PDMDevHlpCritSectDelete(pDevIns, &pThis->CritSectIRQ); 6278 # endif 6318 6279 PDMDevHlpCritSectDelete(pDevIns, &pThis->CritSect); 6319 6280 return VINF_SUCCESS; … … 6330 6291 * @param pMode The mode information structure. 6331 6292 */ 6332 static void vgaAdjustModeInfo(PVGASTATE pThis, ModeInfoListItem *pMode) 6333 { 6334 int maxPage; 6335 int bpl; 6336 6337 6293 static void vgaR3AdjustModeInfo(PVGASTATE pThis, ModeInfoListItem *pMode) 6294 { 6338 6295 /* For 4bpp modes, the planes are "stacked" on top of each other. */ 6339 bpl = pMode->info.BytesPerScanLine * pMode->info.NumberOfPlanes;6296 unsigned bpl = pMode->info.BytesPerScanLine * pMode->info.NumberOfPlanes; 6340 6297 /* The "number of image pages" is really the max page index... */ 6341 maxPage = pThis->vram_size / (pMode->info.YResolution * bpl) - 1; 6342 Assert(maxPage >= 0); 6298 unsigned maxPage = pThis->vram_size / (pMode->info.YResolution * bpl) - 1; 6343 6299 if (maxPage > 255) 6344 6300 maxPage = 255; /* 8-bit value. */ … … 6376 6332 { 6377 6333 s_fExpandDone = true; 6378 vga _init_expand();6334 vgaR3InitExpand(); 6379 6335 } 6380 6336 … … 6411 6367 "|MaxBiosXRes" 6412 6368 "|MaxBiosYRes" 6413 # ifdef VBOX_WITH_VMSVGA6369 # ifdef VBOX_WITH_VMSVGA 6414 6370 "|VMSVGAEnabled" 6415 6371 "|VMSVGAPciId" 6416 6372 "|VMSVGAPciBarLayout" 6417 6373 "|VMSVGAFifoSize" 6418 # endif6419 # ifdef VBOX_WITH_VMSVGA3D6374 # endif 6375 # ifdef VBOX_WITH_VMSVGA3D 6420 6376 "|VMSVGA3dEnabled" 6421 # endif6377 # endif 6422 6378 "|SuppressNewYearSplash" 6423 6379 "|3DEnabled"; … … 6449 6405 Log(("VGA: f3DEnabled=%RTbool\n", pThis->f3DEnabled)); 6450 6406 6451 # ifdef VBOX_WITH_VMSVGA6407 # ifdef VBOX_WITH_VMSVGA 6452 6408 rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "VMSVGAEnabled", &pThis->fVMSVGAEnabled, false); 6453 6409 AssertLogRelRCReturn(rc, rc); … … 6469 6425 pThis->svga.cbFIFOConfig = pThis->svga.cbFIFO; 6470 6426 Log(("VMSVGA: VMSVGAFifoSize = %#x (%'u)\n", pThis->svga.cbFIFO, pThis->svga.cbFIFO)); 6471 # endif6472 # ifdef VBOX_WITH_VMSVGA3D6427 # endif 6428 # ifdef VBOX_WITH_VMSVGA3D 6473 6429 rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "VMSVGA3dEnabled", &pThis->svga.f3DEnabled, false); 6474 6430 AssertLogRelRCReturn(rc, rc); 6475 6431 Log(("VMSVGA: VMSVGA3dEnabled = %d\n", pThis->svga.f3DEnabled)); 6476 # endif6477 6478 # ifdef VBOX_WITH_VMSVGA6432 # endif 6433 6434 # ifdef VBOX_WITH_VMSVGA 6479 6435 if (pThis->fVMSVGAPciBarLayout) 6480 6436 { … … 6488 6444 } 6489 6445 pThis->pciRegions.iFIFO = 2; 6490 # else6446 # else 6491 6447 pThis->pciRegions.iVRAM = 0; 6492 # endif6448 # endif 6493 6449 6494 6450 pThis->pDevInsR3 = pDevIns; 6495 6451 pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 6496 # ifdef VBOX_WITH_RAW_MODE_KEEP6452 # ifdef VBOX_WITH_RAW_MODE_KEEP 6497 6453 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 6498 # endif6454 # endif 6499 6455 6500 6456 vgaR3Reset(pDevIns); … … 6504 6460 PDMPCIDEV_ASSERT_VALID(pDevIns, pPciDev); 6505 6461 6506 # ifdef VBOX_WITH_VMSVGA6462 # ifdef VBOX_WITH_VMSVGA 6507 6463 if (pThis->fVMSVGAEnabled) 6508 6464 { … … 6522 6478 } 6523 6479 else 6524 { 6525 #endif /* VBOX_WITH_VMSVGA */ 6480 # endif /* VBOX_WITH_VMSVGA */ 6481 { 6526 6482 PDMPciDevSetVendorId(pPciDev, 0x80ee); /* PCI vendor, just a free bogus value */ 6527 6483 PDMPciDevSetDeviceId(pPciDev, 0xbeef); 6528 #ifdef VBOX_WITH_VMSVGA 6529 } 6530 #endif 6484 } 6531 6485 PDMPciDevSetClassSub(pPciDev, 0x00); /* VGA controller */ 6532 6486 PDMPciDevSetClassBase(pPciDev, 0x03); 6533 6487 PDMPciDevSetHeaderType(pPciDev, 0x00); 6534 # if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_VDMA) || defined(VBOX_WITH_WDDM))6488 # if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_VDMA) || defined(VBOX_WITH_WDDM)) 6535 6489 PDMPciDevSetInterruptPin(pPciDev, 1); 6536 # endif6490 # endif 6537 6491 6538 6492 /* the interfaces. */ 6539 pThis->IBase.pfnQueryInterface = vgaPortQueryInterface; 6540 6541 pThis->IPort.pfnUpdateDisplay = vgaPortUpdateDisplay; 6542 pThis->IPort.pfnUpdateDisplayAll = vgaPortUpdateDisplayAll; 6543 pThis->IPort.pfnQueryVideoMode = vgaPortQueryVideoMode; 6544 pThis->IPort.pfnSetRefreshRate = vgaPortSetRefreshRate; 6545 pThis->IPort.pfnTakeScreenshot = vgaPortTakeScreenshot; 6546 pThis->IPort.pfnFreeScreenshot = vgaPortFreeScreenshot; 6547 pThis->IPort.pfnDisplayBlt = vgaPortDisplayBlt; 6548 pThis->IPort.pfnUpdateDisplayRect = vgaPortUpdateDisplayRect; 6549 pThis->IPort.pfnCopyRect = vgaPortCopyRect; 6550 pThis->IPort.pfnSetRenderVRAM = vgaPortSetRenderVRAM; 6551 #ifdef VBOX_WITH_VMSVGA 6552 pThis->IPort.pfnSetViewport = vmsvgaPortSetViewport; 6553 #else 6554 pThis->IPort.pfnSetViewport = NULL; 6555 #endif 6556 pThis->IPort.pfnSendModeHint = vbvaPortSendModeHint; 6557 pThis->IPort.pfnReportHostCursorCapabilities 6558 = vgaPortReportHostCursorCapabilities; 6559 pThis->IPort.pfnReportHostCursorPosition 6560 = vgaPortReportHostCursorPosition; 6561 6562 #if defined(VBOX_WITH_HGSMI) 6563 # if defined(VBOX_WITH_VIDEOHWACCEL) 6564 pThis->IVBVACallbacks.pfnVHWACommandCompleteAsync = vbvaVHWACommandCompleteAsync; 6493 pThis->IBase.pfnQueryInterface = vgaR3PortQueryInterface; 6494 6495 pThis->IPort.pfnUpdateDisplay = vgaR3PortUpdateDisplay; 6496 pThis->IPort.pfnUpdateDisplayAll = vgaR3PortUpdateDisplayAll; 6497 pThis->IPort.pfnQueryVideoMode = vgaR3PortQueryVideoMode; 6498 pThis->IPort.pfnSetRefreshRate = vgaR3PortSetRefreshRate; 6499 pThis->IPort.pfnTakeScreenshot = vgaR3PortTakeScreenshot; 6500 pThis->IPort.pfnFreeScreenshot = vgaR3PortFreeScreenshot; 6501 pThis->IPort.pfnDisplayBlt = vgaR3PortDisplayBlt; 6502 pThis->IPort.pfnUpdateDisplayRect = vgaR3PortUpdateDisplayRect; 6503 pThis->IPort.pfnCopyRect = vgaR3PortCopyRect; 6504 pThis->IPort.pfnSetRenderVRAM = vgaR3PortSetRenderVRAM; 6505 # ifdef VBOX_WITH_VMSVGA 6506 pThis->IPort.pfnSetViewport = vmsvgaR3PortSetViewport; 6507 # else 6508 pThis->IPort.pfnSetViewport = NULL; 6565 6509 # endif 6566 #endif 6567 6568 pThis->ILeds.pfnQueryStatusLed = vgaPortQueryStatusLed; 6569 6570 RT_ZERO(pThis->Led3D); 6571 pThis->Led3D.u32Magic = PDMLED_MAGIC; 6510 pThis->IPort.pfnSendModeHint = vbvaR3PortSendModeHint; 6511 pThis->IPort.pfnReportHostCursorCapabilities = vgaR3PortReportHostCursorCapabilities; 6512 pThis->IPort.pfnReportHostCursorPosition = vgaR3PortReportHostCursorPosition; 6513 6514 # if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL) 6515 pThis->IVBVACallbacks.pfnVHWACommandCompleteAsync = vbvaR3VHWACommandCompleteAsync; 6516 # endif 6517 6518 pThis->ILeds.pfnQueryStatusLed = vgaR3PortQueryStatusLed; 6519 pThis->Led3D.u32Magic = PDMLED_MAGIC; 6572 6520 6573 6521 /* … … 6580 6528 AssertRCReturn(rc, rc); 6581 6529 6530 # ifdef VBOX_WITH_HGSMI 6531 /* 6532 * This critical section is used by vgaR3IOPortHgsmiWrite, VBVARaiseIrq and VBVAOnResume 6533 * for some IRQ related synchronization. 6534 */ 6582 6535 rc = PDMDevHlpCritSectInit(pDevIns, &pThis->CritSectIRQ, RT_SRC_POS, "VGA#%u_IRQ", iInstance); 6583 6536 AssertRCReturn(rc, rc); 6537 # endif 6584 6538 6585 6539 /* … … 6900 6854 continue; 6901 6855 *pCurMode = mode_info_list[i]; 6902 vga AdjustModeInfo(pThis, pCurMode);6856 vgaR3AdjustModeInfo(pThis, pCurMode); 6903 6857 pCurMode++; 6904 6858 } … … 7005 6959 pCurMode->info.BytesPerScanLine = cbPitch; 7006 6960 pCurMode->info.LinBytesPerScanLine = cbPitch; 7007 vga AdjustModeInfo(pThis, pCurMode);6961 vgaR3AdjustModeInfo(pThis, pCurMode); 7008 6962 7009 6963 /* commit it */ … … 7041 6995 * Register debugger info callbacks. 7042 6996 */ 7043 PDMDevHlpDBGFInfoRegister(pDevIns, "vga", "Display basic VGA state.", vga InfoState);7044 PDMDevHlpDBGFInfoRegister(pDevIns, "vgatext", "Display VGA memory formatted as text.", vga InfoText);7045 PDMDevHlpDBGFInfoRegister(pDevIns, "vgacr", "Dump VGA CRTC registers.", vga InfoCR);7046 PDMDevHlpDBGFInfoRegister(pDevIns, "vgagr", "Dump VGA Graphics Controller registers.", vga InfoGR);7047 PDMDevHlpDBGFInfoRegister(pDevIns, "vgasr", "Dump VGA Sequencer registers.", vga InfoSR);7048 PDMDevHlpDBGFInfoRegister(pDevIns, "vgaar", "Dump VGA Attribute Controller registers.", vga InfoAR);7049 PDMDevHlpDBGFInfoRegister(pDevIns, "vgapl", "Dump planar graphics state.", vga InfoPlanar);7050 PDMDevHlpDBGFInfoRegister(pDevIns, "vgadac", "Dump VGA DAC registers.", vga InfoDAC);7051 PDMDevHlpDBGFInfoRegister(pDevIns, "vbe", "Dump VGA VBE registers.", vga InfoVBE);6997 PDMDevHlpDBGFInfoRegister(pDevIns, "vga", "Display basic VGA state.", vgaR3InfoState); 6998 PDMDevHlpDBGFInfoRegister(pDevIns, "vgatext", "Display VGA memory formatted as text.", vgaR3InfoText); 6999 PDMDevHlpDBGFInfoRegister(pDevIns, "vgacr", "Dump VGA CRTC registers.", vgaR3InfoCR); 7000 PDMDevHlpDBGFInfoRegister(pDevIns, "vgagr", "Dump VGA Graphics Controller registers.", vgaR3InfoGR); 7001 PDMDevHlpDBGFInfoRegister(pDevIns, "vgasr", "Dump VGA Sequencer registers.", vgaR3InfoSR); 7002 PDMDevHlpDBGFInfoRegister(pDevIns, "vgaar", "Dump VGA Attribute Controller registers.", vgaR3InfoAR); 7003 PDMDevHlpDBGFInfoRegister(pDevIns, "vgapl", "Dump planar graphics state.", vgaR3InfoPlanar); 7004 PDMDevHlpDBGFInfoRegister(pDevIns, "vgadac", "Dump VGA DAC registers.", vgaR3InfoDAC); 7005 PDMDevHlpDBGFInfoRegister(pDevIns, "vbe", "Dump VGA VBE registers.", vgaR3InfoVBE); 7052 7006 7053 7007 /* … … 7084 7038 N_("Configuration error: Querying \"ShowBootMenu\" as integer failed")); 7085 7039 7086 # if defined(DEBUG) && !defined(DEBUG_sunlover) && !defined(DEBUG_michael)7040 # if defined(DEBUG) && !defined(DEBUG_sunlover) && !defined(DEBUG_michael) 7087 7041 /* Disable the logo abd menu if all default settings. */ 7088 7042 if ( LogoHdr.fu8FadeIn … … 7094 7048 LogoHdr.u16LogoMillies = 500; 7095 7049 } 7096 # endif7050 # endif 7097 7051 7098 7052 /* Delay the logo a little bit */ … … 7163 7117 if (g_cbVgaDefBiosLogo) 7164 7118 pThis->cbLogo = g_cbVgaDefBiosLogo; 7165 # ifndef VBOX_OSE7119 # ifndef VBOX_OSE 7166 7120 if (g_cbVgaDefBiosLogoNY) 7167 7121 pThis->cbLogo = g_cbVgaDefBiosLogoNY; 7168 # endif7122 # endif 7169 7123 pThis->cbLogo += sizeof(LogoHdr); 7170 7124 … … 7185 7139 rc = RTFileRead(FileLogo, pLogoHdr + 1, LogoHdr.cbLogo, NULL); 7186 7140 if (RT_SUCCESS(rc)) 7187 rc = vbe ParseBitmap(pThis);7141 rc = vbeR3ParseBitmap(pThis); 7188 7142 if (RT_FAILURE(rc)) 7189 7143 { … … 7196 7150 || RT_FAILURE(rc)) 7197 7151 { 7198 # ifndef VBOX_OSE7152 # ifndef VBOX_OSE 7199 7153 RTTIMESPEC Now; 7200 7154 RTTimeLocalNow(&Now); … … 7211 7165 } 7212 7166 else 7213 # endif7167 # endif 7214 7168 memcpy(pLogoHdr + 1, g_abVgaDefBiosLogo, LogoHdr.cbLogo); 7215 rc = vbe ParseBitmap(pThis);7169 rc = vbeR3ParseBitmap(pThis); 7216 7170 if (RT_FAILURE(rc)) 7217 AssertReleaseMsgFailed(("Parsing of internal bitmap failed! vbe ParseBitmap() -> %Rrc\n", rc));7171 AssertReleaseMsgFailed(("Parsing of internal bitmap failed! vbeR3ParseBitmap() -> %Rrc\n", rc)); 7218 7172 } 7219 7173 … … 7229 7183 RTFileClose(FileLogo); 7230 7184 7231 # ifdef VBOX_WITH_HGSMI7185 # ifdef VBOX_WITH_HGSMI 7232 7186 VBVAInit (pThis); 7233 # endif /* VBOX_WITH_HGSMI */7234 7235 # ifdef VBOX_WITH_VDMA7187 # endif 7188 7189 # ifdef VBOX_WITH_VDMA 7236 7190 if (rc == VINF_SUCCESS) 7237 7191 { … … 7239 7193 AssertRC(rc); 7240 7194 } 7241 # endif7242 7243 # ifdef VBOX_WITH_VMSVGA7195 # endif 7196 7197 # ifdef VBOX_WITH_VMSVGA 7244 7198 if ( rc == VINF_SUCCESS 7245 7199 && pThis->fVMSVGAEnabled) 7246 7200 rc = vmsvgaInit(pDevIns); 7247 # endif7201 # endif 7248 7202 7249 7203 /* 7250 7204 * Statistics. 7251 7205 */ 7252 # ifdef VBOX_WITH_STATISTICS7206 # ifdef VBOX_WITH_STATISTICS 7253 7207 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatRZMemoryRead, STAMTYPE_PROFILE, "RZ/MMIO-Read", STAMUNIT_TICKS_PER_CALL, "Profiling of the VGAGCMemoryRead() body."); 7254 7208 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatR3MemoryRead, STAMTYPE_PROFILE, "R3/MMIO-Read", STAMUNIT_TICKS_PER_CALL, "Profiling of the VGAGCMemoryRead() body."); … … 7256 7210 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatR3MemoryWrite, STAMTYPE_PROFILE, "R3/MMIO-Write", STAMUNIT_TICKS_PER_CALL, "Profiling of the VGAGCMemoryWrite() body."); 7257 7211 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatMapPage, STAMTYPE_COUNTER, "MapPageCalls", STAMUNIT_OCCURENCES, "Calls to IOMMMIOMapMMIO2Page."); 7258 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatUpdateDisp, STAMTYPE_COUNTER, "UpdateDisplay", STAMUNIT_OCCURENCES, "Calls to vga PortUpdateDisplay().");7259 # endif7260 # ifdef VBOX_WITH_HGSMI7212 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatUpdateDisp, STAMTYPE_COUNTER, "UpdateDisplay", STAMUNIT_OCCURENCES, "Calls to vgaR3PortUpdateDisplay()."); 7213 # endif 7214 # ifdef VBOX_WITH_HGSMI 7261 7215 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatHgsmiMdaCgaAccesses, STAMTYPE_COUNTER, "HgmsiMdaCgaAccesses", STAMUNIT_OCCURENCES, "Number of non-HGMSI accesses for 03b0-3b3 and 03d0-3d3."); 7262 # endif7216 # endif 7263 7217 7264 7218 /* Init latched access mask. */ … … 7305 7259 * We just copy the ring-3 registration bits and remove the '&' before the handle. 7306 7260 */ 7307 # define REG_PORT(a_uPort, a_cPorts, a_pfnWrite, a_pfnRead, a_szDesc, a_hIoPort) do { \7261 # define REG_PORT(a_uPort, a_cPorts, a_pfnWrite, a_pfnRead, a_szDesc, a_hIoPort) do { \ 7308 7262 rc = PDMDevHlpIoPortSetUpContext(pDevIns, a_hIoPort, a_pfnWrite, a_pfnRead, NULL /*pvUser*/); \ 7309 7263 AssertRCReturn(rc, rc); \ … … 7328 7282 # endif /* CONFIG_BOCHS_VBE */ 7329 7283 7330 # undef REG_PORT7284 # undef REG_PORT 7331 7285 7332 7286 /* BIOS port: */ … … 7367 7321 else 7368 7322 AssertReturn(pThis->hMmio2VmSvgaFifo == NIL_PGMMMIO2HANDLE, VERR_INVALID_STATE); 7369 # endif7323 # endif 7370 7324 7371 7325 return VINF_SUCCESS; -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r82084 r82088 668 668 669 669 # ifdef VBOX_WITH_VIDEOHWACCEL 670 DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd); 670 DECLCALLBACK(int) vbvaR3VHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, 671 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd); 671 672 int vbvaVHWAConstruct(PVGASTATE pVGAState); 672 673 int vbvaVHWAReset(PVGASTATE pVGAState); … … 684 685 int vboxVBVALoadStateDone(PPDMDEVINS pDevIns); 685 686 686 DECLCALLBACK(int) vgaUpdateDisplayAll(PVGASTATE pThis, bool fFailOnResize); 687 DECLCALLBACK(int) vbvaPortSendModeHint(PPDMIDISPLAYPORT pInterface, uint32_t cx, 688 uint32_t cy, uint32_t cBPP, 689 uint32_t cDisplay, uint32_t dx, 690 uint32_t dy, uint32_t fEnabled, 691 uint32_t fNotifyGuest); 687 DECLCALLBACK(int) vbvaR3PortSendModeHint(PPDMIDISPLAYPORT pInterface, uint32_t cx, uint32_t cy, uint32_t cBPP, 688 uint32_t cDisplay, uint32_t dx, uint32_t dy, uint32_t fEnabled, uint32_t fNotifyGuest); 692 689 693 690 # ifdef VBOX_WITH_VDMA -
trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
r82050 r82088 892 892 { 893 893 Assert(pCommand->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH); 894 vbva VHWACommandCompleteAsync(&pVGAState->IVBVACallbacks, pCommand);894 vbvaR3VHWACommandCompleteAsync(&pVGAState->IVBVACallbacks, pCommand); 895 895 } 896 896 else … … 1355 1355 * @interface_method_impl{PDMIDISPLAYVBVACALLBACKS,pfnVHWACommandCompleteAsync} 1356 1356 */ 1357 DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd) 1357 DECLCALLBACK(int) vbvaR3VHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, 1358 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd) 1358 1359 { 1359 1360 PVGASTATE pVGAState = PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(pInterface); … … 2080 2081 } 2081 2082 2082 void VBVARaiseIrq (PVGASTATE pVGAState, uint32_t fFlags)2083 void VBVARaiseIrq(PVGASTATE pVGAState, uint32_t fFlags) 2083 2084 { 2084 2085 PPDMDEVINS pDevIns = pVGAState->pDevInsR3; … … 2787 2788 #define IDISPLAYPORT_2_VGASTATE(pInterface) ( (PVGASTATE)((uintptr_t)pInterface - RT_OFFSETOF(VGASTATE, IPort)) ) 2788 2789 2789 DECLCALLBACK(int) vbvaPortSendModeHint(PPDMIDISPLAYPORT pInterface, uint32_t cx, 2790 uint32_t cy, uint32_t cBPP, 2791 uint32_t iDisplay, uint32_t dx, 2792 uint32_t dy, uint32_t fEnabled, 2793 uint32_t fNotifyGuest) 2794 { 2795 PVGASTATE pThis; 2796 int rc; 2797 2798 pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 2799 rc = PDMDevHlpCritSectEnter(pThis->pDevInsR3, &pThis->CritSect, VERR_SEM_BUSY); 2790 /** 2791 * @interface_method_impl{PDMIDISPLAYPORT,pfnSendModeHint} 2792 */ 2793 DECLCALLBACK(int) vbvaR3PortSendModeHint(PPDMIDISPLAYPORT pInterface, uint32_t cx, uint32_t cy, uint32_t cBPP, 2794 uint32_t iDisplay, uint32_t dx, uint32_t dy, uint32_t fEnabled, uint32_t fNotifyGuest) 2795 { 2796 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 2797 int rc = PDMDevHlpCritSectEnter(pThis->pDevInsR3, &pThis->CritSect, VERR_SEM_BUSY); 2800 2798 AssertRC(rc); 2801 rc = vbvaSendModeHintWorker(pThis, cx, cy, cBPP, iDisplay, dx, dy, fEnabled, 2802 fNotifyGuest); 2799 2800 rc = vbvaSendModeHintWorker(pThis, cx, cy, cBPP, iDisplay, dx, dy, fEnabled, fNotifyGuest); 2801 2803 2802 PDMDevHlpCritSectLeave(pThis->pDevInsR3, &pThis->CritSect); 2804 2803 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.

