Edit

kc3-lang/angle/src/gpu_info_util/SystemInfo_android.cpp

Branch :

  • Show log

    Commit

  • Author : Jamie Madill
    Date : 2020-09-29 19:59:54
    Hash : e1d1b8b3
    Message : Fix info collection on Android without Vulkan. Allows Vulkan info collection even if Vk is not enabled in ANGLE. Also removes the system_utils error message so that the Android test runner can parse the standard output without conflicts. Bug: chromium:1133459 Bug: angleproject:5109 Change-Id: I7d7bff0f1c3e456342f27538812b33ee6cd1054b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2436657 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>

  • src/gpu_info_util/SystemInfo_android.cpp
  • //
    // 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"
    
    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;
    
        return GetSystemInfoVulkan(info) && isFullyPopulated;
    }
    
    }  // namespace angle