- Timestamp:
- Mar 24, 2010 6:37:48 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
r27433 r27682 1090 1090 1091 1091 pBody->pVM = pVM; 1092 pBody->pvVRAM = pVGAState->vram_ptrR3; 1093 pBody->cbVRAM = pVGAState->vram_size; 1092 1094 1093 1095 int rc = vbvaVHWAHHCommandPost(pVGAState, pCmd); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r27206 r27682 756 756 setFrameStyle (QFrame::NoFrame); 757 757 758 #ifdef VBOX_GUI_USE_QGL 758 #ifdef VBOX_GUI_USE_QGLFB 759 759 QWidget *pViewport; 760 760 switch (mode) … … 806 806 switch (mode) 807 807 { 808 #if defined (VBOX_GUI_USE_QGL )808 #if defined (VBOX_GUI_USE_QGLFB) 809 809 case VBoxDefs::QGLMode: 810 810 mFrameBuf = new VBoxQGLFrameBuffer (this); … … 818 818 mFrameBuf = 819 819 #ifdef VBOX_WITH_VIDEOHWACCEL 820 mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQImageFrameBuffer> (this, &mainWnd->session()) : 820 /* these two additional template args is a workaround to this [VBox|UI] duplication 821 * @todo: they are to be removed once VBox stuff is gone */ 822 mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQImageFrameBuffer, VBoxConsoleView, VBoxResizeEvent> (this, viewport(), &mainWnd->session()) : 821 823 #endif 822 824 new VBoxQImageFrameBuffer (this); … … 835 837 mFrameBuf = 836 838 #if defined(VBOX_WITH_VIDEOHWACCEL) && defined(DEBUG_misha) /* not tested yet */ 837 mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxSDLFrameBuffer> (this, &mainWnd->session()) : 839 /* these two additional template args is a workaround to this [VBox|UI] duplication 840 * @todo: they are to be removed once VBox stuff is gone */ 841 mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxSDLFrameBuffer, VBoxConsoleView, VBoxResizeEvent> (this, viewport(), &mainWnd->session()) : 838 842 #endif 839 843 new VBoxSDLFrameBuffer (this); … … 858 862 mFrameBuf = 859 863 #ifdef VBOX_WITH_VIDEOHWACCEL 860 mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer> (this, &mainWnd->session()) : 864 /* these two additional template args is a workaround to this [VBox|UI] duplication 865 * @todo: they are to be removed once VBox stuff is gone */ 866 mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer, VBoxConsoleView, VBoxResizeEvent> (this, viewport(), &mainWnd->session()) : 861 867 #endif 862 868 new VBoxQuartz2DFrameBuffer (this); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
r27006 r27682 1181 1181 } 1182 1182 1183 VBoxVHWASurfaceBase::VBoxVHWASurfaceBase(class VBox GLWidget *aWidget,1183 VBoxVHWASurfaceBase::VBoxVHWASurfaceBase(class VBoxVHWAImage *pImage, 1184 1184 const QSize & aSize, 1185 1185 const QRect & aTargRect, … … 1203 1203 mComplexList(NULL), 1204 1204 mpPrimary(NULL), 1205 m Widget(aWidget),1206 m HGHandle(VBOXVHWA_SURFHANDLE_INVALID)1205 mHGHandle(VBOXVHWA_SURFHANDLE_INVALID), 1206 mpImage(pImage) 1207 1207 #ifdef DEBUG 1208 1208 , … … 1549 1549 1550 1550 #ifdef VBOXVHWA_PROFILE_FPS 1551 m Widget->reportNewFrame();1551 mpImage->reportNewFrame(); 1552 1552 #endif 1553 1553 … … 1892 1892 class VBoxVHWAGlProgramMngr * VBoxVHWASurfaceBase::getGlProgramMngr() 1893 1893 { 1894 return m Widget->vboxVHWAGetGlProgramMngr();1894 return mpImage->vboxVHWAGetGlProgramMngr(); 1895 1895 } 1896 1896 … … 1917 1917 }; 1918 1918 1919 VBoxGLWidget::VBoxGLWidget (CConsole console, QWidget *aParent, VBoxVHWASettings *aSettings) 1920 : QGLWidget (new VBoxGLContext(VBoxGLWidget::vboxGLFormat()), aParent), 1921 mSurfHandleTable(128), /* 128 should be enough */ 1922 mpfnOp(NULL), 1923 mOpContext(NULL), 1924 mPixelFormat(0), 1925 mUsesGuestVRAM(false), 1919 1920 VBoxGLWgt::VBoxGLWgt(VBoxVHWAImage * pImage, 1921 QWidget* parent, const QGLWidget* shareWidget) 1922 1923 : QGLWidget(new VBoxGLContext(shareWidget->format()), parent, shareWidget), 1924 mpImage(pImage) 1925 { 1926 /* work-around to disable done current needed to old ATI drivers on Linux */ 1927 VBoxGLContext *pc = (VBoxGLContext*)context(); 1928 pc->allowDoneCurrent (false); 1929 } 1930 1931 1932 VBoxVHWAImage::VBoxVHWAImage () 1933 : mSurfHandleTable(128), /* 128 should be enough */ 1926 1934 mRepaintNeeded(false), 1927 1935 // mbVGASurfCreated(false), 1928 m_console(console),1929 1936 mConstructingList(NULL), 1930 1937 mcRemaining2Contruct(0), 1931 mSettings( aSettings)1938 mSettings(NULL) 1932 1939 #ifdef VBOXVHWA_PROFILE_FPS 1933 1940 , … … 1941 1948 } 1942 1949 1943 const QGLFormat & VBoxGLWidget::vboxGLFormat() 1950 int VBoxVHWAImage::init(VBoxVHWASettings *aSettings) 1951 { 1952 mSettings = aSettings; 1953 return VINF_SUCCESS; 1954 } 1955 1956 const QGLFormat & VBoxVHWAImage::vboxGLFormat() 1944 1957 { 1945 1958 static QGLFormat vboxFormat = QGLFormat(); … … 1958 1971 } 1959 1972 1960 VBoxGLWidget::~VBoxGLWidget() 1973 1974 VBoxVHWAImage::~VBoxVHWAImage() 1961 1975 { 1962 1976 delete mpMngr; … … 1964 1978 1965 1979 #ifdef VBOXVHWA_OLD_COORD 1966 void VBox GLWidget::doSetupMatrix(const QSize & aSize, bool bInverted)1980 void VBoxVHWAImage::doSetupMatrix(const QSize & aSize, bool bInverted) 1967 1981 { 1968 1982 VBOXQGL_CHECKERR( … … 1991 2005 #endif 1992 2006 1993 void VBox GLWidget::adjustViewport(const QSize &display, const QRect &viewport)2007 void VBoxVHWAImage::adjustViewport(const QSize &display, const QRect &viewport) 1994 2008 { 1995 2009 glViewport(-viewport.x(), … … 1999 2013 } 2000 2014 2001 void VBox GLWidget::setupMatricies(const QSize &display, bool bInverted)2015 void VBoxVHWAImage::setupMatricies(const QSize &display, bool bInverted) 2002 2016 { 2003 2017 glMatrixMode(GL_PROJECTION); … … 2013 2027 } 2014 2028 2015 VBoxVHWACommandElement * VBoxGLWidget::processCmdList(VBoxVHWACommandElement * pCmd) 2016 { 2017 VBoxVHWACommandElement * pCur; 2018 do 2019 { 2020 pCur = pCmd; 2021 switch(pCmd->type()) 2022 { 2023 case VBOXVHWA_PIPECMD_PAINT: 2024 vboxDoUpdateRect(&pCmd->rect()); 2025 break; 2026 #ifdef VBOX_WITH_VIDEOHWACCEL 2027 case VBOXVHWA_PIPECMD_VHWA: 2028 vboxDoVHWACmd(pCmd->vhwaCmd()); 2029 break; 2030 case VBOXVHWA_PIPECMD_OP: 2031 { 2032 const VBOXVHWACALLBACKINFO & info = pCmd->op(); 2033 (info.pThis->*(info.pfnCallback))(info.pContext); 2034 break; 2035 } 2036 case VBOXVHWA_PIPECMD_FUNC: 2037 { 2038 const VBOXVHWAFUNCCALLBACKINFO & info = pCmd->func(); 2039 info.pfnCallback(info.pContext1, info.pContext2); 2040 break; 2041 } 2042 #endif 2043 default: 2044 Assert(0); 2045 } 2046 pCmd = pCmd->mpNext; 2047 } while(pCmd); 2048 2049 return pCur; 2050 } 2051 2052 void VBoxGLWidget::vboxDoProcessVHWACommands(void *pContext) 2053 { 2054 VBoxVHWACommandElementProcessor * pPipe = (VBoxVHWACommandElementProcessor*)pContext; 2055 VBoxVHWACommandElement * pFirst = pPipe->detachCmdList(NULL, NULL); 2056 do 2057 { 2058 VBoxVHWACommandElement * pLast = processCmdList(pFirst); 2059 2060 pFirst = pPipe->detachCmdList(pFirst, pLast); 2061 } while(pFirst); 2062 } 2063 2064 int VBoxGLWidget::reset(VHWACommandList * pCmdList) 2029 //VBoxVHWACommandElement * VBoxVHWAImage::processCmdList(VBoxVHWACommandElement * pCmd) 2030 //{ 2031 // VBoxVHWACommandElement * pCur; 2032 // do 2033 // { 2034 // pCur = pCmd; 2035 // switch(pCmd->type()) 2036 // { 2037 // case VBOXVHWA_PIPECMD_PAINT: 2038 // vboxDoUpdateRect(&pCmd->rect()); 2039 // break; 2040 //#ifdef VBOX_WITH_VIDEOHWACCEL 2041 // case VBOXVHWA_PIPECMD_VHWA: 2042 // vboxDoVHWACmd(pCmd->vhwaCmd()); 2043 // break; 2044 // case VBOXVHWA_PIPECMD_FUNC: 2045 // { 2046 // const VBOXVHWAFUNCCALLBACKINFO & info = pCmd->func(); 2047 // info.pfnCallback(info.pContext1, info.pContext2); 2048 // break; 2049 // } 2050 //#endif 2051 // default: 2052 // Assert(0); 2053 // } 2054 // pCmd = pCmd->mpNext; 2055 // } while(pCmd); 2056 // 2057 // return pCur; 2058 //} 2059 // 2060 //void VBoxVHWAImage::vboxDoProcessVHWACommands(void *pContext) 2061 //{ 2062 // VBoxVHWACommandElementProcessor * pPipe = (VBoxVHWACommandElementProcessor*)pContext; 2063 // VBoxVHWACommandElement * pFirst = pPipe->detachCmdList(NULL, NULL); 2064 // do 2065 // { 2066 // VBoxVHWACommandElement * pLast = processCmdList(pFirst); 2067 // 2068 // pFirst = pPipe->detachCmdList(pFirst, pLast); 2069 // } while(pFirst); 2070 //} 2071 2072 int VBoxVHWAImage::reset(VHWACommandList * pCmdList) 2065 2073 { 2066 2074 VBOXVHWACMD * pCmd; … … 2116 2124 2117 2125 #ifdef VBOX_WITH_VIDEOHWACCEL 2118 void VBoxGLWidget::vboxDoVHWACmd(void *cmd)2119 {2120 vboxDoVHWACmdExec(cmd);2121 2122 CDisplay display = m_console.GetDisplay();2123 Assert (!display.isNull());2124 2125 display.CompleteVHWACommand((BYTE*)cmd);2126 }2127 2128 void VBoxGLWidget::vboxDoVHWACmdAndFree(void *cmd)2129 {2130 vboxDoVHWACmdExec(cmd);2131 2132 free(cmd);2133 }2134 2135 void VBoxGLWidget::vboxDoVHWACmdExec(void *cmd)2136 {2137 struct _VBOXVHWACMD * pCmd = (struct _VBOXVHWACMD *)cmd;2138 switch(pCmd->enmCmd)2139 {2140 case VBOXVHWACMD_TYPE_SURF_CANCREATE:2141 {2142 VBOXVHWACMD_SURF_CANCREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CANCREATE);2143 pCmd->rc = vhwaSurfaceCanCreate(pBody);2144 } break;2145 case VBOXVHWACMD_TYPE_SURF_CREATE:2146 {2147 VBOXVHWACMD_SURF_CREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CREATE);2148 pCmd->rc = vhwaSurfaceCreate(pBody);2149 } break;2150 case VBOXVHWACMD_TYPE_SURF_DESTROY:2151 {2152 VBOXVHWACMD_SURF_DESTROY * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY);2153 pCmd->rc = vhwaSurfaceDestroy(pBody);2154 } break;2155 case VBOXVHWACMD_TYPE_SURF_LOCK:2156 {2157 VBOXVHWACMD_SURF_LOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_LOCK);2158 pCmd->rc = vhwaSurfaceLock(pBody);2159 } break;2160 case VBOXVHWACMD_TYPE_SURF_UNLOCK:2161 {2162 VBOXVHWACMD_SURF_UNLOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_UNLOCK);2163 pCmd->rc = vhwaSurfaceUnlock(pBody);2164 } break;2165 case VBOXVHWACMD_TYPE_SURF_BLT:2166 {2167 VBOXVHWACMD_SURF_BLT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_BLT);2168 pCmd->rc = vhwaSurfaceBlt(pBody);2169 } break;2170 case VBOXVHWACMD_TYPE_SURF_FLIP:2171 {2172 VBOXVHWACMD_SURF_FLIP * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_FLIP);2173 pCmd->rc = vhwaSurfaceFlip(pBody);2174 } break;2175 case VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE:2176 {2177 VBOXVHWACMD_SURF_OVERLAY_UPDATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_UPDATE);2178 pCmd->rc = vhwaSurfaceOverlayUpdate(pBody);2179 } break;2180 case VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION:2181 {2182 VBOXVHWACMD_SURF_OVERLAY_SETPOSITION * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_SETPOSITION);2183 pCmd->rc = vhwaSurfaceOverlaySetPosition(pBody);2184 } break;2185 case VBOXVHWACMD_TYPE_SURF_COLORKEY_SET:2186 {2187 VBOXVHWACMD_SURF_COLORKEY_SET * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_COLORKEY_SET);2188 pCmd->rc = vhwaSurfaceColorkeySet(pBody);2189 } break;2190 case VBOXVHWACMD_TYPE_QUERY_INFO1:2191 {2192 VBOXVHWACMD_QUERYINFO1 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO1);2193 pCmd->rc = vhwaQueryInfo1(pBody);2194 } break;2195 case VBOXVHWACMD_TYPE_QUERY_INFO2:2196 {2197 VBOXVHWACMD_QUERYINFO2 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO2);2198 pCmd->rc = vhwaQueryInfo2(pBody);2199 } break;2200 case VBOXVHWACMD_TYPE_ENABLE:2201 case VBOXVHWACMD_TYPE_DISABLE:2202 pCmd->rc = VINF_SUCCESS;2203 break;2204 case VBOXVHWACMD_TYPE_HH_CONSTRUCT:2205 {2206 VBOXVHWACMD_HH_CONSTRUCT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_HH_CONSTRUCT);2207 pCmd->rc = vhwaConstruct(pBody);2208 } break;2209 default:2210 Assert(0);2211 pCmd->rc = VERR_NOT_IMPLEMENTED;2212 break;2213 }2214 }2215 2216 int VBox GLWidget::vhwaSurfaceCanCreate(struct _VBOXVHWACMD_SURF_CANCREATE *pCmd)2126 //void VBoxVHWAImage::vboxDoVHWACmd(void *cmd) 2127 //{ 2128 // vboxDoVHWACmdExec(cmd); 2129 // 2130 // CDisplay display = m_console.GetDisplay(); 2131 // Assert (!display.isNull()); 2132 // 2133 // display.CompleteVHWACommand((BYTE*)cmd); 2134 //} 2135 // 2136 //void VBoxVHWAImage::vboxDoVHWACmdAndFree(void *cmd) 2137 //{ 2138 // vboxDoVHWACmdExec(cmd); 2139 // 2140 // free(cmd); 2141 //} 2142 // 2143 //void VBoxVHWAImage::vboxDoVHWACmdExec(void *cmd) 2144 //{ 2145 // struct _VBOXVHWACMD * pCmd = (struct _VBOXVHWACMD *)cmd; 2146 // switch(pCmd->enmCmd) 2147 // { 2148 // case VBOXVHWACMD_TYPE_SURF_CANCREATE: 2149 // { 2150 // VBOXVHWACMD_SURF_CANCREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CANCREATE); 2151 // pCmd->rc = vhwaSurfaceCanCreate(pBody); 2152 // } break; 2153 // case VBOXVHWACMD_TYPE_SURF_CREATE: 2154 // { 2155 // VBOXVHWACMD_SURF_CREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CREATE); 2156 // pCmd->rc = vhwaSurfaceCreate(pBody); 2157 // } break; 2158 // case VBOXVHWACMD_TYPE_SURF_DESTROY: 2159 // { 2160 // VBOXVHWACMD_SURF_DESTROY * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY); 2161 // pCmd->rc = vhwaSurfaceDestroy(pBody); 2162 // } break; 2163 // case VBOXVHWACMD_TYPE_SURF_LOCK: 2164 // { 2165 // VBOXVHWACMD_SURF_LOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_LOCK); 2166 // pCmd->rc = vhwaSurfaceLock(pBody); 2167 // } break; 2168 // case VBOXVHWACMD_TYPE_SURF_UNLOCK: 2169 // { 2170 // VBOXVHWACMD_SURF_UNLOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_UNLOCK); 2171 // pCmd->rc = vhwaSurfaceUnlock(pBody); 2172 // } break; 2173 // case VBOXVHWACMD_TYPE_SURF_BLT: 2174 // { 2175 // VBOXVHWACMD_SURF_BLT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_BLT); 2176 // pCmd->rc = vhwaSurfaceBlt(pBody); 2177 // } break; 2178 // case VBOXVHWACMD_TYPE_SURF_FLIP: 2179 // { 2180 // VBOXVHWACMD_SURF_FLIP * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_FLIP); 2181 // pCmd->rc = vhwaSurfaceFlip(pBody); 2182 // } break; 2183 // case VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE: 2184 // { 2185 // VBOXVHWACMD_SURF_OVERLAY_UPDATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_UPDATE); 2186 // pCmd->rc = vhwaSurfaceOverlayUpdate(pBody); 2187 // } break; 2188 // case VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION: 2189 // { 2190 // VBOXVHWACMD_SURF_OVERLAY_SETPOSITION * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_SETPOSITION); 2191 // pCmd->rc = vhwaSurfaceOverlaySetPosition(pBody); 2192 // } break; 2193 // case VBOXVHWACMD_TYPE_SURF_COLORKEY_SET: 2194 // { 2195 // VBOXVHWACMD_SURF_COLORKEY_SET * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_COLORKEY_SET); 2196 // pCmd->rc = vhwaSurfaceColorkeySet(pBody); 2197 // } break; 2198 // case VBOXVHWACMD_TYPE_QUERY_INFO1: 2199 // { 2200 // VBOXVHWACMD_QUERYINFO1 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO1); 2201 // pCmd->rc = vhwaQueryInfo1(pBody); 2202 // } break; 2203 // case VBOXVHWACMD_TYPE_QUERY_INFO2: 2204 // { 2205 // VBOXVHWACMD_QUERYINFO2 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO2); 2206 // pCmd->rc = vhwaQueryInfo2(pBody); 2207 // } break; 2208 // case VBOXVHWACMD_TYPE_ENABLE: 2209 // case VBOXVHWACMD_TYPE_DISABLE: 2210 // pCmd->rc = VINF_SUCCESS; 2211 // break; 2212 // case VBOXVHWACMD_TYPE_HH_CONSTRUCT: 2213 // { 2214 // VBOXVHWACMD_HH_CONSTRUCT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_HH_CONSTRUCT); 2215 // pCmd->rc = vhwaConstruct(pBody); 2216 // } break; 2217 // default: 2218 // Assert(0); 2219 // pCmd->rc = VERR_NOT_IMPLEMENTED; 2220 // break; 2221 // } 2222 //} 2223 2224 int VBoxVHWAImage::vhwaSurfaceCanCreate(struct _VBOXVHWACMD_SURF_CANCREATE *pCmd) 2217 2225 { 2218 2226 VBOXQGLLOG_ENTER(("\n")); 2219 2227 2220 const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo( context());2228 const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(NULL); 2221 2229 2222 2230 if(!(pCmd->SurfInfo.flags & VBOXVHWA_SD_CAPS)) … … 2312 2320 } 2313 2321 2314 int VBox GLWidget::vhwaSurfaceCreate (struct _VBOXVHWACMD_SURF_CREATE *pCmd)2322 int VBoxVHWAImage::vhwaSurfaceCreate (struct _VBOXVHWACMD_SURF_CREATE *pCmd) 2315 2323 { 2316 2324 VBOXQGLLOG_ENTER (("\n")); … … 2328 2336 2329 2337 VBoxVHWASurfaceBase *surf = NULL; 2338 const VBoxVHWASurfaceBase *existingSurf = NULL; 2330 2339 bool bNoPBO = false; 2331 2340 bool bPrimary = false; … … 2360 2369 bNoPBO = true; 2361 2370 bPrimary = true; 2362 VBoxVHWASurfaceBase * pVga = v boxGetVGASurface();2371 VBoxVHWASurfaceBase * pVga = vgaSurface(); 2363 2372 2364 2373 Assert((pCmd->SurfInfo.surfCaps & VBOXVHWA_SCAPS_OFFSCREENPLAIN) == 0); … … 2378 2387 pCmd->SurfInfo.PixelFormat.m2.rgbGBitMask, 2379 2388 pCmd->SurfInfo.PixelFormat.m3.rgbBBitMask); 2380 Assert(pVga-> colorFormat().equals(format));2381 // if(pVga-> colorFormat().equals(format))2389 Assert(pVga->pixelFormat().equals(format)); 2390 // if(pVga->pixelFormat().equals(format)) 2382 2391 { 2392 existingSurf = pVga; 2383 2393 surf = pVga; 2384 2394 … … 2458 2468 2459 2469 uchar * addr = vboxVRAMAddressFromOffset(pCmd->SurfInfo.offSurface); 2460 surf->init(mDisplay.getPrimary(), addr); 2470 if (!existingSurf) 2471 surf->init(mDisplay.getPrimary(), addr); 2461 2472 2462 2473 if(pCmd->SurfInfo.surfCaps & VBOXVHWA_SCAPS_OVERLAY) … … 2482 2493 else 2483 2494 { 2484 VBoxVHWASurfaceBase * pVga = v boxGetVGASurface();2495 VBoxVHWASurfaceBase * pVga = vgaSurface(); 2485 2496 Assert(pVga->handle() != VBOXVHWA_SURFHANDLE_INVALID); 2486 2497 Assert(pVga != surf); NOREF(pVga); … … 2534 2545 } 2535 2546 2536 int VBox GLWidget::vhwaSurfaceDestroy(struct _VBOXVHWACMD_SURF_DESTROY *pCmd)2547 int VBoxVHWAImage::vhwaSurfaceDestroy(struct _VBOXVHWACMD_SURF_DESTROY *pCmd) 2537 2548 { 2538 2549 VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf); … … 2610 2621 (_pr)->bottom - (_pr)->top) 2611 2622 2612 int VBox GLWidget::vhwaSurfaceLock(struct _VBOXVHWACMD_SURF_LOCK *pCmd)2623 int VBoxVHWAImage::vhwaSurfaceLock(struct _VBOXVHWACMD_SURF_LOCK *pCmd) 2613 2624 { 2614 2625 VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf); … … 2623 2634 } 2624 2635 2625 int VBox GLWidget::vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd)2636 int VBoxVHWAImage::vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd) 2626 2637 { 2627 2638 VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf); … … 2664 2675 } 2665 2676 2666 int VBox GLWidget::vhwaSurfaceBlt(struct _VBOXVHWACMD_SURF_BLT *pCmd)2677 int VBoxVHWAImage::vhwaSurfaceBlt(struct _VBOXVHWACMD_SURF_BLT *pCmd) 2667 2678 { 2668 2679 Q_UNUSED(pCmd); … … 2670 2681 } 2671 2682 2672 int VBox GLWidget::vhwaSurfaceFlip(struct _VBOXVHWACMD_SURF_FLIP *pCmd)2683 int VBoxVHWAImage::vhwaSurfaceFlip(struct _VBOXVHWACMD_SURF_FLIP *pCmd) 2673 2684 { 2674 2685 VBoxVHWASurfaceBase *pTargSurf = handle2Surface(pCmd->u.in.hTargSurf); … … 2695 2706 } 2696 2707 2697 void VBox GLWidget::vhwaDoSurfaceOverlayUpdate(VBoxVHWASurfaceBase *pDstSurf, VBoxVHWASurfaceBase *pSrcSurf, struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd)2708 void VBoxVHWAImage::vhwaDoSurfaceOverlayUpdate(VBoxVHWASurfaceBase *pDstSurf, VBoxVHWASurfaceBase *pSrcSurf, struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd) 2698 2709 { 2699 2710 if(pCmd->u.in.flags & VBOXVHWA_OVER_KEYDEST) … … 2775 2786 } 2776 2787 2777 int VBox GLWidget::vhwaSurfaceOverlayUpdate(struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd)2788 int VBoxVHWAImage::vhwaSurfaceOverlayUpdate(struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd) 2778 2789 { 2779 2790 VBoxVHWASurfaceBase *pSrcSurf = handle2Surface(pCmd->u.in.hSrcSurf); … … 2829 2840 } 2830 2841 2831 int VBox GLWidget::vhwaSurfaceOverlaySetPosition(struct _VBOXVHWACMD_SURF_OVERLAY_SETPOSITION *pCmd)2842 int VBoxVHWAImage::vhwaSurfaceOverlaySetPosition(struct _VBOXVHWACMD_SURF_OVERLAY_SETPOSITION *pCmd) 2832 2843 { 2833 2844 VBoxVHWASurfaceBase *pDstSurf = handle2Surface(pCmd->u.in.hDstSurf); … … 2870 2881 } 2871 2882 2872 int VBox GLWidget::vhwaSurfaceColorkeySet(struct _VBOXVHWACMD_SURF_COLORKEY_SET *pCmd)2883 int VBoxVHWAImage::vhwaSurfaceColorkeySet(struct _VBOXVHWACMD_SURF_COLORKEY_SET *pCmd) 2873 2884 { 2874 2885 VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf); … … 2904 2915 } 2905 2916 2906 int VBox GLWidget::vhwaQueryInfo1(struct _VBOXVHWACMD_QUERYINFO1 *pCmd)2917 int VBoxVHWAImage::vhwaQueryInfo1(struct _VBOXVHWACMD_QUERYINFO1 *pCmd) 2907 2918 { 2908 2919 VBOXQGLLOG_ENTER(("\n")); 2909 2920 bool bEnabled = false; 2910 const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo( context());2921 const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(NULL); 2911 2922 if(info.isVHWASupported()) 2912 2923 { … … 3007 3018 } 3008 3019 3009 int VBox GLWidget::vhwaQueryInfo2(struct _VBOXVHWACMD_QUERYINFO2 *pCmd)3020 int VBoxVHWAImage::vhwaQueryInfo2(struct _VBOXVHWACMD_QUERYINFO2 *pCmd) 3010 3021 { 3011 3022 VBOXQGLLOG_ENTER(("\n")); 3012 3023 3013 const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo( context());3024 const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(NULL); 3014 3025 uint32_t aFourcc[VBOXVHWA_NUMFOURCC]; 3015 3026 int num = mSettings->getIntersection(info, VBOXVHWA_NUMFOURCC, aFourcc); … … 3023 3034 } 3024 3035 3025 static DECLCALLBACK(void) vboxQGLSaveExec(PSSMHANDLE pSSM, void *pvUser)3026 {3027 VBoxGLWidget * pw = (VBoxGLWidget*)pvUser;3028 pw->vhwaSaveExec(pSSM);3029 }3030 3031 static DECLCALLBACK(int) vboxQGLLoadExec(PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version, uint32_t uPass)3032 {3033 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);3034 VBoxGLWidget * pw = (VBoxGLWidget*)pvUser;3035 return VBoxGLWidget::vhwaLoadExec(&pw->onResizeCmdList(), pSSM, u32Version);3036 }3037 3038 int VBox GLWidget::vhwaSaveSurface(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, uint32_t surfCaps)3036 //static DECLCALLBACK(void) vboxQGLSaveExec(PSSMHANDLE pSSM, void *pvUser) 3037 //{ 3038 // VBoxVHWAImage * pw = (VBoxVHWAImage*)pvUser; 3039 // pw->vhwaSaveExec(pSSM); 3040 //} 3041 // 3042 //static DECLCALLBACK(int) vboxQGLLoadExec(PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version, uint32_t uPass) 3043 //{ 3044 // Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); 3045 // VBoxVHWAImage * pw = (VBoxVHWAImage*)pvUser; 3046 // return VBoxVHWAImage::vhwaLoadExec(&pw->onResizeCmdList(), pSSM, u32Version); 3047 //} 3048 3049 int VBoxVHWAImage::vhwaSaveSurface(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, uint32_t surfCaps) 3039 3050 { 3040 3051 VBOXQGL_SAVE_SURFSTART(pSSM); … … 3091 3102 } 3092 3103 3093 const VBoxVHWAColorFormat & format = pSurf-> colorFormat();3104 const VBoxVHWAColorFormat & format = pSurf->pixelFormat(); 3094 3105 flags = 0; 3095 3106 if(format.fourcc()) … … 3115 3126 } 3116 3127 3117 int VBox GLWidget::vhwaLoadSurface(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t cBackBuffers, uint32_t u32Version)3128 int VBoxVHWAImage::vhwaLoadSurface(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t cBackBuffers, uint32_t u32Version) 3118 3129 { 3119 3130 Q_UNUSED(u32Version); … … 3185 3196 3186 3197 pCmdList->push_back(pCmd); 3187 // vboxExecOnResize(&VBox GLWidget::vboxDoVHWACmdAndFree, pCmd); AssertRC(rc);3198 // vboxExecOnResize(&VBoxVHWAImage::vboxDoVHWACmdAndFree, pCmd); AssertRC(rc); 3188 3199 // if(RT_SUCCESS(rc)) 3189 3200 // { … … 3198 3209 } 3199 3210 3200 int VBox GLWidget::vhwaSaveOverlayData(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, bool bVisible)3211 int VBoxVHWAImage::vhwaSaveOverlayData(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, bool bVisible) 3201 3212 { 3202 3213 VBOXQGL_SAVE_OVERLAYSTART(pSSM); … … 3273 3284 } 3274 3285 3275 int VBox GLWidget::vhwaLoadOverlayData(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version)3286 int VBoxVHWAImage::vhwaLoadOverlayData(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version) 3276 3287 { 3277 3288 Q_UNUSED(u32Version); … … 3328 3339 } 3329 3340 3330 void VBox GLWidget::vhwaSaveExecVoid(struct SSMHANDLE * pSSM)3341 void VBoxVHWAImage::vhwaSaveExecVoid(struct SSMHANDLE * pSSM) 3331 3342 { 3332 3343 VBOXQGL_SAVE_START(pSSM); … … 3335 3346 } 3336 3347 3337 void VBox GLWidget::vhwaSaveExec(struct SSMHANDLE * pSSM)3348 void VBoxVHWAImage::vhwaSaveExec(struct SSMHANDLE * pSSM) 3338 3349 { 3339 3350 VBOXQGL_SAVE_START(pSSM); … … 3429 3440 } 3430 3441 3431 int VBox GLWidget::vhwaLoadVHWAEnable(VHWACommandList * pCmdList)3442 int VBoxVHWAImage::vhwaLoadVHWAEnable(VHWACommandList * pCmdList) 3432 3443 { 3433 3444 char *buf = (char*)malloc(sizeof(VBOXVHWACMD)); … … 3446 3457 } 3447 3458 3448 int VBox GLWidget::vhwaLoadExec(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version)3459 int VBoxVHWAImage::vhwaLoadExec(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version) 3449 3460 { 3450 3461 VBOXQGL_LOAD_START(pSSM); … … 3517 3528 } 3518 3529 3519 int VBoxGLWidget::vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd) 3520 { 3521 PVM pVM = (PVM)pCmd->pVM; 3522 uint32_t intsId = 0; /* @todo: set the proper id */ 3523 3524 char nameFuf[sizeof(VBOXQGL_STATE_NAMEBASE) + 8]; 3525 3526 char * pszName = nameFuf; 3527 sprintf(pszName, "%s%d", VBOXQGL_STATE_NAMEBASE, intsId); 3528 int rc = SSMR3RegisterExternal( 3529 pVM, /* The VM handle*/ 3530 pszName, /* Data unit name. */ 3531 intsId, /* The instance identifier of the data unit. 3532 * This must together with the name be unique. */ 3533 VBOXQGL_STATE_VERSION, /* Data layout version number. */ 3534 128, /* The approximate amount of data in the unit. 3535 * Only for progress indicators. */ 3536 NULL, NULL, NULL, /* pfnLiveXxx */ 3537 NULL, /* Prepare save callback, optional. */ 3538 vboxQGLSaveExec, /* Execute save callback, optional. */ 3539 NULL, /* Done save callback, optional. */ 3540 NULL, /* Prepare load callback, optional. */ 3541 vboxQGLLoadExec, /* Execute load callback, optional. */ 3542 NULL, /* Done load callback, optional. */ 3543 this /* User argument. */ 3544 ); 3545 AssertRC(rc); 3546 return rc; 3547 } 3548 3549 uchar * VBoxGLWidget::vboxVRAMAddressFromOffset(uint64_t offset) 3550 { 3551 return ((offset != VBOXVHWA_OFFSET64_VOID) && vboxUsesGuestVRAM()) ? vboxAddress() + offset : NULL; 3552 } 3553 3554 uint64_t VBoxGLWidget::vboxVRAMOffsetFromAddress(uchar* addr) 3555 { 3556 return uint64_t(addr - vboxAddress()); 3557 } 3558 3559 uint64_t VBoxGLWidget::vboxVRAMOffset(VBoxVHWASurfaceBase * pSurf) 3530 int VBoxVHWAImage::vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd) 3531 { 3532 // PVM pVM = (PVM)pCmd->pVM; 3533 // uint32_t intsId = 0; /* @todo: set the proper id */ 3534 // 3535 // char nameFuf[sizeof(VBOXQGL_STATE_NAMEBASE) + 8]; 3536 // 3537 // char * pszName = nameFuf; 3538 // sprintf(pszName, "%s%d", VBOXQGL_STATE_NAMEBASE, intsId); 3539 // int rc = SSMR3RegisterExternal( 3540 // pVM, /* The VM handle*/ 3541 // pszName, /* Data unit name. */ 3542 // intsId, /* The instance identifier of the data unit. 3543 // * This must together with the name be unique. */ 3544 // VBOXQGL_STATE_VERSION, /* Data layout version number. */ 3545 // 128, /* The approximate amount of data in the unit. 3546 // * Only for progress indicators. */ 3547 // NULL, NULL, NULL, /* pfnLiveXxx */ 3548 // NULL, /* Prepare save callback, optional. */ 3549 // vboxQGLSaveExec, /* Execute save callback, optional. */ 3550 // NULL, /* Done save callback, optional. */ 3551 // NULL, /* Prepare load callback, optional. */ 3552 // vboxQGLLoadExec, /* Execute load callback, optional. */ 3553 // NULL, /* Done load callback, optional. */ 3554 // this /* User argument. */ 3555 // ); 3556 // AssertRC(rc); 3557 mpvVRAM = pCmd->pvVRAM; 3558 mcbVRAM = pCmd->cbVRAM; 3559 return VINF_SUCCESS; 3560 } 3561 3562 uchar * VBoxVHWAImage::vboxVRAMAddressFromOffset(uint64_t offset) 3563 { 3564 /* @todo: check vramSize() */ 3565 return (offset != VBOXVHWA_OFFSET64_VOID) ? ((uint8_t*)vramBase()) + offset : NULL; 3566 } 3567 3568 uint64_t VBoxVHWAImage::vboxVRAMOffsetFromAddress(uchar* addr) 3569 { 3570 return uint64_t(addr - ((uchar*)vramBase())); 3571 } 3572 3573 uint64_t VBoxVHWAImage::vboxVRAMOffset(VBoxVHWASurfaceBase * pSurf) 3560 3574 { 3561 3575 return pSurf->addressAlocated() ? VBOXVHWA_OFFSET64_VOID : vboxVRAMOffsetFromAddress(pSurf->address()); … … 3563 3577 3564 3578 #endif 3565 3566 void VBoxGLWidget::initializeGL()3567 {3568 vboxVHWAGetSupportInfo(context());3569 VBoxVHWASurfaceBase::globalInit();3570 }3571 3579 3572 3580 #ifdef VBOXQGL_DBG_SURF … … 3575 3583 VBoxVHWASurfaceBase * g_apSurf[] = {NULL, NULL, NULL}; 3576 3584 3577 void VBox GLWidget::vboxDoTestSurfaces(void* context)3585 void VBoxVHWAImage::vboxDoTestSurfaces(void* context) 3578 3586 { 3579 3587 if(g_iCur >= RT_ELEMENTS(g_apSurf)) … … 3587 3595 #endif 3588 3596 3589 void VBox GLWidget::vboxDoUpdateViewport(const QRect & aRect)3597 void VBoxVHWAImage::vboxDoUpdateViewport(const QRect & aRect) 3590 3598 { 3591 3599 adjustViewport(mDisplay.getPrimary()->size(), aRect); … … 3631 3639 } 3632 3640 3633 bool VBox GLWidget::hasSurfaces() const3641 bool VBoxVHWAImage::hasSurfaces() const 3634 3642 { 3635 3643 if(mDisplay.overlays().size() != 0) … … 3640 3648 } 3641 3649 3642 bool VBox GLWidget::hasVisibleOverlays()3650 bool VBoxVHWAImage::hasVisibleOverlays() 3643 3651 { 3644 3652 const OverlayList & overlays = mDisplay.overlays(); … … 3653 3661 } 3654 3662 3655 QRect VBox GLWidget::overlaysRectUnion()3663 QRect VBoxVHWAImage::overlaysRectUnion() 3656 3664 { 3657 3665 const OverlayList & overlays = mDisplay.overlays(); … … 3669 3677 } 3670 3678 3671 QRect VBox GLWidget::overlaysRectIntersection()3679 QRect VBoxVHWAImage::overlaysRectIntersection() 3672 3680 { 3673 3681 const OverlayList & overlays = mDisplay.overlays(); … … 3695 3703 } 3696 3704 3697 void VBox GLWidget::vboxDoUpdateRect(const QRect * pRect)3705 void VBoxVHWAImage::vboxDoUpdateRect(const QRect * pRect) 3698 3706 { 3699 3707 mDisplay.getPrimary()->updatedMem(pRect); 3700 3708 } 3701 3709 3702 void VBox GLWidget::vboxDoResize(void *resize)3703 { 3704 VBOXQGLLOG(("format().blueBufferSize()(%d)\n", format().blueBufferSize()));3705 VBOXQGLLOG(("format().greenBufferSize()(%d)\n", format().greenBufferSize()));3706 VBOXQGLLOG(("format().redBufferSize()(%d)\n", format().redBufferSize()));3707 #ifdef DEBUG_misha3708 Assert(format().blueBufferSize() == 8);3709 Assert(format().greenBufferSize() == 8);3710 Assert(format().redBufferSize() == 8);3711 #endif3712 3713 Assert(format().directRendering());3714 Assert(format().doubleBuffer());3715 Assert(format().hasOpenGL());3716 VBOXQGLLOG(("hasOpenGLOverlays(%d), hasOverlay(%d)\n", format().hasOpenGLOverlays(), format().hasOverlay()));3717 Assert(format().plane() == 0);3718 Assert(format().rgba());3719 Assert(!format().sampleBuffers());3720 Assert(!format().stereo());3721 VBOXQGLLOG(("swapInterval(%d)\n", format().swapInterval()));3710 void VBoxVHWAImage::resize(const VBoxFBSizeInfo & size) 3711 { 3712 // VBOXQGLLOG(("format().blueBufferSize()(%d)\n", format().blueBufferSize())); 3713 // VBOXQGLLOG(("format().greenBufferSize()(%d)\n", format().greenBufferSize())); 3714 // VBOXQGLLOG(("format().redBufferSize()(%d)\n", format().redBufferSize())); 3715 //#ifdef DEBUG_misha 3716 // Assert(format().blueBufferSize() == 8); 3717 // Assert(format().greenBufferSize() == 8); 3718 // Assert(format().redBufferSize() == 8); 3719 //#endif 3720 // 3721 // Assert(format().directRendering()); 3722 // Assert(format().doubleBuffer()); 3723 // Assert(format().hasOpenGL()); 3724 // VBOXQGLLOG(("hasOpenGLOverlays(%d), hasOverlay(%d)\n", format().hasOpenGLOverlays(), format().hasOverlay())); 3725 // Assert(format().plane() == 0); 3726 // Assert(format().rgba()); 3727 // Assert(!format().sampleBuffers()); 3728 // Assert(!format().stereo()); 3729 // VBOXQGLLOG(("swapInterval(%d)\n", format().swapInterval())); 3722 3730 3723 3731 … … 3726 3734 ); 3727 3735 3728 VBoxResizeEvent *re = (VBoxResizeEvent*)resize;3729 3736 bool remind = false; 3730 3737 bool fallback = false; 3731 3738 3732 3739 VBOXQGLLOG(("resizing: fmt=%d, vram=%p, bpp=%d, bpl=%d, width=%d, height=%d\n", 3733 re->pixelFormat(), re->VRAM(),3734 re->bitsPerPixel(), re->bytesPerLine(),3735 re->width(), re->height()));3740 size.pixelFormat(), size.VRAM(), 3741 size.bitsPerPixel(), size.bytesPerLine(), 3742 size.width(), size.height())); 3736 3743 3737 3744 /* clean the old values first */ … … 3740 3747 uint32_t bitsPerPixel; 3741 3748 uint32_t b = 0xff, g = 0xff00, r = 0xff0000; 3749 ulong pixelFormat; 3750 bool bUsesGuestVram; 3742 3751 3743 3752 /* check if we support the pixel format and can use the guest VRAM directly */ 3744 if ( re->pixelFormat() == FramebufferPixelFormat_FOURCC_RGB)3745 { 3746 3747 bitsPerPixel = re->bitsPerPixel();3748 bytesPerLine = re->bytesPerLine();3753 if (size.pixelFormat() == FramebufferPixelFormat_FOURCC_RGB) 3754 { 3755 3756 bitsPerPixel = size.bitsPerPixel(); 3757 bytesPerLine = size.bytesPerLine(); 3749 3758 ulong bitsPerLine = bytesPerLine * 8; 3750 3759 … … 3785 3794 { 3786 3795 /* QImage only supports 32-bit aligned scan lines... */ 3787 Assert (( re->bytesPerLine() & 3) == 0);3788 fallback = (( re->bytesPerLine() & 3) != 0);3796 Assert ((size.bytesPerLine() & 3) == 0); 3797 fallback = ((size.bytesPerLine() & 3) != 0); 3789 3798 } 3790 3799 if (!fallback) 3791 3800 { 3792 3801 /* ...and the scan lines ought to be a whole number of pixels. */ 3793 Assert ((bitsPerLine & ( re->bitsPerPixel() - 1)) == 0);3794 fallback = ((bitsPerLine & ( re->bitsPerPixel() - 1)) != 0);3802 Assert ((bitsPerLine & (size.bitsPerPixel() - 1)) == 0); 3803 fallback = ((bitsPerLine & (size.bitsPerPixel() - 1)) != 0); 3795 3804 } 3796 3805 if (!fallback) 3797 3806 { 3798 // ulong virtWdt = bitsPerLine / re->bitsPerPixel();3799 mPixelFormat = FramebufferPixelFormat_FOURCC_RGB;3800 mUsesGuestVRAM= true;3807 // ulong virtWdt = bitsPerLine / size.bitsPerPixel(); 3808 pixelFormat = FramebufferPixelFormat_FOURCC_RGB; 3809 bUsesGuestVram = true; 3801 3810 } 3802 3811 } … … 3814 3823 g = 0xff00; 3815 3824 r = 0xff0000; 3816 bytesPerLine = re->width()*bitsPerPixel/8;3817 mPixelFormat = FramebufferPixelFormat_FOURCC_RGB;3818 mUsesGuestVRAM= false;3825 bytesPerLine = size.width()*bitsPerPixel/8; 3826 pixelFormat = FramebufferPixelFormat_FOURCC_RGB; 3827 bUsesGuestVram = false; 3819 3828 } 3820 3829 3821 3830 ulong bytesPerPixel = bitsPerPixel/8; 3822 3831 ulong displayWidth = bytesPerLine/bytesPerPixel; 3823 ulong displayHeight = re->height();3832 ulong displayHeight = size.height(); 3824 3833 3825 3834 #ifdef VBOXQGL_DBG_SURF … … 3855 3864 #endif 3856 3865 0); 3857 pDisplay->init(NULL, mUsesGuestVRAM ? re->VRAM() : NULL);3866 pDisplay->init(NULL, bUsesGuestVram ? size.VRAM() : NULL); 3858 3867 mDisplay.setVGA(pDisplay); 3859 3868 // VBOXQGLLOG(("\n\n*******\n\n viewport size is: (%d):(%d)\n\n*******\n\n", size().width(), size().height())); … … 3928 3937 #endif 3929 3938 3930 if(!mOnResizeCmdList.empty())3931 {3932 for (VHWACommandList::const_iterator it = mOnResizeCmdList.begin();3933 it != mOnResizeCmdList.end(); ++ it)3934 {3935 VBOXVHWACMD * pCmd = (*it);3936 vboxDoVHWACmdExec(pCmd);3937 free(pCmd);3938 }3939 mOnResizeCmdList.clear();3940 }3939 // if(!mOnResizeCmdList.empty()) 3940 // { 3941 // for (VHWACommandList::const_iterator it = mOnResizeCmdList.begin(); 3942 // it != mOnResizeCmdList.end(); ++ it) 3943 // { 3944 // VBOXVHWACMD * pCmd = (*it); 3945 // vboxDoVHWACmdExec(pCmd); 3946 // free(pCmd); 3947 // } 3948 // mOnResizeCmdList.clear(); 3949 // } 3941 3950 3942 3951 if (remind) … … 3953 3962 } 3954 3963 }; 3955 (new RemindEvent ( re->bitsPerPixel()))->post();3964 (new RemindEvent (size.bitsPerPixel()))->post(); 3956 3965 } 3957 3966 } … … 4120 4129 } 4121 4130 4122 VBoxQGLOverlay::VBoxQGLOverlay (VBoxConsoleView *aView, VBoxFrameBuffer * aContainer, CSession * aSession) 4123 : mpOverlayWidget (NULL), 4124 mView (aView), 4125 mContainer (aContainer), 4131 VBoxQGLOverlay::VBoxQGLOverlay (QWidget *pViewport,QObject *pPostEventObject, CSession * aSession) 4132 : mpOverlayWgt (NULL), 4133 mpViewport (pViewport), 4126 4134 mGlOn (false), 4127 4135 mOverlayWidgetVisible (false), … … 4131 4139 mNeedOverlayRepaint (false), 4132 4140 mNeedSetVisible (false), 4133 mCmdPipe (aView), 4134 mSettings (*aSession) 4141 mCmdPipe (pPostEventObject), 4142 mSettings (*aSession), 4143 mpSession(aSession) 4135 4144 { 4136 4145 /* postpone the gl widget initialization to avoid conflict with 3D on Mac */ 4137 4146 } 4138 4147 4148 class VBoxGLShareWgt : public QGLWidget 4149 { 4150 public: 4151 VBoxGLShareWgt() : 4152 QGLWidget(VBoxVHWAImage::vboxGLFormat()) 4153 {} 4154 4155 protected: 4156 void initializeGL() 4157 { 4158 vboxVHWAGetSupportInfo(context()); 4159 VBoxVHWASurfaceBase::globalInit(); 4160 } 4161 }; 4139 4162 void VBoxQGLOverlay::initGl() 4140 4163 { 4141 if(mpOverlayWidget) 4164 if(mpOverlayWgt) 4165 { 4166 Assert(mpShareWgt); 4142 4167 return; 4143 4144 mpOverlayWidget = new VBoxGLWidget (mView->console(), mView->viewport(), &mSettings); 4145 4146 VBoxGLContext *pc = (VBoxGLContext*)mpOverlayWidget->context(); 4147 pc->allowDoneCurrent (false); 4168 } 4169 4170 if (!mpShareWgt) 4171 { 4172 mpShareWgt = new VBoxGLShareWgt(); 4173 /* force initializeGL */ 4174 mpShareWgt->updateGL(); 4175 } 4176 4177 mOverlayImage.init(&mSettings); 4178 mpOverlayWgt = new VBoxGLWgt(&mOverlayImage, mpViewport, mpShareWgt); 4148 4179 4149 4180 mOverlayWidgetVisible = true; /* to ensure it is set hidden with vboxShowOverlay */ 4150 4181 vboxShowOverlay (false); 4151 4182 4152 mpOverlayW idget->setMouseTracking (true);4183 mpOverlayWgt->setMouseTracking (true); 4153 4184 } 4154 4185 … … 4159 4190 if(pHead) 4160 4191 { 4161 CDisplay display = m View->console().GetDisplay();4192 CDisplay display = mpSession->GetConsole().GetDisplay(); 4162 4193 Assert (!display.isNull()); 4163 4194 … … 4174 4205 display.CompleteVHWACommand((BYTE*)pCmd); 4175 4206 } 4176 break;4177 case VBOXVHWA_PIPECMD_OP:4178 /* should not happen, don't handle this for now */4179 Assert(0);4180 4207 break; 4181 4208 case VBOXVHWA_PIPECMD_FUNC: … … 4210 4237 int VBoxQGLOverlay::resetGl() 4211 4238 { 4212 if(mpOverlayWidget) 4213 { 4214 VHWACommandList list; 4215 int rc = mpOverlayWidget->reset(&list); 4216 if(RT_SUCCESS(rc)) 4217 { 4218 for (VHWACommandList::const_iterator sIt = list.begin(); 4239 VHWACommandList list; 4240 int rc = mOverlayImage.reset(&list); 4241 AssertRC(rc); 4242 if (RT_SUCCESS(rc)) 4243 { 4244 for (VHWACommandList::const_iterator sIt = list.begin(); 4219 4245 sIt != list.end(); ++ sIt) 4220 { 4221 VBOXVHWACMD *pCmd = (*sIt); 4222 VBOXVHWA_HH_CALLBACK_SET(pCmd, vbvaVHWAHHCommandFreeCmd, pCmd); 4223 mCmdPipe.postCmd(VBOXVHWA_PIPECMD_VHWA, pCmd, 0); 4224 } 4246 { 4247 VBOXVHWACMD *pCmd = (*sIt); 4248 VBOXVHWA_HH_CALLBACK_SET(pCmd, vbvaVHWAHHCommandFreeCmd, pCmd); 4249 mCmdPipe.postCmd(VBOXVHWA_PIPECMD_VHWA, pCmd, 0); 4225 4250 } 4226 4251 } … … 4298 4323 } 4299 4324 4300 void VBoxQGLOverlay::onResizeEvent (const VBoxResizeEvent *re) 4301 { 4302 Q_UNUSED(re); 4303 } 4304 4305 void VBoxQGLOverlay::onResizeEventPostprocess (const VBoxResizeEvent *re) 4306 { 4307 Q_UNUSED(re); 4325 void VBoxQGLOverlay::onResizeEventPostprocess (const VBoxFBSizeInfo &re, const QPoint & topLeft) 4326 { 4327 mSizeInfo = re; 4328 mContentsTopLeft = topLeft; 4308 4329 4309 4330 if(mGlOn) … … 4345 4366 } 4346 4367 4347 m View->viewport()->repaint (rect.x() - mView->contentsX(),4348 rect.y() - m View->contentsY(),4368 mpViewport->repaint (rect.x() - mContentsTopLeft.x(), 4369 rect.y() - mContentsTopLeft.y(), 4349 4370 rect.width(), rect.height()); 4350 4371 … … 4356 4377 vboxDoVHWACmdExec(cmd); 4357 4378 4358 CDisplay display = m View->console().GetDisplay();4379 CDisplay display = mpSession->GetConsole().GetDisplay(); 4359 4380 Assert (!display.isNull()); 4360 4381 … … 4364 4385 bool VBoxQGLOverlay::vboxSynchGl() 4365 4386 { 4366 if(mpOverlayWidget->vboxIsInitialized() 4367 && mContainer->pixelFormat() == mpOverlayWidget->vboxPixelFormat() 4368 && mContainer->address() == mpOverlayWidget->vboxAddress() 4369 && mContainer->bitsPerPixel() == mpOverlayWidget->vboxBitsPerPixel() 4370 && mContainer->bytesPerLine() == mpOverlayWidget->vboxBytesPerLine() 4371 && (int)mContainer->width() == mpOverlayWidget->vboxFbWidth() 4372 && (int)mContainer->height() == mpOverlayWidget->vboxFbHeight()) 4387 VBoxVHWASurfaceBase * pVGA = mOverlayImage.vgaSurface(); 4388 if(pVGA 4389 && mSizeInfo.pixelFormat() == pVGA->pixelFormat().toVBoxPixelFormat() 4390 && mSizeInfo.VRAM() == pVGA->address() 4391 && mSizeInfo.bitsPerPixel() == pVGA->bitsPerPixel() 4392 && mSizeInfo.bytesPerLine() == pVGA->bytesPerLine() 4393 && mSizeInfo.width() == pVGA->width() 4394 && mSizeInfo.height() == pVGA->height() 4395 ) 4373 4396 { 4374 4397 return false; … … 4376 4399 /* create and issue a resize event to the gl widget to ensure we have all gl data initialized 4377 4400 * and synchronized with the framebuffer */ 4378 VBoxResizeEvent re(mContainer->pixelFormat(), 4379 mContainer->address(), 4380 mContainer->bitsPerPixel(), 4381 mContainer->bytesPerLine(), 4382 mContainer->width(), 4383 mContainer->height()); 4384 4385 mpOverlayWidget->vboxDoResize(&re); 4401 mOverlayImage.resize(mSizeInfo); 4386 4402 return true; 4387 4403 } … … 4397 4413 { 4398 4414 /* need to ensure we have gl functions initialized */ 4399 mpOverlayW idget->makeCurrent();4400 vboxVHWAGetSupportInfo(mpOverlayW idget->context());4415 mpOverlayWgt->makeCurrent(); 4416 vboxVHWAGetSupportInfo(mpOverlayWgt->context()); 4401 4417 4402 4418 VBOXQGLLOGREL(("Switching Gl mode on\n")); 4403 Assert(!mpOverlayW idget->isVisible());4419 Assert(!mpOverlayWgt->isVisible()); 4404 4420 /* just to ensure */ 4405 4421 vboxShowOverlay(false); … … 4424 4440 } 4425 4441 4426 int cX = m View->contentsX();4427 int cY = m View->contentsY();4428 QRect fbVp(cX, cY, m View->viewport()->width(), mView->viewport()->height());4442 int cX = mContentsTopLeft.x(); 4443 int cY = mContentsTopLeft.y(); 4444 QRect fbVp(cX, cY, mpViewport->width(), mpViewport->height()); 4429 4445 QRect overVp = fbVp.intersected(mOverlayViewport); 4430 4446 … … 4435 4451 else 4436 4452 { 4437 if(overVp != m pOverlayWidget->vboxViewport())4453 if(overVp != mOverlayImage.vboxViewport()) 4438 4454 { 4439 4455 makeCurrent(); 4440 m pOverlayWidget->vboxDoUpdateViewport(overVp);4456 mOverlayImage.vboxDoUpdateViewport(overVp); 4441 4457 mNeedOverlayRepaint = true; 4442 4458 } … … 4449 4465 4450 4466 /* workaround for linux ATI issue: need to update gl viewport after widget becomes visible */ 4451 m pOverlayWidget->vboxDoUpdateViewport(overVp);4467 mOverlayImage.vboxDoUpdateViewport(overVp); 4452 4468 } 4453 4469 } … … 4457 4473 if(mOverlayWidgetVisible != show) 4458 4474 { 4459 mpOverlayW idget->setVisible(show);4475 mpOverlayWgt->setVisible(show); 4460 4476 mOverlayWidgetVisible = show; 4461 4477 mGlCurrent = false; 4462 4478 if(!show) 4463 4479 { 4464 mMainDirtyRect.add(m pOverlayWidget->vboxViewport());4480 mMainDirtyRect.add(mOverlayImage.vboxViewport()); 4465 4481 } 4466 4482 } … … 4469 4485 void VBoxQGLOverlay::vboxCheckUpdateOverlay(const QRect & rect) 4470 4486 { 4471 QRect overRect(mpOverlayW idget->pos(), mpOverlayWidget->size());4487 QRect overRect(mpOverlayWgt->pos(), mpOverlayWgt->size()); 4472 4488 if(overRect.x() != rect.x() || overRect.y() != rect.y()) 4473 4489 { 4474 4490 #if defined(RT_OS_WINDOWS) 4475 mpOverlayW idget->setVisible(false);4491 mpOverlayWgt->setVisible(false); 4476 4492 mNeedSetVisible = true; 4477 4493 #endif 4478 4494 VBOXQGLLOG_QRECT("moving wgt to " , &rect, "\n"); 4479 mpOverlayW idget->move(rect.x(), rect.y());4495 mpOverlayWgt->move(rect.x(), rect.y()); 4480 4496 mGlCurrent = false; 4481 4497 } … … 4484 4500 { 4485 4501 #if defined(RT_OS_WINDOWS) 4486 mpOverlayW idget->setVisible(false);4502 mpOverlayWgt->setVisible(false); 4487 4503 mNeedSetVisible = true; 4488 4504 #endif 4489 4505 VBOXQGLLOG(("resizing wgt to w(%d) ,h(%d)\n" , rect.width(), rect.height())); 4490 mpOverlayW idget->resize(rect.width(), rect.height());4506 mpOverlayWgt->resize(rect.width(), rect.height()); 4491 4507 mGlCurrent = false; 4492 4508 } … … 4498 4514 if(mGlOn) 4499 4515 { 4500 m pOverlayWidget->vboxDoUpdateRect(&aRect);4516 mOverlayImage.vboxDoUpdateRect(&aRect); 4501 4517 mNeedOverlayRepaint = true; 4502 4518 } … … 4505 4521 int VBoxQGLOverlay::vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd) 4506 4522 { 4507 int rc = m pOverlayWidget->vhwaSurfaceUnlock(pCmd);4508 VBoxVHWASurfaceBase * pVGA = m pOverlayWidget->vboxGetVGASurface();4523 int rc = mOverlayImage.vhwaSurfaceUnlock(pCmd); 4524 VBoxVHWASurfaceBase * pVGA = mOverlayImage.vgaSurface(); 4509 4525 const VBoxVHWADirtyRect & rect = pVGA->getDirtyRect(); 4510 4526 mNeedOverlayRepaint = true; … … 4525 4541 VBOXVHWACMD_SURF_CANCREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CANCREATE); 4526 4542 makeCurrent(); 4527 pCmd->rc = m pOverlayWidget->vhwaSurfaceCanCreate(pBody);4543 pCmd->rc = mOverlayImage.vhwaSurfaceCanCreate(pBody); 4528 4544 } break; 4529 4545 case VBOXVHWACMD_TYPE_SURF_CREATE: … … 4532 4548 makeCurrent(); 4533 4549 vboxSetGlOn(true); 4534 pCmd->rc = m pOverlayWidget->vhwaSurfaceCreate(pBody);4535 if(!m pOverlayWidget->hasSurfaces())4550 pCmd->rc = mOverlayImage.vhwaSurfaceCreate(pBody); 4551 if(!mOverlayImage.hasSurfaces()) 4536 4552 { 4537 4553 vboxSetGlOn(false); … … 4539 4555 else 4540 4556 { 4541 mOverlayVisible = m pOverlayWidget->hasVisibleOverlays();4557 mOverlayVisible = mOverlayImage.hasVisibleOverlays(); 4542 4558 if(mOverlayVisible) 4543 4559 { 4544 mOverlayViewport = m pOverlayWidget->overlaysRectUnion();4560 mOverlayViewport = mOverlayImage.overlaysRectUnion(); 4545 4561 } 4546 4562 vboxDoCheckUpdateViewport(); … … 4552 4568 VBOXVHWACMD_SURF_DESTROY * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY); 4553 4569 makeCurrent(); 4554 pCmd->rc = m pOverlayWidget->vhwaSurfaceDestroy(pBody);4555 if(!m pOverlayWidget->hasSurfaces())4570 pCmd->rc = mOverlayImage.vhwaSurfaceDestroy(pBody); 4571 if(!mOverlayImage.hasSurfaces()) 4556 4572 { 4557 4573 vboxSetGlOn(false); … … 4559 4575 else 4560 4576 { 4561 mOverlayVisible = m pOverlayWidget->hasVisibleOverlays();4577 mOverlayVisible = mOverlayImage.hasVisibleOverlays(); 4562 4578 if(mOverlayVisible) 4563 4579 { 4564 mOverlayViewport = m pOverlayWidget->overlaysRectUnion();4580 mOverlayViewport = mOverlayImage.overlaysRectUnion(); 4565 4581 } 4566 4582 vboxDoCheckUpdateViewport(); … … 4572 4588 VBOXVHWACMD_SURF_LOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_LOCK); 4573 4589 makeCurrent(); 4574 pCmd->rc = m pOverlayWidget->vhwaSurfaceLock(pBody);4590 pCmd->rc = mOverlayImage.vhwaSurfaceLock(pBody); 4575 4591 } break; 4576 4592 case VBOXVHWACMD_TYPE_SURF_UNLOCK: … … 4585 4601 VBOXVHWACMD_SURF_BLT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_BLT); 4586 4602 makeCurrent(); 4587 pCmd->rc = m pOverlayWidget->vhwaSurfaceBlt(pBody);4603 pCmd->rc = mOverlayImage.vhwaSurfaceBlt(pBody); 4588 4604 mNeedOverlayRepaint = true; 4589 4605 } break; … … 4592 4608 VBOXVHWACMD_SURF_FLIP * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_FLIP); 4593 4609 makeCurrent(); 4594 pCmd->rc = m pOverlayWidget->vhwaSurfaceFlip(pBody);4610 pCmd->rc = mOverlayImage.vhwaSurfaceFlip(pBody); 4595 4611 mNeedOverlayRepaint = true; 4596 4612 } break; … … 4599 4615 VBOXVHWACMD_SURF_OVERLAY_UPDATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_UPDATE); 4600 4616 makeCurrent(); 4601 pCmd->rc = m pOverlayWidget->vhwaSurfaceOverlayUpdate(pBody);4602 mOverlayVisible = m pOverlayWidget->hasVisibleOverlays();4617 pCmd->rc = mOverlayImage.vhwaSurfaceOverlayUpdate(pBody); 4618 mOverlayVisible = mOverlayImage.hasVisibleOverlays(); 4603 4619 if(mOverlayVisible) 4604 4620 { 4605 mOverlayViewport = m pOverlayWidget->overlaysRectUnion();4621 mOverlayViewport = mOverlayImage.overlaysRectUnion(); 4606 4622 } 4607 4623 vboxDoCheckUpdateViewport(); … … 4612 4628 VBOXVHWACMD_SURF_OVERLAY_SETPOSITION * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_SETPOSITION); 4613 4629 makeCurrent(); 4614 pCmd->rc = m pOverlayWidget->vhwaSurfaceOverlaySetPosition(pBody);4615 mOverlayVisible = m pOverlayWidget->hasVisibleOverlays();4630 pCmd->rc = mOverlayImage.vhwaSurfaceOverlaySetPosition(pBody); 4631 mOverlayVisible = mOverlayImage.hasVisibleOverlays(); 4616 4632 if(mOverlayVisible) 4617 4633 { 4618 mOverlayViewport = m pOverlayWidget->overlaysRectUnion();4634 mOverlayViewport = mOverlayImage.overlaysRectUnion(); 4619 4635 } 4620 4636 vboxDoCheckUpdateViewport(); … … 4625 4641 VBOXVHWACMD_SURF_COLORKEY_SET * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_COLORKEY_SET); 4626 4642 makeCurrent(); 4627 pCmd->rc = m pOverlayWidget->vhwaSurfaceColorkeySet(pBody);4643 pCmd->rc = mOverlayImage.vhwaSurfaceColorkeySet(pBody); 4628 4644 /* this is here to ensure we have color key changes picked up */ 4629 4645 vboxDoCheckUpdateViewport(); … … 4635 4651 initGl(); 4636 4652 makeCurrent(); 4637 pCmd->rc = m pOverlayWidget->vhwaQueryInfo1(pBody);4653 pCmd->rc = mOverlayImage.vhwaQueryInfo1(pBody); 4638 4654 } break; 4639 4655 case VBOXVHWACMD_TYPE_QUERY_INFO2: … … 4641 4657 VBOXVHWACMD_QUERYINFO2 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO2); 4642 4658 makeCurrent(); 4643 pCmd->rc = m pOverlayWidget->vhwaQueryInfo2(pBody);4659 pCmd->rc = mOverlayImage.vhwaQueryInfo2(pBody); 4644 4660 } break; 4645 4661 case VBOXVHWACMD_TYPE_ENABLE: … … 4675 4691 int VBoxQGLOverlay::vhwaLoadExec(struct SSMHANDLE * pSSM, uint32_t u32Version) 4676 4692 { 4677 return VBox GLWidget::vhwaLoadExec(&mOnResizeCmdList, pSSM, u32Version);4693 return VBoxVHWAImage::vhwaLoadExec(&mOnResizeCmdList, pSSM, u32Version); 4678 4694 } 4679 4695 4680 4696 void VBoxQGLOverlay::vhwaSaveExec(struct SSMHANDLE * pSSM) 4681 4697 { 4682 if(mpOverlayWidget) 4683 mpOverlayWidget->vhwaSaveExec(pSSM); 4684 else 4685 VBoxGLWidget::vhwaSaveExecVoid(pSSM); 4698 mOverlayImage.vhwaSaveExec(pSSM); 4686 4699 } 4687 4700 … … 4713 4726 ); 4714 4727 AssertRC(rc); 4728 if (RT_SUCCESS(rc)) 4729 { 4730 rc = mOverlayImage.vhwaConstruct(pCmd); 4731 AssertRC(rc); 4732 } 4715 4733 return rc; 4716 4734 } … … 4756 4774 vboxDoVHWACmd(pCmd->vhwaCmd()); 4757 4775 break; 4758 case VBOXVHWA_PIPECMD_OP:4759 {4760 const VBOXVHWACALLBACKINFO & info = pCmd->op();4761 (info.pThis->*(info.pfnCallback))(info.pContext);4762 break;4763 }4764 4776 case VBOXVHWA_PIPECMD_FUNC: 4765 4777 { … … 5176 5188 uint32_t type = calcProgramType(pDst, pDstCKey, pSrcCKey, bNotIntersected); 5177 5189 5178 return mProgramMngr->getProgram(type, & colorFormat(), pDst ? &pDst->colorFormat() : NULL);5190 return mProgramMngr->getProgram(type, &pixelFormat(), pDst ? &pDst->pixelFormat() : NULL); 5179 5191 } 5180 5192 … … 5265 5277 if(pSrcCKey) 5266 5278 { 5267 VBoxVHWATextureImage::setCKey(pProgram, & colorFormat(), pSrcCKey, false);5279 VBoxVHWATextureImage::setCKey(pProgram, &pixelFormat(), pSrcCKey, false); 5268 5280 } 5269 5281 if(pDstCKey) 5270 5282 { 5271 VBoxVHWATextureImage::setCKey(pProgram, &pDst-> colorFormat(), pDstCKey, true);5283 VBoxVHWATextureImage::setCKey(pProgram, &pDst->pixelFormat(), pDstCKey, true); 5272 5284 } 5273 5285 pProgram->stop(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h
r26862 r27682 242 242 bool equals (const VBoxVHWAColorFormat & other) const; 243 243 244 ulong toVBoxPixelFormat() const 245 { 246 if (!mDataFormat) 247 { 248 /* RGB data */ 249 switch (mFormat) 250 { 251 case GL_BGRA_EXT: 252 return FramebufferPixelFormat_FOURCC_RGB; 253 } 254 } 255 return FramebufferPixelFormat_Opaque; 256 } 257 244 258 private: 245 259 void init(uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b); … … 493 507 uint32_t bytesPerLine() { return mpTex[0]->bytesPerLine(); } 494 508 495 const VBoxVHWAColorFormat & colorFormat() { return mColorFormat; }509 const VBoxVHWAColorFormat &pixelFormat() { return mColorFormat; } 496 510 497 511 uint32_t numComponents() {return mcTex;} … … 737 751 { 738 752 public: 739 VBoxVHWASurfaceBase ( 740 class VBoxGLWidget *aWidget, 753 VBoxVHWASurfaceBase (class VBoxVHWAImage *pImage, 741 754 const QSize & aSize, 742 755 const QRect & aTargRect, … … 778 791 ulong memSize(); 779 792 780 ulong width() { return mRect.width(); }781 ulong height() { return mRect.height(); }782 const QSize size() {return mRect.size();}783 784 uint32_t fourcc() {return mImage->colorFormat().fourcc(); }785 786 ulong bitsPerPixel() { return mImage->colorFormat().bitsPerPixel(); }787 ulong bytesPerLine() { return mImage->bytesPerLine(); }793 ulong width() const { return mRect.width(); } 794 ulong height() const { return mRect.height(); } 795 const QSize size() const {return mRect.size();} 796 797 uint32_t fourcc() const {return mImage->pixelFormat().fourcc(); } 798 799 ulong bitsPerPixel() const { return mImage->pixelFormat().bitsPerPixel(); } 800 ulong bytesPerLine() const { return mImage->bytesPerLine(); } 788 801 789 802 const VBoxVHWAColorKey * dstBltCKey() const { return mpDstBltCKey; } … … 884 897 } 885 898 886 const VBoxVHWAColorFormat & colorFormat() { return mImage->colorFormat(); }899 const VBoxVHWAColorFormat & pixelFormat() const { return mImage->pixelFormat(); } 887 900 888 901 void setAddress(uchar * addr); … … 951 964 VBoxVHWASurfaceBase *mpPrimary; 952 965 953 class VBoxGLWidget *mWidget;954 955 966 uint32_t mHGHandle; 967 968 class VBoxVHWAImage *mpImage; 956 969 957 970 #ifdef DEBUG … … 1133 1146 }; 1134 1147 1135 typedef void (VBoxGLWidget::*PFNVBOXQGLOP)(void* );1136 1137 1148 typedef void (*PFNVBOXQGLFUNC)(void*, void*); 1138 1149 … … 1141 1152 VBOXVHWA_PIPECMD_PAINT = 1, 1142 1153 VBOXVHWA_PIPECMD_VHWA, 1143 VBOXVHWA_PIPECMD_OP, 1144 VBOXVHWA_PIPECMD_FUNC, 1154 VBOXVHWA_PIPECMD_FUNC 1145 1155 }VBOXVHWA_PIPECMD_TYPE; 1146 1147 typedef struct VBOXVHWACALLBACKINFO1148 {1149 VBoxGLWidget *pThis;1150 PFNVBOXQGLOP pfnCallback;1151 void * pContext;1152 }VBOXVHWACALLBACKINFO;1153 1156 1154 1157 typedef struct VBOXVHWAFUNCCALLBACKINFO … … 1172 1175 mType = VBOXVHWA_PIPECMD_PAINT; 1173 1176 mRect = aRect; 1174 }1175 1176 void setOp(const VBOXVHWACALLBACKINFO & aOp)1177 {1178 mType = VBOXVHWA_PIPECMD_OP;1179 u.mCallback = aOp;1180 1177 } 1181 1178 … … 1195 1192 case VBOXVHWA_PIPECMD_VHWA: 1196 1193 setVHWACmd((struct _VBOXVHWACMD *)pvData); 1197 break;1198 case VBOXVHWA_PIPECMD_OP:1199 setOp(*((VBOXVHWACALLBACKINFO *)pvData));1200 1194 break; 1201 1195 case VBOXVHWA_PIPECMD_FUNC: … … 1211 1205 const QRect & rect() const {return mRect;} 1212 1206 struct _VBOXVHWACMD * vhwaCmd() const {return u.mpCmd;} 1213 const VBOXVHWACALLBACKINFO & op() const {return u.mCallback; }1214 1207 const VBOXVHWAFUNCCALLBACKINFO & func() const {return u.mFuncCallback; } 1215 1208 … … 1220 1213 { 1221 1214 struct _VBOXVHWACMD * mpCmd; 1222 VBOXVHWACALLBACKINFO mCallback;1223 1215 VBOXVHWAFUNCCALLBACKINFO mFuncCallback; 1224 1216 }u; … … 1335 1327 }; 1336 1328 1337 class VBoxGLWidget : public QGLWidget 1338 { 1339 public: 1340 VBoxGLWidget (CConsole console, QWidget *aParent, VBoxVHWASettings *aSettings); 1341 ~VBoxGLWidget(); 1342 1343 ulong vboxPixelFormat() { return mPixelFormat; } 1344 bool vboxUsesGuestVRAM() { return mUsesGuestVRAM; } 1345 1346 uchar *vboxAddress() { return mDisplay.getVGA() ? mDisplay.getVGA()->address() : NULL; } 1347 1329 /* added to workaround this ** [VBox|UI] duplication */ 1330 class VBoxFBSizeInfo 1331 { 1332 public: 1333 VBoxFBSizeInfo() {} 1334 template<class T> VBoxFBSizeInfo(T * e) : 1335 mPixelFormat(e->pixelFormat()), mVRAM(e->VRAM()), mBitsPerPixel(e->bitsPerPixel()), 1336 mBytesPerLine(e->bytesPerLine()), mWidth(e->width()), mHeight(e->height()) {} 1337 1338 VBoxFBSizeInfo(ulong aPixelFormat, uchar *aVRAM, 1339 ulong aBitsPerPixel, ulong aBytesPerLine, 1340 ulong aWidth, ulong aHeight) : 1341 mPixelFormat (aPixelFormat), mVRAM (aVRAM), mBitsPerPixel (aBitsPerPixel), 1342 mBytesPerLine (aBytesPerLine), mWidth (aWidth), mHeight (aHeight) {} 1343 ulong pixelFormat() const { return mPixelFormat; } 1344 uchar *VRAM() const { return mVRAM; } 1345 ulong bitsPerPixel() const { return mBitsPerPixel; } 1346 ulong bytesPerLine() const { return mBytesPerLine; } 1347 ulong width() const { return mWidth; } 1348 ulong height() const { return mHeight; } 1349 1350 private: 1351 ulong mPixelFormat; 1352 uchar *mVRAM; 1353 ulong mBitsPerPixel; 1354 ulong mBytesPerLine; 1355 ulong mWidth; 1356 ulong mHeight; 1357 }; 1358 1359 class VBoxVHWAImage 1360 { 1361 public: 1362 VBoxVHWAImage (); 1363 ~VBoxVHWAImage(); 1364 1365 int init(VBoxVHWASettings *aSettings); 1348 1366 #ifdef VBOX_WITH_VIDEOHWACCEL 1349 1367 uchar *vboxVRAMAddressFromOffset(uint64_t offset); … … 1369 1387 int vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd); 1370 1388 1389 void *vramBase() { return mpvVRAM; } 1390 uint32_t vramSize() { return mcbVRAM; } 1391 1371 1392 bool hasSurfaces() const; 1372 1393 bool hasVisibleOverlays(); … … 1375 1396 #endif 1376 1397 1398 static const QGLFormat & vboxGLFormat(); 1399 1377 1400 int reset(VHWACommandList * pCmdList); 1378 1401 1379 ulong vboxBitsPerPixel() { return mDisplay.getVGA()->bitsPerPixel(); }1380 ulong vboxBytesPerLine() { return mDisplay.getVGA() ? mDisplay.getVGA()->bytesPerLine() : 0; }1402 // ulong vboxBitsPerPixel() { return mDisplay.getVGA()->bitsPerPixel(); } 1403 // ulong vboxBytesPerLine() { return mDisplay.getVGA() ? mDisplay.getVGA()->bytesPerLine() : 0; } 1381 1404 int vboxFbWidth() {return mDisplay.getVGA()->width(); } 1382 1405 int vboxFbHeight() {return mDisplay.getVGA()->height(); } 1383 bool vboxIsInitialized() {return mDisplay.getVGA() != NULL; } 1384 1385 void vboxDoResize(void *re); 1386 1387 void vboxResizeEvent (void *re) {vboxPerformGLOp(&VBoxGLWidget::vboxDoResize, re); } 1388 1389 void vboxProcessVHWACommands(class VBoxVHWACommandElementProcessor * pPipe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoProcessVHWACommands, pPipe);} 1406 bool isInitialized() {return mDisplay.getVGA() != NULL; } 1407 1408 void resize(const VBoxFBSizeInfo & size); 1390 1409 1391 1410 class VBoxVHWAGlProgramMngr * vboxVHWAGetGlProgramMngr() { return mpMngr; } 1392 1411 1393 VBoxVHWASurfaceBase * v boxGetVGASurface() { return mDisplay.getVGA(); }1412 VBoxVHWASurfaceBase * vgaSurface() { return mDisplay.getVGA(); } 1394 1413 1395 1414 #ifdef VBOXVHWA_OLD_COORD … … 1406 1425 #endif 1407 1426 1408 bool performDisplay AndSwap(bool bForce)1427 bool performDisplay(bool bForce) 1409 1428 { 1410 1429 bForce = mDisplay.performDisplay(bForce | mRepaintNeeded); 1411 if(bForce)1412 {1413 swapBuffers();1414 }1415 1430 1416 1431 #ifdef VBOXVHWA_PROFILE_FPS … … 1429 1444 } 1430 1445 1431 VHWACommandList &onResizeCmdList() { return mOnResizeCmdList; }1446 // VHWACommandList &onResizeCmdList() { return mOnResizeCmdList; } 1432 1447 1433 1448 static void pushSettingsAndSetupViewport(const QSize &display, const QRect &viewport) … … 1448 1463 } 1449 1464 1450 protected:1451 1452 void paintGL()1453 {1454 if(mpfnOp)1455 {1456 (this->*mpfnOp)(mOpContext);1457 mpfnOp = NULL;1458 }1459 VBOXQGLLOG(("paintGL\n"));1460 1461 mDisplay.performDisplay(true);1462 }1463 1464 void initializeGL();1465 1466 1465 private: 1467 1466 static void setupMatricies(const QSize &display, bool bInvert); … … 1473 1472 #endif 1474 1473 #ifdef VBOX_WITH_VIDEOHWACCEL 1475 void vboxDoVHWACmdExec(void *cmd);1476 void vboxDoVHWACmdAndFree(void *cmd);1477 void vboxDoVHWACmd(void *cmd);1474 // void vboxDoVHWACmdExec(void *cmd); 1475 // void vboxDoVHWACmdAndFree(void *cmd); 1476 // void vboxDoVHWACmd(void *cmd); 1478 1477 1479 1478 void vboxCheckUpdateAddress (VBoxVHWASurfaceBase * pSurface, uint64_t offset) … … 1497 1496 void vhwaDoSurfaceOverlayUpdate(VBoxVHWASurfaceBase *pDstSurf, VBoxVHWASurfaceBase *pSrcSurf, struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd); 1498 1497 #endif 1499 static const QGLFormat & vboxGLFormat();1500 1498 1501 1499 VBoxVHWADisplay mDisplay; 1502 1500 1503 1504 /* we do all opengl stuff in the paintGL context, 1505 * submit the operation to be performed 1506 * @todo: could be moved outside the updateGL */ 1507 void vboxPerformGLOp(PFNVBOXQGLOP pfn, void* pContext) 1508 { 1509 mpfnOp = pfn; 1510 mOpContext = pContext; 1511 updateGL(); 1512 } 1513 1514 void vboxDoProcessVHWACommands(void *pContext); 1515 1516 class VBoxVHWACommandElement * processCmdList(class VBoxVHWACommandElement * pCmd); 1501 // void vboxDoProcessVHWACommands(void *pContext); 1502 1503 // class VBoxVHWACommandElement * processCmdList(class VBoxVHWACommandElement * pCmd); 1517 1504 1518 1505 VBoxVHWASurfaceBase* handle2Surface(uint32_t h) … … 1525 1512 VBoxVHWAHandleTable mSurfHandleTable; 1526 1513 1527 PFNVBOXQGLOP mpfnOp;1528 void *mOpContext;1529 1530 ulong mPixelFormat;1531 bool mUsesGuestVRAM;1532 1533 1514 bool mRepaintNeeded; 1534 1515 1535 1516 QRect mViewport; 1536 1537 CConsole m_console;1538 1517 1539 1518 VBoxVHWASurfList *mConstructingList; … … 1542 1521 /* this is used in saved state restore to postpone surface restoration 1543 1522 * till the framebuffer size is restored */ 1544 VHWACommandList mOnResizeCmdList;1523 // VHWACommandList mOnResizeCmdList; 1545 1524 1546 1525 class VBoxVHWAGlProgramMngr *mpMngr; 1547 1526 1548 1527 VBoxVHWASettings *mSettings; 1528 1529 void *mpvVRAM; 1530 uint32_t mcbVRAM; 1549 1531 1550 1532 #ifdef VBOXVHWA_PROFILE_FPS … … 1552 1534 bool mbNewFrame; 1553 1535 #endif 1536 }; 1537 1538 class VBoxGLWgt : public QGLWidget 1539 { 1540 public: 1541 VBoxGLWgt(VBoxVHWAImage * pImage, 1542 QWidget* parent, const QGLWidget* shareWidget); 1543 1544 protected: 1545 void paintGL() 1546 { 1547 mpImage->performDisplay(true); 1548 } 1549 private: 1550 VBoxVHWAImage * mpImage; 1554 1551 }; 1555 1552 … … 1645 1642 T::update(pRect); 1646 1643 1647 VBox GLWidget::pushSettingsAndSetupViewport(rect().size(), rect());1644 VBoxVHWAImage::pushSettingsAndSetupViewport(rect().size(), rect()); 1648 1645 mFBO.bind(); 1649 1646 T::display(); 1650 1647 mFBO.unbind(); 1651 VBox GLWidget::popSettingsAfterSetupViewport();1648 VBoxVHWAImage::popSettingsAfterSetupViewport(); 1652 1649 } 1653 1650 … … 1673 1670 { 1674 1671 public: 1675 VBoxQGLOverlay (class VBoxConsoleView *aView, class VBoxFrameBuffer * aContainer, CSession * aSession); 1672 VBoxQGLOverlay (QWidget *pViewport, QObject *pPostEventObject, CSession * aSession); 1673 ~VBoxQGLOverlay() 1674 { 1675 if (mpShareWgt) 1676 delete mpShareWgt; 1677 } 1678 1679 void updateViewport(QWidget *pViewport); 1676 1680 1677 1681 int onVHWACommand (struct _VBOXVHWACMD * pCommand); … … 1699 1703 } 1700 1704 1701 void onResizeEvent (const class VBoxResizeEvent *re); 1702 void onResizeEventPostprocess (const class VBoxResizeEvent *re); 1705 void onResizeEventPostprocess (const VBoxFBSizeInfo &re, const QPoint & topLeft); 1703 1706 1704 1707 void onViewportResized (QResizeEvent * /*re*/) … … 1708 1711 } 1709 1712 1710 void onViewportScrolled (int /*dx*/, int /*dy*/) 1711 { 1713 void onViewportScrolled (const QPoint & newTopLeft) 1714 { 1715 mContentsTopLeft = newTopLeft; 1712 1716 vboxDoCheckUpdateViewport(); 1713 1717 mGlCurrent = false; … … 1737 1741 { 1738 1742 mNeedSetVisible = false; 1739 mpOverlayW idget->setVisible (true);1743 mpOverlayWgt->setVisible (true); 1740 1744 } 1741 1745 } … … 1748 1752 void makeCurrent() 1749 1753 { 1750 if (!mGlCurrent)1754 if (!mGlCurrent) 1751 1755 { 1752 1756 mGlCurrent = true; 1753 mpOverlayW idget->makeCurrent();1757 mpOverlayWgt->makeCurrent(); 1754 1758 } 1755 1759 } … … 1757 1761 void performDisplayOverlay() 1758 1762 { 1759 if (mOverlayVisible)1763 if (mOverlayVisible) 1760 1764 { 1761 1765 makeCurrent(); 1762 mpOverlayWidget->performDisplayAndSwap (false); 1766 if (mOverlayImage.performDisplay(false)) 1767 mpOverlayWgt->swapBuffers(); 1763 1768 } 1764 1769 } … … 1783 1788 void initGl(); 1784 1789 1785 VBoxGLW idget *mpOverlayWidget;1786 class VBoxConsoleView *mView;1787 class VBoxFrameBuffer *mContainer;1790 VBoxGLWgt *mpOverlayWgt; 1791 VBoxVHWAImage mOverlayImage; 1792 QWidget *mpViewport; 1788 1793 bool mGlOn; 1789 1794 bool mOverlayWidgetVisible; … … 1803 1808 1804 1809 VBoxVHWASettings mSettings; 1805 }; 1806 1807 1808 template <class T> 1810 CSession * mpSession; 1811 1812 VBoxFBSizeInfo mSizeInfo; 1813 QPoint mContentsTopLeft; 1814 1815 QGLWidget *mpShareWgt; 1816 }; 1817 1818 /* these two additional class V, class R are to workaround the [VBox|UI] duplication, 1819 * @todo: remove them once VBox stuff is removed */ 1820 template <class T, class V, class R> 1809 1821 class VBoxOverlayFrameBuffer : public T 1810 1822 { 1811 1823 public: 1812 VBoxOverlayFrameBuffer (class VBoxConsoleView *aView, CSession * aSession) 1813 : T (aView), 1814 mOverlay (aView, this, aSession) 1824 VBoxOverlayFrameBuffer (V *pView, QWidget *pWidget, CSession * aSession) 1825 : T (pView), 1826 mOverlay (pWidget, pView, aSession), 1827 mpView (pView) 1815 1828 {} 1816 1829 … … 1852 1865 } 1853 1866 1854 void resizeEvent (VBoxResizeEvent *re) 1855 { 1856 mOverlay.onResizeEvent (re); 1867 void resizeEvent (R *re) 1868 { 1857 1869 T::resizeEvent (re); 1858 mOverlay.onResizeEventPostprocess (re); 1870 mOverlay.onResizeEventPostprocess (VBoxFBSizeInfo(re), 1871 QPoint(mpView->contentsX(), mpView->contentsY())); 1859 1872 } 1860 1873 … … 1867 1880 void viewportScrolled (int dx, int dy) 1868 1881 { 1869 mOverlay.onViewportScrolled ( dx, dy);1882 mOverlay.onViewportScrolled (QPoint(mpView->contentsX(), mpView->contentsY())); 1870 1883 T::viewportScrolled (dx, dy); 1871 1884 } 1872 1885 private: 1873 1886 VBoxQGLOverlay mOverlay; 1887 V *mpView; 1874 1888 }; 1875 1889 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQGL.cpp
r26719 r27682 19 19 * additional information or have any questions. 20 20 */ 21 #if defined (VBOX_GUI_USE_QGL )21 #if defined (VBOX_GUI_USE_QGLFB) 22 22 23 23 #ifdef VBOX_WITH_PRECOMPILED_HEADERS -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.cpp
r26719 r27682 450 450 ///////////////////////////////////////////////////////////////////////////// 451 451 452 #if defined (VBOX_GUI_USE_QGL )452 #if defined (VBOX_GUI_USE_QGLFB) 453 453 454 454 /* The class is defined in VBoxFBQGL.cpp */ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.h
r26719 r27682 296 296 ///////////////////////////////////////////////////////////////////////////// 297 297 298 #if defined (VBOX_GUI_USE_QGL )298 #if defined (VBOX_GUI_USE_QGLFB) 299 299 300 300 class VBoxQGLFrameBuffer : public VBoxFrameBuffer -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h
r27609 r27682 83 83 { 84 84 InvalidRenderMode, TimerMode, QImageMode, SDLMode, DDRAWMode, Quartz2DMode 85 #ifdef VBOX_GUI_USE_QGL 85 #ifdef VBOX_GUI_USE_QGLFB 86 86 , QGLMode 87 87 #endif -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r27600 r27682 576 576 mode = VBoxDefs::Quartz2DMode; 577 577 #endif 578 #if defined (VBOX_GUI_USE_QGL )578 #if defined (VBOX_GUI_USE_QGLFB) 579 579 else if (::strcmp (aModeStr, "qgl") == 0) 580 580 mode = VBoxDefs::QGLMode; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQGL.cpp
r27107 r27682 19 19 * additional information or have any questions. 20 20 */ 21 #if defined (VBOX_GUI_USE_QGL )21 #if defined (VBOX_GUI_USE_QGLFB) 22 22 23 23 #ifdef VBOX_WITH_PRECOMPILED_HEADERS -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQGL.h
r26797 r27682 26 26 /* Global includes */ 27 27 #include "UIFrameBuffer.h" 28 #if defined (VBOX_GUI_USE_QGL )28 #if defined (VBOX_GUI_USE_QGLFB) 29 29 #include "VBoxFBOverlay.h" 30 30 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r27454 r27682 37 37 #include "UIFrameBufferQuartz2D.h" 38 38 #include "UIFrameBufferSDL.h" 39 #include "VBoxFBOverlay.h" 39 40 #include "UISession.h" 40 41 #include "UIActionsPool.h" … … 463 464 { 464 465 /* Prepare viewport: */ 465 #ifdef VBOX_GUI_USE_QGL 466 #ifdef VBOX_GUI_USE_QGLFB 466 467 QWidget *pViewport; 467 468 switch (mode()) … … 486 487 #ifdef VBOX_GUI_USE_QIMAGE 487 488 case VBoxDefs::QImageMode: 488 //# ifdef VBOX_WITH_VIDEOHWACCEL 489 // m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<UIFrameBufferQImage>(this, &machineWindowWrapper()->session()) : new UIFrameBufferQImage(this); 490 //# else 489 # ifdef VBOX_WITH_VIDEOHWACCEL 490 /* these two additional template args is a workaround to this [VBox|UI] duplication 491 * @todo: they are to be removed once VBox stuff is gone */ 492 m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<UIFrameBufferQImage, UIMachineView, UIResizeEvent>(this, viewport(), &machineWindowWrapper()->session()) : new UIFrameBufferQImage(this); 493 # else 491 494 m_pFrameBuffer = new UIFrameBufferQImage(this); 492 //# endif495 # endif 493 496 break; 494 497 #endif /* VBOX_GUI_USE_QIMAGE */ 495 #ifdef VBOX_GUI_USE_QGL 498 #ifdef VBOX_GUI_USE_QGLFB 496 499 case VBoxDefs::QGLMode: 497 500 m_pFrameBuffer = new UIFrameBufferQGL(this); … … 500 503 // m_pFrameBuffer = new UIQGLOverlayFrameBuffer(this); 501 504 // break; 502 #endif /* VBOX_GUI_USE_QGL */505 #endif /* VBOX_GUI_USE_QGLFB */ 503 506 #ifdef VBOX_GUI_USE_SDL 504 507 case VBoxDefs::SDLMode: … … 510 513 XFlush(QX11Info::display()); 511 514 # endif 512 //# if defined(VBOX_WITH_VIDEOHWACCEL) && defined(DEBUG_misha) /* not tested yet */ 513 // m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<UISDLFrameBuffer> (this, &machineWindowWrapper()->session()) : new UISDLFrameBuffer(this); 514 //# else 515 # if defined(VBOX_WITH_VIDEOHWACCEL) && defined(DEBUG_misha) /* not tested yet */ 516 /* these two additional template args is a workaround to this [VBox|UI] duplication 517 * @todo: they are to be removed once VBox stuff is gone */ 518 m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<UIFrameBufferSDL, UIMachineView, UIResizeEvent> (this, viewport(), &machineWindowWrapper()->session()) : new UIFrameBufferSDL(this); 519 # else 515 520 m_pFrameBuffer = new UIFrameBufferSDL(this); 516 //# endif521 # endif 517 522 /* Disable scrollbars because we cannot correctly draw in a scrolled window using SDL: */ 518 523 horizontalScrollBar()->setEnabled(false); … … 538 543 /* Indicate that we are doing all drawing stuff ourself: */ 539 544 viewport()->setAttribute(Qt::WA_PaintOnScreen); 540 //# ifdef VBOX_WITH_VIDEOHWACCEL 541 // m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer>(this, &machineWindowWrapper()->session()) : new UIFrameBufferQuartz2D(this); 542 //# else 545 # ifdef VBOX_WITH_VIDEOHWACCEL 546 /* these two additional template args is a workaround to this [VBox|UI] duplication 547 * @todo: they are to be removed once VBox stuff is gone */ 548 m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer, UIMachineView, UIResizeEvent>(this, viewport(), &machineWindowWrapper()->session()) : new UIFrameBufferQuartz2D(this); 549 # else 543 550 m_pFrameBuffer = new UIFrameBufferQuartz2D(this); 544 //# endif551 # endif 545 552 break; 546 553 #endif /* VBOX_GUI_USE_QUARTZ2D */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r27679 r27682 264 264 friend class UIFrameBufferQuartz2D; 265 265 friend class UIFrameBufferQGL; 266 template<class UIFrameBufferQImage, class UIMachineView, class UIResizeEvent> friend class VBoxOverlayFrameBuffer; 267 template<class UIFrameBufferQuartz2D, class UIMachineView, class UIResizeEvent> friend class VBoxOverlayFrameBuffer; 268 template<class UIFrameBufferSDL, class UIMachineView, class UIResizeEvent> friend class VBoxOverlayFrameBuffer; 266 269 }; 267 270
Note:
See TracChangeset
for help on using the changeset viewer.