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

Commit 31d2843b authored by Mathias Agopian's avatar Mathias Agopian
Browse files

Add HWC vsync hook. Currently unused.

Change-Id: I849d56f375813a044c5e2d0b25f791476a60fa01
parent 9b712211
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -53,7 +53,9 @@ HWComposer::HWComposer(const sp<SurfaceFlinger>& flinger)
            if (mHwc->registerProcs) {
                mCBContext.hwc = this;
                mCBContext.procs.invalidate = &hook_invalidate;
                mCBContext.procs.vsync = &hook_vsync;
                mHwc->registerProcs(mHwc, &mCBContext.procs);
                memset(mCBContext.procs.zero, 0, sizeof(mCBContext.procs.zero));
            }
        }
    }
@@ -74,10 +76,17 @@ void HWComposer::hook_invalidate(struct hwc_procs* procs) {
    reinterpret_cast<cb_context *>(procs)->hwc->invalidate();
}

void HWComposer::hook_vsync(struct hwc_procs* procs, int dpy, int64_t timestamp) {
    reinterpret_cast<cb_context *>(procs)->hwc->vsync(dpy, timestamp);
}

void HWComposer::invalidate() {
    mFlinger->repaintEverything();
}

void HWComposer::vsync(int dpy, int64_t timestamp) {
}

void HWComposer::setFrameBuffer(EGLDisplay dpy, EGLSurface sur) {
    mDpy = (hwc_display_t)dpy;
    mSur = (hwc_surface_t)sur;
+13 −1
Original line number Diff line number Diff line
@@ -72,12 +72,24 @@ public:
            const Vector< sp<LayerBase> >& visibleLayersSortedByZ) const;

private:

    struct callbacks : public hwc_procs_t {
        // these are here to facilitate the transition when adding
        // new callbacks (an implementation can check for NULL before
        // calling a new callback).
        void (*zero[4])(void);
    };

    struct cb_context {
        hwc_procs_t procs;
        callbacks procs;
        HWComposer* hwc;
    };

    static void hook_invalidate(struct hwc_procs* procs);
    static void hook_vsync(struct hwc_procs* procs, int dpy, int64_t timestamp);

    void invalidate();
    void vsync(int dpy, int64_t timestamp);

    sp<SurfaceFlinger>      mFlinger;
    hw_module_t const*      mModule;