Hash :
a5ab7974
        
        Author :
  
        
        Date :
2021-01-28T12:32:10
        
      
Turn on vulkan backend for android ndk level < 26
Fixes two issue for build Vulkan backend for android ndk level < 26,
* Disable Vulkan validation layers for android ndk level < 26
* Share vulkan memory allocator implementation with chrome to avoid
  duplicated symbols link errors.
* Only run vulkan backend test with Android P or newer
Note: This change will break android-binary-size try bot, we need to
update expected_static_initializer_count to 4 at [1] while rolling this
change into chromium.
    [1] https://source.chromium.org/chromium/chromium/src/+/master:chrome/android/static_initializers.gni;l=19?q=expected_static_initializer_count&ss=chromium%2Fchromium%2Fsrc
Bug: chromium:1170339
Change-Id: Idb9238d8f339724c4d8f9ac136305b95ff06fae4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2656980
Commit-Queue: Peng Huang <penghuang@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 51 52 53 54 55
//
// 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 <string>
#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;
    std::string androidSdkLevel;
    isFullyPopulated =
        GetAndroidSystemProperty("ro.build.version.sdk", &androidSdkLevel) && isFullyPopulated;
    info->androidSdkLevel = std::stoi(androidSdkLevel);
    return GetSystemInfoVulkan(info) && isFullyPopulated;
}
}  // namespace angle