~ubuntu-branches/ubuntu/karmic/virtualbox-ose/karmic-updates

« back to all changes in this revision

Viewing changes to src/VBox/Additions/x11/x11include/libdrm-2.3.0/xf86mm.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-09-14 18:25:07 UTC
  • mfrom: (0.4.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090914182507-c98g07mq16hjmn6d
Tags: 3.0.6-dfsg-1ubuntu1
* Merge from debian unstable (LP: #429697), remaining changes:
  - Enable DKMS support on virtualbox host and guest modules (LP: #267097)
    - Drop virtualbox-ose{-guest,}-modules-* package templates
    - Recommend *-source instead of *-modules packages
    - Replace error messages related to missing/mismatched
      kernel module accordingly
  - Autoload kernel module
    - LOAD_VBOXDRV_MODULE=1 in virtualbox-ose.default
  - Disable update action
    - patches/u01-disable-update-action.dpatch
  - Virtualbox should go in Accessories, not in System tools (LP: #288590)
    - virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add apport hook
    - virtualbox-ose.files/source_virtualbox-ose.py
    - virtualbox-ose.install
  - Add launchpad integration
    - control
    - lpi-bug.xpm
    - patches/u02-lp-integration.dpatch
  - virtualbox, virtualbox-* (names of the upstream proprietary packages)
    conflict with virtualbox-ose (LP: #379878)
* Make debug package depend on normal or guest utils package
* Drop patches/22-pulseaudio-stubs.dpatch (applied upstream)
* Rename Ubuntu specific patches to uXX-*.dpatch
* Fix lintian warnings in maintainer scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
#include "drm.h"
33
 
 
34
 
/*
35
 
 * Note on multithreaded applications using this interface.
36
 
 * Libdrm is not threadsafe, so common buffer, TTM, and fence objects need to
37
 
 * be protected using an external mutex.
38
 
 *
39
 
 * Note: Don't protect the following functions, as it may lead to deadlocks:
40
 
 * drmBOUnmap(), drmFenceBuffers().
41
 
 * The kernel is synchronizing and refcounting buffer maps. 
42
 
 * User space only needs to refcount object usage within the same application.
43
 
 */
44
 
 
45
 
 
46
 
/*
47
 
 * List macros heavily inspired by the Linux kernel
48
 
 * list handling. No list looping yet.
49
 
 */
50
 
 
51
 
typedef struct _drmMMListHead
52
 
{
53
 
    struct _drmMMListHead *prev;
54
 
    struct _drmMMListHead *next;
55
 
} drmMMListHead;
56
 
 
57
 
#define DRMINITLISTHEAD(__item)                \
58
 
  do{                                          \
59
 
    (__item)->prev = (__item);                 \
60
 
    (__item)->next = (__item);                 \
61
 
  } while (0)
62
 
 
63
 
#define DRMLISTADD(__item, __list)                      \
64
 
  do {                                          \
65
 
    (__item)->prev = (__list);                  \
66
 
    (__item)->next = (__list)->next;            \
67
 
    (__list)->next->prev = (__item);            \
68
 
    (__list)->next = (__item);                  \
69
 
  } while (0)
70
 
 
71
 
#define DRMLISTADDTAIL(__item, __list)          \
72
 
  do {                                          \
73
 
    (__item)->next = (__list);                  \
74
 
    (__item)->prev = (__list)->prev;            \
75
 
    (__list)->prev->next = (__item);            \
76
 
    (__list)->prev = (__item);                  \
77
 
  } while(0)
78
 
 
79
 
#define DRMLISTDEL(__item)                      \
80
 
  do {                                          \
81
 
    (__item)->prev->next = (__item)->next;      \
82
 
    (__item)->next->prev = (__item)->prev;      \
83
 
  } while(0)
84
 
 
85
 
#define DRMLISTDELINIT(__item)                  \
86
 
  do {                                          \
87
 
    (__item)->prev->next = (__item)->next;      \
88
 
    (__item)->next->prev = (__item)->prev;      \
89
 
    (__item)->next = (__item);                  \
90
 
    (__item)->prev = (__item);                  \
91
 
  } while(0)
92
 
 
93
 
#define DRMLISTENTRY(__type, __item, __field)   \
94
 
    ((__type *)(((char *) (__item)) - offsetof(__type, __field)))
95
 
 
96
 
typedef struct _drmFence{
97
 
        unsigned handle;
98
 
        int class;
99
 
        unsigned type; 
100
 
        unsigned flags;
101
 
        unsigned signaled;
102
 
        unsigned pad[4]; /* for future expansion */
103
 
} drmFence;
104
 
 
105
 
typedef struct _drmBO{
106
 
    drm_bo_type_t type;
107
 
    unsigned handle;
108
 
    drm_u64_t mapHandle;
109
 
    unsigned flags;
110
 
    unsigned mask;
111
 
    unsigned mapFlags;
112
 
    unsigned long size;
113
 
    unsigned long offset;
114
 
    unsigned long start;
115
 
    unsigned replyFlags;
116
 
    unsigned fenceFlags;
117
 
    unsigned pageAlignment;
118
 
    void *virtual;
119
 
    void *mapVirtual;
120
 
    int mapCount;
121
 
    unsigned pad[8];     /* for future expansion */
122
 
} drmBO;
123
 
 
124
 
 
125
 
typedef struct _drmBONode {
126
 
    drmMMListHead head;
127
 
    drmBO *buf;
128
 
    drm_bo_arg_t bo_arg;
129
 
    unsigned long arg0;
130
 
    unsigned long arg1;
131
 
} drmBONode;
132
 
 
133
 
typedef struct _drmBOList {
134
 
    unsigned numTarget;
135
 
    unsigned numCurrent;
136
 
    unsigned numOnList;
137
 
    drmMMListHead list;
138
 
    drmMMListHead free;
139
 
} drmBOList;
140
 
 
141
 
/* Fencing */
142
 
 
143
 
extern int           drmFenceCreate(int fd, unsigned flags, int class,
144
 
                                    unsigned type, 
145
 
                                    drmFence *fence);
146
 
extern int           drmFenceDestroy(int fd, const drmFence *fence);
147
 
extern int           drmFenceReference(int fd, unsigned handle, drmFence *fence);
148
 
extern int           drmFenceUnreference(int fd, const drmFence *fence);
149
 
extern int           drmFenceFlush(int fd, drmFence *fence, unsigned flush_type);
150
 
extern int           drmFenceSignaled(int fd, drmFence *fence, 
151
 
                                      unsigned fenceType, int *signaled);
152
 
extern int           drmFenceWait(int fd, unsigned flags, drmFence *fence, 
153
 
                                  unsigned flush_type);
154
 
extern int           drmFenceEmit(int fd, unsigned flags, drmFence *fence, 
155
 
                                  unsigned emit_type);
156
 
extern int           drmFenceBuffers(int fd, unsigned flags, drmFence *fence);
157
 
 
158
 
 
159
 
/*
160
 
 * Buffer object list functions.
161
 
 */
162
 
 
163
 
extern void drmBOFreeList(drmBOList *list);
164
 
extern int drmBOResetList(drmBOList *list);
165
 
extern void *drmBOListIterator(drmBOList *list);
166
 
extern void *drmBOListNext(drmBOList *list, void *iterator);
167
 
extern drmBO *drmBOListBuf(void *iterator);
168
 
extern int drmBOCreateList(int numTarget, drmBOList *list);
169
 
 
170
 
/*
171
 
 * Buffer object functions.
172
 
 */
173
 
 
174
 
extern int drmBOCreate(int fd, unsigned long start, unsigned long size,
175
 
                       unsigned pageAlignment,void *user_buffer, 
176
 
                       drm_bo_type_t type, unsigned mask,
177
 
                       unsigned hint, drmBO *buf);
178
 
extern int drmBODestroy(int fd, drmBO *buf);
179
 
extern int drmBOReference(int fd, unsigned handle, drmBO *buf);
180
 
extern int drmBOUnReference(int fd, drmBO *buf);
181
 
extern int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint,
182
 
                    void **address);
183
 
extern int drmBOUnmap(int fd, drmBO *buf);
184
 
extern int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask, 
185
 
                         unsigned hint);
186
 
extern int drmBOFence(int fd, drmBO *buf, unsigned flags, unsigned fenceHandle);
187
 
extern int drmBOInfo(int fd, drmBO *buf);
188
 
extern int drmBOBusy(int fd, drmBO *buf, int *busy);
189
 
 
190
 
 
191
 
extern int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags, 
192
 
                       unsigned mask,
193
 
                       int *newItem);
194
 
extern int drmBOValidateList(int fd, drmBOList *list);
195
 
extern int drmBOFenceList(int fd, drmBOList *list, unsigned fenceHandle);
196
 
extern int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint);
197
 
 
198
 
/*
199
 
 * Initialization functions.
200
 
 */
201
 
 
202
 
extern int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize,
203
 
                     unsigned memType);
204
 
extern int drmMMTakedown(int fd, unsigned memType);
205
 
extern int drmMMLock(int fd, unsigned memType);
206
 
extern int drmMMUnlock(int fd, unsigned memType);
207
 
 
208
 
 
209
 
#endif