Skip to contentSkip to conversation

novueau: Preliminary support for switchable graphics

PATCH New Matthew Garrett 1 participant 1 message Sep 4, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 novueau: Preliminary support for switchable graphics

Some recent laptops have switchable graphics, providing a discrete nvidia gpu and either an integrated Intel gpu or a lower-powered nvidia gpu. An ACPI interface is provided for controlling these devices. BIOSes will often leave both gpus running, wasting power. This initial support simply turns off whichever gpu is currently inactive. In future it will be extended to allow for runtime switching of gpu.

---
 drivers/gpu/drm/nouveau/Makefile        |    1 +
 drivers/gpu/drm/nouveau/nouveau_acpi.c  |  127 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/nouveau/nouveau_drv.h   |   16 ++++
 drivers/gpu/drm/nouveau/nouveau_state.c |    5 +
 4 files changed, 149 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpu/drm/nouveau/nouveau_acpi.c
drivers/gpu/drm/nouveau/Makefile +1 -0
index 5a46cdd..a4e8223 100644
@@ -23,5 +23,6 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \
 
 nouveau-$(CONFIG_COMPAT) += nouveau_ioc32.o
 nouveau-$(CONFIG_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o
+nouveau-$(CONFIG_ACPI) += nouveau_acpi.o
 
 obj-$(CONFIG_DRM_NOUVEAU)+= nouveau.o
drivers/gpu/drm/nouveau/nouveau_acpi.c new file +127 -0

127 lines not on this page · raw message

drivers/gpu/drm/nouveau/nouveau_drv.h +16 -0
index 4a1efa1..f26d6ff 100644
@@ -565,6 +565,7 @@ struct drm_nouveau_private {
 	} susres;
 
 	struct backlight_device *backlight;
+	bool acpi_dsm;
 
 	struct nouveau_channel *evo;
 };
@@ -748,6 +749,21 @@ extern struct ttm_backend *nouveau_sgdma_init_ttm(struct drm_device *);
 extern int  nouveau_dma_init(struct nouveau_channel *);
 extern int  nouveau_dma_wait(struct nouveau_channel *, int size);
 
+/* nouveau_acpi.c */
+#ifdef CONFIG_ACPI
+extern int nouveau_hybrid_setup(struct drm_device *dev);
+extern bool nouveau_dsm_probe(struct drm_device *dev);
+#else
+static inline int nouveau_hybrid_setup(struct drm_device *dev)
+{
+	return 0;
+}
+static inline bool nouveau_dsm_probe(struct drm_device *dev)
+{
+	return false;
+}
+#endif
+
 /* nouveau_backlight.c */
 #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
 extern int nouveau_backlight_init(struct drm_device *);
drivers/gpu/drm/nouveau/nouveau_state.c +5 -0
index 9abc7c8..4d91887 100644
@@ -497,6 +497,11 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
 	NV_DEBUG(dev, "vendor: 0x%X device: 0x%X class: 0x%X\n",
 		 dev->pci_vendor, dev->pci_device, dev->pdev->class);
 
+	dev_priv->acpi_dsm = nouveau_dsm_probe(dev);
+
+	if (dev_priv->acpi_dsm)
+		nouveau_hybrid_setup(dev);
+
 	/* resource 0 is mmio regs */
 	/* resource 1 is linear FB */
 	/* resource 2 is RAMIN (mmio regs + 0x1000000) */
Signature · 1 line
1.6.4.1