summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/common/dri_bufmgr.h1
-rw-r--r--src/mesa/drivers/dri/common/dri_bufmgr_fake.c20
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.c2
3 files changed, 17 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h
index f1863c7056..5c519cb38f 100644
--- a/src/mesa/drivers/dri/common/dri_bufmgr.h
+++ b/src/mesa/drivers/dri/common/dri_bufmgr.h
@@ -202,6 +202,7 @@ dri_bufmgr *dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual,
int (*fence_wait)(void *private,
unsigned int cookie),
void *driver_priv);
+void dri_bufmgr_fake_set_debug(dri_bufmgr *bufmgr, GLboolean enable_debug);
void dri_bufmgr_destroy(dri_bufmgr *bufmgr);
dri_bo *dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
unsigned int handle);
diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c
index c31bd7c6b0..fa82599094 100644
--- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c
+++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c
@@ -41,11 +41,10 @@
#include "mm.h"
#include "imports.h"
-#if 0
-#define DBG(...) _mesa_printf(__VA_ARGS__)
-#else
-#define DBG(...)
-#endif
+#define DBG(...) do { \
+ if (bufmgr_fake->debug) \
+ _mesa_printf(__VA_ARGS__); \
+} while (0)
/* Internal flags:
*/
@@ -129,6 +128,7 @@ typedef struct _bufmgr_fake {
/** Driver-supplied argument to driver callbacks */
void *driver_priv;
+ GLboolean debug;
/** fake relocation list */
struct fake_buffer_reloc reloc[MAX_RELOCS];
@@ -778,10 +778,10 @@ dri_fake_bo_validate(dri_bo *bo, unsigned int flags)
/* XXX: Sanity-check whether we've already validated this one under
* different flags. See drmAddValidateItem().
*/
+ bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
DBG("drm_bo_validate: (buf %d: %s, %d kb)\n", bo_fake->id, bo_fake->name,
bo_fake->bo.size / 1024);
- bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
_glthread_LOCK_MUTEX(bufmgr_fake->mutex);
{
@@ -1097,6 +1097,14 @@ dri_fake_post_submit(dri_bo *batch_buf, dri_fence **last_fence)
bufmgr_fake->nr_relocs = 0;
}
+void
+dri_bufmgr_fake_set_debug(dri_bufmgr *bufmgr, GLboolean enable_debug)
+{
+ dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bufmgr;
+
+ bufmgr_fake->debug = enable_debug;
+}
+
dri_bufmgr *
dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual,
unsigned long size,
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index a26a424f86..326be9c76f 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -460,6 +460,8 @@ intelInitContext(struct intel_context *intel,
#if DO_DEBUG
INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
+ if (!intel->intelScreen->ttm && (INTEL_DEBUG & DEBUG_BUFMGR))
+ dri_bufmgr_fake_set_debug(intel->intelScreen->bufmgr, GL_TRUE);
#endif
if (getenv("INTEL_NO_RAST")) {