mirror of
https://dev.lirent.ru/Vatrog/vm-automation-signaling.git
synced 2026-06-25 20:36:36 +03:00
29 lines
1.2 KiB
C
29 lines
1.2 KiB
C
|
|
#ifndef VGPU_REGION_H
|
||
|
|
#define VGPU_REGION_H
|
||
|
|
|
||
|
|
/* region.h — win32 pinned contract region (resolves blocks for the region-view). */
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
#include "vgpu_stream.h" /* public contract: blocks, offsets, slot geometry */
|
||
|
|
|
||
|
|
/*
|
||
|
|
* One contiguous 2 MiB-aligned pinned region holding the full contract:
|
||
|
|
* producer block (page 0), control block (page 1), then SLOT_COUNT frame slots
|
||
|
|
* starting at VGPU_RING_OFFSET. Object = memory: the region owns the mapping,
|
||
|
|
* its lifetime is the mapping's lifetime. No hidden global state.
|
||
|
|
*/
|
||
|
|
typedef struct {
|
||
|
|
void* os_base; /* raw allocation base (for free) */
|
||
|
|
uint8_t* base; /* 2 MiB-aligned region base (== contract origin) */
|
||
|
|
uint64_t os_total; /* bytes reserved at os_base */
|
||
|
|
vgpu_producer_t* producer; /* base + VGPU_PRODUCER_OFFSET */
|
||
|
|
vgpu_control_t* control; /* base + VGPU_CONTROL_OFFSET */
|
||
|
|
uint8_t* ring; /* base + VGPU_RING_OFFSET */
|
||
|
|
} vgpu_region_t;
|
||
|
|
|
||
|
|
/* Returns 0 on success, non-zero on failure (region zeroed on failure). */
|
||
|
|
int vgpu_region_create(vgpu_region_t* out);
|
||
|
|
void vgpu_region_destroy(vgpu_region_t* r);
|
||
|
|
|
||
|
|
#endif /* VGPU_REGION_H */
|