summaryrefslogtreecommitdiff
path: root/gralloc4/src
diff options
context:
space:
mode:
authorSean Callanan <spyffe@google.com>2021-06-03 18:02:48 +0000
committerSean Callanan <spyffe@google.com>2021-06-03 18:02:48 +0000
commitebd3fb3bf22df037fc2e037e4e38aba2aea2d92c (patch)
tree7393d2469f39a9f09dbbf9144d97461d15768ff9 /gralloc4/src
parente3a678186d514650cca2e0464c26cb10912e4e72 (diff)
downloadgchips-ebd3fb3bf22df037fc2e037e4e38aba2aea2d92c.tar.gz
Revert "gralloc4: limit 64-byte alignment to GPU+camera"
This reverts commit e3a678186d514650cca2e0464c26cb10912e4e72. Reason for revert: All IPs now allow 64-byte alignment. Bug: 188600370 Bug: 184793812 Bug: 185836979 Bug: 188226310 Change-Id: I2b9b20d2f3de7794590a613f40e173e263b487aa
Diffstat (limited to 'gralloc4/src')
-rw-r--r--gralloc4/src/core/mali_gralloc_bufferallocation.cpp39
1 files changed, 5 insertions, 34 deletions
diff --git a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
index d1bc0e1..7defdde 100644
--- a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
+++ b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
@@ -517,7 +517,7 @@ static void calc_allocation_size(const int width,
const format_info_t format,
const bool has_cpu_usage,
const bool has_hw_usage,
- const bool has_gpu_camera_usage,
+ const bool has_gpu_usage,
int * const pixel_stride,
uint64_t * const size,
plane_info_t plane_info[MAX_PLANES])
@@ -576,14 +576,13 @@ static void calc_allocation_size(const int width,
(format.is_rgb ? RGB_BYTE_ALIGN_DEFAULT : 0);
}
- if (has_gpu_camera_usage)
+ if (has_gpu_usage)
{
static_assert(is_power2(GPU_BYTE_ALIGN_DEFAULT),
- "GPU_BYTE_ALIGN_DEFAULT is not a power of 2");
+ "RGB_BYTE_ALIGN_DEFAULT is not a power of 2");
/*
* The GPU requires stricter alignment on YUV and raw formats.
- * Only enforce this for camera buffers for now (b/188226310).
*/
hw_align = std::max(hw_align, static_cast<uint16_t>(GPU_BYTE_ALIGN_DEFAULT));
}
@@ -743,33 +742,6 @@ static bool validate_format(const format_info_t * const format,
return true;
}
-static bool is_gpu_camera_usage(uint64_t usage)
-{
- /*
- * Conservatively report GPU+camera usage (requiring extra alignment) for
- * all cases where the GPU and the camera touch the same buffer, allowing
- * the use of OpenCL.
- *
- * MFC cannot use this alignment, so report an error and don't align if
- * video is involved.
- *
- * Note that HW_RENDER is not considered a "GPU usage" for this purpose
- * since render targets aren't subject to OpenCL alignment restrictions.
- */
-
- const bool is_gpu_usage = (usage & (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_GPU_DATA_BUFFER));
- const bool is_camera_usage = (usage & (GRALLOC_USAGE_HW_CAMERA_WRITE | GRALLOC_USAGE_HW_CAMERA_READ));
- const bool is_video_usage = (usage & (GRALLOC_USAGE_HW_VIDEO_DECODER | GRALLOC_USAGE_HW_VIDEO_ENCODER));
-
- if (is_gpu_usage && is_camera_usage && is_video_usage)
- {
- MALI_GRALLOC_LOGE("ERROR: camera, video AND gpu usages are specified for a buffer (%s). Stride will likely be wrong.", describe_usage(usage).c_str());
- return false;
- }
-
- return is_gpu_usage && is_camera_usage;
-}
-
static int prepare_descriptor_exynos_formats(
buffer_descriptor_t *bufDescriptor,
format_info_t format_info)
@@ -918,7 +890,7 @@ static int prepare_descriptor_exynos_formats(
plane_info_t *plane = bufDescriptor->plane_info;
- if (is_gpu_camera_usage(usage))
+ if (usage & (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_GPU_DATA_BUFFER))
{
if (is_sbwc_format(format))
{
@@ -931,7 +903,6 @@ static int prepare_descriptor_exynos_formats(
{
/*
* The GPU requires stricter alignment on YUV formats.
- * Only enforce this for camera buffers for now (b/188226310).
*/
for (int pidx = 0; pidx < plane_count; ++pidx)
{
@@ -1055,7 +1026,7 @@ int mali_gralloc_derive_format_and_size(buffer_descriptor_t * const bufDescripto
formats[format_idx],
usage & (GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK),
usage & ~(GRALLOC_USAGE_PRIVATE_MASK | GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK),
- is_gpu_camera_usage(usage),
+ usage & (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_GPU_DATA_BUFFER),
&bufDescriptor->pixel_stride,
&bufDescriptor->alloc_sizes[0],
bufDescriptor->plane_info);