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

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

Issue 2473973002: NOT for review (for discussion): Query IOSurfaceIsInUse in the browser process
Patch Set: Created 4 years, 1 month 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 | « gpu/ipc/common/gpu_command_buffer_traits.cc ('k') | ui/gfx/gpu_memory_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 fullscreen_low_power_ca_context_id; 159 fullscreen_low_power_ca_context_id;
160 params.io_surface = io_surface; 160 params.io_surface = io_surface;
161 params.pixel_size = size; 161 params.pixel_size = size;
162 params.scale_factor = scale_factor; 162 params.scale_factor = scale_factor;
163 params.latency_info = std::move(latency_info); 163 params.latency_info = std::move(latency_info);
164 params.result = gfx::SwapResult::SWAP_ACK; 164 params.result = gfx::SwapResult::SWAP_ACK;
165 165
166 for (auto& query : ca_layer_in_use_queries_) { 166 for (auto& query : ca_layer_in_use_queries_) {
167 gpu::TextureInUseResponse response; 167 gpu::TextureInUseResponse response;
168 response.texture = query.texture; 168 response.texture = query.texture;
169 bool in_use = false; 169 response.in_use_valid = false;
170 gl::GLImageIOSurface* io_surface_image = 170 gl::GLImageIOSurface* io_surface_image =
171 gl::GLImageIOSurface::FromGLImage(query.image.get()); 171 gl::GLImageIOSurface::FromGLImage(query.image.get());
172 if (io_surface_image) { 172 if (query.needs_gpu_memory_buffer_handle && io_surface_image) {
173 in_use = io_surface_image->CanCheckIOSurfaceIsInUse() && 173 response.in_use_valid = io_surface_image->CanCheckIOSurfaceIsInUse();
174 IOSurfaceIsInUse(io_surface_image->io_surface()); 174 response.gpu_memory_buffer_handle.type =
175 gfx::GpuMemoryBufferType::IO_SURFACE_BUFFER;
176 response.gpu_memory_buffer_handle.mach_port.reset(
177 IOSurfaceCreateMachPort(io_surface_image->io_surface()));
175 } 178 }
176 response.in_use = in_use;
177 params.in_use_responses.push_back(std::move(response)); 179 params.in_use_responses.push_back(std::move(response));
178 } 180 }
179 ca_layer_in_use_queries_.clear(); 181 ca_layer_in_use_queries_.clear();
180 182
181 stub_->SendSwapBuffersCompleted(params); 183 stub_->SendSwapBuffersCompleted(params);
182 } 184 }
183 185
184 gfx::SwapResult ImageTransportSurfaceOverlayMac::SwapBuffersInternal( 186 gfx::SwapResult ImageTransportSurfaceOverlayMac::SwapBuffersInternal(
185 const gfx::Rect& pixel_damage_rect) { 187 const gfx::Rect& pixel_damage_rect) {
186 TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::SwapBuffersInternal"); 188 TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::SwapBuffersInternal");
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; 394 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask;
393 395
394 // Post a task holding a reference to the new GL context. The reason for 396 // Post a task holding a reference to the new GL context. The reason for
395 // this is to avoid creating-then-destroying the context for every image 397 // this is to avoid creating-then-destroying the context for every image
396 // transport surface that is observing the GPU switch. 398 // transport surface that is observing the GPU switch.
397 base::ThreadTaskRunnerHandle::Get()->PostTask( 399 base::ThreadTaskRunnerHandle::Get()->PostTask(
398 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); 400 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu));
399 } 401 }
400 402
401 } // namespace gpu 403 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/common/gpu_command_buffer_traits.cc ('k') | ui/gfx/gpu_memory_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698