intel: Use libdrm's decode functionality instead of the gpu-tools copy.

While typing out the new decode, I added a fallback mode for dumping
when we fail to re-map the BO after execution.  This should get us a
minimal dump when trying to dump a batch that results in a GPU hang.
This commit is contained in:
Eric Anholt
2011-12-20 14:42:48 -08:00
parent 493faa010d
commit 61b9ccd9e2
5 changed files with 41 additions and 2795 deletions

View File

@@ -41,7 +41,6 @@ i915_C_FILES := \
i915_state.c \
i915_vtbl.c \
intel_context.c \
intel_decode.c \
intel_screen.c \
intel_span.c \
intel_state.c \

View File

@@ -9,7 +9,6 @@ i965_C_FILES := \
intel_buffers.c \
intel_clear.c \
intel_context.c \
intel_decode.c \
intel_extensions.c \
intel_extensions_es.c \
intel_fbo.c \

View File

@@ -28,7 +28,6 @@
#include "intel_context.h"
#include "intel_batchbuffer.h"
#include "intel_buffer_objects.h"
#include "intel_decode.h"
#include "intel_reg.h"
#include "intel_bufmgr.h"
#include "intel_buffers.h"
@@ -118,6 +117,45 @@ intel_batchbuffer_free(struct intel_context *intel)
clear_cache(intel);
}
static void
do_batch_dump(struct intel_context *intel)
{
struct drm_intel_decode *decode;
struct intel_batchbuffer *batch = &intel->batch;
int ret;
decode = drm_intel_decode_context_alloc(intel->intelScreen->deviceID);
if (!decode)
return;
ret = drm_intel_bo_map(batch->bo, false);
if (ret == 0) {
drm_intel_decode_set_batch_pointer(decode,
batch->bo->virtual,
batch->bo->offset,
batch->used);
} else {
fprintf(stderr,
"WARNING: failed to map batchbuffer (%s), "
"dumping uploaded data instead.\n", strerror(ret));
drm_intel_decode_set_batch_pointer(decode,
batch->map,
batch->bo->offset,
batch->used);
}
drm_intel_decode(decode);
drm_intel_decode_context_free(decode);
if (ret == 0) {
drm_intel_bo_unmap(batch->bo);
if (intel->vtbl.debug_batch != NULL)
intel->vtbl.debug_batch(intel);
}
}
/* TODO: Push this whole function into bufmgr.
*/
@@ -152,16 +190,8 @@ do_flush_locked(struct intel_context *intel)
flags);
}
if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) {
drm_intel_bo_map(batch->bo, false);
intel_decode(batch->bo->virtual, batch->used,
batch->bo->offset,
intel->intelScreen->deviceID, true);
drm_intel_bo_unmap(batch->bo);
if (intel->vtbl.debug_batch != NULL)
intel->vtbl.debug_batch(intel);
}
if (unlikely(INTEL_DEBUG & DEBUG_BATCH))
do_batch_dump(intel);
if (ret != 0) {
fprintf(stderr, "intel_do_flush_locked failed: %s\n", strerror(-ret));

File diff suppressed because it is too large Load Diff

View File

@@ -1,31 +0,0 @@
/*
* Copyright © 2007 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* Authors:
* Eric Anholt <eric@anholt.net>
*
*/
int intel_decode(uint32_t *data, int count, uint32_t hw_offset, uint32_t devid,
uint32_t ignore_end_of_batchbuffer);
void intel_decode_context_set_head_tail(uint32_t head, uint32_t tail);
void intel_decode_context_reset(void);