winsys/amdgpu: add slab entry structures to amdgpu_winsys_bo
[mesa.git] / src / gallium / winsys / amdgpu / drm / amdgpu_bo.h
index 93cc83aa80a131d0b40c84274e1bf3c9426f475e..e5b5cf538a8064c5336f01f8ca01bff6fec0d330 100644 (file)
 
 #include "amdgpu_winsys.h"
 
+#include "pipebuffer/pb_slab.h"
+
 struct amdgpu_winsys_bo {
    struct pb_buffer base;
-   struct pb_cache_entry cache_entry;
+   union {
+      struct {
+         struct pb_cache_entry cache_entry;
+
+         amdgpu_va_handle va_handle;
+         int map_count;
+         bool use_reusable_pool;
+
+         struct list_head global_list_item;
+      } real;
+      struct {
+         struct pb_slab_entry entry;
+         struct amdgpu_winsys_bo *real;
+      } slab;
+   } u;
 
    struct amdgpu_winsys *ws;
    void *user_ptr; /* from buffer_from_ptr */
 
-   amdgpu_bo_handle bo;
-   int map_count;
+   amdgpu_bo_handle bo; /* NULL for slab entries */
    uint32_t unique_id;
-   amdgpu_va_handle va_handle;
    uint64_t va;
    enum radeon_bo_domain initial_domain;
-   bool use_reusable_pool;
 
    /* how many command streams is this bo referenced in? */
    int num_cs_references;
@@ -66,8 +79,6 @@ struct amdgpu_winsys_bo {
    unsigned num_fences;
    unsigned max_fences;
    struct pipe_fence_handle **fences;
-
-   struct list_head global_list_item;
 };
 
 bool amdgpu_bo_can_reclaim(struct pb_buffer *_buf);