Skip to content

Commit dcadffb

Browse files
committed
GPU Display Console: Add the possibility to rebind keys
1 parent d1a27d9 commit dcadffb

12 files changed

Lines changed: 403 additions & 244 deletions

‎GPU/GPUTracking/DataTypes/GPUTPCGeometry.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ class GPUTPCGeometry
121121
GPUd() static constexpr int32_t MaxNPadsPerRow() { return 138; }
122122
GPUd() static constexpr float PadWidth(int32_t row) { return (gputpcgeometry_internal::mPadWidthRow[row]); }
123123
#else
124-
GPUd() static constexpr int32_t GetRegion(int32_t row) { return (row < 63 ? 0 : row < 63 + 64 ? 1
125-
: 2); }
124+
GPUd() static constexpr int32_t GetRegion(int32_t row) { return (row < 63 ? 0 : row < 63 + 64 ? 1 : 2); }
126125
GPUd() static constexpr int32_t GetRegionRows(int32_t region) { return 0; } // dummy
127126
GPUd() static constexpr int32_t GetRegionStart(int32_t region) { return 0; } // dummy
128127
GPUd() static constexpr int32_t GetROC(int32_t row) { return GetRegion(row); }

‎GPU/GPUTracking/Definitions/GPUSettingsListDisplay.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ EndConfig()
116116
BeginSubConfig(GPUSettingsDisplayInternal, internal, configStandalone.display, "GLI", 0, "Internal display settings", display_internal)
117117
AddOption(guiReplyTimeout, uint32_t, 100, "", 0, "Time in ms the Qt GUI waits at most for the display to process its update")
118118
AddOption(guiMaxUpdatesAhead, uint32_t, 3, "", 0, "Number of updates the Qt GUI may send ahead of the last one the display has processed, before it waits for the display")
119-
AddOption(consoleDelay, float, 0.5f, "", 0, "Time in seconds to open / close the console (^ key)")
120-
AddOption(consoleAlpha, float, 0.8f, "", 0, "Opacity of the console background")
119+
AddOption(consoleDelay, float, 0.3f, "", 0, "Time in seconds to open / close the console (^ key)")
120+
AddOption(consoleAlpha, float, 0.85f, "", 0, "Opacity of the console background")
121121
AddOption(consoleVertical, float, 0.5f, "", 0, "Fraction of the window height covered by the fully opened console")
122122
AddOption(consoleHistorySize, uint32_t, 1000000, "", 0, "Number of console lines kept, the history is shortened to this when it reaches twice the size")
123123
AddOption(setInfoTime, float, 5.0f, "", 0, "Time in seconds an info message (SetInfo) is shown fully opaque")

‎GPU/GPUTracking/Merger/GPUTPCGlobalDebugSortKernels.cxx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ GPUdii() void GPUTPCGlobalDebugSortKernels::Thread<GPUTPCGlobalDebugSortKernels:
5252
GPUCommonAlgorithm::sort(tmp, tmp + n, [&merger, offset](const int32_t& aa, const int32_t& bb) {
5353
const auto& a = merger.SectorTrackInfos()[offset + aa];
5454
const auto& b = merger.SectorTrackInfos()[offset + bb];
55-
return (a.X() != b.X()) ? (a.X() < b.X()) : (a.Y() != b.Y()) ? (a.Y() < b.Y())
56-
: (a.Z() < b.Z());
55+
return (a.X() != b.X()) ? (a.X() < b.X())
56+
: (a.Y() != b.Y()) ? (a.Y() < b.Y())
57+
: (a.Z() < b.Z());
5758
});
5859
for (int32_t j = 0; j < n; j++) {
5960
if (tmp[j] >= 0 && tmp[j] != j) {

‎GPU/GPUTracking/display/backend/GPUDisplayBackendVulkan.cxx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,7 @@ void GPUDisplayBackendVulkan::createSwapChain(vk::SwapchainKHR oldSwapChain)
813813
{ // Let the compositor scale the last image while resizing, until the new swapchain is presented
814814
const vk::SurfacePresentModeKHR surfacePresentMode{mPresentMode};
815815
const auto caps = mPhysicalDevice.getSurfaceCapabilities2KHR<vk::SurfaceCapabilities2KHR, vk::SurfacePresentScalingCapabilitiesKHR>(vk::PhysicalDeviceSurfaceInfo2KHR{mSurface, &surfacePresentMode}).get<vk::SurfacePresentScalingCapabilitiesKHR>();
816-
auto gravity = [](vk::PresentGravityFlagsKHR f) { return (f & vk::PresentGravityFlagBitsKHR::eCentered) ? vk::PresentGravityFlagBitsKHR::eCentered : (f & vk::PresentGravityFlagBitsKHR::eMin) ? vk::PresentGravityFlagBitsKHR::eMin
817-
: vk::PresentGravityFlagsKHR(f & vk::PresentGravityFlagBitsKHR::eMax); };
816+
auto gravity = [](vk::PresentGravityFlagsKHR f) { return (f & vk::PresentGravityFlagBitsKHR::eCentered) ? vk::PresentGravityFlagBitsKHR::eCentered : (f & vk::PresentGravityFlagBitsKHR::eMin) ? vk::PresentGravityFlagBitsKHR::eMin : vk::PresentGravityFlagsKHR(f & vk::PresentGravityFlagBitsKHR::eMax); };
818817
scalingInfo.scalingBehavior = (caps.supportedPresentScaling & vk::PresentScalingFlagBitsKHR::eAspectRatioStretch) ? vk::PresentScalingFlagBitsKHR::eAspectRatioStretch : vk::PresentScalingFlagsKHR(caps.supportedPresentScaling & vk::PresentScalingFlagBitsKHR::eStretch);
819818
scalingInfo.presentGravityX = gravity(caps.supportedPresentGravityX);
820819
scalingInfo.presentGravityY = gravity(caps.supportedPresentGravityY);

‎GPU/GPUTracking/display/frontend/GPUDisplayFrontend.h‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <mutex>
2525
#include <thread>
2626
#include <condition_variable>
27+
#include <functional>
2728
#include <string>
2829
#include <utility>
2930
#include <vector>
@@ -157,8 +158,7 @@ class GPUDisplayFrontend : public GPUDisplayFrontendInterface, public GPUDisplay
157158
private:
158159
struct GPUDisplayConfiguration;
159160
struct configRTTIExt;
160-
struct configKey;
161-
std::unique_ptr<GPUDisplayConfiguration, void (*)(GPUDisplayConfiguration*)> mConfigRTTI{nullptr, nullptr}; // Deleter set in GPUDisplayFrontendConfig.cxx, the only place where GPUDisplayConfiguration is defined
161+
std::unique_ptr<GPUDisplayConfiguration, void (*)(GPUDisplayConfiguration*)> mConfiguration{nullptr, nullptr}; // Deleter set in GPUDisplayFrontendConfig.cxx, the only place where GPUDisplayConfiguration is defined
162162

163163
void HandleExternalGUIKeys();
164164
static int32_t translateExternalKey(uint32_t translationMode, uint64_t extendedKey); // Key code of an encoded key of sendExternalGUIKey (+ SPECIAL_KEYS_SHIFTED with SHIFT), -1 if unknown
@@ -172,7 +172,8 @@ class GPUDisplayFrontend : public GPUDisplayFrontendInterface, public GPUDisplay
172172
void setGUILayout(GPUDisplayGUIChannel& channel) const; // Copy the GUI elements of the add_gui_binding calls to the channel
173173
void applyGUIValues(const GPUDisplayGUIUpdate& update); // Call the setter of the GUI elements changed in the GUI (element id, value), and show the info of their options
174174
void listConfig();
175-
const std::vector<std::string>& getHelpText() const; // Help text of all key bindings, one line per binding
175+
const std::vector<std::string>& getHelpText(); // Help text of all key bindings, one line per binding, rebuilt after key bindings changed
176+
void listKeys(const std::function<void(const std::string&)>& print); // Bound keys with action / key down mapping and option, then unbound actions and mappings, then the key down mappings with their keys, one line per call
176177
};
177178
} // namespace o2::gpu
178179

0 commit comments

Comments
 (0)