drm/radeon: rework fbdev handling on chips with no connectors
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 10 Mar 2016 20:55:26 +0000 (15:55 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 14 Mar 2016 17:34:19 +0000 (13:34 -0400)
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=112781

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/radeon/radeon_display.c
drivers/gpu/drm/radeon/radeon_fb.c

index a4674bfd979ab047dc1738ed468d8f811a7f52dc..a885dae22dff69935bfe9048f149e880a2e262dc 100644 (file)
@@ -1670,10 +1670,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
        /* setup afmt */
        radeon_afmt_init(rdev);
 
-       if (!list_empty(&rdev->ddev->mode_config.connector_list)) {
-               radeon_fbdev_init(rdev);
-               drm_kms_helper_poll_init(rdev->ddev);
-       }
+       radeon_fbdev_init(rdev);
+       drm_kms_helper_poll_init(rdev->ddev);
 
        /* do pm late init */
        ret = radeon_pm_late_init(rdev);
index d2e628eea53d248c8cd7e3816d3bbdf43656f95d..d179596334a734085906f43aa63ea955cbef3dbd 100644 (file)
@@ -292,7 +292,8 @@ out_unref:
 
 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)
@@ -325,6 +326,10 @@ int radeon_fbdev_init(struct radeon_device *rdev)
        int bpp_sel = 32;
        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 */
        if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024))
                bpp_sel = 8;
@@ -377,11 +382,15 @@ void radeon_fbdev_fini(struct radeon_device *rdev)
 
 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)
 {
+       if (!rdev->mode_info.rfbdev)
+               return false;
+
        if (robj == gem_to_radeon_bo(rdev->mode_info.rfbdev->rfb.obj))
                return true;
        return false;
@@ -389,12 +398,14 @@ 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)
 {
-       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)
 {
-       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);
 }
 
 void radeon_fbdev_restore_mode(struct radeon_device *rdev)