Checkpoint commit. Buffer object flags and IOCTL argument list.
[profile/ivi/libdrm.git] / libdrm / xf86mm.h
1 /**************************************************************************
2  * 
3  * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND. USA.
4  * All Rights Reserved.
5  * 
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  * 
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 
18  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
19  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
20  * USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * The above copyright notice and this permission notice (including the
23  * next paragraph) shall be included in all copies or substantial portions
24  * of the Software.
25  * 
26  * 
27  **************************************************************************/
28
29 #ifndef _XF86MM_H_
30 #define _XF86MM_H_
31 #include <stddef.h>
32
33
34 /*
35  * List macros heavily inspired by the Linux kernel
36  * list handling. No list looping yet.
37  */
38
39 typedef struct _drmMMListHead
40 {
41     struct _drmMMListHead *prev;
42     struct _drmMMListHead *next;
43 } DrmMMListHead;
44
45 #define DRMINITLISTHEAD(__item)                \
46   do{                                          \
47     (__item)->prev = (__item);                 \
48     (__item)->next = (__item);                 \
49   } while (0)
50
51 #define DRMLISTADD(__item, __list)                      \
52   do {                                          \
53     (__item)->prev = (__list);                  \
54     (__item)->next = (__list)->next;            \
55     (__list)->next->prev = (__item);            \
56     (__list)->next = (__item);                  \
57   } while (0)
58
59 #define DRMLISTADDTAIL(__item, __list)          \
60   do {                                          \
61     (__item)->next = (__list);                  \
62     (__item)->prev = (__list)->prev;            \
63     (__list)->prev->next = (__item);            \
64     (__list)->prev = (__item);                  \
65   } while(0)
66
67 #define DRMLISTDEL(__item)                      \
68   do {                                          \
69     (__item)->prev->next = (__item)->next;      \
70     (__item)->next->prev = (__item)->prev;      \
71   } while(0)
72
73 #define DRMLISTDELINIT(__item)                  \
74   do {                                          \
75     (__item)->prev->next = (__item)->next;      \
76     (__item)->next->prev = (__item)->prev;      \
77     (__item)->next = (__item);                  \
78     (__item)->prev = (__item);                  \
79   } while(0)
80
81 #define DRMLISTENTRY(__type, __item, __field)   \
82     ((__type *)(((char *) (__item)) - offsetof(__type, __field)))
83
84
85 typedef struct _DrmBuf{
86     unsigned handle;
87 } DrmBuf;
88
89
90 typedef struct _DrmBufNode {
91     DrmMMListHead head;
92     DrmBuf *buf;
93     drm_bo_arg_t bo_arg;
94 } DrmBufNode;
95
96 typedef struct _DrmMMBufList {
97     unsigned numTarget;
98     unsigned numCurrent;
99     unsigned numOnList;
100     DrmMMListHead list;
101     DrmMMListHead free;
102 } DrmBufList;
103
104
105 #endif