diff options
Diffstat (limited to 'gralloc4/src/hidl_common/MapperMetadata.cpp')
-rw-r--r-- | gralloc4/src/hidl_common/MapperMetadata.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gralloc4/src/hidl_common/MapperMetadata.cpp b/gralloc4/src/hidl_common/MapperMetadata.cpp index cb0a820..1123270 100644 --- a/gralloc4/src/hidl_common/MapperMetadata.cpp +++ b/gralloc4/src/hidl_common/MapperMetadata.cpp @@ -286,7 +286,8 @@ static std::vector<std::vector<PlaneLayoutComponent>> plane_layout_components_fr static android::status_t get_plane_layouts(const private_handle_t *handle, std::vector<PlaneLayout> *layouts) { const int num_planes = get_num_planes(handle); - int32_t format_index = get_format_index(handle->alloc_format & MALI_GRALLOC_INTFMT_FMT_MASK); + uint32_t base_format = handle->alloc_format & MALI_GRALLOC_INTFMT_FMT_MASK; + int32_t format_index = get_format_index(base_format); if (format_index < 0) { MALI_GRALLOC_LOGE("Negative format index in get_plane_layouts"); @@ -304,10 +305,11 @@ static android::status_t get_plane_layouts(const private_handle_t *handle, std:: int64_t sample_increment_in_bits = format_info.bpp[plane_index]; int64_t offset = handle->plane_info[plane_index].offset; - // TODO(b/182885532): Allocate the complete buffer contiguously - if (handle->plane_info[plane_index].fd_idx == plane_index) - { - offset = (int64_t)handle->bases[plane_index] - handle->bases[0]; + uint8_t fd_count = get_exynos_fd_count(base_format); + if (fd_count != 1) { + MALI_GRALLOC_LOGW("Offsets in plane layouts of multi-fd format (%s %" PRIu64 + ") are not reliable. This can lead to image corruption.", + format_name(base_format), handle->alloc_format); } PlaneLayout layout = {.offsetInBytes = offset, |