Re: [Piglit] [PATCH] tests: Add integration with Khronos CTS OpenGL runner
Dylan Baker writes: > Quoting Juan A. Suarez Romero (2016-05-18 06:34:07) >> This adds support for running Khronos' deqp-based conformance suite for >> OpenGL with piglit. >> --- >> piglit.conf.example | 10 ++ >> tests/{cts.py => cts_gl45.py} | 43 >> + >> tests/{cts.py => cts_gles31.py} | 2 +- > > Since these run all of the tests I think I'd prefer cts_gles and cts_gl, > but that's a bit of a nit-pick. > >> 3 files changed, 37 insertions(+), 18 deletions(-) >> copy tests/{cts.py => cts_gl45.py} (56%) >> rename tests/{cts.py => cts_gles31.py} (97%) >> >> diff --git a/piglit.conf.example b/piglit.conf.example >> index 944d5d9..3cce52a 100644 >> --- a/piglit.conf.example >> +++ b/piglit.conf.example >> @@ -95,6 +95,16 @@ testB >> ; overrides the value set here. >> ;extra_args=--deqp-visibility hidden >> >> +[cts_gl] >> +; path to the cts opengl executable >> +; can be overwritten by PIGLIT_CTS_GL_BIN environment variable >> +;bin=/home/knuth/cts/cts/glcts >> + >> +; Space-separated list of extra command line arguments for cts. The >> +; option is not required. The environment variable PIGLIT_CTS_GL_EXTRA_ARGS >> +; overrides the value set here. >> +;extra_args=--deqp-visibility hidden >> + >> ; Section for specific oclconform test. One of these sections is required >> for >> ; each test list in the oclconform section and must be called: >> ; oclconform-$testname >> diff --git a/tests/cts.py b/tests/cts_gl45.py >> similarity index 56% >> copy from tests/cts.py >> copy to tests/cts_gl45.py >> index 0e64e1b..607b79b 100644 >> --- a/tests/cts.py >> +++ b/tests/cts_gl45.py >> @@ -20,25 +20,24 @@ >> >> """Piglit integration for Khronos CTS tests. >> >> -By default this will run GLES2, GLES3, GLES31, and GLESEXT test cases. Those >> -desiring to run only a subset of them should consider using the -t or -x >> -options to include or exclude tests. >> +By default this will run GL30, GL31, GL32, GL33, GL40, GL41, GL42, GL43, >> GL44 >> +and GL45 test cases. Those desiring to run only a subset of them should >> consider >> +using the -t or -x options to include or exclude tests. >> >> For example: >> -./piglit run cts -c foo -t ES3- would run only ES3 tests (note the dash to >> -exclude ES31 tests) >> +./piglit run cts_gl45 -c foo -t GL30- would run only GL30 tests >> >> This integration requires some configuration in piglit.conf, or the use of >> environment variables. >> >> In piglit.conf one should set the following: >> -[cts]:bin -- Path to the glcts binary >> -[cts]:extra_args -- any extra arguments to be passed to cts (optional) >> +[cts_gl]:bin -- Path to the glcts binary >> +[cts_gl]:extra_args -- any extra arguments to be passed to cts (optional) > >> >> Alternatively (or in addition, since environment variables have precedence), >> one could set: >> -PIGLIT_CTS_BIN -- environment equivalent of [cts]:bin >> -PIGLIT_CTS_EXTRA_ARGS -- environment equivalent of [cts]:extra_args >> +PIGLIT_CTS_GL_BIN -- environment equivalent of [cts_gl]:bin >> +PIGLIT_CTS_GL_EXTRA_ARGS -- environment equivalent of [cts_gl]:extra_args >> >> """ >> >> @@ -51,9 +50,9 @@ from framework.test import deqp >> >> __all__ = ['profile'] >> >> -_CTS_BIN = deqp.get_option('PIGLIT_CTS_BIN', ('cts', 'bin')) >> +_CTS_BIN = deqp.get_option('PIGLIT_CTS_GL_BIN', ('cts_gl', 'bin')) >> >> -_EXTRA_ARGS = deqp.get_option('PIGLIT_CTS_EXTRA_ARGS', ('cts', >> 'extra_args'), >> +_EXTRA_ARGS = deqp.get_option('PIGLIT_CTS_GL_EXTRA_ARGS', ('cts_gl', >> 'extra_args'), >>default='').split() >> >> >> @@ -65,18 +64,28 @@ class DEQPCTSTest(deqp.DEQPBaseTest): >> return super(DEQPCTSTest, self).extra_args + \ >> [x for x in _EXTRA_ARGS if not x.startswith('--deqp-case')] >> >> - >> # Add all of the suites by default, users can use filters to remove them. >> profile = deqp.make_profile( # pylint: disable=invalid-name >> itertools.chain( >> deqp.iter_deqp_test_cases( >> -deqp.gen_caselist_txt(_CTS_BIN, 'ES2-CTS-cases.txt', >> _EXTRA_ARGS)), >> +deqp.gen_caselist_txt(_CTS_BIN, 'GL30-CTS-cases.txt', >> _EXTRA_ARGS)), >> +deqp.iter_deqp_test_cases( >> +deqp.gen_caselist_txt(_CTS_BIN, 'GL31-CTS-cases.txt', >> _EXTRA_ARGS)), >> +deqp.iter_deqp_test_cases( >> +deqp.gen_caselist_txt(_CTS_BIN, 'GL32-CTS-cases.txt', >> _EXTRA_ARGS)), >> +deqp.iter_deqp_test_cases( >> +deqp.gen_caselist_txt(_CTS_BIN, 'GL33-CTS-cases.txt', >> _EXTRA_ARGS)), >> +deqp.iter_deqp_test_cases( >> +deqp.gen_caselist_txt(_CTS_BIN, 'GL40-CTS-cases.txt', >> _EXTRA_ARGS)), >> +deqp.iter_deqp_test_cases( >> +deqp.gen_caselist_txt(_CTS_BIN, 'GL41-CTS-cases.txt', >> _EXTRA_ARGS)), >> +deqp.iter_deqp_test_cases( >> +deqp.gen_caselist_txt(_CTS_BIN, 'GL42-CTS-cases.txt', >>
[Piglit] [PATCH] framework: make the interpret_result method for native tests faster
This reimplements the interpret_result method of PiglitBaseTest (which is used by all native piglit tests) to loop once rather than twice. There is a speedup of about 3 seconds for 10,000 iterations. Being that piglit runs about 30,000 tests that is something, for a pretty reasonable patch. Signed-off-by: Dylan Baker --- framework/test/piglit_test.py | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py index 32a991b..ddef66b 100644 --- a/framework/test/piglit_test.py +++ b/framework/test/piglit_test.py @@ -25,9 +25,10 @@ from __future__ import ( absolute_import, division, print_function, unicode_literals ) +import glob +import itertools import os import sys -import glob try: import simplejson as json except ImportError: @@ -68,14 +69,15 @@ class PiglitBaseTest(ValgrindMixin, Test): self._command[0] = os.path.join(TEST_BIN_DIR, self._command[0]) def interpret_result(self): -outlines = self.result.out.split('\n') -outpiglit = (s[7:] for s in outlines if s.startswith('PIGLIT:')) - -# FIXME: handle this properly. It needs a method in TestResult probably -for piglit in outpiglit: -self.result.update(json.loads(piglit)) -self.result.out = '\n'.join( -s for s in outlines if not s.startswith('PIGLIT:')) +out = [] + +for each in self.result.out.split('\n'): +if each.startswith('PIGLIT:'): +self.result.update(json.loads(each[8:])) +else: +out.append(each) + +self.result.out = '\n'.join(out) super(PiglitBaseTest, self).interpret_result() -- 2.8.3 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/2] ext_framebuffer_multisample_blit_scaled: Simplify the shader code
Other than simplifications there are few changes to make the shader look like the one in Mesa. This will make it easier to port the future changes to the test shader from driver shader code. Signed-off-by: Anuj Phogat --- .../blit-scaled.cpp| 59 ++ 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/tests/spec/ext_framebuffer_multisample_blit_scaled/blit-scaled.cpp b/tests/spec/ext_framebuffer_multisample_blit_scaled/blit-scaled.cpp index a192655..b1c1f1c 100644 --- a/tests/spec/ext_framebuffer_multisample_blit_scaled/blit-scaled.cpp +++ b/tests/spec/ext_framebuffer_multisample_blit_scaled/blit-scaled.cpp @@ -76,51 +76,43 @@ compile_shader(GLenum target) "#version 130\n" "in vec2 piglit_vertex;\n" "in vec2 piglit_texcoord;\n" - "out vec2 textureCoord;\n" + "out vec2 texCoords;\n" "void main()\n" "{\n" " gl_Position = vec4(piglit_vertex, 0.0, 1.0);\n" - " textureCoord = piglit_texcoord;\n" + " texCoords = piglit_texcoord;\n" "}\n"; /* Bilinear filtering of samples using shader program */ static const char *frag_template = "#version 130\n" "#extension GL_ARB_texture_multisample : require\n" - "in vec2 textureCoord;\n" "uniform %s texSampler;\n" - "uniform float src_width;\n" - "uniform float src_height;\n" + "uniform float src_width, src_height;\n" + "in vec2 texCoords;\n" "out vec4 out_color;\n" "void main()\n" "{\n" "%s" - " float x_f, y_f;\n" - " const float x_scale = 2.0f, x_scale_inv = 0.5f;\n" - " const float y_scale = %ff, y_scale_inv = %ff;\n" - " const float x_offset = 0.25f, y_offset = %ff;\n" + " vec2 interp;\n" + " const vec2 scale = vec2(%ff, %ff);\n" + " const vec2 scale_inv = vec2(%ff, %ff);\n" + " const vec2 s_0_offset = vec2(%ff, %ff);\n" " vec2 s_0_coord, s_1_coord, s_2_coord, s_3_coord;\n" " vec4 s_0_color, s_1_color, s_2_color, s_3_color;\n" " vec4 x_0_color, x_1_color;\n" + " vec2 tex_coord = texCoords - s_0_offset;\n" "\n" - " vec2 tex_coord = vec2(textureCoord.x - x_offset,\n" - "textureCoord.y - y_offset);\n" - " tex_coord = vec2(x_scale * tex_coord.x, y_scale * tex_coord.y);\n" - "\n" - " clamp(tex_coord.x, 0.0f, x_scale * src_width - 1.0f);\n" - " clamp(tex_coord.y, 0.0f, y_scale * src_height - 1.0f);\n" - "\n" - " x_f = fract(tex_coord.x);\n" - " y_f = fract(tex_coord.y);\n" - "\n" - " tex_coord.x = int(tex_coord.x) * x_scale_inv;\n" - " tex_coord.y = int(tex_coord.y) * y_scale_inv;\n" - "\n" + " tex_coord *= scale;\n" + " tex_coord.x = clamp(tex_coord.x, 0.0f, scale.x * src_width - 1.0f);\n" + " tex_coord.y = clamp(tex_coord.y, 0.0f, scale.y * src_height - 1.0f);\n" + " interp = fract(tex_coord);\n" + " tex_coord = ivec2(tex_coord) * scale_inv;\n" "\n" " /* Compute the sample coordinates used for filtering. */\n" " s_0_coord = tex_coord;\n" - " s_1_coord = tex_coord + vec2(x_scale_inv, 0.0f);\n" - " s_2_coord = tex_coord + vec2(0.0f, y_scale_inv);\n" - " s_3_coord = tex_coord + vec2(x_scale_inv, y_scale_inv);\n" + " s_1_coord = tex_coord + vec2(scale_inv.x, 0.0f);\n" + " s_2_coord = tex_coord + vec2(0.0f, scale_inv.y);\n" + " s_3_coord = tex_coord + vec2(scale_inv.x, scale_inv.y);\n" "\n" " /* Fetch sample color values. */\n" "%s" @@ -131,14 +123,17 @@ compile_shader(GLenum target) "#undef TEXEL_FETCH\n" "\n" " /* Do bilinear filtering on sample colors. */\n" - " x_0_color = mix(s_0_color, s_1_color, x_f);\n" - " x_1_color = mix(s_2_color, s_3_color, x_f);\n" - " out_color = mix(x_0_color, x_1_color, y_f);\n" + " x_0_color = mix(s_0_color, s_1_color, interp.x);\n" + " x_1_color = mix(s_2_color, s_3_color, interp.x);\n" + " out_color = mix(x_0_color, x_1_color, interp.y);\n" "}\n"; char* frag, *texel_fetch_macro; const char*sample_number, *sample_map = ""; - const float y_scale = samples * 0.5; + fl
[Piglit] [PATCH 2/2] ext_framebuffer_multisample_blit_scaled: Add 16x samples support
Signed-off-by: Anuj Phogat --- .../blit-scaled.cpp| 22 +- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/spec/ext_framebuffer_multisample_blit_scaled/blit-scaled.cpp b/tests/spec/ext_framebuffer_multisample_blit_scaled/blit-scaled.cpp index b1c1f1c..91a57b9 100644 --- a/tests/spec/ext_framebuffer_multisample_blit_scaled/blit-scaled.cpp +++ b/tests/spec/ext_framebuffer_multisample_blit_scaled/blit-scaled.cpp @@ -132,7 +132,11 @@ compile_shader(GLenum target) const char*sample_number, *sample_map = ""; float x_scale, y_scale; - x_scale = 2; + if (samples == 16) + x_scale = 4; + else + x_scale = 2; + y_scale = samples / x_scale; /* Below switch is used to setup the shader expression, which computes @@ -166,6 +170,17 @@ compile_shader(GLenum target) * - - * | 6 | 7 | | 7 | 1 | * - - +* +* 16X MSAA sample index layout 16x MSAA sample number layout +* -- +* | 0 | 1 | 2 | 3 ||15 |10 | 9 | 7 | +* -- +* | 4 | 5 | 6 | 7 || 4 | 1 | 3 |13 | +* -- +* | 8 | 9 |10 |11 ||12 | 2 | 0 | 6 | +* -- +* |12 |13 |14 |15 ||11 | 8 | 5 |14 | +* -- */ switch(samples) { case 2: @@ -178,6 +193,11 @@ compile_shader(GLenum target) sample_map = " const int sample_map[8] = int[8](5 , 2, 4, 6, 0, 3, 7, 1);\n"; sample_number = "sample_map[int(2 * fract(coord.x) + 8 * fract(coord.y))]"; break; + case 16: + sample_map = " const int sample_map[16] = int[16](15, 10, 9, 7, 4, 1, 3, 13,\n" +" 12, 2, 0, 6, 11, 8, 5, 14);\n"; + sample_number = "sample_map[int(4 * fract(coord.x) + 16 * fract(coord.y))]"; + break; default: printf("Unsupported sample count %d\n", samples); piglit_report_result(PIGLIT_SKIP); -- 2.5.5 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] Fix the fnctl import on Windows
On Wednesday 01 Jun 2016 à 15:22:12 (-0700), Dylan Baker wrote: > Quoting Olivier Berthier (2016-05-30 03:21:14) > [snip] > > +if sys.platform.startswith('linux'): > > +try: > > +with open(self._monitoring_source, 'r') as f: > > +lines = [] > > +if self._is_locked: > > +# Create a duplicated file descriptor, this avoid > > lock > > +fd = os.dup(f.fileno()) > > +# use I/O control for reading the lines > > +fcntl.fcntl(fd, fcntl.F_SETFL, os.O_NONBLOCK) > > + > > +while True: > > +try: > > +line = os.read(fd, 1024) > > +if not line: > > +break; > > +except OSError as e: > > +if e.errno == errno.EAGAIN: > > +break > > +else: > > +raise e > > +lines.append(line.decode("utf-8", "strict")) > > +os.close(fd) > > I'm very confused here. What exactly is a locked file? Since on Linux at > least you can read a locked file as long as you have the proper > permissions I can't figure out what locking has to do with this code. > With the test you provided if I replace the whole of 'lines = []' > through 'f.close()' with 'lines = f.readlines()' the test passes, so > either the code here is bogus, the test is bogus, or both. > > I think if we need to rely on POSIX-only modules then we need to guard > is_locked behind os.name == 'posix' or similar. > > Dylan > I used this methode instead of readlines() because it works with standard files and with the files like /dev/kmsg. I think it increase the field of view for monitoring. However, if there is another way I can change it. Or if reading these files don't provides any relevant information we can't find in dmesg or in another log, we can juste change to readlines() and remove fnctl. Olivier > > + > > +else: > > +lines = f.read().splitlines() > > + > > +f.close() > > + > > +# Find all new entries, do this by slicing the list of > > +# the lines to only returns elements after the last > > element > > +# stored. If there are not matches a value error is > > raised, > > +# that means all of the lines are new > > +l = 0 > > +for index, item in enumerate(reversed(lines)): > > +if item == self._last_message: > > +# don't include the matched element > > +l = len(lines) - index > > +break > > +self._new_messages = lines[l:] > > +# Attempt to store the last element of lines, > > +# unless there was no line > > +self._last_message = lines[-1] if lines else None > > +except Exception: > > +# if an error occured, we consider there are no new > > messages > > +self._new_messages = [] > > +pass ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit