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

Side by Side Diff: ui/ozone/platform/drm/gpu/gbm_surfaceless.cc

Issue 2908313002: Revert of gpu: Use ANDROID_native_fence_sync instead of ARM_implicit_external_sync. (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_surfaceless.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h" 5 #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 17 matching lines...) Expand all
28 28
29 } // namespace 29 } // namespace
30 30
31 GbmSurfaceless::GbmSurfaceless(GbmSurfaceFactory* surface_factory, 31 GbmSurfaceless::GbmSurfaceless(GbmSurfaceFactory* surface_factory,
32 std::unique_ptr<DrmWindowProxy> window, 32 std::unique_ptr<DrmWindowProxy> window,
33 gfx::AcceleratedWidget widget) 33 gfx::AcceleratedWidget widget)
34 : SurfacelessEGL(gfx::Size()), 34 : SurfacelessEGL(gfx::Size()),
35 surface_factory_(surface_factory), 35 surface_factory_(surface_factory),
36 window_(std::move(window)), 36 window_(std::move(window)),
37 widget_(widget), 37 widget_(widget),
38 has_native_fence_sync_(HasEGLExtension("EGL_ANDROID_native_fence_sync")), 38 has_implicit_external_sync_(
39 HasEGLExtension("EGL_ARM_implicit_external_sync")),
39 weak_factory_(this) { 40 weak_factory_(this) {
40 surface_factory_->RegisterSurface(window_->widget(), this); 41 surface_factory_->RegisterSurface(window_->widget(), this);
41 unsubmitted_frames_.push_back(base::MakeUnique<PendingFrame>()); 42 unsubmitted_frames_.push_back(base::MakeUnique<PendingFrame>());
42 } 43 }
43 44
44 void GbmSurfaceless::QueueOverlayPlane(const OverlayPlane& plane) { 45 void GbmSurfaceless::QueueOverlayPlane(const OverlayPlane& plane) {
45 planes_.push_back(plane); 46 planes_.push_back(plane);
46 } 47 }
47 48
48 bool GbmSurfaceless::Initialize(gl::GLSurfaceFormat format) { 49 bool GbmSurfaceless::Initialize(gl::GLSurfaceFormat format) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 107
107 SwapCompletionCallback surface_swap_callback = base::Bind( 108 SwapCompletionCallback surface_swap_callback = base::Bind(
108 &GbmSurfaceless::SwapCompleted, weak_factory_.GetWeakPtr(), callback); 109 &GbmSurfaceless::SwapCompleted, weak_factory_.GetWeakPtr(), callback);
109 110
110 PendingFrame* frame = unsubmitted_frames_.back().get(); 111 PendingFrame* frame = unsubmitted_frames_.back().get();
111 frame->callback = surface_swap_callback; 112 frame->callback = surface_swap_callback;
112 unsubmitted_frames_.push_back(base::MakeUnique<PendingFrame>()); 113 unsubmitted_frames_.push_back(base::MakeUnique<PendingFrame>());
113 114
114 // TODO: the following should be replaced by a per surface flush as it gets 115 // TODO: the following should be replaced by a per surface flush as it gets
115 // implemented in GL drivers. 116 // implemented in GL drivers.
116 EGLSyncKHR fence = InsertFence(has_native_fence_sync_); 117 EGLSyncKHR fence = InsertFence(has_implicit_external_sync_);
117 if (!fence) { 118 if (!fence) {
118 callback.Run(gfx::SwapResult::SWAP_FAILED); 119 callback.Run(gfx::SwapResult::SWAP_FAILED);
119 return; 120 return;
120 } 121 }
121 122
122 base::Closure fence_wait_task = 123 base::Closure fence_wait_task =
123 base::Bind(&WaitForFence, GetDisplay(), fence); 124 base::Bind(&WaitForFence, GetDisplay(), fence);
124 125
125 base::Closure fence_retired_callback = base::Bind( 126 base::Closure fence_retired_callback = base::Bind(
126 &GbmSurfaceless::FenceRetired, weak_factory_.GetWeakPtr(), fence, frame); 127 &GbmSurfaceless::FenceRetired, weak_factory_.GetWeakPtr(), fence, frame);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // propagate the failed state. 199 // propagate the failed state.
199 frame->callback.Run(gfx::SwapResult::SWAP_FAILED); 200 frame->callback.Run(gfx::SwapResult::SWAP_FAILED);
200 return; 201 return;
201 } 202 }
202 203
203 window_->SchedulePageFlip(planes_, frame->callback); 204 window_->SchedulePageFlip(planes_, frame->callback);
204 planes_.clear(); 205 planes_.clear();
205 } 206 }
206 } 207 }
207 208
208 EGLSyncKHR GbmSurfaceless::InsertFence(bool native) { 209 EGLSyncKHR GbmSurfaceless::InsertFence(bool implicit) {
209 return eglCreateSyncKHR( 210 const EGLint attrib_list[] = {EGL_SYNC_CONDITION_KHR,
210 GetDisplay(), native ? EGL_SYNC_NATIVE_FENCE_ANDROID : EGL_SYNC_FENCE_KHR, 211 EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM,
211 nullptr); 212 EGL_NONE};
213 return eglCreateSyncKHR(GetDisplay(), EGL_SYNC_FENCE_KHR,
214 implicit ? attrib_list : NULL);
212 } 215 }
213 216
214 void GbmSurfaceless::FenceRetired(EGLSyncKHR fence, PendingFrame* frame) { 217 void GbmSurfaceless::FenceRetired(EGLSyncKHR fence, PendingFrame* frame) {
215 eglDestroySyncKHR(GetDisplay(), fence); 218 eglDestroySyncKHR(GetDisplay(), fence);
216 frame->ready = true; 219 frame->ready = true;
217 SubmitFrame(); 220 SubmitFrame();
218 } 221 }
219 222
220 void GbmSurfaceless::SwapCompleted(const SwapCompletionCallback& callback, 223 void GbmSurfaceless::SwapCompleted(const SwapCompletionCallback& callback,
221 gfx::SwapResult result) { 224 gfx::SwapResult result) {
222 callback.Run(result); 225 callback.Run(result);
223 swap_buffers_pending_ = false; 226 swap_buffers_pending_ = false;
224 if (result == gfx::SwapResult::SWAP_FAILED) { 227 if (result == gfx::SwapResult::SWAP_FAILED) {
225 last_swap_buffers_result_ = false; 228 last_swap_buffers_result_ = false;
226 return; 229 return;
227 } 230 }
228 231
229 SubmitFrame(); 232 SubmitFrame();
230 } 233 }
231 234
232 } // namespace ui 235 } // namespace ui
OLDNEW
« 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