diff options
author | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-29 03:08:24 +0000 |
---|---|---|
committer | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-29 03:08:24 +0000 |
commit | 272279c609dd750e5e84ebe0bac21f1e877e49c2 (patch) | |
tree | 4eaeae1014eb283592148aaa2b5b9aad4167ea4e /cc | |
parent | aa2c776abb09337ae2111e5123dfe81b8023543c (diff) | |
download | chromium_src-272279c609dd750e5e84ebe0bac21f1e877e49c2.zip chromium_src-272279c609dd750e5e84ebe0bac21f1e877e49c2.tar.gz chromium_src-272279c609dd750e5e84ebe0bac21f1e877e49c2.tar.bz2 |
cc: Remove legacy accelerated painting path
R=nduca@chromium.org
BUG=none
Review URL: https://chromiumcodereview.appspot.com/16069004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202761 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/layers/content_layer.cc | 10 | ||||
-rw-r--r-- | cc/output/delegating_renderer.cc | 10 | ||||
-rw-r--r-- | cc/output/gl_renderer.cc | 7 | ||||
-rw-r--r-- | cc/resources/resource_update.cc | 21 | ||||
-rw-r--r-- | cc/resources/resource_update.h | 7 | ||||
-rw-r--r-- | cc/resources/resource_update_controller.cc | 103 | ||||
-rw-r--r-- | cc/resources/skpicture_content_layer_updater.cc | 46 | ||||
-rw-r--r-- | cc/resources/skpicture_content_layer_updater.h | 30 | ||||
-rw-r--r-- | cc/trees/layer_tree_host.cc | 6 | ||||
-rw-r--r-- | cc/trees/layer_tree_host.h | 3 | ||||
-rw-r--r-- | cc/trees/layer_tree_settings.cc | 3 | ||||
-rw-r--r-- | cc/trees/layer_tree_settings.h | 1 |
12 files changed, 18 insertions, 229 deletions
diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc index 9269f7c..9bdbc53 100644 --- a/cc/layers/content_layer.cc +++ b/cc/layers/content_layer.cc @@ -95,21 +95,17 @@ void ContentLayer::CreateUpdaterIfNeeded() { return; scoped_ptr<LayerPainter> painter = ContentLayerPainter::Create(client_).PassAs<LayerPainter>(); - if (layer_tree_host()->settings().accelerate_painting) - updater_ = SkPictureContentLayerUpdater::Create( - painter.Pass(), - rendering_stats_instrumentation(), - id()); - else if (layer_tree_host()->settings().per_tile_painting_enabled) + if (layer_tree_host()->settings().per_tile_painting_enabled) { updater_ = BitmapSkPictureContentLayerUpdater::Create( painter.Pass(), rendering_stats_instrumentation(), id()); - else + } else { updater_ = BitmapContentLayerUpdater::Create( painter.Pass(), rendering_stats_instrumentation(), id()); + } updater_->SetOpaque(contents_opaque()); unsigned texture_format = diff --git a/cc/output/delegating_renderer.cc b/cc/output/delegating_renderer.cc index 76093c4..3b5839e 100644 --- a/cc/output/delegating_renderer.cc +++ b/cc/output/delegating_renderer.cc @@ -80,16 +80,13 @@ bool DelegatingRenderer::Initialize() { // TODO(danakj): We need non-GPU-specific paths for these things. This // renderer shouldn't need to use context3d extensions directly. - bool has_read_bgra = false; bool has_set_visibility = false; bool has_io_surface = false; bool has_arb_texture_rect = false; bool has_egl_image = false; bool has_map_image = false; for (size_t i = 0; i < extensions.size(); ++i) { - if (extensions[i] == "GL_EXT_read_format_bgra") { - has_read_bgra = true; - } else if (extensions[i] == "GL_CHROMIUM_set_visibility") { + if (extensions[i] == "GL_CHROMIUM_set_visibility") { has_set_visibility = true; } else if (extensions[i] == "GL_CHROMIUM_iosurface") { has_io_surface = true; @@ -105,11 +102,6 @@ bool DelegatingRenderer::Initialize() { if (has_io_surface) DCHECK(has_arb_texture_rect); - capabilities_.using_accelerated_painting = - Settings().accelerate_painting && - capabilities_.best_texture_format == GL_BGRA_EXT && - has_read_bgra; - // TODO(piman): loop visibility to GPU process? capabilities_.using_set_visibility = has_set_visibility; diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index da2f4f6..7d37920 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -155,13 +155,6 @@ bool GLRenderer::Initialize() { std::set<std::string> extensions(extensions_list.begin(), extensions_list.end()); - if (Settings().accelerate_painting && - extensions.count("GL_EXT_texture_format_BGRA8888") && - extensions.count("GL_EXT_read_format_bgra")) - capabilities_.using_accelerated_painting = true; - else - capabilities_.using_accelerated_painting = false; - capabilities_.using_partial_swap = Settings().partial_swap_enabled && extensions.count("GL_CHROMIUM_post_sub_buffer"); diff --git a/cc/resources/resource_update.cc b/cc/resources/resource_update.cc index 1e44f50..5760ddf 100644 --- a/cc/resources/resource_update.cc +++ b/cc/resources/resource_update.cc @@ -5,7 +5,8 @@ #include "cc/resources/resource_update.h" #include "base/logging.h" -#include "skia/ext/platform_canvas.h" +#include "third_party/skia/include/core/SkCanvas.h" +#include "third_party/skia/include/core/SkDevice.h" namespace cc { @@ -41,25 +42,9 @@ ResourceUpdate ResourceUpdate::CreateFromCanvas( return update; } -ResourceUpdate ResourceUpdate::CreateFromPicture(PrioritizedResource* texture, - SkPicture* picture, - gfx::Rect content_rect, - gfx::Rect source_rect, - gfx::Vector2d dest_offset) { - CHECK(content_rect.Contains(source_rect)); - ResourceUpdate update; - update.texture = texture; - update.picture = picture; - update.content_rect = content_rect; - update.source_rect = source_rect; - update.dest_offset = dest_offset; - return update; -} - ResourceUpdate::ResourceUpdate() : texture(NULL), - bitmap(NULL), - picture(NULL) {} + bitmap(NULL) {} ResourceUpdate::~ResourceUpdate() {} diff --git a/cc/resources/resource_update.h b/cc/resources/resource_update.h index 6484da2..47bef7da 100644 --- a/cc/resources/resource_update.h +++ b/cc/resources/resource_update.h @@ -12,7 +12,6 @@ #include "ui/gfx/vector2d.h" class SkBitmap; -class SkPicture; class SkCanvas; namespace cc { @@ -30,18 +29,12 @@ struct CC_EXPORT ResourceUpdate { gfx::Rect content_rect, gfx::Rect source_rect, gfx::Vector2d dest_offset); - static ResourceUpdate CreateFromPicture(PrioritizedResource* resource, - SkPicture* bitmap, - gfx::Rect content_rect, - gfx::Rect source_rect, - gfx::Vector2d dest_offset); ResourceUpdate(); virtual ~ResourceUpdate(); PrioritizedResource* texture; const SkBitmap* bitmap; - SkPicture* picture; skia::RefPtr<SkCanvas> canvas; gfx::Rect content_rect; gfx::Rect source_rect; diff --git a/cc/resources/resource_update_controller.cc b/cc/resources/resource_update_controller.cc index 5e0a26c..350b4d6 100644 --- a/cc/resources/resource_update_controller.cc +++ b/cc/resources/resource_update_controller.cc @@ -4,20 +4,11 @@ #include "cc/resources/resource_update_controller.h" -#include <limits> - -#include "base/debug/trace_event.h" +#include "base/bind.h" #include "cc/base/thread.h" -#include "cc/output/context_provider.h" #include "cc/output/texture_copier.h" #include "cc/resources/prioritized_resource.h" #include "cc/resources/resource_provider.h" -#include "skia/ext/refptr.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h" -#include "third_party/khronos/GLES2/gl2.h" -#include "third_party/skia/include/gpu/SkGpuDevice.h" - -using WebKit::WebGraphicsContext3D; namespace { @@ -33,21 +24,6 @@ const double kUploaderBusyTickRate = 0.001; // Number of blocking update intervals to allow. const size_t kMaxBlockingUpdateIntervals = 4; -skia::RefPtr<SkCanvas> CreateAcceleratedCanvas( - GrContext* gr_context, gfx::Size canvas_size, unsigned texture_id) { - GrBackendTextureDesc texture_desc; - texture_desc.fFlags = kRenderTarget_GrBackendTextureFlag; - texture_desc.fWidth = canvas_size.width(); - texture_desc.fHeight = canvas_size.height(); - texture_desc.fConfig = kSkia8888_GrPixelConfig; - texture_desc.fTextureHandle = texture_id; - skia::RefPtr<GrTexture> target = - skia::AdoptRef(gr_context->wrapBackendTexture(texture_desc)); - skia::RefPtr<SkDevice> device = - skia::AdoptRef(new SkGpuDevice(gr_context, target.get())); - return skia::AdoptRef(new SkCanvas(device.get())); -} - } // namespace namespace cc { @@ -111,75 +87,14 @@ void ResourceUpdateController::DiscardUploadsToEvictedResources() { } void ResourceUpdateController::UpdateTexture(ResourceUpdate update) { - if (update.picture) { - PrioritizedResource* texture = update.texture; - gfx::Rect picture_rect = update.content_rect; - gfx::Rect source_rect = update.source_rect; - gfx::Vector2d dest_offset = update.dest_offset; - - texture->AcquireBackingTexture(resource_provider_); - DCHECK(texture->have_backing_texture()); - - DCHECK_EQ(resource_provider_->GetResourceType(texture->resource_id()), - ResourceProvider::GLTexture); - - cc::ContextProvider* offscreen_contexts = - resource_provider_->offscreen_context_provider(); - - ResourceProvider::ScopedWriteLockGL lock( - resource_provider_, texture->resource_id()); - - // Flush the compositor context to ensure that textures there are available - // in the shared context. Do this after locking/creating the compositor - // texture. - resource_provider_->Flush(); - - // Make sure skia uses the correct GL context. - offscreen_contexts->Context3d()->makeContextCurrent(); - - // Create an accelerated canvas to draw on. - skia::RefPtr<SkCanvas> canvas = CreateAcceleratedCanvas( - offscreen_contexts->GrContext(), texture->size(), lock.texture_id()); - - // The compositor expects the textures to be upside-down so it can flip - // the final composited image. Ganesh renders the image upright so we - // need to do a y-flip. - canvas->translate(0.0, texture->size().height()); - canvas->scale(1.0, -1.0); - // Clip to the destination on the texture that must be updated. - canvas->clipRect(SkRect::MakeXYWH(dest_offset.x(), - dest_offset.y(), - source_rect.width(), - source_rect.height())); - // Translate the origin of picture_rect to dest_offset. - // Note that dest_offset is defined relative to source_rect. - canvas->translate( - picture_rect.x() - source_rect.x() + dest_offset.x(), - picture_rect.y() - source_rect.y() + dest_offset.y()); - canvas->drawPicture(*update.picture); - - // Flush skia context so that all the rendered stuff appears on the - // texture. - offscreen_contexts->GrContext()->flush(); - - // Flush the GL context so rendering results from this context are - // visible in the compositor's context. - offscreen_contexts->Context3d()->flush(); - - // Use the compositor's GL context again. - resource_provider_->GraphicsContext3D()->makeContextCurrent(); - } - - if (update.bitmap) { - update.bitmap->lockPixels(); - update.texture->SetPixels( - resource_provider_, - static_cast<const uint8_t*>(update.bitmap->getPixels()), - update.content_rect, - update.source_rect, - update.dest_offset); - update.bitmap->unlockPixels(); - } + update.bitmap->lockPixels(); + update.texture->SetPixels( + resource_provider_, + static_cast<const uint8_t*>(update.bitmap->getPixels()), + update.content_rect, + update.source_rect, + update.dest_offset); + update.bitmap->unlockPixels(); } void ResourceUpdateController::Finalize() { diff --git a/cc/resources/skpicture_content_layer_updater.cc b/cc/resources/skpicture_content_layer_updater.cc index bfa6d56..3db8726 100644 --- a/cc/resources/skpicture_content_layer_updater.cc +++ b/cc/resources/skpicture_content_layer_updater.cc @@ -13,22 +13,6 @@ namespace cc { -SkPictureContentLayerUpdater::Resource::Resource( - SkPictureContentLayerUpdater* updater, - scoped_ptr<PrioritizedResource> texture) - : LayerUpdater::Resource(texture.Pass()), updater_(updater) {} - -SkPictureContentLayerUpdater::Resource::~Resource() {} - -void SkPictureContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, - gfx::Rect source_rect, - gfx::Vector2d dest_offset, - bool partial_update, - RenderingStats*) { - updater_->UpdateTexture( - queue, texture(), source_rect, dest_offset, partial_update); -} - SkPictureContentLayerUpdater::SkPictureContentLayerUpdater( scoped_ptr<LayerPainter> painter, RenderingStatsInstrumentation* stats_instrumentation, @@ -38,23 +22,6 @@ SkPictureContentLayerUpdater::SkPictureContentLayerUpdater( SkPictureContentLayerUpdater::~SkPictureContentLayerUpdater() {} -scoped_refptr<SkPictureContentLayerUpdater> -SkPictureContentLayerUpdater::Create( - scoped_ptr<LayerPainter> painter, - RenderingStatsInstrumentation* stats_instrumentation, - int layer_id) { - return make_scoped_refptr( - new SkPictureContentLayerUpdater(painter.Pass(), - stats_instrumentation, - layer_id)); -} - -scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::CreateResource( - PrioritizedResourceManager* manager) { - return scoped_ptr<LayerUpdater::Resource>( - new Resource(this, PrioritizedResource::Create(manager))); -} - void SkPictureContentLayerUpdater::PrepareToUpdate( gfx::Rect content_rect, gfx::Size, @@ -87,19 +54,6 @@ void SkPictureContentLayerUpdater::DrawPicture(SkCanvas* canvas) { canvas->drawPicture(picture_); } -void SkPictureContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue, - PrioritizedResource* texture, - gfx::Rect source_rect, - gfx::Vector2d dest_offset, - bool partial_update) { - ResourceUpdate upload = ResourceUpdate::CreateFromPicture( - texture, &picture_, content_rect(), source_rect, dest_offset); - if (partial_update) - queue->AppendPartialUpload(upload); - else - queue->AppendFullUpload(upload); -} - void SkPictureContentLayerUpdater::SetOpaque(bool opaque) { layer_is_opaque_ = opaque; } diff --git a/cc/resources/skpicture_content_layer_updater.h b/cc/resources/skpicture_content_layer_updater.h index a835744..e5df995 100644 --- a/cc/resources/skpicture_content_layer_updater.h +++ b/cc/resources/skpicture_content_layer_updater.h @@ -21,31 +21,6 @@ class LayerPainter; // implementations. class SkPictureContentLayerUpdater : public ContentLayerUpdater { public: - class Resource : public LayerUpdater::Resource { - public: - Resource(SkPictureContentLayerUpdater* updater, - scoped_ptr<PrioritizedResource> texture); - virtual ~Resource(); - - virtual void Update(ResourceUpdateQueue* queue, - gfx::Rect source_rect, - gfx::Vector2d dest_offset, - bool partial_update, - RenderingStats* stats) OVERRIDE; - - private: - SkPictureContentLayerUpdater* updater_; - - DISALLOW_COPY_AND_ASSIGN(Resource); - }; - - static scoped_refptr<SkPictureContentLayerUpdater> Create( - scoped_ptr<LayerPainter> painter, - RenderingStatsInstrumentation* stats_instrumentation, - int layer_id); - - virtual scoped_ptr<LayerUpdater::Resource> CreateResource( - PrioritizedResourceManager* manager) OVERRIDE; virtual void SetOpaque(bool opaque) OVERRIDE; protected: @@ -62,11 +37,6 @@ class SkPictureContentLayerUpdater : public ContentLayerUpdater { gfx::Rect* resulting_opaque_rect, RenderingStats* stats) OVERRIDE; void DrawPicture(SkCanvas* canvas); - void UpdateTexture(ResourceUpdateQueue* queue, - PrioritizedResource* texture, - gfx::Rect source_rect, - gfx::Vector2d dest_offset, - bool partial_update); bool layer_is_opaque() const { return layer_is_opaque_; } diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index b8b02be..6b7d772 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -47,7 +47,6 @@ namespace cc { RendererCapabilities::RendererCapabilities() : best_texture_format(0), using_partial_swap(false), - using_accelerated_painting(false), using_set_visibility(false), using_swap_complete_callback(false), using_gpu_memory_manager(false), @@ -169,11 +168,6 @@ LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) { if (success) { output_surface_lost_ = false; - // Update settings_ based on capabilities that we got back from the - // renderer. - settings_.accelerate_painting = - proxy_->GetRendererCapabilities().using_accelerated_painting; - // Update settings_ based on partial update capability. size_t max_partial_texture_updates = 0; if (proxy_->GetRendererCapabilities().allow_partial_texture_updates && diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index d0f6801..e5dd380 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h @@ -73,7 +73,6 @@ struct CC_EXPORT RendererCapabilities { unsigned best_texture_format; bool using_partial_swap; - bool using_accelerated_painting; bool using_set_visibility; bool using_swap_complete_callback; bool using_gpu_memory_manager; @@ -99,7 +98,7 @@ class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { void set_needs_filter_context() { needs_filter_context_ = true; } bool needs_offscreen_context() const { - return needs_filter_context_ || settings_.accelerate_painting; + return needs_filter_context_; } // LayerTreeHost interface to Proxy. diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc index 4f30587..a68e7e1 100644 --- a/cc/trees/layer_tree_settings.cc +++ b/cc/trees/layer_tree_settings.cc @@ -13,8 +13,7 @@ namespace cc { LayerTreeSettings::LayerTreeSettings() - : accelerate_painting(false), - compositor_frame_message(false), + : compositor_frame_message(false), impl_side_painting(false), throttle_frame_production(true), render_parent_drives_begin_frame_(false), diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h index 0c92a9d..7229055 100644 --- a/cc/trees/layer_tree_settings.h +++ b/cc/trees/layer_tree_settings.h @@ -18,7 +18,6 @@ class CC_EXPORT LayerTreeSettings { LayerTreeSettings(); ~LayerTreeSettings(); - bool accelerate_painting; bool compositor_frame_message; bool impl_side_painting; bool throttle_frame_production; |