panfrost: Pass the tile buffer budget through pan_fb_info
Pass the tile buffer budget through pan_fb_info instead of assuming the it's always panfrost_device::optimal_tib_size. This way we let the driver decide how much of the tile buffer it's allowed to use instead of making it a general rule. Most importantly, it's one less dependency on panfrost_device in pan_desc.c. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Constantine Shablya <constantine.shablya@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26698>
This commit is contained in:

committed by
Marge Bot

parent
95480bc2ab
commit
8b8942d4dc
@@ -451,11 +451,14 @@ panfrost_batch_to_fb_info(const struct panfrost_batch *batch,
|
|||||||
struct pan_image_view *zs, struct pan_image_view *s,
|
struct pan_image_view *zs, struct pan_image_view *s,
|
||||||
bool reserve)
|
bool reserve)
|
||||||
{
|
{
|
||||||
|
struct panfrost_device *dev = pan_device(batch->ctx->base.screen);
|
||||||
|
|
||||||
memset(fb, 0, sizeof(*fb));
|
memset(fb, 0, sizeof(*fb));
|
||||||
memset(rts, 0, sizeof(*rts) * 8);
|
memset(rts, 0, sizeof(*rts) * 8);
|
||||||
memset(zs, 0, sizeof(*zs));
|
memset(zs, 0, sizeof(*zs));
|
||||||
memset(s, 0, sizeof(*s));
|
memset(s, 0, sizeof(*s));
|
||||||
|
|
||||||
|
fb->tile_buf_budget = dev->optimal_tib_size;
|
||||||
fb->width = batch->key.width;
|
fb->width = batch->key.width;
|
||||||
fb->height = batch->key.height;
|
fb->height = batch->key.height;
|
||||||
fb->extent.minx = batch->minx;
|
fb->extent.minx = batch->minx;
|
||||||
|
@@ -691,7 +691,7 @@ GENX(pan_emit_fbd)(const struct panfrost_device *dev,
|
|||||||
|
|
||||||
unsigned bytes_per_pixel = pan_cbuf_bytes_per_pixel(dev, fb);
|
unsigned bytes_per_pixel = pan_cbuf_bytes_per_pixel(dev, fb);
|
||||||
unsigned tile_size =
|
unsigned tile_size =
|
||||||
pan_select_max_tile_size(dev->optimal_tib_size, bytes_per_pixel);
|
pan_select_max_tile_size(fb->tile_buf_budget, bytes_per_pixel);
|
||||||
|
|
||||||
/* Clamp tile size to hardware limits */
|
/* Clamp tile size to hardware limits */
|
||||||
tile_size = MIN2(tile_size, 16 * 16);
|
tile_size = MIN2(tile_size, 16 * 16);
|
||||||
@@ -699,7 +699,7 @@ GENX(pan_emit_fbd)(const struct panfrost_device *dev,
|
|||||||
|
|
||||||
/* Colour buffer allocations must be 1K aligned. */
|
/* Colour buffer allocations must be 1K aligned. */
|
||||||
unsigned cbuf_allocation = ALIGN_POT(bytes_per_pixel * tile_size, 1024);
|
unsigned cbuf_allocation = ALIGN_POT(bytes_per_pixel * tile_size, 1024);
|
||||||
assert(cbuf_allocation <= dev->optimal_tib_size && "tile too big");
|
assert(cbuf_allocation <= fb->tile_buf_budget && "tile too big");
|
||||||
|
|
||||||
int crc_rt = GENX(pan_select_crc_rt)(fb, tile_size);
|
int crc_rt = GENX(pan_select_crc_rt)(fb, tile_size);
|
||||||
bool has_zs_crc_ext = (fb->zs.view.zs || fb->zs.view.s || crc_rt >= 0);
|
bool has_zs_crc_ext = (fb->zs.view.zs || fb->zs.view.s || crc_rt >= 0);
|
||||||
|
@@ -125,6 +125,9 @@ struct pan_fb_info {
|
|||||||
struct pan_fb_bifrost_info bifrost;
|
struct pan_fb_bifrost_info bifrost;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Optimal tile buffer size. */
|
||||||
|
unsigned tile_buf_budget;
|
||||||
|
|
||||||
/* Only used on Valhall */
|
/* Only used on Valhall */
|
||||||
bool sprite_coord_origin;
|
bool sprite_coord_origin;
|
||||||
bool first_provoking_vertex;
|
bool first_provoking_vertex;
|
||||||
|
@@ -482,6 +482,7 @@ panvk_cmd_fb_info_init(struct panvk_cmd_buffer *cmdbuf)
|
|||||||
memset(cmdbuf->state.fb.crc_valid, 0, sizeof(cmdbuf->state.fb.crc_valid));
|
memset(cmdbuf->state.fb.crc_valid, 0, sizeof(cmdbuf->state.fb.crc_valid));
|
||||||
|
|
||||||
*fbinfo = (struct pan_fb_info){
|
*fbinfo = (struct pan_fb_info){
|
||||||
|
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||||
.width = fb->width,
|
.width = fb->width,
|
||||||
.height = fb->height,
|
.height = fb->height,
|
||||||
.extent.maxx = fb->width - 1,
|
.extent.maxx = fb->width - 1,
|
||||||
|
@@ -53,6 +53,7 @@ panvk_meta_blit(struct panvk_cmd_buffer *cmdbuf,
|
|||||||
};
|
};
|
||||||
|
|
||||||
*fbinfo = (struct pan_fb_info){
|
*fbinfo = (struct pan_fb_info){
|
||||||
|
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||||
.width = u_minify(blitinfo->dst.planes[0].image->layout.width,
|
.width = u_minify(blitinfo->dst.planes[0].image->layout.width,
|
||||||
blitinfo->dst.level),
|
blitinfo->dst.level),
|
||||||
.height = u_minify(blitinfo->dst.planes[0].image->layout.height,
|
.height = u_minify(blitinfo->dst.planes[0].image->layout.height,
|
||||||
|
@@ -332,6 +332,7 @@ panvk_meta_clear_color_img(struct panvk_cmd_buffer *cmdbuf,
|
|||||||
|
|
||||||
cmdbuf->state.fb.crc_valid[0] = false;
|
cmdbuf->state.fb.crc_valid[0] = false;
|
||||||
*fbinfo = (struct pan_fb_info){
|
*fbinfo = (struct pan_fb_info){
|
||||||
|
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||||
.nr_samples = img->pimage.layout.nr_samples,
|
.nr_samples = img->pimage.layout.nr_samples,
|
||||||
.rt_count = 1,
|
.rt_count = 1,
|
||||||
.rts[0].view = &view,
|
.rts[0].view = &view,
|
||||||
@@ -401,6 +402,7 @@ panvk_meta_clear_zs_img(struct panvk_cmd_buffer *cmdbuf,
|
|||||||
|
|
||||||
cmdbuf->state.fb.crc_valid[0] = false;
|
cmdbuf->state.fb.crc_valid[0] = false;
|
||||||
*fbinfo = (struct pan_fb_info){
|
*fbinfo = (struct pan_fb_info){
|
||||||
|
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||||
.nr_samples = img->pimage.layout.nr_samples,
|
.nr_samples = img->pimage.layout.nr_samples,
|
||||||
.rt_count = 1,
|
.rt_count = 1,
|
||||||
.zs.clear_value.depth = value->depth,
|
.zs.clear_value.depth = value->depth,
|
||||||
|
@@ -627,6 +627,7 @@ panvk_meta_copy_img2img(struct panvk_cmd_buffer *cmdbuf,
|
|||||||
u_minify(dst->pimage.layout.height, region->dstSubresource.mipLevel);
|
u_minify(dst->pimage.layout.height, region->dstSubresource.mipLevel);
|
||||||
cmdbuf->state.fb.crc_valid[0] = false;
|
cmdbuf->state.fb.crc_valid[0] = false;
|
||||||
*fbinfo = (struct pan_fb_info){
|
*fbinfo = (struct pan_fb_info){
|
||||||
|
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
.extent.minx = minx & ~31,
|
.extent.minx = minx & ~31,
|
||||||
@@ -1057,6 +1058,7 @@ panvk_meta_copy_buf2img(struct panvk_cmd_buffer *cmdbuf,
|
|||||||
/* TODO: don't force preloads of dst resources if unneeded */
|
/* TODO: don't force preloads of dst resources if unneeded */
|
||||||
cmdbuf->state.fb.crc_valid[0] = false;
|
cmdbuf->state.fb.crc_valid[0] = false;
|
||||||
*fbinfo = (struct pan_fb_info){
|
*fbinfo = (struct pan_fb_info){
|
||||||
|
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||||
.width =
|
.width =
|
||||||
u_minify(img->pimage.layout.width, region->imageSubresource.mipLevel),
|
u_minify(img->pimage.layout.width, region->imageSubresource.mipLevel),
|
||||||
.height =
|
.height =
|
||||||
|
Reference in New Issue
Block a user