mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 00:30:11 +01:00
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>
This commit is contained in:
parent
a88aa3e835
commit
e7b97899ac
1 changed files with 13 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue