Mesa (main): panfrost: Warn on transitions to linear
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jul 14 18:05:14 UTC 2021
Module: Mesa
Branch: main
Commit: a18f434d58b8f1be4edf212a6aa2df4cedc13413
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a18f434d58b8f1be4edf212a6aa2df4cedc13413
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Tue Jul 13 13:26:32 2021 -0400
panfrost: Warn on transitions to linear
The timing is critical for e.g video players, but this can also happen
unexpectedly in other apps which could be a symptom of deeper trouble.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Suggested-by: Icecream95 <ixn at disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11830>
---
src/gallium/drivers/panfrost/pan_resource.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 17fcf3f6986..678977ad474 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -1036,7 +1036,8 @@ pan_resource_modifier_convert(struct panfrost_context *ctx,
}
static bool
-panfrost_should_linear_convert(struct panfrost_resource *prsrc,
+panfrost_should_linear_convert(struct panfrost_device *dev,
+ struct panfrost_resource *prsrc,
struct pipe_transfer *transfer)
{
if (prsrc->modifier_constant)
@@ -1064,7 +1065,12 @@ panfrost_should_linear_convert(struct panfrost_resource *prsrc,
if (entire_overwrite)
++prsrc->modifier_updates;
- return prsrc->modifier_updates >= LAYOUT_CONVERT_THRESHOLD;
+ if (prsrc->modifier_updates >= LAYOUT_CONVERT_THRESHOLD) {
+ perf_debug(dev, "Transitioning to linear due to streaming usage");
+ return true;
+ } else {
+ return false;
+ }
}
static void
@@ -1087,7 +1093,7 @@ panfrost_ptr_unmap(struct pipe_context *pctx,
if (trans->staging.rsrc) {
if (transfer->usage & PIPE_MAP_WRITE) {
- if (panfrost_should_linear_convert(prsrc, transfer)) {
+ if (panfrost_should_linear_convert(dev, prsrc, transfer)) {
panfrost_bo_unreference(prsrc->image.data.bo);
if (prsrc->image.crc.bo)
@@ -1119,7 +1125,7 @@ panfrost_ptr_unmap(struct pipe_context *pctx,
if (prsrc->image.layout.modifier == DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED) {
assert(transfer->box.depth == 1);
- if (panfrost_should_linear_convert(prsrc, transfer)) {
+ if (panfrost_should_linear_convert(dev, prsrc, transfer)) {
panfrost_resource_setup(dev, prsrc, DRM_FORMAT_MOD_LINEAR,
prsrc->image.layout.format);
if (prsrc->image.layout.data_size > bo->size) {
More information about the mesa-commit
mailing list