Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2951f83 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: trace the render rate of an app" into main

parents 5c9e3cbb 1d0cae97
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -41,6 +41,11 @@ cc_aconfig_library {
    aconfig_declarations: "libgui_flags",
}

cc_aconfig_library {
    name: "libguiflags_no_apex",
    aconfig_declarations: "libgui_flags",
}

cc_library_headers {
    name: "libgui_headers",
    vendor_available: true,
+12 −1
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */

#define LOG_TAG "DisplayEventDispatcher"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS

#include <cinttypes>
#include <cstdint>
@@ -23,10 +24,13 @@
#include <gui/DisplayEventReceiver.h>
#include <utils/Log.h>
#include <utils/Looper.h>

#include <utils/Timers.h>
#include <utils/Trace.h>

#include <com_android_graphics_libgui_flags.h>

namespace android {
using namespace com::android::graphics::libgui;

// Number of events to read at a time from the DisplayEventDispatcher pipe.
// The value should be large enough that we can quickly drain the pipe
@@ -171,6 +175,13 @@ bool DisplayEventDispatcher::processPendingEvents(nsecs_t* outTimestamp,
                    *outDisplayId = ev.header.displayId;
                    *outCount = ev.vsync.count;
                    *outVsyncEventData = ev.vsync.vsyncData;

                    // Trace the RenderRate for this app
                    if (ATRACE_ENABLED() && flags::trace_frame_rate_override()) {
                        const auto frameInterval = ev.vsync.vsyncData.frameInterval;
                        int fps = frameInterval > 0 ? 1e9f / frameInterval : 0;
                        ATRACE_INT("RenderRate", fps);
                    }
                    break;
                case DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG:
                    if (ev.hotplug.connectionError == 0) {
+14 −3
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ flag {
  description: "This flag controls plumbing setFrameRate thru BufferQueue"
  bug: "281695725"
  is_fixed_read_only: true
}
} # bq_setframerate

flag {
  name: "frametimestamps_previousrelease"
@@ -15,7 +15,7 @@ flag {
  description: "Controls a fence fixup for timestamp apis"
  bug: "310927247"
  is_fixed_read_only: true
}
} # frametimestamps_previousrelease

flag {
  name: "bq_extendedallocate"
@@ -23,4 +23,15 @@ flag {
  description: "Add BQ support for allocate with extended options"
  bug: "268382490"
  is_fixed_read_only: true
} # bq_extendedallocate

flag {
  name: "trace_frame_rate_override"
  namespace: "core_graphics"
  description: "Trace FrameRateOverride fps"
  bug: "347314033"
  is_fixed_read_only: true
  metadata {
    purpose: PURPOSE_BUGFIX
  }
} # trace_frame_rate_override
+5 −0
Original line number Diff line number Diff line
@@ -1066,6 +1066,11 @@ auto RefreshRateSelector::getFrameRateOverrides(const std::vector<LayerRequireme
        ALOGV("%s: overriding to %s for uid=%d", __func__, to_string(overrideFps).c_str(), uid);
        ATRACE_FORMAT_INSTANT("%s: overriding to %s for uid=%d", __func__,
                              to_string(overrideFps).c_str(), uid);
        if (ATRACE_ENABLED() && FlagManager::getInstance().trace_frame_rate_override()) {
            std::stringstream ss;
            ss << "FrameRateOverride " << uid;
            ATRACE_INT(ss.str().c_str(), overrideFps.getIntValue());
        }
        frameRateOverrides.emplace(uid, overrideFps);
    }

+4 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ cc_library_static {
        "libsurfaceflingerflags",
        "android.os.flags-aconfig-cc",
        "android.server.display.flags-aconfig-cc",
        "libguiflags_no_apex",
    ],
}

@@ -50,6 +51,7 @@ cc_library_static {
        "libsurfaceflingerflags_test",
        "android.os.flags-aconfig-cc-test",
        "android.server.display.flags-aconfig-cc",
        "libguiflags_no_apex",
    ],
}

@@ -64,6 +66,7 @@ cc_defaults {
        "libsurfaceflingerflags",
        "android.os.flags-aconfig-cc",
        "android.server.display.flags-aconfig-cc",
        "libguiflags_no_apex",
    ],
}

@@ -78,5 +81,6 @@ cc_defaults {
        "libsurfaceflingerflags_test",
        "android.os.flags-aconfig-cc-test",
        "android.server.display.flags-aconfig-cc",
        "libguiflags_no_apex",
    ],
}
Loading