iris: Finish aux import in iris_resource_from_handle
This allows us to delete iris_resource_unfinished_aux_import, which incorrectly assumed that a CCS-enabled resource needs an aux BO. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12795>
This commit is contained in:
@@ -238,8 +238,6 @@ iris_blorp_surf_for_resource(struct isl_device *isl_dev,
|
||||
{
|
||||
struct iris_resource *res = (void *) p_res;
|
||||
|
||||
assert(!iris_resource_unfinished_aux_import(res));
|
||||
|
||||
*surf = (struct blorp_surf) {
|
||||
.surf = &res->surf,
|
||||
.addr = (struct blorp_address) {
|
||||
@@ -462,11 +460,6 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info)
|
||||
enum pipe_format dst_pfmt =
|
||||
pipe_format_for_aspect(info->dst.format, aspect);
|
||||
|
||||
if (iris_resource_unfinished_aux_import(src_res))
|
||||
iris_resource_finish_aux_import(ctx->screen, src_res);
|
||||
if (iris_resource_unfinished_aux_import(dst_res))
|
||||
iris_resource_finish_aux_import(ctx->screen, dst_res);
|
||||
|
||||
struct iris_format_info src_fmt =
|
||||
iris_format_for_usage(devinfo, src_pfmt, ISL_SURF_USAGE_TEXTURE_BIT);
|
||||
enum isl_aux_usage src_aux_usage =
|
||||
@@ -741,13 +734,6 @@ iris_resource_copy_region(struct pipe_context *ctx,
|
||||
struct iris_context *ice = (void *) ctx;
|
||||
struct iris_screen *screen = (void *) ctx->screen;
|
||||
struct iris_batch *batch = &ice->batches[IRIS_BATCH_RENDER];
|
||||
struct iris_resource *src = (void *) p_src;
|
||||
struct iris_resource *dst = (void *) p_dst;
|
||||
|
||||
if (iris_resource_unfinished_aux_import(src))
|
||||
iris_resource_finish_aux_import(ctx->screen, src);
|
||||
if (iris_resource_unfinished_aux_import(dst))
|
||||
iris_resource_finish_aux_import(ctx->screen, dst);
|
||||
|
||||
/* Use MI_COPY_MEM_MEM for tiny (<= 16 byte, % 4) buffer copies. */
|
||||
if (p_src->target == PIPE_BUFFER && p_dst->target == PIPE_BUFFER &&
|
||||
@@ -777,7 +763,7 @@ iris_resource_copy_region(struct pipe_context *ctx,
|
||||
dsty, dstz, &s_src_res->base.b, src_level, src_box);
|
||||
}
|
||||
|
||||
iris_flush_and_dirty_for_history(ice, batch, dst,
|
||||
iris_flush_and_dirty_for_history(ice, batch, (struct iris_resource *)p_dst,
|
||||
PIPE_CONTROL_RENDER_TARGET_FLUSH | PIPE_CONTROL_TILE_CACHE_FLUSH,
|
||||
"cache history: post copy_region");
|
||||
}
|
||||
|
@@ -704,12 +704,8 @@ iris_clear_texture(struct pipe_context *ctx,
|
||||
{
|
||||
struct iris_context *ice = (void *) ctx;
|
||||
struct iris_screen *screen = (void *) ctx->screen;
|
||||
struct iris_resource *res = (void *) p_res;
|
||||
const struct intel_device_info *devinfo = &screen->devinfo;
|
||||
|
||||
if (iris_resource_unfinished_aux_import(res))
|
||||
iris_resource_finish_aux_import(ctx->screen, res);
|
||||
|
||||
if (util_format_is_depth_or_stencil(p_res->format)) {
|
||||
const struct util_format_unpack_description *unpack =
|
||||
util_format_unpack_description(p_res->format);
|
||||
|
@@ -898,12 +898,11 @@ import_aux_info(struct iris_resource *res,
|
||||
res->aux.offset = aux_res->aux.offset;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
iris_resource_finish_aux_import(struct pipe_screen *pscreen,
|
||||
struct iris_resource *res)
|
||||
{
|
||||
struct iris_screen *screen = (struct iris_screen *)pscreen;
|
||||
assert(iris_resource_unfinished_aux_import(res));
|
||||
|
||||
/* Create an array of resources. Combining main and aux planes is easier
|
||||
* with indexing as opposed to scanning the linked list.
|
||||
@@ -1276,6 +1275,12 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
|
||||
res->bo = NULL;
|
||||
}
|
||||
|
||||
if (get_num_planes(&res->base.b) ==
|
||||
iris_get_dmabuf_modifier_planes(pscreen, whandle->modifier,
|
||||
whandle->format)) {
|
||||
iris_resource_finish_aux_import(pscreen, res);
|
||||
}
|
||||
|
||||
return &res->base.b;
|
||||
|
||||
fail:
|
||||
@@ -1418,14 +1423,10 @@ iris_resource_get_param(struct pipe_screen *pscreen,
|
||||
bool mod_with_aux =
|
||||
res->mod_info && res->mod_info->aux_usage != ISL_AUX_USAGE_NONE;
|
||||
bool wants_aux = mod_with_aux && plane > 0;
|
||||
struct iris_bo *bo = wants_aux ? res->aux.bo : res->bo;
|
||||
bool result;
|
||||
unsigned handle;
|
||||
|
||||
if (iris_resource_unfinished_aux_import(res))
|
||||
iris_resource_finish_aux_import(pscreen, res);
|
||||
|
||||
struct iris_bo *bo = wants_aux ? res->aux.bo : res->bo;
|
||||
|
||||
iris_resource_disable_aux_on_first_query(resource, handle_usage);
|
||||
|
||||
switch (param) {
|
||||
@@ -2043,9 +2044,6 @@ iris_transfer_map(struct pipe_context *ctx,
|
||||
struct iris_resource *res = (struct iris_resource *)resource;
|
||||
struct isl_surf *surf = &res->surf;
|
||||
|
||||
if (iris_resource_unfinished_aux_import(res))
|
||||
iris_resource_finish_aux_import(ctx->screen, res);
|
||||
|
||||
if (usage & PIPE_MAP_DISCARD_WHOLE_RESOURCE) {
|
||||
/* Replace the backing storage with a fresh buffer for non-async maps */
|
||||
if (!(usage & (PIPE_MAP_UNSYNCHRONIZED |
|
||||
@@ -2281,9 +2279,6 @@ iris_texture_subdata(struct pipe_context *ctx,
|
||||
|
||||
assert(resource->target != PIPE_BUFFER);
|
||||
|
||||
if (iris_resource_unfinished_aux_import(res))
|
||||
iris_resource_finish_aux_import(ctx->screen, res);
|
||||
|
||||
/* Just use the transfer-based path for linear buffers - it will already
|
||||
* do a direct mapping, or a simple linear staging buffer.
|
||||
*
|
||||
|
@@ -488,16 +488,6 @@ enum isl_aux_usage iris_image_view_aux_usage(struct iris_context *ice,
|
||||
enum isl_format iris_image_view_get_format(struct iris_context *ice,
|
||||
const struct pipe_image_view *img);
|
||||
|
||||
static inline bool
|
||||
iris_resource_unfinished_aux_import(struct iris_resource *res)
|
||||
{
|
||||
return res->aux.bo == NULL && res->mod_info &&
|
||||
res->mod_info->aux_usage != ISL_AUX_USAGE_NONE;
|
||||
}
|
||||
|
||||
void iris_resource_finish_aux_import(struct pipe_screen *pscreen,
|
||||
struct iris_resource *res);
|
||||
|
||||
bool iris_has_invalid_primary(const struct iris_resource *res,
|
||||
unsigned start_level, unsigned num_levels,
|
||||
unsigned start_layer, unsigned num_layers);
|
||||
|
@@ -2340,8 +2340,6 @@ fill_surface_state(struct isl_device *isl_dev,
|
||||
.y_offset_sa = tile_y_sa,
|
||||
};
|
||||
|
||||
assert(!iris_resource_unfinished_aux_import(res));
|
||||
|
||||
if (aux_usage != ISL_AUX_USAGE_NONE) {
|
||||
f.aux_surf = &res->aux.surf;
|
||||
f.aux_usage = aux_usage;
|
||||
@@ -2436,9 +2434,6 @@ iris_create_sampler_view(struct pipe_context *ctx,
|
||||
tmpl->u.tex.last_layer - tmpl->u.tex.first_layer + 1;
|
||||
}
|
||||
|
||||
if (iris_resource_unfinished_aux_import(isv->res))
|
||||
iris_resource_finish_aux_import(&screen->base, isv->res);
|
||||
|
||||
unsigned aux_modes = isv->res->aux.sampler_usages;
|
||||
while (aux_modes) {
|
||||
enum isl_aux_usage aux_usage = u_bit_scan(&aux_modes);
|
||||
@@ -2597,9 +2592,6 @@ iris_create_surface(struct pipe_context *ctx,
|
||||
#endif
|
||||
|
||||
if (!isl_format_is_compressed(res->surf.format)) {
|
||||
if (iris_resource_unfinished_aux_import(res))
|
||||
iris_resource_finish_aux_import(&screen->base, res);
|
||||
|
||||
void *map = surf->surface_state.cpu;
|
||||
UNUSED void *map_read = surf->surface_state_read.cpu;
|
||||
|
||||
|
Reference in New Issue
Block a user