Discussion:
[Clanlib-devel] Patch: fix aligment issues with fullscreen GL mode on radeon cards
Hans de Goede
2006-10-05 20:45:24 UTC
Permalink
Hi all,

Please CC me directly on any replies as I'm not subscribed to the list.

I've encountered the following problem with clanlib when using openGL in
fullscreen mode:
1) When using metacity as a window manager changing the override
redirect flag after the window has been mapped once doesn't have any
effect, causing the window to still be managed by the wm. I assume
other wm's suffer from this too.

In general if you want to use override redirect you must set it
before the first mapping of the window, otherwise it will not
(always) work. I know that both SDL and allegro do this to make sure
override redirect works. (I wrote the current version of the allegro
fullscreen code).
2) So we have a still windowmanaged window, not really a problem as it
has the exact resolution of an available mode and we are going to
grab the mouse constraining it to our window, switch to this mode and
set the viewport to our window, so no-one will notice the decorations
3) Problem the decoration is 5 pixels wide and the wm ususally will
decide to place such a large window at 0,0 as we requested, so the
viewport will have to start at an x coordinate of 5, however not all
cards allow setting the viewport x coordinate to an pixel exact
value. For example my radeon 9800 with opensource dri drivers sets
the viewport to start (x) at 4 when you ask for 5 resulting in one
pixel of the windowdecoration still showing. Really ugly.

Workaround. After querying X for the viewport location, round the
viewport X up to a multiple of 8 and move the window along the X axis
by the difference between the unrounded and rounded X. The attached
patch does this and works nicely for me.

Regards,

Hans
Seth A. Robinson
2006-10-06 07:20:30 UTC
Permalink
Hi Hans,

Thanks for the patch.

When I applied this, it broke my fullscreen 1024X768 ClanLib game under my
ubuntu/gnome/on board nvidia video setup. The screen appears about 128
pixels 'shifted' to the left, leaving a large vertical strip on the right of
the screen.

Any ideas? Maybe someone else can try it who is more familiar with the
linux side of things.

PS: On a side note, please use svn's unified diff if possible (well, er, if
you're using the 0.8 from SVN that is.. :) )

-Seth (mrfun in #clanlib)


-----Original Message-----
From: Hans de Goede [mailto:***@hhs.nl]
Sent: Friday, October 06, 2006 5:45 AM
To: clanlib-***@lists.sourceforge.net
Subject: [Clanlib-devel] Patch: fix aligment issues with fullscreen GL
modeon radeon cards

Hi all,

Please CC me directly on any replies as I'm not subscribed to the list.

I've encountered the following problem with clanlib when using openGL in
fullscreen mode:
1) When using metacity as a window manager changing the override
redirect flag after the window has been mapped once doesn't have any
effect, causing the window to still be managed by the wm. I assume
other wm's suffer from this too.

In general if you want to use override redirect you must set it
before the first mapping of the window, otherwise it will not
(always) work. I know that both SDL and allegro do this to make sure
override redirect works. (I wrote the current version of the allegro
fullscreen code).
2) So we have a still windowmanaged window, not really a problem as it
has the exact resolution of an available mode and we are going to
grab the mouse constraining it to our window, switch to this mode and
set the viewport to our window, so no-one will notice the decorations
3) Problem the decoration is 5 pixels wide and the wm ususally will
decide to place such a large window at 0,0 as we requested, so the
viewport will have to start at an x coordinate of 5, however not all
cards allow setting the viewport x coordinate to an pixel exact
value. For example my radeon 9800 with opensource dri drivers sets
the viewport to start (x) at 4 when you ask for 5 resulting in one
pixel of the windowdecoration still showing. Really ugly.

Workaround. After querying X for the viewport location, round the
viewport X up to a multiple of 8 and move the window along the X axis
by the difference between the unrounded and rounded X. The attached
patch does this and works nicely for me.

Regards,

Hans
Hans de Goede
2006-10-06 07:34:30 UTC
Permalink
Post by Seth A. Robinson
Hi Hans,
Thanks for the patch.
When I applied this, it broke my fullscreen 1024X768 ClanLib game under my
ubuntu/gnome/on board nvidia video setup. The screen appears about 128
pixels 'shifted' to the left, leaving a large vertical strip on the right of
the screen.
Any ideas? Maybe someone else can try it who is more familiar with the
linux side of things.
Yeah, the patch is broken on one of my other systems too I found this
out this morning, which didn't help my temper :)

I've got one more idea how to kludge around this, and if that doesn't
work I'm afraid its time to rewrite the fullscreen handling (I know how
as I've done the same for allegro).

Regards,

Hans
Post by Seth A. Robinson
PS: On a side note, please use svn's unified diff if possible (well, er, if
you're using the 0.8 from SVN that is.. :) )
I'm using 0.8.0 release not svn,

Regards,

Hans
Hans de Goede
2006-10-06 19:40:58 UTC
Permalink
Post by Seth A. Robinson
Hi Hans,
Thanks for the patch.
When I applied this, it broke my fullscreen 1024X768 ClanLib game under my
ubuntu/gnome/on board nvidia video setup. The screen appears about 128
pixels 'shifted' to the left, leaving a large vertical strip on the right of
the screen.
Any ideas? Maybe someone else can try it who is more familiar with the
linux side of things.
As said the patch was broken on one of my other systems too. Attached is
an improved version, which should hopefully work correct everywhere.

Regards,

Hans
Hans de Goede
2006-10-06 20:57:40 UTC
Permalink
Post by Seth A. Robinson
Hi Hans,
Thanks for the patch.
When I applied this, it broke my fullscreen 1024X768 ClanLib game under my
ubuntu/gnome/on board nvidia video setup. The screen appears about 128
pixels 'shifted' to the left, leaving a large vertical strip on the right of
the screen.
Any ideas? Maybe someone else can try it who is more familiar with the
linux side of things.
In my previous message I wrote:

As said the patch was broken on one of my other systems too. Attached is
an improved version, which should hopefully work correct everywhere.

---

Forget about this as this new version fails on one of my other testing
sytems. GRRRRRRRRRRr. I think I do know of yet another way to fix this
stay tuned, I dunno when I'll have time for this though.

Regards,

Hans
Hans de Goede
2006-10-10 07:49:39 UTC
Permalink
Hi,

Well as I wrote already trying to kludge around the problem with the current fullscreen ClanLib implementation only leads to fixing one system and breaking another. So I decided to rewrite the current fullscreen GLX implementation. While rewriting I noticed that the set_size code also was broken, so I rewrote that to. I've attached the resulting patck (against 0.8.0 release).

Thanks & Regards,

Hans

Loading...