nouveau/ws: add a push reset just for references.
authorDave Airlie <airlied@redhat.com>
Fri, 17 Jun 2022 04:02:14 +0000 (14:02 +1000)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 21:31:55 +0000 (21:31 +0000)
This is to be used with the empty submission pushbuf.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

src/nouveau/winsys/nouveau_push.c
src/nouveau/winsys/nouveau_push.h

index 26728ba..779ec3d 100644 (file)
@@ -312,3 +312,15 @@ void nouveau_ws_push_reset(struct nouveau_ws_push *push)
    nouveau_ws_push_ref(push, push->bo, NOUVEAU_WS_BO_RD);
    push->map = push->orig_map;
 }
+
+unsigned nouveau_ws_push_num_refs(const struct nouveau_ws_push *push)
+{
+   return util_dynarray_num_elements(&push->bos, struct nouveau_ws_push_bo);
+}
+
+void nouveau_ws_push_reset_refs(struct nouveau_ws_push *push,
+                                unsigned num_refs)
+{
+   assert(num_refs <= nouveau_ws_push_num_refs(push));
+   util_dynarray_resize(&push->bos, struct nouveau_ws_push_bo, num_refs);
+}
index c1da94f..6352b51 100644 (file)
@@ -30,6 +30,9 @@ void nouveau_ws_push_destroy(struct nouveau_ws_push *);
 int nouveau_ws_push_submit(struct nouveau_ws_push *, struct nouveau_ws_device *, struct nouveau_ws_context *);
 void nouveau_ws_push_ref(struct nouveau_ws_push *, struct nouveau_ws_bo *, enum nouveau_ws_bo_map_flags);
 void nouveau_ws_push_reset(struct nouveau_ws_push *);
+unsigned nouveau_ws_push_num_refs(const struct nouveau_ws_push *push);
+void nouveau_ws_push_reset_refs(struct nouveau_ws_push *push,
+                                unsigned num_refs);
 
 #define SUBC_NVA0C0 1
 #define SUBC_NVC0C0 1