summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/surface9.c
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-12-04 10:33:19 +0100
committerAxel Davy <[email protected]>2016-12-20 23:47:08 +0100
commitb4f16615ef6546c6f8eab8a2d2a50cdab1773a91 (patch)
treeed4f89cad6d195298a600e63ef05d4395ac337af /src/gallium/state_trackers/nine/surface9.c
parent525a1b292a3d65857db06832e175fba840b75ff8 (diff)
st/nine: Do not wait for DEFAULT lock for surfaces when we can
If the surfaces (and the texture container) are not referenced, then they are no pending operations on them. We can lock directly. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/surface9.c')
-rw-r--r--src/gallium/state_trackers/nine/surface9.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
index 26c2d69d276..a5c4a9ede8d 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -20,6 +20,7 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "iunknown.h"
#include "surface9.h"
#include "device9.h"
@@ -479,13 +480,22 @@ NineSurface9_LockRect( struct NineSurface9 *This,
box.y);
}
} else {
+ bool no_refs = !p_atomic_read(&This->base.base.bind) &&
+ !(This->base.base.container && p_atomic_read(&This->base.base.container->bind));
DBG("mapping pipe_resource %p (level=%u usage=%x)\n",
resource, This->level, usage);
- pipe = NineDevice9_GetPipe(This->base.base.device);
+ /* if the object is not bound internally, there can't be any pending
+ * operation with the surface in the queue */
+ if (no_refs)
+ pipe = nine_context_get_pipe_acquire(This->base.base.device);
+ else
+ pipe = NineDevice9_GetPipe(This->base.base.device);
pLockedRect->pBits = pipe->transfer_map(pipe, resource,
This->level, usage, &box,
&This->transfer);
+ if (no_refs)
+ nine_context_get_pipe_release(This->base.base.device);
if (!This->transfer) {
DBG("transfer_map failed\n");
if (Flags & D3DLOCK_DONOTWAIT)