Project
Loading...
Searching...
No Matches
GPUDisplayGUIChannel.h
Go to the documentation of this file.
1// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef GPUDISPLAYGUICHANNEL_H
16#define GPUDISPLAYGUICHANNEL_H
17
18#include "GPUSettings.h"
19#include <chrono>
20#include <condition_variable>
21#include <cstdint>
22#include <mutex>
23#include <optional>
24#include <string>
25#include <vector>
26
27namespace o2::gpu
28{
29// Communication between the Qt GUI thread (GPUDisplayGUI) and the display thread (GPUDisplayFrontend::HandleExternalGUISignals), Qt-free.
30// The GUI sends at most one update per timer tick, the display processes it once per frame and publishes the complete settings with the id of the last processed update.
31// If the GUI went to sleep with an update ready and the display picks it up, the GUI waits for the reply when it wakes up, so it continues with the settings including its update.
33 struct Settings {
34 GPUSettingsDisplayHeavy cfgH;
35 GPUSettingsDisplayLight cfgL;
36 GPUSettingsDisplayRenderer cfgR;
37 };
38 struct Update { // GUI → display
39 uint64_t id = 0;
40 std::vector<int32_t> keys; // Keys pressed in the GUI and not handled by it, display key codes
41 std::optional<float> lineWidth; // For testing, to be replaced by generic settings updates
42 bool empty() const { return keys.empty() && !lineWidth; }
43 };
44 struct State { // display → GUI
46 uint64_t appliedUpdate = 0; // Id of the last GUI update included in cfg
47 uint64_t counter = 0; // Incremented with every published state
48 };
49
50 std::mutex mutex; // Protects all members below
51 std::condition_variable stateUpdated; // Notified when a new state is published or the GUI shall stop
52 std::optional<Update> update; // Pending update, not yet picked up by the display
53 State state; // Latest state published by the display
54 bool guiSleeping = false; // GUI waits for its next timer tick with an update ready
55 bool displayProcessingCurrentUpdate = false; // Display processes the update the GUI went to sleep with, GUI waits for the reply
56 bool stop = false; // GUI shall close
57 std::chrono::milliseconds replyTimeout; // Maximum time the GUI waits for a reply
58 uint32_t maxUpdatesAhead = 0; // GUI waits for the reply if it is that many updates ahead of the last one it applied
59 std::string windowName; // Name of the display window, set when starting the GUI
60};
61} // namespace o2::gpu
62
63#endif // GPUDISPLAYGUICHANNEL_H
GLuint counter
Definition glcorearb.h:3987
std::chrono::milliseconds replyTimeout
std::condition_variable stateUpdated