[igt-dev] [PATCH i-g-t 3/3] tests/kms_modes_available_crc: Fix NV12 failure

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Fri Jan 18 08:58:18 UTC 2019


The size of the UV is not calculated correctly - height is not tile
aligned. Make use the stride and offset values intilized in the
previous patch to calculate plane size. The next step would be to rewrite
test to make use of the library functions, but for now this should fix
NV12.

Cc: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
---
 tests/kms_available_modes_crc.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/tests/kms_available_modes_crc.c b/tests/kms_available_modes_crc.c
index fbc40297..c0f33f3c 100644
--- a/tests/kms_available_modes_crc.c
+++ b/tests/kms_available_modes_crc.c
@@ -197,17 +197,18 @@ static bool fill_in_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
 		writesize = data->size;
 		break;
 	case BYTES_PP_1:
-		memset((void*)data->buf, fillers[i].value, data->size);
+		memset((void *)data->buf, fillers[i].value, data->size);
 		writesize = data->size;
 		break;
 	case NV12:
-		memset((void*)data->buf, fillers[i].value&0xff,
-		       data->size);
+		memset((void *)data->buf, fillers[i].value&0xff,
+		       data->fb.offsets[1]);
 
-		memset((void*)(data->buf+data->size),
-		       (fillers[i].value>>8)&0xff, data->size/2);
+		memset((void *)(data->buf+data->fb.offsets[1]),
+		       (fillers[i].value>>8)&0xff,
+		       data->size - data->fb.offsets[1]);
 
-		writesize = data->size+data->size/2;
+		writesize = data->size;
 		break;
 	case P010:
 		ptemp_16_buf = (unsigned short*)data->buf;
@@ -302,6 +303,10 @@ static bool setup_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
 		data->fb.offsets[1] = data->size;
 		data->fb.strides[1] = data->fb.strides[0];
 		gemsize = data->size * 2;
+
+		if (fillers[i].bpp == NV12)
+			data->size += data->fb.strides[1] * ALIGN(h/2, tile_height);
+
 		num_planes = 2;
 	}
 
-- 
2.14.1



More information about the igt-dev mailing list