MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / init

Method init

tests/framework/instruments/MaliCounter.cpp:150–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150void MaliCounter::init()
151{
152 term();
153
154 MaliHWInfo hw_info = get_mali_hw_info(_device);
155
156 _num_cores = hw_info.mp_count;
157
158 _fd = open(_device, O_RDWR | O_CLOEXEC | O_NONBLOCK); // NOLINT
159
160 if (_fd < 0)
161 {
162 ARM_COMPUTE_ERROR("Failed to open /dev/mali0.");
163 }
164
165 {
166 mali_userspace::kbase_uk_hwcnt_reader_version_check_args check; // NOLINT
167 memset(&check, 0, sizeof(check));
168
169 if (mali_userspace::mali_ioctl(_fd, check) != 0)
170 {
171 ARM_COMPUTE_ERROR("Failed to get ABI version.");
172 }
173 else if (check.major < 10)
174 {
175 ARM_COMPUTE_ERROR("Unsupported ABI version 10.");
176 }
177 }
178
179 {
180 mali_userspace::kbase_uk_hwcnt_reader_set_flags flags; // NOLINT
181 memset(&flags, 0, sizeof(flags));
182 flags.header.id = mali_userspace::KBASE_FUNC_SET_FLAGS; // NOLINT
183 flags.create_flags = mali_userspace::BASE_CONTEXT_CREATE_KERNEL_FLAGS;
184
185 if (mali_userspace::mali_ioctl(_fd, flags) != 0)
186 {
187 ARM_COMPUTE_ERROR("Failed settings flags ioctl.");
188 }
189 }
190
191 {
192 mali_userspace::kbase_uk_hwcnt_reader_setup setup; // NOLINT
193 memset(&setup, 0, sizeof(setup));
194 setup.header.id = mali_userspace::KBASE_FUNC_HWCNT_READER_SETUP; // NOLINT
195 setup.buffer_count = _buffer_count;
196 setup.jm_bm = -1;
197 setup.shader_bm = -1;
198 setup.tiler_bm = -1;
199 setup.mmu_l2_bm = -1;
200 setup.fd = -1;
201
202 if (mali_userspace::mali_ioctl(_fd, setup) != 0)
203 {
204 ARM_COMPUTE_ERROR("Failed setting hwcnt reader ioctl.");
205 }
206
207 _hwc_fd = setup.fd;

Callers

nothing calls this directly

Calls 6

get_mali_hw_infoFunction · 0.85
mali_ioctlFunction · 0.85
endFunction · 0.85
push_backMethod · 0.80
resizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected