From d1f01b8486f9f007da97aae3acec0f10690674d2 Mon Sep 17 00:00:00 2001 From: David Steele Date: Mon, 12 Feb 2024 18:42:56 +0000 Subject: [PATCH] Added wait/client wait methods to sync abstraction Note, sync abstraction isn't used by dali-core, but still has a test implementation, so not going to move it to dali-adaptor in this patchset. Change-Id: Iea2b9cb74bcbaffbdf1a181de796010aa371ad03 Signed-off-by: David Steele --- .../dali/dali-test-suite-utils/test-graphics-sync-impl.cpp | 10 ++++++++++ .../dali/dali-test-suite-utils/test-graphics-sync-impl.h | 7 +++++-- .../dali/dali-test-suite-utils/test-graphics-sync-object.h | 5 ++--- dali/integration-api/graphics-sync-abstraction.h | 13 ++++++++++++- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-impl.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-impl.cpp index 17f53a7..bb4a500 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-impl.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-impl.cpp @@ -38,6 +38,16 @@ bool TestSyncObject::IsSynced() return synced; } +void TestSyncObject::Wait() +{ + mTrace.PushCall("SyncObject::Wait", ""); // Trace the method +} + +void TestSyncObject::ClientWait() +{ + mTrace.PushCall("SyncObject::ClientWait", ""); // Trace the method +} + TestGraphicsSyncImplementation::TestGraphicsSyncImplementation() { Initialize(); diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-impl.h b/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-impl.h index cbc5331..21fd358 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-impl.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-impl.h @@ -2,7 +2,7 @@ #define TEST_SYNC_IMPLEMENTATION_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,10 @@ class TestSyncObject : public Integration::GraphicsSyncAbstraction::SyncObject public: TestSyncObject(TraceCallStack& trace); ~TestSyncObject() override; - bool IsSynced() override; + bool IsSynced() override; + void Wait() override; + void ClientWait() override; + bool synced; TraceCallStack& mTrace; }; diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-object.h b/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-object.h index c33de6c..6886687 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-object.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-graphics-sync-object.h @@ -2,7 +2,7 @@ #define DALI_TEST_GRAPHICS_SYNC_OBJECT_H_ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,7 @@ #include #include - -#include +#include "test-graphics-sync-impl.h" namespace Dali { diff --git a/dali/integration-api/graphics-sync-abstraction.h b/dali/integration-api/graphics-sync-abstraction.h index 38bee54..44b24fb 100644 --- a/dali/integration-api/graphics-sync-abstraction.h +++ b/dali/integration-api/graphics-sync-abstraction.h @@ -2,7 +2,7 @@ #define DALI_INTEGRATION_GRAPHICS_SYNC_ABSTRACTION_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,6 +55,17 @@ public: * can now be destroyed) */ virtual bool IsSynced() = 0; + + /** + * Wait in the GPU for the synchronisation object to be signalled (but can timeout) + */ + virtual void Wait() = 0; + + /** + * Wait in the CPU for the synchronisation object to be signalled. + * This will block the render thread - use with caution. + */ + virtual void ClientWait() = 0; }; /** -- 2.7.4