[ANDROID] Add two new DriverDetails bugs for Adreno. V45 of the driver has broken shader compilation with UBOs in the shaders, this is most likely fixed with V53 found in the Nexus 5. Add a bug for issue surrounding on screentext and doing a glClear after swap causes screen swizzling and zero frames rendered respectively. On the Java side, pass in the dimensions of the screen swapped since there is an issue with Adreno where it rotates the output 90 degrees for some reason. Disable the GLSL shader cache on Android for now due to the inability to cleanly exit the emulator, this tends to cause the cache to get corrupted. All this together fixes rendering with Adreno 3xx GPUs with driver version v14 and above. In particular my Galaxy S4 still resets with this without the root commands, but my HTC Droid DNA and LG G2 is fine. This must be due to particular 'enhancements' that the Samsung kernel has over the other ones. The speed on Adreno has yet to be optimized, so it will most likely be slow still. Faster than the software rasterizer in any case. The ARMJIT is still broken in at this point, so not much fun can be had.

This commit is contained in:
Ryan Houdek 2013-09-18 02:36:48 -05:00
parent db7f8697ba
commit 24a44ecfb8
5 changed files with 69 additions and 31 deletions

View File

@ -3,13 +3,16 @@ package org.dolphinemu.dolphinemu;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.DisplayMetrics;
import android.view.*;
import android.view.WindowManager.LayoutParams;
import org.dolphinemu.dolphinemu.settings.InputConfigFragment;
import org.dolphinemu.dolphinemu.settings.VideoSettingsFragment;
import java.util.List;
@ -52,7 +55,18 @@ public final class EmulationActivity extends Activity
// and set on the native side of the code so the emulator can actually
// load the game.
Intent gameToEmulate = getIntent();
NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight);
// Due to a bug in Adreno, it renders the screen rotated 90 degrees when using OpenGL
// Flip the width and height when on Adreno to work around this.
// Mali isn't affected by this bug.
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.getString("gpuPref", "Software Rendering").equals("OGL")
&& VideoSettingsFragment.SupportsGLES3()
&& VideoSettingsFragment.m_GLVendor.equals("Qualcomm"))
NativeLibrary.SetDimensions((int)screenHeight, (int)screenWidth);
else
NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight);
NativeLibrary.SetFilename(gameToEmulate.getStringExtra("SelectedGame"));
Running = true;

View File

@ -6,15 +6,6 @@
package org.dolphinemu.dolphinemu.settings;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import javax.microedition.khronos.opengles.GL10;
import org.dolphinemu.dolphinemu.R;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
@ -23,12 +14,19 @@ import android.preference.ListPreference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import org.dolphinemu.dolphinemu.R;
import javax.microedition.khronos.egl.*;
import javax.microedition.khronos.opengles.GL10;
/**
* Responsible for handling the loading of the video preferences.
*/
public final class VideoSettingsFragment extends PreferenceFragment
{
public static String m_GLVersion;
public static String m_GLVendor;
public static String m_GLRenderer;
private Activity m_activity;
/**
@ -138,9 +136,9 @@ public final class VideoSettingsFragment extends PreferenceFragment
public static boolean SupportsGLES3()
{
VersionCheck mbuffer = new VersionCheck();
String m_GLVersion = mbuffer.getVersion();
String m_GLVendor = mbuffer.getVendor();
String m_GLRenderer = mbuffer.getRenderer();
m_GLVersion = mbuffer.getVersion();
m_GLVendor = mbuffer.getVendor();
m_GLRenderer = mbuffer.getRenderer();
boolean mSupportsGLES3 = false;

View File

@ -30,6 +30,8 @@ namespace DriverDetails
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_NODYNUBOACCESS, 14.0, -1.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENCENTROID, 14.0, -1.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENINFOLOG, -1.0, -1.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_ANNIHILATEDUBOS, 41.0, 46.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENSWAP, -1.0, -1.0, true},
{VENDOR_MESA, DRIVER_NOUVEAU, BUG_BROKENUBO, 900, 916, true},
{VENDOR_MESA, DRIVER_R600, BUG_BROKENUBO, 900, 913, true},
{VENDOR_MESA, DRIVER_I965, BUG_BROKENUBO, 900, 920, true},

View File

@ -99,6 +99,22 @@ namespace DriverDetails
// to be broken. We just get flickering/black rendering when using pinned memory here -- degasus - 2013/08/20
// Please see issue #6105 on google code. Let's hope buffer storage solves this issues.
BUG_BROKENPINNEDMEMORY,
// Bug: Entirely broken UBOs
// Affected devices: Qualcomm/Adreno
// Started Version: ? (Noticed on v45)
// Ended Version: -1
// Uniform buffers are entirely broken on Qualcomm drivers with v45
// Trying to use the uniform buffers causes a malloc to fail inside the driver
// To be safe, blanket drivers from v41 - v45
BUG_ANNIHILATEDUBOS,
// Bug : Can't draw on screen text and clear correctly.
// Affected devices: Qualcomm/Adreno
// Started Version: ?
// Ended Version: ?
// Current code for drawing on screen text and clearing the framebuffer doesn't work on Adreno
// Drawing on screen text causes the whole screen to swizzle in a terrible fashion
// Clearing the framebuffer causes one to never see a frame.
BUG_BROKENSWAP,
};
// Initializes our internal vendor, device family, and driver version

View File

@ -372,11 +372,15 @@ Renderer::Renderer()
GLFunc::Init();
WARN_LOG(VIDEO, "Running the OpenGL ES 3 backend!");
g_Config.backend_info.bSupportsDualSourceBlend = false;
g_Config.backend_info.bSupportsGLSLUBO = true;
g_Config.backend_info.bSupportsGLSLUBO = !DriverDetails::HasBug(DriverDetails::BUG_ANNIHILATEDUBOS);
g_Config.backend_info.bSupportsPrimitiveRestart = true;
g_Config.backend_info.bSupportsEarlyZ = false;
#ifdef ANDROID
g_ogl_config.bSupportsGLSLCache = false;
#else
g_ogl_config.bSupportsGLSLCache = true;
#endif
g_ogl_config.bSupportsGLPinnedMemory = false;
g_ogl_config.bSupportsGLSync = true;
g_ogl_config.bSupportsGLBaseVertex = false;
@ -1557,31 +1561,35 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
if (XFBWrited)
s_fps = UpdateFPSCounter();
// ---------------------------------------------------------------------
GL_REPORT_ERRORD();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (!DriverDetails::HasBug(DriverDetails::BUG_BROKENSWAP))
{
GL_REPORT_ERRORD();
DrawDebugInfo();
DrawDebugText();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_REPORT_ERRORD();
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_ONFRAME);
OSD::DrawMessages();
GL_REPORT_ERRORD();
DrawDebugInfo();
DrawDebugText();
GL_REPORT_ERRORD();
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_ONFRAME);
OSD::DrawMessages();
GL_REPORT_ERRORD();
}
// Copy the rendered frame to the real window
GLInterface->Swap();
GL_REPORT_ERRORD();
// Clear framebuffer
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
GL_REPORT_ERRORD();
if (!DriverDetails::HasBug(DriverDetails::BUG_BROKENSWAP))
{
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
GL_REPORT_ERRORD();
}
if(s_vsync != g_ActiveConfig.IsVSync())
{