VirtualBox

Changeset 82088 in vbox for trunk


Ignore:
Timestamp:
Nov 21, 2019 9:59:57 PM (5 years ago)
Author:
vboxsync
Message:

DevVGA: Mark functions with R3 where appropriate, adding docs and doing other minor cleaning up. bugref:9218

Location:
trunk/src/VBox/Devices/Graphics
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp

    r82086 r82088  
    707707 * @interface_method_impl{PDMIDISPLAYPORT,pfnSetViewport}
    708708 */
    709 DECLCALLBACK(void) vmsvgaPortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t idScreen, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy)
     709DECLCALLBACK(void) vmsvgaR3PortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t idScreen, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy)
    710710{
    711711    PVGASTATE pThis = RT_FROM_MEMBER(pInterface, VGASTATE, IPort);
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h

    r82086 r82088  
    366366DECLCALLBACK(VBOXSTRICTRC) vmsvgaIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb);
    367367
    368 DECLCALLBACK(void) vmsvgaPortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t uScreenId,
     368DECLCALLBACK(void) vmsvgaR3PortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t uScreenId,
    369369                                         uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
    370370
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r82086 r82088  
    259259#endif /* IN_RING3 */
    260260
    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. */
    308262
    309263#ifdef _MSC_VER
     
    348302
    349303#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) | \
    352305                (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) <<  8) | \
    353306                (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >>  8) | \
     
    355308
    356309#ifdef WORDS_BIGENDIAN
    357 #define PAT(x) cbswap_32(x)
     310# define PAT(x) cbswap_32(x)
    358311#else
    359 #define PAT(x) (x)
     312# define PAT(x) (x)
    360313#endif
    361314
    362315#ifdef WORDS_BIGENDIAN
    363 #define BIG 1
     316# define BIG 1
    364317#else
    365 #define BIG 0
     318# define BIG 0
    366319#endif
    367320
     
    394347
    395348#ifdef WORDS_BIGENDIAN
    396 #define PAT(x) (x)
     349# define PAT(x) (x)
    397350#else
    398 #define PAT(x) cbswap_32(x)
     351# define PAT(x) cbswap_32(x)
    399352#endif
    400353
     
    431384static uint8_t expand4to8[16];
    432385
     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 */
     395DECLINLINE(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 */
     410DECLINLINE(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 */
     424DECLINLINE(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}
    433431#endif /* IN_RING3 */
    434432
     
    819817        case VBE_DISPI_CFG_ID_VRAM_SIZE: val = pThis->vram_size; break;
    820818        case VBE_DISPI_CFG_ID_3D:        val = pThis->f3DEnabled; break;
    821 #ifdef VBOX_WITH_VMSVGA
     819# ifdef VBOX_WITH_VMSVGA
    822820        case VBE_DISPI_CFG_ID_VMSVGA:    val = pThis->fVMSVGAEnabled; break;
    823 #endif
     821# endif
    824822        default:
    825823           return 0; /* Not supported. */
     
    889887}
    890888
    891 #define VBE_PITCH_ALIGN     4       /* Align pitch to 32 bits - Qt requires that. */
     889# define VBE_PITCH_ALIGN    4       /* Align pitch to 32 bits - Qt requires that. */
    892890
    893891/* Calculate scanline pitch based on bit depth and width in pixels. */
     
    909907}
    910908
    911 #ifdef SOME_UNUSED_FUNCTION
     909# ifdef SOME_UNUSED_FUNCTION
    912910/* Calculate line width in pixels based on bit depth and pitch. */
    913911static uint32_t calc_line_width(uint16_t bpp, uint32_t pitch)
     
    922920    return width;
    923921}
    924 #endif
     922# endif
    925923
    926924static void recalculate_data(PVGASTATE pThis)
     
    979977                val == VBE_DISPI_ID_VBOX_VIDEO ||
    980978                val == VBE_DISPI_ID_ANYX       ||
    981 #ifdef VBOX_WITH_HGSMI
     979# ifdef VBOX_WITH_HGSMI
    982980                val == VBE_DISPI_ID_HGSMI      ||
    983 #endif
     981# endif
    984982                val == VBE_DISPI_ID_CFG)
    985983            {
     
    10231021            pThis->bank_offset = (val << 16);
    10241022
    1025 #ifndef IN_RC
     1023# ifndef IN_RC
    10261024            /* The VGA region is (could be) affected by this change; reset all aliases we've created. */
    10271025            if (pThis->fRemappedVGA)
     
    10301028                pThis->fRemappedVGA = false;
    10311029            }
    1032 #endif
     1030# endif
    10331031            break;
    10341032
    10351033        case VBE_DISPI_INDEX_ENABLE:
    1036 #ifndef IN_RING3
     1034# ifndef IN_RING3
    10371035            return VINF_IOM_R3_IOPORT_WRITE;
    1038 #else
     1036# else
    10391037        {
    10401038            if ((val & VBE_DISPI_ENABLED) &&
     
    11051103                /* sunlover 30.05.2007
    11061104                 * 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.
    11081106                 * But the VBE mode is graphics, so not a blank anymore.
    11091107                 */
     
    11291127             */
    11301128            pThis->pDrv->pfnLFBModeChange(pThis->pDrv, (val & VBE_DISPI_ENABLED) != 0);
    1131 # ifdef VBOX_WITH_HGSMI
     1129#  ifdef VBOX_WITH_HGSMI
    11321130            VBVAOnVBEChanged(pThis);
    1133 # endif
     1131#  endif
    11341132
    11351133            /* The VGA region is (could be) affected by this change; reset all aliases we've created. */
     
    11411139            break;
    11421140        }
    1143 #endif /* IN_RING3 */
     1141# endif /* IN_RING3 */
    11441142        case VBE_DISPI_INDEX_VIRT_WIDTH:
    11451143        case VBE_DISPI_INDEX_X_OFFSET:
     
    11511149            break;
    11521150        case VBE_DISPI_INDEX_VBOX_VIDEO:
    1153 #ifndef IN_RING3
     1151# ifndef IN_RING3
    11541152            return VINF_IOM_R3_IOPORT_WRITE;
    1155 #else
     1153# else
    11561154            /* Changes in the VGA device are minimal. The device is bypassed. The driver does all work. */
    11571155            if (val == VBOX_VIDEO_DISABLE_ADAPTER_MEMORY)
     
    11611159            else if ((val & 0xFFFF0000) == VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE)
    11621160                pThis->pDrv->pfnProcessDisplayData(pThis->pDrv, pThis->CTX_SUFF(vram_ptr), val & 0xFFFF);
    1163 #endif /* IN_RING3 */
     1161# endif /* IN_RING3 */
    11641162            break;
    11651163        case VBE_DISPI_INDEX_CFG:
     
    12301228        /* If all planes are accessible, then map the page to the frame buffer and make it writable. */
    12311229        if (   (pThis->sr[2] & 3) == 3
    1232             && !vga_is_dirty(pThis, addr)
     1230            && !vgaIsDirty(pThis, addr)
    12331231            && pThis->GCPhysVRAM)
    12341232        {
     
    12381236                                pThis->GCPhysVRAM + addr, X86_PTE_RW | X86_PTE_P);
    12391237            /* Set as dirty as write accesses won't be noticed now. */
    1240             vga_set_dirty(pThis, addr);
     1238            vgaR3MarkDirty(pThis, addr);
    12411239            pThis->fRemappedVGA = true;
    12421240        }
     
    12861284}
    12871285
    1288 /* called for accesses between 0xa0000 and 0xc0000 */
     1286/** called for accesses between 0xa0000 and 0xc0000 */
    12891287static int vga_mem_writeb(PVGASTATE pThis, RTGCPHYS addr, uint32_t val)
    12901288{
     
    13361334            /* If all planes are accessible, then map the page to the frame buffer and make it writable. */
    13371335            if (   (pThis->sr[2] & 3) == 3
    1338                 && !vga_is_dirty(pThis, addr)
     1336                && !vgaIsDirty(pThis, addr)
    13391337                && pThis->GCPhysVRAM)
    13401338            {
     
    13621360            Log3(("vga: chain4: [0x%x]\n", addr));
    13631361            pThis->plane_updated |= mask; /* only used to detect font change */
    1364             vga_set_dirty(pThis, addr);
     1362            vgaR3MarkDirty(pThis, addr);
    13651363        }
    13661364    } else if (!(pThis->sr[4] & 0x04)) {    /* Host access is controlled by SR4, not GR5! */
     
    13911389            Log3(("vga: odd/even: [0x%x]\n", addr));
    13921390            pThis->plane_updated |= mask; /* only used to detect font change */
    1393             vga_set_dirty(pThis, addr);
     1391            vgaR3MarkDirty(pThis, addr);
    13941392        }
    13951393    } else {
     
    14771475#endif
    14781476        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));
    14801478    }
    14811479
     
    15531551static unsigned int rgb_to_pixel32_dup(unsigned int r, unsigned int g, unsigned b)
    15541552{
    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 */
     1557static bool vgaR3UpdatePalette16(PVGASTATE pThis)
    15621558{
    15631559    bool full_update = false;
     
    15741570        v = v * 3;
    15751571        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]));
    15781574        if (col != palette[i]) {
    15791575            full_update = true;
     
    15841580}
    15851581
    1586 /* return true if the palette was modified */
    1587 static bool update_palette256(PVGASTATE pThis)
     1582/** return true if the palette was modified */
     1583static bool vgaR3UpdatePalette256(PVGASTATE pThis)
    15881584{
    15891585    bool full_update = false;
     
    15991595        if (wide_dac)
    16001596            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]);
    16031599        else
    16041600            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]));
    16071603        if (col != palette[i]) {
    16081604            full_update = true;
     
    16141610}
    16151611
    1616 static void vga_get_offsets(PVGASTATE pThis,
     1612static void vgaR3GetOffsets(PVGASTATE pThis,
    16171613                            uint32_t *pline_offset,
    16181614                            uint32_t *pstart_addr,
     
    16501646}
    16511647
    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 */
     1649static bool vgaR3UpdateBasicParams(PVGASTATE pThis)
    16541650{
    16551651    bool full_update = false;
     
    16691665}
    16701666
    1671 static inline int get_depth_index(int depth)
     1667static inline int vgaR3GetDepthIndex(int depth)
    16721668{
    16731669    switch(depth) {
     
    16841680}
    16851681
    1686 static vga_draw_glyph8_func *vga_draw_glyph8_table[4] = {
     1682static vga_draw_glyph8_func * const vga_draw_glyph8_table[4] = {
    16871683    vga_draw_glyph8_8,
    16881684    vga_draw_glyph8_16,
     
    16911687};
    16921688
    1693 static vga_draw_glyph8_func *vga_draw_glyph16_table[4] = {
     1689static vga_draw_glyph8_func * const vga_draw_glyph16_table[4] = {
    16941690    vga_draw_glyph16_8,
    16951691    vga_draw_glyph16_16,
     
    16981694};
    16991695
    1700 static vga_draw_glyph9_func *vga_draw_glyph9_table[4] = {
     1696static vga_draw_glyph9_func * const vga_draw_glyph9_table[4] = {
    17011697    vga_draw_glyph9_8,
    17021698    vga_draw_glyph9_16,
     
    17261722static const uint8_t empty_glyph[32 * 4] = { 0 };
    17271723
    1728 /*
     1724/**
    17291725 * Text mode update
    17301726 * Missing:
    17311727 * - underline
    17321728 */
    1733 static int vga_draw_text(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty,
    1734                          PDMIDISPLAYCONNECTOR *pDrv)
     1729static int vgaR3DrawText(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty, PDMIDISPLAYCONNECTOR *pDrv)
    17351730{
    17361731    int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr;
     
    17491744    bool blink_enabled, blink_do_redraw;
    17501745
    1751     full_update |= update_palette16(pThis);
     1746    full_update |= vgaR3UpdatePalette16(pThis);
    17521747    palette = pThis->last_palette;
    17531748
     
    17731768        full_update = true;
    17741769    }
    1775     full_update |= update_basic_params(pThis);
     1770    full_update |= vgaR3UpdateBasicParams(pThis);
    17761771
    17771772    line_offset = pThis->line_offset;
     
    18391834    }
    18401835    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);
    18421837    if (cw == 16)
    18431838        vga_draw_glyph8 = vga_draw_glyph16_table[depth_index];
     
    19051900                if (cw != 9) {
    19061901                    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);
    19091903                } else {
    19101904                    dup9 = 0;
     
    19121906                        dup9 = 1;
    19131907                    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);
    19161909                }
    19171910                if (src == cursor_ptr &&
     
    19311924                            if (cw != 9) {
    19321925                                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);
    19351927                            } else {
    19361928                                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);
    19391930                            }
    19401931                        }
     
    19571948            /* Flush updates to display. */
    19581949            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);
    19601951            cy_start = -1;
    19611952            cx_max_upd = -1;
     
    19681959        /* Flush any remaining changes to display. */
    19691960        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);
    19711962    return VINF_SUCCESS;
    19721963}
     
    19861977};
    19871978
    1988 static vga_draw_line_func *vga_draw_line_table[4 * VGA_DRAW_LINE_NB] = {
     1979static vga_draw_line_func * const vga_draw_line_table[4 * VGA_DRAW_LINE_NB] = {
    19891980    vga_draw_line2_8,
    19901981    vga_draw_line2_16,
     
    20382029};
    20392030
    2040 static int vga_get_bpp(PVGASTATE pThis)
     2031static int vgaR3GetBpp(PVGASTATE pThis)
    20412032{
    20422033    int ret;
     
    20522043}
    20532044
    2054 static void vga_get_resolution(PVGASTATE pThis, int *pwidth, int *pheight)
     2045static void vgaR3GetResolution(PVGASTATE pThis, int *pwidth, int *pheight)
    20552046{
    20562047    int width, height;
     
    20722063    *pheight = height;
    20732064}
     2065
    20742066
    20752067/**
     
    20862078 * @param   pDrv    The display connector.
    20872079 */
    2088 static int vga_resize_graphic(PVGASTATE pThis, int cx, int cy,
    2089                               PDMIDISPLAYCONNECTOR *pDrv)
     2080static int vgaR3ResizeGraphic(PVGASTATE pThis, int cx, int cy, PDMIDISPLAYCONNECTOR *pDrv)
    20902081{
    20912082    const unsigned cBits = pThis->get_bpp(pThis);
     
    21452136    }
    21462137    if (pThis->shift_control == 0)
    2147         update_palette16(pThis);
     2138        vgaR3UpdatePalette16(pThis);
    21482139    else if (pThis->shift_control == 1)
    2149         update_palette16(pThis);
     2140        vgaR3UpdatePalette16(pThis);
    21502141    return VINF_SUCCESS;
    21512142}
     
    21532144# ifdef VBOX_WITH_VMSVGA
    21542145
     2146#  if 0 /* unused? */
    21552147int vgaR3UpdateDisplay(VGAState *s, unsigned xStart, unsigned yStart, unsigned cx, unsigned cy)
    21562148{
     
    21982190        break;
    21992191    }
    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)];
    22012193
    22022194    uint32_t offSrc = (xStart * cBits) / 8 + s->svga.cbScanline * yStart;
     
    22172209    return VINF_SUCCESS;
    22182210}
    2219 
    2220 /*
     2211#  endif
     2212
     2213/**
    22212214 * graphic modes
    22222215 */
    2223 static int vmsvga_draw_graphic(PVGASTATE pThis, bool fFullUpdate, bool fFailOnResize, bool reset_dirty,
     2216static int vmsvgaR3DrawGraphic(PVGASTATE pThis, bool fFullUpdate, bool fFailOnResize, bool reset_dirty,
    22242217                               PDMIDISPLAYCONNECTOR *pDrv)
    22252218{
     
    22472240        case 8:
    22482241            /* Note! experimental, not sure if this really works... */
    2249             /** @todo fFullUpdate |= update_palette256(pThis); - need fFullUpdate but not
     2242            /** @todo fFullUpdate |= vgaR3UpdatePalette256(pThis); - need fFullUpdate but not
    22502243             *        copying anything to last_palette. */
    22512244            v = VGA_DRAW_LINE8;
     
    22692262            return VERR_NOT_IMPLEMENTED;
    22702263    }
    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)];
    22722265
    22732266    Assert(!pThis->cursor_invalidate);
     
    22932286         * anything wider than 2050 pixels @32bpp. Need to check all pages
    22942287         * 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);
    22962289        if (offPage1 - offPage0 > PAGE_SIZE)
    22972290            /* if wide line, can use another page */
    2298             fUpdate |= vga_is_dirty(pThis, offPage0 + PAGE_SIZE);
     2291            fUpdate |= vgaIsDirty(pThis, offPage0 + PAGE_SIZE);
    22992292        /* explicit invalidation for the hardware cursor */
    23002293        fUpdate |= (pThis->invalidated_y_table[y >> 5] >> (y & 0x1f)) & 1;
     
    23302323    /* reset modified pages */
    23312324    if (offPageMax != -1 && reset_dirty)
    2332         vga_reset_dirty(pThis, offPageMin, offPageMax + PAGE_SIZE);
     2325        vgaR3ResetDirty(pThis, offPageMin, offPageMax + PAGE_SIZE);
    23332326    memset(pThis->invalidated_y_table, 0, ((cy + 31) >> 5) * 4);
    23342327
     
    23382331# endif /* VBOX_WITH_VMSVGA */
    23392332
    2340 /*
     2333/**
    23412334 * graphic modes
    23422335 */
    2343 static int vga_draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty,
     2336static int vgaR3DrawGraphic(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty,
    23442337                            PDMIDISPLAYCONNECTOR *pDrv)
    23452338{
     
    23512344    vga_draw_line_func *vga_draw_line;
    23522345
    2353     bool offsets_changed = update_basic_params(pThis);
     2346    bool offsets_changed = vgaR3UpdateBasicParams(pThis);
    23542347
    23552348    full_update |= offsets_changed;
     
    23692362
    23702363    if (shift_control == 0) {
    2371         full_update |= update_palette16(pThis);
     2364        full_update |= vgaR3UpdatePalette16(pThis);
    23722365        if (pThis->sr[0x01] & 8) {
    23732366            v = VGA_DRAW_LINE4D2;
     
    23782371        bits = 4;
    23792372    } else if (shift_control == 1) {
    2380         full_update |= update_palette16(pThis);
     2373        full_update |= vgaR3UpdatePalette16(pThis);
    23812374        if (pThis->sr[0x01] & 8) {
    23822375            v = VGA_DRAW_LINE2D2;
     
    23902383        default:
    23912384        case 0:
    2392             full_update |= update_palette256(pThis);
     2385            full_update |= vgaR3UpdatePalette256(pThis);
    23932386            v = VGA_DRAW_LINE8D2;
    23942387            bits = 4;
    23952388            break;
    23962389        case 8:
    2397             full_update |= update_palette256(pThis);
     2390            full_update |= vgaR3UpdatePalette256(pThis);
    23982391            v = VGA_DRAW_LINE8;
    23992392            bits = 8;
     
    24272420            return VERR_TRY_AGAIN;
    24282421        }
    2429         int rc = vga_resize_graphic(pThis, disp_width, height, pDrv);
     2422        int rc = vgaR3ResizeGraphic(pThis, disp_width, height, pDrv);
    24302423        if (rc != VINF_SUCCESS)  /* Return any rc, particularly VINF_VGA_RESIZE_IN_PROGRESS, to the caller. */
    24312424            return rc;
     
    24492442    }
    24502443
    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)];
    24522445
    24532446    if (pThis->cursor_invalidate)
     
    24922485         * anything wider than 2050 pixels @32bpp. Need to check all pages
    24932486         * 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);
    24952488        if (page1 - page0 > PAGE_SIZE) {
    24962489            /* if wide line, can use another page */
    2497             update |= vga_is_dirty(pThis, page0 + PAGE_SIZE);
     2490            update |= vgaIsDirty(pThis, page0 + PAGE_SIZE);
    24982491        }
    24992492        /* explicit invalidation for the hardware cursor */
     
    25412534    /* reset modified pages */
    25422535    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);
    25442537    }
    25452538    memset(pThis->invalidated_y_table, 0, ((height + 31) >> 5) * 4);
     
    25472540}
    25482541
    2549 /*
     2542/**
    25502543 * blanked modes
    25512544 */
    2552 static int vga_draw_blank(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty,
     2545static int vgaR3DrawBlank(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty,
    25532546                          PDMIDISPLAYCONNECTOR *pDrv)
    25542547{
     
    25762569        page_min = (pThis->start_addr * 4) & ~PAGE_OFFSET_MASK;
    25772570        /* 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. */
    25792572        page_max = (  pThis->start_addr * 4 + pThis->line_offset * pThis->last_scr_height
    25802573                    - 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);
    25822575    }
    25832576    if (pDrv->pbData == pThis->vram_ptrR3) /* Do not clear the VRAM itself. */
     
    26122605#endif
    26132606
    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 */
     2611static int vgaR3UpdateDisplay(PVGASTATE pThis, bool fUpdateAll, bool fFailOnResize, bool reset_dirty,
    26152612                              PDMIDISPLAYCONNECTOR *pDrv, int32_t *pcur_graphic_mode)
    26162613{
     
    26542651        switch(graphic_mode) {
    26552652        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);
    26572654            break;
    26582655        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);
    26602657            break;
    26612658#ifdef VBOX_WITH_VMSVGA
    26622659        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);
    26642661            break;
    26652662#endif
    26662663        case GMODE_BLANK:
    26672664        default:
    2668             rc = vga_draw_blank(pThis, full_update, fFailOnResize, reset_dirty, pDrv);
     2665            rc = vgaR3DrawBlank(pThis, full_update, fFailOnResize, reset_dirty, pDrv);
    26692666            break;
    26702667        }
     
    26732670}
    26742671
     2672/**
     2673 * Worker for vgaR3SaveExec().
     2674 */
    26752675static void vga_save(PCPDMDEVHLPR3 pHlp, PSSMHANDLE pSSM, PVGASTATE pThis)
    26762676{
     
    27132713}
    27142714
     2715
     2716/**
     2717 * Worker for vgaR3LoadExec().
     2718 */
    27152719static int vga_load(PCPDMDEVHLPR3 pHlp, PSSMHANDLE pSSM, PVGASTATE pThis, int version_id)
    27162720{
     
    27822786}
    27832787
    2784 /* see vgaR3Construct */
    2785 static void vga_init_expand(void)
     2788
     2789/**
     2790 * Worker for vgaR3Construct().
     2791 */
     2792static void vgaR3InitExpand(void)
    27862793{
    27872794    int i, j, v, b;
     
    28112818}
    28122819
    2813 #endif /* !IN_RING0 */
     2820#endif /* IN_RING3 */
    28142821
    28152822
     
    32053212}
    32063213
    3207 #ifdef VBOX_WITH_HGSMI
    3208 # ifdef IN_RING3
     3214#if defined(VBOX_WITH_HGSMI) && defined(IN_RING3)
     3215
    32093216/**
    32103217 * @callback_method_impl{FNIOMIOPORTNEWOUT,HGSMI OUT handler.}
     
    32373244                                                 | HGSMIHOSTFLAGS_VSYNC
    32383245                                                 | HGSMIHOSTFLAGS_HOTPLUG
    3239                                                  | HGSMIHOSTFLAGS_CURSOR_CAPABILITIES
    3240                                                 );
     3246                                                 | HGSMIHOSTFLAGS_CURSOR_CAPABILITIES);
    32413247                    }
    32423248                    else
     
    33273333    return rc;
    33283334}
    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 -=-=-=-=-=- */
    33363342
    33373343/**
     
    33403346 */
    33413347#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 */ \
    33633369    val = (val & bit_mask) | (pThis->latch & ~bit_mask)
    33643370
     
    33753381 * @param   cItems      Number of data items to write.
    33763382 */
    3377 static int vgaInternalMMIOFill(PVGASTATE pThis, void *pvUser, RTGCPHYS GCPhysAddr, uint32_t u32Item, unsigned cbItem, unsigned cItems)
     3383static int vgaInternalMMIOFill(PVGASTATE pThis, void *pvUser, RTGCPHYS GCPhysAddr,
     3384                               uint32_t u32Item, unsigned cbItem, unsigned cItems)
    33783385{
    33793386    uint32_t b;
     
    34233430                {
    34243431                    pThis->CTX_SUFF(vram_ptr)[GCPhysAddr] = aVal[i];
    3425                     vga_set_dirty(pThis, GCPhysAddr);
     3432                    vgaR3MarkDirty(pThis, GCPhysAddr);
    34263433                }
    34273434                GCPhysAddr++;
     
    34373444                    RTGCPHYS PhysAddr2 = ((GCPhysAddr & ~1) * 4) | plane;
    34383445                    pThis->CTX_SUFF(vram_ptr)[PhysAddr2] = aVal[i];
    3439                     vga_set_dirty(pThis, PhysAddr2);
     3446                    vgaR3MarkDirty(pThis, PhysAddr2);
    34403447                }
    34413448                GCPhysAddr++;
     
    35093516            {
    35103517                ((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);
    35123519                GCPhysAddr++;
    35133520            }
     
    35193526            {
    35203527                ((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);
    35223529                GCPhysAddr++;
    35233530
    35243531                ((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);
    35263533                GCPhysAddr++;
    35273534            }
     
    35353542                {
    35363543                    ((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);
    35383545                    GCPhysAddr++;
    35393546                }
     
    37053712     * Set page dirty bit.
    37063713     */
    3707     vga_set_dirty(pThis, GCPhys - pThis->GCPhysVRAM);
     3714    vgaR3MarkDirty(pThis, GCPhys - pThis->GCPhysVRAM);
    37083715    pThis->fLFBUpdated = true;
    37093716
     
    39193926 * @param   pThis       The VGA instance data.
    39203927 */
    3921 static int vbeParseBitmap(PVGASTATE pThis)
    3922 {
    3923     uint16_t    i;
    3924     PBMPINFO    bmpInfo;
    3925     POS2HDR     pOs2Hdr;
    3926     POS22HDR    pOs22Hdr;
    3927     PWINHDR     pWinHdr;
    3928 
     3928static int vbeR3ParseBitmap(PVGASTATE pThis)
     3929{
    39293930    /*
    39303931     * Get bitmap header data
    39313932     */
    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)
    39363937    {
    39373938        switch (pWinHdr->Size)
    39383939        {
    39393940            case BMP_HEADER_OS21:
    3940                 pOs2Hdr = (POS2HDR)pWinHdr;
     3941            {
     3942                POS2HDR pOs2Hdr = (POS2HDR)pWinHdr;
    39413943                pThis->cxLogo = pOs2Hdr->Width;
    39423944                pThis->cyLogo = pOs2Hdr->Height;
     
    39463948                pThis->cLogoUsedColors = 0;
    39473949                break;
     3950            }
    39483951
    39493952            case BMP_HEADER_OS22:
    3950                 pOs22Hdr = (POS22HDR)pWinHdr;
     3953            {
     3954                POS22HDR pOs22Hdr = (POS22HDR)pWinHdr;
    39513955                pThis->cxLogo = pOs22Hdr->Width;
    39523956                pThis->cyLogo = pOs22Hdr->Height;
     
    39563960                pThis->cLogoUsedColors = pOs22Hdr->ClrUsed;
    39573961                break;
     3962            }
    39583963
    39593964            case BMP_HEADER_WIN3:
     
    40044009            const uint8_t *pbPal = pThis->pbLogo + sizeof(LOGOHDR) + sizeof(BMPINFO) + pWinHdr->Size; /* ASSUMES Size location (safe) */
    40054010
    4006             for (i = 0; i < pThis->cLogoPalEntries; i++)
     4011            for (uint16_t i = 0; i < pThis->cLogoPalEntries; i++)
    40074012            {
    40084013                uint16_t j;
     
    40244029         * Bitmap data offset
    40254030         */
    4026         pThis->pbLogoBitmap = pThis->pbLogo + sizeof(LOGOHDR) + bmpInfo->Offset;
     4031        pThis->pbLogoBitmap = pThis->pbLogo + sizeof(LOGOHDR) + pBmpInfo->Offset;
    40274032    }
    40284033    else
     
    40494054 * @param   pbDst       Destination buffer.
    40504055 */
    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)
     4056static 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)
    40544058{
    40554059    uint16_t        i;
     
    42334237
    42344238                /* Show the bitmap. */
    4235                 vbeShowBitmap(pThis->cLogoBits, xLogo, yLogo,
     4239                vbeR3ShowBitmap(pThis->cLogoBits, xLogo, yLogo,
    42364240                              pThis->cxLogo, pThis->cyLogo,
    42374241                              false, iStep, &pThis->au32LogoPalette[0],
     
    42404244                /* Show the 'Press F12...' text. */
    42414245                if (pLogoHdr->fu8ShowBootMenu == 2)
    4242                     vbeShowBitmap(1, LOGO_F12TEXT_X, LOGO_F12TEXT_Y,
     4246                    vbeR3ShowBitmap(1, LOGO_F12TEXT_X, LOGO_F12TEXT_Y,
    42434247                                  LOGO_F12TEXT_WIDTH, LOGO_F12TEXT_HEIGHT,
    42444248                                  pThis->fBootMenuInverse, iStep, &pThis->au32LogoPalette[0],
     
    42604264                while (offDirty <= LOGO_MAX_SIZE)
    42614265                {
    4262                     vga_set_dirty(pThis, offDirty);
     4266                    vgaR3MarkDirty(pThis, offDirty);
    42634267                    offDirty += PAGE_SIZE;
    42644268                }
     
    43234327 *      decode from the registers.}
    43244328 */
    4325 static DECLCALLBACK(void) vgaInfoState(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     4329static DECLCALLBACK(void) vgaR3InfoState(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    43264330{
    43274331    PVGASTATE       pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
     
    43634367        uint32_t offStart;
    43644368        uint32_t uLineCompareIgn;
    4365         vga_get_offsets(pThis, &cbLine, &offStart, &uLineCompareIgn);
     4369        vgaR3GetOffsets(pThis, &cbLine, &offStart, &uLineCompareIgn);
    43664370        if (!cbLine)
    43674371            cbLine = 80 * 8;
     
    43904394    pHlp->pfnPrintf(pHlp, "display refresh interval: %u ms\n", pThis->cMilliesRefreshInterval);
    43914395
    4392 #ifdef VBOX_WITH_VMSVGA
     4396# ifdef VBOX_WITH_VMSVGA
    43934397    if (pThis->svga.fEnabled)
    43944398        pHlp->pfnPrintf(pHlp, pThis->svga.f3DEnabled ? "VMSVGA 3D enabled: %ux%ux%u\n" : "VMSVGA enabled: %ux%ux%u",
    43954399                        pThis->svga.uWidth, pThis->svga.uHeight, pThis->svga.uBpp);
    4396 #endif
     4400# endif
    43974401}
    43984402
     
    44054409 * @param   pszTitle            The title text, NULL if none.
    44064410 */
    4407 static void vgaInfoTextPrintSeparatorLine(PCDBGFINFOHLP pHlp, size_t cCols, const char *pszTitle)
     4411static void vgaR3InfoTextPrintSeparatorLine(PCDBGFINFOHLP pHlp, size_t cCols, const char *pszTitle)
    44084412{
    44094413    if (pszTitle)
     
    44324436
    44334437/**
    4434  * Worker for vgaInfoText.
     4438 * Worker for vgaR3InfoText.
    44354439 *
    44364440 * @param   pThis       The vga state.
     
    44444448 *                      (exclusive).
    44454449 */
    4446 static void vgaInfoTextWorker(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)
     4450static 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)
    44504454{
    44514455    /* Title, */
     
    44684472
    44694473        if (iRow == 0)
    4470             vgaInfoTextPrintSeparatorLine(pHlp, cCols, szTitle);
     4474            vgaR3InfoTextPrintSeparatorLine(pHlp, cCols, szTitle);
    44714475        else if (iRow == iScrBegin)
    4472             vgaInfoTextPrintSeparatorLine(pHlp, cCols, "screen start");
     4476            vgaR3InfoTextPrintSeparatorLine(pHlp, cCols, "screen start");
    44734477        else if (iRow == iScrEnd)
    4474             vgaInfoTextPrintSeparatorLine(pHlp, cCols, "screen end");
     4478            vgaR3InfoTextPrintSeparatorLine(pHlp, cCols, "screen end");
    44754479
    44764480        uint8_t const *pbSrc = pbSrcOuter;
     
    44874491
    44884492    /* Final separator. */
    4489     vgaInfoTextPrintSeparatorLine(pHlp, cCols, NULL);
     4493    vgaR3InfoTextPrintSeparatorLine(pHlp, cCols, NULL);
    44904494}
    44914495
     
    44964500 *      the first page.}
    44974501 */
    4498 static DECLCALLBACK(void) vgaInfoText(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     4502static DECLCALLBACK(void) vgaR3InfoText(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    44994503{
    45004504    PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
     
    45374541            uint32_t offStart;
    45384542            uint32_t uLineCompareIgn;
    4539             vga_get_offsets(pThis, &cbLine, &offStart, &uLineCompareIgn);
     4543            vgaR3GetOffsets(pThis, &cbLine, &offStart, &uLineCompareIgn);
    45404544            if (!cbLine)
    45414545                cbLine = 80 * 8;
     
    45534557
    45544558            if (fAll)
    4555                 vgaInfoTextWorker(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);
    45574561            else
    4558                 vgaInfoTextWorker(pThis, pHlp, offStart, cbLine, cCols, cScrRows, 0, cScrRows);
     4562                vgaR3InfoTextWorker(pThis, pHlp, offStart, cbLine, cCols, cScrRows, 0, cScrRows);
    45594563        }
    45604564        else
     
    45694573 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VGA Sequencer registers.}
    45704574 */
    4571 static DECLCALLBACK(void) vgaInfoSR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     4575static DECLCALLBACK(void) vgaR3InfoSR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    45724576{
    45734577    PVGASTATE   pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
    4574     unsigned    i;
    45754578    NOREF(pszArgs);
    45764579
    45774580    pHlp->pfnPrintf(pHlp, "VGA Sequencer (3C5): SR index 3C4:%02X\n", pThis->sr_index);
    45784581    Assert(sizeof(pThis->sr) >= 8);
    4579     for (i = 0; i < 8; ++i)
     4582    for (unsigned i = 0; i < 8; ++i)
    45804583        pHlp->pfnPrintf(pHlp, " SR%02X:%02X", i, pThis->sr[i]);
    45814584    pHlp->pfnPrintf(pHlp, "\n");
     
    45864589 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VGA CRTC registers.}
    45874590 */
    4588 static DECLCALLBACK(void) vgaInfoCR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     4591static DECLCALLBACK(void) vgaR3InfoCR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    45894592{
    45904593    PVGASTATE   pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
     
    46104613 *      Dumps VGA Graphics Controller registers.}
    46114614 */
    4612 static DECLCALLBACK(void) vgaInfoGR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     4615static DECLCALLBACK(void) vgaR3InfoGR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    46134616{
    46144617    PVGASTATE   pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
    4615     unsigned    i;
    46164618    NOREF(pszArgs);
    46174619
    46184620    pHlp->pfnPrintf(pHlp, "VGA Graphics Controller (3CF): GR index 3CE:%02X\n", pThis->gr_index);
    46194621    Assert(sizeof(pThis->gr) >= 9);
    4620     for (i = 0; i < 9; ++i)
    4621     {
     4622    for (unsigned i = 0; i < 9; ++i)
    46224623        pHlp->pfnPrintf(pHlp, " GR%02X:%02X", i, pThis->gr[i]);
    4623     }
    46244624    pHlp->pfnPrintf(pHlp, "\n");
    46254625}
     
    46304630 *      Dumps VGA Attribute Controller registers.}
    46314631 */
    4632 static DECLCALLBACK(void) vgaInfoAR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     4632static DECLCALLBACK(void) vgaR3InfoAR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    46334633{
    46344634    PVGASTATE   pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
     
    46524652 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VGA DAC registers.}
    46534653 */
    4654 static DECLCALLBACK(void) vgaInfoDAC(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     4654static DECLCALLBACK(void) vgaR3InfoDAC(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    46554655{
    46564656    PVGASTATE   pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
    4657     unsigned    i;
    46584657    NOREF(pszArgs);
    46594658
    46604659    pHlp->pfnPrintf(pHlp, "VGA DAC contents:\n");
    4661     for (i = 0; i < 0x100; ++i)
     4660    for (unsigned i = 0; i < 0x100; ++i)
    46624661        pHlp->pfnPrintf(pHlp, " %02X: %02X %02X %02X\n",
    46634662                        i, pThis->palette[i*3+0], pThis->palette[i*3+1], pThis->palette[i*3+2]);
     
    46684667 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VBE registers.}
    46694668 */
    4670 static DECLCALLBACK(void) vgaInfoVBE(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     4669static DECLCALLBACK(void) vgaR3InfoVBE(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    46714670{
    46724671    PVGASTATE   pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
     
    46744673
    46754674    pHlp->pfnPrintf(pHlp, "LFB at %RGp\n", pThis->GCPhysVRAM);
    4676 
    46774675    if (!(pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED))
    4678     {
    46794676        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    }
    46944691}
    46954692
     
    47004697 *      in human-readable form.}
    47014698 */
    4702 static DECLCALLBACK(void) vgaInfoPlanar(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     4699static DECLCALLBACK(void) vgaR3InfoPlanar(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    47034700{
    47044701    PVGASTATE       pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
    4705     int             val1, val2;
    47064702    NOREF(pszArgs);
    47074703
    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);
    47114707    val1 = pThis->gr[0];
    47124708    val2 = pThis->gr[1];
     
    47144710    val1 = pThis->gr[2];
    47154711    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);
    47174713    val1 = pThis->gr[3] & 7;
    47184714    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);
    47204716    val1 = pThis->gr[7];
    47214717    val2 = pThis->gr[8];
     
    47324728 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    47334729 */
    4734 static DECLCALLBACK(void *) vgaPortQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     4730static DECLCALLBACK(void *) vgaR3PortQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    47354731{
    47364732    PVGASTATE pThis = RT_FROM_MEMBER(pInterface, VGASTATE, IBase);
    47374733    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis->IBase);
    47384734    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))
    47404736    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIDISPLAYVBVACALLBACKS, &pThis->IVBVACallbacks);
    4741 #endif
     4737# endif
    47424738    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds);
    47434739    return NULL;
    47444740}
    47454741
     4742
    47464743/* -=-=-=-=-=- 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 */
     4748static DECLCALLBACK(int) vgaR3PortQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed)
     4749{
     4750    PVGASTATE pThis = RT_FROM_MEMBER(pInterface, VGASTATE, ILeds);
    47604751    switch (iLUN)
    47614752    {
     
    47694760
    47704761        default:
    4771             AssertMsgFailed(("Invalid LUN #%d\n", iLUN));
     4762            AssertMsgFailed(("Invalid LUN #%u\n", iLUN));
    47724763            return VERR_PDM_NO_SUCH_LUN;
    47734764    }
    47744765}
    47754766
     4767
    47764768/* -=-=-=-=-=- Ring 3: Dummy IDisplayConnector -=-=-=-=-=- */
    47774769
    47784770/**
    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 */
     4773static 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);
    47954777    return VINF_SUCCESS;
    47964778}
     
    47984780
    47994781/**
    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 */
     4784static 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 */
     4793static DECLCALLBACK(void) vgaR3DummyRefresh(PPDMIDISPLAYCONNECTOR pInterface)
    48294794{
    48304795    NOREF(pInterface);
     
    48354800
    48364801/** 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 */
     4808static DECLCALLBACK(int) vgaR3PortUpdateDisplay(PPDMIDISPLAYPORT pInterface)
    48474809{
    48484810    PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);
     
    48534815    AssertRC(rc);
    48544816
    4855 #ifdef VBOX_WITH_VMSVGA
     4817# ifdef VBOX_WITH_VMSVGA
    48564818    if (    pThis->svga.fEnabled
    48574819        &&  !pThis->svga.fTraces)
     
    48634825#endif
    48644826
    4865 #ifndef VBOX_WITH_HGSMI
     4827# ifndef VBOX_WITH_HGSMI
    48664828    /* This should be called only in non VBVA mode. */
    4867 #else
     4829# else
    48684830    if (VBVAUpdateDisplay (pThis) == VINF_SUCCESS)
    48694831    {
     
    48714833        return VINF_SUCCESS;
    48724834    }
    4873 #endif /* VBOX_WITH_HGSMI */
     4835# endif /* VBOX_WITH_HGSMI */
    48744836
    48754837    STAM_COUNTER_INC(&pThis->StatUpdateDisp);
     
    48854847    }
    48864848
    4887     rc = vga_update_display(pThis, false /*fUpdateAll*/, false /*fFailOnResize*/, true /*reset_dirty*/,
     4849    rc = vgaR3UpdateDisplay(pThis, false /*fUpdateAll*/, false /*fFailOnResize*/, true /*reset_dirty*/,
    48884850                            pThis->pDrv, &pThis->graphic_mode);
    48894851    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
     
    48934855
    48944856/**
    4895  * Internal vgaPortUpdateDisplayAll worker called under pThis->CritSect.
    4896  */
    4897 static int updateDisplayAll(PVGASTATE pThis, bool fFailOnResize)
     4857 * Internal vgaR3PortUpdateDisplayAll worker called under pThis->CritSect.
     4858 */
     4859static int vboxR3UpdateDisplayAllInternal(PVGASTATE pThis, bool fFailOnResize)
    48984860{
    48994861    PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);
    49004862
    4901 #ifdef VBOX_WITH_VMSVGA
     4863# ifdef VBOX_WITH_VMSVGA
    49024864    if (    !pThis->svga.fEnabled
    49034865        ||  pThis->svga.fTraces)
    49044866    {
    4905 #endif
     4867# endif
    49064868    /* The dirty bits array has been just cleared, reset handlers as well. */
    49074869    if (pThis->GCPhysVRAM && pThis->GCPhysVRAM != NIL_RTGCPHYS)
    49084870        PGMHandlerPhysicalReset(PDMDevHlpGetVM(pDevIns), pThis->GCPhysVRAM);
    4909 #ifdef VBOX_WITH_VMSVGA
    4910     }
    4911 #endif
     4871# ifdef VBOX_WITH_VMSVGA
     4872    }
     4873# endif
    49124874    if (pThis->fRemappedVGA)
    49134875    {
     
    49184880    pThis->graphic_mode = -1; /* force full update */
    49194881
    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 */
     4889static DECLCALLBACK(int) vgaR3PortUpdateDisplayAll(PPDMIDISPLAYPORT pInterface, bool fFailOnResize)
     4890{
     4891    PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);
    49264892    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 */
    49304900
    49314901    int rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY);
    49324902    AssertRC(rc);
    49334903
    4934     rc = updateDisplayAll(pThis, fFailOnResize);
     4904    rc = vboxR3UpdateDisplayAllInternal(pThis, fFailOnResize);
    49354905
    49364906    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
     
    49384908}
    49394909
    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 */
     4914static DECLCALLBACK(int) vgaR3PortSetRefreshRate(PPDMIDISPLAYPORT pInterface, uint32_t cMilliesInterval)
    49674915{
    49684916    PVGASTATE  pThis   = IDISPLAYPORT_2_VGASTATE(pInterface);
     
    49754923    ASMAtomicWriteU32(&pThis->cMilliesRefreshInterval, cMilliesInterval);
    49764924
    4977 #ifdef VBOX_WITH_VMSVGA
     4925# ifdef VBOX_WITH_VMSVGA
    49784926    if (pThis->svga.fFIFOThreadSleeping)
    49794927        PDMDevHlpSUPSemEventSignal(pDevIns, pThis->svga.hFIFORequestSem);
    4980 #endif
     4928# endif
    49814929
    49824930    if (cMilliesInterval)
     
    49864934
    49874935
    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 */
     4939static DECLCALLBACK(int) vgaR3PortQueryVideoMode(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits, uint32_t *pcx, uint32_t *pcy)
    49904940{
    49914941    PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);
     
    49934943    if (!pcBits)
    49944944        return VERR_INVALID_PARAMETER;
    4995     *pcBits = vga_get_bpp(pThis);
     4945    *pcBits = vgaR3GetBpp(pThis);
    49964946    if (pcx)
    49974947        *pcx = pThis->last_scr_width;
     
    50034953
    50044954/**
    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 */
     4957static DECLCALLBACK(int) vgaR3PortTakeScreenshot(PPDMIDISPLAYPORT pInterface, uint8_t **ppbData, size_t *pcbData,
     4958                                                 uint32_t *pcx, uint32_t *pcy)
    50174959{
    50184960    PVGASTATE  pThis   = IDISPLAYPORT_2_VGASTATE(pInterface);
     
    50204962    PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis));
    50214963
    5022     LogFlow(("vgaPortTakeScreenshot: 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));
    50234965
    50244966    /*
     
    50334975    /*
    50344976     * 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.
    50364978     */
    50374979
     
    50605002            Connector.cy            = pThis->last_scr_height;
    50615003            Connector.cbScanline    = Connector.cx * 4;
    5062             Connector.pfnRefresh    = vgaDummyRefresh;
    5063             Connector.pfnResize     = vgaDummyResize;
    5064             Connector.pfnUpdateRect = vgaDummyUpdateRect;
     5004            Connector.pfnRefresh    = vgaR3DummyRefresh;
     5005            Connector.pfnResize     = vgaR3DummyResize;
     5006            Connector.pfnUpdateRect = vgaR3DummyUpdateRect;
    50655007
    50665008            int32_t cur_graphic_mode = -1;
     
    50775019             * If there is a pending resize, the function will fail.
    50785020             */
    5079             rc = vga_update_display(pThis, false /*fUpdateAll*/, true /*fFailOnResize*/, false /*reset_dirty*/,
     5021            rc = vgaR3UpdateDisplay(pThis, false /*fUpdateAll*/, true /*fFailOnResize*/, false /*reset_dirty*/,
    50805022                                    &Connector, &cur_graphic_mode);
    50815023
     
    51115053    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    51125054
    5113     LogFlow(("vgaPortTakeScreenshot: 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));
    51145056    return rc;
    51155057}
    51165058
    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 */
     5063static DECLCALLBACK(void) vgaR3PortFreeScreenshot(PPDMIDISPLAYPORT pInterface, uint8_t *pbData)
    51255064{
    51265065    NOREF(pInterface);
    51275066
    5128     LogFlow(("vgaPortFreeScreenshot: pbData=%p\n", pbData));
     5067    LogFlow(("vgaR3PortFreeScreenshot: pbData=%p\n", pbData));
    51295068
    51305069    RTMemFree(pbData);
    51315070}
    51325071
    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 */
     5076static DECLCALLBACK(int) vgaR3PortDisplayBlt(PPDMIDISPLAYPORT pInterface, const void *pvData,
     5077                                             uint32_t x, uint32_t y, uint32_t cx, uint32_t cy)
    51465078{
    51475079    PVGASTATE       pThis   = IDISPLAYPORT_2_VGASTATE(pInterface);
     
    51495081    int             rc;
    51505082    PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis));
    5151     LogFlow(("vgaPortDisplayBlt: 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));
    51525084
    51535085    rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY);
     
    51985130            uint8_t    *pbDst       = pThis->pDrv->pbData + y * cbLineDst + x * cbPixelDst;
    51995131            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)];
    52015133            Assert(pfnVgaDrawLine);
    52025134            while (cyLeft-- > 0)
     
    52185150    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    52195151
    5220     LogFlow(("vgaPortDisplayBlt: returns %Rrc\n", rc));
     5152    LogFlow(("vgaR3PortDisplayBlt: returns %Rrc\n", rc));
    52215153    return rc;
    52225154}
    52235155
    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 */
     5160static DECLCALLBACK(void) vgaR3PortUpdateDisplayRect(PPDMIDISPLAYPORT pInterface, int32_t x, int32_t y, uint32_t cx, uint32_t cy)
    52255161{
    52265162    PVGASTATE  pThis   = IDISPLAYPORT_2_VGASTATE(pInterface);
     
    52385174
    52395175
    5240 #ifdef DEBUG_sunlover
    5241     LogFlow(("vgaPortUpdateDisplayRect: %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 */
    52435179
    52445180    Assert(pInterface);
     
    52515187    {
    52525188        /* The framebuffer uses the guest VRAM directly. */
    5253 #ifdef DEBUG_sunlover
    5254         LogFlow(("vgaPortUpdateDisplayRect: 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 */
    52565192        PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    52575193        return;
     
    52645200    if (x < 0)
    52655201    {
    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;
    52685204        x = 0;
    52695205    }
     
    52715207    if (y < 0)
    52725208    {
    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;
    52755211        y = 0;
    52765212    }
    52775213
    52785214    /* Also check if coords are greater than the display resolution. */
    5279     if (x + w > pThis->pDrv->cx)
     5215    if (x + cx > pThis->pDrv->cx)
    52805216    {
    52815217        // 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)
    52865222    {
    52875223        // y < 0 is not possible here
    5288         h = pThis->pDrv->cy > (uint32_t)y? pThis->pDrv->cy - y: 0;
    5289     }
    5290 
    5291 #ifdef DEBUG_sunlover
    5292     LogFlow(("vgaPortUpdateDisplayRect: %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
    52945230
    52955231    /* Check if there is something to do at all. */
    5296     if (w == 0 || h == 0)
     5232    if (cx == 0 || cy == 0)
    52975233    {
    52985234        /* Empty rectangle. */
    5299 #ifdef DEBUG_sunlover
    5300         LogFlow(("vgaPortUpdateDisplayRect: 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
    53025238        PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    53035239        return;
     
    53375273    }
    53385274
    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)];
    53405276
    53415277    /* Compute source and destination addresses and pitches. */
     
    53565292    /* Render VRAM to framebuffer. */
    53575293
    5358 #ifdef DEBUG_sunlover
    5359     LogFlow(("vgaPortUpdateDisplayRect: 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);
    53655301        pbDst += cbLineDst;
    53665302        pbSrc += cbLineSrc;
     
    53685304
    53695305    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 */
    53765315static 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)
     5316vgaR3PortCopyRect(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)
    53845322{
    53855323    PVGASTATE  pThis   = IDISPLAYPORT_2_VGASTATE(pInterface);
     
    53885326    vga_draw_line_func *vga_draw_line;
    53895327
    5390 #ifdef DEBUG_sunlover
    5391     LogFlow(("vgaPortCopyRect: %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
    53935331
    53945332    Assert(pInterface);
     
    54285366    }
    54295367
    5430 #ifdef DEBUG_sunlover
    5431     LogFlow(("vgaPortCopyRect: %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
    54335371
    54345372    /* Check if there is something to do at all. */
     
    54365374    {
    54375375        /* Empty rectangle. */
    5438 #ifdef DEBUG_sunlover
     5376# ifdef DEBUG_sunlover
    54395377        LogFlow(("vgaPortUpdateDisplayRectEx: nothing to do: %dx%d\n", cxCorrected, cyCorrected));
    5440 #endif /* DEBUG_sunlover */
     5378# endif
    54415379        return VINF_SUCCESS;
    54425380    }
     
    54695407    if (   (pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) == 0
    54705408        && VBVAIsPaused(pThis)
    5471 #ifdef VBOX_WITH_VMSVGA
     5409# ifdef VBOX_WITH_VMSVGA
    54725410        && !pThis->svga.fEnabled
    5473 #endif
     5411# endif
    54745412       )
    54755413    {
     
    55035441    }
    55045442
    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)];
    55065444
    55075445    /* Compute source and destination addresses and pitches. */
     
    55145452    const uint8_t *pbSrcCur = pbSrc + ySrcCorrected * cbLineSrc + xSrcCorrected * cbPixelSrc;
    55155453
    5516 #ifdef DEBUG_sunlover
    5517     LogFlow(("vgaPortCopyRect: 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
    55195457
    55205458    while (cyCorrected-- > 0)
     
    55265464
    55275465    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
    55325469    return VINF_SUCCESS;
    55335470}
    55345471
    5535 static DECLCALLBACK(void) vgaPortSetRenderVRAM(PPDMIDISPLAYPORT pInterface, bool fRender)
     5472
     5473/**
     5474 * @interface_method_impl{PDMIDISPLAYPORT,pfnSetRenderVRAM}
     5475 */
     5476static DECLCALLBACK(void) vgaR3PortSetRenderVRAM(PPDMIDISPLAYPORT pInterface, bool fRender)
    55365477{
    55375478    PVGASTATE  pThis   = IDISPLAYPORT_2_VGASTATE(pInterface);
    55385479    PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);
    55395480
    5540     LogFlow(("vgaPortSetRenderVRAM: fRender = %d\n", fRender));
     5481    LogFlow(("vgaR3PortSetRenderVRAM: fRender = %d\n", fRender));
    55415482
    55425483    int rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY);
     
    55485489}
    55495490
    5550 static DECLCALLBACK(void) vgaPortReportHostCursorPosition(PPDMIDISPLAYPORT pInterface, uint32_t x, uint32_t y, bool fOutOfRange)
     5491
     5492/**
     5493 * @interface_method_impl{PDMIDISPLAYPORT,pfnReportHostCursorCapabilities}
     5494 */
     5495static 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 */
     5505static DECLCALLBACK(void) vgaR3PortReportHostCursorPosition(PPDMIDISPLAYPORT pInterface, uint32_t x, uint32_t y, bool fOutOfRange)
    55515506{
    55525507    RT_NOREF(pInterface, x, y, fOutOfRange);
    55535508}
    55545509
    5555 static DECLCALLBACK(void) vgaPortReportHostCursorCapabilities(PPDMIDISPLAYPORT pInterface, bool fSupportsRenderCursor, bool fSupportsMoveCursor)
    5556 {
    5557     RT_NOREF(pInterface, fSupportsRenderCursor, fSupportsMoveCursor);
    5558 }
    55595510
    55605511/**
     
    55755526        PDMDevHlpTimerSetMillies(pDevIns, pThis->hRefreshTimer, pThis->cMilliesRefreshInterval);
    55765527
    5577 #ifdef VBOX_WITH_VIDEOHWACCEL
     5528# ifdef VBOX_WITH_VIDEOHWACCEL
    55785529    vbvaTimerCb(pThis);
    5579 #endif
    5580 
    5581 #ifdef VBOX_WITH_VMSVGA
     5530# endif
     5531
     5532# ifdef VBOX_WITH_VMSVGA
    55825533    /*
    55835534     * Call the VMSVGA FIFO poller/watchdog so we can wake up the thread if
     
    55865537    if (pThis->svga.fFIFOThreadSleeping && pThis->svga.fEnabled && pThis->svga.fConfigured)
    55875538        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 */
    55935547int vgaR3RegisterVRAMHandler(PVGASTATE pVGAState, uint64_t cbFrameBuffer)
    55945548{
     
    56055559}
    56065560
     5561
     5562/**
     5563 * Helper for VMSVGA.
     5564 */
    56075565int vgaR3UnregisterVRAMHandler(PVGASTATE pVGAState)
    56085566{
     
    56155573}
    56165574
    5617 #endif /* PPDMDEVINS pDevIns */
     5575# endif /* VBOX_WITH_VMSVGA */
     5576
    56185577
    56195578/* -=-=-=-=-=- Ring 3: PCI Device -=-=-=-=-=- */
     
    56875646
    56885647
    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. */
    56905649/**
    56915650 * @interface_method_impl{PDMPCIDEV,pfnRegionLoadChangeHookR3}
     
    56975656    PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
    56985657
    5699 # ifdef VBOX_WITH_VMSVGA
     5658#  ifdef VBOX_WITH_VMSVGA
    57005659    if (pThis->fVMSVGAEnabled)
    57015660    {
     
    57765735        }
    57775736    }
     5737#  endif /* VBOX_WITH_VMSVGA */
     5738
     5739    return VERR_VGA_UNEXPECTED_PCI_REGION_LOAD_CHANGE;
     5740}
    57785741# endif /* VBOX_WITH_VMSVGA */
    5779 
    5780     return VERR_VGA_UNEXPECTED_PCI_REGION_LOAD_CHANGE;
    5781 }
    5782 #endif /* VBOX_WITH_VMSVGA */
    57835742
    57845743
     
    58165775static DECLCALLBACK(int) vgaR3SavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    58175776{
    5818 #ifdef VBOX_WITH_VIDEOHWACCEL
     5777# ifdef VBOX_WITH_VIDEOHWACCEL
    58195778    RT_NOREF(pSSM);
    58205779    return vboxVBVASaveStatePrep(pDevIns);
    5821 #else
     5780# else
    58225781    RT_NOREF(pDevIns, pSSM);
    58235782    return VINF_SUCCESS;
    5824 #endif
     5783# endif
    58255784}
    58265785
     
    58305789static DECLCALLBACK(int) vgaR3SaveDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    58315790{
    5832 #ifdef VBOX_WITH_VIDEOHWACCEL
     5791# ifdef VBOX_WITH_VIDEOHWACCEL
    58335792    RT_NOREF(pSSM);
    58345793    return vboxVBVASaveStateDone(pDevIns);
    5835 #else
     5794# else
    58365795    RT_NOREF(pDevIns, pSSM);
    58375796    return VINF_SUCCESS;
    5838 #endif
     5797# endif
    58395798}
    58405799
     
    58475806    PCPDMDEVHLPR3   pHlp  = pDevIns->pHlpR3;
    58485807
    5849 #ifdef VBOX_WITH_VDMA
     5808# ifdef VBOX_WITH_VDMA
    58505809    vboxVDMASaveStateExecPrep(pThis->pVdma);
    5851 #endif
     5810# endif
    58525811
    58535812    vgaR3SaveConfig(pHlp, pThis, pSSM);
     
    58555814
    58565815    VGA_SAVED_STATE_PUT_MARKER(pSSM, 1);
    5857 #ifdef VBOX_WITH_HGSMI
     5816# ifdef VBOX_WITH_HGSMI
    58585817    pHlp->pfnSSMPutBool(pSSM, true);
    58595818    int rc = vboxVBVASaveStateExec(pDevIns, pSSM);
    5860 #else
     5819# else
    58615820    int rc = pHlp->pfnSSMPutBool(pSSM, false);
    5862 #endif
     5821# endif
    58635822
    58645823    AssertRCReturn(rc, rc);
    58655824
    58665825    VGA_SAVED_STATE_PUT_MARKER(pSSM, 3);
    5867 #ifdef VBOX_WITH_VDMA
     5826# ifdef VBOX_WITH_VDMA
    58685827    rc = pHlp->pfnSSMPutU32(pSSM, 1);
    58695828    AssertRCReturn(rc, rc);
    58705829    rc = vboxVDMASaveStateExecPerform(pHlp, pThis->pVdma, pSSM);
    5871 #else
     5830# else
    58725831    rc = pHlp->pfnSSMPutU32(pSSM, 0);
    5873 #endif
     5832# endif
    58745833    AssertRCReturn(rc, rc);
    58755834
    5876 #ifdef VBOX_WITH_VDMA
     5835# ifdef VBOX_WITH_VDMA
    58775836    vboxVDMASaveStateExecDone(pThis->pVdma);
    5878 #endif
     5837# endif
    58795838
    58805839    VGA_SAVED_STATE_PUT_MARKER(pSSM, 5);
    5881 #ifdef VBOX_WITH_VMSVGA
     5840# ifdef VBOX_WITH_VMSVGA
    58825841    if (pThis->fVMSVGAEnabled)
    58835842    {
     
    58855844        AssertRCReturn(rc, rc);
    58865845    }
    5887 #endif
     5846# endif
    58885847    VGA_SAVED_STATE_PUT_MARKER(pSSM, 6);
    58895848
     
    59385897        if (fWithHgsmi)
    59395898        {
    5940 #ifdef VBOX_WITH_HGSMI
     5899# ifdef VBOX_WITH_HGSMI
    59415900            rc = vboxVBVALoadStateExec(pDevIns, pSSM, uVersion);
    59425901            AssertRCReturn(rc, rc);
    5943 #else
     5902# else
    59445903            return pHlp->pfnSSMSetCfgError(pSSM, RT_SRC_POS, N_("HGSMI is not compiled in, but it is present in the saved state"));
    5945 #endif
     5904# endif
    59465905        }
    59475906
     
    59535912            if (u32)
    59545913            {
    5955 #ifdef VBOX_WITH_VDMA
     5914# ifdef VBOX_WITH_VDMA
    59565915                if (u32 == 1)
    59575916                {
     
    59605919                }
    59615920                else
    5962 #endif
     5921# endif
    59635922                {
    59645923                    LogRel(("invalid CmdVbva version info\n"));
     
    59695928
    59705929        VGA_SAVED_STATE_GET_MARKER_RETURN_ON_MISMATCH(pSSM, uVersion, 5);
    5971 #ifdef VBOX_WITH_VMSVGA
     5930# ifdef VBOX_WITH_VMSVGA
    59725931        if (pThis->fVMSVGAEnabled)
    59735932        {
     
    59755934            AssertRCReturn(rc, rc);
    59765935        }
    5977 #endif
     5936# endif
    59785937        VGA_SAVED_STATE_GET_MARKER_RETURN_ON_MISMATCH(pSSM, uVersion, 6);
    59795938    }
     
    59905949    int rc = VINF_SUCCESS;
    59915950
    5992 #ifdef VBOX_WITH_HGSMI
     5951# ifdef VBOX_WITH_HGSMI
    59935952    PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
    59945953    rc = vboxVBVALoadStateDone(pDevIns);
     
    60005959    /* Now update the current VBVA state which depends on VBE registers. vboxVBVALoadStateDone cleared the state. */
    60015960    VBVAOnVBEChanged(pThis);
    6002 #endif
    6003 #ifdef VBOX_WITH_VMSVGA
     5961# endif
     5962# ifdef VBOX_WITH_VMSVGA
    60045963    if (pThis->fVMSVGAEnabled)
    60055964    {
     
    60075966        AssertRCReturn(rc, rc);
    60085967    }
    6009 #endif
     5968# endif
    60105969    return rc;
    60115970}
     
    60375996        vboxVDMAReset(pThis->pVdma);
    60385997
    6039 #ifdef VBOX_WITH_VMSVGA
     5998# ifdef VBOX_WITH_VMSVGA
    60405999    if (pThis->fVMSVGAEnabled)
    60416000        vmsvgaReset(pDevIns);
    6042 #endif
    6043 
    6044 #ifdef VBOX_WITH_HGSMI
     6001# endif
     6002
     6003# ifdef VBOX_WITH_HGSMI
    60456004    VBVAReset(pThis);
    6046 #endif /* VBOX_WITH_HGSMI */
     6005# endif
    60476006
    60486007
     
    60716030     * Restore and re-init some bits.
    60726031     */
    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;
    60766035    pThis->graphic_mode   = -1;         /* Force full update. */
    6077 #ifdef CONFIG_BOCHS_VBE
     6036# ifdef CONFIG_BOCHS_VBE
    60786037    pThis->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0;
    60796038    pThis->vbe_regs[VBE_DISPI_INDEX_VBOX_VIDEO] = 0;
    60806039    pThis->vbe_regs[VBE_DISPI_INDEX_FB_BASE_HI] = pThis->GCPhysVRAM >> 16;
    60816040    pThis->vbe_bank_max   = (pThis->vram_size >> 16) - 1;
    6082 #endif /* CONFIG_BOCHS_VBE */
     6041# endif /* CONFIG_BOCHS_VBE */
    60836042
    60846043    /*
     
    61326091{
    61336092    PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
    6134 #ifdef VBOX_WITH_VMSVGA
     6093# ifdef VBOX_WITH_VMSVGA
    61356094    vmsvgaR3PowerOn(pDevIns);
    6136 #endif
     6095# endif
    61376096    VBVAOnResume(pThis);
    61386097}
     
    61976156                        rc = VERR_INTERNAL_ERROR;
    61986157                    }
    6199 #ifdef VBOX_WITH_VIDEOHWACCEL
     6158# ifdef VBOX_WITH_VIDEOHWACCEL
    62006159                    if(rc == VINF_SUCCESS)
    62016160                    {
     
    62046163                            AssertRC(rc);
    62056164                    }
    6206 #endif
     6165# endif
    62076166                }
    62086167                else
     
    62746233# endif
    62756234
    6276 #ifdef VBOX_WITH_VMSVGA
     6235# ifdef VBOX_WITH_VMSVGA
    62776236    if (pThis->fVMSVGAEnabled)
    62786237        vmsvgaDestruct(pDevIns);
    6279 #endif
    6280 
    6281 #ifdef VBOX_WITH_HGSMI
     6238# endif
     6239
     6240# ifdef VBOX_WITH_HGSMI
    62826241    VBVADestroy(pThis);
    6283 #endif
     6242# endif
    62846243
    62856244    /*
     
    63156274    }
    63166275
     6276# if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_VDMA) || defined(VBOX_WITH_WDDM)
    63176277    PDMDevHlpCritSectDelete(pDevIns, &pThis->CritSectIRQ);
     6278# endif
    63186279    PDMDevHlpCritSectDelete(pDevIns, &pThis->CritSect);
    63196280    return VINF_SUCCESS;
     
    63306291 * @param   pMode       The mode information structure.
    63316292 */
    6332 static void vgaAdjustModeInfo(PVGASTATE pThis, ModeInfoListItem *pMode)
    6333 {
    6334     int         maxPage;
    6335     int         bpl;
    6336 
    6337 
     6293static void vgaR3AdjustModeInfo(PVGASTATE pThis, ModeInfoListItem *pMode)
     6294{
    63386295    /* 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;
    63406297    /* 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;
    63436299    if (maxPage > 255)
    63446300        maxPage = 255;  /* 8-bit value. */
     
    63766332    {
    63776333        s_fExpandDone = true;
    6378         vga_init_expand();
     6334        vgaR3InitExpand();
    63796335    }
    63806336
     
    64116367                                            "|MaxBiosXRes"
    64126368                                            "|MaxBiosYRes"
    6413 #ifdef VBOX_WITH_VMSVGA
     6369# ifdef VBOX_WITH_VMSVGA
    64146370                                            "|VMSVGAEnabled"
    64156371                                            "|VMSVGAPciId"
    64166372                                            "|VMSVGAPciBarLayout"
    64176373                                            "|VMSVGAFifoSize"
    6418 #endif
    6419 #ifdef VBOX_WITH_VMSVGA3D
     6374# endif
     6375# ifdef VBOX_WITH_VMSVGA3D
    64206376                                            "|VMSVGA3dEnabled"
    6421 #endif
     6377# endif
    64226378                                            "|SuppressNewYearSplash"
    64236379                                            "|3DEnabled";
     
    64496405    Log(("VGA: f3DEnabled=%RTbool\n", pThis->f3DEnabled));
    64506406
    6451 #ifdef VBOX_WITH_VMSVGA
     6407# ifdef VBOX_WITH_VMSVGA
    64526408    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "VMSVGAEnabled", &pThis->fVMSVGAEnabled, false);
    64536409    AssertLogRelRCReturn(rc, rc);
     
    64696425    pThis->svga.cbFIFOConfig = pThis->svga.cbFIFO;
    64706426    Log(("VMSVGA: VMSVGAFifoSize  = %#x (%'u)\n", pThis->svga.cbFIFO, pThis->svga.cbFIFO));
    6471 #endif
    6472 #ifdef VBOX_WITH_VMSVGA3D
     6427# endif
     6428# ifdef VBOX_WITH_VMSVGA3D
    64736429    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "VMSVGA3dEnabled", &pThis->svga.f3DEnabled, false);
    64746430    AssertLogRelRCReturn(rc, rc);
    64756431    Log(("VMSVGA: VMSVGA3dEnabled = %d\n", pThis->svga.f3DEnabled));
    6476 #endif
    6477 
    6478 #ifdef VBOX_WITH_VMSVGA
     6432# endif
     6433
     6434# ifdef VBOX_WITH_VMSVGA
    64796435    if (pThis->fVMSVGAPciBarLayout)
    64806436    {
     
    64886444    }
    64896445    pThis->pciRegions.iFIFO = 2;
    6490 #else
     6446# else
    64916447    pThis->pciRegions.iVRAM = 0;
    6492 #endif
     6448# endif
    64936449
    64946450    pThis->pDevInsR3 = pDevIns;
    64956451    pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    6496 #ifdef VBOX_WITH_RAW_MODE_KEEP
     6452# ifdef VBOX_WITH_RAW_MODE_KEEP
    64976453    pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    6498 #endif
     6454# endif
    64996455
    65006456    vgaR3Reset(pDevIns);
     
    65046460    PDMPCIDEV_ASSERT_VALID(pDevIns, pPciDev);
    65056461
    6506 #ifdef VBOX_WITH_VMSVGA
     6462# ifdef VBOX_WITH_VMSVGA
    65076463    if (pThis->fVMSVGAEnabled)
    65086464    {
     
    65226478    }
    65236479    else
    6524     {
    6525 #endif /* VBOX_WITH_VMSVGA */
     6480# endif /* VBOX_WITH_VMSVGA */
     6481    {
    65266482        PDMPciDevSetVendorId(pPciDev,           0x80ee);   /* PCI vendor, just a free bogus value */
    65276483        PDMPciDevSetDeviceId(pPciDev,           0xbeef);
    6528 #ifdef VBOX_WITH_VMSVGA
    6529     }
    6530 #endif
     6484    }
    65316485    PDMPciDevSetClassSub(pPciDev,               0x00);   /* VGA controller */
    65326486    PDMPciDevSetClassBase(pPciDev,              0x03);
    65336487    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))
    65356489    PDMPciDevSetInterruptPin(pPciDev,           1);
    6536 #endif
     6490# endif
    65376491
    65386492    /* 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;
    65656509# 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;
    65726520
    65736521    /*
     
    65806528    AssertRCReturn(rc, rc);
    65816529
     6530# ifdef VBOX_WITH_HGSMI
     6531    /*
     6532     * This critical section is used by vgaR3IOPortHgsmiWrite, VBVARaiseIrq and VBVAOnResume
     6533     * for some IRQ related synchronization.
     6534     */
    65826535    rc = PDMDevHlpCritSectInit(pDevIns, &pThis->CritSectIRQ, RT_SRC_POS, "VGA#%u_IRQ", iInstance);
    65836536    AssertRCReturn(rc, rc);
     6537# endif
    65846538
    65856539    /*
     
    69006854            continue;
    69016855        *pCurMode = mode_info_list[i];
    6902         vgaAdjustModeInfo(pThis, pCurMode);
     6856        vgaR3AdjustModeInfo(pThis, pCurMode);
    69036857        pCurMode++;
    69046858    }
     
    70056959                pCurMode->info.BytesPerScanLine    = cbPitch;
    70066960                pCurMode->info.LinBytesPerScanLine = cbPitch;
    7007                 vgaAdjustModeInfo(pThis, pCurMode);
     6961                vgaR3AdjustModeInfo(pThis, pCurMode);
    70086962
    70096963                /* commit it */
     
    70416995     * Register debugger info callbacks.
    70426996     */
    7043     PDMDevHlpDBGFInfoRegister(pDevIns, "vga", "Display basic VGA state.", vgaInfoState);
    7044     PDMDevHlpDBGFInfoRegister(pDevIns, "vgatext", "Display VGA memory formatted as text.", vgaInfoText);
    7045     PDMDevHlpDBGFInfoRegister(pDevIns, "vgacr", "Dump VGA CRTC registers.", vgaInfoCR);
    7046     PDMDevHlpDBGFInfoRegister(pDevIns, "vgagr", "Dump VGA Graphics Controller registers.", vgaInfoGR);
    7047     PDMDevHlpDBGFInfoRegister(pDevIns, "vgasr", "Dump VGA Sequencer registers.", vgaInfoSR);
    7048     PDMDevHlpDBGFInfoRegister(pDevIns, "vgaar", "Dump VGA Attribute Controller registers.", vgaInfoAR);
    7049     PDMDevHlpDBGFInfoRegister(pDevIns, "vgapl", "Dump planar graphics state.", vgaInfoPlanar);
    7050     PDMDevHlpDBGFInfoRegister(pDevIns, "vgadac", "Dump VGA DAC registers.", vgaInfoDAC);
    7051     PDMDevHlpDBGFInfoRegister(pDevIns, "vbe", "Dump VGA VBE registers.", vgaInfoVBE);
     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);
    70527006
    70537007    /*
     
    70847038                                N_("Configuration error: Querying \"ShowBootMenu\" as integer failed"));
    70857039
    7086 #if defined(DEBUG) && !defined(DEBUG_sunlover) && !defined(DEBUG_michael)
     7040# if defined(DEBUG) && !defined(DEBUG_sunlover) && !defined(DEBUG_michael)
    70877041    /* Disable the logo abd menu if all default settings. */
    70887042    if (   LogoHdr.fu8FadeIn
     
    70947048        LogoHdr.u16LogoMillies = 500;
    70957049    }
    7096 #endif
     7050# endif
    70977051
    70987052    /* Delay the logo a little bit */
     
    71637117    if (g_cbVgaDefBiosLogo)
    71647118        pThis->cbLogo = g_cbVgaDefBiosLogo;
    7165 #ifndef VBOX_OSE
     7119# ifndef VBOX_OSE
    71667120    if (g_cbVgaDefBiosLogoNY)
    71677121        pThis->cbLogo = g_cbVgaDefBiosLogoNY;
    7168 #endif
     7122# endif
    71697123    pThis->cbLogo += sizeof(LogoHdr);
    71707124
     
    71857139            rc = RTFileRead(FileLogo, pLogoHdr + 1, LogoHdr.cbLogo, NULL);
    71867140            if (RT_SUCCESS(rc))
    7187                 rc = vbeParseBitmap(pThis);
     7141                rc = vbeR3ParseBitmap(pThis);
    71887142            if (RT_FAILURE(rc))
    71897143            {
     
    71967150            || RT_FAILURE(rc))
    71977151        {
    7198 #ifndef VBOX_OSE
     7152# ifndef VBOX_OSE
    71997153            RTTIMESPEC Now;
    72007154            RTTimeLocalNow(&Now);
     
    72117165            }
    72127166            else
    7213 #endif
     7167# endif
    72147168                memcpy(pLogoHdr + 1, g_abVgaDefBiosLogo, LogoHdr.cbLogo);
    7215             rc = vbeParseBitmap(pThis);
     7169            rc = vbeR3ParseBitmap(pThis);
    72167170            if (RT_FAILURE(rc))
    7217                 AssertReleaseMsgFailed(("Parsing of internal bitmap failed! vbeParseBitmap() -> %Rrc\n", rc));
     7171                AssertReleaseMsgFailed(("Parsing of internal bitmap failed! vbeR3ParseBitmap() -> %Rrc\n", rc));
    72187172        }
    72197173
     
    72297183        RTFileClose(FileLogo);
    72307184
    7231 #ifdef VBOX_WITH_HGSMI
     7185# ifdef VBOX_WITH_HGSMI
    72327186    VBVAInit (pThis);
    7233 #endif /* VBOX_WITH_HGSMI */
    7234 
    7235 #ifdef VBOX_WITH_VDMA
     7187# endif
     7188
     7189# ifdef VBOX_WITH_VDMA
    72367190    if (rc == VINF_SUCCESS)
    72377191    {
     
    72397193        AssertRC(rc);
    72407194    }
    7241 #endif
    7242 
    7243 #ifdef VBOX_WITH_VMSVGA
     7195# endif
     7196
     7197# ifdef VBOX_WITH_VMSVGA
    72447198    if (    rc == VINF_SUCCESS
    72457199        &&  pThis->fVMSVGAEnabled)
    72467200        rc = vmsvgaInit(pDevIns);
    7247 #endif
     7201# endif
    72487202
    72497203    /*
    72507204     * Statistics.
    72517205     */
    7252 #ifdef VBOX_WITH_STATISTICS
     7206# ifdef VBOX_WITH_STATISTICS
    72537207    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatRZMemoryRead,  STAMTYPE_PROFILE, "RZ/MMIO-Read",  STAMUNIT_TICKS_PER_CALL, "Profiling of the VGAGCMemoryRead() body.");
    72547208    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatR3MemoryRead,  STAMTYPE_PROFILE, "R3/MMIO-Read",  STAMUNIT_TICKS_PER_CALL, "Profiling of the VGAGCMemoryRead() body.");
     
    72567210    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatR3MemoryWrite, STAMTYPE_PROFILE, "R3/MMIO-Write", STAMUNIT_TICKS_PER_CALL, "Profiling of the VGAGCMemoryWrite() body.");
    72577211    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatMapPage,       STAMTYPE_COUNTER, "MapPageCalls",  STAMUNIT_OCCURENCES,     "Calls to IOMMMIOMapMMIO2Page.");
    7258     PDMDevHlpSTAMRegister(pDevIns, &pThis->StatUpdateDisp,    STAMTYPE_COUNTER, "UpdateDisplay", STAMUNIT_OCCURENCES,     "Calls to vgaPortUpdateDisplay().");
    7259 #endif
    7260 #ifdef VBOX_WITH_HGSMI
     7212    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatUpdateDisp,    STAMTYPE_COUNTER, "UpdateDisplay", STAMUNIT_OCCURENCES,     "Calls to vgaR3PortUpdateDisplay().");
     7213# endif
     7214# ifdef VBOX_WITH_HGSMI
    72617215    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatHgsmiMdaCgaAccesses, STAMTYPE_COUNTER, "HgmsiMdaCgaAccesses", STAMUNIT_OCCURENCES, "Number of non-HGMSI accesses for 03b0-3b3 and 03d0-3d3.");
    7262 #endif
     7216# endif
    72637217
    72647218    /* Init latched access mask. */
     
    73057259     * We just copy the ring-3 registration bits and remove the '&' before the handle.
    73067260     */
    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 { \
    73087262            rc = PDMDevHlpIoPortSetUpContext(pDevIns, a_hIoPort, a_pfnWrite, a_pfnRead, NULL /*pvUser*/); \
    73097263            AssertRCReturn(rc, rc); \
     
    73287282# endif /* CONFIG_BOCHS_VBE */
    73297283
    7330 #undef REG_PORT
     7284# undef REG_PORT
    73317285
    73327286    /* BIOS port: */
     
    73677321    else
    73687322        AssertReturn(pThis->hMmio2VmSvgaFifo == NIL_PGMMMIO2HANDLE, VERR_INVALID_STATE);
    7369 #endif
     7323# endif
    73707324
    73717325    return VINF_SUCCESS;
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r82084 r82088  
    668668
    669669# ifdef VBOX_WITH_VIDEOHWACCEL
    670 DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd);
     670DECLCALLBACK(int) vbvaR3VHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface,
     671                                                 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd);
    671672int vbvaVHWAConstruct(PVGASTATE pVGAState);
    672673int vbvaVHWAReset(PVGASTATE pVGAState);
     
    684685int vboxVBVALoadStateDone(PPDMDEVINS pDevIns);
    685686
    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);
     687DECLCALLBACK(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);
    692689
    693690# ifdef VBOX_WITH_VDMA
  • trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp

    r82050 r82088  
    892892    {
    893893        Assert(pCommand->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH);
    894         vbvaVHWACommandCompleteAsync(&pVGAState->IVBVACallbacks, pCommand);
     894        vbvaR3VHWACommandCompleteAsync(&pVGAState->IVBVACallbacks, pCommand);
    895895    }
    896896    else
     
    13551355 * @interface_method_impl{PDMIDISPLAYVBVACALLBACKS,pfnVHWACommandCompleteAsync}
    13561356 */
    1357 DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd)
     1357DECLCALLBACK(int) vbvaR3VHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface,
     1358                                                 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd)
    13581359{
    13591360    PVGASTATE pVGAState = PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(pInterface);
     
    20802081}
    20812082
    2082 void VBVARaiseIrq (PVGASTATE pVGAState, uint32_t fFlags)
     2083void VBVARaiseIrq(PVGASTATE pVGAState, uint32_t fFlags)
    20832084{
    20842085    PPDMDEVINS pDevIns = pVGAState->pDevInsR3;
     
    27872788#define IDISPLAYPORT_2_VGASTATE(pInterface) ( (PVGASTATE)((uintptr_t)pInterface - RT_OFFSETOF(VGASTATE, IPort)) )
    27882789
    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 */
     2793DECLCALLBACK(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);
    28002798    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
    28032802    PDMDevHlpCritSectLeave(pThis->pDevInsR3, &pThis->CritSect);
    28042803    return rc;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette