panfrost: fix formatting of a couple of files that were missed

Signed-off-by: Eric Engestrom <eric@igalia.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23264>
This commit is contained in:
Eric Engestrom
2023-05-26 17:23:54 +01:00
committed by Eric Engestrom
parent 480204aeed
commit 63c3768cf3
2 changed files with 48 additions and 32 deletions
+28 -15
View File
@@ -20,8 +20,7 @@
#include <pps/pps.h>
#include <pps/pps_algorithm.h>
namespace pps
{
namespace pps {
PanfrostDriver::PanfrostDriver()
{
}
@@ -30,12 +29,15 @@ 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];
@@ -74,7 +76,8 @@ PanfrostDriver::create_available_counters(const PanfrostPerf &perf)
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));
});
@@ -89,7 +92,8 @@ PanfrostDriver::create_available_counters(const PanfrostPerf &perf)
return ret;
}
bool PanfrostDriver::init_perfcnt()
bool
PanfrostDriver::init_perfcnt()
{
if (!dev) {
dev = std::make_unique<PanfrostDevice>(drm_device.fd);
@@ -103,12 +107,14 @@ bool PanfrostDriver::init_perfcnt()
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) {
@@ -116,18 +122,21 @@ void PanfrostDriver::enable_all_counters()
}
}
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();
@@ -140,14 +149,16 @@ bool PanfrostDriver::dump_perfcnt()
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();
@@ -157,12 +168,14 @@ void PanfrostDriver::disable_perfcnt()
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();
}
+20 -17
View File
@@ -2,14 +2,14 @@
#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);
@@ -25,23 +25,23 @@ PanfrostDevice::~PanfrostDevice()
}
}
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);
@@ -56,31 +56,34 @@ PanfrostPerf::~PanfrostPerf()
}
}
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);