mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-05-05 07:48:02 +02:00
intel: Expect caller to guarantee thread-safety of bo during reloc
This removes the foremost prolific user of mutexes in libdrm_intel.so. The other uses of the bufmgr_gem->mutex to serial access to individual bos are currently required by Mesa, and are far less frequent. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> [anholt: This chunk looks good...] Acked-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
6f1eba0548
commit
9707733a13
1 changed files with 2 additions and 10 deletions
|
|
@ -1201,23 +1201,17 @@ drm_intel_gem_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
|
|||
drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
|
||||
drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *) target_bo;
|
||||
|
||||
pthread_mutex_lock(&bufmgr_gem->lock);
|
||||
if (bo_gem->has_error) {
|
||||
pthread_mutex_unlock(&bufmgr_gem->lock);
|
||||
if (bo_gem->has_error)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (target_bo_gem->has_error) {
|
||||
bo_gem->has_error = 1;
|
||||
pthread_mutex_unlock(&bufmgr_gem->lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Create a new relocation list if needed */
|
||||
if (bo_gem->relocs == NULL && drm_intel_setup_reloc_list(bo)) {
|
||||
pthread_mutex_unlock(&bufmgr_gem->lock);
|
||||
if (bo_gem->relocs == NULL && drm_intel_setup_reloc_list(bo))
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Check overflow */
|
||||
assert(bo_gem->reloc_count < bufmgr_gem->max_relocs);
|
||||
|
|
@ -1249,8 +1243,6 @@ drm_intel_gem_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
|
|||
|
||||
bo_gem->reloc_count++;
|
||||
|
||||
pthread_mutex_unlock(&bufmgr_gem->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue