diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-06-14 22:57:49 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-06-27 10:01:16 +0200 |
commit | 33f1dc43064cd524e5e03230c80570ac212c2d7c (patch) | |
tree | 39687907a952a03cf971bdd8174a0791ee79149d /tests/modetest | |
parent | d7c1383fed831af2a690379c14a910ad0210387a (diff) |
modetest: Allocate NV buffers large enough for the two planes
Multiple the image height by 1.5 for NV12/NV21 and by 2 for NV16/NV61 to
make room for the chroma plane.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'tests/modetest')
-rw-r--r-- | tests/modetest/buffers.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c index 1575bf67..8206ce31 100644 --- a/tests/modetest/buffers.c +++ b/tests/modetest/buffers.c @@ -1038,12 +1038,29 @@ create_test_buffer(struct kms_driver *kms, unsigned int format, unsigned int handles[4], unsigned int pitches[4], unsigned int offsets[4], enum fill_pattern pattern) { + unsigned int virtual_height; struct kms_bo *bo; void *planes[3] = { 0, }; void *virtual; int ret; - bo = allocate_buffer(kms, width, height, &pitches[0]); + switch (format) { + case DRM_FORMAT_NV12: + case DRM_FORMAT_NV21: + virtual_height = height * 3 / 2; + break; + + case DRM_FORMAT_NV16: + case DRM_FORMAT_NV61: + virtual_height = height * 2; + break; + + default: + virtual_height = height; + break; + } + + bo = allocate_buffer(kms, width, virtual_height, &pitches[0]); if (!bo) return NULL; |