Re: [Mesa-dev] [RFC] Haiku viewport / framebuffer invalidation

2013-11-12 Thread Brian Paul

On 11/11/2013 10:29 AM, Alexander von Gluck IV wrote:

I've been banging my head against a wall for a while now on this.

So the Haiku applications that call glViewport(.. for window
resizes,etc never actually execute the Driver's Viewport call.
(aka ctx-Driver.Viewport:
https://urldefense.proofpoint.com/v1/url?u=http://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/targets/haiku-softpipe/GalliumContext.cpp%23n346k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0Am=SLARvvzLHauDbnYuBPS1hiWGoSLCArPBAJ33lBXg6IA%3D%0As=a29a94a8d91c272546bece5d4df65caec4a59f598c4bcd856975820dba5895d3)

I found void GLAPIENTRY _mesa_Viewport in viewport.c, however I
have a feeling this never gets called as softpipe is a Gallium
driver not a Mesa driver.

I know there are stamp's in the st_context and st_framebuffer, however
++'ing them on a window resize doesn't seem to solve the issue.

Our libGL actually is aware of window resizes, so I have a fix in that
manually calls the viewport calls on resize.. however I don't think
this is a good long term fix as the viewport is always forced to the
size of the window (which isn't correct was far as I know)

https://urldefense.proofpoint.com/v1/url?u=http://cgit.freedesktop.org/mesa/mesa/commit/?id%3De759f1c111018949db114e76ebf1a723525fb802k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0Am=SLARvvzLHauDbnYuBPS1hiWGoSLCArPBAJ33lBXg6IA%3D%0As=755583c5b0f95a5897f79d300cf639771af30c093ac191095f1c5a2a7f85d469

Thoughts?


The whole point of drivers hooking into glViewport is to try to detect 
window resizes so that the driver can reallocate 
back/depth/stencil/accum buffers to match the window size.


This goes back to the original Xlib driver.  There, we have no 
event-receiving mechanism so the Xlib driver never saw X's 
ConfigureNotify messages.  So we didn't know when to reallocate the 
ancillary buffers.


The solution was to hook into glViewport, which *most* GL applications 
wind up calling when the window size changes.  We could have also hooked 
into glClear, but that would have meant more calls to XGetGeometry().


Anyway, if the Haiku driver is aware of window resizes, as you said, 
maybe you don't need to worry about glViewport at all.


The viewport should be initialized to the size of the window once when 
the context is bound to a surface for the first time.  Thereafter, it's 
up to the app to call glViewport as needed.


-Brian

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC] Haiku viewport / framebuffer invalidation

2013-11-11 Thread Jose Fonseca


- Original Message -
 I've been banging my head against a wall for a while now on this.
 
 So the Haiku applications that call glViewport(.. for window
 resizes,etc never actually execute the Driver's Viewport call.
 (aka ctx-Driver.Viewport:
 http://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/targets/haiku-softpipe/GalliumContext.cpp#n346)
 
 I found void GLAPIENTRY _mesa_Viewport in viewport.c, however I
 have a feeling this never gets called as softpipe is a Gallium
 driver not a Mesa driver.

They execute src/mesa/state_tracker/st_cb_viewport.c

I'm not sure I fully understand the Haiku case, but I suggest you look at the 
WGL state tracker, particular src/gallium/state_trackers/wgl/stw_framebuffer.c 
and friends, as it might be useful for you.

On Windows, we get a callback (stw_call_window_proc) whenever windows get 
resized. We simply note down the new size, and set a flag must_resize. The 
actual resize happens when stw_framebuffer::validate happens, in 
stw_st_framebuffer_validate. 

I hope this helps.

Jose

 
 I know there are stamp's in the st_context and st_framebuffer, however
 ++'ing them on a window resize doesn't seem to solve the issue.
 
 Our libGL actually is aware of window resizes, so I have a fix in that
 manually calls the viewport calls on resize.. however I don't think
 this is a good long term fix as the viewport is always forced to the
 size of the window (which isn't correct was far as I know)
 
 http://cgit.freedesktop.org/mesa/mesa/commit/?id=e759f1c111018949db114e76ebf1a723525fb802
 
 Thoughts?
 
  -- Alex
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev