| 1 |
|
| 2 |
n |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
#ifndef MOS_BUFMGR_PRIV_H |
| 35 |
#define MOS_BUFMGR_PRIV_H |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
struct mos_bufmgr { |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
struct mos_linux_bo *(*bo_alloc) (struct mos_bufmgr *bufmgr, |
| 51 |
struct mos_drm_bo_alloc *alloc) = nullptr; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
struct mos_linux_bo *(*bo_alloc_userptr)(struct mos_bufmgr *bufmgr, |
| 60 |
struct mos_drm_bo_alloc_userptr *alloc_uptr) = nullptr; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
struct mos_linux_bo *(*bo_alloc_tiled) (struct mos_bufmgr *bufmgr, |
| 78 |
struct mos_drm_bo_alloc_tiled *alloc_tiled) = nullptr; |
| 79 |
|
| 80 |
|
| 81 |
void (*bo_reference) (struct mos_linux_bo *bo) = nullptr; |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
void (*bo_unreference) (struct mos_linux_bo *bo) = nullptr; |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
int (*bo_map) (struct mos_linux_bo *bo, int write_enable) = nullptr; |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
int (*bo_unmap) (struct mos_linux_bo *bo) = nullptr; |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
void (*bo_wait_rendering) (struct mos_linux_bo *bo) = nullptr; |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
void (*destroy) (struct mos_bufmgr *bufmgr) = nullptr; |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
void (*bo_use_48b_address_range) (struct mos_linux_bo *bo, uint32_t enable) = nullptr; |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
int (*bo_pad_to_size) (struct mos_linux_bo *bo, uint64_t pad_to_size) = nullptr; |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
int (*bo_emit_reloc) (struct mos_linux_bo *bo, uint32_t offset, |
| 170 |
struct mos_linux_bo *target_bo, uint32_t target_offset, |
| 171 |
uint32_t read_domains, uint32_t write_domain, |
| 172 |
uint64_t presumed_offset) = nullptr; |
| 173 |
|
| 174 |
|
| 175 |
int (*bo_exec) (struct mos_linux_bo *bo, int used, |
| 176 |
drm_clip_rect_t *cliprects, int num_cliprects, |
| 177 |
int DR4) = nullptr; |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
int (*bo_mrb_exec) (struct mos_linux_bo *bo, int used, |
| 182 |
drm_clip_rect_t *cliprects, int num_cliprects, |
| 183 |
int DR4, unsigned flags) = nullptr; |
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
int (*bo_set_tiling) (struct mos_linux_bo *bo, uint32_t * tiling_mode, |
| 192 |
uint32_t stride) = nullptr; |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
int (*bo_get_tiling) (struct mos_linux_bo *bo, uint32_t * tiling_mode, |
| 202 |
uint32_t * swizzle_mode) = nullptr; |
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
int (*bo_set_softpin) (struct mos_linux_bo *bo) = nullptr; |
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
int (*bo_add_softpin_target) (struct mos_linux_bo *bo, struct mos_linux_bo *target_bo, bool write_flag) = nullptr; |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
int (*bo_flink) (struct mos_linux_bo *bo, uint32_t * name) = nullptr; |
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
int (*bo_busy) (struct mos_linux_bo *bo) = nullptr; |
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
int (*bo_madvise) (struct mos_linux_bo *bo, int madv) = nullptr; |
| 245 |
|
| 246 |
int (*check_aperture_space) (struct mos_linux_bo ** bo_array, int count) = nullptr; |
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
int (*bo_disable_reuse) (struct mos_linux_bo *bo) = nullptr; |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
int (*bo_is_reusable) (struct mos_linux_bo *bo) = nullptr; |
| 263 |
|
| 264 |
|
| 265 |
int (*bo_references) (struct mos_linux_bo *bo, struct mos_linux_bo *target_bo) = nullptr; |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
void (*set_object_async) (struct mos_linux_bo *bo) = nullptr; |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
void (*set_exec_object_async) (struct mos_linux_bo *bo, struct mos_linux_bo *target_bo) = nullptr; |
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
void (*set_object_capture)(struct mos_linux_bo *bo) = nullptr; |
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
int (*bo_wait)(struct mos_linux_bo *bo, int64_t timeout_ns) = nullptr; |
| 317 |
|
| 318 |
void (*bo_clear_relocs)(struct mos_linux_bo *bo, int start) = nullptr; |
| 319 |
struct mos_linux_context *(*context_create)(struct mos_bufmgr *bufmgr) = nullptr; |
| 320 |
struct mos_linux_context *(*context_create_ext)( |
| 321 |
struct mos_bufmgr *bufmgr, |
| 322 |
__u32 flags, |
| 323 |
bool bContextProtected) = nullptr; |
| 324 |
struct mos_linux_context *(*context_create_shared)( |
| 325 |
struct mos_bufmgr *bufmgr, |
| 326 |
mos_linux_context* ctx, |
| 327 |
__u32 flags, |
| 328 |
bool bContextProtected, |
| 329 |
void *engine_map, |
| 330 |
uint8_t ctx_width, |
| 331 |
uint8_t num_placements, |
| 332 |
uint32_t ctx_type) = nullptr; |
| 333 |
void (*context_destroy)(struct mos_linux_context *ctx) = nullptr; |
| 334 |
__u32 (*vm_create)(struct mos_bufmgr *bufmgr) = nullptr; |
| 335 |
void (*vm_destroy)(struct mos_bufmgr *bufmgr, __u32 vm_id) = nullptr; |
| 336 |
int (*bo_context_exec2)(struct mos_linux_bo *bo, int used, struct mos_linux_context *ctx, |
| 337 |
struct drm_clip_rect *cliprects, int num_cliprects, int DR4, |
| 338 |
unsigned int flags, int *fence) = nullptr; |
| 339 |
|
| 340 |
int (*bo_context_exec3)(struct mos_linux_bo **bo, int num_bo, struct mos_linux_context *ctx, |
| 341 |
struct drm_clip_rect *cliprects, int num_cliprects, int DR4, |
| 342 |
unsigned int flags, int *fence) = nullptr; |
| 343 |
bool (*bo_is_exec_object_async)(struct mos_linux_bo *bo) = nullptr; |
| 344 |
bool (*bo_is_softpin)(struct mos_linux_bo *bo) = nullptr; |
| 345 |
int (*bo_map_gtt)(struct mos_linux_bo *bo) = nullptr; |
| 346 |
int (*bo_unmap_gtt)(struct mos_linux_bo *bo) = nullptr; |
| 347 |
int (*bo_map_wc)(struct mos_linux_bo *bo) = nullptr; |
| 348 |
int (*bo_unmap_wc)(struct mos_linux_bo *bo) = nullptr; |
| 349 |
int (*bo_map_unsynchronized)(struct mos_linux_bo *bo) = nullptr; |
| 350 |
void (*bo_start_gtt_access)(struct mos_linux_bo *bo, int write_enable) = nullptr; |
| 351 |
mos_oca_exec_list_info* (*bo_get_softpin_targets_info)(struct mos_linux_bo *bo, int *count) = nullptr; |
| 352 |
struct mos_linux_bo *(*bo_create_from_name)(struct mos_bufmgr *bufmgr, |
| 353 |
const char *name, |
| 354 |
unsigned int handle) = nullptr; |
| 355 |
void (*enable_reuse)(struct mos_bufmgr *bufmgr) = nullptr; |
| 356 |
void (*enable_softpin)(struct mos_bufmgr *bufmgr, bool va1m_align) = nullptr; |
| 357 |
void (*enable_vmbind)(struct mos_bufmgr *bufmgr) = nullptr; |
| 358 |
void (*disable_object_capture)(struct mos_bufmgr *bufmgr) = nullptr; |
| 359 |
int (*get_memory_info)(struct mos_bufmgr *bufmgr, char *info, uint32_t length) = nullptr; |
| 360 |
int (*get_devid)(struct mos_bufmgr *bufmgr) = nullptr; |
| 361 |
void (*realloc_cache)(struct mos_bufmgr *bufmgr, uint8_t alloc_mode) = nullptr; |
| 362 |
int (*query_engines_count)(struct mos_bufmgr *bufmgr, |
| 363 |
unsigned int *nengine) = nullptr; |
| 364 |
|
| 365 |
int (*query_engines)(struct mos_bufmgr *bufmgr, |
| 366 |
__u16 engine_class, |
| 367 |
__u64 caps, |
| 368 |
unsigned int *nengine, |
| 369 |
void *ci) = nullptr; |
| 370 |
|
| 371 |
size_t (*get_engine_class_size)() = nullptr; |
| 372 |
|
| 373 |
void (*select_fixed_engine)(struct mos_bufmgr *bufmgr, |
| 374 |
void *engine_map, |
| 375 |
uint32_t *nengine, |
| 376 |
uint32_t fixed_instance_mask) = nullptr; |
| 377 |
|
| 378 |
int (*set_context_param)(struct mos_linux_context *ctx, |
| 379 |
uint32_t size, |
| 380 |
uint64_t param, |
| 381 |
uint64_t value) = nullptr; |
| 382 |
int (*set_context_param_parallel)(struct mos_linux_context *ctx, |
| 383 |
struct i915_engine_class_instance *ci, |
| 384 |
unsigned int count) = nullptr; |
| 385 |
int (*set_context_param_load_balance)(struct mos_linux_context *ctx, |
| 386 |
struct i915_engine_class_instance *ci, |
| 387 |
unsigned int count) = nullptr; |
| 388 |
int (*set_context_param_bond)(struct mos_linux_context *ctx, |
| 389 |
struct i915_engine_class_instance master_ci, |
| 390 |
struct i915_engine_class_instance *bond_ci, |
| 391 |
unsigned int bond_count) = nullptr; |
| 392 |
int (*get_context_param)(struct mos_linux_context *ctx, |
| 393 |
uint32_t size, |
| 394 |
uint64_t param, |
| 395 |
uint64_t *value) = nullptr; |
| 396 |
struct mos_linux_bo *(*bo_create_from_prime)(struct mos_bufmgr *bufmgr, |
| 397 |
struct mos_drm_bo_alloc_prime *alloc_prime) = nullptr; |
| 398 |
int (*bo_export_to_prime)(struct mos_linux_bo *bo, int *prime_fd) = nullptr; |
| 399 |
int (*reg_read)(struct mos_bufmgr *bufmgr, |
| 400 |
uint32_t offset, |
| 401 |
uint64_t *result) = nullptr; |
| 402 |
int (*get_reset_stats)(struct mos_linux_context *ctx, |
| 403 |
uint32_t *reset_count, |
| 404 |
uint32_t *active, |
| 405 |
uint32_t *pending) = nullptr; |
| 406 |
int (*get_context_param_sseu)(struct mos_linux_context *ctx, |
| 407 |
struct drm_i915_gem_context_param_sseu *sseu) = nullptr; |
| 408 |
int (*set_context_param_sseu)(struct mos_linux_context *ctx, |
| 409 |
struct drm_i915_gem_context_param_sseu sseu) = nullptr; |
| 410 |
int (*query_sys_engines)(struct mos_bufmgr *bufmgr, MEDIA_SYSTEM_INFO* gfx_info) = nullptr; |
| 411 |
int (*query_device_blob)(struct mos_bufmgr *bufmgr, MEDIA_SYSTEM_INFO* gfx_info) = nullptr; |
| 412 |
int (*get_driver_info)(struct mos_bufmgr *bufmgr, struct LinuxDriverInfo *drvInfo) = nullptr; |
| 413 |
int (*query_hw_ip_version)(struct mos_bufmgr *bufmgr, __u16 engine_class, void *ip_ver_info) = nullptr; |
| 414 |
uint64_t (*get_platform_information)(struct mos_bufmgr *bufmgr) = nullptr; |
| 415 |
void (*set_platform_information)(struct mos_bufmgr *bufmgr, uint64_t p) = nullptr; |
| 416 |
int (*get_ts_frequency)(struct mos_bufmgr *bufmgr, uint32_t *ts_freq) = nullptr; |
| 417 |
bool (*has_bsd2)(struct mos_bufmgr *bufmgr) = nullptr; |
| 418 |
void (*enable_turbo_boost)(struct mos_bufmgr *bufmgr) = nullptr; |
| 419 |
uint8_t (*switch_off_n_bits)(struct mos_linux_context *ctx, uint8_t in_mask, int n) = nullptr; |
| 420 |
unsigned int (*hweight8)(struct mos_linux_context *ctx, uint8_t w) = nullptr; |
| 421 |
|
| 422 |
|
| 423 |
int debug = 0; |
| 424 |
|
| 425 |
uint32_t *get_reserved = nullptr; |
| 426 |
uint32_t tile_id = 0; |
| 427 |
bool has_full_vd = true; |
| 428 |
uint64_t platform_information = 0; |
| 429 |
}; |
| 430 |
|
| 431 |
#define ALIGN(value, alignment) ((value + alignment - 1) & ~(alignment - 1)) |
| 432 |
#define ROUND_UP_TO(x, y) (((x) + (y) - 1) / (y) * (y)) |
| 433 |
#define ROUND_UP_TO_MB(x) ROUND_UP_TO((x), 1024*1024) |
| 434 |
|
| 435 |
#endif |