Loading cmds/installd/dexopt.cpp +35 −10 Original line number Diff line number Diff line Loading @@ -740,6 +740,7 @@ static constexpr int PROFMAN_BIN_RETURN_CODE_ERROR_LOCKING = 4; static void run_profman(const std::vector<unique_fd>& profile_fds, const unique_fd& reference_profile_fd, const std::vector<unique_fd>* apk_fds, const std::vector<std::string>* dex_locations, bool copy_and_update) { const char* profman_bin = is_debug_runtime() ? "/system/bin/profmand" : "/system/bin/profman"; Loading @@ -762,6 +763,13 @@ static void run_profman(const std::vector<unique_fd>& profile_fds, } } std::vector<std::string> dex_location_args; if (dex_locations != nullptr) { for (size_t k = 0; k < dex_locations->size(); k++) { dex_location_args.push_back("--dex-location=" + (*dex_locations)[k]); } } // program name, reference profile fd, the final NULL and the profile fds const char* argv[3 + profile_args.size() + apk_args.size() + (copy_and_update ? 1 : 0)]; int i = 0; Loading @@ -773,9 +781,13 @@ static void run_profman(const std::vector<unique_fd>& profile_fds, for (size_t k = 0; k < apk_args.size(); k++) { argv[i++] = apk_args[k].c_str(); } for (size_t k = 0; k < dex_location_args.size(); k++) { argv[i++] = dex_location_args[k].c_str(); } if (copy_and_update) { argv[i++] = "--copy-and-update-profile-key"; } // Do not add after dex2oat_flags, they should override others for debugging. argv[i] = NULL; Loading @@ -787,20 +799,26 @@ static void run_profman(const std::vector<unique_fd>& profile_fds, [[ noreturn ]] static void run_profman_merge(const std::vector<unique_fd>& profiles_fd, const unique_fd& reference_profile_fd, const std::vector<unique_fd>* apk_fds = nullptr) { run_profman(profiles_fd, reference_profile_fd, apk_fds, /*copy_and_update*/false); const std::vector<unique_fd>* apk_fds = nullptr, const std::vector<std::string>* dex_locations = nullptr) { run_profman(profiles_fd, reference_profile_fd, apk_fds, dex_locations, /*copy_and_update*/false); } [[ noreturn ]] static void run_profman_copy_and_update(unique_fd&& profile_fd, unique_fd&& reference_profile_fd, unique_fd&& apk_fd) { unique_fd&& apk_fd, const std::string& dex_location) { std::vector<unique_fd> profiles_fd; profiles_fd.push_back(std::move(profile_fd)); std::vector<unique_fd> apk_fds; apk_fds.push_back(std::move(apk_fd)); std::vector<std::string> dex_locations; dex_locations.push_back(dex_location); run_profman(profiles_fd, reference_profile_fd, &apk_fds, /*copy_and_update*/true); run_profman(profiles_fd, reference_profile_fd, &apk_fds, &dex_locations, /*copy_and_update*/true); } // Decides if profile guided compilation is needed or not based on existing profiles. Loading Loading @@ -2598,7 +2616,8 @@ bool create_cache_path_default(char path[PKG_PATH_MAX], const char *src, } } bool open_classpath_files(const std::string& classpath, std::vector<unique_fd>* apk_fds) { bool open_classpath_files(const std::string& classpath, std::vector<unique_fd>* apk_fds, std::vector<std::string>* dex_locations) { std::vector<std::string> classpaths_elems = base::Split(classpath, ":"); for (const std::string& elem : classpaths_elems) { unique_fd fd(TEMP_FAILURE_RETRY(open(elem.c_str(), O_RDONLY))); Loading @@ -2607,6 +2626,7 @@ bool open_classpath_files(const std::string& classpath, std::vector<unique_fd>* return false; } else { apk_fds->push_back(std::move(fd)); dex_locations->push_back(elem); } } return true; Loading Loading @@ -2636,7 +2656,8 @@ static bool create_app_profile_snapshot(int32_t app_id, // Open the class paths elements. These will be used to filter out profile data that does // not belong to the classpath during merge. std::vector<unique_fd> apk_fds; if (!open_classpath_files(classpath, &apk_fds)) { std::vector<std::string> dex_locations; if (!open_classpath_files(classpath, &apk_fds, &dex_locations)) { return false; } Loading @@ -2644,7 +2665,7 @@ static bool create_app_profile_snapshot(int32_t app_id, if (pid == 0) { /* child -- drop privileges before continuing */ drop_capabilities(app_shared_gid); run_profman_merge(profiles_fd, snapshot_fd, &apk_fds); run_profman_merge(profiles_fd, snapshot_fd, &apk_fds, &dex_locations); } /* parent */ Loading Loading @@ -2694,7 +2715,8 @@ static bool create_boot_image_profile_snapshot(const std::string& package_name, // Open the classpath elements. These will be used to filter out profile data that does // not belong to the classpath during merge. std::vector<unique_fd> apk_fds; if (!open_classpath_files(classpath, &apk_fds)) { std::vector<std::string> dex_locations; if (!open_classpath_files(classpath, &apk_fds, &dex_locations)) { return false; } Loading @@ -2721,7 +2743,9 @@ static bool create_boot_image_profile_snapshot(const std::string& package_name, /* child -- drop privileges before continuing */ drop_capabilities(AID_SYSTEM); run_profman_merge(profiles_fd, snapshot_fd, &apk_fds); // The introduction of new access flags into boot jars causes them to // fail dex file verification. run_profman_merge(profiles_fd, snapshot_fd, &apk_fds, &dex_locations); } /* parent */ Loading Loading @@ -2784,7 +2808,8 @@ bool prepare_app_profile(const std::string& package_name, // The copy and update takes ownership over the fds. run_profman_copy_and_update(std::move(dex_metadata_fd), std::move(ref_profile_fd), std::move(apk_fd)); std::move(apk_fd), code_path); } /* parent */ Loading libs/gui/BufferHubProducer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ status_t BufferHubProducer::dequeueBuffer(int* out_slot, sp<Fence>* out_fence, u uint32_t height, PixelFormat format, uint64_t usage, uint64_t* /*outBufferAge*/, FrameEventHistoryDelta* /* out_timestamps */) { ALOGW("dequeueBuffer: w=%u, h=%u, format=%d, usage=%" PRIu64, width, height, format, usage); ALOGV("dequeueBuffer: w=%u, h=%u, format=%d, usage=%" PRIu64, width, height, format, usage); status_t ret; std::unique_lock<std::mutex> lock(mutex_); Loading Loading @@ -208,7 +208,7 @@ status_t BufferHubProducer::dequeueBuffer(int* out_slot, sp<Fence>* out_fence, u buffers_[slot].mBufferState.freeQueued(); buffers_[slot].mBufferState.dequeue(); ALOGW("dequeueBuffer: slot=%zu", slot); ALOGV("dequeueBuffer: slot=%zu", slot); // TODO(jwcai) Handle fence properly. |BufferHub| has full fence support, we // just need to exopose that through |BufferHubQueue| once we need fence. Loading libs/ui/HdrCapabilities.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ HdrCapabilities::~HdrCapabilities() = default; HdrCapabilities::HdrCapabilities(HdrCapabilities&& other) = default; HdrCapabilities& HdrCapabilities::operator=(HdrCapabilities&& other) = default; size_t HdrCapabilities::getFlattenedSize() const { return sizeof(mMaxLuminance) + sizeof(mMaxAverageLuminance) + Loading services/surfaceflinger/DisplayDevice.cpp +22 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,8 @@ DisplayDevice::DisplayDevice( mSupportedPerFrameMetadata(supportedPerFrameMetadata) { // clang-format on for (Hdr hdrType : hdrCapabilities.getSupportedHdrTypes()) { std::vector<Hdr> types = hdrCapabilities.getSupportedHdrTypes(); for (Hdr hdrType : types) { switch (hdrType) { case Hdr::HDR10: mHasHdr10 = true; Loading @@ -124,6 +125,26 @@ DisplayDevice::DisplayDevice( } } float minLuminance = hdrCapabilities.getDesiredMinLuminance(); float maxLuminance = hdrCapabilities.getDesiredMaxLuminance(); float maxAverageLuminance = hdrCapabilities.getDesiredMaxAverageLuminance(); minLuminance = minLuminance <= 0.0 ? sDefaultMinLumiance : minLuminance; maxLuminance = maxLuminance <= 0.0 ? sDefaultMaxLumiance : maxLuminance; maxAverageLuminance = maxAverageLuminance <= 0.0 ? sDefaultMaxLumiance : maxAverageLuminance; if (this->hasWideColorGamut()) { // insert HDR10/HLG as we will force client composition for HDR10/HLG // layers if (!hasHDR10Support()) { types.push_back(Hdr::HDR10); } if (!hasHLGSupport()) { types.push_back(Hdr::HLG); } } mHdrCapabilities = HdrCapabilities(types, maxLuminance, maxAverageLuminance, minLuminance); // initialize the display orientation transform. setProjection(DisplayState::eOrientationDefault, mViewport, mFrame); } Loading services/surfaceflinger/DisplayDevice.h +15 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include <gui/ISurfaceComposer.h> #include <hardware/hwcomposer_defs.h> #include <ui/GraphicTypes.h> #include <ui/HdrCapabilities.h> #include <ui/Region.h> #include <utils/RefBase.h> #include <utils/Mutex.h> Loading @@ -53,6 +54,9 @@ class HWComposer; class DisplayDevice : public LightRefBase<DisplayDevice> { public: constexpr static float sDefaultMinLumiance = 0.0; constexpr static float sDefaultMaxLumiance = 500.0; // region in layer-stack space mutable Region dirtyRegion; // region in screen space Loading Loading @@ -141,6 +145,13 @@ public: bool hasHDR10Support() const { return mHasHdr10; } bool hasHLGSupport() const { return mHasHLG; } bool hasDolbyVisionSupport() const { return mHasDolbyVision; } // The returned HdrCapabilities is the combination of HDR capabilities from // hardware composer and RenderEngine. When the DisplayDevice supports wide // color gamut, RenderEngine is able to simulate HDR support in Display P3 // color space for both PQ and HLG HDR contents. The minimum and maximum // luminance will be set to sDefaultMinLumiance and sDefaultMaxLumiance // respectively if hardware composer doesn't return meaningful values. const HdrCapabilities& getHdrCapabilities() const { return mHdrCapabilities; } void swapBuffers(HWComposer& hwc) const; Loading Loading @@ -261,7 +272,7 @@ private: bool mHasHdr10; bool mHasHLG; bool mHasDolbyVision; HdrCapabilities mHdrCapabilities; const int32_t mSupportedPerFrameMetadata; }; Loading Loading @@ -309,6 +320,9 @@ public: ui::Dataspace getDataSpace() const override { return mDevice->getCompositionDataSpace(); } float getDisplayMaxLuminance() const override { return mDevice->getHdrCapabilities().getDesiredMaxLuminance(); } private: const sp<const DisplayDevice> mDevice; Loading Loading
cmds/installd/dexopt.cpp +35 −10 Original line number Diff line number Diff line Loading @@ -740,6 +740,7 @@ static constexpr int PROFMAN_BIN_RETURN_CODE_ERROR_LOCKING = 4; static void run_profman(const std::vector<unique_fd>& profile_fds, const unique_fd& reference_profile_fd, const std::vector<unique_fd>* apk_fds, const std::vector<std::string>* dex_locations, bool copy_and_update) { const char* profman_bin = is_debug_runtime() ? "/system/bin/profmand" : "/system/bin/profman"; Loading @@ -762,6 +763,13 @@ static void run_profman(const std::vector<unique_fd>& profile_fds, } } std::vector<std::string> dex_location_args; if (dex_locations != nullptr) { for (size_t k = 0; k < dex_locations->size(); k++) { dex_location_args.push_back("--dex-location=" + (*dex_locations)[k]); } } // program name, reference profile fd, the final NULL and the profile fds const char* argv[3 + profile_args.size() + apk_args.size() + (copy_and_update ? 1 : 0)]; int i = 0; Loading @@ -773,9 +781,13 @@ static void run_profman(const std::vector<unique_fd>& profile_fds, for (size_t k = 0; k < apk_args.size(); k++) { argv[i++] = apk_args[k].c_str(); } for (size_t k = 0; k < dex_location_args.size(); k++) { argv[i++] = dex_location_args[k].c_str(); } if (copy_and_update) { argv[i++] = "--copy-and-update-profile-key"; } // Do not add after dex2oat_flags, they should override others for debugging. argv[i] = NULL; Loading @@ -787,20 +799,26 @@ static void run_profman(const std::vector<unique_fd>& profile_fds, [[ noreturn ]] static void run_profman_merge(const std::vector<unique_fd>& profiles_fd, const unique_fd& reference_profile_fd, const std::vector<unique_fd>* apk_fds = nullptr) { run_profman(profiles_fd, reference_profile_fd, apk_fds, /*copy_and_update*/false); const std::vector<unique_fd>* apk_fds = nullptr, const std::vector<std::string>* dex_locations = nullptr) { run_profman(profiles_fd, reference_profile_fd, apk_fds, dex_locations, /*copy_and_update*/false); } [[ noreturn ]] static void run_profman_copy_and_update(unique_fd&& profile_fd, unique_fd&& reference_profile_fd, unique_fd&& apk_fd) { unique_fd&& apk_fd, const std::string& dex_location) { std::vector<unique_fd> profiles_fd; profiles_fd.push_back(std::move(profile_fd)); std::vector<unique_fd> apk_fds; apk_fds.push_back(std::move(apk_fd)); std::vector<std::string> dex_locations; dex_locations.push_back(dex_location); run_profman(profiles_fd, reference_profile_fd, &apk_fds, /*copy_and_update*/true); run_profman(profiles_fd, reference_profile_fd, &apk_fds, &dex_locations, /*copy_and_update*/true); } // Decides if profile guided compilation is needed or not based on existing profiles. Loading Loading @@ -2598,7 +2616,8 @@ bool create_cache_path_default(char path[PKG_PATH_MAX], const char *src, } } bool open_classpath_files(const std::string& classpath, std::vector<unique_fd>* apk_fds) { bool open_classpath_files(const std::string& classpath, std::vector<unique_fd>* apk_fds, std::vector<std::string>* dex_locations) { std::vector<std::string> classpaths_elems = base::Split(classpath, ":"); for (const std::string& elem : classpaths_elems) { unique_fd fd(TEMP_FAILURE_RETRY(open(elem.c_str(), O_RDONLY))); Loading @@ -2607,6 +2626,7 @@ bool open_classpath_files(const std::string& classpath, std::vector<unique_fd>* return false; } else { apk_fds->push_back(std::move(fd)); dex_locations->push_back(elem); } } return true; Loading Loading @@ -2636,7 +2656,8 @@ static bool create_app_profile_snapshot(int32_t app_id, // Open the class paths elements. These will be used to filter out profile data that does // not belong to the classpath during merge. std::vector<unique_fd> apk_fds; if (!open_classpath_files(classpath, &apk_fds)) { std::vector<std::string> dex_locations; if (!open_classpath_files(classpath, &apk_fds, &dex_locations)) { return false; } Loading @@ -2644,7 +2665,7 @@ static bool create_app_profile_snapshot(int32_t app_id, if (pid == 0) { /* child -- drop privileges before continuing */ drop_capabilities(app_shared_gid); run_profman_merge(profiles_fd, snapshot_fd, &apk_fds); run_profman_merge(profiles_fd, snapshot_fd, &apk_fds, &dex_locations); } /* parent */ Loading Loading @@ -2694,7 +2715,8 @@ static bool create_boot_image_profile_snapshot(const std::string& package_name, // Open the classpath elements. These will be used to filter out profile data that does // not belong to the classpath during merge. std::vector<unique_fd> apk_fds; if (!open_classpath_files(classpath, &apk_fds)) { std::vector<std::string> dex_locations; if (!open_classpath_files(classpath, &apk_fds, &dex_locations)) { return false; } Loading @@ -2721,7 +2743,9 @@ static bool create_boot_image_profile_snapshot(const std::string& package_name, /* child -- drop privileges before continuing */ drop_capabilities(AID_SYSTEM); run_profman_merge(profiles_fd, snapshot_fd, &apk_fds); // The introduction of new access flags into boot jars causes them to // fail dex file verification. run_profman_merge(profiles_fd, snapshot_fd, &apk_fds, &dex_locations); } /* parent */ Loading Loading @@ -2784,7 +2808,8 @@ bool prepare_app_profile(const std::string& package_name, // The copy and update takes ownership over the fds. run_profman_copy_and_update(std::move(dex_metadata_fd), std::move(ref_profile_fd), std::move(apk_fd)); std::move(apk_fd), code_path); } /* parent */ Loading
libs/gui/BufferHubProducer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ status_t BufferHubProducer::dequeueBuffer(int* out_slot, sp<Fence>* out_fence, u uint32_t height, PixelFormat format, uint64_t usage, uint64_t* /*outBufferAge*/, FrameEventHistoryDelta* /* out_timestamps */) { ALOGW("dequeueBuffer: w=%u, h=%u, format=%d, usage=%" PRIu64, width, height, format, usage); ALOGV("dequeueBuffer: w=%u, h=%u, format=%d, usage=%" PRIu64, width, height, format, usage); status_t ret; std::unique_lock<std::mutex> lock(mutex_); Loading Loading @@ -208,7 +208,7 @@ status_t BufferHubProducer::dequeueBuffer(int* out_slot, sp<Fence>* out_fence, u buffers_[slot].mBufferState.freeQueued(); buffers_[slot].mBufferState.dequeue(); ALOGW("dequeueBuffer: slot=%zu", slot); ALOGV("dequeueBuffer: slot=%zu", slot); // TODO(jwcai) Handle fence properly. |BufferHub| has full fence support, we // just need to exopose that through |BufferHubQueue| once we need fence. Loading
libs/ui/HdrCapabilities.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ HdrCapabilities::~HdrCapabilities() = default; HdrCapabilities::HdrCapabilities(HdrCapabilities&& other) = default; HdrCapabilities& HdrCapabilities::operator=(HdrCapabilities&& other) = default; size_t HdrCapabilities::getFlattenedSize() const { return sizeof(mMaxLuminance) + sizeof(mMaxAverageLuminance) + Loading
services/surfaceflinger/DisplayDevice.cpp +22 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,8 @@ DisplayDevice::DisplayDevice( mSupportedPerFrameMetadata(supportedPerFrameMetadata) { // clang-format on for (Hdr hdrType : hdrCapabilities.getSupportedHdrTypes()) { std::vector<Hdr> types = hdrCapabilities.getSupportedHdrTypes(); for (Hdr hdrType : types) { switch (hdrType) { case Hdr::HDR10: mHasHdr10 = true; Loading @@ -124,6 +125,26 @@ DisplayDevice::DisplayDevice( } } float minLuminance = hdrCapabilities.getDesiredMinLuminance(); float maxLuminance = hdrCapabilities.getDesiredMaxLuminance(); float maxAverageLuminance = hdrCapabilities.getDesiredMaxAverageLuminance(); minLuminance = minLuminance <= 0.0 ? sDefaultMinLumiance : minLuminance; maxLuminance = maxLuminance <= 0.0 ? sDefaultMaxLumiance : maxLuminance; maxAverageLuminance = maxAverageLuminance <= 0.0 ? sDefaultMaxLumiance : maxAverageLuminance; if (this->hasWideColorGamut()) { // insert HDR10/HLG as we will force client composition for HDR10/HLG // layers if (!hasHDR10Support()) { types.push_back(Hdr::HDR10); } if (!hasHLGSupport()) { types.push_back(Hdr::HLG); } } mHdrCapabilities = HdrCapabilities(types, maxLuminance, maxAverageLuminance, minLuminance); // initialize the display orientation transform. setProjection(DisplayState::eOrientationDefault, mViewport, mFrame); } Loading
services/surfaceflinger/DisplayDevice.h +15 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include <gui/ISurfaceComposer.h> #include <hardware/hwcomposer_defs.h> #include <ui/GraphicTypes.h> #include <ui/HdrCapabilities.h> #include <ui/Region.h> #include <utils/RefBase.h> #include <utils/Mutex.h> Loading @@ -53,6 +54,9 @@ class HWComposer; class DisplayDevice : public LightRefBase<DisplayDevice> { public: constexpr static float sDefaultMinLumiance = 0.0; constexpr static float sDefaultMaxLumiance = 500.0; // region in layer-stack space mutable Region dirtyRegion; // region in screen space Loading Loading @@ -141,6 +145,13 @@ public: bool hasHDR10Support() const { return mHasHdr10; } bool hasHLGSupport() const { return mHasHLG; } bool hasDolbyVisionSupport() const { return mHasDolbyVision; } // The returned HdrCapabilities is the combination of HDR capabilities from // hardware composer and RenderEngine. When the DisplayDevice supports wide // color gamut, RenderEngine is able to simulate HDR support in Display P3 // color space for both PQ and HLG HDR contents. The minimum and maximum // luminance will be set to sDefaultMinLumiance and sDefaultMaxLumiance // respectively if hardware composer doesn't return meaningful values. const HdrCapabilities& getHdrCapabilities() const { return mHdrCapabilities; } void swapBuffers(HWComposer& hwc) const; Loading Loading @@ -261,7 +272,7 @@ private: bool mHasHdr10; bool mHasHLG; bool mHasDolbyVision; HdrCapabilities mHdrCapabilities; const int32_t mSupportedPerFrameMetadata; }; Loading Loading @@ -309,6 +320,9 @@ public: ui::Dataspace getDataSpace() const override { return mDevice->getCompositionDataSpace(); } float getDisplayMaxLuminance() const override { return mDevice->getHdrCapabilities().getDesiredMaxLuminance(); } private: const sp<const DisplayDevice> mDevice; Loading