gpu: workaround write to context register with SET_CONFIG_REG

This commit is contained in:
DH 2024-10-23 02:32:43 +03:00
parent 373826b506
commit f79e16eb4d

View file

@ -1423,6 +1423,19 @@ bool GraphicsPipe::setConfigReg(Ring &ring) {
auto offset = ring.rptr[1] & 0xffff;
auto data = ring.rptr + 2;
auto mmioOffset = decltype(device->config)::kMmioOffset + offset;
// FIXME: verify
if (mmioOffset >= decltype(context)::kMmioOffset) {
auto contextOffset = mmioOffset - decltype(context)::kMmioOffset;
if (contextOffset + len <= sizeof(context)) {
std::memcpy(reinterpret_cast<std::uint32_t *>(&context) + contextOffset,
data, sizeof(std::uint32_t) * len);
return true;
}
}
rx::dieIf(
(offset + len) * sizeof(std::uint32_t) > sizeof(device->config),
"out of Config regs, offset: %x, count %u, %s\n", offset, len,