summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2016-11-10 22:15:49 -0500
committerRobert Foss <robert.foss@collabora.com>2017-03-22 14:38:44 -0400
commit2128d10775f4a08fd9ea05674420b7caf3d078e4 (patch)
tree08b7ef997c83390acd50488c397d177d316aa6c3
parent11676ef0438667b8a7b31943d17e1e267dc640a0 (diff)
downloaddrm_hwcomposer-2128d10775f4a08fd9ea05674420b7caf3d078e4.tar.gz
drm_hwcomposer-2128d10775f4a08fd9ea05674420b7caf3d078e4.tar.xz
drm_hwcomposer: Add InitRoutine to Worker
Due to Routine needing to be initialised seperately from the Init() call, provide a seperate init call to be run before Routine(). Change-Id: I0ea4f6105b0dbeeebb850859c5125e0535e55826 Sign-off-by: Robert Foss <robert.foss@collabora.com>
-rw-r--r--drmeventlistener.h1
-rw-r--r--vsyncworker.h1
-rw-r--r--worker.cpp2
-rw-r--r--worker.h1
4 files changed, 5 insertions, 0 deletions
diff --git a/drmeventlistener.h b/drmeventlistener.h
index 61eefe8..b4a3344 100644
--- a/drmeventlistener.h
+++ b/drmeventlistener.h
@@ -48,6 +48,7 @@ class DrmEventListener : public Worker {
unsigned int tv_usec, void *user_data);
protected:
+ void InitRoutine(){};
virtual void Routine();
private:
diff --git a/vsyncworker.h b/vsyncworker.h
index a1ba1a5..f629adc 100644
--- a/vsyncworker.h
+++ b/vsyncworker.h
@@ -46,6 +46,7 @@ class VSyncWorker : public Worker {
int VSyncControl(bool enabled);
protected:
+ void InitRoutine(){};
void Routine() override;
private:
diff --git a/worker.cpp b/worker.cpp
index 1cebedc..3740c8e 100644
--- a/worker.cpp
+++ b/worker.cpp
@@ -166,6 +166,8 @@ void *Worker::InternalRoutine(void *arg) {
setpriority(PRIO_PROCESS, 0, worker->priority_);
+ worker->InitRoutine();
+
while (true) {
int ret = worker->Lock();
if (ret) {
diff --git a/worker.h b/worker.h
index 7015178..d33b83f 100644
--- a/worker.h
+++ b/worker.h
@@ -44,6 +44,7 @@ class Worker {
bool initialized() const;
+ virtual void InitRoutine() = 0;
virtual void Routine() = 0;
/*