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 1948

Summary: Screen remains blank after update
Product: SDL Reporter: Nicolae Berendea <berendeanicolae>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED ENDOFLIFE QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: 1.2.15   
Hardware: x86_64   
OS: Linux   

Description Nicolae Berendea 2013-07-09 14:12:01 UTC
The screen doesn't update after I call SDL_Flip or SDL_UpdateRect. I checked for errors reported by SDL_GetError and the values all the functions returned but all seems normal. If I run the program with valgrind, the screen gets updated. Also, if I call the function multiple times +4, the screen gets updated.
Comment 1 Ryan C. Gordon 2013-07-09 16:50:23 UTC
Is there source code for your app we can see? I'd like to try to reproduce this problem here.

--ryan.
Comment 2 Nicolae Berendea 2013-07-10 02:39:34 UTC
I have this problem at all the sources I tested (I have to update multiple times to have the screen updated). I've checked again and it seems to work fine the very first time I run the executable, so I am not sure if SDL is the problem. 

Here is the source code:

#include <SDL/SDL.h>
#include <cstdio>

int main()
{
	SDL_Init(SDL_INIT_EVERYTHING);
	SDL_Surface *screen;
	
	if ((screen=SDL_SetVideoMode(800,600,24,0))==NULL)
		printf("Error!\n");
	if (SDL_FillRect(screen,NULL,0xffffff)<0)
		printf("Error!\n");
	SDL_UpdateRect(screen,0,0,0,0);
	//printf("%d\n",SDL_Flip(screen));
	SDL_Flip(screen);
	puts(SDL_GetError());
	SDL_Delay(3000);

	SDL_Quit();
	return 0;
}
Comment 3 Nicolae Berendea 2013-07-10 03:59:06 UTC
I tried another window manager (lxde) and I observed that the screen updates right (currently I am using awesome wm). So I returned (to awesome), modified the code and I concluded that awesome wm is the problem because if I add a delay before I update the screen first time, it works well after that. 

I am sorry for reporting the problem in the wrong place. 
Anyway, If you need any additional information, ask and I will do my best to respond.
Comment 4 Sam Lantinga 2013-07-10 05:48:28 UTC
I've seen this on Ubuntu under Unity running on VMware as well with SDL 2.0.  It's just the first update that doesn't show anything.  Subsequent updates work correctly.

I'm going to close this for now.  Feel free to reopen it if someone has an idea of what's going on.
Comment 5 Ryan C. Gordon 2013-07-10 11:43:01 UTC
If it's just the first frame, I'm not too concerned, but maybe it's a race with the X server to draw before the window is realized, or something?

--ryan.
Comment 6 Nicolae Berendea 2013-07-12 02:23:10 UTC
It's not the first frame. It works only after a certain amount of time. That means I have to add a delay or to update 3-4 times (until that time passed). I think that's why it was working when I run the program with valgrind (it runs much slower).

So, shortly, you may be right that it's the race thing (I have no idea how it works).

Sorry I responded so late. I will respond faster next time.
Comment 7 Nicolae Berendea 2013-07-13 03:17:11 UTC
Is there something I can do to avoid using that delay at the begining. Or what do you think is the best way to have a functional program?
Comment 8 Ryan C. Gordon 2013-07-13 21:21:03 UTC
Just realized this is for SDL 1.2...Sam, did you see this in the 2.0 branch, too?

--ryan.
Comment 9 Nicolae Berendea 2013-07-14 03:40:07 UTC
I've just tried the sdl2 version. The screen remains black.


#include <SDL2/SDL.h>
int main()
{
	SDL_Init(SDL_INIT_VIDEO);
	SDL_Window *window;
	SDL_Renderer *renderer;
	SDL_Rect rect={0,0,100,100};

	SDL_CreateWindowAndRenderer(480,360,0,&window,&renderer);
	//SDL_Delay(100);
	SDL_SetRenderDrawColor(renderer,255,255,255,255);
	SDL_RenderFillRect(renderer,&rect);
	SDL_RenderPresent(renderer);
	SDL_UpdateWindowSurface(window);
	SDL_Delay(1000);
	SDL_Quit();
	return 0;
}
Comment 10 Sam Lantinga 2013-07-14 17:08:58 UTC
Yes, I saw this with SDL 2.0.  I think it's an X11 regression.
Comment 11 Ryan C. Gordon 2015-08-25 09:38:22 UTC
Hello, and sorry if you're getting several copies of this message by email, since we are closing many bugs at once here.

We have decided to mark all SDL 1.2-related bugs as RESOLVED ENDOFLIFE, as we don't intend to work on SDL 1.2 any further, but didn't want to mark a large quantity of bugs as RESOLVED WONTFIX, to clearly show what was left unattended to and make it easily searchable.

Our current focus is on SDL 2.0.

If you are still having problems with an ENDOFLIFE bug, your absolute best option is to move your program to SDL2, as it will likely fix the problem by default, and give you access to modern platforms and tons of super-cool new features.

Failing that, we _will_ accept small patches to fix these issues, and put them in revision control, although we do not intend to do any further official 1.2 releases.

Failing that, please feel free to contact me directly by email (icculus@icculus.org) and we'll try to find some way to help you out of your situation.

Thank you,
--ryan.