Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b7e13d9 authored by Daniel Zheng's avatar Daniel Zheng
Browse files

surfaceflinger formatting

no functionality changes here. just some clang-tidy formatting

Flag: EXEMPT refactor
Test: th
Change-Id: I25cd53c40d4fde1edb29f4b8fee28df6f4b66235
parent b1b8b4c4
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -328,9 +328,7 @@ std::string AidlComposer::dumpDebugInfo() {
    std::string str;
    // Use other thread to read pipe to prevent
    // pipe is full, making HWC be blocked in writing.
    std::thread t([&]() {
        base::ReadFdToString(pipefds[0], &str);
    });
    std::thread t([&]() { base::ReadFdToString(pipefds[0], &str); });
    const auto status = mAidlComposer->dump(pipefds[1], /*args*/ nullptr, /*numArgs*/ 0);
    // Close the write-end of the pipe to make sure that when reading from the
    // read-end we will get eof instead of blocking forever
+2 −3
Original line number Diff line number Diff line
@@ -235,8 +235,7 @@ public:
    // Composer HAL 2.3
    virtual Error getDisplayIdentificationData(Display display, uint8_t* outPort,
                                               std::vector<uint8_t>* outData) = 0;
    virtual Error setLayerColorTransform(Display display, Layer layer,
                                         const float* matrix) = 0;
    virtual Error setLayerColorTransform(Display display, Layer layer, const float* matrix) = 0;
    virtual Error getDisplayedContentSamplingAttributes(Display display, PixelFormat* outFormat,
                                                        Dataspace* outDataspace,
                                                        uint8_t* outComponentMask) = 0;
+3 −3
Original line number Diff line number Diff line
@@ -824,8 +824,8 @@ mat4 HWComposer::getDataspaceSaturationMatrix(HalDisplayId displayId, ui::Datasp
    RETURN_IF_INVALID_DISPLAY(displayId, {});

    mat4 matrix;
    auto error = mDisplayData[displayId].hwcDisplay->getDataspaceSaturationMatrix(dataspace,
            &matrix);
    auto error =
            mDisplayData[displayId].hwcDisplay->getDataspaceSaturationMatrix(dataspace, &matrix);
    RETURN_IF_HWC_ERROR(error, displayId, {});
    return matrix;
}
+9 −8
Original line number Diff line number Diff line
@@ -1230,14 +1230,15 @@ Error HidlComposer::getDisplayCapabilities(Display display,
                                                            translate<DisplayCapability>(tmpCaps);
                                                });
    } else {
        mClient_2_3
                ->getDisplayCapabilities(display, [&](const auto& tmpError, const auto& tmpCaps) {
        mClient_2_3->getDisplayCapabilities(display,
                                            [&](const auto& tmpError, const auto& tmpCaps) {
                                                error = static_cast<V2_4::Error>(tmpError);
                                                if (error != V2_4::Error::NONE) {
                                                    return;
                                                }

                    *outCapabilities = translate<DisplayCapability>(tmpCaps);
                                                *outCapabilities =
                                                        translate<DisplayCapability>(tmpCaps);
                                            });
    }

+73 −82
Original line number Diff line number Diff line
@@ -361,7 +361,7 @@ bool isExpectedPresentWithinTimeout(TimePoint expectedPresentTime,
    return std::abs(expectedPresentTime.ns() -
                    (lastExpectedPresentTimestamp.ns() + timeoutOpt->ns())) < threshold.ns();
}
}  // namespace anonymous
} // namespace

// ---------------------------------------------------------------------------

@@ -401,8 +401,7 @@ std::string decodeDisplayColorSetting(DisplayColorSetting displayColorSetting) {
        case DisplayColorSetting::kEnhanced:
            return std::string("Enhanced");
        default:
            return std::string("Unknown ") +
                std::to_string(static_cast<int>(displayColorSetting));
            return std::string("Unknown ") + std::to_string(static_cast<int>(displayColorSetting));
    }
}

@@ -599,10 +598,9 @@ sp<IBinder> SurfaceFlinger::createVirtualDisplay(
            flinger->mCurrentState.displays.removeItem(wp<IBinder>::fromExisting(this));
            flinger->setTransactionFlags(eDisplayTransactionNeeded);
        }

    public:
        explicit DisplayToken(const sp<SurfaceFlinger>& flinger)
            : flinger(flinger) {
        }
        explicit DisplayToken(const sp<SurfaceFlinger>& flinger) : flinger(flinger) {}
    };

    sp<BBinder> token = sp<DisplayToken>::make(sp<SurfaceFlinger>::fromExisting(this));
@@ -780,8 +778,7 @@ void SurfaceFlinger::bootFinished() {
    property_set("service.bootanim.exit", "1");

    const int LOGTAG_SF_STOP_BOOTANIM = 60110;
    LOG_EVENT_LONG(LOGTAG_SF_STOP_BOOTANIM,
                   ns2ms(systemTime(SYSTEM_TIME_MONOTONIC)));
    LOG_EVENT_LONG(LOGTAG_SF_STOP_BOOTANIM, ns2ms(systemTime(SYSTEM_TIME_MONOTONIC)));

    sp<IBinder> input(defaultServiceManager()->waitForService(String16("inputflinger")));

@@ -1125,8 +1122,7 @@ void SurfaceFlinger::readPersistentProperties() {
            static_cast<ui::ColorMode>(base::GetIntProperty("persist.sys.sf.color_mode"s, 0));
}

status_t SurfaceFlinger::getSupportedFrameTimestamps(
        std::vector<FrameEvent>* outSupported) const {
status_t SurfaceFlinger::getSupportedFrameTimestamps(std::vector<FrameEvent>* outSupported) const {
    *outSupported = {
            FrameEvent::REQUESTED_PRESENT,
            FrameEvent::ACQUIRE,
@@ -2210,7 +2206,6 @@ status_t SurfaceFlinger::addHdrLayerInfoListener(const sp<IBinder>& displayToken
    }
    hdrInfoReporter->addListener(listener);


    mAddingHDRLayerInfoListener = true;
    return OK;
}
@@ -2807,8 +2802,9 @@ bool SurfaceFlinger::commit(PhysicalDisplayId pacesetterId,
        // setTransactionFlags which will schedule another SF frame. This was if the tracker
        // needs to adjust the vsync timeline, it will be done before the next frame.
        if (FlagManager::getInstance().vrr_config() && mustComposite) {
            mScheduler->getVsyncSchedule()->getTracker().onFrameBegin(
                pacesetterFrameTarget.expectedPresentTime(),
            mScheduler->getVsyncSchedule()
                    ->getTracker()
                    .onFrameBegin(pacesetterFrameTarget.expectedPresentTime(),
                                  pacesetterFrameTarget.lastSignaledFrameTime());
        }
        if (transactionFlushNeeded()) {
@@ -3070,8 +3066,7 @@ CompositeResultsPerDisplay SurfaceFlinger::composite(
            }
        }

        compositionSummary.push_back(
                layerFE->mSnapshot->classifyCompositionForDebug(hwcState));
        compositionSummary.push_back(layerFE->mSnapshot->classifyCompositionForDebug(hwcState));

        if (hwcState.overrideBufferId && !hwcState.wasSkipped) {
            compositionSummary.push_back(':');
@@ -4324,14 +4319,11 @@ void SurfaceFlinger::updateInputFlinger(VsyncId vsyncId, TimePoint frameTime) {
        mVisibleWindowIds = std::move(visibleWindowIds);
    }

    BackgroundExecutor::getInstance().sendCallbacks({[updateWindowInfo,
                                                      windowInfos = std::move(windowInfos),
    BackgroundExecutor::getInstance().sendCallbacks(
            {[updateWindowInfo, windowInfos = std::move(windowInfos),
              displayInfos = std::move(displayInfos),
                                                      inputWindowCommands =
                                                              std::move(mInputWindowCommands),
                                                      inputFlinger = mInputFlinger, this,
                                                      visibleWindowsChanged, vsyncId,
                                                      frameTime]() mutable {
              inputWindowCommands = std::move(mInputWindowCommands), inputFlinger = mInputFlinger,
              this, visibleWindowsChanged, vsyncId, frameTime]() mutable {
                SFTRACE_NAME("BackgroundExecutor::updateInputFlinger");
                if (updateWindowInfo) {
                    mWindowInfosListenerInvoker
@@ -4341,7 +4333,8 @@ void SurfaceFlinger::updateInputFlinger(VsyncId vsyncId, TimePoint frameTime) {
                                                                        frameTime.ns()},
                                                 std::move(inputWindowCommands.releaseListeners()),
                                                 /* forceImmediateCall= */ visibleWindowsChanged ||
                                                 !inputWindowCommands.getFocusRequests().empty());
                                                         !inputWindowCommands.getFocusRequests()
                                                                  .empty());
                } else {
                    // If there are listeners but no changes to input windows, call the listeners
                    // immediately.
@@ -5067,8 +5060,8 @@ status_t SurfaceFlinger::setTransactionState(
        if (resolvedState.state.hasBufferChanges() && resolvedState.state.hasValidBuffer() &&
            resolvedState.state.surface) {
            sp<Layer> layer = LayerHandle::getLayer(resolvedState.state.surface);
            std::string layerName = (layer) ?
                    layer->getDebugName() : std::to_string(resolvedState.state.layerId);
            std::string layerName =
                    (layer) ? layer->getDebugName() : std::to_string(resolvedState.state.layerId);
            resolvedState.externalTexture =
                    getExternalTextureFromBufferData(*resolvedState.state.bufferData,
                                                     layerName.c_str(), transactionId);
@@ -5922,8 +5915,7 @@ status_t SurfaceFlinger::doDump(int fd, const DumpArgs& args, bool asProto) {
    const int pid = ipc->getCallingPid();
    const int uid = ipc->getCallingUid();

    if ((uid != AID_SHELL) &&
            !PermissionCache::checkPermission(sDump, pid, uid)) {
    if ((uid != AID_SHELL) && !PermissionCache::checkPermission(sDump, pid, uid)) {
        StringAppendF(&result, "Permission Denial: can't dump SurfaceFlinger from pid=%d, uid=%d\n",
                      pid, uid);
        write(fd, result.c_str(), result.size());
@@ -6677,11 +6669,12 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
        CHECK_INTERFACE(ISurfaceComposer, data, reply);
        IPCThreadState* ipc = IPCThreadState::self();
        const int uid = ipc->getCallingUid();
        if (CC_UNLIKELY(uid != AID_SYSTEM
                && !PermissionCache::checkCallingPermission(sHardwareTest))) {
        if (CC_UNLIKELY(uid != AID_SYSTEM &&
                        !PermissionCache::checkCallingPermission(sHardwareTest))) {
            const int pid = ipc->getCallingPid();
            ALOGE("Permission Denial: "
                    "can't access SurfaceFlinger pid=%d, uid=%d", pid, uid);
                  "can't access SurfaceFlinger pid=%d, uid=%d",
                  pid, uid);
            return PERMISSION_DENIED;
        }
        int n;
@@ -7272,9 +7265,7 @@ auto SurfaceFlinger::getKernelIdleTimerProperties(PhysicalDisplayId displayId)
class WindowDisconnector {
public:
    WindowDisconnector(ANativeWindow* window, int api) : mWindow(window), mApi(api) {}
    ~WindowDisconnector() {
        native_window_api_disconnect(mWindow, mApi);
    }
    ~WindowDisconnector() { native_window_api_disconnect(mWindow, mApi); }

private:
    ANativeWindow* mWindow;