piglit_drm_dma_buf: fix the stride

Submitted by Marek Olšák on June 17, 2017, 1:38 p.m.

Details

Message ID 1497706717-26911-1-git-send-email-maraeo@gmail.com
State New
Headers show
Series "piglit_drm_dma_buf: fix the stride" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Marek Olšák June 17, 2017, 1:38 p.m.
From: Marek Olšák <marek.olsak@amd.com>

dst_stride is from gbm_bo_map (CPU mapping), but we need the real stride.
This fixes piglit DMABUF tests with tiled surfaces.
---
 tests/util/piglit-framework-gl/piglit_drm_dma_buf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

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 c3225c3..713763d 100644
--- a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
+++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
@@ -323,21 +323,21 @@  piglit_gbm_buf_create(unsigned w, unsigned h, unsigned fourcc,
 			      &dst_stride, &map_data);
 	if (!dst_data) {
 		fprintf(stderr, "Failed to map GBM bo\n");
 		gbm_bo_destroy(bo);
 		return NULL;
 	}
 
 	buf->w = w;
 	buf->h = h;
 	buf->offset[0] = 0;
-	buf->stride[0] = dst_stride;
+	buf->stride[0] = gbm_bo_get_stride(bo);
 	buf->fd = -1;
 	buf->priv = bo;
 
 	for (i = 0; i < h; ++i) {
 		memcpy((char *)dst_data + i * dst_stride,
 		       src_data + i * src_stride,
 		       w * cpp);
 	}
 
 	switch (fourcc) {

Comments

Marek Olšák <maraeo@gmail.com> writes:

> From: Marek Olšák <marek.olsak@amd.com>
>
> dst_stride is from gbm_bo_map (CPU mapping), but we need the real stride.
> This fixes piglit DMABUF tests with tiled surfaces.

If you also update the dst_strides used in buf->offset/stride fields of
the switch (fourcc) down below, you can add:

Reviewed-by: Eric Anholt <eric@anholt.net>
On Mon, Jun 19, 2017 at 6:06 PM, Eric Anholt <eric@anholt.net> wrote:
> Marek Olšák <maraeo@gmail.com> writes:
>
>> From: Marek Olšák <marek.olsak@amd.com>
>>
>> dst_stride is from gbm_bo_map (CPU mapping), but we need the real stride.
>> This fixes piglit DMABUF tests with tiled surfaces.
>
> If you also update the dst_strides used in buf->offset/stride fields of
> the switch (fourcc) down below, you can add:

I'll send out v2. It's more involved. I can fix some obvious things,
but I can't fix the function completely. The whole file assumes a
linear layout with an unaligned height, which is rare even for a
linear layout.

Marek