We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4232

Summary: SDL2-2.0.8 with Directfb requires hardware accelerator to work?
Product: SDL Reporter: Peter Thompson <peter.macleod.thompson>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.8   
Hardware: ARM   
OS: Linux   

Description Peter Thompson 2018-08-16 22:41:51 UTC
For example, the SDL2 wiki "SDL_GetWindowSurface" sample code

	https://wiki.libsdl.org/SDL_GetWindowSurface

doesn't work with directfb unless there is a hardware accelerator AFAIK.  With "software" only, it exits with an error.  

The source code (SDL2/src/video/SDL_video.c)  call stack shown below shows why:

 #1 SDL_GetWindowSurface
 #2 SDL_CreateWindowFramebuffer
 #3 _this->CreateWindowFramebuffer == SDL_CreateWindowTexture for directFB
 #3 SDL_CreateWindowTexture
 #4 SDL_GetWindowData 

SDL_CreateWindowTexture executes the following code (SDL_video.c)  
        if (!renderer) {
            for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
                SDL_RendererInfo info;
                SDL_GetRenderDriverInfo(i, &info);
                if (SDL_strcmp(info.name, "software") != 0) {
                    renderer = SDL_CreateRenderer(window, i, 0);
                    if (renderer) {
                        break;
                    }
                }
            }
        }
        if (!renderer) {
            return SDL_SetError("No hardware accelerated renderers available");

        /* Create the data after we successfully create the renderer (bug #1116) */


SDL_CreateRenderer() which calls SW_CreateRenderer() for "software" also does not work because SDL_GetWindowSurface gets called in the process. 

I am quite sure this all used to work in earlier versions of SDL2. Also Buildroot creates SDL2 with directfb used to work and no longer does (which is why I am writing this note).  Hence I am assuming this is a bug.   Not sure if bug #1116 commented in the source code is related or not.
Comment 1 Peter Thompson 2018-08-28 01:40:26 UTC
SDL2 on Beaglebone Black works using DirectFB using the following patch

https://hg.libsdl.org/SDL/raw-rev/751cdc74d55c

which was created by Sam Lantinga and which is to be incorporated in the next release of SDL2.