st/nine: Bind src not dst in nine_context_box_upload
authorAxel Davy <davyaxel0@gmail.com>
Mon, 3 Dec 2018 20:15:47 +0000 (21:15 +0100)
committerAxel Davy <davyaxel0@gmail.com>
Sun, 23 Dec 2018 07:14:50 +0000 (08:14 +0100)
nine_context_box_upload uploads a ram buffer (from src)
to a pipe_resource (dst).
We already have a refcount on the pipe_resource,
what needs to be protected from release is the ram buffer,
thus a reference to src.

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/nine_state.c
src/gallium/state_trackers/nine/nine_state.h
src/gallium/state_trackers/nine/surface9.c
src/gallium/state_trackers/nine/volume9.c

index 273be88e2b81f293246eacdf1f57b072ae4f3638..4872e24f439bb675df5e3502ce1103c95d175748 100644 (file)
@@ -2434,7 +2434,7 @@ CSMT_ITEM_NO_WAIT_WITH_COUNTER(nine_context_range_upload,
 }
 
 CSMT_ITEM_NO_WAIT_WITH_COUNTER(nine_context_box_upload,
-                               ARG_BIND_REF(struct NineUnknown, dst),
+                               ARG_BIND_REF(struct NineUnknown, src_ref),
                                ARG_BIND_RES(struct pipe_resource, res),
                                ARG_VAL(unsigned, level),
                                ARG_COPY_REF(struct pipe_box, dst_box),
@@ -2449,8 +2449,8 @@ CSMT_ITEM_NO_WAIT_WITH_COUNTER(nine_context_box_upload,
     struct pipe_transfer *transfer = NULL;
     uint8_t *map;
 
-    /* We just bind dst for the bind count */
-    (void)dst;
+    /* Binding src_ref avoids release before upload */
+    (void)src_ref;
 
     map = pipe->transfer_map(pipe,
                              res,
index 51e5e3265273f432e2914d91485516eb5780167d..8de9f84a2562011172fe5f303195970c5dda84f1 100644 (file)
@@ -568,7 +568,7 @@ nine_context_range_upload(struct NineDevice9 *device,
 void
 nine_context_box_upload(struct NineDevice9 *device,
                         unsigned *counter,
-                        struct NineUnknown *dst,
+                        struct NineUnknown *src_ref,
                         struct pipe_resource *res,
                         unsigned level,
                         const struct pipe_box *dst_box,
index 5fd662fa0496c9ad545d691553b861a9b77b256d..10518219a0a2b26a66199f9e784190c0b410c67b 100644 (file)
@@ -660,7 +660,7 @@ NineSurface9_CopyMemToDefault( struct NineSurface9 *This,
 
     nine_context_box_upload(This->base.base.device,
                             &From->pending_uploads_counter,
-                            (struct NineUnknown *)This,
+                            (struct NineUnknown *)From,
                             r_dst,
                             This->level,
                             &dst_box,
index ec811aeba13db456f8dccb5a810cfcd5a55b5372..840f01dae1054d1dfe36939f7015bdb1f9642f0b 100644 (file)
@@ -449,7 +449,7 @@ NineVolume9_CopyMemToDefault( struct NineVolume9 *This,
 
     nine_context_box_upload(This->base.device,
                             &From->pending_uploads_counter,
-                            (struct NineUnknown *)This,
+                            (struct NineUnknown *)From,
                             r_dst,
                             This->level,
                             &dst_box,