[Piglit] [PATCH 3/8] sample_common: Factor out image creation for a dmabuf fd.
I need to reuse this part, without the destruction, for refcounting tests. --- .../spec/ext_image_dma_buf_import/sample_common.c | 40 -- .../spec/ext_image_dma_buf_import/sample_common.h | 4 +++ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.c b/tests/spec/ext_image_dma_buf_import/sample_common.c index 7373cd4c5176..370baa426693 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_common.c +++ b/tests/spec/ext_image_dma_buf_import/sample_common.c @@ -110,9 +110,9 @@ sample_and_destroy_img(unsigned w, unsigned h, EGLImageKHR img) return PIGLIT_PASS; } -static enum piglit_result -sample_buffer(void *buf, int fd, int fourcc, unsigned w, unsigned h, - unsigned stride, unsigned offset) +enum piglit_result +egl_image_for_dma_buf_fd(int fd, int fourcc, int w, int h, +unsigned stride, unsigned offset, EGLImageKHR *out_img) { EGLint error; EGLImageKHR img; @@ -170,10 +170,9 @@ sample_buffer(void *buf, int fd, int fourcc, unsigned w, unsigned h, } img = eglCreateImageKHR(eglGetCurrentDisplay(), EGL_NO_CONTEXT, - EGL_LINUX_DMA_BUF_EXT, (EGLClientBuffer)0, attr); - - /* Release the creator side of the buffer. */ - piglit_destroy_dma_buf(buf); +EGL_LINUX_DMA_BUF_EXT, (EGLClientBuffer)0, +attr); + *out_img = img; error = eglGetError(); @@ -185,9 +184,6 @@ sample_buffer(void *buf, int fd, int fourcc, unsigned w, unsigned h, printf("eglCreateImageKHR() failed: %s 0x%x\n", piglit_get_egl_error_name(error), error); - /* Close the descriptor also, EGL does not have ownership */ - close(fd); - return PIGLIT_FAIL; } @@ -196,6 +192,30 @@ sample_buffer(void *buf, int fd, int fourcc, unsigned w, unsigned h, return PIGLIT_FAIL; } + *out_img = img; + return PIGLIT_PASS; +} + +static enum piglit_result +sample_buffer(void *buf, int fd, int fourcc, unsigned w, unsigned h, + unsigned stride, unsigned offset) +{ + enum piglit_result res; + EGLImageKHR img; + + res = egl_image_for_dma_buf_fd(fd, fourcc, w, h, stride, offset, &img); + + /* Release the creator side of the buffer. */ + piglit_destroy_dma_buf(buf); + + if (!img) { + /* Close the descriptor also, EGL does not have ownership */ + close(fd); + } + + if (res != PIGLIT_PASS) + return res; + return sample_and_destroy_img(w, h, img); } diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.h b/tests/spec/ext_image_dma_buf_import/sample_common.h index 8559e9fe5896..7160b816ca03 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_common.h +++ b/tests/spec/ext_image_dma_buf_import/sample_common.h @@ -35,4 +35,8 @@ enum piglit_result dma_buf_create_and_sample_32bpp(unsigned w, unsigned h, unsigned cpp, int fourcc, const unsigned char *src); +enum piglit_result +egl_image_for_dma_buf_fd(int fd, int fourcc, int w, int h, +unsigned stride, unsigned offset, EGLImageKHR *out_img); + #endif /* SAMPLE_COMMON_H */ -- 2.8.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 4/8] sample_common: Reuse piglit_draw_rect_tex instead of hand-rolling it.
Less code, and it may be useful if we want to extend the tests to desktop at some point. --- .../spec/ext_image_dma_buf_import/sample_common.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.c b/tests/spec/ext_image_dma_buf_import/sample_common.c index 370baa426693..78e4de378494 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_common.c +++ b/tests/spec/ext_image_dma_buf_import/sample_common.c @@ -37,26 +37,16 @@ static const char fs_src[] = "gl_FragColor = texture2D(sampler, texcoords);\n" "}\n"; static const char vs_src[] = - "attribute vec4 position;\n" + "attribute vec4 piglit_vertex;\n" + "attribute vec4 piglit_texcoords;\n" "varying vec2 texcoords;\n" "\n" "void main()\n" "{\n" - "texcoords = 0.5 * (position.xy + vec2(1.0, 1.0));\n" - "gl_Position = position;\n" + " texcoords = piglit_texcoords.xy;\n" + " gl_Position = piglit_vertex;\n" "}\n"; -static void -set_vertices(GLuint prog) -{ - static const GLfloat v[] = { -1.0f, 1.0f, -1.0f, -1.0f, - 1.0f, -1.0f, 1.0f, 1.0f }; - - GLint i = glGetAttribLocation(prog, "position"); - glVertexAttribPointer(i, 2, GL_FLOAT, GL_FALSE, 0, v); - glEnableVertexAttribArray(i); -} - static enum piglit_result sample_and_destroy_img(unsigned w, unsigned h, EGLImageKHR img) { @@ -94,12 +84,12 @@ sample_and_destroy_img(unsigned w, unsigned h, EGLImageKHR img) glUseProgram(prog); glUniform1i(glGetUniformLocation(prog, "sampler"), 0); - set_vertices(prog); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glViewport(0, 0, w, h); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + piglit_draw_rect_tex(-1, -1, 2, 2, +0, 0, 1, 1); glDeleteProgram(prog); glUseProgram(0); -- 2.8.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 5/8] sample_common: Separate EGLImage-to-texture from drawing.
This will get reused from refcount testing. --- tests/spec/ext_image_dma_buf_import/sample_common.c | 21 ++--- tests/spec/ext_image_dma_buf_import/sample_common.h | 3 +++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.c b/tests/spec/ext_image_dma_buf_import/sample_common.c index 78e4de378494..9864ad038644 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_common.c +++ b/tests/spec/ext_image_dma_buf_import/sample_common.c @@ -47,10 +47,10 @@ static const char vs_src[] = " gl_Position = piglit_vertex;\n" "}\n"; -static enum piglit_result -sample_and_destroy_img(unsigned w, unsigned h, EGLImageKHR img) +enum piglit_result +texture_for_egl_image(EGLImageKHR img, GLuint *out_tex) { - GLuint prog, tex; + GLuint tex; GLenum error; glGenTextures(1, &tex); @@ -79,6 +79,21 @@ sample_and_destroy_img(unsigned w, unsigned h, EGLImageKHR img) glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + *out_tex = tex; + + return PIGLIT_PASS; +} + +static enum piglit_result +sample_and_destroy_img(unsigned w, unsigned h, EGLImageKHR img) +{ + GLuint prog, tex; + enum piglit_result res; + + res = texture_for_egl_image(img, &tex); + if (res != PIGLIT_PASS) + return res; + prog = piglit_build_simple_program(vs_src, fs_src); glUseProgram(prog); diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.h b/tests/spec/ext_image_dma_buf_import/sample_common.h index 7160b816ca03..75a5c59bdbc1 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_common.h +++ b/tests/spec/ext_image_dma_buf_import/sample_common.h @@ -39,4 +39,7 @@ enum piglit_result egl_image_for_dma_buf_fd(int fd, int fourcc, int w, int h, unsigned stride, unsigned offset, EGLImageKHR *out_img); +enum piglit_result +texture_for_egl_image(EGLImageKHR img, GLuint *out_tex); + #endif /* SAMPLE_COMMON_H */ -- 2.8.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/8] sample_rgb/yuv: Present the results to the screen in non-auto.
--- tests/spec/ext_image_dma_buf_import/sample_rgb.c | 8 ++-- tests/spec/ext_image_dma_buf_import/sample_yuv.c | 8 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/spec/ext_image_dma_buf_import/sample_rgb.c b/tests/spec/ext_image_dma_buf_import/sample_rgb.c index e6df06b64354..420cc8c3111e 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_rgb.c +++ b/tests/spec/ext_image_dma_buf_import/sample_rgb.c @@ -61,8 +61,12 @@ piglit_display(void) if (res != PIGLIT_PASS) return res; - return piglit_probe_image_ubyte(0, 0, 2, 2, GL_RGBA, expected) ? - PIGLIT_PASS : PIGLIT_FAIL; + if (!piglit_probe_image_ubyte(0, 0, 2, 2, GL_RGBA, expected)) + res = PIGLIT_FAIL; + + piglit_present_results(); + + return res; } static int diff --git a/tests/spec/ext_image_dma_buf_import/sample_yuv.c b/tests/spec/ext_image_dma_buf_import/sample_yuv.c index b910b199935b..a7b78f9de20a 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_yuv.c +++ b/tests/spec/ext_image_dma_buf_import/sample_yuv.c @@ -115,8 +115,12 @@ piglit_display(void) */ piglit_set_tolerance_for_bits(5, 6, 5, 8); - return piglit_probe_image_ubyte(0, 0, 4, 4, GL_RGBA, expected) ? - PIGLIT_PASS : PIGLIT_FAIL; + if (!piglit_probe_image_ubyte(0, 0, 4, 4, GL_RGBA, expected)) + res = PIGLIT_FAIL; + + piglit_present_results(); + + return res; } static int -- 2.8.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 8/8] EGL_EXT_image_dma_buf_import/refcount: New test for GEM handle bug.
Drivers can miss the need to refcount their GEM handles, and the destroy of the image/texture pair for tex2 will result in tex1 no longer being usable. This fails to piglit_report_result(PIGLIT_FAIL) on vc4 (which is missing the handle code), because tex1's shadow tiled temporary already has the texture contents in it when the shadow linear->tiled blit fails, but the driver does make a noisy warning on stderr. On intel, if you drop the global name lookup in libdrm, the driver exit()s due to the -EINVAL from the draw call. --- .../ext_image_dma_buf_import/CMakeLists.gles2.txt | 1 + tests/spec/ext_image_dma_buf_import/refcount.c | 134 + .../spec/ext_image_dma_buf_import/sample_common.c | 6 +- .../spec/ext_image_dma_buf_import/sample_common.h | 2 +- 4 files changed, 139 insertions(+), 4 deletions(-) create mode 100644 tests/spec/ext_image_dma_buf_import/refcount.c diff --git a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt index fdf43595a6dc..93f43fad955d 100644 --- a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt +++ b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt @@ -16,6 +16,7 @@ if(PIGLIT_BUILD_DMA_BUF_TESTS) ${LIBDRM_INCLUDE_DIRS} ) + piglit_add_executable(ext_image_dma_buf_import-refcount refcount.c sample_common.c image_common.c) piglit_add_executable(ext_image_dma_buf_import-sample_yuv sample_yuv.c sample_common.c image_common.c) piglit_add_executable(ext_image_dma_buf_import-sample_rgb sample_rgb.c sample_common.c image_common.c) piglit_add_executable(ext_image_dma_buf_import-intel_external_sampler_with_dma_only intel_external_sampler_with_dma_only.c image_common.c) diff --git a/tests/spec/ext_image_dma_buf_import/refcount.c b/tests/spec/ext_image_dma_buf_import/refcount.c new file mode 100644 index ..5b14cdd766b1 --- /dev/null +++ b/tests/spec/ext_image_dma_buf_import/refcount.c @@ -0,0 +1,134 @@ +/* + * Copyright © 2016 Broadcom + * + * 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 "sample_common.h" +#include "image_common.h" + +/** + * @file refcount.c + * + * Creates two EGL images from an ARGB dmabuf, samples each one, + * destroys one, then tests that the other can still be sampled. + * + * This gets at a common refcounting bug in drivers: GEM returns the + * same handle for a given BO re-opened through dmabuf on the same + * device fd, but that GEM handle is not refcounted. The userspace + * driver needs to be sure that it's doing handle refcounting itself. + */ + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_es_version = 20; + config.window_visual = PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + static int fourcc = fourcc_code('A', 'R', '2', '4'); + int w = 2, h = 2; + const unsigned char src[] = { + 0x00, 0x00, 0xff, 0xff, + 0x00, 0xff, 0x00, 0xff, + 0xff, 0x00, 0x00, 0xff, + 0xff, 0xff, 0xff, 0xff + }; + int cpp = 4; + enum piglit_result res; + struct piglit_dma_buf *buf; + unsigned stride, offset; + int fd; + EGLImageKHR img1, img2; + GLuint tex1, tex2; + /* Scale up factor for drawing the texture to the screen. */ + int scale = 10; + int y_spacing = h * scale + 5; + int i; + GLubyte *expected; + + res = piglit_create_dma_buf(w, h, cpp, src, w * cpp, + &buf, &fd, &stride, &offset); + if (res != PIGLIT_PASS) + return res; + + res = egl_image_for_dma_buf_fd(dup(fd), fourcc, w, h, stride, offset, + &img1); + if (res != PIGLIT_PASS) + return res; + + res = egl_image_fo
[Piglit] [PATCH 6/8] sample_common: Separate drawing from destroying an image.
It's a weird pair of things to do in one helper function, and I need to be able to do them separately for the refcount test. --- .../spec/ext_image_dma_buf_import/sample_common.c | 30 -- .../spec/ext_image_dma_buf_import/sample_common.h | 3 +++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.c b/tests/spec/ext_image_dma_buf_import/sample_common.c index 9864ad038644..276d8a116a24 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_common.c +++ b/tests/spec/ext_image_dma_buf_import/sample_common.c @@ -84,20 +84,16 @@ texture_for_egl_image(EGLImageKHR img, GLuint *out_tex) return PIGLIT_PASS; } -static enum piglit_result -sample_and_destroy_img(unsigned w, unsigned h, EGLImageKHR img) +void +sample_tex(GLuint tex, unsigned w, unsigned h) { - GLuint prog, tex; - enum piglit_result res; - - res = texture_for_egl_image(img, &tex); - if (res != PIGLIT_PASS) - return res; + GLuint prog; prog = piglit_build_simple_program(vs_src, fs_src); glUseProgram(prog); + glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex); glUniform1i(glGetUniformLocation(prog, "sampler"), 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -108,11 +104,6 @@ sample_and_destroy_img(unsigned w, unsigned h, EGLImageKHR img) glDeleteProgram(prog); glUseProgram(0); - - glDeleteTextures(1, &tex); - eglDestroyImageKHR(eglGetCurrentDisplay(), img); - - return PIGLIT_PASS; } enum piglit_result @@ -207,6 +198,7 @@ sample_buffer(void *buf, int fd, int fourcc, unsigned w, unsigned h, { enum piglit_result res; EGLImageKHR img; + GLuint tex; res = egl_image_for_dma_buf_fd(fd, fourcc, w, h, stride, offset, &img); @@ -221,7 +213,17 @@ sample_buffer(void *buf, int fd, int fourcc, unsigned w, unsigned h, if (res != PIGLIT_PASS) return res; - return sample_and_destroy_img(w, h, img); + res = texture_for_egl_image(img, &tex); + if (res != PIGLIT_PASS) + goto destroy; + + sample_tex(tex, w, h); + +destroy: + glDeleteTextures(1, &tex); + eglDestroyImageKHR(eglGetCurrentDisplay(), img); + + return res; } enum piglit_result diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.h b/tests/spec/ext_image_dma_buf_import/sample_common.h index 75a5c59bdbc1..6964dc12f6e9 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_common.h +++ b/tests/spec/ext_image_dma_buf_import/sample_common.h @@ -42,4 +42,7 @@ egl_image_for_dma_buf_fd(int fd, int fourcc, int w, int h, enum piglit_result texture_for_egl_image(EGLImageKHR img, GLuint *out_tex); +void +sample_tex(GLuint tex, unsigned w, unsigned h); + #endif /* SAMPLE_COMMON_H */ -- 2.8.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/8] piglit-framework-gl: Use GBM on non-intel for dmabuf creation.
Previously the dmabuf tests only worked on the intel driver. However, thanks to the new GBM BO mapping interface by Rob Herring, we can make a generic framework for other drivers. --- CMakeLists.txt | 7 +- .../util/piglit-framework-gl/piglit_drm_dma_buf.c | 101 + 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e2abbad6730..55cfc4541df0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,6 +141,10 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(GBM_FOUND) set(PIGLIT_HAS_GBM True) add_definitions(-DPIGLIT_HAS_GBM) + if (GBM_VERSION VERSION_GREATER "11.1") + set(PIGLIT_HAS_GBM_BO_MAP True) + add_definitions(-DPIGLIT_HAS_GBM_BO_MAP) + endif() endif(GBM_FOUND) pkg_check_modules(WAYLAND QUIET wayland-client wayland-egl) @@ -177,7 +181,8 @@ ENDIF() # drm-prime arrived in that version. # if(LIBDRM_FOUND AND XCB_DRI2_FOUND AND - (LIBDRM_INTEL_VERSION VERSION_GREATER "2.4.37")) + ((LIBDRM_INTEL_VERSION VERSION_GREATER "2.4.37") OR + PIGLIT_HAS_GBM_BO_MAP)) set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID true) else() set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID false) diff --git a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c index 479592c3a4db..3d1dc2422b30 100644 --- a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c +++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c @@ -26,6 +26,9 @@ #ifdef HAVE_LIBDRM_INTEL #include #endif +#ifdef PIGLIT_HAS_GBM_BO_MAP +#include +#endif #include #include #include @@ -182,6 +185,97 @@ piglit_intel_buf_destroy(struct piglit_dma_buf *buf) } #endif /* HAVE_LIBDRM_INTEL */ +#ifdef PIGLIT_HAS_GBM_BO_MAP +static struct gbm_device * +piglit_gbm_get(void) +{ + const struct piglit_drm_driver *drv = piglit_drm_get_driver(); + static struct gbm_device *gbm = NULL; + + if (gbm) + return gbm; + + gbm = gbm_create_device(drv->fd); + + return gbm; +} + +static bool +piglit_gbm_buf_create(unsigned w, unsigned h, unsigned cpp, + const unsigned char *src_data, unsigned src_stride, + struct piglit_dma_buf *buf) +{ + unsigned i; + struct gbm_bo *bo; + uint32_t dst_stride; + struct gbm_device *gbm = piglit_gbm_get(); + void *dst_data; + void *map_data = NULL; + enum gbm_bo_format format; + + if (!gbm || h % 2) + return false; + + /* It would be nice if we took in a fourcc instead of a cpp */ + switch (cpp) { + case 1: + format = GBM_FORMAT_C8; + break; + case 4: + format = GBM_BO_FORMAT_ARGB; + break; + default: + fprintf(stderr, "Unknown cpp %d\n", cpp); + return false; + } + + bo = gbm_bo_create(gbm, w, h, format, GBM_BO_USE_RENDERING); + if (!bo) + return false; + + dst_data = gbm_bo_map(bo, 0, 0, w, h, GBM_BO_TRANSFER_WRITE, + &dst_stride, &map_data); + if (!dst_data) { + fprintf(stderr, "Failed to map GBM bo\n"); + gbm_bo_destroy(bo); + return NULL; + } + + for (i = 0; i < h; ++i) { + memcpy((char *)dst_data + i * dst_stride, + src_data + i * src_stride, + w * cpp); + } + gbm_bo_unmap(bo, map_data); + + buf->w = w; + buf->h = h; + buf->stride = dst_stride; + buf->fd = 0; + buf->priv = bo; + + return true; +} + +static bool +piglit_gbm_buf_export(struct piglit_dma_buf *buf) +{ + struct gbm_bo *bo = buf->priv; + + buf->fd = gbm_bo_get_fd(bo); + + return buf->fd >= 0; +} + +static void +piglit_gbm_buf_destroy(struct piglit_dma_buf *buf) +{ + struct gbm_bo *bo = buf->priv; + + gbm_bo_destroy(bo); +} +#endif /* PIGLIT_HAS_GBM_BO_MAP */ + static const struct piglit_drm_driver * piglit_drm_get_driver(void) { @@ -228,6 +322,13 @@ piglit_drm_get_driver(void) drv.destroy = piglit_intel_buf_destroy; } #endif +#ifdef PIGLIT_HAS_GBM_BO_MAP + else if (true) { + drv.create = piglit_gbm_buf_create; + drv.export = piglit_gbm_buf_export; + drv.destroy = piglit_gbm_buf_destroy; + } +#endif else { fprintf(stderr, "error: unrecognized DRM driver name %s\n", version->name); -- 2.8.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 7/8] sample_common: Move clearing the buffer to the callers.
I want to be able to sample more than one dmabuf in the scene. --- tests/spec/ext_image_dma_buf_import/sample_common.c | 2 -- tests/spec/ext_image_dma_buf_import/sample_rgb.c| 6 -- tests/spec/ext_image_dma_buf_import/sample_yuv.c| 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.c b/tests/spec/ext_image_dma_buf_import/sample_common.c index 276d8a116a24..076d6245edfa 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_common.c +++ b/tests/spec/ext_image_dma_buf_import/sample_common.c @@ -96,8 +96,6 @@ sample_tex(GLuint tex, unsigned w, unsigned h) glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex); glUniform1i(glGetUniformLocation(prog, "sampler"), 0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glViewport(0, 0, w, h); piglit_draw_rect_tex(-1, -1, 2, 2, 0, 0, 1, 1); diff --git a/tests/spec/ext_image_dma_buf_import/sample_rgb.c b/tests/spec/ext_image_dma_buf_import/sample_rgb.c index 420cc8c3111e..af9b39ff637b 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_rgb.c +++ b/tests/spec/ext_image_dma_buf_import/sample_rgb.c @@ -55,9 +55,11 @@ piglit_display(void) src[ 6], src[ 5], src[ 4], force_alpha_to_one ? 255 : src[ 7], src[10], src[ 9], src[ 8], force_alpha_to_one ? 255 : src[11], src[14], src[13], src[12], force_alpha_to_one ? 255 : src[15] }; - enum piglit_result res = dma_buf_create_and_sample_32bpp( - 2, 2, 4, fourcc, src); + enum piglit_result res; + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + res = dma_buf_create_and_sample_32bpp(2, 2, 4, fourcc, src); if (res != PIGLIT_PASS) return res; diff --git a/tests/spec/ext_image_dma_buf_import/sample_yuv.c b/tests/spec/ext_image_dma_buf_import/sample_yuv.c index a7b78f9de20a..1fb8de638831 100644 --- a/tests/spec/ext_image_dma_buf_import/sample_yuv.c +++ b/tests/spec/ext_image_dma_buf_import/sample_yuv.c @@ -106,6 +106,8 @@ piglit_display(void) return PIGLIT_SKIP; } + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + res = dma_buf_create_and_sample_32bpp(4, 4, 1, fourcc, t); if (res != PIGLIT_PASS) return res; -- 2.8.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] tex3d-maxsize: rewrite to be more robust and do more testing
On 07/20/2016 02:45 AM, Alejandro Piñeiro wrote: On 13/07/16 23:47, Brian Paul wrote: 1. It seems with NVIDIA's driver that using a proxy texture isn't a sure fire way to know that a given texture format/size can actually be created. Update the find_max_tex3d_size() function to actually try creating a texture with glTexImage3D/glTexStorage3D and see if it works. 2. Improve the speed of texture initialization by copying the first 3D slice to the other slices with glCopyImageSubData(). 3. Use glTexStorage3D when GL_ARB_texture_storage is supported. 4. In addition to GL_RGBA8, test GL_INTENSITY8 and GL_RGBA32F formats. 5. Before testing the largest possible texture, try a couple smaller sizes as a sanity check. 6. Loosen the piglit probe tolerance by one bit to account for inaccuracy caused by GL_NEAREST filtering. Tested with NVIDIA driver, VMware driver and llvmpipe. I just tested with intel i965 Haswell, and it also works fine. Looks good to me, but I have a small question below. --- tests/texturing/tex3d-maxsize.c | 285 +--- 1 file changed, 211 insertions(+), 74 deletions(-) diff --git a/tests/texturing/tex3d-maxsize.c b/tests/texturing/tex3d-maxsize.c index e168d14..60c9c63 100644 --- a/tests/texturing/tex3d-maxsize.c +++ b/tests/texturing/tex3d-maxsize.c @@ -30,31 +30,88 @@ PIGLIT_GL_TEST_CONFIG_BEGIN - config.supports_gl_compat_version = 10; + config.supports_gl_compat_version = 12; config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END -static const char *TestName = "tex3d-maxsize"; + +static GLint MaxSize; + + + +/** + * Compute size (in megabytes) of a texture of the given dimensions and + * internal format. + */ +static unsigned +tex_size(GLenum internalFormat, int width, int height, int depth) +{ + uint64_t sz; + + sz = (uint64_t) width * (uint64_t) height * (uint64_t) depth; + + switch (internalFormat) { + case GL_INTENSITY8: + sz *= 1; + break; + case GL_RGBA8: + sz *= 4; + break; + case GL_RGBA32F: + sz *= 16; + break; + default: + assert(!"Unexpected internalFormat"); + } + + return (unsigned) (sz / (uint64_t) (1024 * 1024)); +} + + +/** + * Allocate a 1-level 3D texture. + */ +static void +alloc_tex3d(GLenum target, GLenum internalFormat, + GLsizei width, GLsizei height, GLsizei depth) +{ + if (target == GL_TEXTURE_3D) { + glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } + + if (piglit_is_extension_supported("GL_ARB_texture_storage")) { + glTexStorage3D(target, 1, internalFormat, + width, height, depth); + } + else { + glTexImage3D(target, 0, internalFormat, +width, height, depth, 0, +GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } +} /* * Use proxy texture to find largest possible 3D texture size. */ static void -find_max_tex3d_size(GLint initSize, GLint *width, GLint *height, GLint *depth) +find_max_tex3d_size(GLenum internalFormat, + GLint initSize, GLint *width, GLint *height, GLint *depth) { GLint dim = 0, w, h, d, pw, ph, pd; + piglit_check_gl_error(GL_NO_ERROR); + w = h = d = initSize; while (w >= 1 && h >= 1 && d >= 1) { /* try proxy image */ const int level = 0; - glTexImage3D(GL_PROXY_TEXTURE_3D, level, GL_RGBA8, -w, h, d, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + alloc_tex3d(GL_PROXY_TEXTURE_3D, internalFormat, w, h, d); glGetTexLevelParameteriv(GL_PROXY_TEXTURE_3D, level, GL_TEXTURE_WIDTH, &pw); @@ -63,12 +120,40 @@ find_max_tex3d_size(GLint initSize, GLint *width, GLint *height, GLint *depth) glGetTexLevelParameteriv(GL_PROXY_TEXTURE_3D, level, GL_TEXTURE_DEPTH, &pd); + if (!piglit_check_gl_error(GL_NO_ERROR)) { + printf("Unexpected error during texture proxy test.\n"); + piglit_report_result(PIGLIT_FAIL); + } + if (pw == w && ph == h && pd == d) { - /* success! */ - *width = w; - *height = h; - *depth = d; - return; + /* this size should be supported, but test it to +* be sure. +*/ + GLuint tex; + GLenum err; + + /* Create a texture object for the non-proxy texture
Re: [Piglit] [PATCH 3/7] khr_texture_compression_astc: Loosen up the tolerence for sRGB tests
On Fri, Jul 22, 2016 at 02:01:33PM -0700, Anuj Phogat wrote: > This will allow testing sRGB formats which have known precision issues > in astcenc in void extent blocks. See khronos bug#11294 for details. > > Cc: Nanley Chery > Signed-off-by: Anuj Phogat This patch is, Reviewed-by: Nanley Chery > --- > .../khr_texture_compression_astc/khr_compressed_astc-miptree.c | 10 > ++ > 1 file changed, 10 insertions(+) > > diff --git > a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c > index 0f82695..f5f8988 100644 > --- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c > +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c > @@ -247,6 +247,16 @@ test_miptrees(void* input_type) > "GL_KHR_texture_compression_astc_hdr"); > const bool check_error = is_hdr_test && !has_hdr; > int block_dims; > + > + if (is_srgb_test) > + /* Loosen up the tolerence for sRGB tests. This will allow > testing > + * sRGB formats which have known precision issues in void extent > + * blocks. See khronos bug#11294 for details. > + */ > + piglit_set_tolerance_for_bits(7, 7, 7, 7); > + else > + piglit_set_tolerance_for_bits(8, 8, 8, 8); > + > for (block_dims = 0; block_dims < ARRAY_SIZE(block_dim_str); > ++block_dims) { > > /* Texture objects. */ > -- > 2.5.5 > > ___ > 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 1/7] khr_texture_compression_astc: Don't use Skip decoding for non-sRGB textures
On Fri, Jul 22, 2016 at 02:01:31PM -0700, Anuj Phogat wrote: > Skipping the decoding in non-sRGB cases isn't serving any purpose. > > Cc: Nanley Chery > Signed-off-by: Anuj Phogat This patch is, Reviewed-by: Nanley Chery > --- > .../khr_compressed_astc-miptree.c | 15 > ++- > 1 file changed, 2 insertions(+), 13 deletions(-) > > diff --git > a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c > index 6429c2e..0f82695 100644 > --- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c > +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c > @@ -151,7 +151,7 @@ load_texture(const char *dir1, const char *dir2, > } > > /** Compares the compressed texture against the decompressed texture */ > -bool draw_compare_levels(bool check_error, bool check_srgb, > +bool draw_compare_levels(bool check_error, > GLint level_pixel_size_loc, GLint pixel_offset_loc, > GLuint compressed_tex, GLuint decompressed_tex) > { > @@ -171,20 +171,12 @@ bool draw_compare_levels(bool check_error, bool > check_srgb, > > /* Draw miplevel of compressed texture. */ > glBindTexture(GL_TEXTURE_2D, compressed_tex); > - if (!check_srgb) > - glTexParameteri(GL_TEXTURE_2D, > - GL_TEXTURE_SRGB_DECODE_EXT, > - GL_SKIP_DECODE_EXT); > glUniform2f(pixel_offset_loc, x, y); > glDrawArrays(GL_TRIANGLE_FAN, 0, NUM_VERTICES); > > /* Draw miplevel of decompressed texture. */ > if (!check_error) { > glBindTexture(GL_TEXTURE_2D, decompressed_tex); > - if (!check_srgb) > - glTexParameteri(GL_TEXTURE_2D, > - GL_TEXTURE_SRGB_DECODE_EXT, > - GL_SKIP_DECODE_EXT); > glUniform2f(pixel_offset_loc, LEVEL0_WIDTH + x, y); > glDrawArrays(GL_TRIANGLE_FAN, 0, NUM_VERTICES); > } > @@ -244,9 +236,6 @@ test_miptrees(void* input_type) > "12x12" > }; > > - if (!is_srgb_test) > - piglit_require_extension("GL_EXT_texture_sRGB_decode"); > - > GLint pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset"); > GLint level_pixel_size_loc = glGetUniformLocation(prog, > "level_pixel_size"); > @@ -276,7 +265,7 @@ test_miptrees(void* input_type) > > /* Draw and compare each level of the two textures */ > glClear(GL_COLOR_BUFFER_BIT); > - if (!draw_compare_levels(check_error, is_srgb_test, > + if (!draw_compare_levels(check_error, > level_pixel_size_loc, > pixel_offset_loc, > tex_compressed, > -- > 2.5.5 > > ___ > 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
[Piglit] [Bug 97063] piglit_wfl_framework.c:287:4: error: void function 'parse_test_config' should not return a value [-Wreturn-type]
https://bugs.freedesktop.org/show_bug.cgi?id=97063 Vinson Lee changed: What|Removed |Added Keywords||bisected CC||jfons...@vmware.com --- Comment #1 from Vinson Lee --- 5e78dd43e4b9f7064b194dee1497d0eec7b58d0e is the first bad commit commit 5e78dd43e4b9f7064b194dee1497d0eec7b58d0e Author: Emil Velikov Date: Tue Mar 29 23:44:59 2016 +0100 util/wfl: fold make_config_attrib_list and make_context_description The latter tends to reverse what was done by the former, in order to produce a human-readable string. Signed-off-by: Emil Velikov Reviewed-by: Jose Fonseca :04 04 ce09f827510b07126574dad1b0fc2f74f046f875 672a93fd68e325e8c5e4192eb45823d6325461f0 M tests bisect run success -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Add glsl-1.20/execution/vsfs-unused-array-member.shader_test
From: Nicolai Hähnle Currently fails due to an error in Gallium st_glsl_to_tgsi. Observed in the game Overlord. --- I'm also going to send out a candidate fix to mesa-dev in a moment. .../execution/vsfs-unused-array-member.shader_test | 41 ++ 1 file changed, 41 insertions(+) create mode 100644 tests/spec/glsl-1.20/execution/vsfs-unused-array-member.shader_test diff --git a/tests/spec/glsl-1.20/execution/vsfs-unused-array-member.shader_test b/tests/spec/glsl-1.20/execution/vsfs-unused-array-member.shader_test new file mode 100644 index 000..821c57a --- /dev/null +++ b/tests/spec/glsl-1.20/execution/vsfs-unused-array-member.shader_test @@ -0,0 +1,41 @@ +# This test verifies that varyings are assigned correctly when a fragment +# shader doesn't read from all elements of a varying array. +# +# This used to fail due to a bug in st/mesa that was visible in Overlord. + +[require] +GLSL >= 1.20 + +[vertex shader] +#version 120 + +uniform vec4 data; + +varying vec4 a[3]; +varying float b; + +void main() +{ + a[0] = data.; + a[1] = data.; + a[2] = data.; + b = data.w; + gl_Position = gl_Vertex; +} + +[fragment shader] +#version 120 + +varying vec4 a[3]; +varying float b; + +void main() +{ + gl_FragColor = vec4(a[0].x, a[2].x, b, 1.0); +} + +[test] +uniform vec4 data 0.2 0.4 0.6 0.8 + +draw rect -1 -1 2 2 +probe all rgba 0.2 0.6 0.8 1.0 -- 2.7.4 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit