Bug 1584375. Remove unused origin from recording. r=nical
☠☠ backed out by 31d06e3bb3b7 ☠ ☠
authorJeff Muizelaar <jrmuizel@gmail.com>
Wed, 02 Oct 2019 16:42:24 +0000
changeset 496067 dfa9c9bab74190db7873249a8c79608441135a1d
parent 496066 223f4c93c2e79d8e505d08eb288b33130761b334
child 496068 3cf5fbc9e4c306dbebad476bf2003abe758bf980
push id114141
push userrmaries@mozilla.com
push dateThu, 03 Oct 2019 09:42:28 +0000
treeherdermozilla-inbound@4a20e73bd624 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1584375
milestone71.0a1
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
Bug 1584375. Remove unused origin from recording. r=nical This was added as part of an intermediate step to blob recoordination. It's not used anymore. Differential Revision: https://phabricator.services.mozilla.com/D47354
gfx/2d/DrawEventRecorder.cpp
gfx/2d/DrawEventRecorder.h
gfx/layers/wr/WebRenderCommandBuilder.cpp
gfx/layers/wr/WebRenderDrawEventRecorder.h
gfx/webrender_bindings/src/moz2d_renderer.rs
--- a/gfx/2d/DrawEventRecorder.cpp
+++ b/gfx/2d/DrawEventRecorder.cpp
@@ -85,18 +85,18 @@ void DrawEventRecorderFile::Close() {
   mOutputStream.close();
 }
 
 DrawEventRecorderMemory::DrawEventRecorderMemory() {
   WriteHeader(mOutputStream);
 }
 
 DrawEventRecorderMemory::DrawEventRecorderMemory(
-    const SerializeResourcesFn& aFn, IntPoint aOrigin)
-    : mSerializeCallback(aFn), mOrigin(aOrigin) {
+    const SerializeResourcesFn& aFn)
+    : mSerializeCallback(aFn) {
   mExternalFonts = !!mSerializeCallback;
   WriteHeader(mOutputStream);
 }
 
 void DrawEventRecorderMemory::Flush() {}
 
 void DrawEventRecorderMemory::FlushItem(IntRect aRect) {
   MOZ_RELEASE_ASSERT(!aRect.IsEmpty());
@@ -127,17 +127,16 @@ bool DrawEventRecorderMemory::Finish() {
   // for example if there are no items in a particular area
   size_t indexOffset = mOutputStream.mLength;
   // write out the index
   mOutputStream.write(mIndex.mData, mIndex.mLength);
   bool hasItems = mIndex.mLength != 0;
   mIndex = MemStream();
   // write out the offset of the Index to the end of the output stream
   WriteElement(mOutputStream, indexOffset);
-  WriteElement(mOutputStream, mOrigin);
   ClearResources();
   return hasItems;
 }
 
 size_t DrawEventRecorderMemory::RecordingSize() {
   return mOutputStream.mLength;
 }
 
--- a/gfx/2d/DrawEventRecorder.h
+++ b/gfx/2d/DrawEventRecorder.h
@@ -174,18 +174,17 @@ typedef std::function<void(MemStream& aS
 class DrawEventRecorderMemory : public DrawEventRecorderPrivate {
  public:
   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawEventRecorderMemory, override)
 
   /**
    * Constructs a DrawEventRecorder that stores the recording in memory.
    */
   DrawEventRecorderMemory();
-  explicit DrawEventRecorderMemory(const SerializeResourcesFn& aSerialize,
-                                   IntPoint aOrigin = IntPoint());
+  explicit DrawEventRecorderMemory(const SerializeResourcesFn& aSerialize);
 
   void RecordEvent(const RecordedEvent& aEvent) override;
 
   void AddDependentSurface(uint64_t aDependencyId) override;
 
   nsTHashtable<nsUint64HashKey>&& TakeDependentSurfaces();
 
   /**
@@ -212,17 +211,16 @@ class DrawEventRecorderMemory : public D
   MemStream mIndex;
 
  protected:
   virtual ~DrawEventRecorderMemory(){};
 
  private:
   SerializeResourcesFn mSerializeCallback;
   nsTHashtable<nsUint64HashKey> mDependentSurfaces;
-  IntPoint mOrigin;
 
   void Flush() override;
 };
 
 }  // namespace gfx
 }  // namespace mozilla
 
 #endif /* MOZILLA_GFX_DRAWEVENTRECORDER_H_ */
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -656,18 +656,17 @@ struct DIGroup {
                 if (key.isNothing()) {
                   validFonts = false;
                   break;
                 }
                 BlobFont font = {key.value(), scaled};
                 aStream.write((const char*)&font, sizeof(font));
               }
               fonts = std::move(aScaledFonts);
-            },
-            mVisibleRect.ToUnknownRect().TopLeft());
+            });
 
     RefPtr<gfx::DrawTarget> dummyDt = gfx::Factory::CreateDrawTarget(
         gfx::BackendType::SKIA, gfx::IntSize(1, 1), format);
 
     RefPtr<gfx::DrawTarget> dt = gfx::Factory::CreateRecordingDrawTarget(
         recorder, dummyDt, mLayerBounds.ToUnknownRect());
     // Setup the gfxContext
     RefPtr<gfxContext> context = gfxContext::CreateOrNull(dt);
@@ -2258,18 +2257,17 @@ WebRenderCommandBuilder::GenerateFallbac
                   if (key.isNothing()) {
                     validFonts = false;
                     break;
                   }
                   BlobFont font = {key.value(), scaled};
                   aStream.write((const char*)&font, sizeof(font));
                 }
                 fonts = std::move(aScaledFonts);
-              },
-              visibleRect.ToUnknownRect().TopLeft());
+              });
       RefPtr<gfx::DrawTarget> dummyDt = gfx::Factory::CreateDrawTarget(
           gfx::BackendType::SKIA, gfx::IntSize(1, 1), format);
       RefPtr<gfx::DrawTarget> dt = gfx::Factory::CreateRecordingDrawTarget(
           recorder, dummyDt, visibleRect.ToUnknownRect());
       if (!fallbackData->mBasicLayerManager) {
         fallbackData->mBasicLayerManager =
             new BasicLayerManager(BasicLayerManager::BLM_INACTIVE);
       }
@@ -2490,18 +2488,17 @@ Maybe<wr::ImageMask> WebRenderCommandBui
                   validFonts = false;
                   break;
                 }
                 BlobFont font = {key.value(), scaled};
                 aStream.write((const char*)&font, sizeof(font));
               }
 
               fonts = std::move(aScaledFonts);
-            },
-            IntPoint(0, 0));
+            });
 
     RefPtr<DrawTarget> dummyDt = Factory::CreateDrawTarget(
         BackendType::SKIA, IntSize(1, 1), SurfaceFormat::A8);
     RefPtr<DrawTarget> dt = Factory::CreateRecordingDrawTarget(
         recorder, dummyDt, IntRect(IntPoint(0, 0), size));
 
     RefPtr<gfxContext> context = gfxContext::CreateOrNull(dt);
     MOZ_ASSERT(context);
--- a/gfx/layers/wr/WebRenderDrawEventRecorder.h
+++ b/gfx/layers/wr/WebRenderDrawEventRecorder.h
@@ -4,33 +4,32 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_LAYERS_WEBRENDERDRAWTARGETRECORDER_H
 #define MOZILLA_LAYERS_WEBRENDERDRAWTARGETRECORDER_H
 
 #include "mozilla/gfx/DrawEventRecorder.h"
 #include "mozilla/gfx/InlineTranslator.h"
 #include "mozilla/webrender/webrender_ffi.h"
-#include "mozilla/gfx/Point.h"
 
 namespace mozilla {
 namespace layers {
 
 struct BlobFont {
   wr::FontInstanceKey mFontInstanceKey;
   gfx::ReferencePtr mScaledFontPtr;
 };
 
 class WebRenderDrawEventRecorder final : public gfx::DrawEventRecorderMemory {
  public:
   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(WebRenderDrawEventRecorder, final)
 
   explicit WebRenderDrawEventRecorder(
-      const gfx::SerializeResourcesFn& aSerialize, gfx::IntPoint aOrigin)
-      : DrawEventRecorderMemory(aSerialize, aOrigin) {}
+      const gfx::SerializeResourcesFn& aSerialize)
+      : DrawEventRecorderMemory(aSerialize) {}
 
   void StoreSourceSurfaceRecording(gfx::SourceSurface* aSurface,
                                    const char* aReason) final;
 
  private:
   virtual ~WebRenderDrawEventRecorder() = default;
 };
 
--- a/gfx/webrender_bindings/src/moz2d_renderer.rs
+++ b/gfx/webrender_bindings/src/moz2d_renderer.rs
@@ -167,17 +167,16 @@ impl<'a> BufReader<'a> {
 ///  the data Vec
 ///  - we use indices/offsets instead of sizes to avoid having to deal with any
 ///  arithmetic that might overflow.
 struct BlobReader<'a> {
     /// The buffer of the blob.
     reader: BufReader<'a>,
     /// Where the buffer head is.
     begin: usize,
-    origin: IntPoint,
 }
 
 #[derive(PartialEq, Debug, Eq, Clone, Copy)]
 struct IntPoint {
     x: i32,
     y: i32
 }
 
@@ -198,19 +197,18 @@ struct Entry {
 
 impl<'a> BlobReader<'a> {
     /// Creates a new BlobReader for the given buffer.
     fn new(buf: &'a[u8]) -> BlobReader<'a> {
         // The offset of the index is at the end of the buffer.
         let index_offset_pos = buf.len()-(mem::size_of::<usize>() + mem::size_of::<IntPoint>());
         assert!(index_offset_pos < buf.len());
         let index_offset = unsafe { convert_from_bytes::<usize>(&buf[index_offset_pos..]) };
-        let origin = unsafe { convert_from_bytes(&buf[(index_offset_pos + mem::size_of::<usize>())..]) };
 
-        BlobReader { reader: BufReader::new(&buf[index_offset..index_offset_pos]), begin: 0, origin }
+        BlobReader { reader: BufReader::new(&buf[index_offset..index_offset_pos]), begin: 0}
     }
 
     /// Reads the next display item's metadata.
     fn read_entry(&mut self) -> Entry {
         let end = self.reader.read_usize();
         let extra_end = self.reader.read_usize();
         let bounds = self.reader.read_box();
         let ret = Entry { begin: self.begin, end, extra_end, bounds };
@@ -246,23 +244,22 @@ impl BlobWriter {
         // Write the bounds to the index.
         self.index.extend_from_slice(convert_to_bytes(&bounds.x1));
         self.index.extend_from_slice(convert_to_bytes(&bounds.y1));
         self.index.extend_from_slice(convert_to_bytes(&bounds.x2));
         self.index.extend_from_slice(convert_to_bytes(&bounds.y2));
     }
 
     /// Completes the blob image, producing a single buffer containing it.
-    fn finish(mut self, origin: IntPoint) -> Vec<u8> {
+    fn finish(mut self) -> Vec<u8> {
         // Append the index to the end of the buffer
         // and then append the offset to the beginning of the index.
         let index_begin = self.data.len();
         self.data.extend_from_slice(&self.index);
         self.data.extend_from_slice(convert_to_bytes(&index_begin));
-        self.data.extend_from_slice(convert_to_bytes(&origin));
         self.data
     }
 }
 
 #[derive(Debug, Eq, PartialEq, Clone, Copy, Ord, PartialOrd)]
 #[repr(C)]
 /// A two-points representation of a rectangle.
 struct Box2d {
@@ -456,17 +453,17 @@ fn merge_blob_images(old_buf: &[u8], new
     while old_reader.reader.reader.has_more() {
         let old = old_reader.reader.read_entry();
         dlog!("new bounds: {} {} {:?}", old.end, old.extra_end, old.bounds);
         //assert!(old.bounds.contained_by(&dirty_rect));
     }
 
     //assert!(old_reader.cache.is_empty());
 
-    let result = result.finish(new_reader.origin);
+    let result = result.finish();
     dump_index(&result);
     result
 }
 
 /// A font used by a blob image.
 #[repr(C)]
 #[derive(Copy, Clone)]
 struct BlobFont {