st/nine: Add src reference to nine_context_range_upload
authorAxel Davy <davyaxel0@gmail.com>
Mon, 3 Dec 2018 20:24:54 +0000 (21:24 +0100)
committerAxel Davy <davyaxel0@gmail.com>
Sun, 23 Dec 2018 07:14:50 +0000 (08:14 +0100)
Just like nine_context_box_upload, nine_context_range_upload
should reference the src, which holds the ram source buffer.

Fixes: https://github.com/iXit/Mesa-3D/issues/327
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Cc: mesa-stable@lists.freedesktop.org
src/gallium/state_trackers/nine/buffer9.h
src/gallium/state_trackers/nine/nine_state.c
src/gallium/state_trackers/nine/nine_state.h

index b04a0a721bb74db398f9863f2c56e1626ce6937b..1803d8d64058205c1a544befa908665e56466454 100644 (file)
@@ -104,7 +104,9 @@ NineBuffer9_Upload( struct NineBuffer9 *This )
     struct NineDevice9 *device = This->base.base.device;
 
     assert(This->base.pool == D3DPOOL_MANAGED && This->managed.dirty);
-    nine_context_range_upload(device, &This->managed.pending_upload, This->base.resource,
+    nine_context_range_upload(device, &This->managed.pending_upload,
+                              (struct NineUnknown *)This,
+                              This->base.resource,
                               This->managed.dirty_box.x,
                               This->managed.dirty_box.width,
                               (char *)This->managed.data + This->managed.dirty_box.x);
index 4872e24f439bb675df5e3502ce1103c95d175748..02673c1f6edfb987ec95fe26dca440e154c359e2 100644 (file)
@@ -2423,6 +2423,7 @@ CSMT_ITEM_NO_WAIT(nine_context_gen_mipmap,
 }
 
 CSMT_ITEM_NO_WAIT_WITH_COUNTER(nine_context_range_upload,
+                               ARG_BIND_REF(struct NineUnknown, src_ref),
                                ARG_BIND_RES(struct pipe_resource, res),
                                ARG_VAL(unsigned, offset),
                                ARG_VAL(unsigned, size),
@@ -2430,6 +2431,9 @@ CSMT_ITEM_NO_WAIT_WITH_COUNTER(nine_context_range_upload,
 {
     struct nine_context *context = &device->context;
 
+    /* Binding src_ref avoids release before upload */
+    (void)src_ref;
+
     context->pipe->buffer_subdata(context->pipe, res, 0, offset, size, data);
 }
 
index 8de9f84a2562011172fe5f303195970c5dda84f1..55960007bfb668d7b75e01033f081a650ccfed1c 100644 (file)
@@ -560,6 +560,7 @@ nine_context_gen_mipmap(struct NineDevice9 *device,
 void
 nine_context_range_upload(struct NineDevice9 *device,
                           unsigned *counter,
+                          struct NineUnknown *src_ref,
                           struct pipe_resource *res,
                           unsigned offset,
                           unsigned size,