mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
pan/crc: Simplify CRC buffer selection logic
This commit doesn't really change the selection logic but tries to make the reasoning more straightforward and prepare for future commits where the CRC state will be cached. A usable RT must pass a few conditional checks like the availability of a CRC buffer. A selected RT must be usable and either have a valid CRC buffer or be fully covered. In the MRT case, the first usable RT with a valid CRC buffer is selected. If no RT has a CRC buffer initialized, then the first usable RT is selected at the condition it's fully covered. Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit is contained in:
parent
e39e303e23
commit
f2a678ed45
1 changed files with 19 additions and 19 deletions
|
|
@ -109,6 +109,8 @@ renderblock_fits_in_single_pass(const struct pan_image_view *view,
|
|||
int
|
||||
GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size)
|
||||
{
|
||||
int best_rt = -1;
|
||||
|
||||
/* Disable CRC when the tile size is smaller than 16x16. In the hardware,
|
||||
* CRC tiles are the same size as the tiles of the framebuffer. However,
|
||||
* our code only handles 16x16 tiles. Therefore under the current
|
||||
|
|
@ -119,42 +121,40 @@ GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size)
|
|||
* Restricting CRC to 16x16 should work in practice.
|
||||
*/
|
||||
if (tile_size < 16 * 16)
|
||||
return -1;
|
||||
return best_rt;
|
||||
|
||||
#if PAN_ARCH <= 6
|
||||
if (fb->rt_count == 1 && fb->rts[0].view && !fb->rts[0].discard &&
|
||||
pan_image_view_has_crc(fb->rts[0].view) &&
|
||||
renderblock_fits_in_single_pass(fb->rts[0].view, tile_size) &&
|
||||
(*(fb->rts[0].crc_valid) || pan_fb_is_fully_covered(fb)))
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
renderblock_fits_in_single_pass(fb->rts[0].view, tile_size))
|
||||
best_rt = 0;
|
||||
#else
|
||||
bool best_rt_valid = false;
|
||||
int best_rt = -1;
|
||||
|
||||
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))
|
||||
continue;
|
||||
|
||||
bool valid = *(fb->rts[i].crc_valid);
|
||||
bool full = pan_fb_is_fully_covered(fb);
|
||||
if (!full && !valid)
|
||||
continue;
|
||||
|
||||
if (best_rt < 0 || (valid && !best_rt_valid)) {
|
||||
/* Select the first RT with a valid CRC buffer. */
|
||||
if (*fb->rts[i].crc_valid) {
|
||||
best_rt = i;
|
||||
best_rt_valid = valid;
|
||||
break;
|
||||
}
|
||||
|
||||
if (valid)
|
||||
break;
|
||||
/* Store the first usable RT otherwise. */
|
||||
if (best_rt == -1)
|
||||
best_rt = i;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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))
|
||||
best_rt = -1;
|
||||
|
||||
return best_rt;
|
||||
#endif
|
||||
}
|
||||
|
||||
static enum mali_zs_format
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue