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 1907

Summary: Display mode in full screen is always set at desktop resolution
Product: SDL Reporter: Alejandro Ricoveri <alejandroricoveri>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: gabomdq
Version: 2.0.0   
Hardware: x86_64   
OS: Linux   
Attachments: Display mode test case

Description Alejandro Ricoveri 2013-06-09 15:53:38 UTC
Hi everyone. First of all I want to congratulated for such an amazing job you're doing.

After not being able to get any success on discussing this matter on the SDL IRC channel, I've come with the conclusion than the following is a potential bug that I might found in SDL2. 

The behavior has been isolated as this:
* In any case, when it comes to setup full screen mode at a determined resolution, apparently gets ignored and its set always at desktop resolution (doing a SDL_GetWindowDisplayMode after setting up the full screen has confirmed the issue to me).
* I've not only tried with SDL_CreateWindow, it also fails by other methods like SDL_GetClosestDisplayMode + SDL_SetWindowDisplayMode, it's the same behavior, video mode gets stalled at desktop resolution (which in my case is 1366x768). 

My system is this:
Ubuntu 13.04 x86_64
uname: Linux marion 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Part of my glxinfo (no extensions and no visuals):
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
server glx extensions:
client glx vendor string: NVIDIA Corporation
client glx version string: 1.4
GLX version: 1.4
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 8600 GT/PCIe/SSE2
OpenGL version string: 3.3.0 NVIDIA 310.44
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler

I've made a small isolated test case for this, and it fails. I've made the tests with both 2.0RC1 and latest 'default' branch snapshot:

/* 
 * Full screen display mode test case 
 */
#include <SDL2/SDL.h>
#include <GL/gl.h>
#define WIDTH 640
#define HEIGHT 480

int 
main (int argc, char *argv[]) 
{
  SDL_Window *window; // window
  SDL_DisplayMode mode; // display mode
  int i = 400;

  /* Boot up */
  SDL_Init (SDL_INIT_VIDEO);

  /* GL setup */
  SDL_GL_SetAttribute ( SDL_GL_RED_SIZE, 8 );
  SDL_GL_SetAttribute ( SDL_GL_GREEN_SIZE, 8 );
  SDL_GL_SetAttribute ( SDL_GL_BLUE_SIZE, 8 );
  SDL_GL_SetAttribute ( SDL_GL_DEPTH_SIZE, 24 );
  SDL_GL_SetAttribute ( SDL_GL_DOUBLEBUFFER, 1 );
  SDL_GL_SetAttribute ( SDL_GL_STENCIL_SIZE, 8 );

  /* Create a window */
  window = SDL_CreateWindow ("Test case", 0, 0, 
           WIDTH, HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_SHOWN );
  
  /* Set up OpenGL context */
  SDL_GL_CreateContext ( window );

  /* Query the actual display mode */
  SDL_GetWindowDisplayMode (window, &mode);
  
  /* Let's see about that */
  if (mode.w != WIDTH || mode.h != HEIGHT) {
    printf ("Le voila!. Display mode is different from what I expected!.\n");
    return -1;
  }

  /* See some red if everything was OK */
  glClearColor (1.0, 0.0, 0.0, 0.0);
  while (--i)
    glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

  /* Tear down */
  SDL_Quit ();
  return 0;
}

I'll dig through the code to see if I may do something about it. I'll do everything I can.

Thank you in advance.

My regards.
Alejandro
Comment 1 Alejandro Ricoveri 2013-06-09 16:00:23 UTC
Created attachment 1186 [details]
Display mode test case
Comment 2 Alejandro Ricoveri 2013-06-09 16:11:30 UTC
After doing a Xephyr session over Mesa GLX with my project, I've isolated even more the issue. Apparently, it only happens nvidia-glx. I need to confirm this someone else.
Comment 3 Alejandro Ricoveri 2013-06-09 21:34:54 UTC
Update: It is not strictly happen on nvidia-glx, the test case also failed on a machine with Mesa 9.1 Gallium 0.4 on ATI RS480. So yeah, it's likely to be a SDL2 bug.
Comment 4 Gabriel Jacobo 2013-06-13 09:43:45 UTC
What's the xrandr -q output for your system/s?
Comment 5 Alejandro Ricoveri 2013-06-14 13:30:52 UTC
This is `xrandr -q` for my Ubuntu box in my office

alejandro@stonemedia:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 13.04
Release:	13.04
Codename:	raring

alejandro@stonemedia:~$ xrandr -q
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 32767 x 32767
VGA1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 410mm x 230mm
   1366x768       59.8*+
   1280x720       60.0  
   1024x768       75.1     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        72.8     75.0     66.7     60.0  
   720x400        70.1
Comment 6 Alejandro Ricoveri 2013-06-14 17:17:42 UTC
Newsflash: At least on Ubuntu: test case is passing when X11_SHARED is set off, it works just dandy. I will evaluate this further.
Comment 7 Gabriel Jacobo 2013-07-06 16:26:30 UTC
Any updates on this? I was just testing the behavior using testrendercopyex for a different bug and this seemed to work fine.
Comment 8 Gabriel Jacobo 2014-02-26 10:08:36 UTC
This is probably a configure issue on the build system. Feel free to reopen if the problem resurfaces.