diff options
author | siva.gunturi@samsung.com <siva.gunturi@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-20 10:55:08 +0000 |
---|---|---|
committer | siva.gunturi@samsung.com <siva.gunturi@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-20 10:55:08 +0000 |
commit | 739f56c7bf03a4676733dbaa784f2c50034f1549 (patch) | |
tree | 788a7ff46940d9f8db8d3280e043e6d0a443239a /content/browser | |
parent | 1f172cbb1bfa19f1f2acaf976f59202289f3edc8 (diff) | |
download | chromium_src-739f56c7bf03a4676733dbaa784f2c50034f1549.zip chromium_src-739f56c7bf03a4676733dbaa784f2c50034f1549.tar.gz chromium_src-739f56c7bf03a4676733dbaa784f2c50034f1549.tar.bz2 |
content_gl_tests were failing because, we are checking for rgb565 platform support
on hardware and failing intentionally, which was not correct, the test should be skiped instead. This patch takes care of that along with the base patch.
On Aura with Nvidiea drivers the support is not there, so the test fails previously now weare skipping it by displaying the reason.
Android the support gets passed.
BUG=323150
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=245772
Review URL: https://codereview.chromium.org/133363004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245896 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
16 files changed, 76 insertions, 23 deletions
diff --git a/content/browser/devtools/renderer_overrides_handler.cc b/content/browser/devtools/renderer_overrides_handler.cc index f8d0211..8dfe5bc 100644 --- a/content/browser/devtools/renderer_overrides_handler.cc +++ b/content/browser/devtools/renderer_overrides_handler.cc @@ -204,7 +204,8 @@ void RendererOverridesHandler::InnerSwapCompositorFrame() { base::Bind(&RendererOverridesHandler::ScreenshotCaptured, weak_factory_.GetWeakPtr(), scoped_refptr<DevToolsProtocol::Command>(), format, quality, - last_compositor_frame_metadata_)); + last_compositor_frame_metadata_), + false); } void RendererOverridesHandler::ParseCaptureParameters( @@ -460,7 +461,8 @@ RendererOverridesHandler::PageCaptureScreenshot( view_bounds, snapshot_size, base::Bind(&RendererOverridesHandler::ScreenshotCaptured, weak_factory_.GetWeakPtr(), command, format, quality, - last_compositor_frame_metadata_)); + last_compositor_frame_metadata_), + false); return command->AsyncResponsePromise(); } diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc index ee0812b..9ee2439 100644 --- a/content/browser/frame_host/render_widget_host_view_child_frame.cc +++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc @@ -309,7 +309,8 @@ BackingStore* RenderWidgetHostViewChildFrame::AllocBackingStore( void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& /* dst_size */, - const base::Callback<void(bool, const SkBitmap&)>& callback) { + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) { callback.Run(false, SkBitmap()); } diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.h b/content/browser/frame_host/render_widget_host_view_child_frame.h index 11c26a5..07073e5 100644 --- a/content/browser/frame_host/render_widget_host_view_child_frame.h +++ b/content/browser/frame_host/render_widget_host_view_child_frame.h @@ -94,7 +94,8 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame virtual void CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE; + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc index d841a19..ed1af63 100644 --- a/content/browser/frame_host/render_widget_host_view_guest.cc +++ b/content/browser/frame_host/render_widget_host_view_guest.cc @@ -334,7 +334,8 @@ void RenderWidgetHostViewGuest::SelectionBoundsChanged( void RenderWidgetHostViewGuest::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback<void(bool, const SkBitmap&)>& callback) { + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) { CHECK(guest_); guest_->CopyFromCompositingSurface(src_subrect, dst_size, callback); } diff --git a/content/browser/frame_host/render_widget_host_view_guest.h b/content/browser/frame_host/render_widget_host_view_guest.h index e66a328..2fdae4d 100644 --- a/content/browser/frame_host/render_widget_host_view_guest.h +++ b/content/browser/frame_host/render_widget_host_view_guest.h @@ -98,7 +98,8 @@ class CONTENT_EXPORT RenderWidgetHostViewGuest virtual void CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE; + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) OVERRIDE; virtual void AcceleratedSurfaceBuffersSwapped( const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, int gpu_host_id) OVERRIDE; diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index f9fb802..0b4eb58 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -347,7 +347,8 @@ bool CompositorImpl::CopyTextureToBitmap(GLuint texture_id, GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper(); helper->ReadbackTextureSync(texture_id, sub_rect, - static_cast<unsigned char*> (bitmap.pixels())); + static_cast<unsigned char*> (bitmap.pixels()), + SkBitmap::kARGB_8888_Config); return true; } diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 25380c8..411de18 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -724,7 +724,8 @@ void RenderWidgetHostImpl::CopyFromBackingStore( gfx::Rect(view_->GetViewBounds().size()) : src_subrect; view_->CopyFromCompositingSurface(accelerated_copy_rect, accelerated_dst_size, - callback); + callback, + false); return; } diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 2b78167..dc9ea5f 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc @@ -306,7 +306,8 @@ bool RenderWidgetHostViewAndroid::PopulateBitmapWithContents(jobject jbitmap) { helper->ReadbackTextureSync(texture, gfx::Rect(bitmap.size()), - static_cast<unsigned char*> (bitmap.pixels())); + static_cast<unsigned char*> (bitmap.pixels()), + SkBitmap::kARGB_8888_Config); gpu::gles2::GLES2Interface* gl = ImageTransportFactoryAndroid::GetInstance()->GetContextGL(); @@ -626,12 +627,23 @@ void RenderWidgetHostViewAndroid::SetBackground(const SkBitmap& background) { void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback<void(bool, const SkBitmap&)>& callback) { + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) { if (!using_synchronous_compositor_ && !IsSurfaceAvailableForCopy()) { callback.Run(false, SkBitmap()); return; } - + ImageTransportFactoryAndroid* factory = + ImageTransportFactoryAndroid::GetInstance(); + GLHelper* gl_helper = factory->GetGLHelper(); + if (!gl_helper) + return; + bool check_rgb565_support = gl_helper->CanUseRgb565Readback(); + if (readback_config_rgb565 && !check_rgb565_support) { + LOG(ERROR) << "Readbackformat rgb565 not supported"; + callback.Run(false, SkBitmap()); + return; + } const gfx::Display& display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); float device_scale_factor = display.device_scale_factor(); @@ -647,7 +659,6 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( SynchronousCopyContents(src_subrect_in_pixel, dst_size_in_pixel, callback); return; } - scoped_ptr<cc::CopyOutputRequest> request; if (src_subrect_in_pixel.size() == dst_size_in_pixel) { request = cc::CopyOutputRequest::CreateBitmapRequest(base::Bind( @@ -658,6 +669,7 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( request = cc::CopyOutputRequest::CreateRequest(base::Bind( &RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult, dst_size_in_pixel, + readback_config_rgb565, callback)); } request->set_area(src_subrect_in_pixel); @@ -1370,6 +1382,7 @@ void RenderWidgetHostViewAndroid::OnLostResources() { // static void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult( const gfx::Size& dst_size_in_pixel, + bool readback_config_rgb565, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result) { DCHECK(result->HasTexture()); @@ -1380,8 +1393,12 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult( return; scoped_ptr<SkBitmap> bitmap(new SkBitmap); - bitmap->setConfig(SkBitmap::kARGB_8888_Config, - dst_size_in_pixel.width(), dst_size_in_pixel.height(), + SkBitmap::Config bitmap_config = readback_config_rgb565 ? + SkBitmap::kRGB_565_Config : + SkBitmap::kARGB_8888_Config; + bitmap->setConfig(bitmap_config, + dst_size_in_pixel.width(), + dst_size_in_pixel.height(), 0, kOpaque_SkAlphaType); if (!bitmap->allocPixels()) return; @@ -1412,6 +1429,7 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult( gfx::Rect(result->size()), dst_size_in_pixel, pixels, + readback_config_rgb565, base::Bind(&CopyFromCompositingSurfaceFinished, callback, base::Passed(&release_callback), diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h index ac4db89..18b9a32 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.h +++ b/content/browser/renderer_host/render_widget_host_view_android.h @@ -138,7 +138,8 @@ class RenderWidgetHostViewAndroid virtual void CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE; + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, @@ -273,6 +274,7 @@ class RenderWidgetHostViewAndroid // of the copy. static void PrepareTextureCopyOutputResult( const gfx::Size& dst_size_in_pixel, + bool readback_config_rgb565, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result); static void PrepareBitmapCopyOutputResult( diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 27f54ec..174b1e7 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -1058,7 +1058,8 @@ BackingStore* RenderWidgetHostViewAura::AllocBackingStore( void RenderWidgetHostViewAura::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback<void(bool, const SkBitmap&)>& callback) { + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) { if (!CanCopyToBitmap()) { callback.Run(false, SkBitmap()); return; @@ -1069,6 +1070,7 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurface( cc::CopyOutputRequest::CreateRequest(base::Bind( &RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult, dst_size_in_pixel, + readback_config_rgb565, callback)); gfx::Rect src_subrect_in_pixel = ConvertRectToPixel(current_device_scale_factor_, src_subrect); @@ -1803,6 +1805,7 @@ void RenderWidgetHostViewAura::SetSurfaceNotInUseByCompositor( // static void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult( const gfx::Size& dst_size_in_pixel, + bool readback_config_rgb565, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result) { if (result->IsEmpty() || result->size().IsEmpty()) { @@ -1811,7 +1814,9 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult( } if (result->HasTexture()) { - PrepareTextureCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); + PrepareTextureCopyOutputResult(dst_size_in_pixel, readback_config_rgb565, + callback, + result.Pass()); return; } @@ -1833,6 +1838,7 @@ static void CopyFromCompositingSurfaceFinished( // static void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( const gfx::Size& dst_size_in_pixel, + bool readback_config_rgb565, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result) { base::ScopedClosureRunner scoped_callback_runner( @@ -1874,6 +1880,7 @@ void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( gfx::Rect(result->size()), dst_size_in_pixel, pixels, + readback_config_rgb565, base::Bind(&CopyFromCompositingSurfaceFinished, callback, base::Passed(&release_callback), diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 9e11115..0cef4e5 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -210,7 +210,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAura virtual void CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE; + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, @@ -491,10 +492,12 @@ class CONTENT_EXPORT RenderWidgetHostViewAura // of the copy. static void CopyFromCompositingSurfaceHasResult( const gfx::Size& dst_size_in_pixel, + bool readback_config_rgb565, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result); static void PrepareTextureCopyOutputResult( const gfx::Size& dst_size_in_pixel, + bool readback_config_rgb565, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result); static void PrepareBitmapCopyOutputResult( diff --git a/content/browser/renderer_host/render_widget_host_view_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_browsertest.cc index 79aa718..d1f888c 100644 --- a/content/browser/renderer_host/render_widget_host_view_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_browsertest.cc @@ -732,7 +732,10 @@ class CompositingRenderWidgetHostViewBrowserTestTabCapture CopyFromCompositingSurfaceCallback, base::Unretained(this), run_loop.QuitClosure()); - rwhvp->CopyFromCompositingSurface(copy_rect, output_size, callback); + rwhvp->CopyFromCompositingSurface(copy_rect, + output_size, + callback, + false); } run_loop.Run(); } diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.cc b/content/browser/renderer_host/render_widget_host_view_gtk.cc index e08e8d8..b7d6e2e 100644 --- a/content/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/content/browser/renderer_host/render_widget_host_view_gtk.cc @@ -1047,7 +1047,12 @@ BackingStore* RenderWidgetHostViewGtk::AllocBackingStore( void RenderWidgetHostViewGtk::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& /* dst_size */, - const base::Callback<void(bool, const SkBitmap&)>& callback) { + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) { + if (readback_config_rgb565) { + NOTIMPLEMENTED(); + callback.Run(false, SkBitmap()); + } // Grab the snapshot from the renderer as that's the only reliable way to // readback from the GPU for this platform right now. GetRenderWidgetHost()->GetSnapshotFromRenderer(src_subrect, callback); diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.h b/content/browser/renderer_host/render_widget_host_view_gtk.h index b9a18c9..f2ff62e5 100644 --- a/content/browser/renderer_host/render_widget_host_view_gtk.h +++ b/content/browser/renderer_host/render_widget_host_view_gtk.h @@ -104,7 +104,8 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk virtual void CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE; + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h index 3923fcf..1cebb51 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -275,7 +275,8 @@ class RenderWidgetHostViewMac : public RenderWidgetHostViewBase, virtual void CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE; + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 5a4e688..3b68caf 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -1134,7 +1134,12 @@ BackingStore* RenderWidgetHostViewMac::AllocBackingStore( void RenderWidgetHostViewMac::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback<void(bool, const SkBitmap&)>& callback) { + const base::Callback<void(bool, const SkBitmap&)>& callback, + bool readback_config_rgb565) { + if (readback_config_rgb565) { + NOTIMPLEMENTED(); + callback.Run(false, SkBitmap()); + } base::ScopedClosureRunner scoped_callback_runner( base::Bind(callback, false, SkBitmap())); float scale = ScaleFactor(cocoa_view_); |