diff --git a/android/camera/media_codecs.xml b/android/media/media_codecs.xml similarity index 98% rename from android/camera/media_codecs.xml rename to android/media/media_codecs.xml index 87d11f2..ee846da 100644 --- a/android/camera/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_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_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/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/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..6ab2330 100644 --- a/products/anbox.mk +++ b/products/anbox.mk @@ -43,8 +43,12 @@ 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 \ + 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 PRODUCT_CHARACTERISTICS := emulator diff --git a/src/anbox/cmds/check_features.cpp b/src/anbox/cmds/check_features.cpp index 686277b..4b6f448 100644 --- a/src/anbox/cmds/check_features.cpp +++ b/src/anbox/cmds/check_features.cpp @@ -36,6 +36,14 @@ std::vector cpu_whitelist = { "M 460", // Intel Celeron N2840 "N2840", + // Intel Core i7 Q720 + "Q 720", + // Intel Pentium T4500 + "T4500", + // Intel Core i7 Q720 + "Q 720", + // Intel Xeon E5520 + "E5520" }; } // namespace @@ -44,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; @@ -70,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: "; @@ -97,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 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);