Re: [Piglit] [PATCH v1] piglit/vbo: memory leak

2018-10-11 Thread Ian Romanick
Reviewed-by: Ian Romanick 

On 10/11/2018 05:59 AM, Sergii Romantsov wrote:
> Trivial fix of memory leaking for test 'initialized-vbo'.
> 
> Fixes: 6a467e00cfae (security/initialized-vbo: test contents of uninitialized 
> VBOs)
> CC: Brian Paul 
> Signed-off-by: Sergii Romantsov 
> ---
>  tests/security/initialized-vbo.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tests/security/initialized-vbo.c 
> b/tests/security/initialized-vbo.c
> index 20c8155..16656bc 100644
> --- a/tests/security/initialized-vbo.c
> +++ b/tests/security/initialized-vbo.c
> @@ -70,6 +70,7 @@ piglit_display(void)
>  
>   glDeleteBuffers(1, );
>  
> + free(tmp);
>   return pass ? PIGLIT_PASS : PIGLIT_WARN;
>  }
>  
> 

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


Re: [Piglit] [PATCH] builtin_packing: Add swizzles to the sources of packing functions

2018-10-11 Thread Ian Romanick
On 10/11/2018 02:09 PM, Jason Ekstrand wrote:
> commit dd553bc67f8ab1513fd196b6ffb7c4a76723adfd
> Author: Jason Ekstrand  >
> Date:   Wed Oct 3 12:14:20 2018 -0500
> 
>     nir/alu_to_scalar: Use ssa_for_alu_src in hand-rolled expansions
>    
>     The ssa_for_alu_src helper will correctly handle swizzles and other
>     source modifiers for you.  The expansions for unpack_half_2x16,
>     pack_uvec2_to_uint, and pack_uvec4_to_uint were all broken with regards
>     to swizzles.  The brokenness of unpack_half_2x16 was causing rendering
>     errors in Rise of the Tomb Raider on Intel ever since c11833ab24dcba26
>     which added an extra copy propagation to the optimization pipeline and
>     caused us to start seeing swizzles where we hadn't seen any before.
>    
>     Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107926
>     Fixes: 9ce901058f3d "nir: Add lowering of nir_op_unpack_half_2x16."
>     Fixes: 9b8786eba955 "nir: Add lowering support for packing opcodes."
>     Tested-by: Alex Smith  >
>     Tested-by: Józef Kucia  >
>     Reviewed-by: Matt Turner  >

I'll take that as, "Yes." ;)  If you add a reference to the bug in the
commit message (so that nobody comes along later to "optimize" the tests),

Reviewed-by: Ian Romanick 

> On Wed, Oct 10, 2018 at 1:45 PM Ian Romanick  > wrote:
> 
> These changes look good, but I'm wondering why. :)  Did you find some
> bug, or ... ?
> 
> On 10/04/2018 10:42 AM, Jason Ekstrand wrote:
> > ---
> >  .../fs_pack.shader_test.mako                       | 14
> +++---
> >  .../fs_unpack.shader_test.mako                     |  6 +++---
> >  .../vs_pack.shader_test.mako                       | 14
> +++---
> >  .../vs_unpack.shader_test.mako                     |  6 +++---
> >  4 files changed, 28 insertions(+), 12 deletions(-)
> >
> > diff --git
> 
> a/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako
> 
> b/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako
> > index 4c053bf89..86c63061e 100644
> > ---
> 
> a/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako
> > +++
> 
> b/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako
> > @@ -21,7 +21,7 @@ precision highp float;
> >  const vec4 red = vec4(1, 0, 0, 1);
> >  const vec4 green = vec4(0, 1, 0, 1);
> > 
> > -uniform ${func.vector_type} func_input;
> > +uniform vec4 func_input;
> > 
> >  % for i in range(func.num_valid_outputs):
> >  uniform ${func.result_precision} uint expect${i};
> > @@ -31,7 +31,11 @@ out vec4 frag_color;
> > 
> >  void main()
> >  {
> > -    ${func.result_precision} uint actual = ${func.name
> }(func_input);
> > +% if func.vector_type == 'vec2':
> > +    ${func.result_precision} uint actual = ${func.name
> }(func_input.wx);
> > +% else:
> > +    ${func.result_precision} uint actual = ${func.name
> }(func_input.wxzy);
> > +% endif
> > 
> >      if (false
> >          % for i in range(func.num_valid_outputs):
> > @@ -53,7 +57,11 @@ vertex/float/2
> > 
> >  [test]
> >  % for io in func.inout_seq:
> > -uniform ${func.vector_type} func_input ${" ".join(io.input)}
> > +% if func.vector_type == 'vec2':
> > +uniform vec4 func_input ${io.input[1]} 0.0 0.0 ${io.input[0]}
> > +% else:
> > +uniform vec4 func_input ${io.input[1]} ${io.input[3]}
> ${io.input[2]} ${io.input[0]}
> > +% endif
> >  % for i in range(func.num_valid_outputs):
> >  uniform uint expect${i} ${io.valid_outputs[i]}
> >  % endfor
> > diff --git
> 
> a/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako
> 
> b/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako
> > index ee610bbfb..8e3f12a58 100644
> > ---
> 
> a/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako
> > +++
> 
> b/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako
> > @@ -21,7 +21,7 @@ precision highp float;
> >  const vec4 red = vec4(1, 0, 0, 1);
> >  const vec4 green = vec4(0, 1, 0, 1);
> > 
> > -uniform highp uint func_input;
> > +uniform highp uvec4 func_input;
> > 
> >  uniform bool exact;
> > 
> > @@ -33,7 +33,7 @@ out vec4 frag_color;
> > 
> >  void main()
> >  {
> > -    ${func.result_precision} ${func.vector_type} actual =
> ${func.name }(func_input);
> > +    ${func.result_precision} ${func.vector_type} actual =
> ${func.name }(func_input.y);
> > 
> > 

Re: [Piglit] [PATCH] builtin_packing: Add swizzles to the sources of packing functions

2018-10-11 Thread Jason Ekstrand
commit dd553bc67f8ab1513fd196b6ffb7c4a76723adfd
Author: Jason Ekstrand 
Date:   Wed Oct 3 12:14:20 2018 -0500

nir/alu_to_scalar: Use ssa_for_alu_src in hand-rolled expansions

The ssa_for_alu_src helper will correctly handle swizzles and other
source modifiers for you.  The expansions for unpack_half_2x16,
pack_uvec2_to_uint, and pack_uvec4_to_uint were all broken with regards
to swizzles.  The brokenness of unpack_half_2x16 was causing rendering
errors in Rise of the Tomb Raider on Intel ever since c11833ab24dcba26
which added an extra copy propagation to the optimization pipeline and
caused us to start seeing swizzles where we hadn't seen any before.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107926
Fixes: 9ce901058f3d "nir: Add lowering of nir_op_unpack_half_2x16."
Fixes: 9b8786eba955 "nir: Add lowering support for packing opcodes."
Tested-by: Alex Smith 
Tested-by: Józef Kucia 
Reviewed-by: Matt Turner 


On Wed, Oct 10, 2018 at 1:45 PM Ian Romanick  wrote:

> These changes look good, but I'm wondering why. :)  Did you find some
> bug, or ... ?
>
> On 10/04/2018 10:42 AM, Jason Ekstrand wrote:
> > ---
> >  .../fs_pack.shader_test.mako   | 14 +++---
> >  .../fs_unpack.shader_test.mako |  6 +++---
> >  .../vs_pack.shader_test.mako   | 14 +++---
> >  .../vs_unpack.shader_test.mako |  6 +++---
> >  4 files changed, 28 insertions(+), 12 deletions(-)
> >
> > diff --git
> a/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako
> b/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako
> > index 4c053bf89..86c63061e 100644
> > ---
> a/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako
> > +++
> b/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako
> > @@ -21,7 +21,7 @@ precision highp float;
> >  const vec4 red = vec4(1, 0, 0, 1);
> >  const vec4 green = vec4(0, 1, 0, 1);
> >
> > -uniform ${func.vector_type} func_input;
> > +uniform vec4 func_input;
> >
> >  % for i in range(func.num_valid_outputs):
> >  uniform ${func.result_precision} uint expect${i};
> > @@ -31,7 +31,11 @@ out vec4 frag_color;
> >
> >  void main()
> >  {
> > -${func.result_precision} uint actual = ${func.name}(func_input);
> > +% if func.vector_type == 'vec2':
> > +${func.result_precision} uint actual = ${func.name}(func_input.wx);
> > +% else:
> > +${func.result_precision} uint actual = ${func.name
> }(func_input.wxzy);
> > +% endif
> >
> >  if (false
> >  % for i in range(func.num_valid_outputs):
> > @@ -53,7 +57,11 @@ vertex/float/2
> >
> >  [test]
> >  % for io in func.inout_seq:
> > -uniform ${func.vector_type} func_input ${" ".join(io.input)}
> > +% if func.vector_type == 'vec2':
> > +uniform vec4 func_input ${io.input[1]} 0.0 0.0 ${io.input[0]}
> > +% else:
> > +uniform vec4 func_input ${io.input[1]} ${io.input[3]} ${io.input[2]}
> ${io.input[0]}
> > +% endif
> >  % for i in range(func.num_valid_outputs):
> >  uniform uint expect${i} ${io.valid_outputs[i]}
> >  % endfor
> > diff --git
> a/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako
> b/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako
> > index ee610bbfb..8e3f12a58 100644
> > ---
> a/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako
> > +++
> b/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako
> > @@ -21,7 +21,7 @@ precision highp float;
> >  const vec4 red = vec4(1, 0, 0, 1);
> >  const vec4 green = vec4(0, 1, 0, 1);
> >
> > -uniform highp uint func_input;
> > +uniform highp uvec4 func_input;
> >
> >  uniform bool exact;
> >
> > @@ -33,7 +33,7 @@ out vec4 frag_color;
> >
> >  void main()
> >  {
> > -${func.result_precision} ${func.vector_type} actual = ${func.name
> }(func_input);
> > +${func.result_precision} ${func.vector_type} actual = ${func.name
> }(func_input.y);
> >
> >  if (false
> >  % for i in range(func.num_valid_outputs):
> > @@ -56,7 +56,7 @@ vertex/float/2
> >
> >  [test]
> >  % for io in func.inout_seq:
> > -uniform uint func_input ${io.input}
> > +uniform uvec4 func_input 0 ${io.input} 0 0
> >  % if func.exact:
> >  uniform int exact 1
> >  % else:
> > diff --git
> a/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako
> b/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako
> > index 5f37d7eaf..81c725846 100644
> > ---
> a/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako
> > +++
> b/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako
> > @@ -11,7 +11,7 @@ ${func.requirements}
> >  const vec4 red = vec4(1, 0, 0, 1);
> >  const vec4 green = vec4(0, 1, 0, 1);
> >
> > -uniform ${func.vector_type} func_input;
> > +uniform vec4 func_input;
> >
> >  % 

Re: [Piglit] [PATCH] egl: doesn't allow egl to create a forward-compatible context with req ver < 3

2018-10-11 Thread Matt Turner
Hello,

Thanks for the patch.

I notice that there are a lot of whitespace errors in this patch. I
would fix them myself when I commit, but I have some questions that
might require other changes. They should be pretty apparent.

On Thu, Oct 11, 2018 at 4:35 AM  wrote:
>
> From: Andrii Simiklit 
>
> EGL_KHR_create_context spec says:
>"The default values for EGL_CONTEXT_MAJOR_VERSION_KHR and
> EGL_CONTEXT_MINOR_VERSION_KHR are 1 and 0 respectively."
>
> requesting a forward-compatible context for OpenGL
> versions less than 3.0 will generate an error.
>
>  "* If an OpenGL context is requested and the values for attributes
> EGL_CONTEXT_MAJOR_VERSION_KHR and EGL_CONTEXT_MINOR_VERSION_KHR,
> when considered together with the value for attribute
> EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR, specify an OpenGL
> version and feature set that are not defined, than an
> EGL_BAD_MATCH error is generated.
>
> The defined versions of OpenGL at the time of writing are OpenGL
> 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 2.0, 2.1, 3.0, 3.1, 3.2, 4.0, 4.1,
> 4.2, and 4.3. Feature deprecation was introduced with OpenGL
> 3.0, so forward-compatible contexts may only be requested for
> OpenGL 3.0 and above. Thus, examples of invalid combinations of
> attributes include:
>
>   - Major version < 1 or > 4
>   - Major version == 1 and minor version < 0 or > 5
>   - Major version == 2 and minor version < 0 or > 1
>   - Major version == 3 and minor version < 0 or > 2
>   - Major version == 4 and minor version < 0 or > 3
>   - Forward-compatible flag set and major version < 3
>
> Because the purpose of forward-compatible contexts is to allow
> application development on a specific OpenGL version with the
> knowledge that the app will run on a future version, context
> creation will fail if
> EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR is set and the
> context version returned cannot implement exactly the requested
> version."
>
> Additionally this patch checks and an independence of the attributes order in 
> list.
>
> Signed-off-by: Andrii Simiklit 
> ---
>  .../valid-flag-forward-compatible-gl.c| 70 +++
>  1 file changed, 57 insertions(+), 13 deletions(-)
>
> diff --git 
> a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c 
> b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
> index 42feb54d6..ea00ef595 100644
> --- a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
> +++ b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
> @@ -23,16 +23,30 @@
>  #include "piglit-util-egl.h"
>  #include "common.h"
>
> -int gl_version;
> +int gl_version = 0;
>
> -static bool try_flag(int flag)
> +static bool try_flag(int req_version, int flag)

This function has become strange, both returning a bool and also
calling piglit_report_result(PIGLIT_FAIL).

>  {
> -   const EGLint attribs[] = {
> -   EGL_CONTEXT_FLAGS_KHR, flag,
> -   EGL_NONE
> -   };
> +   bool oresult = true;

What does the 'o' mean here? Why not just call it result?

> +   const unsigned vidx = req_version < 0 ? 0 : (req_version == 0) ? 1 : 
> 2;
> +   const bool is_forward_compatible =
> +   (0 != (flag & 
> EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR));
>
> -   ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs);
> +   const EGLint attribs[][5] = {
> +   /*req_version-before-case*/
> +   { EGL_CONTEXT_MAJOR_VERSION_KHR, abs(req_version),
> + EGL_CONTEXT_FLAGS_KHR, flag,
> + EGL_NONE },
> +   /*no-req_version-case*/
> +   { EGL_CONTEXT_FLAGS_KHR, flag,
> + EGL_NONE },
> +   /*req_version-after-case-*/
> +   { EGL_CONTEXT_FLAGS_KHR, flag,
> + EGL_CONTEXT_MAJOR_VERSION_KHR, abs(req_version),
> + EGL_NONE }
> +   };
> +   assert(vidx < 3);
> +   ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs[vidx]);
> if (ctx != NULL) {
> /* Get GL version in order to know whether we can test
>  * EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR.
> @@ -47,6 +61,18 @@ static bool try_flag(int flag)
>
> gl_version = piglit_get_gl_version();
> }
> +   if (abs(req_version) < 3 && is_forward_compatible) {
> +   /* The EGL_KHR_create_context spec says:
> +*
> +   *   requesting a forward-compatible context for OpenGL
> +  *   versions less than 3.0 will generate an error

Re: [Piglit] [PATCH v2] framework/wflinfo: use x11_egl for gles with mixed_glx_egl

2018-10-11 Thread Dylan Baker
Quoting Emil Velikov (2018-10-11 03:48:20)
> On Fri, 5 Oct 2018 at 17:06, Dylan Baker  wrote:
> >
> > Because wflinfo returns GL legacy (non-profile) for gles on glx.
> >
> > v2: - If the platform is pure GLX then warn that things aren't going to
> >   work.
> > ---
> >  framework/wflinfo.py | 21 +++--
> >  1 file changed, 19 insertions(+), 2 deletions(-)
> >
> > diff --git a/framework/wflinfo.py b/framework/wflinfo.py
> > index a568bc344..1655aa0ee 100644
> > --- a/framework/wflinfo.py
> > +++ b/framework/wflinfo.py
> > @@ -1,4 +1,4 @@
> > -# Copyright (c) 2015-2016 Intel Corporation
> > +# Copyright (c) 2015-2016,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
> > @@ -26,6 +26,7 @@ import os
> >  import subprocess
> >  import sys
> >  import threading
> > +import warnings
> >
> >  import six
> >
> > @@ -103,7 +104,23 @@ class WflInfo(object):
> >  # to something that wflinfo understands.
> >  platform = OPTIONS.env['PIGLIT_PLATFORM']
> >  if platform == "mixed_glx_egl":
> > -platform = "glx"
> > +if 'gles2' in opts or 'gles3'in opts:
> > +platform = "x11_egl"
> > +else:
> > +platform = "glx"
> > +if platform == 'glx' and 'gles2' in opts or 'gles3' in 
> > opts:
> > +# There is a bug in waffle Which causes it to return
> > +# a legacy (non-profile) OpenGL instead of OpenGL ES 
> > when
> > +# using the GLX platform (not for mixed_glx_egl). If 
> > the
> > +# user explicitly asks for GLX then the tests are 
> > going to
> > +# skip whether we fast skip them or if we let them run.
> > +# Since they're going to skip (even if it's wrong), 
> > let's
> > +# skip them quickly.
> > +#
> > +# https://github.com/waffle-gl/waffle/issues/50
> 
> Things seems to be working fine on my system. I've added some nits to
> the issue report, can you please confirm we're thinking about the same
> thing.
> 
> Thanks
> Emil

I've commented on the waffle bug. I'm willing to hold off on this patch until we
can confirm the waffle issue as this doesn't affect us (we use gbm in CI).

Dylan


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


[Piglit] [PATCH v1] piglit/vbo: memory leak

2018-10-11 Thread Sergii Romantsov
Trivial fix of memory leaking for test 'initialized-vbo'.

Fixes: 6a467e00cfae (security/initialized-vbo: test contents of uninitialized 
VBOs)
CC: Brian Paul 
Signed-off-by: Sergii Romantsov 
---
 tests/security/initialized-vbo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/security/initialized-vbo.c b/tests/security/initialized-vbo.c
index 20c8155..16656bc 100644
--- a/tests/security/initialized-vbo.c
+++ b/tests/security/initialized-vbo.c
@@ -70,6 +70,7 @@ piglit_display(void)
 
glDeleteBuffers(1, );
 
+   free(tmp);
return pass ? PIGLIT_PASS : PIGLIT_WARN;
 }
 
-- 
2.7.4

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


[Piglit] [PATCH] egl: doesn't allow egl to create a forward-compatible context with req ver < 3

2018-10-11 Thread asimiklit . work
From: Andrii Simiklit 

EGL_KHR_create_context spec says:
   "The default values for EGL_CONTEXT_MAJOR_VERSION_KHR and
EGL_CONTEXT_MINOR_VERSION_KHR are 1 and 0 respectively."

requesting a forward-compatible context for OpenGL
versions less than 3.0 will generate an error.

 "* If an OpenGL context is requested and the values for attributes
EGL_CONTEXT_MAJOR_VERSION_KHR and EGL_CONTEXT_MINOR_VERSION_KHR,
when considered together with the value for attribute
EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR, specify an OpenGL
version and feature set that are not defined, than an
EGL_BAD_MATCH error is generated.

The defined versions of OpenGL at the time of writing are OpenGL
1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 2.0, 2.1, 3.0, 3.1, 3.2, 4.0, 4.1,
4.2, and 4.3. Feature deprecation was introduced with OpenGL
3.0, so forward-compatible contexts may only be requested for
OpenGL 3.0 and above. Thus, examples of invalid combinations of
attributes include:

  - Major version < 1 or > 4
  - Major version == 1 and minor version < 0 or > 5
  - Major version == 2 and minor version < 0 or > 1
  - Major version == 3 and minor version < 0 or > 2
  - Major version == 4 and minor version < 0 or > 3
  - Forward-compatible flag set and major version < 3

Because the purpose of forward-compatible contexts is to allow
application development on a specific OpenGL version with the
knowledge that the app will run on a future version, context
creation will fail if
EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR is set and the
context version returned cannot implement exactly the requested
version."

Additionally this patch checks and an independence of the attributes order in 
list.

Signed-off-by: Andrii Simiklit 
---
 .../valid-flag-forward-compatible-gl.c| 70 +++
 1 file changed, 57 insertions(+), 13 deletions(-)

diff --git 
a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c 
b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
index 42feb54d6..ea00ef595 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
@@ -23,16 +23,30 @@
 #include "piglit-util-egl.h"
 #include "common.h"
 
-int gl_version;
+int gl_version = 0;
 
-static bool try_flag(int flag)
+static bool try_flag(int req_version, int flag)
 {
-   const EGLint attribs[] = {
-   EGL_CONTEXT_FLAGS_KHR, flag,
-   EGL_NONE
-   };
+   bool oresult = true;
+   const unsigned vidx = req_version < 0 ? 0 : (req_version == 0) ? 1 : 2;
+   const bool is_forward_compatible =
+   (0 != (flag & 
EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR));
 
-   ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs);
+   const EGLint attribs[][5] = {
+   /*req_version-before-case*/
+   { EGL_CONTEXT_MAJOR_VERSION_KHR, abs(req_version),
+ EGL_CONTEXT_FLAGS_KHR, flag,
+ EGL_NONE },
+   /*no-req_version-case*/
+   { EGL_CONTEXT_FLAGS_KHR, flag,
+ EGL_NONE },
+   /*req_version-after-case-*/
+   { EGL_CONTEXT_FLAGS_KHR, flag,
+ EGL_CONTEXT_MAJOR_VERSION_KHR, abs(req_version),
+ EGL_NONE }
+   };
+   assert(vidx < 3);
+   ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs[vidx]);
if (ctx != NULL) {
/* Get GL version in order to know whether we can test
 * EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR.
@@ -47,6 +61,18 @@ static bool try_flag(int flag)
 
gl_version = piglit_get_gl_version();
}
+   if (abs(req_version) < 3 && is_forward_compatible) {
+   /* The EGL_KHR_create_context spec says:
+*
+   *   requesting a forward-compatible context for OpenGL
+  *   versions less than 3.0 will generate an error
+*
+*   The default values for 
EGL_CONTEXT_MAJOR_VERSION_KHR and
+  *   EGL_CONTEXT_MINOR_VERSION_KHR are 1 and 0 respectively.
+   */
+   piglit_report_result(PIGLIT_FAIL);
+   oresult = false;
+   }
eglDestroyContext(egl_dpy, ctx);
} else if (!piglit_check_egl_error(EGL_BAD_MATCH)) {
/* The EGL_KHR_create_context spec says:
@@ -60,12 +86,13 @@ static bool try_flag(int flag)
piglit_report_result(PIGLIT_FAIL);
}
 
-   return true;

Re: [Piglit] [PATCH v2] framework/wflinfo: use x11_egl for gles with mixed_glx_egl

2018-10-11 Thread Eric Engestrom
On Friday, 2018-10-05 09:06:24 -0700, Dylan Baker wrote:
> Because wflinfo returns GL legacy (non-profile) for gles on glx.
> 
> v2: - If the platform is pure GLX then warn that things aren't going to
>   work.
> ---
>  framework/wflinfo.py | 21 +++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/framework/wflinfo.py b/framework/wflinfo.py
> index a568bc344..1655aa0ee 100644
> --- a/framework/wflinfo.py
> +++ b/framework/wflinfo.py
> @@ -1,4 +1,4 @@
> -# Copyright (c) 2015-2016 Intel Corporation
> +# Copyright (c) 2015-2016,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
> @@ -26,6 +26,7 @@ import os
>  import subprocess
>  import sys
>  import threading
> +import warnings
>  
>  import six
>  
> @@ -103,7 +104,23 @@ class WflInfo(object):
>  # to something that wflinfo understands.
>  platform = OPTIONS.env['PIGLIT_PLATFORM']
>  if platform == "mixed_glx_egl":
> -platform = "glx"
> +if 'gles2' in opts or 'gles3'in opts:
Space still missing :P   ~~~^

(although I just tested, and python seems to not care, but positive and
negative work fine, so...)

> +platform = "x11_egl"
> +else:
> +platform = "glx"
> +if platform == 'glx' and 'gles2' in opts or 'gles3' in opts:
> +# There is a bug in waffle Which causes it to return
> +# a legacy (non-profile) OpenGL instead of OpenGL ES when
> +# using the GLX platform (not for mixed_glx_egl). If the
> +# user explicitly asks for GLX then the tests are going 
> to
> +# skip whether we fast skip them or if we let them run.
> +# Since they're going to skip (even if it's wrong), let's
> +# skip them quickly.
> +#
> +# https://github.com/waffle-gl/waffle/issues/50
> +warnings.warn(
> +'Fast skipping for GLES may not work correctly with '
> +'pure GLX.')
>  
>  if sys.platform in ['windows', 'cygwin']:
>  bin = 'wflinfo.exe'
> -- 
> 2.19.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] framework/wflinfo: use x11_egl for gles with mixed_glx_egl

2018-10-11 Thread Emil Velikov
On Fri, 5 Oct 2018 at 17:06, Dylan Baker  wrote:
>
> Because wflinfo returns GL legacy (non-profile) for gles on glx.
>
> v2: - If the platform is pure GLX then warn that things aren't going to
>   work.
> ---
>  framework/wflinfo.py | 21 +++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/framework/wflinfo.py b/framework/wflinfo.py
> index a568bc344..1655aa0ee 100644
> --- a/framework/wflinfo.py
> +++ b/framework/wflinfo.py
> @@ -1,4 +1,4 @@
> -# Copyright (c) 2015-2016 Intel Corporation
> +# Copyright (c) 2015-2016,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
> @@ -26,6 +26,7 @@ import os
>  import subprocess
>  import sys
>  import threading
> +import warnings
>
>  import six
>
> @@ -103,7 +104,23 @@ class WflInfo(object):
>  # to something that wflinfo understands.
>  platform = OPTIONS.env['PIGLIT_PLATFORM']
>  if platform == "mixed_glx_egl":
> -platform = "glx"
> +if 'gles2' in opts or 'gles3'in opts:
> +platform = "x11_egl"
> +else:
> +platform = "glx"
> +if platform == 'glx' and 'gles2' in opts or 'gles3' in opts:
> +# There is a bug in waffle Which causes it to return
> +# a legacy (non-profile) OpenGL instead of OpenGL ES when
> +# using the GLX platform (not for mixed_glx_egl). If the
> +# user explicitly asks for GLX then the tests are going 
> to
> +# skip whether we fast skip them or if we let them run.
> +# Since they're going to skip (even if it's wrong), let's
> +# skip them quickly.
> +#
> +# https://github.com/waffle-gl/waffle/issues/50

Things seems to be working fine on my system. I've added some nits to
the issue report, can you please confirm we're thinking about the same
thing.

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