VirtualBox

Changeset 77869 in vbox


Ignore:
Timestamp:
Mar 25, 2019 11:15:32 AM (6 years ago)
Author:
vboxsync
Message:

DevVGA-SVGA: report the mouse cursor position only if the guest actually updated it

File:
1 edited

Legend:

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

    r77867 r77869  
    33353335    uint32_t RT_UNTRUSTED_VOLATILE_GUEST * const pFIFO = pThis->svga.pFIFOR3;
    33363336    AssertReturnVoid(pThis->svga.pFIFOR3);
    3337     if (   vmsvgaFIFOHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount)
     3337    if (   vmsvgaFIFOHasWork(pFIFO, ASMAtomicReadU32(&pThis->svga.uLastCursorUpdateCount))
    33383338        && pThis->svga.fFIFOThreadSleeping)
    33393339    {
     
    34043404    /*
    34053405     * Cursor update state (SVGA_FIFO_CAP_CURSOR_BYPASS_3).
    3406      * Initialize with values that will trigger an update as soon as maybe.
     3406     *
     3407     * Initialize with values that will detect an update from the guest.
     3408     * Make sure that if the guest never updates the cursor position, then the device does not report it.
     3409     * The guest has to change the value of uLastCursorUpdateCount, when the cursor position is actually updated.
     3410     * xLastCursor, yLastCursor and fLastCursorVisible are set to report the first update.
    34073411     */
    34083412    uint32_t RT_UNTRUSTED_VOLATILE_GUEST * const pFIFO = pThis->svga.pFIFOR3;
    3409     uint32_t uLastCursorCount   = pThis->svga.uLastCursorUpdateCount = ~pFIFO[SVGA_FIFO_CURSOR_COUNT];
     3413    pThis->svga.uLastCursorUpdateCount = pFIFO[SVGA_FIFO_CURSOR_COUNT];
    34103414    uint32_t xLastCursor        = ~pFIFO[SVGA_FIFO_CURSOR_X];
    34113415    uint32_t yLastCursor        = ~pFIFO[SVGA_FIFO_CURSOR_Y];
     
    34323436         */
    34333437        if (   fBadOrDisabledFifo
    3434             || !vmsvgaFIFOHasWork(pFIFO, uLastCursorCount))
     3438            || !vmsvgaFIFOHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
    34353439        {
    34363440            ASMAtomicWriteBool(&pThis->svga.fFIFOThreadSleeping, true);
     
    34453449# endif
    34463450                if (   !fBadOrDisabledFifo
    3447                     && vmsvgaFIFOHasWork(pFIFO, uLastCursorCount))
     3451                    && vmsvgaFIFOHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
    34483452                    rc = VINF_SUCCESS;
    34493453                else
     
    34673471        if (rc == VERR_TIMEOUT)
    34683472        {
    3469             if (!vmsvgaFIFOHasWork(pFIFO, uLastCursorCount))
     3473            if (!vmsvgaFIFOHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
    34703474            {
    34713475                cMsSleep = RT_MIN(cMsSleep + cMsIncSleep, cMsMaxSleep);
     
    34763480            Log(("vmsvgaFIFOLoop: timeout\n"));
    34773481        }
    3478         else if (vmsvgaFIFOHasWork(pFIFO, uLastCursorCount))
     3482        else if (vmsvgaFIFOHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
    34793483            STAM_REL_COUNTER_INC(&pSVGAState->StatFifoTodoWoken);
    34803484        cMsSleep = cMsMinSleep;
     
    35443548        {
    35453549            uint32_t const uCursorUpdateCount = pFIFO[SVGA_FIFO_CURSOR_COUNT];
    3546             if (uCursorUpdateCount == uLastCursorCount)
     3550            if (uCursorUpdateCount == pThis->svga.uLastCursorUpdateCount)
    35473551            { /* halfways likely */ }
    35483552            else
    35493553            {
    3550                 uLastCursorCount = vmsvgaFIFOUpdateCursor(pThis, pSVGAState, pFIFO, offFifoMin, uCursorUpdateCount,
    3551                                                           &xLastCursor, &yLastCursor, &fLastCursorVisible);
     3554                uint32_t const uLastCursorCount = vmsvgaFIFOUpdateCursor(pThis, pSVGAState, pFIFO, offFifoMin, uCursorUpdateCount,
     3555                                                                         &xLastCursor, &yLastCursor, &fLastCursorVisible);
    35523556                ASMAtomicWriteU32(&pThis->svga.uLastCursorUpdateCount, uLastCursorCount);
    35533557            }
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