01f149ae4ed6819a7c250abd1075d51203ca9bf7
[mesa.git] / src / mesa / drivers / dri / common / dri_bufmgr.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 * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
30 * Keith Whitwell <keithw-at-tungstengraphics-dot-com>
31 */
32
33 #ifndef _DRI_BUFMGR_H_
34 #define _DRI_BUFMGR_H_
35 #include <xf86drm.h>
36
37
38 struct _DriFenceObject;
39 struct _DriBufferObject;
40 struct _DriBufferPool;
41
42 extern struct _DriFenceObject *driFenceBuffers(int fd, char *name,
43 unsigned flags);
44
45 extern struct _DriFenceObject *driFenceReference(struct _DriFenceObject *fence);
46
47 extern void driFenceUnReference(struct _DriFenceObject *fence);
48
49 extern void
50 driFenceFinish(struct _DriFenceObject *fence, unsigned type, int lazy);
51
52 extern int driFenceSignaled(struct _DriFenceObject *fence, unsigned type);
53 extern unsigned driFenceType(struct _DriFenceObject *fence);
54
55 /*
56 * Return a pointer to the libdrm buffer object this DriBufferObject
57 * uses.
58 */
59
60 extern drmBO *driBOKernel(struct _DriBufferObject *buf);
61 extern void *driBOMap(struct _DriBufferObject *buf, unsigned flags,
62 unsigned hint);
63 extern void driBOUnmap(struct _DriBufferObject *buf);
64 extern unsigned long driBOOffset(struct _DriBufferObject *buf);
65 extern unsigned driBOFlags(struct _DriBufferObject *buf);
66 extern struct _DriBufferObject *driBOReference(struct _DriBufferObject *buf);
67 extern void driBOUnReference(struct _DriBufferObject *buf);
68 extern void driBOData(struct _DriBufferObject *r_buf,
69 unsigned size, const void *data, unsigned flags);
70 extern void driBOSubData(struct _DriBufferObject *buf,
71 unsigned long offset, unsigned long size,
72 const void *data);
73 extern void driBOGetSubData(struct _DriBufferObject *buf,
74 unsigned long offset, unsigned long size,
75 void *data);
76 extern void driGenBuffers(struct _DriBufferPool *pool,
77 const char *name,
78 unsigned n,
79 struct _DriBufferObject *buffers[],
80 unsigned alignment, unsigned flags, unsigned hint);
81 extern void driDeleteBuffers(unsigned n, struct _DriBufferObject *buffers[]);
82 extern void driInitBufMgr(int fd);
83 extern void driBOCreateList(int target, drmBOList * list);
84 extern void driBOResetList(drmBOList * list);
85 extern void driBOAddListItem(drmBOList * list, struct _DriBufferObject *buf,
86 unsigned flags, unsigned mask);
87 extern void driBOValidateList(int fd, drmBOList * list);
88
89 extern void driBOFence(struct _DriBufferObject *buf,
90 struct _DriFenceObject *fence);
91
92 extern void driPoolTakeDown(struct _DriBufferPool *pool);
93 extern void driBOSetStatic(struct _DriBufferObject *buf,
94 unsigned long offset,
95 unsigned long size, void *virtual, unsigned flags);
96 extern void driBOWaitIdle(struct _DriBufferObject *buf, int lazy);
97 extern void driPoolTakeDown(struct _DriBufferPool *pool);
98
99 #endif