hwc: Set real time priority to gl threads.
CRs-Fixed: 2646317
Change-Id: I2c3d984006f7b9779eb8d0c8d83bbc04734a1ecf
diff --git a/composer/gl_color_convert_impl.cpp b/composer/gl_color_convert_impl.cpp
index 119fffc..60c7a40 100644
--- a/composer/gl_color_convert_impl.cpp
+++ b/composer/gl_color_convert_impl.cpp
@@ -148,6 +148,8 @@
ctx_.program_id = LoadProgram(1, &kVertexShader, count, fragment_shaders);
+ SetRealTimePriority();
+
return 0;
}
diff --git a/composer/gl_common.cpp b/composer/gl_common.cpp
index 4524867..4d4744d 100644
--- a/composer/gl_common.cpp
+++ b/composer/gl_common.cpp
@@ -173,5 +173,14 @@
image_wrapper_.Init();
}
+void GLCommon::SetRealTimePriority() {
+ // same as composer thread
+ struct sched_param param = {0};
+ param.sched_priority = 2;
+ if (sched_setscheduler(0, SCHED_FIFO | SCHED_RESET_ON_FORK, ¶m) != 0) {
+ DLOGE("Couldn't set SCHED_FIFO: %d", errno);
+ }
+}
+
} // namespace sdm
diff --git a/composer/gl_common.h b/composer/gl_common.h
index eda2d49..31961e6 100644
--- a/composer/gl_common.h
+++ b/composer/gl_common.h
@@ -65,6 +65,7 @@
virtual int WaitOnInputFence(const shared_ptr<Fence> &in_fence);
virtual int CreateOutputFence(shared_ptr<Fence> *out_fence);
virtual void ClearCache();
+ virtual void SetRealTimePriority();
protected:
virtual ~GLCommon() { }
diff --git a/composer/gl_layer_stitch_impl.cpp b/composer/gl_layer_stitch_impl.cpp
index af83ab8..b0d6171 100644
--- a/composer/gl_layer_stitch_impl.cpp
+++ b/composer/gl_layer_stitch_impl.cpp
@@ -127,6 +127,8 @@
ctx_.program_id = LoadProgram(1, &kVertexShader1, count, fragment_shaders);
+ SetRealTimePriority();
+
return 0;
}