mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 10:20:09 +01:00
panfrost: Add env variable for max AFBC packing ratio
Add `PAN_MAX_AFBC_PACKING_RATIO` variable. If the ratio (size of the packed resource) / (size of the sparse resource) * 100 is above that value, we don't care about packing it. Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25012>
This commit is contained in:
parent
888d7c8ee6
commit
5a928f7563
3 changed files with 8 additions and 3 deletions
|
|
@ -1527,13 +1527,13 @@ panfrost_pack_afbc(struct panfrost_context *ctx,
|
|||
|
||||
unsigned new_size = ALIGN_POT(total_size, 4096); // FIXME
|
||||
unsigned old_size = prsrc->image.data.bo->size;
|
||||
unsigned ratio = 100 * new_size / old_size;
|
||||
|
||||
if (new_size == old_size)
|
||||
if (ratio > screen->max_afbc_packing_ratio)
|
||||
return;
|
||||
|
||||
if (dev->debug & PAN_DBG_PERF) {
|
||||
printf("%i%%: %i KB -> %i KB\n", 100 * new_size / old_size,
|
||||
old_size / 1024, new_size / 1024);
|
||||
printf("%i%%: %i KB -> %i KB\n", ratio, old_size / 1024, new_size / 1024);
|
||||
}
|
||||
|
||||
struct panfrost_bo *dst =
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@
|
|||
|
||||
#include "pan_context.h"
|
||||
|
||||
#define DEFAULT_MAX_AFBC_PACKING_RATIO 90
|
||||
|
||||
/* clang-format off */
|
||||
static const struct debug_named_value panfrost_debug_options[] = {
|
||||
{"perf", PAN_DBG_PERF, "Enable performance warnings"},
|
||||
|
|
@ -840,6 +842,8 @@ panfrost_create_screen(int fd, const struct pipe_screen_config *config,
|
|||
/* Debug must be set first for pandecode to work correctly */
|
||||
dev->debug =
|
||||
debug_get_flags_option("PAN_MESA_DEBUG", panfrost_debug_options, 0);
|
||||
screen->max_afbc_packing_ratio = debug_get_num_option(
|
||||
"PAN_MAX_AFBC_PACKING_RATIO", DEFAULT_MAX_AFBC_PACKING_RATIO);
|
||||
panfrost_open_device(screen, fd, dev);
|
||||
|
||||
if (dev->debug & PAN_DBG_NO_AFBC)
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ struct panfrost_screen {
|
|||
|
||||
struct panfrost_vtable vtbl;
|
||||
struct disk_cache *disk_cache;
|
||||
unsigned max_afbc_packing_ratio;
|
||||
};
|
||||
|
||||
static inline struct panfrost_screen *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue