VirtualBox

Changeset 51121 in vbox for trunk/src


Ignore:
Timestamp:
Apr 23, 2014 11:39:21 AM (11 years ago)
Author:
vboxsync
Message:

extend PDMIDISPLAYCONNECTOR::pfnVBVAXxx and VBVA resize for better DevVGA/CrCmd integration

Location:
trunk/src/VBox
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h

    r50940 r51121  
    118118#define VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS 0x01
    119119#define VBOXWDDM_HGSYNC_F_SYNCED_LOCATION   0x02
    120 #define VBOXWDDM_HGSYNC_F_SYNCED_ALL        (VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS | VBOXWDDM_HGSYNC_F_SYNCED_LOCATION)
     120#define VBOXWDDM_HGSYNC_F_SYNCED_VISIBILITY 0x04
     121#define VBOXWDDM_HGSYNC_F_SYNCED_ALL        (VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS | VBOXWDDM_HGSYNC_F_SYNCED_LOCATION | VBOXWDDM_HGSYNC_F_SYNCED_VISIBILITY)
    121122#define VBOXWDDM_HGSYNC_F_CHANGED_LOCATION_ONLY        (VBOXWDDM_HGSYNC_F_SYNCED_ALL & ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION)
    122123
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp

    r51081 r51121  
    13411341    return pCmd->Hdr.i32Result;
    13421342}
     1343
     1344int VBoxCmdVbvaConCmdResize(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint16_t fFlags)
     1345{
     1346    Assert(KeGetCurrentIrql() < DISPATCH_LEVEL);
     1347
     1348    VBOXCMDVBVA_CTL_RESIZE *pResize = (VBOXCMDVBVA_CTL_RESIZE*)vboxCmdVbvaCtlCreate(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, sizeof (VBOXCMDVBVA_CTL_RESIZE));
     1349    if (!pResize)
     1350    {
     1351        WARN(("vboxCmdVbvaCtlCreate failed"));
     1352        return VERR_OUT_OF_RESOURCES;
     1353    }
     1354
     1355    pResize->Hdr.u32Type = VBOXCMDVBVACTL_TYPE_RESIZE;
     1356    pResize->Hdr.i32Result = VERR_NOT_IMPLEMENTED;
     1357
     1358    int rc = vboxWddmScreenInfoInit(&pResize->Resize.aEntries[0].Screen, pAllocData, pVScreenPos, fFlags);
     1359    if (RT_SUCCESS(rc))
     1360    {
     1361        rc = vboxCmdVbvaCtlSubmitSync(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, &pResize->Hdr);
     1362        if (RT_SUCCESS(rc))
     1363        {
     1364            rc = pResize->Hdr.i32Result;
     1365            if (RT_FAILURE(rc))
     1366                WARN(("VBOXCMDVBVACTL_TYPE_RESIZE failed %d", rc));
     1367        }
     1368        else
     1369            WARN(("vboxCmdVbvaCtlSubmitSync failed %d", rc));
     1370    }
     1371    else
     1372        WARN(("vboxWddmScreenInfoInit failed %d", rc));
     1373
     1374    vboxCmdVbvaCtlFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, &pResize->Hdr);
     1375
     1376    return rc;
     1377}
    13431378#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.h

    r51042 r51121  
    247247int VBoxCmdVbvaConCmdSubmitAsync(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD* pCmd, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion);
    248248int VBoxCmdVbvaConCmdCompletionData(void *pvCmd, VBOXCMDVBVA_CRCMD_CMD **ppCmd);
     249int VBoxCmdVbvaConCmdResize(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint16_t fFlags);
    249250#endif /* #ifdef VBOX_WITH_CROGL */
    250251
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r51111 r51121  
    202202}
    203203
    204 NTSTATUS vboxWddmGhDisplayPostInfoScreenBySDesc (PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_SURFACE_DESC *pDesc, const POINT * pVScreenPos, uint16_t fFlags)
     204int vboxWddmGhDisplayPostInfoScreen(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint16_t fFlags)
    205205{
    206206    void *p = VBoxHGSMIBufferAlloc (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx,
     
    208208                                      HGSMI_CH_VBVA,
    209209                                      VBVA_INFO_SCREEN);
    210     Assert(p);
    211     if (p)
    212     {
    213         VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)p;
    214 
    215         pScreen->u32ViewIndex    = pDesc->VidPnSourceId;
    216         pScreen->i32OriginX      = pVScreenPos->x;
    217         pScreen->i32OriginY      = pVScreenPos->y;
     210    if (!p)
     211    {
     212        WARN(("VBoxHGSMIBufferAlloc failed"));
     213
     214        return VERR_OUT_OF_RESOURCES;
     215    }
     216
     217    VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)p;
     218
     219    int rc = vboxWddmScreenInfoInit(pScreen, pAllocData, pVScreenPos, fFlags);
     220    if (RT_SUCCESS(rc))
     221    {
    218222        pScreen->u32StartOffset  = 0; //(uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */
    219         pScreen->u32LineSize     = pDesc->pitch;
    220         pScreen->u32Width        = pDesc->width;
    221         pScreen->u32Height       = pDesc->height;
    222         pScreen->u16BitsPerPixel = (uint16_t)pDesc->bpp;
    223         pScreen->u16Flags        = fFlags;
    224 
    225         VBoxHGSMIBufferSubmit (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);
    226 
    227         VBoxHGSMIBufferFree (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);
    228     }
    229 
    230     return STATUS_SUCCESS;
    231 
    232 }
    233 
    234 NTSTATUS vboxWddmGhDisplayPostInfoScreen(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos)
    235 {
    236     NTSTATUS Status = vboxWddmGhDisplayPostInfoScreenBySDesc(pDevExt, &pAllocData->SurfDesc, pVScreenPos, VBVA_SCREEN_F_ACTIVE);
    237     if (!NT_SUCCESS(Status))
    238         WARN(("vboxWddmGhDisplayPostInfoScreenBySDesc failed Status 0x%x", Status));
    239     return Status;
    240 }
    241 
    242 NTSTATUS vboxWddmGhDisplayHideScreen(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
    243 {
    244     PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[VidPnTargetId];
    245     /* this will force update on re-activation */
    246     pSource->AllocData.SurfDesc.width = 0;
    247     pSource->AllocData.SurfDesc.height = 0;
    248     POINT VScreenPos = {0};
    249 
    250     NTSTATUS Status = vboxWddmGhDisplayPostInfoScreenBySDesc(pDevExt, &pSource->AllocData.SurfDesc, &VScreenPos, VBVA_SCREEN_F_ACTIVE | VBVA_SCREEN_F_DISABLED);
    251     if (!NT_SUCCESS(Status))
    252         WARN(("vboxWddmGhDisplayPostInfoScreenBySDesc failed Status 0x%x", Status));
    253     return Status;
    254 }
    255 
    256 BOOL vboxWddmGhDisplayCheckCompletePeningScreenInfo(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
    257 {
    258     if (!ASMAtomicCmpXchgBool(&pDevExt->aTargets[VidPnTargetId].fStateSyncPening, false, true))
    259         return FALSE;
    260     return vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, &pDevExt->aSources[VidPnTargetId]);
    261 }
    262 
    263 NTSTATUS vboxWddmGhDisplayPostInfoView(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData)
     223
     224        rc = VBoxHGSMIBufferSubmit (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);
     225        if (RT_FAILURE(rc))
     226            WARN(("VBoxHGSMIBufferSubmit failed %d", rc));
     227    }
     228    else
     229        WARN(("VBoxHGSMIBufferSubmit failed %d", rc));
     230
     231    VBoxHGSMIBufferFree (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);
     232
     233    return rc;
     234}
     235
     236int vboxWddmGhDisplayPostInfoView(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData)
    264237{
    265238    VBOXVIDEOOFFSET offVram = vboxWddmAddrFramOffset(&pAllocData->Addr);
     
    267240    {
    268241        WARN(("offVram == VBOXVIDEOOFFSET_VOID"));
    269         return STATUS_INVALID_PARAMETER;
     242        return VERR_INVALID_PARAMETER;
    270243    }
    271244
     
    275248                                      HGSMI_CH_VBVA,
    276249                                      VBVA_INFO_VIEW);
    277     Assert(p);
    278     if (p)
    279     {
    280         VBVAINFOVIEW *pView = (VBVAINFOVIEW *)p;
    281 
    282         pView->u32ViewIndex     = pAllocData->SurfDesc.VidPnSourceId;
    283         pView->u32ViewOffset    = (uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */
    284         pView->u32ViewSize      = vboxWddmVramCpuVisibleSegmentSize(pDevExt)/VBoxCommonFromDeviceExt(pDevExt)->cDisplays;
    285 
    286         pView->u32MaxScreenSize = pView->u32ViewSize;
    287 
    288         VBoxHGSMIBufferSubmit (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);
    289 
    290         VBoxHGSMIBufferFree (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);
     250    if (!p)
     251    {
     252        WARN(("VBoxHGSMIBufferAlloc failed"));
     253        return VERR_OUT_OF_RESOURCES;
     254    }
     255
     256    VBVAINFOVIEW *pView = (VBVAINFOVIEW *)p;
     257
     258    pView->u32ViewIndex     = pAllocData->SurfDesc.VidPnSourceId;
     259    pView->u32ViewOffset    = (uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */
     260    pView->u32ViewSize      = vboxWddmVramCpuVisibleSegmentSize(pDevExt)/VBoxCommonFromDeviceExt(pDevExt)->cDisplays;
     261
     262    pView->u32MaxScreenSize = pView->u32ViewSize;
     263
     264    int rc = VBoxHGSMIBufferSubmit (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);
     265    if (RT_FAILURE(rc))
     266        WARN(("VBoxHGSMIBufferSubmit failed %d", rc));
     267
     268    VBoxHGSMIBufferFree (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);
     269
     270    return rc;
     271}
     272
     273NTSTATUS vboxWddmGhDisplayPostResize(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint16_t fFlags)
     274{
     275    int rc;
     276#ifdef VBOX_WITH_CROGL
     277    if (pDevExt->fCmdVbvaEnabled)
     278    {
     279        rc = VBoxCmdVbvaConCmdResize(pDevExt, pAllocData, pVScreenPos, fFlags);
     280        if (RT_SUCCESS(rc))
     281            return STATUS_SUCCESS;
     282
     283        WARN(("VBoxCmdVbvaConCmdResize failed %d", rc));
     284
     285        if (rc != VERR_NOT_IMPLEMENTED)
     286        {
     287            WARN(("VBoxCmdVbvaConCmdResize unexpected error occured %d", rc));
     288            return STATUS_UNSUCCESSFUL;
     289        }
     290    }
     291#endif
     292
     293    if (!(fFlags & VBVA_SCREEN_F_DISABLED))
     294    {
     295        rc = vboxWddmGhDisplayPostInfoView(pDevExt, pAllocData);
     296        if (RT_FAILURE(rc))
     297        {
     298            WARN(("vboxWddmGhDisplayPostInfoView failed %d", rc));
     299            return STATUS_UNSUCCESSFUL;
     300        }
     301    }
     302
     303    rc = vboxWddmGhDisplayPostInfoScreen(pDevExt, pAllocData, pVScreenPos, fFlags);
     304    if (RT_FAILURE(rc))
     305    {
     306        WARN(("vboxWddmGhDisplayPostInfoScreen failed %d", rc));
     307        return STATUS_UNSUCCESSFUL;
    291308    }
    292309
    293310    return STATUS_SUCCESS;
     311}
     312
     313NTSTATUS vboxWddmGhDisplayHideScreen(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
     314{
     315    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[VidPnTargetId];
     316
     317    NTSTATUS Status = vboxWddmGhDisplayPostResize(pDevExt, &pSource->AllocData, &pSource->VScreenPos, VBVA_SCREEN_F_ACTIVE | VBVA_SCREEN_F_DISABLED);
     318    if (!NT_SUCCESS(Status))
     319        WARN(("vboxWddmGhDisplayPostResize failed Status 0x%x", Status));
     320    return Status;
     321}
     322
     323BOOL vboxWddmGhDisplayCheckCompletePeningScreenInfo(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
     324{
     325    if (!ASMAtomicCmpXchgBool(&pDevExt->aTargets[VidPnTargetId].fStateSyncPening, false, true))
     326        return FALSE;
     327    return vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, &pDevExt->aSources[VidPnTargetId]);
    294328}
    295329
     
    340374    pSource->VScreenPos = *pVScreenPos;
    341375
    342     NTSTATUS Status = vboxWddmGhDisplayPostInfoScreen(pDevExt, &pSource->AllocData, &pSource->VScreenPos);
     376    NTSTATUS Status = vboxWddmGhDisplayPostResize(pDevExt, &pSource->AllocData, &pSource->VScreenPos, VBVA_SCREEN_F_ACTIVE);
    343377    Assert(Status == STATUS_SUCCESS);
    344378    return Status;
     
    361395    if (NT_SUCCESS(Status))
    362396    {
    363         Status = vboxWddmGhDisplayPostInfoView(pDevExt, pAllocData);
     397        Status = vboxWddmGhDisplayPostResize(pDevExt, pAllocData, pVScreenPos, VBVA_SCREEN_F_ACTIVE);
    364398        if (NT_SUCCESS(Status))
    365399        {
    366             Status = vboxWddmGhDisplayPostInfoScreen(pDevExt, pAllocData, pVScreenPos);
    367             if (NT_SUCCESS(Status))
    368             {
    369400#ifdef VBOX_WITH_CROGL
    370                 if (pDevExt->f3DEnabled)
    371                 {
    372                     Status = vboxVdmaTexPresentSetAlloc(pDevExt, pRealFbAlloc);
    373                     if (NT_SUCCESS(Status))
    374                         return STATUS_SUCCESS;
    375                     else
    376                         WARN(("vboxVdmaTexPresentSetAlloc failed, Status 0x%x", Status));
    377                 }
     401            if (pDevExt->f3DEnabled)
     402            {
     403                Status = vboxVdmaTexPresentSetAlloc(pDevExt, pRealFbAlloc);
     404                if (NT_SUCCESS(Status))
     405                    return STATUS_SUCCESS;
     406                else
     407                    WARN(("vboxVdmaTexPresentSetAlloc failed, Status 0x%x", Status));
     408            }
    378409#else
    379                 return STATUS_SUCCESS;
    380 #endif
    381             }
    382             else
    383                 WARN(("vboxWddmGhDisplayPostInfoScreen failed, Status 0x%x", Status));
     410            return STATUS_SUCCESS;
     411#endif
    384412        }
    385413        else
    386             WARN(("vboxWddmGhDisplayPostInfoView failed, Status 0x%x", Status));
     414            WARN(("vboxWddmGhDisplayPostResize failed, Status 0x%x", Status));
    387415    }
    388416    else
     
    53345362    pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION;
    53355363
    5336     if (pSource->bVisible)
     5364    if (pDevExt->fCmdVbvaEnabled || pSource->bVisible)
    53375365    {
    53385366        vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource);
     
    53845412    PVBOXWDDM_ALLOCATION pAllocation = pSource->pPrimaryAllocation;
    53855413    if (pAllocation)
     5414    {
     5415        Assert(pAllocation->bVisible == pSource->bVisible);
    53865416        pAllocation->bVisible = pSetVidPnSourceVisibility->Visible;
     5417    }
    53875418
    53885419    if (pSource->bVisible != pSetVidPnSourceVisibility->Visible)
    53895420    {
    53905421        pSource->bVisible = pSetVidPnSourceVisibility->Visible;
    5391         if (pSource->bVisible)
     5422        pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_VISIBILITY;
     5423        if (pDevExt->fCmdVbvaEnabled || pSource->bVisible)
    53925424        {
    53935425            vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource);
     
    55385570            {
    55395571                if (pSource->bVisible || !pTarget->HeightVisible)
     5572                {
     5573                    pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_VISIBILITY;
     5574                    vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource);
     5575                }
     5576                else if (pDevExt->fCmdVbvaEnabled)
    55405577                    vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource);
    55415578            }
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h

    r50987 r51121  
    243243            (pAddr->SegmentId == 1 ? pAddr->offVram : 0)
    244244            : VBOXVIDEOOFFSET_VOID;
     245}
     246
     247DECLINLINE(int) vboxWddmScreenInfoInit(VBVAINFOSCREEN *pScreen, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint16_t fFlags)
     248{
     249    VBOXVIDEOOFFSET offVram = vboxWddmAddrFramOffset(&pAllocData->Addr);
     250    if (offVram == VBOXVIDEOOFFSET_VOID && !(fFlags & VBVA_SCREEN_F_DISABLED))
     251    {
     252        WARN(("offVram == VBOXVIDEOOFFSET_VOID"));
     253        return VERR_INVALID_PARAMETER;
     254    }
     255
     256    pScreen->u32ViewIndex    = pAllocData->SurfDesc.VidPnSourceId;
     257    pScreen->i32OriginX      = pVScreenPos->x;
     258    pScreen->i32OriginY      = pVScreenPos->y;
     259    pScreen->u32StartOffset  = (uint32_t)offVram;
     260    pScreen->u32LineSize     = pAllocData->SurfDesc.pitch;
     261    pScreen->u32Width        = pAllocData->SurfDesc.width;
     262    pScreen->u32Height       = pAllocData->SurfDesc.height;
     263    pScreen->u16BitsPerPixel = (uint16_t)pAllocData->SurfDesc.bpp;
     264    pScreen->u16Flags        = fFlags;
     265
     266    return VINF_SUCCESS;
    245267}
    246268
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r51013 r51121  
    592592void     VBVAReset (PVGASTATE pVGAState);
    593593void     VBVAPause (PVGASTATE pVGAState, bool fPause);
    594 int      VBVAGetScreenInfo(PVGASTATE pVGAState, unsigned uScreenId, struct VBVAINFOSCREEN *pScreen, void **ppvVram);
    595594
    596595bool VBVAIsEnabled(PVGASTATE pVGAState);
     
    598597void VBVARaiseIrq (PVGASTATE pVGAState, uint32_t fFlags);
    599598void VBVARaiseIrqNoWait(PVGASTATE pVGAState, uint32_t fFlags);
     599
     600int VBVAInfoView(PVGASTATE pVGAState, VBVAINFOVIEW *pView);
     601int VBVAInfoScreen(PVGASTATE pVGAState, VBVAINFOSCREEN *pScreen);
    600602
    601603/* @return host-guest flags that were set on reset
  • trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp

    r51013 r51121  
    496496        pVBVA->hostFlags.u32SupportedOrders = 0;
    497497
    498         rc = pVGAState->pDrv->pfnVBVAEnable (pVGAState->pDrv, uScreenId, &pVBVA->hostFlags);
     498        rc = pVGAState->pDrv->pfnVBVAEnable (pVGAState->pDrv, uScreenId, &pVBVA->hostFlags, false);
    499499    }
    500500    else
     
    19031903}
    19041904
     1905int VBVAInfoView(PVGASTATE pVGAState, VBVAINFOVIEW *pView)
     1906{
     1907    LogFlowFunc(("VBVA_INFO_VIEW: index %d, offset 0x%x, size 0x%x, max screen size 0x%x\n",
     1908                     pView->u32ViewIndex, pView->u32ViewOffset, pView->u32ViewSize, pView->u32MaxScreenSize));
     1909
     1910    PHGSMIINSTANCE pIns = pVGAState->pHGSMI;
     1911    VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns);
     1912
     1913    /* @todo verify view data. */
     1914    if (pView->u32ViewIndex >= pCtx->cViews)
     1915    {
     1916        Log(("View index too large %d!!!\n",
     1917             pView->u32ViewIndex));
     1918        return VERR_INVALID_PARAMETER;
     1919    }
     1920
     1921    pCtx->aViews[pView->u32ViewIndex].view = *pView;
     1922
     1923    return VINF_SUCCESS;
     1924}
     1925
     1926int VBVAInfoScreen(PVGASTATE pVGAState, VBVAINFOSCREEN *pScreen)
     1927{
     1928    PHGSMIINSTANCE pIns = pVGAState->pHGSMI;
     1929    VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns);
     1930    VBVAINFOVIEW *pView = &pCtx->aViews[pScreen->u32ViewIndex].view;
     1931    /* Calculate the offset of the  end of the screen so we can make
     1932     * sure it is inside the view.  I assume that screen rollover is not
     1933     * implemented. */
     1934    int64_t offEnd =   (int64_t)pScreen->u32Height * pScreen->u32LineSize
     1935                     + pScreen->u32Width + pScreen->u32StartOffset;
     1936    LogRel(("VBVA_INFO_SCREEN: [%d] @%d,%d %dx%d, line 0x%x, BPP %d, flags 0x%x\n",
     1937                    pScreen->u32ViewIndex, pScreen->i32OriginX, pScreen->i32OriginY,
     1938                    pScreen->u32Width, pScreen->u32Height,
     1939                    pScreen->u32LineSize,  pScreen->u16BitsPerPixel, pScreen->u16Flags));
     1940
     1941    if (   pScreen->u32ViewIndex < RT_ELEMENTS (pCtx->aViews)
     1942        && pScreen->u16BitsPerPixel <= 32
     1943        && pScreen->u32Width <= UINT16_MAX
     1944        && pScreen->u32Height <= UINT16_MAX
     1945        && pScreen->u32LineSize <= UINT16_MAX * 4
     1946        && offEnd < pView->u32MaxScreenSize)
     1947    {
     1948        vbvaResize (pVGAState, &pCtx->aViews[pScreen->u32ViewIndex], pScreen);
     1949        return VINF_SUCCESS;
     1950    }
     1951
     1952    LogRelFlow(("VBVA_INFO_SCREEN [%lu]: bad data: %lux%lu, line 0x%lx, BPP %u, start offset %lu, max screen size %lu\n",
     1953                    (unsigned long)pScreen->u32ViewIndex,
     1954                    (unsigned long)pScreen->u32Width,
     1955                    (unsigned long)pScreen->u32Height,
     1956                    (unsigned long)pScreen->u32LineSize,
     1957                    (unsigned long)pScreen->u16BitsPerPixel,
     1958                    (unsigned long)pScreen->u32StartOffset,
     1959                    (unsigned long)pView->u32MaxScreenSize));
     1960    return VERR_INVALID_PARAMETER;
     1961}
     1962
    19051963
    19061964/*
     
    20692127                 pView++, cbBuffer -= sizeof (VBVAINFOVIEW))
    20702128            {
    2071                 LogFlowFunc(("VBVA_INFO_VIEW: index %d, offset 0x%x, size 0x%x, max screen size 0x%x\n",
    2072                              pView->u32ViewIndex, pView->u32ViewOffset, pView->u32ViewSize, pView->u32MaxScreenSize));
    2073 
    2074                 /* @todo verify view data. */
    2075                 if (pView->u32ViewIndex >= pCtx->cViews)
    2076                 {
    2077                     Log(("View index too large %d!!!\n",
    2078                          pView->u32ViewIndex));
    2079                     rc = VERR_INVALID_PARAMETER;
     2129                VBVAINFOVIEW View = *pView;
     2130                rc = VBVAInfoView(pVGAState, &View);
     2131                if (RT_FAILURE(rc))
    20802132                    break;
    2081                 }
    2082 
    2083                 pCtx->aViews[pView->u32ViewIndex].view = *pView;
    20842133            }
    20852134        } break;
     
    21242173
    21252174            VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)pvBuffer;
    2126             VBVAINFOVIEW *pView = &pCtx->aViews[pScreen->u32ViewIndex].view;
    2127             /* Calculate the offset of the  end of the screen so we can make
    2128              * sure it is inside the view.  I assume that screen rollover is not
    2129              * implemented. */
    2130             int64_t offEnd =   (int64_t)pScreen->u32Height * pScreen->u32LineSize
    2131                              + pScreen->u32Width + pScreen->u32StartOffset;
    2132             LogRel(("VBVA_INFO_SCREEN: [%d] @%d,%d %dx%d, line 0x%x, BPP %d, flags 0x%x\n",
    2133                             pScreen->u32ViewIndex, pScreen->i32OriginX, pScreen->i32OriginY,
    2134                             pScreen->u32Width, pScreen->u32Height,
    2135                             pScreen->u32LineSize,  pScreen->u16BitsPerPixel, pScreen->u16Flags));
    2136 
    2137             if (   pScreen->u32ViewIndex < RT_ELEMENTS (pCtx->aViews)
    2138                 && pScreen->u16BitsPerPixel <= 32
    2139                 && pScreen->u32Width <= UINT16_MAX
    2140                 && pScreen->u32Height <= UINT16_MAX
    2141                 && pScreen->u32LineSize <= UINT16_MAX * 4
    2142                 && offEnd < pView->u32MaxScreenSize)
    2143             {
    2144                 vbvaResize (pVGAState, &pCtx->aViews[pScreen->u32ViewIndex], pScreen);
    2145             }
    2146             else
    2147             {
    2148                 LogRelFlow(("VBVA_INFO_SCREEN [%lu]: bad data: %lux%lu, line 0x%lx, BPP %u, start offset %lu, max screen size %lu\n",
    2149                             (unsigned long)pScreen->u32ViewIndex,
    2150                             (unsigned long)pScreen->u32Width,
    2151                             (unsigned long)pScreen->u32Height,
    2152                             (unsigned long)pScreen->u32LineSize,
    2153                             (unsigned long)pScreen->u16BitsPerPixel,
    2154                             (unsigned long)pScreen->u32StartOffset,
    2155                             (unsigned long)pView->u32MaxScreenSize));
    2156                 rc = VERR_INVALID_PARAMETER;
    2157             }
     2175            VBVAINFOSCREEN Screen = *pScreen;
     2176            rc = VBVAInfoScreen(pVGAState, &Screen);
    21582177        } break;
    21592178
     
    24422461    pVGAState->pHGSMI = NULL;
    24432462}
    2444 
    2445 int VBVAGetScreenInfo(PVGASTATE pVGAState, unsigned uScreenId, struct VBVAINFOSCREEN *pScreen, void **ppvVram)
    2446 {
    2447     PPDMDEVINS pDevIns = pVGAState->pDevInsR3;
    2448     PHGSMIINSTANCE pIns = pVGAState->pHGSMI;
    2449     VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns);
    2450     int rc = PDMCritSectEnter(&pVGAState->CritSect, VERR_SEM_BUSY);
    2451     if (RT_SUCCESS(rc))
    2452     {
    2453         if (uScreenId < pCtx->cViews)
    2454         {
    2455             VBVAVIEW *pView = &pCtx->aViews[uScreenId];
    2456             if (pView->pVBVA)
    2457             {
    2458                 uint8_t *pu8VRAM = pVGAState->vram_ptrR3 + pView->view.u32ViewOffset;
    2459                 *pScreen = pView->screen;
    2460                 *ppvVram = (void*)pu8VRAM;
    2461                 rc = VINF_SUCCESS;
    2462             }
    2463             else
    2464             {
    2465                 /* pretend disabled */
    2466                 memset(pScreen, 0, sizeof (*pScreen));
    2467                 pScreen->u16Flags = VBVA_SCREEN_F_DISABLED;
    2468                 pScreen->u32ViewIndex = uScreenId;
    2469                 *ppvVram = NULL;
    2470                 rc = VINF_SUCCESS;
    2471             }
    2472         }
    2473         else
    2474             rc = VERR_INVALID_PARAMETER;
    2475 
    2476         PDMCritSectLeave(&pVGAState->CritSect);
    2477     }
    2478     return rc;
    2479 }
  • trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp

    r51111 r51121  
    109109    VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED,
    110110    VBVAEXHOSTCTL_TYPE_GHH_DISABLE,
    111     VBVAEXHOSTCTL_TYPE_GH_MIN = VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE,
    112     VBVAEXHOSTCTL_TYPE_GH_MAX = VBVAEXHOSTCTL_TYPE_GHH_DISABLE
     111    VBVAEXHOSTCTL_TYPE_GHH_RESIZE
    113112} VBVAEXHOSTCTL_TYPE;
    114113
     
    615614static int vboxVBVAExHSSaveGuestCtl(struct VBVAEXHOSTCONTEXT *pCmdVbva, VBVAEXHOSTCTL* pCtl, uint8_t* pu8VramBase, PSSMHANDLE pSSM)
    616615{
    617     if (VBVAEXHOSTCTL_TYPE_GH_MIN > pCtl->enmType || VBVAEXHOSTCTL_TYPE_GH_MAX < pCtl->enmType)
    618     {
    619         WARN(("unexpected command type!\n"));
    620         return VERR_INTERNAL_ERROR;
    621     }
    622 
    623616    int rc = SSMR3PutU32(pSSM, pCtl->enmType);
    624617    AssertRCReturn(rc, rc);
     
    681674    if (!u32)
    682675        return VINF_EOF;
    683 
    684     if (VBVAEXHOSTCTL_TYPE_GH_MIN > u32 || VBVAEXHOSTCTL_TYPE_GH_MAX < u32)
    685     {
    686         WARN(("unexpected command type!\n"));
    687         return VERR_INTERNAL_ERROR;
    688     }
    689676
    690677    VBVAEXHOSTCTL* pHCtl = VBoxVBVAExHCtlCreate(pCmdVbva, (VBVAEXHOSTCTL_TYPE)u32);
     
    13361323        }
    13371324        case VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE:
     1325        {
    13381326            if (!VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva))
    13391327            {
     
    13421330            }
    13431331            return pVdma->CrSrvInfo.pfnHostCtl(pVdma->CrSrvInfo.hSvr, pCmd->u.cmd.pu8Cmd, pCmd->u.cmd.cbCmd);
     1332        }
    13441333        case VBVAEXHOSTCTL_TYPE_GHH_DISABLE:
    13451334        {
     
    13831372    switch (enmType)
    13841373    {
    1385        case VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE:
    1386            if (!VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva))
    1387            {
    1388                WARN(("VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE for disabled vdma VBVA\n"));
    1389                return VERR_INVALID_STATE;
    1390            }
    1391            return pVdma->CrSrvInfo.pfnGuestCtl(pVdma->CrSrvInfo.hSvr, pCmd->u.cmd.pu8Cmd, pCmd->u.cmd.cbCmd);
     1374        case VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE:
     1375        {
     1376            if (!VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva))
     1377            {
     1378                WARN(("VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE for disabled vdma VBVA\n"));
     1379                return VERR_INVALID_STATE;
     1380            }
     1381            return pVdma->CrSrvInfo.pfnGuestCtl(pVdma->CrSrvInfo.hSvr, pCmd->u.cmd.pu8Cmd, pCmd->u.cmd.cbCmd);
     1382        }
     1383        case VBVAEXHOSTCTL_TYPE_GHH_RESIZE:
     1384        {
     1385            if (!VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva))
     1386            {
     1387                WARN(("VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE for disabled vdma VBVA\n"));
     1388                return VERR_INVALID_STATE;
     1389            }
     1390
     1391            uint32_t cbCmd = pCmd->u.cmd.cbCmd;
     1392
     1393            if (cbCmd % sizeof (VBOXCMDVBVA_RESIZE_ENTRY))
     1394            {
     1395                WARN(("invalid buffer size\n"));
     1396                return VERR_INVALID_PARAMETER;
     1397            }
     1398
     1399            uint32_t cElements = cbCmd / sizeof (VBOXCMDVBVA_RESIZE_ENTRY);
     1400            if (!cElements)
     1401            {
     1402                WARN(("invalid buffer size\n"));
     1403                return VERR_INVALID_PARAMETER;
     1404            }
     1405
     1406            VBOXCMDVBVA_RESIZE *pResize = (VBOXCMDVBVA_RESIZE*)pCmd->u.cmd.pu8Cmd;
     1407            PVGASTATE pVGAState = pVdma->pVGAState;
     1408            int rc = VINF_SUCCESS;
     1409
     1410            for (uint32_t i = 0; i < cElements; ++i)
     1411            {
     1412                VBOXCMDVBVA_RESIZE_ENTRY *pEntry = &pResize->aEntries[i];
     1413                VBVAINFOSCREEN Screen = pEntry->Screen;
     1414                VBVAINFOVIEW View;
     1415                uint32_t u32StartOffsetPreserve = 0;
     1416                if (Screen.u32StartOffset == ~0UL)
     1417                {
     1418                    if (Screen.u16Flags & VBVA_SCREEN_F_DISABLED)
     1419                    {
     1420                        u32StartOffsetPreserve = ~0UL;
     1421                        Screen.u32StartOffset = 0;
     1422                    }
     1423                    else
     1424                    {
     1425                        WARN(("invalid parameter\n"));
     1426                        rc = VERR_INVALID_PARAMETER;
     1427                        break;
     1428                    }
     1429                }
     1430
     1431
     1432                View.u32ViewIndex = Screen.u32ViewIndex;
     1433                View.u32ViewOffset = 0;
     1434                View.u32ViewSize = Screen.u32LineSize * Screen.u32Height + Screen.u32StartOffset;
     1435                View.u32MaxScreenSize = View.u32ViewSize + Screen.u32Width + 1; /* <- make VBVAInfoScreen logic (offEnd < pView->u32MaxScreenSize) happy */
     1436
     1437                int rc = VBVAInfoView(pVGAState, &View);
     1438                if (RT_SUCCESS(rc))
     1439                {
     1440
     1441                    rc = VBVAInfoScreen(pVGAState, &Screen);
     1442                    if (RT_SUCCESS(rc))
     1443                    {
     1444                        if (u32StartOffsetPreserve)
     1445                            Screen.u32StartOffset = u32StartOffsetPreserve;
     1446
     1447                        rc = pVdma->CrSrvInfo.pfnResize(pVdma->CrSrvInfo.hSvr, &Screen, u32StartOffsetPreserve ? NULL : pVGAState->vram_ptrR3 + Screen.u32StartOffset);
     1448                        if (RT_SUCCESS(rc))
     1449                            continue;
     1450                        else
     1451                        {
     1452                            WARN(("pfnResize failed %d\n", rc));
     1453                            break;
     1454                        }
     1455                    }
     1456                    else
     1457                    {
     1458                        WARN(("VBVAInfoScreen failed %d\n", rc));
     1459                        break;
     1460                    }
     1461                }
     1462                else
     1463                {
     1464                    WARN(("VBVAInfoView failed %d\n", rc));
     1465                    break;
     1466                }
     1467            }
     1468            return rc;
     1469        }
    13921470        case VBVAEXHOSTCTL_TYPE_GHH_ENABLE:
    13931471        case VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED:
     
    26452723}
    26462724
    2647 static int vdmaVBVACtlOpaqueSubmit(PVBOXVDMAHOST pVdma, VBVAEXHOSTCTL_SOURCE enmSource, uint8_t* pu8Cmd, uint32_t cbCmd, PFNVBVAEXHOSTCTL_COMPLETE pfnComplete, void *pvComplete)
    2648 {
    2649     VBVAEXHOSTCTL* pHCtl = VBoxVBVAExHCtlCreate(&pVdma->CmdVbva, VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE);
     2725static int vdmaVBVACtlGenericSubmit(PVBOXVDMAHOST pVdma, VBVAEXHOSTCTL_SOURCE enmSource, VBVAEXHOSTCTL_TYPE enmType, uint8_t* pu8Cmd, uint32_t cbCmd, PFNVBVAEXHOSTCTL_COMPLETE pfnComplete, void *pvComplete)
     2726{
     2727    VBVAEXHOSTCTL* pHCtl = VBoxVBVAExHCtlCreate(&pVdma->CmdVbva, enmType);
    26502728    if (!pHCtl)
    26512729    {
     
    26662744}
    26672745
    2668 static int vdmaVBVACtlOpaqueGuestSubmit(PVBOXVDMAHOST pVdma, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl)
     2746static int vdmaVBVACtlGenericGuestSubmit(PVBOXVDMAHOST pVdma, VBVAEXHOSTCTL_TYPE enmType, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl)
    26692747{
    26702748    Assert(cbCtl >= sizeof (VBOXCMDVBVA_CTL));
    26712749    VBoxSHGSMICommandMarkAsynchCompletion(pCtl);
    2672     int rc = vdmaVBVACtlOpaqueSubmit(pVdma, VBVAEXHOSTCTL_SOURCE_GUEST, (uint8_t*)(pCtl+1), cbCtl - sizeof (VBOXCMDVBVA_CTL), vboxCmdVBVACmdCtlGuestCompletion, pVdma);
     2750    int rc = vdmaVBVACtlGenericSubmit(pVdma, VBVAEXHOSTCTL_SOURCE_GUEST, enmType, (uint8_t*)(pCtl+1), cbCtl - sizeof (VBOXCMDVBVA_CTL), vboxCmdVBVACmdCtlGuestCompletion, pVdma);
    26732751    if (RT_SUCCESS(rc))
    26742752        return VINF_SUCCESS;
    26752753
    2676     WARN(("vdmaVBVACtlOpaqueSubmit failed %d\n", rc));
     2754    WARN(("vdmaVBVACtlGenericSubmit failed %d\n", rc));
    26772755    pCtl->i32Result = rc;
    26782756    rc = VBoxSHGSMICommandComplete(pVdma->pHgsmi, pCtl);
     
    26942772{
    26952773    pCmd->u.pfnInternal = (void(*)())pfnCompletion;
    2696     int rc = vdmaVBVACtlOpaqueSubmit(pVdma, VBVAEXHOSTCTL_SOURCE_HOST, (uint8_t*)pCmd, cbCmd, vboxCmdVBVACmdCtlHostCompletion, pvCompletion);
     2774    int rc = vdmaVBVACtlGenericSubmit(pVdma, VBVAEXHOSTCTL_SOURCE_HOST, VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE, (uint8_t*)pCmd, cbCmd, vboxCmdVBVACmdCtlHostCompletion, pvCompletion);
    26972775    if (RT_FAILURE(rc))
    26982776    {
     
    27072785            return rc;
    27082786        }
    2709         WARN(("vdmaVBVACtlOpaqueSubmit failed %d\n", rc));
     2787        WARN(("vdmaVBVACtlGenericSubmit failed %d\n", rc));
    27102788        return rc;
    27112789    }
    27122790
     2791    return VINF_SUCCESS;
     2792}
     2793
     2794static DECLCALLBACK(int) vdmaVBVANotifyEnable(PVGASTATE pVGAState)
     2795{
     2796    for (uint32_t i = 0; i < pVGAState->cMonitors; i++)
     2797    {
     2798        int rc = pVGAState->pDrv->pfnVBVAEnable (pVGAState->pDrv, i, NULL, true);
     2799        if (!RT_SUCCESS(rc))
     2800        {
     2801            WARN(("pfnVBVAEnable failed %d\n", rc));
     2802            for (uint32_t j = 0; j < i; j++)
     2803            {
     2804                pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, j);
     2805            }
     2806
     2807            return rc;
     2808        }
     2809    }
     2810    return VINF_SUCCESS;
     2811}
     2812
     2813static DECLCALLBACK(int) vdmaVBVANotifyDisable(PVGASTATE pVGAState)
     2814{
     2815    for (uint32_t i = 0; i < pVGAState->cMonitors; i++)
     2816    {
     2817        pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, i);
     2818    }
    27132819    return VINF_SUCCESS;
    27142820}
     
    27222828    {
    27232829        rc = vboxVDMACrGuestCtlProcess(pVdma, pHCtl);
    2724         if (RT_FAILURE(rc))
     2830        /* rc == VINF_SUCCESS would mean the actual state change has occcured */
     2831        if (rc == VINF_SUCCESS)
     2832        {
     2833            /* we need to inform Main about VBVA enable/disable
     2834             * main expects notifications to be done from the main thread
     2835             * submit it there */
     2836            PVGASTATE pVGAState = pVdma->pVGAState;
     2837
     2838            if (VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva))
     2839                vdmaVBVANotifyEnable(pVGAState);
     2840            else
     2841                vdmaVBVANotifyDisable(pVGAState);
     2842        }
     2843        else if (RT_FAILURE(rc))
    27252844            WARN(("vboxVDMACrGuestCtlProcess failed %d\n", rc));
    27262845    }
     
    28232942}
    28242943
    2825 static DECLCALLBACK(int) vdmaVBVANotifyEnable(PVGASTATE pVGAState)
    2826 {
    2827     for (uint32_t i = 0; i < pVGAState->cMonitors; i++)
    2828     {
    2829         int rc = pVGAState->pDrv->pfnVBVAEnable (pVGAState->pDrv, i, NULL);
    2830         if (!RT_SUCCESS(rc))
    2831         {
    2832             WARN(("pfnVBVAEnable failed %d\n", rc));
    2833             for (uint32_t j = 0; j < i; j++)
    2834             {
    2835                 pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, j);
    2836             }
    2837 
    2838             return rc;
    2839         }
    2840     }
    2841     return VINF_SUCCESS;
    2842 }
    2843 
    2844 static DECLCALLBACK(int) vdmaVBVANotifyDisable(PVGASTATE pVGAState)
    2845 {
    2846     for (uint32_t i = 0; i < pVGAState->cMonitors; i++)
    2847     {
    2848         pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, i);
    2849     }
    2850     return VINF_SUCCESS;
    2851 }
    2852 
    2853 static DECLCALLBACK(void) vboxCmdVBVACmdCtlGuestEnableDisableCompletion(VBVAEXHOSTCONTEXT *pVbva, struct VBVAEXHOSTCTL *pCtl, int rc, void *pvContext)
    2854 {
    2855     if (rc == VINF_SUCCESS)
    2856     {
    2857         /* we need to inform Main about VBVA enable/disable
    2858          * main expects notifications to be done from the main thread
    2859          * submit it there */
    2860         PVBOXVDMAHOST pVdma = RT_FROM_MEMBER(pVbva, VBOXVDMAHOST, CmdVbva);
    2861         PVGASTATE pVGAState = pVdma->pVGAState;
    2862 
    2863         if (VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva))
    2864             VMR3ReqCallNoWait(PDMDevHlpGetVM(pVGAState->pDevInsR3), VMCPUID_ANY, (PFNRT)vdmaVBVANotifyEnable, 1, pVGAState);
    2865         else
    2866             VMR3ReqCallNoWait(PDMDevHlpGetVM(pVGAState->pDevInsR3), VMCPUID_ANY, (PFNRT)vdmaVBVANotifyDisable, 1, pVGAState);
    2867     }
    2868 
    2869     vboxCmdVBVACmdCtlGuestCompletion(pVbva, pCtl, rc, pvContext);
    2870 }
    2871 
    28722944static int vdmaVBVACtlEnableDisableSubmitInternal(PVBOXVDMAHOST pVdma, VBVAENABLE *pEnable, PFNVBVAEXHOSTCTL_COMPLETE pfnComplete, void *pvComplete)
    28732945{
     
    28812953{
    28822954    VBoxSHGSMICommandMarkAsynchCompletion(&pEnable->Hdr);
    2883     int rc = vdmaVBVACtlEnableDisableSubmitInternal(pVdma, &pEnable->Enable, vboxCmdVBVACmdCtlGuestEnableDisableCompletion, pVdma);
     2955    int rc = vdmaVBVACtlEnableDisableSubmitInternal(pVdma, &pEnable->Enable, vboxCmdVBVACmdCtlGuestCompletion, pVdma);
    28842956    if (RT_SUCCESS(rc))
    28852957        return VINF_SUCCESS;
     
    30453117    {
    30463118        case VBOXCMDVBVACTL_TYPE_3DCTL:
    3047             return vdmaVBVACtlOpaqueGuestSubmit(pVdma, pCtl, cbCtl);
     3119            return vdmaVBVACtlGenericGuestSubmit(pVdma, VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE, pCtl, cbCtl);
     3120        case VBOXCMDVBVACTL_TYPE_RESIZE:
     3121            return vdmaVBVACtlGenericGuestSubmit(pVdma, VBVAEXHOSTCTL_TYPE_GHH_RESIZE, pCtl, cbCtl);
    30483122        case VBOXCMDVBVACTL_TYPE_ENABLE:
    30493123            if (cbCtl != sizeof (VBOXCMDVBVA_CTL_ENABLE))
     
    32153289        Assert(pVdma->CmdVbva.i32State == VBVAEXHOSTCONTEXT_ESTATE_PAUSED);
    32163290
    3217         vdmaVBVANotifyEnable(pVdma->pVGAState);
    3218 
    32193291        VBVAEXHOSTCTL HCtl;
    32203292        HCtl.enmType = VBVAEXHOSTCTL_TYPE_HH_LOADSTATE;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r51111 r51121  
    473473int8_t crVBoxServerCrCmdFlipProcess(const VBOXCMDVBVA_FLIP *pFlip);
    474474
     475int crVBoxServerResizeScreen(const struct VBVAINFOSCREEN *pScreen, void *pvVRAM);
     476
    475477//#define VBOX_WITH_CRSERVER_DUMPER
    476478#ifdef VBOX_WITH_CRSERVER_DUMPER
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r51111 r51121  
    35693569}
    35703570
     3571static DECLCALLBACK(int) crVBoxCrCmdResize(HVBOXCRCMDSVR hSvr, const struct VBVAINFOSCREEN *pScreen, void *pvVRAM)
     3572{
     3573    CRASSERT(cr_server.fCrCmdEnabled);
     3574    return crVBoxServerResizeScreen(pScreen, pvVRAM);
     3575}
     3576
    35713577static const char* gszVBoxOGLSSMMagic = "***OpenGL state data***";
    35723578
     
    41954201            pSetup->CrCmdServerInfo.pfnHostCtl = crVBoxCrCmdHostCtl;
    41964202            pSetup->CrCmdServerInfo.pfnGuestCtl = crVBoxCrCmdGuestCtl;
     4203            pSetup->CrCmdServerInfo.pfnResize = crVBoxCrCmdResize;
    41974204            pSetup->CrCmdServerInfo.pfnSaveState = crVBoxCrCmdSaveState;
    41984205            pSetup->CrCmdServerInfo.pfnLoadState = crVBoxCrCmdLoadState;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.cpp

    r50754 r51121  
    395395
    396396
    397 static int crVBoxServerResizeScreen(const struct VBVAINFOSCREEN *pScreen, void *pvVRAM)
     397int crVBoxServerResizeScreen(const struct VBVAINFOSCREEN *pScreen, void *pvVRAM)
    398398{
    399399    int rc;
     
    431431DECLEXPORT(int) crVBoxServerNotifyResize(const struct VBVAINFOSCREEN *pScreen, void *pvVRAM)
    432432{
     433    if (cr_server.fCrCmdEnabled)
     434    {
     435        WARN(("crVBoxServerNotifyResize for enabled CrCmd"));
     436        return VERR_INVALID_STATE;
     437    }
     438
    433439    int rc = crVBoxServerResizeScreen(pScreen, pvVRAM);
    434440    if (!RT_SUCCESS(rc))
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp

    r51112 r51121  
    12421242    return pFbTex;
    12431243}
    1244 
    12451244
    12461245CR_TEXDATA* CrFbTexDataCreate(const VBOXVR_TEXTURE *pTex)
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r51013 r51121  
    9898    bool fVBVAEnabled;
    9999    bool fVBVAForceResize;
     100    bool fRenderThreadMode;
    100101    uint32_t cVBVASkipUpdate;
    101102    struct
     
    280281#endif
    281282#ifdef VBOX_WITH_HGSMI
    282     static DECLCALLBACK(int)   displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags);
     283    static DECLCALLBACK(int)   displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode);
    283284    static DECLCALLBACK(void)  displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
    284285    static DECLCALLBACK(void)  displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r51095 r51121  
    638638        maFramebuffers[ul].fVBVAEnabled = false;
    639639        maFramebuffers[ul].fVBVAForceResize = false;
     640        maFramebuffers[ul].fRenderThreadMode = false;
    640641        maFramebuffers[ul].cVBVASkipUpdate = 0;
    641642        RT_ZERO(maFramebuffers[ul].vbvaSkippedRect);
     
    872873{
    873874#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     875    if (maFramebuffers[pScreen->u32ViewIndex].fRenderThreadMode)
     876        return VINF_SUCCESS; /* nop it */
     877
    874878    BOOL is3denabled;
    875879    mParent->machine()->COMGETTER(Accelerate3DEnabled)(&is3denabled);
     
    45874591
    45884592#ifdef VBOX_WITH_HGSMI
    4589 DECLCALLBACK(int) Display::displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags)
     4593DECLCALLBACK(int) Display::displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode)
    45904594{
    45914595    LogRelFlowFunc(("uScreenId %d\n", uScreenId));
     
    45944598    Display *pThis = pDrv->pDisplay;
    45954599
     4600    if (pThis->maFramebuffers[uScreenId].fVBVAEnabled && pThis->maFramebuffers[uScreenId].fRenderThreadMode != fRenderThreadMode)
     4601    {
     4602        LogRel(("enabling different vbva mode"));
     4603#ifdef DEBUG_misha
     4604        AssertMsgFailed(("enabling different vbva mode"));
     4605#endif
     4606        return VERR_INVALID_STATE;
     4607    }
     4608
    45964609    pThis->maFramebuffers[uScreenId].fVBVAEnabled = true;
    45974610    pThis->maFramebuffers[uScreenId].pVBVAHostFlags = pHostFlags;
     4611    pThis->maFramebuffers[uScreenId].fRenderThreadMode = fRenderThreadMode;
    45984612    pThis->maFramebuffers[uScreenId].fVBVAForceResize = true;
    45994613
     
    46304644    pFBInfo->fVBVAEnabled = false;
    46314645    pFBInfo->fVBVAForceResize = false;
     4646    pFBInfo->fRenderThreadMode = false;
    46324647
    46334648    vbvaSetMemoryFlagsHGSMI(uScreenId, 0, false, pFBInfo);
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