summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-07-22 10:50:50 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-07-22 10:50:50 +0000
commit9130ec005fbc78a62420643414d8354d0929ca50 (patch)
tree6762777acdd2d4eee17ef87290e80dc7afe2b73d /lib/mesa/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
parentca11beabae33eb59fb981b8adf50b1d47a2a98f0 (diff)
Merge Mesa 21.1.5
Diffstat (limited to 'lib/mesa/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h')
-rw-r--r--lib/mesa/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h68
1 files changed, 34 insertions, 34 deletions
diff --git a/lib/mesa/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h b/lib/mesa/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
index 9f37437cd..48bce54ec 100644
--- a/lib/mesa/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
+++ b/lib/mesa/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
@@ -59,15 +59,21 @@ struct amdgpu_winsys_bo {
struct pb_buffer base;
union {
struct {
- struct pb_cache_entry cache_entry;
-
amdgpu_va_handle va_handle;
+#if DEBUG
+ struct list_head global_list_item;
+#endif
+ void *cpu_ptr; /* for user_ptr and permanent maps */
+ uint32_t kms_handle;
int map_count;
- bool use_reusable_pool;
- struct list_head global_list_item;
+ bool is_user_ptr;
+ bool use_reusable_pool;
- uint32_t kms_handle;
+ /* Whether buffer_get_handle or buffer_from_handle has been called,
+ * it can only transition from false to true. Protected by lock.
+ */
+ bool is_shared;
} real;
struct {
struct pb_slab_entry entry;
@@ -75,7 +81,6 @@ struct amdgpu_winsys_bo {
} slab;
struct {
amdgpu_va_handle va_handle;
- enum radeon_bo_flag flags;
uint32_t num_va_pages;
uint32_t num_backing_pages;
@@ -87,60 +92,53 @@ struct amdgpu_winsys_bo {
} sparse;
} u;
- struct amdgpu_winsys *ws;
- void *cpu_ptr; /* for user_ptr and permanent maps */
-
amdgpu_bo_handle bo; /* NULL for slab entries and sparse buffers */
- bool sparse;
- bool is_user_ptr;
- uint32_t unique_id;
uint64_t va;
- enum radeon_bo_domain initial_domain;
- enum radeon_bo_flag flags;
- /* how many command streams is this bo referenced in? */
- int num_cs_references;
+ uint32_t unique_id;
+ simple_mtx_t lock;
/* how many command streams, which are being emitted in a separate
* thread, is this bo referenced in? */
volatile int num_active_ioctls;
- /* whether buffer_get_handle or buffer_from_handle was called,
- * it can only transition from false to true
- */
- volatile int is_shared; /* bool (int for atomicity) */
-
/* Fences for buffer synchronization. */
- unsigned num_fences;
- unsigned max_fences;
+ uint16_t num_fences;
+ uint16_t max_fences;
struct pipe_fence_handle **fences;
- simple_mtx_t lock;
+ struct pb_cache_entry cache_entry[];
};
struct amdgpu_slab {
struct pb_slab base;
+ unsigned entry_size;
struct amdgpu_winsys_bo *buffer;
struct amdgpu_winsys_bo *entries;
};
-bool amdgpu_bo_can_reclaim(struct pb_buffer *_buf);
+bool amdgpu_bo_can_reclaim(struct amdgpu_winsys *ws, struct pb_buffer *_buf);
struct pb_buffer *amdgpu_bo_create(struct amdgpu_winsys *ws,
uint64_t size,
unsigned alignment,
enum radeon_bo_domain domain,
enum radeon_bo_flag flags);
-void amdgpu_bo_destroy(struct pb_buffer *_buf);
-void *amdgpu_bo_map(struct pb_buffer *buf,
+void amdgpu_bo_destroy(struct amdgpu_winsys *ws, struct pb_buffer *_buf);
+void *amdgpu_bo_map(struct radeon_winsys *rws,
+ struct pb_buffer *buf,
struct radeon_cmdbuf *rcs,
- enum pipe_transfer_usage usage);
+ enum pipe_map_flags usage);
+void amdgpu_bo_unmap(struct radeon_winsys *rws, struct pb_buffer *buf);
void amdgpu_bo_init_functions(struct amdgpu_screen_winsys *ws);
bool amdgpu_bo_can_reclaim_slab(void *priv, struct pb_slab_entry *entry);
-struct pb_slab *amdgpu_bo_slab_alloc(void *priv, unsigned heap,
- unsigned entry_size,
- unsigned group_index);
-void amdgpu_bo_slab_free(void *priv, struct pb_slab *slab);
+struct pb_slab *amdgpu_bo_slab_alloc_encrypted(void *priv, unsigned heap,
+ unsigned entry_size,
+ unsigned group_index);
+struct pb_slab *amdgpu_bo_slab_alloc_normal(void *priv, unsigned heap,
+ unsigned entry_size,
+ unsigned group_index);
+void amdgpu_bo_slab_free(struct amdgpu_winsys *ws, struct pb_slab *slab);
static inline
struct amdgpu_winsys_bo *amdgpu_winsys_bo(struct pb_buffer *bo)
@@ -155,10 +153,12 @@ struct amdgpu_slab *amdgpu_slab(struct pb_slab *slab)
}
static inline
-void amdgpu_winsys_bo_reference(struct amdgpu_winsys_bo **dst,
+void amdgpu_winsys_bo_reference(struct amdgpu_winsys *ws,
+ struct amdgpu_winsys_bo **dst,
struct amdgpu_winsys_bo *src)
{
- pb_reference((struct pb_buffer**)dst, (struct pb_buffer*)src);
+ radeon_bo_reference(&ws->dummy_ws.base,
+ (struct pb_buffer**)dst, (struct pb_buffer*)src);
}
#endif