Changeset 15707 in vbox
- Timestamp:
- Dec 19, 2008 6:16:40 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 41270
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
r15532 r15707 117 117 /* make sure there's host buffer and it's clear */ 118 118 CRASSERT(conn->pHostBuffer && !conn->cbHostBuffer); 119 CRASSERT(conn->cbHostBufferAllocated >= len); 119 120 if (conn->cbHostBufferAllocated < len) 121 { 122 crDebug("Host buffer too small %d out of requsted %d bytes, reallocating", conn->cbHostBufferAllocated, len); 123 crFree(conn->pHostBuffer); 124 conn->pHostBuffer = crAlloc(len); 125 if (!conn->pHostBuffer) 126 { 127 conn->cbHostBufferAllocated = 0; 128 crError("OUT_OF_MEMORY trying to allocate %d bytes", len); 129 return FALSE; 130 } 131 conn->cbHostBufferAllocated = len; 132 } 120 133 121 134 crMemcpy(conn->pHostBuffer, buf, len); … … 314 327 } 315 328 329 static void crVBoxHGCMReadExact( CRConnection *conn, const void *buf, unsigned int len ) 330 { 331 CRVBOXHGCMREAD parms; 332 int rc; 333 334 parms.hdr.result = VINF_SUCCESS; 335 parms.hdr.u32ClientID = conn->u32ClientID; 336 parms.hdr.u32Function = SHCRGL_GUEST_FN_READ; 337 parms.hdr.cParms = SHCRGL_CPARMS_READ; 338 339 CRASSERT(!conn->pBuffer); //make sure there's no data to process 340 parms.pBuffer.type = VMMDevHGCMParmType_LinAddr_Out; 341 parms.pBuffer.u.Pointer.size = conn->cbHostBufferAllocated; 342 parms.pBuffer.u.Pointer.u.linearAddr = (VMMDEVHYPPTR) conn->pHostBuffer; 343 344 parms.cbBuffer.type = VMMDevHGCMParmType_32bit; 345 parms.cbBuffer.u.value32 = 0; 346 347 rc = crVBoxHGCMCall(&parms, sizeof(parms)); 348 349 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.result)) 350 { 351 crDebug("SHCRGL_GUEST_FN_WRITE_READ failed with %x %x\n", rc, parms.hdr.result); 352 return; 353 } 354 355 if (parms.cbBuffer.u.value32) 356 { 357 conn->pBuffer = (uint8_t*) parms.pBuffer.u.Pointer.u.linearAddr; 358 conn->cbBuffer = parms.cbBuffer.u.value32; 359 } 360 361 if (conn->cbBuffer) 362 crVBoxHGCMReceiveMessage(conn); 363 364 } 365 316 366 /* Same as crVBoxHGCMWriteExact, but combined with read of writeback data. 317 367 * This halves the number of HGCM calls we do, … … 354 404 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.result)) 355 405 { 356 crDebug("SHCRGL_GUEST_FN_WRITE_READ failed with %x %x\n", rc, parms.hdr.result); 357 return; 406 407 if ((VERR_BUFFER_OVERFLOW == parms.hdr.result) && RT_SUCCESS(rc)) 408 { 409 /* reallocate buffer and retry */ 410 411 CRASSERT(parms.cbWriteback.u.value32>conn->cbHostBufferAllocated); 412 413 crDebug("Reallocating host buffer from %d to %d bytes", conn->cbHostBufferAllocated, parms.cbWriteback.u.value32); 414 415 crFree(conn->pHostBuffer); 416 conn->cbHostBufferAllocated = parms.cbWriteback.u.value32; 417 conn->pHostBuffer = crAlloc(conn->cbHostBufferAllocated); 418 419 crVBoxHGCMReadExact(conn, buf, len); 420 421 return; 422 } 423 else 424 { 425 crDebug("SHCRGL_GUEST_FN_WRITE_READ failed with %x %x\n", rc, parms.hdr.result); 426 return; 427 } 358 428 } 359 429 … … 413 483 */ 414 484 *bufp = NULL; 415 }416 417 static void crVBoxHGCMReadExact( CRConnection *conn, void *buf, unsigned int len )418 {419 CRASSERT(FALSE);420 485 } 421 486 … … 900 965 901 966 //@todo remove this crap at all later 902 conn->cbHostBufferAllocated = 1 00*1024;967 conn->cbHostBufferAllocated = 1*1024; 903 968 conn->pHostBuffer = (uint8_t*) crAlloc(conn->cbHostBufferAllocated); 904 969 CRASSERT(conn->pHostBuffer); -
trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
r15532 r15707 297 297 /* Update parameters.*/ 298 298 paParms[0].u.pointer.size = cbBuffer; //@todo guest doesn't see this change somehow? 299 paParms[1].u.uint32 = cbBuffer; 300 } 299 } 300 301 /* Return the required buffer size always */ 302 paParms[1].u.uint32 = cbBuffer; 301 303 302 304 break; … … 337 339 /* Update parameters.*/ 338 340 paParms[1].u.pointer.size = cbWriteback; 339 paParms[2].u.uint32 = cbWriteback;340 341 } 342 /* Return the required buffer size always */ 343 paParms[2].u.uint32 = cbWriteback; 341 344 } 342 345 break; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r15532 r15707 460 460 crWarning("crServer: [%lx] ClientRead u32ClientID=%d FAIL, host buffer too small %d of %d", 461 461 crThreadID(), u32ClientID, *pcbBuffer, pClient->conn->cbHostBuffer); 462 return VERR_INVALID_PARAMETER; 462 463 /* Return the size of needed buffer */ 464 *pcbBuffer = pClient->conn->cbHostBuffer; 465 466 return VERR_BUFFER_OVERFLOW; 463 467 } 464 468
Note:
See TracChangeset
for help on using the changeset viewer.