From a2f34ea82b5a31a7e842d0099921b85b8bce403f Mon Sep 17 00:00:00 2001 From: Max Fedotov Date: Tue, 11 May 2021 06:10:29 +0300 Subject: [PATCH] gcc 11 compatibility fix (suggestion) (#5778) Fixes missing include and runtime variable in offsetof * gcc 11 compatibility fix * Revert "gcc 11 compatibility fix" This reverts commit bf5711d944bbdf7b5663ba4fec1b9066f16e2bb2. * gcc 11 compatibility fix (with pointer math) * Don't require pointers for framebuffer field math * Code style fix (clang-format) --- src/common/ring_buffer.h | 1 + src/core/hle/service/gsp/gsp_gpu.cpp | 28 ++++++++++++++-------------- src/core/hw/gpu.h | 8 ++++++++ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/common/ring_buffer.h b/src/common/ring_buffer.h index 080059058..29fc7f0cc 100644 --- a/src/common/ring_buffer.h +++ b/src/common/ring_buffer.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/src/core/hle/service/gsp/gsp_gpu.cpp b/src/core/hle/service/gsp/gsp_gpu.cpp index 5a41f5ca0..7ef109e76 100644 --- a/src/core/hle/service/gsp/gsp_gpu.cpp +++ b/src/core/hle/service/gsp/gsp_gpu.cpp @@ -283,29 +283,29 @@ ResultCode SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) { PAddr phys_address_left = VirtualToPhysicalAddress(info.address_left); PAddr phys_address_right = VirtualToPhysicalAddress(info.address_right); if (info.active_fb == 0) { - WriteSingleHWReg(base_address + 4 * static_cast(GPU_REG_INDEX( - framebuffer_config[screen_id].address_left1)), + WriteSingleHWReg(base_address + 4 * static_cast(GPU_FRAMEBUFFER_REG_INDEX( + screen_id, address_left1)), phys_address_left); - WriteSingleHWReg(base_address + 4 * static_cast(GPU_REG_INDEX( - framebuffer_config[screen_id].address_right1)), + WriteSingleHWReg(base_address + 4 * static_cast(GPU_FRAMEBUFFER_REG_INDEX( + screen_id, address_right1)), phys_address_right); } else { - WriteSingleHWReg(base_address + 4 * static_cast(GPU_REG_INDEX( - framebuffer_config[screen_id].address_left2)), + WriteSingleHWReg(base_address + 4 * static_cast(GPU_FRAMEBUFFER_REG_INDEX( + screen_id, address_left2)), phys_address_left); - WriteSingleHWReg(base_address + 4 * static_cast(GPU_REG_INDEX( - framebuffer_config[screen_id].address_right2)), + WriteSingleHWReg(base_address + 4 * static_cast(GPU_FRAMEBUFFER_REG_INDEX( + screen_id, address_right2)), phys_address_right); } WriteSingleHWReg(base_address + - 4 * static_cast(GPU_REG_INDEX(framebuffer_config[screen_id].stride)), + 4 * static_cast(GPU_FRAMEBUFFER_REG_INDEX(screen_id, stride)), info.stride); - WriteSingleHWReg(base_address + 4 * static_cast(GPU_REG_INDEX( - framebuffer_config[screen_id].color_format)), + WriteSingleHWReg(base_address + + 4 * static_cast(GPU_FRAMEBUFFER_REG_INDEX(screen_id, color_format)), info.format); - WriteSingleHWReg( - base_address + 4 * static_cast(GPU_REG_INDEX(framebuffer_config[screen_id].active_fb)), - info.shown_fb); + WriteSingleHWReg(base_address + + 4 * static_cast(GPU_FRAMEBUFFER_REG_INDEX(screen_id, active_fb)), + info.shown_fb); if (Pica::g_debug_context) Pica::g_debug_context->OnEvent(Pica::DebugContext::Event::BufferSwapped, nullptr); diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h index 1e49967e9..79976fcdb 100644 --- a/src/core/hw/gpu.h +++ b/src/core/hw/gpu.h @@ -30,6 +30,14 @@ constexpr double SCREEN_REFRESH_RATE = BASE_CLOCK_RATE_ARM11 / static_cast