[Mesa-dev] [PATCH] st/nine: Dirty MANAGED buffers at Lock time

Axel Davy axel.davy at ens.fr
Tue Dec 13 22:53:16 UTC 2016

Tests suggest MANAGED buffers are made dirty
at Lock time, not at Unlock time.

Signed-off-by: Axel Davy <axel.davy at ens.fr>
Dirtying MANAGED buffers at Unlock was a requirement
of our previous implementation, since we were uploading
all dirty MANAGED buffers as soon as a draw call was made.
With the CSMT patchset, the correct behaviour (just upload a
MANAGED buffer before the draw call that needs it) is implemented,
which means we can go back to dirtying at Lock time, which is the
correct behaviour according to tests.
 src/gallium/state_trackers/nine/buffer9.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c
index 176a245..0e8065e 100644
--- a/src/gallium/state_trackers/nine/buffer9.c
+++ b/src/gallium/state_trackers/nine/buffer9.c
@@ -243,6 +243,9 @@ NineBuffer9_Lock( struct NineBuffer9 *This,
             } else
                 u_box_union_2d(&This->managed.dirty_box, &This->managed.dirty_box, &box);
+            /* Tests trying to draw while the buffer is locked show that
+             * MANAGED buffers are made dirty at Lock time */
         *ppbData = (char *)This->managed.data + OffsetToLock;
         DBG("returning pointer %p\n", *ppbData);
@@ -393,8 +396,6 @@ NineBuffer9_Unlock( struct NineBuffer9 *This )
         } else if (This->maps[This->nmaps].should_destroy_buf)
             nine_upload_release_buffer(device->buffer_upload, This->maps[This->nmaps].buf);
-    } else {
     return D3D_OK;

More information about the mesa-dev mailing list