Accept 3d controllers and not only VGA controllers.
Subsystems (3)
PATCH 1/1 Accept 3d controllers and not only VGA controllers.
Accept 3d controllers and not only VGA controllers. According to Ilia Mirkin,
the VGA controller check should be removed. This makes it possible to use external connectors on a docking station (40A5) for a Thinkpad P51. (See Bug 101778).
lspci example:
01:00.0 3D controller: NVIDIA Corporation GM107GLM [Quadro M1200 Mobile] (rev a2)
Also include safe-guards to avoid NULL dereferencing of fbcon, which is how this bug was found.
---
drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/nouveau/nv50_display.c | 13 +++++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
(quoted diff) +0 -0
b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 2b12d82aac15..6b4d374a9d82 100644
drivers/gpu/drm/nouveau/nouveau_fbcon.c +0 -0
@@ -498,8 +498,7 @@ nouveau_fbcon_init(struct drm_device *dev)
int preferred_bpp;
int ret;
- if (!dev->mode_config.num_crtc ||
- (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) + if (!dev->mode_config.num_crtc)
return 0;
fbcon = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL);
(quoted diff) +0 -0
b/drivers/gpu/drm/nouveau/nv50_display.c
index fb47d46050ec..061daf036407 100644
drivers/gpu/drm/nouveau/nv50_display.c +0 -0
@@ -3214,6 +3214,13 @@ nv50_mstm_destroy_connector(struct
drm_dp_mst_topology_mgr *mgr,
struct nouveau_drm *drm = nouveau_drm(connector->dev); struct nv50_mstc *mstc = nv50_mstc(connector);
+ if (!drm->fbcon)
+ {
+ NV_WARN(drm, "drm->fbcon of %s point to NULL. Will not destroy connector\n",
+ connector->name);
+ return;
+ }
+
drm_connector_unregister(&mstc->connector);
drm_modeset_lock_all(drm->dev);
@@ -3229,6 +3236,12 @@ nv50_mstm_register_connector(struct drm_connector *connector)
{
struct nouveau_drm *drm = nouveau_drm(connector->dev);
+ if (!drm->fbcon)
+ {
+ NV_WARN(drm, "drm->fbcon of %s point to NULL. Will not register connector\n",
+ connector->name);
+ return;
+ }
drm_modeset_lock_all(drm->dev); drm_fb_helper_add_one_connector(&drm->fbcon->helper, connector); drm_modeset_unlock_all(drm->dev);
Signature · 1 line
2.13.6
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Quoted 67 lines · Josef Larsson
Accept 3d controllers and not only VGA controllers. According to Ilia Mirkin,
the VGA controller check should be removed. This makes it possible to use external connectors on a docking station (40A5) for a Thinkpad P51. (See Bug 101778).lspci example:
01:00.0 3D controller: NVIDIA Corporation GM107GLM [Quadro M1200 Mobile] (rev a2)
Also include safe-guards to avoid NULL dereferencing of fbcon, which is how this bug was found.
--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/nouveau/nv50_display.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-)drivers/gpu/drm/nouveau/nouveau_fbcon.c +1
-2@@ -498,8 +498,7 @@ nouveau_fbcon_init(struct drm_device *dev) int preferred_bpp; int ret; - if (!dev->mode_config.num_crtc || - (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) + if (!dev->mode_config.num_crtc) return 0; fbcon = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL);drivers/gpu/drm/nouveau/nv50_display.c +7
-0@@ -3214,6 +3214,13 @@ nv50_mstm_destroy_connector(struct drm_dp_mst_topology_mgr *mgr, struct nouveau_drm *drm = nouveau_drm(connector->dev); struct nv50_mstc *mstc = nv50_mstc(connector); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will not destroy connector\n", + connector->name); + return; + } + drm_connector_unregister(&mstc->connector);
drm_modeset_lock_all(drm->dev);drivers/gpu/drm/nouveau/nv50_display.c +6
-0@@ -3229,6 +3236,12 @@ nv50_mstm_register_connector(struct drm_connector *connector) { struct nouveau_drm *drm = nouveau_drm(connector->dev); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will not register connector\n", + connector->name); + return; + } drm_modeset_lock_all(drm->dev);
Quoted 4 lines
drm_fb_helper_add_one_connector(&drm->fbcon->helper, connector);drm_modeset_unlock_all(drm->dev);
Hi,
the patch looks OK to me, yet as noted in IRC, i'd like to have this patch split into two and have the ->fbcon check as a precondition to the 3D Controller part. But lets see what the other and more clever people think about it! :)
Greetings,
Tobias
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Sure, I can easily split it into two commits, but I would like to have an OK on the actual code changes before splitting the patch.
Best regards,
Josef Larsson
Quoted 72 lines · Tobias Klausmann
Quoted 63 lines · Josef Larsson
Accept 3d controllers and not only VGA controllers. According to Ilia Mirkin,
the VGA controller check should be removed. This makes it possible to use external connectors on a docking station (40A5) for a Thinkpad P51.
(See Bug 101778).lspci example:
01:00.0 3D controller: NVIDIA Corporation GM107GLM [Quadro M1200 Mobile] (rev a2)
Also include safe-guards to avoid NULL dereferencing of fbcon, which is how this bug was found.
---
drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/nouveau/nv50_display.c | 13 +++++++++++++2 files changed, 14 insertions(+), 2 deletions(-)drivers/gpu/drm/nouveau/nouveau_fbcon.c +0
-0@@ -498,8 +498,7 @@ nouveau_fbcon_init(struct drm_device *dev) int preferred_bpp; int ret;- if (!dev->mode_config.num_crtc ||
- (dev->pdev->class>> 8) !=PCI_CLASS_DISPLAY_VGA) + if (!dev->mode_config.num_crtc)
return 0;
fbcon =kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL);drivers/gpu/drm/nouveau/nv50_display.c +6
-0@@ -3214,6 +3214,13 @@ nv50_mstm_destroy_connector(struct drm_dp_mst_topology_mgr *mgr, struct nouveau_drm *drm = nouveau_drm(connector->dev); struct nv50_mstc *mstc = nv50_mstc(connector); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will not destroy connector\n", + connector->name); + return; + } + drm_connector_unregister(&mstc->connector);
drm_modeset_lock_all(drm->dev);drivers/gpu/drm/nouveau/nv50_display.c +5
-0@@ -3229,6 +3236,12 @@ nv50_mstm_register_connector(struct drm_connector *connector) { struct nouveau_drm *drm = nouveau_drm(connector->dev); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will not register connector\n", + connector->name); + return; + } drm_modeset_lock_all(drm->dev);Quoted 4 lines
drm_fb_helper_add_one_connector(&drm->fbcon->helper, connector);drm_modeset_unlock_all(drm->dev);Hi,
Quoted 9 lines
the patch looks OK to me, yet as noted in IRC, i'd like to have this patch split into two and have the ->fbcon check as a precondition to the 3D Controller part. But lets see what the other and more clever people think about it! :)
Greetings,
Tobias
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Quoted 89 lines · Josef Larsson
Sure, I can easily split it into two commits, but I would like to have an OK on the actual code changes before splitting the patch.
Best regards,
Josef Larsson
Quoted 79 lines · Tobias Klausmann
Quoted 57 lines · Josef Larsson
Accept 3d controllers and not only VGA controllers. According to Ilia Mirkin,
the VGA controller check should be removed. This makes it possible to use external connectors on a docking station (40A5) for a Thinkpad P51.
(See Bug 101778).lspci example:
01:00.0 3D controller: NVIDIA Corporation GM107GLM [Quadro M1200 Mobile] (rev a2)
Also include safe-guards to avoid NULL dereferencing of fbcon, which is how this bug was found.
--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/nouveau/nv50_display.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-)drivers/gpu/drm/nouveau/nouveau_fbcon.c +1
-1@@ -498,8 +498,7 @@ nouveau_fbcon_init(struct drm_device *dev) int preferred_bpp; int ret; - if (!dev->mode_config.num_crtc || - (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) + if (!dev->mode_config.num_crtc) return 0; fbcon = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL);drivers/gpu/drm/nouveau/nv50_display.c +6
-0@@ -3214,6 +3214,13 @@ nv50_mstm_destroy_connector(struct drm_dp_mst_topology_mgr *mgr, struct nouveau_drm *drm = nouveau_drm(connector->dev); struct nv50_mstc *mstc = nv50_mstc(connector); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will not destroy connector\n", + connector->name); + return; + } + drm_connector_unregister(&mstc->connector); drm_modeset_lock_all(drm->dev);@@ -3229,6 +3236,12 @@ nv50_mstm_register_connector(struct drm_connector *connector) { struct nouveau_drm *drm = nouveau_drm(connector->dev);drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct drm_connector
Quoted 10 lines
drivers/gpu/drm/nouveau/nv50_display.c +5
-0+ if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will not register connector\n", + connector->name); + return; + } drm_modeset_lock_all(drm->dev); drm_fb_helper_add_one_connector(&drm->fbcon->helper, connector); drm_modeset_unlock_all(drm->dev);Hi,
the patch looks OK to me, yet as noted in IRC, i'd like to have this patch split into two and have the ->fbcon check as a precondition to the 3D Controller part. But lets see what the other and more clever people think about it! :)
Greetings,
Tobias
Ping,
adding Ben Skeggs and Dave Airlied to CC, maybe this will get this little one commited!
Greetings,
Tobias
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Quoted 5 lines · Tobias Klausmann
Quoted 3 lines · Josef Larsson
Sure, I can easily split it into two commits, but I would like to have an OK on the actual code changes before splitting the patch.
I'm not actually sure this is a good idea still. As I recall, part of the purpose of that check is to prevent nouveau taking over as the primary fbcon when it's the secondary display in the system. ie. Optimus system with Intel driving the display, NVIDIA GPU has no displays attached. If nouveau loads first, at some point in history, you'd have ended up with a blank console.
I'm not sure if this is still the case, but it warrants checking before making this change.
I'm more interested in what this actually solves, and why not having fbcon prevents external displays from being used.
Ben.
Quoted 98 lines
Quoted 89 lines
Best regards,
Josef Larsson
Quoted 81 lines · Tobias Klausmann
Quoted 58 lines · Josef Larsson
Accept 3d controllers and not only VGA controllers. According to Ilia Mirkin,
the VGA controller check should be removed. This makes it possible to use external connectors on a docking station (40A5) for a Thinkpad P51.
(See Bug 101778).lspci example:
01:00.0 3D controller: NVIDIA Corporation GM107GLM [Quadro M1200 Mobile] (rev a2)
Also include safe-guards to avoid NULL dereferencing of fbcon, which is how this bug was found.
--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/nouveau/nv50_display.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-)drivers/gpu/drm/nouveau/nouveau_fbcon.c +1
-1@@ -498,8 +498,7 @@ nouveau_fbcon_init(struct drm_device *dev)int preferred_bpp;int ret; - if (!dev->mode_config.num_crtc || - (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) + if (!dev->mode_config.num_crtc) return 0; fbcon = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL);drivers/gpu/drm/nouveau/nv50_display.c +6
-0@@ -3214,6 +3214,13 @@ nv50_mstm_destroy_connector(structdrm_dp_mst_topology_mgr *mgr, struct nouveau_drm *drm = nouveau_drm(connector->dev);struct nv50_mstc *mstc =nv50_mstc (connector); + if (!drm->fbcon) + { +NV_WARN (drm,"drm->fbcon of %s point to NULL. Will not destroy connector\n", + connector->name); +return ; + } +drm_connector_unregister (&mstc->connector);drm_modeset_lock_all (drm->dev);@@ -3229,6 +3236,12 @@ nv50_mstm_register_connector(struct drm_connector *connector) {struct nouveau_drm *drm =nouveau_drm (connector->dev);drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct drm_connector
Quoted 10 lines
drivers/gpu/drm/nouveau/nv50_display.c +5
-0+ if (!drm->fbcon) + { +NV_WARN (drm,"drm->fbcon of %s point to NULL. Will not register connector\n", + connector->name); +return ; + }drm_modeset_lock_all (drm->dev);drm_fb_helper_add_one_connector (&drm->fbcon->helper, connector);drm_modeset_unlock_all (drm->dev);Hi,
the patch looks OK to me, yet as noted in IRC, i'd like to have this patch split into two and have the ->fbcon check as a precondition to the 3D Controller part. But lets see what the other and more clever people think about it! :)
Greetings,
Tobias
Ping,
adding Ben Skeggs and Dave Airlied to CC, maybe this will get this little one commited!
Greetings,
Quoted 7 lines
Tobias
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Quoted 15 lines · Ben Skeggs
Quoted 4 lines · Tobias Klausmann
Quoted 2 lines · Josef Larsson
Sure, I can easily split it into two commits, but I would like to
have
Quoted 1 line
Quoted 1 line
an OK on the actual code changes before splitting the patch.
I'm not actually sure this is a good idea still. As I recall, part of the purpose of that check is to prevent nouveau taking over as the primary fbcon when it's the secondary display in the system. ie. Optimus system with Intel driving the display, NVIDIA GPU has no displays attached. If nouveau loads first, at some point in history, you'd have ended up with a blank console.
Quoted 8 lines
I'm not sure if this is still the case, but it warrants checking before making this change.
I'm more interested in what this actually solves, and why not having fbcon prevents external displays from being used.
Ben.
I think the issue is we can't really put any trust in this. my kepler GPU on my laptop is a VGA device, not a 3D accelerator, even though everything is wird to intel, it is a MXM card though, so in theory it is able to drive displays.
We need something else to detect if the GPU is the main one or not.
Quoted 113 lines
Quoted 11 lines
Quoted 11 lines
Best regards,
Josef Larsson
Quoted 4 lines · Tobias Klausmann
Quoted 2 lines · Josef Larsson
Accept 3d controllers and not only VGA controllers. According to
Ilia
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Mirkin,
the VGA controller check should be removed. This makes it possible to use external connectors on a docking station (40A5) for aThinkpad
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
P51.
(See Bug 101778).lspci example:
01:00.0 3D controller: NVIDIA Corporation GM107GLM [Quadro M1200
Mobile]
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(rev a2)
Also include safe-guards to avoid NULL dereferencing of fbcon,
which is
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
how this bug was found.
--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/nouveau/nv50_display.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-)Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c +0
-0Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c nouveau_fbcon_init(struct drm_device *dev) · line 503
Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c +1
-1@@ -498,8 +498,7 @@ nouveau_fbcon_init(struct drm_device *dev)int preferred_bpp;int ret; - if (!dev->mode_config.num_crtc || - (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) + if (!dev->mode_config.num_crtc) return 0; fbcon = kzalloc(sizeof(struct nouveau_fbdev),
GFP_KERNEL);Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/nouveau/nv50_display.c +0
-1--- a/drivers/gpu/drm/nouveau/nv50_display.cQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_destroy_connector(struct · line 3219
Quoted 8 lines
+++
b/drivers/gpu/drm/nouveau/nv50_display.cdrivers/gpu/drm/nouveau/nv50_display.c +2
-0@@ -3214,6 +3214,13 @@ nv50_mstm_destroy_connector(structdrm_dp_mst_topology_mgr *mgr, struct nouveau_drm *drm = nouveau_drm(connector->dev);struct nv50_mstc *mstc =nv50_mstc (connector); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will notdestroy
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c +4
-0connector\n", + connector->name); +return ; + } +drm_connector_unregister (&mstc->connector);drm_modeset_lock_all (drm->dev);@@ -3229,6 +3236,12 @@ nv50_mstm_register_connector(struct
drm_connectorQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct · line 3241
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c +2
-0*connector) {struct nouveau_drm *drm =nouveau_drm (connector->dev); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will notregister
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c +3
-0connector\n", + connector->name); +return ; + }drm_modeset_lock_all (drm->dev); drm_fb_helper_add_one_connector(&drm->fbcon->helper,connector);
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
drm_modeset_unlock_all(drm->dev);Hi,
the patch looks OK to me, yet as noted in IRC, i'd like to have
this
Quoted 1 line
Quoted 1 line
Quoted 1 line
patch split into two and have the ->fbcon check as a precondition
to
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
the 3D Controller part. But lets see what the other and more clever people think about it! :)
Greetings,
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Tobias
Ping,
adding Ben Skeggs and Dave Airlied to CC, maybe this will get this
little
Quoted 8 lines
one commited!
Greetings,
Tobias
Quoted 8 lines
Quoted 4 lines
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Without a NULL pointer safe-guard patch, I get a kernel oops when I plug in external displays in my docking station, (exactly the same issue as
https://bugs.freedesktop.org/show_bug.cgi?id=101778) and without removing or modifying the check (accepting PCI_CLASS_DISPLAY_3D in the if-condition), I cannot use external displays through my docking station. This is on an optimus system where I use reverse PRIME to be able to use the connectors at all. Having some kind of safe-guard makes sense to me, and that is available in the i915-driver of the corresponding functions.
If there are better patches to fix my two problems, I am willing to try them out, because I really think this should be handled somehow.
One note though: These patches do not make the docking station experience perfect. They only make it not quite as bad. For example, undocking when using external displays forces Xorg to restart, and when docking without a patch for xf86-video-nouveau DDX by Ilia Mirkin
(https://people.freedesktop.org/~imirkin/patches/0001-drmmode-update-logic-for-dynamic-connectors-paths-an.patch),
the external docking station displays are not detected.
Quoted 18 lines · Karol Herbst
Quoted 16 lines · Ben Skeggs
Quoted 2 lines · Tobias Klausmann
Quoted 1 line · Josef Larsson
Sure, I can easily split it into two commits, but I would like to
have
Quoted 1 line
Quoted 1 line
an OK on the actual code changes before splitting the patch.
I'm not actually sure this is a good idea still. As I recall, part of the purpose of that check is to prevent nouveau taking over as the primary fbcon when it's the secondary display in the system. ie. Optimus system with Intel driving the display, NVIDIA GPU has no displays attached. If nouveau loads first, at some point in history, you'd have ended up with a blank console.
I'm not sure if this is still the case, but it warrants checking before making this change.
Quoted 125 lines
Quoted 5 lines
I'm more interested in what this actually solves, and why not having fbcon prevents external displays from being used.
Ben.
I think the issue is we can't really put any trust in this. my kepler GPU on my laptop is a VGA device, not a 3D accelerator, even though everything is wird to intel, it is a MXM card though, so in theory it is able to drive displays.
We need something else to detect if the GPU is the main one or not.
Quoted 116 lines
Quoted 8 lines
Quoted 8 lines
Best regards,
Josef Larsson
Quoted 2 lines · Tobias Klausmann
Quoted 1 line · Josef Larsson
Accept 3d controllers and not only VGA controllers. According to
Ilia
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Mirkin,
the VGA controller check should be removed. This makes it possible to use external connectors on a docking station (40A5) for aThinkpad
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
P51.
(See Bug 101778).lspci example:
01:00.0 3D controller: NVIDIA Corporation GM107GLM [Quadro M1200
Mobile]
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(rev a2)
Also include safe-guards to avoid NULL dereferencing of fbcon,
which is
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
how this bug was found.
--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/nouveau/nv50_display.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-)Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c +0
-0Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c nouveau_fbcon_init(struct drm_device *dev) · line 503
Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c +1
-1@@ -498,8 +498,7 @@ nouveau_fbcon_init(struct drm_device *dev)int preferred_bpp;int ret; - if (!dev->mode_config.num_crtc || - (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) + if (!dev->mode_config.num_crtc) return 0; fbcon = kzalloc(sizeof(struct nouveau_fbdev),
GFP_KERNEL);Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/nouveau/nv50_display.c +0
-1--- a/drivers/gpu/drm/nouveau/nv50_display.cQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_destroy_connector(struct · line 3219
Quoted 8 lines
+++
b/drivers/gpu/drm/nouveau/nv50_display.cdrivers/gpu/drm/nouveau/nv50_display.c +2
-0@@ -3214,6 +3214,13 @@ nv50_mstm_destroy_connector(structdrm_dp_mst_topology_mgr *mgr, struct nouveau_drm *drm = nouveau_drm(connector->dev);struct nv50_mstc *mstc =nv50_mstc (connector); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will notdestroy
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c +4
-0connector\n", + connector->name); +return ; + } +drm_connector_unregister (&mstc->connector);drm_modeset_lock_all (drm->dev);@@ -3229,6 +3236,12 @@ nv50_mstm_register_connector(struct
drm_connectorQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct · line 3241
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c +2
-0*connector) {struct nouveau_drm *drm =nouveau_drm (connector->dev); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will notregister
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c +3
-0connector\n", + connector->name); +return ; + }drm_modeset_lock_all (drm->dev); drm_fb_helper_add_one_connector(&drm->fbcon->helper,connector);
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
drm_modeset_unlock_all(drm->dev);Hi,
the patch looks OK to me, yet as noted in IRC, i'd like to have
this
Quoted 1 line
Quoted 1 line
Quoted 1 line
patch split into two and have the ->fbcon check as a precondition
to
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
the 3D Controller part. But lets see what the other and more clever people think about it! :)
Greetings,
Tobias
Ping,
adding Ben Skeggs and Dave Airlied to CC, maybe this will get this
little
Quoted 5 lines
one commited!
Greetings,
Quoted 7 lines
Tobias
_______________________________________________
Nouveau mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau_______________________________________________
Nouveau mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
I've discussed it with Ben and we actually found a better solution. There are just some calls inside those functions which should get NULL checks, nv50_mstm_register_connector and nv50_mstm_destroy_connector. Or at least something similiar so that the code doesn't depent on the fbcon object being there.
Quoted 168 lines · Josef Larsson
Without a NULL pointer safe-guard patch, I get a kernel oops when I plug in external displays in my docking station, (exactly the same issue as
https://bugs.freedesktop.org/show_bug.cgi?id=101778) and without removing or modifying the check (acceptingPCI_CLASS_DISPLAY_3Din the if-condition), I cannot use external displays through my docking station. This is on an optimus system where I use reverse PRIME to be able to use the connectors at all. Having some kind of safe-guard makes sense to me, and that is available in the i915-driver of the corresponding functions.If there are better patches to fix my two problems, I am willing to try them out, because I really think this should be handled somehow.
One note though: These patches do not make the docking station experience perfect. They only make it not quite as bad. For example, undocking when using external displays forces Xorg to restart, and when docking without a patch for xf86-video-nouveau DDX by Ilia Mirkin
(https://people.freedesktop.org/~imirkin/patches/0001-drmmode-update-logic-for-dynamic-connectors-paths-an.patch),
the external docking station displays are not detected.Quoted 18 lines · Karol Herbst
Quoted 16 lines · Ben Skeggs
Quoted 2 lines · Tobias Klausmann
Quoted 1 line · Josef Larsson
Sure, I can easily split it into two commits, but I would like to
have
Quoted 1 line
Quoted 1 line
an OK on the actual code changes before splitting the patch.
I'm not actually sure this is a good idea still. As I recall, part of the purpose of that check is to prevent nouveau taking over as the primary fbcon when it's the secondary display in the system. ie. Optimus system with Intel driving the display, NVIDIA GPU has no displays attached. If nouveau loads first, at some point in history, you'd have ended up with a blank console.
I'm not sure if this is still the case, but it warrants checking before making this change.
Quoted 125 lines
Quoted 5 lines
I'm more interested in what this actually solves, and why not having fbcon prevents external displays from being used.
Ben.
I think the issue is we can't really put any trust in this. my kepler GPU on my laptop is a VGA device, not a 3D accelerator, even though everything is wird to intel, it is a MXM card though, so in theory it is able to drive displays.
We need something else to detect if the GPU is the main one or not.
Quoted 116 lines
Quoted 8 lines
Quoted 8 lines
Best regards,
Josef Larsson
Quoted 2 lines · Tobias Klausmann
Quoted 1 line · Josef Larsson
Accept 3d controllers and not only VGA controllers. According to
Ilia
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Mirkin,
the VGA controller check should be removed. This makes it possible to use external connectors on a docking station (40A5) for aThinkpad
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
P51.
(See Bug 101778).lspci example:
01:00.0 3D controller: NVIDIA Corporation GM107GLM [Quadro M1200
Mobile]
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(rev a2)
Also include safe-guards to avoid NULL dereferencing of fbcon,
which is
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
how this bug was found.
--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/nouveau/nv50_display.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-)Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c +0
-0Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c nouveau_fbcon_init(struct drm_device *dev) · line 503
Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c +1
-1@@ -498,8 +498,7 @@ nouveau_fbcon_init(struct drm_device *dev)int preferred_bpp;int ret; - if (!dev->mode_config.num_crtc || - (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) + if (!dev->mode_config.num_crtc) return 0; fbcon = kzalloc(sizeof(struct nouveau_fbdev),
GFP_KERNEL);Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/nouveau/nv50_display.c +0
-1--- a/drivers/gpu/drm/nouveau/nv50_display.cQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_destroy_connector(struct · line 3219
Quoted 8 lines
+++
b/drivers/gpu/drm/nouveau/nv50_display.cdrivers/gpu/drm/nouveau/nv50_display.c +2
-0@@ -3214,6 +3214,13 @@ nv50_mstm_destroy_connector(structdrm_dp_mst_topology_mgr *mgr, struct nouveau_drm *drm = nouveau_drm(connector->dev);struct nv50_mstc *mstc =nv50_mstc (connector); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will notdestroy
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c +4
-0connector\n", + connector->name); +return ; + } +drm_connector_unregister (&mstc->connector);drm_modeset_lock_all (drm->dev);@@ -3229,6 +3236,12 @@ nv50_mstm_register_connector(struct
drm_connectorQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct · line 3241
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c +2
-0*connector) {struct nouveau_drm *drm =nouveau_drm (connector->dev); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will notregister
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c +3
-0connector\n", + connector->name); +return ; + }drm_modeset_lock_all (drm->dev); drm_fb_helper_add_one_connector(&drm->fbcon->helper,connector);
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
drm_modeset_unlock_all(drm->dev);Hi,
the patch looks OK to me, yet as noted in IRC, i'd like to have
this
Quoted 1 line
Quoted 1 line
Quoted 1 line
patch split into two and have the ->fbcon check as a precondition
to
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
the 3D Controller part. But lets see what the other and more clever people think about it! :)
Greetings,
Tobias
Ping,
adding Ben Skeggs and Dave Airlied to CC, maybe this will get this
little
Quoted 5 lines
one commited!
Greetings,
Quoted 7 lines
Tobias
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Quoted 5 lines
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Sounds good to me, if we remove or modify the PCI_CLASS check in nouveau_fbcon.c as well :).
Quoted 6 lines · Karol Herbst
I've discussed it with Ben and we actually found a better solution. There are just some calls inside those functions which should get NULL checks,
nv50_mstm_register_connectorandnv50_mstm_destroy_connector. Or at least something similiar so that the code doesn't depent on the fbcon object being there.
Quoted 172 lines
Quoted 171 lines · Josef Larsson
Without a NULL pointer safe-guard patch, I get a kernel oops when I plug in external displays in my docking station, (exactly the same issue as
https://bugs.freedesktop.org/show_bug.cgi?id=101778) and without removing or modifying the check (acceptingPCI_CLASS_DISPLAY_3Din the if-condition), I cannot use external displays through my docking station. This is on an optimus system where I use reverse PRIME to be able to use the connectors at all. Having some kind of safe-guard makes sense to me, and that is available in the i915-driver of the corresponding functions.If there are better patches to fix my two problems, I am willing to try them out, because I really think this should be handled somehow.
One note though: These patches do not make the docking station experience perfect. They only make it not quite as bad. For example, undocking when using external displays forces Xorg to restart, and when docking without a patch for xf86-video-nouveau DDX by Ilia Mirkin
(https://people.freedesktop.org/~imirkin/patches/0001-drmmode-update-logic-for-dynamic-connectors-paths-an.patch),
the external docking station displays are not detected.Quoted 17 lines · Karol Herbst
Quoted 16 lines · Ben Skeggs
Quoted 2 lines · Tobias Klausmann
Quoted 1 line · Josef Larsson
Sure, I can easily split it into two commits, but I would like to
have
Quoted 1 line
Quoted 1 line
an OK on the actual code changes before splitting the patch.
I'm not actually sure this is a good idea still. As I recall, part of the purpose of that check is to prevent nouveau taking over as the primary fbcon when it's the secondary display in the system. ie. Optimus system with Intel driving the display, NVIDIA GPU has no displays attached. If nouveau loads first, at some point in history, you'd have ended up with a blank console.
I'm not sure if this is still the case, but it warrants checking before making this change.
Quoted 125 lines
Quoted 5 lines
I'm more interested in what this actually solves, and why not having fbcon prevents external displays from being used.
Ben.
I think the issue is we can't really put any trust in this. my kepler GPU on my laptop is a VGA device, not a 3D accelerator, even though everything is wird to intel, it is a MXM card though, so in theory it is able to drive displays.
We need something else to detect if the GPU is the main one or not.
Quoted 116 lines
Quoted 8 lines
Quoted 8 lines
Best regards,
Josef Larsson
Quoted 2 lines · Tobias Klausmann
Quoted 1 line · Josef Larsson
Accept 3d controllers and not only VGA controllers. According to
Ilia
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Mirkin,
the VGA controller check should be removed. This makes it possible to use external connectors on a docking station (40A5) for aThinkpad
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
P51.
(See Bug 101778).lspci example:
01:00.0 3D controller: NVIDIA Corporation GM107GLM [Quadro M1200
Mobile]
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(rev a2)
Also include safe-guards to avoid NULL dereferencing of fbcon,
which is
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
how this bug was found.
--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/nouveau/nv50_display.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-)Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c +0
-0Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c nouveau_fbcon_init(struct drm_device *dev) · line 503
Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_fbcon.c +1
-1@@ -498,8 +498,7 @@ nouveau_fbcon_init(struct drm_device *dev)int preferred_bpp;int ret; - if (!dev->mode_config.num_crtc || - (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) + if (!dev->mode_config.num_crtc) return 0; fbcon = kzalloc(sizeof(struct nouveau_fbdev),
GFP_KERNEL);Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/nouveau/nv50_display.c +0
-1--- a/drivers/gpu/drm/nouveau/nv50_display.cQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_destroy_connector(struct · line 3219
Quoted 8 lines
+++
b/drivers/gpu/drm/nouveau/nv50_display.cdrivers/gpu/drm/nouveau/nv50_display.c +2
-0@@ -3214,6 +3214,13 @@ nv50_mstm_destroy_connector(structdrm_dp_mst_topology_mgr *mgr, struct nouveau_drm *drm = nouveau_drm(connector->dev);struct nv50_mstc *mstc =nv50_mstc (connector); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will notdestroy
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_display.c +4
-0connector\n", + connector->name); +return ; + } +drm_connector_unregister (&mstc->connector);drm_modeset_lock_all (drm->dev);@@ -3229,6 +3236,12 @@ nv50_mstm_register_connector(struct
drm_connectorQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct · line 3241
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c +2
-0*connector) {struct nouveau_drm *drm =nouveau_drm (connector->dev); + if (!drm->fbcon) + { + NV_WARN(drm, "drm->fbcon of %s point to NULL. Will notregister
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c nv50_mstm_register_connector(struct
Quoted 6 lines
drivers/gpu/drm/nouveau/nv50_display.c +3
-0connector\n", + connector->name); +return ; + }drm_modeset_lock_all (drm->dev); drm_fb_helper_add_one_connector(&drm->fbcon->helper,connector);
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
drm_modeset_unlock_all(drm->dev);Hi,
the patch looks OK to me, yet as noted in IRC, i'd like to have
this
Quoted 1 line
Quoted 1 line
Quoted 1 line
patch split into two and have the ->fbcon check as a precondition
to
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
the 3D Controller part. But lets see what the other and more clever people think about it! :)
Greetings,
Tobias
Ping,
adding Ben Skeggs and Dave Airlied to CC, maybe this will get this
little
Quoted 5 lines
one commited!
Greetings,
Quoted 7 lines
Tobias
_______________________________________________
Nouveau mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau_______________________________________________
Nouveau mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau_______________________________________________
Nouveau mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau