diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2013-04-17 19:18:02 +0000 |
---|---|---|
committer | Jerome Glisse <jglisse@redhat.com> | 2013-04-18 14:52:00 -0400 |
commit | c2988eb211ecad2db60081f1000cf19b350703db (patch) | |
tree | 8f270951131ac0a01ec00c6b875a32abb49fc405 | |
parent | aa4afdf0b3be20aa6037b64f90983ea0146b2893 (diff) | |
download | libdrm-c2988eb211ecad2db60081f1000cf19b350703db.tar.gz libdrm-c2988eb211ecad2db60081f1000cf19b350703db.tar.bz2 libdrm-c2988eb211ecad2db60081f1000cf19b350703db.zip |
modetest: Fix pitches, somewhat
libkms only has the xrgb8888 format, so we're overallocating the bo by
quite a lot in some cases. But we still need to get the pitch from the
libkms since it's the driver that decides how to align it.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | tests/modetest/buffers.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c index 50863811..00269e8d 100644 --- a/tests/modetest/buffers.c +++ b/tests/modetest/buffers.c @@ -945,9 +945,9 @@ create_test_buffer(struct kms_driver *kms, unsigned int format, case DRM_FORMAT_VYUY: case DRM_FORMAT_YUYV: case DRM_FORMAT_YVYU: - pitches[0] = width * 2; offsets[0] = 0; kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]); + kms_bo_get_prop(bo, KMS_PITCH, &pitches[0]); planes[0] = virtual; break; @@ -956,11 +956,11 @@ create_test_buffer(struct kms_driver *kms, unsigned int format, case DRM_FORMAT_NV21: case DRM_FORMAT_NV16: case DRM_FORMAT_NV61: - pitches[0] = width; offsets[0] = 0; kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]); - pitches[1] = width; - offsets[1] = width * height; + kms_bo_get_prop(bo, KMS_PITCH, &pitches[0]); + pitches[1] = pitches[0]; + offsets[1] = pitches[0] * height; kms_bo_get_prop(bo, KMS_HANDLE, &handles[1]); planes[0] = virtual; @@ -968,14 +968,14 @@ create_test_buffer(struct kms_driver *kms, unsigned int format, break; case DRM_FORMAT_YVU420: - pitches[0] = width; offsets[0] = 0; kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]); - pitches[1] = width / 2; - offsets[1] = width * height; + kms_bo_get_prop(bo, KMS_PITCH, &pitches[0]); + pitches[1] = pitches[0] / 2; + offsets[1] = pitches[0] * height; kms_bo_get_prop(bo, KMS_HANDLE, &handles[1]); - pitches[2] = width / 2; - offsets[2] = offsets[1] + (width * height) / 4; + pitches[2] = pitches[1]; + offsets[2] = offsets[1] + pitches[1] * height / 2; kms_bo_get_prop(bo, KMS_HANDLE, &handles[2]); planes[0] = virtual; @@ -986,29 +986,15 @@ create_test_buffer(struct kms_driver *kms, unsigned int format, case DRM_FORMAT_RGB565: case DRM_FORMAT_ARGB1555: case DRM_FORMAT_XRGB1555: - pitches[0] = width * 2; - offsets[0] = 0; - kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]); - - planes[0] = virtual; - break; - case DRM_FORMAT_BGR888: case DRM_FORMAT_RGB888: - pitches[0] = width * 3; - offsets[0] = 0; - kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]); - - planes[0] = virtual; - break; - case DRM_FORMAT_ARGB8888: case DRM_FORMAT_BGRA8888: case DRM_FORMAT_XRGB8888: case DRM_FORMAT_BGRX8888: - pitches[0] = width * 4; offsets[0] = 0; kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]); + kms_bo_get_prop(bo, KMS_PITCH, &pitches[0]); planes[0] = virtual; break; |