mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 15:12:13 +02:00
drm/amdgpu: Add stolen vga reserve-region
Use reserve region helpers for initializing/reserving stolen vga region. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
c9042a4dd6
commit
9bb16dabb0
|
|
@ -1099,10 +1099,12 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
|
|||
size = 0;
|
||||
|
||||
if (size > AMDGPU_VBIOS_VGA_ALLOCATION) {
|
||||
adev->mman.stolen_vga_size = AMDGPU_VBIOS_VGA_ALLOCATION;
|
||||
adev->mman.stolen_extended_size = size - adev->mman.stolen_vga_size;
|
||||
amdgpu_ttm_init_vram_resv(adev, AMDGPU_RESV_STOLEN_VGA,
|
||||
0, AMDGPU_VBIOS_VGA_ALLOCATION, false);
|
||||
adev->mman.stolen_extended_size = size - AMDGPU_VBIOS_VGA_ALLOCATION;
|
||||
} else {
|
||||
adev->mman.stolen_vga_size = size;
|
||||
amdgpu_ttm_init_vram_resv(adev, AMDGPU_RESV_STOLEN_VGA,
|
||||
0, size, false);
|
||||
adev->mman.stolen_extended_size = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2206,14 +2206,12 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
|
|||
* and driver.
|
||||
*/
|
||||
if (!adev->gmc.is_app_apu) {
|
||||
r = amdgpu_bo_create_kernel_at(adev, 0,
|
||||
adev->mman.stolen_vga_size,
|
||||
&adev->mman.stolen_vga_memory,
|
||||
NULL);
|
||||
r = amdgpu_ttm_mark_vram_reserved(adev, AMDGPU_RESV_STOLEN_VGA);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = amdgpu_bo_create_kernel_at(adev, adev->mman.stolen_vga_size,
|
||||
r = amdgpu_bo_create_kernel_at(adev,
|
||||
adev->mman.resv_region[AMDGPU_RESV_STOLEN_VGA].size,
|
||||
adev->mman.stolen_extended_size,
|
||||
&adev->mman.stolen_extended_memory,
|
||||
NULL);
|
||||
|
|
@ -2342,7 +2340,7 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
|
|||
amdgpu_ttm_training_reserve_vram_fini(adev);
|
||||
/* return the stolen vga memory back to VRAM */
|
||||
if (!adev->gmc.is_app_apu) {
|
||||
amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
|
||||
amdgpu_ttm_unmark_vram_reserved(adev, AMDGPU_RESV_STOLEN_VGA);
|
||||
amdgpu_bo_free_kernel(&adev->mman.stolen_extended_memory, NULL, NULL);
|
||||
/* return the FW reserved memory back to VRAM */
|
||||
amdgpu_bo_free_kernel(&adev->mman.fw_reserved_memory, NULL,
|
||||
|
|
|
|||
|
|
@ -103,8 +103,6 @@ struct amdgpu_mman {
|
|||
struct amdgpu_gtt_mgr gtt_mgr;
|
||||
struct ttm_resource_manager preempt_mgr;
|
||||
|
||||
uint64_t stolen_vga_size;
|
||||
struct amdgpu_bo *stolen_vga_memory;
|
||||
uint64_t stolen_extended_size;
|
||||
struct amdgpu_bo *stolen_extended_memory;
|
||||
bool keep_stolen_vga_memory;
|
||||
|
|
|
|||
|
|
@ -11199,7 +11199,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
|
|||
if (!adev->in_suspend) {
|
||||
/* return the stolen vga memory back to VRAM */
|
||||
if (!adev->mman.keep_stolen_vga_memory)
|
||||
amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
|
||||
amdgpu_ttm_unmark_vram_reserved(adev, AMDGPU_RESV_STOLEN_VGA);
|
||||
amdgpu_bo_free_kernel(&adev->mman.stolen_extended_memory, NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user