intel: Ask libdrm to dump an AUB file if INTEL_DEBUG=aub.
authorEric Anholt <eric@anholt.net>
Tue, 6 Mar 2012 23:31:42 +0000 (15:31 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 21 Mar 2012 19:45:05 +0000 (12:45 -0700)
It also asks for BMPs in the aub file at SwapBuffers time.

Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_context.h
src/mesa/drivers/dri/intel/intel_screen.c

index d2ec0265e7c7a6b2ba7fc7886490897ac9dbb616..5c857ba866bec5c0e9c7994f84d4c36715a99405 100644 (file)
@@ -477,6 +477,7 @@ static const struct dri_debug_control debug_control[] = {
    { "urb",   DEBUG_URB },
    { "vs",    DEBUG_VS },
    { "clip",  DEBUG_CLIP },
+   { "aub",   DEBUG_AUB },
    { NULL,    0 }
 };
 
@@ -732,6 +733,9 @@ intelInitContext(struct intel_context *intel,
    if (INTEL_DEBUG & DEBUG_BUFMGR)
       dri_bufmgr_set_debug(intel->bufmgr, true);
 
+   if (INTEL_DEBUG & DEBUG_AUB)
+      drm_intel_bufmgr_gem_set_aub_dump(intel->bufmgr, true);
+
    intel_batchbuffer_init(intel);
 
    intel_fbo_init(intel);
index 041a4fcd4e9c3ad1224123a3da22a7530c9097c6..bfe5f9445b8529ddd8d448c739dc151ef644ebc3 100644 (file)
@@ -466,6 +466,7 @@ extern int INTEL_DEBUG;
 #define DEBUG_URB       0x800000
 #define DEBUG_VS        0x1000000
 #define DEBUG_CLIP      0x2000000
+#define DEBUG_AUB       0x4000000
 
 #define DBG(...) do {                                          \
        if (unlikely(INTEL_DEBUG & FILE_DEBUG_FLAG))            \
index 229eeb1f5ada7721b1b81a599493a6812b1bf783..e7c45b7d90745579119233238c9e4143b9629624 100644 (file)
@@ -129,6 +129,38 @@ intelDRI2Flush(__DRIdrawable *drawable)
 
    if (intel->batch.used)
       intel_batchbuffer_flush(intel);
+
+   if (INTEL_DEBUG & DEBUG_AUB) {
+      struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+      for (int i = 0; i < fb->_NumColorDrawBuffers; i++) {
+        struct intel_renderbuffer *irb =
+           intel_renderbuffer(fb->_ColorDrawBuffers[i]);
+
+        if (irb && irb->mt) {
+           enum aub_dump_bmp_format format;
+
+           switch (irb->Base.Base.Format) {
+           case MESA_FORMAT_ARGB8888:
+           case MESA_FORMAT_XRGB8888:
+              format = AUB_DUMP_BMP_FORMAT_ARGB_8888;
+              break;
+           default:
+              continue;
+           }
+
+           drm_intel_gem_bo_aub_dump_bmp(irb->mt->region->bo,
+                                         irb->draw_x,
+                                         irb->draw_y,
+                                         irb->Base.Base.Width,
+                                         irb->Base.Base.Height,
+                                         format,
+                                         irb->mt->region->pitch *
+                                         irb->mt->region->cpp,
+                                         0);
+        }
+      }
+   }
 }
 
 static const struct __DRI2flushExtensionRec intelFlushExtension = {