[Piglit] [PATCH] framework: stop copying dma buffer source padding

Topi Pohjolainen topi.pohjolainen at intel.com
Thu Oct 10 10:15:24 CEST 2013


Fixes a bug spotted by Chad.

The initial support allowed the stride of the source content in
the dma buffer creation to have some padding but it had to be
less than the padding in the target dma buffer being created.

Moreover the implementation also unnecessarily copied any
padding present in the source to the destination. By copying
only the actual pixel values one not only fixes this but also
allows the source to have greater padding than the destination.

CC: Chad Versace <chad.versace at linux.intel.com>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 tests/util/piglit-framework-gl/piglit_drm_dma_buf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 cc6c366..70b4eb0 100644
--- a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
+++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
@@ -145,7 +145,7 @@ piglit_intel_buf_create(unsigned w, unsigned h, unsigned cpp,
 	unsigned stride = ALIGN(w * cpp, 4);
 	drm_intel_bufmgr *mgr = piglit_intel_bufmgr_get();
 
-	if (!mgr || src_stride > stride || h % 2)
+	if (!mgr || h % 2)
 		return false;
 
 	bo = drm_intel_bo_alloc(mgr, "piglit_dma_buf", h * stride, 4096);
@@ -153,7 +153,7 @@ piglit_intel_buf_create(unsigned w, unsigned h, unsigned cpp,
 		return false;
 
 	for (i = 0; i < h; ++i) {
-		if (drm_intel_bo_subdata(bo, i * stride, src_stride,
+		if (drm_intel_bo_subdata(bo, i * stride, w * cpp,
 			src_data + i * src_stride)) {
 			drm_intel_bo_unreference(bo);
 			return false;
-- 
1.8.3.1



More information about the Piglit mailing list