[Piglit] [PATCH 1/3] primitive-restart-draw-mode: draw front and back faces in different colors

2018-10-29 Thread Marek Olšák
From: Marek Olšák 

so that triangle strip winding reset is visible after primitive restart
---
 tests/general/primitive-restart-draw-mode.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/general/primitive-restart-draw-mode.c 
b/tests/general/primitive-restart-draw-mode.c
index cca89e385..5a1379748 100644
--- a/tests/general/primitive-restart-draw-mode.c
+++ b/tests/general/primitive-restart-draw-mode.c
@@ -126,34 +126,36 @@ static const struct test_desc
 };
 
 static const struct test_desc *test = NULL;
 
 
 static const char vs_text[] =
"#version 110\n"
"attribute vec2 vertex;\n"
"uniform vec2 offset;\n"
"uniform vec2 window_size;\n"
-   "uniform vec4 color;\n"
+   "uniform vec4 color, bcolor;\n"
"void main()\n"
"{\n"
"  gl_Position = vec4((vertex + offset) / window_size * 2.0 - 1.0,\n"
" 0.0, 1.0);\n"
"  gl_FrontColor = color;\n"
+   "  gl_BackColor = bcolor;\n"
"}\n";
 
 
 static GLuint prog;
 static GLint vertex_attr;
 static GLint window_size_loc;
 static GLint offset_loc;
 static GLint color_loc;
+static GLint bcolor_loc;
 
 
 static void
 print_usage_and_exit(const char *prog_name)
 {
int i;
printf("Usage: %s \n"
   "  where  is one of the following:\n", prog_name);
for (i = 0; i < ARRAY_SIZE(tests); i++)
printf("%s\n", tests[i].name);
@@ -188,28 +190,33 @@ piglit_init(int argc, char **argv)
 
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
prog = piglit_link_simple_program(vs, 0);
if (!prog)
piglit_report_result(PIGLIT_FAIL);
glDeleteShader(vs);
vertex_attr = glGetAttribLocation(prog, "vertex");
window_size_loc = glGetUniformLocation(prog, "window_size");
offset_loc = glGetUniformLocation(prog, "offset");
color_loc = glGetUniformLocation(prog, "color");
+   bcolor_loc = glGetUniformLocation(prog, "bcolor");
+
+   glEnable(GL_VERTEX_PROGRAM_TWO_SIDE);
 }
 
 
 static void
 draw_pattern(int restart_pos, bool use_primitive_restart)
 {
-   /* Draw test pattern in blue */
+   /* Draw front faces blue and back faces red. */
glUniform4f(color_loc, 0.25, 0.25, 1.0, 1.0);
+   glUniform4f(bcolor_loc, 0.7, 0.2, 0.2, 1.0);
+
if (use_primitive_restart) {
GLubyte index_buffer[NUM_VERTICES + 1];
int i;
 
for (i = 0; i < restart_pos; i++) {
index_buffer[i] = i;
}
index_buffer[restart_pos] = 0xff;
for (i = restart_pos + 1; i < ARRAY_SIZE(index_buffer); i++) {
index_buffer[i] = i - 1;
-- 
2.17.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/3] drawoverhead: print results in the CSV format

2018-10-29 Thread Marek Olšák
From: Marek Olšák 

for easier data processing.
---
 tests/perf/common.c   | 19 ---
 tests/perf/common.h   |  3 ---
 tests/perf/drawoverhead.c |  8 
 3 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/tests/perf/common.c b/tests/perf/common.c
index e157d82c5..791b7f943 100644
--- a/tests/perf/common.c
+++ b/tests/perf/common.c
@@ -89,29 +89,10 @@ perf_measure_rate(perf_rate_func f)
else
break;
 
prevRate = rate;
}
 
if (0)
printf("%s returning iters %u  rate %f\n", __FUNCTION__, 
subiters, rate);
return rate;
 }
-
-/* Note static buffer, can only use once per printf.
- */
-const char *
-perf_human_float( double d )
-{
-   static char buf[80];
-
-   if (d > 10.0)
-   snprintf(buf, sizeof(buf), "%.2f billion", d / 10.0);
-   else if (d > 100.0)
-   snprintf(buf, sizeof(buf), "%.2f million", d / 100.0);
-   else if (d > 1000.0)
-   snprintf(buf, sizeof(buf), "%.2f thousand", d / 1000.0);
-   else
-   snprintf(buf, sizeof(buf), "%.2f", d);
-
-   return buf;
-}
diff --git a/tests/perf/common.h b/tests/perf/common.h
index daa0d42ab..0da3b7b5f 100644
--- a/tests/perf/common.h
+++ b/tests/perf/common.h
@@ -20,15 +20,12 @@
  */
 
 #ifndef COMMON_H
 #define COMMON_H
 
 typedef void (*perf_rate_func)(unsigned count);
 
 double
 perf_measure_rate(perf_rate_func f);
 
-const char *
-perf_human_float( double d );
-
 #endif /* COMMON_H */
 
diff --git a/tests/perf/drawoverhead.c b/tests/perf/drawoverhead.c
index 2bc04fabf..b30d7d46a 100644
--- a/tests/perf/drawoverhead.c
+++ b/tests/perf/drawoverhead.c
@@ -34,21 +34,20 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
for (int i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-compat")) {
config.supports_gl_compat_version = 10;
config.supports_gl_core_version = 0;
is_compat = true;
break;
}
}
puts(config.supports_gl_core_version ? "Using Core profile." :
   "Using Compatibility profile.");
-   puts("Draw calls per second:");
 
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE |
PIGLIT_GL_VISUAL_DEPTH | 
PIGLIT_GL_VISUAL_STENCIL;
 
 PIGLIT_GL_TEST_CONFIG_END
 
 static GLuint prog[2], uniform_loc, tex[8], ubo[4], tbo[8];
 static bool indexed;
 static GLenum enable_enum;
 
@@ -638,33 +637,33 @@ perf_run(const char *call, unsigned num_vbos, unsigned 
num_ubos,
 unsigned num_textures, unsigned num_tbos, unsigned num_images,
 unsigned num_imgbos,
 const char *change, perf_rate_func f, double base_rate)
 {
static unsigned test_index;
test_index++;
 
double rate = perf_measure_rate(f);
double ratio = base_rate ? rate / base_rate : 1;
 
-   printf(" %3u: %s (%2u VBO, %u UBO, %2u %s) w/ %s change:%*s"
-  COLOR_CYAN "%s" COLOR_RESET " %s(%.1f%%)" COLOR_RESET "\n",
+   printf(" %3u, %s (%2u VBO| %u UBO| %2u %s) w/ %s change,%*s"
+  COLOR_CYAN "%5u" COLOR_RESET ", %s%.1f%%" COLOR_RESET "\n",
   test_index, call, num_vbos, num_ubos,
   num_textures ? num_textures :
 num_tbos ? num_tbos :
 num_images ? num_images : num_imgbos,
   num_textures ? "Tex" :
 num_tbos ? "TBO" :
 num_images ? "Img" :
 num_imgbos ? "ImB" : "   ",
   change,
   MAX2(36 - (int)strlen(change) - (int)strlen(call), 0), "",
-  perf_human_float(rate),
+  (unsigned)(rate / 1000),
   base_rate == 0 ? COLOR_RESET :
ratio > 0.7 ? COLOR_GREEN :
ratio > 0.4 ? COLOR_YELLOW : COLOR_RED,
   100 * ratio);
return rate;
 }
 
 struct enable_state_t {
GLenum enable;
const char *name;
@@ -818,16 +817,17 @@ perf_draw_variant(const char *call, bool is_indexed)
 enable_states[state].name,
 draw_state_change, base_rate);
}
}
 }
 
 /** Called from test harness/main */
 enum piglit_result
 piglit_display(void)
 {
+   puts("   #, Test name  ,
Thousands draws/s, Difference vs the 1st");
perf_draw_variant("DrawElements", true);
perf_draw_variant("DrawArrays", false);
 
exit(0);
return PIGLIT_SKIP;
 }
-- 
2.17.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/3] ext_window_rectangles/render: make the test more thorough

2018-10-29 Thread Marek Olšák
From: Marek Olšák 

---
 tests/spec/ext_window_rectangles/render.c | 93 +++
 1 file changed, 61 insertions(+), 32 deletions(-)

diff --git a/tests/spec/ext_window_rectangles/render.c 
b/tests/spec/ext_window_rectangles/render.c
index 87435b23c..0062399f0 100644
--- a/tests/spec/ext_window_rectangles/render.c
+++ b/tests/spec/ext_window_rectangles/render.c
@@ -26,20 +26,21 @@
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 30;
config.supports_gl_es_version = 30;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
 
 PIGLIT_GL_TEST_CONFIG_END
 
 GLint prog, color;
 GLuint fb;
+static int max_rectangles;
 
 enum piglit_result
 piglit_display(void)
 {
static const float blue[4] = {0, 0, 1, 1};
static const float green[4] = {0, 1, 0, 1};
static const int rect[4 * 8] = {
  0, 0, 1, 1,
  2, 0, 1, 1,
  4, 0, 1, 1,
@@ -50,56 +51,82 @@ piglit_display(void)
  2, 2, 1, 1,
};
 
bool pass = true;
 
glBindFramebuffer(GL_FRAMEBUFFER, fb);
glUseProgram(prog);
 
glViewport(0, 0, 20, 20);
 
-   glClearColor(0, 0, 1, 1);
-   glClear(GL_COLOR_BUFFER_BIT);
-
-   glWindowRectanglesEXT(GL_EXCLUSIVE_EXT, 8, rect);
-   glUniform4fv(color, 1, green);
-   glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
-   for (int i = 0; i < 20; i++) {
-   for (int j = 0; j < 20; j++) {
-   // excluded
-   if ((i == 0 && (j == 0 || j == 2 || j == 4)) ||
-   (i == 1 && (j == 1 || j == 3 || j == 5)) ||
-   (i == 2 && (j == 0 || j == 2)))
-   pass &= piglit_probe_pixel_rgba(j, i, blue);
-   else
-   pass &= piglit_probe_pixel_rgba(j, i, green);
+   for (int num_rectangles = 1; num_rectangles <= max_rectangles; 
num_rectangles++) {
+   glClearColor(0, 0, 1, 1);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glWindowRectanglesEXT(GL_EXCLUSIVE_EXT, num_rectangles, rect);
+   glUniform4fv(color, 1, green);
+   glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+   bool subresult = true;
+
+   for (int y = 0; y < 20; y++) {
+   for (int x = 0; x < 20; x++) {
+   bool excluded = false;
+
+   for (int i = 0; i < num_rectangles; i++) {
+   if (rect[i*4+0] == x &&
+   rect[i*4+1] == y) {
+   excluded = true;
+   break;
+   }
+   }
+   if (excluded)
+   subresult &= piglit_probe_pixel_rgba(x, 
y, blue);
+   else
+   subresult &= piglit_probe_pixel_rgba(x, 
y, green);
+   }
}
+   piglit_report_subtest_result(subresult ? PIGLIT_PASS : 
PIGLIT_FAIL,
+"exclusive, num rectangles = %u", 
num_rectangles);
+   pass &= subresult;
}
 
-   glClearColor(0, 0, 1, 1);
-   glClear(GL_COLOR_BUFFER_BIT);
-
-   glWindowRectanglesEXT(GL_INCLUSIVE_EXT, 8, rect);
-   glUniform4fv(color, 1, green);
-   glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
-   for (int i = 0; i < 20; i++) {
-   for (int j = 0; j < 20; j++) {
-   // included
-   if ((i == 0 && (j == 0 || j == 2 || j == 4)) ||
-   (i == 1 && (j == 1 || j == 3 || j == 5)) ||
-   (i == 2 && (j == 0 || j == 2)))
-   pass &= piglit_probe_pixel_rgba(j, i, green);
-   else
-   pass &= piglit_probe_pixel_rgba(j, i, blue);
+   for (int num_rectangles = 1; num_rectangles <= max_rectangles; 
num_rectangles++) {
+   glClearColor(0, 0, 1, 1);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glWindowRectanglesEXT(GL_INCLUSIVE_EXT, num_rectangles, rect);
+   glUniform4fv(color, 1, green);
+   glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+   bool subresult = true;
+
+   for (int y = 0; y < 20; y++) {
+   for (int x = 0; x < 20; x++) {
+   bool included = false;
+
+   for (int i = 0; i < num_rectangles; i++) {
+   if (rect[i*4+0] == x &&
+   rect[i*4+1] == y) {
+   included = true;
+ 

Re: [Piglit] [PATCH 1/1] tests: enable test case egl-context-priority on all egl platforms

2018-10-29 Thread Tapani Pälli

Reviewed-by: Tapani Pälli 

On 10/29/18 7:01 PM, James Xiong wrote:

From: "Xiong, James" 

Signed-off-by: Xiong, James 
---
  tests/egl/egl-context-priority.c | 7 +--
  1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/tests/egl/egl-context-priority.c b/tests/egl/egl-context-priority.c
index 9590cca..4b75661 100644
--- a/tests/egl/egl-context-priority.c
+++ b/tests/egl/egl-context-priority.c
@@ -94,12 +94,7 @@ piglit_init(int argc, char **argv)
EGL_CONTEXT_PRIORITY_LOW_IMG
};
  
-	/* Require EGL_MESA_platform_surfaceless extension. */

-   const char *exts = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
-   if (!strstr(exts, "EGL_MESA_platform_surfaceless"))
-   piglit_report_result(PIGLIT_SKIP);
-
-   dpy = piglit_egl_get_default_display(EGL_PLATFORM_SURFACELESS_MESA);
+   dpy = piglit_egl_get_default_display(EGL_NONE);
  
  	ok = eglInitialize(dpy, &major, &minor);

if (!ok) {


___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 5/7] egl-context-preemption: Add a subtest to reuse the same display.

2018-10-29 Thread Rafael Antognolli
Add a subtest that reuses the same EGLDisplay used in the main thread.
This is just another case we can test and see if there's a difference in
the preemption behavior.
---
 tests/egl/egl-context-preemption.c | 29 +
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/tests/egl/egl-context-preemption.c 
b/tests/egl/egl-context-preemption.c
index e9180d4ee..3781f2fcf 100644
--- a/tests/egl/egl-context-preemption.c
+++ b/tests/egl/egl-context-preemption.c
@@ -51,6 +51,7 @@ struct test_data {
int nruns;
EGLDisplay dpy;
EGLContext ctx;
+   const struct test_profile *p;
 };
 
 struct test_profile {
@@ -58,6 +59,7 @@ struct test_profile {
size_t bufsize;
GLenum draw_mode;
GLuint (*shader_setup)(void);
+   bool same_display;
 };
 
 static bool small = false;
@@ -300,8 +302,9 @@ setup_thread_context(struct test_data *d)
bool ok = false;
EGLContext ctx2 = EGL_NO_CONTEXT;
 
-   EGLDisplay dpy;
-   if (init_other_display(&dpy) == PIGLIT_SKIP) {
+   EGLDisplay dpy = d->dpy;
+   if (!d->p->same_display &&
+   init_other_display(&dpy) == PIGLIT_SKIP) {
piglit_loge("failed to get display\n");
result = PIGLIT_FAIL;
return result;
@@ -351,7 +354,9 @@ setup_thread_context(struct test_data *d)
 cleanup:
if (ctx2 != EGL_NO_CONTEXT)
eglDestroyContext(dpy, ctx2);
-   eglTerminate(dpy);
+
+   if (!d->p->same_display)
+   eglTerminate(dpy);
 
return result;
 }
@@ -438,7 +443,8 @@ thread2_create_high_priority_context(void *data)
 
if (d->ctx != EGL_NO_CONTEXT)
eglDestroyContext(d->dpy, d->ctx);
-   eglTerminate(d->dpy);
+   if (!d->p->same_display)
+   eglTerminate(d->dpy);
 
return result;
 }
@@ -479,6 +485,7 @@ test_preemption(void *data)
struct test_data d = {
.main_finished = false,
.nruns = 0,
+   .p = profile,
};
d.dpy = eglGetCurrentDisplay();
 
@@ -626,6 +633,14 @@ static struct test_profile trifan = {
.shader_setup = setup_shaders,
 };
 
+static struct test_profile triangles_same_display = {
+   .vertices = triangle_vertices,
+   .bufsize = sizeof(triangle_vertices),
+   .draw_mode = GL_TRIANGLES,
+   .shader_setup = setup_shaders,
+   .same_display = true,
+};
+
 static const struct piglit_subtest subtests[] = {
{
"triangles",
@@ -639,6 +654,12 @@ static const struct piglit_subtest subtests[] = {
test_preemption,
&trifan,
},
+   {
+   "triangles_same_display",
+   "same_display",
+   test_preemption,
+   &triangles_same_display,
+   },
{0},
 };
 
-- 
2.19.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 2/7] egl-context-preemption: Add check for high priority contexts.

2018-10-29 Thread Rafael Antognolli
Check if we can create high priority contexts, otherwise just fail the
test immediately. There's no reason to test for preemption if we can't
create high priority contexts.

v2: Require configless context (Tapani)
---
 tests/egl/egl-context-preemption.c | 58 ++
 1 file changed, 58 insertions(+)

diff --git a/tests/egl/egl-context-preemption.c 
b/tests/egl/egl-context-preemption.c
index 82a698aa1..5265bccc4 100644
--- a/tests/egl/egl-context-preemption.c
+++ b/tests/egl/egl-context-preemption.c
@@ -58,6 +58,40 @@ struct test_profile {
 static bool small = false;
 static int total_objects = 0;
 
+static EGLint
+check_priority(EGLDisplay dpy, EGLContext ctx, EGLint *expected)
+{
+   EGLint value;
+   EGLBoolean status =
+   eglQueryContext(dpy, ctx, EGL_CONTEXT_PRIORITY_LEVEL_IMG, 
&value);
+
+   if (status == EGL_FALSE) {
+   piglit_loge("eglQueryContext failed\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   if (expected && value != *expected) {
+   piglit_loge("%s fail: priority value 0x%x, expected 0x%x\n",
+   __func__, value, *expected);
+   piglit_loge("Can't create high priority context.\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   return value;
+}
+
+static EGLContext
+create_context(EGLDisplay dpy, EGLint *attr)
+{
+   EGLContext ctx =
+   eglCreateContext(dpy, EGL_NO_CONFIG_MESA, EGL_NO_CONTEXT, attr);
+
+   if (ctx == EGL_NO_CONTEXT) {
+   piglit_loge("could not create EGL context, attr 0x%x\n", 
attr[1]);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   return ctx;
+}
+
 static const char *vs_text =
"#version 330 core\n"
"layout (location = 0) in vec3 aPos;\n"
@@ -304,6 +338,27 @@ piglit_display(void)
return result;
 }
 
+static void
+check_high_context_priority_creation(EGLDisplay dpy)
+{
+   EGLint attr[] = {
+   EGL_CONTEXT_PRIORITY_LEVEL_IMG,
+   EGL_CONTEXT_PRIORITY_HIGH_IMG,
+   EGL_NONE
+   };
+   EGLContext ctx = create_context(dpy, attr);
+   if (ctx == EGL_NO_CONTEXT) {
+   piglit_loge("failed to create context");
+   piglit_check_egl_error(EGL_SUCCESS);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   EGLint expected = EGL_CONTEXT_PRIORITY_HIGH_IMG;
+   check_priority(dpy, ctx, &expected);
+
+   eglDestroyContext(dpy, ctx);
+}
+
 void
 piglit_init(int argc, char **argv)
 {
@@ -311,6 +366,9 @@ piglit_init(int argc, char **argv)
 
dpy = eglGetCurrentDisplay();
piglit_require_egl_extension(dpy, "EGL_IMG_context_priority");
+   piglit_require_egl_extension(dpy, "EGL_MESA_configless_context");
+
+   check_high_context_priority_creation(dpy);
 
if (piglit_strip_arg(&argc, argv, "small"))
small = true;
-- 
2.19.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 6/7] egl-context-preemption: Check that the rendering was correct.

2018-10-29 Thread Rafael Antognolli
Verify that the rendering done by the high priority thread was also
correct by rendering a reference image at the beginning.
---
 tests/egl/egl-context-preemption.c | 75 +-
 1 file changed, 73 insertions(+), 2 deletions(-)

diff --git a/tests/egl/egl-context-preemption.c 
b/tests/egl/egl-context-preemption.c
index 3781f2fcf..64e11e48d 100644
--- a/tests/egl/egl-context-preemption.c
+++ b/tests/egl/egl-context-preemption.c
@@ -52,6 +52,7 @@ struct test_data {
EGLDisplay dpy;
EGLContext ctx;
const struct test_profile *p;
+   float *ref_image;
 };
 
 struct test_profile {
@@ -441,6 +442,16 @@ thread2_create_high_priority_context(void *data)
draw_high_priority(d, program, i);
}
 
+   /* check that the rendering was correct */
+   bool pass = true;
+   for (int i = 0; i < d->nruns; i++) {
+   glBindFramebuffer(GL_READ_FRAMEBUFFER, fbos[i]);
+   pass = pass && piglit_probe_image_rgba(0, 0, hp_width, 
hp_height,
+  d->ref_image);
+   }
+
+   *result = pass ? PIGLIT_PASS : PIGLIT_FAIL;
+
if (d->ctx != EGL_NO_CONTEXT)
eglDestroyContext(d->dpy, d->ctx);
if (!d->p->same_display)
@@ -477,6 +488,39 @@ read_pixels_float(GLint x, GLint y, GLsizei width, GLsizei 
height,
return pixels;
 }
 
+static void*
+thread_create_ref_image(void *data)
+{
+   enum piglit_result *result = malloc(sizeof(*result));
+   struct test_data *d = data;
+
+   *result = setup_thread_context(d);
+   if (*result != PIGLIT_PASS)
+   return result;
+
+   GLuint fbo;
+   GLuint texColorBuffer;
+   setup_render_target(&fbo, &texColorBuffer, 1, hp_width, hp_height);
+
+   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+   unsigned int program = setup_shaders();
+
+   draw_objects(program, GL_TRIANGLES, triangle_vertices,
+sizeof(triangle_vertices), 1);
+   glFinish();
+
+   d->ref_image = read_pixels_float(0, 0, hp_width, hp_height,
+GL_RGBA, NULL);
+
+   if (d->ctx != EGL_NO_CONTEXT)
+   eglDestroyContext(d->dpy, d->ctx);
+   if (!d->p->same_display)
+   eglTerminate(d->dpy);
+
+   return result;
+}
+
 static enum piglit_result
 test_preemption(void *data)
 {
@@ -489,6 +533,29 @@ test_preemption(void *data)
};
d.dpy = eglGetCurrentDisplay();
 
+   pthread_t thread1;
+   int err = pthread_create(
+   &thread1, NULL,
+   thread_create_ref_image,
+   &d);
+   if (err) {
+   piglit_loge("failed to create ref image thread");
+   result = PIGLIT_FAIL;
+   goto cleanup;
+   }
+
+   void *retval = NULL;
+   err = pthread_join(thread1, &retval);
+   if (err) {
+   piglit_loge("failed to join thread %"PRIuMAX, (uintmax_t) 
thread1);
+   result = PIGLIT_FAIL;
+   goto cleanup;
+   }
+
+   result = *((enum piglit_result *)retval);
+   if (result != PIGLIT_PASS)
+   goto cleanup;
+
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
@@ -526,7 +593,7 @@ test_preemption(void *data)
 
/* Start second thread with high priority */
pthread_t thread2;
-   int err = pthread_create(
+   err = pthread_create(
&thread2, NULL,
thread2_create_high_priority_context,
&d);
@@ -552,12 +619,16 @@ test_preemption(void *data)
 
glBindFramebuffer(GL_FRAMEBUFFER, 0);
 
-   err = pthread_join(thread2, NULL);
+   err = pthread_join(thread2, &retval);
if (err) {
piglit_loge("failed to join thread %"PRIuMAX, (uintmax_t) 
thread2);
result = PIGLIT_FAIL;
goto cleanup;
}
+   result = *((enum piglit_result *)retval);
+   if (result != PIGLIT_PASS)
+   goto cleanup;
+
 
/* In this loop we are only looking for the first high priority render
 * that started after the main workload. In theory the first one should
-- 
2.19.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 1/7] tests: Add base test for mid-command preemption.

2018-10-29 Thread Rafael Antognolli
This is the base of the test, where we use the main piglit context to
render to the framebuffer. It is supposed to be an artificially slow
draw call, that can be preempted by a higher priority context if needed.
---
 tests/egl/CMakeLists.gl.txt|   2 +
 tests/egl/egl-context-preemption.c | 319 +
 2 files changed, 321 insertions(+)
 create mode 100644 tests/egl/egl-context-preemption.c

diff --git a/tests/egl/CMakeLists.gl.txt b/tests/egl/CMakeLists.gl.txt
index 3691c56a9..6de166044 100644
--- a/tests/egl/CMakeLists.gl.txt
+++ b/tests/egl/CMakeLists.gl.txt
@@ -35,6 +35,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(egl-invalid-attr pthread)
piglit_add_executable (egl-context-priority egl-context-priority.c)
target_link_libraries(egl-context-priority pthread)
+   piglit_add_executable (egl-context-preemption egl-context-preemption.c)
+   target_link_libraries(egl-context-preemption pthread)
 ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 
 # vim: ft=cmake:
diff --git a/tests/egl/egl-context-preemption.c 
b/tests/egl/egl-context-preemption.c
new file mode 100644
index 0..82a698aa1
--- /dev/null
+++ b/tests/egl/egl-context-preemption.c
@@ -0,0 +1,319 @@
+/*
+ * 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "piglit-util-egl.h"
+#include "piglit-util-gl.h"
+
+#include 
+
+#include 
+
+/**
+ * @file egl-context-preemption.c
+ *
+ * EGL API tests for IMG_context_priority extension:
+ * 
https://www.khronos.org/registry/EGL/extensions/IMG/EGL_IMG_context_priority.txt
+ *
+ * This file tries to test mid-command preemption (between triangles) support
+ * through the IMG_context_priority extension.  Particularly on i965, if a
+ * context is marked with high priority level, then it should preempt lower
+ * priority contexts (when the hardware and kernel supports it).
+ */
+
+#define HIGH_PRIO_RUNS 50
+
+struct test_data {
+   bool main_finished;
+   int64_t main_tstarted, main_tfinished;
+   EGLDisplay dpy;
+};
+
+struct test_profile {
+   GLfloat *vertices;
+   size_t bufsize;
+   GLenum draw_mode;
+   GLuint (*shader_setup)(void);
+};
+
+static bool small = false;
+static int total_objects = 0;
+
+static const char *vs_text =
+   "#version 330 core\n"
+   "layout (location = 0) in vec3 aPos;\n"
+   "uniform int nInstances;\n"
+   "out vec4 color;\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "int i = gl_InstanceID;\n"
+   "float integer;\n"
+   "float r = 0.0 + (1.0 / nInstances) * i;\n"
+   "modf(r, integer);\n"
+   "r -= integer;\n"
+   "float g = 0.333 + (1.0 / nInstances) * i;\n"
+   "modf(g, integer);\n"
+   "g -= integer;\n"
+   "float b = 0.666 + (1.0 / nInstances) * i;\n"
+   "modf(b, integer);\n"
+   "b -= integer;\n"
+   "color = vec4(r, g, b, 0.8);\n"
+   "float invertz = mod(i, 2) * 2 - 1.0;\n"
+   "\n"
+   "float width = 2.0;\n"
+   "float dx = (2.0 / nInstances) * i - 1;\n"
+   "gl_Position = vec4(aPos.x + dx, aPos.y, i / nInstances, 1.0);\n"
+   "}\n";
+
+
+static const char *fs_text =
+   "#version 330 core\n"
+   "in vec4 color;\n"
+   "out vec4 FragColor;\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "FragColor = color;\n"
+   "}\n";
+
+static GLuint setup_shaders(void)
+{
+   GLuint prog = piglit_build_simple_program(vs_text, fs_text);
+
+   glUseProgram(prog);
+
+   return prog;
+}
+
+#define MAX_OBJECTS 100
+
+static GLfloat triangle_vertices[] = {
+   -1.0f, -1.0f, 0.0f,
+   0.0f, 1.0f, 0.0f,
+   1.0f, -1.0f, 0.0f,
+};
+
+/* 3 vertices for the first triangle, plus 1 more fore each triangle (4
+ * triangles in total)
+ */
+static GLfloat tr

[Piglit] [PATCH v2 4/7] egl-context-preemption: check that preemption actually happened.

2018-10-29 Thread Rafael Antognolli
After both the main and the high priority threads have finished, check
their render timestamps to try to figure out if preemption has kicked
in.
---
 tests/egl/egl-context-preemption.c | 88 ++
 1 file changed, 88 insertions(+)

diff --git a/tests/egl/egl-context-preemption.c 
b/tests/egl/egl-context-preemption.c
index 8f0245e49..e9180d4ee 100644
--- a/tests/egl/egl-context-preemption.c
+++ b/tests/egl/egl-context-preemption.c
@@ -263,6 +263,36 @@ init_other_display(EGLDisplay *out_other_dpy)
return result;
 }
 
+/* Return the time difference between t1 and t2, taking into account wrapping
+ * around 'nbits'.
+ *
+ * Note: this function only works if the time difference is up to
+ * 1 << (nbits - 1).
+ */
+static int64_t
+time_diff(int64_t t1, int64_t t2, int nbits)
+{
+   const int64_t max_delta = 1ULL << (nbits - 1);
+   const int64_t bitmask = (1ULL << nbits) - 1;
+   const int64_t diff = t1 - t2;
+   const bool wrapped = llabs(t1 - t2) > max_delta;
+
+   /* First find out which one came first
+*  diff < 0 -- if t1 < t2
+*  diff == 0  -- if t1 == t2
+*  diff > 0 -- if t1 > t2
+*/
+   const int64_t diff_wrap = wrapped ? -diff : diff;
+
+   /* Then calculate the difference between them, taking overflow into
+* account
+*/
+   if (diff_wrap > 0)
+   return (t1 - t2) & bitmask;
+   else
+   return -((t2 - t1) & bitmask);
+}
+
 static enum piglit_result
 setup_thread_context(struct test_data *d)
 {
@@ -510,6 +540,9 @@ test_preemption(void *data)
goto cleanup;
}
 
+   GLint nbits;
+   glGetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, &nbits);
+
glBindFramebuffer(GL_FRAMEBUFFER, 0);
 
err = pthread_join(thread2, NULL);
@@ -519,6 +552,61 @@ test_preemption(void *data)
goto cleanup;
}
 
+   /* In this loop we are only looking for the first high priority render
+* that started after the main workload. In theory the first one should
+* already start after the main, but we run this loop just to confirm
+* that assumption.
+*/
+   int first_run = -1;
+   for (int i = 0; i < d.nruns; i++) {
+   if (time_diff(d.tstarted[i], d.main_tstarted, nbits) > 0) {
+   first_run = i;
+   break;
+   }
+   }
+
+   if (first_run < 0) {
+   piglit_loge("Something went wrong, all high priority workloads"
+   " started before the main workload.");
+   result = PIGLIT_FAIL;
+   goto cleanup;
+   }
+
+   /* If mid-command preemption is enabled, the first workload to start
+* after the main workload should finish first.
+*/
+   if (time_diff(d.tfinished[first_run], d.main_tfinished, nbits) >= 0) {
+   piglit_loge("First preemption failed.");
+   result = PIGLIT_FAIL;
+   goto cleanup;
+   }
+
+   int second_run = first_run + 1;
+   if (second_run >= d.nruns) {
+   piglit_loge("The first run to start after the main draw was"
+   " also the last one, so we can't check the second"
+   " run time.");
+   piglit_loge("First run: %d, second run: %d, nruns: %d",
+   first_run, second_run, d.nruns);
+   result = PIGLIT_WARN;
+   }
+
+   /* On i965, it looks like even if mid-command preemption is not
+* supported/enabled, it might report that the first high priority
+* render finished before the main render. So we check the timing of
+* the second high priority render too, which should also finish
+* earlier than the main render, if mid-command preemption is enabled.
+*/
+   if (time_diff(d.tfinished[second_run], d.main_tfinished, nbits) >= 0) {
+   piglit_loge("Second preemption failed.");
+   result = PIGLIT_FAIL;
+   goto cleanup;
+   }
+
+   /* TODO: Calculate the time to run each of the high priority workloads,
+* and print the average latency.
+*/
+
 cleanup:
free(ref_image);
return result;
-- 
2.19.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 7/7] tests: Add preemption test to the opengl profile.

2018-10-29 Thread Rafael Antognolli
---
 tests/opengl.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/opengl.py b/tests/opengl.py
index 54cfd04d5..9de15af13 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4455,6 +4455,8 @@ with profile.test_list.group_manager(
   run_concurrent=False)
 g(['egl-invalid-attr'])
 g(['egl-context-priority'])
+g(['egl-context-preemption'], run_concurrent=False)
+g(['egl-context-preemption', 'small'], run_concurrent=False)
 g(['egl-blob-cache'])
 g(['egl-copy-buffers'])
 
-- 
2.19.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 3/7] egl-context-preemption: Add a high priority thread/context.

2018-10-29 Thread Rafael Antognolli
Start a new thread right after dispatching the render commands from the
main thread, after glFlush().

This second thread creates a high priority EGL context, and uses it to
render to a frame buffer multiple times. These draw calls are supposed
to finish before the one in the main thread.

v2:
 - skip on high priority failure (Ken)
 - remove useless check (Tapani)
---
 tests/egl/egl-context-preemption.c | 242 -
 1 file changed, 239 insertions(+), 3 deletions(-)

diff --git a/tests/egl/egl-context-preemption.c 
b/tests/egl/egl-context-preemption.c
index 5265bccc4..8f0245e49 100644
--- a/tests/egl/egl-context-preemption.c
+++ b/tests/egl/egl-context-preemption.c
@@ -41,11 +41,16 @@
  */
 
 #define HIGH_PRIO_RUNS 50
+static const int hp_width = 80, hp_height = 80;
 
 struct test_data {
bool main_finished;
int64_t main_tstarted, main_tfinished;
+   int64_t tstarted[HIGH_PRIO_RUNS];
+   int64_t tfinished[HIGH_PRIO_RUNS];
+   int nruns;
EGLDisplay dpy;
+   EGLContext ctx;
 };
 
 struct test_profile {
@@ -71,10 +76,10 @@ check_priority(EGLDisplay dpy, EGLContext ctx, EGLint 
*expected)
}
 
if (expected && value != *expected) {
-   piglit_loge("%s fail: priority value 0x%x, expected 0x%x\n",
+   piglit_logd("%s fail: priority value 0x%x, expected 0x%x\n",
__func__, value, *expected);
-   piglit_loge("Can't create high priority context.\n");
-   piglit_report_result(PIGLIT_FAIL);
+   piglit_logd("Can't create high priority context.\n");
+   piglit_report_result(PIGLIT_SKIP);
}
return value;
 }
@@ -197,6 +202,217 @@ draw_objects(unsigned int shader_program, GLenum mode, 
GLfloat *vertices,
glDisableVertexAttribArray(0);
 }
 
+static enum piglit_result
+init_display(EGLenum platform, EGLDisplay *out_dpy)
+{
+   enum piglit_result result = PIGLIT_PASS;
+   EGLDisplay dpy;
+   EGLint egl_major, egl_minor;
+   bool ok;
+
+   dpy = piglit_egl_get_default_display(platform);
+   if (!dpy) {
+   result = PIGLIT_SKIP;
+   goto error;
+   }
+
+   ok = eglInitialize(dpy, &egl_major, &egl_minor);
+   if (!ok) {
+   result = PIGLIT_SKIP;
+   goto error;
+   }
+
+   *out_dpy = dpy;
+   return result;
+
+error:
+   if (dpy) {
+   eglTerminate(dpy);
+   }
+   return result;
+}
+
+static enum piglit_result
+init_other_display(EGLDisplay *out_other_dpy)
+{
+   enum piglit_result result = PIGLIT_SKIP;
+   EGLDisplay other_dpy = 0;
+   int i;
+
+   static const EGLint platforms[] = {
+   EGL_PLATFORM_GBM_MESA,
+   EGL_PLATFORM_SURFACELESS_MESA,
+   EGL_PLATFORM_X11_EXT,
+   EGL_PLATFORM_WAYLAND_EXT,
+   0,
+   };
+
+   for (i = 0; platforms[i] != 0; ++i) {
+   result = init_display(platforms[i], &other_dpy);
+   switch (result) {
+   case PIGLIT_SKIP:
+   break;
+   case PIGLIT_PASS:
+   *out_other_dpy = other_dpy;
+   return PIGLIT_PASS;
+   default:
+   break;
+   }
+   }
+
+   return result;
+}
+
+static enum piglit_result
+setup_thread_context(struct test_data *d)
+{
+   enum piglit_result result = PIGLIT_PASS;
+   bool ok = false;
+   EGLContext ctx2 = EGL_NO_CONTEXT;
+
+   EGLDisplay dpy;
+   if (init_other_display(&dpy) == PIGLIT_SKIP) {
+   piglit_loge("failed to get display\n");
+   result = PIGLIT_FAIL;
+   return result;
+   }
+
+   eglBindAPI(EGL_OPENGL_API);
+   if (!piglit_check_egl_error(EGL_SUCCESS)) {
+   piglit_loge("failed to set OpenGL API.\n");
+   result = PIGLIT_FAIL;
+   return result;
+   }
+
+   EGLint attr[] = {
+   EGL_CONTEXT_CLIENT_VERSION, 3,
+   EGL_CONTEXT_MINOR_VERSION_KHR, 3,
+   EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
+   EGL_NONE };
+   ctx2 = eglCreateContext(dpy, EGL_NO_CONFIG_MESA, EGL_NO_CONTEXT, attr);
+   if (ctx2 == EGL_NO_CONTEXT) {
+   piglit_loge("failed to create context");
+   piglit_check_egl_error(EGL_SUCCESS);
+   result = PIGLIT_FAIL;
+   goto cleanup;
+   }
+
+   ok = eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, ctx2);
+   if (!ok) {
+   piglit_loge("failed to make context current without surface");
+   result = PIGLIT_FAIL;
+   goto cleanup;
+   }
+
+   GLuint VertexArrayID;
+   glGenVertexArrays(1, &VertexArrayID);
+   glBindVertexArray(VertexArrayID);
+
+   glEnable(GL_BLEND);
+   glBlendFunc(GL_SRC_ALPHA, GL_O

[Piglit] [PATCH v2 0/8] Preemption test.

2018-10-29 Thread Rafael Antognolli
Updated version with changes requested by Tapani and Ken included (the
test won't fail if we can't create a high priority context, in case we
lack the right permissions.

This series is also available here:

https://gitlab.freedesktop.org/rantogno/piglit/commits/review/context_preemption_v2

Rafael Antognolli (7):
  tests: Add base test for mid-command preemption.
  egl-context-preemption: Add check for high priority contexts.
  egl-context-preemption: Add a high priority thread/context.
  egl-context-preemption: check that preemption actually happened.
  egl-context-preemption: Add a subtest to reuse the same display.
  egl-context-preemption: Check that the rendering was correct.
  tests: Add preemption test to the opengl profile.

 tests/egl/CMakeLists.gl.txt|   2 +
 tests/egl/egl-context-preemption.c | 793 +
 tests/opengl.py|   2 +
 3 files changed, 797 insertions(+)
 create mode 100644 tests/egl/egl-context-preemption.c

-- 
2.19.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/1] tests: enable test case egl-context-priority on all egl platforms

2018-10-29 Thread James Xiong
From: "Xiong, James" 

Signed-off-by: Xiong, James 
---
 tests/egl/egl-context-priority.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/tests/egl/egl-context-priority.c b/tests/egl/egl-context-priority.c
index 9590cca..4b75661 100644
--- a/tests/egl/egl-context-priority.c
+++ b/tests/egl/egl-context-priority.c
@@ -94,12 +94,7 @@ piglit_init(int argc, char **argv)
EGL_CONTEXT_PRIORITY_LOW_IMG
};
 
-   /* Require EGL_MESA_platform_surfaceless extension. */
-   const char *exts = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
-   if (!strstr(exts, "EGL_MESA_platform_surfaceless"))
-   piglit_report_result(PIGLIT_SKIP);
-
-   dpy = piglit_egl_get_default_display(EGL_PLATFORM_SURFACELESS_MESA);
+   dpy = piglit_egl_get_default_display(EGL_NONE);
 
ok = eglInitialize(dpy, &major, &minor);
if (!ok) {
-- 
2.7.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2 1/6] texturing: make sure s3tc tests require GL 1.1

2018-10-29 Thread Erik Faye-Lund
On Fri, 2018-10-26 at 17:36 +0100, Emil Velikov wrote:
> On Fri, 26 Oct 2018 at 16:39, Erik Faye-Lund
>  wrote:
> > 
> > On Fri, 2018-10-26 at 16:21 +0100, Emil Velikov wrote:
> > > On Fri, 26 Oct 2018 at 14:03, Erik Faye-Lund
> > >  wrote:
> > > > 
> > > > The EXT_texture_compression_s3tc spec lists that it requires
> > > > OpenGL 1.1, not 1.0 like some of these list.
> > > > 
> > > > In reality, this probably doesn't make a huge difference, as
> > > > OpenGL 1.0 hardware/drivers are pretty much extinct, but let's
> > > > just get it right to avoid confusion.
> > > > 
> > > > Signed-off-by: Erik Faye-Lund 
> > > > ---
> > > >  tests/texturing/s3tc-errors.c  | 2 +-
> > > >  tests/texturing/s3tc-teximage.c| 2 +-
> > > >  tests/texturing/s3tc-texsubimage.c | 2 +-
> > > >  3 files changed, 3 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/tests/texturing/s3tc-errors.c
> > > > b/tests/texturing/s3tc-
> > > > errors.c
> > > > index 81fee3e21..ccedf8a22 100644
> > > > --- a/tests/texturing/s3tc-errors.c
> > > > +++ b/tests/texturing/s3tc-errors.c
> > > > @@ -36,7 +36,7 @@
> > > > 
> > > >  PIGLIT_GL_TEST_CONFIG_BEGIN
> > > > 
> > > > -config.supports_gl_compat_version = 10;
> > > > +config.supports_gl_compat_version = 11;
> > > > 
> > > 
> > > Ages ago Ilia reported on IRC that some tests (was it 10 or 11,
> > > don't
> > > recall) failing on the classic swrast and/or nouveau_vieux.
> > > That waffle issue should be fixed, although if he can give this
> > > patch
> > > a try (with platform glx) that'll be appreciated ...
> > > 
> > > Gut feeling suggests that the fix may not have been enough.
> > 
> > I don't think I understand the issue... Some of these tests use 10
> > and
> > some use 11 here, and 11 is the correct value (according to the
> > spec).
> > I'm just making it consistent...
> > 
> > This is just a filter under what contexts these tests will run, no?
> > I
> > haven't seen an OpenGL 1.0-only implementation, well, ever I think?
> > Isn't this just theoretical anyway? I don't understand how this
> > could
> > have any practical effect...
> > 
> 
> It's been ~3 years so, my memory and amount of details is flaky.
> 
> A while ago Ilia and Brian Paul reported that some tests annotated as
> 10 (or was it 11)  were failing on nouveau_vieux and classic swrast
> respectively.
> That was because piglit was passing the explicit version to waffle,
> which in turn was using the GLX_ARB_create_context since it's the
> only
> way to request a specific version.
> 
> That should be addressed with the following waffle commit [1],
> although I'm concerned about the 10 check in the patch.
> Sadly I did not document why in the commit log (nor was it asked
> during review), perhaps it has something to do with the massive
> comment in waffle's glx_context.c [2].
> 
> That said, if your patch causes problems I could double-check and fix
> waffle.
> Since I've annoyed Ilia enough times, I wanted to spare another
> instance - hence the suggestion.

Right. I gave it a go on classic swrast, and these tests are skipped
there due to lacking GL_EXT_texture_compression_s3tc. I don't have a
Nouveau system to test on.

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] glsl-1.30: update linker test for inter stage in/out vars usage

2018-10-29 Thread Vadym Shovkoplias
Adding additional in/out variable exposes new GLSL linker bug.
The test fails with the following error message:

Failed to link:
error: fragment shader input `bar' has no matching output
   in the previous stage

Signed-off-by: Vadym Shovkoplias 
---
 .../linker/interstage-multiple-vertex-objects.shader_test| 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test 
b/tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test
index dd168d434..39838b1f2 100644
--- a/tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test
+++ b/tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test
@@ -8,8 +8,10 @@ GLSL >= 1.30
 
 [vertex shader]
 out vec4 foo;
+out vec4 bar;
 void unused()
 {
+bar=vec4(0);
 foo=vec4(1);
 }
 
@@ -22,11 +24,12 @@ void main()
 
 [fragment shader]
 in vec4 foo;
+in vec4 bar;
 out vec4 color;
 
 void main()
 {
-gl_FragColor=foo;
+gl_FragColor=foo*bar;
 }
 
 [test]
-- 
2.19.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit