Merge "BoxedHandleManager: fix corner case where there is no replay handles" into main
diff --git a/.gitignore b/.gitignore
index d01643a..712259b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+/bazel-*
/build*/
/.vscode/*
/objs/*
diff --git a/Android.bp b/Android.bp
index 2b0da1b..385351f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -163,7 +163,9 @@
"-DVK_GFXSTREAM_STRUCTURE_TYPE_EXT",
"-DGFXSTREAM_ENABLE_HOST_GLES=1",
"-Wall",
+ "-Werror",
"-Wextra",
+ "-Wformat",
"-Wshadow",
"-Wthread-safety",
"-Wno-unused-function",
diff --git a/BUILD.bazel b/BUILD.bazel
index 5bb24fd..698fded 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -69,12 +69,11 @@
name = "gfxstream-gl-host-common-headers",
hdrs = glob([
"include/**/*.h",
- "include/**/*.hpp",
]),
includes = ["include"],
visibility = ["//visibility:public"],
deps = [
- "//hardware/google/aemu/base:aemu-base-headers",
- "//hardware/google/aemu/host-common:aemu-host-common-headers",
+ "@aemu//base:aemu-base-headers",
+ "@aemu//host-common:aemu-host-common-headers",
],
)
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..44a81d1
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,10 @@
+module(
+ name = "gfxstream",
+ version = "0.0.1",
+)
+
+bazel_dep(name = "aemu", version = "0.0.1")
+bazel_dep(name = "googletest", version = "1.15.2", repo_name = "com_google_googletest")
+bazel_dep(name = "platforms", version = "0.0.11")
+bazel_dep(name = "rules_cc", version = "0.0.14")
+bazel_dep(name = "rules_license", version = "1.0.0")
diff --git a/common/etc/BUILD.bazel b/common/etc/BUILD.bazel
index 3d723be..3b1f82c 100644
--- a/common/etc/BUILD.bazel
+++ b/common/etc/BUILD.bazel
@@ -1,9 +1,10 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
# Header Library
cc_library(
name = "gfxstream_etc_headers",
hdrs = glob([
"include/**/*.h",
- "include/**/*.hpp",
]),
includes = ["include"],
visibility = ["//visibility:public"],
diff --git a/host/BUILD.bazel b/host/BUILD.bazel
index d2bfd20..dd8e636 100644
--- a/host/BUILD.bazel
+++ b/host/BUILD.bazel
@@ -14,7 +14,6 @@
"compressedTextureFormats/AstcCpuDecompressor.h",
] + glob([
"*.h",
- "gl/*.h",
]),
copts = ["-fno-exceptions"],
includes = ["."],
@@ -31,7 +30,7 @@
includes = ["."],
visibility = ["//visibility:public"],
deps = [
- "//hardware/google/gfxstream/common/etc:gfxstream_etc",
+ "//common/etc:gfxstream_etc",
],
)
@@ -41,8 +40,8 @@
copts = ["-fno-exceptions"],
deps = [
":gfxstream-compressedTextures",
- "//hardware/google/aemu/base:aemu-base",
- "//hardware/google/aemu/host-common:logging",
+ "@aemu//base:aemu-base",
+ "@aemu//host-common:logging",
"@com_google_googletest//:gtest_main",
],
)
@@ -67,10 +66,13 @@
"QuartzCore",
"IOSurface",
],
+ target_compatible_with = [
+ "@platforms//os:macos",
+ ],
deps = [
":gfxstream_backend_headers",
- "//external/angle:angle-headers",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
+ "//:gfxstream-gl-host-common-headers",
+ "//common/opengl:gfxstream_opengl_headers",
],
)
@@ -138,29 +140,29 @@
visibility = ["//visibility:public"],
deps = [
":gfxstream_backend_headers",
- "//hardware/google/aemu/base:aemu-base",
- "//hardware/google/aemu/base:aemu-base-metrics",
- "//hardware/google/aemu/host-common:aemu-host-common",
- "//hardware/google/aemu/host-common:logging",
- "//hardware/google/aemu/snapshot:aemu-snapshot",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
- "//hardware/google/gfxstream/host/backend:gfxstream_backend",
- "//hardware/google/gfxstream/host/features:gfxstream_features",
- "//hardware/google/gfxstream/host/gl:EGL_translator_static",
- "//hardware/google/gfxstream/host/gl:OpenGLESDispatch",
- "//hardware/google/gfxstream/host/gl:gfxstream-gl-host-common",
- "//hardware/google/gfxstream/host/gl:gfxstream-gl-server",
- "//hardware/google/gfxstream/host/gl:gl-common-headers",
- "//hardware/google/gfxstream/host/gl:gl_headers",
- "//hardware/google/gfxstream/host/gl:gles1_dec",
- "//hardware/google/gfxstream/host/gl:gles2_dec",
- "//hardware/google/gfxstream/host/gl/glestranslator/GLES_CM:GLES_CM_translator_static",
- "//hardware/google/gfxstream/host/magma:gfxstream-magma-server",
- "//hardware/google/gfxstream/host/magma:magma-headers",
- "//hardware/google/gfxstream/host/renderControl_dec",
- "//hardware/google/gfxstream/host/tracing:gfxstream_host_tracing",
- "//hardware/google/gfxstream/host/vulkan:gfxstream-vulkan-server",
+ "//:gfxstream-gl-host-common-headers",
+ "//host/apigen-codec-common",
+ "//host/backend:gfxstream_backend",
+ "//host/features:gfxstream_features",
+ "//host/gl:EGL_translator_static",
+ "//host/gl:OpenGLESDispatch",
+ "//host/gl:gfxstream-gl-host-common",
+ "//host/gl:gfxstream-gl-server",
+ "//host/gl:gl-common-headers",
+ "//host/gl:gl_headers",
+ "//host/gl:gles1_dec",
+ "//host/gl:gles2_dec",
+ "//host/gl/glestranslator/GLES_CM:GLES_CM_translator_static",
+ "//host/magma:gfxstream-magma-server",
+ "//host/magma:magma-headers",
+ "//host/renderControl_dec",
+ "//host/tracing:gfxstream_host_tracing",
+ "//host/vulkan:gfxstream-vulkan-server",
+ "@aemu//base:aemu-base",
+ "@aemu//base:aemu-base-metrics",
+ "@aemu//host-common:aemu-host-common",
+ "@aemu//host-common:logging",
+ "@aemu//snapshot:aemu-snapshot",
] + select({
"@platforms//os:macos": [
":gfxstream_backend_static-darwin",
@@ -189,12 +191,12 @@
visibility = ["//visibility:public"],
deps = [
":gfxstream_backend_static",
- "//hardware/google/aemu/base:aemu-base",
- "//hardware/google/aemu/base:aemu-base-metrics",
- "//hardware/google/aemu/host-common:aemu-host-common-product-feature-override",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
- "//hardware/google/gfxstream/common/utils:gfxstream_common_utils",
- "//hardware/google/gfxstream/host/gl:gfxstream-gl-host-common",
+ "//:gfxstream-gl-host-common-headers",
+ "//common/utils:gfxstream_common_utils",
+ "//host/gl:gfxstream-gl-host-common",
+ "@aemu//base:aemu-base",
+ "@aemu//base:aemu-base-metrics",
+ "@aemu//host-common:aemu-host-common-product-feature-override",
],
)
@@ -209,12 +211,12 @@
visibility = ["//visibility:public"],
deps = [
":gfxstream_backend_static",
- "//hardware/google/aemu/base:aemu-base",
- "//hardware/google/aemu/base:aemu-base-metrics",
- "//hardware/google/aemu/host-common:aemu-host-common-product-feature-override",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
- "//hardware/google/gfxstream/common/utils:gfxstream_common_utils",
- "//hardware/google/gfxstream/host/gl:gfxstream-gl-host-common",
+ "//:gfxstream-gl-host-common-headers",
+ "//common/utils:gfxstream_common_utils",
+ "//host/gl:gfxstream-gl-host-common",
+ "@aemu//base:aemu-base",
+ "@aemu//base:aemu-base-metrics",
+ "@aemu//host-common:aemu-host-common-product-feature-override",
],
)
diff --git a/host/ColorBuffer.cpp b/host/ColorBuffer.cpp
index 345b74b..0ec2e5c 100644
--- a/host/ColorBuffer.cpp
+++ b/host/ColorBuffer.cpp
@@ -54,7 +54,7 @@
vk::VkEmulation* emulationVk, uint32_t width,
uint32_t height, GLenum format,
FrameworkFormat frameworkFormat, HandleType handle,
- android::base::Stream* stream, bool linear) {
+ android::base::Stream* stream) {
std::shared_ptr<ColorBuffer> colorBuffer(
new ColorBuffer(handle, width, height, format, frameworkFormat));
@@ -82,10 +82,7 @@
if (emulationVk) {
const bool vulkanOnly = colorBuffer->mColorBufferGl == nullptr;
- uint32_t memoryProperty = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
- if (vulkanOnly && linear) {
- memoryProperty |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
- }
+ const uint32_t memoryProperty = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
colorBuffer->mColorBufferVk =
vk::ColorBufferVk::create(*emulationVk, handle, width, height, format, frameworkFormat,
vulkanOnly, memoryProperty, stream);
diff --git a/host/ColorBuffer.h b/host/ColorBuffer.h
index ea6a025..51edfe4 100644
--- a/host/ColorBuffer.h
+++ b/host/ColorBuffer.h
@@ -52,8 +52,7 @@
vk::VkEmulation* emulationVk, uint32_t width,
uint32_t height, GLenum format,
FrameworkFormat frameworkFormat, HandleType handle,
- android::base::Stream* stream = nullptr,
- bool linear = false);
+ android::base::Stream* stream = nullptr);
static std::shared_ptr<ColorBuffer> onLoad(gl::EmulationGl* emulationGl,
vk::VkEmulation* emulationVk,
diff --git a/host/FrameBuffer.cpp b/host/FrameBuffer.cpp
index 789c8b7..4dc0898 100644
--- a/host/FrameBuffer.cpp
+++ b/host/FrameBuffer.cpp
@@ -1172,7 +1172,7 @@
void FrameBuffer::createColorBufferWithResourceHandle(int p_width, int p_height,
GLenum p_internalFormat,
FrameworkFormat p_frameworkFormat,
- HandleType handle, bool p_linear) {
+ HandleType handle) {
{
AutoLock mutex(m_lock);
sweepColorBuffersLocked();
@@ -1188,18 +1188,17 @@
}
createColorBufferWithResourceHandleLocked(p_width, p_height, p_internalFormat,
- p_frameworkFormat, handle, p_linear);
+ p_frameworkFormat, handle);
}
}
HandleType FrameBuffer::createColorBufferWithResourceHandleLocked(int p_width, int p_height,
GLenum p_internalFormat,
FrameworkFormat p_frameworkFormat,
- HandleType handle,
- bool p_linear) {
- ColorBufferPtr cb = ColorBuffer::create(m_emulationGl.get(), m_emulationVk.get(), p_width,
- p_height, p_internalFormat, p_frameworkFormat, handle,
- nullptr /*stream*/, p_linear);
+ HandleType handle) {
+ ColorBufferPtr cb =
+ ColorBuffer::create(m_emulationGl.get(), m_emulationVk.get(), p_width, p_height,
+ p_internalFormat, p_frameworkFormat, handle, nullptr /*stream*/);
if (cb.get() == nullptr) {
GFXSTREAM_ABORT(FatalError(ABORT_REASON_OTHER))
<< "Failed to create ColorBuffer:" << handle << " format:" << p_internalFormat
diff --git a/host/FrameBuffer.h b/host/FrameBuffer.h
index 65b502a..3f40aba 100644
--- a/host/FrameBuffer.h
+++ b/host/FrameBuffer.h
@@ -208,8 +208,7 @@
// handle already assigned. This is for use with
// virtio-gpu's RESOURCE_CREATE ioctl.
void createColorBufferWithResourceHandle(int p_width, int p_height, GLenum p_internalFormat,
- FrameworkFormat p_frameworkFormat, HandleType handle,
- bool linear = false);
+ FrameworkFormat p_frameworkFormat, HandleType handle);
// Create a new data Buffer instance from this display instance.
// The buffer will be backed by a VkBuffer and VkDeviceMemory (if Vulkan
@@ -722,7 +721,7 @@
HandleType createColorBufferWithResourceHandleLocked(int p_width, int p_height,
GLenum p_internalFormat,
FrameworkFormat p_frameworkFormat,
- HandleType handle, bool linear = false);
+ HandleType handle);
HandleType createBufferWithResourceHandleLocked(int p_size, HandleType handle,
uint32_t memoryProperty);
diff --git a/host/RendererImpl.cpp b/host/RendererImpl.cpp
index 14bbbff..2bfc710 100644
--- a/host/RendererImpl.cpp
+++ b/host/RendererImpl.cpp
@@ -572,10 +572,9 @@
FrameBuffer::getFB()->createBufferWithResourceHandle(size, handle);
},
.create_color_buffer_with_handle =
- [](uint32_t width, uint32_t height, uint32_t format, uint32_t fwkFormat, uint32_t handle,
- bool linear) {
+ [](uint32_t width, uint32_t height, uint32_t format, uint32_t fwkFormat, uint32_t handle) {
FrameBuffer::getFB()->createColorBufferWithResourceHandle(
- width, height, (GLenum)format, (FrameworkFormat)fwkFormat, handle, linear);
+ width, height, (GLenum)format, (FrameworkFormat)fwkFormat, handle);
},
.open_color_buffer = [](uint32_t handle) { FrameBuffer::getFB()->openColorBuffer(handle); },
.close_buffer = [](uint32_t handle) { FrameBuffer::getFB()->closeBuffer(handle); },
diff --git a/host/VirtioGpuResource.cpp b/host/VirtioGpuResource.cpp
index 5577188..5681d98 100644
--- a/host/VirtioGpuResource.cpp
+++ b/host/VirtioGpuResource.cpp
@@ -147,14 +147,8 @@
} else if (resourceType == VirtioGpuResourceType::COLOR_BUFFER) {
const uint32_t glformat = virgl_format_to_gl(args->format);
const auto fwkformat = (gfxstream::FrameworkFormat)virgl_format_to_fwk_format(args->format);
- const bool linear =
-#ifdef GFXSTREAM_ENABLE_GUEST_VIRTIO_RESOURCE_TILING_CONTROL
- !!(args->bind & VIRGL_BIND_LINEAR);
-#else
- false;
-#endif
FrameBuffer::getFB()->createColorBufferWithResourceHandle(
- args->width, args->height, glformat, fwkformat, args->handle, linear);
+ args->width, args->height, glformat, fwkformat, args->handle);
FrameBuffer::getFB()->setGuestManagedColorBufferLifetime(true /* guest manages lifetime */);
FrameBuffer::getFB()->openColorBuffer(args->handle);
} else {
@@ -225,15 +219,9 @@
const uint32_t glformat = virgl_format_to_gl(internal_create_args.format);
const auto fwkformat =
(gfxstream::FrameworkFormat)virgl_format_to_fwk_format(internal_create_args.format);
- const bool linear =
-#ifdef GFXSTREAM_ENABLE_GUEST_VIRTIO_RESOURCE_TILING_CONTROL
- !!(internal_create_args.bind & VIRGL_BIND_LINEAR);
-#else
- false;
-#endif
FrameBuffer::getFB()->createColorBufferWithResourceHandle(
internal_create_args.width, internal_create_args.height, glformat, fwkformat,
- internal_create_args.handle, linear);
+ internal_create_args.handle);
FrameBuffer::getFB()->setGuestManagedColorBufferLifetime(true /* guest manages lifetime */);
FrameBuffer::getFB()->openColorBuffer(internal_create_args.handle);
diff --git a/host/apigen-codec-common/BUILD.bazel b/host/apigen-codec-common/BUILD.bazel
index 1172ba7..ccdc867 100644
--- a/host/apigen-codec-common/BUILD.bazel
+++ b/host/apigen-codec-common/BUILD.bazel
@@ -1,5 +1,7 @@
# File: project_root/src/apigen-codec-common/BUILD
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
cc_library(
name = "apigen-codec-common",
srcs = [
@@ -32,8 +34,8 @@
includes = ["."],
visibility = ["//visibility:public"],
deps = [
- "//hardware/google/aemu/base:aemu-base-headers",
- "//hardware/google/aemu/host-common:aemu-host-common",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
+ "//:gfxstream-gl-host-common-headers",
+ "@aemu//base:aemu-base-headers",
+ "@aemu//host-common:aemu-host-common",
],
)
diff --git a/host/backend/BUILD.bazel b/host/backend/BUILD.bazel
index 5de9100..8c0823a 100644
--- a/host/backend/BUILD.bazel
+++ b/host/backend/BUILD.bazel
@@ -1,9 +1,11 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
cc_library(
name = "gfxstream_backend",
srcs = glob(["include/**/*.h"]),
includes = ["include"],
visibility = ["//visibility:public"],
deps = [
- "//hardware/google/gfxstream/common/utils:gfxstream_common_utils",
+ "//common/utils:gfxstream_common_utils",
],
-)
\ No newline at end of file
+)
diff --git a/host/features/Features.cpp b/host/features/Features.cpp
index 0e126aa..1249204 100644
--- a/host/features/Features.cpp
+++ b/host/features/Features.cpp
@@ -22,23 +22,6 @@
*this = rhs;
}
-FeatureResult FeatureDependencyHandler::checkAllDependentFeaturesAreEnabled() {
- // Only check for direct dependencies. Since we're verifying all enabled features, this should cover the whole span.
- bool allDependenciesAreEnabled = true;
- std::stringstream ss;
- for (auto const&[feature, dependentFeatures] : VK_FEATURE_DEPENDENCY_MAP) {
- if (feature->enabled && !dependentFeatures.empty()) {
- for (auto const& dep : dependentFeatures) {
- if (!dep->enabled) {
- ss << "Feature: " << feature->name << " requests missing dependency: " << dep->name << "\n";
- allDependenciesAreEnabled = false;
- }
- }
- }
- }
- return {allDependenciesAreEnabled, ss.str()};
-};
-
FeatureSet& FeatureSet::operator=(const FeatureSet& rhs) {
for (const auto& [featureName, featureInfo] : rhs.map) {
*map[featureName] = *featureInfo;
diff --git a/host/features/include/gfxstream/host/Features.h b/host/features/include/gfxstream/host/Features.h
index 6c03a70..1b9e6b6 100644
--- a/host/features/include/gfxstream/host/Features.h
+++ b/host/features/include/gfxstream/host/Features.h
@@ -221,8 +221,10 @@
};
FeatureInfo BypassVulkanDeviceFeatureOverrides = {
"BypassVulkanDeviceFeatureOverrides",
- "We are force disabling (overriding) some vulkan features (private data, uniform inline block etc) which the device may naturally support."
- "If toggled ON, this flag will cause the host side to not force disable anything and let the device fully advertise supported features.",
+ "We are force disabling (overriding) some vulkan features (private data, uniform inline "
+ "block etc) which the device may naturally support."
+ "If toggled ON, this flag will cause the host side to not force disable anything and let "
+ "the device fully advertise supported features.",
&map,
};
FeatureInfo VulkanAllocateDeviceMemoryOnly = {
@@ -321,17 +323,12 @@
"device properties for the guest queries.",
&map,
};
-};
-struct FeatureDependencyHandler {
- FeatureDependencyHandler(const FeatureSet& set) : featureSetView(set){}
- const FeatureSet& featureSetView;
- const std::map<const FeatureInfo*, std::vector<const FeatureInfo*>> VK_FEATURE_DEPENDENCY_MAP= {
- // List other dependencies here in the shape of:
- // {FEATURE_X, {DEPENDENT_FEATURE_A, DEPENDENT_FEATURE_B}}
- {&featureSetView.VulkanSnapshots, {&featureSetView.VulkanBatchedDescriptorSetUpdate, &featureSetView.Vulkan}},
+ FeatureInfo VulkanRobustness = {
+ "VulkanRobustness",
+ "If enabled, robustness extensions with all supported features will be enabled on "
+ "all created devices. (e.g. VK_EXT_robustness2)",
+ &map,
};
-
- FeatureResult checkAllDependentFeaturesAreEnabled();
};
#define GFXSTREAM_SET_FEATURE_ON_CONDITION(set, feature, condition) \
diff --git a/host/gl/BUILD.bazel b/host/gl/BUILD.bazel
index 0b6ee9f..3825631 100644
--- a/host/gl/BUILD.bazel
+++ b/host/gl/BUILD.bazel
@@ -1,3 +1,5 @@
+load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
+
cc_library(
name = "gles1_dec",
srcs = [
@@ -10,8 +12,8 @@
visibility = ["//visibility:public"],
deps = [
":GLSnapshot",
- "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
+ "//common/opengl:gfxstream_opengl_headers",
+ "//host/apigen-codec-common",
],
)
@@ -23,8 +25,11 @@
hdrs = ["gl-host-common/include/host-common/opengl/macTouchOpenGL.h"],
defines = ["EMUGL_BUILD"],
includes = ["gl-host-common/include"],
+ target_compatible_with = [
+ "@platforms//os:macos",
+ ],
deps = [
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
+ "//:gfxstream-gl-host-common-headers",
],
)
@@ -34,7 +39,7 @@
copts = ["-fno-exceptions"],
includes = ["glestranslator/GLcommon/include"],
visibility = ["//visibility:public"],
- deps = ["//hardware/google/gfxstream/host/apigen-codec-common"],
+ deps = ["//host/apigen-codec-common"],
)
objc_library(
@@ -51,9 +56,12 @@
"CoreGraphics",
"OpenGL",
],
+ target_compatible_with = [
+ "@platforms//os:macos",
+ ],
visibility = ["//visibility:public"],
deps = [
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
+ "//:gfxstream-gl-host-common-headers",
],
alwayslink = True,
)
@@ -103,16 +111,16 @@
deps =
[
":gl-common-headers",
- "//hardware/google/aemu/host-common:aemu-host-common-headers",
- "//hardware/google/aemu/snapshot:aemu-snapshot",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
- "//hardware/google/gfxstream/common/etc:gfxstream_etc",
- "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
- "//hardware/google/gfxstream/host:gfxstream_host_headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
- "//hardware/google/gfxstream/host/gl:gfxstream-gl-host-common",
- "//hardware/google/gfxstream/host/gl/glestranslator/GLES_CM:GLES_CM_translator_static",
- "//hardware/google/gfxstream/host/gl/glestranslator/GLES_V2:GLES_V2_translator_static",
+ "//:gfxstream-gl-host-common-headers",
+ "//common/etc:gfxstream_etc",
+ "//common/opengl:gfxstream_opengl_headers",
+ "//host:gfxstream_host_headers",
+ "//host/apigen-codec-common",
+ "//host/gl:gfxstream-gl-host-common",
+ "//host/gl/glestranslator/GLES_CM:GLES_CM_translator_static",
+ "//host/gl/glestranslator/GLES_V2:GLES_V2_translator_static",
+ "@aemu//host-common:aemu-host-common-headers",
+ "@aemu//snapshot:aemu-snapshot",
] + select({
"@platforms//os:macos": [":egl_translator-darwin"],
"//conditions:default": [],
@@ -155,10 +163,10 @@
deps = [
":gl-common-headers",
# "//external/angle:angle-headers",
- "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
- "//hardware/google/aemu/snapshot:aemu-snapshot",
- "//hardware/google/gfxstream/common/etc:gfxstream_etc",
- "//hardware/google/gfxstream/host:gfxstream-compressedTextures",
+ "//common/opengl:gfxstream_opengl_headers",
+ "@aemu//snapshot:aemu-snapshot",
+ "//common/etc:gfxstream_etc",
+ "//host:gfxstream-compressedTextures",
],
)
@@ -197,10 +205,10 @@
}),
visibility = ["//visibility:public"],
deps = [
- "//hardware/google/aemu/snapshot:aemu-snapshot",
- "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
- "//hardware/google/gfxstream/host/features:gfxstream_features",
+ "//common/opengl:gfxstream_opengl_headers",
+ "//host/apigen-codec-common",
+ "//host/features:gfxstream_features",
+ "@aemu//snapshot:aemu-snapshot",
] + select({
"@platforms//os:macos": ["gfxstream-gl-host-common-darwin"],
"//conditions:default": [],
@@ -219,9 +227,9 @@
visibility = ["//visibility:public"],
deps = [
":GLSnapshot",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
- "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
+ "//:gfxstream-gl-host-common-headers",
+ "//common/opengl:gfxstream_opengl_headers",
+ "//host/apigen-codec-common",
],
)
@@ -236,7 +244,7 @@
defines = ["EMUGL_BUILD"],
includes = ["glsnapshot"],
visibility = ["//visibility:public"],
- deps = ["//hardware/google/gfxstream/host/apigen-codec-common"],
+ deps = ["//host/apigen-codec-common"],
)
cc_library(
@@ -249,7 +257,7 @@
"OpenGLESDispatch/StaticDispatch.cpp",
"OpenGLESDispatch/gles1_stubbed_in_translator_namespace.cpp",
"OpenGLESDispatch/gles2_stubbed_in_translator_namespace.cpp",
- ] + glob(["OpenGLESDispatch/*.h"]),
+ ],
copts = [
"-fno-exceptions",
"-Wno-extern-c-compat",
@@ -260,9 +268,9 @@
":EGL_translator_static",
":gles1_dec",
":gles2_dec",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
- "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
+ "//:gfxstream-gl-host-common-headers",
+ "//common/opengl:gfxstream_opengl_headers",
+ "//host/apigen-codec-common",
],
)
@@ -288,7 +296,6 @@
"YUVConverter.cpp",
] + glob([
"*.h",
- "glestranslator/include/**/*.h",
]),
hdrs = [],
copts = [
@@ -305,10 +312,10 @@
":gfxstream-gl-host-common",
":gles1_dec",
":gles2_dec",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
- "//hardware/google/gfxstream/host:gfxstream_host_headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
- "//hardware/google/gfxstream/host/gl:GLSnapshot",
+ "//:gfxstream-gl-host-common-headers",
+ "//host:gfxstream_host_headers",
+ "//host/apigen-codec-common",
+ "//host/gl:GLSnapshot",
],
)
diff --git a/host/gl/gles1_dec/meson.build b/host/gl/gles1_dec/meson.build
index e151213..aa33366 100644
--- a/host/gl/gles1_dec/meson.build
+++ b/host/gl/gles1_dec/meson.build
@@ -11,6 +11,6 @@
'gles1_dec',
files_lib_gles1_dec,
cpp_args: gfxstream_host_args,
- include_directories: [inc_gfxstream_include, inc_include, inc_apigen_codec, inc_gles_translator],
+ include_directories: [inc_gfxstream_include, inc_include, inc_apigen_codec],
dependencies: [aemu_base_dep, aemu_logging_dep]
)
diff --git a/host/gl/gles2_dec/meson.build b/host/gl/gles2_dec/meson.build
index 91f0e16..fe75aad 100644
--- a/host/gl/gles2_dec/meson.build
+++ b/host/gl/gles2_dec/meson.build
@@ -11,7 +11,7 @@
'gles2_dec',
files_lib_gles2_dec,
cpp_args: gfxstream_host_args,
- include_directories: [inc_gfxstream_include, inc_include, inc_apigen_codec, inc_gles_translator,
+ include_directories: [inc_gfxstream_include, inc_include, inc_apigen_codec,
inc_gl_snapshot],
link_with: lib_gl_snapshot,
dependencies: [aemu_base_dep, aemu_logging_dep]
diff --git a/host/gl/glestranslator/EGL/meson.build b/host/gl/glestranslator/EGL/meson.build
index 0758656..513aa3b 100644
--- a/host/gl/glestranslator/EGL/meson.build
+++ b/host/gl/glestranslator/EGL/meson.build
@@ -52,7 +52,7 @@
'egl_translator',
files_lib_egl_translator,
cpp_args: egl_cpp_args + gfxstream_host_args,
- include_directories: [inc_gfxstream_include, inc_include, inc_gles_translator, inc_apigen_codec,
+ include_directories: [inc_gfxstream_include, inc_include, inc_gl_common, inc_apigen_codec,
inc_gl_host_common, inc_stream_servers, inc_etc],
link_with: [lib_gl_common, lib_apigen_codec, lib_gl_host_common],
dependencies: [aemu_base_dep, aemu_common_dep, aemu_snapshot_dep,
diff --git a/host/gl/glestranslator/GLES_CM/BUILD.bazel b/host/gl/glestranslator/GLES_CM/BUILD.bazel
index 500df40..6ffc875 100644
--- a/host/gl/glestranslator/GLES_CM/BUILD.bazel
+++ b/host/gl/glestranslator/GLES_CM/BUILD.bazel
@@ -1,3 +1,5 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
cc_library(
name = "GLES_CM_translator_static",
srcs = [
@@ -12,11 +14,10 @@
],
visibility = ["//visibility:public"],
deps = [
- "//external/angle:angle-headers",
- "//hardware/google/aemu/snapshot:aemu-snapshot",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
- "//hardware/google/gfxstream/host/gl:gl_common",
- "//hardware/google/gfxstream/third-party/glm",
+ "//:gfxstream-gl-host-common-headers",
+ "//host/apigen-codec-common",
+ "//host/gl:gl_common",
+ "//third-party/glm",
+ "@aemu//snapshot:aemu-snapshot",
],
)
diff --git a/host/gl/glestranslator/GLES_CM/meson.build b/host/gl/glestranslator/GLES_CM/meson.build
index b8666b5..dccafd7 100644
--- a/host/gl/glestranslator/GLES_CM/meson.build
+++ b/host/gl/glestranslator/GLES_CM/meson.build
@@ -13,7 +13,7 @@
'glescm_translator',
files_lib_glescm_translator,
cpp_args: gfxstream_host_args,
- include_directories: [inc_gfxstream_include, inc_include, inc_gles_translator, inc_glm,
+ include_directories: [inc_gfxstream_include, inc_include, inc_gl_common, inc_glm,
inc_etc],
dependencies: [aemu_base_dep, aemu_logging_dep, aemu_snapshot_dep]
)
diff --git a/host/gl/glestranslator/GLES_V2/BUILD.bazel b/host/gl/glestranslator/GLES_V2/BUILD.bazel
index bb38bbe..839d9e3 100644
--- a/host/gl/glestranslator/GLES_V2/BUILD.bazel
+++ b/host/gl/glestranslator/GLES_V2/BUILD.bazel
@@ -1,3 +1,5 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
cc_library(
name = "GLES_V2_translator_static",
srcs = [
@@ -27,9 +29,9 @@
includes = ["."],
visibility = ["//visibility:public"],
deps = [
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
- "//hardware/google/gfxstream/host/gl:gl_common",
+ "//:gfxstream-gl-host-common-headers",
+ "//host/apigen-codec-common",
+ "//host/gl:gl_common",
],
alwayslink = True,
)
diff --git a/host/gl/glestranslator/GLES_V2/meson.build b/host/gl/glestranslator/GLES_V2/meson.build
index 28137ab..cff02f9 100644
--- a/host/gl/glestranslator/GLES_V2/meson.build
+++ b/host/gl/glestranslator/GLES_V2/meson.build
@@ -17,7 +17,7 @@
'glesv2_translator',
files_lib_glesv2_translator,
cpp_args: gfxstream_host_args,
- include_directories: [inc_gfxstream_include, inc_include, inc_gles_translator, inc_stream_servers,
+ include_directories: [inc_gfxstream_include, inc_include, inc_gl_common, inc_stream_servers,
inc_etc],
dependencies: [aemu_base_dep, aemu_logging_dep, aemu_snapshot_dep]
)
diff --git a/host/gl/glestranslator/GLcommon/meson.build b/host/gl/glestranslator/GLcommon/meson.build
index 686d94b..d1bf29c 100644
--- a/host/gl/glestranslator/GLcommon/meson.build
+++ b/host/gl/glestranslator/GLcommon/meson.build
@@ -27,7 +27,7 @@
'gl_common',
files_lib_gl_common,
cpp_args: gfxstream_host_args,
- include_directories: [inc_etc, inc_gfxstream_include, inc_include, inc_stream_servers, inc_gles_translator],
+ include_directories: [inc_etc, inc_gfxstream_include, inc_include, inc_stream_servers, inc_gl_common],
link_with: [lib_compressed_textures, lib_etc],
dependencies: [aemu_base_dep, aemu_logging_dep, aemu_snapshot_dep]
)
diff --git a/host/gl/meson.build b/host/gl/meson.build
index 11f9732..f3247fa 100644
--- a/host/gl/meson.build
+++ b/host/gl/meson.build
@@ -2,7 +2,6 @@
# SPDX-License-Identifier: MIT
inc_gl_server = include_directories('.')
-inc_gles_translator = include_directories('glestranslator/include')
inc_gl_snapshot = include_directories('glsnapshot')
# snapshot
@@ -43,7 +42,7 @@
files_lib_gl_server,
cpp_args: gfxstream_host_args,
include_directories: [inc_gfxstream_include, inc_include, inc_stream_servers, inc_apigen_codec,
- inc_gl_snapshot, inc_gl_host_common, inc_host_features],
+ inc_gl_snapshot, inc_gl_host_common, inc_host_features, inc_gl_common],
link_with: [lib_gles1_dec, lib_gles2_dec, lib_apigen_codec, lib_gl_dispatch,
lib_apigen_codec, lib_host_features],
dependencies: [aemu_base_dep, aemu_common_dep, aemu_snapshot_dep]
diff --git a/host/magma/BUILD.bazel b/host/magma/BUILD.bazel
index 746150c..3b21245 100644
--- a/host/magma/BUILD.bazel
+++ b/host/magma/BUILD.bazel
@@ -1,3 +1,5 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
cc_library(
name = "gfxstream-magma-server",
srcs = [
@@ -8,9 +10,9 @@
includes = ["magma_dec"],
visibility = ["//visibility:public"],
deps = [
- "//hardware/google/gfxstream/host:gfxstream_host_headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
- "//hardware/google/gfxstream/third-party/fuchsia/magma:magma-headers",
+ "//host:gfxstream_host_headers",
+ "//host/apigen-codec-common",
+ "//third-party/fuchsia/magma:magma-headers",
],
)
diff --git a/host/meson.build b/host/meson.build
index b13ccef..362af0a 100644
--- a/host/meson.build
+++ b/host/meson.build
@@ -6,7 +6,6 @@
#===============#
gfxstream_host_args = [
'-D_FILE_OFFSET_BITS=64',
- '-DGFXSTREAM_ENABLE_GUEST_VIRTIO_RESOURCE_TILING_CONTROL=1',
'-Wno-unused-parameter',
'-Wno-unused-function',
'-Wno-unused-variable',
@@ -152,6 +151,8 @@
inc_stream_servers = include_directories('.')
inc_host_include = include_directories('include')
+inc_gl_common = include_directories('gl/glestranslator/GLcommon/include')
+
subdir('features')
subdir('tracing')
@@ -208,7 +209,7 @@
files_lib_gfxstream_backend += files('RenderThreadInfoGl.cpp')
files_lib_gfxstream_backend += files('RenderControl.cpp')
- inc_gfxstream_backend += [inc_gl_server, inc_gl_snapshot, inc_gles_translator]
+ inc_gfxstream_backend += [inc_gl_server, inc_gl_snapshot, inc_gl_common]
link_gfxstream_backend += lib_gl_server
endif
@@ -242,7 +243,6 @@
elif host_machine.system() == 'qnx'
files_lib_gfxstream_backend += files(
'NativeSubWindow_qnx.cpp',
- '../qnx/host/platform_qnx.cpp',
)
endif
diff --git a/host/renderControl_dec/BUILD.bazel b/host/renderControl_dec/BUILD.bazel
index b91b510..bd36a87 100644
--- a/host/renderControl_dec/BUILD.bazel
+++ b/host/renderControl_dec/BUILD.bazel
@@ -1,3 +1,5 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
cc_library(
name = "renderControl_dec",
srcs = [
@@ -7,7 +9,7 @@
hdrs = [],
visibility = ["//visibility:public"],
deps = [
- "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
+ "//common/opengl:gfxstream_opengl_headers",
+ "//host/apigen-codec-common",
],
)
diff --git a/host/vulkan/BUILD.bazel b/host/vulkan/BUILD.bazel
index 39860de..75b1a6b 100644
--- a/host/vulkan/BUILD.bazel
+++ b/host/vulkan/BUILD.bazel
@@ -1,3 +1,5 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
cc_library(
name = "gfxstream-vulkan-server",
srcs = [
@@ -62,18 +64,18 @@
visibility = ["//visibility:public"],
deps = [
# "//external/angle:angle-headers",
- "//hardware/google/aemu/snapshot:aemu-snapshot",
- "//hardware/google/gfxstream/common/vulkan:gfxstream_vulkan_headers",
- "//hardware/google/gfxstream/host:gfxstream-compressedTextures",
- "//hardware/google/gfxstream/host:gfxstream_host_headers",
- "//hardware/google/gfxstream/host/apigen-codec-common",
- "//hardware/google/gfxstream/host/gl:gfxstream-gl-host-common",
- "//hardware/google/gfxstream/host/gl:gl_headers",
- "//hardware/google/gfxstream/host/vulkan:OpenglRender_vulkan_cereal",
- "//hardware/google/gfxstream/host/vulkan:emulated_textures",
- "//hardware/google/gfxstream/third-party/glm",
- "//hardware/google/gfxstream/third-party/renderdoc",
- "//hardware/google/gfxstream/utils:gfxstream_utils",
+ "@aemu//snapshot:aemu-snapshot",
+ "//common/vulkan:gfxstream_vulkan_headers",
+ "//host:gfxstream-compressedTextures",
+ "//host:gfxstream_host_headers",
+ "//host/apigen-codec-common",
+ "//host/gl:gfxstream-gl-host-common",
+ "//host/gl:gl_headers",
+ "//host/vulkan:OpenglRender_vulkan_cereal",
+ "//host/vulkan:emulated_textures",
+ "//third-party/glm",
+ "//third-party/renderdoc",
+ "//utils:gfxstream_utils",
],
)
@@ -109,15 +111,15 @@
"cereal/common",
],
deps = [
- "//hardware/google/aemu/base:aemu-base-headers",
- "//hardware/google/aemu/host-common:aemu-host-common-headers",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
- "//hardware/google/gfxstream/common/vulkan:gfxstream_vulkan_headers",
- "//hardware/google/gfxstream/host:gfxstream_host_headers",
- "//hardware/google/gfxstream/host/backend:gfxstream_backend",
- "//hardware/google/gfxstream/host/features:gfxstream_features",
- "//hardware/google/gfxstream/host/tracing:gfxstream_host_tracing",
- "//hardware/google/gfxstream/utils:gfxstream_utils",
+ "//:gfxstream-gl-host-common-headers",
+ "//common/vulkan:gfxstream_vulkan_headers",
+ "//host:gfxstream_host_headers",
+ "//host/backend:gfxstream_backend",
+ "//host/features:gfxstream_features",
+ "//host/tracing:gfxstream_host_tracing",
+ "//utils:gfxstream_utils",
+ "@aemu//base:aemu-base-headers",
+ "@aemu//host-common:aemu-host-common-headers",
],
)
@@ -150,10 +152,10 @@
"cereal/common",
],
deps = [
- "//hardware/google/aemu/host-common:aemu-host-common-headers",
- "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
- "//hardware/google/gfxstream/common/vulkan:gfxstream_vulkan_headers",
- "//hardware/google/gfxstream/host:gfxstream_host_headers",
- "//hardware/google/gfxstream/utils:gfxstream_utils",
+ "//:gfxstream-gl-host-common-headers",
+ "//common/vulkan:gfxstream_vulkan_headers",
+ "//host:gfxstream_host_headers",
+ "//utils:gfxstream_utils",
+ "@aemu//host-common:aemu-host-common-headers",
],
)
diff --git a/host/vulkan/VkAndroidNativeBuffer.cpp b/host/vulkan/VkAndroidNativeBuffer.cpp
index 9cf9596..54d53c4 100644
--- a/host/vulkan/VkAndroidNativeBuffer.cpp
+++ b/host/vulkan/VkAndroidNativeBuffer.cpp
@@ -201,6 +201,10 @@
importedColorBufferInfo.height);
return nullptr;
}
+
+ // Update create flags to match the color buffer imported
+ createImageCi.flags = importedColorBufferInfo.imageCreateInfoShallow.flags;
+
const auto& importedColorBufferMemoryInfo = importedColorBufferInfo.memory;
// VkBindImageMemorySwapchainInfoKHR may be included from the guest but
@@ -235,6 +239,18 @@
vk->vkGetImageMemoryRequirements(out->mDevice, out->mImage, &out->mImageMemoryRequirements);
+ if (out->mImageMemoryRequirements.size > importedColorBufferMemoryInfo.size) {
+ VK_ANB_ERR(
+ "Failed to prepare ANB image: attempted to import memory that is not large enough "
+ "for the VkImage: image memory requirements size:%llu vs actual memory size:%llu, "
+ "CB: %u, %s, %ux%u",
+ out->mImageMemoryRequirements.size, importedColorBufferMemoryInfo.size,
+ importedColorBufferHandle, string_VkFormat(createImageCi.format),
+ createImageCi.extent.width, createImageCi.extent.height);
+
+ return nullptr;
+ }
+
if (out->mImageMemoryRequirements.size < importedColorBufferMemoryInfo.size) {
out->mImageMemoryRequirements.size = importedColorBufferMemoryInfo.size;
}
diff --git a/host/vulkan/VkCommonOperations.cpp b/host/vulkan/VkCommonOperations.cpp
index 3fc4f0b..5f8abc0 100644
--- a/host/vulkan/VkCommonOperations.cpp
+++ b/host/vulkan/VkCommonOperations.cpp
@@ -571,6 +571,11 @@
{VK_FORMAT_B8G8R8A8_UNORM,
VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_EXTENDED_USAGE_BIT},
+ {VK_FORMAT_B4G4R4A4_UNORM_PACK16,
+ VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_EXTENDED_USAGE_BIT},
+ {VK_FORMAT_R4G4B4A4_UNORM_PACK16,
+ VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_EXTENDED_USAGE_BIT},
+
{VK_FORMAT_R8_UNORM,
VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_EXTENDED_USAGE_BIT},
{VK_FORMAT_R16_UNORM,
@@ -1220,6 +1225,15 @@
vk_append_struct(&features2Chain, &privateDataFeatures);
}
+ VkPhysicalDeviceRobustness2FeaturesEXT robustness2Features = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT};
+ const bool robustnessRequested = emulation->mFeatures.VulkanRobustness.enabled;
+ const bool robustnessSupported =
+ extensionsSupported(deviceExts, {VK_EXT_ROBUSTNESS_2_EXTENSION_NAME});
+ if (robustnessRequested && robustnessSupported) {
+ vk_append_struct(&features2Chain, &robustness2Features);
+ }
+
emulation->mGetPhysicalDeviceFeatures2Func(physicalDevices[i], &features2);
deviceInfos[i].supportsSamplerYcbcrConversion =
@@ -1230,6 +1244,15 @@
deviceInfos[i].supportsPrivateData = (privateDataFeatures.privateData == VK_TRUE);
+ // Enable robustness only when requested
+ if (robustnessRequested && robustnessSupported) {
+ deviceInfos[i].robustness2Features = vk_make_orphan_copy(robustness2Features);
+ } else if (robustnessRequested) {
+ WARN(
+ "VulkanRobustness was requested but the "
+ "VK_EXT_robustness2 extension is not supported.");
+ }
+
#if defined(__QNX__)
deviceInfos[i].supportsExternalMemoryImport =
extMemScreenBufferFeatures.screenBufferImport == VK_TRUE;
@@ -1358,6 +1381,10 @@
}
#endif
+ if (emulation->mDeviceInfo.robustness2Features) {
+ selectedDeviceExtensionNames_.emplace(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME);
+ }
+
std::vector<const char*> selectedDeviceExtensionNames(selectedDeviceExtensionNames_.begin(),
selectedDeviceExtensionNames_.end());
@@ -1422,6 +1449,20 @@
"VK_NV_device_diagnostic_checkpoints extension is not supported.");
}
+ VkPhysicalDeviceRobustness2FeaturesEXT r2features = {};
+ if (emulation->mDeviceInfo.robustness2Features) {
+ r2features = *emulation->mDeviceInfo.robustness2Features;
+ INFO("Enabling VK_EXT_robustness2 (%d %d %d).", r2features.robustBufferAccess2,
+ r2features.robustImageAccess2, r2features.nullDescriptor);
+ vk_append_struct(&deviceCiChain, &r2features);
+
+ // vkCreateDevice() - VUID-04000: If robustBufferAccess2 is enabled then robustBufferAccess
+ // must be enabled.
+ if (r2features.robustBufferAccess2) {
+ physicalDeviceFeatures.features.robustBufferAccess = VK_TRUE;
+ }
+ }
+
ivk->vkCreateDevice(emulation->mPhysicalDevice, &dCi, nullptr, &emulation->mDevice);
if (res != VK_SUCCESS) {
@@ -1757,6 +1798,10 @@
return mDeviceInfo.supportsExternalMemoryHostProps;
}
+std::optional<VkPhysicalDeviceRobustness2FeaturesEXT> VkEmulation::getRobustness2Features() const {
+ return mDeviceInfo.robustness2Features;
+}
+
VkPhysicalDeviceExternalMemoryHostPropertiesEXT VkEmulation::externalMemoryHostProperties() const {
return mDeviceInfo.externalMemoryHostProps;
}
@@ -1957,8 +2002,8 @@
VkResult allocRes = vk->vkAllocateMemory(mDevice, &allocInfo, nullptr, &info->memory);
if (allocRes != VK_SUCCESS) {
- VERBOSE("allocExternalMemory: failed in vkAllocateMemory: %s",
- string_VkResult(allocRes));
+ VERBOSE("%s: failed in vkAllocateMemory: %s",
+ __func__, string_VkResult(allocRes));
break;
}
@@ -1967,7 +2012,7 @@
VkResult mapRes =
vk->vkMapMemory(mDevice, info->memory, 0, info->size, 0, &info->mappedPtr);
if (mapRes != VK_SUCCESS) {
- VERBOSE("allocExternalMemory: failed in vkMapMemory: %s", string_VkResult(mapRes));
+ VERBOSE("%s: failed in vkMapMemory: %s", __func__, string_VkResult(mapRes));
break;
}
}
@@ -1992,14 +2037,14 @@
} else {
allocationAttempts.push_back(info->memory);
- VERBOSE("allocExternalMemory: attempt #%zu failed; deviceAlignment: %" PRIu64
+ VERBOSE("%s: attempt #%zu failed; deviceAlignment: %" PRIu64
", mappedPtrPageOffset: %" PRIu64,
- allocationAttempts.size(), deviceAlignment.valueOr(0), mappedPtrPageOffset);
+ __func__, allocationAttempts.size(), deviceAlignment.valueOr(0), mappedPtrPageOffset);
if (allocationAttempts.size() >= kMaxAllocationAttempts) {
VERBOSE(
- "allocExternalMemory: unable to allocate memory with CPU mapped ptr aligned to "
- "page");
+ "%s: unable to allocate memory with CPU mapped ptr aligned to "
+ "page", __func__);
break;
}
}
@@ -2078,8 +2123,8 @@
#endif
if (exportRes != VK_SUCCESS || !validHandle) {
- WARN("allocExternalMemory: Failed to get external memory, result: %s",
- string_VkResult(exportRes));
+ WARN("%s: Failed to get external memory, result: %s",
+ __func__, string_VkResult(exportRes));
return false;
}
@@ -2228,7 +2273,7 @@
// b/281550953
// RGB8 is not supported on many vulkan drivers.
// Try RGBA8 instead.
- // Note: copyImageData() performs channel conversion for this case.
+ // Note: updateColorBufferFromBytesLocked() performs channel conversion for this case.
return VK_FORMAT_R8G8B8A8_UNORM;
case GL_RGB565:
return VK_FORMAT_R5G6B5_UNORM_PACK16;
@@ -2239,8 +2284,19 @@
return VK_FORMAT_R8G8B8A8_UNORM;
case GL_RGB5_A1_OES:
return VK_FORMAT_A1R5G5B5_UNORM_PACK16;
- case GL_RGBA4_OES:
+ case GL_RGBA4_OES: {
+ // TODO: add R4G4B4A4 support to lavapipe, and check support programmatically
+ const bool lavapipe =
+ (android::base::getEnvironmentVariable("ANDROID_EMU_VK_ICD").compare("lavapipe") ==
+ 0);
+ if (lavapipe) {
+ // RGBA4 is not supported on lavapipe, use more widely available BGRA4 instead.
+ // Note: updateColorBufferFromBytesLocked() performs channel conversion for this
+ // case.
+ return VK_FORMAT_B4G4R4A4_UNORM_PACK16;
+ }
return VK_FORMAT_R4G4B4A4_UNORM_PACK16;
+ }
case GL_RGB10_A2:
case GL_UNSIGNED_INT_10_10_10_2_OES:
return VK_FORMAT_A2R10G10B10_UNORM_PACK32;
@@ -2653,10 +2709,8 @@
const VkFormat imageVkFormat = infoPtr->imageCreateInfoShallow.format;
VERBOSE(
- "ColorBuffer %d, dimensions: %dx%d, format: %s, "
- "allocation size and type index: %lu, %d, "
- "allocated memory property: %d, "
- "requested memory property: %d",
+ "ColorBuffer %u, %ux%u, %s, "
+ "Memory [size: %llu, type: %d, props: %u / %u]",
colorBufferHandle, infoPtr->width, infoPtr->height, string_VkFormat(imageVkFormat),
infoPtr->memory.size, infoPtr->memory.typeIndex,
mDeviceInfo.memProps.memoryTypes[infoPtr->memory.typeIndex].propertyFlags,
@@ -3035,13 +3089,13 @@
mDebugUtilsHelper.cmdBeginDebugLabel(mCommandBuffer, "readColorBufferToBytes(ColorBuffer:%d)",
colorBufferHandle);
- VkImageLayout currentLayout = colorBufferInfo->currentLayout;
- VkImageLayout transferSrcLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
+ const VkImageLayout currentLayout = colorBufferInfo->currentLayout;
+ const VkImageLayout transferSrcLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
const VkImageMemoryBarrier toTransferSrcImageBarrier = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.pNext = nullptr,
- .srcAccessMask = 0,
+ .srcAccessMask = VK_ACCESS_MEMORY_WRITE_BIT,
.dstAccessMask = VK_ACCESS_HOST_READ_BIT,
.oldLayout = currentLayout,
.newLayout = transferSrcLayout,
@@ -3063,7 +3117,7 @@
&toTransferSrcImageBarrier);
vk->vkCmdCopyImageToBuffer(mCommandBuffer, colorBufferInfo->image,
- VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, mStaging.buffer,
+ transferSrcLayout, mStaging.buffer,
bufferImageCopies.size(), bufferImageCopies.data());
// Change back to original layout
@@ -3072,7 +3126,7 @@
const VkImageMemoryBarrier toCurrentLayoutImageBarrier = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.pNext = nullptr,
- .srcAccessMask = VK_ACCESS_HOST_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT,
+ .srcAccessMask = VK_ACCESS_HOST_READ_BIT,
.dstAccessMask = VK_ACCESS_NONE_KHR,
.oldLayout = transferSrcLayout,
.newLayout = colorBufferInfo->currentLayout,
@@ -3187,6 +3241,20 @@
}
}
+static void convertRgba4ToBGRA4Pixels(void* dst, const void* src, uint32_t w, uint32_t h) {
+ const size_t pixelCount = w * h;
+ const uint16_t* srcPixels = reinterpret_cast<const uint16_t*>(src);
+ uint16_t* dstPixels = reinterpret_cast<uint16_t*>(dst);
+ for (size_t i = 0; i < pixelCount; ++i) {
+ const uint16_t rgba4_pixel = srcPixels[i];
+ const uint8_t red = (rgba4_pixel >> 12) & 0xF;
+ const uint8_t green = (rgba4_pixel >> 8) & 0xF;
+ const uint8_t blue = (rgba4_pixel >> 4) & 0xF;
+ const uint8_t alpha = rgba4_pixel & 0xF;
+ dstPixels[i] = (blue << 12) | (green << 8) | (red << 4) | alpha;
+ }
+}
+
bool VkEmulation::updateColorBufferFromBytesLocked(uint32_t colorBufferHandle, uint32_t x,
uint32_t y, uint32_t w, uint32_t h,
const void* pixels, size_t inputPixelsSize) {
@@ -3209,9 +3277,10 @@
return false;
}
+ const VkFormat creationFormat = colorBufferInfo->imageCreateInfoShallow.format;
VkDeviceSize dstBufferSize = 0;
std::vector<VkBufferImageCopy> bufferImageCopies;
- if (!getFormatTransferInfo(colorBufferInfo->imageCreateInfoShallow.format,
+ if (!getFormatTransferInfo(creationFormat,
colorBufferInfo->imageCreateInfoShallow.extent.width,
colorBufferInfo->imageCreateInfoShallow.extent.height,
&dstBufferSize, &bufferImageCopies)) {
@@ -3226,10 +3295,11 @@
colorBufferHandle, dstBufferSize, stagingBufferSize);
return false;
}
-
- bool isThreeByteRgb =
+ const bool isRGBA4onBGRA4 = (colorBufferInfo->internalFormat == GL_RGBA4_OES) &&
+ (creationFormat == VK_FORMAT_B4G4R4A4_UNORM_PACK16);
+ const bool isThreeByteRgb =
(colorBufferInfo->internalFormat == GL_RGB || colorBufferInfo->internalFormat == GL_RGB8);
- size_t expectedInputSize = (isThreeByteRgb ? dstBufferSize / 4 * 3 : dstBufferSize);
+ const size_t expectedInputSize = (isThreeByteRgb ? dstBufferSize / 4 * 3 : dstBufferSize);
if (inputPixelsSize != 0 && inputPixelsSize != expectedInputSize) {
ERR("Unexpected contents size when trying to update ColorBuffer:%d, "
@@ -3245,6 +3315,8 @@
// an incompatible choice of 4-byte backing VK_FORMAT_R8G8B8A8_UNORM.
// b/281550953
convertRgbToRgbaPixels(stagingBufferPtr, pixels, w, h);
+ } else if(isRGBA4onBGRA4) {
+ convertRgba4ToBGRA4Pixels(stagingBufferPtr, pixels, w, h);
} else {
std::memcpy(stagingBufferPtr, pixels, dstBufferSize);
}
diff --git a/host/vulkan/VkCommonOperations.h b/host/vulkan/VkCommonOperations.h
index bb50ca3..9e14b4d 100644
--- a/host/vulkan/VkCommonOperations.h
+++ b/host/vulkan/VkCommonOperations.h
@@ -126,6 +126,8 @@
bool supportsExternalMemoryHostProperties() const;
+ std::optional<VkPhysicalDeviceRobustness2FeaturesEXT> getRobustness2Features() const;
+
VkPhysicalDeviceExternalMemoryHostPropertiesEXT externalMemoryHostProperties() const;
bool isGuestVulkanOnly() const;
@@ -472,6 +474,9 @@
#else
PFN_vkGetMemoryFdKHR getMemoryHandleFunc = nullptr;
#endif
+
+ // Set only if requested and supported
+ std::optional<VkPhysicalDeviceRobustness2FeaturesEXT> robustness2Features;
};
uint32_t getValidMemoryTypeIndex(uint32_t requiredMemoryTypeBits,
diff --git a/host/vulkan/VkDecoderGlobalState.cpp b/host/vulkan/VkDecoderGlobalState.cpp
index 6bca012..f79a06d 100644
--- a/host/vulkan/VkDecoderGlobalState.cpp
+++ b/host/vulkan/VkDecoderGlobalState.cpp
@@ -1822,6 +1822,19 @@
}
}
+ const auto r2features = m_vkEmulation->getRobustness2Features();
+ const bool forceEnableRobustness =
+ r2features &&
+ (vk_find_struct<VkPhysicalDeviceRobustness2FeaturesEXT>(&createInfoFiltered) == nullptr);
+ VkPhysicalDeviceRobustness2FeaturesEXT modifiedRobustness2features;
+ if (forceEnableRobustness) {
+ VERBOSE("Force-enabling VK_EXT_robustness2 on device creation.");
+ updatedDeviceExtensions.push_back(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME);
+ modifiedRobustness2features = *r2features;
+ modifiedRobustness2features.pNext = const_cast<void*>(createInfoFiltered.pNext);
+ createInfoFiltered.pNext = &modifiedRobustness2features;
+ }
+
if (VkPhysicalDeviceFeatures2* features2 =
vk_find_struct<VkPhysicalDeviceFeatures2>(&createInfoFiltered)) {
featuresToFilter.emplace_back(&features2->features);
@@ -1864,6 +1877,12 @@
if (emulateTextureAstc) {
feature->textureCompressionASTC_LDR = VK_FALSE;
}
+
+ // vkCreateDevice() - VUID-04000: If robustBufferAccess2 is enabled then
+ // robustBufferAccess must be enabled.
+ if (forceEnableRobustness && modifiedRobustness2features.robustBufferAccess2) {
+ feature->robustBufferAccess = VK_TRUE;
+ }
}
if (auto* ycbcrFeatures = vk_find_struct<VkPhysicalDeviceSamplerYcbcrConversionFeatures>(
@@ -5302,7 +5321,7 @@
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
}
- importInfoMetalHandle.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_MTLBUFFER_BIT_EXT;
+ importInfoMetalHandle.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_MTLHEAP_BIT_EXT;
importInfoMetalHandle.handle = bufferMetalMemoryHandle;
vk_append_struct(&structChainIter, &importInfoMetalHandle);
@@ -5482,7 +5501,7 @@
#if defined(__APPLE__)
if (m_vkEmulation->supportsMoltenVk()) {
// Using a different handle type when in MoltenVK mode
- handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_MTLBUFFER_BIT_EXT|VK_EXTERNAL_MEMORY_HANDLE_TYPE_MTLTEXTURE_BIT_EXT;
+ handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_MTLHEAP_BIT_EXT;
} else {
handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT;
}
diff --git a/host/vulkan/cereal/common/vk_struct_id.h b/host/vulkan/cereal/common/vk_struct_id.h
index 0a9fb23..65f428b 100644
--- a/host/vulkan/cereal/common/vk_struct_id.h
+++ b/host/vulkan/cereal/common/vk_struct_id.h
@@ -105,6 +105,8 @@
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES);
REGISTER_VK_STRUCT_ID(VkPhysicalDeviceInlineUniformBlockFeatures,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES);
+REGISTER_VK_STRUCT_ID(VkPhysicalDeviceRobustness2FeaturesEXT,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT);
#if defined(VK_USE_PLATFORM_SCREEN_QNX)
REGISTER_VK_STRUCT_ID(VkPhysicalDeviceExternalMemoryScreenBufferFeaturesQNX,
diff --git a/include/render-utils/virtio_gpu_ops.h b/include/render-utils/virtio_gpu_ops.h
index fedfa86..e066671 100644
--- a/include/render-utils/virtio_gpu_ops.h
+++ b/include/render-utils/virtio_gpu_ops.h
@@ -25,7 +25,7 @@
/* virtio-gpu interface for color buffers
* (triggered by minigbm/egl calling virtio-gpu ioctls) */
typedef void (*create_color_buffer_with_handle_t)(uint32_t width, uint32_t height, uint32_t format,
- uint32_t fwkFormat, uint32_t handle, bool linear);
+ uint32_t fwkFormat, uint32_t handle);
/* create YUV textures with given width and height
type: FRAMEWORK_FORMAT_NV12 or FRAMEWORK_FORMAT_YUV_420_888
diff --git a/qnx/host/platform_qnx.cpp b/qnx/host/platform_qnx.cpp
deleted file mode 100644
index 37c369b..0000000
--- a/qnx/host/platform_qnx.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (C) 2023 The Android Open Source Project
-// Copyright (C) 2023 BlackBerry Limited
-//
-// 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 <EGL/egl.h>
-#include <GLES2/gl2.h>
-
-// without this the build fails to properly link to the qnx EGL and GLESv2 libs:
-// SharedLibrary.cpp:266] SharedLibrary::open for [libGLESv2.so] failed (posix). dlerror:
-// [Unresolved symbols] EglOsApi_egl.cpp:208] EglOsGlLibrary: Could not open GL library
-// libGLESv2.so [Unresolved symbols]
-void link_EGL_GLES2(void) {
- eglGetDisplay(EGL_DEFAULT_DISPLAY);
- glViewport(0, 0, 0, 0);
-}
diff --git a/third-party/fuchsia/magma/BUILD.bazel b/third-party/fuchsia/magma/BUILD.bazel
index e6f9804..8355af0 100644
--- a/third-party/fuchsia/magma/BUILD.bazel
+++ b/third-party/fuchsia/magma/BUILD.bazel
@@ -1,9 +1,9 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
cc_library(
name = "magma-headers",
hdrs = glob([
"include/**/*.h",
- "include/**/*.hpp",
- "include/**/*.inl",
]),
includes = ["include"],
visibility = ["//visibility:public"],
diff --git a/utils/BUILD.bazel b/utils/BUILD.bazel
index f042524..245f9ca 100644
--- a/utils/BUILD.bazel
+++ b/utils/BUILD.bazel
@@ -1,5 +1,7 @@
# File: BUILD
+load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
+
# Interface Library
cc_library(
name = "gfxstream_utils_headers",
@@ -7,10 +9,10 @@
includes = ["include"],
visibility = ["//visibility:public"],
deps = [
- "//hardware/google/aemu/base:aemu-base-headers",
- "//hardware/google/aemu/host-common:aemu-host-common-headers",
- "//hardware/google/gfxstream/common/vulkan:gfxstream_vulkan_headers",
- "//hardware/google/gfxstream/third-party/renderdoc",
+ "//common/vulkan:gfxstream_vulkan_headers",
+ "//third-party/renderdoc",
+ "@aemu//base:aemu-base-headers",
+ "@aemu//host-common:aemu-host-common-headers",
],
)
@@ -31,6 +33,7 @@
],
deps = [
":gfxstream_utils",
+ "@aemu//base:aemu-base",
"@com_google_googletest//:gtest_main",
],
)