anv: Remove anv_batch_emit_reloc and just open-code it
We don't need the relocation offsets anymore, and just want to pin the BO, and combine the address into a uint64_t. We can just open code those two things; it's actually less code. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18208>
This commit is contained in:

committed by
Marge Bot

parent
479a999637
commit
bc68e7b564
@@ -1432,35 +1432,17 @@ anv_batch_has_error(struct anv_batch *batch)
|
|||||||
return batch->status != VK_SUCCESS;
|
return batch->status != VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t
|
|
||||||
anv_batch_emit_reloc(struct anv_batch *batch,
|
|
||||||
void *location, struct anv_bo *bo, uint32_t delta)
|
|
||||||
{
|
|
||||||
uint64_t address_u64 = bo->offset + delta;
|
|
||||||
VkResult result = anv_reloc_list_add_bo(batch->relocs, batch->alloc, bo);
|
|
||||||
|
|
||||||
if (unlikely(result != VK_SUCCESS)) {
|
|
||||||
anv_batch_set_error(batch, result);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return address_u64;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint64_t
|
static inline uint64_t
|
||||||
_anv_combine_address(struct anv_batch *batch, void *location,
|
_anv_combine_address(struct anv_batch *batch, void *location,
|
||||||
const struct anv_address address, uint32_t delta)
|
const struct anv_address address, uint32_t delta)
|
||||||
{
|
{
|
||||||
if (address.bo == NULL) {
|
if (address.bo == NULL)
|
||||||
return address.offset + delta;
|
return address.offset + delta;
|
||||||
} else if (batch == NULL) {
|
|
||||||
return anv_address_physical(anv_address_add(address, delta));
|
if (batch)
|
||||||
} else {
|
anv_reloc_list_add_bo(batch->relocs, batch->alloc, address.bo);
|
||||||
assert(batch->start <= location && location < batch->end);
|
|
||||||
/* i915 relocations are signed. */
|
return anv_address_physical(anv_address_add(address, delta));
|
||||||
assert(INT32_MIN <= address.offset && address.offset <= INT32_MAX);
|
|
||||||
return anv_batch_emit_reloc(batch, location, address.bo, address.offset + delta);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __gen_address_type struct anv_address
|
#define __gen_address_type struct anv_address
|
||||||
|
@@ -71,10 +71,13 @@ blorp_emit_reloc(struct blorp_batch *batch,
|
|||||||
void *location, struct blorp_address address, uint32_t delta)
|
void *location, struct blorp_address address, uint32_t delta)
|
||||||
{
|
{
|
||||||
struct anv_cmd_buffer *cmd_buffer = batch->driver_batch;
|
struct anv_cmd_buffer *cmd_buffer = batch->driver_batch;
|
||||||
assert(cmd_buffer->batch.start <= location &&
|
struct anv_address anv_addr = {
|
||||||
location < cmd_buffer->batch.end);
|
.bo = address.buffer,
|
||||||
return anv_batch_emit_reloc(&cmd_buffer->batch, location,
|
.offset = address.offset,
|
||||||
address.buffer, address.offset + delta);
|
};
|
||||||
|
anv_reloc_list_add_bo(cmd_buffer->batch.relocs,
|
||||||
|
cmd_buffer->batch.alloc, anv_addr.bo);
|
||||||
|
return anv_address_physical(anv_address_add(anv_addr, delta));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -5723,12 +5723,11 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
const struct anv_address depth_address =
|
const struct anv_address depth_address =
|
||||||
anv_image_address(image, &depth_surface->memory_range);
|
anv_image_address(image, &depth_surface->memory_range);
|
||||||
|
|
||||||
info.depth_surf = &depth_surface->isl;
|
anv_reloc_list_add_bo(cmd_buffer->batch.relocs,
|
||||||
|
cmd_buffer->batch.alloc, depth_address.bo);
|
||||||
|
|
||||||
info.depth_address =
|
info.depth_surf = &depth_surface->isl;
|
||||||
anv_batch_emit_reloc(&cmd_buffer->batch,
|
info.depth_address = anv_address_physical(depth_address);
|
||||||
dw + device->isl_dev.ds.depth_offset / 4,
|
|
||||||
depth_address.bo, depth_address.offset);
|
|
||||||
info.mocs =
|
info.mocs =
|
||||||
anv_mocs(device, depth_address.bo, ISL_SURF_USAGE_DEPTH_BIT);
|
anv_mocs(device, depth_address.bo, ISL_SURF_USAGE_DEPTH_BIT);
|
||||||
|
|
||||||
@@ -5741,12 +5740,11 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
const struct anv_address hiz_address =
|
const struct anv_address hiz_address =
|
||||||
anv_image_address(image, &hiz_surface->memory_range);
|
anv_image_address(image, &hiz_surface->memory_range);
|
||||||
|
|
||||||
info.hiz_surf = &hiz_surface->isl;
|
anv_reloc_list_add_bo(cmd_buffer->batch.relocs,
|
||||||
|
cmd_buffer->batch.alloc, hiz_address.bo);
|
||||||
|
|
||||||
info.hiz_address =
|
info.hiz_surf = &hiz_surface->isl;
|
||||||
anv_batch_emit_reloc(&cmd_buffer->batch,
|
info.hiz_address = anv_address_physical(hiz_address);
|
||||||
dw + device->isl_dev.ds.hiz_offset / 4,
|
|
||||||
hiz_address.bo, hiz_address.offset);
|
|
||||||
|
|
||||||
info.depth_clear_value = ANV_HZ_FC_VAL;
|
info.depth_clear_value = ANV_HZ_FC_VAL;
|
||||||
}
|
}
|
||||||
@@ -5763,13 +5761,13 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
const struct anv_address stencil_address =
|
const struct anv_address stencil_address =
|
||||||
anv_image_address(image, &stencil_surface->memory_range);
|
anv_image_address(image, &stencil_surface->memory_range);
|
||||||
|
|
||||||
|
anv_reloc_list_add_bo(cmd_buffer->batch.relocs,
|
||||||
|
cmd_buffer->batch.alloc, stencil_address.bo);
|
||||||
|
|
||||||
info.stencil_surf = &stencil_surface->isl;
|
info.stencil_surf = &stencil_surface->isl;
|
||||||
|
|
||||||
info.stencil_aux_usage = image->planes[stencil_plane].aux_usage;
|
info.stencil_aux_usage = image->planes[stencil_plane].aux_usage;
|
||||||
info.stencil_address =
|
info.stencil_address = anv_address_physical(stencil_address);
|
||||||
anv_batch_emit_reloc(&cmd_buffer->batch,
|
|
||||||
dw + device->isl_dev.ds.stencil_offset / 4,
|
|
||||||
stencil_address.bo, stencil_address.offset);
|
|
||||||
info.mocs =
|
info.mocs =
|
||||||
anv_mocs(device, stencil_address.bo, ISL_SURF_USAGE_STENCIL_BIT);
|
anv_mocs(device, stencil_address.bo, ISL_SURF_USAGE_STENCIL_BIT);
|
||||||
}
|
}
|
||||||
@@ -5818,14 +5816,17 @@ cmd_buffer_emit_cps_control_buffer(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
struct isl_cpb_emit_info info = { };
|
struct isl_cpb_emit_info info = { };
|
||||||
|
|
||||||
if (fsr_iview) {
|
if (fsr_iview) {
|
||||||
|
const struct anv_image_binding *binding = &fsr_iview->image->bindings[0];
|
||||||
|
|
||||||
|
anv_reloc_list_add_bo(cmd_buffer->batch.relocs,
|
||||||
|
cmd_buffer->batch.alloc, binding->address.bo);
|
||||||
|
|
||||||
|
struct anv_address addr =
|
||||||
|
anv_address_add(binding->address, binding->memory_range.offset);
|
||||||
|
|
||||||
info.view = &fsr_iview->planes[0].isl;
|
info.view = &fsr_iview->planes[0].isl;
|
||||||
info.surf = &fsr_iview->image->planes[0].primary_surface.isl;
|
info.surf = &fsr_iview->image->planes[0].primary_surface.isl;
|
||||||
info.address =
|
info.address = anv_address_physical(addr);
|
||||||
anv_batch_emit_reloc(&cmd_buffer->batch,
|
|
||||||
dw + device->isl_dev.cpb.offset / 4,
|
|
||||||
fsr_iview->image->bindings[0].address.bo,
|
|
||||||
fsr_iview->image->bindings[0].address.offset +
|
|
||||||
fsr_iview->image->bindings[0].memory_range.offset);
|
|
||||||
info.mocs =
|
info.mocs =
|
||||||
anv_mocs(device, fsr_iview->image->bindings[0].address.bo,
|
anv_mocs(device, fsr_iview->image->bindings[0].address.bo,
|
||||||
ISL_SURF_USAGE_CPB_BIT);
|
ISL_SURF_USAGE_CPB_BIT);
|
||||||
|
Reference in New Issue
Block a user