Hash :
b630bf9e
Author :
Date :
2020-01-24T17:27:01
Fuchsia: Implement SystemInfo on Fuchsia The Android vulkan code is reusable, so move that to a new file SystemInfo_vulkan.cpp and call it in the Android & Fuchsia implementations. This is necessary to skip tests based on GPU. Bug: angleproject:4349, angleproject:4352 Change-Id: I8330cfcdbd41f4d51391bd5ed7f0820c55e02801 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2023909 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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
//
// 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 <dlfcn.h>
#include <vulkan/vulkan.h>
#include "gpu_info_util/SystemInfo_internal.h"
#include "gpu_info_util/SystemInfo_vulkan.h"
#include <sys/system_properties.h>
#include <cstring>
#include <fstream>
#include "common/angleutils.h"
#include "common/debug.h"
namespace angle
{
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;
}
bool GetSystemInfo(SystemInfo *info)
{
bool isFullyPopulated = true;
isFullyPopulated =
GetAndroidSystemProperty("ro.product.manufacturer", &info->machineManufacturer) &&
isFullyPopulated;
isFullyPopulated =
GetAndroidSystemProperty("ro.product.model", &info->machineModelName) && isFullyPopulated;
return GetSystemInfoVulkan(info) && isFullyPopulated;
}
} // namespace angle