[SDL 2.0.8 - 2.0.9] Render Issue on Adreno 630

Something strange with pair SDL + Adreno 630.

I run simple test case render app which draw to 2 green rectangles on two different android devices:

  • xiaomi pocophone f1 (with Adreno 630)
  • samsung galaxy (version does not matter)

and I have strange drawing behaviour on xaomi (on the left side).

#include "SDL.h"

int main(int, char**)
if (SDL_Init(SDL_INIT_VIDEO) != 0)
return -1;

auto Renderer = SDL_CreateRenderer(Window, -1, SDL_RENDERER_ACCELERATED);

SDL_Event Event;
while (SDL_WaitEvent(NULL))
    while (SDL_PollEvent(&Event))
        SDL_SetRenderDrawColor(Renderer, 255, 255, 255, 255); // white

        SDL_SetRenderDrawColor(Renderer, 0, 255, 0, 255); // green

        SDL_Rect R;
        R.x = R.y = 50;
        R.w = R.h = 200;
        SDL_RenderFillRect(Renderer, &R);

        R.x = R.y = 300;
        SDL_RenderFillRect(Renderer, &R);

return 0;


For more details please look at the video https://www.youtube.com/watch?v=YRIdURATZJg&feature=youtu.be

the problem is not about xaiomi only, it seems to be it reproduces on all devices with Adreno 630.

Is there a workaround?

At least it reproduces on:

  • asus Zenfone 5Z ZS620KL;
  • Xaomi Pocophone F1.


Can you try adding this before SDL_CreateWindow ?
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);

Can you also try with last HG sources and provide some log if possible ?


Thank you very much!) i appreciate your help
it works for me now even for SDL 2.0.8)

You mean setting RGB to 565 solved the issue ? or you found a mistake ?

It should not be necessary to set those attributes (otherwise this should be make the default).
So maybe you could really try with latest source code.

Yes, setting RGB to 565 solved the issue.

I will try to check last source from hg later and will reply.

Sylvain_Becker, I took your last commit with ID 63abc8d1ca3a32dba7e15c0091d7c86a1a88b9a5 and Text “Android: move and group JNIEnv helper functions”,
I was rebuild c++ libs and rebuild my apk and issue still apperars on my device’s screen. The rectangles green or purple on different moment.

But now I do not understand why back color is black.

Devices running arm64-v8a

After I set RGB 565 rects become normally green but background still black.

My test app source was not changed and on windows it still show green rects on white screen as I expect.

If you need more Info feel free to asking.

My app users reported me this issue some days ago on Google Play and today I bought this device to try resolve problem.

My app’s user sent me the video to show me how my app (SDL 2.0.8) looks on * asus Zenfone 5Z ZS620KL:

My opinion is that it reminds me same kind of old issues (on other devices). Since that, I’ve always set those 565 RGB attributes.

By maybe it’s worth investigating this.

Just to make sure, with the latest sources:

  • you don’t have a black background if you set RGB 565 ?

  • and you don’t have this black bg on phones that are ok ? (and without RGB 565)

  • I would be curious to see, if the black background come from
    Android_JNI_SetSurfaceViewFormat(format); (in “src/video/SDL_egl.c”).
    (if you comment it on / off)

  • Instead of RGB 565,
    You could also try to modify SDL_EGL_ChooseConfig so that it always picks the config[0].
    See: https://hg.libsdl.org/SDL/file/63abc8d1ca3a/src/video/SDL_egl.c#l604

With latest sources:

For example give me the link for your application written on SDL and I’ll check it on my Xaomi.

SDL_egl.c (31.2 KB)

This version I’m working with.

No source code changings I made.

The black screen is actually another issue. Thanks for finding it !
I’ve created a ticket there: https://bugzilla.libsdl.org/show_bug.cgi?id=4453
It appears on Android and also on Linux, with GLES 2 and GLES 1 renderers.

Black background is fixed by https://hg.libsdl.org/SDL/rev/af47ff0de5ab. ClearColor wasn’t initialized.