summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuK1337 <priv.luk@gmail.com>2019-10-16 14:50:14 +0200
committeralk3pInjection <webmaster@raspii.tech>2022-09-05 22:00:03 +0800
commit82dc4153e1649971f67b167829c02c5581305c58 (patch)
tree4367d887d7301dd58017b91ce53eaba9906c5aa5
parentb12b88a506bb085624a6b42495a59d8f0adc6842 (diff)
gralloc: Add option for unaligned NV21_ZSL pixel format
* Not sure why this is a thing but on some devices (eg. Samsung Galaxy Tab S5e) aligning NV21_ZSL to 64 results in invalid width and height. Change-Id: I8611752798a8c66ba55d52d826aa532fd76abe33
-rw-r--r--gralloc/Android.mk4
-rw-r--r--gralloc/gr_utils.cpp2
2 files changed, 6 insertions, 0 deletions
diff --git a/gralloc/Android.mk b/gralloc/Android.mk
index 4dffadea..c3f41337 100644
--- a/gralloc/Android.mk
+++ b/gralloc/Android.mk
@@ -46,6 +46,10 @@ else ifeq ($(TARGET_USES_YCRCB_VENUS_CAMERA_PREVIEW),true)
LOCAL_CFLAGS += -DUSE_YCRCB_CAMERA_PREVIEW_VENUS
endif
+ifeq ($(TARGET_USES_UNALIGNED_NV21_ZSL),true)
+ LOCAL_CFLAGS += -DUSE_UNALIGNED_NV21_ZSL
+endif
+
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := gr_utils.cpp gr_adreno_info.cpp
include $(BUILD_SHARED_LIBRARY)
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp
index 20508344..d157ad61 100644
--- a/gralloc/gr_utils.cpp
+++ b/gralloc/gr_utils.cpp
@@ -1064,8 +1064,10 @@ void GetAlignedWidthAndHeight(const BufferInfo &info, unsigned int *alignedw,
case HAL_PIXEL_FORMAT_RAW_OPAQUE:
break;
case HAL_PIXEL_FORMAT_NV21_ZSL:
+#ifndef USE_UNALIGNED_NV21_ZSL
aligned_w = ALIGN(width, 64);
aligned_h = ALIGN(height, 64);
+#endif
break;
case HAL_PIXEL_FORMAT_NV12_HEIF:
aligned_w = INT(VENUS_Y_STRIDE(COLOR_FMT_NV12_512, width));