intel/tools: Add basic aub_context code and helpers.

v2:
 - Only dump context if there were no erros (Lionel).
 - Store counter for context handles in aub_file (Lionel).
v3:
 - Add a comment about aub_context -> GEM context (Lionel).

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
Rafael Antognolli
2019-09-13 15:13:31 -07:00
parent 472de61187
commit 12feafc28e
3 changed files with 115 additions and 0 deletions
+21
View File
@@ -37,11 +37,25 @@
extern "C" {
#endif
#define MAX_CONTEXT_COUNT 64
struct aub_ppgtt_table {
uint64_t phys_addr;
struct aub_ppgtt_table *subtables[512];
};
struct aub_hw_context {
bool initialized;
uint64_t ring_addr;
uint64_t pphwsp_addr;
};
/* GEM context, as seen from userspace */
struct aub_context {
uint32_t id;
struct aub_hw_context hw_contexts[I915_ENGINE_CLASS_VIDEO + 1];
};
struct aub_file {
FILE *file;
@@ -64,6 +78,11 @@ struct aub_file {
uint64_t pphwsp_addr;
uint64_t descriptor;
} engine_setup[I915_ENGINE_CLASS_VIDEO_ENHANCE + 1];
struct aub_context contexts[MAX_CONTEXT_COUNT];
int num_contexts;
uint32_t next_context_handle;
};
void aub_file_init(struct aub_file *aub, FILE *file, FILE *debug, uint16_t pci_id, const char *app_name);
@@ -97,6 +116,8 @@ void aub_write_exec(struct aub_file *aub, uint64_t batch_addr,
void aub_write_context_execlists(struct aub_file *aub, uint64_t context_addr,
enum drm_i915_gem_engine_class engine_class);
uint32_t aub_write_context_create(struct aub_file *aub, uint32_t *ctx_id);
#ifdef __cplusplus
}
#endif