diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 898ba2a26cb..5e817646936 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -336,9 +336,6 @@ panfrost_batch_read_rsrc(struct panfrost_batch *batch, panfrost_batch_add_bo_old(batch, rsrc->image.data.bo, access); - if (rsrc->image.crc.bo) - panfrost_batch_add_bo_old(batch, rsrc->image.crc.bo, access); - if (rsrc->separate_stencil) panfrost_batch_add_bo_old(batch, rsrc->separate_stencil->image.data.bo, access); @@ -355,9 +352,6 @@ panfrost_batch_write_rsrc(struct panfrost_batch *batch, panfrost_batch_add_bo_old(batch, rsrc->image.data.bo, access); - if (rsrc->image.crc.bo) - panfrost_batch_add_bo_old(batch, rsrc->image.crc.bo, access); - if (rsrc->separate_stencil) panfrost_batch_add_bo_old(batch, rsrc->separate_stencil->image.data.bo, access); diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 402346dcd59..10ea877de21 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -51,9 +51,6 @@ #include "pan_tiling.h" #include "decode.h" -static bool -panfrost_should_checksum(const struct panfrost_device *dev, const struct panfrost_resource *pres); - static struct pipe_resource * panfrost_resource_from_handle(struct pipe_screen *pscreen, const struct pipe_resource *templat, @@ -81,9 +78,6 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen, DRM_FORMAT_MOD_LINEAR : whandle->modifier; enum mali_texture_dimension dim = panfrost_translate_texture_dimension(templat->target); - enum pan_image_crc_mode crc_mode = - panfrost_should_checksum(dev, rsc) ? - PAN_IMAGE_CRC_OOB : PAN_IMAGE_CRC_NONE; struct pan_image_explicit_layout explicit_layout = { .offset = whandle->offset, .row_stride = panfrost_from_legacy_stride(whandle->stride, templat->format, mod) @@ -99,7 +93,6 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen, .array_size = prsc->array_size, .nr_samples = MAX2(prsc->nr_samples, 1), .nr_slices = 1, - .crc_mode = crc_mode }; bool valid = pan_image_layout_init(&rsc->image.layout, &explicit_layout); @@ -117,8 +110,6 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen, FREE(rsc); return NULL; } - if (rsc->image.layout.crc_mode == PAN_IMAGE_CRC_OOB) - rsc->image.crc.bo = panfrost_bo_create(dev, rsc->image.layout.crc_size, 0, "CRC data"); rsc->modifier_constant = true; @@ -445,9 +436,6 @@ panfrost_resource_setup(struct panfrost_device *dev, { uint64_t chosen_mod = modifier != DRM_FORMAT_MOD_INVALID ? modifier : panfrost_best_modifier(dev, pres, fmt); - enum pan_image_crc_mode crc_mode = - panfrost_should_checksum(dev, pres) ? - PAN_IMAGE_CRC_INBAND : PAN_IMAGE_CRC_NONE; enum mali_texture_dimension dim = panfrost_translate_texture_dimension(pres->base.target); @@ -473,7 +461,7 @@ panfrost_resource_setup(struct panfrost_device *dev, .array_size = pres->base.array_size, .nr_samples = MAX2(pres->base.nr_samples, 1), .nr_slices = pres->base.last_level + 1, - .crc_mode = crc_mode + .crc = panfrost_should_checksum(dev, pres) }; ASSERTED bool valid = pan_image_layout_init(&pres->image.layout, NULL); @@ -776,9 +764,6 @@ panfrost_resource_destroy(struct pipe_screen *screen, if (rsrc->image.data.bo) panfrost_bo_unreference(rsrc->image.data.bo); - if (rsrc->image.crc.bo) - panfrost_bo_unreference(rsrc->image.crc.bo); - free(rsrc->index_cache); free(rsrc->damage.tile_map.data); @@ -1204,8 +1189,6 @@ pan_resource_modifier_convert(struct panfrost_context *ctx, } panfrost_bo_unreference(rsrc->image.data.bo); - if (rsrc->image.crc.bo) - panfrost_bo_unreference(rsrc->image.crc.bo); rsrc->image.data.bo = tmp_rsrc->image.data.bo; panfrost_bo_reference(rsrc->image.data.bo); @@ -1299,8 +1282,6 @@ panfrost_ptr_unmap(struct pipe_context *pctx, if (panfrost_should_linear_convert(dev, prsrc, transfer)) { panfrost_bo_unreference(prsrc->image.data.bo); - if (prsrc->image.crc.bo) - panfrost_bo_unreference(prsrc->image.crc.bo); panfrost_resource_setup(dev, prsrc, DRM_FORMAT_MOD_LINEAR, prsrc->image.layout.format); diff --git a/src/panfrost/lib/pan_cs.c b/src/panfrost/lib/pan_cs.c index cf405292c1b..7a62dcb3e0f 100644 --- a/src/panfrost/lib/pan_cs.c +++ b/src/panfrost/lib/pan_cs.c @@ -107,7 +107,7 @@ GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size) #if PAN_ARCH <= 6 if (fb->rt_count == 1 && fb->rts[0].view && !fb->rts[0].discard && - fb->rts[0].view->image->layout.crc_mode != PAN_IMAGE_CRC_NONE) + fb->rts[0].view->image->layout.crc) return 0; return -1; @@ -117,7 +117,7 @@ GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size) for (unsigned i = 0; i < fb->rt_count; i++) { if (!fb->rts[i].view || fb->rts[0].discard || - fb->rts[i].view->image->layout.crc_mode == PAN_IMAGE_CRC_NONE) + !fb->rts[i].view->image->layout.crc) continue; bool valid = *(fb->rts[i].crc_valid); @@ -274,10 +274,8 @@ pan_prepare_crc(const struct pan_fb_info *fb, int rt_crc, const struct pan_image_view *rt = fb->rts[rt_crc].view; const struct pan_image_slice_layout *slice = &rt->image->layout.slices[rt->first_level]; - ext->crc_base = (rt->image->layout.crc_mode == PAN_IMAGE_CRC_INBAND ? - (rt->image->data.bo->ptr.gpu + rt->image->data.offset) : - (rt->image->crc.bo->ptr.gpu + rt->image->crc.offset)) + - slice->crc.offset; + ext->crc_base = rt->image->data.bo->ptr.gpu + rt->image->data.offset + + slice->crc.offset; ext->crc_row_stride = slice->crc.stride; #if PAN_ARCH >= 7 @@ -883,20 +881,14 @@ GENX(pan_emit_fbd)(const struct panfrost_device *dev, assert(cfg.color_block_format == MALI_BLOCK_FORMAT_LINEAR || cfg.color_block_format == MALI_BLOCK_FORMAT_TILED_U_INTERLEAVED); - if (rt->image->layout.crc_mode != PAN_IMAGE_CRC_NONE) { + if (rt->image->layout.crc) { const struct pan_image_slice_layout *slice = &rt->image->layout.slices[level]; cfg.crc_buffer.row_stride = slice->crc.stride; - if (rt->image->layout.crc_mode == PAN_IMAGE_CRC_INBAND) { - cfg.crc_buffer.base = rt->image->data.bo->ptr.gpu + - rt->image->data.offset + - slice->crc.offset; - } else { - cfg.crc_buffer.base = rt->image->crc.bo->ptr.gpu + - rt->image->crc.offset + - slice->crc.offset; - } + cfg.crc_buffer.base = rt->image->data.bo->ptr.gpu + + rt->image->data.offset + + slice->crc.offset; } } diff --git a/src/panfrost/lib/pan_layout.c b/src/panfrost/lib/pan_layout.c index 127ad6c7815..b64a2d7a6e5 100644 --- a/src/panfrost/lib/pan_layout.c +++ b/src/panfrost/lib/pan_layout.c @@ -279,13 +279,13 @@ bool pan_image_layout_init(struct pan_image_layout *layout, const struct pan_image_explicit_layout *explicit_layout) { - /* Explicit stride only work with non-mipmap, non-array; single-sample - * 2D image, and in-band CRC can't be used. + /* Explicit stride only work with non-mipmap, non-array, single-sample + * 2D image without CRC. */ if (explicit_layout && (layout->depth > 1 || layout->nr_samples > 1 || layout->array_size > 1 || layout->dim != MALI_TEXTURE_DIMENSION_2D || - layout->nr_slices > 1 || layout->crc_mode == PAN_IMAGE_CRC_INBAND)) + layout->nr_slices > 1 || layout->crc)) return false; /* Mandate 64 byte alignement */ @@ -303,7 +303,6 @@ pan_image_layout_init(struct pan_image_layout *layout, bool linear = layout->modifier == DRM_FORMAT_MOD_LINEAR; bool is_3d = layout->dim == MALI_TEXTURE_DIMENSION_3D; - unsigned oob_crc_offset = 0; unsigned offset = explicit_layout ? explicit_layout->offset : 0; struct pan_block_size block_size = panfrost_block_size(layout->modifier, layout->format); @@ -392,18 +391,13 @@ pan_image_layout_init(struct pan_image_layout *layout, slice->size = slice_full_size; /* Add a checksum region if necessary */ - if (layout->crc_mode != PAN_IMAGE_CRC_NONE) { + if (layout->crc) { slice->crc.size = panfrost_compute_checksum_size(slice, width, height); - if (layout->crc_mode == PAN_IMAGE_CRC_INBAND) { - slice->crc.offset = offset; - offset += slice->crc.size; - slice->size += slice->crc.size; - } else { - slice->crc.offset = oob_crc_offset; - oob_crc_offset += slice->crc.size; - } + slice->crc.offset = offset; + offset += slice->crc.size; + slice->size += slice->crc.size; } width = u_minify(width, 1); @@ -417,7 +411,6 @@ pan_image_layout_init(struct pan_image_layout *layout, layout->data_size = offset; else layout->data_size = ALIGN_POT(layout->array_stride * layout->array_size, 4096); - layout->crc_size = oob_crc_offset; return true; } diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h index bd773fa374e..58dcef725b6 100644 --- a/src/panfrost/lib/pan_texture.h +++ b/src/panfrost/lib/pan_texture.h @@ -89,12 +89,6 @@ struct pan_image_slice_layout { unsigned size; }; -enum pan_image_crc_mode { - PAN_IMAGE_CRC_NONE, - PAN_IMAGE_CRC_INBAND, - PAN_IMAGE_CRC_OOB, -}; - struct pan_image_layout { uint64_t modifier; enum pipe_format format; @@ -103,7 +97,7 @@ struct pan_image_layout { enum mali_texture_dimension dim; unsigned nr_slices; unsigned array_size; - enum pan_image_crc_mode crc_mode; + bool crc; /* The remaining fields may be derived from the above by calling * pan_image_layout_init @@ -111,9 +105,6 @@ struct pan_image_layout { struct pan_image_slice_layout slices[MAX_MIP_LEVELS]; - /* crc_size != 0 only if crc_mode == OOB otherwise CRC words are - * counted in data_size */ - unsigned crc_size; unsigned data_size; unsigned array_stride; }; @@ -125,7 +116,6 @@ struct pan_image_mem { struct pan_image { struct pan_image_mem data; - struct pan_image_mem crc; struct pan_image_layout layout; }; diff --git a/src/panfrost/vulkan/panvk_image.c b/src/panfrost/vulkan/panvk_image.c index fa635abbc86..7e76da25400 100644 --- a/src/panfrost/vulkan/panvk_image.c +++ b/src/panfrost/vulkan/panvk_image.c @@ -85,7 +85,6 @@ panvk_image_create(VkDevice _device, .array_size = image->vk.array_layers, .nr_samples = image->vk.samples, .nr_slices = image->vk.mip_levels, - .crc_mode = PAN_IMAGE_CRC_NONE }; pan_image_layout_init(&image->pimage.layout, NULL);