Bug 68296

Summary: Using old viewport value after a window resize (content is clipped)
Product: Mesa Reporter: Rafael Antognolli <rafael.antognolli>
Component: EGL/WaylandAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED INVALID QA Contact: mesa-dev
Severity: major    
Priority: high CC: ullysses.a.eoff
Version: 9.2   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Sample code that reproduces the problem.
glxinfo output
clear color does not fill new viewport size
modified weston-simple-egl (courtesy of antognolli)

Description Rafael Antognolli 2013-08-19 22:57:35 UTC
Created attachment 84295 [details]
Sample code that reproduces the problem.

In the attached sample code, a window is created with 100x100. However, after resizing it with "i" keyboard input to 200x200, changing the viewport (with glViewport), and drawing its content again, the content is clipped with the old 100x100 size.

Uncommenting line 48 will remove the bug, as if it was causing mesa to "flush" the viewport size.

I noticed this on EFL (Enlightenment Foundation Libraries), both on GL X11 and Wayland EGL backends.

This bug only happens on mesa from git, it seems that there's no bug on 9.1.6.

I checked bug #29984, it's similar, but I still have the problem.

Running on Fedora 19.
Comment 1 Brian Paul 2013-08-20 14:29:34 UTC
Which driver are you using (the output of glxinfo would be helpful)?
Comment 2 Rafael Antognolli 2013-08-20 15:24:19 UTC
I can't find it on the glxinfo output, but I'm attaching it anyway.

Is there any other way to know, or any other debug that I can attach?
Comment 3 Rafael Antognolli 2013-08-20 15:24:41 UTC
Created attachment 84345 [details]
glxinfo output
Comment 4 Kenneth Graunke 2013-08-20 18:36:58 UTC
That's Ivybridge (i965).
Comment 5 U. Artie Eoff 2013-12-12 14:07:19 UTC
Any progress made on a resolution?
Comment 6 U. Artie Eoff 2013-12-16 19:14:11 UTC
This issue still exists on latest tips in master and 10.0 branches (as of today):

mesa (master) heads/master-0-gf9cfe5c
mesa (10.0) heads/10.0-0-g6f7da01
Comment 7 U. Artie Eoff 2013-12-16 20:08:54 UTC
(In reply to comment #6)
> This issue still exists on latest tips in master and 10.0 branches (as of
> today):
> 
> mesa (master) heads/master-0-gf9cfe5c
> mesa (10.0) heads/10.0-0-g6f7da01

Ok, I can't seem to duplicate the issue with the attached test case with the aforementioned commits... but I still see the issue in EFL.
Comment 8 U. Artie Eoff 2013-12-16 20:11:31 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > This issue still exists on latest tips in master and 10.0 branches (as of
> > today):
> > 
> > mesa (master) heads/master-0-gf9cfe5c
> > mesa (10.0) heads/10.0-0-g6f7da01
> 
> Ok, I can't seem to duplicate the issue with the attached test case with the
> aforementioned commits... but I still see the issue in EFL.

I take that back... I was able to duplicate *sometimes*.
Comment 9 U. Artie Eoff 2013-12-20 16:30:29 UTC
The hope is that EFL 1.8 will be integrated into Tizen in January... however this bug impacts EFL 1.8 quality on its wayland egl engine.  Therefore, raising importance to "high".  Preferably, the fix should be backported to the 9.2 branch.
Comment 10 Kenneth Graunke 2014-04-18 05:48:16 UTC
This seems to work fine for me with the latest Mesa.  Feel free to reopen if this is still a problem for you.
Comment 11 U. Artie Eoff 2014-04-18 19:46:41 UTC
(In reply to comment #10)
> This seems to work fine for me with the latest Mesa.  Feel free to reopen if
> this is still a problem for you.

I think this was originally reported based on a side-effect it had on EFL... https://phab.enlightenment.org/T493

Unfortunately, the EFL issue still remains (even with latest mesa).  So perhaps the EFL bug isn't related to this issue at all.

Any ideas why we are seeing the problem in EFL?
Comment 12 U. Artie Eoff 2014-07-18 14:25:12 UTC
Created attachment 103044 [details]
clear color does not fill new viewport size

The problem is that the GL color buffer does not fill the GL viewport after it's been resized.  That is, after calling glViewport(...) the background color goes black, and in the more extreme case the original clear color remains in the portion of the previous viewport size giving the illusion of being clipped (as seen in my attached image).

If you modify the glClearColor(...) in the sample test code to be something other than black, then the problem becomes obvious.  If then you add a glClear(GL_COLOR_BUFFER_BIT) after the call to glViewport(...), then the problem goes away.

The question is, is it the responsibility of the GL client program to make a call to glClear after executing glViewport, or is Mesa supposed to handle this for you?

The EFL developers indicate that this is only a problem on Intel platforms.
Comment 13 Michel Dänzer 2014-07-22 03:56:48 UTC
(In reply to comment #12)
> If then you add a glClear(GL_COLOR_BUFFER_BIT) after the call to
> glViewport(...), then the problem goes away.
> 
> The question is, is it the responsibility of the GL client program to make a
> call to glClear after executing glViewport, [...]

It is, if the GL client program wants the new viewport size to be filled with the clear colour.
Comment 14 U. Artie Eoff 2014-08-11 21:00:10 UTC
Created attachment 104458 [details]
modified weston-simple-egl (courtesy of antognolli)
Comment 15 Rafael Antognolli 2017-07-05 20:48:43 UTC
The bug on EFL side has been closed for a while, so I think it's fine to close this one too.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.