freedreno: Add perf_warn() for missed UBWC opportunities

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8659>
This commit is contained in:
Rob Clark 2021-01-22 09:19:09 -08:00
parent 55f4f6882f
commit 03c28278a7
3 changed files with 33 additions and 6 deletions

View file

@ -118,6 +118,9 @@ fd6_validate_format(struct fd_context *ctx, struct fd_resource *rsc,
if (ok_ubwc_format(rsc->base.screen, format))
return;
perf_debug_ctx(ctx, "%"PRSC_FMT": demoted to uncompressed due to use as %s",
PRSC_ARGS(&rsc->base), util_format_short_name(format));
fd_resource_uncompress(ctx, rsc);
}
@ -203,7 +206,16 @@ fd6_layout_resource_for_modifier(struct fd_resource *rsc, uint64_t modifier)
case DRM_FORMAT_MOD_QCOM_COMPRESSED:
return fill_ubwc_buffer_sizes(rsc);
case DRM_FORMAT_MOD_LINEAR:
if (can_do_ubwc(&rsc->base)) {
perf_debug("%"PRSC_FMT": not UBWC: imported with DRM_FORMAT_MOD_LINEAR!",
PRSC_ARGS(&rsc->base));
}
return 0;
case DRM_FORMAT_MOD_INVALID:
if (can_do_ubwc(&rsc->base)) {
perf_debug("%"PRSC_FMT": not UBWC: imported with DRM_FORMAT_MOD_INVALID!",
PRSC_ARGS(&rsc->base));
}
return 0;
default:
return -1;

View file

@ -454,6 +454,7 @@ fd_alloc_staging(struct fd_context *ctx, struct fd_resource *rsc,
}
tmpl.last_level = 0;
tmpl.bind |= PIPE_BIND_LINEAR;
tmpl.usage = PIPE_USAGE_STAGING;
struct pipe_resource *pstaging =
pctx->screen->resource_create(pctx->screen, &tmpl);
@ -911,8 +912,13 @@ fd_resource_allocate_and_resolve(struct pipe_screen *pscreen,
PIPE_BIND_DISPLAY_TARGET)
bool linear = drm_find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count);
if (tmpl->bind & LINEAR)
if (linear) {
perf_debug("%"PRSC_FMT": linear: DRM_FORMAT_MOD_LINEAR requested!", PRSC_ARGS(prsc));
} else if (tmpl->bind & LINEAR) {
if (tmpl->usage != PIPE_USAGE_STAGING)
perf_debug("%"PRSC_FMT": linear: LINEAR bind requested!", PRSC_ARGS(prsc));
linear = true;
}
if (fd_mesa_debug & FD_DBG_NOTILE)
linear = true;
@ -925,11 +931,20 @@ fd_resource_allocate_and_resolve(struct pipe_screen *pscreen,
* except we don't have a format modifier for tiled. (We probably
* should.)
*/
bool allow_ubwc = drm_find_modifier(DRM_FORMAT_MOD_INVALID, modifiers, count);
if (tmpl->bind & PIPE_BIND_SHARED) {
allow_ubwc = drm_find_modifier(DRM_FORMAT_MOD_QCOM_COMPRESSED, modifiers, count);
bool allow_ubwc = false;
if (!linear) {
allow_ubwc = drm_find_modifier(DRM_FORMAT_MOD_INVALID, modifiers, count);
if (!allow_ubwc) {
linear = true;
perf_debug("%"PRSC_FMT": not UBWC: DRM_FORMAT_MOD_INVALID not requested!",
PRSC_ARGS(prsc));
}
if (tmpl->bind & PIPE_BIND_SHARED) {
allow_ubwc = drm_find_modifier(DRM_FORMAT_MOD_QCOM_COMPRESSED, modifiers, count);
if (!allow_ubwc) {
perf_debug("%"PRSC_FMT": not UBWC: shared and DRM_FORMAT_MOD_QCOM_COMPRESSED not requested!",
PRSC_ARGS(prsc));
linear = true;
}
}
}

View file

@ -101,7 +101,7 @@ extern bool fd_binning_enabled;
__FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0)
#define perf_debug_ctx(ctx, ...) do { \
perf_warn(__VA_ARGS__); \
perf_debug(__VA_ARGS__); \
pipe_debug_message(&(ctx)->debug, PERF_INFO, __VA_ARGS__); \
} while(0)