52static const std::map<enums::NoMaliGpuType, nomali_gpu_type_t>
gpuTypeMap{
53 { enums::T60x, NOMALI_GPU_T60X },
54 { enums::T62x, NOMALI_GPU_T62X },
55 { enums::T760, NOMALI_GPU_T760 },
63 { NOMALI_INT_GPU,
p.int_gpu },
64 { NOMALI_INT_JOB,
p.int_job },
65 { NOMALI_INT_MMU,
p.int_mmu },
68 if (nomali_api_version() != NOMALI_API_VERSION)
69 panic(
"NoMali library API mismatch!\n");
73 memset(&cfg, 0,
sizeof(cfg));
77 fatal(
"Unrecognized GPU type: %s (%i)\n",
78 enums::NoMaliGpuTypeStrings[
p.gpu_type],
p.gpu_type);
80 cfg.type = it_gpu->second;
82 cfg.ver_maj =
p.ver_maj;
83 cfg.ver_min =
p.ver_min;
84 cfg.ver_status =
p.ver_status;
87 nomali_create(&nomali, &cfg),
88 "Failed to instantiate NoMali");
92 nomali_callback_t cbk_int;
93 cbk_int.type = NOMALI_CALLBACK_INT;
94 cbk_int.usr = (
void *)
this;
95 cbk_int.func.interrupt = NoMaliGpu::_interrupt;
99 nomali_callback_t cbk_rst;
100 cbk_rst.type = NOMALI_CALLBACK_RESET;
101 cbk_rst.usr = (
void *)
this;
102 cbk_rst.func.reset = NoMaliGpu::_reset;
103 setCallback(cbk_rst);
106 nomali_get_info(nomali, &nomaliInfo),
107 "Failed to get NoMali information struct");
274NoMaliGpu::onInterrupt(nomali_int_t intno,
bool set)
276 const auto it_int(interruptMap.find(intno));
277 if (it_int == interruptMap.end())
278 panic(
"Unhandled interrupt from NoMali: %i\n", intno);
280 DPRINTF(NoMali,
"Interrupt %i->%i: %i\n",
281 intno, it_int->second,
set);
284 assert(platform->gic);
287 platform->gic->sendInt(it_int->second);
289 platform->gic->clearInt(it_int->second);
327CustomNoMaliGpu::CustomNoMaliGpu(
const CustomNoMaliGpuParams &p)
330 { GPU_CONTROL_REG(GPU_ID),
p.gpu_id },
331 { GPU_CONTROL_REG(L2_FEATURES),
p.l2_features },
332 { GPU_CONTROL_REG(TILER_FEATURES),
p.tiler_features },
333 { GPU_CONTROL_REG(MEM_FEATURES),
p.mem_features },
334 { GPU_CONTROL_REG(MMU_FEATURES),
p.mmu_features },
335 { GPU_CONTROL_REG(AS_PRESENT),
p.as_present },
336 { GPU_CONTROL_REG(JS_PRESENT),
p.js_present },
338 { GPU_CONTROL_REG(THREAD_MAX_THREADS),
p.thread_max_threads },
339 { GPU_CONTROL_REG(THREAD_MAX_WORKGROUP_SIZE),
340 p.thread_max_workgroup_size },
341 { GPU_CONTROL_REG(THREAD_MAX_BARRIER_SIZE),
342 p.thread_max_barrier_size },
343 { GPU_CONTROL_REG(THREAD_FEATURES),
p.thread_features },
345 { GPU_CONTROL_REG(SHADER_PRESENT_LO),
bits(
p.shader_present, 31, 0) },
346 { GPU_CONTROL_REG(SHADER_PRESENT_HI),
bits(
p.shader_present, 63, 32) },
347 { GPU_CONTROL_REG(TILER_PRESENT_LO),
bits(
p.tiler_present, 31, 0) },
348 { GPU_CONTROL_REG(TILER_PRESENT_HI),
bits(
p.tiler_present, 63, 32) },
349 { GPU_CONTROL_REG(L2_PRESENT_LO),
bits(
p.l2_present, 31, 0) },
350 { GPU_CONTROL_REG(L2_PRESENT_HI),
bits(
p.l2_present, 63, 32) },
354 "Too many texture feature registers specified (%i)\n",
355 p.texture_features.size());
358 "Too many job slot feature registers specified (%i)\n",
359 p.js_features.size());
361 for (
int i = 0;
i <
p.texture_features.size();
i++)
362 idRegs[TEXTURE_FEATURES_REG(
i)] =
p.texture_features[
i];
364 for (
int i = 0;
i <
p.js_features.size();
i++)
365 idRegs[JS_FEATURES_REG(
i)] =
p.js_features[
i];
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.