From: José Roberto de Souza Date: Tue, 14 Mar 2023 20:27:53 +0000 (-0700) Subject: anv: Apply memory alignment requirements in Xe kmd X-Git-Tag: upstream/23.3.3~11388 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96302900aa26d28c3cb01e6e1a34a6c0bdfb2c06;p=platform%2Fupstream%2Fmesa.git anv: Apply memory alignment requirements in Xe kmd Without alignment vm bind will fail and during gem buffer creation size also need to be aligned otherwise the range in vm bind can be bigger than allocated size for smem. Signed-off-by: José Roberto de Souza Reviewed-by: Lionel Landwerlin Part-of: --- diff --git a/src/intel/vulkan/xe/anv_kmd_backend.c b/src/intel/vulkan/xe/anv_kmd_backend.c index b76ba0b..434215e 100644 --- a/src/intel/vulkan/xe/anv_kmd_backend.c +++ b/src/intel/vulkan/xe/anv_kmd_backend.c @@ -40,7 +40,7 @@ xe_gem_create(struct anv_device *device, * 2. Cannot be exported as a PRIME fd. */ .vm_id = alloc_flags & ANV_BO_ALLOC_EXTERNAL ? 0 : device->vm_id, - .size = size, + .size = align64(size, device->info->mem_alignment), .flags = alloc_flags & ANV_BO_ALLOC_SCANOUT ? XE_GEM_CREATE_FLAG_SCANOUT : 0, }; for (uint16_t i = 0; i < regions_count; i++) @@ -93,7 +93,7 @@ xe_gem_vm_bind_op(struct anv_device *device, struct anv_bo *bo, uint32_t op) .num_binds = 1, .bind.obj = op == XE_VM_BIND_OP_UNMAP ? 0 : bo->gem_handle, .bind.obj_offset = 0, - .bind.range = bo->size + bo->_ccs_size, + .bind.range = align64(bo->size + bo->_ccs_size, device->info->mem_alignment), .bind.addr = intel_48b_address(bo->offset), .bind.op = op, .num_syncs = 1,