From: Axel Davy Date: Wed, 24 Apr 2019 21:24:40 +0000 (+0200) Subject: st/nine: Optimize a bit writeonly buffers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=562f5a35c88f0de62bb6f6c65fa668b6211e4bd0;p=mesa.git 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 --- 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;