From 562f5a35c88f0de62bb6f6c65fa668b6211e4bd0 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Wed, 24 Apr 2019 23:24:40 +0200 Subject: [PATCH] st/nine: Optimize a bit writeonly buffers Optimize writeonly by passing PIPE_TRANSFER_WRITE for these buffers instead of the safer PIPE_TRANSFER_READ_WRITE. This seems to improve the performance of d3d8 games using d3d8to9. Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/buffer9.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index 30066f11c83..f93abaa5c84 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -283,7 +283,12 @@ NineBuffer9_Lock( struct NineBuffer9 *This, else if (Flags & D3DLOCK_NOOVERWRITE) usage = PIPE_TRANSFER_WRITE | PIPE_TRANSFER_UNSYNCHRONIZED; else - usage = PIPE_TRANSFER_READ_WRITE; + /* Do not ask for READ if writeonly and default pool (should be safe enough, + * as the doc says app shouldn't expect reading to work with writeonly). + * Ignore for Systemmem as it has special behaviours. */ + usage = ((This->base.usage & D3DUSAGE_WRITEONLY) && This->base.pool == D3DPOOL_DEFAULT) ? + PIPE_TRANSFER_WRITE : + PIPE_TRANSFER_READ_WRITE; if (Flags & D3DLOCK_DONOTWAIT && !(This->base.usage & D3DUSAGE_DYNAMIC)) usage |= PIPE_TRANSFER_DONTBLOCK; -- 2.30.2