Changeset 50364 in vbox for trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp
- Timestamp:
- Feb 7, 2014 2:11:50 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp
r50313 r50364 98 98 if (CrBltIsEntered(pBlitter)) 99 99 { 100 crWarning("CrBltBlitTexTex: blitter is entered");100 WARN(("CrBltBlitTexTex: blitter is entered")); 101 101 return VERR_INVALID_STATE; 102 102 } … … 108 108 if (!RT_SUCCESS(rc)) 109 109 { 110 crWarning("CrBltEnter failed, rc %d", rc);110 WARN(("CrBltEnter failed, rc %d", rc)); 111 111 return rc; 112 112 } … … 138 138 if (CrBltIsEntered(pBlitter)) 139 139 { 140 crWarning("can not set null mural for entered bleater");140 WARN(("can not set null mural for entered bleater")); 141 141 return VERR_INVALID_STATE; 142 142 } … … 152 152 else if (!pBlitter->CtxInfo.Base.id) 153 153 { 154 crWarning("setting current mural for entered no-context blitter");154 WARN(("setting current mural for entered no-context blitter")); 155 155 return VERR_INVALID_STATE; 156 156 } 157 157 158 crWarning("changing mural for entered blitter, is is somewhat expected?");158 WARN(("changing mural for entered blitter, is is somewhat expected?")); 159 159 160 160 pBlitter->pDispatch->Flush(); … … 548 548 void CrBltLeave(PCR_BLITTER pBlitter) 549 549 { 550 if (! CrBltIsEntered(pBlitter))551 { 552 WARN((" CrBltLeave: blitter not entered"));550 if (!pBlitter->cEnters) 551 { 552 WARN(("blitter not entered!")); 553 553 return; 554 554 } 555 556 if (--pBlitter->cEnters) 557 return; 555 558 556 559 if (pBlitter->Flags.SupportsFBO) … … 565 568 if (pBlitter->CtxInfo.Base.id) 566 569 pBlitter->pDispatch->MakeCurrent(0, 0, 0); 567 568 pBlitter->Flags.Entered = 0;569 570 } 570 571 … … 577 578 } 578 579 579 if (CrBltIsEntered(pBlitter)) 580 { 581 WARN(("blitter is entered already!")); 582 return VERR_INVALID_STATE; 583 } 580 if (pBlitter->cEnters++) 581 return VINF_SUCCESS; 584 582 585 583 if (pBlitter->CurrentMural.Base.id) /* <- pBlitter->CurrentMural.Base.id can be null if the blitter is in a "no-context" mode (see comments to BltInit for detail)*/ … … 587 585 pBlitter->pDispatch->MakeCurrent(pBlitter->CurrentMural.Base.id, pBlitter->i32MakeCurrentUserData, pBlitter->CtxInfo.Base.id); 588 586 } 589 590 pBlitter->Flags.Entered = 1;591 587 592 588 if (pBlitter->Flags.Initialized) … … 647 643 if (!CrBltIsEntered(pBlitter)) 648 644 { 649 crWarning("CrBltBlitTexMural: blitter not entered");645 WARN(("CrBltBlitTexMural: blitter not entered")); 650 646 return; 651 647 } … … 662 658 if (!CrBltIsEntered(pBlitter)) 663 659 { 664 crWarning("CrBltBlitTexTex: blitter not entered");660 WARN(("CrBltBlitTexTex: blitter not entered")); 665 661 return; 666 662 } … … 686 682 if (!CrBltIsEntered(pBlitter)) 687 683 { 688 crWarning("CrBltPresent: blitter not entered");684 WARN(("CrBltPresent: blitter not entered")); 689 685 return; 690 686 } … … 702 698 && enmFormat != GL_BGRA) 703 699 { 704 crWarning("unsupported format 0x%x", enmFormat);700 WARN(("unsupported format 0x%x", enmFormat)); 705 701 return VERR_NOT_IMPLEMENTED; 706 702 } … … 752 748 if (!CrBltIsEntered(pBlitter)) 753 749 { 754 crWarning("CrBltImgGetTex: blitter not entered");750 WARN(("CrBltImgGetTex: blitter not entered")); 755 751 return VERR_INVALID_STATE; 756 752 } … … 787 783 if (!CrBltIsEntered(pBlitter)) 788 784 { 789 crWarning("CrBltImgGetMural: blitter not entered");785 WARN(("CrBltImgGetMural: blitter not entered")); 790 786 return VERR_INVALID_STATE; 791 787 } … … 799 795 if (!CrBltIsEntered(pBlitter)) 800 796 { 801 crWarning("CrBltImgFree: blitter not entered");797 WARN(("CrBltImgFree: blitter not entered")); 802 798 return; 803 799 } … … 1127 1123 1128 1124 /*TdBlt*/ 1129 1130 1125 static void crTdBltCheckPBO(PCR_TEXDATA pTex) 1131 1126 { … … 1152 1147 } 1153 1148 1154 static uint32_t crTdBltTexCreate(PCR_TEXDATA pTex) 1155 { 1156 PCR_BLITTER pBlitter = pTex->pBlitter; 1149 static uint32_t crTdBltTexCreate(PCR_BLITTER pBlitter, uint32_t width, uint32_t height, GLenum enmTarget) 1150 { 1157 1151 uint32_t tex = 0; 1158 1152 pBlitter->pDispatch->GenTextures(1, &tex); … … 1163 1157 } 1164 1158 1165 pBlitter->pDispatch->BindTexture(GL_TEXTURE_2D, tex); 1166 pBlitter->pDispatch->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 1167 pBlitter->pDispatch->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 1168 pBlitter->pDispatch->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); 1169 pBlitter->pDispatch->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 1170 pBlitter->pDispatch->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1171 pTex->Tex.width, 1172 pTex->Tex.height, 1159 pBlitter->pDispatch->BindTexture(enmTarget, tex); 1160 pBlitter->pDispatch->TexParameteri(enmTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 1161 pBlitter->pDispatch->TexParameteri(enmTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 1162 pBlitter->pDispatch->TexParameteri(enmTarget, GL_TEXTURE_WRAP_S, GL_CLAMP); 1163 pBlitter->pDispatch->TexParameteri(enmTarget, GL_TEXTURE_WRAP_T, GL_CLAMP); 1164 pBlitter->pDispatch->TexImage2D(enmTarget, 0, GL_RGBA8, 1165 width, height, 1173 1166 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); 1174 1167 1175 1168 1176 1169 /*Restore gl state*/ 1177 pBlitter->pDispatch->BindTexture( GL_TEXTURE_2D, 0);1170 pBlitter->pDispatch->BindTexture(enmTarget, 0); 1178 1171 1179 1172 return tex; … … 1185 1178 return VINF_SUCCESS; 1186 1179 1187 pTex->idInvertTex = crTdBltTexCreate(pTex );1180 pTex->idInvertTex = crTdBltTexCreate(pTex->pBlitter, pTex->Tex.width, pTex->Tex.height, pTex->Tex.target); 1188 1181 if (!pTex->idInvertTex) 1189 1182 { … … 1194 1187 } 1195 1188 1189 void crTdBltImgRelease(PCR_TEXDATA pTex) 1190 { 1191 pTex->Flags.DataValid = 0; 1192 } 1193 1196 1194 void crTdBltImgFree(PCR_TEXDATA pTex) 1197 1195 { 1198 1196 if (!pTex->Img.pvData) 1197 { 1198 Assert(!pTex->Flags.DataValid); 1199 1199 return; 1200 1201 PCR_BLITTER pBlitter = pTex->pBlitter; 1200 } 1201 1202 crTdBltImgRelease(pTex); 1203 1204 Assert(!pTex->Flags.DataValid); 1205 1202 1206 1203 1207 if (pTex->idPBO) 1204 1208 { 1209 PCR_BLITTER pBlitter = pTex->pBlitter; 1210 1205 1211 Assert(CrBltIsEntered(pBlitter)); 1206 1212 pBlitter->pDispatch->BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pTex->idPBO); … … 1209 1215 } 1210 1216 else 1217 { 1218 Assert(pTex->Img.pvData); 1211 1219 RTMemFree(pTex->Img.pvData); 1220 } 1212 1221 1213 1222 pTex->Img.pvData = NULL; … … 1216 1225 int crTdBltImgAcquire(PCR_TEXDATA pTex, GLenum enmFormat, bool fInverted) 1217 1226 { 1227 void *pvData = pTex->Img.pvData; 1228 Assert(!pTex->Flags.DataValid); 1218 1229 int rc = crBltImgInitBaseForTex(&pTex->Tex, &pTex->Img, enmFormat); 1219 1230 if (!RT_SUCCESS(rc)) 1220 1231 { 1221 crWarning("crBltImgInitBaseForTex failed rc %d", rc);1232 WARN(("crBltImgInitBaseForTex failed rc %d", rc)); 1222 1233 return rc; 1223 1234 } 1224 1235 1225 1236 PCR_BLITTER pBlitter = pTex->pBlitter; 1226 void *pvData = NULL;1237 Assert(CrBltIsEntered(pBlitter)); 1227 1238 pBlitter->pDispatch->BindTexture(pTex->Tex.target, fInverted ? pTex->idInvertTex : pTex->Tex.hwid); 1228 1239 1229 1240 pBlitter->pDispatch->BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pTex->idPBO); 1230 1241 1231 if (!pTex->idPBO) 1232 { 1233 pvData = RTMemAlloc(4*pTex->Tex.width*pTex->Tex.height); 1234 if (!pvData) 1235 { 1236 crWarning("Out of memory in crTdBltImgAcquire"); 1237 return VERR_NO_MEMORY; 1238 } 1239 } 1242 if (pvData) 1243 { 1244 if (pTex->idPBO) 1245 { 1246 pBlitter->pDispatch->UnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB); 1247 pvData = NULL; 1248 1249 } 1250 } 1251 else 1252 { 1253 if (!pTex->idPBO) 1254 { 1255 pvData = RTMemAlloc(4*pTex->Tex.width*pTex->Tex.height); 1256 if (!pvData) 1257 { 1258 WARN(("Out of memory in crTdBltImgAcquire")); 1259 pBlitter->pDispatch->BindTexture(pTex->Tex.target, 0); 1260 return VERR_NO_MEMORY; 1261 } 1262 } 1263 } 1264 1265 Assert(!pvData == !!pTex->idPBO); 1240 1266 1241 1267 /*read the texture, note pixels are NULL for PBO case as it's offset in the buffer*/ … … 1250 1276 if (!pvData) 1251 1277 { 1252 crWarning("Failed to MapBuffer in CrHlpGetTexImage");1278 WARN(("Failed to MapBuffer in CrHlpGetTexImage")); 1253 1279 return VERR_GENERAL_FAILURE; 1254 1280 } … … 1257 1283 } 1258 1284 1259 CRASSERT(pvData);1285 Assert(pvData); 1260 1286 pTex->Img.pvData = pvData; 1287 pTex->Flags.DataValid = 1; 1261 1288 pTex->Flags.DataInverted = fInverted; 1262 1289 return VINF_SUCCESS; 1263 1290 } 1264 1291 1265 /* release the texture data, the data remains cached in the CR_TEXDATA object until it is discarded with CrTdBltData Discardor CrTdBltDataCleanup */1292 /* release the texture data, the data remains cached in the CR_TEXDATA object until it is discarded with CrTdBltDataInvalidateNe or CrTdBltDataCleanup */ 1266 1293 VBOXBLITTERDECL(int) CrTdBltDataRelease(PCR_TEXDATA pTex) 1267 1294 { … … 1271 1298 return VERR_INVALID_STATE; 1272 1299 } 1300 1301 if (!pTex->Flags.DataAcquired) 1302 { 1303 WARN(("Data NOT acquired")); 1304 return VERR_INVALID_STATE; 1305 } 1306 1273 1307 Assert(pTex->Img.pvData); 1274 return VINF_SUCCESS; 1308 Assert(pTex->Flags.DataValid); 1309 1310 pTex->Flags.DataAcquired = 0; 1311 1312 return VINF_SUCCESS; 1313 } 1314 1315 static void crTdBltDataFree(PCR_TEXDATA pTex) 1316 { 1317 crTdBltImgFree(pTex); 1318 1319 if (pTex->pStretchedCache) 1320 CrTdBltDataFreeNe(pTex->pStretchedCache); 1275 1321 } 1276 1322 1277 1323 /* discard the texture data cached with previous CrTdBltDataAcquire. 1278 1324 * Must be called wit data released (CrTdBltDataRelease) */ 1279 VBOXBLITTERDECL(int) CrTdBltData Discard(PCR_TEXDATA pTex)1325 VBOXBLITTERDECL(int) CrTdBltDataFree(PCR_TEXDATA pTex) 1280 1326 { 1281 1327 if (!pTex->Flags.Entered) … … 1285 1331 } 1286 1332 1287 crTdBltImgFree(pTex); 1288 1289 return VINF_SUCCESS; 1290 } 1291 1292 VBOXBLITTERDECL(int) CrTdBltDataDiscardNe(PCR_TEXDATA pTex) 1333 crTdBltDataFree(pTex); 1334 1335 return VINF_SUCCESS; 1336 } 1337 1338 VBOXBLITTERDECL(void) CrTdBltDataInvalidateNe(PCR_TEXDATA pTex) 1339 { 1340 crTdBltImgRelease(pTex); 1341 1342 if (pTex->pStretchedCache) 1343 CrTdBltDataInvalidateNe(pTex->pStretchedCache); 1344 } 1345 1346 VBOXBLITTERDECL(int) CrTdBltDataFreeNe(PCR_TEXDATA pTex) 1293 1347 { 1294 1348 if (!pTex->Img.pvData) … … 1308 1362 } 1309 1363 1310 crTdBlt ImgFree(pTex);1364 crTdBltDataFree(pTex); 1311 1365 1312 1366 if (fEntered) … … 1314 1368 1315 1369 return VINF_SUCCESS; 1370 } 1371 1372 static void crTdBltSdCleanupCacheNe(PCR_TEXDATA pTex) 1373 { 1374 if (pTex->pStretchedCache) 1375 { 1376 CrTdBltDataCleanupNe(pTex->pStretchedCache); 1377 CrTdRelease(pTex->pStretchedCache); 1378 pTex->pStretchedCache = NULL; 1379 } 1316 1380 } 1317 1381 … … 1335 1399 pTex->idInvertTex = 0; 1336 1400 } 1337 } 1338 1339 /* does same as CrTdBltDataDiscard, and in addition cleans up */ 1401 1402 crTdBltSdCleanupCacheNe(pTex); 1403 } 1404 1405 /* does same as CrTdBltDataFree, and in addition cleans up */ 1340 1406 VBOXBLITTERDECL(int) CrTdBltDataCleanup(PCR_TEXDATA pTex) 1341 1407 { … … 1375 1441 1376 1442 /* acquire the texture data, returns the cached data in case it is cached. 1377 * the data remains cached in the CR_TEXDATA object until it is discarded with CrTdBltData Discardor CrTdBltDataCleanup.1443 * the data remains cached in the CR_TEXDATA object until it is discarded with CrTdBltDataFree or CrTdBltDataCleanup. 1378 1444 * */ 1379 1445 VBOXBLITTERDECL(int) CrTdBltDataAcquire(PCR_TEXDATA pTex, GLenum enmFormat, bool fInverted, const CR_BLITTER_IMG**ppImg) … … 1385 1451 } 1386 1452 1387 if (pTex->Img.pvData && pTex->Img.enmFormat == enmFormat && !pTex->Flags.DataInverted == !fInverted) 1388 { 1453 if (pTex->Flags.DataAcquired) 1454 { 1455 WARN(("Data acquired already")); 1456 return VERR_INVALID_STATE; 1457 } 1458 1459 if (pTex->Flags.DataValid && pTex->Img.enmFormat == enmFormat && !pTex->Flags.DataInverted == !fInverted) 1460 { 1461 Assert(pTex->Img.pvData); 1389 1462 *ppImg = &pTex->Img; 1463 pTex->Flags.DataAcquired = 1; 1390 1464 return VINF_SUCCESS; 1391 1465 } 1392 1466 1393 crTdBltImg Free(pTex);1467 crTdBltImgRelease(pTex); 1394 1468 1395 1469 crTdBltCheckPBO(pTex); … … 1432 1506 } 1433 1507 1508 Assert(pTex->Img.pvData); 1434 1509 *ppImg = &pTex->Img; 1435 1436 return VINF_SUCCESS; 1437 } 1510 pTex->Flags.DataAcquired = 1; 1511 1512 return VINF_SUCCESS; 1513 } 1514 1515 DECLINLINE(void) crTdResize(PCR_TEXDATA pTex, const VBOXVR_TEXTURE *pVrTex) 1516 { 1517 crTdBltDataCleanup(pTex); 1518 1519 pTex->Tex = *pVrTex; 1520 } 1521 1522 static DECLCALLBACK(void) ctTdBltSdReleased(struct CR_TEXDATA *pTexture) 1523 { 1524 PCR_BLITTER pBlitter = pTexture->pBlitter; 1525 1526 int rc = CrBltEnter(pBlitter); 1527 if (!RT_SUCCESS(rc)) 1528 { 1529 WARN(("CrBltEnter failed, rc %d", rc)); 1530 return; 1531 } 1532 1533 CrTdBltDataCleanupNe(pTexture); 1534 1535 pBlitter->pDispatch->DeleteTextures(1, &pTexture->Tex.hwid); 1536 1537 CrBltLeave(pBlitter); 1538 1539 RTMemFree(pTexture); 1540 } 1541 1542 static int ctTdBltSdCreate(PCR_BLITTER pBlitter, uint32_t width, uint32_t height, GLenum enmTarget, PCR_TEXDATA *ppStretchedCache) 1543 { 1544 PCR_TEXDATA pStretchedCache; 1545 1546 Assert(CrBltIsEntered(pBlitter)); 1547 1548 *ppStretchedCache = NULL; 1549 1550 pStretchedCache = (PCR_TEXDATA)RTMemAlloc(sizeof (*pStretchedCache)); 1551 if (!pStretchedCache) 1552 { 1553 WARN(("RTMemAlloc failed")); 1554 return VERR_NO_MEMORY; 1555 } 1556 1557 VBOXVR_TEXTURE Tex; 1558 Tex.width = width; 1559 Tex.height = height; 1560 Tex.target = enmTarget; 1561 Tex.hwid = crTdBltTexCreate(pBlitter, width, height, enmTarget); 1562 if (!Tex.hwid) 1563 { 1564 WARN(("Tex create failed")); 1565 RTMemFree(pStretchedCache); 1566 return VERR_GENERAL_FAILURE; 1567 } 1568 1569 CrTdInit(pStretchedCache, &Tex, pBlitter, ctTdBltSdReleased); 1570 1571 *ppStretchedCache = pStretchedCache; 1572 1573 return VINF_SUCCESS; 1574 } 1575 1576 static int ctTdBltSdGet(PCR_TEXDATA pTex, uint32_t width, uint32_t height, PCR_TEXDATA *ppStretchedCache) 1577 { 1578 Assert(pTex->Flags.Entered); 1579 1580 PCR_TEXDATA pStretchedCache; 1581 1582 *ppStretchedCache = NULL; 1583 1584 if (!pTex->pStretchedCache) 1585 { 1586 int rc = ctTdBltSdCreate(pTex->pBlitter, width, height, pTex->Tex.target, &pStretchedCache); 1587 if (!RT_SUCCESS(rc)) 1588 { 1589 WARN(("ctTdBltSdCreate failed %d", rc)); 1590 return rc; 1591 } 1592 1593 pTex->pStretchedCache = pStretchedCache; 1594 } 1595 else 1596 { 1597 int cmp = pTex->pStretchedCache->Tex.width - width; 1598 if (cmp <= 0) 1599 cmp = pTex->pStretchedCache->Tex.height - height; 1600 1601 if (!cmp) 1602 pStretchedCache = pTex->pStretchedCache; 1603 else if (cmp < 0) /* current cache is "less" than the requested */ 1604 { 1605 int rc = ctTdBltSdCreate(pTex->pBlitter, width, height, pTex->Tex.target, &pStretchedCache); 1606 if (!RT_SUCCESS(rc)) 1607 { 1608 WARN(("ctTdBltSdCreate failed %d", rc)); 1609 return rc; 1610 } 1611 1612 pStretchedCache->pStretchedCache = pTex->pStretchedCache; 1613 pTex->pStretchedCache = pStretchedCache; 1614 } 1615 else /* cmp > 0 */ 1616 { 1617 int rc = ctTdBltSdGet(pTex->pStretchedCache, width, height, &pStretchedCache); 1618 if (!RT_SUCCESS(rc)) 1619 { 1620 WARN(("ctTdBltSdGet failed %d", rc)); 1621 return rc; 1622 } 1623 } 1624 } 1625 1626 Assert(pStretchedCache); 1627 1628 #if 0 1629 { 1630 VBOXVR_TEXTURE Tex; 1631 Tex.width = width; 1632 Tex.height = height; 1633 Tex.target = pTex->Tex.target; 1634 Tex.hwid = crTdBltTexCreate(pTex, width, height); 1635 if (!Tex.hwid) 1636 { 1637 WARN(("Tex create failed")); 1638 return VERR_GENERAL_FAILURE; 1639 } 1640 1641 pTex->pBlitter->pDispatch->DeleteTextures(1, &pTex->pStretchedCache->Tex.hwid); 1642 1643 crTdResize(pTex->pStretchedCache, &Tex); 1644 } 1645 #endif 1646 1647 *ppStretchedCache = pStretchedCache; 1648 return VINF_SUCCESS; 1649 } 1650 1651 static int ctTdBltSdGetUpdated(PCR_TEXDATA pTex, uint32_t width, uint32_t height, PCR_TEXDATA *ppStretchedCache) 1652 { 1653 PCR_TEXDATA pStretchedCache; 1654 1655 *ppStretchedCache = NULL; 1656 int rc = ctTdBltSdGet(pTex, width, height, &pStretchedCache); 1657 if (!RT_SUCCESS(rc)) 1658 { 1659 WARN(("ctTdBltSdGet failed %d", rc)); 1660 return rc; 1661 } 1662 1663 Assert(width == pStretchedCache->Tex.width); 1664 Assert(height == pStretchedCache->Tex.height); 1665 1666 if (!pStretchedCache->Flags.DataValid) 1667 { 1668 RTRECT SrcRect, DstRect; 1669 1670 SrcRect.xLeft = 0; 1671 SrcRect.yTop = 0; 1672 SrcRect.xRight = pTex->Tex.width; 1673 SrcRect.yBottom = pTex->Tex.height; 1674 1675 DstRect.xLeft = 0; 1676 DstRect.yTop = 0; 1677 DstRect.xRight = width; 1678 DstRect.yBottom = height; 1679 1680 CrBltBlitTexTex(pTex->pBlitter, &pTex->Tex, &SrcRect, &pStretchedCache->Tex, &DstRect, 1, 0); 1681 } 1682 1683 *ppStretchedCache = pStretchedCache; 1684 1685 return VINF_SUCCESS; 1686 } 1687 1688 VBOXBLITTERDECL(int) CrTdBltDataAcquireStretched(PCR_TEXDATA pTex, GLenum enmFormat, bool fInverted, uint32_t width, uint32_t height, const CR_BLITTER_IMG**ppImg) 1689 { 1690 if (pTex->Tex.width == width && pTex->Tex.height == height) 1691 return CrTdBltDataAcquire(pTex, enmFormat, fInverted, ppImg); 1692 1693 if (!pTex->Flags.Entered) 1694 { 1695 WARN(("tex not entered")); 1696 return VERR_INVALID_STATE; 1697 } 1698 1699 PCR_TEXDATA pStretchedCache; 1700 1701 int rc = ctTdBltSdGetUpdated(pTex, width, height, &pStretchedCache); 1702 if (!RT_SUCCESS(rc)) 1703 { 1704 WARN(("ctTdBltSdGetUpdated failed rc %d", rc)); 1705 return rc; 1706 } 1707 1708 rc = CrTdBltEnter(pStretchedCache); 1709 if (!RT_SUCCESS(rc)) 1710 { 1711 WARN(("CrTdBltEnter failed rc %d", rc)); 1712 return rc; 1713 } 1714 1715 rc = CrTdBltDataAcquire(pStretchedCache, enmFormat, fInverted, ppImg); 1716 if (!RT_SUCCESS(rc)) 1717 { 1718 WARN(("CrTdBltDataAcquire failed rc %d", rc)); 1719 CrTdBltLeave(pTex->pStretchedCache); 1720 return rc; 1721 } 1722 1723 return VINF_SUCCESS; 1724 } 1725 1726 VBOXBLITTERDECL(int) CrTdBltDataReleaseStretched(PCR_TEXDATA pTex, const CR_BLITTER_IMG *pImg) 1727 { 1728 PCR_TEXDATA pStretchedCache = RT_FROM_MEMBER(pImg, CR_TEXDATA, Img); 1729 int rc = CrTdBltDataRelease(pStretchedCache); 1730 if (!RT_SUCCESS(rc)) 1731 { 1732 WARN(("CrTdBltDataRelease failed rc %d", rc)); 1733 return rc; 1734 } 1735 1736 if (pStretchedCache != pTex) 1737 CrTdBltLeave(pStretchedCache); 1738 1739 return VINF_SUCCESS; 1740 } 1741 1742 VBOXBLITTERDECL(void) CrTdBltStretchCacheMoveTo(PCR_TEXDATA pTex, PCR_TEXDATA pDstTex) 1743 { 1744 if (!pTex->pStretchedCache) 1745 return; 1746 1747 crTdBltSdCleanupCacheNe(pDstTex); 1748 1749 pDstTex->pStretchedCache = pTex->pStretchedCache; 1750 pTex->pStretchedCache = NULL; 1751 }
Note:
See TracChangeset
for help on using the changeset viewer.