Go to the source code of this file.
Functions | |
static void * | pool_create (struct _DriBufferPool *pool, unsigned long size, uint64_t flags, unsigned hint, unsigned alignment) |
static void * | pool_reference (struct _DriBufferPool *pool, unsigned handle) |
static int | pool_destroy (struct _DriBufferPool *pool, void *private) |
static int | pool_unreference (struct _DriBufferPool *pool, void *private) |
static int | pool_map (struct _DriBufferPool *pool, void *private, unsigned flags, int hint, pipe_mutex *mutex, void **virtual) |
static int | pool_unmap (struct _DriBufferPool *pool, void *private) |
static unsigned long | pool_offset (struct _DriBufferPool *pool, void *private) |
static unsigned long | pool_poolOffset (struct _DriBufferPool *pool, void *private) |
static uint64_t | pool_flags (struct _DriBufferPool *pool, void *private) |
static unsigned long | pool_size (struct _DriBufferPool *pool, void *private) |
static int | pool_fence (struct _DriBufferPool *pool, void *private, struct _DriFenceObject *fence) |
static drmBO * | pool_kernel (struct _DriBufferPool *pool, void *private) |
static int | pool_waitIdle (struct _DriBufferPool *pool, void *private, pipe_mutex *mutex, int lazy) |
static void | pool_takedown (struct _DriBufferPool *pool) |
struct _DriBufferPool * | driDRMPoolInit (int fd) |
struct _DriBufferPool* driDRMPoolInit | ( | int | fd | ) | [read] |
Definition at line 241 of file ws_dri_drmpool.c.
References _DriBufferPool::create, _DriBufferPool::data, _DriBufferPool::destroy, _DriBufferPool::fd, _DriBufferPool::fence, _DriBufferPool::flags, _DriBufferPool::kernel, _DriBufferPool::map, _DriBufferPool::offset, pool_create(), pool_destroy(), pool_fence(), pool_flags(), pool_kernel(), pool_map(), pool_offset(), pool_poolOffset(), pool_reference(), pool_size(), pool_takedown(), pool_unmap(), pool_unreference(), pool_waitIdle(), _DriBufferPool::poolOffset, _DriBufferPool::reference, _DriBufferPool::size, _DriBufferPool::takeDown, _DriBufferPool::unmap, _DriBufferPool::unreference, _DriBufferPool::validate, and _DriBufferPool::waitIdle.
00242 { 00243 struct _DriBufferPool *pool; 00244 00245 pool = (struct _DriBufferPool *) malloc(sizeof(*pool)); 00246 00247 if (!pool) 00248 return NULL; 00249 00250 pool->fd = fd; 00251 pool->map = &pool_map; 00252 pool->unmap = &pool_unmap; 00253 pool->destroy = &pool_destroy; 00254 pool->offset = &pool_offset; 00255 pool->poolOffset = &pool_poolOffset; 00256 pool->flags = &pool_flags; 00257 pool->size = &pool_size; 00258 pool->create = &pool_create; 00259 pool->fence = &pool_fence; 00260 pool->kernel = &pool_kernel; 00261 pool->validate = NULL; 00262 pool->waitIdle = &pool_waitIdle; 00263 pool->takeDown = &pool_takedown; 00264 pool->reference = &pool_reference; 00265 pool->unreference = &pool_unreference; 00266 pool->data = NULL; 00267 return pool; 00268 }
static void* pool_create | ( | struct _DriBufferPool * | pool, | |
unsigned long | size, | |||
uint64_t | flags, | |||
unsigned | hint, | |||
unsigned | alignment | |||
) | [static] |
Definition at line 44 of file ws_dri_drmpool.c.
References _DriBufferPool::fd.
00047 { 00048 drmBO *buf = (drmBO *) malloc(sizeof(*buf)); 00049 int ret; 00050 unsigned pageSize = getpagesize(); 00051 00052 if (!buf) 00053 return NULL; 00054 00055 if ((alignment > pageSize) && (alignment % pageSize)) { 00056 free(buf); 00057 return NULL; 00058 } 00059 00060 ret = drmBOCreate(pool->fd, size, alignment / pageSize, 00061 NULL, 00062 flags, hint, buf); 00063 if (ret) { 00064 free(buf); 00065 return NULL; 00066 } 00067 00068 return (void *) buf; 00069 }
static int pool_destroy | ( | struct _DriBufferPool * | pool, | |
void * | private | |||
) | [static] |
Definition at line 91 of file ws_dri_drmpool.c.
References driReadLockKernelBO(), driReadUnlockKernelBO(), and _DriBufferPool::fd.
00092 { 00093 int ret; 00094 drmBO *buf = (drmBO *) private; 00095 driReadLockKernelBO(); 00096 ret = drmBOUnreference(pool->fd, buf); 00097 free(buf); 00098 driReadUnlockKernelBO(); 00099 return ret; 00100 }
static int pool_fence | ( | struct _DriBufferPool * | pool, | |
void * | private, | |||
struct _DriFenceObject * | fence | |||
) | [static] |
Definition at line 188 of file ws_dri_drmpool.c.
00190 { 00191 /* 00192 * Noop. The kernel handles all fencing. 00193 */ 00194 00195 return 0; 00196 }
static uint64_t pool_flags | ( | struct _DriBufferPool * | pool, | |
void * | private | |||
) | [static] |
Definition at line 161 of file ws_dri_drmpool.c.
References driReadLockKernelBO(), and driReadUnlockKernelBO().
00162 { 00163 drmBO *buf = (drmBO *) private; 00164 uint64_t flags; 00165 00166 driReadLockKernelBO(); 00167 flags = buf->flags; 00168 driReadUnlockKernelBO(); 00169 00170 return flags; 00171 }
static drmBO* pool_kernel | ( | struct _DriBufferPool * | pool, | |
void * | private | |||
) | [static] |
static int pool_map | ( | struct _DriBufferPool * | pool, | |
void * | private, | |||
unsigned | flags, | |||
int | hint, | |||
pipe_mutex * | mutex, | |||
void ** | virtual | |||
) | [static] |
Definition at line 115 of file ws_dri_drmpool.c.
References driReadLockKernelBO(), driReadUnlockKernelBO(), and _DriBufferPool::fd.
00117 { 00118 drmBO *buf = (drmBO *) private; 00119 int ret; 00120 00121 driReadLockKernelBO(); 00122 ret = drmBOMap(pool->fd, buf, flags, hint, virtual); 00123 driReadUnlockKernelBO(); 00124 return ret; 00125 }
static unsigned long pool_offset | ( | struct _DriBufferPool * | pool, | |
void * | private | |||
) | [static] |
Definition at line 141 of file ws_dri_drmpool.c.
References assert, driReadLockKernelBO(), driReadUnlockKernelBO(), and offset().
00142 { 00143 drmBO *buf = (drmBO *) private; 00144 unsigned long offset; 00145 00146 driReadLockKernelBO(); 00147 assert(buf->flags & DRM_BO_FLAG_NO_MOVE); 00148 offset = buf->offset; 00149 driReadUnlockKernelBO(); 00150 00151 return buf->offset; 00152 }
static unsigned long pool_poolOffset | ( | struct _DriBufferPool * | pool, | |
void * | private | |||
) | [static] |
static void* pool_reference | ( | struct _DriBufferPool * | pool, | |
unsigned | handle | |||
) | [static] |
Definition at line 72 of file ws_dri_drmpool.c.
References _DriBufferPool::fd.
00073 { 00074 drmBO *buf = (drmBO *) malloc(sizeof(*buf)); 00075 int ret; 00076 00077 if (!buf) 00078 return NULL; 00079 00080 ret = drmBOReference(pool->fd, handle, buf); 00081 00082 if (ret) { 00083 free(buf); 00084 return NULL; 00085 } 00086 00087 return (void *) buf; 00088 }
static unsigned long pool_size | ( | struct _DriBufferPool * | pool, | |
void * | private | |||
) | [static] |
Definition at line 175 of file ws_dri_drmpool.c.
References driReadLockKernelBO(), and driReadUnlockKernelBO().
00176 { 00177 drmBO *buf = (drmBO *) private; 00178 unsigned long size; 00179 00180 driReadLockKernelBO(); 00181 size = buf->size; 00182 driReadUnlockKernelBO(); 00183 00184 return buf->size; 00185 }
static void pool_takedown | ( | struct _DriBufferPool * | pool | ) | [static] |
static int pool_unmap | ( | struct _DriBufferPool * | pool, | |
void * | private | |||
) | [static] |
Definition at line 128 of file ws_dri_drmpool.c.
References driReadLockKernelBO(), driReadUnlockKernelBO(), and _DriBufferPool::fd.
00129 { 00130 drmBO *buf = (drmBO *) private; 00131 int ret; 00132 00133 driReadLockKernelBO(); 00134 ret = drmBOUnmap(pool->fd, buf); 00135 driReadUnlockKernelBO(); 00136 00137 return ret; 00138 }
static int pool_unreference | ( | struct _DriBufferPool * | pool, | |
void * | private | |||
) | [static] |
Definition at line 103 of file ws_dri_drmpool.c.
References driReadLockKernelBO(), driReadUnlockKernelBO(), and _DriBufferPool::fd.
00104 { 00105 int ret; 00106 drmBO *buf = (drmBO *) private; 00107 driReadLockKernelBO(); 00108 ret = drmBOUnreference(pool->fd, buf); 00109 free(buf); 00110 driReadUnlockKernelBO(); 00111 return ret; 00112 }
static int pool_waitIdle | ( | struct _DriBufferPool * | pool, | |
void * | private, | |||
pipe_mutex * | mutex, | |||
int | lazy | |||
) | [static] |
Definition at line 205 of file ws_dri_drmpool.c.
References driReadLockKernelBO(), driReadUnlockKernelBO(), and _DriBufferPool::fd.
00207 { 00208 drmBO *buf = (drmBO *) private; 00209 int ret; 00210 00211 driReadLockKernelBO(); 00212 ret = drmBOWaitIdle(pool->fd, buf, (lazy) ? DRM_BO_HINT_WAIT_LAZY:0); 00213 driReadUnlockKernelBO(); 00214 00215 return ret; 00216 }