return ALIGN(macrotile_width * macrotile_height, PLANE_SIZE_ALIGN);
}
+static unsigned get_pitch_alignment(struct bo *bo)
+{
+ switch (bo->meta.format) {
+ case DRM_FORMAT_NV12:
+ return VENUS_STRIDE_ALIGN;
+ case DRM_FORMAT_YVU420:
+ case DRM_FORMAT_YVU420_ANDROID:
+ /* TODO other YUV formats? */
+ /* Something (in the video stack?) assumes the U/V planes can use
+ * half the pitch as the Y plane.. to componsate, double the
+ * alignment:
+ */
+ return 2 * DEFAULT_ALIGNMENT;
+ default:
+ return DEFAULT_ALIGNMENT;
+ }
+}
+
static void msm_calculate_layout(struct bo *bo)
{
uint32_t width, height;
} else {
uint32_t stride, alignw, alignh;
- alignw = ALIGN(width, DEFAULT_ALIGNMENT);
+ alignw = ALIGN(width, get_pitch_alignment(bo));
/* HAL_PIXEL_FORMAT_YV12 requires that the buffer's height not be aligned.
DRM_FORMAT_R8 of height one is used for JPEG camera output, so don't
height align that. */