drm_hwcomposer: Add tracing around validate/present paths
Add perferto tracing around validate and present paths. Specifically around code that blocks on the main thread (e.g. commit, fence waits). These should increase the visibility of what is blocking the presentation hot path in perfetto traces. Change-Id: I6db60648c5e1d5f1a666ebc52f5ae5ad57e0e82a
This commit is contained in:
parent
f61371b260
commit
7e7e0609ee
3 changed files with 23 additions and 3 deletions
|
|
@ -119,6 +119,7 @@ bool DrmAtomicStateManager::CommitFrame(AtomicCommitArgs &args) {
|
|||
auto *drm = pipe_->device;
|
||||
|
||||
if (args.test_only) {
|
||||
ATRACE_NAME("TestOnlyCommit");
|
||||
auto err = drmModeAtomicCommit(*drm->GetFd(),
|
||||
atomic_request->property_set.get(),
|
||||
flags | DRM_MODE_ATOMIC_TEST_ONLY, drm);
|
||||
|
|
@ -134,15 +135,21 @@ bool DrmAtomicStateManager::CommitFrame(AtomicCommitArgs &args) {
|
|||
bool nonblock = !args.blocking && !args.active;
|
||||
|
||||
flags |= nonblock ? DRM_MODE_ATOMIC_NONBLOCK : 0U;
|
||||
auto err = drmModeAtomicCommit(*drm->GetFd(),
|
||||
atomic_request->property_set.get(), flags,
|
||||
drm);
|
||||
int err = 0;
|
||||
{
|
||||
ATRACE_NAME((nonblock ? "Commit_nonblock" : "Commit_block"));
|
||||
err = drmModeAtomicCommit(*drm->GetFd(), atomic_request->property_set.get(),
|
||||
flags, drm);
|
||||
}
|
||||
|
||||
if (err != 0 && args.seamless) {
|
||||
ALOGE(
|
||||
"Seamless commit failed, retrying a full modeset (visual artifacts may "
|
||||
"be observed). Error: %s",
|
||||
strerror_r(errno, err_buf, error_buf_max_size));
|
||||
|
||||
ATRACE_NAME("SeamlessFallbackFullModesetCommit");
|
||||
|
||||
err = drmModeAtomicCommit(*drm->GetFd(), atomic_request->property_set.get(),
|
||||
flags | DRM_MODE_ATOMIC_ALLOW_MODESET, drm);
|
||||
}
|
||||
|
|
@ -227,6 +234,7 @@ bool DrmAtomicStateManager::SetWriteBackFenceIfNeeded(
|
|||
|
||||
// Wait on input fence if provided
|
||||
if (args.writeback_release_fence) {
|
||||
ATRACE_NAME("WritebackFenceWait");
|
||||
sync_wait(*args.writeback_release_fence, -1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <cinttypes>
|
||||
|
||||
#include <ui/ColorSpace.h>
|
||||
#include <utils/Trace.h>
|
||||
|
||||
#include "backend/Backend.h"
|
||||
#include "backend/BackendManager.h"
|
||||
|
|
@ -223,6 +224,8 @@ void HwcDisplay::SetOutputType(OutputType hdr_output_type) {
|
|||
}
|
||||
|
||||
HwcDisplay::ConfigError HwcDisplay::SetConfig(ConfigId config) {
|
||||
ATRACE_CALL();
|
||||
|
||||
const HwcDisplayConfig *new_config = GetConfig(config);
|
||||
if (new_config == nullptr) {
|
||||
ALOGE("Could not find active mode for %u", config);
|
||||
|
|
@ -376,6 +379,8 @@ auto HwcDisplay::AcceptValidatedComposition() -> void {
|
|||
auto HwcDisplay::PresentStagedComposition(
|
||||
std::optional<int64_t> desired_present_time, SharedFd &out_present_fence,
|
||||
std::vector<ReleaseFence> &out_release_fences) -> bool {
|
||||
ATRACE_CALL();
|
||||
|
||||
if (IsInHeadlessMode()) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -785,6 +790,8 @@ uint32_t HwcDisplay::GetCurrentVsyncPeriodNs() const {
|
|||
|
||||
bool HwcDisplay::TestComposition(
|
||||
Backend::ValidatedComposition &composition) const {
|
||||
ATRACE_CALL();
|
||||
|
||||
if (IsInHeadlessMode()) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -920,6 +927,8 @@ std::optional<AtomicCommitArgs> HwcDisplay::CreateFrameUpdateCommit(
|
|||
bool HwcDisplay::CommitComposition(
|
||||
const Backend::CompositionTypeMap &composition,
|
||||
SharedFd &out_present_fence) {
|
||||
ATRACE_CALL();
|
||||
|
||||
if (IsInHeadlessMode()) {
|
||||
ALOGE("%s: Display is in headless mode, should never reach here", __func__);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include <android/binder_ibinder_platform.h>
|
||||
#include <cutils/native_handle.h>
|
||||
#include <ui/GraphicBufferMapper.h>
|
||||
#include <utils/Trace.h>
|
||||
|
||||
#include "bufferinfo/BufferInfo.h"
|
||||
#include "compositor/DisplayInfo.h"
|
||||
|
|
@ -711,6 +712,8 @@ void ComposerClient::DispatchLayerCommand(int64_t display_handle,
|
|||
}
|
||||
|
||||
void ComposerClient::ExecuteDisplayCommand(const DisplayCommand& command) {
|
||||
ATRACE_CALL();
|
||||
|
||||
const int64_t display_handle = command.display;
|
||||
HwcDisplay* display = hwc_->GetDisplay(display_handle);
|
||||
if (display == nullptr) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue