Changeset 32061 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Aug 27, 2010 5:00:41 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r31875 r32061 1359 1359 } 1360 1360 1361 static CRITICAL_SECTION g_VBoxCritSect; 1362 1363 void vboxDispLock() 1364 { 1365 EnterCriticalSection(&g_VBoxCritSect); 1366 } 1367 1368 void vboxDispUnlock() 1369 { 1370 LeaveCriticalSection(&g_VBoxCritSect); 1371 } 1372 1373 void vboxDispLockInit() 1374 { 1375 InitializeCriticalSection(&g_VBoxCritSect); 1376 } 1377 1361 1378 /** 1362 1379 * DLL entry point. … … 1370 1387 case DLL_PROCESS_ATTACH: 1371 1388 { 1389 vboxDispLockInit(); 1390 1372 1391 vboxVDbgPrint(("VBoxDispD3D: DLL loaded.\n")); 1373 1392 #ifdef VBOXWDDMDISP_DEBUG … … 1386 1405 #endif 1387 1406 { 1388 hr = VBoxScreenMRunnerStart(&g_VBoxScreenMonRunner);1389 Assert(hr == S_OK);1407 // hr = VBoxScreenMRunnerStart(&g_VBoxScreenMonRunner); 1408 // Assert(hr == S_OK); 1390 1409 /* succeed in any way */ 1391 1410 hr = S_OK; … … 1410 1429 vboxVDbgVEHandlerUnregister(); 1411 1430 #endif 1412 HRESULT hr = VBoxScreenMRunnerStop(&g_VBoxScreenMonRunner); 1413 Assert(hr == S_OK); 1414 if (hr == S_OK) 1431 HRESULT hr = S_OK; 1432 // hr = VBoxScreenMRunnerStop(&g_VBoxScreenMonRunner); 1433 // Assert(hr == S_OK); 1434 // if (hr == S_OK) 1415 1435 { 1416 1436 #ifdef VBOXDISPMP_TEST … … 1850 1870 Assert(pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE); 1851 1871 pD3DIfTex = (IDirect3DTexture9*)pRc->aAllocations[0].pD3DIf; 1872 #ifdef DEBUG_misha 1873 bool bDo = false; 1874 1875 if (bDo) 1876 { 1877 vboxVDbgDumpSurfData((pDevice, "SetTexture:\n", pRc, 0 /* alloc index*/, NULL, NULL, "\n")); 1878 } 1879 #endif 1852 1880 } 1853 1881 else … … 5722 5750 vboxVDbgPrint(("==> "__FUNCTION__"\n")); 5723 5751 5752 // vboxDispLock(); 5753 5754 HRESULT hr = E_FAIL; 5755 5756 do 5757 { 5758 5724 5759 VBOXWDDM_QI Query; 5725 5760 D3DDDICB_QUERYADAPTERINFO DdiQuery; 5726 5761 DdiQuery.PrivateDriverDataSize = sizeof(Query); 5727 5762 DdiQuery.pPrivateDriverData = &Query; 5728 HRESULThr = pOpenData->pAdapterCallbacks->pfnQueryAdapterInfoCb(pOpenData->hAdapter, &DdiQuery);5763 hr = pOpenData->pAdapterCallbacks->pfnQueryAdapterInfoCb(pOpenData->hAdapter, &DdiQuery); 5729 5764 Assert(hr == S_OK); 5730 5765 if (hr != S_OK) 5731 5766 { 5732 5767 vboxVDbgPrintR((__FUNCTION__": pfnQueryAdapterInfoCb failed, hr (%d)\n", hr)); 5733 return E_FAIL; 5768 hr = E_FAIL; 5769 break; 5734 5770 } 5735 5771 … … 5740 5776 VBOXVIDEOIF_VERSION, 5741 5777 Query.u32Version)); 5742 return E_FAIL; 5778 hr = E_FAIL; 5779 break; 5743 5780 } 5744 5781 … … 5782 5819 if (hr == S_OK) 5783 5820 { 5821 // Assert(0); 5784 5822 hr = pAdapter->D3D.pfnDirect3DCreate9Ex(D3D_SDK_VERSION, &pAdapter->pD3D9If); 5785 5823 Assert(hr == S_OK); … … 5823 5861 } 5824 5862 5863 } while (0); 5864 5865 // vboxDispUnlock(); 5866 5825 5867 vboxVDbgPrint(("<== "__FUNCTION__", hr (%d)\n", hr)); 5826 5868 … … 5851 5893 Assert(pRect->bottom > pRect->top); 5852 5894 vboxVDbgMpPrintRect((pDevice, "rect: ", pRect, "\n")); 5895 } 5896 5897 BOOL bReleaseSurf = false; 5898 if (!pSurf) 5899 { 5900 HRESULT tmpHr = vboxWddmSurfGet(pRc, iAlloc, &pSurf); 5901 Assert(tmpHr == S_OK); 5902 bReleaseSurf = TRUE; 5853 5903 } 5854 5904 HRESULT srcHr = pSurf->LockRect(&Lr, NULL, D3DLOCK_READONLY); … … 5876 5926 vboxVDbgMpPrint((pDevice, "%s\n", pSuffix)); 5877 5927 } 5928 5929 if (bReleaseSurf) 5930 pSurf->Release(); 5878 5931 } 5879 5932 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxScreen.cpp
r31756 r32061 479 479 { 480 480 PVBOXSCREENMONRUNNER pRunner = (PVBOXSCREENMONRUNNER)pvUser; 481 Assert(0); 482 483 BOOL bRc = SetEvent(pRunner->hEvent); 484 if (!bRc) 485 { 486 DWORD winErr = GetLastError(); 487 Log((__FUNCTION__": SetEvent failed, winErr = (%d)", winErr)); 488 HRESULT tmpHr = HRESULT_FROM_WIN32(winErr); 489 Assert(0); 490 Assert(tmpHr != S_OK); 491 } 481 492 482 493 HRESULT hr = vboxScreenMonInit(); … … 497 508 memset(pMon, 0, sizeof (VBOXSCREENMONRUNNER)); 498 509 499 pMon->hThread = CreateThread(NULL /* LPSECURITY_ATTRIBUTES lpThreadAttributes */, 500 0 /* SIZE_T dwStackSize */, 501 vboxScreenMRunnerThread, 502 pMon, 503 0 /* DWORD dwCreationFlags */, 504 &pMon->idThread); 505 if (pMon->hThread) 506 return S_OK; 507 508 DWORD winErr = GetLastError(); 509 Log((__FUNCTION__": CreateThread failed, winErr = (%d)", winErr)); 510 hr = HRESULT_FROM_WIN32(winErr); 511 Assert(0); 512 Assert(hr != S_OK); 510 pMon->hEvent = CreateEvent(NULL, /* LPSECURITY_ATTRIBUTES lpEventAttributes*/ 511 FALSE, /* BOOL bManualReset*/ 512 FALSE, /* BOOL bInitialState */ 513 NULL /* LPCTSTR lpName */ 514 ); 515 if (pMon->hEvent) 516 { 517 pMon->hThread = CreateThread(NULL /* LPSECURITY_ATTRIBUTES lpThreadAttributes */, 518 0 /* SIZE_T dwStackSize */, 519 vboxScreenMRunnerThread, 520 pMon, 521 0 /* DWORD dwCreationFlags */, 522 &pMon->idThread); 523 if (pMon->hThread) 524 { 525 Assert(0); 526 return S_OK; 527 } 528 else 529 { 530 DWORD winErr = GetLastError(); 531 Log((__FUNCTION__": CreateThread failed, winErr = (%d)", winErr)); 532 hr = HRESULT_FROM_WIN32(winErr); 533 Assert(0); 534 Assert(hr != S_OK); 535 } 536 CloseHandle(pMon->hEvent); 537 } 538 else 539 { 540 DWORD winErr = GetLastError(); 541 Log((__FUNCTION__": CreateEvent failed, winErr = (%d)", winErr)); 542 hr = HRESULT_FROM_WIN32(winErr); 543 Assert(0); 544 Assert(hr != S_OK); 545 } 513 546 514 547 return hr; … … 520 553 return S_OK; 521 554 522 BOOL bResult = PostThreadMessage(pMon->idThread, WM_QUIT, 0, 0); 523 HRESULT hr = S_OK; 524 if (bResult) 525 { 526 DWORD dwErr = WaitForSingleObject(pMon->hThread, INFINITE); 527 if (dwErr == WAIT_OBJECT_0) 528 { 529 CloseHandle(pMon->hThread); 530 pMon->hThread = 0; 555 Assert(0); 556 557 HANDLE ahHandles[2]; 558 ahHandles[0] = pMon->hThread; 559 ahHandles[1] = pMon->hEvent; 560 DWORD dwResult = WaitForMultipleObjects(2, ahHandles, 561 FALSE, /* BOOL bWaitAll */ 562 INFINITE /* DWORD dwMilliseconds */ 563 ); 564 HRESULT hr = E_FAIL; 565 if (dwResult == WAIT_OBJECT_0 + 1) /* Event is signaled */ 566 { 567 BOOL bResult = PostThreadMessage(pMon->idThread, WM_QUIT, 0, 0); 568 if (bResult) 569 { 570 DWORD dwErr = WaitForSingleObject(pMon->hThread, INFINITE); 571 if (dwErr == WAIT_OBJECT_0) 572 { 573 hr = S_OK; 574 } 575 else 576 { 577 DWORD winErr = GetLastError(); 578 hr = HRESULT_FROM_WIN32(winErr); 579 Assert(0); 580 } 531 581 } 532 582 else 533 583 { 534 584 DWORD winErr = GetLastError(); 535 hr = HRESULT_FROM_WIN32(winErr); 536 Assert(0); 537 } 585 Assert(winErr != ERROR_SUCCESS); 586 if (winErr == ERROR_INVALID_THREAD_ID) 587 { 588 hr = S_OK; 589 } 590 else 591 { 592 hr = HRESULT_FROM_WIN32(winErr); 593 Assert(0); 594 } 595 } 596 } 597 else if (dwResult == WAIT_OBJECT_0) 598 { 599 /* thread has terminated already */ 600 hr = S_OK; 538 601 } 539 602 else 540 603 { 541 DWORD winErr = GetLastError(); 542 Assert(winErr != ERROR_SUCCESS); 543 if (winErr != ERROR_INVALID_THREAD_ID) 544 { 545 hr = HRESULT_FROM_WIN32(winErr); 546 Assert(0); 547 } 548 /* else - treat as OK */ 604 Assert(0); 605 } 606 607 if (hr == S_OK) 608 { 609 CloseHandle(pMon->hThread); 610 pMon->hThread = 0; 611 CloseHandle(pMon->hEvent); 612 pMon->hThread = 0; 549 613 } 550 614 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxScreen.h
r31687 r32061 56 56 HANDLE hThread; 57 57 DWORD idThread; 58 HANDLE hEvent; 58 59 } VBOXSCREENMONRUNNER, *PVBOXSCREENMONRUNNER; 59 60 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c
r31936 r32061 482 482 return hr; 483 483 } 484 #ifdef VBOXWDDM485 if (shared_handle && !*shared_handle)486 {487 *shared_handle = VBOXSHRC_GET_SHAREHANDLE(surface);488 }489 #endif490 484 491 485 return hr; … … 497 491 498 492 #if defined(DEBUG_misha) && defined (VBOXWDDM) 499 if (VBOXSHRC_IS_ SHARED(This))493 if (VBOXSHRC_IS_INITIALIZED(This)) 500 494 { 501 495 Assert(0); … … 2025 2019 ENTER_GL(); 2026 2020 glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); 2027 if(This->texture_name) 2028 { 2029 surface_bind_and_dirtify(This, FALSE); 2030 glTexImage2D(This->texture_target, This->texture_level, 2031 GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); 2032 } 2033 if(This->texture_name_srgb) 2034 { 2035 surface_bind_and_dirtify(This, TRUE); 2036 glTexImage2D(This->texture_target, This->texture_level, 2037 GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); 2021 #ifdef VBOXWDDM 2022 if (!VBOXSHRC_IS_SHARED_OPENED(This)) 2023 #endif 2024 { 2025 if(This->texture_name) 2026 { 2027 surface_bind_and_dirtify(This, FALSE); 2028 glTexImage2D(This->texture_target, This->texture_level, 2029 GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); 2030 } 2031 if(This->texture_name_srgb) 2032 { 2033 surface_bind_and_dirtify(This, TRUE); 2034 glTexImage2D(This->texture_target, This->texture_level, 2035 GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); 2036 } 2038 2037 } 2039 2038 glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); … … 4280 4279 if(((This->Flags & SFLAG_INTEXTURE) && !(flag & SFLAG_INTEXTURE)) || 4281 4280 ((This->Flags & SFLAG_INSRGBTEX) && !(flag & SFLAG_INSRGBTEX))) { 4282 #ifdef VBOXWDDM4283 if (VBOXSHRC_IS_SHARED(This))4284 {4285 IWineD3DSurfaceImpl_LoadLocation(iface, SFLAG_INTEXTURE, NULL);4286 }4287 else4288 #endif4289 4281 if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&texture) == WINED3D_OK) { 4290 4282 TRACE("Passing to container\n"); … … 4293 4285 } 4294 4286 } 4287 4295 4288 This->Flags &= ~SFLAG_LOCATIONS; 4296 4289 This->Flags |= flag; … … 4304 4297 } else { 4305 4298 if((This->Flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)) && (flag & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX))) { 4306 #ifdef VBOXWDDM4307 if (VBOXSHRC_IS_SHARED(This))4308 {4309 IWineD3DSurfaceImpl_LoadLocation(iface, SFLAG_INTEXTURE, NULL);4310 }4311 else4312 #endif4313 4299 if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&texture) == WINED3D_OK) { 4314 4300 TRACE("Passing to container\n"); … … 4317 4303 } 4318 4304 } 4305 4319 4306 This->Flags &= ~flag; 4320 4307 } 4308 4309 #ifdef VBOXWDDM 4310 if(VBOXSHRC_IS_INITIALIZED(This)) { 4311 /* with the shared resource only texture can be considered valid 4312 * to make sure changes done to the resource in the other device context are visible 4313 * because the resource contents is shared via texture. 4314 * This is why we ensure texture location is the one and only which is always valid */ 4315 if(!(This->Flags & SFLAG_INTEXTURE)) { 4316 IWineD3DSurfaceImpl_LoadLocation(iface, SFLAG_INTEXTURE, NULL); 4317 } else { 4318 This->Flags &= ~SFLAG_LOCATIONS; 4319 This->Flags |= SFLAG_INTEXTURE; 4320 } 4321 } 4322 #endif 4321 4323 4322 4324 if(!(This->Flags & SFLAG_LOCATIONS)) { … … 4619 4621 } 4620 4622 4621 if(rect == NULL) { 4622 This->Flags |= flag; 4623 } 4624 4625 if (in_fbo && (This->Flags & (SFLAG_INTEXTURE | SFLAG_INDRAWABLE))) { 4626 /* With ORM_FBO, SFLAG_INTEXTURE and SFLAG_INDRAWABLE are the same for offscreen targets. */ 4627 This->Flags |= (SFLAG_INTEXTURE | SFLAG_INDRAWABLE); 4623 #ifdef VBOXWDDM 4624 if (VBOXSHRC_IS_INITIALIZED(This)) 4625 { 4626 /* with the shared resource only texture can be considered valid 4627 * to make sure changes done to the resource in the other device context are visible 4628 * because the resource contents is shared via texture. 4629 * One can load and use other locations as needed, 4630 * but they should be reloaded each time on each usage */ 4631 Assert(!!(This->Flags & SFLAG_INTEXTURE) || !!(flag & SFLAG_INTEXTURE)); 4632 This->Flags &= ~SFLAG_LOCATIONS; 4633 This->Flags |= SFLAG_INTEXTURE; 4634 /* @todo: SFLAG_INSRGBTEX ?? */ 4635 // if (in_fbo) 4636 // { 4637 // This->Flags |= SFLAG_INDRAWABLE; 4638 // } 4639 } 4640 else 4641 #endif 4642 { 4643 if(rect == NULL) { 4644 This->Flags |= flag; 4645 } 4646 4647 if (in_fbo && (This->Flags & (SFLAG_INTEXTURE | SFLAG_INDRAWABLE))) { 4648 /* With ORM_FBO, SFLAG_INTEXTURE and SFLAG_INDRAWABLE are the same for offscreen targets. */ 4649 This->Flags |= (SFLAG_INTEXTURE | SFLAG_INDRAWABLE); 4650 } 4628 4651 } 4629 4652 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/texture.c
r31936 r32061 620 620 { 621 621 Assert(shared_handle); 622 VBOXSHRC_SET_INITIALIZED(texture); 622 623 IWineD3DSurface_LoadLocation(texture->surfaces[0], SFLAG_INTEXTURE, NULL); 623 624 if (!VBOXSHRC_IS_SHARED_OPENED(texture)) … … 629 630 { 630 631 Assert(*shared_handle); 632 Assert(*shared_handle == VBOXSHRC_GET_SHAREHANDLE(texture)); 631 633 } 632 634 #ifdef DEBUG -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxsharedrc.h
r31936 r32061 17 17 #define ___vboxsharedrc_h___ 18 18 19 #define VBOXSHRC_F_SHARED 0x00000001 /* shared rc */ 20 #define VBOXSHRC_F_SHARED_OPENED 0x00000002 /* if set shared rc is opened, otherwise it is created */ 19 #define VBOXSHRC_F_SHARED 0x00000001 /* shared rc */ 20 #define VBOXSHRC_F_SHARED_OPENED 0x00000002 /* if set shared rc is opened, otherwise it is created */ 21 #define VBOXSHRC_F_INITIALIZED 0x00000004 /* set once shared rc is initialized */ 21 22 22 23 #define VBOXSHRC_GET_SHAREFLAFS(_o) ((_o)->resource.sharerc_flags) 23 24 #define VBOXSHRC_GET_SHAREHANDLE(_o) ((_o)->resource.sharerc_handle) 24 25 #define VBOXSHRC_SET_SHAREHANDLE(_o, _h) ((_o)->resource.sharerc_handle = (_h)) 26 #define VBOXSHRC_SET_INITIALIZED(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) |= VBOXSHRC_F_INITIALIZED) 25 27 #define VBOXSHRC_IS_SHARED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_SHARED)) 26 28 #define VBOXSHRC_IS_SHARED_OPENED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_SHARED_OPENED)) 29 #define VBOXSHRC_IS_INITIALIZED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_INITIALIZED)) 27 30 28 31 #ifdef DEBUG_misha
Note:
See TracChangeset
for help on using the changeset viewer.