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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 13746002: Force GPU switch with CGLSetVirtualScreen only for compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only transition compositor contexts Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
11 #include <map> 11 #include <map>
12 #include <stack> 12 #include <stack>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/at_exit.h" 16 #include "base/at_exit.h"
17 #include "base/atomicops.h" 17 #include "base/atomicops.h"
18 #include "base/bind.h" 18 #include "base/bind.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
20 #include "base/debug/trace_event.h" 20 #include "base/debug/trace_event.h"
21 #if defined(OS_MACOSX)
22 #include "base/mac/scoped_cftyperef.h"
23 #endif
24 #include "base/memory/scoped_ptr.h" 21 #include "base/memory/scoped_ptr.h"
25 #include "base/string_number_conversions.h" 22 #include "base/string_number_conversions.h"
26 #include "base/stringprintf.h" 23 #include "base/stringprintf.h"
27 #include "build/build_config.h" 24 #include "build/build_config.h"
28 #define GLES2_GPU_SERVICE 1 25 #define GLES2_GPU_SERVICE 1
29 #include "gpu/command_buffer/common/gles2_cmd_format.h" 26 #include "gpu/command_buffer/common/gles2_cmd_format.h"
30 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 27 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
31 #include "gpu/command_buffer/common/debug_marker_manager.h" 28 #include "gpu/command_buffer/common/debug_marker_manager.h"
32 #include "gpu/command_buffer/common/id_allocator.h" 29 #include "gpu/command_buffer/common/id_allocator.h"
33 #include "gpu/command_buffer/service/buffer_manager.h" 30 #include "gpu/command_buffer/service/buffer_manager.h"
(...skipping 20 matching lines...) Expand all
54 #include "gpu/command_buffer/service/stream_texture_manager.h" 51 #include "gpu/command_buffer/service/stream_texture_manager.h"
55 #include "gpu/command_buffer/service/texture_definition.h" 52 #include "gpu/command_buffer/service/texture_definition.h"
56 #include "gpu/command_buffer/service/texture_manager.h" 53 #include "gpu/command_buffer/service/texture_manager.h"
57 #include "gpu/command_buffer/service/vertex_attrib_manager.h" 54 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
58 #include "gpu/command_buffer/service/vertex_array_manager.h" 55 #include "gpu/command_buffer/service/vertex_array_manager.h"
59 #include "ui/gl/async_pixel_transfer_delegate.h" 56 #include "ui/gl/async_pixel_transfer_delegate.h"
60 #include "ui/gl/gl_bindings.h" 57 #include "ui/gl/gl_bindings.h"
61 #include "ui/gl/gl_image.h" 58 #include "ui/gl/gl_image.h"
62 #include "ui/gl/gl_implementation.h" 59 #include "ui/gl/gl_implementation.h"
63 #include "ui/gl/gl_surface.h" 60 #include "ui/gl/gl_surface.h"
61
64 #if defined(OS_MACOSX) 62 #if defined(OS_MACOSX)
63 #include "base/mac/scoped_cftyperef.h"
Ken Russell (switch to Gerrit) 2013/04/09 00:48:58 This change is not necessary for this CL; please u
ccameron 2013/04/09 17:28:55 Done.
65 #include "ui/surface/io_surface_support_mac.h" 64 #include "ui/surface/io_surface_support_mac.h"
66 #endif 65 #endif
67 66
68 // TODO(zmo): we can't include "City.h" due to type def conflicts. 67 // TODO(zmo): we can't include "City.h" due to type def conflicts.
69 extern uint64 CityHash64(const char*, size_t); 68 extern uint64 CityHash64(const char*, size_t);
70 69
71 namespace gpu { 70 namespace gpu {
72 namespace gles2 { 71 namespace gles2 {
73 72
74 namespace { 73 namespace {
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 2565
2567 DoBindBuffer(GL_ARRAY_BUFFER, 0); 2566 DoBindBuffer(GL_ARRAY_BUFFER, 0);
2568 DoBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); 2567 DoBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
2569 DoBindFramebuffer(GL_FRAMEBUFFER, 0); 2568 DoBindFramebuffer(GL_FRAMEBUFFER, 0);
2570 DoBindRenderbuffer(GL_RENDERBUFFER, 0); 2569 DoBindRenderbuffer(GL_RENDERBUFFER, 0);
2571 2570
2572 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { 2571 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) {
2573 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); 2572 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT);
2574 } 2573 }
2575 2574
2575 // Only compositor contexts are known to use only the subset of GL
2576 // that can be safely migrated between the iGPU and the dGPU. Mark
2577 // those contexts as safe to forcibly transition between the GPUs.
2578 // http://crbug.com/180876, http://crbug.com/227228
2579 if (!offscreen)
2580 context_->SetSafeToForceGpuSwitch();
Ken Russell (switch to Gerrit) 2013/04/09 00:48:58 Does this work when virtual contexts are being use
ccameron 2013/04/09 17:28:55 Good point -- I added support for virtual contexts
Ken Russell (switch to Gerrit) 2013/04/09 17:42:03 A TODO is needed. It is clear that if we virtualiz
2581
2576 // Create a delegate to perform async pixel transfers. 2582 // Create a delegate to perform async pixel transfers.
2577 async_pixel_transfer_delegate_ = 2583 async_pixel_transfer_delegate_ =
2578 gfx::AsyncPixelTransferDelegate::Create(context.get()); 2584 gfx::AsyncPixelTransferDelegate::Create(context.get());
2579 2585
2580 return true; 2586 return true;
2581 } 2587 }
2582 2588
2583 void GLES2DecoderImpl::UpdateCapabilities() { 2589 void GLES2DecoderImpl::UpdateCapabilities() {
2584 util_.set_num_compressed_texture_formats( 2590 util_.set_num_compressed_texture_formats(
2585 validators_->compressed_texture_format.GetValues().size()); 2591 validators_->compressed_texture_format.GetValues().size());
(...skipping 7939 matching lines...) Expand 10 before | Expand all | Expand 10 after
10525 return error::kNoError; 10531 return error::kNoError;
10526 } 10532 }
10527 10533
10528 // Include the auto-generated part of this file. We split this because it means 10534 // Include the auto-generated part of this file. We split this because it means
10529 // we can easily edit the non-auto generated parts right here in this file 10535 // we can easily edit the non-auto generated parts right here in this file
10530 // instead of having to edit some template or the code generator. 10536 // instead of having to edit some template or the code generator.
10531 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10537 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10532 10538
10533 } // namespace gles2 10539 } // namespace gles2
10534 } // namespace gpu 10540 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698