intel: Fix several other paths for buffers pointing at themselves.

main
Eric Anholt 2010-06-10 08:58:08 -07:00
parent 0ec768e67a
commit 4f7704aea7
1 changed files with 9 additions and 4 deletions

View File

@ -859,9 +859,11 @@ drm_intel_gem_bo_unreference_final(drm_intel_bo *bo, time_t time)
/* Unreference all the target buffers */ /* Unreference all the target buffers */
for (i = 0; i < bo_gem->reloc_count; i++) { for (i = 0; i < bo_gem->reloc_count; i++) {
drm_intel_gem_bo_unreference_locked_timed(bo_gem-> if (bo_gem->reloc_target_info[i].bo != bo) {
reloc_target_info[i].bo, drm_intel_gem_bo_unreference_locked_timed(bo_gem->
time); reloc_target_info[i].bo,
time);
}
} }
bo_gem->reloc_count = 0; bo_gem->reloc_count = 0;
bo_gem->used_as_reloc_target = 0; bo_gem->used_as_reloc_target = 0;
@ -1345,7 +1347,8 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
bo_gem->relocs[bo_gem->reloc_count].presumed_offset = target_bo->offset; bo_gem->relocs[bo_gem->reloc_count].presumed_offset = target_bo->offset;
bo_gem->reloc_target_info[bo_gem->reloc_count].bo = target_bo; bo_gem->reloc_target_info[bo_gem->reloc_count].bo = target_bo;
drm_intel_gem_bo_reference(target_bo); if (target_bo != bo)
drm_intel_gem_bo_reference(target_bo);
if (need_fence) if (need_fence)
bo_gem->reloc_target_info[bo_gem->reloc_count].flags = bo_gem->reloc_target_info[bo_gem->reloc_count].flags =
DRM_INTEL_RELOC_FENCE; DRM_INTEL_RELOC_FENCE;
@ -1967,6 +1970,8 @@ _drm_intel_gem_bo_references(drm_intel_bo *bo, drm_intel_bo *target_bo)
for (i = 0; i < bo_gem->reloc_count; i++) { for (i = 0; i < bo_gem->reloc_count; i++) {
if (bo_gem->reloc_target_info[i].bo == target_bo) if (bo_gem->reloc_target_info[i].bo == target_bo)
return 1; return 1;
if (bo == bo_gem->reloc_target_info[i].bo)
continue;
if (_drm_intel_gem_bo_references(bo_gem->reloc_target_info[i].bo, if (_drm_intel_gem_bo_references(bo_gem->reloc_target_info[i].bo,
target_bo)) target_bo))
return 1; return 1;