Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Unified Diff: ui/ozone/platform/drm/gpu/gbm_surfaceless.cc

Issue 2866903002: Revert of ozone: Wait on EGLFence before committing buffers. Avoid using GL. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_surfaceless.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/gbm_surfaceless.cc
diff --git a/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc b/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc
index 722de976b72684a39248b0e149258c3f0d5b33b2..b436a7b2871433ad8d3bce905e3b7fc7252c5811 100644
--- a/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc
+++ b/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc
@@ -37,6 +37,8 @@
widget_(widget),
has_implicit_external_sync_(
HasEGLExtension("EGL_ARM_implicit_external_sync")),
+ has_image_flush_external_(
+ HasEGLExtension("EGL_EXT_image_flush_external")),
weak_factory_(this) {
surface_factory_->RegisterSurface(window_->widget(), this);
unsubmitted_frames_.push_back(base::MakeUnique<PendingFrame>());
@@ -103,6 +105,7 @@
return;
}
+ glFlush();
unsubmitted_frames_.back()->Flush();
SwapCompletionCallback surface_swap_callback = base::Bind(
@@ -114,25 +117,31 @@
// TODO: the following should be replaced by a per surface flush as it gets
// implemented in GL drivers.
- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_);
- if (!fence) {
- callback.Run(gfx::SwapResult::SWAP_FAILED);
- return;
- }
-
- base::Closure fence_wait_task =
- base::Bind(&WaitForFence, GetDisplay(), fence);
-
- base::Closure fence_retired_callback = base::Bind(
- &GbmSurfaceless::FenceRetired, weak_factory_.GetWeakPtr(), fence, frame);
-
- base::PostTaskWithTraitsAndReply(
- FROM_HERE,
- base::TaskTraits()
- .WithShutdownBehavior(
- base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
- .MayBlock(),
- fence_wait_task, fence_retired_callback);
+ if (has_implicit_external_sync_ || has_image_flush_external_) {
+ EGLSyncKHR fence = InsertFence(has_implicit_external_sync_);
+ if (!fence) {
+ callback.Run(gfx::SwapResult::SWAP_FAILED);
+ return;
+ }
+
+ base::Closure fence_wait_task =
+ base::Bind(&WaitForFence, GetDisplay(), fence);
+
+ base::Closure fence_retired_callback =
+ base::Bind(&GbmSurfaceless::FenceRetired, weak_factory_.GetWeakPtr(),
+ fence, frame);
+
+ base::PostTaskWithTraitsAndReply(
+ FROM_HERE, base::TaskTraits()
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
+ .MayBlock(),
+ fence_wait_task, fence_retired_callback);
+ return; // Defer frame submission until fence signals.
+ }
+
+ frame->ready = true;
+ SubmitFrame();
}
void GbmSurfaceless::PostSubBufferAsync(
@@ -204,6 +213,9 @@
return;
}
+ if (IsUniversalDisplayLinkDevice())
+ glFinish();
+
window_->SchedulePageFlip(planes_, frame->callback);
planes_.clear();
}
@@ -235,4 +247,8 @@
SubmitFrame();
}
+bool GbmSurfaceless::IsUniversalDisplayLinkDevice() {
+ return planes_.empty() ? false : planes_[0].buffer->RequiresGlFinish();
+}
+
} // namespace ui
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_surfaceless.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698