ws_dri_bufpool.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  */
00031 
00032 #ifndef _PSB_BUFPOOL_H_
00033 #define _PSB_BUFPOOL_H_
00034 
00035 #include <xf86drm.h>
00036 #include "pipe/p_thread.h"
00037 struct _DriFenceObject;
00038 
00039 typedef struct _DriBufferPool
00040 {
00041    int fd;
00042    int (*map) (struct _DriBufferPool * pool, void *private,
00043                unsigned flags, int hint, pipe_mutex *mutex,
00044                void **virtual);
00045    int (*unmap) (struct _DriBufferPool * pool, void *private);
00046    int (*destroy) (struct _DriBufferPool * pool, void *private);
00047    unsigned long (*offset) (struct _DriBufferPool * pool, void *private);
00048    unsigned long (*poolOffset) (struct _DriBufferPool * pool, void *private);
00049    uint64_t (*flags) (struct _DriBufferPool * pool, void *private);
00050    unsigned long (*size) (struct _DriBufferPool * pool, void *private);
00051    void *(*create) (struct _DriBufferPool * pool, unsigned long size,
00052                     uint64_t flags, unsigned hint, unsigned alignment);
00053    void *(*reference) (struct _DriBufferPool * pool, unsigned handle);
00054    int (*unreference) (struct _DriBufferPool * pool, void *private);
00055    int (*fence) (struct _DriBufferPool * pool, void *private,
00056                  struct _DriFenceObject * fence);
00057    drmBO *(*kernel) (struct _DriBufferPool * pool, void *private);
00058    int (*validate) (struct _DriBufferPool * pool, void *private, pipe_mutex *mutex);
00059    int (*waitIdle) (struct _DriBufferPool *pool, void *private, pipe_mutex *mutex,
00060                     int lazy);
00061    int (*setStatus)  (struct _DriBufferPool *pool, void *private,
00062                       uint64_t flag_diff, uint64_t old_flags);
00063    void (*takeDown) (struct _DriBufferPool * pool);
00064    void *data;
00065 } DriBufferPool;
00066 
00067 extern void bmError(int val, const char *file, const char *function,
00068                     int line);
00069 #define BM_CKFATAL(val)                                        \
00070   do{                                                          \
00071     int tstVal = (val);                                        \
00072     if (tstVal)                                                \
00073       bmError(tstVal, __FILE__, __FUNCTION__, __LINE__);       \
00074   } while(0);
00075 
00076 
00077 /*
00078  * Builtin pools.
00079  */
00080 
00081 /*
00082  * Kernel buffer objects. Size in multiples of page size. Page size aligned.
00083  */
00084 
00085 extern struct _DriBufferPool *driDRMPoolInit(int fd);
00086 extern struct _DriBufferPool *driMallocPoolInit(void);
00087 
00088 struct _DriFreeSlabManager;
00089 extern struct _DriBufferPool * driSlabPoolInit(int fd, uint64_t flags,
00090                                                uint64_t validMask,
00091                                                uint32_t smallestSize,
00092                                                uint32_t numSizes,
00093                                                uint32_t desiredNumBuffers,
00094                                                uint32_t maxSlabSize,
00095                                                uint32_t pageAlignment,
00096                                                struct _DriFreeSlabManager *fMan);
00097 extern void driFinishFreeSlabManager(struct _DriFreeSlabManager *fMan);
00098 extern struct _DriFreeSlabManager *
00099 driInitFreeSlabManager(uint32_t checkIntervalMsec, uint32_t slabTimeoutMsec);
00100 
00101 
00102 #endif

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