summaryrefslogtreecommitdiff
path: root/vsyncworker.h
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2016-02-10 10:00:08 -0800
committerRobert Foss <robert.foss@collabora.com>2017-02-28 13:53:06 -0500
commita5df1defa12bc38ed2e5c9cb2fdef85fe7ea0cd7 (patch)
tree818eb50bdc149a05007a939b117d47c986335457 /vsyncworker.h
parent8600e347e14b42872b1c2762d51b27102ddc40f9 (diff)
drm_hwcomposer: Don't pass hwc_procs_t to VsyncWorker
Introduce a new class to limit the hwc_procs_t callback structure scope to hwcomposer.cpp Change-Id: I68ec62e7947ca87702b3d6d0169ae850cfbf5d85 Signed-off-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Robert Foss <robert.foss@collabora.com>
Diffstat (limited to 'vsyncworker.h')
-rw-r--r--vsyncworker.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/vsyncworker.h b/vsyncworker.h
index 98ac546..a1ba1a5 100644
--- a/vsyncworker.h
+++ b/vsyncworker.h
@@ -28,13 +28,20 @@
namespace android {
+class VsyncCallback {
+ public:
+ virtual ~VsyncCallback() {
+ }
+ virtual void Callback(int display, int64_t timestamp) = 0;
+};
+
class VSyncWorker : public Worker {
public:
VSyncWorker();
~VSyncWorker() override;
int Init(DrmResources *drm, int display);
- int SetProcs(hwc_procs_t const *procs);
+ int RegisterCallback(std::shared_ptr<VsyncCallback> callback);
int VSyncControl(bool enabled);
@@ -46,7 +53,11 @@ class VSyncWorker : public Worker {
int SyntheticWaitVBlank(int64_t *timestamp);
DrmResources *drm_;
- hwc_procs_t const *procs_;
+
+ // shared_ptr since we need to use this outside of the thread lock (to
+ // actually call the hook) and we don't want the memory freed until we're
+ // done
+ std::shared_ptr<VsyncCallback> callback_ = NULL;
int display_;
bool enabled_;