Skip to content

Commit

Permalink
drm/amdgpu: use generic fb helpers instead of setting up AMD own's.
Browse files Browse the repository at this point in the history
With the shadow buffer support from generic framebuffer emulation, it's
possible now to have runpm kicked when no update for console.

Signed-off-by: Evan Quan <[email protected]>
Acked-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
  • Loading branch information
Evan Quan authored and alexdeucher committed Nov 17, 2021
1 parent b5d1d75 commit 087451f
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 426 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdgpu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \
amdgpu_atombios.o atombios_crtc.o amdgpu_connectors.o \
atom.o amdgpu_fence.o amdgpu_ttm.o amdgpu_object.o amdgpu_gart.o \
amdgpu_encoders.o amdgpu_display.o amdgpu_i2c.o \
amdgpu_fb.o amdgpu_gem.o amdgpu_ring.o \
amdgpu_gem.o amdgpu_ring.o \
amdgpu_cs.o amdgpu_bios.o amdgpu_benchmark.o amdgpu_test.o \
atombios_dp.o amdgpu_afmt.o amdgpu_trace_points.o \
atombios_encoders.o amdgpu_sa.o atombios_i2c.o \
Expand Down
12 changes: 4 additions & 8 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -3684,8 +3684,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
/* Get a log2 for easy divisions. */
adev->mm_stats.log2_max_MBps = ilog2(max(1u, max_MBps));

amdgpu_fbdev_init(adev);

r = amdgpu_pm_sysfs_init(adev);
if (r) {
adev->pm_sysfs_en = false;
Expand Down Expand Up @@ -3843,8 +3841,6 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
amdgpu_ucode_sysfs_fini(adev);
sysfs_remove_files(&adev->dev->kobj, amdgpu_dev_attributes);

amdgpu_fbdev_fini(adev);

amdgpu_device_ip_fini_early(adev);

amdgpu_irq_fini_hw(adev);
Expand Down Expand Up @@ -3939,7 +3935,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
drm_kms_helper_poll_disable(dev);

if (fbcon)
amdgpu_fbdev_set_suspend(adev, 1);
drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, true);

cancel_delayed_work_sync(&adev->delayed_init_work);

Expand Down Expand Up @@ -4016,7 +4012,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
flush_delayed_work(&adev->delayed_init_work);

if (fbcon)
amdgpu_fbdev_set_suspend(adev, 0);
drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, false);

drm_kms_helper_poll_enable(dev);

Expand Down Expand Up @@ -4646,7 +4642,7 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
if (r)
goto out;

amdgpu_fbdev_set_suspend(tmp_adev, 0);
drm_fb_helper_set_suspend_unlocked(adev_to_drm(tmp_adev)->fb_helper, false);

/*
* The GPU enters bad state once faulty pages
Expand Down Expand Up @@ -5036,7 +5032,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
*/
amdgpu_unregister_gpu_instance(tmp_adev);

amdgpu_fbdev_set_suspend(tmp_adev, 1);
drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, true);

/* disable ras on ALL IPs */
if (!need_emergency_restart &&
Expand Down
11 changes: 4 additions & 7 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,13 +1603,10 @@ int amdgpu_display_suspend_helper(struct amdgpu_device *adev)
continue;
}
robj = gem_to_amdgpu_bo(fb->obj[0]);
/* don't unpin kernel fb objects */
if (!amdgpu_fbdev_robj_is_fb(adev, robj)) {
r = amdgpu_bo_reserve(robj, true);
if (r == 0) {
amdgpu_bo_unpin(robj);
amdgpu_bo_unreserve(robj);
}
r = amdgpu_bo_reserve(robj, true);
if (r == 0) {
amdgpu_bo_unpin(robj);
amdgpu_bo_unreserve(robj);
}
}
return 0;
Expand Down
13 changes: 13 additions & 0 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2002,6 +2002,19 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
goto err_pci;
}

/*
* 1. don't init fbdev on hw without DCE
* 2. don't init fbdev if there are no connectors
*/
if (adev->mode_info.mode_config_initialized &&
!list_empty(&adev_to_drm(adev)->mode_config.connector_list)) {
/* select 8 bpp console on low vram cards */
if (adev->gmc.real_vram_size <= (32*1024*1024))
drm_fbdev_generic_setup(adev_to_drm(adev), 8);
else
drm_fbdev_generic_setup(adev_to_drm(adev), 32);
}

ret = amdgpu_debugfs_init(adev);
if (ret)
DRM_ERROR("Creating debugfs files failed (%d).\n", ret);
Expand Down
Loading

0 comments on commit 087451f

Please sign in to comment.