i915: Use the malloc pool for constant buffers since they don't go to the GPU directly.
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Thu, 22 May 2008 14:42:53 +0000 (16:42 +0200)
committerJakob Bornecrantz <jakob@tungstengraphics.com>
Fri, 23 May 2008 09:02:14 +0000 (11:02 +0200)
src/gallium/winsys/dri/intel/intel_winsys.h
src/gallium/winsys/dri/intel/intel_winsys_pipe.c

index d0a319f9a4f73e68d68d5536943f086eead68fe3..3d32db10a4aa00da1efd14377eb292207b730c10 100644 (file)
@@ -53,6 +53,7 @@ intel_create_i915simple( struct intel_context *intel,
 
 struct intel_buffer {
    struct pipe_buffer base;
+   struct _DriBufferPool *pool;
    struct _DriBufferObject *driBO;
 };
 
@@ -69,5 +70,4 @@ dri_bo( struct pipe_buffer *buf )
 }
 
 
-
 #endif
index 44baa6d9fa143bd6db57333de73de33f627a9264..7b1c0acfc948f5a99adccf4a8e0baf462b980f3d 100644 (file)
@@ -50,6 +50,7 @@
 struct intel_pipe_winsys {
    struct pipe_winsys winsys;
    struct _DriBufferPool *regionPool;
+   struct _DriBufferPool *mallocPool;
    struct _DriFreeSlabManager *fMan;
 };
 
@@ -110,16 +111,19 @@ intel_buffer_create(struct pipe_winsys *winsys,
    struct intel_buffer *buffer = CALLOC_STRUCT( intel_buffer );
    struct intel_pipe_winsys *iws = intel_pipe_winsys(winsys);
    unsigned flags = 0;
+   struct _DriBufferPool *pool;
 
    buffer->base.refcount = 1;
    buffer->base.alignment = alignment;
    buffer->base.usage = usage;
    buffer->base.size = size;
 
-   if (usage & (PIPE_BUFFER_USAGE_VERTEX /*| IWS_BUFFER_USAGE_LOCAL*/)) {
+   if (usage & (PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_CONSTANT)) {
       flags |= DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_CACHED;
+      pool = iws->mallocPool;
    } else {
       flags |= DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_TT;
+      pool = iws->regionPool;
    }
 
    if (usage & PIPE_BUFFER_USAGE_GPU_READ)
@@ -141,10 +145,11 @@ intel_buffer_create(struct pipe_winsys *winsys,
       flags |= DRM_BO_FLAG_CACHED;
 #endif
 
-   driGenBuffers( iws->regionPool, 
+   buffer->pool = pool;
+   driGenBuffers( buffer->pool, 
                  "pipe buffer", 1, &buffer->driBO, alignment, flags, 0 );
 
-   driBOData( buffer->driBO, size, NULL, iws->regionPool, 0 );
+   driBOData( buffer->driBO, size, NULL, buffer->pool, 0 );
 
    return &buffer->base;
 }
@@ -278,8 +283,7 @@ intel_fence_finish( struct pipe_winsys *sws,
                     struct pipe_fence_handle *fence,
                     unsigned flag )
 {
-   /* JB: Lets allways lazy wait */
-   return driFenceFinish((struct _DriFenceObject *)fence, flag, 1);
+   return driFenceFinish((struct _DriFenceObject *)fence, flag, 0);
 }
 
 struct pipe_winsys *
@@ -310,15 +314,9 @@ intel_create_pipe_winsys( int fd, struct _DriFreeSlabManager *fMan )
    iws->winsys.fence_finish = intel_fence_finish;
 
    if (fd)
-      iws->regionPool = driSlabPoolInit(fd,
-                       DRM_BO_FLAG_READ |
-                       DRM_BO_FLAG_WRITE |
-                       DRM_BO_FLAG_MEM_TT,
-                       DRM_BO_FLAG_READ |
-                       DRM_BO_FLAG_WRITE |
-                       DRM_BO_FLAG_MEM_TT,
-                       64, 6, 16, 4096, 0,
-                       fMan);
+     iws->regionPool = driDRMPoolInit(fd);
+
+   iws->mallocPool = driMallocPoolInit();
 
    return &iws->winsys;
 }
@@ -331,6 +329,9 @@ intel_destroy_pipe_winsys( struct pipe_winsys *winsys )
    if (iws->regionPool) {
       driPoolTakeDown(iws->regionPool);
    }
+   if (iws->mallocPool) {
+      driPoolTakeDown(iws->mallocPool);
+   }
    free(iws);
 }