[Piglit] [PATCH] dmabuf: fix YUV tests for drivers other than intel

Eric Anholt eric at anholt.net
Thu Sep 8 21:51:42 UTC 2016

Rob Clark <robdclark at gmail.com> writes:

> Ok, so the basic problem with the YUV tests is that they currently
> completely ignore driver/hw pitch requirements, since the code that
> allocates the buffer doesn't know the pixel format, only the 'cpp'.
> The yuv test creates a small 4x4 yuv eglimage.  If, say, the hardware
> requires the pitch to be aligned to, say, 32pixels, everything is fine
> for the Y plane, but the subsampled U/V or U+V plane has half as many
> pixels.  (This did help me catch a bug in driver, not rejecting the
> dmabuf import with invalid pitch, but that doesn't help to get the
> piglit tests running.)
> The best approach I could come up with to fix this is to pass the
> fourcc all the way down to the code that creates the dmabuf (and copies
> src data into the dmabuf).  Unfortunately this makes the patch a bit
> bigger than I was hoping, and not really sure a good way to split it
> up.
> This is tested on i965 (with the intel dma-buf backend) and freedreno
> (with the gbm dma-buf backend).  In the gbm case, it requires new
> gbm format values for R8 and GR88, which is on mesa master as of
> this morning.  (So I bumped the gbm version dependency to 12.1.)

> diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
> index 9748ddf..c7c91fe 100644
> --- a/tests/util/piglit-framework-gl.c
> +++ b/tests/util/piglit-framework-gl.c
> @@ -265,22 +265,15 @@ piglit_set_reshape_func(void (*func)(int w, int h))
>  		gl_fw->set_reshape_func(gl_fw, func);
>  }
> -
>  enum piglit_result
> -piglit_create_dma_buf(unsigned w, unsigned h, unsigned cpp,
> +piglit_create_dma_buf(unsigned w, unsigned h, unsigned fourcc,
>  		      const void *src_data, unsigned src_stride,
> -		      struct piglit_dma_buf **buf, int *fd,
> -		      unsigned *stride, unsigned *offset)
> +		      struct piglit_dma_buf **buf)
>  {
> -	*fd = 0;
> -	*stride = 0;
> -	*offset = 0;
> -
>  	if (!gl_fw->create_dma_buf)
>  		return PIGLIT_SKIP;
> -	return gl_fw->create_dma_buf(w, h, cpp, src_data, src_stride, buf, fd,
> -				stride, offset);
> +	return gl_fw->create_dma_buf(w, h, fourcc, src_data, buf);
>  }

You've dropped src_stride from the backend, but not from this function's

Seems like while you're changing the signature of this, you should drop
the dead src_stride, too.

I'm pretty into this patch overall, though.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20160908/b249dcf5/attachment.sig>

More information about the Piglit mailing list