The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
2D game performance issue when compiz is enabled
Manu
Guest

Hi,

I'm developing a 2D game on linux which have a win32 port (with mingw.)
Lately I got a new faster computer and upgraded to ubuntu lucid. I got now
compiz working fine but my game is just running much slower, unless I
disable compiz. I think this relates to compiz using opengl and hardware
acceleration. So I'm looking for a way to have the game running at normal
speed but ***without*** disabling compiz. Until now, I've been unable to
fix the problem. Does anyone have a clue about what's going on?

Thanks in advance.

Manu


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Torsten Giebl


Joined: 12 Sep 2009
Posts: 172
Hello !


Quote:
I'm developing a 2D game on linux which have a win32 port (with mingw.)
Lately I got a new faster computer and upgraded to ubuntu lucid. I got now
compiz working fine but my game is just running much slower, unless I
disable compiz. I think this relates to compiz using opengl and hardware
acceleration. So I'm looking for a way to have the game running at normal
speed but ***without*** disabling compiz. Until now, I've been unable to
fix the problem. Does anyone have a clue about what's going on?

Are you using SDL 1.2 ?

It is the same with KDE 4 which uses 3D by Default.

I cannot say if it is really a problem with SDL 1.2 itself
or if it is a problem in general with 2D apps.

Even when testing with the simple testsprite on KDE 3 and no 3D and
KDE 4 with 3D, you see the number of FPS going down.


CU
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
MrOzBarry


Joined: 26 Jun 2010
Posts: 620
As much as it's annoying to disable compiz everytime, it is the way to go.  Try other games, too - you'll notice a huge performance difference when you disable compiz.  It's the nature of the beast - compiz really has no way of knowing if you're running a game that should take priority for hardware acceleration.  Most people recommend putting a SDL_Delay(1) at the end up your game loop, but I would recommend removing that if you want your program to take a higher priority.  That may or may not improve it, but it's worth a try

-Alex

On Wed, Aug 18, 2010 at 11:56 AM, Manu wrote:
Quote:
Hi,

I'm developing a 2D game on linux which have a win32 port (with mingw.)
Lately I got a new faster computer and upgraded to ubuntu lucid. I got now
compiz working fine but my game is just running much slower, unless I
disable compiz. I think this relates to compiz using opengl and hardware
acceleration. So I'm looking for a way to have the game running at normal
speed but ***without*** disabling compiz. Until now, I've been unable to
fix the problem. Does anyone have a clue about what's going on?

Thanks in advance.

Manu


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Jeremiah
Guest

You're using an old video driver. Compiz universally slows GL
performance, unless you have DRI2 support.

Take a look at http://fedoraproject.org/wiki/Features/DRI2#Summary

The solution you're looking for is hardware/driver related.


On Wed, Aug 18, 2010 at 11:56 AM, Manu wrote:
Quote:
Hi,

I'm developing a 2D game on linux which have a win32 port (with mingw.)
Lately I got a new faster computer and upgraded to ubuntu lucid. I got now
compiz working fine but my game is just running much slower, unless I
disable compiz. I think this relates to compiz using opengl and hardware
acceleration. So I'm looking for a way to have the game running at normal
speed but ***without*** disabling compiz. Until now, I've been unable to
fix the problem. Does anyone have a clue about what's going on?

Thanks in advance.

Manu


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Nikos Chantziaras
Guest

On 08/18/2010 06:56 PM, Manu wrote:
Quote:
Hi,

I'm developing a 2D game on linux which have a win32 port (with mingw.)
Lately I got a new faster computer and upgraded to ubuntu lucid. I got now
compiz working fine but my game is just running much slower, unless I
disable compiz. I think this relates to compiz using opengl and hardware
acceleration. So I'm looking for a way to have the game running at normal
speed but ***without*** disabling compiz. Until now, I've been unable to
fix the problem. Does anyone have a clue about what's going on?

Compiz has an option to unredirect fullscreen apps, so it's best to run
games in fullscreen mode.

Furthermore, KDE suspends compositing completely for fullscreen apps by
default.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Torsten Giebl


Joined: 12 Sep 2009
Posts: 172
Hello !


Quote:
Quote:
I'm developing a 2D game on linux which have a win32 port (with mingw.)
Lately I got a new faster computer and upgraded to ubuntu lucid. I got
now
compiz working fine but my game is just running much slower, unless I
disable compiz. I think this relates to compiz using opengl and hardware
acceleration. So I'm looking for a way to have the game running at normal
speed but ***without*** disabling compiz. Until now, I've been unable to
fix the problem. Does anyone have a clue about what's going on?

Compiz has an option to unredirect fullscreen apps, so it's best to run
games in fullscreen mode.

Furthermore, KDE suspends compositing completely for fullscreen apps by
default.


But i don't understand what the real reason for
the slow down is. Gfx cards have accelerated blits from
the system memory to the video memory.

Is this something that can be fixed with the Xorg drivers ?


CU
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Jeremiah
Guest

I'm confused as well about the lower 2D performance. 3D acceleration
interfering with 2D acceleration?
Unless this has something to do with Xrender. I wonder if Xrender is
optional in SDL?

If so, the solution maybe to detect loss in FPS and disable Xrender.
Falling back to the old style.





On Wed, Aug 18, 2010 at 9:39 AM, Torsten Giebl wrote:
Quote:
Hello !


Quote:
Quote:
I'm developing a 2D game on linux which have a win32 port (with mingw.)
Lately I got a new faster computer and upgraded to ubuntu lucid. I got
now
compiz working fine but my game is just running much slower, unless I
disable compiz. I think this relates to compiz using opengl and hardware
acceleration. So I'm looking for a way to have the game running at normal
speed but ***without*** disabling compiz. Until now, I've been unable to
fix the problem. Does anyone have a clue about what's going on?

Compiz has an option to unredirect fullscreen apps, so it's best to run
games in fullscreen mode.

Furthermore, KDE suspends compositing completely for fullscreen apps by
default.


But i don't understand what the real reason for
the slow down is. Gfx cards have accelerated blits from
the system memory to the video memory.

Is this something that can be fixed with the Xorg drivers ?


CU
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Paul Duffy
Guest

The performance hit is inevitable because there are effectively extra layers of
buffering for every single frame.

With the old-style pre-compiz way of doing things, there are a number of
functions internal to the graphics card which handle 2D operations including
fast drawing of basic primitives (rectangles and lines) and replacing a frame on
the screen is a simple matter of replacing a rectangular region from a
backbuffer with a simple bitstream. As much as this buffer may have to be
formatted and byte-aligned, it's still just a transfer of data from one memory
space to another. It's been this way since at least the '90s.

When using something like Compiz/Aero/Quartz, all the old 2D functonality is no
longer accessible and everything has to be done with textures so the new frame
has to be sent to the graphics card to be converted to a texture which is then
used to overwrite a texture which is linked to a plane. It's not quite as simple
a process. Add to this all the stuff being done in the background to have all
those effects that compiz provides and this uses resources that just aren't
being used without it. Then there's the mipmapping conversion if you have that
switched on for the fancy cube effect which means your image is being copied and
resized several time on every single new frame.

Of course, the extra resource use also means there's a performance hit for 3D
games as well, and not just because they have to go through an extra layer of
rendering to texture rather than accessing the screen directly. For every single
frame on screen of a windowed game, the entire context has to be switched out to
render the game frame to a texture, then render the compiz desktop with that
texture. It's still a fairly hefty performance impact.

Hope this answers some of your questions.

Regards, Paul


----- Original Message ----
From: Jeremiah
To: SDL Development List
Sent: Wed, 18 August, 2010 22:26:40
Subject: Re: [SDL] 2D game performance issue when compiz is enabled

I'm confused as well about the lower 2D performance. 3D acceleration
interfering with 2D acceleration?
Unless this has something to do with Xrender. I wonder if Xrender is
optional in SDL?

If so, the solution maybe to detect loss in FPS and disable Xrender.
Falling back to the old style.





On Wed, Aug 18, 2010 at 9:39 AM, Torsten Giebl wrote:
Quote:
Hello !


Quote:
Quote:
I'm developing a 2D game on linux which have a win32 port (with mingw.)
Lately I got a new faster computer and upgraded to ubuntu lucid. I got
now
compiz working fine but my game is just running much slower, unless I
disable compiz. I think this relates to compiz using opengl and hardware
acceleration. So I'm looking for a way to have the game running at normal
speed but ***without*** disabling compiz. Until now, I've been unable to
fix the problem. Does anyone have a clue about what's going on?

Compiz has an option to unredirect fullscreen apps, so it's best to run
games in fullscreen mode.

Furthermore, KDE suspends compositing completely for fullscreen apps by
default.


But i don't understand what the real reason for
the slow down is. Gfx cards have accelerated blits from
the system memory to the video memory.

Is this something that can be fixed with the Xorg drivers ?


CU
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Torsten Giebl


Joined: 12 Sep 2009
Posts: 172
Hello !


Windows 7 also uses 3D by default, but with Windows an old SDL 1.2
game does not show that big loss of speed, it may be a few frames,
but it is not the Linux 3D difference 2/3 of the original 2D speed.

I always thought that it is possible blitting an image from the system memory
to the video memory accelerated and without it being converted to a texture.


CU
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Nikos Chantziaras
Guest

On 08/19/2010 02:41 AM, Torsten Giebl wrote:
Quote:
Hello !


Windows 7 also uses 3D by default, but with Windows an old SDL 1.2
game does not show that big loss of speed, it may be a few frames,
but it is not the Linux 3D difference 2/3 of the original 2D speed.

The Linux graphics stack is still behind to what Windows can do
speedwise. It's getting better as of late, but I wouldn't hold my
breath. It'll be a while.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Jeremiah
Guest

If there's a single word answer. It would be DirectX.

Unified graphics/sound api.
Its the very same thing that makes SDL so appealing.

Not to mention, DirectX11 practically has all the features of opengl3
+ dri2 + etc,etc
already implemented and supported by drivers from all (nearly?) the
companies that sell graphics or audio hardware.

Microsoft might have a slight advantage here.




On Wed, Aug 18, 2010 at 7:41 PM, Torsten Giebl wrote:
Quote:
Hello !


Windows 7 also uses 3D by default, but with Windows an old SDL 1.2
game does not show that big loss of speed, it may be a few frames,
but it is not the Linux 3D difference 2/3 of the original 2D speed.

I always thought that it is possible blitting an image from the system memory
to the video memory accelerated and without it being converted to a texture.


CU
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Donny Viszneki
Guest

On Wed, Aug 18, 2010 at 8:54 PM, Jeremiah wrote:
Quote:
If there's a single word answer. It would be DirectX.

Unified graphics/sound api.
Its the very same thing that makes SDL so appealing.

Not to mention, DirectX11 practically has all the features of opengl3
+ dri2 + etc,etc
already implemented and supported by drivers from all (nearly?) the
companies that sell graphics or audio hardware.

Microsoft might have a slight advantage here.

One might even say an *unfair* advantage.

*leers at proprietary drivers and opaque hardware vendors*

--
http://codebad.com/
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Nikos Chantziaras
Guest

On 08/20/2010 11:25 PM, Donny Viszneki wrote:
Quote:
On Wed, Aug 18, 2010 at 8:54 PM, Jeremiah wrote:
Quote:
If there's a single word answer. It would be DirectX.

Unified graphics/sound api.
Its the very same thing that makes SDL so appealing.

Not to mention, DirectX11 practically has all the features of opengl3
+ dri2 + etc,etc
already implemented and supported by drivers from all (nearly?) the
companies that sell graphics or audio hardware.

Microsoft might have a slight advantage here.

One might even say an *unfair* advantage.

*leers at proprietary drivers and opaque hardware vendors*

Only NVidia. Intel and AMD/ATI have open specs, but someone has to
actually write drivers... They don't write themselves Razz

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Paul Duffy
Guest

Given the number of lengthy issues with drivers for both nVidia and ATI on
Vistas release I can only say: you what?

The performance advantage is that Aero is written directly into the display
system while Compiz is a layer on top of X. There are a number of very good
reasons why X itself hasn't been rewritten, primarily its cross-platformability
and the need for it to run on some very low powered systems. Unlike Vista/7 it
won't only ever be expected to run only on 9th/10th Gen x86 architecture with 3D
acceleration hardware of a predictable nature; same reason it's written entirely
in C without a hint of Assembly. You wouldn't get it working on the old PPC Macs
for starters.

Windows, on the other hand, has so much low-level MASM (funny how that always
makes me think 'miasma') that the Win32 Assembly libraries are usually discussed
as though a dialect in their own right.

In short: to dump all the extra layers of conversion and get any serious
performance improvement, an alternative to x.org or X11R6 needs to be written
which would exclude non-intel platforms in its use of architecture-specific
enhancements. This is somewhat contrary to the point of having a Free Software
system if you only end up having to tie yourself down to one hardware
architecture.


----- Original Message ----
From: Donny Viszneki
To: SDL Development List
Sent: Fri, 20 August, 2010 21:25:46
Subject: Re: [SDL] 2D game performance issue when compiz is enabled

On Wed, Aug 18, 2010 at 8:54 PM, Jeremiah wrote:
Quote:
If there's a single word answer. It would be DirectX.

Unified graphics/sound api.
Its the very same thing that makes SDL so appealing.

Not to mention, DirectX11 practically has all the features of opengl3
+ dri2 + etc,etc
already implemented and supported by drivers from all (nearly?) the
companies that sell graphics or audio hardware.

Microsoft might have a slight advantage here.

One might even say an *unfair* advantage.

*leers at proprietary drivers and opaque hardware vendors*

--
http://codebad.com/
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
2D game performance issue when compiz is enabled
Nikos Chantziaras
Guest

On 08/21/2010 01:45 AM, Paul Duffy wrote:
Quote:
[...]
In short: to dump all the extra layers of conversion and get any serious
performance improvement, an alternative to x.org or X11R6 needs to be written
which would exclude non-intel platforms in its use of architecture-specific
enhancements. This is somewhat contrary to the point of having a Free Software
system if you only end up having to tie yourself down to one hardware
architecture.

I don't think that's true. Gallium3D, DRI2 and the in-kernel Gem and
TTM memory managers will provide the needed speed. But as mentioned
earlier, it will take some time.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org