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

Side by Side Diff: ui/gl/gl_surface_ozone.cc

Issue 1564123002: GLSurfaceOzone: move the IsUDL() check after ScheduleOverlayPlanes() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/gl/gl_surface.h" 5 #include "ui/gl/gl_surface.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // TODO: the following should be replaced by a per surface flush as it gets 255 // TODO: the following should be replaced by a per surface flush as it gets
256 // implemented in GL drivers. 256 // implemented in GL drivers.
257 if (has_implicit_external_sync_) { 257 if (has_implicit_external_sync_) {
258 EGLSyncKHR fence = InsertFence(); 258 EGLSyncKHR fence = InsertFence();
259 if (!fence) 259 if (!fence)
260 return SwapResult::SWAP_FAILED; 260 return SwapResult::SWAP_FAILED;
261 261
262 EGLDisplay display = GetDisplay(); 262 EGLDisplay display = GetDisplay();
263 WaitForFence(display, fence); 263 WaitForFence(display, fence);
264 eglDestroySyncKHR(display, fence); 264 eglDestroySyncKHR(display, fence);
265 } else if (ozone_surface_->IsUniversalDisplayLinkDevice()) {
266 glFinish();
267 } 265 }
268 266
269 unsubmitted_frames_.back()->ScheduleOverlayPlanes(widget_); 267 unsubmitted_frames_.back()->ScheduleOverlayPlanes(widget_);
270 unsubmitted_frames_.back()->overlays.clear(); 268 unsubmitted_frames_.back()->overlays.clear();
271 269
270 if (ozone_surface_->IsUniversalDisplayLinkDevice())
271 glFinish();
272
272 return ozone_surface_->OnSwapBuffers() ? gfx::SwapResult::SWAP_ACK 273 return ozone_surface_->OnSwapBuffers() ? gfx::SwapResult::SWAP_ACK
273 : gfx::SwapResult::SWAP_FAILED; 274 : gfx::SwapResult::SWAP_FAILED;
274 } 275 }
275 276
276 bool GLSurfaceOzoneSurfaceless::ScheduleOverlayPlane(int z_order, 277 bool GLSurfaceOzoneSurfaceless::ScheduleOverlayPlane(int z_order,
277 OverlayTransform transform, 278 OverlayTransform transform,
278 GLImage* image, 279 GLImage* image,
279 const Rect& bounds_rect, 280 const Rect& bounds_rect,
280 const RectF& crop_rect) { 281 const RectF& crop_rect) {
281 unsubmitted_frames_.back()->overlays.push_back( 282 unsubmitted_frames_.back()->overlays.push_back(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 341
341 base::Closure fence_retired_callback = 342 base::Closure fence_retired_callback =
342 base::Bind(&GLSurfaceOzoneSurfaceless::FenceRetired, 343 base::Bind(&GLSurfaceOzoneSurfaceless::FenceRetired,
343 weak_factory_.GetWeakPtr(), fence, frame); 344 weak_factory_.GetWeakPtr(), fence, frame);
344 345
345 base::WorkerPool::PostTaskAndReply(FROM_HERE, fence_wait_task, 346 base::WorkerPool::PostTaskAndReply(FROM_HERE, fence_wait_task,
346 fence_retired_callback, false); 347 fence_retired_callback, false);
347 return; // Defer frame submission until fence signals. 348 return; // Defer frame submission until fence signals.
348 } 349 }
349 350
350 if (ozone_surface_->IsUniversalDisplayLinkDevice())
351 glFinish();
352
353 frame->ready = true; 351 frame->ready = true;
354 SubmitFrame(); 352 SubmitFrame();
355 } 353 }
356 354
357 void GLSurfaceOzoneSurfaceless::PostSubBufferAsync( 355 void GLSurfaceOzoneSurfaceless::PostSubBufferAsync(
358 int x, 356 int x,
359 int y, 357 int y,
360 int width, 358 int width,
361 int height, 359 int height,
362 const SwapCompletionCallback& callback) { 360 const SwapCompletionCallback& callback) {
(...skipping 13 matching lines...) Expand all
376 unsubmitted_frames_.weak_erase(unsubmitted_frames_.begin()); 374 unsubmitted_frames_.weak_erase(unsubmitted_frames_.begin());
377 swap_buffers_pending_ = true; 375 swap_buffers_pending_ = true;
378 376
379 if (!frame->ScheduleOverlayPlanes(widget_)) { 377 if (!frame->ScheduleOverlayPlanes(widget_)) {
380 // |callback| is a wrapper for SwapCompleted(). Call it to properly 378 // |callback| is a wrapper for SwapCompleted(). Call it to properly
381 // propagate the failed state. 379 // propagate the failed state.
382 frame->callback.Run(gfx::SwapResult::SWAP_FAILED); 380 frame->callback.Run(gfx::SwapResult::SWAP_FAILED);
383 return; 381 return;
384 } 382 }
385 383
384 if (ozone_surface_->IsUniversalDisplayLinkDevice())
385 glFinish();
386
386 ozone_surface_->OnSwapBuffersAsync(frame->callback); 387 ozone_surface_->OnSwapBuffersAsync(frame->callback);
387 } 388 }
388 } 389 }
389 390
390 EGLSyncKHR GLSurfaceOzoneSurfaceless::InsertFence() { 391 EGLSyncKHR GLSurfaceOzoneSurfaceless::InsertFence() {
391 const EGLint attrib_list[] = {EGL_SYNC_CONDITION_KHR, 392 const EGLint attrib_list[] = {EGL_SYNC_CONDITION_KHR,
392 EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM, 393 EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM,
393 EGL_NONE}; 394 EGL_NONE};
394 return eglCreateSyncKHR(GetDisplay(), EGL_SYNC_FENCE_KHR, attrib_list); 395 return eglCreateSyncKHR(GetDisplay(), EGL_SYNC_FENCE_KHR, attrib_list);
395 } 396 }
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 } 717 }
717 } 718 }
718 719
719 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 720 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
720 return ui::OzonePlatform::GetInstance() 721 return ui::OzonePlatform::GetInstance()
721 ->GetSurfaceFactoryOzone() 722 ->GetSurfaceFactoryOzone()
722 ->GetNativeDisplay(); 723 ->GetNativeDisplay();
723 } 724 }
724 725
725 } // namespace gfx 726 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698