diff options
author | Arun Kumar K.R <akumarkr@codeaurora.org> | 2018-06-15 16:31:23 +0530 |
---|---|---|
committer | Janis Danisevskis <jdanis@google.com> | 2018-06-15 16:03:41 -0700 |
commit | c977cea8feef50579b79a774bb18a150ffc75dde (patch) | |
tree | 656c95e1c856507ac2cc16153cf4b3b74014a8af /gralloc | |
parent | 483a3e6f8a103ee573e89eb3febf758475b97fc4 (diff) | |
download | display-c977cea8feef50579b79a774bb18a150ffc75dde.tar.gz |
Gralloc: Do not use adreno for secure camera and secure display
Avoid using adreno size calculations for secure camera and
secure display buffers.
Bug: 110055706
Test: adb shell keystore_cli_v2 confirmation --prompt_text=testfdasdf --extra_data=aa --locale=en
Change-Id: Ib61d893cbcc57b10070250a63b8fa79106de4af3
Acked-by: Saurabh Dubey <sdubey@codeaurora.org>
Diffstat (limited to 'gralloc')
-rw-r--r-- | gralloc/gr_buf_mgr.cpp | 2 | ||||
-rw-r--r-- | gralloc/gr_utils.cpp | 13 | ||||
-rw-r--r-- | gralloc/gr_utils.h | 1 |
3 files changed, 15 insertions, 1 deletions
diff --git a/gralloc/gr_buf_mgr.cpp b/gralloc/gr_buf_mgr.cpp index e7c7f0f4..63de7b71 100644 --- a/gralloc/gr_buf_mgr.cpp +++ b/gralloc/gr_buf_mgr.cpp @@ -326,7 +326,7 @@ Error BufferManager::AllocateBuffer(const BufferDescriptor &descriptor, buffer_h bool use_adreno_for_size = false; GraphicsMetadata graphics_metadata = {}; - use_adreno_for_size = ((buffer_type != BUFFER_TYPE_VIDEO) && GetAdrenoSizeAPIStatus()); + use_adreno_for_size = CanUseAdrenoForSize(buffer_type, usage); if (use_adreno_for_size) { GetGpuResourceSizeAndDimensions(info, &size, &alignedw, &alignedh, &graphics_metadata); } else { diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp index 3525403e..4e12e01d 100644 --- a/gralloc/gr_utils.cpp +++ b/gralloc/gr_utils.cpp @@ -982,6 +982,19 @@ void GetGpuResourceSizeAndDimensions(const BufferInfo &info, unsigned int *size, *size = adreno_mem_info->AdrenoGetAlignedGpuBufferSize(graphics_metadata->data); } +bool CanUseAdrenoForSize(int buffer_type, uint64_t usage) { + if (buffer_type == BUFFER_TYPE_VIDEO || !GetAdrenoSizeAPIStatus()) { + return false; + } + + if ((usage & BufferUsage::PROTECTED) && ((usage & BufferUsage::CAMERA_OUTPUT) || + (usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY))) { + return false; + } + + return true; +} + bool GetAdrenoSizeAPIStatus() { AdrenoMemInfo* adreno_mem_info = AdrenoMemInfo::GetInstance(); if (adreno_mem_info) { diff --git a/gralloc/gr_utils.h b/gralloc/gr_utils.h index fa628717..c6ae2e4d 100644 --- a/gralloc/gr_utils.h +++ b/gralloc/gr_utils.h @@ -106,6 +106,7 @@ uint32_t GetDataAlignment(int format, uint64_t usage); void GetGpuResourceSizeAndDimensions(const BufferInfo &info, unsigned int *size, unsigned int *alignedw, unsigned int *alignedh, GraphicsMetadata *graphics_metadata); +bool CanUseAdrenoForSize(int buffer_type, uint64_t usage); bool GetAdrenoSizeAPIStatus(); } // namespace gralloc |