mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 21:50:11 +01:00
asahi: Update to UAPI 10011
Incompatible changes: - Make VM layout more flexible to allow for SVM with rusticl (eventually, hopefully) Compatible changes: - Expose soft fault state to userspace as a flag Signed-off-by: Asahi Lina <lina@asahilina.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30633>
This commit is contained in:
parent
dd5cce4730
commit
c7994a2955
5 changed files with 477 additions and 423 deletions
|
|
@ -18,8 +18,8 @@ static const struct drm_asahi_params_global params = {
|
|||
.gpu_revision = 0,
|
||||
.vm_user_start = 0x1000000,
|
||||
.vm_user_end = 0x5000000,
|
||||
.vm_shader_start = 0x8000000,
|
||||
.vm_shader_end = 0x9000000,
|
||||
.vm_usc_start = 0,
|
||||
.vm_usc_end = 0,
|
||||
.vm_page_size = 4096,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -551,7 +551,19 @@ agx_open_device(void *memctx, struct agx_device *dev)
|
|||
}
|
||||
|
||||
dev->guard_size = dev->params.vm_page_size;
|
||||
dev->shader_base = dev->params.vm_shader_start;
|
||||
if (dev->params.vm_usc_start) {
|
||||
dev->shader_base = dev->params.vm_usc_start;
|
||||
} else {
|
||||
// Put the USC heap at the bottom of the user address space, 4GiB aligned
|
||||
dev->shader_base = ALIGN_POT(dev->params.vm_user_start, 0x100000000ull);
|
||||
}
|
||||
|
||||
uint64_t shader_size = 0x100000000ull;
|
||||
// Put the user heap after the USC heap
|
||||
uint64_t user_start = dev->shader_base + shader_size;
|
||||
|
||||
assert(dev->shader_base >= dev->params.vm_user_start);
|
||||
assert(user_start < dev->params.vm_user_end);
|
||||
|
||||
util_sparse_array_init(&dev->bo_map, sizeof(struct agx_bo), 512);
|
||||
pthread_mutex_init(&dev->bo_map_lock, NULL);
|
||||
|
|
@ -562,7 +574,16 @@ agx_open_device(void *memctx, struct agx_device *dev)
|
|||
for (unsigned i = 0; i < ARRAY_SIZE(dev->bo_cache.buckets); ++i)
|
||||
list_inithead(&dev->bo_cache.buckets[i]);
|
||||
|
||||
struct drm_asahi_vm_create vm_create = {};
|
||||
// Put the kernel heap at the top of the address space.
|
||||
// Give it 32GB of address space, should be more than enough for any
|
||||
// reasonable use case.
|
||||
uint64_t kernel_size = MAX2(dev->params.vm_kernel_min_size, 32ull << 30);
|
||||
struct drm_asahi_vm_create vm_create = {
|
||||
.kernel_start = dev->params.vm_user_end - kernel_size,
|
||||
.kernel_end = dev->params.vm_user_end,
|
||||
};
|
||||
|
||||
uint64_t user_size = vm_create.kernel_start - user_start;
|
||||
|
||||
int ret = asahi_simple_ioctl(dev, DRM_IOCTL_ASAHI_VM_CREATE, &vm_create);
|
||||
if (ret) {
|
||||
|
|
@ -572,11 +593,8 @@ agx_open_device(void *memctx, struct agx_device *dev)
|
|||
}
|
||||
|
||||
simple_mtx_init(&dev->vma_lock, mtx_plain);
|
||||
util_vma_heap_init(&dev->main_heap, dev->params.vm_user_start,
|
||||
dev->params.vm_user_end - dev->params.vm_user_start + 1);
|
||||
util_vma_heap_init(
|
||||
&dev->usc_heap, dev->params.vm_shader_start,
|
||||
dev->params.vm_shader_end - dev->params.vm_shader_start + 1);
|
||||
util_vma_heap_init(&dev->main_heap, user_start, user_size);
|
||||
util_vma_heap_init(&dev->usc_heap, dev->shader_base, shader_size);
|
||||
|
||||
dev->vm_id = vm_create.vm_id;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -79,6 +79,8 @@ asahi_fill_cdm_command(struct hk_device *dev, struct hk_cs *cs,
|
|||
.sampler_count = dev->samplers.table.alloc,
|
||||
.sampler_max = dev->samplers.table.alloc + 1,
|
||||
|
||||
.usc_base = dev->dev.shader_base,
|
||||
|
||||
.encoder_id = agx_get_global_id(&dev->dev),
|
||||
.cmd_id = agx_get_global_id(&dev->dev),
|
||||
.unk_mask = 0xffffffff,
|
||||
|
|
@ -119,6 +121,9 @@ asahi_fill_vdm_command(struct hk_device *dev, struct hk_cs *cs,
|
|||
c->cmd_ta_id = cmd_ta_id;
|
||||
c->ppp_ctrl = 0x202;
|
||||
|
||||
c->fragment_usc_base = dev->dev.shader_base;
|
||||
c->vertex_usc_base = c->fragment_usc_base;
|
||||
|
||||
c->fb_width = cs->cr.width;
|
||||
c->fb_height = cs->cr.height;
|
||||
|
||||
|
|
|
|||
|
|
@ -1276,6 +1276,9 @@ agx_cmdbuf(struct agx_device *dev, struct drm_asahi_cmd_render *c,
|
|||
c->cmd_3d_id = cmd_3d_id;
|
||||
c->cmd_ta_id = cmd_ta_id;
|
||||
|
||||
c->fragment_usc_base = dev->shader_base;
|
||||
c->vertex_usc_base = dev->shader_base;
|
||||
|
||||
/* bit 0 specifies OpenGL clip behaviour. Since ARB_clip_control is
|
||||
* advertised, we don't set it and lower in the vertex shader.
|
||||
*/
|
||||
|
|
@ -1620,6 +1623,7 @@ agx_flush_compute(struct agx_context *ctx, struct agx_batch *batch,
|
|||
.encoder_ptr = batch->cdm.bo->ptr.gpu,
|
||||
.encoder_end = batch->cdm.bo->ptr.gpu +
|
||||
(batch->cdm.current - (uint8_t *)batch->cdm.bo->ptr.cpu),
|
||||
.usc_base = dev->shader_base,
|
||||
.helper_arg = 0,
|
||||
.helper_cfg = 0,
|
||||
.helper_program = 0,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue