Skip to content

Commit aad202b

Browse files
Add semaphore functions for gx2/dmae
1 parent 2016e42 commit aad202b

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

include/dmae/sync.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22
#include <wut.h>
3+
#include <gx2/semaphore.h>
34

45
/**
56
* \defgroup dmae_sync Synchronization
@@ -14,6 +15,12 @@ extern "C" {
1415
//! Timestamp for a DMAE operation.
1516
typedef uint64_t DMAETimeStamp;
1617

18+
DMAETimeStamp
19+
DMAEGetLastSubmittedTimeStamp(void);
20+
21+
DMAETimeStamp
22+
DMAEGetRetiredTimeStamp(void);
23+
1724
/**
1825
* Waits for a DMAE operation to complete.
1926
*
@@ -26,6 +33,16 @@ typedef uint64_t DMAETimeStamp;
2633
BOOL
2734
DMAEWaitDone(DMAETimeStamp timestamp);
2835

36+
uint32_t
37+
DMAEGetTimeout(void);
38+
39+
void
40+
DMAESetTimeout(uint32_t timeout);
41+
42+
void
43+
DMAESemaphore(GX2Semaphore *semaphore,
44+
GX2SemaphoreAction action);
45+
2946
#ifdef __cplusplus
3047
}
3148
#endif

include/gx2/enum.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,12 @@ typedef enum GX2ScanTarget
348348

349349
WUT_ENUM_BITMASK_TYPE(GX2ScanTarget)
350350

351+
typedef enum GX2SemaphoreAction
352+
{
353+
GX2_SEMAPHORE_ACTION_WAIT = 0,
354+
GX2_SEMAPHORE_ACTION_SIGNAL = 1,
355+
} GX2SemaphoreAction;
356+
351357
typedef enum GX2ShaderMode
352358
{
353359
GX2_SHADER_MODE_UNIFORM_REGISTER = 0,

include/gx2/semaphore.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#pragma once
2+
#include <wut.h>
3+
#include "enum.h"
4+
5+
/**
6+
* \defgroup gx2_semaphore Semaphore
7+
* \ingroup gx2
8+
* @{
9+
*/
10+
11+
#ifdef __cplusplus
12+
extern "C" {
13+
#endif
14+
15+
typedef uint64_t GX2Semaphore;
16+
17+
/**
18+
* Inserts a semaphore into the command stream.
19+
*
20+
* \param semaphore
21+
* Address of the semaphore. Must be aligned by \c 0x8.
22+
*
23+
* \param action
24+
* Semaphore operation to perform.
25+
*/
26+
void
27+
GX2SetSemaphore(GX2Semaphore *semaphore,
28+
GX2SemaphoreAction action);
29+
30+
#ifdef __cplusplus
31+
}
32+
#endif
33+
34+
/** @} */

0 commit comments

Comments
 (0)