VirtualBox

Changeset 90180 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jul 14, 2021 12:05:26 PM (4 years ago)
Author:
vboxsync
Message:

3D/VMSVGA: The command buffer context init/cleanup on device start/stop, bugref:9845

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.cpp

    r89438 r90180  
    2727#include <iprt/memobj.h>
    2828
     29static NTSTATUS SvgaCmdBufCtxInit(VBOXWDDM_EXT_VMSVGA *pSvga, bool enable)
     30{
     31    int rc = STATUS_SUCCESS;
     32
     33    if (enable)
     34    {
     35        rc = RTR0MemObjAllocPageTag(&pSvga->hMemObj, 2 << PAGE_SHIFT,
     36                                false /* executable R0 mapping */, "WDDMGA");
     37
     38        pSvga->pvR0Hdr = RTR0MemObjAddress(pSvga->hMemObj);
     39        pSvga->paHdr   = RTR0MemObjGetPagePhysAddr(pSvga->hMemObj, 0/*iPage*/);
     40
     41        pSvga->pvR0Cmd = (uint8_t *)pSvga->pvR0Hdr + PAGE_SIZE;
     42        pSvga->paCmd   = RTR0MemObjGetPagePhysAddr(pSvga->hMemObj, 1/*iPage*/);
     43    }
     44
     45    SVGACBHeader *pHdr = (SVGACBHeader *)pSvga->pvR0Hdr;
     46
     47    pHdr->status = SVGA_CB_STATUS_NONE;
     48    pHdr->errorOffset = 0;
     49    pHdr->id = 0;
     50    pHdr->flags = SVGA_CB_FLAG_NONE;
     51    pHdr->length = sizeof(uint32_t) + sizeof(SVGADCCmdStartStop);
     52    pHdr->ptr.pa = pSvga->paCmd;
     53
     54    uint32_t *pu32Id = (uint32_t *)pSvga->pvR0Cmd;
     55    SVGADCCmdStartStop *pCommand = (SVGADCCmdStartStop *)&pu32Id[1];
     56
     57    *pu32Id = SVGA_DC_CMD_START_STOP_CONTEXT;
     58    pCommand->enable = enable;
     59    pCommand->context = SVGA_CB_CONTEXT_0;
     60
     61    SVGARegWrite(pSvga, SVGA_REG_COMMAND_HIGH, (uint32_t)(pSvga->paHdr >> 32));
     62    SVGARegWrite(pSvga, SVGA_REG_COMMAND_LOW, (uint32_t)pSvga->paHdr | 0x3f);
     63
     64    if (!enable)
     65    {
     66        RTR0MemObjFree(pSvga->hMemObj, true);
     67        pSvga->hMemObj = NIL_RTR0MEMOBJ;
     68    }
     69
     70    return rc;
     71}
     72
    2973static NTSTATUS svgaHwInit(VBOXWDDM_EXT_VMSVGA *pSvga)
    3074{
     
    70114    }
    71115
     116    if (pSvga->u32Caps & SVGA_CAP_COMMAND_BUFFERS)
     117    {
     118        SvgaCmdBufCtxInit(pSvga, true);
     119    }
     120
    72121    return Status;
    73122}
     
    95144            pSvga->pu32GMRBits = NULL;
    96145            pSvga->cbGMRBits = 0;
     146        }
     147
     148        if (pSvga->u32Caps & SVGA_CAP_COMMAND_BUFFERS)
     149        {
     150            SvgaCmdBufCtxInit(pSvga, false);
    97151        }
    98152
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.h

    r86307 r90180  
    6464    /** Pointer to FIFO MMIO region. */
    6565    volatile uint32_t *pu32FIFO;
     66
     67    RTR0MEMOBJ hMemObj;
     68    RTR0PTR  pvR0Hdr, pvR0Cmd;
     69    RTHCPHYS paHdr, paCmd;
    6670
    6771    /**
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