From 202241a1c41ccf540dc1909d8451b63eca65e808 Mon Sep 17 00:00:00 2001 From: nvschilleman <32854433+nvschilleman@users.noreply.github.com> Date: Sat, 8 Sep 2018 00:38:39 +0200 Subject: [PATCH 01/11] Update check_features.cpp --- src/anbox/cmds/check_features.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/anbox/cmds/check_features.cpp b/src/anbox/cmds/check_features.cpp index 309d59f..d045897 100644 --- a/src/anbox/cmds/check_features.cpp +++ b/src/anbox/cmds/check_features.cpp @@ -36,6 +36,9 @@ std::vector cpu_whitelist = { "M 460", // Intel Celeron N2840 "N2840", + // Intel Pentium T4500 + "T4500", + }; } // namespace From aceed15472f1ca5b4a2e62ff8d8fea4160cb0762 Mon Sep 17 00:00:00 2001 From: Pal Lockheart Date: Sat, 8 Sep 2018 20:35:54 +0800 Subject: [PATCH 02/11] Update check_features.cpp - Added override for Core i7-720QM --- src/anbox/cmds/check_features.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/anbox/cmds/check_features.cpp b/src/anbox/cmds/check_features.cpp index 309d59f..5d9ea6e 100644 --- a/src/anbox/cmds/check_features.cpp +++ b/src/anbox/cmds/check_features.cpp @@ -36,6 +36,8 @@ std::vector cpu_whitelist = { "M 460", // Intel Celeron N2840 "N2840", + // Intel Core i7 Q720 + "Q 720", }; } // namespace From 2d76da96050b3ac80e889202c637ab963c098891 Mon Sep 17 00:00:00 2001 From: nvschilleman <32854433+nvschilleman@users.noreply.github.com> Date: Sun, 9 Sep 2018 12:58:57 +0200 Subject: [PATCH 03/11] Update check_features.cpp --- src/anbox/cmds/check_features.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/anbox/cmds/check_features.cpp b/src/anbox/cmds/check_features.cpp index d045897..17d7ed9 100644 --- a/src/anbox/cmds/check_features.cpp +++ b/src/anbox/cmds/check_features.cpp @@ -37,8 +37,7 @@ std::vector cpu_whitelist = { // Intel Celeron N2840 "N2840", // Intel Pentium T4500 - "T4500", - + "T4500", }; } // namespace From 25c44527b1954801c0fac181fcb74a621996ced1 Mon Sep 17 00:00:00 2001 From: Marius Gripsgard Date: Sun, 9 Sep 2018 21:09:43 +0200 Subject: [PATCH 04/11] Add option to disable sdl window hit test with envar value --- src/anbox/platform/sdl/window.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/anbox/platform/sdl/window.cpp b/src/anbox/platform/sdl/window.cpp index a5806a9..752b13c 100644 --- a/src/anbox/platform/sdl/window.cpp +++ b/src/anbox/platform/sdl/window.cpp @@ -72,8 +72,9 @@ Window::Window(const std::shared_ptr &renderer, BOOST_THROW_EXCEPTION(std::runtime_error(message)); } - if (SDL_SetWindowHitTest(window_, &Window::on_window_hit, this) < 0) - BOOST_THROW_EXCEPTION(std::runtime_error("Failed to register for window hit test")); + if (utils::get_env_value("ANBOX_NO_SDL_WINDOW_HIT_TEST", "false") == "false") + if (SDL_SetWindowHitTest(window_, &Window::on_window_hit, this) < 0) + BOOST_THROW_EXCEPTION(std::runtime_error("Failed to register for window hit test")); SDL_SysWMinfo info; SDL_VERSION(&info.version); From 85107c46adf278915772ee8a2c14d91fa23a4729 Mon Sep 17 00:00:00 2001 From: fatihbalsoy Date: Mon, 10 Sep 2018 19:16:35 -0500 Subject: [PATCH 05/11] Update check_features.cpp - Added override for Core i7-720QM and Xeon E5520 I also get the same SSE error on a virtual machine with an Intel Xeon Processor: The CPU of your computer (Intel(R) Xeon(R) CPU E5520 @ 2.27GHz) does not support all features Anbox requires. It is missing support for the following features: SSE 4.1, SSE 4.2, SSSE 3 but checking /proc/cpuinfo reveals that it supports the features: ... model name : Intel(R) Xeon(R) CPU E5520 @ 2.27GHz ... flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni ssse3 sse4_1 sse4_2 x2apic hypervisor lahf_lm pti I hope adding the following code into the array in check_features.cpp could fix the problem: // Intel Xeon Processor E5520 "E5520" --- src/anbox/cmds/check_features.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/anbox/cmds/check_features.cpp b/src/anbox/cmds/check_features.cpp index d6c06d8..c5df3bc 100644 --- a/src/anbox/cmds/check_features.cpp +++ b/src/anbox/cmds/check_features.cpp @@ -38,6 +38,10 @@ std::vector cpu_whitelist = { "N2840", // Intel Pentium T4500 "T4500", + // Intel Core i7 Q720 + "Q 720", + // Intel Xeon E5520 + "E5520" }; } // namespace From 54bbd82120e42efdbb47d8b7a0a052fe8159c7b3 Mon Sep 17 00:00:00 2001 From: fatihbalsoy Date: Mon, 10 Sep 2018 19:50:10 -0500 Subject: [PATCH 06/11] Removed i7 from pull request, already exists. --- src/anbox/cmds/check_features.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/anbox/cmds/check_features.cpp b/src/anbox/cmds/check_features.cpp index c5df3bc..71490d4 100644 --- a/src/anbox/cmds/check_features.cpp +++ b/src/anbox/cmds/check_features.cpp @@ -38,8 +38,6 @@ std::vector cpu_whitelist = { "N2840", // Intel Pentium T4500 "T4500", - // Intel Core i7 Q720 - "Q 720", // Intel Xeon E5520 "E5520" }; From 40f190c5e2257d01c891f15c332b5ec4b9c7bd80 Mon Sep 17 00:00:00 2001 From: fatihbalsoy Date: Mon, 10 Sep 2018 20:01:47 -0500 Subject: [PATCH 07/11] Added back i7 Q720 to prevent merge conflicts. --- src/anbox/cmds/check_features.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/anbox/cmds/check_features.cpp b/src/anbox/cmds/check_features.cpp index 71490d4..c5df3bc 100644 --- a/src/anbox/cmds/check_features.cpp +++ b/src/anbox/cmds/check_features.cpp @@ -38,6 +38,8 @@ std::vector cpu_whitelist = { "N2840", // Intel Pentium T4500 "T4500", + // Intel Core i7 Q720 + "Q 720", // Intel Xeon E5520 "E5520" }; From ae8cefb77028ea3f4f3e8aeb5abf722cae6dca87 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Tue, 11 Sep 2018 19:40:56 +0200 Subject: [PATCH 08/11] cmds: implement CPU feature sanity check via builtin compiler functions To prevent our whilelist from growing much more we know do an additional sanity check via compiler builtin functions if we cannot detect all mandatory CPU features via the cpu_features libray and if the CPU isn't whitelisted. This should cover more or less all remaining cases unless the compiler is unable to detect the features properly. --- src/anbox/cmds/check_features.cpp | 33 +++++++++++++++++++++++++++++-- src/anbox/cmds/check_features.h | 3 +++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/anbox/cmds/check_features.cpp b/src/anbox/cmds/check_features.cpp index a1e1943..4b6f448 100644 --- a/src/anbox/cmds/check_features.cpp +++ b/src/anbox/cmds/check_features.cpp @@ -52,7 +52,7 @@ anbox::cmds::CheckFeatures::CheckFeatures() cli::Name{"check-features"}, cli::Usage{"check-features"}, cli::Description{"Check that the host system supports all necessary features"}} { - action([](const cli::Command::Context&) { + action([this](const cli::Command::Context&) { #if defined(CPU_FEATURES_ARCH_X86) const auto info = cpu_features::GetX86Info(); std::vector missing_features; @@ -78,7 +78,7 @@ anbox::cmds::CheckFeatures::CheckFeatures() } } - if (missing_features.size() > 0 && !is_whitelisted) { + if (missing_features.size() > 0 && !is_whitelisted && !sanity_check_for_features()) { std::cerr << "The CPU of your computer (" << brand_string << ") does not support all" << std::endl << "features Anbox requires." << std::endl << "It is missing support for the following features: "; @@ -105,3 +105,32 @@ anbox::cmds::CheckFeatures::CheckFeatures() #endif }); } + +// In case that the CPU supports AVX we take the decision as from our analysis +// of the output from the cpu_features library. If it does not we have to check +// further via the compiler builtins if we the CPU supports all mandatory features +// or not. In case that any is missing we will fail the test. +// +// This uses the compiler builtin function __builtin_cpu_supports which allows us +// to detect certain CPU features. +// See https://gcc.gnu.org/onlinedocs/gcc/x86-Built-in-Functions.html +bool anbox::cmds::CheckFeatures::sanity_check_for_features() { +#if defined(CPU_FEATURES_ARCH_X86) + if (__builtin_cpu_supports("avx")) + return true; + + std::vector missing_features; + +#define CHECK_FEATURE(name) \ + if (!__builtin_cpu_supports(name)) \ + missing_features.push_back(name); + + CHECK_FEATURE("sse4.1"); + CHECK_FEATURE("sse4.2"); + CHECK_FEATURE("ssse3"); + + return missing_features.empty(); +#else + return true; +#endif +} diff --git a/src/anbox/cmds/check_features.h b/src/anbox/cmds/check_features.h index e6c6ff7..8402ca6 100644 --- a/src/anbox/cmds/check_features.h +++ b/src/anbox/cmds/check_features.h @@ -29,6 +29,9 @@ namespace cmds { class CheckFeatures : public cli::CommandWithFlagsAndAction { public: CheckFeatures(); + + private: + bool sanity_check_for_features(); }; } // namespace cmds } // namespace anbox From 8d0faeb5d659203dea417c772b7468baff09e484 Mon Sep 17 00:00:00 2001 From: Marcel Partap Date: Thu, 13 Sep 2018 09:48:08 +0200 Subject: [PATCH 09/11] Moved the media codecs list to android/media/ as it also contains audio codecs. --- android/{camera => media}/media_codecs.xml | 0 android/{camera => media}/media_profiles.xml | 0 products/anbox.mk | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename android/{camera => media}/media_codecs.xml (100%) rename android/{camera => media}/media_profiles.xml (100%) diff --git a/android/camera/media_codecs.xml b/android/media/media_codecs.xml similarity index 100% rename from android/camera/media_codecs.xml rename to android/media/media_codecs.xml diff --git a/android/camera/media_profiles.xml b/android/media/media_profiles.xml similarity index 100% rename from android/camera/media_profiles.xml rename to android/media/media_profiles.xml diff --git a/products/anbox.mk b/products/anbox.mk index 73fd1a9..109634d 100644 --- a/products/anbox.mk +++ b/products/anbox.mk @@ -43,8 +43,8 @@ PRODUCT_COPY_FILES += \ vendor/anbox/android/init.goldfish.rc:root/init.goldfish.rc \ vendor/anbox/android/init.goldfish.sh:system/etc/init.goldfish.sh \ vendor/anbox/android/ueventd.goldfish.rc:root/ueventd.goldfish.rc \ - vendor/anbox/android/camera/media_profiles.xml:system/etc/media_profiles.xml \ - vendor/anbox/android/camera/media_codecs.xml:system/etc/media_codecs.xml \ + vendor/anbox/android/media/media_profiles.xml:system/etc/media_profiles.xml \ + vendor/anbox/android/media/media_codecs.xml:system/etc/media_codecs.xml \ hardware/libhardware_legacy/audio/audio_policy.conf:system/etc/audio_policy.conf PRODUCT_CHARACTERISTICS := emulator From c98fe4b3a23ad39597f7e6ad2b8da0ed217c609f Mon Sep 17 00:00:00 2001 From: Marcel Partap Date: Thu, 13 Sep 2018 10:02:38 +0200 Subject: [PATCH 10/11] Added missing media_codecs_google_*.xml from frameworks/av libstagefright (tree 6b14452cfef637b9b987c0a6a690bda7067afe49). Upstream location is https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/data --- android/media/media_codecs_google_audio.xml | 97 ++++++++++++++ .../media/media_codecs_google_telephony.xml | 25 ++++ android/media/media_codecs_google_video.xml | 122 ++++++++++++++++++ products/anbox.mk | 3 + 4 files changed, 247 insertions(+) create mode 100644 android/media/media_codecs_google_audio.xml create mode 100644 android/media/media_codecs_google_telephony.xml create mode 100644 android/media/media_codecs_google_video.xml diff --git a/android/media/media_codecs_google_audio.xml b/android/media/media_codecs_google_audio.xml new file mode 100644 index 0000000..632088a --- /dev/null +++ b/android/media/media_codecs_google_audio.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/media/media_codecs_google_telephony.xml b/android/media/media_codecs_google_telephony.xml new file mode 100644 index 0000000..5ad90d9 --- /dev/null +++ b/android/media/media_codecs_google_telephony.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + diff --git a/android/media/media_codecs_google_video.xml b/android/media/media_codecs_google_video.xml new file mode 100644 index 0000000..829f403 --- /dev/null +++ b/android/media/media_codecs_google_video.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/products/anbox.mk b/products/anbox.mk index 109634d..9a2d7c5 100644 --- a/products/anbox.mk +++ b/products/anbox.mk @@ -45,6 +45,9 @@ PRODUCT_COPY_FILES += \ vendor/anbox/android/ueventd.goldfish.rc:root/ueventd.goldfish.rc \ vendor/anbox/android/media/media_profiles.xml:system/etc/media_profiles.xml \ vendor/anbox/android/media/media_codecs.xml:system/etc/media_codecs.xml \ + vendor/anbox/android/media/media_codecs_google_audio.xml:system/etc/media_codecs_google_audio.xml \ + vendor/anbox/android/media/media_codecs_google_telephony.xml:system/etc/media_codecs_google_telephony.xml \ + vendor/anbox/android/media/media_codecs_google_video.xml:system/etc/media_codecs_google_video.xml \ hardware/libhardware_legacy/audio/audio_policy.conf:system/etc/audio_policy.conf PRODUCT_CHARACTERISTICS := emulator From 05cb1a608e6c690ca393858ab786d780a4d62a82 Mon Sep 17 00:00:00 2001 From: Marcel Partap Date: Thu, 13 Sep 2018 10:04:04 +0200 Subject: [PATCH 11/11] Also add mpeg2 support. (frameworks/av commit c83d228e85b187e3112f10003282c8270d18ef71 moved this from media_codecs_google_video.xml to new file media_codecs_google_tv.xml for reasons not given.) --- android/media/media_codecs.xml | 1 + android/media/media_codecs_google_tv.xml | 29 ++++++++++++++++++++++++ products/anbox.mk | 1 + 3 files changed, 31 insertions(+) create mode 100644 android/media/media_codecs_google_tv.xml diff --git a/android/media/media_codecs.xml b/android/media/media_codecs.xml index 87d11f2..ee846da 100644 --- a/android/media/media_codecs.xml +++ b/android/media/media_codecs.xml @@ -80,5 +80,6 @@ Only the three quirks included above are recognized at this point: + diff --git a/android/media/media_codecs_google_tv.xml b/android/media/media_codecs_google_tv.xml new file mode 100644 index 0000000..330c6fb --- /dev/null +++ b/android/media/media_codecs_google_tv.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + diff --git a/products/anbox.mk b/products/anbox.mk index 9a2d7c5..6ab2330 100644 --- a/products/anbox.mk +++ b/products/anbox.mk @@ -47,6 +47,7 @@ PRODUCT_COPY_FILES += \ vendor/anbox/android/media/media_codecs.xml:system/etc/media_codecs.xml \ vendor/anbox/android/media/media_codecs_google_audio.xml:system/etc/media_codecs_google_audio.xml \ vendor/anbox/android/media/media_codecs_google_telephony.xml:system/etc/media_codecs_google_telephony.xml \ + vendor/anbox/android/media/media_codecs_google_tv.xml:system/etc/media_codecs_google_tv.xml \ vendor/anbox/android/media/media_codecs_google_video.xml:system/etc/media_codecs_google_video.xml \ hardware/libhardware_legacy/audio/audio_policy.conf:system/etc/audio_policy.conf