Re: [Mesa-dev] [PATCH 4/7] mesa: remove check_compatible() in make_current

2016-02-11 Thread Miklós Máté

On 02/09/2016 05:21 AM, Ian Romanick wrote:

On 02/05/2016 01:11 PM, Miklós Máté wrote:

this was marked for removal since 2007
ctx::Visual is also removed, since this was its only legit user
---
  .../drivers/dri/radeon/radeon_common_context.c |  2 +-
  src/mesa/main/blend.c  |  4 +-
  src/mesa/main/blend.h  |  4 +-
  src/mesa/main/context.c| 89 ++
  src/mesa/main/mtypes.h |  7 --
  src/mesa/main/pixel.c  |  4 +-
  src/mesa/main/pixel.h  |  4 +-
  7 files changed, 15 insertions(+), 99 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c 
b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index 4660d98..2989f63 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -604,7 +604,7 @@ GLboolean radeonMakeCurrent(__DRIcontext * driContextPriv,
}
  
  	if(driDrawPriv == NULL && driReadPriv == NULL) {

-   drfb = _mesa_create_framebuffer(>glCtx.Visual);
+   drfb = _mesa_get_incomplete_framebuffer();
readfb = drfb;
}
else {
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 2ae22e9..28e2dbf 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -921,7 +921,7 @@ _mesa_get_render_format(const struct gl_context *ctx, 
mesa_format format)
   * Initializes the related fields in the context color attribute group,
   * __struct gl_contextRec::Color.
   */
-void _mesa_init_color( struct gl_context * ctx )
+void _mesa_init_color( struct gl_context * ctx, GLuint doubleBufferMode )

Mesa has changed it's style (years ago, at this point) to not have the
spaces after the ( or before the ).  Since the prototype is being
updated anyway, this is a good time to fix the style.

I think I'd also prefer doubleBufferMode to be bool.

I have a bunch of comments below about the other changes, but I think
explicitly passing the double buffer mode around is a reasonable change.

  {
 GLuint i;
  
@@ -951,7 +951,7 @@ void _mesa_init_color( struct gl_context * ctx )
  
 /* GL_FRONT is not possible on GLES. Instead GL_BACK will render to either

  * the front or the back buffer depending on the config */
-   if (ctx->Visual.doubleBufferMode || _mesa_is_gles(ctx)) {
+   if (doubleBufferMode || _mesa_is_gles(ctx)) {
ctx->Color.DrawBuffer[0] = GL_BACK;
 }
 else {
diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h
index 8ab9e02..f4854a6 100644
--- a/src/mesa/main/blend.h
+++ b/src/mesa/main/blend.h
@@ -124,7 +124,7 @@ _mesa_update_clamp_vertex_color(struct gl_context *ctx,
  extern mesa_format
  _mesa_get_render_format(const struct gl_context *ctx, mesa_format format);
  
-extern void

-_mesa_init_color( struct gl_context * ctx );
+extern void
+_mesa_init_color( struct gl_context * ctx, GLuint doubleBufferMode );

Same comment here about fixing the spacing while changing the prototype.

  
  #endif

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 8b415ed..2a512c6 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -796,7 +796,7 @@ check_context_limits(struct gl_context *ctx)
   * functions for the more complex data structures.
   */
  static GLboolean
-init_attrib_groups(struct gl_context *ctx)
+init_attrib_groups(struct gl_context *ctx, GLuint doubleBufferMode)

Same comment here about s/GLuint/bool/


  {
 assert(ctx);
  
@@ -810,7 +810,7 @@ init_attrib_groups(struct gl_context *ctx)

 _mesa_init_accum( ctx );
 _mesa_init_attrib( ctx );
 _mesa_init_buffer_objects( ctx );
-   _mesa_init_color( ctx );
+   _mesa_init_color( ctx, doubleBufferMode );
 _mesa_init_current( ctx );
 _mesa_init_depth( ctx );
 _mesa_init_debug( ctx );
@@ -828,7 +828,7 @@ init_attrib_groups(struct gl_context *ctx)
 _mesa_init_multisample( ctx );
 _mesa_init_performance_monitors( ctx );
 _mesa_init_pipeline( ctx );
-   _mesa_init_pixel( ctx );
+   _mesa_init_pixel( ctx, doubleBufferMode );

Spaces.


 _mesa_init_pixelstore( ctx );
 _mesa_init_point( ctx );
 _mesa_init_polygon( ctx );
@@ -1159,15 +1159,6 @@ _mesa_initialize_context(struct gl_context *ctx,
 ctx->WinSysDrawBuffer = NULL;
 ctx->WinSysReadBuffer = NULL;
  
-   if (visual) {

-  ctx->Visual = *visual;
-  ctx->HasConfig = GL_TRUE;
-   }
-   else {
-  memset(>Visual, 0, sizeof ctx->Visual);
-  ctx->HasConfig = GL_FALSE;
-   }
-
 _mesa_override_gl_version(ctx);
  
 /* misc one-time initializations */

@@ -1193,7 +1184,7 @@ _mesa_initialize_context(struct gl_context *ctx,
  
 _mesa_reference_shared_state(ctx, >Shared, shared);
  
-   if (!init_attrib_groups( ctx ))

+   if (!init_attrib_groups( ctx, visual->doubleBufferMode ))

Spaces.


goto fail;
  
 /* setup the 

Re: [Mesa-dev] [PATCH 4/7] mesa: remove check_compatible() in make_current

2016-02-08 Thread Ian Romanick
On 02/05/2016 01:11 PM, Miklós Máté wrote:
> this was marked for removal since 2007
> ctx::Visual is also removed, since this was its only legit user
> ---
>  .../drivers/dri/radeon/radeon_common_context.c |  2 +-
>  src/mesa/main/blend.c  |  4 +-
>  src/mesa/main/blend.h  |  4 +-
>  src/mesa/main/context.c| 89 
> ++
>  src/mesa/main/mtypes.h |  7 --
>  src/mesa/main/pixel.c  |  4 +-
>  src/mesa/main/pixel.h  |  4 +-
>  7 files changed, 15 insertions(+), 99 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c 
> b/src/mesa/drivers/dri/radeon/radeon_common_context.c
> index 4660d98..2989f63 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
> @@ -604,7 +604,7 @@ GLboolean radeonMakeCurrent(__DRIcontext * driContextPriv,
>   }
>  
>   if(driDrawPriv == NULL && driReadPriv == NULL) {
> - drfb = _mesa_create_framebuffer(>glCtx.Visual);
> + drfb = _mesa_get_incomplete_framebuffer();
>   readfb = drfb;
>   }
>   else {
> diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
> index 2ae22e9..28e2dbf 100644
> --- a/src/mesa/main/blend.c
> +++ b/src/mesa/main/blend.c
> @@ -921,7 +921,7 @@ _mesa_get_render_format(const struct gl_context *ctx, 
> mesa_format format)
>   * Initializes the related fields in the context color attribute group,
>   * __struct gl_contextRec::Color.
>   */
> -void _mesa_init_color( struct gl_context * ctx )
> +void _mesa_init_color( struct gl_context * ctx, GLuint doubleBufferMode )

Mesa has changed it's style (years ago, at this point) to not have the
spaces after the ( or before the ).  Since the prototype is being
updated anyway, this is a good time to fix the style.

I think I'd also prefer doubleBufferMode to be bool.

I have a bunch of comments below about the other changes, but I think
explicitly passing the double buffer mode around is a reasonable change.
>  {
> GLuint i;
>  
> @@ -951,7 +951,7 @@ void _mesa_init_color( struct gl_context * ctx )
>  
> /* GL_FRONT is not possible on GLES. Instead GL_BACK will render to either
>  * the front or the back buffer depending on the config */
> -   if (ctx->Visual.doubleBufferMode || _mesa_is_gles(ctx)) {
> +   if (doubleBufferMode || _mesa_is_gles(ctx)) {
>ctx->Color.DrawBuffer[0] = GL_BACK;
> }
> else {
> diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h
> index 8ab9e02..f4854a6 100644
> --- a/src/mesa/main/blend.h
> +++ b/src/mesa/main/blend.h
> @@ -124,7 +124,7 @@ _mesa_update_clamp_vertex_color(struct gl_context *ctx,
>  extern mesa_format
>  _mesa_get_render_format(const struct gl_context *ctx, mesa_format format);
>  
> -extern void  
> -_mesa_init_color( struct gl_context * ctx );
> +extern void
> +_mesa_init_color( struct gl_context * ctx, GLuint doubleBufferMode );

Same comment here about fixing the spacing while changing the prototype.

>  
>  #endif
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index 8b415ed..2a512c6 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -796,7 +796,7 @@ check_context_limits(struct gl_context *ctx)
>   * functions for the more complex data structures.
>   */
>  static GLboolean
> -init_attrib_groups(struct gl_context *ctx)
> +init_attrib_groups(struct gl_context *ctx, GLuint doubleBufferMode)

Same comment here about s/GLuint/bool/

>  {
> assert(ctx);
>  
> @@ -810,7 +810,7 @@ init_attrib_groups(struct gl_context *ctx)
> _mesa_init_accum( ctx );
> _mesa_init_attrib( ctx );
> _mesa_init_buffer_objects( ctx );
> -   _mesa_init_color( ctx );
> +   _mesa_init_color( ctx, doubleBufferMode );
> _mesa_init_current( ctx );
> _mesa_init_depth( ctx );
> _mesa_init_debug( ctx );
> @@ -828,7 +828,7 @@ init_attrib_groups(struct gl_context *ctx)
> _mesa_init_multisample( ctx );
> _mesa_init_performance_monitors( ctx );
> _mesa_init_pipeline( ctx );
> -   _mesa_init_pixel( ctx );
> +   _mesa_init_pixel( ctx, doubleBufferMode );

Spaces.

> _mesa_init_pixelstore( ctx );
> _mesa_init_point( ctx );
> _mesa_init_polygon( ctx );
> @@ -1159,15 +1159,6 @@ _mesa_initialize_context(struct gl_context *ctx,
> ctx->WinSysDrawBuffer = NULL;
> ctx->WinSysReadBuffer = NULL;
>  
> -   if (visual) {
> -  ctx->Visual = *visual;
> -  ctx->HasConfig = GL_TRUE;
> -   }
> -   else {
> -  memset(>Visual, 0, sizeof ctx->Visual);
> -  ctx->HasConfig = GL_FALSE;
> -   }
> -
> _mesa_override_gl_version(ctx);
>  
> /* misc one-time initializations */
> @@ -1193,7 +1184,7 @@ _mesa_initialize_context(struct gl_context *ctx,
>  
> _mesa_reference_shared_state(ctx, >Shared, shared);
>  
> -   if (!init_attrib_groups( ctx ))

[Mesa-dev] [PATCH 4/7] mesa: remove check_compatible() in make_current

2016-02-05 Thread Miklós Máté
this was marked for removal since 2007
ctx::Visual is also removed, since this was its only legit user
---
 .../drivers/dri/radeon/radeon_common_context.c |  2 +-
 src/mesa/main/blend.c  |  4 +-
 src/mesa/main/blend.h  |  4 +-
 src/mesa/main/context.c| 89 ++
 src/mesa/main/mtypes.h |  7 --
 src/mesa/main/pixel.c  |  4 +-
 src/mesa/main/pixel.h  |  4 +-
 7 files changed, 15 insertions(+), 99 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c 
b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index 4660d98..2989f63 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -604,7 +604,7 @@ GLboolean radeonMakeCurrent(__DRIcontext * driContextPriv,
}
 
if(driDrawPriv == NULL && driReadPriv == NULL) {
-   drfb = _mesa_create_framebuffer(>glCtx.Visual);
+   drfb = _mesa_get_incomplete_framebuffer();
readfb = drfb;
}
else {
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 2ae22e9..28e2dbf 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -921,7 +921,7 @@ _mesa_get_render_format(const struct gl_context *ctx, 
mesa_format format)
  * Initializes the related fields in the context color attribute group,
  * __struct gl_contextRec::Color.
  */
-void _mesa_init_color( struct gl_context * ctx )
+void _mesa_init_color( struct gl_context * ctx, GLuint doubleBufferMode )
 {
GLuint i;
 
@@ -951,7 +951,7 @@ void _mesa_init_color( struct gl_context * ctx )
 
/* GL_FRONT is not possible on GLES. Instead GL_BACK will render to either
 * the front or the back buffer depending on the config */
-   if (ctx->Visual.doubleBufferMode || _mesa_is_gles(ctx)) {
+   if (doubleBufferMode || _mesa_is_gles(ctx)) {
   ctx->Color.DrawBuffer[0] = GL_BACK;
}
else {
diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h
index 8ab9e02..f4854a6 100644
--- a/src/mesa/main/blend.h
+++ b/src/mesa/main/blend.h
@@ -124,7 +124,7 @@ _mesa_update_clamp_vertex_color(struct gl_context *ctx,
 extern mesa_format
 _mesa_get_render_format(const struct gl_context *ctx, mesa_format format);
 
-extern void  
-_mesa_init_color( struct gl_context * ctx );
+extern void
+_mesa_init_color( struct gl_context * ctx, GLuint doubleBufferMode );
 
 #endif
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 8b415ed..2a512c6 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -796,7 +796,7 @@ check_context_limits(struct gl_context *ctx)
  * functions for the more complex data structures.
  */
 static GLboolean
-init_attrib_groups(struct gl_context *ctx)
+init_attrib_groups(struct gl_context *ctx, GLuint doubleBufferMode)
 {
assert(ctx);
 
@@ -810,7 +810,7 @@ init_attrib_groups(struct gl_context *ctx)
_mesa_init_accum( ctx );
_mesa_init_attrib( ctx );
_mesa_init_buffer_objects( ctx );
-   _mesa_init_color( ctx );
+   _mesa_init_color( ctx, doubleBufferMode );
_mesa_init_current( ctx );
_mesa_init_depth( ctx );
_mesa_init_debug( ctx );
@@ -828,7 +828,7 @@ init_attrib_groups(struct gl_context *ctx)
_mesa_init_multisample( ctx );
_mesa_init_performance_monitors( ctx );
_mesa_init_pipeline( ctx );
-   _mesa_init_pixel( ctx );
+   _mesa_init_pixel( ctx, doubleBufferMode );
_mesa_init_pixelstore( ctx );
_mesa_init_point( ctx );
_mesa_init_polygon( ctx );
@@ -1159,15 +1159,6 @@ _mesa_initialize_context(struct gl_context *ctx,
ctx->WinSysDrawBuffer = NULL;
ctx->WinSysReadBuffer = NULL;
 
-   if (visual) {
-  ctx->Visual = *visual;
-  ctx->HasConfig = GL_TRUE;
-   }
-   else {
-  memset(>Visual, 0, sizeof ctx->Visual);
-  ctx->HasConfig = GL_FALSE;
-   }
-
_mesa_override_gl_version(ctx);
 
/* misc one-time initializations */
@@ -1193,7 +1184,7 @@ _mesa_initialize_context(struct gl_context *ctx,
 
_mesa_reference_shared_state(ctx, >Shared, shared);
 
-   if (!init_attrib_groups( ctx ))
+   if (!init_attrib_groups( ctx, visual->doubleBufferMode ))
   goto fail;
 
/* setup the API dispatch tables with all nop functions */
@@ -1521,57 +1512,6 @@ _mesa_copy_context( const struct gl_context *src, struct 
gl_context *dst,
 
 
 /**
- * Check if the given context can render into the given framebuffer
- * by checking visual attributes.
- *
- * Most of these tests could go away because Mesa is now pretty flexible
- * in terms of mixing rendering contexts with framebuffers.  As long
- * as RGB vs. CI mode agree, we're probably good.
- *
- * \return GL_TRUE if compatible, GL_FALSE otherwise.
- */
-static GLboolean 
-check_compatible(const struct gl_context *ctx,
- const struct gl_framebuffer *buffer)
-{
-   const struct gl_config *ctxvis