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

Commit 0e4dbdb5 authored by Dominik Laskowski's avatar Dominik Laskowski Committed by Android (Google) Code Review
Browse files

Merge changes Idf36e20c,Idf9f43b3,I420058ae into udc-qpr-dev

* changes:
  ui: Pull DisplayMap.h from SF
  SF: Encapsulate frame targeting
  SF: Redefine VsyncId using FTL mixins
parents 017e37be 6b049fff
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
#include <ftl/small_map.h>
#include <ftl/small_vector.h>

namespace android::display {
namespace android::ui {

// The static capacities were chosen to exceed a typical number of physical and/or virtual displays.

@@ -32,4 +32,4 @@ using PhysicalDisplayMap = ftl::SmallMap<Key, Value, 3>;
template <typename T>
using PhysicalDisplayVector = ftl::SmallVector<T, 3>;

} // namespace android::display
} // namespace android::ui
+12 −4
Original line number Diff line number Diff line
@@ -142,6 +142,8 @@ private:
    std::atomic<nsecs_t> mSignalTime{Fence::SIGNAL_TIME_INVALID};
};

using FenceTimePtr = std::shared_ptr<FenceTime>;

// A queue of FenceTimes that are expected to signal in FIFO order.
// Only maintains a queue of weak pointers so it doesn't keep references
// to Fences on its own.
@@ -190,8 +192,15 @@ private:
// before the new one is added.
class FenceToFenceTimeMap {
public:
    // Create a new FenceTime with that wraps the provided Fence.
    std::shared_ptr<FenceTime> createFenceTimeForTest(const sp<Fence>& fence);
    using FencePair = std::pair<sp<Fence>, FenceTimePtr>;

    FencePair makePendingFenceForTest() {
        const auto fence = sp<Fence>::make();
        return {fence, createFenceTimeForTest(fence)};
    }

    // Create a new FenceTime that wraps the provided Fence.
    FenceTimePtr createFenceTimeForTest(const sp<Fence>&);

    // Signals all FenceTimes created through this class that are wrappers
    // around |fence|.
@@ -205,7 +214,6 @@ private:
    std::unordered_map<Fence*, std::vector<std::weak_ptr<FenceTime>>> mMap;
};


}; // namespace android
} // namespace android

#endif // ANDROID_FENCE_TIME_H
+2 −2
Original line number Diff line number Diff line
@@ -21,9 +21,9 @@

#include <binder/IBinder.h>
#include <ui/DisplayId.h>
#include <ui/DisplayMap.h>
#include <utils/StrongPointer.h>

#include "DisplayMap.h"
#include "DisplaySnapshot.h"

namespace android::display {
@@ -66,7 +66,7 @@ private:
    DisplaySnapshot mSnapshot;
};

using PhysicalDisplays = PhysicalDisplayMap<PhysicalDisplayId, PhysicalDisplay>;
using PhysicalDisplays = ui::PhysicalDisplayMap<PhysicalDisplayId, PhysicalDisplay>;

// Combinator for ftl::Optional<PhysicalDisplayId>::and_then.
constexpr auto getPhysicalDisplay(const PhysicalDisplays& displays) {
+5 −4
Original line number Diff line number Diff line
@@ -17,8 +17,9 @@
#pragma once

#include "ComposerHal.h"

#include <ftl/shared_mutex.h>
#include <ftl/small_map.h>
#include <ui/DisplayMap.h>

#include <functional>
#include <optional>
@@ -272,9 +273,9 @@ private:
    // Invalid displayId used as a key to mReaders when mSingleReader is true.
    static constexpr int64_t kSingleReaderKey = 0;

    // TODO (b/256881188): Use display::PhysicalDisplayMap instead of hard-coded `3`
    ftl::SmallMap<Display, ComposerClientWriter, 3> mWriters GUARDED_BY(mMutex);
    ftl::SmallMap<Display, ComposerClientReader, 3> mReaders GUARDED_BY(mMutex);
    ui::PhysicalDisplayMap<Display, ComposerClientWriter> mWriters GUARDED_BY(mMutex);
    ui::PhysicalDisplayMap<Display, ComposerClientReader> mReaders GUARDED_BY(mMutex);

    // Protect access to mWriters and mReaders with a shared_mutex. Adding and
    // removing a display require exclusive access, since the iterator or the
    // writer/reader may be invalidated. Other calls need shared access while
+5 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@
#include <sstream>

#include <gui/DisplayInfo.h>
#include <ui/DisplayMap.h>
#include <ui/LayerStack.h>
#include <ui/Transform.h>

namespace android::surfaceflinger::frontend {

@@ -44,4 +47,6 @@ struct DisplayInfo {
    }
};

using DisplayInfos = ui::DisplayMap<ui::LayerStack, DisplayInfo>;

} // namespace android::surfaceflinger::frontend
Loading