summaryrefslogtreecommitdiff
path: root/lib/intel_batchbuffer.h
diff options
context:
space:
mode:
authorZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2020-10-23 09:30:17 +0200
committerZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2021-04-13 15:44:38 +0200
commit6fa47495ec9c07c909ae4dd64a922bea4c0b0456 (patch)
tree0d8ab8754f6d34a6621378a2b2bc0246ac9f4bb4 /lib/intel_batchbuffer.h
parent8df4c1cf5bcab7633d9e9bb8d01cf1bcc2f4fbee (diff)
lib/intel_batchbuffer: Add tracking intel_buf to intel_bb
From now on intel_bb starts tracking added/removed intel_bufs. We're safe now regardless order of intel_buf close/destroy or intel_bb destroy paths. When intel_buf is closed/destroyed first and it was previously added to intel_bb it calls the code which removes itself from intel_bb. In destroy path we go over all tracked intel_bufs and clear tracking information and buffer offset (it is set to INTEL_BUF_INVALID_ADDRESS). Reset path is handled as follows: - intel_bb_reset(ibb, false) - just clean objects array leaving cache / allocator state intact. - intel_bb_reset(ibb, true) - purge cache as well as detach intel_bufs from intel_bb (release offsets from allocator). Remove intel_bb_object_offset_to_buf() function as tracking intel_buf updates (checks for allocator) their offsets after execbuf. Alter api_intel_bb according to intel-bb changes. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Dominik Grzegorzek <dominik.grzegorzek@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib/intel_batchbuffer.h')
-rw-r--r--lib/intel_batchbuffer.h29
1 files changed, 11 insertions, 18 deletions
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index 702052d2..6f148713 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -6,6 +6,7 @@
#include <i915_drm.h>
#include "igt_core.h"
+#include "igt_list.h"
#include "intel_reg.h"
#include "drmtest.h"
#include "intel_allocator.h"
@@ -464,6 +465,7 @@ struct intel_bb {
bool uses_full_ppgtt;
uint32_t ctx;
+ uint32_t vm_id;
/* Cache */
void *root;
@@ -481,6 +483,9 @@ struct intel_bb {
uint32_t num_relocs;
uint32_t allocated_relocs;
+ /* Tracked intel_bufs */
+ struct igt_list_head intel_bufs;
+
/*
* BO recreate in reset path only when refcount == 0
* Currently we don't need to use atomics because intel_bb
@@ -517,29 +522,15 @@ static inline void intel_bb_unref(struct intel_bb *ibb)
void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache);
int intel_bb_sync(struct intel_bb *ibb);
+
+uint64_t intel_bb_assign_vm(struct intel_bb *ibb, uint64_t allocator,
+ uint32_t vm_id);
+
void intel_bb_print(struct intel_bb *ibb);
void intel_bb_dump(struct intel_bb *ibb, const char *filename);
void intel_bb_set_debug(struct intel_bb *ibb, bool debug);
void intel_bb_set_dump_base64(struct intel_bb *ibb, bool dump);
-/*
-static inline uint64_t
-intel_bb_set_default_object_alignment(struct intel_bb *ibb, uint64_t alignment)
-{
- uint64_t old = ibb->alignment;
-
- ibb->alignment = alignment;
-
- return old;
-}
-
-static inline uint64_t
-intel_bb_get_default_object_alignment(struct intel_bb *ibb)
-{
- return ibb->alignment;
-}
-*/
-
static inline uint32_t intel_bb_offset(struct intel_bb *ibb)
{
return (uint32_t) ((uint8_t *) ibb->ptr - (uint8_t *) ibb->batch);
@@ -597,7 +588,9 @@ intel_bb_add_intel_buf(struct intel_bb *ibb, struct intel_buf *buf, bool write);
struct drm_i915_gem_exec_object2 *
intel_bb_add_intel_buf_with_alignment(struct intel_bb *ibb, struct intel_buf *buf,
uint64_t alignment, bool write);
+void intel_bb_detach_intel_buf(struct intel_bb *ibb, struct intel_buf *buf);
bool intel_bb_remove_intel_buf(struct intel_bb *ibb, struct intel_buf *buf);
+void intel_bb_print_intel_bufs(struct intel_bb *ibb);
struct drm_i915_gem_exec_object2 *
intel_bb_find_object(struct intel_bb *ibb, uint32_t handle);