SDL 2 full screen badly broken in Linux with Nvidia drivers

"dreamlayers" <[email protected]> Tue, 14 Mar 2017 21:18:05 +0000
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
--===============3730184218500751188==
Content-Type: multipart/alternative;
	boundary="=_bf26df1efcb13ed4be3a004936bcaf05"

--=_bf26df1efcb13ed4be3a004936bcaf05
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

I'm running Ubuntu 16.10 with Xfce and proprietary Nvidia drivers, version 340.101-0ubuntu0.16.10.1. The graphics hardware is GeForce 8600 GT. Although this is not the latest Nvidia driver, it is the latest which supports this card. I see the same behaviour with both with SDL 2.0.5 downloaded from this site and built myself, and Ubuntu's libsdl2-2.0-0:amd64 2.0.4+dfsg2-1ubuntu1.

When I switch a window to full screen using SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN), the size reported to the application is larger than the video mode. Initially I see the top left part of the screen. I can scroll around the application output by bringing my mouse to the edge of the screen. For example going to the right edge scrolls the viewport to the right, and sees what was hidden there, while scrolling stuff at the left edge out of view. So, I can see all of the application by scrolling around, and the scrolling is limited to application output size, but this is not a nice way to use an application.

Afterwards, when I switch back to windowed mode using SDL_SetWindowFullscreen(window, 0), the original desktop video mode is restored if and only if the viewport was scrolled all the way up and all the way left when I switched back. Otherwise, I stay in the same resolution used by the full screen mode, but see the desktop, and need to scroll around with the mouse to view it. Recovery is possible using xrandr at the command line, or by going back into full screen mode, and back into windowed mode, making sure the viewport was at the top left.

This problem only occurs with SDL 2 and does not occur with SDL 1 libsdl1.2debian:amd64 1.2.15+dfsg1-4 SDL_WM_ToggleFullScreen().

SDL 2 by default uses Xrandr for mode switching. If I set SDL_VIDEO_X11_XRANDR=0, things get even worse. After switching to full screen mode, the screen is black, but I can scroll around with the mouse to view the rest of the desktop that's not covered by that blackness. The application is totally hung. Control-C does not work and I need to kill -9 it. SDL_VIDEO_X11_LEGACY_FULLSCREEN=1 messes up the same way. With both SDL_VIDEO_X11_XRANDR=0 and SDL_VIDEO_X11_XVIDMODE=0 there is no mode switching, and full screen is full screen at the desktop resolution. That works fine.

If I use the open source nouveau driver instead of Nvidia's proprietary driver, full screen works fine.

It seems the Nvidia driver is at fault here: https://devtalk.nvidia.com/default/topic/951192/linux/panning-enabled-when-turning-fullscreen-with-xrrsetcrtcconfig/





--=_bf26df1efcb13ed4be3a004936bcaf05
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type=3D"text/css">
<!--

/*
  The original subSilver Theme for phpBB version 2+
  Created by subBlue design
  http://www.subBlue.com

  NOTE: These CSS definitions are stored within the main page body so that =
you can use the phpBB2
  theme administration centre. When you have finalised your style you could=
 cut the final CSS code
  and place it in an external file, deleting this section to save bandwidth=
.
*/


 /* General page style. The scroll bar colours only visible in IE5.5+ */
body {
	background-color: #;
	font-family: ;
	font-size: 11;
	color: #;
}

/* General font families for common tags */
font,th,td,p { font-family:  }
p, td		{ font-size : 11; color : #; }
a:link,a:active,a:visited { color : #; }
a:hover		{ text-decoration: underline; color : #; }
hr	{ height: 0px; border: solid # 0px; border-top-width: 1px;}
h1,h2		{ font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif=
; font-size : 22px; font-weight : bold; text-decoration : none; line-height=
 : 120%; color : #000000;}


/* This is the border line & background colour round the entire page */
.bodyline	{ background-color: #; border: 1px # solid; }


/* General text */
.gen { font-size : 12px; }
.genmed { font-size : 11px; }
.gensmall { font-size : 10px; line-height: 12px}
.gen,.genmed,.gensmall { color : #; }
a.gen,a.genmed,a.gensmall { color: #; text-decoration: none; }
a.gen:hover,a.genmed:hover,a.gensmall:hover	{ color: #; text-decoration: un=
derline; }


/* Forum title: Text and link to the forums used in: index.php */
.forumlink		{ font-weight: bold; font-size: 12px; color : #; }
a.forumlink 	{ text-decoration: none; color : #; }
a.forumlink:hover{ text-decoration: underline; color : #; }


/* The content of the posts (body of text) */
.postbody { font-size : 12px; line-height: 18px}
a.postlink:link	{ text-decoration: none; color : # }
a.postlink:visited { text-decoration: none; color : #; }
a.postlink:hover { text-decoration: underline; color : #}


/* Quote & Code blocks */
.code {
	font-family: ; font-size: 11px; color: #3FB753;
	background-color: #; border: #; border-style: solid;
	border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; bo=
rder-bottom-width: 1px
}

.quote {
	font-family: ; font-size: 11px; color: #444444; line-height: 125%;
	background-color: #; border: #; border-style: solid;
	border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; bo=
rder-bottom-width: 1px
}

-->
</style>
</head>
	<body>

	<div class=3D"postbody">I'm running Ubuntu 16.10 with Xfce and proprietary=
 Nvidia drivers, version 340.101-0ubuntu0.16.10.1. The graphics hardware is=
 GeForce 8600 GT. Although this is not the latest Nvidia driver, it is the =
latest which supports this card. I see the same behaviour with both with SD=
L 2.0.5 downloaded from this site and built myself, and Ubuntu's libsdl2-2.=
0-0:amd64 2.0.4+dfsg2-1ubuntu1.<br />
<br />
When I switch a window to full screen using SDL_SetWindowFullscreen(window,=
 SDL_WINDOW_FULLSCREEN), the size reported to the application is larger tha=
n the video mode. Initially I see the top left part of the screen. I can sc=
roll around the application output by bringing my mouse to the edge of the =
screen. For example going to the right edge scrolls the viewport to the rig=
ht, and sees what was hidden there, while scrolling stuff at the left edge =
out of view. So, I can see all of the application by scrolling around, and =
the scrolling is limited to application output size, but this is not a nice=
 way to use an application.<br />
<br />
Afterwards, when I switch back to windowed mode using SDL_SetWindowFullscre=
en(window, 0), the original desktop video mode is restored if and only if t=
he viewport was scrolled all the way up and all the way left when I switche=
d back. Otherwise, I stay in the same resolution used by the full screen mo=
de, but see the desktop, and need to scroll around with the mouse to view i=
t. Recovery is possible using xrandr at the command line, or by going back =
into full screen mode, and back into windowed mode, making sure the viewpor=
t was at the top left.<br />
<br />
This problem only occurs with SDL 2 and does not occur with SDL 1 libsdl1.2=
debian:amd64 1.2.15+dfsg1-4 SDL_WM_ToggleFullScreen().<br />
<br />
SDL 2 by default uses Xrandr for mode switching. If I set SDL_VIDEO_X11_XRA=
NDR=3D0, things get even worse. After switching to full screen mode, the sc=
reen is black, but I can scroll around with the mouse to view the rest of t=
he desktop that's not covered by that blackness. The application is totally=
 hung. Control-C does not work and I need to kill -9 it. SDL_VIDEO_X11_LEGA=
CY_FULLSCREEN=3D1 messes up the same way. With both SDL_VIDEO_X11_XRANDR=3D=
0 and SDL_VIDEO_X11_XVIDMODE=3D0 there is no mode switching, and full scree=
n is full screen at the desktop resolution. That works fine.<br />
<br />
If I use the open source nouveau driver instead of Nvidia's proprietary dri=
ver, full screen works fine.<br />
<br />
It seems the Nvidia driver is at fault here: <a href=3D"https://devtalk.nvi=
dia.com/default/topic/951192/linux/panning-enabled-when-turning-fullscreen-=
with-xrrsetcrtcconfig/" target=3D"_blank">https://devtalk.nvidia.com/defaul=
t/topic/951192/linux/panning-enabled-when-turning-fullscreen-with-xrrsetcrt=
cconfig/</a></div>
	</body>
</html>

--=_bf26df1efcb13ed4be3a004936bcaf05--

--===============3730184218500751188==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

--===============3730184218500751188==--