Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Android/device/device/generic/goldfish/hals/hwc3/   (Android Betriebssystem Version 17©)  Datei vom 26.5.2026 mit Größe 2 kB image not shown  

Quelle  VsyncThread.h

  Sprache: C
 

/*
 * Copyright 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * 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.
 */


#ifndef ANDROID_HWC_VSYNCTHREAD_H
#define ANDROID_HWC_VSYNCTHREAD_H

#include <aidl/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.h>
#include <aidl/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.h>
#include <android/hardware/graphics/common/1.0/types.h>

#include <chrono>
#include <mutex>
#include <optional>
#include <thread>

#include "Common.h"

namespace aidl::android::hardware::graphics::composer3::impl {

// Generates Vsync signals in software.
class VsyncThread {
   public:
    VsyncThread(int64_t id);
    virtual ~VsyncThread();

    VsyncThread(const VsyncThread&) = delete;
    VsyncThread& operator=(const VsyncThread&) = delete;

    VsyncThread(VsyncThread&&) = delete;
    VsyncThread& operator=(VsyncThread&&) = delete;

    HWC3::Error start(int32_t periodNanos);

    HWC3::Error setCallbacks(const std::shared_ptr<IComposerCallback>& callback);

    HWC3::Error setVsyncEnabled(bool enabled);

    HWC3::Error scheduleVsyncUpdate(
        int32_t newVsyncPeriod, const VsyncPeriodChangeConstraints& newVsyncPeriodChangeConstraints,
        VsyncPeriodChangeTimeline* timeline);

   private:
    HWC3::Error stop();

    void threadLoop();

    std::chrono::nanoseconds updateVsyncPeriodLocked(
        std::chrono::time_point<std::chrono::steady_clock> now);

    const int64_t mDisplayId;

    std::thread mThread;

    std::mutex mStateMutex;

    std::atomic<bool> mShuttingDown{false};

    std::shared_ptr<IComposerCallback> mCallbacks;

    bool mVsyncEnabled = false;
    std::chrono::nanoseconds mVsyncPeriod;
    std::chrono::time_point<std::chrono::steady_clock> mPreviousVsync;

    struct PendingUpdate {
        std::chrono::nanoseconds period;
        std::chrono::time_point<std::chrono::steady_clock> updateAfter;
    };
    std::optional<PendingUpdate> mPendingUpdate;
};

}  // namespace aidl::android::hardware::graphics::composer3::impl

#endif

Messung V0.5 in Prozent
C=95 H=96 G=95

¤ Dauer der Verarbeitung: 0.9 Sekunden  (vorverarbeitet am  2026-06-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.