Project Silk

From MozillaWiki
Jump to: navigation, search


The objective of Project Silk is to provide smoother scrolling and animation on B2G. To achieve the goal, it aligns HW Vsync signals among input, content painting and composition modules. Proper docs are at An easier to read version is at

Porting Issue

In silk, there are only two platform dependent objects, which are platform vsync timer and InputDispatcher.

In a word, if you want to enable project silk on a specific platform, things need to be done are

  • Constructing a concrete implementation of PlatformVsyncTimer interface
  • An InputDispatcher instance which is inherit from VsyncObserver
  • TBD: (object creation)

Testing Plan


  • Test manually
    • With automatic script or tool
    • Scroll
      • Show we get a smooth position with time
    • OMTA
      • Check b2g always composes done before next vsync
    • requestAnimationFrame
      • Check we get a better timestamp for animation

Unit test

  • VsyncDispatcher
    • Registry - vsync listener should be able to receive sync-notification steadily after registry.
    • Unregistry - vsync listener should not receive any vync notification after synchronize unregistry from VsyncDispatcher

Integration test

  • First paint - have a test case to make sure we do not break first-paint.



  • requestAnimationFrame, WebGL
  • OMTA test
  • scrollable layer

Running the mochitest

There is a builtin mochitest that requires APZ and e10s enabled which generates native touch events and scrolls a test webpage. It then calculates the frame uniformity of each scrollable layer. You can run it with:

./mach mochitest --e10s --setpref=layers.async-pan-zoom.enabled=true gfx/layers/apz/test/test_smoothness.html

On OS X, the frame uniformity value should be < 2, with 0 being perfect. On Windows, it should be < 4. The values are only valid on platforms with hardware vsync.

Project Silk Discussion at Taipei Workweek

Project Silk



No results.

0 Total; 0 Open (0%); 0 Resolved (0%); 0 Verified (0%);


Full Query
ID Priority Summary Status Assigned to Target milestone Last change time
930939 P1 Separate the threads that run gecko and that receive input events from the OS RESOLVED Kartikaya Gupta ( mozilla38 2018-10-31T13:12:35Z
980241 P2 Vsync-triggered RefreshDriver RESOLVED Jerry Shih[:jerry] (UTC+8) (inactive) --- 2014-06-12T18:07:26Z
982972 P2 investigate using RT priority in compositor on gonk RESOLVED Mason Chang [Inactive] [:mchang] --- 2014-08-15T00:11:44Z
987523 P2 Vsync-triggered CompositorParent RESOLVED Jerry Shih[:jerry] (UTC+8) (inactive) --- 2015-01-29T14:26:00Z
987527 P1 Register Vsync monitor to HWComposer RESOLVED Boris Chiou [:boris] 2.1 S3 (29aug) 2018-10-31T13:12:35Z
987529 P1 Integrate vsync dispatcher on B2G RESOLVED Jerry Shih[:jerry] (UTC+8) (inactive) 2.1 S4 (12sep) 2018-10-31T13:12:35Z
990832 P1 Build a tool to Visualize Frame Uniformity with ScrollGraph Output RESOLVED Jinho Hwang [:jeffhwang] mozilla33 2014-08-20T17:42:53Z
991420 P1 (silk) IPC Shows 1-2ms latency sending message from b2g to content process and b2g main thread to composite thread RESOLVED Mason Chang [Inactive] [:mchang] 2.0 S4 (20june) 2015-01-29T01:23:23Z
991483 -- Vsync-triggered GeckoInputDispatcher RESOLVED Jinho Hwang [:jeffhwang] --- 2018-10-31T13:12:35Z
1035076 P2 Measure vsync event latency between VsyncDispatcher and other modules in Project Silk RESOLVED Jerry Shih[:jerry] (UTC+8) (inactive) 2.1 S5 (26sep) 2015-01-29T14:49:24Z
1042017 P3 Re-Examine the APZ kinetic Scroll Friction Animation RESOLVED Mason Chang [Inactive] [:mchang] --- 2014-11-11T17:39:43Z
1043822 P2 Support SW Vsync and combine it with HW Vsync RESOLVED Boris Chiou [:boris] 2.1 S3 (29aug) 2018-10-31T13:12:35Z
1048667 P1 Implement Vsync dispatch framework RESOLVED Jerry Shih[:jerry] (UTC+8) (inactive) 2.1 S2 (15aug) 2018-10-31T13:12:35Z
1062117 -- Support the priority change for VsyncDispatcher RESOLVED Boris Chiou [:boris] --- 2018-10-31T13:12:35Z
1062331 -- Turn on by default touch event smoothing with gfx.frameuniformity.hw-vsync and gfx.touch.resample RESOLVED Mason Chang [Inactive] [:mchang] mozilla38 2018-10-31T13:12:35Z
1072627 P1 Hardware Composer Vsync Events aren't stable RESOLVED Mason Chang [Inactive] [:mchang] --- 2018-10-31T13:12:35Z
1073545 -- Add Vsync Markers to SPS Profiler RESOLVED Mason Chang [Inactive] [:mchang] mozilla35 2014-10-06T13:48:12Z
1073704 -- Input touch resampling is broken RESOLVED Michael Wu [:mwu] mozilla35 2018-10-31T13:12:35Z
1078136 -- Tune the thread priority for VsyncDispatcher thread RESOLVED --- 2018-10-31T13:12:35Z
1078152 P2 Provide performance label for frame uniformity RESOLVED Jerry Shih[:jerry] (UTC+8) (inactive) --- 2018-03-02T21:34:10Z
1078160 -- Provide an automatic testing environment for QA to check the project silk performance RESOLVED --- 2015-03-25T02:43:27Z
1078168 P3 Measure "where is my water" game overall performance with project silk RESOLVED --- 2015-12-14T06:01:05Z
1078171 P3 Measure "cut the rope" game overall performance with project silk RESOLVED --- 2015-12-14T06:00:56Z
1083530 -- Refactor GeckoTouchDispatcher to use mozilla::TimeStamp instead of nsecs_t for vsync times RESOLVED Mason Chang [Inactive] [:mchang] mozilla36 2018-10-31T13:12:35Z
1092245 -- Create a benchmark to measure refresh driver alignment to vsync and detect regressions RESOLVED Mason Chang [Inactive] [:mchang] --- 2017-01-30T16:53:10Z
1092978 P1 Integrate refresh driver for silk RESOLVED Jerry Shih[:jerry] (UTC+8) (inactive) mozilla38 2015-01-29T01:22:03Z
1094760 -- Compositor will sleep for a long time during composing if we align composing and refresh driver tick with vsync RESOLVED Jerry Shih[:jerry] (UTC+8) (inactive) --- 2015-04-08T01:46:04Z
1095242 -- Disable Vsync When Idle RESOLVED Mason Chang [Inactive] [:mchang] mozilla38 2015-02-22T14:59:55Z
1098701 -- [Silk] Gtest for project Silk RESOLVED Mason Chang [Inactive] [:mchang] mozilla38 2015-01-25T05:32:44Z
1101974 P1 Create a single VsyncDisptacher per nsBaseWidget RESOLVED Mason Chang [Inactive] [:mchang] mozilla37 2014-12-19T15:30:03Z
1102200 -- Composing time becomes much longer randomly when we unplug the usb cable on flame-kk device RESOLVED --- 2022-05-30T19:26:41Z
1102631 -- Create a software vsync timer RESOLVED Mason Chang [Inactive] [:mchang] --- 2016-07-26T21:48:15Z
1117870 -- Let the CompositorVsyncObserver unobserve vsync after a configurable number of vsyncs have passed RESOLVED Mason Chang [Inactive] [:mchang] mozilla37 2022-01-03T17:02:05Z
1118530 -- [meta] Turn on by default hardware vsync and the Vsync Aligned Compositor on b2g RESOLVED Mason Chang [Inactive] [:mchang] mozilla38 2015-07-18T14:29:51Z
1123734 -- Notify global VsyncSource in hwc RESOLVED Jerry Shih[:jerry] (UTC+8) (inactive) mozilla38 2018-10-31T13:12:35Z
1123762 -- [META] Turn on vsync-aligned refresh driver by default on b2g RESOLVED Mason Chang [Inactive] [:mchang] mozilla39 2022-06-01T22:16:00Z
1130678 -- dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html intermittent with vsync refresh driver RESOLVED Mason Chang [Inactive] [:mchang] mozilla38 2022-06-01T22:14:38Z
1139253 -- Reuse the same thread when we start/stop vsync event for software vsync timer RESOLVED Jerry Shih[:jerry] (UTC+8) (inactive) 2.2 S8 (20mar) 2015-03-10T02:04:26Z

38 Total; 0 Open (0%); 38 Resolved (100%); 0 Verified (0%);


Platform supporting plan 
We are going to support Firefox OS first and extend this framework to other platforms after.
Can Silk improve rendering performance?
What version of Android is required?
We need Kit-Kat or greater. Jelly Bean and ICS are NOT supported.