Commit 1a5aee1a authored by Alex Deucher's avatar Alex Deucher Committed by Sasha Levin

drm/radeon: rework fbdev handling on chips with no connectors

[ Upstream commit e5f243bd ]

Move all the logic to radeon_fb.c and add checks to functions
called frome elsewhere.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=112781Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 76b69dfe
...@@ -333,7 +333,8 @@ static int radeonfb_create(struct drm_fb_helper *helper, ...@@ -333,7 +333,8 @@ static int radeonfb_create(struct drm_fb_helper *helper,
void radeon_fb_output_poll_changed(struct radeon_device *rdev) void radeon_fb_output_poll_changed(struct radeon_device *rdev)
{ {
drm_fb_helper_hotplug_event(&rdev->mode_info.rfbdev->helper); if (rdev->mode_info.rfbdev)
drm_fb_helper_hotplug_event(&rdev->mode_info.rfbdev->helper);
} }
static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfbdev) static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfbdev)
...@@ -373,6 +374,10 @@ int radeon_fbdev_init(struct radeon_device *rdev) ...@@ -373,6 +374,10 @@ int radeon_fbdev_init(struct radeon_device *rdev)
int bpp_sel = 32; int bpp_sel = 32;
int ret; int ret;
/* don't enable fbdev if no connectors */
if (list_empty(&rdev->ddev->mode_config.connector_list))
return 0;
/* select 8 bpp console on RN50 or 16MB cards */ /* select 8 bpp console on RN50 or 16MB cards */
if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024)) if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024))
bpp_sel = 8; bpp_sel = 8;
...@@ -425,11 +430,15 @@ void radeon_fbdev_fini(struct radeon_device *rdev) ...@@ -425,11 +430,15 @@ void radeon_fbdev_fini(struct radeon_device *rdev)
void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state) void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state)
{ {
fb_set_suspend(rdev->mode_info.rfbdev->helper.fbdev, state); if (rdev->mode_info.rfbdev)
fb_set_suspend(rdev->mode_info.rfbdev->helper.fbdev, state);
} }
bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj) bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)
{ {
if (!rdev->mode_info.rfbdev)
return false;
if (robj == gem_to_radeon_bo(rdev->mode_info.rfbdev->rfb.obj)) if (robj == gem_to_radeon_bo(rdev->mode_info.rfbdev->rfb.obj))
return true; return true;
return false; return false;
...@@ -437,10 +446,12 @@ bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj) ...@@ -437,10 +446,12 @@ bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)
void radeon_fb_add_connector(struct radeon_device *rdev, struct drm_connector *connector) void radeon_fb_add_connector(struct radeon_device *rdev, struct drm_connector *connector)
{ {
drm_fb_helper_add_one_connector(&rdev->mode_info.rfbdev->helper, connector); if (rdev->mode_info.rfbdev)
drm_fb_helper_add_one_connector(&rdev->mode_info.rfbdev->helper, connector);
} }
void radeon_fb_remove_connector(struct radeon_device *rdev, struct drm_connector *connector) void radeon_fb_remove_connector(struct radeon_device *rdev, struct drm_connector *connector)
{ {
drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector); if (rdev->mode_info.rfbdev)
drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment