We want to implement explicit BO dependency tracking and for that
we'll use arrays of dependencies (syncobjs) indexed by screen->id.
This is way more efficient than storing and checking screen pointers
everywhere.
v2: Properly use atomic operations in a non-racy way (Alyssa, Ken).
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12363>
uint64_t vma_min_align;
struct iris_memregion vram, sys;
+ int next_screen_id;
+
bool has_llc:1;
bool has_local_mem:1;
bool has_mmap_offset:1;
simple_mtx_unlock(&global_bufmgr_list_mutex);
}
+/** Returns a new unique id, to be used by screens. */
+int
+iris_bufmgr_create_screen_id(struct iris_bufmgr *bufmgr)
+{
+ return p_atomic_inc_return(&bufmgr->next_screen_id) - 1;
+}
+
/**
* Gets an already existing GEM buffer manager or create a new one.
*
enum iris_memory_zone iris_memzone_for_address(uint64_t address);
+int iris_bufmgr_create_screen_id(struct iris_bufmgr *bufmgr);
+
#endif /* IRIS_BUFMGR_H */
screen->fd = iris_bufmgr_get_fd(screen->bufmgr);
screen->winsys_fd = fd;
+ screen->id = iris_bufmgr_create_screen_id(screen->bufmgr);
+
screen->workaround_bo =
iris_bo_alloc(screen->bufmgr, "workaround", 4096, 1,
IRIS_MEMZONE_OTHER, 0);
struct disk_cache *disk_cache;
struct intel_measure_device measure;
+
+ /** Every screen on a bufmgr has an unique ID assigned by the bufmgr. */
+ int id;
};
struct pipe_screen *