Snap for 11510485 from f91d8e734c8dfe252a773d1434fc712e4300f9b3 to 24Q2-release
Change-Id: Ibd9af81de2cec730bd7aec632f6b90b1b2fdffda
diff --git a/Android.bp b/Android.bp
index cf44e07..09c58d4 100644
--- a/Android.bp
+++ b/Android.bp
@@ -52,12 +52,12 @@
header_libs: [
"aemu_common_headers",
"gfxstream_magma_headers",
- "gfxstream_vulkan_headers",
+ "libgfxstream_vulkan_headers",
],
export_header_lib_headers: [
"aemu_common_headers",
"gfxstream_magma_headers",
- "gfxstream_vulkan_headers",
+ "libgfxstream_vulkan_headers",
],
apex_available: [
"//apex_available:platform",
@@ -147,16 +147,16 @@
cflags: [
"-U__ANDROID__",
"-UANDROID",
- ]
+ ],
},
android: {
compile_multilib: "64",
- shared_libs: [ "libnativewindow", ],
+ shared_libs: ["libnativewindow"],
},
linux_bionic_arm64: {
enabled: true,
- cflags: [ "-Dandroidbionic", ],
- }
+ cflags: ["-Dandroidbionic"],
+ },
},
host_supported: true,
vendor_available: true,
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index ff962c3..00e6638 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -1,3 +1,4 @@
add_subdirectory(detector)
add_subdirectory(etc)
+add_subdirectory(utils)
add_subdirectory(vulkan)
\ No newline at end of file
diff --git a/common/detector/Android.bp b/common/detector/Android.bp
index ef2eb1a..7b137b4 100644
--- a/common/detector/Android.bp
+++ b/common/detector/Android.bp
@@ -30,7 +30,7 @@
"Vulkan.cpp",
],
header_libs: [
- "gfxstream_vulkan_headers",
+ "libgfxstream_vulkan_headers",
],
static_libs: [
"libgfxstream_graphics_detector_proto",
diff --git a/common/end2end/Android.bp b/common/end2end/Android.bp
index 6e293c5..aa83a91 100644
--- a/common/end2end/Android.bp
+++ b/common/end2end/Android.bp
@@ -1,4 +1,3 @@
-
package {
// See: http://go/android-license-faq
default_applicable_licenses: ["hardware_google_gfxstream_license"],
@@ -7,7 +6,7 @@
// Run with `atest --host GfxstreamEnd2EndTests`
cc_test_host {
name: "GfxstreamEnd2EndTests",
- defaults: [ "gfxstream_cc_defaults" ],
+ defaults: ["gfxstream_cc_defaults"],
srcs: [
"GfxstreamEnd2EndTests.cpp",
"GfxstreamEnd2EndGlTests.cpp",
@@ -23,20 +22,20 @@
"libGLESv2_emulation_with_host",
"libEGL_emulation_with_host",
"libgfxstream_guest_vulkan_with_host",
- "libplatform_rutabaga_server",
+ "libgfxstream_platform_rutabaga_server",
],
shared_libs: [
"libandroidemu",
"libOpenglSystemCommonWithHost",
"libbase",
"liblog",
- "libplatform_rutabaga_server",
+ "libgfxstream_platform_rutabaga_server",
],
static_libs: [
"libc++fs",
"libgfxstream_guest_android_with_host",
"libgmock",
- "libplatform_rutabaga",
+ "libgfxstream_platform_rutabaga",
],
cflags: [
// TODO: remove
diff --git a/common/meson.build b/common/meson.build
index 2763692..c1bebf2 100644
--- a/common/meson.build
+++ b/common/meson.build
@@ -2,3 +2,4 @@
# SPDX-License-Identifier: MIT
subdir('etc')
+subdir('utils')
diff --git a/common/opengl/Android.bp b/common/opengl/Android.bp
index df3556f..de250a3 100644
--- a/common/opengl/Android.bp
+++ b/common/opengl/Android.bp
@@ -14,4 +14,4 @@
"//apex_available:platform",
"com.android.virt",
],
-}
\ No newline at end of file
+}
diff --git a/common/utils/Android.bp b/common/utils/Android.bp
new file mode 100644
index 0000000..9d8040b
--- /dev/null
+++ b/common/utils/Android.bp
@@ -0,0 +1,16 @@
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["hardware_google_gfxstream_license"],
+}
+
+cc_library_static {
+ name: "libgfxstream_common_utils",
+ defaults: ["gfxstream_defaults"],
+ export_include_dirs: [
+ "include",
+ ],
+ srcs: [
+ "Strings.cpp",
+ ],
+}
diff --git a/common/utils/CMakeLists.txt b/common/utils/CMakeLists.txt
new file mode 100644
index 0000000..6e877b4
--- /dev/null
+++ b/common/utils/CMakeLists.txt
@@ -0,0 +1,14 @@
+add_library(
+ gfxstream_common_utils.headers
+ INTERFACE)
+target_include_directories(
+ gfxstream_common_utils.headers
+ INTERFACE
+ include)
+add_library(
+ gfxstream_common_utils
+ Strings.cpp)
+target_link_libraries(
+ gfxstream_common_utils
+ PUBLIC
+ gfxstream_common_utils.headers)
\ No newline at end of file
diff --git a/common/utils/Strings.cpp b/common/utils/Strings.cpp
new file mode 100644
index 0000000..0389b08
--- /dev/null
+++ b/common/utils/Strings.cpp
@@ -0,0 +1,38 @@
+// Copyright (C) 2024 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "gfxstream/Strings.h"
+
+namespace gfxstream {
+
+std::vector<std::string> Split(const std::string& s, const std::string& delimiters) {
+ if (delimiters.empty()) {
+ return {};
+ }
+
+ std::vector<std::string> result;
+
+ size_t base = 0;
+ size_t found;
+ while (true) {
+ found = s.find_first_of(delimiters, base);
+ result.push_back(s.substr(base, found - base));
+ if (found == s.npos) break;
+ base = found + 1;
+ }
+
+ return result;
+}
+
+} // namespace gfxstream
diff --git a/common/utils/include/gfxstream/Strings.h b/common/utils/include/gfxstream/Strings.h
new file mode 100644
index 0000000..f7a017e
--- /dev/null
+++ b/common/utils/include/gfxstream/Strings.h
@@ -0,0 +1,24 @@
+// Copyright 2024 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#pragma once
+
+#include <string>
+#include <vector>
+
+namespace gfxstream {
+
+std::vector<std::string> Split(const std::string& s, const std::string& delimiters);
+
+} // namespace gfxstream
diff --git a/common/utils/meson.build b/common/utils/meson.build
new file mode 100644
index 0000000..040300f
--- /dev/null
+++ b/common/utils/meson.build
@@ -0,0 +1,14 @@
+# Copyright 2024 Android Open Source Project
+# SPDX-License-Identifier: MIT
+
+inc_common_utils = include_directories('include')
+
+files_lib_common_utils = files(
+ 'Strings.cpp',
+)
+
+lib_common_utils = static_library(
+ 'common_utils',
+ files_lib_common_utils,
+ include_directories: [inc_common_utils],
+)
\ No newline at end of file
diff --git a/common/vulkan/Android.bp b/common/vulkan/Android.bp
index a35a506..900d858 100644
--- a/common/vulkan/Android.bp
+++ b/common/vulkan/Android.bp
@@ -1,5 +1,5 @@
cc_library_headers {
- name: "gfxstream_vulkan_headers",
+ name: "libgfxstream_vulkan_headers",
export_include_dirs: ["include"],
host_supported: true,
vendor_available: true,
diff --git a/guest/GoldfishAddressSpace/Android.bp b/guest/GoldfishAddressSpace/Android.bp
index 018ff9a..5600e5e 100644
--- a/guest/GoldfishAddressSpace/Android.bp
+++ b/guest/GoldfishAddressSpace/Android.bp
@@ -19,7 +19,7 @@
"liblog",
],
static_libs: [
- "libandroidemu_static",
+ "libgfxstream_androidemu_static",
"libplatform",
],
export_include_dirs: [
diff --git a/guest/OpenglCodecCommon/Android.bp b/guest/OpenglCodecCommon/Android.bp
index 2b7b838..f745c9d 100644
--- a/guest/OpenglCodecCommon/Android.bp
+++ b/guest/OpenglCodecCommon/Android.bp
@@ -53,11 +53,11 @@
"liblog",
],
export_static_lib_headers: [
- "libandroidemu_static",
+ "libgfxstream_androidemu_static",
],
static_libs: [
"libgfxstream_etc",
- "libandroidemu_static",
+ "libgfxstream_androidemu_static",
"libqemupipe.ranchu",
],
cflags: [
diff --git a/guest/OpenglSystemCommon/Android.bp b/guest/OpenglSystemCommon/Android.bp
index 3cb00d6..e08fcce 100644
--- a/guest/OpenglSystemCommon/Android.bp
+++ b/guest/OpenglSystemCommon/Android.bp
@@ -52,7 +52,7 @@
"libgfxstream_guest_cc_defaults",
],
header_libs: [
- "gfxstream_vulkan_headers",
+ "libgfxstream_vulkan_headers",
"libgfxstream_guest_graphics_headers",
"libgfxstream_guest_iostream",
"libhardware_headers",
@@ -134,7 +134,7 @@
"libnativewindow",
"libsync",
],
- }
+ },
},
}
@@ -145,16 +145,16 @@
],
shared_libs: [
"libandroidemu",
- "libplatform_rutabaga_server",
+ "libgfxstream_platform_rutabaga_server",
],
static_libs: [
"libgfxstream_guest_android_with_host",
"libgfxstream_guest_vulkan_encoder_with_host",
- "libplatform_rutabaga",
+ "libgfxstream_platform_rutabaga",
],
export_static_lib_headers: [
"libgfxstream_guest_android_with_host",
- "libplatform_rutabaga",
+ "libgfxstream_platform_rutabaga",
],
target: {
host: {
@@ -175,7 +175,7 @@
"vulkan_enc_headers",
],
static_libs: [
- "libandroidemu_static",
+ "libgfxstream_androidemu_static",
"libgfxstream_guest_android",
"libplatform",
],
@@ -194,16 +194,16 @@
"vulkan_enc_headers",
],
shared_libs: [
- "libplatform_rutabaga_server",
+ "libgfxstream_platform_rutabaga_server",
],
static_libs: [
- "libandroidemu_static",
+ "libgfxstream_androidemu_static",
"libgfxstream_guest_android_with_host",
- "libplatform_rutabaga",
+ "libgfxstream_platform_rutabaga",
],
export_static_lib_headers: [
"libgfxstream_guest_android_with_host",
- "libplatform_rutabaga",
+ "libgfxstream_platform_rutabaga",
],
target: {
host: {
diff --git a/guest/android-emu/Android.bp b/guest/android-emu/Android.bp
index 96d7ef6..f510d2a 100644
--- a/guest/android-emu/Android.bp
+++ b/guest/android-emu/Android.bp
@@ -47,7 +47,7 @@
}
cc_library_static {
- name: "libandroidemu_static",
+ name: "libgfxstream_androidemu_static",
defaults: [
"libgfxstream_guest_cc_defaults",
],
diff --git a/guest/android/Android.bp b/guest/android/Android.bp
index 4846597..c2d06cc 100644
--- a/guest/android/Android.bp
+++ b/guest/android/Android.bp
@@ -39,7 +39,7 @@
"libdrm",
],
export_include_dirs: [
- "include"
+ "include",
],
local_include_dirs: [
".",
@@ -88,7 +88,7 @@
"libgfxstream_guest_android_defaults",
],
static_libs: [
- "libplatform_rutabaga",
+ "libgfxstream_platform_rutabaga",
],
target: {
host: {
@@ -102,4 +102,4 @@
"ANativeWindowEmulated.cpp",
"GrallocEmulated.cpp",
],
-}
\ No newline at end of file
+}
diff --git a/guest/gralloc_cb/Android.bp b/guest/gralloc_cb/Android.bp
index 9565d00..7fa1b97 100644
--- a/guest/gralloc_cb/Android.bp
+++ b/guest/gralloc_cb/Android.bp
@@ -30,6 +30,6 @@
],
export_header_lib_headers: [
"libcutils_headers",
- "libqemupipe-types.ranchu"
+ "libqemupipe-types.ranchu",
],
}
diff --git a/guest/magma/Android.bp b/guest/magma/Android.bp
index 12d8e6a..17cdd85 100644
--- a/guest/magma/Android.bp
+++ b/guest/magma/Android.bp
@@ -36,7 +36,7 @@
"libplatform",
"libgfxstream_guest_android",
"libGoldfishAddressSpace",
- "libandroidemu_static",
+ "libgfxstream_androidemu_static",
],
srcs: [
"magma.cpp",
diff --git a/guest/platform/Android.bp b/guest/platform/Android.bp
index 9fdd009..1905bc2 100644
--- a/guest/platform/Android.bp
+++ b/guest/platform/Android.bp
@@ -61,7 +61,7 @@
}
cc_library_shared {
- name: "libplatform_rutabaga_server",
+ name: "libgfxstream_platform_rutabaga_server",
host_supported: true,
vendor_available: true,
srcs: [
@@ -93,7 +93,7 @@
}
cc_library_static {
- name: "libplatform_rutabaga",
+ name: "libgfxstream_platform_rutabaga",
host_supported: true,
vendor_available: true,
srcs: [
@@ -106,7 +106,7 @@
shared_libs: [
"libcutils",
"libdrm",
- "libplatform_rutabaga_server",
+ "libgfxstream_platform_rutabaga_server",
"liblog",
"libutils",
],
@@ -138,7 +138,7 @@
}
cc_library_static {
- name: "libplatform_stub",
+ name: "libgfxstream_platform_stub",
host_supported: true,
vendor: true,
srcs: [
diff --git a/guest/vulkan/Android.bp b/guest/vulkan/Android.bp
index 16047ae..806a77c 100644
--- a/guest/vulkan/Android.bp
+++ b/guest/vulkan/Android.bp
@@ -33,7 +33,7 @@
"vk_physical_device_properties_header_gfxstream",
],
header_libs: [
- "gfxstream_vulkan_headers",
+ "libgfxstream_vulkan_headers",
"mesa_common_headers_gfxstream",
"libnativewindow_headers",
"vulkan_enc_headers",
@@ -50,7 +50,7 @@
"libringbuffer",
"libqemupipe.ranchu",
"libarect",
- "libandroidemu_static",
+ "libgfxstream_androidemu_static",
],
shared_libs: [
"liblog",
@@ -124,12 +124,12 @@
"libgfxstream_guest_vulkan_defaults",
],
shared_libs: [
- "libplatform_rutabaga_server",
+ "libgfxstream_platform_rutabaga_server",
],
static_libs: [
"libgfxstream_guest_android_with_host",
"libgfxstream_guest_system_common_with_host",
- "libplatform_rutabaga",
+ "libgfxstream_platform_rutabaga",
],
cflags: [
"-DEND2END_TESTS",
diff --git a/guest/vulkan_enc/Android.bp b/guest/vulkan_enc/Android.bp
index 96c922f..f06d7b8 100644
--- a/guest/vulkan_enc/Android.bp
+++ b/guest/vulkan_enc/Android.bp
@@ -112,7 +112,7 @@
"libgfxstream_guest_cc_defaults",
],
header_libs: [
- "gfxstream_vulkan_headers",
+ "libgfxstream_vulkan_headers",
"libOpenglSystemCommonHeaders",
"libgfxstream_guest_iostream",
"libnativewindow_headers",
@@ -132,7 +132,7 @@
static_libs: [
"libarect",
"libdrm",
- "libandroidemu_static",
+ "libgfxstream_androidemu_static",
"libGoldfishAddressSpace",
"libmesa_vulkan_util_gfxstream",
"libmesa_vulkan_runtime_gfxstream",
@@ -198,10 +198,10 @@
"libgfxstream_guest_vulkan_encoder_defaults",
],
static_libs: [
- "libplatform_rutabaga",
+ "libgfxstream_platform_rutabaga",
],
export_static_lib_headers: [
- "libplatform_rutabaga",
+ "libgfxstream_platform_rutabaga",
],
target: {
host: {
diff --git a/guest/vulkan_enc_unit_tests/Android.bp b/guest/vulkan_enc_unit_tests/Android.bp
index c586bbb..8e3751d 100644
--- a/guest/vulkan_enc_unit_tests/Android.bp
+++ b/guest/vulkan_enc_unit_tests/Android.bp
@@ -30,7 +30,7 @@
"CommandBufferStagingStream_test.cpp",
],
header_libs: [
- "gfxstream_vulkan_headers",
+ "libgfxstream_vulkan_headers",
"libgfxstream_guest_iostream",
],
shared_libs: [
diff --git a/host/Android.bp b/host/Android.bp
index b2e37dc..426193f 100644
--- a/host/Android.bp
+++ b/host/Android.bp
@@ -29,39 +29,40 @@
],
header_libs: [
"gfxstream_opengl_headers",
- "gfxstream_vulkan_cereal_common",
+ "libgfxstream_host_vulkan_cereal_common",
],
static_libs: [
"gfxstream_base",
"gfxstream_host_common",
- "gfxstream_gl_host_common",
- "gfxstream_apigen_codec_common",
- "gfxstream_gl_server",
- "gfxstream_gles1_dec",
- "gfxstream_gles2_dec",
- "gfxstream_glsnapshot",
- "gfxstream_magma_dec",
- "gfxstream_magma_server",
- "gfxstream_translator_glcommon",
- "gfxstream_translator_egl",
- "gfxstream_translator_glescm",
- "gfxstream_translator_glesv2",
- "gfxstream_vulkan_cereal_host",
- "gfxstream_vulkan_server",
- "gfxstream_renderControl_dec",
- "gfxstream_dispatch",
- "gfxstream_glm",
- "gfxstream_compressedTextures",
- "gfxstream_emulated_textures",
+ "libgfxstream_common_utils",
"libgfxstream_etc",
+ "libgfxstream_glestranslator_egl",
+ "libgfxstream_glestranslator_glescm",
+ "libgfxstream_glestranslator_glesv2",
+ "libgfxstream_host_apigen_codec_common",
+ "libgfxstream_host_compressedtextures",
+ "libgfxstream_host_dispatch",
+ "libgfxstream_host_gl_host_common",
+ "libgfxstream_host_gl_server",
+ "libgfxstream_host_gles1_dec",
+ "libgfxstream_host_gles2_dec",
+ "libgfxstream_host_glestranslator_glcommon",
+ "libgfxstream_host_glsnapshot",
+ "libgfxstream_host_magma_dec",
+ "libgfxstream_host_magma_server",
+ "libgfxstream_host_rendercontrol_dec",
+ "libgfxstream_host_vulkan_cereal",
+ "libgfxstream_host_vulkan_emulatedtextures",
+ "libgfxstream_host_vulkan_server",
+ "libgfxstream_thirdparty_glm",
],
export_static_lib_headers: [
"gfxstream_base",
- "gfxstream_gl_host_common",
- "gfxstream_gles2_dec",
- "gfxstream_glsnapshot",
- "gfxstream_magma_server",
- "gfxstream_vulkan_cereal_host",
+ "libgfxstream_host_gl_host_common",
+ "libgfxstream_host_gles2_dec",
+ "libgfxstream_host_glsnapshot",
+ "libgfxstream_host_magma_server",
+ "libgfxstream_host_vulkan_cereal",
],
shared_libs: [
"liblog", // gfxstream_base uses this via perfetto-libperfettobase
@@ -126,22 +127,22 @@
],
header_libs: [
"gfxstream_opengl_headers",
- "gfxstream_vulkan_cereal_common",
+ "libgfxstream_host_vulkan_cereal_common",
],
shared_libs: [
"libbase",
"libgfxstream_backend",
],
export_static_lib_headers: [
- "gfxstream_oswindow_test_support",
+ "libgfxstream_oswindow_test_support",
],
static_libs: [
- "gfxstream_apigen_codec_common",
+ "libgfxstream_host_apigen_codec_common",
"gfxstream_base",
"gfxstream_base_test_support",
"gfxstream_host_common_test_support",
"gfxstream_snapshot",
- "gfxstream_oswindow_test_support",
+ "libgfxstream_oswindow_test_support",
"libgmock",
"liblz4",
],
@@ -155,7 +156,7 @@
"libbase",
],
static_libs: [
- "libgfxstream_stb",
+ "libgfxstream_thirdparty_stb",
],
srcs: [
"tests/ImageUtils.cpp",
@@ -167,7 +168,7 @@
name: "gfxstream_compositorvk_test",
defaults: ["gfxstream_defaults"],
header_libs: [
- "gfxstream_vulkan_cereal_common",
+ "libgfxstream_host_vulkan_cereal_common",
],
srcs: [
"tests/CompositorVk_unittest.cpp",
@@ -207,8 +208,8 @@
"libgfxstream_test_image_utils",
],
static_libs: [
- "gfxstream_vulkan_server",
- "gfxstream_glm",
+ "libgfxstream_host_vulkan_server",
+ "libgfxstream_thirdparty_glm",
"libc++fs",
],
test_options: {
@@ -225,7 +226,7 @@
name: "gfxstream_framebuffer_tests",
defaults: ["gfxstream_defaults"],
header_libs: [
- "gfxstream_vulkan_cereal_common",
+ "libgfxstream_host_vulkan_cereal_common",
],
srcs: [
"tests/FrameBuffer_unittest.cpp",
@@ -239,11 +240,11 @@
"gfxstream_backend_test_support",
"gfxstream_base",
"gfxstream_base_test_support",
- "gfxstream_glm",
+ "libgfxstream_thirdparty_glm",
"gfxstream_host_common_test_support",
- "gfxstream_oswindow_test_support",
+ "libgfxstream_oswindow_test_support",
"gfxstream_snapshot",
- "gfxstream_vulkan_server",
+ "libgfxstream_host_vulkan_server",
"libgmock",
"liblz4",
],
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index 3e280f1..f19f51c 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -129,6 +129,7 @@
target_link_libraries(
gfxstream_backend
PUBLIC
+ gfxstream_common_utils
gfxstream_backend_static
PRIVATE
)
diff --git a/host/apigen-codec-common/Android.bp b/host/apigen-codec-common/Android.bp
index 808ab78..ec741f5 100644
--- a/host/apigen-codec-common/Android.bp
+++ b/host/apigen-codec-common/Android.bp
@@ -16,11 +16,14 @@
}
cc_library_static {
- name: "gfxstream_apigen_codec_common",
- defaults: [ "gfxstream_defaults" ],
- static_libs: [ "gfxstream_base", "gfxstream_host_common", ],
- cflags: [ "-fvisibility=hidden" ],
- export_include_dirs: [ "." ],
+ name: "libgfxstream_host_apigen_codec_common",
+ defaults: ["gfxstream_defaults"],
+ static_libs: [
+ "gfxstream_base",
+ "gfxstream_host_common",
+ ],
+ cflags: ["-fvisibility=hidden"],
+ export_include_dirs: ["."],
srcs: [
"ChecksumCalculator.cpp",
"ChecksumCalculatorThreadInfo.cpp",
@@ -28,7 +31,7 @@
],
target: {
host: {
- srcs: [ "X11Support.cpp", ],
- }
- }
+ srcs: ["X11Support.cpp"],
+ },
+ },
}
diff --git a/host/compressedTextureFormats/Android.bp b/host/compressedTextureFormats/Android.bp
index 1e50124..e811381 100644
--- a/host/compressedTextureFormats/Android.bp
+++ b/host/compressedTextureFormats/Android.bp
@@ -8,8 +8,8 @@
}
cc_library_static {
- name: "gfxstream_compressedTextures",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_host_compressedtextures",
+ defaults: ["gfxstream_defaults"],
srcs: [
"AstcCpuDecompressorNoOp.cpp",
],
diff --git a/host/gl/Android.bp b/host/gl/Android.bp
index 36e2566..65dd9f9 100644
--- a/host/gl/Android.bp
+++ b/host/gl/Android.bp
@@ -9,8 +9,8 @@
}
cc_library_static {
- name: "gfxstream_gl_server",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_host_gl_server",
+ defaults: ["gfxstream_defaults"],
srcs: [
"BufferGl.cpp",
"ColorBufferGl.cpp",
@@ -35,8 +35,8 @@
"gfxstream_opengl_headers",
],
static_libs: [
- "gfxstream_gles1_dec",
- "gfxstream_gles2_dec",
- "gfxstream_glsnapshot",
+ "libgfxstream_host_gles1_dec",
+ "libgfxstream_host_gles2_dec",
+ "libgfxstream_host_glsnapshot",
],
-}
\ No newline at end of file
+}
diff --git a/host/gl/OpenGLESDispatch/Android.bp b/host/gl/OpenGLESDispatch/Android.bp
index 99369a4..4c045aa 100644
--- a/host/gl/OpenGLESDispatch/Android.bp
+++ b/host/gl/OpenGLESDispatch/Android.bp
@@ -8,18 +8,18 @@
}
cc_library_static {
- name: "gfxstream_dispatch",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_host_dispatch",
+ defaults: ["gfxstream_defaults"],
header_libs: [
"gfxstream_opengl_headers",
],
static_libs: [
"gfxstream_base",
- "gfxstream_glm",
- "gfxstream_gles1_dec",
- "gfxstream_gles2_dec",
- "gfxstream_apigen_codec_common",
- "gfxstream_translator_egl",
+ "libgfxstream_thirdparty_glm",
+ "libgfxstream_host_gles1_dec",
+ "libgfxstream_host_gles2_dec",
+ "libgfxstream_host_apigen_codec_common",
+ "libgfxstream_glestranslator_egl",
],
cflags: [
"-fvisibility=default",
diff --git a/host/gl/gl-host-common/Android.bp b/host/gl/gl-host-common/Android.bp
index de12c1a..1675504 100644
--- a/host/gl/gl-host-common/Android.bp
+++ b/host/gl/gl-host-common/Android.bp
@@ -9,15 +9,15 @@
cc_library_headers {
name: "gfxstream_gl_host_common_headers",
- defaults: [ "gfxstream_defaults" ],
+ defaults: ["gfxstream_defaults"],
export_include_dirs: [
"include",
],
}
cc_library_static {
- name: "gfxstream_gl_host_common",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_host_gl_host_common",
+ defaults: ["gfxstream_defaults"],
static_libs: [
"gfxstream_base",
"gfxstream_host_common",
@@ -42,4 +42,3 @@
"opengl/NativeGpuInfo_linux.cpp",
],
}
-
diff --git a/host/gl/gles1_dec/Android.bp b/host/gl/gles1_dec/Android.bp
index 6bd3c0c..2f9da63 100644
--- a/host/gl/gles1_dec/Android.bp
+++ b/host/gl/gles1_dec/Android.bp
@@ -8,14 +8,14 @@
}
cc_library_static {
- name: "gfxstream_gles1_dec",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_host_gles1_dec",
+ defaults: ["gfxstream_defaults"],
header_libs: [
"gfxstream_opengl_headers",
],
static_libs: [
- "gfxstream_apigen_codec_common",
- "gfxstream_glsnapshot",
+ "libgfxstream_host_apigen_codec_common",
+ "libgfxstream_host_glsnapshot",
],
srcs: [
"gles1_dec.cpp",
diff --git a/host/gl/gles2_dec/Android.bp b/host/gl/gles2_dec/Android.bp
index 93e99d6..71a2982 100644
--- a/host/gl/gles2_dec/Android.bp
+++ b/host/gl/gles2_dec/Android.bp
@@ -8,14 +8,14 @@
}
cc_library_static {
- name: "gfxstream_gles2_dec",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_host_gles2_dec",
+ defaults: ["gfxstream_defaults"],
header_libs: [
"gfxstream_opengl_headers",
],
static_libs: [
- "gfxstream_apigen_codec_common",
- "gfxstream_glsnapshot",
+ "libgfxstream_host_apigen_codec_common",
+ "libgfxstream_host_glsnapshot",
],
srcs: [
"gles2_dec.cpp",
diff --git a/host/gl/glestranslator/EGL/Android.bp b/host/gl/glestranslator/EGL/Android.bp
index edc282e..f612102 100644
--- a/host/gl/glestranslator/EGL/Android.bp
+++ b/host/gl/glestranslator/EGL/Android.bp
@@ -8,18 +8,18 @@
}
cc_library_static {
- name: "gfxstream_translator_egl",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_glestranslator_egl",
+ defaults: ["gfxstream_defaults"],
header_libs: [
"gfxstream_gl_host_common_headers",
"gfxstream_opengl_headers",
],
static_libs: [
"gfxstream_base",
- "gfxstream_apigen_codec_common",
- "gfxstream_translator_glcommon",
- "gfxstream_translator_glescm",
- "gfxstream_translator_glesv2",
+ "libgfxstream_host_apigen_codec_common",
+ "libgfxstream_host_glestranslator_glcommon",
+ "libgfxstream_glestranslator_glescm",
+ "libgfxstream_glestranslator_glesv2",
],
cflags: [
"-fvisibility=hidden",
@@ -48,6 +48,6 @@
"EglOsApi_glx.cpp",
"X11ErrorHandler.cpp",
],
- }
- }
+ },
+ },
}
diff --git a/host/gl/glestranslator/GLES_CM/Android.bp b/host/gl/glestranslator/GLES_CM/Android.bp
index 018faaa..9ba8e65 100644
--- a/host/gl/glestranslator/GLES_CM/Android.bp
+++ b/host/gl/glestranslator/GLES_CM/Android.bp
@@ -8,16 +8,16 @@
}
cc_library_static {
- name: "gfxstream_translator_glescm",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_glestranslator_glescm",
+ defaults: ["gfxstream_defaults"],
header_libs: [
"gfxstream_opengl_headers",
],
static_libs: [
"gfxstream_base",
- "gfxstream_glm",
- "gfxstream_apigen_codec_common",
- "gfxstream_translator_glcommon",
+ "libgfxstream_thirdparty_glm",
+ "libgfxstream_host_apigen_codec_common",
+ "libgfxstream_host_glestranslator_glcommon",
],
cflags: [
"-fvisibility=hidden",
diff --git a/host/gl/glestranslator/GLES_V2/Android.bp b/host/gl/glestranslator/GLES_V2/Android.bp
index c969c1e..0b1ad3b 100644
--- a/host/gl/glestranslator/GLES_V2/Android.bp
+++ b/host/gl/glestranslator/GLES_V2/Android.bp
@@ -8,15 +8,15 @@
}
cc_library_static {
- name: "gfxstream_translator_glesv2",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_glestranslator_glesv2",
+ defaults: ["gfxstream_defaults"],
header_libs: [
"gfxstream_opengl_headers",
],
static_libs: [
"gfxstream_base",
- "gfxstream_apigen_codec_common",
- "gfxstream_translator_glcommon",
+ "libgfxstream_host_apigen_codec_common",
+ "libgfxstream_host_glestranslator_glcommon",
],
cflags: [
"-fvisibility=hidden",
diff --git a/host/gl/glestranslator/GLcommon/Android.bp b/host/gl/glestranslator/GLcommon/Android.bp
index 765103b..5929319 100644
--- a/host/gl/glestranslator/GLcommon/Android.bp
+++ b/host/gl/glestranslator/GLcommon/Android.bp
@@ -8,8 +8,8 @@
}
cc_library_static {
- name: "gfxstream_translator_glcommon",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_host_glestranslator_glcommon",
+ defaults: ["gfxstream_defaults"],
cflags: [
"-fvisibility=hidden",
"-Wno-inconsistent-missing-override",
diff --git a/host/gl/glsnapshot/Android.bp b/host/gl/glsnapshot/Android.bp
index 0218431..a93c9b9 100644
--- a/host/gl/glsnapshot/Android.bp
+++ b/host/gl/glsnapshot/Android.bp
@@ -11,8 +11,8 @@
}
cc_library_static {
- name: "gfxstream_glsnapshot",
- defaults: [ "gfxstream_defaults" ],
- srcs: [ "GLSnapshot.cpp", ],
- export_include_dirs: [ "." ],
+ name: "libgfxstream_host_glsnapshot",
+ defaults: ["gfxstream_defaults"],
+ srcs: ["GLSnapshot.cpp"],
+ export_include_dirs: ["."],
}
diff --git a/host/include/gfxstream/virtio-gpu-gfxstream-renderer-unstable.h b/host/include/gfxstream/virtio-gpu-gfxstream-renderer-unstable.h
index 952718e..f913f07 100644
--- a/host/include/gfxstream/virtio-gpu-gfxstream-renderer-unstable.h
+++ b/host/include/gfxstream/virtio-gpu-gfxstream-renderer-unstable.h
@@ -54,6 +54,10 @@
int64_t result_code, uint32_t op_code, const char* function, uint32_t line,
uint64_t allocation_size, bool is_host_side_result, bool is_allocation);
+// STREAM_RENDERER_PARAM_RENDERER_FEATURES: stream_renderer_param::value is a pointer to a null
+// terminated string of the form "<feature1 name>:[enabled|disabled],<feature 2 ...>".
+#define STREAM_RENDERER_PARAM_RENDERER_FEATURES 11
+
#define STREAM_RENDERER_PARAM_METRICS_CALLBACK_SET_ANNOTATION 1028
typedef void (*stream_renderer_param_metrics_callback_set_annotation)(const char* key,
const char* value);
diff --git a/host/include/gfxstream/virtio-gpu-gfxstream-renderer.h b/host/include/gfxstream/virtio-gpu-gfxstream-renderer.h
index 081befc..9e8d280 100644
--- a/host/include/gfxstream/virtio-gpu-gfxstream-renderer.h
+++ b/host/include/gfxstream/virtio-gpu-gfxstream-renderer.h
@@ -86,22 +86,23 @@
uint32_t handle_type;
};
-// Log level of gfxstream
-#ifndef STREAM_RENDERER_LOG_LEVEL
-#define STREAM_RENDERER_LOG_LEVEL 1
-#endif
-
// @user_data: custom user data passed during `stream_renderer_init`
// @type: one of STREAM_RENDERER_DEBUG_*
// @string: null-terminated C-string
#define STREAM_RENDERER_DEBUG_ERROR 0x1
#define STREAM_RENDERER_DEBUG_WARN 0x2
#define STREAM_RENDERER_DEBUG_INFO 0x3
+#define STREAM_RENDERER_DEBUG_DEBUG 0x4
struct stream_renderer_debug {
uint32_t debug_type;
const char* message;
};
+// Log level of gfxstream
+#ifndef STREAM_RENDERER_LOG_LEVEL
+#define STREAM_RENDERER_LOG_LEVEL STREAM_RENDERER_DEBUG_INFO
+#endif
+
// Callback for writing a fence.
typedef void (*stream_renderer_fence_callback)(void* user_data,
struct stream_renderer_fence* fence_data);
diff --git a/host/magma/Android.bp b/host/magma/Android.bp
index 1ce98fb..bc64fd6 100644
--- a/host/magma/Android.bp
+++ b/host/magma/Android.bp
@@ -3,14 +3,14 @@
}
cc_library_static {
- name: "gfxstream_magma_server",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_host_magma_server",
+ defaults: ["gfxstream_defaults"],
static_libs: [
"gfxstream_base",
"gfxstream_host_common",
- "gfxstream_magma_dec",
- "gfxstream_apigen_codec_common",
- "gfxstream_vulkan_cereal_host",
+ "libgfxstream_host_magma_dec",
+ "libgfxstream_host_apigen_codec_common",
+ "libgfxstream_host_vulkan_cereal",
],
srcs: [
"Decoder.cpp",
@@ -49,6 +49,6 @@
cflags: [
"-DGFXSTREAM_MAGMA_USE_INTEL_DRM=1",
],
- }
- }
+ },
+ },
}
diff --git a/host/magma/magma_dec/Android.bp b/host/magma/magma_dec/Android.bp
index f679bb5..7f98fae 100644
--- a/host/magma/magma_dec/Android.bp
+++ b/host/magma/magma_dec/Android.bp
@@ -3,10 +3,10 @@
}
cc_library_static {
- name: "gfxstream_magma_dec",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_host_magma_dec",
+ defaults: ["gfxstream_defaults"],
static_libs: [
- "gfxstream_apigen_codec_common",
+ "libgfxstream_host_apigen_codec_common",
],
srcs: [
"magma_dec.cpp",
diff --git a/host/meson.build b/host/meson.build
index 060bbf7..c78142c 100644
--- a/host/meson.build
+++ b/host/meson.build
@@ -153,9 +153,9 @@
subdir('gl/gl-host-common')
inc_gfxstream_backend = [inc_root, inc_gfxstream_include, inc_include, inc_apigen_codec, inc_utils,
- inc_gl_host_common, inc_host_include]
+ inc_gl_host_common, inc_host_include, inc_common_utils]
-link_gfxstream_backend = [lib_gl_host_common, lib_apigen_codec]
+link_gfxstream_backend = [lib_gl_host_common, lib_apigen_codec, lib_common_utils]
files_lib_gfxstream_backend = files(
'Buffer.cpp',
diff --git a/host/renderControl_dec/Android.bp b/host/renderControl_dec/Android.bp
index c123fec..6cf0ca7 100644
--- a/host/renderControl_dec/Android.bp
+++ b/host/renderControl_dec/Android.bp
@@ -8,8 +8,8 @@
}
cc_library_static {
- name: "gfxstream_renderControl_dec",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_host_rendercontrol_dec",
+ defaults: ["gfxstream_defaults"],
header_libs: [
"gfxstream_opengl_headers",
],
@@ -17,7 +17,7 @@
"gfxstream_opengl_headers",
],
static_libs: [
- "gfxstream_apigen_codec_common",
+ "libgfxstream_host_apigen_codec_common",
],
srcs: [
"renderControl_dec.cpp",
diff --git a/host/testlibs/Android.bp b/host/testlibs/Android.bp
index b7279fd..47e881d 100644
--- a/host/testlibs/Android.bp
+++ b/host/testlibs/Android.bp
@@ -13,8 +13,8 @@
}
cc_test_library {
- name: "gfxstream_oswindow_test_support",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_oswindow_test_support",
+ defaults: ["gfxstream_defaults"],
header_libs: [
"gfxstream_opengl_headers",
],
diff --git a/host/virtio-gpu-gfxstream-renderer.cpp b/host/virtio-gpu-gfxstream-renderer.cpp
index 1d9706d..fabe6cb 100644
--- a/host/virtio-gpu-gfxstream-renderer.cpp
+++ b/host/virtio-gpu-gfxstream-renderer.cpp
@@ -30,6 +30,7 @@
#include "aemu/base/Tracing.h"
#include "aemu/base/memory/SharedMemory.h"
#include "aemu/base/synchronization/Lock.h"
+#include "gfxstream/Strings.h"
#include "host-common/AddressSpaceService.h"
#include "host-common/GfxstreamFatalError.h"
#include "host-common/address_space_device.h"
@@ -71,7 +72,7 @@
void* globalUserData = nullptr;
stream_renderer_debug_callback globalDebugCallback = nullptr;
-void stream_renderer_debug(uint32_t type, const char* format, ...) {
+void stream_renderer_log(uint32_t type, const char* format, ...) {
char buf[MAX_DEBUG_BUFFER_SIZE];
va_list args;
va_start(args, format);
@@ -89,26 +90,46 @@
}
}
-#if STREAM_RENDERER_LOG_LEVEL >= 1
-#define stream_renderer_error(format, ...) \
- do { \
- stream_renderer_debug(STREAM_RENDERER_DEBUG_ERROR, "[%s(%d)] %s " format, \
- __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); \
+#if STREAM_RENDERER_LOG_LEVEL >= STREAM_RENDERER_DEBUG_ERROR
+#define stream_renderer_error(format, ...) \
+ do { \
+ stream_renderer_log(STREAM_RENDERER_DEBUG_ERROR, "[%s(%d)] %s " format, __FILE__, \
+ __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); \
} while (0)
#else
#define stream_renderer_error(format, ...)
#endif
-#if STREAM_RENDERER_LOG_LEVEL >= 3
-#define stream_renderer_info(format, ...) \
- do { \
- stream_renderer_debug(STREAM_RENDERER_DEBUG_INFO, "[%s(%d)] %s " format, \
- __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); \
+#if STREAM_RENDERER_LOG_LEVEL >= STREAM_RENDERER_DEBUG_WARN
+#define stream_renderer_warn(format, ...) \
+ do { \
+ stream_renderer_log(STREAM_RENDERER_DEBUG_WARN, "[%s(%d)] %s " format, __FILE__, __LINE__, \
+ __PRETTY_FUNCTION__, ##__VA_ARGS__); \
+ } while (0)
+#else
+#define stream_renderer_warn(format, ...)
+#endif
+
+#if STREAM_RENDERER_LOG_LEVEL >= STREAM_RENDERER_DEBUG_INFO
+#define stream_renderer_info(format, ...) \
+ do { \
+ stream_renderer_log(STREAM_RENDERER_DEBUG_INFO, "[%s(%d)] %s " format, __FILE__, __LINE__, \
+ __FUNCTION__, ##__VA_ARGS__); \
} while (0)
#else
#define stream_renderer_info(format, ...)
#endif
+#if STREAM_RENDERER_LOG_LEVEL >= STREAM_RENDERER_DEBUG_DEBUG
+#define stream_renderer_debug(format, ...) \
+ do { \
+ stream_renderer_log(STREAM_RENDERER_DEBUG_DEBUG, "[%s(%d)] %s " format, __FILE__, \
+ __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); \
+ } while (0)
+#else
+#define stream_renderer_debug(format, ...)
+#endif
+
// Virtio Goldfish Pipe: Overview-----------------------------------------------
//
// Virtio Goldfish Pipe is meant for running goldfish pipe services with a
@@ -488,9 +509,9 @@
static int sync_iov(PipeResEntry* res, uint64_t offset, const stream_renderer_box* box,
IovSyncDir dir) {
- stream_renderer_info("offset: 0x%llx box: %u %u %u %u size %u x %u iovs %u linearSize %zu",
- (unsigned long long)offset, box->x, box->y, box->w, box->h,
- res->args.width, res->args.height, res->numIovs, res->linearSize);
+ stream_renderer_debug("offset: 0x%llx box: %u %u %u %u size %u x %u iovs %u linearSize %zu",
+ (unsigned long long)offset, box->x, box->y, box->w, box->h,
+ res->args.width, res->args.height, res->numIovs, res->linearSize);
if (box->x > res->args.width || box->y > res->args.height) {
stream_renderer_error("Box out of range of resource");
@@ -575,7 +596,7 @@
PipeVirglRenderer() = default;
int init(void* cookie, int flags, stream_renderer_fence_callback fence_callback) {
- stream_renderer_info("cookie: %p", cookie);
+ stream_renderer_debug("cookie: %p", cookie);
mCookie = cookie;
mFenceCallback = fence_callback;
mVirtioGpuOps = android_getVirtioGpuOps();
@@ -599,7 +620,7 @@
}
int resetPipe(GoldfishHwPipe* hwPipe, GoldfishHostPipe* hostPipe) {
- stream_renderer_info("Want to reset hwpipe %p to hostpipe %p", hwPipe, hostPipe);
+ stream_renderer_debug("Want to reset hwpipe %p to hostpipe %p", hwPipe, hostPipe);
VirtioGpuCtxId asCtxId = (VirtioGpuCtxId)(uintptr_t)hwPipe;
auto it = mContexts.find(asCtxId);
if (it == mContexts.end()) {
@@ -608,9 +629,9 @@
}
auto& entry = it->second;
- stream_renderer_info("ctxid: %u prev hostpipe: %p", asCtxId, entry.hostPipe);
+ stream_renderer_debug("ctxid: %u prev hostpipe: %p", asCtxId, entry.hostPipe);
entry.hostPipe = hostPipe;
- stream_renderer_info("ctxid: %u next hostpipe: %p", asCtxId, entry.hostPipe);
+ stream_renderer_debug("ctxid: %u next hostpipe: %p", asCtxId, entry.hostPipe);
// Also update any resources associated with it
auto resourcesIt = mContextResources.find(asCtxId);
@@ -639,13 +660,13 @@
uint32_t context_init) {
std::string contextName(name, nlen);
- stream_renderer_info("ctxid: %u len: %u name: %s", ctx_id, nlen, contextName.c_str());
+ stream_renderer_debug("ctxid: %u len: %u name: %s", ctx_id, nlen, contextName.c_str());
auto ops = ensureAndGetServiceOps();
auto hostPipe = ops->guest_open_with_flags(reinterpret_cast<GoldfishHwPipe*>(ctx_id),
0x1 /* is virtio */);
if (!hostPipe) {
- stream_renderer_error("failed to create hw pipe!\n");
+ stream_renderer_error("failed to create hw pipe!");
return -EINVAL;
}
std::unordered_map<uint32_t, uint32_t> map;
@@ -661,18 +682,18 @@
map, // resourceId --> ASG handle map
};
- stream_renderer_info("initial host pipe for ctxid %u: %p", ctx_id, hostPipe);
+ stream_renderer_debug("initial host pipe for ctxid %u: %p", ctx_id, hostPipe);
mContexts[ctx_id] = res;
android_onGuestGraphicsProcessCreate(ctx_id);
return 0;
}
int destroyContext(VirtioGpuCtxId handle) {
- stream_renderer_info("ctxid: %u", handle);
+ stream_renderer_debug("ctxid: %u", handle);
auto it = mContexts.find(handle);
if (it == mContexts.end()) {
- stream_renderer_error("could not find context handle %u\n", handle);
+ stream_renderer_error("could not find context handle %u", handle);
return -EINVAL;
}
@@ -799,16 +820,16 @@
void* buffer = reinterpret_cast<void*>(cmd->cmd);
VirtioGpuRing ring = VirtioGpuRingGlobal{};
- stream_renderer_info("ctx: % u, ring: %s buffer: %p dwords: %d", cmd->ctx_id,
- to_string(ring).c_str(), buffer, cmd->cmd_size);
+ stream_renderer_debug("ctx: % u, ring: %s buffer: %p dwords: %d", cmd->ctx_id,
+ to_string(ring).c_str(), buffer, cmd->cmd_size);
if (!buffer) {
- stream_renderer_error("error: buffer null\n");
+ stream_renderer_error("error: buffer null");
return -EINVAL;
}
if (cmd->cmd_size < 4) {
- stream_renderer_error("error: not enough bytes (got %d)\n", cmd->cmd_size);
+ stream_renderer_error("error: not enough bytes (got %d)", cmd->cmd_size);
return -EINVAL;
}
@@ -827,7 +848,7 @@
uint64_t sync_handle =
convert32to64(exportSync.syncHandleLo, exportSync.syncHandleHi);
- stream_renderer_info("wait for gpu ring %s", to_string(ring).c_str());
+ stream_renderer_debug("wait for gpu ring %s", to_string(ring).c_str());
auto taskId = mVirtioGpuTimelines->enqueueTask(ring);
mVirtioGpuOps->async_wait_for_gpu_with_cb(sync_handle, [this, taskId] {
mVirtioGpuTimelines->notifyTaskCompletion(taskId);
@@ -853,7 +874,7 @@
uint64_t fence_handle =
convert32to64(exportSyncVK.fenceHandleLo, exportSyncVK.fenceHandleHi);
- stream_renderer_info("wait for gpu ring %s", to_string(ring).c_str());
+ stream_renderer_debug("wait for gpu ring %s", to_string(ring).c_str());
auto taskId = mVirtioGpuTimelines->enqueueTask(ring);
mVirtioGpuOps->async_wait_for_gpu_vulkan_with_cb(
device_handle, fence_handle,
@@ -875,8 +896,8 @@
uint64_t image_handle =
convert32to64(exportQSRI.imageHandleLo, exportQSRI.imageHandleHi);
- stream_renderer_info("wait for gpu vk qsri ring %u image 0x%llx",
- to_string(ring).c_str(), (unsigned long long)image_handle);
+ stream_renderer_debug("wait for gpu vk qsri ring %u image 0x%llx",
+ to_string(ring).c_str(), (unsigned long long)image_handle);
auto taskId = mVirtioGpuTimelines->enqueueTask(ring);
mVirtioGpuOps->async_wait_for_gpu_vulkan_qsri_with_cb(image_handle, [this, taskId] {
mVirtioGpuTimelines->notifyTaskCompletion(taskId);
@@ -895,8 +916,8 @@
}
int createFence(uint64_t fence_id, const VirtioGpuRing& ring) {
- stream_renderer_info("fenceid: %llu ring: %s", (unsigned long long)fence_id,
- to_string(ring).c_str());
+ stream_renderer_debug("fenceid: %llu ring: %s", (unsigned long long)fence_id,
+ to_string(ring).c_str());
struct {
FenceCompletionCallback operator()(const VirtioGpuRingGlobal&) {
@@ -1004,8 +1025,8 @@
void handleCreateResourceColorBuffer(struct stream_renderer_resource_create_args* args) {
// corresponds to allocation of gralloc buffer in minigbm
- stream_renderer_info("w h %u %u resid %u -> CreateColorBufferWithHandle", args->width,
- args->height, args->handle);
+ stream_renderer_debug("w h %u %u resid %u -> CreateColorBufferWithHandle", args->width,
+ args->height, args->handle);
const uint32_t glformat = virgl_format_to_gl(args->format);
const uint32_t fwkformat = virgl_format_to_fwk_format(args->format);
@@ -1017,7 +1038,7 @@
int createResource(struct stream_renderer_resource_create_args* args, struct iovec* iov,
uint32_t num_iovs) {
- stream_renderer_info("handle: %u. num iovs: %u", args->handle, num_iovs);
+ stream_renderer_debug("handle: %u. num iovs: %u", args->handle, num_iovs);
const auto resType = getResourceType(*args);
switch (resType) {
@@ -1047,7 +1068,7 @@
}
void unrefResource(uint32_t toUnrefId) {
- stream_renderer_info("handle: %u", toUnrefId);
+ stream_renderer_debug("handle: %u", toUnrefId);
auto it = mResources.find(toUnrefId);
if (it == mResources.end()) return;
@@ -1096,16 +1117,16 @@
}
int attachIov(int resId, iovec* iov, int num_iovs) {
- stream_renderer_info("resid: %d numiovs: %d", resId, num_iovs);
+ stream_renderer_debug("resid: %d numiovs: %d", resId, num_iovs);
auto it = mResources.find(resId);
if (it == mResources.end()) return ENOENT;
auto& entry = it->second;
- stream_renderer_info("res linear: %p", entry.linear);
+ stream_renderer_debug("res linear: %p", entry.linear);
if (!entry.linear) allocResource(entry, iov, num_iovs);
- stream_renderer_info("done");
+ stream_renderer_debug("done");
return 0;
}
@@ -1117,9 +1138,9 @@
if (num_iovs) {
*num_iovs = entry.numIovs;
- stream_renderer_info("resid: %d numIovs: %d", resId, *num_iovs);
+ stream_renderer_debug("resid: %d numIovs: %d", resId, *num_iovs);
} else {
- stream_renderer_info("resid: %d numIovs: 0", resId);
+ stream_renderer_debug("resid: %d numIovs: 0", resId);
}
entry.numIovs = 0;
@@ -1132,7 +1153,7 @@
}
allocResource(entry, entry.iov, entry.numIovs);
- stream_renderer_info("done");
+ stream_renderer_debug("done");
}
int handleTransferReadPipe(PipeResEntry* res, uint64_t offset, stream_renderer_box* box) {
@@ -1178,12 +1199,12 @@
// Do the pipe service op here, if there is an associated hostpipe.
auto hostPipe = res->hostPipe;
if (!hostPipe) {
- stream_renderer_info("No hostPipe");
+ stream_renderer_error("No hostPipe");
return -EINVAL;
}
- stream_renderer_info("resid: %d offset: 0x%llx hostpipe: %p", res->args.handle,
- (unsigned long long)offset, hostPipe);
+ stream_renderer_debug("resid: %d offset: 0x%llx hostpipe: %p", res->args.handle,
+ (unsigned long long)offset, hostPipe);
auto ops = ensureAndGetServiceOps();
@@ -1434,7 +1455,7 @@
}
void attachResource(uint32_t ctxId, uint32_t resId) {
- stream_renderer_info("ctxid: %u resid: %u", ctxId, resId);
+ stream_renderer_debug("ctxid: %u resid: %u", ctxId, resId);
auto resourcesIt = mContextResources.find(ctxId);
@@ -1468,18 +1489,18 @@
if (ctxEntryIt == mContexts.end() || resEntryIt == mResources.end()) return;
- stream_renderer_info("hostPipe: %p", ctxEntryIt->second.hostPipe);
+ stream_renderer_debug("hostPipe: %p", ctxEntryIt->second.hostPipe);
resEntryIt->second.hostPipe = ctxEntryIt->second.hostPipe;
resEntryIt->second.ctxId = ctxId;
}
void detachResource(uint32_t ctxId, uint32_t toUnrefId) {
- stream_renderer_info("ctxid: %u resid: %u", ctxId, toUnrefId);
+ stream_renderer_debug("ctxid: %u resid: %u", ctxId, toUnrefId);
detachResourceLocked(ctxId, toUnrefId);
}
int getResourceInfo(uint32_t resId, struct stream_renderer_resource_info* info) {
- stream_renderer_info("resid: %u", resId);
+ stream_renderer_debug("resid: %u", resId);
if (!info) return EINVAL;
auto it = mResources.find(resId);
@@ -1565,8 +1586,8 @@
int createBlob(uint32_t ctx_id, uint32_t res_handle,
const struct stream_renderer_create_blob* create_blob,
const struct stream_renderer_handle* handle) {
- stream_renderer_info("ctx:%u res:%u blob-id:%u blob-size:%u",
- ctx_id, res_handle, create_blob->blob_id, create_blob->size);
+ stream_renderer_debug("ctx:%u res:%u blob-id:%u blob-size:%u", ctx_id, res_handle,
+ create_blob->blob_id, create_blob->size);
PipeResEntry e;
struct stream_renderer_resource_create_args args = {0};
@@ -1762,17 +1783,17 @@
#endif // CONFIG_AEMU
private:
void allocResource(PipeResEntry& entry, iovec* iov, int num_iovs) {
- stream_renderer_info("entry linear: %p", entry.linear);
+ stream_renderer_debug("entry linear: %p", entry.linear);
if (entry.linear) free(entry.linear);
size_t linearSize = 0;
for (uint32_t i = 0; i < num_iovs; ++i) {
- stream_renderer_info("iov base: %p", iov[i].iov_base);
+ stream_renderer_debug("iov base: %p", iov[i].iov_base);
linearSize += iov[i].iov_len;
- stream_renderer_info("has iov of %zu. linearSize current: %zu", iov[i].iov_len,
- linearSize);
+ stream_renderer_debug("has iov of %zu. linearSize current: %zu", iov[i].iov_len,
+ linearSize);
}
- stream_renderer_info("final linearSize: %zu", linearSize);
+ stream_renderer_debug("final linearSize: %zu", linearSize);
void* linear = nullptr;
@@ -1786,7 +1807,7 @@
}
void detachResourceLocked(uint32_t ctxId, uint32_t toUnrefId) {
- stream_renderer_info("ctxid: %u resid: %u", ctxId, toUnrefId);
+ stream_renderer_debug("ctxid: %u resid: %u", ctxId, toUnrefId);
auto it = mContextResources.find(ctxId);
if (it == mContextResources.end()) return;
@@ -2137,9 +2158,9 @@
};
static int stream_renderer_opengles_init(uint32_t display_width, uint32_t display_height,
- int renderer_flags) {
- stream_renderer_info("start. display dimensions: width %u height %u, renderer flags: 0x%x",
- display_width, display_height, renderer_flags);
+ int renderer_flags, const std::string& renderer_features) {
+ stream_renderer_debug("start. display dimensions: width %u height %u, renderer flags: 0x%x",
+ display_width, display_height, renderer_flags);
// Flags processing
@@ -2187,12 +2208,12 @@
if (useSystemBlob) {
if (!useExternalBlob) {
- stream_renderer_info("USE_EXTERNAL_BLOB must be on with USE_SYSTEM_BLOB");
+ stream_renderer_error("USE_EXTERNAL_BLOB must be on with USE_SYSTEM_BLOB");
return -EINVAL;
}
#ifndef _WIN32
- stream_renderer_info("Warning: USE_SYSTEM_BLOB has only been tested on Windows");
+ stream_renderer_warn("Warning: USE_SYSTEM_BLOB has only been tested on Windows");
#endif
}
@@ -2224,6 +2245,36 @@
feature_set_enabled_override(kFeature_VulkanSnapshots, true);
}
+ for (const std::string& renderer_feature : gfxstream::Split(renderer_features, ",")) {
+ if (renderer_feature.empty()) continue;
+
+ const std::vector<std::string>& parts = gfxstream::Split(renderer_feature, ":");
+ if (parts.size() != 2) {
+ stream_renderer_error("Error: invalid renderer features: %s",
+ renderer_features.c_str());
+ return -EINVAL;
+ }
+
+ const std::string& feature_name = parts[0];
+ const Feature feature = feature_from_name(feature_name.c_str());
+ if (feature == kFeature_unknown) {
+ stream_renderer_error("Error: invalid renderer feature: '%s'", feature_name.c_str());
+ return -EINVAL;
+ }
+
+ const std::string& feature_status = parts[1];
+ if (feature_status != "enabled" && feature_status != "disabled") {
+ stream_renderer_error("Error: invalid option %s for renderer feature: %s",
+ feature_status.c_str(), feature_name.c_str());
+ return -EINVAL;
+ }
+
+ feature_set_enabled_override(feature, feature_status == "enabled");
+
+ stream_renderer_error("Gfxstream feature %s %s", feature_name.c_str(),
+ feature_status.c_str());
+ }
+
android::featurecontrol::productFeatureOverride();
if (useVulkanNativeSwapchain && !enableVk) {
@@ -2273,7 +2324,7 @@
android_getOpenglesHardwareStrings(&vendor, &renderer, &version);
- stream_renderer_info("GL strings; [%s] [%s] [%s].\n", vendor, renderer, version);
+ stream_renderer_info("GL strings; [%s] [%s] [%s].", vendor, renderer, version);
auto openglesRenderer = android_getOpenglesRenderer();
@@ -2341,11 +2392,12 @@
uint32_t display_height = 0;
void* renderer_cookie = nullptr;
int renderer_flags = 0;
+ std::string renderer_features;
stream_renderer_fence_callback fence_callback = nullptr;
bool skip_opengles = false;
// Iterate all parameters that we support.
- stream_renderer_info("Reading stream renderer parameters:");
+ stream_renderer_debug("Reading stream renderer parameters:");
for (uint64_t i = 0; i < num_params; ++i) {
stream_renderer_param& param = stream_renderer_params[i];
@@ -2353,11 +2405,11 @@
// adding new prints.
if (printed_param_values.find(param.key) != printed_param_values.end() ||
param.value <= 4096) {
- stream_renderer_info("%s - %llu", get_param_string(param.key).c_str(),
- static_cast<unsigned long long>(param.value));
+ stream_renderer_debug("%s - %llu", get_param_string(param.key).c_str(),
+ static_cast<unsigned long long>(param.value));
} else {
// If not full value, print that it was passed.
- stream_renderer_info("%s", get_param_string(param.key).c_str());
+ stream_renderer_debug("%s", get_param_string(param.key).c_str());
}
// Removing every param we process will leave required_params empty if all provided.
@@ -2419,6 +2471,11 @@
static_cast<uintptr_t>(param.value));
break;
}
+ case STREAM_RENDERER_PARAM_RENDERER_FEATURES: {
+ renderer_features =
+ std::string(reinterpret_cast<const char*>(static_cast<uintptr_t>(param.value)));
+ break;
+ }
case STREAM_RENDERER_PARAM_METRICS_CALLBACK_SET_ANNOTATION: {
MetricsLogger::set_crash_annotation_callback =
reinterpret_cast<stream_renderer_param_metrics_callback_set_annotation>(
@@ -2440,7 +2497,7 @@
}
}
}
- stream_renderer_info("Finished reading parameters");
+ stream_renderer_debug("Finished reading parameters");
// Some required params not found.
if (required_params.size() > 0) {
@@ -2481,7 +2538,8 @@
if (!skip_opengles) {
// aemu currently does its own opengles initialization in
// qemu/android/android-emu/android/opengles.cpp.
- int ret = stream_renderer_opengles_init(display_width, display_height, renderer_flags);
+ int ret = stream_renderer_opengles_init(display_width, display_height, renderer_flags,
+ renderer_features);
if (ret) {
return ret;
}
@@ -2490,7 +2548,7 @@
sRenderer()->init(renderer_cookie, renderer_flags, fence_callback);
gfxstream::FrameBuffer::waitUntilInitialized();
- stream_renderer_info("Started renderer");
+ stream_renderer_info("Gfxstream initialized successfully!");
return 0;
}
diff --git a/host/vulkan/Android.bp b/host/vulkan/Android.bp
index f8e9d12..b40cb90 100644
--- a/host/vulkan/Android.bp
+++ b/host/vulkan/Android.bp
@@ -10,21 +10,21 @@
}
cc_library_static {
- name: "gfxstream_vulkan_server",
+ name: "libgfxstream_host_vulkan_server",
defaults: ["gfxstream_defaults"],
header_libs: [
"gfxstream_gl_host_common_headers",
"gfxstream_opengl_headers",
- "gfxstream_vulkan_cereal_common",
+ "libgfxstream_host_vulkan_cereal_common",
],
static_libs: [
"gfxstream_base",
- "gfxstream_glm",
- "gfxstream_compressedTextures",
- "gfxstream_emulated_textures",
+ "libgfxstream_thirdparty_glm",
+ "libgfxstream_host_compressedtextures",
+ "libgfxstream_host_vulkan_emulatedtextures",
"gfxstream_host_common",
- "gfxstream_apigen_codec_common",
- "gfxstream_vulkan_cereal_host",
+ "libgfxstream_host_apigen_codec_common",
+ "libgfxstream_host_vulkan_cereal",
],
cflags: [
"-fvisibility=hidden",
@@ -84,9 +84,9 @@
"liblog",
],
static_libs: [
- "gfxstream_glm",
+ "libgfxstream_thirdparty_glm",
"gfxstream_host_common",
- "gfxstream_vulkan_server",
+ "libgfxstream_host_vulkan_server",
"libgtest",
"libgmock",
],
diff --git a/host/vulkan/VkDecoderGlobalState.cpp b/host/vulkan/VkDecoderGlobalState.cpp
index 28298ad..2536720 100644
--- a/host/vulkan/VkDecoderGlobalState.cpp
+++ b/host/vulkan/VkDecoderGlobalState.cpp
@@ -3868,6 +3868,7 @@
VkImportMemoryHostPointerInfoEXT importHostInfo;
std::optional<SharedMemory> sharedMemory = std::nullopt;
+ std::shared_ptr<PrivateMemory> privateMemory = {};
// TODO(b/261222354): Make sure the feature exists when initializing sVkEmulation.
if (hostVisible && feature_is_enabled(kFeature_SystemBlob)) {
@@ -3902,6 +3903,22 @@
vk_append_struct(&structChainIter, &importHostInfo);
}
+ VkImportMemoryHostPointerInfoEXT importHostInfoPrivate{};
+ if (hostVisible && feature_is_enabled(kFeature_VulkanAllocateHostMemory) &&
+ localAllocInfo.pNext == nullptr) {
+ VkDeviceSize alignedSize = __ALIGN(localAllocInfo.allocationSize, kPageSizeforBlob);
+ localAllocInfo.allocationSize = alignedSize;
+ privateMemory =
+ std::make_shared<PrivateMemory>(kPageSizeforBlob, localAllocInfo.allocationSize);
+ mappedPtr = privateMemory->getAddr();
+ importHostInfoPrivate = {
+ .sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT,
+ .pNext = NULL,
+ .handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT,
+ .pHostPointer = mappedPtr};
+ vk_append_struct(&structChainIter, &importHostInfoPrivate);
+ }
+
VkResult result = vk->vkAllocateMemory(device, &localAllocInfo, pAllocator, pMemory);
if (result != VK_SUCCESS) {
@@ -3992,6 +4009,8 @@
// Always assign the shared memory into memoryInfo. If it was used, then it will have
// ownership transferred.
memoryInfo.sharedMemory = std::exchange(sharedMemory, std::nullopt);
+
+ memoryInfo.privateMemory = privateMemory;
}
*pMemory = new_boxed_non_dispatchable_VkDeviceMemory(*pMemory);
diff --git a/host/vulkan/VkDecoderInternalStructs.h b/host/vulkan/VkDecoderInternalStructs.h
index 6a90923..bf1e55f 100644
--- a/host/vulkan/VkDecoderInternalStructs.h
+++ b/host/vulkan/VkDecoderInternalStructs.h
@@ -16,6 +16,11 @@
#include <vulkan/vulkan.h>
+#ifdef _WIN32
+#include <malloc.h>
+#endif
+
+#include <stdlib.h>
#include <set>
#include <string>
@@ -100,6 +105,32 @@
int mMaxSize;
};
+class PrivateMemory {
+public:
+ PrivateMemory(size_t alignment, size_t size) {
+#ifdef _WIN32
+ mAddr = _aligned_malloc(size, alignment);
+#else
+ mAddr = aligned_alloc(alignment, size);
+#endif
+ }
+ ~PrivateMemory() {
+ if (mAddr) {
+#ifdef _WIN32
+ _aligned_free(mAddr);
+#else
+ free(mAddr);
+#endif
+ mAddr = nullptr;
+ }
+ }
+ void* getAddr() {
+ return mAddr;
+ }
+private:
+ void* mAddr{nullptr};
+};
+
// We always map the whole size on host.
// This makes it much easier to implement
// the memory map API.
@@ -126,6 +157,7 @@
// Set if the memory is backed by shared memory.
std::optional<android::base::SharedMemory> sharedMemory;
+ std::shared_ptr<PrivateMemory> privateMemory;
// virtio-gpu blobs
uint64_t blobId = 0;
@@ -307,4 +339,4 @@
VkDevice device;
};
} // namespace vk
-} // namespace gfxstream
\ No newline at end of file
+} // namespace gfxstream
diff --git a/host/vulkan/cereal/Android.bp b/host/vulkan/cereal/Android.bp
index a8072a5..1f90cfb 100644
--- a/host/vulkan/cereal/Android.bp
+++ b/host/vulkan/cereal/Android.bp
@@ -8,7 +8,7 @@
}
cc_library_static {
- name: "gfxstream_vulkan_cereal_host",
+ name: "libgfxstream_host_vulkan_cereal",
defaults: ["gfxstream_defaults"],
static_libs: ["gfxstream_base"],
srcs: [
@@ -20,11 +20,11 @@
"common/goldfish_vk_transform.cpp",
],
header_libs: [
- "gfxstream_vulkan_headers",
- "gfxstream_vulkan_cereal_common",
+ "libgfxstream_vulkan_headers",
+ "libgfxstream_host_vulkan_cereal_common",
],
export_header_lib_headers: [
- "gfxstream_vulkan_headers",
+ "libgfxstream_vulkan_headers",
],
cflags: [
"-DVK_ANDROID_native_buffer",
diff --git a/host/vulkan/cereal/common/Android.bp b/host/vulkan/cereal/common/Android.bp
index b05f0c3..0ba0643 100644
--- a/host/vulkan/cereal/common/Android.bp
+++ b/host/vulkan/cereal/common/Android.bp
@@ -8,7 +8,7 @@
}
cc_library_headers {
- name: "gfxstream_vulkan_cereal_common",
+ name: "libgfxstream_host_vulkan_cereal_common",
vendor_available: true,
host_supported: true,
export_include_dirs: [
diff --git a/host/vulkan/emulated_textures/Android.bp b/host/vulkan/emulated_textures/Android.bp
index 053b7da..4b24604 100644
--- a/host/vulkan/emulated_textures/Android.bp
+++ b/host/vulkan/emulated_textures/Android.bp
@@ -8,10 +8,10 @@
}
cc_library_static {
- name: "gfxstream_emulated_textures",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_host_vulkan_emulatedtextures",
+ defaults: ["gfxstream_defaults"],
header_libs: [
- "gfxstream_vulkan_cereal_common",
+ "libgfxstream_host_vulkan_cereal_common",
],
srcs: [
"AstcTexture.cpp",
diff --git a/third-party/astc-encoder/Android.bp b/third-party/astc-encoder/Android.bp
index 2c5baac..9c02c41 100644
--- a/third-party/astc-encoder/Android.bp
+++ b/third-party/astc-encoder/Android.bp
@@ -31,4 +31,4 @@
],
}
-// TODO(gregschlom) Write the rules to actually build this library
\ No newline at end of file
+// TODO(gregschlom) Write the rules to actually build this library
diff --git a/third-party/glm/Android.bp b/third-party/glm/Android.bp
index 2c6af2f..6eb20bb 100644
--- a/third-party/glm/Android.bp
+++ b/third-party/glm/Android.bp
@@ -8,7 +8,7 @@
}
cc_library_static {
- name: "gfxstream_glm",
+ name: "libgfxstream_thirdparty_glm",
defaults: ["gfxstream_defaults"],
- export_include_dirs: [ "include" ],
+ export_include_dirs: ["include"],
}
diff --git a/third-party/renderdoc/Android.bp b/third-party/renderdoc/Android.bp
index 725ee2d..ebfdc36 100644
--- a/third-party/renderdoc/Android.bp
+++ b/third-party/renderdoc/Android.bp
@@ -16,9 +16,12 @@
}
cc_library_headers {
- name: "gfxstream_renderdoc_headers",
+ name: "libgfxstream_thirdparty_renderdoc_headers",
defaults: ["gfxstream_defaults"],
vendor_available: true,
host_supported: true,
- export_include_dirs: [ ".", "include" ],
+ export_include_dirs: [
+ ".",
+ "include",
+ ],
}
diff --git a/third-party/stb/Android.bp b/third-party/stb/Android.bp
index e50cd85..034f32a 100644
--- a/third-party/stb/Android.bp
+++ b/third-party/stb/Android.bp
@@ -15,13 +15,13 @@
}
cc_library {
- name: "libgfxstream_stb",
- defaults: [ "gfxstream_defaults" ],
+ name: "libgfxstream_thirdparty_stb",
+ defaults: ["gfxstream_defaults"],
srcs: [
"src/stb_image.cpp",
"src/stb_image_write.cpp",
],
export_include_dirs: [
"include",
- ]
+ ],
}