anv: Use an address for each anv_image plane
This is better than having BO and offset fields. Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
This commit is contained in:
@@ -207,8 +207,8 @@ get_blorp_surf_for_anv_image(const struct anv_device *device,
|
|||||||
*blorp_surf = (struct blorp_surf) {
|
*blorp_surf = (struct blorp_surf) {
|
||||||
.surf = &surface->isl,
|
.surf = &surface->isl,
|
||||||
.addr = {
|
.addr = {
|
||||||
.buffer = image->planes[plane].bo,
|
.buffer = image->planes[plane].address.bo,
|
||||||
.offset = image->planes[plane].bo_offset + surface->offset,
|
.offset = image->planes[plane].address.offset + surface->offset,
|
||||||
.mocs = device->default_mocs,
|
.mocs = device->default_mocs,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -217,8 +217,8 @@ get_blorp_surf_for_anv_image(const struct anv_device *device,
|
|||||||
const struct anv_surface *aux_surface = &image->planes[plane].aux_surface;
|
const struct anv_surface *aux_surface = &image->planes[plane].aux_surface;
|
||||||
blorp_surf->aux_surf = &aux_surface->isl,
|
blorp_surf->aux_surf = &aux_surface->isl,
|
||||||
blorp_surf->aux_addr = (struct blorp_address) {
|
blorp_surf->aux_addr = (struct blorp_address) {
|
||||||
.buffer = image->planes[plane].bo,
|
.buffer = image->planes[plane].address.bo,
|
||||||
.offset = image->planes[plane].bo_offset + aux_surface->offset,
|
.offset = image->planes[plane].address.offset + aux_surface->offset,
|
||||||
.mocs = device->default_mocs,
|
.mocs = device->default_mocs,
|
||||||
};
|
};
|
||||||
blorp_surf->aux_usage = aux_usage;
|
blorp_surf->aux_usage = aux_usage;
|
||||||
@@ -1411,8 +1411,8 @@ anv_image_copy_to_shadow(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
struct blorp_surf shadow_surf = {
|
struct blorp_surf shadow_surf = {
|
||||||
.surf = &image->planes[0].shadow_surface.isl,
|
.surf = &image->planes[0].shadow_surface.isl,
|
||||||
.addr = {
|
.addr = {
|
||||||
.buffer = image->planes[0].bo,
|
.buffer = image->planes[0].address.bo,
|
||||||
.offset = image->planes[0].bo_offset +
|
.offset = image->planes[0].address.offset +
|
||||||
image->planes[0].shadow_surface.offset,
|
image->planes[0].shadow_surface.offset,
|
||||||
.mocs = cmd_buffer->device->default_mocs,
|
.mocs = cmd_buffer->device->default_mocs,
|
||||||
},
|
},
|
||||||
|
@@ -658,8 +658,9 @@ anv_DestroyImage(VkDevice _device, VkImage _image,
|
|||||||
|
|
||||||
for (uint32_t p = 0; p < image->n_planes; ++p) {
|
for (uint32_t p = 0; p < image->n_planes; ++p) {
|
||||||
if (image->planes[p].bo_is_owned) {
|
if (image->planes[p].bo_is_owned) {
|
||||||
assert(image->planes[p].bo != NULL);
|
assert(image->planes[p].address.bo != NULL);
|
||||||
anv_bo_cache_release(device, &device->bo_cache, image->planes[p].bo);
|
anv_bo_cache_release(device, &device->bo_cache,
|
||||||
|
image->planes[p].address.bo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,13 +676,14 @@ static void anv_image_bind_memory_plane(struct anv_device *device,
|
|||||||
assert(!image->planes[plane].bo_is_owned);
|
assert(!image->planes[plane].bo_is_owned);
|
||||||
|
|
||||||
if (!memory) {
|
if (!memory) {
|
||||||
image->planes[plane].bo = NULL;
|
image->planes[plane].address = ANV_NULL_ADDRESS;
|
||||||
image->planes[plane].bo_offset = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
image->planes[plane].bo = memory->bo;
|
image->planes[plane].address = (struct anv_address) {
|
||||||
image->planes[plane].bo_offset = memory_offset;
|
.bo = memory->bo,
|
||||||
|
.offset = memory_offset,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult anv_BindImageMemory(
|
VkResult anv_BindImageMemory(
|
||||||
@@ -1067,10 +1069,8 @@ anv_image_fill_surface_state(struct anv_device *device,
|
|||||||
if (!clear_color)
|
if (!clear_color)
|
||||||
clear_color = &default_clear_color;
|
clear_color = &default_clear_color;
|
||||||
|
|
||||||
const struct anv_address address = {
|
const struct anv_address address =
|
||||||
.bo = image->planes[plane].bo,
|
anv_address_add(image->planes[plane].address, surface->offset);
|
||||||
.offset = image->planes[plane].bo_offset + surface->offset,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (view_usage == ISL_SURF_USAGE_STORAGE_BIT &&
|
if (view_usage == ISL_SURF_USAGE_STORAGE_BIT &&
|
||||||
!(flags & ANV_IMAGE_VIEW_STATE_STORAGE_WRITE_ONLY) &&
|
!(flags & ANV_IMAGE_VIEW_STATE_STORAGE_WRITE_ONLY) &&
|
||||||
@@ -1159,10 +1159,8 @@ anv_image_fill_surface_state(struct anv_device *device,
|
|||||||
|
|
||||||
struct anv_address aux_address = ANV_NULL_ADDRESS;
|
struct anv_address aux_address = ANV_NULL_ADDRESS;
|
||||||
if (aux_usage != ISL_AUX_USAGE_NONE) {
|
if (aux_usage != ISL_AUX_USAGE_NONE) {
|
||||||
aux_address = (struct anv_address) {
|
aux_address = anv_address_add(image->planes[plane].address,
|
||||||
.bo = image->planes[plane].bo,
|
aux_surface->offset);
|
||||||
.offset = image->planes[plane].bo_offset + aux_surface->offset,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
state_inout->aux_address = aux_address;
|
state_inout->aux_address = aux_address;
|
||||||
|
|
||||||
|
@@ -93,8 +93,10 @@ VkResult anv_CreateDmaBufImageINTEL(
|
|||||||
if (device->instance->physicalDevice.supports_48bit_addresses)
|
if (device->instance->physicalDevice.supports_48bit_addresses)
|
||||||
mem->bo->flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
|
mem->bo->flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
|
||||||
|
|
||||||
image->planes[0].bo = mem->bo;
|
image->planes[0].address = (struct anv_address) {
|
||||||
image->planes[0].bo_offset = 0;
|
.bo = mem->bo,
|
||||||
|
.offset = 0,
|
||||||
|
};
|
||||||
|
|
||||||
assert(image->extent.width > 0);
|
assert(image->extent.width > 0);
|
||||||
assert(image->extent.height > 0);
|
assert(image->extent.height > 0);
|
||||||
|
@@ -2630,8 +2630,7 @@ struct anv_image {
|
|||||||
/**
|
/**
|
||||||
* BO associated with this plane, set when bound.
|
* BO associated with this plane, set when bound.
|
||||||
*/
|
*/
|
||||||
struct anv_bo *bo;
|
struct anv_address address;
|
||||||
VkDeviceSize bo_offset;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When destroying the image, also free the bo.
|
* When destroying the image, also free the bo.
|
||||||
@@ -2691,11 +2690,8 @@ anv_image_get_clear_color_addr(const struct anv_device *device,
|
|||||||
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
|
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
|
||||||
|
|
||||||
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
|
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
|
||||||
return (struct anv_address) {
|
return anv_address_add(image->planes[plane].address,
|
||||||
.bo = image->planes[plane].bo,
|
image->planes[plane].fast_clear_state_offset);
|
||||||
.offset = image->planes[plane].bo_offset +
|
|
||||||
image->planes[plane].fast_clear_state_offset,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct anv_address
|
static inline struct anv_address
|
||||||
|
@@ -3371,8 +3371,8 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
info.depth_address =
|
info.depth_address =
|
||||||
anv_batch_emit_reloc(&cmd_buffer->batch,
|
anv_batch_emit_reloc(&cmd_buffer->batch,
|
||||||
dw + device->isl_dev.ds.depth_offset / 4,
|
dw + device->isl_dev.ds.depth_offset / 4,
|
||||||
image->planes[depth_plane].bo,
|
image->planes[depth_plane].address.bo,
|
||||||
image->planes[depth_plane].bo_offset +
|
image->planes[depth_plane].address.offset +
|
||||||
surface->offset);
|
surface->offset);
|
||||||
|
|
||||||
const uint32_t ds =
|
const uint32_t ds =
|
||||||
@@ -3384,8 +3384,8 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
info.hiz_address =
|
info.hiz_address =
|
||||||
anv_batch_emit_reloc(&cmd_buffer->batch,
|
anv_batch_emit_reloc(&cmd_buffer->batch,
|
||||||
dw + device->isl_dev.ds.hiz_offset / 4,
|
dw + device->isl_dev.ds.hiz_offset / 4,
|
||||||
image->planes[depth_plane].bo,
|
image->planes[depth_plane].address.bo,
|
||||||
image->planes[depth_plane].bo_offset +
|
image->planes[depth_plane].address.offset +
|
||||||
image->planes[depth_plane].aux_surface.offset);
|
image->planes[depth_plane].aux_surface.offset);
|
||||||
|
|
||||||
info.depth_clear_value = ANV_HZ_FC_VAL;
|
info.depth_clear_value = ANV_HZ_FC_VAL;
|
||||||
@@ -3402,8 +3402,9 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
info.stencil_address =
|
info.stencil_address =
|
||||||
anv_batch_emit_reloc(&cmd_buffer->batch,
|
anv_batch_emit_reloc(&cmd_buffer->batch,
|
||||||
dw + device->isl_dev.ds.stencil_offset / 4,
|
dw + device->isl_dev.ds.stencil_offset / 4,
|
||||||
image->planes[stencil_plane].bo,
|
image->planes[stencil_plane].address.bo,
|
||||||
image->planes[stencil_plane].bo_offset + surface->offset);
|
image->planes[stencil_plane].address.offset +
|
||||||
|
surface->offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
isl_emit_depth_stencil_hiz_s(&device->isl_dev, dw, &info);
|
isl_emit_depth_stencil_hiz_s(&device->isl_dev, dw, &info);
|
||||||
|
Reference in New Issue
Block a user