Changeset 43888 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
- Timestamp:
- Nov 15, 2012 9:23:50 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
r43744 r43888 17 17 } 18 18 19 GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID) 20 { 21 CRMuralInfo *defaultMural; 22 GLint dims[2]; 23 GLint windowID = -1; 24 /* 25 * Have first SPU make a new window. 26 */ 27 GLint spuWindow = cr_server.head_spu->dispatch_table.WindowCreate( dpyName, visBits ); 28 if (spuWindow < 0) { 29 crServerReturnValue( &spuWindow, sizeof(spuWindow) ); 30 return spuWindow; 31 } 32 33 /* get initial window size */ 34 cr_server.head_spu->dispatch_table.GetChromiumParametervCR(GL_WINDOW_SIZE_CR, spuWindow, GL_INT, 2, dims); 35 36 defaultMural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, 0); 37 CRASSERT(defaultMural); 38 mural->gX = 0; 39 mural->gY = 0; 40 mural->width = dims[0]; 41 mural->height = dims[1]; 42 43 mural->spuWindow = spuWindow; 44 mural->screenId = 0; 45 mural->bVisible = GL_FALSE; 46 mural->bUseFBO = GL_FALSE; 47 48 mural->cVisibleRects = 0; 49 mural->pVisibleRects = NULL; 50 mural->bReceivedRects = GL_FALSE; 51 52 mural->pvOutputRedirectInstance = NULL; 53 54 /* generate ID for this new window/mural (special-case for file conns) */ 55 if (cr_server.curClient && cr_server.curClient->conn->type == CR_FILE) 56 windowID = spuWindow; 57 else 58 windowID = preloadWinID<0 ? crServerGenerateID(&cr_server.idsPool.freeWindowID) : preloadWinID; 59 60 crServerSetupOutputRedirect(mural); 61 62 return windowID; 63 } 19 64 20 65 GLint … … 23 68 CRMuralInfo *mural; 24 69 GLint windowID = -1; 25 GLint spuWindow;26 GLint dims[2];27 70 CRCreateInfo_t *pCreateInfo; 28 71 … … 55 98 } 56 99 57 /*58 * Have first SPU make a new window.59 */60 spuWindow = cr_server.head_spu->dispatch_table.WindowCreate( dpyName, visBits );61 if (spuWindow < 0) {62 crServerReturnValue( &spuWindow, sizeof(spuWindow) );63 return spuWindow;64 }65 66 /* get initial window size */67 cr_server.head_spu->dispatch_table.GetChromiumParametervCR(GL_WINDOW_SIZE_CR, spuWindow, GL_INT, 2, dims);68 100 69 101 /* … … 71 103 */ 72 104 mural = (CRMuralInfo *) crCalloc(sizeof(CRMuralInfo)); 73 if (mural) { 74 CRMuralInfo *defaultMural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, 0); 75 CRASSERT(defaultMural); 76 mural->gX = 0; 77 mural->gY = 0; 78 mural->width = dims[0]; 79 mural->height = dims[1]; 80 81 mural->spuWindow = spuWindow; 82 mural->screenId = 0; 83 mural->bVisible = GL_FALSE; 84 mural->bUseFBO = GL_FALSE; 85 86 mural->cVisibleRects = 0; 87 mural->pVisibleRects = NULL; 88 mural->bReceivedRects = GL_FALSE; 89 90 mural->pvOutputRedirectInstance = NULL; 91 92 /* generate ID for this new window/mural (special-case for file conns) */ 93 if (cr_server.curClient && cr_server.curClient->conn->type == CR_FILE) 94 windowID = spuWindow; 95 else 96 windowID = preloadWinID<0 ? crServerGenerateID(&cr_server.idsPool.freeWindowID) : preloadWinID; 97 crHashtableAdd(cr_server.muralTable, windowID, mural); 98 99 pCreateInfo = (CRCreateInfo_t *) crAlloc(sizeof(CRCreateInfo_t)); 100 pCreateInfo->pszDpyName = dpyName ? crStrdup(dpyName) : NULL; 101 pCreateInfo->visualBits = visBits; 102 crHashtableAdd(cr_server.pWindowCreateInfoTable, windowID, pCreateInfo); 103 104 crServerSetupOutputRedirect(mural); 105 } 105 if (!mural) 106 { 107 crWarning("crCalloc failed!"); 108 return -1; 109 } 110 111 windowID = crServerMuralInit(mural, dpyName, visBits, preloadWinID); 112 if (windowID < 0) 113 { 114 crWarning("crServerMuralInit failed!"); 115 crFree(mural); 116 return windowID; 117 } 118 119 crHashtableAdd(cr_server.muralTable, windowID, mural); 120 121 pCreateInfo = (CRCreateInfo_t *) crAlloc(sizeof(CRCreateInfo_t)); 122 pCreateInfo->pszDpyName = dpyName ? crStrdup(dpyName) : NULL; 123 pCreateInfo->visualBits = visBits; 124 crHashtableAdd(cr_server.pWindowCreateInfoTable, windowID, pCreateInfo); 106 125 107 126 crDebug("CRServer: client %p created new window %d (SPU window %d)", 108 cr_server.curClient, windowID, spuWindow);127 cr_server.curClient, windowID, mural->spuWindow); 109 128 110 129 if (windowID != -1 && !cr_server.bIsInLoadingState) { … … 138 157 } 139 158 159 void crServerMuralTerm(CRMuralInfo *mural) 160 { 161 if (mural->pvOutputRedirectInstance) 162 { 163 cr_server.outputRedirect.CROREnd(mural->pvOutputRedirectInstance); 164 mural->pvOutputRedirectInstance = NULL; 165 } 166 167 crServerRedirMuralFBO(mural, GL_FALSE); 168 crServerDeleteMuralFBO(mural); 169 170 cr_server.head_spu->dispatch_table.WindowDestroy( mural->spuWindow ); 171 172 if (mural->pVisibleRects) 173 { 174 crFree(mural->pVisibleRects); 175 } 176 } 177 140 178 void SERVER_DISPATCH_APIENTRY 141 179 crServerDispatchWindowDestroy( GLint window ) … … 158 196 } 159 197 160 if (mural->pvOutputRedirectInstance) 161 { 162 cr_server.outputRedirect.CROREnd(mural->pvOutputRedirectInstance); 163 mural->pvOutputRedirectInstance = NULL; 164 } 198 crDebug("CRServer: Destroying window %d (spu window %d)", window, mural->spuWindow); 199 200 crServerMuralTerm(mural); 165 201 166 202 if (cr_server.currentWindow == window) 167 203 { 168 204 cr_server.currentWindow = -1; 169 }170 171 crServerRedirMuralFBO(mural, GL_FALSE);172 crServerDeleteMuralFBO(mural);173 174 crDebug("CRServer: Destroying window %d (spu window %d)", window, mural->spuWindow);175 cr_server.head_spu->dispatch_table.WindowDestroy( mural->spuWindow );205 CRASSERT(cr_server.currentMural == mural); 206 cr_server.currentMural = NULL; 207 } 208 else 209 { 210 CRASSERT(cr_server.currentMural != mural); 211 } 176 212 177 213 if (cr_server.curClient) … … 236 272 crHashtableDelete(cr_server.pWindowCreateInfoTable, window, crServerCreateInfoDeleteCB); 237 273 238 if (mural->pVisibleRects)239 {240 crFree(mural->pVisibleRects);241 }242 274 crHashtableDelete(cr_server.muralTable, window, crFree); 275 } 276 277 void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height) 278 { 279 mural->width = width; 280 mural->height = height; 281 282 if (cr_server.curClient && cr_server.curClient->currentMural == mural) 283 { 284 crStateGetCurrent()->buffer.width = mural->width; 285 crStateGetCurrent()->buffer.height = mural->height; 286 } 287 288 crServerCheckMuralGeometry(mural); 289 290 cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height); 243 291 } 244 292 … … 257 305 } 258 306 259 mural->width = width; 260 mural->height = height; 261 262 if (cr_server.curClient && cr_server.curClient->currentMural == mural) 263 { 264 crStateGetCurrent()->buffer.width = mural->width; 265 crStateGetCurrent()->buffer.height = mural->height; 266 } 267 268 crServerCheckMuralGeometry(mural); 269 270 cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height); 307 crServerMuralSize(mural, width, height); 271 308 272 309 /* Work-around Intel driver bug */
Note:
See TracChangeset
for help on using the changeset viewer.