	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dm_plane_helper_prepare_fb
_dm_plane_helper_prepare_fb:            ## @dm_plane_helper_prepare_fb
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	8(%rdi), %rdi
	callq	_to_dm_plane_state
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_to_dm_plane_state
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	callq	_to_amdgpu_framebuffer
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	(%rbx), %rax
	movq	(%rax), %rax
	movq	(%rax), %rdi
	callq	_gem_to_amdgpu_bo
	movq	%rax, %r12
	movl	(%rax), %edi
	callq	_amdgpu_ttm_adev
	movq	%rax, %r13
	leaq	-56(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_INIT_LIST_HEAD
	movq	%r12, -96(%rbp)
	movl	$1, -104(%rbp)
	leaq	-100(%rbp), %rdi
	movq	%rbx, %rsi
	callq	_list_add
	leaq	-48(%rbp), %rdi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	_ttm_eu_reserve_buffers
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	%eax, %r14d
	movl	(%r13), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_err
	jmp	LBB0_16
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_DRM_DEBUG_DRIVER
	xorl	%r14d, %r14d
	jmp	LBB0_16
LBB0_4:
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	movq	(%r15), %rax
	movq	_DRM_PLANE_TYPE_CURSOR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_5
## %bb.6:
	movq	_AMDGPU_GEM_DOMAIN_VRAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	jmp	LBB0_7
LBB0_5:
	movl	4(%r12), %esi
	movq	%r13, %rdi
	callq	_amdgpu_display_supported_domains
	movl	%eax, %esi
LBB0_7:
	movq	%r12, %rdi
	callq	_amdgpu_bo_pin
	movl	%eax, %r14d
	xorl	%edi, %edi
	testl	%eax, %eax
	setne	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_11
## %bb.8:
	movq	_ERESTARTSYS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r14d, %eax
	je	LBB0_10
## %bb.9:
	leaq	L_.str.2(%rip), %rdi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_DRM_ERROR
LBB0_10:
	leaq	-48(%rbp), %rdi
	leaq	-56(%rbp), %rsi
	callq	_ttm_eu_backoff_reservation
	jmp	LBB0_16
LBB0_11:
	movq	%r12, %rdi
	callq	_amdgpu_ttm_alloc_gart
	movl	%eax, %r14d
	xorl	%edi, %edi
	testl	%eax, %eax
	setne	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_13
## %bb.12:
	movq	%r12, %rdi
	callq	_amdgpu_bo_unpin
	leaq	-48(%rbp), %rdi
	leaq	-56(%rbp), %rsi
	callq	_ttm_eu_backoff_reservation
	leaq	L_.str.3(%rip), %rdi
	movq	%r12, %rsi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_16
LBB0_13:
	leaq	-60(%rbp), %rsi
	movq	%r12, %rdi
	callq	_amdgpu_bo_get_tiling_flags
	leaq	-48(%rbp), %rdi
	leaq	-56(%rbp), %rsi
	callq	_ttm_eu_backoff_reservation
	movq	%r12, %rdi
	callq	_amdgpu_bo_gpu_offset
	movl	%eax, (%rbx)
	movq	%r12, %rdi
	callq	_amdgpu_bo_ref
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	xorl	%r14d, %r14d
	testq	%rax, %rax
	je	LBB0_16
## %bb.14:
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	cmpq	%rax, (%rcx)
	je	LBB0_16
## %bb.15:
	movl	16(%rax), %ecx
	movl	20(%rax), %edx
	movl	-60(%rbp), %r8d
	leaq	12(%rax), %r9
	leaq	8(%rax), %r10
	subq	$8, %rsp
	movq	%r13, %rdi
	movq	%rbx, %rsi
	pushq	%rax
	addq	$4, %rax
	pushq	%rax
	pushq	%r10
	callq	_fill_plane_buffer_attributes
	addq	$32, %rsp
LBB0_16:
	movl	%r14d, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No FB bound\n"

L_.str.1:                               ## @.str.1
	.asciz	"fail to reserve bo (%d)\n"

	.comm	_DRM_PLANE_TYPE_CURSOR,8,3      ## @DRM_PLANE_TYPE_CURSOR
	.comm	_AMDGPU_GEM_DOMAIN_VRAM,4,2     ## @AMDGPU_GEM_DOMAIN_VRAM
	.comm	_ERESTARTSYS,4,2                ## @ERESTARTSYS
L_.str.2:                               ## @.str.2
	.asciz	"Failed to pin framebuffer with error %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"%p bind failed\n"

	.no_dead_strip	_dm_plane_helper_prepare_fb
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dm_plane_helper_prepare_fb
_dm_plane_helper_prepare_fb:            ; @dm_plane_helper_prepare_fb
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x22, x1
	mov	x25, x0
	ldr	x0, [x0, #8]
	bl	_to_dm_plane_state
	mov	x19, x0
	mov	x0, x22
	bl	_to_dm_plane_state
	mov	x21, x0
	ldr	x0, [x22]
	cbz	x0, LBB0_3
; %bb.1:
	bl	_to_amdgpu_framebuffer
	mov	x20, x0
	ldr	x8, [x22]
	ldr	x8, [x8]
	ldr	x0, [x8]
	bl	_gem_to_amdgpu_bo
	mov	x23, x0
	ldr	w0, [x0]
	bl	_amdgpu_ttm_adev
	mov	x22, x0
	add	x0, sp, #40
	bl	_INIT_LIST_HEAD
	str	x23, [sp, #32]
	mov	w8, #1
	str	w8, [sp, #24]
	add	x8, sp, #24
	orr	x0, x8, #0x4
	add	x1, sp, #40
	bl	_list_add
	add	x0, sp, #16
	add	x1, sp, #40
	mov	w2, #0
	mov	x3, #0
	mov	w4, #1
	bl	_ttm_eu_reserve_buffers
	cbz	w0, LBB0_5
; %bb.2:
	mov	x24, x0
	ldr	w0, [x22]
Lloh0:
	adrp	x1, l_.str.1@PAGE
Lloh1:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x24
	bl	_dev_err
	b	LBB0_14
LBB0_3:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG_DRIVER
LBB0_4:
	mov	w24, #0
	b	LBB0_14
LBB0_5:
	ldr	x8, [x25]
Lloh4:
	adrp	x9, _DRM_PLANE_TYPE_CURSOR@GOTPAGE
Lloh5:
	ldr	x9, [x9, _DRM_PLANE_TYPE_CURSOR@GOTPAGEOFF]
Lloh6:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.6:
Lloh7:
	adrp	x8, _AMDGPU_GEM_DOMAIN_VRAM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _AMDGPU_GEM_DOMAIN_VRAM@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	b	LBB0_8
LBB0_7:
	ldr	w1, [x23, #4]
	mov	x0, x22
	bl	_amdgpu_display_supported_domains
	mov	x1, x0
LBB0_8:
	mov	x0, x23
	bl	_amdgpu_bo_pin
	mov	x24, x0
	cmp	w0, #0
	cset	w0, ne
	bl	_unlikely
	cbz	x0, LBB0_12
; %bb.9:
Lloh10:
	adrp	x8, _ERESTARTSYS@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ERESTARTSYS@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	cmn	w24, w8
	b.eq	LBB0_11
; %bb.10:
	str	x24, [sp]
Lloh13:
	adrp	x0, l_.str.2@PAGE
Lloh14:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DRM_ERROR
LBB0_11:
	add	x0, sp, #16
	add	x1, sp, #40
	bl	_ttm_eu_backoff_reservation
	b	LBB0_14
LBB0_12:
	mov	x0, x23
	bl	_amdgpu_ttm_alloc_gart
	mov	x24, x0
	cmp	w0, #0
	cset	w0, ne
	bl	_unlikely
	cbz	x0, LBB0_15
; %bb.13:
	mov	x0, x23
	bl	_amdgpu_bo_unpin
	add	x0, sp, #16
	add	x1, sp, #40
	bl	_ttm_eu_backoff_reservation
	str	x23, [sp]
Lloh15:
	adrp	x0, l_.str.3@PAGE
Lloh16:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_DRM_ERROR
LBB0_14:
	mov	x0, x24
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_15:
	add	x1, sp, #12
	mov	x0, x23
	bl	_amdgpu_bo_get_tiling_flags
	add	x0, sp, #16
	add	x1, sp, #40
	bl	_ttm_eu_backoff_reservation
	mov	x0, x23
	bl	_amdgpu_bo_gpu_offset
	str	w0, [x20]
	mov	x0, x23
	bl	_amdgpu_bo_ref
	ldr	x8, [x21]
	cbz	x8, LBB0_4
; %bb.16:
	ldr	x9, [x19]
	cmp	x9, x8
	b.eq	LBB0_4
; %bb.17:
	ldp	w3, w2, [x8, #16]
	add	x5, x8, #12
	add	x6, x8, #8
	add	x7, x8, #4
	ldr	w4, [sp, #12]
	str	x8, [sp]
	mov	x0, x22
	mov	x1, x20
	bl	_fill_plane_buffer_attributes
	b	LBB0_4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No FB bound\n"

l_.str.1:                               ; @.str.1
	.asciz	"fail to reserve bo (%d)\n"

	.comm	_DRM_PLANE_TYPE_CURSOR,8,3      ; @DRM_PLANE_TYPE_CURSOR
	.comm	_AMDGPU_GEM_DOMAIN_VRAM,4,2     ; @AMDGPU_GEM_DOMAIN_VRAM
	.comm	_ERESTARTSYS,4,2                ; @ERESTARTSYS
l_.str.2:                               ; @.str.2
	.asciz	"Failed to pin framebuffer with error %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"%p bind failed\n"

	.no_dead_strip	_dm_plane_helper_prepare_fb
.subsections_via_symbols
