Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h	(revision 22835)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h	(revision 22836)
@@ -965,4 +965,6 @@
 };
 
+#define VBOXVHWACMDPIPEC_NEWEVENT      0x00000001
+#define VBOXVHWACMDPIPEC_COMPLETEEVENT 0x00000002
 class VBoxVHWACommandElementProcessor
 {
@@ -970,5 +972,6 @@
     VBoxVHWACommandElementProcessor(class VBoxConsoleView *aView);
     ~VBoxVHWACommandElementProcessor();
-    void postCmd(VBOXVHWA_PIPECMD_TYPE aType, void * pvData);
+    void postCmd(VBOXVHWA_PIPECMD_TYPE aType, void * pvData, uint32_t flags);
+    void completeCurrentEvent();
     class VBoxVHWACommandElement * detachCmdList(class VBoxVHWACommandElement * pFirst2Free, VBoxVHWACommandElement * pLast2Free);
 
@@ -1185,4 +1188,17 @@
                              ULONG aW, ULONG aH);
 
+    /**
+     * to be called on RequestResize framebuffer call
+     * @return true if the request was processed & should not be forwarded to the framebuffer
+     * false - otherwise */
+    bool onRequestResize (ULONG aScreenId, ULONG aPixelFormat,
+                              BYTE *aVRAM, ULONG aBitsPerPixel, ULONG aBytesPerLine,
+                              ULONG aWidth, ULONG aHeight,
+                              BOOL *aFinished)
+    {
+        mCmdPipe.completeCurrentEvent();
+        return false;
+    }
+
     VBOXFBOVERLAY_RESUT onPaintEvent (const QPaintEvent *pe, QRect *pRect);
     void onResizeEvent (const class VBoxResizeEvent *re);
@@ -1308,4 +1324,22 @@
     }
 
+    STDMETHOD(RequestResize) (ULONG aScreenId, ULONG aPixelFormat,
+                              BYTE *aVRAM, ULONG aBitsPerPixel, ULONG aBytesPerLine,
+                              ULONG aWidth, ULONG aHeight,
+                              BOOL *aFinished)
+   {
+        if(mOverlay.onRequestResize (aScreenId, aPixelFormat,
+                aVRAM, aBitsPerPixel, aBytesPerLine,
+                aWidth, aHeight,
+                aFinished))
+        {
+            return S_OK;
+        }
+        return T::RequestResize (aScreenId, aPixelFormat,
+                aVRAM, aBitsPerPixel, aBytesPerLine,
+                aWidth, aHeight,
+                aFinished);
+   }
+
     STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
                              ULONG aW, ULONG aH)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp	(revision 22835)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp	(revision 22836)
@@ -3403,5 +3403,7 @@
 //            Assert(mbVGASurfCreated);
             mDisplay.getVGA()->getComplexList()->add(surf);
+#ifdef DEBUG_misha
             Assert(pCmd->SurfInfo.surfCaps & VBOXVHWA_SCAPS_VISIBLE);
+#endif
 //            if(pCmd->SurfInfo.surfCaps & VBOXVHWA_SCAPS_VISIBLE)
             {
@@ -3747,6 +3749,8 @@
         vboxCheckUpdateAddress (pDstSurf, pCmd->u.in.offDstSurface);
         VBOXQGLLOG(("pDstSurf (0x%x)\n",pDstSurf));
+#ifdef DEBUG_misha
         Assert(pDstSurf == mDisplay.getVGA());
         Assert(mDisplay.getVGA() == mDisplay.getPrimary());
+#endif
         Assert(pDstSurf->getComplexList() == mDisplay.getVGA()->getComplexList());
 
@@ -5100,14 +5104,21 @@
 int VBoxQGLOverlay::onVHWACommand(struct _VBOXVHWACMD * pCmd)
 {
-//    Assert(0);
-//    VBOXVHWACMD * pCmd = (VBOXVHWACMD*)pCommand;
+    uint32_t flags = 0;
+    switch(pCmd->enmCmd)
+    {
+        case VBOXVHWACMD_TYPE_SURF_FLIP:
+        case VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE:
+        case VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION:
+            flags |= VBOXVHWACMDPIPEC_COMPLETEEVENT;
+            break;
+        default:
+            break;
+    }//    Assert(0);
     /* indicate that we process and complete the command asynchronously */
     pCmd->Flags |= VBOXVHWACMD_FLAG_HG_ASYNCH;
-    /* post the command to the GUI thread for processing */
-//    QApplication::postEvent (mView,
-//                             new VBoxVHWACommandProcessEvent (pCmd));
-    mCmdPipe.postCmd(VBOXVHWA_PIPECMD_VHWA, pCmd);
+
+    mCmdPipe.postCmd(VBOXVHWA_PIPECMD_VHWA, pCmd, flags);
     return VINF_SUCCESS;
-//    return E_NOTIMPL;
+
 }
 
@@ -5138,5 +5149,5 @@
 #if 1
     QRect r(aX, aY, aW, aH);
-    mCmdPipe.postCmd(VBOXVHWA_PIPECMD_PAINT, &r);
+    mCmdPipe.postCmd(VBOXVHWA_PIPECMD_PAINT, &r, 0);
     return true;
 #else
@@ -5645,5 +5656,12 @@
 }
 
-void VBoxVHWACommandElementProcessor::postCmd(VBOXVHWA_PIPECMD_TYPE aType, void * pvData)
+void VBoxVHWACommandElementProcessor::completeCurrentEvent()
+{
+    RTCritSectEnter(&mCritSect);
+    mbNewEvent = true;
+    RTCritSectLeave(&mCritSect);
+}
+
+void VBoxVHWACommandElementProcessor::postCmd(VBOXVHWA_PIPECMD_TYPE aType, void * pvData, uint32_t flags)
 {
     /* 1. lock*/
@@ -5661,4 +5679,10 @@
     }
     pCmd->setData(aType, pvData);
+
+    if((flags & VBOXVHWACMDPIPEC_NEWEVENT) != 0)
+    {
+        mbNewEvent = true;
+    }
+
     /* 2. if can add to current*/
     if(!mbNewEvent)
@@ -5670,4 +5694,8 @@
             mpLastEvent->pipe().put(pCmd);
             /* 3.b unlock and return */
+            if((flags & VBOXVHWACMDPIPEC_COMPLETEEVENT) != 0)
+            {
+                mbNewEvent = true;
+            }
             RTCritSectLeave(&mCritSect);
             return;
@@ -5680,4 +5708,6 @@
     /* 5. create & initialize new Event */
     VBoxVHWACommandProcessEvent *pCurrentEvent = new VBoxVHWACommandProcessEvent(pCmd);
+    pCurrentEvent->mpNext = NULL;
+
     /* 6. lock */
     RTCritSectEnter(&mCritSect);
@@ -5688,5 +5718,4 @@
         mpFirstEvent = pCurrentEvent;
         mpLastEvent = pCurrentEvent;
-        pCurrentEvent->mpNext = NULL;
     }
     else
@@ -5696,5 +5725,5 @@
     }
     /* 8. reset blocking events counter */
-    mbNewEvent = false;
+    mbNewEvent = ((flags & VBOXVHWACMDPIPEC_COMPLETEEVENT) != 0);
     /* 9. unlock */
     RTCritSectLeave(&mCritSect);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQGL.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQGL.cpp	(revision 22835)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQGL.cpp	(revision 22836)
@@ -79,5 +79,5 @@
 #else
     QRect r(aX, aY, aW, aH);
-    mCmdPipe.postCmd(VBOXVHWA_PIPECMD_PAINT, &r);
+    mCmdPipe.postCmd(VBOXVHWA_PIPECMD_PAINT, &r, 0);
 #endif
     return S_OK;
@@ -162,5 +162,5 @@
 //    QApplication::postEvent (mView,
 //                             new VBoxVHWACommandProcessEvent (pCmd));
-    mCmdPipe.postCmd(VBOXVHWA_PIPECMD_VHWA, pCmd);
+    mCmdPipe.postCmd(VBOXVHWA_PIPECMD_VHWA, pCmd, 0);
     return S_OK;
 }
