aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrRenderTargetContext.cpp
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2017-08-01 17:43:30 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-01 17:43:41 +0000
commitcc8eb60c486eaf397685c60b28998682025fee1a (patch)
treea2a9569c0936cd787f14ff8e894579ac11c2ba1c /src/gpu/GrRenderTargetContext.cpp
parent8514ebfb19c9c50e588283541133125b5aa8a05b (diff)
Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush"""
This reverts commit 876aed8758b7109574999ffac43b1ea47f359bd7. Reason for revert: the bots seem to be unhappily red with this CL Original change's description: > Revert "Revert "Add support for semaphores to be inserted on GrContext flush"" > > This reverts commit 8724b4609996eb6369b454611e31b065f3d8d2cf. > > Reason for revert: Creating a test CL to see what happens on the bots > > Original change's description: > > Revert "Add support for semaphores to be inserted on GrContext flush" > > > > This reverts commit cd1416efbc7af6f115dbaa09dce48e075d1d96ca. > > > > Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths > > > > Original change's description: > > > Add support for semaphores to be inserted on GrContext flush > > > > > > This also moves the logic of inserting semaphores down into GrDrawingManager > > > and finishFlush on GrGpu. With it being on finishFlush, there should be no > > > issues when the DrawingManager starts respecting the proxy passed in assuming > > > it always calls finishFlush at the end (which it should). > > > > > > Bug: skia: > > > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7 > > > Reviewed-on: https://skia-review.googlesource.com/25641 > > > Reviewed-by: Brian Salomon <bsalomon@google.com> > > > Commit-Queue: Greg Daniel <egdaniel@google.com> > > > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com > > > > Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249 > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Bug: skia: > > Reviewed-on: https://skia-review.googlesource.com/25980 > > Reviewed-by: Mike Reed <reed@google.com> > > Commit-Queue: Mike Reed <reed@google.com> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Bug: skia: > Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c > Reviewed-on: https://skia-review.googlesource.com/26160 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Greg Daniel <egdaniel@google.com> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com Change-Id: I22fd6febafe70489a5fdb695c6f4263368eb423d No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/29422 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetContext.cpp')
-rw-r--r--src/gpu/GrRenderTargetContext.cpp38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index d54b084b5a..66a707b52d 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1409,16 +1409,42 @@ void GrRenderTargetContext::drawImageLattice(const GrClip& clip,
this->addDrawOp(clip, std::move(op));
}
-GrSemaphoresSubmitted GrRenderTargetContext::prepareForExternalIO(
- int numSemaphores, GrBackendSemaphore backendSemaphores[]) {
+bool GrRenderTargetContext::prepareForExternalIO(int numSemaphores,
+ GrBackendSemaphore* backendSemaphores) {
ASSERT_SINGLE_OWNER
- if (this->drawingManager()->wasAbandoned()) { return GrSemaphoresSubmitted::kNo; }
+ RETURN_FALSE_IF_ABANDONED
SkDEBUGCODE(this->validate();)
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "prepareForExternalIO", fContext);
- return this->drawingManager()->prepareSurfaceForExternalIO(fRenderTargetProxy.get(),
- numSemaphores,
- backendSemaphores);
+ if (numSemaphores && !this->caps()->fenceSyncSupport()) {
+ this->drawingManager()->prepareSurfaceForExternalIO(fRenderTargetProxy.get());
+ return false;
+ }
+
+ SkTArray<sk_sp<GrSemaphore>> semaphores(numSemaphores);
+ for (int i = 0; i < numSemaphores; ++i) {
+ if (backendSemaphores[i].isInitialized()) {
+ semaphores.push_back(fContext->resourceProvider()->wrapBackendSemaphore(
+ backendSemaphores[i], kBorrow_GrWrapOwnership));
+ } else {
+ semaphores.push_back(fContext->resourceProvider()->makeSemaphore(false));
+ }
+ // Create signal semaphore ops and force the final one to call flush.
+ bool forceFlush = (i == (numSemaphores - 1));
+ std::unique_ptr<GrOp> signalOp(GrSemaphoreOp::MakeSignal(semaphores.back(),
+ fRenderTargetProxy.get(),
+ forceFlush));
+ this->getRTOpList()->addOp(std::move(signalOp), *this->caps());
+ }
+
+ this->drawingManager()->prepareSurfaceForExternalIO(fRenderTargetProxy.get());
+
+ for (int i = 0; i < numSemaphores; ++i) {
+ if (!backendSemaphores[i].isInitialized()) {
+ semaphores[i]->setBackendSemaphore(&backendSemaphores[i]);
+ }
+ }
+ return true;
}
bool GrRenderTargetContext::waitOnSemaphores(int numSemaphores,