Skip to content

Commit

Permalink
Merge branch 'master' into touch_emulation
Browse files Browse the repository at this point in the history
  • Loading branch information
morphis authored Apr 24, 2019
2 parents 9597069 + 5530c0a commit 8d8adcb
Show file tree
Hide file tree
Showing 18 changed files with 108 additions and 37 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMESA_EGL_NO_X11_HEADERS")

if(Protobuf_VERSION GREATER_EQUAL "3.7")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_PROTOBUF_CALLBACK_HEADER")
endif()

#####################################################################
# Enable code coverage calculation with gcov/gcovr/lcov
# Usage:
Expand Down
2 changes: 1 addition & 1 deletion android/opengl/system/gralloc/gralloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ static int gralloc_lock(gralloc_module_t const* module,
if (sw_read) {
D("gralloc_lock read back color buffer %d %d\n", cb->width, cb->height);
rcEnc->rcReadColorBuffer(rcEnc, cb->hostHandle,
0, 0, cb->width, cb->height, GL_RGBA, GL_UNSIGNED_BYTE, cpu_addr);
0, 0, cb->width, cb->height, cb->glFormat, cb->glType, cpu_addr);
}
}

Expand Down
35 changes: 26 additions & 9 deletions external/android-emugl/host/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
set(GENERATED_SOURCES
FUNCTION(PREPEND var prefix)
SET(listVar "")
FOREACH(f ${ARGN})
LIST(APPEND listVar "${prefix}/${f}")
ENDFOREACH(f)
SET(${var} "${listVar}" PARENT_SCOPE)
ENDFUNCTION(PREPEND)

PREPEND(GLHEADERS_SOURCES libOpenGLESDispatch/
render_egl_extensions.entries
render_egl.entries
gles_common.entries
gles_extensions.entries
gles1_only.entries
gles1_extensions.entries
gles2_only.entries
gles2_extensions.entries
gles3_only.entries)

PREPEND(GLHEADERS_GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/../include/OpenGLESDispatch/
gles1_extensions_functions.h
gles1_only_functions.h
gles2_extensions_functions.h
gles2_only_functions.h
gles3_only_functions.h
gles_common_functions.h
gles_extensions_functions.h
gles_functions.h
RenderEGL_extensions_functions.h
RenderEGL_functions.h)

add_custom_target(GLHeaders)
add_custom_command(
TARGET GLHeaders
POST_BUILD
OUTPUT ${GLHEADERS_GENERATED_SOURCES}
COMMAND ${CMAKE_SOURCE_DIR}/scripts/gen-emugl-headers.sh ${CMAKE_BINARY_DIR}
DEPENDS ${GLHEADERS_SOURCES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

add_subdirectory(GLESv1_dec)
add_subdirectory(GLESv2_dec)
add_subdirectory(libOpenGLESDispatch)
add_subdirectory(renderControl_dec)
include(GLESv1_dec/CMakeLists.txt)
include(GLESv2_dec/CMakeLists.txt)
include(libOpenGLESDispatch/CMakeLists.txt)
include(renderControl_dec/CMakeLists.txt)
15 changes: 8 additions & 7 deletions external/android-emugl/host/libs/GLESv1_dec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
set(GENERATED_SOURCES
set(CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/GLESv1_dec)

PREPEND(GENERATED_SOURCES ${CURRENT_BINARY_DIR}/
gles1_dec.cpp
gles1_opcodes.h
gles1_server_context.cpp)

add_custom_command(
OUTPUT ${GENERATED_SOURCES}
POST_BUILD
COMMAND ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen
-D ${CMAKE_CURRENT_BINARY_DIR} gles1
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND mkdir -p ${CURRENT_BINARY_DIR} && ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen
-D ${CURRENT_BINARY_DIR} gles1
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS emugen)

set(SOURCES
PREPEND(SOURCES ${CMAKE_CURRENT_LIST_DIR}/
GLESv1Decoder.cpp)

if ("${cmake_build_type_lower}" STREQUAL "trace")
Expand All @@ -20,6 +22,5 @@ if ("${cmake_build_type_lower}" STREQUAL "trace")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPENGL_DEBUG}")
endif()

add_library(GLESv1_dec STATIC ${SOURCES} ${GENERATED_SOURCES})
add_dependencies(GLESv1_dec GLHeaders)
add_library(GLESv1_dec STATIC ${SOURCES} ${GENERATED_SOURCES} ${GLHEADERS_GENERATED_SOURCES})
target_link_libraries(GLESv1_dec OpenglCodecCommon)
15 changes: 8 additions & 7 deletions external/android-emugl/host/libs/GLESv2_dec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
set(GENERATED_SOURCES
set(CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/GLESv2_dec)

PREPEND(GENERATED_SOURCES ${CURRENT_BINARY_DIR}/
gles2_dec.cpp
gles2_opcodes.h
gles2_server_context.cpp)

add_custom_command(
OUTPUT ${GENERATED_SOURCES}
POST_BUILD
COMMAND ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen
-D ${CMAKE_CURRENT_BINARY_DIR} gles2
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND mkdir -p ${CURRENT_BINARY_DIR} && ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen
-D ${CURRENT_BINARY_DIR} gles2
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS emugen)

set(SOURCES
PREPEND(SOURCES ${CMAKE_CURRENT_LIST_DIR}/
GLESv2Decoder.cpp)

if ("${cmake_build_type_lower}" STREQUAL "trace")
Expand All @@ -20,6 +22,5 @@ if ("${cmake_build_type_lower}" STREQUAL "trace")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPENGL_DEBUG}")
endif()

add_library(GLESv2_dec STATIC ${SOURCES} ${GENERATED_SOURCES})
add_dependencies(GLESv2_dec GLHeaders)
add_library(GLESv2_dec STATIC ${SOURCES} ${GENERATED_SOURCES} ${GLHEADERS_GENERATED_SOURCES})
target_link_libraries(GLESv2_dec OpenglCodecCommon)
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
set(SOURCES
PREPEND(SOURCES ${CMAKE_CURRENT_LIST_DIR}/
EGLDispatch.cpp
GLESv2Dispatch.cpp
GLESv1Dispatch.cpp)

add_library(OpenGLESDispatch STATIC ${SOURCES})
add_dependencies(OpenGLESDispatch GLHeaders)
add_library(OpenGLESDispatch STATIC ${SOURCES} ${GLHEADERS_GENERATED_SOURCES})
target_link_libraries(OpenGLESDispatch
emugl_common
GLESv2_dec
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
set(GENERATED_SOURCES
set(CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/GLESv1_dec)

PREPEND(GENERATED_SOURCES ${CURRENT_BINARY_DIR}/
renderControl_dec.cpp
renderControl_server_context.cpp)

add_custom_command(
OUTPUT ${GENERATED_SOURCES}
POST_BUILD
COMMAND ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen
-D ${CMAKE_CURRENT_BINARY_DIR} renderControl
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND mkdir -p ${CURRENT_BINARY_DIR} && ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen
-D ${CURRENT_BINARY_DIR} renderControl
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS emugen)

if ("${cmake_build_type_lower}" STREQUAL "trace")
Expand Down
3 changes: 3 additions & 0 deletions products/vendorsetup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
add_lunch_combo anbox_x86_64-userdebug
add_lunch_combo anbox_x86_64-user
add_lunch_combo anbox_armv7a_neon-userdebug
add_lunch_combo anbox_armv7a_neon-user
add_lunch_combo anbox_arm64-userdebug
add_lunch_combo anbox_arm64-user
5 changes: 5 additions & 0 deletions scripts/anbox-init.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ function prepare_filesystem() {
chown system:system /dev/$f
chmod 0666 /dev/$f
done

if [ -e "/dev/tun" ] ; then
chown system:vpn /dev/tun
chmod 0660 /dev/tun
fi
}

prepare_filesystem &
Expand Down
3 changes: 3 additions & 0 deletions scripts/snap-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export XDG_DATA_HOME="$SNAP_USER_COMMON/app-data"
# configured but the actual EGL implementation is missing.
export __EGL_VENDOR_LIBRARY_DIRS="$SNAP/glvnd"

# Suppress "libEGL warning: FIXME: egl/x11 doesn't support front buffer rendering." spam
export EGL_LOG_LEVEL="fatal"

enable_debug="$(snapctl get debug.enable)"
if [ "$enable_debug" = true ]; then
export ANBOX_LOG_LEVEL=debug
Expand Down
4 changes: 4 additions & 0 deletions src/anbox/bridge/android_api_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
#include "anbox_rpc.pb.h"

#include <boost/filesystem.hpp>
#ifdef USE_PROTOBUF_CALLBACK_HEADER
#include <google/protobuf/stubs/callback.h>
#endif


namespace fs = boost::filesystem;

Expand Down
4 changes: 4 additions & 0 deletions src/anbox/bridge/platform_api_skeleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

#include "anbox_bridge.pb.h"

#ifdef USE_PROTOBUF_CALLBACK_HEADER
#include <google/protobuf/stubs/callback.h>
#endif

namespace anbox {
namespace bridge {
PlatformApiSkeleton::PlatformApiSkeleton(
Expand Down
1 change: 1 addition & 0 deletions src/anbox/container/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace anbox {
namespace container {
struct DeviceSpecification {
uint32_t permission;
std::string old_device_name = "";
};

struct Configuration {
Expand Down
24 changes: 18 additions & 6 deletions src/anbox/container/lxc_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ LxcContainer::~LxcContainer() {

void LxcContainer::setup_id_map() {
const auto base_id = unprivileged_uid;
const auto max_id = 65536;
const auto max_id = 100000;

set_config_item(lxc_config_idmap_key, utils::string_format("u 0 %d %d", base_id, android_system_uid - 1));
set_config_item(lxc_config_idmap_key, utils::string_format("g 0 %d %d", base_id, android_system_uid - 1));
Expand Down Expand Up @@ -156,14 +156,20 @@ void LxcContainer::setup_network() {
ip_conf.set_assignment(android::IpConfigBuilder::Assignment::Static);

std::string address = default_container_ip_address;
if (!container_network_address_.empty())
address = container_network_address_;
ip_conf.set_link_address(address, default_container_ip_prefix_length);
std::uint32_t ip_prefix_length = default_container_ip_prefix_length;
if (!container_network_address_.empty()) {
auto tokens = utils::string_split(container_network_address_, '/');
if (tokens.size() == 1 || tokens.size() == 2)
address = tokens[0];
if (tokens.size() == 2)
ip_prefix_length = atoi(tokens[1].c_str());
}
ip_conf.set_link_address(address, ip_prefix_length);

std::string gateway = default_host_ip_address;
if (!container_network_gateway_.empty())
gateway = container_network_gateway_;
ip_conf.set_gateway(default_host_ip_address);
ip_conf.set_gateway(gateway);

if (container_network_dns_servers_.size() > 0)
ip_conf.set_dns_servers(container_network_dns_servers_);
Expand Down Expand Up @@ -220,7 +226,12 @@ void LxcContainer::setup_network() {

void LxcContainer::add_device(const std::string& device, const DeviceSpecification& spec) {
struct stat st;
int r = stat(device.c_str(), &st);
const std::string *old_device_name;
if (!spec.old_device_name.empty())
old_device_name = &spec.old_device_name;
else
old_device_name = &device;
int r = stat(old_device_name->c_str(), &st);
if (r < 0) {
const auto msg = utils::string_format("Failed to retrieve information about device %s", device);
throw std::runtime_error(msg);
Expand Down Expand Up @@ -386,6 +397,7 @@ void LxcContainer::start(const Configuration &configuration) {
devices.insert({"/dev/tty", {0666}});
devices.insert({"/dev/urandom", {0666}});
devices.insert({"/dev/zero", {0666}});
devices.insert({"/dev/tun", {0660, "/dev/net/tun"}});

// Remove all left over devices from last time first before
// creating any new ones
Expand Down
4 changes: 4 additions & 0 deletions src/anbox/container/management_api_skeleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#include "anbox_container.pb.h"
#include "anbox_rpc.pb.h"

#ifdef USE_PROTOBUF_CALLBACK_HEADER
#include <google/protobuf/stubs/callback.h>
#endif

namespace anbox {
namespace container {
ManagementApiSkeleton::ManagementApiSkeleton(
Expand Down
4 changes: 4 additions & 0 deletions src/anbox/container/management_api_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include "anbox_container.pb.h"
#include "anbox_rpc.pb.h"

#ifdef USE_PROTOBUF_CALLBACK_HEADER
#include <google/protobuf/stubs/callback.h>
#endif

namespace anbox {
namespace container {

Expand Down
4 changes: 4 additions & 0 deletions src/anbox/rpc/pending_call_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

#include "anbox_rpc.pb.h"

#ifdef USE_PROTOBUF_CALLBACK_HEADER
#include <google/protobuf/stubs/callback.h>
#endif

namespace anbox {
namespace rpc {
PendingCallCache::PendingCallCache() {}
Expand Down
3 changes: 3 additions & 0 deletions src/anbox/rpc/template_message_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#define ANBOX_RPC_TEMPLATE_MESSAGE_PROCESSOR_H_

#include <google/protobuf/stubs/common.h>
#ifdef USE_PROTOBUF_CALLBACK_HEADER
#include <google/protobuf/stubs/callback.h>
#endif

#include "anbox/rpc/message_processor.h"

Expand Down

0 comments on commit 8d8adcb

Please sign in to comment.