Skip to content

Commit

Permalink
gpu: workaround write to context register with SET_CONFIG_REG
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Oct 22, 2024
1 parent 373826b commit f79e16e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions rpcsx/gpu/Pipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f79e16e

Please sign in to comment.