Bug 1368496 - Expose the push_clip_and_scroll_info API in WR via WebRenderAPI. r=jrmuizel
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 08 Jun 2017 11:34:01 -0400
changeset 363029 c48397f4c2e2c2b8152abc7370bc615047130de3
parent 363028 fd266694b1f8a5d81ce30382bde54d505139329e
child 363030 dcffcfdf03ad254ae04b91fe6b230cd455723f7a
push id31994
push usercbook@mozilla.com
push dateFri, 09 Jun 2017 10:56:24 +0000
treeherdermozilla-central@7c9d96bbc400 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1368496
milestone55.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 1368496 - Expose the push_clip_and_scroll_info API in WR via WebRenderAPI. r=jrmuizel MozReview-Commit-ID: f8gIDoUDC1
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/WebRenderAPI.h
gfx/webrender_bindings/src/bindings.rs
gfx/webrender_bindings/webrender_ffi_generated.h
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -619,16 +619,32 @@ void
 DisplayListBuilder::PopScrollLayer()
 {
   WRDL_LOG("PopScrollLayer id=%" PRIu64 "\n", mScrollIdStack.back());
   mScrollIdStack.pop_back();
   wr_dp_pop_scroll_layer(mWrState);
 }
 
 void
+DisplayListBuilder::PushClipAndScrollInfo(const layers::FrameMetrics::ViewID& aScrollId,
+                                          const uint64_t* aClipId)
+{
+  WRDL_LOG("PushClipAndScroll s=%" PRIu64 " c=%s\n", aScrollId,
+      aClipId ? Stringify(*aClipId).c_str() : "none");
+  wr_dp_push_clip_and_scroll_info(mWrState, aScrollId, aClipId);
+}
+
+void
+DisplayListBuilder::PopClipAndScrollInfo()
+{
+  WRDL_LOG("PopClipAndScroll\n");
+  wr_dp_pop_clip_and_scroll_info(mWrState);
+}
+
+void
 DisplayListBuilder::PushRect(const WrRect& aBounds,
                              const WrClipRegionToken aClip,
                              const WrColor& aColor)
 {
   WRDL_LOG("PushRect b=%s c=%s\n",
       Stringify(aBounds).c_str(),
       Stringify(aColor).c_str());
   wr_dp_push_rect(mWrState, aBounds, aClip, aColor);
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -162,16 +162,19 @@ public:
 
   void PushBuiltDisplayList(wr::BuiltDisplayList dl);
 
   void PushScrollLayer(const layers::FrameMetrics::ViewID& aScrollId,
                        const WrRect& aContentRect, // TODO: We should work with strongly typed rects
                        const WrRect& aClipRect);
   void PopScrollLayer();
 
+  void PushClipAndScrollInfo(const layers::FrameMetrics::ViewID& aScrollId,
+                             const uint64_t* aClipId);
+  void PopClipAndScrollInfo();
 
   void PushRect(const WrRect& aBounds,
                 const WrClipRegionToken aClip,
                 const WrColor& aColor);
 
   void PushLinearGradient(const WrRect& aBounds,
                           const WrClipRegionToken aClip,
                           const WrPoint& aStartPoint,
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -1381,16 +1381,38 @@ pub extern "C" fn wr_scroll_layer_with_i
                                           scroll_id: u64,
                                           new_scroll_origin: WrPoint) {
     assert!(unsafe { is_in_compositor_thread() });
     let clip_id = ClipId::new(scroll_id, pipeline_id);
     api.scroll_node_with_id(new_scroll_origin.into(), clip_id, ScrollClamping::NoClamping);
 }
 
 #[no_mangle]
+pub extern "C" fn wr_dp_push_clip_and_scroll_info(state: &mut WrState,
+                                                  scroll_id: u64,
+                                                  clip_id: *const u64) {
+    assert!(unsafe { is_in_main_thread() });
+    let scroll_id = ClipId::new(scroll_id, state.pipeline_id);
+    let info = if let Some(&id) = unsafe { clip_id.as_ref() } {
+        ClipAndScrollInfo::new(
+            scroll_id,
+            ClipId::Clip(id, state.pipeline_id))
+    } else {
+        ClipAndScrollInfo::simple(scroll_id)
+    };
+    state.frame_builder.dl_builder.push_clip_and_scroll_info(info);
+}
+
+#[no_mangle]
+pub extern "C" fn wr_dp_pop_clip_and_scroll_info(state: &mut WrState) {
+    assert!(unsafe { is_in_main_thread() });
+    state.frame_builder.dl_builder.pop_clip_id();
+}
+
+#[no_mangle]
 pub extern "C" fn wr_dp_push_iframe(state: &mut WrState,
                                     rect: WrRect,
                                     clip: WrClipRegionToken,
                                     pipeline_id: WrPipelineId) {
     assert!(unsafe { is_in_main_thread() });
 
     state.frame_builder.dl_builder.push_iframe(rect.into(), clip.into(), pipeline_id);
 }
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -650,16 +650,20 @@ WR_INLINE
 void wr_dp_end(WrState *aState)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_pop_clip(WrState *aState)
 WR_FUNC;
 
 WR_INLINE
+void wr_dp_pop_clip_and_scroll_info(WrState *aState)
+WR_FUNC;
+
+WR_INLINE
 void wr_dp_pop_scroll_layer(WrState *aState)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_pop_stacking_context(WrState *aState)
 WR_FUNC;
 
 WR_INLINE
@@ -733,16 +737,22 @@ WR_FUNC;
 
 WR_INLINE
 uint64_t wr_dp_push_clip(WrState *aState,
                          WrRect aClipRect,
                          const WrImageMask *aMask)
 WR_FUNC;
 
 WR_INLINE
+void wr_dp_push_clip_and_scroll_info(WrState *aState,
+                                     uint64_t aScrollId,
+                                     const uint64_t *aClipId)
+WR_FUNC;
+
+WR_INLINE
 WrClipRegionToken wr_dp_push_clip_region(WrState *aState,
                                          WrRect aMain,
                                          const WrComplexClipRegion *aComplex,
                                          size_t aComplexCount,
                                          const WrImageMask *aImageMask)
 WR_FUNC;
 
 WR_INLINE