Re: [Mesa-dev] [PATCH 1/2] st/mesa: check for incomplete texture in st_finalize_texture()

2017-07-09 Thread Brian Paul
I think we can skip this one since it's pretty obscure and only the 
VMware driver seemed to be effected.


-Brian

On 07/08/2017 08:06 AM, Andres Gomez wrote:

Brian, it looks like we could want this series into -stable (?)

On Wed, 2017-06-28 at 16:12 -0600, Brian Paul wrote:

Return early from st_finalize_texture() if we have an incomplete
texture.  This avoids trying to create a texture resource with invalid
parameters (too many mipmap levels given the base dimension).

Specifically, the Piglit fbo-incomplete-texture-03 test winds up
calling pipe_screen::resource_create() with width0=32, height0=32 and
last_level=6 because the first five cube faces are 32x32 but the sixth
face is 64x64.  Some drivers handle this, but others (like VMware svga)
do not (generates device errors).

Note that this code is on the path that's usually not taken (we normally
build consistent textures).

No Piglit regressions.
---
  src/mesa/state_tracker/st_cb_texture.c | 14 ++
  1 file changed, 14 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index 9798321..7708443 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2543,6 +2543,20 @@ st_finalize_texture(struct gl_context *ctx,
  stObj->base.Target == GL_TEXTURE_CUBE_MAP_ARRAY)
 ptHeight = ptWidth;
   }
+
+ /* At this point, the texture may be incomplete (mismatched cube
+  * face sizes, for example).  If that's the case, give up, but
+  * don't return GL_FALSE as that would raise an incorrect
+  * GL_OUT_OF_MEMORY error.  See Piglit fbo-incomplete-texture-03 test.
+  */
+ if (!stObj->base._BaseComplete ||
+ !stObj->base._MipmapComplete) {
+_mesa_test_texobj_completeness(ctx, >base);
+if (!stObj->base._BaseComplete ||
+!stObj->base._MipmapComplete) {
+   return TRUE;
+}
+ }
}

ptNumSamples = firstImage->base.NumSamples;


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


Re: [Mesa-dev] [PATCH 1/2] st/mesa: check for incomplete texture in st_finalize_texture()

2017-07-08 Thread Andres Gomez
Brian, it looks like we could want this series into -stable (?)

On Wed, 2017-06-28 at 16:12 -0600, Brian Paul wrote:
> Return early from st_finalize_texture() if we have an incomplete
> texture.  This avoids trying to create a texture resource with invalid
> parameters (too many mipmap levels given the base dimension).
> 
> Specifically, the Piglit fbo-incomplete-texture-03 test winds up
> calling pipe_screen::resource_create() with width0=32, height0=32 and
> last_level=6 because the first five cube faces are 32x32 but the sixth
> face is 64x64.  Some drivers handle this, but others (like VMware svga)
> do not (generates device errors).
> 
> Note that this code is on the path that's usually not taken (we normally
> build consistent textures).
> 
> No Piglit regressions.
> ---
>  src/mesa/state_tracker/st_cb_texture.c | 14 ++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/src/mesa/state_tracker/st_cb_texture.c 
> b/src/mesa/state_tracker/st_cb_texture.c
> index 9798321..7708443 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -2543,6 +2543,20 @@ st_finalize_texture(struct gl_context *ctx,
>  stObj->base.Target == GL_TEXTURE_CUBE_MAP_ARRAY)
> ptHeight = ptWidth;
>   }
> +
> + /* At this point, the texture may be incomplete (mismatched cube
> +  * face sizes, for example).  If that's the case, give up, but
> +  * don't return GL_FALSE as that would raise an incorrect
> +  * GL_OUT_OF_MEMORY error.  See Piglit fbo-incomplete-texture-03 
> test.
> +  */
> + if (!stObj->base._BaseComplete ||
> + !stObj->base._MipmapComplete) {
> +_mesa_test_texobj_completeness(ctx, >base);
> +if (!stObj->base._BaseComplete ||
> +!stObj->base._MipmapComplete) {
> +   return TRUE;
> +}
> + }
>}
>  
>ptNumSamples = firstImage->base.NumSamples;
-- 
Br,

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


[Mesa-dev] [PATCH 1/2] st/mesa: check for incomplete texture in st_finalize_texture()

2017-06-28 Thread Brian Paul
Return early from st_finalize_texture() if we have an incomplete
texture.  This avoids trying to create a texture resource with invalid
parameters (too many mipmap levels given the base dimension).

Specifically, the Piglit fbo-incomplete-texture-03 test winds up
calling pipe_screen::resource_create() with width0=32, height0=32 and
last_level=6 because the first five cube faces are 32x32 but the sixth
face is 64x64.  Some drivers handle this, but others (like VMware svga)
do not (generates device errors).

Note that this code is on the path that's usually not taken (we normally
build consistent textures).

No Piglit regressions.
---
 src/mesa/state_tracker/st_cb_texture.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index 9798321..7708443 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2543,6 +2543,20 @@ st_finalize_texture(struct gl_context *ctx,
 stObj->base.Target == GL_TEXTURE_CUBE_MAP_ARRAY)
ptHeight = ptWidth;
  }
+
+ /* At this point, the texture may be incomplete (mismatched cube
+  * face sizes, for example).  If that's the case, give up, but
+  * don't return GL_FALSE as that would raise an incorrect
+  * GL_OUT_OF_MEMORY error.  See Piglit fbo-incomplete-texture-03 test.
+  */
+ if (!stObj->base._BaseComplete ||
+ !stObj->base._MipmapComplete) {
+_mesa_test_texobj_completeness(ctx, >base);
+if (!stObj->base._BaseComplete ||
+!stObj->base._MipmapComplete) {
+   return TRUE;
+}
+ }
   }
 
   ptNumSamples = firstImage->base.NumSamples;
-- 
1.9.1

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