[PATCH] drm/amdgpu: assign dpms for amdgpu_vkms_crtc_helper_funcs
Chen, Guchun
Guchun.Chen at amd.com
Fri Nov 5 10:23:32 UTC 2021
[Public]
Acked-by: Guchun Chen <guchun.chen at amd.com>
Regards,
Guchun
-----Original Message-----
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Asher Song
Sent: Friday, November 5, 2021 5:41 PM
To: amd-gfx at lists.freedesktop.org
Cc: Song, Asher <Asher.Song at amd.com>
Subject: [PATCH] drm/amdgpu: assign dpms for amdgpu_vkms_crtc_helper_funcs
In drm_helper_disable_unused_functions(), when !crtc->enable is false, a NULL pointer crtc_funcs->dpms may occur. To avoid this, assign dpms for amdgpu_vkms_crtc_helper_funcs.
Call Trace:
__drm_helper_disable_unused_functions+0xac/0xe0 [drm_kms_helper]
drm_helper_disable_unused_functions+0x38/0x60 [drm_kms_helper]
amdgpu_fbdev_init+0xf6/0x100 [amdgpu]
amdgpu_device_init+0x13d4/0x1f10 [amdgpu]
Fixes: ba5317109d0ce ("drm/amdgpu: create amdgpu_vkms (v4)")
Signed-off-by: Asher Song <Asher.Song at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 26 ++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
index 50bdc39733aa..9cfe479c4c97 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
@@ -156,7 +156,33 @@ static void amdgpu_vkms_crtc_atomic_flush(struct drm_crtc *crtc,
}
}
+static void amdgpu_vkms_crtc_dpms(struct drm_crtc *crtc, int mode) {
+ struct drm_device *dev = crtc->dev;
+ struct amdgpu_device *adev = drm_to_adev(dev);
+ struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
+ unsigned type;
+
+ switch (mode) {
+ case DRM_MODE_DPMS_ON:
+ amdgpu_crtc->enabled = true;
+ /* Make sure VBLANK interrupts are still enabled */
+ type = amdgpu_display_crtc_idx_to_irq_type(adev,
+ amdgpu_crtc->crtc_id);
+ amdgpu_irq_update(adev, &adev->crtc_irq, type);
+ drm_crtc_vblank_on(crtc);
+ break;
+ case DRM_MODE_DPMS_STANDBY:
+ case DRM_MODE_DPMS_SUSPEND:
+ case DRM_MODE_DPMS_OFF:
+ drm_crtc_vblank_off(crtc);
+ amdgpu_crtc->enabled = false;
+ break;
+ }
+}
+
static const struct drm_crtc_helper_funcs amdgpu_vkms_crtc_helper_funcs = {
+ .dpms = amdgpu_vkms_crtc_dpms,
.atomic_flush = amdgpu_vkms_crtc_atomic_flush,
.atomic_enable = amdgpu_vkms_crtc_atomic_enable,
.atomic_disable = amdgpu_vkms_crtc_atomic_disable,
--
2.25.1
More information about the amd-gfx
mailing list