Re: Blue/Purple Screen on New Android
Posted: Sun Dec 30, 2018 7:59 pm
Do you mean the main menu displays correctly during 1 second, then have the bug during 1 second, then this sequence repeats ? It's a useful information for me.
Freeciv - because civilization should be free!
http://forum.freeciv.org/f/
It's possible. But it happens only on some devices, and the options "disable hw overlays" and "force 4x msaa" fix the problem. I don't have skills in SDL but I think these options are not related to color space. Because this bug happens on powerful devices, it seems that slowing down the GPU helps to fix the problem.louis94 wrote:Maybe the wrong color space is somehow selected at startup?
Code: Select all
display_splash('userdata/presplash.png', (255, 255, 255))
+ time.sleep(5)
os.chdir(get_internal_storage() + '/package')
+ display_splash('userdata/presplash.png', (255, 255, 255),300,0) # move to the right
+ time.sleep(2)
I'll try this, but I don't know when I've time to do this.louis94 wrote:I'd try to reproduce with some basic SDL demos to rule out an upstream issue first.
Code: Select all
def create_window(size, hidden=False, fullscreen=False):
global _window, _window_handle
w, h = size
- flags = SDL_WINDOW_OPENGL # we need OpenGL, software renderer is shit
+ flags = 0 # Try software renderer
if hidden:
flags |= SDL_WINDOW_HIDDEN
if fullscreen:
flags |= SDL_WINDOW_FULLSCREEN
wnd = SDL_CreateWindow("touchciv", 0, 0, w, h, flags)
_window_handle = wnd
- renderer = SDL_CreateRenderer(wnd, -1, SDL_RENDERER_ACCELERATED)
+ renderer = SDL_CreateRenderer(wnd, -1, SDL_RENDERER_SOFTWARE)
if not renderer:
raise SDLError()
_window = _make_surface(renderer, NULL, size, "window")
Code: Select all
load_image userdata/intro.jpg : format 0x17101803
load_image userdata/options.png : format 0x16762004
Code: Select all
grep -ril pixelformat android/project/src/ android/project/jni/src/ lib/ src/
android/project/src/main/java/org/libsdl/app/SDLActivity.java (part of SDL2-2.0.9.tar.gz)
android/project/jni/src/graphics.c (copy of lib/graphics.c generated from graphics.pyx)
lib/SDL.pxd
lib/graphics.pyx
lib/graphics.c (generated from graphics.pyx)
Code: Select all
// Called when the surface is resized
@Override
public void surfaceChanged(SurfaceHolder holder,
int format, int width, int height) {
Log.v("SDL", "surfaceChanged()");
if (SDLActivity.mSingleton == null) {
return;
}
int sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 by default
switch (format) {
case PixelFormat.A_8:
Log.v("SDL", "pixel format A_8");
break;
case PixelFormat.LA_88:
Log.v("SDL", "pixel format LA_88");
break;
case PixelFormat.L_8:
Log.v("SDL", "pixel format L_8");
break;
case PixelFormat.RGBA_4444:
Log.v("SDL", "pixel format RGBA_4444");
sdlFormat = 0x15421002; // SDL_PIXELFORMAT_RGBA4444
break;
case PixelFormat.RGBA_5551:
Log.v("SDL", "pixel format RGBA_5551");
sdlFormat = 0x15441002; // SDL_PIXELFORMAT_RGBA5551
break;
case PixelFormat.RGBA_8888:
Log.v("SDL", "pixel format RGBA_8888");
sdlFormat = 0x16462004; // SDL_PIXELFORMAT_RGBA8888
break;
case PixelFormat.RGBX_8888:
Log.v("SDL", "pixel format RGBX_8888");
sdlFormat = 0x16261804; // SDL_PIXELFORMAT_RGBX8888
break;
case PixelFormat.RGB_332:
Log.v("SDL", "pixel format RGB_332");
sdlFormat = 0x14110801; // SDL_PIXELFORMAT_RGB332
break;
case PixelFormat.RGB_565:
Log.v("SDL", "pixel format RGB_565");
sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565
break;
case PixelFormat.RGB_888:
Log.v("SDL", "pixel format RGB_888");
// Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead?
sdlFormat = 0x16161804; // SDL_PIXELFORMAT_RGB888
break;
default:
Log.v("SDL", "pixel format unknown " + format);
break;
}
mWidth = width;
mHeight = height;
int nDeviceWidth = width;
int nDeviceHeight = height;
try
{
if (Build.VERSION.SDK_INT >= 17) {
android.util.DisplayMetrics realMetrics = new android.util.DisplayMetrics();
mDisplay.getRealMetrics( realMetrics );
nDeviceWidth = realMetrics.widthPixels;
nDeviceHeight = realMetrics.heightPixels;
}
}
catch ( java.lang.Throwable throwable ) {}
synchronized(SDLActivity.getContext()) {
// In case we're waiting on a size change after going fullscreen, send a notification.
SDLActivity.getContext().notifyAll();
}
Log.v("SDL", "Window size: " + width + "x" + height);
Log.v("SDL", "Device size: " + nDeviceWidth + "x" + nDeviceHeight);
SDLActivity.onNativeResize(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate());
boolean skip = false;
int requestedOrientation = SDLActivity.mSingleton.getRequestedOrientation();
if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
{
// Accept any
}
else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT || requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT)
{
if (mWidth > mHeight) {
skip = true;
}
} else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE) {
if (mWidth < mHeight) {
skip = true;
}
}
// Special Patch for Square Resolution: Black Berry Passport
if (skip) {
double min = Math.min(mWidth, mHeight);
double max = Math.max(mWidth, mHeight);
if (max / min < 1.20) {
Log.v("SDL", "Don't skip on such aspect-ratio. Could be a square resolution.");
skip = false;
}
}
if (skip) {
Log.v("SDL", "Skip .. Surface is not ready.");
SDLActivity.mIsSurfaceReady = false;
return;
}
/* Surface is ready */
SDLActivity.mIsSurfaceReady = true;
/* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */
SDLActivity.onNativeSurfaceChanged();
SDLActivity.handleNativeState();
}