Loading libs/graphicsenv/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ cc_library_shared { shared_libs: [ "liblog", "libcutils", ], export_include_dirs: ["include"], Loading libs/graphicsenv/GraphicsEnv.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -18,9 +18,12 @@ #define LOG_TAG "GraphicsEnv" #include <graphicsenv/GraphicsEnv.h> #include <sys/prctl.h> #include <mutex> #include <android/dlext.h> #include <cutils/properties.h> #include <log/log.h> // TODO(b/37049319) Get this from a header once one exists Loading @@ -46,6 +49,14 @@ namespace android { return env; } int GraphicsEnv::getCanLoadSystemLibraries() { if (property_get_bool("ro.debuggable", false) && prctl(PR_GET_DUMPABLE, 0, 0, 0, 0)) { // Return an integer value since this crosses library boundaries return 1; } return 0; } void GraphicsEnv::setDriverPath(const std::string path) { if (!mDriverPath.empty()) { ALOGV("ignoring attempt to change driver path from '%s' to '%s'", Loading Loading @@ -181,4 +192,10 @@ bool android_getAngleDeveloperOptIn() { const char* android_getAngleAppPref() { return android::GraphicsEnv::getInstance().getAngleAppPref(); } const char* android_getLayerPaths() { return android::GraphicsEnv::getInstance().getLayerPaths().c_str(); } const char* android_getDebugLayers() { return android::GraphicsEnv::getInstance().getDebugLayers().c_str(); } } libs/graphicsenv/include/graphicsenv/GraphicsEnv.h +9 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ class GraphicsEnv { public: static GraphicsEnv& getInstance(); int getCanLoadSystemLibraries(); // Set a search path for loading graphics drivers. The path is a list of // directories separated by ':'. A directory can be contained in a zip file // (drivers must be stored uncompressed and page aligned); such elements Loading Loading @@ -90,6 +92,8 @@ android_namespace_t* android_getAngleNamespace(); const char* android_getAngleAppName(); const char* android_getAngleAppPref(); bool android_getAngleDeveloperOptIn(); const char* android_getLayerPaths(); const char* android_getDebugLayers(); } #endif // ANDROID_UI_GRAPHICS_ENV_H libs/vr/libbufferhub/buffer_hub-test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -920,6 +920,7 @@ TEST_F(LibBufferHubTest, TestDuplicateDetachedBuffer) { kUsage, kUserMetadataSize); int b1_id = b1->id(); EXPECT_TRUE(b1->IsValid()); EXPECT_EQ(b1->user_metadata_size(), kUserMetadataSize); auto status_or_handle = b1->Duplicate(); EXPECT_TRUE(status_or_handle); Loading @@ -935,6 +936,9 @@ TEST_F(LibBufferHubTest, TestDuplicateDetachedBuffer) { std::unique_ptr<DetachedBuffer> b2 = DetachedBuffer::Import(std::move(h2)); EXPECT_FALSE(h2.valid()); ASSERT_TRUE(b2 != nullptr); EXPECT_TRUE(b2->IsValid()); EXPECT_EQ(b2->user_metadata_size(), kUserMetadataSize); int b2_id = b2->id(); // These two buffer instances are based on the same physical buffer under the Loading libs/vr/libbufferhub/buffer_hub_metadata.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,9 @@ BufferHubMetadata BufferHubMetadata::Import(pdx::LocalHandle ashmem_handle) { size_t metadata_size = ashmem_get_size_region(ashmem_handle.Get()); size_t user_metadata_size = metadata_size - kMetadataHeaderSize; // Note that here the buffer state is mapped from shared memory as an atomic // object. The std::atomic's constructor will not be called so that the // original value stored in the memory region can be preserved. auto metadata_header = static_cast<MetadataHeader*>( mmap(nullptr, metadata_size, kAshmemProt, MAP_SHARED, ashmem_handle.Get(), /*offset=*/0)); Loading Loading
libs/graphicsenv/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ cc_library_shared { shared_libs: [ "liblog", "libcutils", ], export_include_dirs: ["include"], Loading
libs/graphicsenv/GraphicsEnv.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -18,9 +18,12 @@ #define LOG_TAG "GraphicsEnv" #include <graphicsenv/GraphicsEnv.h> #include <sys/prctl.h> #include <mutex> #include <android/dlext.h> #include <cutils/properties.h> #include <log/log.h> // TODO(b/37049319) Get this from a header once one exists Loading @@ -46,6 +49,14 @@ namespace android { return env; } int GraphicsEnv::getCanLoadSystemLibraries() { if (property_get_bool("ro.debuggable", false) && prctl(PR_GET_DUMPABLE, 0, 0, 0, 0)) { // Return an integer value since this crosses library boundaries return 1; } return 0; } void GraphicsEnv::setDriverPath(const std::string path) { if (!mDriverPath.empty()) { ALOGV("ignoring attempt to change driver path from '%s' to '%s'", Loading Loading @@ -181,4 +192,10 @@ bool android_getAngleDeveloperOptIn() { const char* android_getAngleAppPref() { return android::GraphicsEnv::getInstance().getAngleAppPref(); } const char* android_getLayerPaths() { return android::GraphicsEnv::getInstance().getLayerPaths().c_str(); } const char* android_getDebugLayers() { return android::GraphicsEnv::getInstance().getDebugLayers().c_str(); } }
libs/graphicsenv/include/graphicsenv/GraphicsEnv.h +9 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ class GraphicsEnv { public: static GraphicsEnv& getInstance(); int getCanLoadSystemLibraries(); // Set a search path for loading graphics drivers. The path is a list of // directories separated by ':'. A directory can be contained in a zip file // (drivers must be stored uncompressed and page aligned); such elements Loading Loading @@ -90,6 +92,8 @@ android_namespace_t* android_getAngleNamespace(); const char* android_getAngleAppName(); const char* android_getAngleAppPref(); bool android_getAngleDeveloperOptIn(); const char* android_getLayerPaths(); const char* android_getDebugLayers(); } #endif // ANDROID_UI_GRAPHICS_ENV_H
libs/vr/libbufferhub/buffer_hub-test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -920,6 +920,7 @@ TEST_F(LibBufferHubTest, TestDuplicateDetachedBuffer) { kUsage, kUserMetadataSize); int b1_id = b1->id(); EXPECT_TRUE(b1->IsValid()); EXPECT_EQ(b1->user_metadata_size(), kUserMetadataSize); auto status_or_handle = b1->Duplicate(); EXPECT_TRUE(status_or_handle); Loading @@ -935,6 +936,9 @@ TEST_F(LibBufferHubTest, TestDuplicateDetachedBuffer) { std::unique_ptr<DetachedBuffer> b2 = DetachedBuffer::Import(std::move(h2)); EXPECT_FALSE(h2.valid()); ASSERT_TRUE(b2 != nullptr); EXPECT_TRUE(b2->IsValid()); EXPECT_EQ(b2->user_metadata_size(), kUserMetadataSize); int b2_id = b2->id(); // These two buffer instances are based on the same physical buffer under the Loading
libs/vr/libbufferhub/buffer_hub_metadata.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,9 @@ BufferHubMetadata BufferHubMetadata::Import(pdx::LocalHandle ashmem_handle) { size_t metadata_size = ashmem_get_size_region(ashmem_handle.Get()); size_t user_metadata_size = metadata_size - kMetadataHeaderSize; // Note that here the buffer state is mapped from shared memory as an atomic // object. The std::atomic's constructor will not be called so that the // original value stored in the memory region can be preserved. auto metadata_header = static_cast<MetadataHeader*>( mmap(nullptr, metadata_size, kAshmemProt, MAP_SHARED, ashmem_handle.Get(), /*offset=*/0)); Loading