Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54baa3b1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add SurfaceFlinger phase offset to configStore"

parents b0ebfdeb eebc925d
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -16,6 +16,29 @@
package android.hardware.configstore@1.0;

interface ISurfaceFlingerConfigs {
    /*
     * The following two methods define (respectively):
     *
     * - The phase offset between hardware vsync and when apps are woken up by the
     *   Choreographer callback
     * - The phase offset between hardware vsync and when SurfaceFlinger wakes up
     *   to consume input
     *
     * Their values may be tuned to trade off between display pipeline latency (both
     * overall latency and the lengths of the app --> SF and SF --> display phases)
     * and frame delivery jitter (which typically manifests as "jank" or "jerkiness"
     * while interacting with the device). The default values must produce a
     * relatively low amount of jitter at the expense of roughly two frames of
     * app --> display latency, and unless significant testing is performed to avoid
     * increased display jitter (both manual investigation using systrace [1] and
     * automated testing using dumpsys gfxinfo [2] are recommended), they should not
     * be modified.
     *
     * [1] https://developer.android.com/studio/profile/systrace.html
     * [2] https://developer.android.com/training/testing/performance.html
     */
    vsyncEventPhaseOffsetNs() generates (OptionalInt64 value);
    vsyncSfEventPhaseOffsetNs() generates (OptionalInt64 value);

    useTripleFramebuffer() generates (OptionalBool value);
};
+10 −0
Original line number Diff line number Diff line
@@ -19,6 +19,16 @@ Return<void> SurfaceFlingerConfigs::vsyncEventPhaseOffsetNs(vsyncEventPhaseOffse
    return Void();
}

Return<void> SurfaceFlingerConfigs::vsyncSfEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) {
#ifdef SF_VSYNC_EVENT_PHASE_OFFSET_NS
    _hidl_cb({true, SF_VSYNC_EVENT_PHASE_OFFSET_NS});
    LOG(INFO) << "sfvsync event phase offset ns =  " << SF_VSYNC_EVENT_PHASE_OFFSET_NS;
#else
    _hidl_cb({false, 0});
#endif
    return Void();
}

Return<void> SurfaceFlingerConfigs::useTripleFramebuffer(useTripleFramebuffer_cb _hidl_cb) {
    bool value = false;
#ifdef USE_TRIPLE_FRAMEBUFFER
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ using ::android::sp;
struct SurfaceFlingerConfigs : public ISurfaceFlingerConfigs {
    // Methods from ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs follow.
    Return<void> vsyncEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) override;
    Return<void> vsyncSfEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) override;
    Return<void> useTripleFramebuffer(useTripleFramebuffer_cb _hidl_cb) override;

    // Methods from ::android::hidl::base::V1_0::IBase follow.
+4 −0
Original line number Diff line number Diff line
@@ -5,6 +5,10 @@ ifneq ($(VSYNC_EVENT_PHASE_OFFSET_NS),)
    LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=$(VSYNC_EVENT_PHASE_OFFSET_NS)
endif

ifneq ($(SF_VSYNC_EVENT_PHASE_OFFSET_NS),)
    LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=$(SF_VSYNC_EVENT_PHASE_OFFSET_NS)
endif

ifeq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),3)
    LOCAL_CFLAGS += -DUSE_TRIPLE_FRAMEBUFFER
endif