Update reporting for new DesktopAtoms
Change-Id: I5e0053c65480b26c02377320bb9904ed141504f4
This commit is contained in:
parent
68ff3baebe
commit
5b8fc6f028
4 changed files with 75 additions and 14 deletions
|
|
@ -328,6 +328,8 @@ drm_hwcomposer_atom_reporter_library {
|
|||
name: "drm_hwcomposer_atom_reporter",
|
||||
shared_libs: [
|
||||
"libc++",
|
||||
"libdrm",
|
||||
"libhardware",
|
||||
"liblog",
|
||||
],
|
||||
soong_config_variables: {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "CompositionStats.h"
|
||||
#include "backend/Backend.h"
|
||||
|
||||
namespace android::drm_hwcomposer {
|
||||
|
||||
// CompositionStatsAtomReporter is a wrapper around creation of a VendorAtom
|
||||
|
|
@ -29,9 +32,12 @@ class CompositionStatsAtomReporter {
|
|||
static std::unique_ptr<CompositionStatsAtomReporter> Create();
|
||||
|
||||
// Pushes a Vendor Atom to IStats::reportVendorAtom.
|
||||
virtual void PushAtom(int64_t display_handle, int64_t presented_frame_count,
|
||||
int64_t present_failed_count,
|
||||
int64_t validate_failed_count) = 0;
|
||||
virtual void PushAtom(int64_t display_handle, bool present_failed,
|
||||
ValidationResult validation_result,
|
||||
Backend::FlattenReason flatten_reason,
|
||||
int64_t frame_count, int64_t layer_count,
|
||||
int64_t used_plane_count, uint64_t total_pixops,
|
||||
uint64_t gpu_pixops) = 0;
|
||||
virtual ~CompositionStatsAtomReporter() = default;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
#include <aidl/android/frameworks/stats/IStats.h>
|
||||
#include <android/binder_manager.h>
|
||||
|
||||
#include "CompositionStats.h"
|
||||
#include "backend/Backend.h"
|
||||
#include "desktopatoms.h"
|
||||
#include "utils/log.h"
|
||||
|
||||
|
|
@ -35,20 +37,62 @@ namespace DesktopAtoms = android::vendor::google::desktop::stats::DesktopAtoms;
|
|||
namespace android::drm_hwcomposer {
|
||||
namespace {
|
||||
|
||||
using FlattenReason = Backend::FlattenReason;
|
||||
|
||||
const std::string kStatsServiceName = std::string(IStats::descriptor)
|
||||
.append("/default");
|
||||
|
||||
std::string ValidationResultToString(ValidationResult result) {
|
||||
switch (result) {
|
||||
case ValidationResult::kUnspecified:
|
||||
return "Unspecified";
|
||||
case ValidationResult::kSuccess:
|
||||
return "Success";
|
||||
case ValidationResult::kFailure:
|
||||
return "Failure";
|
||||
case ValidationResult::kSkip:
|
||||
return "Skip";
|
||||
}
|
||||
LOG_ALWAYS_FATAL("Unknown ValidationResult value=%d",
|
||||
static_cast<int>(result));
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
std::string FlattenReasonToString(FlattenReason reason) {
|
||||
switch (reason) {
|
||||
case FlattenReason::kUnspecified:
|
||||
return "Unspecified";
|
||||
case FlattenReason::kNone:
|
||||
return "None";
|
||||
case FlattenReason::kStaticScene:
|
||||
return "StaticScene";
|
||||
case FlattenReason::kValidateFailed:
|
||||
return "ValidateFailed";
|
||||
case FlattenReason::kCtmWithOffset:
|
||||
return "CtmWithOffset";
|
||||
}
|
||||
LOG_ALWAYS_FATAL("Unknown FlattenReason value=%d", static_cast<int>(reason));
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
// Use a private implementation of CompositionStatsAtomReporter to avoid leaking
|
||||
// the IStats interface through the public api.
|
||||
class CompositionStatsReporterDesktop : public CompositionStatsAtomReporter {
|
||||
public:
|
||||
void PushAtom(int64_t display_handle, int64_t presented_frame_count,
|
||||
int64_t present_failed_count,
|
||||
int64_t validate_failed_count) override {
|
||||
ALOGV("Sending stats: id=%" PRId64 ", frames=%" PRId64
|
||||
", failed_present=%" PRId64 ", failed_validate=%" PRId64,
|
||||
display_handle, presented_frame_count, present_failed_count,
|
||||
validate_failed_count);
|
||||
void PushAtom(int64_t display_handle, bool present_failed,
|
||||
ValidationResult validation_result,
|
||||
FlattenReason flatten_reason, int64_t frame_count,
|
||||
int64_t layer_count, int64_t used_plane_count,
|
||||
uint64_t total_pixops, uint64_t gpu_pixops) override {
|
||||
ALOGV("Sending stats: display_handle=%" PRId64
|
||||
", present_failed=%d, validation_result=%s, flatten_reason=%s, "
|
||||
"frame_count=%" PRId64 ", layer_count=%" PRId64
|
||||
", used_plane_count=%" PRId64 ", total_pixops=%" PRIu64
|
||||
", gpu_pixops=%" PRIu64,
|
||||
display_handle, present_failed,
|
||||
ValidationResultToString(validation_result).c_str(),
|
||||
FlattenReasonToString(flatten_reason).c_str(), frame_count,
|
||||
layer_count, used_plane_count, total_pixops, gpu_pixops);
|
||||
|
||||
// The order of the arguments to createVendorAtom is determined by the
|
||||
// proto definition in libdesktopatoms.
|
||||
|
|
@ -56,8 +100,14 @@ class CompositionStatsReporterDesktop : public CompositionStatsAtomReporter {
|
|||
const VendorAtom atom = DesktopAtoms::
|
||||
createVendorAtom(DesktopAtoms::HWC_COMPOSITION_STATS,
|
||||
kDeprecatedReverseDomainName, display_handle,
|
||||
presented_frame_count, present_failed_count,
|
||||
validate_failed_count);
|
||||
/*presented_frame_count=*/0,
|
||||
/*present_failed_count=*/0,
|
||||
/*validate_failed_count=*/0, present_failed,
|
||||
static_cast<int32_t>(validation_result),
|
||||
static_cast<int32_t>(flatten_reason), frame_count,
|
||||
layer_count, used_plane_count,
|
||||
static_cast<int64_t>(total_pixops),
|
||||
static_cast<int64_t>(gpu_pixops));
|
||||
|
||||
auto stats_service = IStats::fromBinder(ndk::SpAIBinder(
|
||||
AServiceManager_checkService(kStatsServiceName.c_str())));
|
||||
|
|
|
|||
|
|
@ -48,8 +48,11 @@ void CompositionStatsPoller::PollFunc() {
|
|||
if (delta.total_frames == 0) {
|
||||
return;
|
||||
}
|
||||
reporter_->PushAtom(attributes.display_handle, delta.total_frames,
|
||||
delta.failed_kms_present, delta.failed_kms_validate);
|
||||
reporter_->PushAtom(attributes.display_handle, attributes.present_failed,
|
||||
attributes.validation_result,
|
||||
attributes.flatten_reason, delta.total_frames,
|
||||
delta.layer_count, delta.used_plane_count,
|
||||
delta.total_pixops, delta.gpu_pixops);
|
||||
});
|
||||
|
||||
constexpr std::chrono::seconds kPollFrequency = std::chrono::minutes(1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue