intel_be_device.h File Reference

Include dependency graph for intel_be_device.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  intel_be_device
struct  intel_be_buffer

Functions

boolean intel_be_init_device (struct intel_be_device *device, int fd, unsigned id)
void intel_be_destroy_device (struct intel_be_device *dev)
struct pipe_bufferintel_be_buffer_from_handle (struct intel_be_device *device, const char *name, unsigned handle)
 Create a be buffer from a drm bo handle.
static struct intel_be_bufferintel_be_buffer (struct pipe_buffer *buf)
static struct _DriBufferObjectdri_bo (struct pipe_buffer *buf)


Function Documentation

static struct _DriBufferObject* dri_bo ( struct pipe_buffer buf  )  [static, read]

Definition at line 67 of file intel_be_device.h.

References intel_be_buffer::driBO, and intel_be_buffer().

00068 {
00069         return intel_be_buffer(buf)->driBO;
00070 }

static struct intel_be_buffer* intel_be_buffer ( struct pipe_buffer buf  )  [static, read]

Definition at line 61 of file intel_be_device.h.

00062 {
00063         return (struct intel_be_buffer *)buf;
00064 }

struct pipe_buffer* intel_be_buffer_from_handle ( struct intel_be_device device,
const char *  name,
unsigned  handle 
) [read]

Create a be buffer from a drm bo handle.

Takes a reference

XXX TODO check error

Definition at line 129 of file intel_be_device.c.

References pipe_buffer::alignment, intel_be_buffer::base, intel_be_buffer::driBO, driBOSetReferenced(), driBOSize(), driGenBuffers(), pipe_buffer::refcount, pipe_buffer::size, intel_be_device::staticPool, and pipe_buffer::usage.

00131 {
00132         struct intel_be_buffer *be_buf = malloc(sizeof(*be_buf));
00133         struct pipe_buffer *buffer;
00134 
00135         if (!be_buf)
00136                 goto err;
00137 
00138         memset(be_buf, 0, sizeof(*be_buf));
00139 
00140         driGenBuffers(device->staticPool, name, 1, &be_buf->driBO, 0, 0, 0);
00141     driBOSetReferenced(be_buf->driBO, handle);
00142 
00143         if (0) 
00144                 goto err_bo;
00145         
00146         buffer = &be_buf->base;
00147         buffer->refcount = 1;
00148         buffer->alignment = 0;
00149         buffer->usage = 0;
00150         buffer->size = driBOSize(be_buf->driBO);
00151 
00152         return buffer;
00153 err_bo:
00154         free(be_buf);
00155 err:
00156         return NULL;
00157 }

void intel_be_destroy_device ( struct intel_be_device dev  ) 

TODO takedown fenceMgr and fMan

Definition at line 299 of file intel_be_device.c.

References intel_be_device::batchPool, driPoolTakeDown(), intel_be_device::mallocPool, intel_be_device::regionPool, intel_be_device::staticPool, and intel_be_device::vertexPool.

00300 {
00301         driPoolTakeDown(dev->mallocPool);
00302         driPoolTakeDown(dev->staticPool);
00303         driPoolTakeDown(dev->regionPool);
00304         driPoolTakeDown(dev->vertexPool);
00305         driPoolTakeDown(dev->batchPool);
00306 
00308 }

boolean intel_be_init_device ( struct intel_be_device device,
int  fd,
unsigned  id 
)

Definition at line 230 of file intel_be_device.c.

References intel_be_device::base, intel_be_device::batchPool, pipe_winsys::buffer_create, pipe_winsys::buffer_destroy, pipe_winsys::buffer_map, pipe_winsys::buffer_unmap, driDRMPoolInit(), driFenceMgrTTMInit(), driInitFreeSlabManager(), driMallocPoolInit(), driSlabPoolInit(), intel_be_device::fd, pipe_winsys::fence_finish, pipe_winsys::fence_reference, pipe_winsys::fence_signalled, intel_be_device::fenceMgr, pipe_winsys::flush_frontbuffer, intel_be_device::fMan, pipe_winsys::get_name, i915_create_screen(), intel_be_buffer_create(), intel_be_buffer_destroy(), intel_be_buffer_map(), intel_be_buffer_unmap(), intel_be_fence_finish(), intel_be_fence_reference(), intel_be_fence_signalled(), intel_be_user_buffer_create(), intel_flush_frontbuffer(), intel_get_name(), intel_i915_surface_alloc(), intel_i915_surface_alloc_storage(), intel_i915_surface_release(), intel_be_device::mallocPool, intel_be_device::max_batch_size, intel_be_device::max_vertex_size, intel_be_device::regionPool, intel_be_device::screen, intel_be_device::staticPool, pipe_winsys::surface_alloc, pipe_winsys::surface_alloc_storage, pipe_winsys::surface_release, pipe_winsys::user_buffer_create, and intel_be_device::vertexPool.

00231 {
00232         dev->fd = fd;
00233         dev->max_batch_size = 16 * 4096;
00234         dev->max_vertex_size = 128 * 4096;
00235 
00236         dev->base.buffer_create = intel_be_buffer_create;
00237         dev->base.user_buffer_create = intel_be_user_buffer_create;
00238         dev->base.buffer_map = intel_be_buffer_map;
00239         dev->base.buffer_unmap = intel_be_buffer_unmap;
00240         dev->base.buffer_destroy = intel_be_buffer_destroy;
00241         dev->base.surface_alloc = intel_i915_surface_alloc;
00242         dev->base.surface_alloc_storage = intel_i915_surface_alloc_storage;
00243         dev->base.surface_release = intel_i915_surface_release;
00244         dev->base.fence_reference = intel_be_fence_reference;
00245         dev->base.fence_signalled = intel_be_fence_signalled;
00246         dev->base.fence_finish = intel_be_fence_finish;
00247 
00248 #if 0 /* Set by the winsys */
00249         dev->base.flush_frontbuffer = intel_flush_frontbuffer;
00250         dev->base.get_name = intel_get_name;
00251 #endif
00252 
00253         dev->fMan = driInitFreeSlabManager(10, 10);
00254         dev->fenceMgr = driFenceMgrTTMInit(dev->fd);
00255 
00256         dev->mallocPool = driMallocPoolInit();
00257         dev->staticPool = driDRMPoolInit(dev->fd);
00258         /* Sizes: 64 128 256 512 1024 2048 4096 8192 16384 32768 */
00259         dev->regionPool = driSlabPoolInit(dev->fd,
00260                                           DRM_BO_FLAG_READ |
00261                                           DRM_BO_FLAG_WRITE |
00262                                           DRM_BO_FLAG_MEM_TT,
00263                                           DRM_BO_FLAG_READ |
00264                                           DRM_BO_FLAG_WRITE |
00265                                           DRM_BO_FLAG_MEM_TT,
00266                                           64,
00267                                           10, 120, 4096 * 64, 0,
00268                                           dev->fMan);
00269 
00270         dev->vertexPool = driSlabPoolInit(dev->fd,
00271                                           DRM_BO_FLAG_READ |
00272                                           DRM_BO_FLAG_WRITE |
00273                                           DRM_BO_FLAG_MEM_TT,
00274                                           DRM_BO_FLAG_READ |
00275                                           DRM_BO_FLAG_WRITE |
00276                                           DRM_BO_FLAG_MEM_TT,
00277                                           dev->max_vertex_size,
00278                                           1, 120, dev->max_vertex_size * 4, 0,
00279                                           dev->fMan);
00280 
00281         dev->batchPool = driSlabPoolInit(dev->fd,
00282                                          DRM_BO_FLAG_EXE |
00283                                          DRM_BO_FLAG_MEM_TT,
00284                                          DRM_BO_FLAG_EXE |
00285                                          DRM_BO_FLAG_MEM_TT,
00286                                          dev->max_batch_size,
00287                                          1, 40, dev->max_batch_size * 16, 0,
00288                                          dev->fMan);
00289 
00290         /* Fill in this struct with callbacks that i915simple will need to
00291          * communicate with the window system, buffer manager, etc.
00292          */
00293         dev->screen = i915_create_screen(&dev->base, id);
00294 
00295         return true;
00296 }


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