1 /**************************************************************************
3 * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND. USA.
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:
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.
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
27 **************************************************************************/
35 * List macros heavily inspired by the Linux kernel
36 * list handling. No list looping yet.
39 typedef struct _drmMMListHead
41 struct _drmMMListHead *prev;
42 struct _drmMMListHead *next;
45 #define DRMINITLISTHEAD(__item) \
47 (__item)->prev = (__item); \
48 (__item)->next = (__item); \
51 #define DRMLISTADD(__item, __list) \
53 (__item)->prev = (__list); \
54 (__item)->next = (__list)->next; \
55 (__list)->next->prev = (__item); \
56 (__list)->next = (__item); \
59 #define DRMLISTADDTAIL(__item, __list) \
61 (__item)->next = (__list); \
62 (__item)->prev = (__list)->prev; \
63 (__list)->prev->next = (__item); \
64 (__list)->prev = (__item); \
67 #define DRMLISTDEL(__item) \
69 (__item)->prev->next = (__item)->next; \
70 (__item)->next->prev = (__item)->prev; \
73 #define DRMLISTDELINIT(__item) \
75 (__item)->prev->next = (__item)->next; \
76 (__item)->next->prev = (__item)->prev; \
77 (__item)->next = (__item); \
78 (__item)->prev = (__item); \
81 #define DRMLISTENTRY(__type, __item, __field) \
82 ((__type *)(((char *) (__item)) - offsetof(__type, __field)))
85 typedef struct _drmBO{
88 drm_handle_t map_handle;
103 typedef struct _drmBONode {
109 typedef struct _drmBOList {
117 extern int drmBOCreate(int fd, drmTTM *ttm, unsigned long start, unsigned long size,
118 void *user_buffer, drm_bo_type_t type, unsigned mask,
119 unsigned hint, drmBO *buf);
120 extern int drmBODestroy(int fd, drmBO *buf);
121 extern int drmBOReference(int fd, unsigned handle, drmBO *buf);
122 extern int drmBOUnReference(int fd, drmBO *buf);