nouveau/mme: Make the winsys headers C++ safe

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand 2023-01-30 20:11:57 -06:00 committed by Marge Bot
parent 58b9108468
commit e4b936d817
4 changed files with 42 additions and 3 deletions

View file

@ -5,8 +5,19 @@
#include "nouveau_device.h"
#ifdef __cplusplus
#include <atomic>
using std::atomic_uint_fast32_t;
#else
#include <stdatomic.h>
#endif
#include <sys/mman.h>
#ifdef __cplusplus
extern "C" {
#endif
enum nouveau_ws_bo_flags {
/* vram or gart depending on GPU */
NOUVEAU_WS_BO_LOCAL = 0 << 0,
@ -27,7 +38,7 @@ struct nouveau_ws_bo {
int fd;
uint32_t handle;
enum nouveau_ws_bo_flags flags;
_Atomic uint32_t refcnt;
atomic_uint_fast32_t refcnt;
};
struct nouveau_ws_bo *nouveau_ws_bo_new(struct nouveau_ws_device *,
@ -54,4 +65,8 @@ nouveau_ws_bo_unmap(struct nouveau_ws_bo *bo, void *ptr)
munmap(ptr, bo->size);
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -3,6 +3,10 @@
#include "nouveau_private.h"
#ifdef __cplusplus
extern "C" {
#endif
struct nouveau_ws_device;
struct nouveau_ws_object {
@ -25,4 +29,8 @@ int nouveau_ws_context_create(struct nouveau_ws_device *, struct nouveau_ws_cont
bool nouveau_ws_context_killed(struct nouveau_ws_context *);
void nouveau_ws_context_destroy(struct nouveau_ws_context *);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -5,6 +5,10 @@
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
enum nvk_debug {
/* dumps all push buffers after submission */
NVK_DEBUG_PUSH_DUMP = 1ull << 0,
@ -61,4 +65,8 @@ struct nouveau_ws_device {
struct nouveau_ws_device *nouveau_ws_device_new(int fd);
void nouveau_ws_device_destroy(struct nouveau_ws_device *);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,11 +1,15 @@
#ifndef NOUVEAU_CMD_BUF
#define NOUVEAU_CMD_BUF 1
#ifndef NOUVEAU_PUSH
#define NOUVEAU_PUSH 1
#include "nouveau_private.h"
#include "nouveau_bo.h"
#include "util/u_dynarray.h"
#ifdef __cplusplus
extern "C" {
#endif
struct nouveau_ws_context;
struct nouveau_ws_device;
@ -259,4 +263,8 @@ P_SPACE(struct nouveau_ws_push *push, uint32_t size)
return nouveau_ws_push_space(push, size);
}
#ifdef __cplusplus
}
#endif
#endif /* NOUVEAU_PUSH */