Bufmgr cleanup from intel-batchbuffer branch of 2d driver.
authorEric Anholt <eric@anholt.net>
Thu, 24 Jan 2008 21:00:13 +0000 (13:00 -0800)
committerEric Anholt <eric@anholt.net>
Thu, 24 Jan 2008 21:00:13 +0000 (13:00 -0800)
src/mesa/drivers/dri/common/dri_bufmgr.c
src/mesa/drivers/dri/common/dri_bufmgr.h
src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c

index 18b12c63f72f108bb379a4421dca645ffcb7937b..8413a51577c17ba1af771dfba0ef72d5ce9e782e 100644 (file)
@@ -25,6 +25,9 @@
  *
  */
 
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
 #include "mtypes.h"
 #include "dri_bufmgr.h"
 
index 36340d4d57d07ef06e33c80e18ad8669e556521a..08cf8ca3e15729e62842ca1bc26dfa68b9365d97 100644 (file)
@@ -197,9 +197,6 @@ void dri_bo_subdata(dri_bo *bo, unsigned long offset,
 void dri_bo_get_subdata(dri_bo *bo, unsigned long offset,
                        unsigned long size, void *data);
 
-dri_bufmgr *dri_bufmgr_ttm_init(int fd, unsigned int fence_type,
-                               unsigned int fence_type_flush);
-
 void dri_bufmgr_fake_contended_lock_take(dri_bufmgr *bufmgr);
 dri_bufmgr *dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual,
                                 unsigned long size,
@@ -213,8 +210,6 @@ void dri_bo_fake_disable_backing_store(dri_bo *bo,
                                                             void *ptr),
                                       void *ptr);
 void dri_bufmgr_destroy(dri_bufmgr *bufmgr);
-dri_bo *dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
-                                     unsigned int handle);
 
 void dri_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta,
                    GLuint offset, dri_bo *target_buf);
index 745dbc8a3e068782caf3612433fc448f4b3ef7a7..043447b1864297b949fa045d841ac6fcb5d242e9 100644 (file)
  */
 
 #include <xf86drm.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
-#include "glthread.h"
+#include <assert.h>
+
 #include "errno.h"
 #include "mtypes.h"
 #include "dri_bufmgr.h"
@@ -50,7 +53,7 @@
 
 #define DBG(...) do {                                  \
    if (bufmgr_ttm->bufmgr.debug)                       \
-      _mesa_printf(__VA_ARGS__);                       \
+      fprintf(stderr, __VA_ARGS__);                    \
 } while (0)
 
 /*
@@ -150,7 +153,7 @@ static void dri_ttm_dump_validation_list(dri_bufmgr_ttm *bufmgr_ttm)
                    bufmgr_ttm->validate_array[reloc_entry[2]].bo;
                dri_bo_ttm *target_ttm = (dri_bo_ttm *)target_bo;
 
-               DBG("%2d: %s@0x%08x -> %s@0x%08x + 0x%08x\n",
+               DBG("%2d: %s@0x%08x -> %s@0x%08lx + 0x%08x\n",
                    i,
                    bo_ttm->name, reloc_entry[0],
                    target_ttm->name, target_bo->offset,
@@ -369,7 +372,7 @@ dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name,
     ttm_buf->delayed_unmap = GL_FALSE;
     ttm_buf->validate_index = -1;
 
-    DBG("bo_create: %p (%s) %db\n", &ttm_buf->bo, ttm_buf->name, size);
+    DBG("bo_create: %p (%s) %ldb\n", &ttm_buf->bo, ttm_buf->name, size);
 
     return &ttm_buf->bo;
 }
@@ -619,8 +622,8 @@ dri_ttm_fence_wait(dri_fence *fence)
 
     ret = drmFenceWait(bufmgr_ttm->fd, DRM_FENCE_FLAG_WAIT_LAZY, &fence_ttm->drm_fence, 0);
     if (ret != 0) {
-       _mesa_printf("%s:%d: Error %d waiting for fence %s.\n",
-                    __FILE__, __LINE__, ret, fence_ttm->name);
+        fprintf(stderr, "%s:%d: Error %d waiting for fence %s.\n",
+               __FILE__, __LINE__, ret, fence_ttm->name);
        abort();
     }
 
@@ -705,8 +708,6 @@ dri_ttm_bo_process_reloc(dri_bo *bo)
 
     for (i = 0; i < nr_relocs; i++) {
        struct dri_ttm_reloc *r = &bo_ttm->relocs[i];
-       dri_bo_ttm *target_ttm = (dri_bo_ttm *)r->target_buf;
-       uint32_t *reloc_entry;
 
        /* Continue walking the tree depth-first. */
        dri_ttm_bo_process_reloc(r->target_buf);
@@ -786,8 +787,8 @@ intel_update_buffer_offsets (dri_bufmgr_ttm *bufmgr_ttm)
        }
        /* Update the buffer offset */
        if (rep->bo_info.offset != bo->offset) {
-           DBG("BO %s migrated: 0x%08x -> 0x%08x\n",
-               bo_ttm->name, bo->offset, rep->bo_info.offset);
+           DBG("BO %s migrated: 0x%08lx -> 0x%08lx\n",
+               bo_ttm->name, bo->offset, (unsigned long)rep->bo_info.offset);
            bo->offset = rep->bo_info.offset;
        }
     }