ws_dri_bufmgr.h

Go to the documentation of this file.
00001 /**************************************************************************
00002  *
00003  * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
00004  * All Rights Reserved.
00005  *
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation the rights to use, copy, modify, merge, publish,
00010  * distribute, sub license, and/or sell copies of the Software, and to
00011  * permit persons to whom the Software is furnished to do so, subject to
00012  * the following conditions:
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
00017  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
00018  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
00019  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
00020  * USE OR OTHER DEALINGS IN THE SOFTWARE.
00021  *
00022  * The above copyright notice and this permission notice (including the
00023  * next paragraph) shall be included in all copies or substantial portions
00024  * of the Software.
00025  *
00026  *
00027  **************************************************************************/
00028 /*
00029  * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
00030  *          Keith Whitwell <keithw-at-tungstengraphics-dot-com>
00031  */
00032 
00033 #ifndef _PSB_BUFMGR_H_
00034 #define _PSB_BUFMGR_H_
00035 #include <xf86mm.h>
00036 #include "i915_drm.h"
00037 #include "ws_dri_fencemgr.h"
00038 
00039 typedef struct _drmBONode
00040 {
00041     drmMMListHead head;
00042     drmBO *buf;
00043     struct drm_i915_op_arg bo_arg;
00044     uint64_t arg0;
00045     uint64_t arg1;
00046 } drmBONode;
00047 
00048 typedef struct _drmBOList {
00049     unsigned numTarget;
00050     unsigned numCurrent;
00051     unsigned numOnList;
00052     drmMMListHead list;
00053     drmMMListHead free;
00054 } drmBOList;
00055 
00056 
00057 struct _DriFenceObject;
00058 struct _DriBufferObject;
00059 struct _DriBufferPool;
00060 struct _DriBufferList;
00061 
00062 /*
00063  * Return a pointer to the libdrm buffer object this DriBufferObject
00064  * uses.
00065  */
00066 
00067 extern drmBO *driBOKernel(struct _DriBufferObject *buf);
00068 extern void *driBOMap(struct _DriBufferObject *buf, unsigned flags,
00069                       unsigned hint);
00070 extern void driBOUnmap(struct _DriBufferObject *buf);
00071 extern unsigned long driBOOffset(struct _DriBufferObject *buf);
00072 extern unsigned long driBOPoolOffset(struct _DriBufferObject *buf);
00073 
00074 extern uint64_t driBOFlags(struct _DriBufferObject *buf);
00075 extern struct _DriBufferObject *driBOReference(struct _DriBufferObject *buf);
00076 extern void driBOUnReference(struct _DriBufferObject *buf);
00077 
00078 extern int driBOData(struct _DriBufferObject *r_buf,
00079                      unsigned size, const void *data,
00080                      struct _DriBufferPool *pool, uint64_t flags);
00081 
00082 extern void driBOSubData(struct _DriBufferObject *buf,
00083                          unsigned long offset, unsigned long size,
00084                          const void *data);
00085 extern void driBOGetSubData(struct _DriBufferObject *buf,
00086                             unsigned long offset, unsigned long size,
00087                             void *data);
00088 extern int driGenBuffers(struct _DriBufferPool *pool,
00089                          const char *name,
00090                          unsigned n,
00091                          struct _DriBufferObject *buffers[],
00092                          unsigned alignment, uint64_t flags, unsigned hint);
00093 extern void driGenUserBuffer(struct _DriBufferPool *pool,
00094                              const char *name,
00095                              struct _DriBufferObject *buffers[],
00096                              void *ptr, unsigned bytes);
00097 extern void driDeleteBuffers(unsigned n, struct _DriBufferObject *buffers[]);
00098 extern void driInitBufMgr(int fd);
00099 extern struct _DriBufferList *driBOCreateList(int target);
00100 extern int driBOResetList(struct _DriBufferList * list);
00101 extern void driBOAddListItem(struct _DriBufferList * list,
00102                              struct _DriBufferObject *buf,
00103                              uint64_t flags, uint64_t mask, int *itemLoc,
00104                              struct _drmBONode **node);
00105 
00106 extern void driBOValidateList(int fd, struct _DriBufferList * list);
00107 extern void driBOFreeList(struct _DriBufferList * list);
00108 extern struct _DriFenceObject *driBOFenceUserList(struct _DriFenceMgr *mgr,
00109                                                   struct _DriBufferList *list,
00110                                                   const char *name,
00111                                                   drmFence *kFence);
00112 extern void driBOUnrefUserList(struct _DriBufferList *list);
00113 extern void driBOValidateUserList(struct _DriBufferList * list);
00114 extern drmBOList *driGetdrmBOList(struct _DriBufferList *list);
00115 extern void driPutdrmBOList(struct _DriBufferList *list);
00116 
00117 extern void driBOFence(struct _DriBufferObject *buf,
00118                        struct _DriFenceObject *fence);
00119 
00120 extern void driPoolTakeDown(struct _DriBufferPool *pool);
00121 extern void driBOSetReferenced(struct _DriBufferObject *buf,
00122                                unsigned long handle);
00123 unsigned long driBOSize(struct _DriBufferObject *buf);
00124 extern void driBOWaitIdle(struct _DriBufferObject *buf, int lazy);
00125 extern void driPoolTakeDown(struct _DriBufferPool *pool);
00126 
00127 extern void driReadLockKernelBO(void);
00128 extern void driReadUnlockKernelBO(void);
00129 extern void driWriteLockKernelBO(void);
00130 extern void driWriteUnlockKernelBO(void);
00131 
00132 /*
00133  * For debugging purposes.
00134  */
00135 
00136 extern drmBOList *driBOGetDRMBuffers(struct _DriBufferList *list);
00137 extern drmBOList *driBOGetDRIBuffers(struct _DriBufferList *list);
00138 #endif

Generated on Tue Sep 29 06:25:17 2009 for Gallium3D by  doxygen 1.5.4