1
0
Fork 0
Commit graph

13 commits

Author SHA1 Message Date
Andrew Wolfers
a890ccd62f Add atom reporting for flattening controller state
Change-Id: I09f60c95519d844359d5f1c70b940b47f756da21
2025-11-06 15:30:45 +00:00
Drew Davenport
f61371b260 drm_hwcomposer: Don't reset callbacks in FlatteningController
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
2025-09-19 17:36:33 -06:00
Drew Davenport
9876f33138 drm_hwcomposer: Make FlatteningController::StopThread private
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
2025-09-19 17:36:33 -06:00
Drew Davenport
d2ccec310e drm_hwcomposer: No-op FlatteningController cleanup
- Move member function implementations to the .cpp file.
- Rename Disable -> DisableFlattening
- Update comments for functions

Change-Id: I71eec96597a0d41f652b897c1862a34138b5be85
2025-09-19 17:36:33 -06:00
Drew Davenport
6075ab4596 drm_hwcomposer: Use unique_ptr for FlatteningController
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
2025-09-19 16:58:58 -06:00
Drew Davenport
23e38a1033 drm_hwcomposer: Refactor state tracking in FlatteningController
Use an enum to track the different possible states of the
FlatteningController rather than a collection of bools.

Change-Id: I6136fd8f57a4033a10798f932a952951a01707b7
2025-09-19 16:58:46 -06:00
Drew Davenport
ccd7ca17c5 drm_hwcomposer: Add thread annotations to FlatteningController
Annotate the state that is access across multiple threads. Add locks in
appropriate scopes as necessary.

Change-Id: I05ca1054b4836b72c6efb3fd2bf241d4958e3252
2025-09-19 16:57:31 -06:00
Drew Davenport
2432cb0dfa drm_hwcomposer: Update FlatteningController behavior
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
2025-09-19 16:56:55 -06:00
Drew Davenport
ce65d6c6e3 drm_hwcomposer: Make FlatteningController timeout configurable
Pass a timeout to the FlatteningController constructor. Move the
original default timeout from FlatteningController to HwcDisplay.cpp

Change-Id: I6e3f8950badc38a5ccad8ae68e1b11317c850d61
2025-09-19 16:54:55 -06:00
Drew Davenport
38045be8af drm_hwcomposer: Add FlatteningController constructor args
Add a constructor that takes the callbacks and initialize the callbacks
in the constructor.

Change-Id: Id7a64fc23819e913a75753035f18fca2c81ce034
2025-09-19 16:54:54 -06:00
Andrew Wolfers
9255d0d10b drm_hwcomposer: Migrate to android::drm_hwcomposer namespace
Change-Id: I2859aa8f55532d88231389724956fc77b0625339
2025-09-08 18:53:00 +00:00
Drew Davenport
199e090920 drm_hwcomposer: Join FlatteningController in destructor
Ensure that the thread has stopped and has stopped executing before
destructing the FlatteningController.

Change-Id: I32c631cbbfffc99dbd6c6b65bf1e86b670eca171
2025-07-16 17:49:31 -06:00
Roman Stratiienko
22fe9617da drm_hwcomposer: Make flattening thread-based instead of vsync-based
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>
2023-01-18 19:25:08 +02:00