VirtualBox

Changeset 83578 in vbox for trunk/src


Ignore:
Timestamp:
Apr 6, 2020 12:04:45 AM (5 years ago)
Author:
vboxsync
Message:

WDDM: compute the number of available miplevels; return an error if a fence has been already deleted. bugref:9688.

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

Legend:

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

    r83222 r83578  
    6262        pSvga->u32MaxTextureHeight = 8192;
    6363    }
     64
     65    /* 1 + floor(log2(max(u32MaxTextureWidth, u32MaxTextureHeight))):
     66     * In Direct3D the next mipmap level size is floor(prev_size / 2), for example 5 -> 2 -> 1
     67     * Therefore we only need to know the position of the highest non-zero bit. And since
     68     * ASMBitLastSetU32 returns a 1 based index, there is no need to add 1.
     69     */
     70    pSvga->u32MaxTextureLevels = ASMBitLastSetU32(RT_MAX(pSvga->u32MaxTextureWidth, pSvga->u32MaxTextureHeight));
    6471
    6572    NTSTATUS Status = SvgaFifoInit(pSvga);
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.h

    r83222 r83578  
    8383    uint32_t u32MaxTextureWidth;  /** SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH */
    8484    uint32_t u32MaxTextureHeight; /** SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT */
     85
     86    uint32_t u32MaxTextureLevels; /** 1 + floor(log2(max(u32MaxTextureWidth, u32MaxTextureHeight))) */
    8587
    8688    /** Fifo state. */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/SvgaHostObjects.cpp

    r83222 r83578  
    319319    AssertReturn(Status == STATUS_SUCCESS, Status);
    320320
     321    AssertReturn(cSizes <= pSvga->u32MaxTextureLevels, STATUS_INVALID_PARAMETER);
     322
    321323    SURFACEOBJECT *pSO = (SURFACEOBJECT *)GaMemAllocZero(sizeof(SURFACEOBJECT));
    322324    if (pSO)
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaExt.h

    r83222 r83578  
    7777
    7878#define GAFENCE_F_WAITED        0x1 /* KEVENT is initialized and there is(are) waiter(s). */
     79#define GAFENCE_F_DELETED       0x2 /* The user mode driver deleted this fence. */
    7980
    8081NTSTATUS GaFenceCreate(PVBOXWDDM_EXT_GA pGaDevExt,
     
    8990                     uint32_t u32FenceHandle,
    9091                     uint32_t u32TimeoutUS);
    91 NTSTATUS GaFenceUnref(PVBOXWDDM_EXT_GA pGaDevExt,
    92                       uint32_t u32FenceHandle);
     92NTSTATUS GaFenceDelete(PVBOXWDDM_EXT_GA pGaDevExt,
     93                       uint32_t u32FenceHandle);
    9394
    9495DECLINLINE(void) gaFenceObjectsLock(VBOXWDDM_EXT_GA *pGaDevExt)
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaFence.cpp

    r82968 r83578  
    249249}
    250250
    251 NTSTATUS GaFenceUnref(PVBOXWDDM_EXT_GA pGaDevExt,
    252                       uint32_t u32FenceHandle)
     251NTSTATUS GaFenceDelete(PVBOXWDDM_EXT_GA pGaDevExt,
     252                       uint32_t u32FenceHandle)
    253253{
    254254    gaFenceObjectsLock(pGaDevExt);
     
    257257    AssertReturnStmt(pFO, gaFenceObjectsUnlock(pGaDevExt), STATUS_INVALID_PARAMETER);
    258258
     259    if (RT_BOOL(pFO->fu32FenceFlags & GAFENCE_F_DELETED))
     260    {
     261        /* Undo GaFenceLookup ref. */
     262        GaFenceUnrefLocked(pGaDevExt, pFO);
     263
     264        gaFenceObjectsUnlock(pGaDevExt);
     265        return STATUS_INVALID_PARAMETER;
     266    }
     267
     268    pFO->fu32FenceFlags |= GAFENCE_F_DELETED;
     269
    259270    if (RT_BOOL(pFO->fu32FenceFlags & GAFENCE_F_WAITED))
    260271    {
     
    263274    }
    264275
     276    /* Undo GaFenceLookup ref. */
     277    GaFenceUnrefLocked(pGaDevExt, pFO);
     278
     279    /* Undo the GaFenceCreate ref. */
     280    GaFenceUnrefLocked(pGaDevExt, pFO);
     281
    265282    gaFenceObjectsUnlock(pGaDevExt);
    266283
    267284    GALOG(("u32FenceHandle = %d, pFO %p\n", u32FenceHandle, pFO));
    268285
    269     /* Undo GaFenceLookup ref. */
    270     gaFenceUnref(pGaDevExt, pFO);
    271 
    272     /* Undo the GaFenceCreate ref. */
    273     gaFenceUnref(pGaDevExt, pFO);
    274 
    275286    return STATUS_SUCCESS;
    276287}
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaWddm.cpp

    r83222 r83578  
    17411741            GASURFSIZE *paSizes = (GASURFSIZE *)&pCreateParms[1];
    17421742
    1743             /// @todo verify the data
    17441743            Status = gaSurfaceDefine(pDevExt->pGa, pCreateParms, paSizes, pGaSurfaceDefine->cSizes, &pGaSurfaceDefine->u32Sid);
    17451744            break;
     
    18291828
    18301829            VBOXDISPIFESCAPE_GAFENCEUNREF *pFenceUnref = (VBOXDISPIFESCAPE_GAFENCEUNREF *)pEscapeHdr;
    1831             Status = GaFenceUnref(pDevExt->pGa, pFenceUnref->u32FenceHandle);
     1830            Status = GaFenceDelete(pDevExt->pGa, pFenceUnref->u32FenceHandle);
    18321831            break;
    18331832        }
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