diff options
author | Alyssa Rosenzweig <alyssa@rosenzweig.io> | 2022-12-17 16:28:54 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-02-04 07:45:12 +0000 |
commit | e7b97899ac92e9dc1390db017bad8e3ee492e047 (patch) | |
tree | 14f825793cf455b2da001cd63307e94f73d35a35 /src | |
parent | a88aa3e8350ced14a4a3ae24af12447067ce55d3 (diff) |
asahi: Use writeback when it looks beneficial
When playing the My Little Pony theme song at 1080p on T8103, with mpv's GPU
compositing but software decoding, CPU usage drops from 200% to 50% due to
proper caching of the staging resource.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21063>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/asahi/agx_pipe.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 689b66fef3b..3607ad3e4e2 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -530,7 +530,19 @@ agx_resource_create_with_modifiers(struct pipe_screen *screen, : (bind & PIPE_BIND_SHADER_IMAGE) ? "Shader image" : "Other resource"; - nresource->bo = agx_bo_create(dev, nresource->layout.size_B, 0, label); + uint32_t create_flags = 0; + + /* Default to write-combine resources, but use writeback if that is expected + * to be beneficial. + */ + if (nresource->base.usage == PIPE_USAGE_STAGING || + (nresource->base.flags & PIPE_RESOURCE_FLAG_MAP_COHERENT)) { + + create_flags |= AGX_BO_WRITEBACK; + } + + nresource->bo = + agx_bo_create(dev, nresource->layout.size_B, create_flags, label); if (!nresource->bo) { FREE(nresource); |