Backed out 6 changesets (bug 1444434) for build bustages on a CLOSED TREE
authorCoroiu Cristina <ccoroiu@mozilla.com>
Tue, 26 Mar 2019 23:43:17 +0200
changeset 466234 9ac40c5bc0087cf4651d673f9be4ab6dbeee8a7d
parent 466233 09f3b83a2b8b50574e33646fb29a4b7b03277ae7
child 466235 d3f27592a382d8c84b3b1ab8fa7dbbcd8d22e785
push id35762
push usercsabou@mozilla.com
push dateWed, 27 Mar 2019 04:44:00 +0000
treeherdermozilla-central@bc572aee49b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1444434
milestone68.0a1
backs out13c0d857bf3c7cb5b21f25e2c35e1f2f3a57a4e2
d2c85db549ea25fb84c832df0a9654d084779736
543708a1f683cca77621edb919cb9ac27d77c53f
af008ed0a5c2ed74b1853569c13a3958346e18c0
ec2a81eea3888d28f1ae33cdda01cc07034c853a
0bcf6edc86567990174922bb2b385e7cd3dc3461
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 6 changesets (bug 1444434) for build bustages on a CLOSED TREE Backed out changeset 13c0d857bf3c (bug 1444434) Backed out changeset d2c85db549ea (bug 1444434) Backed out changeset 543708a1f683 (bug 1444434) Backed out changeset af008ed0a5c2 (bug 1444434) Backed out changeset ec2a81eea388 (bug 1444434) Backed out changeset 0bcf6edc8656 (bug 1444434)
gfx/webrender_bindings/RendererOGL.cpp
gfx/webrender_bindings/RendererOGL.h
gfx/webrender_bindings/RendererScreenshotGrabber.cpp
gfx/webrender_bindings/RendererScreenshotGrabber.h
gfx/webrender_bindings/moz.build
gfx/webrender_bindings/src/bindings.rs
gfx/wr/webrender/src/device/gl.rs
gfx/wr/webrender/src/lib.rs
gfx/wr/webrender/src/renderer.rs
--- a/gfx/webrender_bindings/RendererOGL.cpp
+++ b/gfx/webrender_bindings/RendererOGL.cpp
@@ -125,34 +125,30 @@ bool RendererOGL::UpdateAndRender(const 
 
   if (aReadbackBuffer.isSome()) {
     MOZ_ASSERT(aReadbackSize.isSome());
     wr_renderer_readback(mRenderer, aReadbackSize.ref().width,
                          aReadbackSize.ref().height, &aReadbackBuffer.ref()[0],
                          aReadbackBuffer.ref().length());
   }
 
-  mScreenshotGrabber.MaybeGrabScreenshot(mRenderer, size.ToUnknownSize());
-
   mCompositor->EndFrame();
 
   mCompositor->GetWidget()->PostRender(&widgetContext);
 
 #if defined(ENABLE_FRAME_LATENCY_LOG)
   if (mFrameStartTime) {
     uint32_t latencyMs =
         round((TimeStamp::Now() - mFrameStartTime).ToMilliseconds());
     printf_stderr("generate frame latencyMs latencyMs %d\n", latencyMs);
   }
   // Clear frame start time
   mFrameStartTime = TimeStamp();
 #endif
 
-  mScreenshotGrabber.MaybeProcessQueue(mRenderer);
-
   // TODO: Flush pending actions such as texture deletions/unlocks and
   //       textureHosts recycling.
 
   return true;
 }
 
 void RendererOGL::CheckGraphicsResetStatus() {
   if (!mCompositor || !mCompositor->gl()) {
--- a/gfx/webrender_bindings/RendererOGL.h
+++ b/gfx/webrender_bindings/RendererOGL.h
@@ -7,17 +7,16 @@
 #ifndef MOZILLA_LAYERS_RENDEREROGL_H
 #define MOZILLA_LAYERS_RENDEREROGL_H
 
 #include "mozilla/layers/CompositorTypes.h"
 #include "mozilla/gfx/Point.h"
 #include "mozilla/webrender/RenderThread.h"
 #include "mozilla/webrender/WebRenderTypes.h"
 #include "mozilla/webrender/webrender_ffi.h"
-#include "mozilla/webrender/RendererScreenshotGrabber.h"
 
 namespace mozilla {
 
 namespace gfx {
 class DrawTarget;
 }
 
 namespace gl {
@@ -106,16 +105,14 @@ class RendererOGL {
   void NotifyWebRenderError(WebRenderError aError);
 
   RefPtr<RenderThread> mThread;
   UniquePtr<RenderCompositor> mCompositor;
   wr::Renderer* mRenderer;
   layers::CompositorBridgeParent* mBridge;
   wr::WindowId mWindowId;
   TimeStamp mFrameStartTime;
-
-  RendererScreenshotGrabber mScreenshotGrabber;
 };
 
 }  // namespace wr
 }  // namespace mozilla
 
 #endif
deleted file mode 100644
--- a/gfx/webrender_bindings/RendererScreenshotGrabber.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "RendererScreenshotGrabber.h"
-
-using mozilla::layers::ProfilerScreenshots;
-
-namespace mozilla {
-namespace wr {
-
-RendererScreenshotGrabber::RendererScreenshotGrabber() {
-  mMaxScreenshotSize = ProfilerScreenshots::ScreenshotSize();
-}
-
-void RendererScreenshotGrabber::MaybeGrabScreenshot(
-    Renderer* aRenderer, const gfx::IntSize& aWindowSize) {
-  if (ProfilerScreenshots::IsEnabled()) {
-    if (!mProfilerScreenshots) {
-      mProfilerScreenshots = MakeUnique<ProfilerScreenshots>();
-    }
-
-    GrabScreenshot(aRenderer, aWindowSize);
-  } else if (mProfilerScreenshots) {
-    Destroy(aRenderer);
-  }
-}
-
-void RendererScreenshotGrabber::MaybeProcessQueue(Renderer* aRenderer) {
-  if (ProfilerScreenshots::IsEnabled()) {
-    if (!mProfilerScreenshots) {
-      mProfilerScreenshots = MakeUnique<ProfilerScreenshots>();
-    }
-
-    ProcessQueue(aRenderer);
-  } else if (mProfilerScreenshots) {
-    Destroy(aRenderer);
-  }
-}
-
-void RendererScreenshotGrabber::Destroy(Renderer* aRenderer) {
-  mQueue.Clear();
-  mCurrentFrameQueueItem = Nothing();
-  mProfilerScreenshots = nullptr;
-
-  wr_renderer_release_profiler_structures(aRenderer);
-}
-
-void RendererScreenshotGrabber::GrabScreenshot(
-    Renderer* aRenderer, const gfx::IntSize& aWindowSize) {
-  gfx::IntSize screenshotSize;
-
-  AsyncScreenshotHandle handle = wr_renderer_get_screenshot_async(
-      aRenderer, 0, 0, aWindowSize.width, aWindowSize.height,
-      mMaxScreenshotSize.width, mMaxScreenshotSize.height, ImageFormat::BGRA8,
-      &screenshotSize.width, &screenshotSize.height);
-
-  mCurrentFrameQueueItem = Some(QueueItem{
-      TimeStamp::Now(),
-      handle,
-      screenshotSize,
-      aWindowSize,
-      reinterpret_cast<uintptr_t>(this),
-  });
-}
-
-void RendererScreenshotGrabber::ProcessQueue(Renderer* aRenderer) {
-  for (const auto& item : mQueue) {
-    mProfilerScreenshots->SubmitScreenshot(
-        item.mWindowIdentifier, item.mWindowSize, item.mScreenshotSize,
-        item.mTimeStamp, [&item, aRenderer](DataSourceSurface* aTargetSurface) {
-          DataSourceSurface::ScopedMap map(aTargetSurface,
-                                           DataSourceSurface::WRITE);
-          int32_t destStride = map.GetStride();
-
-          bool success = wr_renderer_map_and_recycle_screenshot(
-              aRenderer, item.mHandle, map.GetData(),
-              destStride * aTargetSurface->GetSize().height, destStride);
-
-          return success;
-        });
-  }
-
-  mQueue.Clear();
-
-  if (mCurrentFrameQueueItem) {
-    mQueue.AppendElement(*mCurrentFrameQueueItem);
-    mCurrentFrameQueueItem = Nothing();
-  }
-}
-
-}  // namespace wr
-}  // namespace mozilla
deleted file mode 100644
--- a/gfx/webrender_bindings/RendererScreenshotGrabber.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_layers_RendererScreenshotGrabber_h
-#define mozilla_layers_RendererScreenshotGrabber_h
-
-#include "mozilla/TimeStamp.h"
-#include "mozilla/UniquePtr.h"
-#include "mozilla/gfx/Point.h"
-#include "mozilla/layers/ProfilerScreenshots.h"
-#include "nsTArray.h"
-
-namespace mozilla {
-namespace wr {
-
-/**
- * Used by |RendererOGL| to grab screenshots from WebRender and submit them to
- * the Gecko profiler.
- *
- * If the profiler is not running or the screenshots feature is disabled, no
- * work will be done.
- */
-class RendererScreenshotGrabber final {
- public:
-  RendererScreenshotGrabber();
-
-  /**
-   * Grab a screenshot from WebRender if we are profiling and screenshots are
-   * enabled.
-   *
-   * The captured screenshot will not be mapped until the second call to
-   * |MaybeProcessQueue| after this call to |MaybeGrabScreenshot|.
-   */
-  void MaybeGrabScreenshot(Renderer* aRenderer,
-                           const gfx::IntSize& aWindowSize);
-
-  /**
-   * Process the screenshots pending in the queue if we are profiling and
-   * screenshots are enabled.
-   */
-  void MaybeProcessQueue(Renderer* aRenderer);
-
- private:
-  /**
-   * Drop all our allocated memory when we are no longer profiling.
-   *
-   * This will also instruct WebRender to drop all its Gecko profiler
-   * associated memory.
-   */
-  void Destroy(Renderer* aRenderer);
-
-  /**
-   * Actually grab a screenshot from WebRender.
-   */
-  void GrabScreenshot(Renderer* aRenderer, const gfx::IntSize& aWindowSize);
-
-  /**
-   * Process the screenshots pending in the queue.
-   */
-  void ProcessQueue(Renderer* aRenderer);
-
-  struct QueueItem {
-    mozilla::TimeStamp mTimeStamp;
-    AsyncScreenshotHandle mHandle;
-    gfx::IntSize mScreenshotSize;
-    gfx::IntSize mWindowSize;
-    uintptr_t mWindowIdentifier;
-  };
-
-  /**
-   * The maximum size for screenshots, as dictated by
-   * |ProfilerScrenshots::ScreenshotSize|.
-   */
-  gfx::IntSize mMaxScreenshotSize;
-
-  /**
-   * The queue of screenshots waiting to be processed and submitted.
-   */
-  nsTArray<QueueItem> mQueue;
-
-  /**
-   * The queue item for the current frame. This will be inserted into the queue
-   * after a call to |MaybeProcessQueue| so it will be not be processed until
-   * the next frame.
-   */
-  Maybe<QueueItem> mCurrentFrameQueueItem;
-
-  /**
-   * Our handle to the profiler screenshots object.
-   */
-  UniquePtr<mozilla::layers::ProfilerScreenshots> mProfilerScreenshots;
-};
-
-}  // namespace wr
-}  // namespace mozilla
-
-#endif  // mozilla_layers_RendererScreenshotGrabber_h
--- a/gfx/webrender_bindings/moz.build
+++ b/gfx/webrender_bindings/moz.build
@@ -7,34 +7,32 @@
 with Files('**'):
     BUG_COMPONENT = ('Core', 'Graphics: WebRender')
 
 EXPORTS.mozilla.webrender += [
     'RenderBufferTextureHost.h',
     'RenderCompositor.h',
     'RenderCompositorOGL.h',
     'RendererOGL.h',
-    'RendererScreenshotGrabber.h',
     'RenderSharedSurfaceTextureHost.h',
     'RenderTextureHost.h',
     'RenderTextureHostOGL.h',
     'RenderTextureHostWrapper.h',
     'RenderThread.h',
     'webrender_ffi.h',
     'WebRenderAPI.h',
     'WebRenderTypes.h',
 ]
 
 UNIFIED_SOURCES += [
     'Moz2DImageRenderer.cpp',
     'RenderBufferTextureHost.cpp',
     'RenderCompositor.cpp',
     'RenderCompositorOGL.cpp',
     'RendererOGL.cpp',
-    'RendererScreenshotGrabber.cpp',
     'RenderSharedSurfaceTextureHost.cpp',
     'RenderTextureHost.cpp',
     'RenderTextureHostOGL.cpp',
     'RenderTextureHostWrapper.cpp',
     'RenderThread.cpp',
     'WebRenderAPI.cpp',
     'WebRenderTypes.cpp',
 ]
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -14,23 +14,25 @@ use std::sync::Arc;
 use std::sync::atomic::{AtomicUsize, Ordering};
 use std::ops::Range;
 use std::os::raw::{c_void, c_char, c_float};
 #[cfg(target_os = "android")]
 use std::os::raw::{c_int};
 use std::time::Duration;
 use gleam::gl;
 
-use webrender::{
-    api::*, units::*, ApiRecordingReceiver, AsyncPropertySampler, AsyncScreenshotHandle,
-    BinaryRecorder, DebugFlags, Device, ExternalImage, ExternalImageHandler, ExternalImageSource,
-    PipelineInfo, ProfilerHooks, ReadPixelsFormat, Renderer, RendererOptions, RendererStats,
-    SceneBuilderHooks, ShaderPrecacheFlags, Shaders, ThreadListener, UploadMethod, VertexUsageHint,
-    WrShaders, set_profiler_hooks,
-};
+use webrender::api::*;
+use webrender::api::units::*;
+use webrender::{ReadPixelsFormat, Renderer, RendererOptions, RendererStats, ThreadListener};
+use webrender::{ExternalImage, ExternalImageHandler, ExternalImageSource};
+use webrender::DebugFlags;
+use webrender::{ApiRecordingReceiver, BinaryRecorder};
+use webrender::{AsyncPropertySampler, PipelineInfo, SceneBuilderHooks};
+use webrender::{UploadMethod, VertexUsageHint, ProfilerHooks, set_profiler_hooks};
+use webrender::{Device, Shaders, WrShaders, ShaderPrecacheFlags};
 use thread_profiler::register_thread_with_profiler;
 use moz2d_renderer::Moz2dBlobImageHandler;
 use program_cache::{WrProgramCache, remove_disk_cache};
 use rayon;
 use euclid::SideOffsets2D;
 use nsstring::nsAString;
 
 #[cfg(target_os = "macos")]
@@ -662,69 +664,16 @@ pub extern "C" fn wr_renderer_render(ren
                     gfx_critical_note(msg.as_ptr());
                 }
             }
             false
         },
     }
 }
 
-#[no_mangle]
-pub extern "C" fn wr_renderer_get_screenshot_async(
-    renderer: &mut Renderer,
-    window_x: i32,
-    window_y: i32,
-    window_width: i32,
-    window_height: i32,
-    buffer_width: i32,
-    buffer_height: i32,
-    image_format: ImageFormat,
-    screenshot_width: *mut i32,
-    screenshot_height: *mut i32,
-) -> AsyncScreenshotHandle {
-    assert!(!screenshot_width.is_null());
-    assert!(!screenshot_height.is_null());
-
-    let (handle, size) = renderer.get_screenshot_async(
-        DeviceIntRect::new(
-            DeviceIntPoint::new(window_x, window_y),
-            DeviceIntSize::new(window_width, window_height),
-        ),
-        DeviceIntSize::new(buffer_width, buffer_height),
-        image_format,
-    );
-
-    unsafe {
-        *screenshot_width = size.width;
-        *screenshot_height = size.height;
-    }
-
-    handle
-}
-
-#[no_mangle]
-pub extern "C" fn wr_renderer_map_and_recycle_screenshot(
-    renderer: &mut Renderer,
-    handle: AsyncScreenshotHandle,
-    dst_buffer: *mut u8,
-    dst_buffer_len: usize,
-    dst_stride: usize,
-) -> bool {
-    renderer.map_and_recycle_screenshot(
-        handle,
-        make_slice_mut(dst_buffer, dst_buffer_len),
-        dst_stride,
-    )
-}
-
-#[no_mangle]
-pub extern "C" fn wr_renderer_release_profiler_structures(renderer: &mut Renderer) {
-    renderer.release_profiler_structures();
-}
-
 // Call wr_renderer_render() before calling this function.
 #[no_mangle]
 pub unsafe extern "C" fn wr_renderer_readback(renderer: &mut Renderer,
                                               width: i32,
                                               height: i32,
                                               dst_buffer: *mut u8,
                                               buffer_size: usize) {
     assert!(is_in_render_thread());
--- a/gfx/wr/webrender/src/device/gl.rs
+++ b/gfx/wr/webrender/src/device/gl.rs
@@ -653,45 +653,27 @@ impl Drop for VAO {
             thread::panicking() || self.id == 0,
             "renderer::deinit not called"
         );
     }
 }
 
 pub struct PBO {
     id: gl::GLuint,
-    reserved_size: usize,
-}
-
-impl PBO {
-    pub fn get_reserved_size(&self) -> usize {
-        self.reserved_size
-    }
 }
 
 impl Drop for PBO {
     fn drop(&mut self) {
         debug_assert!(
             thread::panicking() || self.id == 0,
             "renderer::deinit not called"
         );
     }
 }
 
-pub struct BoundPBO<'a> {
-    device: &'a mut Device,
-    pub data: &'a [u8]
-}
-
-impl<'a> Drop for BoundPBO<'a> {
-    fn drop(&mut self) {
-        self.device.gl.unmap_buffer(gl::PIXEL_PACK_BUFFER);
-    }
-}
-
 #[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)]
 pub struct FBOId(gl::GLuint);
 
 #[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)]
 pub struct RBOId(gl::GLuint);
 
 #[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)]
 pub struct VBOId(gl::GLuint);
@@ -2342,102 +2324,22 @@ impl Device {
 
     pub fn switch_mode(&self, mode: i32) {
         debug_assert!(self.inside_frame);
         self.gl.uniform_1i(self.program_mode_id.0, mode);
     }
 
     pub fn create_pbo(&mut self) -> PBO {
         let id = self.gl.gen_buffers(1)[0];
-        PBO {
-            id,
-            reserved_size: 0,
-        }
-    }
-
-    pub fn create_pbo_with_size(&mut self, size: usize) -> PBO {
-        let mut pbo = self.create_pbo();
-
-        self.gl.bind_buffer(gl::PIXEL_PACK_BUFFER, pbo.id);
-        self.gl.pixel_store_i(gl::PACK_ALIGNMENT, 1);
-        self.gl.buffer_data_untyped(
-            gl::PIXEL_PACK_BUFFER,
-            size as _,
-            ptr::null(),
-            gl::STREAM_READ,
-        );
-        self.gl.bind_buffer(gl::PIXEL_UNPACK_BUFFER, 0);
-
-        pbo.reserved_size = size;
-        pbo
-    }
-
-    pub fn read_pixels_into_pbo(
-        &mut self,
-        read_target: ReadTarget,
-        rect: DeviceIntRect,
-        format: ImageFormat,
-        pbo: &PBO,
-    ) {
-        let byte_size = rect.size.area() as usize * format.bytes_per_pixel() as usize;
-
-        assert!(byte_size <= pbo.reserved_size);
-
-        self.bind_read_target(read_target);
-
-        self.gl.bind_buffer(gl::PIXEL_PACK_BUFFER, pbo.id);
-        self.gl.pixel_store_i(gl::PACK_ALIGNMENT, 1);
-
-        let gl_format = self.gl_describe_format(format);
-
-        unsafe {
-            self.gl.read_pixels_into_pbo(
-                rect.origin.x as _,
-                rect.origin.y as _,
-                rect.size.width as _,
-                rect.size.height as _,
-                gl_format.external,
-                gl_format.pixel_type,
-            );
-        }
-
-        self.gl.bind_buffer(gl::PIXEL_PACK_BUFFER, 0);
-    }
-
-    pub fn map_pbo_for_readback<'a>(&'a mut self, pbo: &'a PBO) -> Option<BoundPBO<'a>> {
-        let buf_ptr = match self.gl.get_type() {
-            gl::GlType::Gl => {
-                self.gl.map_buffer(gl::PIXEL_PACK_BUFFER, gl::READ_ONLY)
-            }
-
-            gl::GlType::Gles => {
-                self.gl.map_buffer_range(
-                    gl::PIXEL_PACK_BUFFER,
-                    0,
-                    pbo.reserved_size as _,
-                    gl::READ_ONLY)
-            }
-        };
-
-        if buf_ptr.is_null() {
-            return None;
-        }
-
-        let buffer = unsafe { slice::from_raw_parts(buf_ptr as *const u8, pbo.reserved_size) };
-
-        Some(BoundPBO {
-            device: self,
-            data: buffer,
-        })
+        PBO { id }
     }
 
     pub fn delete_pbo(&mut self, mut pbo: PBO) {
         self.gl.delete_buffers(&[pbo.id]);
         pbo.id = 0;
-        pbo.reserved_size = 0
     }
 
     pub fn upload_texture<'a, T>(
         &'a mut self,
         texture: &'a Texture,
         pbo: &PBO,
         upload_count: usize,
     ) -> TextureUploader<'a, T> {
--- a/gfx/wr/webrender/src/lib.rs
+++ b/gfx/wr/webrender/src/lib.rs
@@ -205,16 +205,16 @@ pub extern crate webrender_api;
 extern crate webrender_build;
 
 #[doc(hidden)]
 pub use device::{build_shader_strings, ReadPixelsFormat, UploadMethod, VertexUsageHint};
 pub use device::{ProgramBinary, ProgramCache, ProgramCacheObserver};
 pub use device::Device;
 pub use frame_builder::ChasePrimitive;
 pub use profiler::{ProfilerHooks, set_profiler_hooks};
-pub use renderer::{AsyncPropertySampler, AsyncScreenshotHandle, CpuProfile, DebugFlags};
-pub use renderer::{OutputImageHandler, RendererKind, ExternalImage, ExternalImageHandler};
-pub use renderer::{ExternalImageSource, GpuProfile, GraphicsApi, GraphicsApiInfo, PipelineInfo};
-pub use renderer::{Renderer, RendererOptions, RenderResults, RendererStats, SceneBuilderHooks};
-pub use renderer::{ThreadListener, ShaderPrecacheFlags, MAX_VERTEX_TEXTURE_WIDTH};
+pub use renderer::{AsyncPropertySampler, CpuProfile, DebugFlags, OutputImageHandler, RendererKind};
+pub use renderer::{ExternalImage, ExternalImageHandler, ExternalImageSource, GpuProfile};
+pub use renderer::{GraphicsApi, GraphicsApiInfo, PipelineInfo, Renderer, RendererOptions};
+pub use renderer::{RenderResults, RendererStats, SceneBuilderHooks, ThreadListener, ShaderPrecacheFlags};
+pub use renderer::MAX_VERTEX_TEXTURE_WIDTH;
 pub use shade::{Shaders, WrShaders};
 pub use webrender_api as api;
 pub use webrender_api::euclid;
--- a/gfx/wr/webrender/src/renderer.rs
+++ b/gfx/wr/webrender/src/renderer.rs
@@ -83,17 +83,17 @@ use scene_builder::{SceneBuilder, LowPri
 use shade::{Shaders, WrShaders};
 use smallvec::SmallVec;
 use render_task::{RenderTask, RenderTaskData, RenderTaskKind, RenderTaskTree};
 use resource_cache::ResourceCache;
 use util::drain_filter;
 
 use std;
 use std::cmp;
-use std::collections::{HashMap, VecDeque};
+use std::collections::VecDeque;
 use std::collections::hash_map::Entry;
 use std::f32;
 use std::marker::PhantomData;
 use std::mem;
 use std::os::raw::c_void;
 use std::path::PathBuf;
 use std::rc::Rc;
 use std::sync::Arc;
@@ -1590,265 +1590,16 @@ pub struct RendererVAOs {
     clip_vao: VAO,
     border_vao: VAO,
     line_vao: VAO,
     scale_vao: VAO,
     gradient_vao: VAO,
     resolve_vao: VAO,
 }
 
-#[repr(C)]
-#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
-/// A handle to a screenshot that is being asynchronously captured and scaled.
-pub struct AsyncScreenshotHandle(usize);
-
-/// An asynchronously captured screenshot bound to a PBO which has not yet been mapped for copying.
-struct AsyncScreenshot {
-    /// The PBO that will contain the screenshot data.
-    pbo: PBO,
-    /// The size of the screenshot.
-    screenshot_size: DeviceIntSize,
-    /// Thge image format of the screenshot.
-    image_format: ImageFormat,
-}
-
-/// Renderer infrastructure for capturing screenshots and scaling them asynchronously.
-struct AsyncScreenshotGrabber {
-    /// The textures used to scale screenshots.
-    scaling_textures: Vec<Texture>,
-    /// PBOs available to be used for screenshot readback.
-    available_pbos: Vec<PBO>,
-    /// PBOs containing screenshots that are awaiting readback.
-    awaiting_readback: HashMap<AsyncScreenshotHandle, AsyncScreenshot>,
-    /// The handle for the net PBO that will be inserted into `in_use_pbos`.
-    next_pbo_handle: usize,
-}
-
-impl Default for AsyncScreenshotGrabber {
-    fn default() -> Self {
-        return AsyncScreenshotGrabber {
-            scaling_textures: Vec::new(),
-            available_pbos: Vec::new(),
-            awaiting_readback: HashMap::new(),
-            next_pbo_handle: 1,
-        }
-    }
-}
-
-impl AsyncScreenshotGrabber {
-    /// Deinitialize the allocated textures and PBOs.
-    pub fn deinit(self, device: &mut Device) {
-        for texture in self.scaling_textures {
-            device.delete_texture(texture);
-        }
-
-        for pbo in self.available_pbos {
-            device.delete_pbo(pbo);
-        }
-
-        for (_, async_screenshot) in self.awaiting_readback {
-            device.delete_pbo(async_screenshot.pbo);
-        }
-    }
-
-    /// Take a screenshot and scale it asynchronously.
-    ///
-    /// The returned handle can be used to access the mapped screenshot data via
-    /// `map_and_recycle_screenshot`.
-    /// The returned size is the size of the screenshot.
-    pub fn get_screenshot(
-        &mut self,
-        device: &mut Device,
-        window_rect: DeviceIntRect,
-        buffer_size: DeviceIntSize,
-        image_format: ImageFormat,
-    ) -> (AsyncScreenshotHandle, DeviceIntSize) {
-        let scale = (buffer_size.width as f32 / window_rect.size.width as f32)
-            .min(buffer_size.height as f32 / window_rect.size.height as f32);
-        let screenshot_size = (window_rect.size.to_f32() * scale).round().to_i32();
-        let required_size = buffer_size.area() as usize
-            * image_format.bytes_per_pixel() as usize;
-
-        assert!(screenshot_size.width <= buffer_size.width);
-        assert!(screenshot_size.height <= buffer_size.height);
-
-        let pbo = match self.available_pbos.pop() {
-            Some(pbo) => {
-                assert_eq!(pbo.get_reserved_size(), required_size);
-                pbo
-            }
-
-            None => device.create_pbo_with_size(required_size),
-        };
-
-        self.scale_screenshot(
-            device,
-            ReadTarget::Default,
-            window_rect,
-            buffer_size,
-            screenshot_size,
-            image_format,
-            0,
-        );
-
-        device.read_pixels_into_pbo(
-            ReadTarget::Texture {
-                texture: &self.scaling_textures[0],
-                layer: 0 as _,
-            },
-            DeviceIntRect::new(DeviceIntPoint::new(0, 0), screenshot_size),
-            image_format,
-            &pbo,
-        );
-
-        let handle = AsyncScreenshotHandle(self.next_pbo_handle);
-        self.next_pbo_handle += 1;
-
-        self.awaiting_readback.insert(handle, AsyncScreenshot {
-            pbo,
-            screenshot_size,
-            image_format,
-        });
-
-        (handle, screenshot_size)
-    }
-
-    /// Take the screenshot in the given `ReadTarget` and scale it to `dest_size` recursively.
-    ///
-    /// Each scaling operation scales only by a factor of two to preserve quality.
-    ///
-    /// Textures are scaled such that `scaling_textures[n]` is half the size of
-    /// `scaling_textures[n+1]`.
-    ///
-    /// After the scaling completes, the final screenshot will be in
-    /// `scaling_textures[0]`.
-    fn scale_screenshot(
-        &mut self,
-        device: &mut Device,
-        read_target: ReadTarget,
-        read_target_rect: DeviceIntRect,
-        buffer_size: DeviceIntSize,
-        dest_size: DeviceIntSize,
-        image_format: ImageFormat,
-        level: usize,
-    ) {
-        let texture_size = buffer_size * (1 << level);
-        if level == self.scaling_textures.len() {
-            let texture = device.create_texture(
-                TextureTarget::Default,
-                image_format,
-                texture_size.width,
-                texture_size.height,
-                TextureFilter::Linear,
-                Some(RenderTargetInfo { has_depth: false }),
-                1,
-            );
-            self.scaling_textures.push(texture);
-        } else {
-            let current_texture_size = self.scaling_textures[level].get_dimensions();
-            assert_eq!(current_texture_size.width, texture_size.width);
-            assert_eq!(current_texture_size.height, texture_size.height);
-        }
-
-        let (read_target, read_target_rect) = if read_target_rect.size.width > 2 * dest_size.width {
-            self.scale_screenshot(
-                device,
-                read_target,
-                read_target_rect,
-                buffer_size,
-                dest_size * 2,
-                image_format,
-                level + 1,
-            );
-
-            (
-                ReadTarget::Texture {
-                    texture: &self.scaling_textures[level + 1],
-                    layer: 0 as _,
-                },
-                DeviceIntRect::new(
-                    DeviceIntPoint::new(0, 0),
-                    dest_size * 2,
-                ),
-            )
-        } else {
-            (read_target, read_target_rect)
-        };
-
-        let draw_target = DrawTarget::Texture {
-            texture: &self.scaling_textures[level],
-            layer: 0 as _,
-            with_depth: false,
-        };
-
-        let draw_target_rect = draw_target.to_framebuffer_rect(
-            DeviceIntRect::new(DeviceIntPoint::new(0, 0), dest_size),
-        );
-
-        let read_target_rect = FramebufferIntRect::from_untyped(&read_target_rect.to_untyped());
-
-        if level == 0 {
-            device.blit_render_target_invert_y(
-                read_target,
-                read_target_rect,
-                draw_target,
-                draw_target_rect,
-            );
-        } else {
-            device.blit_render_target(
-                read_target,
-                read_target_rect,
-                draw_target,
-                draw_target_rect,
-                TextureFilter::Linear,
-            );
-        }
-
-    }
-
-    /// Map the contents of the screenshot given by the handle and copy it into the given buffer.
-    pub fn map_and_recycle_screenshot(
-        &mut self,
-        device: &mut Device,
-        handle: AsyncScreenshotHandle,
-        dst_buffer: &mut [u8],
-        dst_stride: usize,
-    ) -> bool {
-        let AsyncScreenshot {
-            pbo,
-            screenshot_size,
-            image_format,
-        } = match self.awaiting_readback.remove(&handle) {
-            Some(async_screenshots) => async_screenshots,
-            None => return false,
-        };
-
-        let success = if let Some(bound_pbo) = device.map_pbo_for_readback(&pbo) {
-            let src_buffer = &bound_pbo.data;
-            let src_stride = screenshot_size.width as usize
-                * image_format.bytes_per_pixel() as usize;
-
-            for (src_slice, dst_slice) in src_buffer
-                .chunks(src_stride)
-                .zip(dst_buffer.chunks_mut(dst_stride))
-                .take(screenshot_size.height as usize)
-            {
-                dst_slice[..src_stride].copy_from_slice(src_slice);
-            }
-
-            true
-        } else {
-            false
-        };
-
-        self.available_pbos.push(pbo);
-        success
-    }
-}
-
 /// The renderer is responsible for submitting to the GPU the work prepared by the
 /// RenderBackend.
 ///
 /// We have a separate `Renderer` instance for each instance of WebRender (generally
 /// one per OS window), and all instances share the same thread.
 pub struct Renderer {
     result_rx: Receiver<ResultMsg>,
     debug_server: DebugServer,
@@ -1920,18 +1671,16 @@ pub struct Renderer {
     /// heap-allocated pointer.
     size_of_ops: Option<MallocSizeOfOps>,
 
     // Currently allocated FBOs for output frames.
     output_targets: FastHashMap<u32, FrameOutput>,
 
     pub renderer_errors: Vec<RendererError>,
 
-    async_screenshots: Option<AsyncScreenshotGrabber>,
-
     /// List of profile results from previous frames. Can be retrieved
     /// via get_frame_profiles().
     cpu_profiles: VecDeque<CpuProfile>,
     gpu_profiles: VecDeque<GpuProfile>,
 
     /// Notification requests to be fulfilled after rendering.
     notifications: Vec<NotificationRequest>,
 
@@ -2394,17 +2143,16 @@ impl Renderer {
             gpu_profiles: VecDeque::new(),
             gpu_cache_texture,
             gpu_cache_debug_chunks: Vec::new(),
             gpu_cache_frame_id: FrameId::INVALID,
             gpu_cache_overflow: false,
             texture_cache_upload_pbo,
             texture_resolver,
             renderer_errors: Vec::new(),
-            async_screenshots: None,
             #[cfg(feature = "capture")]
             read_fbo,
             #[cfg(feature = "replay")]
             owned_external_images: FastHashMap::default(),
             notifications: Vec::new(),
             framebuffer_size: None,
             zoom_debug_texture: None,
             cursor_position: DeviceIntPoint::zero(),
@@ -2589,75 +2337,24 @@ impl Renderer {
                 },
                 ResultMsg::DebugCommand(command) => {
                     self.handle_debug_command(command);
                 }
             }
         }
     }
 
-    /// Take a screenshot and scale it asynchronously.
-    ///
-    /// The returned handle can be used to access the mapped screenshot data via
-    /// `map_and_recycle_screenshot`.
-    /// The returned size is the size of the screenshot.
-    pub fn get_screenshot_async(
-        &mut self,
-        window_rect: DeviceIntRect,
-        buffer_size: DeviceIntSize,
-        image_format: ImageFormat,
-    ) -> (AsyncScreenshotHandle, DeviceIntSize) {
-        self.device.begin_frame();
-
-        let handle = self.async_screenshots
-            .get_or_insert_with(AsyncScreenshotGrabber::default)
-            .get_screenshot(&mut self.device,
-                            window_rect,
-                            buffer_size,
-                            image_format);
-
-        self.device.end_frame();
-
-        handle
-    }
-
-    /// Map the contents of the screenshot given by the handle and copy it into the given buffer.
-    pub fn map_and_recycle_screenshot(
-        &mut self,
-        handle: AsyncScreenshotHandle,
-        dst_buffer: &mut [u8],
-        dst_stride: usize,
-    ) -> bool {
-        if let Some(async_screenshots) = self.async_screenshots.as_mut() {
-            async_screenshots.map_and_recycle_screenshot(
-                &mut self.device,
-                handle,
-                dst_buffer,
-                dst_stride,
-            )
-        } else {
-            false
-        }
-    }
-
-    pub fn release_profiler_structures(&mut self) {
-        if let Some(async_screenshots) = self.async_screenshots.take() {
-            self.device.begin_frame();
-            async_screenshots.deinit(&mut self.device);
-            self.device.end_frame();
-        }
-    }
-
     #[cfg(not(feature = "debugger"))]
     fn get_screenshot_for_debugger(&mut self) -> String {
         // Avoid unused param warning.
         let _ = &self.debug_server;
         String::new()
     }
 
+
     #[cfg(feature = "debugger")]
     fn get_screenshot_for_debugger(&mut self) -> String {
         use api::ImageDescriptor;
 
         let desc = ImageDescriptor::new(1024, 768, ImageFormat::BGRA8, true, false);
         let data = self.device.read_pixels(&desc);
         let screenshot = debug_server::Screenshot::new(desc.size, data);
 
@@ -5304,21 +5001,16 @@ impl Renderer {
         self.debug.deinit(&mut self.device);
 
         for (_, target) in self.output_targets {
             self.device.delete_fbo(target.fbo_id);
         }
         if let Ok(shaders) = Rc::try_unwrap(self.shaders) {
             shaders.into_inner().deinit(&mut self.device);
         }
-
-        if let Some(async_screenshots) = self.async_screenshots.take() {
-            async_screenshots.deinit(&mut self.device);
-        }
-
         #[cfg(feature = "capture")]
         self.device.delete_fbo(self.read_fbo);
         #[cfg(feature = "replay")]
         for (_, ext) in self.owned_external_images {
             self.device.delete_external_texture(ext);
         }
         self.device.end_frame();
     }