| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 [DartPackage="mojo_services"] | 5 [DartPackage="mojo_services"] |
| 6 module mojo.gfx.composition; | 6 module mojo.gfx.composition; |
| 7 | 7 |
| 8 // Provides support for scheduling drawing and composition operations | 8 // Provides support for scheduling drawing and composition operations. |
| 9 // for a particular scene. | |
| 10 // | 9 // |
| 11 // Instances of this interface must be obtained from a |Scene|. This interface | 10 // Instances of this interface must be obtained from a |Scene| or |Renderer|. |
| 12 // is modeled separately so as to allow applications to use different threads | 11 interface FrameScheduler { |
| 13 // for scheduling work as opposed to publishing scene updates. | |
| 14 interface SceneScheduler { | |
| 15 // Asks the compositor to invoke the callback when it is a good time to | 12 // Asks the compositor to invoke the callback when it is a good time to |
| 16 // draw the next frame. | 13 // draw the next frame. |
| 17 // | 14 // |
| 18 // The rate at which the callback is invoked may depend on how the scene | 15 // The rate at which the callback is invoked may depend on how the scene |
| 19 // has been embedded. The scene will only receive frame callbacks while | 16 // has been embedded. The scene will only receive frame callbacks while |
| 20 // it is attached to a scene graph which the compositor has been asked | 17 // it is attached to a scene graph which the compositor has been asked |
| 21 // to renderer since timing information ultimately derives from the | 18 // to render since timing information ultimately derives from the |
| 22 // renderer. If the same scene is being rendered to multiple destinations | 19 // renderer. If the same scene is being rendered to multiple destinations |
| 23 // with different timing requirements, the compositor will perform rate | 20 // with different timing requirements, the compositor will couple the |
| 24 // adaptation as required behind the scenes. | 21 // scene scheduling to one of the renderers. |
| 25 // | 22 // |
| 26 // The returned |frame_info| provides information about the frame to | 23 // The returned |frame_info| provides information about the frame to |
| 27 // be drawn. | 24 // be drawn. This information should be passed to a |
| 25 // |mojo::gfx::composition::FrameTracker| to apply compensation for |
| 26 // skipped frames before using it. |
| 28 // | 27 // |
| 29 // TODO(jeffbrown): Consider whether we should have the callback be invoked | 28 // TODO(jeffbrown): Consider whether we should have the callback be invoked |
| 30 // immediately rather than on schedule, letting the client set its own | 29 // immediately rather than on schedule, letting the client set its own |
| 31 // timers. Advantage may be a reduction in latency due to the elimination | 30 // timers. Advantage may be a reduction in latency due to the elimination |
| 32 // of an IPC on a timing critical path. Disadvantage may be an increase | 31 // of an IPC on a timing critical path. Disadvantage may be an increase |
| 33 // in the number of context switches and some extra client side bookkeeping. | 32 // in the number of context switches and some extra client side bookkeeping. |
| 34 // Note that although clients could predict future frame times based on the | 33 // Note that although clients could predict future frame times based on the |
| 35 // reported information, it's still better for them to schedule each frame | 34 // reported information, it's still better for them to schedule each frame |
| 36 // individually so they stay in sync with one another and quickly catch | 35 // individually so they stay in sync with one another and quickly catch |
| 37 // up to any changes in timing. This also gives the compositor more | 36 // up to any changes in timing. This also gives the compositor more |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // A timestamp indicating approximately when the contents of the frame | 87 // A timestamp indicating approximately when the contents of the frame |
| 89 // will be shown on the display output assuming everything is fully rendered | 88 // will be shown on the display output assuming everything is fully rendered |
| 90 // and submitted by the indicated |frame_deadline|. | 89 // and submitted by the indicated |frame_deadline|. |
| 91 // | 90 // |
| 92 // This value monotonically increases with each frame, never repeats, and | 91 // This value monotonically increases with each frame, never repeats, and |
| 93 // is guaranteed to be no less than |frame_deadline|. | 92 // is guaranteed to be no less than |frame_deadline|. |
| 94 // | 93 // |
| 95 // Expressed in microseconds in the |MojoTimeTicks| timebase. | 94 // Expressed in microseconds in the |MojoTimeTicks| timebase. |
| 96 int64 presentation_time; | 95 int64 presentation_time; |
| 97 }; | 96 }; |
| OLD | NEW |