Changeset 68550 in vbox for trunk/src/VBox/GuestHost/OpenGL/util
- Timestamp:
- Aug 31, 2017 12:09:41 PM (7 years ago)
- Location:
- trunk/src/VBox/GuestHost/OpenGL/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
r68473 r68550 581 581 * @param cbData Data size 582 582 */ 583 static int crVBoxHGCMCall(CRConnection *conn, VBoxGuestHGCMCallInfo *pData, unsigned cbData)583 static int crVBoxHGCMCall(CRConnection *conn, PVBGLIOCHGCMCALL pData, unsigned cbData) 584 584 { 585 585 #ifdef IN_GUEST … … 705 705 706 706 rc = crVBoxHGCMCall(conn, &parms.hdr, sizeof(parms)); 707 callRes = parms.hdr. result;707 callRes = parms.hdr.Hdr.rc; 708 708 } 709 709 else … … 719 719 720 720 rc = crVBoxHGCMCall(conn, &parms.hdr, sizeof(parms)); 721 callRes = parms.hdr. result;721 callRes = parms.hdr.Hdr.rc; 722 722 } 723 723 … … 759 759 rc = crVBoxHGCMCall(conn, &parms.hdr, sizeof(parms)); 760 760 761 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr. result))762 { 763 crWarning("SHCRGL_GUEST_FN_READ failed with %x %x\n", rc, parms.hdr. result);761 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.Hdr.rc)) 762 { 763 crWarning("SHCRGL_GUEST_FN_READ failed with %x %x\n", rc, parms.hdr.Hdr.rc); 764 764 return; 765 765 } … … 835 835 836 836 rc = crVBoxHGCMCall(conn, &wbParms.hdr, sizeof(wbParms)); 837 if (RT_FAILURE(rc) || RT_FAILURE(wbParms.hdr. result))837 if (RT_FAILURE(rc) || RT_FAILURE(wbParms.hdr.Hdr.rc)) 838 838 { 839 crError("SHCRGL_GUEST_FN_WRITE_BUFFER (%i) failed with %x %x\n", wbParms.pBuffer.u.Pointer.size, rc, wbParms.hdr. result);839 crError("SHCRGL_GUEST_FN_WRITE_BUFFER (%i) failed with %x %x\n", wbParms.pBuffer.u.Pointer.size, rc, wbParms.hdr.Hdr.rc); 840 840 return; 841 841 } … … 859 859 860 860 /*bit of hack to reuse code below*/ 861 parms.hdr. result = wrbParms.hdr.result;861 parms.hdr.Hdr.rc = wrbParms.hdr.Hdr.rc; 862 862 crMemcpy(&parms.cbWriteback, &wrbParms.cbWriteback, sizeof(HGCMFunctionParameter)); 863 863 crMemcpy(&parms.pWriteback, &wrbParms.pWriteback, sizeof(HGCMFunctionParameter)); … … 866 866 #endif 867 867 868 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr. result))869 { 870 871 if ((VERR_BUFFER_OVERFLOW == parms.hdr. result) && RT_SUCCESS(rc))868 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.Hdr.rc)) 869 { 870 871 if ((VERR_BUFFER_OVERFLOW == parms.hdr.Hdr.rc) && RT_SUCCESS(rc)) 872 872 { 873 873 /* reallocate buffer and retry */ … … 887 887 else 888 888 { 889 crWarning("SHCRGL_GUEST_FN_WRITE_READ (%i) failed with %x %x\n", len, rc, parms.hdr. result);889 crWarning("SHCRGL_GUEST_FN_WRITE_READ (%i) failed with %x %x\n", len, rc, parms.hdr.Hdr.rc); 890 890 return; 891 891 } … … 991 991 rc = crVBoxHGCMCall(conn, &parms.hdr, sizeof(parms)); 992 992 993 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr. result))994 { 995 crDebug("SHCRGL_GUEST_FN_READ failed with %x %x\n", rc, parms.hdr. result);993 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.Hdr.rc)) 994 { 995 crDebug("SHCRGL_GUEST_FN_READ failed with %x %x\n", rc, parms.hdr.Hdr.rc); 996 996 return; 997 997 } … … 1194 1194 if (RT_SUCCESS(rc)) 1195 1195 { 1196 rc = parms.hdr. result;1196 rc = parms.hdr.Hdr.rc; 1197 1197 if (RT_SUCCESS(rc)) 1198 1198 { … … 1226 1226 if (RT_SUCCESS(rc)) 1227 1227 { 1228 rc = caps.hdr.result;1228 rc = caps.hdr.Hdr.rc; 1229 1229 if (RT_SUCCESS(rc)) 1230 1230 { … … 1251 1251 VBGL_HGCM_HDR_INIT(&parms.hdr, conn->u32ClientID, SHCRGL_GUEST_FN_SET_PID, SHCRGL_CPARMS_SET_PID); 1252 1252 1253 parms.u64PID.type = VMMDevHGCMParmType_64bit;1253 parms.u64PID.type = VMMDevHGCMParmType_64bit; 1254 1254 parms.u64PID.u.value64 = pid; 1255 1255 1256 1256 rc = crVBoxHGCMCall(conn, &parms.hdr, sizeof(parms)); 1257 1257 1258 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr. result))1258 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.Hdr.rc)) 1259 1259 { 1260 1260 crWarning("SHCRGL_GUEST_FN_SET_PID failed!"); … … 1273 1273 { 1274 1274 #ifdef IN_GUEST 1275 1275 int rc; 1276 1276 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1277 1277 rc = VbglR3InitUser(); … … 1741 1741 #ifdef DEBUG_misha 1742 1742 /* catch it here to test the buffer */ 1743 Assert(RT_SUCCESS(parms->hdr. result) || parms->hdr.result== VERR_BUFFER_OVERFLOW);1743 Assert(RT_SUCCESS(parms->hdr.Hdr.rc) || parms->hdr.Hdr.rc == VERR_BUFFER_OVERFLOW); 1744 1744 #endif 1745 1745 _crVBoxHGSMICmdBufferUnlock(pClient); -
trunk/src/VBox/GuestHost/OpenGL/util/vboxhgsmi.c
r68475 r68550 173 173 CRNetCloseFuncList *close_list; 174 174 CRBufferPool *mempool; 175 #ifdef RT_OS_WINDOWS176 HANDLE hGuestDrv;177 #else178 int iGuestDrv;179 #endif180 175 } CRVBOXHGSMIDATA; 181 176 … … 1200 1195 * Servers go through crVBoxHGCMAccept; 1201 1196 */ 1202 /*@todo use vbglR3Something here */1203 1197 static int crVBoxHGSMIDoConnect( CRConnection *conn ) 1204 1198 { 1205 1199 #ifdef IN_GUEST 1206 VBoxGuestHGCMConnectInfo info; 1207 1208 #ifdef RT_OS_WINDOWS 1209 DWORD cbReturned; 1200 int rc; 1210 1201 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1211 1212 if (g_crvboxhgsmi.hGuestDrv == INVALID_HANDLE_VALUE) 1213 { 1214 /* open VBox guest driver */ 1215 g_crvboxhgsmi.hGuestDrv = CreateFile(VBOXGUEST_DEVICE_NAME, 1216 GENERIC_READ | GENERIC_WRITE, 1217 FILE_SHARE_READ | FILE_SHARE_WRITE, 1218 NULL, 1219 OPEN_EXISTING, 1220 FILE_ATTRIBUTE_NORMAL, 1221 NULL); 1222 1223 /* @todo check if we could rollback to softwareopengl */ 1224 if (g_crvboxhgsmi.hGuestDrv == INVALID_HANDLE_VALUE) 1225 { 1226 Assert(0); 1227 crDebug("could not open VBox Guest Additions driver! rc = %d\n", GetLastError()); 1228 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1229 return FALSE; 1230 } 1231 } 1232 #else 1233 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1234 1235 if (g_crvboxhgsmi.iGuestDrv == INVALID_HANDLE_VALUE) 1236 { 1237 g_crvboxhgsmi.iGuestDrv = open(VBOXGUEST_USER_DEVICE_NAME, O_RDWR, 0); 1238 if (g_crvboxhgsmi.iGuestDrv == INVALID_HANDLE_VALUE) 1239 { 1240 crDebug("could not open Guest Additions kernel module! rc = %d\n", errno); 1241 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1242 return FALSE; 1243 } 1244 } 1245 #endif 1246 1247 memset (&info, 0, sizeof (info)); 1248 info.Loc.type = VMMDevHGCMLoc_LocalHost_Existing; 1249 strcpy (info.Loc.u.host.achName, "VBoxSharedCrOpenGL"); 1250 1251 #ifdef RT_OS_WINDOWS 1252 if (DeviceIoControl(g_crvboxhgsmi.hGuestDrv, 1253 VBOXGUEST_IOCTL_HGCM_CONNECT, 1254 &info, sizeof (info), 1255 &info, sizeof (info), 1256 &cbReturned, 1257 NULL)) 1258 #elif defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD) 1259 VBGLBIGREQ Hdr; 1260 Hdr.u32Magic = VBGLBIGREQ_MAGIC; 1261 Hdr.cbData = sizeof(info); 1262 Hdr.pvDataR3 = &info; 1263 # if HC_ARCH_BITS == 32 1264 Hdr.u32Padding = 0; 1265 # endif 1266 if (ioctl(g_crvboxhgsmi.iGuestDrv, VBOXGUEST_IOCTL_HGCM_CONNECT, &Hdr) >= 0) 1267 #else 1268 if (ioctl(g_crvboxhgsmi.iGuestDrv, VBOXGUEST_IOCTL_HGCM_CONNECT, &info, sizeof (info)) >= 0) 1269 #endif 1270 { 1271 if (info.result == VINF_SUCCESS) 1272 { 1273 int rc; 1274 conn->u32ClientID = info.u32ClientID; 1202 rc = VbglR3InitUser(); 1203 if (RT_SUCCESS(rc)) 1204 { 1205 uint32_t idClient; 1206 rc = VbglR3HGCMConnect("VBoxSharedCrOpenGL", &idClient); 1207 if (RT_SUCCESS(rc)) 1208 { 1209 conn->u32ClientID = idClient; 1275 1210 crDebug("HGCM connect was successful: client id =0x%x\n", conn->u32ClientID); 1276 1211 1277 rc = crVBoxHG SMISetVersion(conn, CR_PROTOCOL_VERSION_MAJOR, CR_PROTOCOL_VERSION_MINOR);1278 if ( !rc)1212 rc = crVBoxHGCMSetVersion(conn, CR_PROTOCOL_VERSION_MAJOR, CR_PROTOCOL_VERSION_MINOR); 1213 if (RT_FAILURE(rc)) 1279 1214 { 1215 WARN(("crVBoxHGCMSetVersion failed %d", rc)); 1216 /** @todo r=bird: Someone else messed up the return values here, not me. */ 1280 1217 return rc; 1281 1218 } … … 1285 1222 rc = crVBoxHGCMSetPID(conn, crGetPID()); 1286 1223 #endif 1224 if (RT_FAILURE(rc)) 1225 WARN(("crVBoxHGCMSetPID failed %Rrc", rc)); 1226 /** @todo r=bird: Someone else messed up the return values here, not me. */ 1287 1227 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1288 1228 return rc; 1289 1229 } 1290 else 1291 { 1292 Assert(0); 1293 crDebug("HGCM connect failed with rc=0x%x\n", info.result); 1294 } 1230 1231 crDebug("HGCM connect failed: %Rrc\n", rc); 1232 VbglR3Term(); 1295 1233 } 1296 1234 else 1297 { 1298 #ifdef RT_OS_WINDOWS 1299 crDebug("IOCTL for HGCM connect failed with rc=0x%x\n", GetLastError()); 1300 #else 1301 crDebug("IOCTL for HGCM connect failed with rc=0x%x\n", errno); 1302 #endif 1303 } 1235 crDebug("Failed to initialize VbglR3 library: %Rrc\n", rc); 1304 1236 1305 1237 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1306 1307 1238 return FALSE; 1239 1308 1240 #else /*#ifdef IN_GUEST*/ 1309 1241 crError("crVBoxHGSMIDoConnect called on host side!"); … … 1316 1248 static void crVBoxHGSMIDoDisconnect( CRConnection *conn ) 1317 1249 { 1318 #ifdef IN_GUEST1319 VBoxGuestHGCMDisconnectInfo info;1320 # ifdef RT_OS_WINDOWS1321 DWORD cbReturned;1322 # endif1323 int i;1324 #endif1325 1250 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1326 1251 … … 1355 1280 if (conn->u32ClientID) 1356 1281 { 1357 memset (&info, 0, sizeof (info)); 1358 info.u32ClientID = conn->u32ClientID; 1359 1360 # ifdef RT_OS_WINDOWS 1361 if ( !DeviceIoControl(g_crvboxhgsmi.hGuestDrv, 1362 VBOXGUEST_IOCTL_HGCM_DISCONNECT, 1363 &info, sizeof (info), 1364 &info, sizeof (info), 1365 &cbReturned, 1366 NULL) ) 1367 { 1368 crDebug("Disconnect failed with %x\n", GetLastError()); 1369 } 1370 # elif defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD) 1371 VBGLBIGREQ Hdr; 1372 Hdr.u32Magic = VBGLBIGREQ_MAGIC; 1373 Hdr.cbData = sizeof(info); 1374 Hdr.pvDataR3 = &info; 1375 # if HC_ARCH_BITS == 32 1376 Hdr.u32Padding = 0; 1377 # endif 1378 if (ioctl(g_crvboxhgsmi.iGuestDrv, VBOXGUEST_IOCTL_HGCM_DISCONNECT, &Hdr) >= 0) 1379 # else 1380 if (ioctl(g_crvboxhgsmi.iGuestDrv, VBOXGUEST_IOCTL_HGCM_DISCONNECT, &info, sizeof (info)) < 0) 1381 { 1382 crDebug("Disconnect failed with %x\n", errno); 1383 } 1384 # endif 1385 1282 int rc = VbglR3HGCMDisconnect(conn->u32ClientID); 1283 if (RT_FAILURE(rc)) 1284 crDebug("Disconnect failed with %Rrc\n", rc); 1386 1285 conn->u32ClientID = 0; 1387 } 1388 1389 /* see if any connections remain */ 1390 for (i = 0; i < g_crvboxhgsmi.num_conns; i++) 1391 if (g_crvboxhgsmi.conns[i] && g_crvboxhgsmi.conns[i]->type != CR_NO_CONNECTION) 1392 break; 1393 1394 /* close guest additions driver*/ 1395 if (i>=g_crvboxhgsmi.num_conns) 1396 { 1397 # ifdef RT_OS_WINDOWS 1398 CloseHandle(g_crvboxhgsmi.hGuestDrv); 1399 g_crvboxhgsmi.hGuestDrv = INVALID_HANDLE_VALUE; 1400 # else 1401 close(g_crvboxhgsmi.iGuestDrv); 1402 g_crvboxhgsmi.iGuestDrv = INVALID_HANDLE_VALUE; 1403 # endif 1404 } 1286 1287 VbglR3Term(); 1288 } 1289 1405 1290 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1406 1291 #endif /* IN_GUEST */
Note:
See TracChangeset
for help on using the changeset viewer.