gralloc: Hide dmabuf heap allocator behind of a flag

... so that devices that have API level 31 but do not have the
system dmabuf heap installed (as it is not required) do not spam
error logs before falling back to memfd.

BUG=b:227375257
TEST=build Cuttlefish with aosp/2051732
TEST=cvd start
TEST=vts -m VtsHalGraphicsMapperV4_0Target

Change-Id: I7ab79ce472b1e3d84ffa8bb06044ecc933847656
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3563512
Commit-Queue: Jason Macnak <natsu@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
This commit is contained in:
Jason Macnak 2022-03-31 16:33:59 -07:00 committed by Chromeos LUCI
parent 1a733377e9
commit db3c6fcf02
2 changed files with 3 additions and 3 deletions

View file

@ -205,7 +205,7 @@ int cros_gralloc_driver::create_reserved_region(const std::string &buffer_name,
{
int ret;
#if ANDROID_API_LEVEL >= 31
#if ANDROID_API_LEVEL >= 31 && defined(HAS_DMABUF_SYSTEM_HEAP)
ret = allocator_.Alloc(kDmabufSystemHeapName, reserved_region_size);
if (ret >= 0)
return ret;

View file

@ -15,7 +15,7 @@
#include <string>
#include <unordered_map>
#if ANDROID_API_LEVEL >= 31
#if ANDROID_API_LEVEL >= 31 && defined(HAS_DMABUF_SYSTEM_HEAP)
#include <BufferAllocator/BufferAllocator.h>
#endif
@ -62,7 +62,7 @@ class cros_gralloc_driver
int create_reserved_region(const std::string &buffer_name, uint64_t reserved_region_size);
#if ANDROID_API_LEVEL >= 31
#if ANDROID_API_LEVEL >= 31 && defined(HAS_DMABUF_SYSTEM_HEAP)
/* For allocating cros_gralloc_buffer reserved regions for metadata. */
BufferAllocator allocator_;
#endif