Full screen rendering with overlapping outputs not working properly #175

Closed
jherico opened this Issue Nov 16, 2013 · 4 comments

Comments

Projects
None yet
2 participants
@jherico

jherico commented Nov 16, 2013

GLFW seems to have a problem with fullscreen modes if one screen is set on top of another (working in X11 with XRandr).

I normally set up my screens like this: 'xrandr --output DVI-I-1 --auto --pos 0x0 --primary --output DVI-D-0 --below DVI-I-1 --output HDMI-0 --auto --pos 100x100'. In english, that's a large 1920x1080 monitor (DVI-D-0) for my primary screen, another large 1920x1080 monitor (DVI-I-1) above the main screen for rendering output, and then a sub-region of the rendering screen which shows the output targeted at a small 1280x800 monitor (HDMI-0).

The reason I'm superimposing my screens is because I'm doing software development for the Oculus Rift. It's viewed by the system as a monitor, but you can't really see normal desktop stuff through it very well, so having the output for it overlaid on one of my other monitors is usually helpful for debugging.

Here's how it looks when I create a GLFW window using this code

glfwWindowHint(GLFW_DECORATED, 0);
window = glfwCreateWindow(w, h, "glfw", NULL, NULL);

I see this:
Good Render

But when I try to do full screen with this code

  GLFWmonitor * target = ...;
  window = glfwCreateWindow(w, h, "glfw", target, NULL);

I see this:
Bad Render

The Rift display is still showing the same sub-region of the top screen, meaning I see something approximately like this:

Bad Rift Render

When I don't do superimposition, but instead set the Rift outside the areas covered by the existing monitors, then I don't have a problem, and the Rift display looks correct. I'd rather not have to use xrandr to reset the screen layouts every time I want to test something for fullscreen.

@ghost ghost assigned elmindreda Nov 16, 2013

@elmindreda

This comment has been minimized.

Show comment Hide comment
@elmindreda

elmindreda Nov 16, 2013

Member

I certainly want GLFW to work well with the Rift. I think that's a very important piece of hardware to support. However, I'm currently attending a conference and won't have time to look into this until Monday at the earliest.

Member

elmindreda commented Nov 16, 2013

I certainly want GLFW to work well with the Rift. I think that's a very important piece of hardware to support. However, I'm currently attending a conference and won't have time to look into this until Monday at the earliest.

@jherico

This comment has been minimized.

Show comment Hide comment
@jherico

jherico Nov 16, 2013

Thanks. I have a workaround for the time being.

jherico commented Nov 16, 2013

Thanks. I have a workaround for the time being.

@elmindreda

This comment has been minimized.

Show comment Hide comment
@elmindreda

elmindreda Nov 19, 2013

Member

So this is more of a RandR thing and less of a Rift thing.

The reason that the window gets expanded to fill the second DVI monitor is that your window manager thinks that this is the monitor the window should go full screen on. GLFW uses the EWMH full screen mechanism where available, which leaves almost all such logic up to the window manager. In effect, all GLFW is doing is moving the window to the right monitor and then telling the WM "full screen, please".

As for possible workarounds, you can try forcing non-EWMH full screen by tinkering with detectEWMH in x11_init.c, which will also disable iconification, or use a windowed mode window and move it to the correct position.

I'm going to look into whether using _NET_WM_FULLSCREEN_MONITORS can help solve this properly.

Member

elmindreda commented Nov 19, 2013

So this is more of a RandR thing and less of a Rift thing.

The reason that the window gets expanded to fill the second DVI monitor is that your window manager thinks that this is the monitor the window should go full screen on. GLFW uses the EWMH full screen mechanism where available, which leaves almost all such logic up to the window manager. In effect, all GLFW is doing is moving the window to the right monitor and then telling the WM "full screen, please".

As for possible workarounds, you can try forcing non-EWMH full screen by tinkering with detectEWMH in x11_init.c, which will also disable iconification, or use a windowed mode window and move it to the correct position.

I'm going to look into whether using _NET_WM_FULLSCREEN_MONITORS can help solve this properly.

@elmindreda

This comment has been minimized.

Show comment Hide comment
@elmindreda

elmindreda Sep 22, 2014

Member

_NET_WM_FULLSCREEN_MONITORS does indeed provide a solution for this. This issue will be fixed in 3.1, along with many other Rift-related issues.

Member

elmindreda commented Sep 22, 2014

_NET_WM_FULLSCREEN_MONITORS does indeed provide a solution for this. This issue will be fixed in 3.1, along with many other Rift-related issues.

Scorpiour added a commit to Scorpiour/glfw that referenced this issue May 11, 2015

Added support for _NET_WM_FULLSCREEN_MONITORS.
This allows EWMH full screen windows to correctly cover monitors that
overlap other monitors, such as an Oculus Rift mapped onto a section of
a larger monitor.

Fixes #175.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment