Emil Velikov
2013-Oct-09 07:25 UTC
[Nouveau] [PATCH] drm/nouveau: consider CLASS_DISPLAY_3D devices while detecting dsm/optimus
The present code assumes that optimus is present whenever two VGA (PCI_CLASS_DISPLAY_VGA) devices are present. This does not seem to be the case of newer laptops with optimus, in which case the nvidia gpu is a PCI_CLASS_DISPLAY_3D device. Rework the logic so that we count both VGA and 3D devices, when contemplating if optimus is present on the platform. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70208 Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com> --- Ideally we would not need to iterate though the pci devices twice. Although currently we have to do that as there is no function that can takes a mask for the class(s) we're looking for. Additionally the base function pci_get_dev_by_id() from drivers/pci is not accessible (not exported), thus we cannot easily make a function that does that for us. Cheers Emil --- drivers/gpu/drm/nouveau/nouveau_acpi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index d97f200..646d4e3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c @@ -289,6 +289,16 @@ static bool nouveau_dsm_detect(void) has_optimus = 1; } + while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_3D << 8, pdev)) != NULL) { + vga_count++; + + retval = nouveau_dsm_pci_probe(pdev); + if (retval & NOUVEAU_DSM_HAS_MUX) + has_dsm |= 1; + if (retval & NOUVEAU_DSM_HAS_OPT) + has_optimus = 1; + } + /* find the optimus DSM or the old v1 DSM */ if (has_optimus == 1) { acpi_get_name(nouveau_dsm_priv.dhandle, ACPI_FULL_PATHNAME, -- 1.8.4
Possibly Parallel Threads
- [PATCH v2 1/4] drm/nouveau/acpi: ensure matching ACPI handle and supported functions
- [PATCH v3 1/4] drm/nouveau/acpi: ensure matching ACPI handle and supported functions
- [PATCH] drm/nouveau: check function before using it
- [PATCH RFC] nouveau: Add support for Gmux _DSM method
- [PATCH v2 1/9] acpi: Rename v1 DSM to mux to avoid ambiguity