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

Side by Side Diff: gpu/ipc/service/image_transport_surface_overlay_mac.mm

Issue 2042553002: Mac CoreAnimation compositor in the browser process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lock_directly
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "gpu/ipc/service/image_transport_surface_overlay_mac.h" 5 #include "gpu/ipc/service/image_transport_surface_overlay_mac.h"
6 6
7 #include <CoreGraphics/CoreGraphics.h> 7 #include <CoreGraphics/CoreGraphics.h>
8 #include <IOSurface/IOSurface.h> 8 #include <IOSurface/IOSurface.h>
9 #include <OpenGL/CGLRenderers.h> 9 #include <OpenGL/CGLRenderers.h>
10 #include <OpenGL/CGLTypes.h> 10 #include <OpenGL/CGLTypes.h>
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 gl::ScopedSetGLToRealGLApi scoped_set_gl_api; 203 gl::ScopedSetGLToRealGLApi scoped_set_gl_api;
204 TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::glFinish"); 204 TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::glFinish");
205 CheckGLErrors("Before finish"); 205 CheckGLErrors("Before finish");
206 glFinish(); 206 glFinish();
207 CheckGLErrors("After finish"); 207 CheckGLErrors("After finish");
208 } 208 }
209 209
210 base::TimeTicks finish_time = base::TimeTicks::Now(); 210 base::TimeTicks finish_time = base::TimeTicks::Now();
211 211
212 bool fullscreen_low_power_layer_valid = false; 212 bool fullscreen_low_power_layer_valid = false;
213 /*
213 ca_layer_tree_coordinator_->CommitPendingTreesToCA( 214 ca_layer_tree_coordinator_->CommitPendingTreesToCA(
214 pixel_damage_rect, &fullscreen_low_power_layer_valid); 215 pixel_damage_rect, &fullscreen_low_power_layer_valid);
216 */
215 // TODO(ccameron): Plumb the fullscreen low power layer through to the 217 // TODO(ccameron): Plumb the fullscreen low power layer through to the
216 // appropriate window. 218 // appropriate window.
217 219
218 // Update the latency info to reflect the swap time. 220 // Update the latency info to reflect the swap time.
219 for (auto latency_info : latency_info_) { 221 for (auto latency_info : latency_info_) {
220 latency_info.AddLatencyNumberWithTimestamp( 222 latency_info.AddLatencyNumberWithTimestamp(
221 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, finish_time, 1); 223 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, finish_time, 1);
222 latency_info.AddLatencyNumberWithTimestamp( 224 latency_info.AddLatencyNumberWithTimestamp(
223 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, 225 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0,
224 finish_time, 1); 226 finish_time, 1);
225 } 227 }
226 228
227 // Send acknowledgement to the browser. 229 // Send acknowledgement to the browser.
228 CAContextID ca_context_id = 0; 230 CAContextID ca_context_id = 0;
229 CAContextID fullscreen_low_power_ca_context_id = 0; 231 CAContextID fullscreen_low_power_ca_context_id = 0;
230 gfx::ScopedRefCountedIOSurfaceMachPort io_surface_mach_port; 232 gfx::ScopedRefCountedIOSurfaceMachPort io_surface_mach_port;
233 /*
231 if (use_remote_layer_api_) { 234 if (use_remote_layer_api_) {
232 ca_context_id = [ca_context_ contextId]; 235 ca_context_id = [ca_context_ contextId];
233 fullscreen_low_power_ca_context_id = 236 fullscreen_low_power_ca_context_id =
234 [fullscreen_low_power_ca_context_ contextId]; 237 [fullscreen_low_power_ca_context_ contextId];
235 } else { 238 } else {
236 IOSurfaceRef io_surface = 239 IOSurfaceRef io_surface =
237 ca_layer_tree_coordinator_->GetIOSurfaceForDisplay(); 240 ca_layer_tree_coordinator_->GetIOSurfaceForDisplay();
238 if (io_surface) 241 if (io_surface)
239 io_surface_mach_port.reset(IOSurfaceCreateMachPort(io_surface)); 242 io_surface_mach_port.reset(IOSurfaceCreateMachPort(io_surface));
240 } 243 }
244 */
241 SendAcceleratedSurfaceBuffersSwapped( 245 SendAcceleratedSurfaceBuffersSwapped(
242 handle_, ca_context_id, fullscreen_low_power_layer_valid, 246 handle_, ca_context_id, fullscreen_low_power_layer_valid,
243 fullscreen_low_power_ca_context_id, io_surface_mach_port, pixel_size_, 247 fullscreen_low_power_ca_context_id, io_surface_mach_port, pixel_size_,
244 scale_factor_, std::move(latency_info_)); 248 scale_factor_, std::move(latency_info_));
245 249
246 // Reset all state for the next frame. 250 // Reset all state for the next frame.
247 latency_info_.clear(); 251 latency_info_.clear();
248 return gfx::SwapResult::SWAP_ACK; 252 return gfx::SwapResult::SWAP_ACK;
249 } 253 }
250 254
(...skipping 28 matching lines...) Expand all
279 context->share_group()->SetRendererID(gl_renderer_id_); 283 context->share_group()->SetRendererID(gl_renderer_id_);
280 return true; 284 return true;
281 } 285 }
282 286
283 bool ImageTransportSurfaceOverlayMac::ScheduleOverlayPlane( 287 bool ImageTransportSurfaceOverlayMac::ScheduleOverlayPlane(
284 int z_order, 288 int z_order,
285 gfx::OverlayTransform transform, 289 gfx::OverlayTransform transform,
286 gl::GLImage* image, 290 gl::GLImage* image,
287 const gfx::Rect& pixel_frame_rect, 291 const gfx::Rect& pixel_frame_rect,
288 const gfx::RectF& crop_rect) { 292 const gfx::RectF& crop_rect) {
293 CHECK(0);
289 if (transform != gfx::OVERLAY_TRANSFORM_NONE) { 294 if (transform != gfx::OVERLAY_TRANSFORM_NONE) {
290 DLOG(ERROR) << "Invalid overlay plane transform."; 295 DLOG(ERROR) << "Invalid overlay plane transform.";
291 return false; 296 return false;
292 } 297 }
293 if (z_order) { 298 if (z_order) {
294 DLOG(ERROR) << "Invalid non-zero Z order."; 299 DLOG(ERROR) << "Invalid non-zero Z order.";
295 return false; 300 return false;
296 } 301 }
297 return ca_layer_tree_coordinator_->SetPendingGLRendererBackbuffer( 302 return ca_layer_tree_coordinator_->SetPendingGLRendererBackbuffer(
298 static_cast<gl::GLImageIOSurface*>(image)->io_surface()); 303 static_cast<gl::GLImageIOSurface*>(image)->io_surface());
299 } 304 }
300 305
301 bool ImageTransportSurfaceOverlayMac::ScheduleCALayer( 306 bool ImageTransportSurfaceOverlayMac::ScheduleCALayer(
302 gl::GLImage* contents_image, 307 gl::GLImage* contents_image,
303 const gfx::RectF& contents_rect, 308 const gfx::RectF& contents_rect,
304 float opacity, 309 float opacity,
305 unsigned background_color, 310 unsigned background_color,
306 unsigned edge_aa_mask, 311 unsigned edge_aa_mask,
307 const gfx::RectF& rect, 312 const gfx::RectF& rect,
308 bool is_clipped, 313 bool is_clipped,
309 const gfx::RectF& clip_rect, 314 const gfx::RectF& clip_rect,
310 const gfx::Transform& transform, 315 const gfx::Transform& transform,
311 int sorting_context_id, 316 int sorting_context_id,
312 unsigned filter) { 317 unsigned filter) {
318 CHECK(0);
313 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; 319 base::ScopedCFTypeRef<IOSurfaceRef> io_surface;
314 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer; 320 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer;
315 if (contents_image) { 321 if (contents_image) {
316 gl::GLImageIOSurface* io_surface_image = 322 gl::GLImageIOSurface* io_surface_image =
317 static_cast<gl::GLImageIOSurface*>(contents_image); 323 static_cast<gl::GLImageIOSurface*>(contents_image);
318 io_surface = io_surface_image->io_surface(); 324 io_surface = io_surface_image->io_surface();
319 cv_pixel_buffer = io_surface_image->cv_pixel_buffer(); 325 cv_pixel_buffer = io_surface_image->cv_pixel_buffer();
320 } 326 }
321 return ca_layer_tree_coordinator_->GetPendingCARendererLayerTree() 327 return ca_layer_tree_coordinator_->GetPendingCARendererLayerTree()
322 ->ScheduleCALayer(is_clipped, gfx::ToEnclosingRect(clip_rect), 328 ->ScheduleCALayer(is_clipped, gfx::ToEnclosingRect(clip_rect),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; 361 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask;
356 362
357 // Post a task holding a reference to the new GL context. The reason for 363 // Post a task holding a reference to the new GL context. The reason for
358 // this is to avoid creating-then-destroying the context for every image 364 // this is to avoid creating-then-destroying the context for every image
359 // transport surface that is observing the GPU switch. 365 // transport surface that is observing the GPU switch.
360 base::MessageLoop::current()->PostTask( 366 base::MessageLoop::current()->PostTask(
361 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); 367 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu));
362 } 368 }
363 369
364 } // namespace gpu 370 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_io_surface.cc ('k') | ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698