Refresh trouble in X11

Hi all,

On Ubuntu 8 (64bits), in windowed mode, if an application
refreshes only some areas of the screen (with dirty rectangles),
and if the SDL window gets overlayed by another X11 window, then
only the dirty rectangles get blit, the rest of the pixels are lost.

This refresh problem doesn’t occur on Mac OS X.

I’m talking about SDL 1.2

Any idea ?

Julien

Hi all,

On Ubuntu 8 (64bits), in windowed mode, if an application
refreshes only some areas of the screen (with dirty rectangles),
and if the SDL window gets overlayed by another X11 window, then
only the dirty rectangles get blit, the rest of the pixels are lost.

This refresh problem doesn’t occur on Mac OS X.

I’m talking about SDL 1.2

Any idea ?

Redraw the the whole window when you get an expose event.

I’m assuming that you are using your own dirty rectangle code which
means you fix the damage done by changes that are under your control.
Damage done to the window by the windowing system, is of course, not
known by your code and can’t be fixed by your dirty rectangle code.
So, you have to redraw the whole window when you get an expose event.

And, yes Mac OS X is not Ubuntu/Linux with X11. Two different systems
with two different behaviors. You can not expect Mac OS X to act like
X windows on Linux and both are different from MS Windows.

Bob PendletonOn Fri, Jan 23, 2009 at 1:58 PM, julien CLEMENT wrote:

Julien


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

±-------------------------------------+

Redraw the the whole window when you get an expose event.

I’m assuming that you are using your own dirty rectangle code which
means you fix the damage done by changes that are under your control.
Damage done to the window by the windowing system, is of course, not
known by your code and can’t be fixed by your dirty rectangle code.

Can’t be known by your code? That’s really not true at all. Plenty of
windowing environments and GUI toolkits take special care to provide
the programmer with exactly that information.

So, you have to redraw the whole window when you get an expose event.

Yeah, generally that has been my approach, but I can see why you might
not want to have to do that.

If you just use double buffering, you can just use SDL_Flip()

And, yes Mac OS X is not Ubuntu/Linux with X11. Two different systems
with two different behaviors. You can not expect Mac OS X to act like
X windows on Linux and both are different from MS Windows.

With the advent of more sophisticated window composition software,
they can all actually act very similar. Mac OS X since version 10.3,
Windows Vista, and X with compositing enabled all pretty much
eliminate the need to react to window "damage."On Fri, Jan 23, 2009 at 3:37 PM, Bob Pendleton wrote:

On Fri, Jan 23, 2009 at 1:58 PM, julien CLEMENT wrote:


http://codebad.com/

Thank you !

Julien

— En date de?: Ven 23.1.09, Donny Viszneki <donny.viszneki at gmail.com> a ?crit?:> De: Donny Viszneki <donny.viszneki at gmail.com>

Objet: Re: [SDL] Refresh trouble in X11
?: “A list for developers using the SDL library. (includes SDL-announce)”
Date: Vendredi 23 Janvier 2009, 23h24
On Fri, Jan 23, 2009 at 3:37 PM, Bob Pendleton wrote:

On Fri, Jan 23, 2009 at 1:58 PM, julien CLEMENT <@Julien_Clement1> wrote:
Redraw the the whole window when you get an expose
event.

I’m assuming that you are using your own dirty
rectangle code which
means you fix the damage done by changes that are
under your control.
Damage done to the window by the windowing system, is
of course, not
known by your code and can’t be fixed by your
dirty rectangle code.

Can’t be known by your code? That’s really not true
at all. Plenty of
windowing environments and GUI toolkits take special care
to provide
the programmer with exactly that information.

So, you have to redraw the whole window when you get
an expose event.

Yeah, generally that has been my approach, but I can see
why you might
not want to have to do that.

If you just use double buffering, you can just use
SDL_Flip()

And, yes Mac OS X is not Ubuntu/Linux with X11. Two
different systems
with two different behaviors. You can not expect Mac
OS X to act like
X windows on Linux and both are different from MS
Windows.

With the advent of more sophisticated window composition
software,
they can all actually act very similar. Mac OS X since
version 10.3,
Windows Vista, and X with compositing enabled all pretty
much
eliminate the need to react to window “damage.”


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Redraw the the whole window when you get an expose event.

I’m assuming that you are using your own dirty rectangle code which
means you fix the damage done by changes that are under your control.
Damage done to the window by the windowing system, is of course, not
known by your code and can’t be fixed by your dirty rectangle code.

Can’t be known by your code? That’s really not true at all. Plenty of
windowing environments and GUI toolkits take special care to provide
the programmer with exactly that information.

In the situation he described, it can not be known to his code. The
SDL expose event does not return a damaged rectangles list. X11 lets
you get the damaged list, but SDL does not.

Please Donny, consider the context of an answer.

So, you have to redraw the whole window when you get an expose event.

Yeah, generally that has been my approach, but I can see why you might
not want to have to do that.

I surely can see why you might not want to. My experience is that
wants and desires have no effect on reality.

If you just use double buffering, you can just use SDL_Flip()

Which does what? It redraws the entire window. :slight_smile:

And, yes Mac OS X is not Ubuntu/Linux with X11. Two different systems
with two different behaviors. You can not expect Mac OS X to act like
X windows on Linux and both are different from MS Windows.

With the advent of more sophisticated window composition software,
they can all actually act very similar. Mac OS X since version 10.3,
Windows Vista, and X with compositing enabled all pretty much
eliminate the need to react to window “damage.”

Not in this case or else the question would not have been asked.

Gee, if I had some bread I could make a ham sandwich… if I had some ham.

Seriously, consider the context of a question and answer before
jumping all over the people trying to answer it.

Bob PendletonOn Fri, Jan 23, 2009 at 4:24 PM, Donny Viszneki <donny.viszneki at gmail.com> wrote:

On Fri, Jan 23, 2009 at 3:37 PM, Bob Pendleton <@Bob_Pendleton> wrote:

On Fri, Jan 23, 2009 at 1:58 PM, julien CLEMENT wrote:


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

±-------------------------------------+

Just trying to provide a counterpoint to the “all’s well in SDL land” vibeOn Sun, Jan 25, 2009 at 7:18 PM, Bob Pendleton wrote:

Seriously, consider the context of a question and answer before
jumping all over the people trying to answer it.


http://codebad.com/

Ah, but Bob, in your limited experience you haven’t met my wife have you?
:sunglasses:

JeffOn Sunday 25 January 2009 16:18, Bob Pendleton wrote:

I surely can see why you might not want to. My experience is that
wants and desires have no effect on reality.

I surely can see why you might not want to. My experience is that
wants and desires have no effect on reality.

Ah, but Bob, in your limited experience you haven’t met my wife have you?
:sunglasses:

If you are making nasty comments about your wife in a public forum you
either need counseling or a lawyer.

Bob PendletonOn Sun, Jan 25, 2009 at 7:39 PM, Jeff Post <j_post at pacbell.net> wrote:

On Sunday 25 January 2009 16:18, Bob Pendleton wrote:

Jeff


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

±-------------------------------------+

In the situation he described, it can not be known to his code. The
SDL expose event does not return a damaged rectangles list. X11 lets
you get the damaged list, but SDL does not.

SDL doesn’t provide that in its expose event? That’s kind of
unfortunate, especially as it’s something that’s really easy to fake
if the underlying platform wouldn’t provide it (just cover the whole
window, getting the same effect).

Would be a nice addition to 1.3 (if it’s not there already?)…

If you just use double buffering, you can just use SDL_Flip()

Which does what? It redraws the entire window. :slight_smile:

Maybe even twice, if the underlying platform does double buffering. :-)On Sun, Jan 25, 2009 at 7:18 PM, Bob Pendleton wrote:


http://pphaneuf.livejournal.com/

It was an attempt at humor, Bob. For all of us, our perception of reality is
determined somewhat by our wants and desires. It’s part of being human. My
wife goes a bit farther than most, so it tickled my funny bone a bit. Mea
culpa.

JeffOn Sunday 25 January 2009 18:40, Bob Pendleton wrote:

If you are making nasty comments about your wife in a public forum you
either need counseling or a lawyer.

If you are making nasty comments about your wife in a public forum you
either need counseling or a lawyer.

It was an attempt at humor, Bob. For all of us, our perception of reality is
determined somewhat by our wants and desires. It’s part of being human. My
wife goes a bit farther than most, so it tickled my funny bone a bit. Mea
culpa.

Sorry, I completely missed it. :slight_smile: I feel so damned lucky to be
married to my wife that I never say anything that could be construed
as negative about her… Which is an example of exactly what you just
said. LOL! My perception of my personal reality made me miss the humor
in what you said.

Bob PendletonOn Sun, Jan 25, 2009 at 11:46 PM, Jeff Post <j_post at pacbell.net> wrote:

On Sunday 25 January 2009 18:40, Bob Pendleton wrote:

Jeff


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

±-------------------------------------+

In the situation he described, it can not be known to his code. The
SDL expose event does not return a damaged rectangles list. X11 lets
you get the damaged list, but SDL does not.

SDL doesn’t provide that in its expose event?

Nope, nothing but the fact that you need to redraw the window.

That’s kind of
unfortunate, especially as it’s something that’s really easy to fake
if the underlying platform wouldn’t provide it (just cover the whole
window, getting the same effect).

Yes, and no. It is really easy to fake. To implement it you would have
to write code to convert the underlying platforms damaged rectangle
list to SDL’s rectangle list format. Which is not a lot of code…

But, how often would it get used? Even on old X11 code from the '80s
very few people bothered to do anything but redraw the whole window.
It is mainly useful on low performance computers.

You have to remember that things like the damaged rectangle list as
part of an expose event was invented back when people were first
putting GUIs on computers. X11 was designed for the 3 (or maybe 4) M
computer where M stands for 1,000,000 (one million). The Ms were for a
Megabyte of ram, a Million 1 bit pixels, a Million
instructions/second, and 1 Megabit/second Ethernet. The original Mac
was a bit shy of those specs as were the first PCs the ran Windows
1.0. But, were not far off. In those days the GUI value of updating
fragments of the screen was pretty high because updating the screen at
all was slow.

OTOH, we have recently entered the Giga (billion 1,000,000,000) Age
where we have Billions of instructions/second, billions of bytes of
ram, Billions of bits of graphic ram, and Billion bit per second
Ethernet.

The rules change when the measure of every facet of our machines
increases by a factor of 1,000. So, while some machines would benefit
from SDL having a damaged rectangles list as part of the expose event,
most would not. And, over the next few years the machines that would
benefit will fade away.

IMHO, the damaged rectangle list was left out of SDL in the first
place because even when SDL was new that information was of little use
to game developers. (Sam, please correct me if I am wrong.) I see
little value in adding it in now.

Bob PendletonOn Sun, Jan 25, 2009 at 10:55 PM, Pierre Phaneuf wrote:

On Sun, Jan 25, 2009 at 7:18 PM, Bob Pendleton <@Bob_Pendleton> wrote:

Would be a nice addition to 1.3 (if it’s not there already?)…

If you just use double buffering, you can just use SDL_Flip()

Which does what? It redraws the entire window. :slight_smile:

Maybe even twice, if the underlying platform does double buffering. :slight_smile:


http://pphaneuf.livejournal.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

±-------------------------------------+

The rules change when the measure of every facet of our machines
increases by a factor of 1,000.

Now, my two first computer systems were an NES and an Apple IIe. I could stick a cartridge in the NES, hit the power button, and be up and running in under 15 seconds. How long does it take a PS3, Wii or Xbox 360 to boot up these days? (Or an NDS or PSP?)

Same goes for the IIe. Most of my games and other applications were up and running in under a minute once I hit the power switch. Now, if you’re lucky, you can boot a modern PC with Windows XP and reach the desktop in about a minute, but it still takes a while for the system to load autorun processes and stabilize, then you need to find your program and wait for it to load up. OSX is similar. Linux probably is too. (If you’re using Vista, you’ll be waiting even longer.)

If computers have increased in power by a factor of several thousands, why are they so much slower today?>----- Original Message ----

From: Bob Pendleton
Subject: Re: [SDL] Refresh trouble in X11

Yes, and no. It is really easy to fake. To implement it you would have
to write code to convert the underlying platforms damaged rectangle
list to SDL’s rectangle list format. Which is not a lot of code…

Were I to do it, I’d just lift what’s in XExposeEvent right off, and
"lie" on platforms where I don’t have the whole information (count
might be always zero, or the x/y/w/h always the full window). But…

But, how often would it get used? Even on old X11 code from the '80s
very few people bothered to do anything but redraw the whole window.
It is mainly useful on low performance computers.

OTOH, we have recently entered the Giga (billion 1,000,000,000) Age
where we have Billions of instructions/second, billions of bytes of
ram, Billions of bits of graphic ram, and Billion bit per second
Ethernet.

… what I’d actually do is take advantage of those gigathings, and do
like every other platform: just double-buffer without telling anyone.
:wink:

On X11, it’s very easy to do, by creating a Pixmap that’s the same
size as the window, setting it as the background of your window, take
the relevant stuff out of your event mask (so we don’t get spam we
don’t need), draw to that Pixmap instead, and follow up draws with a
XClearArea of the same place on the window. Works even everywhere, it
just might be slower on older machines (those with crummy old drivers
that do not keep Pixmaps in offscreen memory).

The Pixmap can be a shared memory pixmap, too, if that works (on many
newer cards/drivers, it doesn’t anymore, because they actually put
them on the video card, so it’s still okay), but it’s not required for
it to work.

There’s also the backing store flag, but I’m not sure if that’s
implemented. Basically amounts to the same…On Mon, Jan 26, 2009 at 12:19 PM, Bob Pendleton wrote:


http://pphaneuf.livejournal.com/

Now, my two first computer systems were an NES and an Apple IIe. I could stick a cartridge in the NES, hit the power button, and be up and running in under 15 seconds.

15 seconds for an NES ?

usually 2 full frames,
each frame ~= 1/60 sec,
2/60 = 1/30 ~= 33 ms << 15 sec :stuck_out_tongue:

I was referring to total time from pressing the power button to being actually in-game and playing. But yeah, “boot time” was a fraction of a second.>----- Original Message ----

From: “mattmatteh at mac.com
Subject: Re: [SDL] Refresh trouble in X11

Now, my two first computer systems were an NES and an Apple IIe. I could stick a cartridge in the NES, hit the power button, and be up and running in under 15 seconds.

15 seconds for an NES ?

usually 2 full frames,
each frame ~= 1/60 sec,
2/60 = 1/30 ~= 33 ms << 15 sec :stuck_out_tongue:

I’m so glad to read that !
Yes we have very powerful machines, Open GL, amazing memories, but the systems are very heavy, that’s true. Nostalgy from earlier days when you could see so fast, fluid, and fun softwares & games :slight_smile:
All that because of normalization ?

Let’s make another OS :slight_smile:

By the way, I’m amazed to see how a little message concerning stupid dirty rectangles has triggered a passionate discussion ^^

Julien

— En date de?: Lun 26.1.09, Mason Wheeler a ?crit?:> De: Mason Wheeler

Objet: Re: [SDL] Refresh trouble in X11
?: “A list for developers using the SDL library. (includes SDL-announce)”
Date: Lundi 26 Janvier 2009, 18h52

----- Original Message ----

From: Bob Pendleton
Subject: Re: [SDL] Refresh trouble in X11

The rules change when the measure of every facet of our
machines
increases by a factor of 1,000.

Now, my two first computer systems were an NES and an Apple
IIe. I could stick a cartridge in the NES, hit the power
button, and be up and running in under 15 seconds. How long
does it take a PS3, Wii or Xbox 360 to boot up these days?
(Or an NDS or PSP?)

Same goes for the IIe. Most of my games and other
applications were up and running in under a minute once I
hit the power switch. Now, if you’re lucky, you can
boot a modern PC with Windows XP and reach the desktop in
about a minute, but it still takes a while for the system to
load autorun processes and stabilize, then you need to find
your program and wait for it to load up. OSX is similar.
Linux probably is too. (If you’re using Vista,
you’ll be waiting even longer.)

If computers have increased in power by a factor of several
thousands, why are they so much slower today?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

By the way, 15 seconds includes the title screen and all :slight_smile:
some games were launching instantly:

t = 0 : power button
t = 10ms : title screen
t = 1s : push start
t = 1s+epsilon : play lol

:wink:

— En date de?: Lun 26.1.09, Mason Wheeler a ?crit?:> De: Mason Wheeler

Objet: Re: [SDL] Refresh trouble in X11
?: “A list for developers using the SDL library. (includes SDL-announce)”
Date: Lundi 26 Janvier 2009, 21h24
I was referring to total time from pressing the power button
to being actually in-game and playing. But yeah, “boot
time” was a fraction of a second.

----- Original Message ----
From: "mattmatteh at mac.com"

Subject: Re: [SDL] Refresh trouble in X11

Now, my two first computer systems were an NES and
an Apple IIe. I could stick a cartridge in the NES, hit the
power button, and be up and running in under 15 seconds.

15 seconds for an NES ?

usually 2 full frames,
each frame ~= 1/60 sec,
2/60 = 1/30 ~= 33 ms << 15 sec :stuck_out_tongue:


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

t = 0 : power button
t = 10ms : title screen
t = 1s : push start
t = 1s+epsilon : play lol

A bit longer if you’re playing Contra: up up down down left right left
right B A start!On Mon, Jan 26, 2009 at 4:18 PM, julien CLEMENT wrote:


http://pphaneuf.livejournal.com/

That is very easy to answer.

On those days the complete OS was in ROM. When you turned it on, the
initialization code
just had to create a few data strutures in RAM, and you were set.

Now a normal computer has to:
- Do BIOS boot test verfication;
- Load OS from disk to RAM, while performing the following actions;
- dynamic linker has to search all required dynamic libraries for
each executable, load them and
relocate the symbols;
- several processes are launched in paralel triggered lots of disk
access requests;
- network configuration is started;
- and so on

So the computers nowadays a way lot faster, but we managed to slow them down
by making them
do lots of stuff during the boot process. I think I was able to turn on +
load a game on my ZX Spectrum,
quicker then I load XP on my laptop. :slight_smile:

If you look at the current solutions of having a Linux image in ROM in some
new laptops, it goes exactly into
the direction that the computers used to be in the 80s. It also boots very
quickly, under 30s.–
Paulo

On Mon, Jan 26, 2009 at 6:52 PM, Mason Wheeler wrote:

----- Original Message ----

From: Bob Pendleton
Subject: Re: [SDL] Refresh trouble in X11

The rules change when the measure of every facet of our machines
increases by a factor of 1,000.

Now, my two first computer systems were an NES and an Apple IIe. I could
stick a cartridge in the NES, hit the power button, and be up and running in
under 15 seconds. How long does it take a PS3, Wii or Xbox 360 to boot up
these days? (Or an NDS or PSP?)

Same goes for the IIe. Most of my games and other applications were up and
running in under a minute once I hit the power switch. Now, if you’re
lucky, you can boot a modern PC with Windows XP and reach the desktop in
about a minute, but it still takes a while for the system to load autorun
processes and stabilize, then you need to find your program and wait for it
to load up. OSX is similar. Linux probably is too. (If you’re using
Vista, you’ll be waiting even longer.)

If computers have increased in power by a factor of several thousands, why
are they so much slower today?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org