Changeset 46966 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- Jul 4, 2013 6:08:11 AM (12 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r46885 r46966 140 140 } 141 141 142 void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, const VBOXVR_TEXTURE *pTextureData) 143 { 144 CrVrScrCompositorEntryInit(&pEntry->CEntry, pTextureData); 142 #define PCR_DISPLAY_ENTRY_FROM_CENTRY(_pe) ((PCR_DISPLAY_ENTRY)((uint8_t*)(_pe) - RT_OFFSETOF(CR_DISPLAY_ENTRY, CEntry))) 143 static DECLCALLBACK(void) crDpEntryCEntryReleaseCB(const struct VBOXVR_SCR_COMPOSITOR *pCompositor, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pReplacingEntry) 144 { 145 PCR_DISPLAY_ENTRY pCEntry = PCR_DISPLAY_ENTRY_FROM_CENTRY(pEntry); 146 CrDemEntryRelease(pCEntry); 147 } 148 149 void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, const VBOXVR_TEXTURE *pTextureData, void *pvUserData1, void *pvUserData2) 150 { 151 CrVrScrCompositorEntryInit(&pEntry->CEntry, pTextureData, crDpEntryCEntryReleaseCB); 145 152 CrVrScrCompositorEntryFlagsSet(&pEntry->CEntry, CRBLT_F_INVERT_SRC_YCOORDS); 146 CrVrScrCompositorEntryInit(&pEntry->RootVrCEntry, pTextureData );153 CrVrScrCompositorEntryInit(&pEntry->RootVrCEntry, pTextureData, NULL); 147 154 CrVrScrCompositorEntryFlagsSet(&pEntry->RootVrCEntry, CRBLT_F_INVERT_SRC_YCOORDS); 155 pEntry->pvUserData1 = pvUserData1; 156 pEntry->pvUserData2 = pvUserData2; 148 157 } 149 158 … … 175 184 } 176 185 186 void crDemEntryRelease(PCR_DISPLAY_ENTRY_MAP pMap, PCR_DISPLAY_ENTRY pEntry, bool fForceDelete) 187 { 188 CRTextureObj *pTobj = (CRTextureObj *)pEntry->pvUserData2; 189 if (!pTobj) 190 { 191 crWarning("Trying to release entry that does not have tobj specified"); 192 return; 193 } 194 195 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pTobj, cr_server.MainContextInfo.pContext); 196 197 bool fDeleteEntry = fForceDelete; 198 GLuint idTexture = pTobj->id; 199 200 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pTobj)) 201 { 202 CRSharedState *pShared = crStateGlobalSharedAcquire(); 203 204 CRASSERT(pShared); 205 /* on the host side, we need to delete an ogl texture object here as well, which crStateDeleteTextureCallback will do 206 * in addition to calling crStateDeleteTextureObject to delete a state object */ 207 crHashtableDelete(pShared->textureTable, idTexture, crStateDeleteTextureCallback); 208 209 crStateGlobalSharedRelease(); 210 211 fDeleteEntry = true; 212 } 213 else 214 { 215 /* this is something we would not generally expect */ 216 CRASSERT(!fForceDelete); 217 } 218 219 if (fDeleteEntry) 220 { 221 if (pMap) 222 crHashtableDelete(pMap->pTextureMap, idTexture, crFree); 223 else 224 crFree(pEntry); /* <- when called from crDemTermEntryCb */ 225 226 crStateGlobalSharedRelease(); 227 } 228 } 229 230 void crDemTermEntryCb(void *pvEntry) 231 { 232 crDemEntryRelease(NULL, (PCR_DISPLAY_ENTRY)pvEntry, true); 233 } 234 177 235 void CrDemTerm(PCR_DISPLAY_ENTRY_MAP pMap) 178 236 { 179 crFreeHashtable(pMap->pTextureMap, crFree); 180 } 181 182 PCR_DISPLAY_ENTRY CrDemEntryGetCreate(PCR_DISPLAY_ENTRY_MAP pMap, GLuint idTexture, CRContextInfo *pCtxInfo) 237 crFreeHashtable(pMap->pTextureMap, crDemTermEntryCb); 238 } 239 240 void CrDemEntryRelease(PCR_DISPLAY_ENTRY pEntry) 241 { 242 PCR_DISPLAY_ENTRY_MAP pMap = (PCR_DISPLAY_ENTRY_MAP)pEntry->pvUserData1; 243 Assert(pMap); 244 crDemEntryRelease(pMap, pEntry, false); 245 } 246 247 PCR_DISPLAY_ENTRY CrDemEntryAcquire(PCR_DISPLAY_ENTRY_MAP pMap, GLuint idTexture) 183 248 { 184 249 PCR_DISPLAY_ENTRY pEntry = (PCR_DISPLAY_ENTRY)crHashtableSearch(pMap->pTextureMap, idTexture); … … 186 251 return pEntry; 187 252 188 CR Context *pContext = pCtxInfo->pContext;189 if (!p Context)190 { 191 crWarning("p Contextis null!");253 CRSharedState *pShared = crStateGlobalSharedAcquire(); 254 if (!pShared) 255 { 256 crWarning("pShared is null!"); 192 257 return NULL; 193 258 } 194 259 195 CRTextureObj *pTobj = (CRTextureObj*)crHashtableSearch(p Context->shared->textureTable, idTexture);260 CRTextureObj *pTobj = (CRTextureObj*)crHashtableSearch(pShared->textureTable, idTexture); 196 261 if (!pTobj) 197 262 { 198 263 crWarning("pTobj is null!"); 264 crStateGlobalSharedRelease(); 199 265 return NULL; 200 266 } 267 268 Assert(pTobj->id == idTexture); 201 269 202 270 GLuint hwId = crStateGetTextureObjHWID(pTobj); … … 204 272 { 205 273 crWarning("hwId is null!"); 274 crStateGlobalSharedRelease(); 206 275 return NULL; 207 276 } … … 217 286 { 218 287 crWarning("crAlloc failed allocating CR_DISPLAY_ENTRY"); 288 crStateGlobalSharedRelease(); 219 289 return NULL; 220 290 } 221 291 222 CrDpEntryInit(pEntry, &TextureData); 292 CrDpEntryInit(pEntry, &TextureData, pMap, pTobj); 293 294 /* just use main context info's context to hold the texture reference */ 295 CR_STATE_SHAREDOBJ_USAGE_SET(pTobj, cr_server.MainContextInfo.pContext); 223 296 224 297 crHashtableAdd(pMap->pTextureMap, idTexture, pEntry); … … 226 299 227 300 } 228 301 #if 0 229 302 void CrDemEntryDestroy(PCR_DISPLAY_ENTRY_MAP pMap, GLuint idTexture) 230 303 { … … 243 316 crHashtableDelete(pMap->pTextureMap, idTexture, crFree); 244 317 } 245 318 #endif 246 319 PCR_DISPLAY crServerDisplayGetInitialized(uint32_t idScreen) 247 320 { … … 412 485 if (texture) 413 486 { 414 pEntry = CrDemEntry GetCreate(&cr_server.PresentTexturepMap, texture, cr_server.currentCtxInfo);487 pEntry = CrDemEntryAcquire(&cr_server.PresentTexturepMap, texture); 415 488 if (!pEntry) 416 489 { 417 crWarning("CrDemEntry GetCreate Failed");490 crWarning("CrDemEntryAcquire Failed"); 418 491 return; 419 492 } … … 428 501 if (!RT_SUCCESS(rc)) 429 502 { 430 crWarning("CrDpEntrySetRegions Failed rc %d", rc); 503 crWarning("CrDpEntryRegionsAdd Failed rc %d", rc); 504 // if (pEntry) 505 // CrDemEntryRelease(pEntry); 431 506 return; 432 507 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
r46885 r46966 55 55 Tex.target = GL_TEXTURE_2D; 56 56 Tex.hwid = 0; 57 CrVrScrCompositorEntryInit(&mural->DefaultDEntry.CEntry, &Tex );57 CrVrScrCompositorEntryInit(&mural->DefaultDEntry.CEntry, &Tex, NULL); 58 58 59 59 if (cr_server.fRootVrOn) 60 60 { 61 CrVrScrCompositorEntryInit(&mural->DefaultDEntry.RootVrCEntry, &Tex );61 CrVrScrCompositorEntryInit(&mural->DefaultDEntry.RootVrCEntry, &Tex, NULL); 62 62 mural->fRootVrOn = GL_TRUE; 63 63 } … … 407 407 { 408 408 CR_DISPLAY_ENTRY *pDEntry = CR_DENTRY_FROM_CENTRY(pEntry); 409 CrVrScrCompositorEntryInit(&pDEntry->RootVrCEntry, CrVrScrCompositorEntryTexGet(pEntry) );409 CrVrScrCompositorEntryInit(&pDEntry->RootVrCEntry, CrVrScrCompositorEntryTexGet(pEntry), NULL); 410 410 return &pDEntry->RootVrCEntry; 411 411 } … … 416 416 417 417 crServerVBoxRootVrTranslateForMural(mural); 418 419 /* ensure the rootvr compositor does not hold any data, 420 * i.e. cleanup all rootvr entries data */ 421 CrVrScrCompositorClear(&mural->RootVrCompositor); 418 422 419 423 rc = CrVrScrCompositorIntersectedList(&mural->Compositor, &cr_server.RootVr, &mural->RootVrCompositor, crServerMuralGetRootVrCEntry, NULL, NULL); … … 468 472 goto end; 469 473 } 470 CrVrScrCompositorEntryInit(&mural->DefaultDEntry.CEntry, &Tex );474 CrVrScrCompositorEntryInit(&mural->DefaultDEntry.CEntry, &Tex, NULL); 471 475 /* initially set regions to all visible since this is what some guest assume 472 476 * and will not post any more visible regions command */
Note:
See TracChangeset
for help on using the changeset viewer.