Path: blob/21.2-virgl/src/panfrost/ds/pan_pps_driver.h
4560 views
/*1* Copyright © 2020-2021 Collabora, Ltd.2* Author: Antonio Caggiano <[email protected]>3* Author: Rohan Garg <[email protected]>4* Author: Robert Beckett <[email protected]>5*6* SPDX-License-Identifier: MIT7*/89#pragma once1011#include <pps/pps_driver.h>1213#include "pan_pps_perf.h"1415namespace pps16{17/// @brief Panfrost implementation of PPS driver.18/// This driver queries the GPU through `drm/panfrost_drm.h`, using performance counters ioctls,19/// which can be enabled by setting a kernel parameter: `modprobe panfrost unstable_ioctls=1`.20/// The ioctl needs a buffer to copy data from kernel to user space.21class PanfrostDriver : public Driver22{23public:24static inline PanfrostDriver &into(Driver &dri);25static inline const PanfrostDriver &into(const Driver &dri);2627/// @param A list of mali counter names28/// @return A pair with two lists: counter groups and available counters29static std::pair<std::vector<CounterGroup>, std::vector<Counter>> create_available_counters(30const PanfrostPerf& perf);3132PanfrostDriver();33~PanfrostDriver();3435uint64_t get_min_sampling_period_ns() override;36bool init_perfcnt() override;37void enable_counter(uint32_t counter_id) override;38void enable_all_counters() override;39void enable_perfcnt(uint64_t sampling_period_ns) override;40void disable_perfcnt() override;41bool dump_perfcnt() override;42uint64_t next() override;4344uint64_t last_dump_ts = 0;4546std::unique_ptr<PanfrostDevice> dev = nullptr;47std::unique_ptr<PanfrostPerf> perf = nullptr;48};4950PanfrostDriver &PanfrostDriver::into(Driver &dri)51{52return reinterpret_cast<PanfrostDriver &>(dri);53}5455const PanfrostDriver &PanfrostDriver::into(const Driver &dri)56{57return reinterpret_cast<const PanfrostDriver &>(dri);58}5960} // namespace pps616263