summaryrefslogtreecommitdiffstats
path: root/ui/surface/accelerated_surface_win.cc
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-07 08:24:51 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-07 08:24:51 +0000
commit7929b6c273b2cd5e1d4158c8bad301cb58312ac1 (patch)
treeae8c692404dcf8da28034321774409fe30c96d0c /ui/surface/accelerated_surface_win.cc
parentf9307cc1f95bbc9c65252abb79900e1dff4da07e (diff)
downloadchromium_src-7929b6c273b2cd5e1d4158c8bad301cb58312ac1.zip
chromium_src-7929b6c273b2cd5e1d4158c8bad301cb58312ac1.tar.gz
chromium_src-7929b6c273b2cd5e1d4158c8bad301cb58312ac1.tar.bz2
accelerated_surface_transformer_win: Improve readback and scaling performance
by caching temporary surfaces. This greatly improves the performance of tab capture on current-model Core i3 and Core i5 systems with Intel HD 3000/4000 graphics, and the default drivers under Win8. On these target systems as much as 15ms was spent in the ~ScopedComPtr dtor, freeing the temporary surfaces. Patch is intended to be as low-risk as possible while fixing the performance, since most of this code will go away soon when we do not care about non-Aura Windows. BUG=235502 TEST=surface_gpu_tests Review URL: https://chromiumcodereview.appspot.com/14763006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198670 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/surface/accelerated_surface_win.cc')
-rw-r--r--ui/surface/accelerated_surface_win.cc22
1 files changed, 8 insertions, 14 deletions
diff --git a/ui/surface/accelerated_surface_win.cc b/ui/surface/accelerated_surface_win.cc
index 1223616..03d4880 100644
--- a/ui/surface/accelerated_surface_win.cc
+++ b/ui/surface/accelerated_surface_win.cc
@@ -456,10 +456,9 @@ bool AcceleratedPresenter::DoCopyToARGB(const gfx::Rect& requested_src_subrect,
src_subrect.Intersect(gfx::Rect(back_buffer_size));
base::win::ScopedComPtr<IDirect3DSurface9> final_surface;
{
- TRACE_EVENT0("gpu", "CreateTemporaryLockableSurface");
- if (!d3d_utils::CreateTemporaryLockableSurface(present_thread_->device(),
- dst_size,
- final_surface.Receive())) {
+ if (!d3d_utils::CreateOrReuseLockableSurface(present_thread_->device(),
+ dst_size,
+ &final_surface)) {
LOG(ERROR) << "Failed to create temporary lockable surface";
return false;
}
@@ -527,17 +526,12 @@ bool AcceleratedPresenter::DoCopyToYUV(
gfx::Rect src_subrect = requested_src_subrect;
src_subrect.Intersect(gfx::Rect(back_buffer_size));
- base::win::ScopedComPtr<IDirect3DTexture9> resized_as_texture;
base::win::ScopedComPtr<IDirect3DSurface9> resized;
- {
- TRACE_EVENT0("gpu", "CreateTemporaryRenderTargetTexture");
- if (!d3d_utils::CreateTemporaryRenderTargetTexture(
- present_thread_->device(),
- dst_size,
- resized_as_texture.Receive(),
- resized.Receive())) {
- return false;
- }
+ base::win::ScopedComPtr<IDirect3DTexture9> resized_as_texture;
+ if (!gpu_ops->GetIntermediateTexture(dst_size,
+ resized_as_texture.Receive(),
+ resized.Receive())) {
+ return false;
}
// Shrink the source to fit entirely in the destination while preserving