panfrost,panvk: rename pan_fb_info::extent to draw_extent

This represents what this bounding box is being used for better,
as it can be easily confused with the framebuffer bounding box
otherwise.

Also fixes the comment about inclusiveness, as these are being
used as exclusive on both panfrost and panvk.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37771>
This commit is contained in:
Utku Iseri 2025-10-13 19:37:19 +02:00 committed by Marge Bot
parent b722e17203
commit bde9156dcf
7 changed files with 66 additions and 58 deletions

View file

@ -1073,10 +1073,10 @@ pan_preload_emit_dcd(struct pan_fb_preload_cache *cache, struct pan_pool *pool,
maxy = fb->height - 1; maxy = fb->height - 1;
} else { } else {
/* Align on 32x32 tiles */ /* Align on 32x32 tiles */
minx = fb->extent.minx & ~31; minx = fb->draw_extent.minx & ~31;
miny = fb->extent.miny & ~31; miny = fb->draw_extent.miny & ~31;
maxx = MIN2(ALIGN_POT(fb->extent.maxx + 1, 32), fb->width) - 1; maxx = MIN2(ALIGN_POT(fb->draw_extent.maxx + 1, 32), fb->width) - 1;
maxy = MIN2(ALIGN_POT(fb->extent.maxy + 1, 32), fb->height) - 1; maxy = MIN2(ALIGN_POT(fb->draw_extent.maxy + 1, 32), fb->height) - 1;
} }
cfg.thread_storage = tsd; cfg.thread_storage = tsd;
@ -1221,9 +1221,9 @@ pan_preload_emit_pre_frame_dcd(struct pan_fb_preload_cache *cache,
* write even clean tiles to make sure CRC data is updated. */ * write even clean tiles to make sure CRC data is updated. */
if (crc_rt >= 0) { if (crc_rt >= 0) {
bool *valid = fb->rts[crc_rt].crc_valid; bool *valid = fb->rts[crc_rt].crc_valid;
bool full = !fb->extent.minx && !fb->extent.miny && bool full = !fb->draw_extent.minx && !fb->draw_extent.miny &&
fb->extent.maxx == (fb->width - 1) && fb->draw_extent.maxx == (fb->width - 1) &&
fb->extent.maxy == (fb->height - 1); fb->draw_extent.maxy == (fb->height - 1);
if (full && !(*valid)) if (full && !(*valid))
always_write = true; always_write = true;
@ -1241,9 +1241,9 @@ pan_preload_emit_pre_frame_dcd(struct pan_fb_preload_cache *cache,
* performance. The UNUSED tag is because some PAN_ARCH variants do not * performance. The UNUSED tag is because some PAN_ARCH variants do not
* need this test. * need this test.
*/ */
UNUSED bool always = !fb->extent.minx && !fb->extent.miny && UNUSED bool always = !fb->draw_extent.minx && !fb->draw_extent.miny &&
fb->extent.maxx == (fb->width - 1) && fb->draw_extent.maxx == (fb->width - 1) &&
fb->extent.maxy == (fb->height - 1); fb->draw_extent.maxy == (fb->height - 1);
/* If we're dealing with a combined ZS resource and only one /* If we're dealing with a combined ZS resource and only one
* component is cleared, we need to reload the whole surface * component is cleared, we need to reload the whole surface

View file

@ -486,10 +486,10 @@ panfrost_batch_to_fb_info(const struct panfrost_batch *batch,
fb->z_tile_buf_budget = dev->optimal_z_tib_size; fb->z_tile_buf_budget = dev->optimal_z_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->draw_extent.minx = batch->minx;
fb->extent.miny = batch->miny; fb->draw_extent.miny = batch->miny;
fb->extent.maxx = batch->maxx - 1; fb->draw_extent.maxx = batch->maxx - 1;
fb->extent.maxy = batch->maxy - 1; fb->draw_extent.maxy = batch->maxy - 1;
fb->nr_samples = util_framebuffer_get_num_samples(&batch->key); fb->nr_samples = util_framebuffer_get_num_samples(&batch->key);
fb->force_samples = (batch->line_smoothing == U_TRISTATE_YES) ? 16 : 0; fb->force_samples = (batch->line_smoothing == U_TRISTATE_YES) ? 16 : 0;
fb->rt_count = batch->key.nr_cbufs; fb->rt_count = batch->key.nr_cbufs;
@ -526,12 +526,16 @@ panfrost_batch_to_fb_info(const struct panfrost_batch *batch,
* the damage region is "undefined behavior", so we should be safe. * the damage region is "undefined behavior", so we should be safe.
*/ */
if (!fb->rts[i].discard) { if (!fb->rts[i].discard) {
fb->extent.minx = MAX2(fb->extent.minx, prsrc->damage.extent.minx); fb->draw_extent.minx =
fb->extent.miny = MAX2(fb->extent.miny, prsrc->damage.extent.miny); MAX2(fb->draw_extent.minx, prsrc->damage.extent.minx);
fb->extent.maxx = MIN2(fb->extent.maxx, prsrc->damage.extent.maxx - 1); fb->draw_extent.miny =
fb->extent.maxy = MIN2(fb->extent.maxy, prsrc->damage.extent.maxy - 1); MAX2(fb->draw_extent.miny, prsrc->damage.extent.miny);
assert(fb->extent.minx <= fb->extent.maxx); fb->draw_extent.maxx =
assert(fb->extent.miny <= fb->extent.maxy); MIN2(fb->draw_extent.maxx, prsrc->damage.extent.maxx - 1);
fb->draw_extent.maxy =
MIN2(fb->draw_extent.maxy, prsrc->damage.extent.maxy - 1);
assert(fb->draw_extent.minx <= fb->draw_extent.maxx);
assert(fb->draw_extent.miny <= fb->draw_extent.maxy);
} }
rts[i].format = surf->format; rts[i].format = surf->format;

View file

@ -111,9 +111,9 @@ GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size)
continue; continue;
bool valid = *(fb->rts[i].crc_valid); bool valid = *(fb->rts[i].crc_valid);
bool full = !fb->extent.minx && !fb->extent.miny && bool full = !fb->draw_extent.minx && !fb->draw_extent.miny &&
fb->extent.maxx == (fb->width - 1) && fb->draw_extent.maxx == (fb->width - 1) &&
fb->extent.maxy == (fb->height - 1); fb->draw_extent.maxy == (fb->height - 1);
if (!full && !valid) if (!full && !valid)
continue; continue;
@ -1135,9 +1135,9 @@ GENX(pan_emit_fbd)(const struct pan_fb_info *fb, unsigned layer_idx,
if (crc_rt >= 0) { if (crc_rt >= 0) {
bool *valid = fb->rts[crc_rt].crc_valid; bool *valid = fb->rts[crc_rt].crc_valid;
bool full = !fb->extent.minx && !fb->extent.miny && bool full = !fb->draw_extent.minx && !fb->draw_extent.miny &&
fb->extent.maxx == (fb->width - 1) && fb->draw_extent.maxx == (fb->width - 1) &&
fb->extent.maxy == (fb->height - 1); fb->draw_extent.maxy == (fb->height - 1);
bool clean_tile_write = fb->rts[crc_rt].clear; bool clean_tile_write = fb->rts[crc_rt].clear;
#if PAN_ARCH >= 6 #if PAN_ARCH >= 6
@ -1386,10 +1386,10 @@ GENX(pan_emit_fragment_job_payload)(const struct pan_fb_info *fb, uint64_t fbd,
void *out) void *out)
{ {
pan_section_pack(out, FRAGMENT_JOB, PAYLOAD, payload) { pan_section_pack(out, FRAGMENT_JOB, PAYLOAD, payload) {
payload.bound_min_x = fb->extent.minx >> MALI_TILE_SHIFT; payload.bound_min_x = fb->draw_extent.minx >> MALI_TILE_SHIFT;
payload.bound_min_y = fb->extent.miny >> MALI_TILE_SHIFT; payload.bound_min_y = fb->draw_extent.miny >> MALI_TILE_SHIFT;
payload.bound_max_x = fb->extent.maxx >> MALI_TILE_SHIFT; payload.bound_max_x = fb->draw_extent.maxx >> MALI_TILE_SHIFT;
payload.bound_max_y = fb->extent.maxy >> MALI_TILE_SHIFT; payload.bound_max_y = fb->draw_extent.maxy >> MALI_TILE_SHIFT;
payload.framebuffer = fbd; payload.framebuffer = fbd;
#if PAN_ARCH >= 5 #if PAN_ARCH >= 5

View file

@ -131,10 +131,11 @@ struct pan_fb_bifrost_info {
struct pan_fb_info { struct pan_fb_info {
unsigned width, height; unsigned width, height;
/* Draw-extent controlled by viewports/scissors. */
struct { struct {
/* Max values are inclusive */ /* Max values are exclusive */
unsigned minx, miny, maxx, maxy; unsigned minx, miny, maxx, maxy;
} extent; } draw_extent;
unsigned nr_samples; unsigned nr_samples;
unsigned force_samples; /* samples used for rasterization */ unsigned force_samples; /* samples used for rasterization */
unsigned rt_count; unsigned rt_count;

View file

@ -3075,9 +3075,9 @@ issue_fragment_jobs(struct panvk_cmd_buffer *cmdbuf)
/* Now initialize the fragment bits. */ /* Now initialize the fragment bits. */
cs_update_frag_ctx(b) { cs_update_frag_ctx(b) {
cs_move32_to(b, cs_sr_reg32(b, FRAGMENT, BBOX_MIN), cs_move32_to(b, cs_sr_reg32(b, FRAGMENT, BBOX_MIN),
(fbinfo->extent.miny << 16) | fbinfo->extent.minx); (fbinfo->draw_extent.miny << 16) | fbinfo->draw_extent.minx);
cs_move32_to(b, cs_sr_reg32(b, FRAGMENT, BBOX_MAX), cs_move32_to(b, cs_sr_reg32(b, FRAGMENT, BBOX_MAX),
(fbinfo->extent.maxy << 16) | fbinfo->extent.maxx); (fbinfo->draw_extent.maxy << 16) | fbinfo->draw_extent.maxx);
} }
bool simul_use = bool simul_use =

View file

@ -336,19 +336,19 @@ panvk_per_arch(cmd_init_render_state)(struct panvk_cmd_buffer *cmdbuf,
} }
} }
fbinfo->extent.minx = pRenderingInfo->renderArea.offset.x; fbinfo->draw_extent.minx = pRenderingInfo->renderArea.offset.x;
fbinfo->extent.maxx = pRenderingInfo->renderArea.offset.x + fbinfo->draw_extent.maxx = pRenderingInfo->renderArea.offset.x +
pRenderingInfo->renderArea.extent.width - 1; pRenderingInfo->renderArea.extent.width - 1;
fbinfo->extent.miny = pRenderingInfo->renderArea.offset.y; fbinfo->draw_extent.miny = pRenderingInfo->renderArea.offset.y;
fbinfo->extent.maxy = pRenderingInfo->renderArea.offset.y + fbinfo->draw_extent.maxy = pRenderingInfo->renderArea.offset.y +
pRenderingInfo->renderArea.extent.height - 1; pRenderingInfo->renderArea.extent.height - 1;
if (state->render.bound_attachments) { if (state->render.bound_attachments) {
fbinfo->width = att_width; fbinfo->width = att_width;
fbinfo->height = att_height; fbinfo->height = att_height;
} else { } else {
fbinfo->width = fbinfo->extent.maxx + 1; fbinfo->width = fbinfo->draw_extent.maxx + 1;
fbinfo->height = fbinfo->extent.maxy + 1; fbinfo->height = fbinfo->draw_extent.maxy + 1;
} }
assert(fbinfo->width && fbinfo->height); assert(fbinfo->width && fbinfo->height);
@ -467,10 +467,12 @@ panvk_per_arch(cmd_resolve_attachments)(struct panvk_cmd_buffer *cmdbuf)
.sType = VK_STRUCTURE_TYPE_RENDERING_INFO, .sType = VK_STRUCTURE_TYPE_RENDERING_INFO,
.renderArea = .renderArea =
{ {
.offset.x = fbinfo->extent.minx, .offset.x = fbinfo->draw_extent.minx,
.offset.y = fbinfo->extent.miny, .offset.y = fbinfo->draw_extent.miny,
.extent.width = fbinfo->extent.maxx - fbinfo->extent.minx + 1, .extent.width =
.extent.height = fbinfo->extent.maxy - fbinfo->extent.miny + 1, fbinfo->draw_extent.maxx - fbinfo->draw_extent.minx + 1,
.extent.height =
fbinfo->draw_extent.maxy - fbinfo->draw_extent.miny + 1,
}, },
.layerCount = cmdbuf->state.gfx.render.layer_count, .layerCount = cmdbuf->state.gfx.render.layer_count,
.viewMask = cmdbuf->state.gfx.render.view_mask, .viewMask = cmdbuf->state.gfx.render.view_mask,
@ -610,11 +612,12 @@ panvk_per_arch(cmd_preload_render_area_border)(
struct pan_fb_info *fbinfo = &state->render.fb.info; struct pan_fb_info *fbinfo = &state->render.fb.info;
bool render_area_is_aligned = bool render_area_is_aligned =
((fbinfo->extent.minx | fbinfo->extent.miny) % meta_tile_size) == 0 && ((fbinfo->draw_extent.minx | fbinfo->draw_extent.miny) %
(fbinfo->extent.maxx + 1 == fbinfo->width || meta_tile_size) == 0 &&
(fbinfo->extent.maxx % meta_tile_size) == (meta_tile_size - 1)) && (fbinfo->draw_extent.maxx + 1 == fbinfo->width ||
(fbinfo->extent.maxy + 1 == fbinfo->height || (fbinfo->draw_extent.maxx % meta_tile_size) == (meta_tile_size - 1)) &&
(fbinfo->extent.maxy % meta_tile_size) == (meta_tile_size - 1)); (fbinfo->draw_extent.maxy + 1 == fbinfo->height ||
(fbinfo->draw_extent.maxy % meta_tile_size) == (meta_tile_size - 1));
/* If the render area is aligned on the meta tile size, we're good. */ /* If the render area is aligned on the meta tile size, we're good. */
if (!render_area_is_aligned) if (!render_area_is_aligned)

View file

@ -382,10 +382,10 @@ cmd_emit_dcd(struct panvk_cmd_buffer *cmdbuf, struct pan_fb_info *fbinfo,
uint16_t minx = 0, miny = 0, maxx, maxy; uint16_t minx = 0, miny = 0, maxx, maxy;
/* Align on 32x32 tiles */ /* Align on 32x32 tiles */
minx = fbinfo->extent.minx & ~31; minx = fbinfo->draw_extent.minx & ~31;
miny = fbinfo->extent.miny & ~31; miny = fbinfo->draw_extent.miny & ~31;
maxx = MIN2(ALIGN_POT(fbinfo->extent.maxx + 1, 32), fbinfo->width) - 1; maxx = MIN2(ALIGN_POT(fbinfo->draw_extent.maxx + 1, 32), fbinfo->width) - 1;
maxy = MIN2(ALIGN_POT(fbinfo->extent.maxy + 1, 32), fbinfo->height) - 1; maxy = MIN2(ALIGN_POT(fbinfo->draw_extent.maxy + 1, 32), fbinfo->height) - 1;
struct pan_ptr vpd = panvk_cmd_alloc_desc(cmdbuf, VIEWPORT); struct pan_ptr vpd = panvk_cmd_alloc_desc(cmdbuf, VIEWPORT);
if (!vpd.cpu) if (!vpd.cpu)
@ -486,9 +486,9 @@ cmd_emit_dcd(struct panvk_cmd_buffer *cmdbuf, struct pan_fb_info *fbinfo,
* screen rectangle will always intersect, this won't affect * screen rectangle will always intersect, this won't affect
* performance. * performance.
*/ */
bool always = !fbinfo->extent.minx && !fbinfo->extent.miny && bool always = !fbinfo->draw_extent.minx && !fbinfo->draw_extent.miny &&
fbinfo->extent.maxx == (fbinfo->width - 1) && fbinfo->draw_extent.maxx == (fbinfo->width - 1) &&
fbinfo->extent.maxy == (fbinfo->height - 1); fbinfo->draw_extent.maxy == (fbinfo->height - 1);
/* If we're dealing with a combined ZS resource and only one /* If we're dealing with a combined ZS resource and only one
* component is cleared, we need to reload the whole surface * component is cleared, we need to reload the whole surface