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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 17350003: gpu: Add more context labelling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@GPU_add_context_names
Patch Set: Rebase. Created 7 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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/debug/trace_event.h" 13 #include "base/debug/trace_event.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/strings/string_split.h" 15 #include "base/strings/string_split.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "cc/base/math_util.h" 19 #include "cc/base/math_util.h"
19 #include "cc/layers/video_layer_impl.h" 20 #include "cc/layers/video_layer_impl.h"
20 #include "cc/output/compositor_frame.h" 21 #include "cc/output/compositor_frame.h"
21 #include "cc/output/compositor_frame_metadata.h" 22 #include "cc/output/compositor_frame_metadata.h"
22 #include "cc/output/context_provider.h" 23 #include "cc/output/context_provider.h"
23 #include "cc/output/copy_output_request.h" 24 #include "cc/output/copy_output_request.h"
24 #include "cc/output/copy_output_result.h" 25 #include "cc/output/copy_output_result.h"
25 #include "cc/output/geometry_binding.h" 26 #include "cc/output/geometry_binding.h"
26 #include "cc/output/gl_frame_data.h" 27 #include "cc/output/gl_frame_data.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)), 132 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)),
132 context_(output_surface->context3d()), 133 context_(output_surface->context3d()),
133 is_backbuffer_discarded_(false), 134 is_backbuffer_discarded_(false),
134 discard_backbuffer_when_not_visible_(false), 135 discard_backbuffer_when_not_visible_(false),
135 is_using_bind_uniform_(false), 136 is_using_bind_uniform_(false),
136 visible_(true), 137 visible_(true),
137 is_scissor_enabled_(false), 138 is_scissor_enabled_(false),
138 highp_threshold_min_(highp_threshold_min), 139 highp_threshold_min_(highp_threshold_min),
139 highp_threshold_cache_(0), 140 highp_threshold_cache_(0),
140 on_demand_tile_raster_resource_id_(0), 141 on_demand_tile_raster_resource_id_(0),
141 weak_factory_(this) { 142 weak_factory_(this),
143 offscreen_context_labelled_(false) {
142 DCHECK(context_); 144 DCHECK(context_);
143 } 145 }
144 146
145 bool GLRenderer::Initialize() { 147 bool GLRenderer::Initialize() {
146 if (!context_->makeContextCurrent()) 148 if (!context_->makeContextCurrent())
147 return false; 149 return false;
148 150
149 context_->pushGroupMarkerEXT(Settings().compositor_name.c_str()); 151 std::string unique_context_name = base::StringPrintf(
152 "%s-%p",
153 Settings().compositor_name.c_str(),
154 context_);
155 context_->pushGroupMarkerEXT(unique_context_name.c_str());
150 156
151 std::string extensions_string = 157 std::string extensions_string =
152 UTF16ToASCII(context_->getString(GL_EXTENSIONS)); 158 UTF16ToASCII(context_->getString(GL_EXTENSIONS));
153 std::vector<std::string> extensions_list; 159 std::vector<std::string> extensions_list;
154 base::SplitString(extensions_string, ' ', &extensions_list); 160 base::SplitString(extensions_string, ' ', &extensions_list);
155 std::set<std::string> extensions(extensions_list.begin(), 161 std::set<std::string> extensions(extensions_list.begin(),
156 extensions_list.end()); 162 extensions_list.end());
157 163
158 capabilities_.using_partial_swap = 164 capabilities_.using_partial_swap =
159 Settings().partial_swap_enabled && 165 Settings().partial_swap_enabled &&
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 source_texture_resource->id()); 461 source_texture_resource->id());
456 462
457 // Flush the compositor context to ensure that textures there are available 463 // Flush the compositor context to ensure that textures there are available
458 // in the shared context. Do this after locking/creating the compositor 464 // in the shared context. Do this after locking/creating the compositor
459 // texture. 465 // texture.
460 renderer->resource_provider()->Flush(); 466 renderer->resource_provider()->Flush();
461 467
462 // Make sure skia uses the correct GL context. 468 // Make sure skia uses the correct GL context.
463 offscreen_contexts->Context3d()->makeContextCurrent(); 469 offscreen_contexts->Context3d()->makeContextCurrent();
464 470
471 // Lazily label this context.
472 renderer->LazyLabelOffscreenContext();
473
465 SkBitmap source = 474 SkBitmap source =
466 RenderSurfaceFilters::Apply(filters, 475 RenderSurfaceFilters::Apply(filters,
467 lock.texture_id(), 476 lock.texture_id(),
468 source_texture_resource->size(), 477 source_texture_resource->size(),
469 offscreen_contexts->GrContext()); 478 offscreen_contexts->GrContext());
470 479
471 // Flush skia context so that all the rendered stuff appears on the 480 // Flush skia context so that all the rendered stuff appears on the
472 // texture. 481 // texture.
473 offscreen_contexts->GrContext()->flush(); 482 offscreen_contexts->GrContext()->flush();
474 483
(...skipping 21 matching lines...) Expand all
496 source_texture_resource->id()); 505 source_texture_resource->id());
497 506
498 // Flush the compositor context to ensure that textures there are available 507 // Flush the compositor context to ensure that textures there are available
499 // in the shared context. Do this after locking/creating the compositor 508 // in the shared context. Do this after locking/creating the compositor
500 // texture. 509 // texture.
501 renderer->resource_provider()->Flush(); 510 renderer->resource_provider()->Flush();
502 511
503 // Make sure skia uses the correct GL context. 512 // Make sure skia uses the correct GL context.
504 offscreen_contexts->Context3d()->makeContextCurrent(); 513 offscreen_contexts->Context3d()->makeContextCurrent();
505 514
515 // Lazily label this context.
516 renderer->LazyLabelOffscreenContext();
517
506 // Wrap the source texture in a Ganesh platform texture. 518 // Wrap the source texture in a Ganesh platform texture.
507 GrBackendTextureDesc backend_texture_description; 519 GrBackendTextureDesc backend_texture_description;
508 backend_texture_description.fWidth = source_texture_resource->size().width(); 520 backend_texture_description.fWidth = source_texture_resource->size().width();
509 backend_texture_description.fHeight = 521 backend_texture_description.fHeight =
510 source_texture_resource->size().height(); 522 source_texture_resource->size().height();
511 backend_texture_description.fConfig = kSkia8888_GrPixelConfig; 523 backend_texture_description.fConfig = kSkia8888_GrPixelConfig;
512 backend_texture_description.fTextureHandle = lock.texture_id(); 524 backend_texture_description.fTextureHandle = lock.texture_id();
513 backend_texture_description.fOrigin = kBottomLeft_GrSurfaceOrigin; 525 backend_texture_description.fOrigin = kBottomLeft_GrSurfaceOrigin;
514 skia::RefPtr<GrTexture> texture = 526 skia::RefPtr<GrTexture> texture =
515 skia::AdoptRef(offscreen_contexts->GrContext()->wrapBackendTexture( 527 skia::AdoptRef(offscreen_contexts->GrContext()->wrapBackendTexture(
(...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after
3028 bool GLRenderer::CanUseSkiaGPUBackend() const { 3040 bool GLRenderer::CanUseSkiaGPUBackend() const {
3029 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas 3041 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas
3030 // implementation. 3042 // implementation.
3031 return gr_context_ && context_->getContextAttributes().stencil; 3043 return gr_context_ && context_->getContextAttributes().stencil;
3032 } 3044 }
3033 3045
3034 bool GLRenderer::IsContextLost() { 3046 bool GLRenderer::IsContextLost() {
3035 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); 3047 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR);
3036 } 3048 }
3037 3049
3050 void GLRenderer::LazyLabelOffscreenContext() {
3051 if (!offscreen_context_labelled_) {
danakj 2013/06/25 15:02:19 nit: if (labelled) return;
3052 offscreen_context_labelled_ = true;
3053 std::string unique_context_name = base::StringPrintf(
3054 "%s-Offscreen-%p",
3055 Settings().compositor_name.c_str(),
3056 context_);
3057 resource_provider()->offscreen_context_provider()->Context3d()->
3058 pushGroupMarkerEXT(unique_context_name.c_str());
3059 }
3060 }
3061
3062
3038 } // namespace cc 3063 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.h ('k') | content/browser/renderer_host/image_transport_factory_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698