On Mon, Feb 27, 2012 at 2:37 PM, Brian Paul <span dir="ltr"><<a href="mailto:brianp@vmware.com">brianp@vmware.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 02/27/2012 03:02 PM, Anuj Phogat wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On Mon, Feb 27, 2012 at 10:54 AM, Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a><br></div><div class="im">
<mailto:<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>><u></u>> wrote:<br>
<br>
On Mon, Feb 27, 2012 at 7:44 AM, Brian Paul <<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a><br></div><div class="im">
<mailto:<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>>> wrote:<br>
<br>
On 02/23/2012 08:27 PM, Anuj Phogat wrote:<br>
<br>
Intel driver throws GL_OUT_OF_MEMORY and assertion failure<br>
/ segmentation<br>
fault with large textures.<br>
<br>
Reproduces the errors reported in:<br></div>
<a href="https://bugs.freedesktop.org/__show_bug.cgi?id=44970" target="_blank">https://bugs.freedesktop.org/_<u></u>_show_bug.cgi?id=44970</a><br>
<<a href="https://bugs.freedesktop.org/show_bug.cgi?id=44970" target="_blank">https://bugs.freedesktop.org/<u></u>show_bug.cgi?id=44970</a>><br>
<a href="https://bugs.freedesktop.org/__show_bug.cgi?id=46303" target="_blank">https://bugs.freedesktop.org/_<u></u>_show_bug.cgi?id=46303</a><div class="im"><br>
<<a href="https://bugs.freedesktop.org/show_bug.cgi?id=46303" target="_blank">https://bugs.freedesktop.org/<u></u>show_bug.cgi?id=46303</a>><br>
<br>
Signed-off-by: Anuj Phogat<<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a><br></div>
<mailto:<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>><u></u>><div class="im"><br>
---<br>
V3: Added the test using proxy textures, deleted redundant<br>
code,<br>
data array allocation based on size returned<br>
<br>
ToDo: getMaxTarget, getProxyTarget and isValidTexSize<br>
functions can be added<br>
as piglit utility functions in piglit-util-gl.c<br>
I will do it in a separate patch.<br>
<br>
tests/all.tests | 1 +<br>
tests/bugs/CMakeLists.gl.txt | 1 +<br>
tests/bugs/large-textures.c | 352<br></div>
++++++++++++++++++++++++++++++<u></u>__++++++++++++<div><div class="h5"><br>
3 files changed, 354 insertions(+), 0 deletions(-)<br>
create mode 100644 tests/bugs/large-textures.c<br>
<br>
<br>
<br>
diff --git a/tests/bugs/large-textures.c<br>
b/tests/bugs/large-textures.c<br>
new file mode 100644<br>
index 0000000..c43f51e<br>
--- /dev/null<br>
+++ b/tests/bugs/large-textures.c<br>
@@ -0,0 +1,352 @@<br>
<br>
<br>
The test should be moved to test/texturing/. I think we<br>
agreed to move away from the tests/bugs/ directory.<br>
<br>
<br>
<br>
[...]<br>
<br>
<br>
+void piglit_init(int argc, char **argv)<br>
+{<br>
+ GLuint tex;<br>
+ int i, j;<br>
+<br>
+ glMatrixMode(GL_PROJECTION);<br>
+ glPushMatrix();<br>
+ glLoadIdentity();<br>
+ glOrtho(0, piglit_width, 0, piglit_height, -1, 1);<br>
+ glMatrixMode(GL_MODELVIEW);<br>
+ glPushMatrix();<br>
+ glLoadIdentity();<br>
+ glClearColor(0.2, 0.2, 0.2, 1.0);<br>
+ glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+ for ( i = 0; i< ARRAY_SIZE(target); i++) {<br>
+<br>
+ glGenTextures(1,&tex);<br>
+ glBindTexture(target[i], tex);<br>
+ glTexParameteri(target[i],<br>
GL_TEXTURE_MIN_FILTER, GL_NEAREST);<br>
+ glTexParameteri(target[i],<br>
GL_TEXTURE_MAG_FILTER, GL_NEAREST);<br>
+<br>
+ for (j = 0; j<<br>
ARRAY_SIZE(internalformat); j++) {<br>
+<br>
+ if (internalformat[j] == GL_RGBA16F ||<br>
+ internalformat[j] == GL_RGBA32F)<br>
+<br></div></div>
piglit_require_extension("GL__<u></u>_ARB_texture_float");<div><div class="h5"><br>
<br>
<br>
I think you should simply skip the float formats if<br>
GL_ARB_texture_float is not supported (don't exit with SKIP<br>
result).<br>
<br>
Yes. That's the right thing i should do.<br>
<br>
<br>
I ran the test with NVIDIA's driver. Here's what it printed:<br>
<br>
GL_PROXY_TEXTURE_1D, Internal Format = GL_RGBA8, Largest<br>
Texture Size = 16384<br>
GL_PROXY_TEXTURE_1D, Internal Format = GL_RGBA16, Largest<br>
Texture Size = 16384<br>
GL_PROXY_TEXTURE_1D, Internal Format = GL_RGBA32F, Largest<br>
Texture Size = 16384<br>
GL_PROXY_TEXTURE_2D, Internal Format = GL_RGBA8, Largest<br>
Texture Size = 16384<br>
GL_PROXY_TEXTURE_2D, Internal Format = GL_RGBA16, Largest<br>
Texture Size = 16384<br>
GL_PROXY_TEXTURE_2D, Internal Format = GL_RGBA32F, Largest<br>
Texture Size = 16384<br>
GL_PROXY_TEXTURE_CUBE_MAP, Internal Format = GL_RGBA8, Largest<br>
Texture Size = 16384<br>
GL_PROXY_TEXTURE_CUBE_MAP, Internal Format = GL_RGBA16,<br>
Largest Texture Size = 16384<br>
GL_PROXY_TEXTURE_CUBE_MAP, Internal Format = GL_RGBA32F,<br>
Largest Texture Size = 16384<br>
GL_PROXY_TEXTURE_3D, Internal Format = GL_RGBA8, Largest<br>
Texture Size = 2048<br>
GL_PROXY_TEXTURE_3D, Internal Format = GL_RGBA16, Largest<br>
Texture Size = 2048<br>
GL_PROXY_TEXTURE_3D, Internal Format = GL_RGBA32F, Largest<br>
Texture Size = 2048<br>
<br>
GL_TEXTURE_1D, Internal Format = GL_RGBA8, Largest Texture<br>
Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_1D, Internal Format = GL_RGBA16, Largest Texture<br>
Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_1D, Internal Format = GL_RGBA32F, Largest Texture<br>
Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_2D, Internal Format = GL_RGBA8, Largest Texture<br>
Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_2D, Internal Format = GL_RGBA16, Largest Texture<br>
Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_2D, Internal Format = GL_RGBA32F, Largest Texture<br>
Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_CUBE_MAP, Internal Format = GL_RGBA16, Largest<br>
Texture Size = 16384<br>
[I killed it here after 10+ minutes of runtime]<br>
<br>
I don't know what's causing the INVALID_VALUE error.<br>
<br>
GL_INVALID_VALUE error is thrown by the driver when we test with<br>
textures larger than maximum supported size. So, this is an<br>
expected error.<br>
</div></div></blockquote>
<br>
I haven't double-checked the code, but why are you testing a texture size that's larger than the advertised max size?<br></blockquote><div>Just to verify that such a case is handled properly in mesa. There was a bug relevant to this case:</div>
<div><a href="https://bugs.freedesktop.org/show_bug.cgi?id=44970">https://bugs.freedesktop.org/show_bug.cgi?id=44970</a></div><div>If you suggest, this case can be moved to texture-border test i'm developing currently. </div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
OK, I'm looking at the loop at line 186:<div class="im"><br>
<br>
for (side = maxSide - 100; side < maxSide + 2; side++) {<br></div>
switch (target) {<br>
case GL_TEXTURE_1D:<br><br>
I guess I don't understand why you're doing that. It seems to me you just have to query the max texture size (both via glGetIntegerv() and the proxy test) then try to create a texture of that size. Testing 102 other size variations isn't necessary.</blockquote>
<div>I originally put that loop starting from maxSide/2 to detect the texture size where driver segfaults or starts throwing GL_OUT_OF_MEMORY. But that makes it a huge loop and i was anyway not able to conclude on a specific texture size which causes segfault. So, now it makes sense to remove this loop.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Another expected error is GL_OUT_OF_MEMORY when driver is unable<br>
to map a previously created large texture in glSubTexImage1D/2D/3D.<br>
I will include both these errors as expected errors and put a<br>
comment about it.<br>
<br>
The test runs _extremely_ slowly. It looks like the driver is<br>
allocating some really large image buffers so we're falling<br>
back to virtual memory. I don't know a way around this. On<br>
one hand, it's good to test this, but nobody wants to wait 10+<br>
minutes for the outcome.<br>
<br>
The purpose of this test case is to make sure that driver doesn't<br>
segfault with large textures and throws relevant errors in case<br>
it is unable to allocate memory or map large textures. I am able<br>
to identify few issues in intel driver using this test case. If<br>
nVidia driver takes a long time to run the test, there's a<br>
possibility that they are not handling such cases properly. May be<br>
they should return GL_OUT_OF_MEMORY in that case.<br>
or we can comment out GL_RGBA16 and GL_RGBA32F and put a comment<br>
informing users about the time test takes with those formats.<br>
</blockquote>
<br></div>
Let's try taking out the 102-iteration loop and see what happens.</blockquote><div>I'll send out an updated patch. Thanks for testing on NVIDIA.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I noticed below listed comment in tests/texturing/tex3d-maxsize.<u></u>c<br>
which might explain the issue you are seeing on nvidia driver:<br>
[...]<br>
/* use proxy texture to find working max texture size */<br>
find_max_tex3d_size(maxsize, &width, &height, &depth);<br>
#ifdef NVIDIA_HACK<br>
/* XXX NVIDIA's proxy texture mechanism is broken.<br>
* If this code is enabled, a smaller texture is used and<br>
* the test passes. Only halving the texture size<br>
isn't enough:<br>
* we try to allocate a gigantic texture which<br>
typically brings<br>
* the machine to its knees, swapping, then dying.<br>
*/<br>
width /= 4;<br>
height /= 4;<br>
depth /= 4;<br>
#endif<br>
[...]<br>
<br>
</blockquote>
<br></div>
I wish I'd have noted which version of NVIDIA driver that was. I don't see any problem with driver 280.13 so we could probably remove that code (it's disabled anyway).<span class="HOEnZb"><font color="#888888"><br>
<br>
-Brian<br>
<br>
</font></span></blockquote></div><br>