VirtualBox

Changeset 66400 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Apr 3, 2017 1:54:44 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
114352
Message:

Main: bugref:8783: fixes for the new resizing code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r66396 r66400  
    922922int Display::i_handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM,
    923923                                   uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags,
    924                                    uint32_t xOrigin, uint32_t yOrigin, bool fVGAResize)
     924                                   int32_t xOrigin, int32_t yOrigin, bool fVGAResize)
    925925#endif
    926926{
     
    10201020    AssertReturn(!isWriteLockOnCurrentThread(), VERR_INVALID_STATE);
    10211021
     1022    /* Note: the old code checked if the video mode was actially chnaged and
     1023     * did not invalidate the source bitmap if the mode did not change.
     1024     * The new code always invalidates the source bitmap, i.e. it will
     1025     * notify the frontend even if nothing actually changed.
     1026     *
     1027     * Implementing the filtering is possible but might lead to pfnSetRenderVRAM races
     1028     * between this method and QuerySourceBitmap. Such races can be avoided by implementing
     1029     * the @todo below.
     1030     */
     1031
    10221032    /* Make sure that the VGA device does not access the source bitmap. */
    10231033    if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN && mpDrv)
    10241034    {
     1035        /// @todo It is probably more convenient to implement
     1036        // mpDrv->pUpPort->pfnSetOutputBitmap(pvVRAM, cbScanline, cBits, cx, cy, bool fSet);
     1037        // and remove IConnector.pbData, cbScanline, cBits, cx, cy.
     1038        // fSet = false disables rendering and VGA can check
     1039        // if it is already rendering to a different bitmap, avoiding
     1040        // enable/disable rendering races.
    10251041        mpDrv->pUpPort->pfnSetRenderVRAM(mpDrv->pUpPort, false);
    10261042
     
    10391055
    10401056    DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
     1057
     1058    /* Whether the monitor position has changed.
     1059     * A resize initiated by the VGA device does not change the monitor position.
     1060     */
     1061    const bool fNewOrigin =    !fVGAResize
     1062                            && (   pFBInfo->xOrigin != xOrigin
     1063                                || pFBInfo->yOrigin != yOrigin);
     1064
     1065    /* The event for disabled->enabled transition.
     1066     * VGA resizes also come when the guest uses VBVA mode. They do not affect pFBInfo->fDisabled.
     1067     * The primary screen is re-enabled when the guest leaves the VBVA mode in i_displayVBVADisable.
     1068     */
     1069    const bool fGuestMonitorChangedEvent =   !fVGAResize
     1070                                          && (pFBInfo->fDisabled != RT_BOOL(flags & VBVA_SCREEN_F_DISABLED));
    10411071
    10421072    /* Reset the update mode. */
     
    10541084    pFBInfo->pu8FramebufferVRAM = (uint8_t *)pvVRAM;
    10551085    pFBInfo->u32LineSize = cbLine;
    1056     pFBInfo->flags = flags;
    10571086    if (!fVGAResize)
    10581087    {
     1088        /* Fields which are not used in not VBVA modes and not affected by a VGA resize. */
     1089        pFBInfo->flags = flags;
    10591090        pFBInfo->xOrigin = xOrigin;
    10601091        pFBInfo->yOrigin = yOrigin;
     
    10651096    /* Prepare local vars for the notification code below. */
    10661097    ComPtr<IFramebuffer> pFramebuffer = pFBInfo->pFramebuffer;
     1098    const bool fDisabled = pFBInfo->fDisabled;
    10671099
    10681100    alock.release();
     
    10741106        NOREF(hr);
    10751107    }
     1108
     1109    if (fGuestMonitorChangedEvent)
     1110    {
     1111        if (fDisabled)
     1112            fireGuestMonitorChangedEvent(mParent->i_getEventSource(),
     1113                                         GuestMonitorChangedEventType_Disabled,
     1114                                         uScreenId,
     1115                                         0, 0, 0, 0);
     1116        else
     1117            fireGuestMonitorChangedEvent(mParent->i_getEventSource(),
     1118                                         GuestMonitorChangedEventType_Enabled,
     1119                                         uScreenId,
     1120                                         xOrigin, yOrigin, w, h);
     1121    }
     1122
     1123    if (fNewOrigin)
     1124        fireGuestMonitorChangedEvent(mParent->i_getEventSource(),
     1125                                     GuestMonitorChangedEventType_NewOrigin,
     1126                                     uScreenId,
     1127                                     xOrigin, yOrigin, 0, 0);
    10761128
    10771129    /* Inform the VRDP server about the change of display parameters. */
     
    33593411    int rc = pThis->i_handleDisplayResize(VBOX_VIDEO_PRIMARY_SCREEN, bpp, pvVRAM, cbLine, cx, cy, VBVA_SCREEN_F_ACTIVE);
    33603412#else
    3361     int rc = pThis->i_handleDisplayResize(VBOX_VIDEO_PRIMARY_SCREEN, bpp, pvVRAM, cbLine, cx, cy,
    3362                                           VBVA_SCREEN_F_ACTIVE, 0, 0, true);
     3413    int rc = pThis->i_handleDisplayResize(VBOX_VIDEO_PRIMARY_SCREEN, bpp, pvVRAM, cbLine, cx, cy, 0, 0, 0, true);
    33633414#endif
    33643415
     
    41434194         * The guest can't use VBVA anymore, so only only the VGA device output works.
    41444195         */
     4196#ifdef NEW_RESIZE
     4197        pFBInfo->flags = 0;
     4198#endif
    41454199        if (pFBInfo->fDisabled)
    41464200        {
     
    45274581                              u32Width, u32Height, pScreen->u16Flags, xOrigin, yOrigin, false);
    45284582
    4529         fireGuestMonitorChangedEvent(mParent->i_getEventSource(),
    4530                                      GuestMonitorChangedEventType_Disabled,
    4531                                      pScreen->u32ViewIndex,
    4532                                      0, 0, 0, 0);
    45334583        return VINF_SUCCESS;
    45344584    }
     
    45564606    }
    45574607
    4558     /* Resize if VBVA was just enabled or display was in disabled state.
    4559      * Also if there is no framebuffer, a resize will be required, because the framebuffer was/will be changed.
    4560      */
    4561     bool fResize = pFBInfo->fVBVAForceResize || pFBInfo->fDisabled || pFBInfo->pFramebuffer.isNull();
    4562 
    4563     /* If the screen blanked state is changing, then do a resize request to make sure that the framebuffer
    4564      * is notified and requests a new source bitmap.
    4565      */
    4566     fResize = fResize || RT_BOOL((pScreen->u16Flags ^ pFBInfo->flags) & VBVA_SCREEN_F_BLANK);
    4567 
    4568     /* Check if this is a real resize or a notification about the screen origin.
    4569      * The guest uses this VBVAResize call for both.
    4570      */
    4571     fResize =    fResize
    4572               || pFBInfo->u16BitsPerPixel != pScreen->u16BitsPerPixel
    4573               || pFBInfo->pu8FramebufferVRAM != (uint8_t *)pvVRAM + pScreen->u32StartOffset
    4574               || pFBInfo->u32LineSize != pScreen->u32LineSize
    4575               || pFBInfo->w != pScreen->u32Width
    4576               || pFBInfo->h != pScreen->u32Height;
    4577 
    4578     bool fNewOrigin =    pFBInfo->xOrigin != pScreen->i32OriginX
    4579                       || pFBInfo->yOrigin != pScreen->i32OriginY;
    4580 
    4581     /* The event for disabled->enabled transition. */
    4582     const bool fGuestMonitorChangedEvent = pFBInfo->fDisabled;
    4583 
    45844608    if (fResetInputMapping)
    45854609    {
     
    45934617    alock.release();
    45944618
    4595     if (fNewOrigin || fResize)
    4596         i_notifyCroglResize(pView, pScreen, pvVRAM);
    4597 
    4598     if (fGuestMonitorChangedEvent)
    4599         fireGuestMonitorChangedEvent(mParent->i_getEventSource(),
    4600                                      GuestMonitorChangedEventType_Enabled,
    4601                                      pScreen->u32ViewIndex,
    4602                                      pScreen->i32OriginX, pScreen->i32OriginY,
    4603                                      pScreen->u32Width, pScreen->u32Height);
    4604 
    4605     if (fNewOrigin)
    4606         fireGuestMonitorChangedEvent(mParent->i_getEventSource(),
    4607                                      GuestMonitorChangedEventType_NewOrigin,
    4608                                      pScreen->u32ViewIndex,
    4609                                      pScreen->i32OriginX, pScreen->i32OriginY,
    4610                                      0, 0);
    4611 
    4612     if (!fResize)
    4613     {
    4614         /* No parameters of the framebuffer have actually changed. */
    4615         if (fNewOrigin)
    4616         {
    4617             /* VRDP server still need this notification. */
    4618             LogRelFlowFunc(("Calling VRDP\n"));
    4619             mParent->i_consoleVRDPServer()->SendResize();
    4620         }
    4621         return VINF_SUCCESS;
    4622     }
    4623 
    4624     /* Do a regular resize. */
     4619    i_notifyCroglResize(pView, pScreen, pvVRAM);
     4620
    46254621    return i_handleDisplayResize(pScreen->u32ViewIndex, pScreen->u16BitsPerPixel,
    46264622                                 (uint8_t *)pvVRAM + pScreen->u32StartOffset,
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette