Re: [Mesa-dev] [PATCH] egl: reset 'ViewportInitialized' when unbinding current context

2016-08-24 Thread Dongwon Kim
Yeah, I understood your point. Manual updating of viewport and
drawable seems to be needed in this case unless we change
EGL specificiation. Thanks

On Tue, Aug 23, 2016 at 05:51:23PM +0100, Emil Velikov wrote:
> On 23 August 2016 at 17:36, Dongwon Kim  wrote:
> > I read that part in egl specification as well but I wasn't sure
> > if this statement covers the case when the context is unbound via
> > eglMakeCurrent call with NULL context then it is made current again.
> > The problem I saw was when the context is made current again especially
> > with a new surface with different dimension, there's no way the context
> > updates its viewport accordingly.
> >
> In that case one should adjust the viewport manually as mentioned in the spec 
> ?
> 
> Also note that the src/mesa/ code is _not_ EGL but EGL/GLX agnostic,
> so one should we
> quite careful that changes don't break in either one of the two ;-)
> 
> -Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl: reset 'ViewportInitialized' when unbinding current context

2016-08-23 Thread Emil Velikov
On 23 August 2016 at 17:36, Dongwon Kim  wrote:
> I read that part in egl specification as well but I wasn't sure
> if this statement covers the case when the context is unbound via
> eglMakeCurrent call with NULL context then it is made current again.
> The problem I saw was when the context is made current again especially
> with a new surface with different dimension, there's no way the context
> updates its viewport accordingly.
>
In that case one should adjust the viewport manually as mentioned in the spec ?

Also note that the src/mesa/ code is _not_ EGL but EGL/GLX agnostic,
so one should we
quite careful that changes don't break in either one of the two ;-)

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


Re: [Mesa-dev] [PATCH] egl: reset 'ViewportInitialized' when unbinding current context

2016-08-23 Thread Dongwon Kim
I read that part in egl specification as well but I wasn't sure 
if this statement covers the case when the context is unbound via 
eglMakeCurrent call with NULL context then it is made current again.
The problem I saw was when the context is made current again especially 
with a new surface with different dimension, there's no way the context 
updates its viewport accordingly. 

On Tue, Aug 23, 2016 at 12:23:47PM +0100, Emil Velikov wrote:
> On 15 August 2016 at 23:58, Dongwon Kim  wrote:
> > 'ViewportInitialized' flag in gl_context has to be reset to '0'
> > when the current context is unbound via a eglMakeCurrent call with
> > all of 'NULL' resources (surfaces and context).
> >
> > This is to make sure the viewport of the context is re-initialized
> > when the same context is bound to new read and draw surfaces
> > (or same surfaces but with different size.) next time when the
> > context is made current again.
> >
> The spec is pretty clear about this:
> 
> "The first time a OpenGL or OpenGL ES context is made current the
> viewport and scissor dimensions are set to the size of the draw
> surface (as though glViewport(0, 0, w, h) and glScissor(0, 0, w, h)
> were called, where w and h are the width and height of the surface,
> respectively). However, the viewport and scissor dimensions are not
> modified when ctx is subsequently made current."
> 
> So unless coffee hasn't kicked this patch is wrong.
> Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl: reset 'ViewportInitialized' when unbinding current context

2016-08-23 Thread Emil Velikov
On 15 August 2016 at 23:58, Dongwon Kim  wrote:
> 'ViewportInitialized' flag in gl_context has to be reset to '0'
> when the current context is unbound via a eglMakeCurrent call with
> all of 'NULL' resources (surfaces and context).
>
> This is to make sure the viewport of the context is re-initialized
> when the same context is bound to new read and draw surfaces
> (or same surfaces but with different size.) next time when the
> context is made current again.
>
The spec is pretty clear about this:

"The first time a OpenGL or OpenGL ES context is made current the
viewport and scissor dimensions are set to the size of the draw
surface (as though glViewport(0, 0, w, h) and glScissor(0, 0, w, h)
were called, where w and h are the width and height of the surface,
respectively). However, the viewport and scissor dimensions are not
modified when ctx is subsequently made current."

So unless coffee hasn't kicked this patch is wrong.
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] egl: reset 'ViewportInitialized' when unbinding current context

2016-08-15 Thread Dongwon Kim
'ViewportInitialized' flag in gl_context has to be reset to '0'
when the current context is unbound via a eglMakeCurrent call with
all of 'NULL' resources (surfaces and context).

This is to make sure the viewport of the context is re-initialized
when the same context is bound to new read and draw surfaces
(or same surfaces but with different size.) next time when the
context is made current again.

Signed-off-by: Dongwon Kim 
---
 src/mesa/main/context.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 574c0fb..477e543 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1642,6 +1642,10 @@ _mesa_make_current( struct gl_context *newCtx,
assert(_mesa_get_current_context() == newCtx);
 
if (!newCtx) {
+  /* We reset ViewportInitialized for new bindings of surfaces to the
+   * same context in a new _mesa_make_current call.
+   */
+  curCtx->ViewportInitialized = GL_FALSE;
   _glapi_set_dispatch(NULL);  /* none current */
}
else {
-- 
2.7.4

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