blorp: handle binding table & surface state allocation failures
The embedding driver could be failing the allocation for whatever reason, in which case we should skip the surface state writes. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25955>
This commit is contained in:

committed by
Marge Bot

parent
1cc26e8b66
commit
f9753488ec
@@ -169,7 +169,7 @@ blorp_alloc_general_state(struct blorp_batch *blorp_batch,
|
|||||||
return blorp_alloc_dynamic_state(blorp_batch, size, alignment, offset);
|
return blorp_alloc_dynamic_state(blorp_batch, size, alignment, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
blorp_alloc_binding_table(struct blorp_batch *blorp_batch,
|
blorp_alloc_binding_table(struct blorp_batch *blorp_batch,
|
||||||
unsigned num_entries,
|
unsigned num_entries,
|
||||||
unsigned state_size,
|
unsigned state_size,
|
||||||
@@ -188,6 +188,8 @@ blorp_alloc_binding_table(struct blorp_batch *blorp_batch,
|
|||||||
&(surface_offsets)[i], NULL);
|
&(surface_offsets)[i], NULL);
|
||||||
bt_map[i] = surface_offsets[i];
|
bt_map[i] = surface_offsets[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
|
@@ -150,7 +150,7 @@ blorp_alloc_general_state(struct blorp_batch *blorp_batch,
|
|||||||
return blorp_alloc_dynamic_state(blorp_batch, size, alignment, offset);
|
return blorp_alloc_dynamic_state(blorp_batch, size, alignment, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
blorp_alloc_binding_table(struct blorp_batch *blorp_batch,
|
blorp_alloc_binding_table(struct blorp_batch *blorp_batch,
|
||||||
unsigned num_entries,
|
unsigned num_entries,
|
||||||
unsigned state_size,
|
unsigned state_size,
|
||||||
@@ -181,6 +181,8 @@ blorp_alloc_binding_table(struct blorp_batch *blorp_batch,
|
|||||||
iris_use_pinned_bo(batch, binder->bo, false, IRIS_DOMAIN_NONE);
|
iris_use_pinned_bo(batch, binder->bo, false, IRIS_DOMAIN_NONE);
|
||||||
|
|
||||||
batch->screen->vtbl.update_binder_address(batch, binder);
|
batch->screen->vtbl.update_binder_address(batch, binder);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
|
@@ -84,7 +84,7 @@ blorp_vf_invalidate_for_vb_48b_transitions(struct blorp_batch *batch,
|
|||||||
UNUSED static struct blorp_address
|
UNUSED static struct blorp_address
|
||||||
blorp_get_workaround_address(struct blorp_batch *batch);
|
blorp_get_workaround_address(struct blorp_batch *batch);
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
|
blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
|
||||||
unsigned state_size, unsigned state_alignment,
|
unsigned state_size, unsigned state_alignment,
|
||||||
uint32_t *bt_offset, uint32_t *surface_offsets,
|
uint32_t *bt_offset, uint32_t *surface_offsets,
|
||||||
@@ -1632,9 +1632,10 @@ blorp_setup_binding_table(struct blorp_batch *batch,
|
|||||||
bind_offset = params->pre_baked_binding_table_offset;
|
bind_offset = params->pre_baked_binding_table_offset;
|
||||||
} else {
|
} else {
|
||||||
unsigned num_surfaces = 1 + params->src.enabled;
|
unsigned num_surfaces = 1 + params->src.enabled;
|
||||||
blorp_alloc_binding_table(batch, num_surfaces,
|
if (!blorp_alloc_binding_table(batch, num_surfaces,
|
||||||
isl_dev->ss.size, isl_dev->ss.align,
|
isl_dev->ss.size, isl_dev->ss.align,
|
||||||
&bind_offset, surface_offsets, surface_maps);
|
&bind_offset, surface_offsets, surface_maps))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (params->dst.enabled) {
|
if (params->dst.enabled) {
|
||||||
blorp_emit_surface_state(batch, ¶ms->dst,
|
blorp_emit_surface_state(batch, ¶ms->dst,
|
||||||
|
@@ -146,7 +146,7 @@ blorp_alloc_general_state(struct blorp_batch *batch,
|
|||||||
return state.map;
|
return state.map;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
|
blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
|
||||||
unsigned state_size, unsigned state_alignment,
|
unsigned state_size, unsigned state_alignment,
|
||||||
uint32_t *bt_offset,
|
uint32_t *bt_offset,
|
||||||
@@ -161,7 +161,7 @@ blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
|
|||||||
anv_cmd_buffer_alloc_blorp_binding_table(cmd_buffer, num_entries,
|
anv_cmd_buffer_alloc_blorp_binding_table(cmd_buffer, num_entries,
|
||||||
&state_offset, &bt_state);
|
&state_offset, &bt_state);
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
uint32_t *bt_map = bt_state.map;
|
uint32_t *bt_map = bt_state.map;
|
||||||
*bt_offset = bt_state.offset;
|
*bt_offset = bt_state.offset;
|
||||||
@@ -169,10 +169,13 @@ blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
|
|||||||
for (unsigned i = 0; i < num_entries; i++) {
|
for (unsigned i = 0; i < num_entries; i++) {
|
||||||
struct anv_state surface_state =
|
struct anv_state surface_state =
|
||||||
anv_cmd_buffer_alloc_surface_state(cmd_buffer);
|
anv_cmd_buffer_alloc_surface_state(cmd_buffer);
|
||||||
|
|
||||||
bt_map[i] = surface_state.offset + state_offset;
|
bt_map[i] = surface_state.offset + state_offset;
|
||||||
surface_offsets[i] = surface_state.offset;
|
surface_offsets[i] = surface_state.offset;
|
||||||
surface_maps[i] = surface_state.map;
|
surface_maps[i] = surface_state.map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
|
@@ -180,7 +180,7 @@ blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
|
|||||||
anv_cmd_buffer_alloc_blorp_binding_table(cmd_buffer, num_entries,
|
anv_cmd_buffer_alloc_blorp_binding_table(cmd_buffer, num_entries,
|
||||||
&state_offset, &bt_state);
|
&state_offset, &bt_state);
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
uint32_t *bt_map = bt_state.map;
|
uint32_t *bt_map = bt_state.map;
|
||||||
*bt_offset = bt_state.offset;
|
*bt_offset = bt_state.offset;
|
||||||
@@ -192,6 +192,8 @@ blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
|
|||||||
surface_offsets[i] = surface_state.offset;
|
surface_offsets[i] = surface_state.offset;
|
||||||
surface_maps[i] = surface_state.map;
|
surface_maps[i] = surface_state.map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
|
Reference in New Issue
Block a user