On 05/03/2013 04:26 AM, Topi Pohjolainen wrote:
Create a planar image where all the planes are located in the
same dma buffer, just in different offsets.

Signed-off-by: Topi Pohjolainen <[email protected]>
---
  .../ext_image_dma_buf_import/CMakeLists.gles1.txt  |   1 +
  .../create_yuv420_same_fd.c                        | 135 +++++++++++++++++++++
  2 files changed, 136 insertions(+)
  create mode 100644 tests/spec/ext_image_dma_buf_import/create_yuv420_same_fd.c

[snip]

+enum piglit_result
+piglit_display(void)
+{
+       /**
+        * All three planes for 4x4 can be represented using six four-byte rows,
+        * first four representing 4x4 and the two following 2x2 subsampled
+        * chroma planes each.
+        */
+       const unsigned char pixels[4 * 4 * 1 + 2 * 2 * 1 + 2 * 2 * 1];
+       struct piglit_dma_buf *buf;
+       unsigned stride;
+       unsigned offset;
+       int fd;
+       enum piglit_result res;
+
+       res = piglit_create_dma_buf(4, 6, 1, pixels, 4 * 1, &buf, &fd,
+                               &stride, &offset);
+       if (res != PIGLIT_PASS) {
+               fprintf(stderr, "buffer creation failed\n");
+               return res;
+       }
+
+       return test_create_and_destroy(4, 4, buf, fd, 4, 2, 2,
+                       offset,
+                       offset + 4 * 4 * 1,
+                       offset + 4 * 4 * 1 + 2 * 2 * 1) ?
+                       PIGLIT_PASS : PIGLIT_FAIL;

The 'return' statement is difficult to read. It looks like it returns the value
of test_create_and_destroy(), but on closer inspection I see it converts that
to a piglit_result. Please simplify that with an 'if' statement or a temporary
result variable.

Other than that, the test looks good.

[snip]

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to