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