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

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

Issue 2443023002: gpu: Add CHROMIUM_copy_image extension.
Patch Set: rebase Created 4 years, 2 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 2fe3306e323c97594ca1fd7af49bbc1cdee3eba3..6ce6c85f434ad1b955fa4e49508aee73d14af116 100644
--- a/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc
+++ b/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
-#include "base/threading/worker_pool.h"
#include "base/trace_event/trace_event.h"
#include "ui/ozone/common/egl_util.h"
#include "ui/ozone/platform/drm/gpu/drm_vsync_provider.h"
@@ -19,15 +18,6 @@
namespace ui {
-namespace {
-
-void WaitForFence(EGLDisplay display, EGLSyncKHR fence) {
- eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,
- EGL_FOREVER_KHR);
-}
-
-} // namespace
-
GbmSurfaceless::GbmSurfaceless(GbmSurfaceFactory* surface_factory,
std::unique_ptr<DrmWindowProxy> window,
gfx::AcceleratedWidget widget)
@@ -118,26 +108,21 @@ void GbmSurfaceless::SwapBuffersAsync(const SwapCompletionCallback& callback) {
// TODO: the following should be replaced by a per surface flush as it gets
// implemented in GL drivers.
if (has_implicit_external_sync_ || has_image_flush_external_) {
- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_);
- if (!fence) {
+ const EGLint attrib_list[] = {EGL_SYNC_CONDITION_KHR,
+ EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM,
+ EGL_NONE};
+ base::Closure frame_ready_callback = base::Bind(
+ &GbmSurfaceless::FrameReady, weak_factory_.GetWeakPtr(), frame);
+ if (!InsertSyncFence(has_implicit_external_sync_ ? attrib_list : nullptr,
+ frame_ready_callback)) {
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::WorkerPool::PostTaskAndReply(FROM_HERE, fence_wait_task,
- fence_retired_callback, false);
return; // Defer frame submission until fence signals.
}
- frame->ready = true;
- SubmitFrame();
+ FrameReady(frame);
}
void GbmSurfaceless::PostSubBufferAsync(
@@ -217,16 +202,7 @@ void GbmSurfaceless::SubmitFrame() {
}
}
-EGLSyncKHR GbmSurfaceless::InsertFence(bool implicit) {
- const EGLint attrib_list[] = {EGL_SYNC_CONDITION_KHR,
- EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM,
- EGL_NONE};
- return eglCreateSyncKHR(GetDisplay(), EGL_SYNC_FENCE_KHR,
- implicit ? attrib_list : NULL);
-}
-
-void GbmSurfaceless::FenceRetired(EGLSyncKHR fence, PendingFrame* frame) {
- eglDestroySyncKHR(GetDisplay(), fence);
+void GbmSurfaceless::FrameReady(PendingFrame* frame) {
frame->ready = true;
SubmitFrame();
}
« 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