1
0
Fork 0

drm_hwcomposer: Add cursor stats

This change adds stats for commits that use the cursor plane.
The failed_kms_cursor_validate_ stat is incremented whenever a
test commit fails which attempted to match a layer to the cursor
plane. This event was previously being tracked by the
broader failed_kms_validate_ stat, but this change disentangles
the two events to help with debugging.

This change also adds a stat which tracks the number of frames
which successfully commit to the cursor plane.

Change-Id: I3f23e3e1d4bfd5ac70d2ceb1d768a2ded8ee034b
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
This commit is contained in:
Andrew Wolfers 2025-04-07 14:45:26 +00:00
parent 0312c9e2a0
commit 3aa544e249
3 changed files with 17 additions and 8 deletions

View file

@ -74,10 +74,8 @@ HWC2::Error Backend::ValidateDisplay(HwcDisplay *display, uint32_t *num_types,
bool testing_needed = client_start != 0 || client_size != layers.size();
AtomicCommitArgs a_args = {.test_only = true};
if (testing_needed &&
display->CreateComposition(a_args) != HWC2::Error::None) {
++display->total_stats().failed_kms_validate_;
return false;
if (testing_needed) {
return display->CreateComposition(a_args) != HWC2::Error::None;
}
return true;
@ -88,12 +86,14 @@ HWC2::Error Backend::ValidateDisplay(HwcDisplay *display, uint32_t *num_types,
// First fallback: convert cursor layer to device composition and reattempt.
if (!success && use_cursor_plane) {
++display->total_stats().failed_kms_cursor_validate_;
use_cursor_plane = false;
success = validate_and_test();
}
// Final fallback: convert all layers to client composition.
if (!success) {
++display->total_stats().failed_kms_validate_;
client_start = 0;
client_size = layers.size();
MarkValidated(layers, client_start, client_size, use_cursor_plane);
@ -103,6 +103,9 @@ HWC2::Error Backend::ValidateDisplay(HwcDisplay *display, uint32_t *num_types,
display->total_stats().gpu_pixops_ += CalcPixOps(layers, client_start,
client_size);
display->total_stats().total_pixops_ += CalcPixOps(layers, 0, layers.size());
if (use_cursor_plane) {
++display->total_stats().cursor_plane_frames_;
}
return *num_types != 0 ? HWC2::Error::HasChanges : HWC2::Error::None;
}

View file

@ -113,15 +113,17 @@ std::string HwcDisplay::DumpDelta(HwcDisplay::Stats delta) {
std::stringstream ss;
ss << " Total frames count: " << delta.total_frames_ << "\n"
<< " Failed cursor test commit frames: "
<< delta.failed_kms_cursor_validate_ << "\n"
<< " Failed to test commit frames: " << delta.failed_kms_validate_ << "\n"
<< " Failed to commit frames: " << delta.failed_kms_present_ << "\n"
<< ((delta.failed_kms_present_ > 0)
? " !!! Internal failure, FIX it please\n"
: "")
<< " Flattened frames: " << delta.frames_flattened_ << "\n"
<< " Pixel operations (free units)"
<< " : [TOTAL: " << delta.total_pixops_ << " / GPU: " << delta.gpu_pixops_
<< "]\n"
<< " Cursor plane frames: " << delta.cursor_plane_frames_ << "\n"
<< " Pixel operations (free units) : [TOTAL: " << delta.total_pixops_
<< " / GPU: " << delta.gpu_pixops_ << "]\n"
<< " Composition efficiency: " << ratio;
return ss.str();

View file

@ -185,7 +185,9 @@ class HwcDisplay {
gpu_pixops_ - b.gpu_pixops_,
failed_kms_validate_ - b.failed_kms_validate_,
failed_kms_present_ - b.failed_kms_present_,
frames_flattened_ - b.frames_flattened_};
frames_flattened_ - b.frames_flattened_,
cursor_plane_frames_ - b.cursor_plane_frames_,
failed_kms_cursor_validate_ - b.failed_kms_cursor_validate_};
}
uint32_t total_frames_ = 0;
@ -194,6 +196,8 @@ class HwcDisplay {
uint32_t failed_kms_validate_ = 0;
uint32_t failed_kms_present_ = 0;
uint32_t frames_flattened_ = 0;
uint32_t cursor_plane_frames_ = 0;
uint32_t failed_kms_cursor_validate_ = 0;
};
const Backend *backend() const;