[Piglit] [PATCH] fbo-blit: test BlitFramebuffer with GL_TEXTURE_RECTANGLE

2013-02-26 Thread Marek Olšák
---
 tests/all.tests  |1 +
 tests/fbo/fbo-blit.c |   22 +-
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/tests/all.tests b/tests/all.tests
index 2278026..9595070 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1140,6 +1140,7 @@ add_concurrent_test(arb_texture_rectangle, 
'1-1-linear-texture')
 add_plain_test(arb_texture_rectangle, 'texrect-many')
 add_concurrent_test(arb_texture_rectangle, 'getteximage-targets RECT')
 add_plain_test(arb_texture_rectangle, 'texrect_simple_arb_texrect')
+add_plain_test(arb_texture_rectangle, 'fbo-blit rect')
 
 arb_texture_storage = Group()
 spec['ARB_texture_storage'] = arb_texture_storage
diff --git a/tests/fbo/fbo-blit.c b/tests/fbo/fbo-blit.c
index 933a56f..efa0661 100644
--- a/tests/fbo/fbo-blit.c
+++ b/tests/fbo/fbo-blit.c
@@ -52,6 +52,8 @@ PIGLIT_GL_TEST_CONFIG_END
 /* size of texture/renderbuffer (power of two) */
 #define FBO_SIZE 64
 
+static GLuint target = GL_TEXTURE_2D;
+
 
 static GLuint
 make_fbo(int w, int h)
@@ -64,17 +66,17 @@ make_fbo(int w, int h)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
 
glGenTextures(1, tex);
-   glBindTexture(GL_TEXTURE_2D, tex);
-   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
+   glBindTexture(target, tex);
+   glTexImage2D(target, 0, GL_RGBA,
 w, h, 0,
 GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 
-   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+   glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+   glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
  GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D,
+ target,
  tex,
  0);
assert(glGetError() == 0);
@@ -219,8 +221,18 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
+   int i;
+
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
piglit_require_extension(GL_EXT_framebuffer_object);
piglit_require_extension(GL_EXT_framebuffer_blit);
+
+   for (i = 1; i  argc; i++) {
+   if (strcmp(argv[i], rect) == 0) {
+   piglit_require_extension(GL_ARB_texture_rectangle);
+   target = GL_TEXTURE_RECTANGLE;
+   puts(Testing ARB_texture_rectangle);
+   }
+   }
 }
-- 
1.7.10.4

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


Re: [Piglit] [PATCH] fbo-blit: test BlitFramebuffer with GL_TEXTURE_RECTANGLE

2013-02-26 Thread Jose Fonseca


- Original Message -
 ---
  tests/all.tests  |1 +
  tests/fbo/fbo-blit.c |   22 +-
  2 files changed, 18 insertions(+), 5 deletions(-)
 
 diff --git a/tests/all.tests b/tests/all.tests
 index 2278026..9595070 100644
 --- a/tests/all.tests
 +++ b/tests/all.tests
 @@ -1140,6 +1140,7 @@ add_concurrent_test(arb_texture_rectangle,
 '1-1-linear-texture')
  add_plain_test(arb_texture_rectangle, 'texrect-many')
  add_concurrent_test(arb_texture_rectangle, 'getteximage-targets RECT')
  add_plain_test(arb_texture_rectangle, 'texrect_simple_arb_texrect')
 +add_plain_test(arb_texture_rectangle, 'fbo-blit rect')
  
  arb_texture_storage = Group()
  spec['ARB_texture_storage'] = arb_texture_storage
 diff --git a/tests/fbo/fbo-blit.c b/tests/fbo/fbo-blit.c
 index 933a56f..efa0661 100644
 --- a/tests/fbo/fbo-blit.c
 +++ b/tests/fbo/fbo-blit.c
 @@ -52,6 +52,8 @@ PIGLIT_GL_TEST_CONFIG_END
  /* size of texture/renderbuffer (power of two) */
  #define FBO_SIZE 64
  
 +static GLuint target = GL_TEXTURE_2D;
 +
  
  static GLuint
  make_fbo(int w, int h)
 @@ -64,17 +66,17 @@ make_fbo(int w, int h)
   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
  
   glGenTextures(1, tex);
 - glBindTexture(GL_TEXTURE_2D, tex);
 - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
 + glBindTexture(target, tex);
 + glTexImage2D(target, 0, GL_RGBA,
w, h, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
  
 - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 + glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 + glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  
   glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
 GL_COLOR_ATTACHMENT0_EXT,
 -   GL_TEXTURE_2D,
 +   target,
 tex,
 0);
   assert(glGetError() == 0);
 @@ -219,8 +221,18 @@ piglit_display(void)
  void
  piglit_init(int argc, char **argv)
  {
 + int i;
 +
   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
  
   piglit_require_extension(GL_EXT_framebuffer_object);
   piglit_require_extension(GL_EXT_framebuffer_blit);
 +
 + for (i = 1; i  argc; i++) {
 + if (strcmp(argv[i], rect) == 0) {
 + piglit_require_extension(GL_ARB_texture_rectangle);
 + target = GL_TEXTURE_RECTANGLE;
 + puts(Testing ARB_texture_rectangle);
 + }
 + }
  }

Reviewed-by: Jose Fonseca jfons...@vmware.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH V3 0/8] Add tests for ARB_texture_multisample

2013-02-26 Thread Chris Forbes
This series adds an initial set of tests for the ARB_texture_multisample
extension. I will follow this with more tests to explore some edge cases.

Changes from V2:
- Leftover window size junk removed
- Misc small tidyups

-- Chris

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


[Piglit] [PATCH V3 1/8] arb_texture_multisample: add cmake plumbing

2013-02-26 Thread Chris Forbes
Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 tests/spec/CMakeLists.txt|  1 +
 tests/spec/arb_texture_multisample/CMakeLists.gl.txt | 14 ++
 tests/spec/arb_texture_multisample/CMakeLists.txt|  1 +
 3 files changed, 16 insertions(+)
 create mode 100644 tests/spec/arb_texture_multisample/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_texture_multisample/CMakeLists.txt

diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 96b5a61..18b1d37 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -26,6 +26,7 @@ add_subdirectory (arb_texture_compression)
 add_subdirectory (arb_texture_cube_map_array)
 add_subdirectory (arb_texture_float)
 add_subdirectory (arb_texture_rectangle)
+add_subdirectory (arb_texture_multisample)
 add_subdirectory (arb_texture_storage)
 add_subdirectory (arb_timer_query)
 add_subdirectory (arb_transform_feedback2)
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt 
b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
new file mode 100644
index 000..c37afac
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
@@ -0,0 +1,14 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+   ${piglit_SOURCE_DIR}/tests/spec/arb_texture_multisample
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.txt 
b/tests/spec/arb_texture_multisample/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
-- 
1.8.1.4

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


[Piglit] [PATCH V3 4/8] arb_texture_multisample: new test for teximage state

2013-02-26 Thread Chris Forbes
This tests that the new teximage state added in ARB_texture_multisample
exists and has correct defaults for non-multisample textures:

- GL_TEXTURE_SAMPLES = 0
- GL_TEXTURE_FIXED_SAMPLE_LOCATIONS = true

V2: Don't specify window size, we don't care.

Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 tests/all.tests|  1 +
 .../spec/arb_texture_multisample/CMakeLists.gl.txt |  1 +
 tests/spec/arb_texture_multisample/texstate.c  | 55 ++
 3 files changed, 57 insertions(+)
 create mode 100644 tests/spec/arb_texture_multisample/texstate.c

diff --git a/tests/all.tests b/tests/all.tests
index 184b172..0d331f1 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -865,6 +865,7 @@ for sample_count in MSAA_SAMPLE_COUNTS:
 # fb-completeness
 spec['ARB_texture_multisample/fb-completeness/%d' % (sample_count,)] = \
 concurrent_test('arb_texture_multisample-fb-completeness %d' % 
(sample_count,))
+add_concurrent_test(arb_texture_multisample, 
'arb_texture_multisample-texstate')
 
 # Group AMD_shader_stencil_export
 spec['AMD_shader_stencil_export'] = Group()
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt 
b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
index d793256..d4cd51f 100644
--- a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
@@ -12,5 +12,6 @@ link_libraries (
 
 piglit_add_executable (arb_texture_multisample-minmax minmax.c)
 piglit_add_executable (arb_texture_multisample-fb-completeness 
fb-completeness.c)
+piglit_add_executable (arb_texture_multisample-texstate texstate.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_multisample/texstate.c 
b/tests/spec/arb_texture_multisample/texstate.c
new file mode 100644
index 000..bb51c35
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/texstate.c
@@ -0,0 +1,55 @@
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+config.supports_gl_compat_version = 30;
+config.window_visual = PIGLIT_GL_VISUAL_RGB;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+return PIGLIT_FAIL;
+}
+
+static bool
+check_texlevelparameter_int(GLuint target, GLuint level,
+char const *name, GLuint pname, GLint expected_value)
+{
+GLint actual_value;
+glGetTexLevelParameteriv(target, level, pname, actual_value);
+if (!piglit_check_gl_error(GL_NO_ERROR))
+return false;
+
+if (actual_value != expected_value) {
+printf(Expected %s value of %d but got %d\n,
+name, expected_value, actual_value);
+return false;
+}
+
+return true;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+GLuint tex2d;
+bool pass = true;
+piglit_require_extension(GL_ARB_texture_multisample);
+
+/* check that new image state required by ARB_texture_multisample
+ * exists, and has correct defaults. Tests against a non-multisample
+ * texture target, since this state exists on all images. */
+
+glGenTextures(1, tex2d);
+glBindTexture(GL_TEXTURE_2D, tex2d);
+glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, 
GL_UNSIGNED_BYTE, 0);
+
+pass = check_texlevelparameter_int(GL_TEXTURE_2D, 0, GL_TEXTURE_SAMPLES,
+GL_TEXTURE_SAMPLES, 0)  pass;
+pass = check_texlevelparameter_int(GL_TEXTURE_2D, 0, 
GL_TEXTURE_FIXED_SAMPLE_LOCATIONS,
+GL_TEXTURE_FIXED_SAMPLE_LOCATIONS, GL_TRUE)  pass;
+
+piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
-- 
1.8.1.4

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


[Piglit] [PATCH V3 7/8] arb_texture_multisample: add new targets to texelFetch

2013-02-26 Thread Chris Forbes
Allows verification of texelFetch with all six flavors of MS sampler.

- Put lod/sample_index in the fourth channel of the texture, so we
can verify that the correct lod/sample was sampled.
- For multisample targets, render the test pattern rather than uploading
  it. GL won't let us do a direct upload into these texture targets, and
  the alternative (upload to a staging texture; copy to target) is
  even messier.
- Accept sample count as an extra parameter after sampler
- Add existing swizzle option to usage string
- Use smaller formats for multisample tests, to avoid running into some
  hardware limits.

This replaces the earlier arb_texture_multisample-texel-fetch-execution
and arb_texture_multisample-texel-fetch-execution-array tests, and is
much more thorough (it showed Gen7 was still messed up :( !)

V3: - Increase window height so we can test 8x.
- Don't break the format-based extension checks.

Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 tests/all.tests  |   6 +
 tests/texturing/shaders/common.c |  34 --
 tests/texturing/shaders/common.h |   2 +
 tests/texturing/shaders/texelFetch.c | 226 +++
 4 files changed, 238 insertions(+), 30 deletions(-)

diff --git a/tests/all.tests b/tests/all.tests
index 5ab0a2d..a041515 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -867,6 +867,12 @@ for sample_count in MSAA_SAMPLE_COUNTS:
 # fb-completeness
 spec['ARB_texture_multisample/fb-completeness/%d' % (sample_count,)] = \
 concurrent_test('arb_texture_multisample-fb-completeness %d' % 
(sample_count,))
+# texel-fetch execution
+for stage in ['vs','fs']:
+for sampler in samplers_atm:
+spec['ARB_texture_multisample/texelFetch/%d-%s-%s' % (
+sample_count, stage, sampler)] = \
+concurrent_test('texelFetch %s %s %d' % (stage, sampler, 
sample_count))
 add_concurrent_test(arb_texture_multisample, 
'arb_texture_multisample-texstate')
 add_concurrent_test(arb_texture_multisample, 
'arb_texture_multisample-sample-mask')
 add_concurrent_test(arb_texture_multisample, 
'arb_texture_multisample-sample-mask-value')
diff --git a/tests/texturing/shaders/common.c b/tests/texturing/shaders/common.c
index 120e424..0b13d47 100644
--- a/tests/texturing/shaders/common.c
+++ b/tests/texturing/shaders/common.c
@@ -151,10 +151,11 @@ compute_miplevel_info()
miplevels = (int) log2f(max_dimension) + 1;
 
if (sampler.target == GL_TEXTURE_RECTANGLE ||
-   sampler.target == GL_TEXTURE_BUFFER ||
-   sampler.target == GL_TEXTURE_2D_MULTISAMPLE ||
-   sampler.target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
+   sampler.target == GL_TEXTURE_BUFFER)
miplevels = 1;
+   if (sampler.target == GL_TEXTURE_2D_MULTISAMPLE ||
+   sampler.target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
+   miplevels = sample_count;
 
/* Compute the size of each miplevel */
level_size = malloc(miplevels * sizeof(int *));
@@ -165,7 +166,11 @@ compute_miplevel_info()
level_size[l] = malloc(3 * sizeof(int));
 
for (i = 0; i  3 - is_array; i++)
-   level_size[l][i] = max2(level_size[l-1][i] / 2, 1);
+   if (has_samples())
+   /* same size for all sample planes */
+   level_size[l][i] = level_size[l-1][i];
+   else
+   level_size[l][i] = max2(level_size[l-1][i] / 2, 
1);
 
if (is_array)
level_size[l][2] = base_size[2];
@@ -190,6 +195,13 @@ has_slices()
 }
 
 bool
+has_samples()
+{
+return sampler.target == GL_TEXTURE_2D_MULTISAMPLE ||
+   sampler.target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
+}
+
+bool
 is_array_sampler()
 {
return sampler.target == GL_TEXTURE_1D_ARRAY ||
@@ -279,15 +291,20 @@ select_sampler(const char *name)
sampler.type = samplers[i].type;
sampler.target = samplers[i].target;
 
+   /* Use 32bpc sized formats where possible; drop down to 16bpc for
+* testing multisample targets to avoid hitting some hardware limits.
+* on i965.
+*/
+
if (name[0] == 'i') {
sampler.data_type = GL_INT;
sampler.format = GL_RGBA_INTEGER;
-   sampler.internal_format = GL_RGBA32I;
+   sampler.internal_format = has_samples() ? GL_RGBA16I : 
GL_RGBA32I;
sampler.return_type = ivec4;
} else if (name[0] == 'u') {
sampler.data_type = GL_UNSIGNED_INT;
sampler.format = GL_RGBA_INTEGER;
-   sampler.internal_format = GL_RGBA32UI;
+   sampler.internal_format = has_samples() ? GL_RGBA16UI : 
GL_RGBA32UI;
sampler.return_type = uvec4;
} else if (strstr(name, Shadow)) {
/* 

[Piglit] [RFC] Tests for image external

2013-02-26 Thread Topi Pohjolainen
In addition to the actual tests this series augments the framework to
provide platform specific buffers for the tests to consume. The
support written for GBM is far from ideal but I could not figure out
anything better and hence I'm looking for advise.

Topi Pohjolainen (3):
  framework: introduce interface for external buffers
  framework: gbm: support for creating external buffers
  tests/spec: add tests for oes image external

 tests/spec/CMakeLists.txt  |1 +
 .../oes_egl_image_external/CMakeLists.gles2.txt|   16 +
 tests/spec/oes_egl_image_external/CMakeLists.txt   |3 +
 .../oes_egl_image_external.c   |  776 
 tests/util/piglit-framework-gl.c   |   29 +
 tests/util/piglit-framework-gl.h   |   21 +
 .../piglit-framework-gl/piglit_gbm_framework.c |   78 ++
 .../util/piglit-framework-gl/piglit_gl_framework.h |   23 +
 8 files changed, 947 insertions(+)
 create mode 100644 tests/spec/oes_egl_image_external/CMakeLists.gles2.txt
 create mode 100644 tests/spec/oes_egl_image_external/CMakeLists.txt
 create mode 100644 tests/spec/oes_egl_image_external/oes_egl_image_external.c

-- 
1.7.9.5

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


[Piglit] [RFC 2/3] framework: gbm: support for creating external buffers

2013-02-26 Thread Topi Pohjolainen
Getting direct access to the gbm device through the waffle display
and creating the buffer is rather straightforward thing to do.
Writing to the buffer using CPU, however, requires priviledges for
the underlying gem-ioctl.

Signed-off-by: Topi Pohjolainen topi.pohjolai...@intel.com
---
 .../piglit-framework-gl/piglit_gbm_framework.c |   78 
 1 file changed, 78 insertions(+)

diff --git a/tests/util/piglit-framework-gl/piglit_gbm_framework.c 
b/tests/util/piglit-framework-gl/piglit_gbm_framework.c
index 4df3861..00e1425 100644
--- a/tests/util/piglit-framework-gl/piglit_gbm_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_gbm_framework.c
@@ -24,10 +24,18 @@
 #include assert.h
 #include stdlib.h
 #include unistd.h
+#include waffle.h
+#include waffle_gbm.h
+#include gbm.h
+#include libdrm/drm.h
+#include libdrm/i915_drm.h
+#include sys/ioctl.h
 
 #include piglit-util-gl-common.h
 #include piglit_gbm_framework.h
 
+#define ALIGN(value, alignment) (((value) + alignment - 1)  ~(alignment - 1))
+
 static void
 enter_event_loop(struct piglit_winsys_framework *winsys_fw)
 {
@@ -51,6 +59,73 @@ destroy(struct piglit_gl_framework *gl_fw)
free(winsys_fw);
 }
 
+static void *
+map(struct gbm_device *gbm, struct gbm_bo *bo, unsigned n_bytes)
+{
+int res;
+struct drm_i915_gem_mmap mmap_arg;
+
+mmap_arg.handle = gbm_bo_get_handle(bo).u32;
+mmap_arg.offset = 0;
+mmap_arg.size = n_bytes;
+
+res = ioctl(gbm_device_get_fd(gbm), DRM_IOCTL_I915_GEM_MMAP, 
mmap_arg);
+
+if (res)
+return 0;
+
+return (void *)(uintptr_t)mmap_arg.addr_ptr;
+}
+
+/* At the time of writing this, GBM did not have any alignment
+ * restrictions on height or width.
+ */
+static void *
+create_ext_420_buffer(struct piglit_gl_framework *gl_fw,
+ unsigned w, unsigned h, bool swap_vu,
+ const void *y, const void *u, const void *v)
+{
+   struct waffle_gbm_display *native = waffle_display_get_native(
+   piglit_wfl_framework(gl_fw)-display)-gbm;
+   struct gbm_bo *bo = gbm_bo_create(native-gbm_device, w, h,
+   swap_vu ? GBM_FORMAT_YVU420 : GBM_FORMAT_YUV420,
+   GBM_BO_USE_RENDERING);
+   unsigned char *p;
+   unsigned y_off = 0;
+   unsigned u_off = ALIGN(w * h, 4096);
+   unsigned v_off = u_off + ALIGN((w / 2) * (h / 2), 4096);
+   unsigned total = v_off + ALIGN((w / 2) * (h / 2), 4096);
+
+   if (!bo)
+   return NULL;
+
+   p = (unsigned char *)map(native-gbm_device, bo, total);
+
+   if (!p) {
+   gbm_bo_destroy(bo);
+   return NULL;
+   }
+
+   memcpy(p + y_off, y, w * h);
+
+   if (swap_vu) {
+   memcpy(p + u_off, v, (w / 2) * (h / 2));
+   memcpy(p + v_off, u, (w / 2) * (h / 2));
+   } else {
+   memcpy(p + u_off, u, (w / 2) * (h / 2));
+   memcpy(p + v_off, v, (w / 2) * (h / 2));
+   }
+
+   return bo;
+}
+
+static void
+destroy_ext_buffer(struct piglit_gl_framework *gl_fw, void *buf)
+{
+   (void)gl_fw;
+   gbm_bo_destroy((struct gbm_bo *)buf);
+}
+
 struct piglit_gl_framework*
 piglit_gbm_framework_create(const struct piglit_gl_test_config *test_config)
 {
@@ -70,6 +145,9 @@ piglit_gbm_framework_create(const struct 
piglit_gl_test_config *test_config)
winsys_fw-enter_event_loop = enter_event_loop;
gl_fw-destroy = destroy;
 
+   gl_fw-create_external_420_buffer = create_ext_420_buffer;
+   gl_fw-destroy_external_buffer = destroy_ext_buffer;
+
return gl_fw;
 
 fail:
-- 
1.7.9.5

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


[Piglit] [RFC 3/3] tests/spec: add tests for oes image external

2013-02-26 Thread Topi Pohjolainen
This consists of tests adapted from Khronos conformance suite and
Android surface flinger. While the former deals with getters/setters,
enumrations and simple sampling of texture based images, the latter
addresses bilinear sampling of non-GPU written subsampled UV-planes
and conversion from YUV to RGB.

The original Android test consist of two YV12 formatted textures,
one of size 64x64 and another of size 64x66. Both represent checker
board pattern each YUV component having value 63 or 191. Here I have
only the first but I'm planning to adopt the latter also if the approach
I have taken is reasonable. Instead of filling in the entire pattern I
have only written those YUV-components that are actually checked (a
dozen odd pixels) while the rest are initialised to zero. In addition
I used calculated floating point values instead of the hardcoded found
in the original. There, however, I ended up in deviations and I would
appreciate if people understanding the domain of YUV to RGB conversion
better could take a good look.

In the implementation that I have written for mesa/i965 I have also
support for NV12 format. Whereas YV12 (YVU420) has separate U- and
V-planes, NV12 has them combined into one. Hence I would like to have
the same tests for NV12 as for YV12 if acceptable.

The tests are written only for ES2 contexts, I haven't looked into
how I would separate the tests not dealing with external sampler
(samplerExternalOES is only defined for ES 2.x).

Signed-off-by: Topi Pohjolainen topi.pohjolai...@intel.com
---
 tests/spec/CMakeLists.txt  |1 +
 .../oes_egl_image_external/CMakeLists.gles2.txt|   16 +
 tests/spec/oes_egl_image_external/CMakeLists.txt   |3 +
 .../oes_egl_image_external.c   |  776 
 4 files changed, 796 insertions(+)
 create mode 100644 tests/spec/oes_egl_image_external/CMakeLists.gles2.txt
 create mode 100644 tests/spec/oes_egl_image_external/CMakeLists.txt
 create mode 100644 tests/spec/oes_egl_image_external/oes_egl_image_external.c

diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 96b5a61..485cf5e 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -66,6 +66,7 @@ add_subdirectory (ext_texture_array)
 add_subdirectory (ext_texture_integer)
 add_subdirectory (arb_draw_buffers)
 add_subdirectory (oes_draw_texture)
+add_subdirectory (oes_egl_image_external)
 add_subdirectory (arb_blend_func_extended)
 add_subdirectory (ext_unpack_subimage)
 add_subdirectory (arb_vertex_array_object)
diff --git a/tests/spec/oes_egl_image_external/CMakeLists.gles2.txt 
b/tests/spec/oes_egl_image_external/CMakeLists.gles2.txt
new file mode 100644
index 000..1ae1792
--- /dev/null
+++ b/tests/spec/oes_egl_image_external/CMakeLists.gles2.txt
@@ -0,0 +1,16 @@
+#add_definitions(-DSOURCE_DIR=${piglit_SOURCE_DIR}/)
+
+include_directories(
+   ${OPENGL_INCLUDE_PATH}
+   )
+
+link_libraries(
+   ${OPENGL_egl_LIBRARY}
+   piglitutil_gles2
+   )
+
+piglit_add_executable(oes_egl_image_external_gles2
+   oes_egl_image_external.c
+   )
+
+# vim: ft=cmake:
diff --git a/tests/spec/oes_egl_image_external/CMakeLists.txt 
b/tests/spec/oes_egl_image_external/CMakeLists.txt
new file mode 100644
index 000..d9d41f2
--- /dev/null
+++ b/tests/spec/oes_egl_image_external/CMakeLists.txt
@@ -0,0 +1,3 @@
+if(OPENGL_egl_LIBRARY)
+   piglit_include_target_api()
+endif(OPENGL_egl_LIBRARY)
diff --git a/tests/spec/oes_egl_image_external/oes_egl_image_external.c 
b/tests/spec/oes_egl_image_external/oes_egl_image_external.c
new file mode 100644
index 000..b04c72c
--- /dev/null
+++ b/tests/spec/oes_egl_image_external/oes_egl_image_external.c
@@ -0,0 +1,776 @@
+/*
+ * Copyright © 2013 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.
+ *
+ * Author: Topi Pohjolainen topi.pohjolai...@intel.com
+ */
+
+/** @file 

[Piglit] [PATCH 1/3] depthstencil-render-miplevels: Move the rendering to display() time.

2013-02-26 Thread Eric Anholt
I want to actually present results on the screen so that debugging
this test involves less meditation before achieving enlightenment.
---
 tests/texturing/depthstencil-render-miplevels.cpp |   13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/tests/texturing/depthstencil-render-miplevels.cpp 
b/tests/texturing/depthstencil-render-miplevels.cpp
index ac37b38..4fcc95a 100644
--- a/tests/texturing/depthstencil-render-miplevels.cpp
+++ b/tests/texturing/depthstencil-render-miplevels.cpp
@@ -415,7 +415,11 @@ piglit_init(int argc, char **argv)
} else {
print_usage_and_exit(argv[0]);
}
+}
 
+extern C enum piglit_result
+piglit_display()
+{
bool pass = true;
 
color_tex = create_mipmapped_tex(GL_RGBA);
@@ -454,14 +458,7 @@ piglit_init(int argc, char **argv)
pass = test_miplevel(level)  pass;
}
 
-   piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
-}
-
-extern C enum piglit_result
-piglit_display()
-{
-   /* Should never be reached */
-   return PIGLIT_FAIL;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 }; /* Anonymous namespace */
-- 
1.7.10.4

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


[Piglit] [PATCH 2/3] depthstencil-render-miplevels: Make the stencil value scale like depth.

2013-02-26 Thread Eric Anholt
This will let the presentation of stencil work like presentation of
depth.
---
 tests/texturing/depthstencil-render-miplevels.cpp |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/texturing/depthstencil-render-miplevels.cpp 
b/tests/texturing/depthstencil-render-miplevels.cpp
index 4fcc95a..b41fea8 100644
--- a/tests/texturing/depthstencil-render-miplevels.cpp
+++ b/tests/texturing/depthstencil-render-miplevels.cpp
@@ -227,6 +227,14 @@ set_up_framebuffer_for_miplevel(int level)
}
 }
 
+uint8_t
+stencil_for_level(int level)
+{
+   int step = 254 / max_miplevel;
+
+   return 1 + step * level;
+}
+
 /**
  * Using glClear, set the contents of the depth and stencil buffers
  * (if present) to a value that is unique to this miplevel.
@@ -242,7 +250,7 @@ populate_miplevel(int level)
clear_mask |= GL_DEPTH_BUFFER_BIT;
}
if (attach_stencil) {
-   glClearStencil(level + 1);
+   glClearStencil(stencil_for_level(level));
clear_mask |= GL_STENCIL_BUFFER_BIT;
}
 
@@ -268,7 +276,8 @@ test_miplevel(int level)
 
if (attach_stencil) {
printf(Probing miplevel %d stencil\n, level);
-   pass = piglit_probe_rect_stencil(0, 0, dim, dim, level + 1)
+   pass = piglit_probe_rect_stencil(0, 0, dim, dim,
+stencil_for_level(level))
 pass;
}
 
-- 
1.7.10.4

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


[Piglit] [PATCH 3/3] depthstencil-render-miplevels: Present the results in non-auto mode.

2013-02-26 Thread Eric Anholt
I tried to make the presentation be the data that was originally
probed -- there's a second readpixels that's unfortunately, but we do
use separate textures so that any workaround relayouts of the probed
textures don't get tweaked in the process of displaying.
---
 tests/texturing/depthstencil-render-miplevels.cpp |  105 -
 1 file changed, 102 insertions(+), 3 deletions(-)

diff --git a/tests/texturing/depthstencil-render-miplevels.cpp 
b/tests/texturing/depthstencil-render-miplevels.cpp
index b41fea8..2ffe07d 100644
--- a/tests/texturing/depthstencil-render-miplevels.cpp
+++ b/tests/texturing/depthstencil-render-miplevels.cpp
@@ -90,8 +90,8 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 16;
-   config.window_height = 16;
+   config.window_width = 512;
+   config.window_height = 512;
config.window_visual = PIGLIT_GL_VISUAL_RGBA;
 
 PIGLIT_GL_TEST_CONFIG_END
@@ -109,7 +109,8 @@ bool attach_stencil_first = false;
 GLenum depth_format;
 int miplevel0_size;
 int max_miplevel;
-
+float **depth_miplevel_data;
+uint8_t **stencil_miplevel_data;
 
 /**
  * Check if the given depth/stencil/rgba texture internal format is supported.
@@ -260,6 +261,9 @@ populate_miplevel(int level)
 /**
  * Test that every pixel in the depth and stencil buffers (if present)
  * is equal to the value set by populate_miplevel.
+ *
+ * If we're going to later render our results to the screen for
+ * debugging, then save off a copy of the data we read now.
  */
 bool
 test_miplevel(int level)
@@ -272,6 +276,14 @@ test_miplevel(int level)
printf(Probing miplevel %d depth\n, level);
pass = piglit_probe_rect_depth(0, 0, dim, dim, float_value)
 pass;
+
+   if (!piglit_automatic) {
+   depth_miplevel_data[level] =
+   (float *)malloc(4 * dim * dim);
+   glReadPixels(0, 0, dim, dim,
+GL_DEPTH_COMPONENT, GL_FLOAT,
+depth_miplevel_data[level]);
+   }
}
 
if (attach_stencil) {
@@ -279,6 +291,14 @@ test_miplevel(int level)
pass = piglit_probe_rect_stencil(0, 0, dim, dim,
 stencil_for_level(level))
 pass;
+
+   if (!piglit_automatic) {
+   stencil_miplevel_data[level] =
+   (uint8_t *)malloc(dim * dim);
+   glReadPixels(0, 0, dim, dim,
+GL_STENCIL_INDEX, GL_UNSIGNED_BYTE,
+stencil_miplevel_data[level]);
+   }
}
 
return pass;
@@ -332,6 +352,9 @@ piglit_init(int argc, char **argv)
while ((miplevel0_size  (max_miplevel + 1))  0)
++max_miplevel;
}
+   depth_miplevel_data = (float **)calloc(max_miplevel, sizeof(float *));
+   stencil_miplevel_data = (uint8_t **)calloc(max_miplevel,
+  sizeof(uint8_t *));
 
/* argv[2]: buffer combination */
if (strcmp(argv[2], s=z24_s8) == 0) {
@@ -426,6 +449,79 @@ piglit_init(int argc, char **argv)
}
 }
 
+static void
+render_tex_to_screen(GLuint tex, int x, int y)
+{
+   glBindTexture(GL_TEXTURE_2D, tex);
+   glEnable(GL_TEXTURE_2D);
+
+   for (int level = 0; level = max_miplevel; ++level) {
+   int dim = miplevel0_size  level;
+
+   piglit_draw_rect_tex(x, y, dim, dim,
+0, 0, 1, 1);
+
+   y += dim + 1;
+   }
+}
+
+/**
+ * Presents the results of the rendering on the screen.
+ */
+static void
+render_results_to_screen()
+{
+   GLuint tex;
+
+   printf(\n);
+   printf(Depth is on the left, stencil is on the right.\n);
+   printf(Colors should proceed from nearly-black to nearly-red.\n);
+
+   piglit_ortho_projection(piglit_width, piglit_height, false);
+
+   glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+   glClearColor(0.5, 0.5, 0.5, 0.0);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glGenTextures(1, tex);
+   glBindTexture(GL_TEXTURE_2D, tex);
+
+   if (attach_depth) {
+   for (int level = 0; level = max_miplevel; ++level) {
+   int dim = miplevel0_size  level;
+
+   glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA,
+dim, dim,
+0,
+GL_RED, GL_FLOAT,
+depth_miplevel_data[level]);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   render_tex_to_screen(tex, 0, 1);
+   }

Re: [Piglit] [Mesa-dev] [PATCH 0/9] remove mfeatures.h file

2013-02-26 Thread Aaron Watry
On Tue, Feb 26, 2013 at 2:19 PM, Brian Paul bri...@vmware.com wrote:

 On 02/26/2013 11:58 AM, Jordan Justen wrote:

 On Tue, Feb 26, 2013 at 10:16 AM, Brian Paulbri...@vmware.com  wrote:

 On 02/26/2013 10:09 AM, Jordan Justen wrote:


 On Sat, Feb 23, 2013 at 7:29 AM, Brian Paulbri...@vmware.com   wrote:


 This series removes the dependencies on the mfeatures.h file and the
 file
 itself.

 I'd appreciated someone doing a test build of this series to
 double-check
 my
 work.


 I'm getting a build error:
 GENmain/get_hash.h
 updating main/git_sha1.h
 get_hash_generator.py: need at least a single enabled API


 OK, I've got a patch for this, but it looks like the disk on fd.o is
 full.
 When I try to push to my branch I get:

 Counting objects: 19, done.
 Delta compression using up to 8 threads.
 Compressing objects: 100% (12/12), done.
 Writing objects: 100% (12/12), 1.16 KiB, done.
 Total 12 (delta 10), reused 0 (delta 0)
 error: file write error (No space left on device)
 fatal: unable to write sha1 file
 error: unpack failed: unpack-objects abnormal exit
 To 
 ssh://brianp@people.**freedesktop.org/~brianp/mesa.**githttp://bri...@people.freedesktop.org/~brianp/mesa.git
   ! [remote rejected] remove-mfeatures -  remove-mfeatures (n/a
 (unpacker
 error))
 error: failed to push some refs to
 'ssh://brianp@people.**freedesktop.org/~brianp/mesa.**githttp://bri...@people.freedesktop.org/~brianp/mesa.git
 '

 brianp@annarchy:~$ df
 Filesystem   1K-blocks  Used Available Use% Mounted on
 /dev/vda1 10325748   7479656   2321572  77% /
 tmpfs 12372476 0  12372476   0% /lib/init/rw
 udev  1236717296  12367076   1% /dev
 tmpfs 12372476 0  12372476   0% /dev/shm
 /dev/vda5 82573108  78378536 4 100% /home


 I looks like someone freed up some space on /home now...


 Yeah, I pushed my new patches.


These patches fix my previous build errors. My previously-posted
configuration (radeon/r600g, LLVM, Clover) is building correctly now.

--Aaron


 Andreas, I haven't looked at the issue you found yet.  Feel free to take a
 look yourself though...

 -Brian


 __**_
 mesa-dev mailing list
 mesa-...@lists.freedesktop.org
 http://lists.freedesktop.org/**mailman/listinfo/mesa-devhttp://lists.freedesktop.org/mailman/listinfo/mesa-dev

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