Skip to content

Commit 52937ed

Browse files
committed
GPU Display: Store pointer to GPUSettingsProcessing, so we do not need to copy debugLevel to GPUParam
1 parent e060099 commit 52937ed

14 files changed

+58
-31
lines changed

GPU/GPUTracking/Base/GPUReconstructionTimeframe.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@
2525
#include "TPCFastTransform.h"
2626
#include "CorrectionMapsHelper.h"
2727
#include "GPUO2DataTypes.h"
28+
#include "GPUSettings.h"
2829

2930
#include <cstdio>
3031
#include <exception>
3132
#include <memory>
3233
#include <cstring>
3334

34-
#include "utils/qconfig.h"
35-
3635
using namespace o2::gpu;
3736

3837
namespace o2::gpu

GPU/GPUTracking/Interface/GPUO2InterfaceDisplay.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ GPUO2InterfaceDisplay::GPUO2InterfaceDisplay(const GPUO2InterfaceConfiguration*
3535
mQA.reset(new GPUQA(nullptr, &config->configQA, mParam.get()));
3636
mQA->InitO2MCData();
3737
}
38-
mDisplay.reset(GPUDisplayInterface::getDisplay(mFrontend.get(), nullptr, mQA.get(), mParam.get(), &mConfig->configCalib, &mConfig->configDisplay));
38+
mDisplay.reset(GPUDisplayInterface::getDisplay(mFrontend.get(), nullptr, mQA.get(), mParam.get(), &mConfig->configCalib, &mConfig->configDisplay, &mConfig->configProcessing));
3939
}
4040

4141
GPUO2InterfaceDisplay::~GPUO2InterfaceDisplay() = default;

GPU/GPUTracking/Merger/GPUTPCGMTrackParam.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#include "GPUGetConstexpr.h"
4343

4444
#ifdef GPUCA_CADEBUG_ENABLED
45-
#include "../utils/qconfig.h"
45+
#include "GPUSettings.h"
4646
#include "AliHLTTPCClusterMCData.h"
4747
#endif
4848

GPU/GPUTracking/display/GPUDisplay.cxx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "GPUTPCTracker.h"
3535
#include "GPUTPCGMMergedTrack.h"
3636
#include "GPUO2DataTypes.h"
37-
#include "utils/qconfig.h"
37+
#include "GPUSettings.h"
3838

3939
#include "frontend/GPUDisplayFrontend.h"
4040
#include "backend/GPUDisplayBackend.h"
@@ -44,17 +44,19 @@ constexpr hmm_mat4 MY_HMM_IDENTITY = {{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0},
4444

4545
using namespace o2::gpu;
4646

47-
static const GPUSettingsDisplay& GPUDisplay_GetConfig(GPUChainTracking* chain)
47+
const GPUSettingsDisplay& GPUDisplay::GetConfig(GPUChainTracking* chain)
4848
{
4949
static GPUSettingsDisplay defaultConfig;
50-
if (chain && chain->mConfigDisplay) {
51-
return *chain->mConfigDisplay;
52-
} else {
53-
return defaultConfig;
54-
}
50+
return (chain && chain->mConfigDisplay) ? *chain->mConfigDisplay : defaultConfig;
51+
}
52+
53+
const GPUSettingsProcessing& GPUDisplay::GetProcessingConfig(GPUChainTracking* chain)
54+
{
55+
static GPUSettingsProcessing defaultConfig;
56+
return chain ? chain->GetProcessingSettings() : defaultConfig;
5557
}
5658

57-
GPUDisplay::GPUDisplay(GPUDisplayFrontend* frontend, GPUChainTracking* chain, GPUQA* qa, const GPUParam* param, const GPUCalibObjectsConst* calib, const GPUSettingsDisplay* config) : GPUDisplayInterface(), mFrontend(frontend), mChain(chain), mConfig(config ? *config : GPUDisplay_GetConfig(chain)), mQA(qa)
59+
GPUDisplay::GPUDisplay(GPUDisplayFrontend* frontend, GPUChainTracking* chain, GPUQA* qa, const GPUParam* param, const GPUCalibObjectsConst* calib, const GPUSettingsDisplay* config, const GPUSettingsProcessing* proc) : GPUDisplayInterface(), mFrontend(frontend), mChain(chain), mConfig(config ? *config : GetConfig(chain)), mProcessingSettings(proc ? *proc : GetProcessingConfig(chain)), mQA(qa)
5860
{
5961
mParam = param ? param : &mChain->GetParam();
6062
mCalib = calib;

GPU/GPUTracking/display/GPUDisplay.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "frontend/GPUDisplayFrontend.h"
1919
#include "backend/GPUDisplayBackend.h"
2020
#include "GPUDisplayInterface.h"
21+
#include "GPUSettings.h"
2122

2223
#include "../utils/vecpod.h"
2324
#include "../utils/qsem.h"
@@ -37,7 +38,7 @@ class GPUTRDGeometry;
3738
class GPUDisplay : public GPUDisplayInterface
3839
{
3940
public:
40-
GPUDisplay(GPUDisplayFrontend* frontend, GPUChainTracking* chain, GPUQA* qa, const GPUParam* param = nullptr, const GPUCalibObjectsConst* calib = nullptr, const GPUSettingsDisplay* config = nullptr);
41+
GPUDisplay(GPUDisplayFrontend* frontend, GPUChainTracking* chain, GPUQA* qa, const GPUParam* param = nullptr, const GPUCalibObjectsConst* calib = nullptr, const GPUSettingsDisplay* config = nullptr, const GPUSettingsProcessing* proc = nullptr);
4142
GPUDisplay(const GPUDisplay&) = delete;
4243
~GPUDisplay() override = default;
4344

@@ -71,6 +72,7 @@ class GPUDisplay : public GPUDisplayInterface
7172
};
7273
vecpod<vtx>* vertexBuffer() { return mVertexBuffer; }
7374
const GPUParam* param() { return mParam; }
75+
const GPUSettingsProcessing& GetProcessingSettings() const { return mProcessingSettings; }
7476
GPUDisplayFrontend* frontend() { return mFrontend; }
7577
bool drawTextInCompatMode() const { return mDrawTextInCompatMode; }
7678
int32_t& drawTextFontSize() { return mDrawTextFontSize; }
@@ -140,6 +142,9 @@ class GPUDisplay : public GPUDisplayInterface
140142
bool mVerbose = false;
141143
};
142144

145+
static const GPUSettingsDisplay& GetConfig(GPUChainTracking* chain);
146+
static const GPUSettingsProcessing& GetProcessingConfig(GPUChainTracking* chain);
147+
143148
void DrawGLScene_internal(float animateTime = -1.f, bool renderToMixBuffer = false);
144149
void DrawGLScene_updateEventData();
145150
void DrawGLScene_cameraAndAnimation(float animateTime, float& mixSlaveImage, hmm_mat4& nextViewMatrix);
@@ -214,6 +219,7 @@ class GPUDisplay : public GPUDisplayInterface
214219
GPUSettingsDisplayLight mCfgL;
215220
GPUSettingsDisplayHeavy mCfgH;
216221
GPUSettingsDisplayRenderer mCfgR;
222+
const GPUSettingsProcessing& mProcessingSettings;
217223
GPUQA* mQA;
218224
qSem mSemLockDisplay;
219225

GPU/GPUTracking/display/GPUDisplayInterface.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ static void* loadUnloadLib(bool load)
6565
return nullptr;
6666
}
6767

68-
GPUDisplayInterface* GPUDisplayInterface::getDisplay(GPUDisplayFrontendInterface* frontend, GPUChainTracking* chain, GPUQA* qa, const GPUParam* param, const GPUCalibObjectsConst* calib, const GPUSettingsDisplay* config)
68+
GPUDisplayInterface* GPUDisplayInterface::getDisplay(GPUDisplayFrontendInterface* frontend, GPUChainTracking* chain, GPUQA* qa, const GPUParam* param, const GPUCalibObjectsConst* calib, const GPUSettingsDisplay* config, const GPUSettingsProcessing* proc)
6969
{
70-
std::tuple args = {frontend, chain, qa, param, calib, config};
70+
std::tuple args = {frontend, chain, qa, param, calib, config, proc};
7171
auto func = (GPUDisplayInterface * (*)(const char*, void*)) loadUnloadLib(true);
7272
return func ? func("display", &args) : nullptr;
7373
}

GPU/GPUTracking/display/GPUDisplayInterface.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,24 @@
1515
#ifndef GPUDISPLAYINTERFACE_H
1616
#define GPUDISPLAYINTERFACE_H
1717

18-
#include "GPUSettings.h"
18+
#include <cstdint>
1919

2020
namespace o2::gpu
2121
{
2222

2323
class GPUChainTracking;
2424
class GPUQA;
2525
struct GPUParam;
26+
struct GPUTrackingInOutPointers;
27+
template <class T>
28+
struct ConstPtr;
29+
template <template <typename T> class S>
30+
struct GPUCalibObjectsTemplate;
31+
typedef GPUCalibObjectsTemplate<ConstPtr> GPUCalibObjectsConst;
32+
struct GPUDisplayFrontendInterface;
33+
struct GPUSettingsDisplay;
34+
struct GPUSettingsProcessing;
35+
2636
class GPUDisplayInterface
2737
{
2838
public:
@@ -34,7 +44,7 @@ class GPUDisplayInterface
3444
virtual void SetCollisionFirstCluster(uint32_t collision, int32_t sector, int32_t cluster) = 0;
3545
virtual void UpdateCalib(const GPUCalibObjectsConst* calib) = 0;
3646
virtual void UpdateParam(const GPUParam* param) = 0;
37-
static GPUDisplayInterface* getDisplay(GPUDisplayFrontendInterface* frontend, GPUChainTracking* chain, GPUQA* qa, const GPUParam* param = nullptr, const GPUCalibObjectsConst* calib = nullptr, const GPUSettingsDisplay* config = nullptr);
47+
static GPUDisplayInterface* getDisplay(GPUDisplayFrontendInterface* frontend, GPUChainTracking* chain, GPUQA* qa, const GPUParam* param = nullptr, const GPUCalibObjectsConst* calib = nullptr, const GPUSettingsDisplay* config = nullptr, const GPUSettingsProcessing* proc = nullptr);
3848

3949
protected:
4050
GPUDisplayInterface();

GPU/GPUTracking/display/backend/GPUDisplayBackendOpenGL.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ int32_t GPUDisplayBackendOpenGL::checkProgramStatus(uint32_t program)
305305

306306
int32_t GPUDisplayBackendOpenGL::InitBackendA()
307307
{
308-
if (mDisplay->param()->par.debugLevel >= 2) {
308+
if (mDisplay->GetProcessingSettings().debugLevel >= 2) {
309309
auto renderer = glGetString(GL_RENDERER);
310310
GPUInfo("Renderer: %s", (const char*)renderer);
311311
}

GPU/GPUTracking/display/backend/GPUDisplayBackendVulkan.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ void GPUDisplayBackendVulkan::createDevice()
414414
mDebugMessenger = mInstance.createDebugUtilsMessengerEXT(debugCreateInfo, nullptr);
415415
}
416416
std::vector<vk::ExtensionProperties> extensions = vk::enumerateInstanceExtensionProperties(nullptr);
417-
if (mDisplay->param()->par.debugLevel >= 3) {
417+
if (mDisplay->GetProcessingSettings().debugLevel >= 3) {
418418
std::cout << "available instance extensions: " << extensions.size() << "\n";
419419
for (const auto& extension : extensions) {
420420
std::cout << '\t' << extension.extensionName << '\n';
@@ -436,7 +436,7 @@ void GPUDisplayBackendVulkan::createDevice()
436436
double bestScore = -1.;
437437
for (uint32_t i = 0; i < devices.size(); i++) {
438438
double score = checkDevice(devices[i], reqDeviceExtensions);
439-
if (mDisplay->param()->par.debugLevel >= 2) {
439+
if (mDisplay->GetProcessingSettings().debugLevel >= 2) {
440440
vk::PhysicalDeviceProperties deviceProperties = devices[i].getProperties();
441441
GPUInfo("Available Vulkan device %d: %s - Score %f", i, &deviceProperties.deviceName[0], score);
442442
}
@@ -467,7 +467,7 @@ void GPUDisplayBackendVulkan::createDevice()
467467
mStencilSupported = (bool)(depth64FormatProperties.optimalTilingFeatures & vk::FormatFeatureFlagBits::eDepthStencilAttachment);
468468
mCubicFilterSupported = (bool)(formatProperties.optimalTilingFeatures & vk::FormatFeatureFlagBits::eSampledImageFilterCubicEXT);
469469
bool mailboxSupported = std::find(mSwapChainDetails.presentModes.begin(), mSwapChainDetails.presentModes.end(), vk::PresentModeKHR::eMailbox) != mSwapChainDetails.presentModes.end();
470-
if (mDisplay->param()->par.debugLevel >= 2) {
470+
if (mDisplay->GetProcessingSettings().debugLevel >= 2) {
471471
GPUInfo("Max MSAA: %d, 32 bit Z buffer %d, 32 bit Z buffer + stencil buffer %d, Cubic Filtering %d, Mailbox present mode %d\n", (int32_t)mMaxMSAAsupported, (int32_t)mZSupported, (int32_t)mStencilSupported, (int32_t)mCubicFilterSupported, (int32_t)mailboxSupported);
472472
}
473473

@@ -1406,7 +1406,7 @@ void GPUDisplayBackendVulkan::clearImage(VulkanImage& image)
14061406

14071407
int32_t GPUDisplayBackendVulkan::InitBackendA()
14081408
{
1409-
mEnableValidationLayers = mDisplay->param() && mDisplay->param()->par.debugLevel >= 2;
1409+
mEnableValidationLayers = mDisplay->param() && mDisplay->GetProcessingSettings().debugLevel >= 2;
14101410
mFramesInFlight = 2;
14111411

14121412
createDevice();

GPU/GPUTracking/display/frontend/GPUDisplayFrontendWayland.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ int32_t GPUDisplayFrontendWayland::FrontendMain()
290290
auto seat_capabilities_c = internal::CCallWrapper<void, wl_seat*, uint32_t>{[seat_capabilities](wl_seat* seat, uint32_t capabilities) { seat_capabilities(seat, capabilities); }};
291291

292292
auto seat_name = [](void* data, struct wl_seat* seat, const char* name) {
293-
if (((GPUDisplayFrontendWayland*)data)->mDisplay->param()->par.debugLevel >= 2) {
293+
if (((GPUDisplayFrontendWayland*)data)->mDisplay->GetProcessingSettings().debugLevel >= 2) {
294294
GPUInfo("Wayland seat: %s", name);
295295
}
296296
};
@@ -300,7 +300,7 @@ int32_t GPUDisplayFrontendWayland::FrontendMain()
300300
};
301301

302302
auto registry_global = [&](wl_registry* registry, uint32_t name, const char* interface, uint32_t version) {
303-
if (mDisplay->param()->par.debugLevel >= 3) {
303+
if (mDisplay->GetProcessingSettings().debugLevel >= 3) {
304304
GPUInfo("Available interface %s", interface);
305305
}
306306
if (strcmp(interface, wl_output_interface.name) == 0) {
@@ -344,7 +344,7 @@ int32_t GPUDisplayFrontendWayland::FrontendMain()
344344

345345
auto xdg_toplevel_handle_configure = [](void* data, xdg_toplevel* toplevel, int32_t width, int32_t height, wl_array* states) {
346346
GPUDisplayFrontendWayland* me = (GPUDisplayFrontendWayland*)data;
347-
if (me->mDisplay->param()->par.debugLevel >= 3) {
347+
if (me->mDisplay->GetProcessingSettings().debugLevel >= 3) {
348348
GPUInfo("Wayland surface resized to %d %d", width, height);
349349
}
350350
me->mWidthRequested = width;

0 commit comments

Comments
 (0)