1 /* 2 * Copyright 2024 Google LLC 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #include "gfxstream/guest/GfxStreamGralloc.h" 7 8 #if defined(__ANDROID__) 9 10 #include <string> 11 12 #include "GrallocGoldfish.h" 13 #include "GrallocMinigbm.h" 14 #include "android-base/properties.h" 15 16 namespace gfxstream { 17 createPlatformGralloc(int32_t descriptor)18Gralloc* createPlatformGralloc(int32_t descriptor) { 19 const std::string value = android::base::GetProperty("ro.hardware.gralloc", ""); 20 if (value == "minigbm") { 21 auto gralloc = new MinigbmGralloc(descriptor); 22 return gralloc; 23 } 24 return new GoldfishGralloc(); 25 } 26 27 } // namespace gfxstream 28 29 #endif 30