mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
pan/crc: Check CRC requirements in dedicated function
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit is contained in:
parent
00f4ed9643
commit
dbd3f9b6ad
3 changed files with 21 additions and 14 deletions
|
|
@ -1197,7 +1197,7 @@ pan_preload_emit_pre_frame_dcd(struct pan_fb_preload_cache *cache,
|
|||
* write even clean tiles to make sure CRC data is updated. */
|
||||
if (crc_rt >= 0) {
|
||||
bool *valid = fb->rts[crc_rt].crc_valid;
|
||||
bool full = pan_fb_is_fully_covered(fb);
|
||||
bool full = pan_fb_info_is_fully_covered(fb);
|
||||
|
||||
if (full && !(*valid))
|
||||
always_write = true;
|
||||
|
|
|
|||
|
|
@ -93,17 +93,26 @@ pan_warn_on_afbc_reverse_issue_order(const struct pan_attachment_info *att,
|
|||
#endif
|
||||
|
||||
static bool
|
||||
renderblock_fits_in_single_pass(const struct pan_image_view *view,
|
||||
unsigned tile_size)
|
||||
pan_fb_color_attachment_should_crc(const struct pan_fb_color_attachment *rt,
|
||||
unsigned tile_size)
|
||||
{
|
||||
const struct pan_image_plane_ref pref = pan_image_view_get_first_plane(view);
|
||||
uint64_t mod = pref.image->props.modifier;
|
||||
uint64_t mod;
|
||||
struct pan_image_block_size renderblk_sz;
|
||||
|
||||
if (!rt->view || rt->discard || !pan_image_view_has_crc(rt->view))
|
||||
return false;
|
||||
|
||||
mod = pan_image_view_get_first_plane(rt->view).image->props.modifier;
|
||||
|
||||
if (!drm_is_afbc(mod))
|
||||
return true;
|
||||
|
||||
struct pan_image_block_size renderblk_sz = pan_afbc_renderblock_size(mod);
|
||||
return tile_size >= renderblk_sz.width * renderblk_sz.height;
|
||||
/* AFBC render block size must fit in a single pass. */
|
||||
renderblk_sz = pan_afbc_renderblock_size(mod);
|
||||
if (tile_size < renderblk_sz.width * renderblk_sz.height)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -129,10 +138,8 @@ GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size)
|
|||
#endif
|
||||
|
||||
for (unsigned i = 0; i < fb->rt_count; i++) {
|
||||
/* Skip unusable RT. */
|
||||
if (!fb->rts[i].view || fb->rts[i].discard ||
|
||||
!pan_image_view_has_crc(fb->rts[i].view) ||
|
||||
!renderblock_fits_in_single_pass(fb->rts[i].view, tile_size))
|
||||
/* Skip unusable RTs. */
|
||||
if (!pan_fb_color_attachment_should_crc(&fb->rts[i], tile_size))
|
||||
continue;
|
||||
|
||||
/* Select the first RT with a valid CRC buffer. */
|
||||
|
|
@ -149,7 +156,7 @@ GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size)
|
|||
/* The selected RT must be fully covered for now in order to correctly
|
||||
* initialize the CRC buffer. */
|
||||
if (best_rt != -1 && !*fb->rts[best_rt].crc_valid &&
|
||||
!pan_fb_is_fully_covered(fb))
|
||||
!pan_fb_info_is_fully_covered(fb))
|
||||
best_rt = -1;
|
||||
|
||||
return best_rt;
|
||||
|
|
@ -1252,7 +1259,7 @@ GENX(pan_emit_fbd)(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
|
||||
if (crc_rt >= 0) {
|
||||
bool *valid = fb->rts[crc_rt].crc_valid;
|
||||
bool full = pan_fb_is_fully_covered(fb);
|
||||
bool full = pan_fb_info_is_fully_covered(fb);
|
||||
|
||||
/* If the CRC was valid it stays valid, if it wasn't, we must ensure
|
||||
* the render operation covers the full frame, and clean tiles are
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ struct pan_clean_tile {
|
|||
};
|
||||
|
||||
static inline bool
|
||||
pan_fb_is_fully_covered(const struct pan_fb_info *fb)
|
||||
pan_fb_info_is_fully_covered(const struct pan_fb_info *fb)
|
||||
{
|
||||
return !fb->draw_extent.minx &&
|
||||
!fb->draw_extent.miny &&
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue