Hash :
5173a8e1
Author :
Date :
2020-09-23T23:01:21
Enable Vulkan SystemInfo on more platforms. Can be used in the gold tests to produce device info. Bug: angleproject:4090 Bug: b/168049670 Change-Id: I60d3ddc7d17cd00aa816dd266a54f6d6a62770d7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2427871 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// SystemInfo_android.cpp: implementation of the Android-specific parts of SystemInfo.h
#include "gpu_info_util/SystemInfo_internal.h"
#include <sys/system_properties.h>
#include <cstring>
#include <fstream>
#include "common/angleutils.h"
#include "common/debug.h"
#if defined(ANGLE_ENABLE_VULKAN)
# include "gpu_info_util/SystemInfo_vulkan.h"
#endif // defined(ANGLE_ENABLE_VULKAN)
namespace angle
{
namespace
{
bool GetAndroidSystemProperty(const std::string &propertyName, std::string *value)
{
// PROP_VALUE_MAX from <sys/system_properties.h>
std::vector<char> propertyBuf(PROP_VALUE_MAX);
int len = __system_property_get(propertyName.c_str(), propertyBuf.data());
if (len <= 0)
{
return false;
}
*value = std::string(propertyBuf.data());
return true;
}
} // namespace
bool GetSystemInfo(SystemInfo *info)
{
bool isFullyPopulated = true;
isFullyPopulated =
GetAndroidSystemProperty("ro.product.manufacturer", &info->machineManufacturer) &&
isFullyPopulated;
isFullyPopulated =
GetAndroidSystemProperty("ro.product.model", &info->machineModelName) && isFullyPopulated;
#if defined(ANGLE_ENABLE_VULKAN)
isFullyPopulated = GetSystemInfoVulkan(info) && isFullyPopulated;
#else
isFullyPopulated = false;
#endif // defined(ANGLE_ENABLE_VULKAN)
return isFullyPopulated;
}
} // namespace angle