summaryrefslogtreecommitdiff
path: root/src/qxl_mem.h
blob: 8be31f702a90209a9973e9bd797ca210707f505e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

#ifndef QXL_MEM_H
#define QXL_MEM_H

struct qxl_mem;

struct qxl_mem *  qxl_mem_create       (void                   *base,
					unsigned long           n_bytes);

void *            qxl_alloc            (struct qxl_mem         *mem,
					unsigned long           n_bytes,
					const char *            name);

void              qxl_free             (struct qxl_mem         *mem,
					void                   *d,
					const char *            name);


#pragma pack(push,1)

struct qxl_ring_header {
    uint32_t num_items;
    uint32_t prod;
    uint32_t notify_on_prod;
    uint32_t cons;
    uint32_t notify_on_cons;
};

#pragma pack(pop)
/*
 * Rings
 */
struct qxl_ring * qxl_ring_create      (struct qxl_ring_header *header,
					int                     element_size,
					int                     n_elements,
					int                     prod_notify,
					void *qxl);
void              qxl_ring_push        (struct qxl_ring        *ring,
					const void             *element);
Bool              qxl_ring_pop         (struct qxl_ring        *ring,
					void                   *element);
void              qxl_ring_wait_idle   (struct qxl_ring        *ring);

void              qxl_ring_request_notify (struct qxl_ring *ring);

int               qxl_ring_prod        (struct qxl_ring        *ring);
int               qxl_ring_cons        (struct qxl_ring        *ring);

#endif