Changeset 78341 in vbox for trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
- Timestamp:
- Apr 28, 2019 4:47:51 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
r78263 r78341 169 169 CRConnection **conns; 170 170 CRBufferPool *bufpool; 171 #ifdef CHROMIUM_THREADSAFE172 171 CRmutex mutex; 173 172 CRmutex recvmutex; 174 #endif175 173 CRNetReceiveFuncList *recv_list; 176 174 CRNetCloseFuncList *close_list; … … 637 635 CRVBOXHGCMBUFFER *buf; 638 636 639 #ifdef CHROMIUM_THREADSAFE640 637 crLockMutex(&g_crvboxhgcm.mutex); 641 #endif642 643 638 buf = (CRVBOXHGCMBUFFER *) crBufferPoolPop(g_crvboxhgcm.bufpool, conn->buffer_size); 644 639 … … 661 656 } 662 657 663 #ifdef CHROMIUM_THREADSAFE664 658 crUnlockMutex(&g_crvboxhgcm.mutex); 665 #endif666 667 659 return (void *)( buf + 1 ); 668 660 … … 673 665 void *pvBuff; 674 666 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 675 #ifdef CHROMIUM_THREADSAFE676 667 crLockMutex(&g_crvboxhgcm.mutex); 677 #endif678 668 pvBuff = _crVBoxHGCMAlloc(conn); 679 #ifdef CHROMIUM_THREADSAFE680 669 crUnlockMutex(&g_crvboxhgcm.mutex); 681 #endif682 670 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 683 671 return pvBuff; … … 730 718 { 731 719 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 732 #ifdef CHROMIUM_THREADSAFE 720 733 721 crLockMutex(&g_crvboxhgcm.mutex); 734 #endif735 722 _crVBoxHGCMWriteExact(conn, buf, len); 736 #ifdef CHROMIUM_THREADSAFE737 723 crUnlockMutex(&g_crvboxhgcm.mutex); 738 #endif739 724 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 740 725 } … … 908 893 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 909 894 910 #ifdef CHROMIUM_THREADSAFE911 895 crLockMutex(&g_crvboxhgcm.mutex); 912 #endif913 914 896 if (!bufp) /* We're sending a user-allocated buffer. */ 915 897 { … … 923 905 crVBoxHGCMWriteReadExact(conn, start, len, CR_VBOXHGCM_USERALLOCATED); 924 906 #endif 925 #ifdef CHROMIUM_THREADSAFE926 907 crUnlockMutex(&g_crvboxhgcm.mutex); 927 #endif928 908 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 929 909 return; … … 951 931 952 932 /* Reclaim this pointer for reuse */ 953 #ifdef CHROMIUM_THREADSAFE954 933 crLockMutex(&g_crvboxhgcm.mutex); 955 #endif956 934 crBufferPoolPush(g_crvboxhgcm.bufpool, hgcm_buffer, hgcm_buffer->allocated); 957 #ifdef CHROMIUM_THREADSAFE958 935 crUnlockMutex(&g_crvboxhgcm.mutex); 959 #endif960 936 961 937 /* Since the buffer's now in the 'free' buffer pool, the caller can't … … 965 941 *bufp = NULL; 966 942 967 #ifdef CHROMIUM_THREADSAFE968 943 crUnlockMutex(&g_crvboxhgcm.mutex); 969 #endif970 971 944 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 972 945 } … … 1006 979 { 1007 980 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1008 #ifdef CHROMIUM_THREADSAFE1009 981 crLockMutex(&g_crvboxhgcm.mutex); 1010 #endif1011 982 crVBoxHGCMReadExact(conn, buf, len); 1012 #ifdef CHROMIUM_THREADSAFE1013 983 crUnlockMutex(&g_crvboxhgcm.mutex); 1014 #endif1015 984 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1016 985 } … … 1028 997 { 1029 998 case CR_VBOXHGCM_MEMORY: 1030 #ifdef CHROMIUM_THREADSAFE1031 999 crLockMutex(&g_crvboxhgcm.mutex); 1032 #endif1033 1000 if (g_crvboxhgcm.bufpool) { 1034 1001 /** @todo o'rly? */ … … 1038 1005 crBufferPoolPush(g_crvboxhgcm.bufpool, hgcm_buffer, hgcm_buffer->allocated); 1039 1006 } 1040 #ifdef CHROMIUM_THREADSAFE1041 1007 crUnlockMutex(&g_crvboxhgcm.mutex); 1042 #endif1043 1008 break; 1044 1009 … … 1055 1020 { 1056 1021 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1057 #ifdef CHROMIUM_THREADSAFE1058 1022 crLockMutex(&g_crvboxhgcm.mutex); 1059 #endif1060 1023 _crVBoxHGCMFree(conn, buf); 1061 #ifdef CHROMIUM_THREADSAFE1062 1024 crUnlockMutex(&g_crvboxhgcm.mutex); 1063 #endif1064 1025 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1065 1026 } … … 1170 1131 { 1171 1132 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1172 #ifdef CHROMIUM_THREADSAFE1173 1133 crLockMutex(&g_crvboxhgcm.mutex); 1174 #endif1175 1134 _crVBoxHGCMReceiveMessage(conn); 1176 #ifdef CHROMIUM_THREADSAFE1177 1135 crUnlockMutex(&g_crvboxhgcm.mutex); 1178 #endif1179 1136 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1180 1137 } … … 1402 1359 if (!g_crvboxhgcm.initialized) return; 1403 1360 1404 #ifdef CHROMIUM_THREADSAFE1405 1361 crLockMutex(&g_crvboxhgcm.mutex); 1406 #endif1407 1408 1362 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1409 1363 … … 1425 1379 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1426 1380 1427 #ifdef CHROMIUM_THREADSAFE1428 1381 crUnlockMutex(&g_crvboxhgcm.mutex); 1429 #endif1430 1382 } 1431 1383 … … 1433 1385 { 1434 1386 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1435 #ifdef CHROMIUM_THREADSAFE1436 1387 crLockMutex(&g_crvboxhgcm.mutex); 1437 #endif1438 1388 _crVBoxHGCMFree(conn, mess); 1439 1389 CRASSERT(FALSE); 1440 #ifdef CHROMIUM_THREADSAFE1441 1390 crUnlockMutex(&g_crvboxhgcm.mutex); 1442 #endif1443 1391 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1444 1392 } … … 1543 1491 1544 1492 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1545 1546 #ifdef CHROMIUM_THREADSAFE1547 1493 crLockMutex(&g_crvboxhgcm.mutex); 1548 #endif1549 1550 1494 pClient = _crVBoxHGSMIClientGet(conn); 1551 1495 if (pClient) … … 1559 1503 } 1560 1504 1561 #ifdef CHROMIUM_THREADSAFE1562 1505 crUnlockMutex(&g_crvboxhgcm.mutex); 1563 #endif1564 1565 1506 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1566 1507 … … 1571 1512 { 1572 1513 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1573 #ifdef CHROMIUM_THREADSAFE1574 1514 crLockMutex(&g_crvboxhgcm.mutex); 1575 #endif1576 1515 _crVBoxHGSMIFree(conn, buf); 1577 #ifdef CHROMIUM_THREADSAFE1578 1516 crUnlockMutex(&g_crvboxhgcm.mutex); 1579 #endif1580 1517 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1581 1518 } … … 1921 1858 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1922 1859 1923 #ifdef CHROMIUM_THREADSAFE1924 1860 crLockMutex(&g_crvboxhgcm.mutex); 1925 #endif1926 1927 1861 if (!bufp) /* We're sending a user-allocated buffer. */ 1928 1862 { … … 1939 1873 _crVBoxHGSMIWriteReadExact(conn, pClient, (void*)start, 0, len, false); 1940 1874 #endif 1941 #ifdef CHROMIUM_THREADSAFE1942 1875 crUnlockMutex(&g_crvboxhgcm.mutex); 1943 #endif1944 1876 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1945 1877 return; … … 1948 1880 /* fallback */ 1949 1881 crVBoxHGCMSend(conn, bufp, start, len); 1950 #ifdef CHROMIUM_THREADSAFE1951 1882 crUnlockMutex(&g_crvboxhgcm.mutex); 1952 #endif1953 1883 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1954 1884 return; … … 1967 1897 /* fallback */ 1968 1898 crVBoxHGCMSend(conn, bufp, start, len); 1969 #ifdef CHROMIUM_THREADSAFE1970 1899 crUnlockMutex(&g_crvboxhgcm.mutex); 1971 #endif1972 1900 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1973 1901 return; … … 1984 1912 { 1985 1913 crVBoxHGCMSend(conn, bufp, start, len); 1986 #ifdef CHROMIUM_THREADSAFE1987 1914 crUnlockMutex(&g_crvboxhgcm.mutex); 1988 #endif1989 1915 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1990 1916 return; … … 2019 1945 *bufp = NULL; 2020 1946 2021 #ifdef CHROMIUM_THREADSAFE2022 1947 crUnlockMutex(&g_crvboxhgcm.mutex); 2023 #endif2024 2025 1948 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2026 1949 } … … 2048 1971 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2049 1972 2050 #ifdef CHROMIUM_THREADSAFE2051 1973 crLockMutex(&g_crvboxhgcm.mutex); 2052 #endif2053 2054 1974 CRASSERT(0); 2055 1975 2056 1976 _crVBoxHGCMReceiveMessage(conn); 2057 1977 2058 #ifdef CHROMIUM_THREADSAFE2059 1978 crUnlockMutex(&g_crvboxhgcm.mutex); 2060 #endif2061 2062 1979 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2063 1980 } … … 2083 2000 int rc = VINF_SUCCESS; 2084 2001 2085 #ifdef CHROMIUM_THREADSAFE2086 2002 crLockMutex(&g_crvboxhgcm.mutex); 2087 #endif2088 2089 2003 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2090 2004 … … 2119 2033 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2120 2034 2121 #ifdef CHROMIUM_THREADSAFE2122 2035 crUnlockMutex(&g_crvboxhgcm.mutex); 2123 #endif2124 2036 return RT_SUCCESS(rc); 2125 2037 } … … 2133 2045 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2134 2046 2135 #ifdef CHROMIUM_THREADSAFE2136 2047 crLockMutex(&g_crvboxhgcm.mutex); 2137 #endif2138 2139 2048 fHasActiveCons = _crVBoxCommonDoDisconnectLocked(conn); 2140 2049 … … 2153 2062 2154 2063 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2155 2156 #ifdef CHROMIUM_THREADSAFE2157 2064 crUnlockMutex(&g_crvboxhgcm.mutex); 2158 #endif2159 2065 } 2160 2066 … … 2162 2068 { 2163 2069 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2164 #ifdef CHROMIUM_THREADSAFE2165 2070 crLockMutex(&g_crvboxhgcm.mutex); 2166 #endif2167 2071 CRASSERT(0); 2168 2072 2169 2073 _crVBoxHGSMIFree(conn, mess); 2170 2074 2171 #ifdef CHROMIUM_THREADSAFE2172 2075 crUnlockMutex(&g_crvboxhgcm.mutex); 2173 #endif2174 2076 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2175 2077 } … … 2212 2114 #endif 2213 2115 2214 #ifdef CHROMIUM_THREADSAFE2215 2116 crInitMutex(&g_crvboxhgcm.mutex); 2216 2117 crInitMutex(&g_crvboxhgcm.recvmutex); 2217 #endif2218 2118 g_crvboxhgcm.bufpool = crBufferPoolInit(16); 2219 2119 … … 2253 2153 if (!g_crvboxhgcm.initialized) return; 2254 2154 2255 #ifdef CHROMIUM_THREADSAFE2256 2155 crLockMutex(&g_crvboxhgcm.mutex); 2257 #endif2258 2156 2259 2157 /* Connection count would be changed in calls to crNetDisconnect, so we have to store original value. … … 2275 2173 g_crvboxhgcm.bufpool = NULL; 2276 2174 2277 #ifdef CHROMIUM_THREADSAFE2278 2175 crUnlockMutex(&g_crvboxhgcm.mutex); 2279 2176 crFreeMutex(&g_crvboxhgcm.mutex); 2280 2177 crFreeMutex(&g_crvboxhgcm.recvmutex); 2281 #endif2282 2178 2283 2179 crFree(g_crvboxhgcm.conns); … … 2364 2260 #endif 2365 2261 2366 #ifdef CHROMIUM_THREADSAFE2367 2262 crLockMutex(&g_crvboxhgcm.mutex); 2368 #endif 2263 2369 2264 /* Find a free slot */ 2370 2265 for (i = 0; i < g_crvboxhgcm.num_conns; i++) { … … 2384 2279 g_crvboxhgcm.conns[g_crvboxhgcm.num_conns++] = conn; 2385 2280 } 2386 #ifdef CHROMIUM_THREADSAFE2387 2281 crUnlockMutex(&g_crvboxhgcm.mutex); 2388 #endif2389 2282 } 2390 2283 … … 2443 2336 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2444 2337 2445 #ifdef CHROMIUM_THREADSAFE2446 2338 crLockMutex(&g_crvboxhgcm.mutex); 2447 #endif2448 2339 2449 2340 #ifdef IN_GUEST … … 2479 2370 } 2480 2371 2481 #ifdef CHROMIUM_THREADSAFE2482 2372 crUnlockMutex(&g_crvboxhgcm.mutex); 2483 #endif2484 2485 2373 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2486 2374
Note:
See TracChangeset
for help on using the changeset viewer.