VirtualBox

Changeset 77952 in vbox


Ignore:
Timestamp:
Mar 29, 2019 3:20:19 PM (6 years ago)
Author:
vboxsync
Message:

VMSVGA: Implemented pitch lock registers. See bugref:9424

File:
1 edited

Legend:

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

    r77920 r77952  
    14651465    }
    14661466}
     1467
     1468
     1469/**
     1470 * Update the scanline pitch in response to the guest changing mode
     1471 * width/bpp.
     1472 *
     1473 * @param   pThis       VMSVGA State
     1474 */
     1475DECLINLINE(void) vmsvgaUpdatePitch(PVGASTATE pThis)
     1476{
     1477    uint32_t RT_UNTRUSTED_VOLATILE_GUEST *pFIFO = pThis->svga.CTX_SUFF(pFIFO);
     1478    uint32_t uFifoPitchLock = pFIFO[SVGA_FIFO_PITCHLOCK];
     1479    uint32_t uRegPitchLock  = pThis->svga.u32PitchLock;
     1480
     1481    /* Sanitize values. */
     1482    uFifoPitchLock = (uint16_t)uFifoPitchLock;
     1483    uRegPitchLock  = (uint16_t)uFifoPitchLock;
     1484
     1485    /* Prefer the register value to the FIFO value.*/
     1486    if (pThis->svga.u32PitchLock)
     1487        pThis->svga.cbScanline = pThis->svga.u32PitchLock;
     1488    if (uFifoPitchLock)
     1489        pThis->svga.cbScanline = uFifoPitchLock;
     1490    else
     1491        pThis->svga.cbScanline = pThis->svga.uWidth * (RT_ALIGN(pThis->svga.uBpp, 8) / 8);
     1492}
    14671493#endif
     1494
    14681495
    14691496/**
     
    15931620        if (pThis->svga.uWidth != u32)
    15941621        {
     1622#if defined(IN_RING3) || defined(IN_RING0)
    15951623            pThis->svga.uWidth = u32;
    1596             pThis->svga.cbScanline = pThis->svga.uWidth * (RT_ALIGN(pThis->svga.uBpp, 8) / 8);
     1624            vmsvgaUpdatePitch(pThis);
    15971625            if (pThis->svga.fEnabled)
    15981626            {
    15991627                ASMAtomicOrU32(&pThis->svga.u32ActionFlags, VMSVGA_ACTION_CHANGEMODE);
    16001628            }
     1629#else
     1630            rc = VINF_IOM_R3_IOPORT_WRITE;
     1631#endif
    16011632        }
    16021633        /* else: nop */
     
    16251656        if (pThis->svga.uBpp != u32)
    16261657        {
     1658#if defined(IN_RING3) || defined(IN_RING0)
    16271659            pThis->svga.uBpp = u32;
    1628             pThis->svga.cbScanline = pThis->svga.uWidth * (RT_ALIGN(pThis->svga.uBpp, 8) / 8);
     1660            vmsvgaUpdatePitch(pThis);
    16291661            if (pThis->svga.fEnabled)
    16301662            {
    16311663                ASMAtomicOrU32(&pThis->svga.u32ActionFlags, VMSVGA_ACTION_CHANGEMODE);
    16321664            }
     1665#else
     1666            rc = VINF_IOM_R3_IOPORT_WRITE;
     1667#endif
    16331668        }
    16341669        /* else: nop */
     
    16891724        STAM_REL_COUNTER_INC(&pThis->svga.StatRegPitchLockWr);
    16901725        pThis->svga.u32PitchLock = u32;
     1726        /* Should this also update the FIFO pitch lock? Unclear. */
    16911727        break;
    16921728
     
    54275463    PVGASTATE       pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
    54285464    PVMSVGAR3STATE  pSVGAState = pThis->svga.pSvgaR3State;
     5465    uint32_t RT_UNTRUSTED_VOLATILE_GUEST *pFIFO = pThis->svga.pFIFOR3;
    54295466
    54305467    pHlp->pfnPrintf(pHlp, "Extension enabled:  %RTbool\n", pThis->svga.fEnabled);
     
    54405477    pHlp->pfnPrintf(pHlp, "IRQ status:         %#x\n", pThis->svga.u32IrqStatus);
    54415478    pHlp->pfnPrintf(pHlp, "IRQ mask:           %#x\n", pThis->svga.u32IrqMask);
    5442     pHlp->pfnPrintf(pHlp, "Pitch lock:         %#x\n", pThis->svga.u32PitchLock);
     5479    pHlp->pfnPrintf(pHlp, "Pitch lock:         %#x (FIFO:%#x)\n", pThis->svga.u32PitchLock, pFIFO[SVGA_FIFO_PITCHLOCK]);
    54435480    pHlp->pfnPrintf(pHlp, "Current GMR ID:     %#x\n", pThis->svga.u32CurrentGMRId);
    54445481    pHlp->pfnPrintf(pHlp, "Capabilites reg:    %#x\n", pThis->svga.u32RegCaps);
     
    58375874
    58385875    /* Setup FIFO capabilities. */
    5839     pThis->svga.pFIFOR3[SVGA_FIFO_CAPABILITIES] = SVGA_FIFO_CAP_FENCE | SVGA_FIFO_CAP_CURSOR_BYPASS_3 | SVGA_FIFO_CAP_GMR2 | SVGA_FIFO_CAP_3D_HWVERSION_REVISED | SVGA_FIFO_CAP_SCREEN_OBJECT_2 | SVGA_FIFO_CAP_RESERVE;
     5876    pThis->svga.pFIFOR3[SVGA_FIFO_CAPABILITIES] = SVGA_FIFO_CAP_FENCE | SVGA_FIFO_CAP_CURSOR_BYPASS_3 | SVGA_FIFO_CAP_GMR2 | SVGA_FIFO_CAP_3D_HWVERSION_REVISED | SVGA_FIFO_CAP_SCREEN_OBJECT_2 | SVGA_FIFO_CAP_RESERVE | SVGA_FIFO_CAP_PITCHLOCK;
    58405877
    58415878    /* Valid with SVGA_FIFO_CAP_SCREEN_OBJECT_2 */
     
    59666003
    59676004    /* Setup FIFO capabilities. */
    5968     pThis->svga.pFIFOR3[SVGA_FIFO_CAPABILITIES] = SVGA_FIFO_CAP_FENCE | SVGA_FIFO_CAP_CURSOR_BYPASS_3 | SVGA_FIFO_CAP_GMR2 | SVGA_FIFO_CAP_3D_HWVERSION_REVISED | SVGA_FIFO_CAP_SCREEN_OBJECT_2 | SVGA_FIFO_CAP_RESERVE;
     6005    pThis->svga.pFIFOR3[SVGA_FIFO_CAPABILITIES] = SVGA_FIFO_CAP_FENCE | SVGA_FIFO_CAP_CURSOR_BYPASS_3 | SVGA_FIFO_CAP_GMR2 | SVGA_FIFO_CAP_3D_HWVERSION_REVISED | SVGA_FIFO_CAP_SCREEN_OBJECT_2 | SVGA_FIFO_CAP_RESERVE | SVGA_FIFO_CAP_PITCHLOCK;
    59696006
    59706007    /* Valid with SVGA_FIFO_CAP_SCREEN_OBJECT_2 */
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