drm_hwcomposer: Add FlatteningController constructor args
Add a constructor that takes the callbacks and initialize the callbacks in the constructor. Change-Id: Id7a64fc23819e913a75753035f18fca2c81ce034
This commit is contained in:
parent
ac727c57ae
commit
38045be8af
2 changed files with 13 additions and 14 deletions
|
|
@ -39,18 +39,12 @@ namespace android::drm_hwcomposer {
|
|||
|
||||
auto FlatteningController::CreateInstance(FlatConCallbacks &cbks)
|
||||
-> std::shared_ptr<FlatteningController> {
|
||||
auto fc = std::shared_ptr<FlatteningController>(new FlatteningController());
|
||||
return std::shared_ptr<FlatteningController>(new FlatteningController(cbks));
|
||||
}
|
||||
|
||||
/* Disable the controller by default as it can cause refresh event to be
|
||||
* issued at creation time, even when it is not required. This can fail VTS
|
||||
* tests at teardown that check for this behaviour. See:
|
||||
* https://cs.android.com/android/platform/superproject/main/+/cedca652b903e4f4e584e457b5a7038e0825fb94:hardware/interfaces/graphics/composer/aidl/vts/VtsComposerClient.cpp;drc=a2a6deaf5036e081f48379b6573db4465538b5ac;l=604
|
||||
*/
|
||||
fc->Disable();
|
||||
fc->cbks_ = cbks;
|
||||
fc->thread_ = std::thread(&FlatteningController::ThreadFn, fc.get());
|
||||
|
||||
return fc;
|
||||
FlatteningController::FlatteningController(FlatConCallbacks callbacks)
|
||||
: cbks_(std::move(callbacks)) {
|
||||
thread_ = std::thread(&FlatteningController::ThreadFn, this);
|
||||
}
|
||||
|
||||
/* Compositor should call this every frame */
|
||||
|
|
|
|||
|
|
@ -61,11 +61,16 @@ class FlatteningController {
|
|||
static constexpr auto kTimeout = 1s;
|
||||
|
||||
private:
|
||||
FlatteningController() = default;
|
||||
explicit FlatteningController(FlatConCallbacks callbacks);
|
||||
void ThreadFn();
|
||||
|
||||
bool flatten_next_frame_{};
|
||||
bool disabled_{};
|
||||
/* Disable the controller by default as it can cause refresh event to be
|
||||
* issued at creation time, even when it is not required. This can fail VTS
|
||||
* tests at teardown that check for this behaviour. See:
|
||||
* https://cs.android.com/android/platform/superproject/main/+/cedca652b903e4f4e584e457b5a7038e0825fb94:hardware/interfaces/graphics/composer/aidl/vts/VtsComposerClient.cpp;drc=a2a6deaf5036e081f48379b6573db4465538b5ac;l=604
|
||||
*/
|
||||
bool flatten_next_frame_ = false;
|
||||
bool disabled_ = true;
|
||||
decltype(std::chrono::system_clock::now()) sleep_until_{};
|
||||
std::thread thread_;
|
||||
std::mutex mutex_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue