Skip to contentSkip to conversation

drm/radeon: only init fbdev if we have connectors

PATCH Applied Rob Clark 3 participants 5 messages Jan 25, 2016 – Jan 26, 2016

Subsystems (2)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 drm/radeon: only init fbdev if we have connectors

This fixes an issue that was noticed on an optimus/prime laptop with a kernel that was old enough to not support the integrated intel gfx (which was driving all the outputs), but did have support for the discrete radeon gpu. The end result was not falling back to VESA and leaving the user with a black screen.

(Plus it is kind of silly to create an framebuffer device if there are no outputs hooked up to the gpu.)

---
 drivers/gpu/drm/radeon/radeon_display.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_display.c +4 -2
index 1eca0ac..f8e776c 100644
@@ -1670,8 +1670,10 @@ int radeon_modeset_init(struct radeon_device *rdev)
 	/* setup afmt */
 	radeon_afmt_init(rdev);
 
-	radeon_fbdev_init(rdev);
-	drm_kms_helper_poll_init(rdev->ddev);
+	if (!list_empty(&rdev->ddev->mode_config.connector_list)) {
+		radeon_fbdev_init(rdev);
+		drm_kms_helper_poll_init(rdev->ddev);
+	}
 
 	/* do pm late init */
 	ret = radeon_pm_late_init(rdev);
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Is something similar required for AMDGPU too?

Quoted 35 lines · On Mon, 25 Jan 2016 at 23:06 Rob Clark <[email protected]> wrote:

This fixes an issue that was noticed on an optimus/prime laptop with a kernel that was old enough to not support the integrated intel gfx (which was driving all the outputs), but did have support for the discrete radeon gpu. The end result was not falling back to VESA and leaving the user with a black screen.

(Plus it is kind of silly to create an framebuffer device if there are no outputs hooked up to the gpu.)

---
 drivers/gpu/drm/radeon/radeon_display.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_display.c +4 -3
index 1eca0ac..f8e776c 100644
@@ -1670,8 +1670,10 @@ int radeon_modeset_init(struct radeon_device *rdev)
        /* setup afmt */
        radeon_afmt_init(rdev);
 
-       radeon_fbdev_init(rdev);
-       drm_kms_helper_poll_init(rdev->ddev);
+       if (!list_empty(&rdev->ddev->mode_config.connector_list)) {
+               radeon_fbdev_init(rdev);
+               drm_kms_helper_poll_init(rdev->ddev);
+       }
 
        /* do pm late init */
        ret = radeon_pm_late_init(rdev);
--

2.5.0

Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#2 lore raw

from a quick look, I think so..

It was something I ran across on an older kernel which didn't have amdgpu, but I don't see anything obvious that would cause drm_fb_helper_init() to be skipped in amdgpu if there are no connectors.. (but nouveau seems to check for dev->mode_config.num_crtc, for (I assume) similar reasons)

BR,
-R

Quoted 39 lines · Mike Lothian

Is something similar required for AMDGPU too?

Quoted 36 lines · On Mon, 25 Jan 2016 at 23:06 Rob Clark <[email protected]> wrote:

This fixes an issue that was noticed on an optimus/prime laptop with a kernel that was old enough to not support the integrated intel gfx (which was driving all the outputs), but did have support for the discrete radeon gpu. The end result was not falling back to VESA and leaving the user with a black screen.

(Plus it is kind of silly to create an framebuffer device if there are no outputs hooked up to the gpu.)

---
 drivers/gpu/drm/radeon/radeon_display.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_display.c +4 -3
index 1eca0ac..f8e776c 100644
@@ -1670,8 +1670,10 @@ int radeon_modeset_init(struct radeon_device *rdev)
        /* setup afmt */
        radeon_afmt_init(rdev);
 
-       radeon_fbdev_init(rdev);
-       drm_kms_helper_poll_init(rdev->ddev);
+       if (!list_empty(&rdev->ddev->mode_config.connector_list)) {
+               radeon_fbdev_init(rdev);
+               drm_kms_helper_poll_init(rdev->ddev);
+       }
 
        /* do pm late init */
        ret = radeon_pm_late_init(rdev);
--

2.5.0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 7 lines · Rob Clark

from a quick look, I think so..

It was something I ran across on an older kernel which didn't have amdgpu, but I don't see anything obvious that would cause drm_fb_helper_init() to be skipped in amdgpu if there are no connectors.. (but nouveau seems to check for dev->mode_config.num_crtc, for (I assume) similar reasons)

We don't enable fbdev on amdgpu if the chip in question has no display block, but we still could enable it if the chip has a display block, but no connectors. The same may be true in nouveau so the check for num_crtc may not be enough. Attached patch should rectify that.

Alex

Quoted 44 lines

BR,
-R

Quoted 39 lines · Mike Lothian

Is something similar required for AMDGPU too?

Quoted 36 lines · On Mon, 25 Jan 2016 at 23:06 Rob Clark <[email protected]> wrote:

This fixes an issue that was noticed on an optimus/prime laptop with a kernel that was old enough to not support the integrated intel gfx (which was driving all the outputs), but did have support for the discrete radeon gpu. The end result was not falling back to VESA and leaving the user with a black screen.

(Plus it is kind of silly to create an framebuffer device if there are no outputs hooked up to the gpu.)

---
 drivers/gpu/drm/radeon/radeon_display.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_display.c +4 -3
index 1eca0ac..f8e776c 100644
@@ -1670,8 +1670,10 @@ int radeon_modeset_init(struct radeon_device *rdev)
        /* setup afmt */
        radeon_afmt_init(rdev);
 
-       radeon_fbdev_init(rdev);
-       drm_kms_helper_poll_init(rdev->ddev);
+       if (!list_empty(&rdev->ddev->mode_config.connector_list)) {
+               radeon_fbdev_init(rdev);
+               drm_kms_helper_poll_init(rdev->ddev);
+       }
 
        /* do pm late init */
        ret = radeon_pm_late_init(rdev);
--

2.5.0

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

From 55a9c63c7a20f07cb77864346ac21ea962f00068 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Tue, 26 Jan 2016 00:30:33 -0500
Subject: [PATCH] drm/amdgpu: don't init fbdev if we don't have any connectors

Don't init fbdev if we don't have connectors. E.g., if you have a PX laptop with the displays attached to an IGP with no driver support, you may end up with a blank screen rather than falling back to vesa, etc.

Based on a similar radeon patch from Rob Clark.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +4 -0
index cfb6caa..9191467 100644
@@ -333,6 +333,10 @@ int amdgpu_fbdev_init(struct amdgpu_device *adev)
 	if (!adev->mode_info.mode_config_initialized)
 		return 0;
 
+	/* don't init fbdev if there are no connectors */
+	if (list_empty(&adev->ddev->mode_config.connector_list))
+		return 0;
+
 	/* select 8 bpp console on low vram cards */
 	if (adev->mc.real_vram_size <= (32*1024*1024))
 		bpp_sel = 8;
Signature · 1 line
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Applied
#4 lore raw
In reply to Rob Clark
Quoted 10 lines · Rob Clark

This fixes an issue that was noticed on an optimus/prime laptop with a kernel that was old enough to not support the integrated intel gfx (which was driving all the outputs), but did have support for the discrete radeon gpu. The end result was not falling back to VESA and leaving the user with a black screen.

(Plus it is kind of silly to create an framebuffer device if there are no outputs hooked up to the gpu.)

Applied. thanks!

Alex

Quoted 24 lines
---
 drivers/gpu/drm/radeon/radeon_display.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_display.c +4 -3
index 1eca0ac..f8e776c 100644
@@ -1670,8 +1670,10 @@ int radeon_modeset_init(struct radeon_device *rdev)
        /* setup afmt */
        radeon_afmt_init(rdev);
 
-       radeon_fbdev_init(rdev);
-       drm_kms_helper_poll_init(rdev->ddev);
+       if (!list_empty(&rdev->ddev->mode_config.connector_list)) {
+               radeon_fbdev_init(rdev);
+               drm_kms_helper_poll_init(rdev->ddev);
+       }
 
        /* do pm late init */
        ret = radeon_pm_late_init(rdev);
--

2.5.0

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel