Make cbks_ const as set in the constructor. Add a new kExitThread state
to indicate that the thread should exit.
This reduces the amount of state that needs to be synchronized across
threads and the amount of member variables that control state flow.
Change-Id: Ic99dd7ab153939bfa2d971985799413b212a999e
There is no need for this to be public since it is called from the
destructor, and any public usage of it was immediately before
destructing the FlatteningController
Change-Id: Ice233feaa9b934e7385ac83769250fea33f9140c
- Move member function implementations to the .cpp file.
- Rename Disable -> DisableFlattening
- Update comments for functions
Change-Id: I71eec96597a0d41f652b897c1862a34138b5be85
FlatteningController is owned by HwcDisplay, so use a unique_ptr to
better control and indicate the ownership.
Remove the CreateInstance factory method and use std::make_unique
instead.
Change-Id: I0155c602dcf5a31d27fd2677f9f96ff9696a4022
Use an enum to track the different possible states of the
FlatteningController rather than a collection of bools.
Change-Id: I6136fd8f57a4033a10798f932a952951a01707b7
Annotate the state that is access across multiple threads. Add locks in
appropriate scopes as necessary.
Change-Id: I05ca1054b4836b72c6efb3fd2bf241d4958e3252
Under the previous behavior, NewFrame both updated the internal state
tracking to indicate that the scene is not idle, as well as returning a
bool to indicate whether the scene should be flattened or not.
ShouldFlatten was not being used, and would return `true` during the
interval between the refresh callback being triggered and the next
NewFrame, which would be in response to the refresh callback. Subsequent
calls to ShouldFlatten would return `false` even though the scene
remains idle.
This commit updates NewFrame to only update the internal state. Callers
should call ShouldFlatten to check whether the controller has detected
that the scene should be flattened.
After the callback is triggered, ShouldFlatten returns true. It will
continue to return true after the first NewFrame, which would be in
response to the refresh callback. Subsequent NewFrame calls will reset
the idle detection.
Change-Id: I8b11a55bb6b101bb2ce473a844f5b9795a027956
Pass a timeout to the FlatteningController constructor. Move the
original default timeout from FlatteningController to HwcDisplay.cpp
Change-Id: I6e3f8950badc38a5ccad8ae68e1b11317c850d61
Ensure that the thread has stopped and has stopped executing before
destructing the FlatteningController.
Change-Id: I32c631cbbfffc99dbd6c6b65bf1e86b670eca171
Using vsync means consume some CPU time every frame for
IRQ -> Kernel_Thread -> UserSpace_listener thread transitions.
Framework tries to reduce vsync usage to the minimum, by using timelines
instead.
New flattening controller thread wakes-up only once per second.
This commit also removes flattening info from dumpsys. Practice shows
that it is almost useless. Instead debugging can be done using ALOGV
dumps.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>