[Piglit] [v5 04/12] tests: spec: EXT_image_dma_buf_import invalid hints

Eric Anholt eric at anholt.net
Fri May 3 14:23:47 PDT 2013


Topi Pohjolainen <topi.pohjolainen at intel.com> writes:

> diff --git a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt
> new file mode 100644
> index 0000000..2499554
> --- /dev/null
> +++ b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt
> @@ -0,0 +1,15 @@
> +#add_definitions(-DSOURCE_DIR="${piglit_SOURCE_DIR}/")
> +
> +include_directories(
> +	${OPENGL_INCLUDE_PATH}
> +	)
> +
> +link_libraries(
> +	${OPENGL_gles1_LIBRARY}
> +	${OPENGL_egl_LIBRARY}
> +	piglitutil_gles1
> +	)
> +
> +piglit_add_executable(ext_image_dma_buf_import-invalid_hints invalid_hints.c)

I'd like to see conditional compile on HAVE_LIBDRM and no
ext_image_dma_buf_fourcc.h.

> +/**
> + * One re-uses the buffer for all the tests. Each test is expected to fail
> + * meaning that the ownership is not transferred to the EGL in any point.
> + */
> +enum piglit_result
> +piglit_display(void)
> +{
> +	const unsigned char pixels[2 * 2 * 4];
> +	struct piglit_dma_buf *buf;
> +	unsigned stride;
> +	unsigned offset;
> +	int fd;
> +	bool pass;
> +	enum piglit_result res;
> +
> +	res = piglit_create_dma_buf(2, 2, 4, pixels, 2 * 4, &buf, &fd, &stride,
> +				&offset);
> +	if (res != PIGLIT_PASS)
> +		return res;
> +
> +	pass = test_invalid_hint(fd, 2, 2, stride, offset,
> +			EGL_YUV_COLOR_SPACE_HINT_EXT, 0);
> +	pass = test_invalid_hint(fd, 2, 2, stride, offset,
> +			EGL_SAMPLE_RANGE_HINT_EXT, 0) && pass;
> +	pass = test_invalid_hint(fd, 2, 2, stride, offset,
> +			EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT, 0) && pass;
> +	pass = test_invalid_hint(fd, 2, 2, stride, offset,
> +			EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT, 0) && pass;
> +
> +	piglit_destroy_dma_buf(buf);
> +
> +	/* Close the file descriptor also, EGL does not have ownership */
> +	close(fd);

Check that you don't get EBADF here to make sure that EGL didn't
accidentally steal ownership in its error path?

Either way, if the header thing is fixed,

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130503/8ca3f9f4/attachment.pgp>


More information about the Piglit mailing list