Loading libs/binder/Parcel.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -2835,11 +2835,17 @@ status_t Parcel::continueWrite(size_t desired) } release_object(proc, *flat, this, &mOpenAshmemSize); } if (objectsSize == 0) { free(mObjects); mObjects = nullptr; } else { binder_size_t* objects = (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t)); if (objects) { mObjects = objects; } } mObjectsSize = objectsSize; mNextObjectHint = 0; mObjectsSorted = false; Loading libs/graphicsenv/GraphicsEnv.cpp +62 −49 Original line number Diff line number Diff line Loading @@ -534,60 +534,73 @@ void GraphicsEnv::setDebugLayersGLES(const std::string layers) { mDebugLayersGLES = layers; } android_namespace_t* GraphicsEnv::getDriverNamespace() { static std::once_flag once; std::call_once(once, [this]() { if (mDriverPath.empty()) return; auto vndkNamespace = android_get_exported_namespace("vndk"); if (!vndkNamespace) return; mDriverNamespace = android_create_namespace("gfx driver", mDriverPath.c_str(), // ld_library_path mDriverPath.c_str(), // default_library_path ANDROID_NAMESPACE_TYPE_ISOLATED, nullptr, // permitted_when_isolated_path nullptr); // Return true if all the required libraries from vndk and sphal namespace are // linked to the Game Driver namespace correctly. bool GraphicsEnv::linkDriverNamespaceLocked(android_namespace_t* vndkNamespace) { const std::string llndkLibraries = getSystemNativeLibraries(NativeLibrary::LLNDK); if (llndkLibraries.empty()) { mDriverNamespace = nullptr; return; return false; } if (!android_link_namespaces(mDriverNamespace, nullptr, llndkLibraries.c_str())) { ALOGE("Failed to link default namespace[%s]", dlerror()); mDriverNamespace = nullptr; return; return false; } const std::string vndkspLibraries = getSystemNativeLibraries(NativeLibrary::VNDKSP); if (vndkspLibraries.empty()) { mDriverNamespace = nullptr; return; return false; } if (!android_link_namespaces(mDriverNamespace, vndkNamespace, vndkspLibraries.c_str())) { ALOGE("Failed to link vndk namespace[%s]", dlerror()); mDriverNamespace = nullptr; return; return false; } if (mSphalLibraries.empty()) return; if (mSphalLibraries.empty()) { return true; } // Make additional libraries in sphal to be accessible auto sphalNamespace = android_get_exported_namespace("sphal"); if (!sphalNamespace) { ALOGE("Depend on these libraries[%s] in sphal, but failed to get sphal namespace", mSphalLibraries.c_str()); mDriverNamespace = nullptr; return; return false; } if (!android_link_namespaces(mDriverNamespace, sphalNamespace, mSphalLibraries.c_str())) { ALOGE("Failed to link sphal namespace[%s]", dlerror()); return false; } return true; } android_namespace_t* GraphicsEnv::getDriverNamespace() { std::lock_guard<std::mutex> lock(mNamespaceMutex); if (mDriverNamespace) { return mDriverNamespace; } if (mDriverPath.empty()) { return nullptr; } auto vndkNamespace = android_get_exported_namespace("vndk"); if (!vndkNamespace) { return nullptr; } mDriverNamespace = android_create_namespace("gfx driver", mDriverPath.c_str(), // ld_library_path mDriverPath.c_str(), // default_library_path ANDROID_NAMESPACE_TYPE_ISOLATED, nullptr, // permitted_when_isolated_path nullptr); if (!linkDriverNamespaceLocked(vndkNamespace)) { mDriverNamespace = nullptr; return; } }); return mDriverNamespace; } Loading libs/graphicsenv/include/graphicsenv/GraphicsEnv.h +1 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ private: void* loadLibrary(std::string name); bool checkAngleRules(void* so); void updateUseAngle(); bool linkDriverNamespaceLocked(android_namespace_t* vndkNamespace); GraphicsEnv() = default; std::string mDriverPath; Loading libs/gui/DisplayEventReceiver.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -32,10 +32,11 @@ namespace android { // --------------------------------------------------------------------------- DisplayEventReceiver::DisplayEventReceiver(ISurfaceComposer::VsyncSource vsyncSource) { DisplayEventReceiver::DisplayEventReceiver(ISurfaceComposer::VsyncSource vsyncSource, ISurfaceComposer::ConfigChanged configChanged) { sp<ISurfaceComposer> sf(ComposerService::getComposerService()); if (sf != nullptr) { mEventConnection = sf->createDisplayEventConnection(vsyncSource); mEventConnection = sf->createDisplayEventConnection(vsyncSource, configChanged); if (mEventConnection != nullptr) { mDataChannel = std::make_unique<gui::BitTube>(); mEventConnection->stealReceiveChannel(mDataChannel.get()); Loading libs/gui/ISurfaceComposer.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -278,8 +278,8 @@ public: return NO_ERROR; } virtual sp<IDisplayEventConnection> createDisplayEventConnection(VsyncSource vsyncSource) { virtual sp<IDisplayEventConnection> createDisplayEventConnection(VsyncSource vsyncSource, ConfigChanged configChanged) { Parcel data, reply; sp<IDisplayEventConnection> result; int err = data.writeInterfaceToken( Loading @@ -288,6 +288,7 @@ public: return result; } data.writeInt32(static_cast<int32_t>(vsyncSource)); data.writeInt32(static_cast<int32_t>(configChanged)); err = remote()->transact( BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION, data, &reply); Loading Loading @@ -1155,8 +1156,11 @@ status_t BnSurfaceComposer::onTransact( } case CREATE_DISPLAY_EVENT_CONNECTION: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IDisplayEventConnection> connection(createDisplayEventConnection( static_cast<ISurfaceComposer::VsyncSource>(data.readInt32()))); auto vsyncSource = static_cast<ISurfaceComposer::VsyncSource>(data.readInt32()); auto configChanged = static_cast<ISurfaceComposer::ConfigChanged>(data.readInt32()); sp<IDisplayEventConnection> connection( createDisplayEventConnection(vsyncSource, configChanged)); reply->writeStrongBinder(IInterface::asBinder(connection)); return NO_ERROR; } Loading Loading
libs/binder/Parcel.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -2835,11 +2835,17 @@ status_t Parcel::continueWrite(size_t desired) } release_object(proc, *flat, this, &mOpenAshmemSize); } if (objectsSize == 0) { free(mObjects); mObjects = nullptr; } else { binder_size_t* objects = (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t)); if (objects) { mObjects = objects; } } mObjectsSize = objectsSize; mNextObjectHint = 0; mObjectsSorted = false; Loading
libs/graphicsenv/GraphicsEnv.cpp +62 −49 Original line number Diff line number Diff line Loading @@ -534,60 +534,73 @@ void GraphicsEnv::setDebugLayersGLES(const std::string layers) { mDebugLayersGLES = layers; } android_namespace_t* GraphicsEnv::getDriverNamespace() { static std::once_flag once; std::call_once(once, [this]() { if (mDriverPath.empty()) return; auto vndkNamespace = android_get_exported_namespace("vndk"); if (!vndkNamespace) return; mDriverNamespace = android_create_namespace("gfx driver", mDriverPath.c_str(), // ld_library_path mDriverPath.c_str(), // default_library_path ANDROID_NAMESPACE_TYPE_ISOLATED, nullptr, // permitted_when_isolated_path nullptr); // Return true if all the required libraries from vndk and sphal namespace are // linked to the Game Driver namespace correctly. bool GraphicsEnv::linkDriverNamespaceLocked(android_namespace_t* vndkNamespace) { const std::string llndkLibraries = getSystemNativeLibraries(NativeLibrary::LLNDK); if (llndkLibraries.empty()) { mDriverNamespace = nullptr; return; return false; } if (!android_link_namespaces(mDriverNamespace, nullptr, llndkLibraries.c_str())) { ALOGE("Failed to link default namespace[%s]", dlerror()); mDriverNamespace = nullptr; return; return false; } const std::string vndkspLibraries = getSystemNativeLibraries(NativeLibrary::VNDKSP); if (vndkspLibraries.empty()) { mDriverNamespace = nullptr; return; return false; } if (!android_link_namespaces(mDriverNamespace, vndkNamespace, vndkspLibraries.c_str())) { ALOGE("Failed to link vndk namespace[%s]", dlerror()); mDriverNamespace = nullptr; return; return false; } if (mSphalLibraries.empty()) return; if (mSphalLibraries.empty()) { return true; } // Make additional libraries in sphal to be accessible auto sphalNamespace = android_get_exported_namespace("sphal"); if (!sphalNamespace) { ALOGE("Depend on these libraries[%s] in sphal, but failed to get sphal namespace", mSphalLibraries.c_str()); mDriverNamespace = nullptr; return; return false; } if (!android_link_namespaces(mDriverNamespace, sphalNamespace, mSphalLibraries.c_str())) { ALOGE("Failed to link sphal namespace[%s]", dlerror()); return false; } return true; } android_namespace_t* GraphicsEnv::getDriverNamespace() { std::lock_guard<std::mutex> lock(mNamespaceMutex); if (mDriverNamespace) { return mDriverNamespace; } if (mDriverPath.empty()) { return nullptr; } auto vndkNamespace = android_get_exported_namespace("vndk"); if (!vndkNamespace) { return nullptr; } mDriverNamespace = android_create_namespace("gfx driver", mDriverPath.c_str(), // ld_library_path mDriverPath.c_str(), // default_library_path ANDROID_NAMESPACE_TYPE_ISOLATED, nullptr, // permitted_when_isolated_path nullptr); if (!linkDriverNamespaceLocked(vndkNamespace)) { mDriverNamespace = nullptr; return; } }); return mDriverNamespace; } Loading
libs/graphicsenv/include/graphicsenv/GraphicsEnv.h +1 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ private: void* loadLibrary(std::string name); bool checkAngleRules(void* so); void updateUseAngle(); bool linkDriverNamespaceLocked(android_namespace_t* vndkNamespace); GraphicsEnv() = default; std::string mDriverPath; Loading
libs/gui/DisplayEventReceiver.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -32,10 +32,11 @@ namespace android { // --------------------------------------------------------------------------- DisplayEventReceiver::DisplayEventReceiver(ISurfaceComposer::VsyncSource vsyncSource) { DisplayEventReceiver::DisplayEventReceiver(ISurfaceComposer::VsyncSource vsyncSource, ISurfaceComposer::ConfigChanged configChanged) { sp<ISurfaceComposer> sf(ComposerService::getComposerService()); if (sf != nullptr) { mEventConnection = sf->createDisplayEventConnection(vsyncSource); mEventConnection = sf->createDisplayEventConnection(vsyncSource, configChanged); if (mEventConnection != nullptr) { mDataChannel = std::make_unique<gui::BitTube>(); mEventConnection->stealReceiveChannel(mDataChannel.get()); Loading
libs/gui/ISurfaceComposer.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -278,8 +278,8 @@ public: return NO_ERROR; } virtual sp<IDisplayEventConnection> createDisplayEventConnection(VsyncSource vsyncSource) { virtual sp<IDisplayEventConnection> createDisplayEventConnection(VsyncSource vsyncSource, ConfigChanged configChanged) { Parcel data, reply; sp<IDisplayEventConnection> result; int err = data.writeInterfaceToken( Loading @@ -288,6 +288,7 @@ public: return result; } data.writeInt32(static_cast<int32_t>(vsyncSource)); data.writeInt32(static_cast<int32_t>(configChanged)); err = remote()->transact( BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION, data, &reply); Loading Loading @@ -1155,8 +1156,11 @@ status_t BnSurfaceComposer::onTransact( } case CREATE_DISPLAY_EVENT_CONNECTION: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IDisplayEventConnection> connection(createDisplayEventConnection( static_cast<ISurfaceComposer::VsyncSource>(data.readInt32()))); auto vsyncSource = static_cast<ISurfaceComposer::VsyncSource>(data.readInt32()); auto configChanged = static_cast<ISurfaceComposer::ConfigChanged>(data.readInt32()); sp<IDisplayEventConnection> connection( createDisplayEventConnection(vsyncSource, configChanged)); reply->writeStrongBinder(IInterface::asBinder(connection)); return NO_ERROR; } Loading