From 99b6c82ac34c086a21bab9d197a53d97175340dd Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 29 Jan 2014 16:15:10 -0600 Subject: [PATCH] [Android] Fix Adreno v53 development drivers rotating framebuffer Older Qualcomm drivers rotated the framebuffer 90 degrees and this fix didn't work. Now for some obscene reason it rotates a full 180 degrees. This can at least be worked around by flipping around the image on our end. --- Source/Core/VideoBackends/OGL/Render.cpp | 13 +++++++++---- Source/Core/VideoCommon/DriverDetails.cpp | 1 + Source/Core/VideoCommon/DriverDetails.h | 9 +++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 898d907dc1..a04071be30 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1299,10 +1299,15 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& r UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); TargetRectangle flipped_trc = GetTargetRectangle(); - // Flip top and bottom for some reason; TODO: Fix the code to suck less? - int tmp = flipped_trc.top; - flipped_trc.top = flipped_trc.bottom; - flipped_trc.bottom = tmp; + if (DriverDetails::HasBug(DriverDetails::BUG_ROTATEDFRAMEBUFFER)) + { + std::swap(flipped_trc.left, flipped_trc.right); + } + else + { + // Flip top and bottom for some reason; TODO: Fix the code to suck less? + std::swap(flipped_trc.top, flipped_trc.bottom); + } GL_REPORT_ERRORD(); diff --git a/Source/Core/VideoCommon/DriverDetails.cpp b/Source/Core/VideoCommon/DriverDetails.cpp index dce690505a..e25cd4e9bd 100644 --- a/Source/Core/VideoCommon/DriverDetails.cpp +++ b/Source/Core/VideoCommon/DriverDetails.cpp @@ -47,6 +47,7 @@ namespace DriverDetails {OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, -1, BUG_BROKENSWAP, -1.0, 46.0, true}, {OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, -1, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true}, {OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, -1, BUG_BROKENTEXTURESIZE, -1.0, -1.0, true}, + {OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, -1, BUG_ROTATEDFRAMEBUFFER, 53.0, -1.0, true}, {OS_ALL, VENDOR_ARM, DRIVER_ARM_T6XX, -1, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true}, {OS_ALL, VENDOR_MESA, DRIVER_NOUVEAU, -1, BUG_BROKENUBO, 900, 916, true}, {OS_ALL, VENDOR_MESA, DRIVER_R600, -1, BUG_BROKENUBO, 900, 913, true}, diff --git a/Source/Core/VideoCommon/DriverDetails.h b/Source/Core/VideoCommon/DriverDetails.h index 68c31cc932..9f95744db9 100644 --- a/Source/Core/VideoCommon/DriverDetails.h +++ b/Source/Core/VideoCommon/DriverDetails.h @@ -165,6 +165,15 @@ namespace DriverDetails // TODO: some windows AMD driver/gpu combination seems also affected // but as they all support pinned memory, it doesn't matter BUG_BROKENUNSYNCMAPPING, + // Bug: Adreno now rotates the framebuffer on blit a full 180 degrees + // Affected devices: Adreno + // Started Version: v53 (dev drivers) + // Ended Version: -1 + // Qualcomm is a super pro company that has recently updated their development drivers + // These drivers are available to the Nexus 5 and report as v53 + // Qualcomm in their infinite wisdom thought it was a good idea to rotate the framebuffer 180 degrees on glBlit + // This bug allows us to work around that rotation by rotating it the right way around again. + BUG_ROTATEDFRAMEBUFFER, }; // Initializes our internal vendor, device family, and driver version