mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-26 03:13:15 -06:00
Merge pull request #9204 from vonchenplus/dma_copy_1d_random_crash
video_core: Fix dma copy 1D random crash
This commit is contained in:
commit
e4d55e4ee4
1 changed files with 20 additions and 17 deletions
|
@ -102,26 +102,29 @@ void MaxwellDMA::Launch() {
|
||||||
const bool is_src_pitch = IsPitchKind(static_cast<PTEKind>(src_kind));
|
const bool is_src_pitch = IsPitchKind(static_cast<PTEKind>(src_kind));
|
||||||
const bool is_dst_pitch = IsPitchKind(static_cast<PTEKind>(dst_kind));
|
const bool is_dst_pitch = IsPitchKind(static_cast<PTEKind>(dst_kind));
|
||||||
if (!is_src_pitch && is_dst_pitch) {
|
if (!is_src_pitch && is_dst_pitch) {
|
||||||
std::vector<u8> tmp_buffer(regs.line_length_in);
|
UNIMPLEMENTED_IF(regs.line_length_in % 16 != 0);
|
||||||
std::vector<u8> dst_buffer(regs.line_length_in);
|
UNIMPLEMENTED_IF(regs.offset_in % 16 != 0);
|
||||||
memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(),
|
UNIMPLEMENTED_IF(regs.offset_out % 16 != 0);
|
||||||
regs.line_length_in);
|
std::vector<u8> tmp_buffer(16);
|
||||||
for (u32 offset = 0; offset < regs.line_length_in; ++offset) {
|
for (u32 offset = 0; offset < regs.line_length_in; offset += 16) {
|
||||||
dst_buffer[offset] =
|
memory_manager.ReadBlockUnsafe(
|
||||||
tmp_buffer[convert_linear_2_blocklinear_addr(regs.offset_in + offset) -
|
convert_linear_2_blocklinear_addr(regs.offset_in + offset),
|
||||||
regs.offset_in];
|
tmp_buffer.data(), tmp_buffer.size());
|
||||||
|
memory_manager.WriteBlock(regs.offset_out + offset, tmp_buffer.data(),
|
||||||
|
tmp_buffer.size());
|
||||||
}
|
}
|
||||||
memory_manager.WriteBlock(regs.offset_out, dst_buffer.data(), regs.line_length_in);
|
|
||||||
} else if (is_src_pitch && !is_dst_pitch) {
|
} else if (is_src_pitch && !is_dst_pitch) {
|
||||||
std::vector<u8> tmp_buffer(regs.line_length_in);
|
UNIMPLEMENTED_IF(regs.line_length_in % 16 != 0);
|
||||||
std::vector<u8> dst_buffer(regs.line_length_in);
|
UNIMPLEMENTED_IF(regs.offset_in % 16 != 0);
|
||||||
memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(),
|
UNIMPLEMENTED_IF(regs.offset_out % 16 != 0);
|
||||||
regs.line_length_in);
|
std::vector<u8> tmp_buffer(16);
|
||||||
for (u32 offset = 0; offset < regs.line_length_in; ++offset) {
|
for (u32 offset = 0; offset < regs.line_length_in; offset += 16) {
|
||||||
dst_buffer[convert_linear_2_blocklinear_addr(regs.offset_out + offset) -
|
memory_manager.ReadBlockUnsafe(regs.offset_in + offset, tmp_buffer.data(),
|
||||||
regs.offset_out] = tmp_buffer[offset];
|
tmp_buffer.size());
|
||||||
|
memory_manager.WriteBlock(
|
||||||
|
convert_linear_2_blocklinear_addr(regs.offset_out + offset),
|
||||||
|
tmp_buffer.data(), tmp_buffer.size());
|
||||||
}
|
}
|
||||||
memory_manager.WriteBlock(regs.offset_out, dst_buffer.data(), regs.line_length_in);
|
|
||||||
} else {
|
} else {
|
||||||
if (!accelerate.BufferCopy(regs.offset_in, regs.offset_out, regs.line_length_in)) {
|
if (!accelerate.BufferCopy(regs.offset_in, regs.offset_out, regs.line_length_in)) {
|
||||||
std::vector<u8> tmp_buffer(regs.line_length_in);
|
std::vector<u8> tmp_buffer(regs.line_length_in);
|
||||||
|
|
Loading…
Reference in a new issue