summaryrefslogtreecommitdiff
path: root/gralloc/gr_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gralloc/gr_utils.cpp')
-rw-r--r--gralloc/gr_utils.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp
index d91da928..dc64b584 100644
--- a/gralloc/gr_utils.cpp
+++ b/gralloc/gr_utils.cpp
@@ -218,6 +218,21 @@ uint32_t GetDataAlignment(int format, uint64_t usage) {
return align;
}
+bool IsGPUFlagSupported(uint64_t usage) {
+ bool ret = true;
+ if ((usage & BufferUsage::GPU_MIPMAP_COMPLETE)) {
+ ALOGE("GPU_MIPMAP_COMPLETE not supported");
+ ret = false;
+ }
+
+ if ((usage & BufferUsage::GPU_CUBE_MAP)) {
+ ALOGE("GPU_CUBE_MAP not supported");
+ ret = false;
+ }
+
+ return ret;
+}
+
// Returns the final buffer size meant to be allocated with ion
unsigned int GetSize(const BufferInfo &info, unsigned int alignedw, unsigned int alignedh) {
unsigned int size = 0;
@@ -226,6 +241,11 @@ unsigned int GetSize(const BufferInfo &info, unsigned int alignedw, unsigned int
int height = info.height;
uint64_t usage = info.usage;
+ if (!IsGPUFlagSupported(usage)) {
+ ALOGE("Unsupported GPU usage flags present 0x%" PRIx64, usage);
+ return 0;
+ }
+
if (IsUBwcEnabled(format, usage)) {
size = GetUBwcSize(width, height, format, alignedw, alignedh);
} else if (IsUncompressedRGBFormat(format)) {
@@ -546,6 +566,11 @@ bool IsUBwcSupported(int format) {
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
case HAL_PIXEL_FORMAT_RGBA_1010102:
case HAL_PIXEL_FORMAT_RGBX_1010102:
+ case HAL_PIXEL_FORMAT_DEPTH_16:
+ case HAL_PIXEL_FORMAT_DEPTH_24:
+ case HAL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
+ case HAL_PIXEL_FORMAT_DEPTH_32F:
+ case HAL_PIXEL_FORMAT_STENCIL_8:
return true;
default:
break;