[Piglit] [PATCH] fcc: Combine fast clear with mipmap generation

Topi Pohjolainen topi.pohjolainen at intel.com
Tue Feb 9 13:33:30 UTC 2016


This test demonstrates a bug in the Intel mesa driver meta
operation state restore logic. Originally it was found when
developing lossless compression support. Current piglit tests
just didn't exercise the resolve code path that would interfere
with any ongoing meta operation.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
CC: Ben Widawsky <benjamin.widawsky at intel.com>
CC: Chad Versace <chad.versace at intel.com>
---
 tests/fast_color_clear/read-after-clear.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/fast_color_clear/read-after-clear.c b/tests/fast_color_clear/read-after-clear.c
index 98c7169..bbd638e 100644
--- a/tests/fast_color_clear/read-after-clear.c
+++ b/tests/fast_color_clear/read-after-clear.c
@@ -243,6 +243,25 @@ piglit_display(void)
 		glUniform1i(glGetUniformLocation(prog_sample, "samp"), 0);
 		glActiveTexture(GL_TEXTURE0);
 		glBindTexture(GL_TEXTURE_2D, tex1);
+
+		/* Initial buffer for texture is not large enough to hold
+ 		 * subsequent mipmap levels. As a side effect mipmap
+ 		 * generation will trigger Intel driver to allocate new buffer
+ 		 * and to copy the original level zero to the newly allocated.
+		 * Moreover, this will happen inside a meta operation that aims
+		 * to generate level one using level zero as source. The copy
+		 * from original level zero to the new buffer falls to blitter
+		 * engine. This in turn requires the fast cleared content in
+		 * the original buffer to be resolved resulting into another
+		 * nested meta operation.
+		 * This will exercise a bug in Intel driver, the nested meta
+		 * operation will interfere with vertex buffer state of the
+		 * outer meta operation causing the generated level one to
+		 * hold wrong pixel values.
+		 */
+		glGenerateMipmap(GL_TEXTURE_2D);
+		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 1);
+
 		piglit_draw_rect_tex(-1, -1, 2, 2, 0, 0, 1, 1);
 		glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
 		pass = piglit_probe_rect_rgba(0, 0, piglit_width,
-- 
2.5.0



More information about the Piglit mailing list