Re: [Piglit] [PATCH] egl: add new test egl-create-largest-pbuffer-surface

2016-02-15 Thread Matt Turner
On Mon, Feb 15, 2016 at 12:14 AM, Tapani Pälli  wrote:
> Test is based on egl-create-pbuffer-surface but tests that using
> EGL_LARGEST_PBUFFER attribute works as specified
>
> Test fails on current Mesa and Nvidia binary driver version 355.11.
>
> Signed-off-by: Tapani Pälli 
> ---
>  tests/all.py   |   3 +
>  tests/egl/CMakeLists.gl.txt|   2 +
>  tests/egl/egl-create-largest-pbuffer-surface.c | 113 
> +
>  3 files changed, 118 insertions(+)
>  create mode 100644 tests/egl/egl-create-largest-pbuffer-surface.c
>
> diff --git a/tests/all.py b/tests/all.py
> index c5009cc..440eb0f 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4332,6 +4332,9 @@ with profile.group_manager(
>  g(['egl-create-pbuffer-surface'],
>'eglCreatePbufferSurface and then glClear',
>run_concurrent=False)
> +g(['egl-create-largest-pbuffer-surface'],
> +  'largest possible eglCreatePbufferSurface and then glClear',
> +  run_concurrent=False)
>
>  with profile.group_manager(
>  PiglitGLTest,
> diff --git a/tests/egl/CMakeLists.gl.txt b/tests/egl/CMakeLists.gl.txt
> index eccd470..06fbecb 100644
> --- a/tests/egl/CMakeLists.gl.txt
> +++ b/tests/egl/CMakeLists.gl.txt
> @@ -21,6 +21,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
> target_link_libraries(egl-query-surface pthread ${X11_X11_LIB})
> piglit_add_executable (egl-create-pbuffer-surface egl-util.c 
> egl-create-pbuffer-surface.c)
> target_link_libraries(egl-create-pbuffer-surface pthread 
> ${X11_X11_LIB})
> +   piglit_add_executable (egl-create-largest-pbuffer-surface egl-util.c 
> egl-create-largest-pbuffer-surface.c)
> +   target_link_libraries(egl-create-largest-pbuffer-surface pthread 
> ${X11_X11_LIB})
> piglit_add_executable (egl-configless-context 
> egl-configless-context.c)
> target_link_libraries(egl-configless-context pthread ${X11_X11_LIB})
> piglit_add_executable (egl-gl-colorspace egl-util.c 
> egl-gl-colorspace.c)
> diff --git a/tests/egl/egl-create-largest-pbuffer-surface.c 
> b/tests/egl/egl-create-largest-pbuffer-surface.c
> new file mode 100644
> index 000..c02971f
> --- /dev/null
> +++ b/tests/egl/egl-create-largest-pbuffer-surface.c
> @@ -0,0 +1,113 @@
> +/*
> + * Copyright © 2014 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.
> + *
> + */
> +
> +/** @file egl-create-largest-pbuffer-surface.c
> + *
> + * Test EGLCreatePBufferSurface behaviour with EGL_LARGEST_PBUFFER attribute.
> + *
> + * From EGL 1.5 spec:
> + *
> + * "Use EGL_LARGEST_PBUFFER to get the largest available pbuffer when the
> + * allocation of the pbuffer would otherwise fail."
> + */
> +
> +#include 
> +#include "piglit-util-gl.h"
> +#include "egl-util.h"
> +
> +static enum piglit_result
> +draw(struct egl_state *state)
> +{
> +   EGLSurface surf;
> +   const float purple[] = {1.0, 0.0, 1.0, 1.0};
> +   EGLint width, height;
> +
> +   const EGLint srfPbufferAttr[] =

static

> +   {
> +  EGL_WIDTH, INT_MAX,
> +  EGL_HEIGHT, INT_MAX,
> +  EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
> +  EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
> +  EGL_LARGEST_PBUFFER, EGL_TRUE,
> +  EGL_NONE
> +   };
> +
> +   surf = eglCreatePbufferSurface(state->egl_dpy, state->cfg,
> +   srfPbufferAttr);
> +
> +   if (eglGetError() != EGL_SUCCESS || surf == EGL_NO_SURFACE) {
> +  fprintf(stderr, "eglCreatePbufferSurface failed\n");
> +  piglit_report_result(PIGLIT_FAIL);
> +   }
> +
> +   /* Query what are the dimensions we got. */
> +   eglQuerySurface(state->egl_dpy, surf, EGL_WIDTH, );
> +   eglQuerySurface(state->egl_dpy, surf, EGL_HEIGHT, );
> +
> +   glEnable(GL_TEXTURE_2D);
> +
> +   eglMakeCurrent(state->egl_dpy, 

Re: [Piglit] [PATCH] egl: add new test egl-create-largest-pbuffer-surface

2016-02-15 Thread Juha-Pekka Heikkila

On 15.02.2016 10:14, Tapani Pälli wrote:

Test is based on egl-create-pbuffer-surface but tests that using
EGL_LARGEST_PBUFFER attribute works as specified

Test fails on current Mesa and Nvidia binary driver version 355.11.

Signed-off-by: Tapani Pälli 
---
  tests/all.py   |   3 +
  tests/egl/CMakeLists.gl.txt|   2 +
  tests/egl/egl-create-largest-pbuffer-surface.c | 113 +
  3 files changed, 118 insertions(+)
  create mode 100644 tests/egl/egl-create-largest-pbuffer-surface.c

diff --git a/tests/all.py b/tests/all.py
index c5009cc..440eb0f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4332,6 +4332,9 @@ with profile.group_manager(
  g(['egl-create-pbuffer-surface'],
'eglCreatePbufferSurface and then glClear',
run_concurrent=False)
+g(['egl-create-largest-pbuffer-surface'],
+  'largest possible eglCreatePbufferSurface and then glClear',
+  run_concurrent=False)

  with profile.group_manager(
  PiglitGLTest,
diff --git a/tests/egl/CMakeLists.gl.txt b/tests/egl/CMakeLists.gl.txt
index eccd470..06fbecb 100644
--- a/tests/egl/CMakeLists.gl.txt
+++ b/tests/egl/CMakeLists.gl.txt
@@ -21,6 +21,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(egl-query-surface pthread ${X11_X11_LIB})
piglit_add_executable (egl-create-pbuffer-surface egl-util.c 
egl-create-pbuffer-surface.c)
target_link_libraries(egl-create-pbuffer-surface pthread ${X11_X11_LIB})
+   piglit_add_executable (egl-create-largest-pbuffer-surface egl-util.c 
egl-create-largest-pbuffer-surface.c)
+   target_link_libraries(egl-create-largest-pbuffer-surface pthread 
${X11_X11_LIB})
piglit_add_executable (egl-configless-context egl-configless-context.c)
target_link_libraries(egl-configless-context pthread ${X11_X11_LIB})
piglit_add_executable (egl-gl-colorspace egl-util.c egl-gl-colorspace.c)
diff --git a/tests/egl/egl-create-largest-pbuffer-surface.c 
b/tests/egl/egl-create-largest-pbuffer-surface.c
new file mode 100644
index 000..c02971f
--- /dev/null
+++ b/tests/egl/egl-create-largest-pbuffer-surface.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright © 2014 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.
+ *
+ */
+
+/** @file egl-create-largest-pbuffer-surface.c
+ *
+ * Test EGLCreatePBufferSurface behaviour with EGL_LARGEST_PBUFFER attribute.
+ *
+ * From EGL 1.5 spec:
+ *
+ * "Use EGL_LARGEST_PBUFFER to get the largest available pbuffer when the
+ * allocation of the pbuffer would otherwise fail."
+ */
+
+#include 
+#include "piglit-util-gl.h"
+#include "egl-util.h"
+
+static enum piglit_result
+draw(struct egl_state *state)
+{
+   EGLSurface surf;
+   const float purple[] = {1.0, 0.0, 1.0, 1.0};
+   EGLint width, height;
+
+   const EGLint srfPbufferAttr[] =
+   {
+  EGL_WIDTH, INT_MAX,
+  EGL_HEIGHT, INT_MAX,
+  EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
+  EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
+  EGL_LARGEST_PBUFFER, EGL_TRUE,
+  EGL_NONE
+   };
+
+   surf = eglCreatePbufferSurface(state->egl_dpy, state->cfg,
+   srfPbufferAttr);
+
+   if (eglGetError() != EGL_SUCCESS || surf == EGL_NO_SURFACE) {
+  fprintf(stderr, "eglCreatePbufferSurface failed\n");
+  piglit_report_result(PIGLIT_FAIL);
+   }
+
+   /* Query what are the dimensions we got. */
+   eglQuerySurface(state->egl_dpy, surf, EGL_WIDTH, );
+   eglQuerySurface(state->egl_dpy, surf, EGL_HEIGHT, );


These are not needed.


+
+   glEnable(GL_TEXTURE_2D);
+
+   eglMakeCurrent(state->egl_dpy, state->surf, state->surf, state->ctx);
+   glClearColor(1.0, 1.0, 1.0, 0.0);
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   eglBindTexImage(state->egl_dpy, surf, EGL_BACK_BUFFER);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 

[Piglit] [PATCH] egl: add new test egl-create-largest-pbuffer-surface

2016-02-15 Thread Tapani Pälli
Test is based on egl-create-pbuffer-surface but tests that using
EGL_LARGEST_PBUFFER attribute works as specified

Test fails on current Mesa and Nvidia binary driver version 355.11.

Signed-off-by: Tapani Pälli 
---
 tests/all.py   |   3 +
 tests/egl/CMakeLists.gl.txt|   2 +
 tests/egl/egl-create-largest-pbuffer-surface.c | 113 +
 3 files changed, 118 insertions(+)
 create mode 100644 tests/egl/egl-create-largest-pbuffer-surface.c

diff --git a/tests/all.py b/tests/all.py
index c5009cc..440eb0f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4332,6 +4332,9 @@ with profile.group_manager(
 g(['egl-create-pbuffer-surface'],
   'eglCreatePbufferSurface and then glClear',
   run_concurrent=False)
+g(['egl-create-largest-pbuffer-surface'],
+  'largest possible eglCreatePbufferSurface and then glClear',
+  run_concurrent=False)
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/egl/CMakeLists.gl.txt b/tests/egl/CMakeLists.gl.txt
index eccd470..06fbecb 100644
--- a/tests/egl/CMakeLists.gl.txt
+++ b/tests/egl/CMakeLists.gl.txt
@@ -21,6 +21,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(egl-query-surface pthread ${X11_X11_LIB})
piglit_add_executable (egl-create-pbuffer-surface egl-util.c 
egl-create-pbuffer-surface.c)
target_link_libraries(egl-create-pbuffer-surface pthread ${X11_X11_LIB})
+   piglit_add_executable (egl-create-largest-pbuffer-surface egl-util.c 
egl-create-largest-pbuffer-surface.c)
+   target_link_libraries(egl-create-largest-pbuffer-surface pthread 
${X11_X11_LIB})
piglit_add_executable (egl-configless-context egl-configless-context.c)
target_link_libraries(egl-configless-context pthread ${X11_X11_LIB})
piglit_add_executable (egl-gl-colorspace egl-util.c egl-gl-colorspace.c)
diff --git a/tests/egl/egl-create-largest-pbuffer-surface.c 
b/tests/egl/egl-create-largest-pbuffer-surface.c
new file mode 100644
index 000..c02971f
--- /dev/null
+++ b/tests/egl/egl-create-largest-pbuffer-surface.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright © 2014 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.
+ *
+ */
+
+/** @file egl-create-largest-pbuffer-surface.c
+ *
+ * Test EGLCreatePBufferSurface behaviour with EGL_LARGEST_PBUFFER attribute.
+ *
+ * From EGL 1.5 spec:
+ *
+ * "Use EGL_LARGEST_PBUFFER to get the largest available pbuffer when the
+ * allocation of the pbuffer would otherwise fail."
+ */
+
+#include 
+#include "piglit-util-gl.h"
+#include "egl-util.h"
+
+static enum piglit_result
+draw(struct egl_state *state)
+{
+   EGLSurface surf;
+   const float purple[] = {1.0, 0.0, 1.0, 1.0};
+   EGLint width, height;
+
+   const EGLint srfPbufferAttr[] =
+   {
+  EGL_WIDTH, INT_MAX,
+  EGL_HEIGHT, INT_MAX,
+  EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
+  EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
+  EGL_LARGEST_PBUFFER, EGL_TRUE,
+  EGL_NONE
+   };
+
+   surf = eglCreatePbufferSurface(state->egl_dpy, state->cfg,
+   srfPbufferAttr);
+
+   if (eglGetError() != EGL_SUCCESS || surf == EGL_NO_SURFACE) {
+  fprintf(stderr, "eglCreatePbufferSurface failed\n");
+  piglit_report_result(PIGLIT_FAIL);
+   }
+
+   /* Query what are the dimensions we got. */
+   eglQuerySurface(state->egl_dpy, surf, EGL_WIDTH, );
+   eglQuerySurface(state->egl_dpy, surf, EGL_HEIGHT, );
+
+   glEnable(GL_TEXTURE_2D);
+
+   eglMakeCurrent(state->egl_dpy, state->surf, state->surf, state->ctx);
+   glClearColor(1.0, 1.0, 1.0, 0.0);
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   eglBindTexImage(state->egl_dpy, surf, EGL_BACK_BUFFER);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+