#include <pps/pps.h>
#include <pps/pps_algorithm.h>
-namespace pps
-{
+namespace pps {
PanfrostDriver::PanfrostDriver()
{
}
{
}
-uint64_t PanfrostDriver::get_min_sampling_period_ns()
+uint64_t
+PanfrostDriver::get_min_sampling_period_ns()
{
return 1000000;
}
-uint32_t find_id_within_group(uint32_t counter_id, const struct panfrost_perf_config *cfg)
+uint32_t
+find_id_within_group(uint32_t counter_id,
+ const struct panfrost_perf_config *cfg)
{
for (uint32_t cat_id = 0; cat_id < cfg->n_categories; ++cat_id) {
const struct panfrost_perf_category *cat = &cfg->categories[cat_id];
auto &pan_driver = PanfrostDriver::into(d);
struct panfrost_perf *perf = pan_driver.perf->perf;
uint32_t id_within_group = find_id_within_group(c.id, perf->cfg);
- const auto counter = &perf->cfg->categories[c.group].counters[id_within_group];
+ const auto counter =
+ &perf->cfg->categories[c.group].counters[id_within_group];
return int64_t(panfrost_perf_counter_read(counter, perf));
});
return ret;
}
-bool PanfrostDriver::init_perfcnt()
+bool
+PanfrostDriver::init_perfcnt()
{
if (!dev) {
dev = std::make_unique<PanfrostDevice>(drm_device.fd);
return true;
}
-void PanfrostDriver::enable_counter(const uint32_t counter_id)
+void
+PanfrostDriver::enable_counter(const uint32_t counter_id)
{
enabled_counters.push_back(counters[counter_id]);
}
-void PanfrostDriver::enable_all_counters()
+void
+PanfrostDriver::enable_all_counters()
{
enabled_counters.resize(counters.size());
for (size_t i = 0; i < counters.size(); ++i) {
}
}
-void PanfrostDriver::enable_perfcnt(const uint64_t /* sampling_period_ns */)
+void
+PanfrostDriver::enable_perfcnt(const uint64_t /* sampling_period_ns */)
{
auto res = perf->enable();
if (!check(res, "Failed to enable performance counters")) {
if (res == -ENOSYS) {
- PERFETTO_FATAL("Please enable unstable ioctls with: modprobe panfrost unstable_ioctls=1");
+ PERFETTO_FATAL(
+ "Please enable unstable ioctls with: modprobe panfrost unstable_ioctls=1");
}
PERFETTO_FATAL("Please verify graphics card");
}
}
-bool PanfrostDriver::dump_perfcnt()
+bool
+PanfrostDriver::dump_perfcnt()
{
last_dump_ts = perfetto::base::GetBootTimeNs().count();
return true;
}
-uint64_t PanfrostDriver::next()
+uint64_t
+PanfrostDriver::next()
{
auto ret = last_dump_ts;
last_dump_ts = 0;
return ret;
}
-void PanfrostDriver::disable_perfcnt()
+void
+PanfrostDriver::disable_perfcnt()
{
perf->disable();
perf.reset();
enabled_counters.clear();
}
-uint32_t PanfrostDriver::gpu_clock_id() const
+uint32_t
+PanfrostDriver::gpu_clock_id() const
{
return perfetto::protos::pbzero::BUILTIN_CLOCK_BOOTTIME;
}
-uint64_t PanfrostDriver::gpu_timestamp() const
+uint64_t
+PanfrostDriver::gpu_timestamp() const
{
return perfetto::base::GetBootTimeNs().count();
}
#include <lib/pan_device.h>
#include <perf/pan_perf.h>
-#include <util/ralloc.h>
#include <pps/pps.h>
+#include <util/ralloc.h>
-namespace pps
-{
+namespace pps {
PanfrostDevice::PanfrostDevice(int fd)
- : ctx {ralloc_context(nullptr)}
- , dev {reinterpret_cast<struct panfrost_device*>(new struct panfrost_device())}
+ : ctx{ralloc_context(nullptr)},
+ dev{reinterpret_cast<struct panfrost_device *>(
+ new struct panfrost_device())}
{
assert(fd >= 0);
panfrost_open_device(ctx, fd, dev);
}
}
-PanfrostDevice::PanfrostDevice(PanfrostDevice &&o)
- : ctx {o.ctx}
- , dev {o.dev}
+PanfrostDevice::PanfrostDevice(PanfrostDevice &&o): ctx{o.ctx}, dev{o.dev}
{
o.ctx = nullptr;
o.dev = nullptr;
}
-PanfrostDevice &PanfrostDevice::operator=(PanfrostDevice &&o)
+PanfrostDevice &
+PanfrostDevice::operator=(PanfrostDevice &&o)
{
std::swap(ctx, o.ctx);
std::swap(dev, o.dev);
return *this;
}
-PanfrostPerf::PanfrostPerf(const PanfrostDevice& dev)
- : perf {reinterpret_cast<struct panfrost_perf *>(rzalloc(nullptr, struct panfrost_perf))}
+PanfrostPerf::PanfrostPerf(const PanfrostDevice &dev)
+ : perf{reinterpret_cast<struct panfrost_perf *>(
+ rzalloc(nullptr, struct panfrost_perf))}
{
assert(perf);
assert(dev.dev);
}
}
-PanfrostPerf::PanfrostPerf(PanfrostPerf &&o)
- : perf {o.perf}
+PanfrostPerf::PanfrostPerf(PanfrostPerf &&o): perf{o.perf}
{
o.perf = nullptr;
}
-PanfrostPerf &PanfrostPerf::operator=(PanfrostPerf &&o)
+PanfrostPerf &
+PanfrostPerf::operator=(PanfrostPerf &&o)
{
std::swap(perf, o.perf);
return *this;
}
-int PanfrostPerf::enable() const
+int
+PanfrostPerf::enable() const
{
assert(perf);
return panfrost_perf_enable(perf);
}
-void PanfrostPerf::disable() const
+void
+PanfrostPerf::disable() const
{
assert(perf);
panfrost_perf_disable(perf);
}
-int PanfrostPerf::dump() const
+int
+PanfrostPerf::dump() const
{
assert(perf);
return panfrost_perf_dump(perf);