common/display/pageflipeventhandler.cpp \
common/display/virtualdisplay.cpp \
common/utils/drmscopedtypes.cpp \
+ common/utils/fdhandler.cpp \
common/utils/hwcevent.cpp \
common/utils/hwcthread.cpp \
common/utils/disjoint_layers.cpp \
if (fence > 0) {
compositor_.InsertFence(dup(fence));
fd_handler_.AddFd(fence);
- commit_pending_ = true;
out_fence_.Reset(fence);
}
#endif
- previous_sync_.reset(current_sync_.release());
current_sync_.reset(queue_item.sync_object_.release());
}
-void DisplayQueue::HandleRoutine() {
- if (commit_pending_ && fd_handler_.IsReady(out_fence_.get())) {
- fd_handler_.RemoveFd(out_fence_.get());
- commit_pending_ = false;
- out_fence_.Reset(-1);
- previous_sync_.reset(nullptr);
- }
-
- if (commit_pending_)
- return;
+void DisplayQueue::CommitFinished() {
+ fd_handler_.RemoveFd(out_fence_.get());
+ out_fence_.Reset(-1);
+}
+void DisplayQueue::ProcessRequests() {
display_queue_.lock();
size_t size = queue_.size();
HandleUpdateRequest(item);
}
+void DisplayQueue::HandleRoutine() {
+ // If we have a commit pending and the out_fence_ is ready, we can process
+ // the end of the last commit.
+ int fd = out_fence_.get();
+ if (fd > 0 && fd_handler_.IsReady(fd))
+ CommitFinished();
+
+ // Do not submit another commit while there is one still pending.
+ if (out_fence_.get() > 0)
+ return;
+
+ // Check whether there are more requests to process, and commit the first
+ // one.
+ ProcessRequests();
+}
+
void DisplayQueue::Flush() {
ScopedSpinLock lock(display_queue_);
previous_layers_.clear();
previous_plane_state_.clear();
std::queue<DisplayQueueItem>().swap(queue_);
- previous_sync_.reset(nullptr);
current_sync_.reset(nullptr);
compositor_.Reset();
}
void GetDrmObjectProperty(const char* name,
const ScopedDrmObjectPropertyPtr& props,
uint32_t* id) const;
+ void CommitFinished();
+ void ProcessRequests();
Compositor compositor_;
drmModeModeInfo mode_;
uint32_t old_blob_id_ = 0;
uint32_t gpu_fd_;
bool needs_modeset_ = false;
- bool commit_pending_ = false;
std::unique_ptr<PageFlipEventHandler> flip_handler_;
std::unique_ptr<DisplayPlaneManager> display_plane_manager_;
std::unique_ptr<NativeSync> current_sync_;
- std::unique_ptr<NativeSync> previous_sync_;
SpinLock spin_lock_;
SpinLock display_queue_;
std::queue<DisplayQueueItem> queue_;