1
0
Fork 0

Merge remote-tracking branch 'freedesktop/main' into android-16.0

This commit is contained in:
Konsta 2025-11-12 22:01:44 +02:00
commit 22ba81cf61
14 changed files with 436 additions and 1 deletions

View file

@ -72,7 +72,11 @@ std::string DumpDisplayStats(const HwcDisplay *display,
}
} // namespace
DrmHwc::DrmHwc() : resource_manager_(this), dump_stats_tracker_(this) {};
DrmHwc::DrmHwc()
: resource_manager_(this),
dump_stats_tracker_(this),
refresh_rates_reporter_(
DisplayRefreshRatesChangedAtomReporter::Create()) {};
/* Must be called after every display attach/detach cycle */
void DrmHwc::FinalizeDisplayBinding() {
@ -274,4 +278,18 @@ void DrmHwc::DeinitDisplays() {
}
}
void DrmHwc::LogRefreshRateChanges() {
std::vector<int32_t> refresh_rates;
refresh_rates.reserve(displays_.size());
for (const auto &[_, display] : displays_) {
if (const HwcDisplayConfig *config = display->GetCurrentConfig(); config) {
refresh_rates.push_back(
static_cast<int32_t>(lround(config->mode.GetVRefresh())));
}
}
if (refresh_rates_reporter_)
refresh_rates_reporter_->UpdateRefreshRates(refresh_rates);
}
} // namespace android::drm_hwcomposer

View file

@ -19,6 +19,7 @@
#include "drm/ResourceManager.h"
#include "hwc/HwcDisplay.h"
#include "stats/CompositionStats.h"
#include "stats/DisplayRefreshRatesChangedAtomReporter.h"
namespace android::drm_hwcomposer {
@ -85,6 +86,9 @@ class DrmHwc : public PipelineToFrontendBindingInterface,
void NotifyDisplayLinkStatus(
std::shared_ptr<DrmDisplayPipeline> pipeline) override;
// Should be done for all successful modesets (full and seamless).
void LogRefreshRateChanges();
protected:
auto &Displays() {
return displays_;
@ -100,6 +104,9 @@ class DrmHwc : public PipelineToFrontendBindingInterface,
DisplayHandle last_display_handle_ = kPrimaryDisplay;
CompositionStatsTracker dump_stats_tracker_;
std::unique_ptr<DisplayRefreshRatesChangedAtomReporter>
refresh_rates_reporter_;
};
} // namespace android::drm_hwcomposer