mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 11:58:10 +02:00
crocus: find correct relocation target for the bo.
If we have batch a + b, and writing to batch b, causes batch a
to flush, all the bo->index get reset, and we try to submit a -1
to the kernel.
Look the bo index up when creating relocations.
Fixes crash seen in KHR-GL46.compute_shader.pipeline-post-fs
and a trace from Wasteland 3
Fixes: f3630548f1 ("crocus: initial gallium driver for Intel gfx 4-7")
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14905>
This commit is contained in:
parent
d774059a0c
commit
37c3be6947
2 changed files with 15 additions and 7 deletions
|
|
@ -1,4 +1,3 @@
|
|||
KHR-GL46.compute_shader.pipeline-post-fs
|
||||
KHR-GL46.texture_barrier.overlapping-texels
|
||||
KHR-GL46.texture_barrier_ARB.overlapping-texels
|
||||
KHR-GL46.texture_barrier_ARB.same-texel-rw-multipass
|
||||
|
|
|
|||
|
|
@ -263,21 +263,30 @@ crocus_init_batch(struct crocus_context *ice,
|
|||
crocus_batch_reset(batch);
|
||||
}
|
||||
|
||||
static struct drm_i915_gem_exec_object2 *
|
||||
find_validation_entry(struct crocus_batch *batch, struct crocus_bo *bo)
|
||||
static int
|
||||
find_exec_index(struct crocus_batch *batch, struct crocus_bo *bo)
|
||||
{
|
||||
unsigned index = READ_ONCE(bo->index);
|
||||
|
||||
if (index < batch->exec_count && batch->exec_bos[index] == bo)
|
||||
return &batch->validation_list[index];
|
||||
return index;
|
||||
|
||||
/* May have been shared between multiple active batches */
|
||||
for (index = 0; index < batch->exec_count; index++) {
|
||||
if (batch->exec_bos[index] == bo)
|
||||
return &batch->validation_list[index];
|
||||
return index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
static struct drm_i915_gem_exec_object2 *
|
||||
find_validation_entry(struct crocus_batch *batch, struct crocus_bo *bo)
|
||||
{
|
||||
int index = find_exec_index(batch, bo);
|
||||
|
||||
if (index == -1)
|
||||
return NULL;
|
||||
return &batch->validation_list[index];
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -409,7 +418,7 @@ emit_reloc(struct crocus_batch *batch,
|
|||
(struct drm_i915_gem_relocation_entry) {
|
||||
.offset = offset,
|
||||
.delta = target_offset,
|
||||
.target_handle = target->index,
|
||||
.target_handle = find_exec_index(batch, target),
|
||||
.presumed_offset = entry->offset,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue