- Timestamp:
- Nov 24, 2009 10:59:37 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxVideo.h
r24646 r24925 320 320 321 321 #define VBOXVHWACMD_HEADSIZE() (RT_OFFSETOF(VBOXVHWACMD, body)) 322 #define VBOXVHWACMD_SIZE(_tCmd) (VBOXVHWACMD_HEADSIZE() + sizeof(_tCmd)) 322 #define VBOXVHWACMD_SIZE_FROMBODYSIZE(_s) (VBOXVHWACMD_HEADSIZE() + (_s)) 323 #define VBOXVHWACMD_SIZE(_tCmd) (VBOXVHWACMD_SIZE_FROMBODYSIZE(sizeof(_tCmd))) 323 324 typedef unsigned int VBOXVHWACMD_LENGTH; 324 325 typedef uint64_t VBOXVHWA_SURFHANDLE; … … 734 735 void * pVM; 735 736 } VBOXVHWACMD_HH_CONSTRUCT; 737 738 typedef DECLCALLBACK(void) FNVBOXVHWA_HH_CALLBACK(void*); 739 typedef FNVBOXVHWA_HH_CALLBACK *PFNVBOXVHWA_HH_CALLBACK; 740 741 #define VBOXVHWA_HH_CALLBACK_SET(_pCmd, _pfn, _parg) \ 742 do { \ 743 (_pCmd)->GuestVBVAReserved1 = (uint64_t)(_pfn); \ 744 (_pCmd)->GuestVBVAReserved2 = (uint64_t)(_parg); \ 745 }while(0) 746 747 #define VBOXVHWA_HH_CALLBACK_GET(_pCmd) ((PFNVBOXVHWA_HH_CALLBACK)(_pCmd)->GuestVBVAReserved1) 748 #define VBOXVHWA_HH_CALLBACK_GET_ARG(_pCmd) ((void*)(_pCmd)->GuestVBVAReserved2) 736 749 737 750 #pragma pack() -
trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c
r24646 r24925 1342 1342 vboxVHWASurfDescFree(pDesc); 1343 1343 1344 lpSurfaceGlobal->dwReserved1 = NULL;1344 lpSurfaceGlobal->dwReserved1 = (ULONG_PTR)NULL; 1345 1345 1346 1346 lpDestroySurface->ddRVal = DD_OK; -
trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
r24779 r24925 1045 1045 } 1046 1046 1047 static DECLCALLBACK(void) vbvaVHWAHHCommandSetEventCallback(void * pContext) 1048 { 1049 RTSemEventSignal((RTSEMEVENT)pContext); 1050 } 1051 1047 1052 static int vbvaVHWAHHCommandPost(PVGASTATE pVGAState, VBOXVHWACMD* pCmd) 1048 1053 { … … 1054 1059 /* ensure the cmd is not deleted until we process it */ 1055 1060 vbvaVHWAHHCommandRetain (pCmd); 1056 pCmd->GuestVBVAReserved1 = (uint64_t)hComplEvent;1061 VBOXVHWA_HH_CALLBACK_SET(pCmd, vbvaVHWAHHCommandSetEventCallback, (void*)hComplEvent); 1057 1062 vbvaVHWAHandleCommand(pVGAState, NULL, pCmd); 1058 1063 if((ASMAtomicReadU32((volatile uint32_t *)&pCmd->Flags) & VBOXVHWACMD_FLAG_HG_ASYNCH) != 0) … … 1249 1254 else 1250 1255 { 1251 if(pCmd->GuestVBVAReserved1)1252 {1253 RTSEMEVENT hComplEvent = (RTSEMEVENT)pCmd->GuestVBVAReserved1;1254 RTSemEventSignal(hComplEvent);1256 PFNVBOXVHWA_HH_CALLBACK pfn = VBOXVHWA_HH_CALLBACK_GET(pCmd); 1257 if(pfn) 1258 { 1259 pfn(VBOXVHWA_HH_CALLBACK_GET_ARG(pCmd)); 1255 1260 } 1256 1261 rc = VINF_SUCCESS; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h
r24861 r24925 1104 1104 #endif 1105 1105 1106 int reset(VHWACommandList * pCmdList); 1107 1106 1108 ulong vboxBitsPerPixel() { return mDisplay.getVGA()->bitsPerPixel(); } 1107 1109 ulong vboxBytesPerLine() { return mDisplay.getVGA() ? mDisplay.getVGA()->bytesPerLine() : 0; } … … 1402 1404 1403 1405 int reset(); 1406 1407 int resetGl(); 1404 1408 1405 1409 void initGl(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
r24867 r24925 165 165 static bool g_bVBoxVHWAChecked = false; 166 166 static bool g_bVBoxVHWASupported = false; 167 168 static struct _VBOXVHWACMD * vhwaHHCmdCreate(VBOXVHWACMD_TYPE type, size_t size) 169 { 170 char *buf = (char*)malloc(VBOXVHWACMD_SIZE_FROMBODYSIZE(size)); 171 memset(buf, 0, size); 172 VBOXVHWACMD * pCmd = (VBOXVHWACMD*)buf; 173 pCmd->enmCmd = type; 174 pCmd->Flags = VBOXVHWACMD_FLAG_HH_CMD; 175 return pCmd; 176 } 167 177 168 178 static const VBoxVHWAInfo & vboxVHWAGetSupportInfo(const QGLContext *pContext) … … 2805 2815 } 2806 2816 2817 int VBoxGLWidget::reset(VHWACommandList * pCmdList) 2818 { 2819 VBOXVHWACMD * pCmd; 2820 const OverlayList & overlays = mDisplay.overlays(); 2821 for (OverlayList::const_iterator oIt = overlays.begin(); 2822 oIt != overlays.end(); ++ oIt) 2823 { 2824 VBoxVHWASurfList * pSurfList = *oIt; 2825 if(pSurfList->current()) 2826 { 2827 /* 1. hide overlay */ 2828 pCmd = vhwaHHCmdCreate(VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE, sizeof(VBOXVHWACMD_SURF_OVERLAY_UPDATE)); 2829 VBOXVHWACMD_SURF_OVERLAY_UPDATE *pOUCmd = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_UPDATE); 2830 pOUCmd->u.in.hSrcSurf = pSurfList->current()->handle(); 2831 pOUCmd->u.in.flags = VBOXVHWA_OVER_HIDE; 2832 2833 pCmdList->push_back(pCmd); 2834 } 2835 2836 /* 2. destroy overlay */ 2837 const SurfList & surfaces = pSurfList->surfaces(); 2838 2839 for (SurfList::const_iterator sIt = surfaces.begin(); 2840 sIt != surfaces.end(); ++ sIt) 2841 { 2842 VBoxVHWASurfaceBase *pCurSurf = (*sIt); 2843 pCmd = vhwaHHCmdCreate(VBOXVHWACMD_TYPE_SURF_DESTROY, sizeof(VBOXVHWACMD_SURF_DESTROY)); 2844 VBOXVHWACMD_SURF_DESTROY *pSDCmd = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY); 2845 pSDCmd->u.in.hSurf = pCurSurf->handle(); 2846 2847 pCmdList->push_back(pCmd); 2848 } 2849 } 2850 2851 /* 3. destroy primaries */ 2852 const SurfList & surfaces = mDisplay.primaries().surfaces(); 2853 for (SurfList::const_iterator sIt = surfaces.begin(); 2854 sIt != surfaces.end(); ++ sIt) 2855 { 2856 VBoxVHWASurfaceBase *pCurSurf = (*sIt); 2857 if(pCurSurf->handle() != VBOXVHWA_SURFHANDLE_INVALID) 2858 { 2859 pCmd = vhwaHHCmdCreate(VBOXVHWACMD_TYPE_SURF_DESTROY, sizeof(VBOXVHWACMD_SURF_DESTROY)); 2860 VBOXVHWACMD_SURF_DESTROY *pSDCmd = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY); 2861 pSDCmd->u.in.hSurf = pCurSurf->handle(); 2862 2863 pCmdList->push_back(pCmd); 2864 } 2865 } 2866 2867 return VINF_SUCCESS; 2868 } 2869 2807 2870 #ifdef VBOX_WITH_VIDEOHWACCEL 2808 2871 void VBoxGLWidget::vboxDoVHWACmd(void *cmd) … … 3900 3963 3901 3964 char *buf = (char*)malloc(VBOXVHWACMD_SIZE(VBOXVHWACMD_SURF_CREATE)); 3902 memset(buf, 0, sizeof( buf));3965 memset(buf, 0, sizeof(VBOXVHWACMD_SIZE(VBOXVHWACMD_SURF_CREATE))); 3903 3966 VBOXVHWACMD * pCmd = (VBOXVHWACMD*)buf; 3904 3967 pCmd->enmCmd = VBOXVHWACMD_TYPE_SURF_CREATE; … … 4059 4122 // char buf[VBOXVHWACMD_SIZE(VBOXVHWACMD_SURF_OVERLAY_UPDATE)]; 4060 4123 char *buf = new char[VBOXVHWACMD_SIZE(VBOXVHWACMD_SURF_CREATE)]; 4061 memset(buf, 0, sizeof(buf));4124 memset(buf, 0, VBOXVHWACMD_SIZE(VBOXVHWACMD_SURF_CREATE)); 4062 4125 VBOXVHWACMD * pCmd = (VBOXVHWACMD*)buf; 4063 4126 pCmd->enmCmd = VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE; … … 4233 4296 if(buf) 4234 4297 { 4235 memset(buf, 0, sizeof( buf));4298 memset(buf, 0, sizeof(VBOXVHWACMD)); 4236 4299 VBOXVHWACMD * pCmd = (VBOXVHWACMD*)buf; 4237 4300 pCmd->enmCmd = VBOXVHWACMD_TYPE_ENABLE; … … 5081 5144 break; 5082 5145 #endif 5146 case VBOXVHWA_PIPECMD_PAINT: 5147 break; 5083 5148 default: 5084 5149 /* should not happen, don't handle this for now */ … … 5088 5153 } 5089 5154 5090 #ifdef DEBUG5091 5155 VBoxVHWACommandElement *pTest = mCmdPipe.detachCmdList(pHead, pTail); 5092 5156 Assert(!pTest); 5093 5157 NOREF(pTest); 5094 #endif 5158 } 5159 5160 resetGl(); 5161 5162 return VINF_SUCCESS; 5163 } 5164 5165 static DECLCALLBACK(void) vbvaVHWAHHCommandFreeCmd(void * pContext) 5166 { 5167 free(pContext); 5168 } 5169 5170 int VBoxQGLOverlay::resetGl() 5171 { 5172 if(mpOverlayWidget) 5173 { 5174 VHWACommandList list; 5175 int rc = mpOverlayWidget->reset(&list); 5176 if(RT_SUCCESS(rc)) 5177 { 5178 for (VHWACommandList::const_iterator sIt = list.begin(); 5179 sIt != list.end(); ++ sIt) 5180 { 5181 VBOXVHWACMD *pCmd = (*sIt); 5182 VBOXVHWA_HH_CALLBACK_SET(pCmd, vbvaVHWAHHCommandFreeCmd, pCmd); 5183 mCmdPipe.postCmd(VBOXVHWA_PIPECMD_VHWA, pCmd, 0); 5184 } 5185 } 5095 5186 } 5096 5187 return VINF_SUCCESS; … … 5134 5225 mGlCurrent = false; /* just a fall-back */ 5135 5226 VBoxVHWACommandElement * pFirst = mCmdPipe.detachCmdList(NULL, NULL); 5136 do 5227 while(pFirst) /* pFirst can be zero right after reset when all pending commands are flushed, 5228 * while events for those commands may still come along */ 5137 5229 { 5138 5230 VBoxVHWACommandElement * pLast = processCmdList(pFirst); 5139 5231 5140 5232 pFirst = mCmdPipe.detachCmdList(pFirst, pLast); 5141 } while(pFirst);5233 } 5142 5234 5143 5235 mProcessingCommands = false; … … 5872 5964 { 5873 5965 Assert(pLast); 5874 pHead = pFirst->pipe().detachList();5875 5966 VBoxVHWACommandElement * pCurHead; 5876 5967 for(VBoxVHWACommandProcessEvent * pCur = pFirst; pCur ; pCur = pCur->mpNext)
Note:
See TracChangeset
for help on using the changeset viewer.