[Piglit] [PATCH 1/2] cl: Add execution event parameter to piglit_cl_enqueue_kernel
From: Jan Vesely Signed-off-by: Jan Vesely --- tests/cl/api/create-program-with-binary.c| 3 ++- tests/cl/custom/buffer-flags.c | 2 +- tests/cl/custom/flush-after-enqueue-kernel.c | 3 ++- tests/cl/custom/r600-create-release-buffer-bug.c | 9 ++--- tests/cl/custom/use-sub-buffer-in-kernel.c | 3 ++- tests/util/piglit-util-cl.c | 9 ++--- tests/util/piglit-util-cl.h | 4 +++- 7 files changed, 22 insertions(+), 11 deletions(-) diff --git a/tests/cl/api/create-program-with-binary.c b/tests/cl/api/create-program-with-binary.c index 618f4ec296..3f62cd88f7 100644 --- a/tests/cl/api/create-program-with-binary.c +++ b/tests/cl/api/create-program-with-binary.c @@ -185,7 +185,8 @@ piglit_cl_test(const int argc, size_t local_work_size = 1; cl_command_queue queue = ctx->command_queues[i]; if (!piglit_cl_enqueue_ND_range_kernel(queue, kernel, 1, NULL, - &global_work_size, &local_work_size)) { + &global_work_size, &local_work_size, + NULL)) { fprintf(stderr, "Failed to execute binary kernel."); piglit_merge_result(&result, PIGLIT_FAIL); } diff --git a/tests/cl/custom/buffer-flags.c b/tests/cl/custom/buffer-flags.c index e4466bc9d2..a46ce548be 100644 --- a/tests/cl/custom/buffer-flags.c +++ b/tests/cl/custom/buffer-flags.c @@ -130,7 +130,7 @@ buffer_test(piglit_cl_context *ctx, printf("Running the kernel...\n"); if (!piglit_cl_enqueue_ND_range_kernel(context->command_queues[0], - kernel, 1, NULL, &global, &local)) { + kernel, 1, NULL, &global, &local, NULL)) { ret = PIGLIT_FAIL; goto cleanup; } diff --git a/tests/cl/custom/flush-after-enqueue-kernel.c b/tests/cl/custom/flush-after-enqueue-kernel.c index 8d3fc8ccd6..f1246761e1 100644 --- a/tests/cl/custom/flush-after-enqueue-kernel.c +++ b/tests/cl/custom/flush-after-enqueue-kernel.c @@ -92,7 +92,8 @@ piglit_cl_test(const int argc, } if (!piglit_cl_enqueue_ND_range_kernel(context->command_queues[0], - kernel, 3, NULL, global_size, local_size)) { + kernel, 3, NULL, global_size, local_size, + NULL)) { return PIGLIT_FAIL; } diff --git a/tests/cl/custom/r600-create-release-buffer-bug.c b/tests/cl/custom/r600-create-release-buffer-bug.c index 535e57dbfa..262fbce7ec 100644 --- a/tests/cl/custom/r600-create-release-buffer-bug.c +++ b/tests/cl/custom/r600-create-release-buffer-bug.c @@ -75,7 +75,8 @@ piglit_cl_test(const int argc, } if (!piglit_cl_enqueue_ND_range_kernel(queue, kernel, 1, NULL, - &global_size, &local_size)) { + &global_size, &local_size, + NULL)) { return PIGLIT_FAIL; } @@ -85,7 +86,8 @@ piglit_cl_test(const int argc, } if (!piglit_cl_enqueue_ND_range_kernel(queue, kernel, 1, NULL, - &global_size, &local_size)) { + &global_size, &local_size, + NULL)) { return PIGLIT_FAIL; } @@ -99,7 +101,8 @@ piglit_cl_test(const int argc, } if (!piglit_cl_enqueue_ND_range_kernel(queue, kernel, 1, NULL, - &global_size, &local_size)) { + &global_size, &local_size, + NULL)) { return PIGLIT_FAIL; } diff --git a/tests/cl/custom/use-sub-buffer-in-kernel.c b/tests/cl/custom/use-sub-buffer-in-kernel.c index 74c085882e..57aed3258f 100644 --- a/tests/cl/custom/use-sub-buffer-in-kernel.c +++ b/tests/cl/custom/use-sub-buffer-in-kernel.c @@ -99,7 +99,8 @@ piglit_cl_test(const int argc, } if (!piglit_cl_enqueue_ND_range_kernel(queue, kernel, 1, NULL, - &global_size, &local_size)) { + &global_size, &local_size, + NULL)) { return PIGLIT_FAIL; } clFinish(queue); diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c index 28217724c5..f4def259cc 100644 --- a/tests/util/piglit-util-cl.c +++ b/tests/util/piglit-util-cl.c @@ -1322,13 +1322,14 @@ piglit_cl_enqueue_ND_range_kernel(cl_command_queue command_queue, cl_kernel kernel, cl_uint
[Piglit] [PATCH 2/2] cl: Wait for kernel execution instead of flushing the queue in cl_piglit_execute kernel
From: Jan Vesely This prevents race condition when a failed kernel launch would no longer be in the command queue by the time we call clFinish. Signed-off-by: Jan Vesely --- tests/util/piglit-util-cl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c index f4def259cc..42a5e72f92 100644 --- a/tests/util/piglit-util-cl.c +++ b/tests/util/piglit-util-cl.c @@ -1360,7 +1360,7 @@ piglit_cl_execute_ND_range_kernel(cl_command_queue command_queue, return false; } - errNo = clFinish(command_queue); + errNo = clWaitForEvents(1, &ev); if(!piglit_cl_check_error(errNo, CL_SUCCESS)) { fprintf(stderr, "Could not wait for kernel to finish: %s\n", -- 2.18.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] tests/image_load_store/atomic: use piglit subtest framework
Quoting Rafael Antognolli (2018-11-20 17:01:11) > Awesome, thanks for doing this. > > Reviewed-by: Rafael Antognolli > > Also, it fixes the issue I had, but apparently it's not the only test > with that problem. Another test with the same issue: > > spec@arb_shader_image_size@builtin > > I would guess there are other tests in the same situation, it just > happens that I didn't have a GPU hang with them, and so they didn't > incorrectly report pass when they actually hung. > > Thanks anyway. > Rafael Yeah, basically all tests using subtests (except for a very small number that have been fixed already) have this problem. I just haven't gotten around to fixing them all yet. > > On Mon, Nov 19, 2018 at 03:12:27PM -0800, Dylan Baker wrote: > > cc: Rafael Antognolli > > --- > > .../arb_shader_image_load_store/atomicity.c | 403 +++--- > > 1 file changed, 239 insertions(+), 164 deletions(-) > > > > diff --git a/tests/spec/arb_shader_image_load_store/atomicity.c > > b/tests/spec/arb_shader_image_load_store/atomicity.c > > index f53dddaa2..88d15d65d 100644 > > --- a/tests/spec/arb_shader_image_load_store/atomicity.c > > +++ b/tests/spec/arb_shader_image_load_store/atomicity.c > > @@ -1,5 +1,6 @@ > > /* > > * Copyright (C) 2014 Intel Corporation > > + * Copyright © 2018 Intel Corporation > > * > > * Permission is hereby granted, free of charge, to any person obtaining a > > * copy of this software and associated documentation files (the > > "Software"), > > @@ -58,16 +59,7 @@ > > /** Total number of pixels in the window and image. */ > > #define N (W * H) > > > > -PIGLIT_GL_TEST_CONFIG_BEGIN > > - > > -config.supports_gl_core_version = 32; > > - > > -config.window_width = W; > > -config.window_height = H; > > -config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; > > -config.khr_no_error_support = PIGLIT_NO_ERRORS; > > - > > -PIGLIT_GL_TEST_CONFIG_END > > +static struct piglit_gl_test_config *piglit_config; > > > > static bool > > init_image(const struct image_info img, uint32_t v) > > @@ -112,56 +104,28 @@ check_image_const(const struct image_info img, > > unsigned n, uint32_t v) > > pixels, v, 0, 0, 0); > > } > > > > -/** > > - * Test skeleton: Init image to \a init_value, run the provided shader > > - * \a op, check that the first \a check_sz pixels of the image equal > > - * \a check_value and optionally check that the resulting fragment > > - * values on the framebuffer are unique. > > - */ > > -static bool > > -run_test(uint32_t init_value, unsigned check_sz, uint32_t check_value, > > - bool check_unique, const char *op) > > -{ > > -const struct grid_info grid = > > -grid_info(GL_FRAGMENT_SHADER, GL_R32UI, W, H); > > -const struct image_info img = > > -image_info(GL_TEXTURE_1D, GL_R32UI, W, H); > > -GLuint prog = generate_program( > > -grid, GL_FRAGMENT_SHADER, > > -concat(image_hunk(img, ""), > > - hunk("volatile IMAGE_UNIFORM_T img;\n"), > > - hunk(op), NULL)); > > -bool ret = prog && > > -init_fb(grid) && > > -init_image(img, init_value) && > > -set_uniform_int(prog, "img", 0) && > > -draw_grid(grid, prog) && > > -check_image_const(img, check_sz, check_value) && > > -(!check_unique || check_fb_unique(grid)); > > - > > -glDeleteProgram(prog); > > -return ret; > > -} > > - > > -void > > -piglit_init(int argc, char **argv) > > +struct testcase > > { > > -enum piglit_result status = PIGLIT_PASS; > > - > > -piglit_require_extension("GL_ARB_shader_image_load_store"); > > - > > + uint32_t init_value; > > + unsigned check_sz; > > + uint32_t check_value; > > + bool check_unique; > > + const char * op; > > +}; > > + > > +static struct testcase testdata[] = { > > /* > > * If imageAtomicAdd() is atomic the return values obtained > > * from each call are guaranteed to be unique. > > */ > > -subtest(&status, true, > > -run_test(0, 1, N, true, > > - "GRID_T op(ivec2 idx, GRID_T x) {\n" > > - " return GRID_T(" > > - " imageAtomicAdd(img, > > IMAGE_ADDR(ivec2(0)), 1u)," > > - " 0, 0, 1);\n" > > - "}\n"), > > -"imageAtomicAdd"); > > + { > > + 0, 1, N, true, > > + "GRID_T op(ivec2 idx, GRID_T x) {\n" > > + " return GRID_T(" > > + " imageAtomicAdd(img, IMAGE_ADDR(ivec2(0)), 1u)," > > + " 0, 0, 1);\n" > > + "}\n", > > + }, > > > > /* > > * Call imageAtomicMin() on a fixed location from within a > >
Re: [Piglit] [PATCH 19/19] tests/ext_polygon_offset_clamp-draw: use subtest framework
Quoting Ilia Mirkin (2018-11-20 18:28:52) > On Mon, Nov 19, 2018 at 4:24 PM Dylan Baker wrote: > > > > --- > > tests/spec/ext_polygon_offset_clamp/draw.c | 121 ++--- > > 1 file changed, 79 insertions(+), 42 deletions(-) > > > > diff --git a/tests/spec/ext_polygon_offset_clamp/draw.c > > b/tests/spec/ext_polygon_offset_clamp/draw.c > > index 5c7382556..089b45425 100644 > > --- a/tests/spec/ext_polygon_offset_clamp/draw.c > > +++ b/tests/spec/ext_polygon_offset_clamp/draw.c > > @@ -39,47 +39,22 @@ > > > > #include "piglit-util-gl.h" > > > > -PIGLIT_GL_TEST_CONFIG_BEGIN > > -#if PIGLIT_USE_OPENGL > > - config.supports_gl_compat_version = 21; > > -#else > > - config.supports_gl_es_version = 20; > > -#endif > > - config.window_visual = PIGLIT_GL_VISUAL_RGB | > > PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_DOUBLE; > > - > > -PIGLIT_GL_TEST_CONFIG_END > > - > > GLint prog, color, zflip; > > > > -enum piglit_result > > -piglit_display(void) > > -{ > > - static const float blue[4] = {0, 0, 1, 1}; > > - static const float red[4] = {1, 0, 0, 1}; > > - static const float green[4] = {0, 1, 0, 1}; > > - > > - bool passa = true, passb = true; > > - > > - glUseProgram(prog); > > - > > - glViewport(0, 0, piglit_width, piglit_height); > > - glEnable(GL_DEPTH_TEST); > > - glEnable(GL_POLYGON_OFFSET_FILL); > > - > > - glUniform1f(zflip, 1.0); > > - glClearColor(0, 0, 1, 1); > > -#ifdef PIGLIT_USE_OPENGL > > - glClearDepth(0.5); > > -#else > > - glClearDepthf(0.5); > > -#endif > > - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); > > +static const struct piglit_gl_test_config * piglit_config; > > +static const float blue[4] = {0, 0, 1, 1}; > > +static const float red[4] = {1, 0, 0, 1}; > > +static const float green[4] = {0, 1, 0, 1}; > > > > +static enum piglit_result > > +test_negative_clamp(void * unused) > > +{ > > /* NOTE: It appears that at least nvidia hw will end up > > * wrapping around if the final z value goes below 0 (or > > * something). This can come up when testing without the > > * clamp. > > */ > > + bool pass = true; > > > > /* Draw red rectangle that slopes between 1 and 0.1. Use a > > * polygon offset with a high factor but small clamp > > @@ -89,7 +64,7 @@ piglit_display(void) > > glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); > > if (!piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, > > blue)) { > > printf(" FAIL: red rect peeks over blue rect\n"); > > - passa = false; > > + pass = false; > > } > > > > /* And now set the clamp such that all parts of the polygon > > @@ -100,11 +75,21 @@ piglit_display(void) > > glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); > > if (!piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, > > green)) { > > printf(" FAIL: green rect does not cover blue rect\n"); > > - passa = false; > > + pass = false; > > } > > > > - piglit_report_subtest_result(passa ? PIGLIT_PASS : PIGLIT_FAIL, > > -"negative clamp"); > > + return pass ? PIGLIT_PASS : PIGLIT_FAIL; > > +} > > + > > +static enum piglit_result > > +test_positive_clamp(void * unused) > > +{ > > + /* NOTE: It appears that at least nvidia hw will end up > > +* wrapping around if the final z value goes below 0 (or > > +* something). This can come up when testing without the > > +* clamp. > > Having this identical comment 2x seems ... unnecessary. Perhaps just > once and above the function? sure, that sounds better. > > > +*/ > > + bool pass = true; > > > > /* Now try this again with the inverse approach and a positive > > * clamp value. The polygon will now slope between -1 and > > @@ -121,7 +106,7 @@ piglit_display(void) > > glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); > > if (!piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, > > blue)) { > > printf(" FAIL: red rect peeks over blue rect\n"); > > - passb = false; > > + pass = false; > > } > > > > /* And now set the clamp so that all parts of the polygon pass > > @@ -132,15 +117,67 @@ piglit_display(void) > > glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); > > if (!piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, > > green)) { > > printf(" FAIL: green rect does not cover blue rect\n"); > > - passb = false; > > + pass = false; > > } > > > > - piglit_report_subtest_result(passb ? PIGLIT_PASS : PIGLIT_FAIL, > > -"positive clamp"); > > + return pass ? PIGLIT_PASS : PIGLIT_FAIL; > > +} > > + > > +static const struct piglit_subtest tests[] = { > > +
[Piglit] [PATCH] arb_gl_spirv: add test for uniform blocks with the same structure
This test reproduces a bug in Nvidia drivers: error: binding mismatch between shaders for UBO (named __defaultname) error: struct type mismatch between shaders for uniform (named __defaultname) error: binding mismatch between shaders for UBO (named __defaultname) error: struct type mismatch between shaders for uniform (named __defaultname) error: binding mismatch between shaders for UBO (named __defaultname) error: struct type mismatch between shaders for uniform (named __defaultname) error: binding mismatch between shaders for UBO (named __defaultname) error: struct type mismatch between shaders for uniform (named __defaultname) The same issue is also present when SPIR-V debug names for uniform blocks are the same. --- .../unnamed-uniform-blocks.shader_test| 67 +++ 1 file changed, 67 insertions(+) create mode 100644 tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test diff --git a/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test b/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test new file mode 100644 index ..9dba7d44c37d --- /dev/null +++ b/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test @@ -0,0 +1,67 @@ +# Test unnamed uniform blocks with the same structure + +[require] +SPIRV YES +GL >= 3.3 +GLSL >= 4.50 + +[compute shader spirv] +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" + OpExecutionMode %4 LocalSize 1 1 1 + OpDecorate %9 Location 2 + OpDecorate %9 DescriptorSet 0 + OpDecorate %_arr_v4uint_uint_4 ArrayStride 16 + OpMemberDecorate %_struct_18 0 Offset 0 + OpDecorate %_struct_18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %_arr_v4uint_uint_4_0 ArrayStride 16 + OpMemberDecorate %_struct_26 0 Offset 0 + OpDecorate %_struct_26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %7 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %9 = OpVariable %_ptr_UniformConstant_7 UniformConstant +%int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 + %14 = OpConstantComposite %v2int %int_0 %int_0 + %v4uint = OpTypeVector %uint 4 + %uint_4 = OpConstant %uint 4 +%_arr_v4uint_uint_4 = OpTypeArray %v4uint %uint_4 + %_struct_18 = OpTypeStruct %_arr_v4uint_uint_4 +%_ptr_Uniform__struct_18 = OpTypePointer Uniform %_struct_18 + %20 = OpVariable %_ptr_Uniform__struct_18 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_arr_v4uint_uint_4_0 = OpTypeArray %v4uint %uint_4 + %_struct_26 = OpTypeStruct %_arr_v4uint_uint_4_0 +%_ptr_Uniform__struct_26 = OpTypePointer Uniform %_struct_26 + %28 = OpVariable %_ptr_Uniform__struct_26 Uniform + %4 = OpFunction %void None %3 + %5 = OpLabel + %10 = OpLoad %7 %9 + %23 = OpAccessChain %_ptr_Uniform_uint %20 %int_0 %int_0 %uint_0 + %24 = OpLoad %uint %23 + %29 = OpAccessChain %_ptr_Uniform_uint %28 %int_0 %int_0 %uint_0 + %30 = OpLoad %uint %29 + %31 = OpIAdd %uint %24 %30 + %32 = OpCompositeConstruct %v4uint %31 %31 %31 %31 + OpImageWrite %10 %14 %32 + OpReturn + OpFunctionEnd + +[test] +link success -- 2.18.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] fbo: fixup compiler-warnings in quirk-test
I'm not quite sure why I didn't catch this earlier, but the code discards constness from some arrays, which leads to warnings. Let's add the constness to the function-signature, and the warnings go away. Signed-off-by: Erik Faye-Lund --- tests/fbo/fbo-blending-format-quirks.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/fbo/fbo-blending-format-quirks.c b/tests/fbo/fbo-blending-format-quirks.c index 1b71b3252..478890141 100644 --- a/tests/fbo/fbo-blending-format-quirks.c +++ b/tests/fbo/fbo-blending-format-quirks.c @@ -42,8 +42,10 @@ PIGLIT_GL_TEST_CONFIG_BEGIN PIGLIT_GL_TEST_CONFIG_END -static enum piglit_result test_formats(const char *name, GLenum formats[2], - float expect[2][4], GLenum factors[2]) +static enum piglit_result test_formats(const char *name, + const GLenum formats[2], + const float expect[2][4], + const GLenum factors[2]) { GLboolean pass = GL_TRUE; GLuint tex[2], fb; -- 2.19.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH v2 7/6] texturing: run gles2 variants as well
On Tue, 2018-11-20 at 22:30 -0500, Ilia Mirkin wrote: > Series is > > Reviewed-by: Ilia Mirkin Thanks, pushed :) > On Fri, Oct 26, 2018 at 11:34 AM Erik Faye-Lund > wrote: > > It's nice if these tests also run automatically, so let's add them > > to > > opengl.py. > > > > Signed-off-by: Erik Faye-Lund > > --- > > Yeah, so Ilia pointed out on IRC that it would be a good idea to > > hook > > these up so they run automatically as well. So here's an additional > > patch for that. If desired, I can squash these in with the patches > > that > > ports the tests instead of having an additional patch in the end. > > > > tests/opengl.py | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/tests/opengl.py b/tests/opengl.py > > index 54cfd04d5..c7b5aaf6e 100644 > > --- a/tests/opengl.py > > +++ b/tests/opengl.py > > @@ -3210,9 +3210,12 @@ with profile.test_list.group_manager( > > g(['arb_texture_compression-invalid-formats', 's3tc'], > > 'invalid formats') > > g(['gen-compressed-teximage'], run_concurrent=False) > > g(['s3tc-errors']) > > +g(['s3tc-errors_gles2']) > > g(['s3tc-targeted']) > > g(['s3tc-teximage'], run_concurrent=False) > > +g(['s3tc-teximage_gles2'], run_concurrent=False) > > g(['s3tc-texsubimage'], run_concurrent=False) > > +g(['s3tc-texsubimage_gles2'], run_concurrent=False) > > g(['getteximage-targets', '2D', 'S3TC']) > > g(['getteximage-targets', '2D_ARRAY', 'S3TC']) > > g(['getteximage-targets', 'CUBE', 'S3TC']) > > -- > > 2.17.2 > > ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [Bug 108819] Piglit test depthstencil-render-miplevels wrong memory usage
https://bugs.freedesktop.org/show_bug.cgi?id=108819 --- Comment #1 from Sergii Romantsov --- Series proposed: https://patchwork.freedesktop.org/series/52815/ -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH v1 1/2] piglit-framework-gl: add possibility to deinit test
Each test can be initialized ('init') and displayed ('dipslay'). During initialization can be allocated resources. But there is no common unified mechanism to free resources on test finishing, except, probably, registaration of callabck with 'atexit'. To the piglit-configuration added callback-function 'deinit' that will be called on the test end. CC: Brian Paul CC: Timothy Arceri Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108819 Signed-off-by: Sergii Romantsov --- tests/util/piglit-framework-gl.h | 3 +++ tests/util/piglit-framework-gl/piglit_gl_framework.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h index a4ecddb..2dfbad2 100644 --- a/tests/util/piglit-framework-gl.h +++ b/tests/util/piglit-framework-gl.h @@ -192,6 +192,9 @@ struct piglit_gl_test_config { enum piglit_result (*display)(void); + void + (*deinit)(void); + /** * List of subtests supported by this test case * diff --git a/tests/util/piglit-framework-gl/piglit_gl_framework.c b/tests/util/piglit-framework-gl/piglit_gl_framework.c index 37c0677..bdb9dbd 100644 --- a/tests/util/piglit-framework-gl/piglit_gl_framework.c +++ b/tests/util/piglit-framework-gl/piglit_gl_framework.c @@ -116,5 +116,7 @@ piglit_gl_framework_init(struct piglit_gl_framework *gl_fw, void piglit_gl_framework_teardown(struct piglit_gl_framework *gl_fw) { + if (gl_fw->test_config->deinit) + gl_fw->test_config->deinit(); return; } -- 2.7.4 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH v1 2/2] test: fix resources usage for depthstencil-render-miplevels
Usage test 'depthstencil-render-miplevels 200 s=z24_s8' causes core dump on exit. Issues: 1. Allocation of memory many times to the same variable 2. Not complete array to store pointers 3. Absence of memory freeing CC: Eric Anholt Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108819 Fixes: 7a0e61d7792f (depthstencil-render-miplevels: Present the results in non-auto mode.) Signed-off-by: Sergii Romantsov --- tests/texturing/depthstencil-render-miplevels.cpp | 37 ++- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/tests/texturing/depthstencil-render-miplevels.cpp b/tests/texturing/depthstencil-render-miplevels.cpp index 87af92f..f3b1d02 100644 --- a/tests/texturing/depthstencil-render-miplevels.cpp +++ b/tests/texturing/depthstencil-render-miplevels.cpp @@ -86,6 +86,9 @@ #include "piglit-util-gl.h" +extern "C" void +piglit_deinit(void); + PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; @@ -94,6 +97,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.window_height = 512; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; config.khr_no_error_support = PIGLIT_NO_ERRORS; + config.deinit = piglit_deinit; PIGLIT_GL_TEST_CONFIG_END @@ -109,9 +113,28 @@ bool attach_together = false; bool attach_stencil_first = false; GLenum depth_format; int miplevel0_size; -int max_miplevel; -float **depth_miplevel_data; -uint8_t **stencil_miplevel_data; +int max_miplevel = 0; +float **depth_miplevel_data = NULL; +uint8_t **stencil_miplevel_data = NULL; + +extern "C" void +piglit_deinit() +{ + if (depth_miplevel_data) + { + for (int i = 0; i <= max_miplevel; ++i) + if (depth_miplevel_data[i]) + free(depth_miplevel_data[i]); + free(depth_miplevel_data); + } + if (stencil_miplevel_data) + { + for (int i = 0; i <= max_miplevel; ++i) + if (stencil_miplevel_data[i]) + free(stencil_miplevel_data[i]); + free(stencil_miplevel_data); + } +} /** * Check if the given depth/stencil/rgba texture internal format is supported. @@ -279,7 +302,7 @@ test_miplevel(int level) if (!piglit_automatic) { depth_miplevel_data[level] = - (float *)malloc(4 * dim * dim); + (float *)realloc(depth_miplevel_data[level], 4 * dim * dim); glReadPixels(0, 0, dim, dim, GL_DEPTH_COMPONENT, GL_FLOAT, depth_miplevel_data[level]); @@ -294,7 +317,7 @@ test_miplevel(int level) if (!piglit_automatic) { stencil_miplevel_data[level] = - (uint8_t *)malloc(dim * dim); + (uint8_t *)realloc(stencil_miplevel_data[level], dim * dim); glReadPixels(0, 0, dim, dim, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, stencil_miplevel_data[level]); @@ -360,8 +383,8 @@ piglit_init(int argc, char **argv) piglit_require_extension("GL_ARB_depth_texture"); piglit_require_extension("GL_ARB_texture_non_power_of_two"); - depth_miplevel_data = (float **)calloc(max_miplevel, sizeof(float *)); - stencil_miplevel_data = (uint8_t **)calloc(max_miplevel, + depth_miplevel_data = (float **)calloc(max_miplevel + 1, sizeof(float *)); + stencil_miplevel_data = (uint8_t **)calloc(max_miplevel + 1, sizeof(uint8_t *)); /* argv[2]: buffer combination */ -- 2.7.4 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [Bug 108819] New: Piglit test depthstencil-render-miplevels wrong memory usage
https://bugs.freedesktop.org/show_bug.cgi?id=108819 Bug ID: 108819 Summary: Piglit test depthstencil-render-miplevels wrong memory usage Product: piglit Version: unspecified Hardware: Other OS: All Status: NEW Severity: normal Priority: medium Component: tests Assignee: piglit@lists.freedesktop.org Reporter: sergii.romant...@globallogic.com QA Contact: piglit@lists.freedesktop.org Usage test 'depthstencil-render-miplevels 200 s=z24_s8' causes core dump on exit. *** Error in `./depthstencil-render-miplevels': double free or corruption (out): 0x01e02120 *** -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit