[Piglit] [v7 06/12] tests: spec: EXT_image_dma_buf_import missing attributes

Chad Versace chad.versace at linux.intel.com
Mon Jun 3 17:56:57 PDT 2013


On 05/28/2013 02:51 AM, Topi Pohjolainen wrote:
> v2:
>     - compile only on platforms that have drm (Eric)
>     - use standard drm definitions for fourcc instead of duplicated
>       local (Daniel, Eric)
>     - removed irrelevant quotes of the spec (Eric)
>     - rewritten attribute test vector using a full set which is then
>       trimmed down in individual tests (Eric)
>     - check that EGL did not take the ownership and revise the
>       explanation for it (Eric)
>     - use helper variables for width, height and cpp instead
>       of repeating the magic numbers over and over again (Eric)
>     - use the stride and offset provided by the framework instead of
>       hardcoded assumed values (Eric)
>
> v3 (Eric):
>     - use properly linked egl-extension calls
>
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
>   .../ext_image_dma_buf_import/CMakeLists.gles1.txt  |   1 +
>   .../ext_image_dma_buf_import/missing_attributes.c  | 163 +++++++++++++++++++++
>   2 files changed, 164 insertions(+)
>   create mode 100644 tests/spec/ext_image_dma_buf_import/missing_attributes.c


> +#include "piglit-util-egl.h"
> +#define EGL_EGLEXT_PROTOTYPES 1

Prototypes again.



> +enum piglit_result
> +piglit_display(void)
> +{
> +	const unsigned w = 2;
> +	const unsigned h = 2;
> +	const unsigned cpp = 2;
> +	const unsigned char pixels[w * h * cpp];
> +	EGLint all[2 * NUM_MANDATORY_ATTRS];
> +	EGLint missing[2 * (NUM_MANDATORY_ATTRS - 1) + 1];
> +	struct piglit_dma_buf *buf;
> +	unsigned stride;
> +	unsigned offset;
> +	int fd;
> +	enum piglit_result res;
> +	bool pass;
> +
> +	res = piglit_create_dma_buf(w, h, cpp, pixels, w * cpp,
> +				&buf, &fd, &stride, &offset);
> +	if (res != PIGLIT_PASS)
> +		return res;
> +
> +	fill_full_set(w, h, fd, offset, stride, all);
> +
> +	fill_one_missing(all, missing, EGL_HEIGHT);
> +	pass = test_missing(fd, missing);
              ^^^
Please initialize 'pass = true' and use '&=' here. Otherwise,
this just looks buggy because it doesn't follow the overall pattern
in this function.

> +
> +	fill_one_missing(all, missing, EGL_WIDTH);
> +	pass &= test_missing(fd, missing);
> +
> +	fill_one_missing(all, missing, EGL_LINUX_DRM_FOURCC_EXT);
> +	pass &= test_missing(fd, missing);
> +
> +	fill_one_missing(all, missing, EGL_DMA_BUF_PLANE0_FD_EXT);
> +	pass &= test_missing(fd, missing);
> +
> +	fill_one_missing(all, missing, EGL_DMA_BUF_PLANE0_OFFSET_EXT);
> +	pass &= test_missing(fd, missing);
> +
> +	fill_one_missing(all, missing, EGL_DMA_BUF_PLANE0_PITCH_EXT);
> +	pass &= test_missing(fd, missing);
> +
> +	/**
> +	 * EGL stack can claim the ownership of the file descriptor only when it
> +	 * succeeds. Close the file descriptor here and check that it really
> +	 * wasn't closed by EGL.
> +	 */
> +	pass &= (close(fd) == 0);
> +
> +	piglit_destroy_dma_buf(buf);
> +
> +	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}



More information about the Piglit mailing list