Changeset 41109 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- May 2, 2012 8:37:46 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 77709
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
r41058 r41109 2469 2469 return hr; 2470 2470 } 2471 2472 static HRESULT vboxWddmShRcRefAlloc(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL fAddRef, DWORD *pcRefs)2473 {2474 D3DDDICB_ESCAPE DdiEscape = {0};2475 VBOXDISPIFESCAPE_SHRC_REF Data = {0};2476 DdiEscape.hContext = pDevice->DefaultContext.ContextInfo.hContext;2477 DdiEscape.hDevice = pDevice->hDevice;2478 DdiEscape.Flags.HardwareAccess = 1;2479 DdiEscape.pPrivateDriverData = &Data;2480 DdiEscape.PrivateDriverDataSize = sizeof (Data);2481 Data.EscapeHdr.escapeCode = fAddRef ? VBOXESC_SHRC_ADDREF : VBOXESC_SHRC_RELEASE;2482 Data.hAlloc = (uint64_t)pAlloc->hAllocation;2483 HRESULT hr = pDevice->RtCallbacks.pfnEscapeCb(pDevice->pAdapter->hAdapter, &DdiEscape);2484 if (FAILED(hr))2485 {2486 WARN(("pfnEscapeCb, hr (0x%x)", hr));2487 return TRUE;2488 }2489 2490 LOG(("shrc(0x%p) refs(%d)", (void*)pAlloc->hSharedHandle, Data.EscapeHdr.u32CmdSpecific));2491 if (pcRefs)2492 *pcRefs = Data.EscapeHdr.u32CmdSpecific;2493 2494 return hr;2495 }2496 2497 static HRESULT vboxWddmShRcRefRc(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_RESOURCE pRc, BOOL fAddRef, DWORD *pcRefs)2498 {2499 Assert(pRc->RcDesc.fFlags.SharedResource);2500 DWORD cTotalRefs = 0;2501 HRESULT hr = S_OK;2502 for (DWORD i = 0; i < pRc->cAllocations; ++i)2503 {2504 DWORD cRefs = 0;2505 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i];2506 if(!pAlloc->hSharedHandle)2507 continue;2508 2509 hr = vboxWddmShRcRefAlloc(pDevice, pAlloc, fAddRef, &cRefs);2510 2511 if (FAILED(hr))2512 {2513 WARN(("vboxWddmShRcRefAlloc failed, hr()0x%x", hr));2514 for (DWORD j = 0; j < i; ++j)2515 {2516 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i];2517 if(!pAlloc->hSharedHandle)2518 continue;2519 HRESULT tmpHr = vboxWddmShRcRefAlloc(pDevice, pAlloc, !fAddRef, NULL);2520 Assert(SUCCEEDED(tmpHr));2521 }2522 return hr;2523 }2524 2525 /* success! */2526 cTotalRefs += cRefs;2527 }2528 2529 Assert(cTotalRefs || !fAddRef);2530 2531 /* success! */2532 if (pcRefs)2533 *pcRefs = cTotalRefs;2534 2535 return S_OK;2536 }2537 2538 2471 2539 2472 static HRESULT vboxWddmSwapchainChkCreateIf(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain) … … 5681 5614 if (pResource->Flags.SharedResource) 5682 5615 { 5683 if (pAllocation->hSharedHandle)5684 {5685 vboxWddmShRcRefAlloc(pDevice, pAllocation, TRUE, NULL);5686 }5687 5616 #ifdef DEBUG_misha 5688 5617 Assert(VBOXWDDMDISP_IS_TEXTURE(pResource->Flags)); … … 5747 5676 for (UINT i = 0; i < pRc->cAllocations; ++i) 5748 5677 { 5749 BOOL fSetDelete = FALSE;5750 5678 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i]; 5751 5679 if (pAlloc->hSharedHandle) 5752 5680 { 5753 /* using one and the same shared resource by different clients could lead to the situation where one client can still refer to the resource5754 * while another one has deleted it5755 * this could lead to gl state corruption on both host and guest side.5756 * This is why we take extra care to avoid it.5757 * Until we do a vboxWddmShRcRefAlloc call below the resource is guarantied to be present, however it can be removed any time after the call5758 * if cShRcRefs is non-zero, i.e. the current cliet is not the one deleting it.5759 * We first explicitely say to wine that resource must NOT be accessed any more and that all references to it should be cleaned */5760 pAdapter->D3D.pfnVBoxWineExD3DRc9SetShRcState((IDirect3DResource9*)pAlloc->pD3DIf, VBOXWINEEX_SHRC_STATE_GL_DISABLE);5761 5762 DWORD cShRcRefs;5763 HRESULT tmpHr = vboxWddmShRcRefAlloc(pDevice, pAlloc, FALSE, &cShRcRefs);5764 if (!cShRcRefs)5765 {5766 /* the current client IS the one deleting this resource */5767 fSetDelete = TRUE;5768 }5769 5681 #ifdef DEBUG_misha 5770 5682 vboxVDbgPrint(("\n\n********\n(0x%x:0n%d)Shared DESTROYED pAlloc(0x%p), hRc(0x%p), hAl(0x%p), " … … 5775 5687 )); 5776 5688 #endif 5777 }5778 5779 if (fSetDelete)5780 {5781 Assert(pAlloc->pD3DIf);5782 pAdapter->D3D.pfnVBoxWineExD3DRc9SetShRcState((IDirect3DResource9*)pAlloc->pD3DIf, VBOXWINEEX_SHRC_STATE_GL_DELETE);5783 5689 } 5784 5690 … … 7091 6997 Assert(pAllocation->hSharedHandle); 7092 6998 #endif 7093 7094 vboxWddmShRcRefAlloc(pDevice, pAllocation, TRUE, NULL);7095 7096 6999 vboxVDbgPrint(("\n\n********\n(0x%x:0n%d)Shared OPENNED pAlloc(0x%p), hRc(0x%p), hAl(0x%p), " 7097 7000 "Handle(0x%x), (0n%d) \n***********\n\n", -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/Makefile.kmk
r40897 r41109 87 87 endif 88 88 VBoxVideoWddm_DEFS += LOG_TO_BACKDOOR 89 VBoxVideoWddm_INCS += ../../../include .. . ../../../../common/VBoxGuestLib $(VBOX_PATH_CROGL_INCLUDE) 89 VBoxVideoWddm_INCS += ../../../include .. . ../../../../common/VBoxGuestLib $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES) 90 90 VBoxVideoWddm_LDFLAGS.x86 += /Entry:DriverEntry@8 91 91 VBoxVideoWddm_LDFLAGS.amd64 += /Entry:DriverEntry -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.cpp
r40897 r41109 20 20 #include "VBoxMPCr.h" 21 21 22 #include <VBox/HostServices/VBoxCrOpenGLSvc.h> 23 22 24 #include <cr_protocol.h> 23 25 24 #include <VBox/HostServices/VBoxCrOpenGLSvc.h> 26 #if 0 27 #include <cr_pack.h> 28 29 typedef struct PVBOXMP_SHGSMIPACKER 30 { 31 PVBOXMP_DEVEXT pDevExt; 32 CRPackContext CrPacker; 33 CRPackBuffer CrBuffer; 34 } PVBOXMP_SHGSMIPACKER, *PPVBOXMP_SHGSMIPACKER; 35 36 static void* vboxMpCrShgsmiBufferAlloc(PVBOXMP_DEVEXT pDevExt, HGSMISIZE cbData) 37 { 38 return VBoxSHGSMIHeapBufferAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, cbData); 39 } 40 41 static void vboxMpCrShgsmiBufferFree(PVBOXMP_DEVEXT pDevExt, void *pvBuffer) 42 { 43 VBoxSHGSMIHeapBufferFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pvBuffer); 44 } 45 46 static void vboxMpCrShgsmiPackerCbFlush(void *pvFlush) 47 { 48 PPVBOXMP_SHGSMIPACKER pPacker = (PPVBOXMP_SHGSMIPACKER)pvFlush; 49 50 crPackReleaseBuffer(&pPacker->CrPacker); 51 52 if (pPacker->CrBuffer.opcode_current != pPacker->CrBuffer.opcode_start) 53 { 54 CRMessageOpcodes *pHdr; 55 unsigned int len; 56 pHdr = vboxMpCrPackerPrependHeader(&pPacker->CrBuffer, &len, 0); 57 58 /*Send*/ 59 } 60 61 62 crPackSetBuffer(&pPacker->CrPacker, &pPacker->CrBuffer); 63 crPackResetPointers(&pPacker->CrPacker); 64 } 65 66 static int vboxMpCrShgsmiPackerInit(PPVBOXMP_SHGSMIPACKER pPacker, PVBOXMP_DEVEXT pDevExt) 67 { 68 memset(pPacker, 0, sizeof (*pPacker)); 69 70 static const cbBuffer = 1000; 71 void *pvBuffer = vboxMpCrShgsmiBufferAlloc(pDevExt, cbBuffer); 72 if (!pvBuffer) 73 { 74 WARN(("vboxMpCrShgsmiBufferAlloc failed")); 75 return VERR_NO_MEMORY; 76 } 77 crPackInitBuffer(&pPacker->CrBuffer, pvBuffer, cbBuffer, cbBuffer); 78 crPackSetBuffer(&pPacker->CrPacker, &pPacker->CrBuffer); 79 crPackFlushFunc(&pPacker->CrPacker, vboxMpCrShgsmiPackerCbFlush); 80 crPackFlushArg(&pPacker->CrPacker, pPacker); 81 // crPackSendHugeFunc( thread->packer, packspuHuge ); 82 return VINF_SUCCESS; 83 } 84 #endif 25 85 26 86 static int vboxMpCrCtlAddRef(PVBOXMP_CRCTLCON pCrCtlCon) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.cpp
r40387 r41109 161 161 KeAcquireSpinLock(&pHeap->HeapLock, &OldIrql); 162 162 HGSMIHeapFree(&pHeap->Heap, pvBuffer); 163 KeReleaseSpinLock(&pHeap->HeapLock, OldIrql); 164 } 165 166 void* VBoxSHGSMIHeapBufferAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData) 167 { 168 KIRQL OldIrql; 169 void* pvData; 170 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 171 KeAcquireSpinLock(&pHeap->HeapLock, &OldIrql); 172 pvData = HGSMIHeapBufferAlloc(&pHeap->Heap, cbData); 173 KeReleaseSpinLock(&pHeap->HeapLock, OldIrql); 174 if (!pvData) 175 WARN(("HGSMIHeapAlloc failed!")); 176 return pvData; 177 } 178 179 void VBoxSHGSMIHeapBufferFree(PVBOXSHGSMI pHeap, void *pvBuffer) 180 { 181 KIRQL OldIrql; 182 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 183 KeAcquireSpinLock(&pHeap->HeapLock, &OldIrql); 184 HGSMIHeapBufferFree(&pHeap->Heap, pvBuffer); 163 185 KeReleaseSpinLock(&pHeap->HeapLock, OldIrql); 164 186 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.h
r40387 r41109 58 58 void* VBoxSHGSMIHeapAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo); 59 59 void VBoxSHGSMIHeapFree(PVBOXSHGSMI pHeap, void *pvBuffer); 60 void* VBoxSHGSMIHeapBufferAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData); 61 void VBoxSHGSMIHeapBufferFree(PVBOXSHGSMI pHeap, void *pvBuffer); 60 62 void* VBoxSHGSMICommandAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo); 61 63 void VBoxSHGSMICommandFree(PVBOXSHGSMI pHeap, void *pvBuffer); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/basetexture.c
r40388 r41109 35 35 #include "wined3d_private.h" 36 36 37 #define GLINFO_LOCATION (This->resource.device->adapter->gl_info) 38 37 39 WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); 38 40 … … 100 102 101 103 /* A GL context is provided by the caller */ 102 static void gltexture_delete( struct gl_texture *tex)104 static void gltexture_delete(IWineD3DTextureImpl *This, struct gl_texture *tex) 103 105 { 104 106 ENTER_GL(); 105 glDeleteTextures(1, &tex->name);107 texture_gl_delete(This, tex->name); 106 108 LEAVE_GL(); 107 109 tex->name = 0; … … 112 114 IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; 113 115 IWineD3DDeviceImpl *device = This->resource.device; 114 115 #ifdef VBOX_WITH_WDDM 116 if (!VBOXSHRC_CAN_DELETE(device, This)) 117 { 118 This->baseTexture.texture_rgb.name = 0; 119 This->baseTexture.texture_srgb.name = 0; 120 } 121 else 122 #endif 123 { 124 struct wined3d_context *context = NULL; 125 if (This->baseTexture.texture_rgb.name || This->baseTexture.texture_srgb.name) 126 { 127 context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 128 } 129 130 if(This->baseTexture.texture_rgb.name) { 131 gltexture_delete(&This->baseTexture.texture_rgb); 132 } 133 if(This->baseTexture.texture_srgb.name) { 134 gltexture_delete(&This->baseTexture.texture_srgb); 135 } 136 137 if (context) context_release(context); 138 } 116 struct wined3d_context *context = NULL; 117 if (This->baseTexture.texture_rgb.name || This->baseTexture.texture_srgb.name) 118 { 119 context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 120 } 121 122 if(This->baseTexture.texture_rgb.name) { 123 gltexture_delete(This, &This->baseTexture.texture_rgb); 124 } 125 if(This->baseTexture.texture_srgb.name) { 126 gltexture_delete(This, &This->baseTexture.texture_srgb); 127 } 128 129 if (context) context_release(context); 139 130 140 131 This->baseTexture.texture_rgb.dirty = TRUE; … … 296 287 TRACE("(%p) : About to bind texture\n", This); 297 288 298 #ifdef VBOX_WITH_WDDM299 Assert(!VBOXSHRC_IS_DISABLED(This));300 #endif301 302 289 This->baseTexture.is_srgb = srgb; /* SRGB mode cache for PreLoad calls outside drawprim */ 303 290 if(srgb) { … … 317 304 ERR("should not be here!"); 318 305 gl_tex->name = (GLuint)VBOXSHRC_GET_SHAREHANDLE(This); 306 GL_EXTCALL(glChromiumParameteriCR(GL_RCUSAGE_TEXTURE_SET_CR, gl_tex->name)); 319 307 TRACE("Assigned shared texture %d\n", gl_tex->name); 320 308 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
r41028 r41109 6279 6279 if (surface->texture_name) 6280 6280 { 6281 #ifdef VBOX_WITH_WDDM 6282 # ifdef DEBUG_misha 6283 /* shared case needs testing! */ 6284 Assert(!VBOXSHRC_IS_SHARED(surface)); 6285 # endif 6286 if (VBOXSHRC_CAN_DELETE(device, surface)) 6287 #endif 6288 { 6289 struct wined3d_context *context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 6290 ENTER_GL(); 6291 glDeleteTextures(1, &surface->texture_name); 6292 LEAVE_GL(); 6293 context_release(context); 6294 } 6281 IWineD3DDeviceImpl *This = device; /* <- to make the below texture_gl_delete macro work and avoid other modifications */ 6282 struct wined3d_context *context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 6283 ENTER_GL(); 6284 texture_gl_delete(surface, surface->texture_name); 6285 LEAVE_GL(); 6286 context_release(context); 6295 6287 surface->texture_name = 0; 6296 6288 surface->Flags &= ~SFLAG_CLIENT; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/resource.c
r40388 r41109 296 296 } 297 297 298 switch (enmState) 299 { 300 case VBOXWINEEX_SHRC_STATE_GL_DISABLE: 301 VBOXSHRC_SET_DISABLE(This); 302 break; 303 case VBOXWINEEX_SHRC_STATE_GL_DELETE: 304 VBOXSHRC_SET_DELETE(This); 305 break; 306 default: 307 ERR("invalid arg"); 308 return E_INVALIDARG; 309 } 310 311 return WINED3D_OK; 312 } 313 #endif 298 return WINED3D_OK; 299 } 300 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c
r40962 r41109 98 98 ENTER_GL(); 99 99 100 if (This->texture_name 101 #ifdef VBOX_WITH_WDDM 102 && VBOXSHRC_CAN_DELETE(device, This) 103 #endif 104 ) 100 if (This->texture_name) 105 101 { 106 102 /* Release the OpenGL texture. */ 107 103 TRACE("Deleting texture %u.\n", This->texture_name); 108 glDeleteTextures(1, &This->texture_name);104 texture_gl_delete(This, This->texture_name); 109 105 } 110 106 … … 528 524 if (VBOXSHRC_IS_SHARED(surface)) 529 525 { 526 struct wined3d_context * context; 530 527 Assert(shared_handle); 531 surface_shrc_unlock(surface);532 528 if (!VBOXSHRC_IS_SHARED_OPENED(surface)) 533 529 { 534 struct wined3d_context * context; 535 530 surface_shrc_unlock(surface); 536 531 Assert(!(*shared_handle)); 537 532 *shared_handle = VBOXSHRC_GET_SHAREHANDLE(surface); 538 539 Assert(!device->isInDraw);540 541 /* flush to ensure the texture is allocated before it is used by another542 * process opening it */543 context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD);544 if (context->valid)545 {546 wglFlush();547 }548 else549 {550 ERR("invalid context!");551 }552 context_release(context);553 533 } 554 534 else 555 535 { 536 VBOXSHRC_UNLOCK(surface); 537 Assert(!VBOXSHRC_IS_LOCKED(surface)); 538 #ifdef DEBUG_misha 539 ERR("test this!"); 540 #endif 541 surface_setup_location_onopen(surface); 556 542 Assert(*shared_handle); 557 543 Assert(*shared_handle == VBOXSHRC_GET_SHAREHANDLE(surface)); 558 544 } 545 546 Assert(!device->isInDraw); 547 548 /* flush to ensure the texture is allocated/referenced before it is used/released by another 549 * process opening/creating it */ 550 context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 551 if (context->valid) 552 { 553 wglFlush(); 554 } 555 else 556 { 557 ERR("invalid context!"); 558 } 559 context_release(context); 559 560 } 560 561 else … … 1459 1460 if(!texture) { 1460 1461 ENTER_GL(); 1461 #ifdef VBOX_WITH_WDDM 1462 if (VBOXSHRC_CAN_DELETE(device, This)) 1463 #endif 1464 { 1465 glDeleteTextures(1, &This->texture_name); 1466 glDeleteTextures(1, &This->texture_name_srgb); 1467 } 1462 texture_gl_delete(This, This->texture_name); 1463 texture_gl_delete(This, This->texture_name_srgb); 1468 1464 This->texture_name = 0; 1469 1465 This->texture_name_srgb = 0; … … 1828 1824 struct wined3d_format_desc desc; 1829 1825 IWineD3DBaseTexture *baseTexture = NULL; 1826 struct wined3d_context *context; 1830 1827 1831 1828 d3dfmt_get_conv(This, TRUE, TRUE, &desc, &convert); … … 1840 1837 /* @todo: this is not entirely correct: need to share this state among all instances of the given shared resource */ 1841 1838 texture_state_init((IWineD3DTexture*)baseTexture, &pTex->baseTexture.texture_rgb); 1839 context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 1840 ENTER_GL(); 1841 GL_EXTCALL(glChromiumParameteriCR(GL_RCUSAGE_TEXTURE_SET_CR, pTex->baseTexture.texture_rgb.name)); 1842 ENTER_GL(); 1843 context_release(context); 1842 1844 } 1843 1845 IWineD3DBaseTexture_Release(baseTexture); 1844 1846 } 1847 else 1848 { 1849 context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 1850 ENTER_GL(); 1851 GL_EXTCALL(glChromiumParameteriCR(GL_RCUSAGE_TEXTURE_SET_CR, (GLuint)VBOXSHRC_GET_SHAREHANDLE(This))); 1852 ENTER_GL(); 1853 context_release(context); 1854 } 1845 1855 This->Flags |= alloc_flag; 1846 1847 1856 This->texture_name = (GLuint)VBOXSHRC_GET_SHAREHANDLE(This); 1848 1857 … … 2258 2267 2259 2268 #ifdef VBOX_WITH_WDDM 2260 2269 surface_shrc_unlock(This); 2261 2270 #endif 2262 2271 … … 2269 2278 struct wined3d_context *context; 2270 2279 2280 #ifdef VBOX_WITH_WDDM 2281 if (VBOXSHRC_IS_SHARED(This)) 2282 { 2283 ERR("surface_release_client_storage for shared resource! ignoring.."); 2284 return; 2285 } 2286 #endif 2287 2271 2288 context = context_acquire(This->resource.device, NULL, CTXUSAGE_RESOURCELOAD); 2272 2289 2273 2290 ENTER_GL(); 2274 2291 glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); 2275 #ifdef VBOX_WITH_WDDM 2276 if (!VBOXSHRC_IS_SHARED_OPENED(This)) 2277 #endif 2278 { 2279 if(This->texture_name) 2280 { 2281 surface_bind_and_dirtify(This, FALSE); 2282 glTexImage2D(This->texture_target, This->texture_level, 2283 GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); 2284 } 2285 if(This->texture_name_srgb) 2286 { 2287 surface_bind_and_dirtify(This, TRUE); 2288 glTexImage2D(This->texture_target, This->texture_level, 2289 GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); 2290 } 2292 if(This->texture_name) 2293 { 2294 surface_bind_and_dirtify(This, FALSE); 2295 glTexImage2D(This->texture_target, This->texture_level, 2296 GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); 2297 } 2298 if(This->texture_name_srgb) 2299 { 2300 surface_bind_and_dirtify(This, TRUE); 2301 glTexImage2D(This->texture_target, This->texture_level, 2302 GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); 2291 2303 } 2292 2304 glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); … … 2869 2881 IWineD3DBaseTexture *baseTexture = NULL; 2870 2882 2871 #ifdef VBOX_WITH_WDDM2872 Assert(!VBOXSHRC_IS_DISABLED(This));2873 #endif2874 2875 2883 TRACE("(%p)Checking to see if the container is a base texture\n", This); 2876 2884 if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&baseTexture) == WINED3D_OK) { … … 2895 2903 if (VBOXSHRC_IS_SHARED_OPENED(This)) 2896 2904 { 2905 struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info; 2897 2906 ERR("should not be here!"); 2898 2907 *name = (GLuint)VBOXSHRC_GET_SHAREHANDLE(This); 2908 GL_EXTCALL(glChromiumParameteriCR(GL_RCUSAGE_TEXTURE_SET_CR, name)); 2899 2909 } 2900 2910 else … … 5354 5364 #ifdef VBOX_WITH_WDDM 5355 5365 static HRESULT WINAPI IWineD3DSurfaceImpl_SetShRcState(IWineD3DSurface *iface, VBOXWINEEX_SHRC_STATE enmState) { 5356 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl*)iface;5357 IWineD3DBaseTextureImpl *texture = NULL;5358 struct wined3d_context *context = NULL;5359 5366 HRESULT hr; 5360 unsigned int i;5361 5362 if (SUCCEEDED(IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&texture)))5363 {5364 /* this is a texture, check that the */5365 switch (enmState)5366 {5367 case VBOXWINEEX_SHRC_STATE_GL_DISABLE:5368 if (!VBOXSHRC_IS_DISABLED(texture))5369 {5370 ERR("directly doing SetShRcState for texture surface not allowed!");5371 return E_FAIL;5372 }5373 break;5374 case VBOXWINEEX_SHRC_STATE_GL_DELETE:5375 if (!VBOXSHRC_IS_DELETE(texture))5376 {5377 ERR("directly doing SetShRcState for texture surface not allowed!");5378 return E_FAIL;5379 }5380 break;5381 default:5382 ERR("invalid arg");5383 return E_INVALIDARG;5384 }5385 5386 IWineD3DBaseTexture_Release((IWineD3DBaseTexture*)texture);5387 }5388 5389 5367 5390 5368 hr = IWineD3DResourceImpl_SetShRcState((IWineD3DResource*)iface, enmState); … … 5393 5371 ERR("IWineD3DResource_SetShRcState failed"); 5394 5372 return hr; 5395 }5396 5397 if (!texture)5398 {5399 if (!This->resource.device->isInDraw)5400 {5401 context = context_acquire(This->resource.device, NULL, CTXUSAGE_RESOURCELOAD);5402 if (!context)5403 {5404 ERR("zero context!");5405 return E_FAIL;5406 }5407 5408 if (!context->valid)5409 {5410 ERR("context invalid!");5411 context_release(context);5412 return E_FAIL;5413 }5414 }5415 5416 device_cleanup_durtify_texture_target(This->resource.device, This->texture_target);5417 5418 if (context)5419 context_release(context);5420 5373 } 5421 5374 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/texture.c
r40481 r41109 323 323 TRACE("(%p) : relay to BaseTexture\n", This); 324 324 325 #ifdef VBOX_WITH_WDDM326 Assert(!VBOXSHRC_IS_DISABLED(This));327 #endif328 329 325 hr = basetexture_bind((IWineD3DBaseTexture *)iface, srgb, &set_gl_texture_desc); 330 326 if (set_gl_texture_desc && SUCCEEDED(hr)) { … … 727 723 #endif 728 724 729 if (!VBOXSHRC_IS_SHARED _OPENED(texture))725 if (!VBOXSHRC_IS_SHARED(texture)) 730 726 { 731 727 struct wined3d_context * context; … … 733 729 Assert(!device->isInDraw); 734 730 735 /* flush to ensure the texture is allocated before it is used by another736 * process opening it */731 /* flush to ensure the texture is allocated/referenced before it is used/released by another 732 * process opening/creating it */ 737 733 context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 738 734 if (context->valid) -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxsharedrc.h
r40388 r41109 19 19 #define VBOXSHRC_F_SHARED 0x00000001 /* shared rc */ 20 20 #define VBOXSHRC_F_SHARED_OPENED 0x00000002 /* if set shared rc is opened, otherwise it is created */ 21 #define VBOXSHRC_F_GL_DISABLE 0x00000004 /* don't delete gl resources on d3d resource deletion */22 #define VBOXSHRC_F_GL_DELETE 0x00000008 /* don't delete gl resources on d3d resource deletion */23 21 24 22 #define VBOXSHRC_GET_SHAREFLAFS(_o) ((_o)->resource.sharerc_flags) … … 31 29 #define VBOXSHRC_SET_SHARED(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) |= VBOXSHRC_F_SHARED) 32 30 #define VBOXSHRC_SET_SHARED_OPENED(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) |= VBOXSHRC_F_SHARED_OPENED) 33 #define VBOXSHRC_SET_DISABLE(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) |= VBOXSHRC_F_GL_DISABLE)34 #define VBOXSHRC_SET_DELETE(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) = (VBOXSHRC_GET_SHAREFLAFS(_o) | VBOXSHRC_F_GL_DELETE) & (~VBOXSHRC_F_GL_DISABLE))35 31 36 32 #define VBOXSHRC_IS_SHARED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_SHARED)) 37 33 #define VBOXSHRC_IS_SHARED_OPENED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_SHARED_OPENED)) 38 34 #define VBOXSHRC_IS_SHARED_UNLOCKED(_o) (VBOXSHRC_IS_SHARED(_o) && !VBOXSHRC_IS_LOCKED(_o)) 39 #define VBOXSHRC_IS_DISABLED(_o) ( \40 VBOXSHRC_IS_SHARED(_o) \41 && (VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_GL_DISABLE) \42 )43 #define VBOXSHRC_IS_DELETE(_o) ( \44 VBOXSHRC_IS_SHARED(_o) \45 && (VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_GL_DELETE) \46 )47 48 #define VBOXSHRC_CAN_DELETE(_d, _o) (!VBOXSHRC_IS_DISABLED(_o))49 35 50 36 #define VBOXSHRC_LOCK(_o) do{ \ -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_gl.h
r39602 r41109 3774 3774 const PIXELFORMATDESCRIPTOR *ppfd); 3775 3775 3776 /*Global resource ids sharing*/ 3776 3777 #define GL_SHARE_CONTEXT_RESOURCES_CR 0x8B27 3778 /*do flush for the command buffer of a thread the context was previusly current for*/ 3777 3779 #define GL_FLUSH_ON_THREAD_SWITCH_CR 0x8B28 3780 /*report that the shared resource is used by this context, the parameter value is a texture name*/ 3781 #define GL_RCUSAGE_TEXTURE_SET_CR 0x8B29 3782 /*report that the shared resource is no longer used by this context, the parameter value is a texture name*/ 3783 #define GL_RCUSAGE_TEXTURE_CLEAR_CR 0x8B2A 3784 3778 3785 typedef void (WINE_GLAPI *PGLFNCHROMIUMPARAMETERUCR)(GLenum param, GLint value); 3779 3786 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h
r40962 r41109 2012 2012 void basetexture_unload(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; 2013 2013 2014 #ifdef VBOX_WITH_WDDM 2015 #define texture_gl_delete(_o, _t) do { \ 2016 if (VBOXSHRC_IS_SHARED(_o)) GL_EXTCALL(glChromiumParameteriCR(GL_RCUSAGE_TEXTURE_CLEAR_CR, _t)); \ 2017 else glDeleteTextures(1, &_t); \ 2018 } while (0) 2019 #else 2020 #define texture_gl_delete(_o, _t) do { \ 2021 glDeleteTextures(1, &_t); \ 2022 } while (0) 2023 2024 #endif 2014 2025 /***************************************************************************** 2015 2026 * IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl)
Note:
See TracChangeset
for help on using the changeset viewer.