Reland^2: Use "gfxstream" namespace This reverts commit d37d7c8c0cdf6b84d453cb41e358094880a8f3b5. Reland adds in aosp/2516595 which was only built on the "full" target and removes namespace around window methods to satisfy MacOS build. Bug: b/271464937 Test: android build Test: cmake build Test: ATP MacOS build Change-Id: Ida36ac16f9c3b98aedd744d21c9b27e9063a8eea
diff --git a/stream-servers/tests/CompositorVk_unittest.cpp b/stream-servers/tests/CompositorVk_unittest.cpp index 3e02b2a..0288264 100644 --- a/stream-servers/tests/CompositorVk_unittest.cpp +++ b/stream-servers/tests/CompositorVk_unittest.cpp
@@ -16,6 +16,8 @@ #include "vulkan/VulkanDispatch.h" #include "vulkan/vk_util.h" +namespace gfxstream { +namespace vk { namespace { static constexpr const bool kDefaultSaveImageIfComparisonFailed = false; @@ -33,13 +35,11 @@ class CompositorVkTest : public ::testing::Test { protected: - using TargetImage = emugl::RenderResourceVk<VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT>; - using SourceImage = emugl::RenderTextureVk; + using TargetImage = RenderResourceVk<VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, + VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT>; + using SourceImage = RenderTextureVk; - static void SetUpTestCase() { - k_vk = emugl::vkDispatch(false); - } + static void SetUpTestCase() { k_vk = vkDispatch(false); } void SetUp() override { #if defined(__APPLE__) && defined(__arm64__) @@ -258,7 +258,7 @@ checkImageFilledWith(image, color); } - static const goldfish_vk::VulkanDispatch *k_vk; + static const VulkanDispatch* k_vk; VkInstance m_vkInstance = VK_NULL_HANDLE; VkPhysicalDevice m_vkPhysicalDevice = VK_NULL_HANDLE; uint32_t m_compositorQueueFamilyIndex = 0; @@ -355,7 +355,7 @@ } }; -const goldfish_vk::VulkanDispatch *CompositorVkTest::k_vk = nullptr; +const VulkanDispatch* CompositorVkTest::k_vk = nullptr; TEST_F(CompositorVkTest, QueueSupportsComposition) { VkQueueFamilyProperties properties = {}; @@ -820,3 +820,5 @@ } } // namespace +} // namespace vk +} // namespace gfxstream
diff --git a/stream-servers/tests/DefaultFramebufferBlit_unittest.cpp b/stream-servers/tests/DefaultFramebufferBlit_unittest.cpp index 398c642..7952f55 100644 --- a/stream-servers/tests/DefaultFramebufferBlit_unittest.cpp +++ b/stream-servers/tests/DefaultFramebufferBlit_unittest.cpp
@@ -19,14 +19,17 @@ #include <memory> -using gfxstream::GLESApi; -using gfxstream::GLESApi_2; -using gfxstream::GLESApi_3_0; -using gfxstream::GLESApi_3_1; -using gfxstream::GLESApi_3_2; -using gfxstream::GLESApi_CM; +namespace gfxstream { +namespace { -namespace emugl { +using gl::GLESApi; +using gl::GLESApi_2; +using gl::GLESApi_3_0; +using gl::GLESApi_3_1; +using gl::GLESApi_3_2; +using gl::GLESApi_CM; +using gl::LazyLoadedEGLDispatch; +using gl::LazyLoadedGLESv2Dispatch; struct ClearColorParam { const GLESApi glVersion; @@ -275,5 +278,5 @@ testing::Values( ClearColorParam(GLESApi_3_0, true))); - -} // namespace emugl +} // namespace +} // namespace gfxstream
diff --git a/stream-servers/tests/DisplayVk_unittest.cpp b/stream-servers/tests/DisplayVk_unittest.cpp index cda4937..2842873 100644 --- a/stream-servers/tests/DisplayVk_unittest.cpp +++ b/stream-servers/tests/DisplayVk_unittest.cpp
@@ -12,22 +12,26 @@ using gfxstream::DisplaySurface; +namespace gfxstream { +namespace vk { +namespace { + class DisplayVkTest : public ::testing::Test { protected: - using RenderTexture = emugl::RenderTextureVk; + using RenderTexture = RenderTextureVk; - static void SetUpTestCase() { k_vk = emugl::vkDispatch(false); } + static void SetUpTestCase() { k_vk = vkDispatch(false); } void SetUp() override { // skip the test when testing without a window - if (!emugl::shouldUseWindow()) { + if (!shouldUseWindow()) { GTEST_SKIP(); } ASSERT_NE(k_vk, nullptr); createInstance(); createWindowAndSurface(); - m_window = emugl::createOrGetTestWindow(0, 0, k_width, k_height); + m_window = createOrGetTestWindow(0, 0, k_width, k_height); pickPhysicalDevice(); createLogicalDevice(); k_vk->vkGetDeviceQueue(m_vkDevice, m_compositorQueueFamilyIndex, 0, &m_compositorVkQueue); @@ -51,7 +55,7 @@ } void TearDown() override { - if (emugl::shouldUseWindow()) { + if (shouldUseWindow()) { ASSERT_EQ(k_vk->vkQueueWaitIdle(m_compositorVkQueue), VK_SUCCESS); ASSERT_EQ(k_vk->vkQueueWaitIdle(m_swapChainVkQueue), VK_SUCCESS); @@ -80,7 +84,7 @@ return info; } - static const goldfish_vk::VulkanDispatch *k_vk; + static const VulkanDispatch* k_vk; static constexpr uint32_t k_width = 0x100; static constexpr uint32_t k_height = 0x100; @@ -119,7 +123,7 @@ } void createWindowAndSurface() { - m_window = emugl::createOrGetTestWindow(0, 0, k_width, k_height); + m_window = createOrGetTestWindow(0, 0, k_width, k_height); ASSERT_NE(m_window, nullptr); // TODO(kaiyili, b/179477624): add support for other platforms #ifdef _WIN32 @@ -205,7 +209,7 @@ } }; -const goldfish_vk::VulkanDispatch *DisplayVkTest::k_vk = nullptr; +const VulkanDispatch* DisplayVkTest::k_vk = nullptr; TEST_F(DisplayVkTest, Init) {} @@ -282,3 +286,7 @@ waitForGpuFuture.wait(); } } + +} // namespace +} // namespace vk +} // namespace gfxstream
diff --git a/stream-servers/tests/FrameBuffer_unittest.cpp b/stream-servers/tests/FrameBuffer_unittest.cpp index dc79ad0..6bca587 100644 --- a/stream-servers/tests/FrameBuffer_unittest.cpp +++ b/stream-servers/tests/FrameBuffer_unittest.cpp
@@ -43,12 +43,17 @@ #include "X11TestingSupport.h" #endif +namespace gfxstream { +namespace { + using android::base::StdioStream; using android::snapshot::TextureLoader; using android::snapshot::TextureSaver; -using gfxstream::GLESApi_3_0; - -namespace emugl { +using gl::EGLDispatch; +using gl::EmulatedEglConfigList; +using gl::GLESApi_3_0; +using gl::LazyLoadedEGLDispatch; +using gl::LazyLoadedGLESv2Dispatch; class FrameBufferTest : public ::testing::Test { public: @@ -981,4 +986,6 @@ freeNativePixmap(pixmap); } #endif -} // namespace emugl + +} // namespace +} // namespace gfxstream
diff --git a/stream-servers/tests/GLES1Dispatch_unittest.cpp b/stream-servers/tests/GLES1Dispatch_unittest.cpp index ec6f1ed..174ccf2 100644 --- a/stream-servers/tests/GLES1Dispatch_unittest.cpp +++ b/stream-servers/tests/GLES1Dispatch_unittest.cpp
@@ -18,7 +18,10 @@ #include "GLTestUtils.h" #include "OpenGLTestContext.h" -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { + // b/233094475: GLES1 frustumf crash on cmcontext should not crash when // core profile is not enabled. TEST_F(GLTest, TestGlFrustumNoCoreProfile) { @@ -32,4 +35,6 @@ context.frustumf(0, 0, 0, 0, 0, 0); } -} // namespace emugl \ No newline at end of file +} // namespace +} // namespace gl +} // namespace gfxstream \ No newline at end of file
diff --git a/stream-servers/tests/GLSnapshotBuffers_unittest.cpp b/stream-servers/tests/GLSnapshotBuffers_unittest.cpp index d246d90..2dc4318 100644 --- a/stream-servers/tests/GLSnapshotBuffers_unittest.cpp +++ b/stream-servers/tests/GLSnapshotBuffers_unittest.cpp
@@ -20,7 +20,9 @@ #include <map> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { static const GLenum kGLES2GlobalBufferBindings[] = { GL_ARRAY_BUFFER_BINDING, GL_ELEMENT_ARRAY_BUFFER_BINDING}; @@ -143,4 +145,6 @@ doCheckedSnapshot(); } -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotFramebufferControl_unittest.cpp b/stream-servers/tests/GLSnapshotFramebufferControl_unittest.cpp index fb12829..39f523a 100644 --- a/stream-servers/tests/GLSnapshotFramebufferControl_unittest.cpp +++ b/stream-servers/tests/GLSnapshotFramebufferControl_unittest.cpp
@@ -16,7 +16,9 @@ #include <gtest/gtest.h> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { class SnapshotGlColorMaskTest : public SnapshotSetValueTest<std::vector<GLboolean>> { @@ -106,4 +108,6 @@ doCheckedSnapshot(); } -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotFramebuffers_unittest.cpp b/stream-servers/tests/GLSnapshotFramebuffers_unittest.cpp index 397061d..05c3c6e 100644 --- a/stream-servers/tests/GLSnapshotFramebuffers_unittest.cpp +++ b/stream-servers/tests/GLSnapshotFramebuffers_unittest.cpp
@@ -19,7 +19,9 @@ #include <map> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { struct GlFramebufferAttachment { GLenum type; @@ -154,4 +156,6 @@ doCheckedSnapshot(); } -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotMultisampling_unittest.cpp b/stream-servers/tests/GLSnapshotMultisampling_unittest.cpp index 76ff56f..5e1a530 100644 --- a/stream-servers/tests/GLSnapshotMultisampling_unittest.cpp +++ b/stream-servers/tests/GLSnapshotMultisampling_unittest.cpp
@@ -17,7 +17,9 @@ #include <gtest/gtest.h> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { struct GlSampleCoverage { GLclampf value; @@ -52,4 +54,6 @@ SnapshotGlSampleCoverageTest, ::testing::ValuesIn(kGLES2TestSampleCoverages)); -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotPixelOperations_unittest.cpp b/stream-servers/tests/GLSnapshotPixelOperations_unittest.cpp index 347db33..6ace67f 100644 --- a/stream-servers/tests/GLSnapshotPixelOperations_unittest.cpp +++ b/stream-servers/tests/GLSnapshotPixelOperations_unittest.cpp
@@ -18,7 +18,9 @@ #include <gtest/gtest.h> #include <array> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { struct GlStencilFunc { GLenum func; @@ -410,4 +412,6 @@ INSTANTIATE_TEST_SUITE_P(GLES2SnapshotPixelOps, SnapshotGlBlendFunciTest, ::testing::Values(kGLES2TestBlendFunci)); -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotPixels_unittest.cpp b/stream-servers/tests/GLSnapshotPixels_unittest.cpp index d75599b..98fc452 100644 --- a/stream-servers/tests/GLSnapshotPixels_unittest.cpp +++ b/stream-servers/tests/GLSnapshotPixels_unittest.cpp
@@ -16,7 +16,9 @@ #include <gtest/gtest.h> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { class SnapshotGlUnpackAlignmentTest : public SnapshotSetValueTest<GLuint>, @@ -58,4 +60,6 @@ SnapshotGlPackAlignmentTest, ::testing::Values(1, 2, 4, 8)); -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotPrograms_unittest.cpp b/stream-servers/tests/GLSnapshotPrograms_unittest.cpp index d73ebc2..d23ded1 100644 --- a/stream-servers/tests/GLSnapshotPrograms_unittest.cpp +++ b/stream-servers/tests/GLSnapshotPrograms_unittest.cpp
@@ -20,7 +20,9 @@ #include <map> #include <string> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { static const char kTestVertexShader[] = R"( attribute vec4 position; @@ -414,4 +416,6 @@ doCheckedSnapshot(); } -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotRasterization_unittest.cpp b/stream-servers/tests/GLSnapshotRasterization_unittest.cpp index 3f016af..89c369e 100644 --- a/stream-servers/tests/GLSnapshotRasterization_unittest.cpp +++ b/stream-servers/tests/GLSnapshotRasterization_unittest.cpp
@@ -17,7 +17,9 @@ #include <gtest/gtest.h> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { // Line width settings to attempt static const GLfloat kGLES2TestLineWidths[] = {2.0f}; @@ -101,5 +103,6 @@ doCheckedSnapshot(); } - -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotRenderbuffers_unittest.cpp b/stream-servers/tests/GLSnapshotRenderbuffers_unittest.cpp index a0ad642..b9593b6 100644 --- a/stream-servers/tests/GLSnapshotRenderbuffers_unittest.cpp +++ b/stream-servers/tests/GLSnapshotRenderbuffers_unittest.cpp
@@ -16,7 +16,9 @@ #include <gtest/gtest.h> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { struct GlRenderbufferFormat { GLenum name; @@ -205,4 +207,6 @@ SnapshotGlRenderbufferFormatTest, ::testing::ValuesIn(kGLES2TestRenderbufferStates)); -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotRendering_unittest.cpp b/stream-servers/tests/GLSnapshotRendering_unittest.cpp index e6df544..3b8bb4b 100644 --- a/stream-servers/tests/GLSnapshotRendering_unittest.cpp +++ b/stream-servers/tests/GLSnapshotRendering_unittest.cpp
@@ -21,10 +21,9 @@ #include <gtest/gtest.h> - -namespace emugl { - - +namespace gfxstream { +namespace gl { +namespace { TEST(SnapshotGlRenderingSampleTest, OverrideDispatch) { const GLESv2Dispatch* gl = LazyLoadedGLESv2Dispatch::get(); @@ -73,7 +72,7 @@ emugl::set_emugl_window_operations(*getGraphicsAgents()->emu); //const EGLDispatch* egl = LazyLoadedEGLDispatch::get(); - LazyLoadedGLESv2Dispatch::get(); + gl::LazyLoadedGLESv2Dispatch::get(); getSnapshotTestDispatch(); mApp.reset(new T()); @@ -104,4 +103,6 @@ this->mApp->drawLoop(); } -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotShaders_unittest.cpp b/stream-servers/tests/GLSnapshotShaders_unittest.cpp index 37a68e6..8e304a2 100644 --- a/stream-servers/tests/GLSnapshotShaders_unittest.cpp +++ b/stream-servers/tests/GLSnapshotShaders_unittest.cpp
@@ -18,7 +18,9 @@ #include <string> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { static const char kTestVertexShaderSource[] = R"( attribute vec4 position; @@ -242,4 +244,6 @@ doCheckedSnapshot(); } -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotTestDispatch.cpp b/stream-servers/tests/GLSnapshotTestDispatch.cpp index 258d218..9660e8e 100644 --- a/stream-servers/tests/GLSnapshotTestDispatch.cpp +++ b/stream-servers/tests/GLSnapshotTestDispatch.cpp
@@ -12,7 +12,8 @@ #include "snapshot/TextureLoader.h" #include "snapshot/TextureSaver.h" -namespace emugl { +namespace gfxstream { +namespace gl { using android::base::StdioStream; using android::snapshot::TextureLoader; @@ -169,4 +170,5 @@ prePixels.data(), postPixels.data())); } -} // namespace emugl +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotTestDispatch.h b/stream-servers/tests/GLSnapshotTestDispatch.h index 736e0fa..3a8d62b 100644 --- a/stream-servers/tests/GLSnapshotTestDispatch.h +++ b/stream-servers/tests/GLSnapshotTestDispatch.h
@@ -18,7 +18,8 @@ #include "aemu/base/testing/TestSystem.h" -namespace emugl { +namespace gfxstream { +namespace gl { // Global dispatch object with functions overridden for snapshot testing const GLESv2Dispatch* getSnapshotTestDispatch(); @@ -68,4 +69,5 @@ std::string mTextureFile = {}; }; -} // namespace emugl +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotTestStateUtils.cpp b/stream-servers/tests/GLSnapshotTestStateUtils.cpp index 8549d31..46b0af3 100644 --- a/stream-servers/tests/GLSnapshotTestStateUtils.cpp +++ b/stream-servers/tests/GLSnapshotTestStateUtils.cpp
@@ -22,7 +22,8 @@ #include <GLES2/gl2.h> #include <GLES3/gl31.h> -namespace emugl { +namespace gfxstream { +namespace gl { GLuint createBuffer(const GLESv2Dispatch* gl, GlBufferData data) { // We bind to GL_ARRAY_BUFFER in order to set up buffer data, @@ -107,4 +108,5 @@ return out; } -} // namespace emugl +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotTestStateUtils.h b/stream-servers/tests/GLSnapshotTestStateUtils.h index d1cf385..311a8cc 100644 --- a/stream-servers/tests/GLSnapshotTestStateUtils.h +++ b/stream-servers/tests/GLSnapshotTestStateUtils.h
@@ -18,7 +18,8 @@ #include <GLES2/gl2.h> #include <GLES3/gl31.h> -namespace emugl { +namespace gfxstream { +namespace gl { GLuint createBuffer(const GLESv2Dispatch* gl, GlBufferData data); @@ -37,4 +38,5 @@ GLenum format, GLenum type); -} // namespace emugl +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotTesting.cpp b/stream-servers/tests/GLSnapshotTesting.cpp index 5b27eab..8ea3945 100644 --- a/stream-servers/tests/GLSnapshotTesting.cpp +++ b/stream-servers/tests/GLSnapshotTesting.cpp
@@ -29,7 +29,8 @@ #include <GLES2/gl2.h> #include <GLES3/gl31.h> -namespace emugl { +namespace gfxstream { +namespace gl { using android::base::StdioStream; using android::snapshot::TextureLoader; @@ -344,4 +345,5 @@ } } -} // namespace emugl +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotTesting.h b/stream-servers/tests/GLSnapshotTesting.h index 5e6b7f4..ac979d6 100644 --- a/stream-servers/tests/GLSnapshotTesting.h +++ b/stream-servers/tests/GLSnapshotTesting.h
@@ -25,7 +25,8 @@ #include <memory> #include <vector> -namespace emugl { +namespace gfxstream { +namespace gl { struct GlValues { std::vector<GLint> ints; @@ -192,8 +193,8 @@ // EXPECT_FALSE(fooBarState()); // Snapshot preserved the state change // } // -class SnapshotTest : public emugl::GLTest { -public: +class SnapshotTest : public gfxstream::gl::GLTest { + public: SnapshotTest() = default; void SetUp() override; @@ -320,4 +321,5 @@ std::unique_ptr<T> m_changed_value; }; -} // namespace emugl +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotTextures_unittest.cpp b/stream-servers/tests/GLSnapshotTextures_unittest.cpp index c450b60..e2818bd 100644 --- a/stream-servers/tests/GLSnapshotTextures_unittest.cpp +++ b/stream-servers/tests/GLSnapshotTextures_unittest.cpp
@@ -18,7 +18,9 @@ #include <gtest/gtest.h> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { struct GlTextureUnitState { GLuint binding2D; @@ -478,4 +480,6 @@ doCheckedSnapshot(); } -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotTransformation_unittest.cpp b/stream-servers/tests/GLSnapshotTransformation_unittest.cpp index 394af70..7d23ab5 100644 --- a/stream-servers/tests/GLSnapshotTransformation_unittest.cpp +++ b/stream-servers/tests/GLSnapshotTransformation_unittest.cpp
@@ -17,7 +17,9 @@ #include <gtest/gtest.h> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { // Viewport settings to attempt static const std::vector<GLint> kGLES2TestViewport = {10, 10, 100, 100}; @@ -74,4 +76,6 @@ SnapshotGlDepthRangeTest, ::testing::Values(kGLES2TestDepthRange)); -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshotVertexAttributes_unittest.cpp b/stream-servers/tests/GLSnapshotVertexAttributes_unittest.cpp index f8438dd..3fbcce1 100644 --- a/stream-servers/tests/GLSnapshotVertexAttributes_unittest.cpp +++ b/stream-servers/tests/GLSnapshotVertexAttributes_unittest.cpp
@@ -20,7 +20,9 @@ #include <algorithm> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { enum class GlVertexAttribMode { SingleValue = 0, Array = 1, Buffer = 2 }; @@ -302,4 +304,6 @@ doCheckedSnapshot(); } -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLSnapshot_unittest.cpp b/stream-servers/tests/GLSnapshot_unittest.cpp index fce7999..f963905 100644 --- a/stream-servers/tests/GLSnapshot_unittest.cpp +++ b/stream-servers/tests/GLSnapshot_unittest.cpp
@@ -17,7 +17,9 @@ #include <gtest/gtest.h> -namespace emugl { +namespace gfxstream { +namespace gl { +namespace { TEST_F(SnapshotTest, InitDestroy) {} @@ -78,4 +80,6 @@ SnapshotGlMipmapHintTest, ::testing::ValuesIn(kGLES2GenerateMipmapHints)); -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLTestUtils.cpp b/stream-servers/tests/GLTestUtils.cpp index 8e1fc63..d2b9af9 100644 --- a/stream-servers/tests/GLTestUtils.cpp +++ b/stream-servers/tests/GLTestUtils.cpp
@@ -16,7 +16,7 @@ using android::AlignedBuf; -namespace emugl { +namespace gfxstream { testing::AssertionResult RowMatches(int rowIndex, size_t rowBytes, unsigned char* expected, unsigned char* actual) { @@ -624,4 +624,4 @@ } } -} // namespace emugl +} // namespace gfxstream
diff --git a/stream-servers/tests/GLTestUtils.h b/stream-servers/tests/GLTestUtils.h index 9e9b5cf..1cc0e90 100644 --- a/stream-servers/tests/GLTestUtils.h +++ b/stream-servers/tests/GLTestUtils.h
@@ -21,7 +21,7 @@ #include <gtest/gtest.h> -namespace emugl { +namespace gfxstream { using TestTexture = android::AlignedBuf<uint8_t, 4>; @@ -45,4 +45,4 @@ // Return the name associated with |v| as a string. const char* getEnumString(GLenum v); -} // namespace emugl +} // namespace gfxstream
diff --git a/stream-servers/tests/HelloTriangle.cpp b/stream-servers/tests/HelloTriangle.cpp index a65bfb5..0ec71b7 100644 --- a/stream-servers/tests/HelloTriangle.cpp +++ b/stream-servers/tests/HelloTriangle.cpp
@@ -17,7 +17,7 @@ // Implementation is in HelloTriangleImp.cpp int main(int argc, char** argv) { - emugl::HelloTriangle app; + gfxstream::HelloTriangle app; app.drawLoop(); return 0; }
diff --git a/stream-servers/tests/HelloTriangle.h b/stream-servers/tests/HelloTriangle.h index fda9432..4d1d067 100644 --- a/stream-servers/tests/HelloTriangle.h +++ b/stream-servers/tests/HelloTriangle.h
@@ -23,7 +23,7 @@ #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> -namespace emugl { +namespace gfxstream { class HelloTriangle : public SampleApplication { protected: @@ -40,4 +40,4 @@ float mTime = 0.0f; }; -} // namespace emugl +} // namespace gfxstream
diff --git a/stream-servers/tests/HelloTriangleImp.cpp b/stream-servers/tests/HelloTriangleImp.cpp index cbe0249..a08d683 100644 --- a/stream-servers/tests/HelloTriangleImp.cpp +++ b/stream-servers/tests/HelloTriangleImp.cpp
@@ -23,7 +23,7 @@ #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> -namespace emugl { +namespace gfxstream { void HelloTriangle::initialize() { constexpr char vshaderSrc[] = R"(#version 300 es @@ -53,7 +53,7 @@ } )"; - GLint program = emugl::compileAndLinkShaderProgram(vshaderSrc, fshaderSrc); + GLint program = compileAndLinkShaderProgram(vshaderSrc, fshaderSrc); auto gl = getGlDispatch(); @@ -97,4 +97,4 @@ mTime += 0.05f; } -} // namespace emugl +} // namespace gfxstream
diff --git a/stream-servers/tests/ImageUtils.cpp b/stream-servers/tests/ImageUtils.cpp index f9de13f..25269c5 100644 --- a/stream-servers/tests/ImageUtils.cpp +++ b/stream-servers/tests/ImageUtils.cpp
@@ -19,6 +19,8 @@ #include <cstring> +namespace gfxstream { + bool LoadRGBAFromPng(const std::string& filename, uint32_t* outWidth, uint32_t* outHeight, std::vector<uint32_t>* outPixels) { *outWidth = 0; @@ -56,3 +58,5 @@ } return true; } + +} // namespace gfxstream
diff --git a/stream-servers/tests/ImageUtils.h b/stream-servers/tests/ImageUtils.h index 567741b..3ff83fc 100644 --- a/stream-servers/tests/ImageUtils.h +++ b/stream-servers/tests/ImageUtils.h
@@ -18,8 +18,12 @@ #include <string> #include <vector> +namespace gfxstream { + bool LoadRGBAFromPng(const std::string& filename, uint32_t* outWidth, uint32_t* outHeight, std::vector<uint32_t>* outPixels); bool SaveRGBAToPng(uint32_t width, uint32_t height, const uint32_t* pixels, const std::string& filename); + +} // namespace gfxstream
diff --git a/stream-servers/tests/OpenGLTestContext.cpp b/stream-servers/tests/OpenGLTestContext.cpp index d0babb9..0c6117a 100644 --- a/stream-servers/tests/OpenGLTestContext.cpp +++ b/stream-servers/tests/OpenGLTestContext.cpp
@@ -18,7 +18,8 @@ #include "host-common/testing/MockGraphicsAgentFactory.h" #include "Standalone.h" -namespace emugl { +namespace gfxstream { +namespace gl { static bool sDisplayNeedsInit = true; @@ -152,4 +153,5 @@ << "GLTest TearDown found EGL error"; } -} // namespace emugl +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/OpenGLTestContext.h b/stream-servers/tests/OpenGLTestContext.h index 756307a..7b8ca6a 100644 --- a/stream-servers/tests/OpenGLTestContext.h +++ b/stream-servers/tests/OpenGLTestContext.h
@@ -28,7 +28,8 @@ #include <GLES2/gl2.h> #include <GLES3/gl31.h> -namespace emugl { +namespace gfxstream { +namespace gl { // Dimensions for test surface static const int kTestSurfaceSize[] = {32, 32}; @@ -65,4 +66,6 @@ return; \ } \ } while (0) -} // namespace emugl + +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/OpenGL_unittest.cpp b/stream-servers/tests/OpenGL_unittest.cpp index 0cf2e2b..22d738e 100644 --- a/stream-servers/tests/OpenGL_unittest.cpp +++ b/stream-servers/tests/OpenGL_unittest.cpp
@@ -16,7 +16,8 @@ #include <gtest/gtest.h> -namespace emugl { +namespace gfxstream { +namespace { TEST_F(GLTest, InitDestroy) {} @@ -41,4 +42,5 @@ EXPECT_EQ(EGL_SUCCESS, egl->eglGetError()); } -} // namespace emugl +} // namespace +} // namespace gfxstream
diff --git a/stream-servers/tests/SampleApplication.cpp b/stream-servers/tests/SampleApplication.cpp index 7ea34f0..c8b9747 100644 --- a/stream-servers/tests/SampleApplication.cpp +++ b/stream-servers/tests/SampleApplication.cpp
@@ -30,18 +30,18 @@ #include <EGL/eglext.h> #include <GLES3/gl3.h> +namespace gfxstream { + using android::base::AutoLock; using android::base::ConditionVariable; using android::base::FunctorThread; using android::base::Lock; using android::base::MessageChannel; using android::base::TestSystem; -using gfxstream::EmulatedEglFenceSync; -using gfxstream::GLESApi; -using gfxstream::GLESApi_3_0; -using gfxstream::GLESApi_CM; - -namespace emugl { +using gl::EmulatedEglFenceSync; +using gl::GLESApi; +using gl::GLESApi_3_0; +using gl::GLESApi_CM; // Class holding the persistent test window. class TestWindow { @@ -244,9 +244,9 @@ emugl::setGLObjectCounter(android::base::GLObjectCounter::get()); emugl::set_emugl_window_operations(*getGraphicsAgents()->emu);; emugl::set_emugl_multi_display_operations(*getGraphicsAgents()->multi_display); - LazyLoadedEGLDispatch::get(); - if (glVersion == GLESApi_CM) LazyLoadedGLESv1Dispatch::get(); - LazyLoadedGLESv2Dispatch::get(); + gl::LazyLoadedEGLDispatch::get(); + if (glVersion == GLESApi_CM) gl::LazyLoadedGLESv1Dispatch::get(); + gl::LazyLoadedGLESv2Dispatch::get(); bool useHostGpu = shouldUseHostGpu(); mWindow = createOrGetTestWindow(mXOffset, mYOffset, mWidth, mHeight); @@ -556,8 +556,8 @@ } } -const GLESv2Dispatch* SampleApplication::getGlDispatch() { - return LazyLoadedGLESv2Dispatch::get(); +const gl::GLESv2Dispatch* SampleApplication::getGlDispatch() { + return gl::LazyLoadedGLESv2Dispatch::get(); } bool SampleApplication::isSwANGLE() { @@ -568,4 +568,4 @@ return strstr(renderer, "ANGLE") && strstr(renderer, "SwiftShader"); } -} // namespace emugl +} // namespace gfxstream
diff --git a/stream-servers/tests/SampleApplication.h b/stream-servers/tests/SampleApplication.h index 09c49a6..2bdf8b5 100644 --- a/stream-servers/tests/SampleApplication.h +++ b/stream-servers/tests/SampleApplication.h
@@ -24,11 +24,12 @@ #include "gl/EmulatedEglContext.h" #include "gl/EmulatedEglFenceSync.h" -class FrameBuffer; class OSWindow; -struct RenderThreadInfo; -namespace emugl { +namespace gfxstream { + +class FrameBuffer; +struct RenderThreadInfo; // Determines whether the host GPU should be used. bool shouldUseHostGpu(); @@ -46,51 +47,49 @@ // Creates a window (or runs headless) to be used in a sample app. class SampleApplication { public: - SampleApplication(int windowWidth = 256, int windowHeight = 256, - int refreshRate = 60, - gfxstream::GLESApi glVersion = gfxstream::GLESApi_3_0, - bool compose = false); - virtual ~SampleApplication(); + SampleApplication(int windowWidth = 256, int windowHeight = 256, int refreshRate = 60, + gl::GLESApi glVersion = gl::GLESApi_3_0, bool compose = false); + virtual ~SampleApplication(); - // A basic draw loop that works similar to most simple - // GL apps that run on desktop. - // - // Per frame: - // - // a single GL context for drawing, - // a color buffer to blit, - // and a call to post that color buffer. - void rebind(); - void drawLoop(); + // A basic draw loop that works similar to most simple + // GL apps that run on desktop. + // + // Per frame: + // + // a single GL context for drawing, + // a color buffer to blit, + // and a call to post that color buffer. + void rebind(); + void drawLoop(); - // A more complex loop that uses 3 separate contexts - // to simulate what goes on in Android: - // - // Per frame - // - // a GL 'app' context for drawing, - // a SurfaceFlinger context for rendering the "Layer", - // and a HWC context for posting. - void surfaceFlingerComposerLoop(); + // A more complex loop that uses 3 separate contexts + // to simulate what goes on in Android: + // + // Per frame + // + // a GL 'app' context for drawing, + // a SurfaceFlinger context for rendering the "Layer", + // and a HWC context for posting. + void surfaceFlingerComposerLoop(); - // TODO: - // void HWC2Loop(); + // TODO: + // void HWC2Loop(); - // Just initialize, draw, and swap buffers once. - void drawOnce(); + // Just initialize, draw, and swap buffers once. + void drawOnce(); - bool isSwANGLE(); + bool isSwANGLE(); private: void drawWorkerWithCompose(ColorBufferQueue& app2sfQueue, ColorBufferQueue& sf2appQueue); void drawWorker(ColorBufferQueue& app2sfQueue, ColorBufferQueue& sf2appQueue, ColorBufferQueue& sf2hwcQueue, ColorBufferQueue& hwc2sfQueue); - gfxstream::EmulatedEglFenceSync* getFenceSync(); + gl::EmulatedEglFenceSync* getFenceSync(); -protected: + protected: virtual void initialize() = 0; virtual void draw() = 0; - virtual const GLESv2Dispatch* getGlDispatch(); + virtual const gl::GLESv2Dispatch* getGlDispatch(); int mWidth = 256; int mHeight = 256; @@ -114,4 +113,4 @@ DISALLOW_COPY_ASSIGN_AND_MOVE(SampleApplication); }; -} // namespace emugl +} // namespace gfxstream
diff --git a/stream-servers/tests/ShaderUtils.cpp b/stream-servers/tests/ShaderUtils.cpp index 4d73dbc..fb038ab 100644 --- a/stream-servers/tests/ShaderUtils.cpp +++ b/stream-servers/tests/ShaderUtils.cpp
@@ -39,10 +39,10 @@ #define E(fmt,...) fprintf(stderr, "%s: " fmt "\n", __func__, ##__VA_ARGS__); -namespace emugl { +namespace gfxstream { GLuint compileShader(GLenum shaderType, const char* src) { - auto gl = LazyLoadedGLESv2Dispatch::get(); + auto gl = gl::LazyLoadedGLESv2Dispatch::get(); GLuint shader = gl->glCreateShader(shaderType); gl->glShaderSource(shader, 1, (const GLchar* const*)&src, nullptr); @@ -63,7 +63,7 @@ } GLint compileAndLinkShaderProgram(const char* vshaderSrc, const char* fshaderSrc) { - auto gl = LazyLoadedGLESv2Dispatch::get(); + auto gl = gl::LazyLoadedGLESv2Dispatch::get(); GLuint vshader = compileShader(GL_VERTEX_SHADER, vshaderSrc); GLuint fshader = compileShader(GL_FRAGMENT_SHADER, fshaderSrc); @@ -96,23 +96,23 @@ // #else // std::string programName = "glslangValidator"; // #endif -// +// // auto programDirRelativePath = // pj(android::base::getProgramDirectory(), // "lib64", "vulkan", "tools", programName); -// +// // if (path_exists(programDirRelativePath.c_str())) { // return programDirRelativePath; // } -// +// // auto launcherDirRelativePath = // pj(android::base::getLauncherDirectory(), // "lib64", "vulkan", programName); -// +// // if (path_exists(launcherDirRelativePath.c_str())) { // return launcherDirRelativePath; // } -// +// // E("spirv compiler does not exist"); // return {}; // } @@ -120,62 +120,62 @@ // Optional<std::string> compileSpirvFromGLSL(const std::string& shaderType, // const std::string& src) { // auto spvCompilerPath = getSpirvCompilerPath(); -// +// // if (!spvCompilerPath) return {}; -// +// // const auto glslFile = android::base::makeCustomScopedPtr( // tempfile_create(), tempfile_unref_and_close_file); -// +// // const auto spvFile = android::base::makeCustomScopedPtr( // tempfile_create(), tempfile_unref_and_close_file); -// +// // auto glslPath = tempfile_path(glslFile.get()); // auto spvPath = tempfile_path(spvFile.get()); -// +// // auto glslFd = android::base::ScopedFd(open(glslPath, O_RDWR)); // if (!glslFd.valid()) { return {}; } -// +// // android::writeStringToFile(glslFd.get(), src); // glslFd.close(); -// +// // std::vector<std::string> args = // { *spvCompilerPath, glslPath, "-V", "-S", shaderType, "-o", spvPath }; -// +// // auto runRes = System::get()->runCommandWithResult(args); -// +// // if (!runRes) { // E("failed to compile SPIRV from GLSL. args: %s %s -V -S %s -o %s", // spvCompilerPath->c_str(), glslPath, shaderType.c_str(), spvPath); // return {}; // } -// +// // D("Result of compiling SPIRV from GLSL. res: %s args: %s %s -V -S %s -o %s", // runRes->c_str(), spvCompilerPath->c_str(), glslPath, shaderType.c_str(), // spvPath); -// +// // auto res = android::readFileIntoString(spvPath); -// +// // if (res) { // D("got %zu bytes:", res->size()); // } else { // E("failed to read SPIRV file %s into string", spvPath); // } -// +// // return res; // } -// +// // Optional<std::vector<char> > readSpirv(const char* path) { // std::ifstream in(path, std::ios::ate | std::ios::binary); -// +// // if (!in) return {}; -// +// // size_t fileSize = (size_t)in.tellg(); // std::vector<char> buffer(fileSize); -// +// // in.seekg(0); // in.read(buffer.data(), fileSize); -// +// // return buffer; // } -} // namespace emugl +} // namespace gfxstream
diff --git a/stream-servers/tests/ShaderUtils.h b/stream-servers/tests/ShaderUtils.h index ea81a19..0851e0d 100644 --- a/stream-servers/tests/ShaderUtils.h +++ b/stream-servers/tests/ShaderUtils.h
@@ -20,7 +20,7 @@ #include <string> #include <vector> -namespace emugl { +namespace gfxstream { GLuint compileShader(GLenum shaderType, const char* src); GLint compileAndLinkShaderProgram(const char* vshaderSrc, const char* fshaderSrc); @@ -31,4 +31,4 @@ android::base::Optional<std::vector<char>> readSpirv(const char* path); -} // namespace emugl +} // namespace gfxstream
diff --git a/stream-servers/tests/StalePtrRegistry_unittest.cpp b/stream-servers/tests/StalePtrRegistry_unittest.cpp index 8ec9dfb..9ab9d96 100644 --- a/stream-servers/tests/StalePtrRegistry_unittest.cpp +++ b/stream-servers/tests/StalePtrRegistry_unittest.cpp
@@ -16,6 +16,9 @@ #include <gtest/gtest.h> +namespace gfxstream { +namespace { + TEST(StalePtrRegistry, Constructor) { StalePtrRegistry<void> reg; } @@ -199,3 +202,6 @@ EXPECT_EQ(reg.getPtr(handle1), ptr1); EXPECT_EQ(reg.getPtr(handle2), ptr2); } + +} // namespace +} // namespace gfxstream
diff --git a/stream-servers/tests/SwapChainStateVk_unittest.cpp b/stream-servers/tests/SwapChainStateVk_unittest.cpp index 826c0cc..46372e4 100644 --- a/stream-servers/tests/SwapChainStateVk_unittest.cpp +++ b/stream-servers/tests/SwapChainStateVk_unittest.cpp
@@ -5,13 +5,17 @@ #include "Standalone.h" #include "vulkan/VulkanDispatch.h" +namespace gfxstream { +namespace vk { +namespace { + class SwapChainStateVkTest : public ::testing::Test { protected: - static void SetUpTestCase() { k_vk = emugl::vkDispatch(false); } + static void SetUpTestCase() { k_vk = vkDispatch(false); } void SetUp() override { // skip the test when testing without a window - if (!emugl::shouldUseWindow()) { + if (!shouldUseWindow()) { GTEST_SKIP(); } ASSERT_NE(k_vk, nullptr); @@ -23,14 +27,14 @@ } void TearDown() override { - if (emugl::shouldUseWindow()) { + if (shouldUseWindow()) { k_vk->vkDestroyDevice(m_vkDevice, nullptr); k_vk->vkDestroySurfaceKHR(m_vkInstance, m_vkSurface, nullptr); k_vk->vkDestroyInstance(m_vkInstance, nullptr); } } - static goldfish_vk::VulkanDispatch *k_vk; + static VulkanDispatch* k_vk; static const uint32_t k_width = 0x100; static const uint32_t k_height = 0x100; @@ -63,7 +67,7 @@ } void createWindowAndSurface() { - m_window = emugl::createOrGetTestWindow(0, 0, k_width, k_height); + m_window = createOrGetTestWindow(0, 0, k_width, k_height); ASSERT_NE(m_window, nullptr); #ifdef _WIN32 VkWin32SurfaceCreateInfoKHR surfaceCi = { @@ -162,7 +166,7 @@ } }; -goldfish_vk::VulkanDispatch *SwapChainStateVkTest::k_vk = nullptr; +VulkanDispatch* SwapChainStateVkTest::k_vk = nullptr; TEST_F(SwapChainStateVkTest, init) { auto swapChainCi = SwapChainStateVk::createSwapChainCi( @@ -171,4 +175,8 @@ ASSERT_NE(swapChainCi, std::nullopt); std::unique_ptr<SwapChainStateVk> swapChainState = SwapChainStateVk::createSwapChainVk(*k_vk, m_vkDevice, swapChainCi->mCreateInfo); -} \ No newline at end of file +} + +} // namespace +} // namespace vk +} // namespace gfxstream
diff --git a/stream-servers/tests/TextureDraw_unittest.cpp b/stream-servers/tests/TextureDraw_unittest.cpp index 01e1d94..32fdd46 100644 --- a/stream-servers/tests/TextureDraw_unittest.cpp +++ b/stream-servers/tests/TextureDraw_unittest.cpp
@@ -18,8 +18,8 @@ #include "OpenGLTestContext.h" #include "TextureDraw.h" -namespace emugl { - +namespace gfxstream { +namespace gl { namespace { void TestTextureDrawBasic(const GLESv2Dispatch* gl, GLenum internalformat, @@ -205,8 +205,6 @@ } -} // namespace - #define GL_BGRA_EXT 0x80E1 TEST_F(GLTest, TextureDrawBasic) { @@ -218,4 +216,6 @@ TestTextureDrawLayer(gl); } -} // namespace emugl +} // namespace +} // namespace gl +} // namespace gfxstream
diff --git a/stream-servers/tests/VirtioGpuTimelines_unittest.cpp b/stream-servers/tests/VirtioGpuTimelines_unittest.cpp index f0abc28..5e7dbc0 100644 --- a/stream-servers/tests/VirtioGpuTimelines_unittest.cpp +++ b/stream-servers/tests/VirtioGpuTimelines_unittest.cpp
@@ -18,6 +18,9 @@ #include <memory> +namespace gfxstream { +namespace { + using RingGlobal = VirtioGpuRingGlobal; using RingContextSpecific = VirtioGpuRingContextSpecific; @@ -239,3 +242,6 @@ check.Call(3); virtioGpuTimelines->notifyTaskCompletion(taskId3); } + +} // namespace +} // namespace gfxstream
diff --git a/stream-servers/tests/VkTestUtils.h b/stream-servers/tests/VkTestUtils.h index 484c8a9..4c0b131 100644 --- a/stream-servers/tests/VkTestUtils.h +++ b/stream-servers/tests/VkTestUtils.h
@@ -5,7 +5,8 @@ #include "vulkan/VulkanDispatch.h" #include "vulkan/vk_util.h" -namespace emugl { +namespace gfxstream { +namespace vk { inline std::string libDir() { using android::base::pj; @@ -37,7 +38,7 @@ vk_util::FindMemoryType, // vk_util::RecordImageLayoutTransformCommands, // vk_util::RunSingleTimeCommand> { - const goldfish_vk::VulkanDispatch &m_vk; + const VulkanDispatch& m_vk; VkDevice m_vkDevice; VkPhysicalDevice m_vkPhysicalDevice; VkQueue m_vkQueue; @@ -57,7 +58,7 @@ VkCommandBuffer m_readCommandBuffer; VkCommandBuffer m_writeCommandBuffer; - explicit RenderResourceVkBase(const goldfish_vk::VulkanDispatch &vk) + explicit RenderResourceVkBase(const VulkanDispatch& vk) : m_vk(vk), m_vkImageCreateInfo({}), m_vkImage(VK_NULL_HANDLE), @@ -77,10 +78,9 @@ static constexpr uint32_t k_bpp = 4; static constexpr VkImageLayout k_vkImageLayout = imageLayout; - static std::unique_ptr<const RenderResourceVk<imageLayout, imageUsage>> - create(const goldfish_vk::VulkanDispatch &vk, VkDevice device, - VkPhysicalDevice physicalDevice, VkQueue queue, - VkCommandPool commandPool, uint32_t width, uint32_t height) { + static std::unique_ptr<const RenderResourceVk<imageLayout, imageUsage>> create( + const VulkanDispatch& vk, VkDevice device, VkPhysicalDevice physicalDevice, VkQueue queue, + VkCommandPool commandPool, uint32_t width, uint32_t height) { std::unique_ptr<RenderResourceVk<imageLayout, imageUsage>> res( new RenderResourceVk<imageLayout, imageUsage>(vk)); res->m_vkDevice = device; @@ -145,8 +145,7 @@ } private: - RenderResourceVk(const goldfish_vk::VulkanDispatch &vk) - : RenderResourceVkBase(vk) {} + RenderResourceVk(const VulkanDispatch& vk) : RenderResourceVkBase(vk) {} bool setUpImage() { VkImageCreateInfo imageCi{ @@ -339,12 +338,12 @@ } return true; } -}; // namespace emugl +}; using RenderTextureVk = - emugl::RenderResourceVk<VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, - VK_IMAGE_USAGE_SAMPLED_BIT>; + RenderResourceVk<VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT>; -} // namespace emugl +} // namespace vk +} // namespace gfxstream #endif \ No newline at end of file
diff --git a/stream-servers/tests/VsyncThread_unittest.cpp b/stream-servers/tests/VsyncThread_unittest.cpp index f5d1cb5..0635a5c 100644 --- a/stream-servers/tests/VsyncThread_unittest.cpp +++ b/stream-servers/tests/VsyncThread_unittest.cpp
@@ -19,6 +19,9 @@ #include <unistd.h> #endif +namespace gfxstream { +namespace { + // Tests scheduling some basic task, and that they are processed // before the thread completely exits. TEST(VsyncThread, Basic) { @@ -66,3 +69,6 @@ EXPECT_EQ(2, count); } } + +} // namespace +} // namespace gfxstream
diff --git a/stream-servers/tests/Vulkan_unittest.cpp b/stream-servers/tests/Vulkan_unittest.cpp index 93cc56c..b40255a 100644 --- a/stream-servers/tests/Vulkan_unittest.cpp +++ b/stream-servers/tests/Vulkan_unittest.cpp
@@ -47,7 +47,9 @@ using android::base::pj; using android::base::TestSystem; -namespace emugl { +namespace gfxstream { +namespace vk { +namespace { static constexpr const HandleType kArbitraryColorBufferHandle = 5; @@ -95,11 +97,9 @@ return ss.str(); } -static std::string getPhysicalDevicePropertiesString( - const goldfish_vk::VulkanDispatch* vk, - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceProperties& props) { - +static std::string getPhysicalDevicePropertiesString(const VulkanDispatch* vk, + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceProperties& props) { std::stringstream ss; uint16_t apiMaj = (uint16_t)(props.apiVersion >> 22); @@ -397,7 +397,7 @@ static void TearDownTestSuite() { } void SetUp() override { - auto dispatch = emugl::vkDispatch(false); + auto dispatch = vkDispatch(false); ASSERT_NE(dispatch, nullptr); mVk = *dispatch; @@ -425,8 +425,7 @@ mVk.vkGetPhysicalDeviceMemoryProperties(mPhysicalDevice, &memProps); - EXPECT_TRUE(goldfish_vk::getStagingMemoryTypeIndex( - &mVk, mDevice, &memProps, &typeIndex)); + EXPECT_TRUE(getStagingMemoryTypeIndex(&mVk, mDevice, &memProps, &typeIndex)); } #ifndef _WIN32 // TODO: Get this working w/ Swiftshader vk on Windows @@ -447,9 +446,8 @@ emugl::setGLObjectCounter(android::base::GLObjectCounter::get()); emugl::set_emugl_window_operations(*getGraphicsAgents()->emu); emugl::set_emugl_multi_display_operations(*getGraphicsAgents()->multi_display); - const EGLDispatch* egl = LazyLoadedEGLDispatch::get(); - ASSERT_NE(nullptr, egl); - ASSERT_NE(nullptr, LazyLoadedGLESv2Dispatch::get()); + ASSERT_NE(nullptr, gl::LazyLoadedEGLDispatch::get()); + ASSERT_NE(nullptr, gl::LazyLoadedGLESv2Dispatch::get()); bool useHostGpu = false; EXPECT_TRUE(FrameBuffer::initialize(mWidth, mHeight, false, @@ -474,16 +472,15 @@ TEST_F(VulkanFrameBufferTest, VkColorBufferWithoutMemoryProperties) { // Create a color buffer without any memory properties restriction. - EXPECT_TRUE(goldfish_vk::setupVkColorBuffer(mWidth, mHeight, GL_RGBA, - FRAMEWORK_FORMAT_GL_COMPATIBLE, - kArbitraryColorBufferHandle, true, /* vulkanOnly */ - 0 /* memoryProperty */ - )); - EXPECT_TRUE(goldfish_vk::teardownVkColorBuffer(kArbitraryColorBufferHandle)); + EXPECT_TRUE(setupVkColorBuffer(mWidth, mHeight, GL_RGBA, FRAMEWORK_FORMAT_GL_COMPATIBLE, + kArbitraryColorBufferHandle, true, /* vulkanOnly */ + 0 /* memoryProperty */ + )); + EXPECT_TRUE(teardownVkColorBuffer(kArbitraryColorBufferHandle)); } TEST_F(VulkanFrameBufferTest, VkColorBufferWithMemoryPropertyFlags) { - auto* vkEmulation = goldfish_vk::getGlobalVkEmulation(); + auto* vkEmulation = getGlobalVkEmulation(); VkMemoryPropertyFlags kTargetMemoryPropertyFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; @@ -540,22 +537,23 @@ } // Create a color buffer with the target memory property flags. - EXPECT_TRUE(goldfish_vk::setupVkColorBuffer(mWidth, mHeight, GL_RGBA, - FRAMEWORK_FORMAT_GL_COMPATIBLE, - kArbitraryColorBufferHandle, true, /* vulkanOnly */ - static_cast<uint32_t>(kTargetMemoryPropertyFlags))); + EXPECT_TRUE(setupVkColorBuffer(mWidth, mHeight, GL_RGBA, FRAMEWORK_FORMAT_GL_COMPATIBLE, + kArbitraryColorBufferHandle, true, /* vulkanOnly */ + static_cast<uint32_t>(kTargetMemoryPropertyFlags))); uint32_t allocatedTypeIndex = 0u; - EXPECT_TRUE(goldfish_vk::getColorBufferAllocationInfo(kArbitraryColorBufferHandle, nullptr, - &allocatedTypeIndex, nullptr, nullptr)); + EXPECT_TRUE(getColorBufferAllocationInfo(kArbitraryColorBufferHandle, nullptr, + &allocatedTypeIndex, nullptr, nullptr)); EXPECT_TRUE(vkEmulation->deviceInfo.memProps.memoryTypes[allocatedTypeIndex] .propertyFlags & kTargetMemoryPropertyFlags); - EXPECT_TRUE(goldfish_vk::teardownVkColorBuffer(kArbitraryColorBufferHandle)); + EXPECT_TRUE(teardownVkColorBuffer(kArbitraryColorBufferHandle)); } #endif // !_WIN32 -} // namespace emugl +} // namespace +} // namespace vk +} // namespace gfxstream
diff --git a/stream-servers/tests/X11TestingSupport.cpp b/stream-servers/tests/X11TestingSupport.cpp index 59cf8e7..22905f8 100644 --- a/stream-servers/tests/X11TestingSupport.cpp +++ b/stream-servers/tests/X11TestingSupport.cpp
@@ -11,9 +11,13 @@ // 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 "../apigen-codec-common/X11Support.h" + #include <stdio.h> +#include "../apigen-codec-common/X11Support.h" + +namespace gfxstream { + struct X11State { X11State() : threadsInitResult(XInitThreads()), @@ -47,3 +51,5 @@ } void freeNativePixmap(void* pixmap) { XFreePixmap(x11()->display, (Pixmap)pixmap); } + +} // namespace gfxstream \ No newline at end of file
diff --git a/stream-servers/tests/X11TestingSupport.h b/stream-servers/tests/X11TestingSupport.h index e146b0f..fdf1456 100644 --- a/stream-servers/tests/X11TestingSupport.h +++ b/stream-servers/tests/X11TestingSupport.h
@@ -13,5 +13,9 @@ // limitations under the License. #pragma once +namespace gfxstream { + void* createNativePixmap(int width, int height, int bytesPerPixel); void freeNativePixmap(void* pixmap); + +} // namespace gfxstream