rpms/kernel/devel drm-nouveau.patch, 1.52, 1.53 kernel.spec, 1.1793, 1.1794

Ben Skeggs bskeggs at fedoraproject.org
Fri Sep 11 07:05:09 UTC 2009


Author: bskeggs

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv31146

Modified Files:
	drm-nouveau.patch kernel.spec 
Log Message:
* Fri Sep 11 2009 Ben Skeggs <bskeggs at redhat.com>
- nouveau: bring in Matthew Garret's initial switchable graphics support



drm-nouveau.patch:
 drivers/gpu/drm/Kconfig                     |   45 
 drivers/gpu/drm/Makefile                    |    2 
 drivers/gpu/drm/drm_bufs.c                  |   28 
 drivers/gpu/drm/i2c/Makefile                |    4 
 drivers/gpu/drm/i2c/ch7006_drv.c            |  532 
 drivers/gpu/drm/i2c/ch7006_mode.c           |  473 
 drivers/gpu/drm/i2c/ch7006_priv.h           |  340 
 drivers/gpu/drm/nouveau/Makefile            |   28 
 drivers/gpu/drm/nouveau/nouveau_acpi.c      |  127 
 drivers/gpu/drm/nouveau/nouveau_backlight.c |  155 
 drivers/gpu/drm/nouveau/nouveau_bios.c      | 5209 ++++++
 drivers/gpu/drm/nouveau/nouveau_bios.h      |  235 
 drivers/gpu/drm/nouveau/nouveau_bo.c        |  622 
 drivers/gpu/drm/nouveau/nouveau_calc.c      |  626 
 drivers/gpu/drm/nouveau/nouveau_channel.c   |  520 
 drivers/gpu/drm/nouveau/nouveau_connector.c |  748 
 drivers/gpu/drm/nouveau/nouveau_connector.h |   55 
 drivers/gpu/drm/nouveau/nouveau_crtc.h      |   95 
 drivers/gpu/drm/nouveau/nouveau_display.c   |  115 
 drivers/gpu/drm/nouveau/nouveau_dma.c       |  206 
 drivers/gpu/drm/nouveau/nouveau_dma.h       |  148 
 drivers/gpu/drm/nouveau/nouveau_drv.c       |  433 
 drivers/gpu/drm/nouveau/nouveau_drv.h       | 1218 +
 drivers/gpu/drm/nouveau/nouveau_encoder.h   |   66 
 drivers/gpu/drm/nouveau/nouveau_fb.h        |   47 
 drivers/gpu/drm/nouveau/nouveau_fbcon.c     |  355 
 drivers/gpu/drm/nouveau/nouveau_fbcon.h     |   48 
 drivers/gpu/drm/nouveau/nouveau_fence.c     |  261 
 drivers/gpu/drm/nouveau/nouveau_gem.c       |  954 +
 drivers/gpu/drm/nouveau/nouveau_hw.c        | 1077 +
 drivers/gpu/drm/nouveau/nouveau_hw.h        |  446 
 drivers/gpu/drm/nouveau/nouveau_i2c.c       |  256 
 drivers/gpu/drm/nouveau/nouveau_i2c.h       |   45 
 drivers/gpu/drm/nouveau/nouveau_ioc32.c     |   72 
 drivers/gpu/drm/nouveau/nouveau_irq.c       |  675 
 drivers/gpu/drm/nouveau/nouveau_mem.c       |  565 
 drivers/gpu/drm/nouveau/nouveau_notifier.c  |  194 
 drivers/gpu/drm/nouveau/nouveau_object.c    | 1279 +
 drivers/gpu/drm/nouveau/nouveau_reg.h       |  834 +
 drivers/gpu/drm/nouveau/nouveau_sgdma.c     |  317 
 drivers/gpu/drm/nouveau/nouveau_state.c     |  834 +
 drivers/gpu/drm/nouveau/nouveau_swmthd.h    |   33 
 drivers/gpu/drm/nouveau/nouveau_ttm.c       |  131 
 drivers/gpu/drm/nouveau/nv04_crtc.c         | 1014 +
 drivers/gpu/drm/nouveau/nv04_cursor.c       |   70 
 drivers/gpu/drm/nouveau/nv04_dac.c          |  525 
 drivers/gpu/drm/nouveau/nv04_dfp.c          |  621 
 drivers/gpu/drm/nouveau/nv04_display.c      |  293 
 drivers/gpu/drm/nouveau/nv04_fb.c           |   21 
 drivers/gpu/drm/nouveau/nv04_fbcon.c        |  292 
 drivers/gpu/drm/nouveau/nv04_fifo.c         |  295 
 drivers/gpu/drm/nouveau/nv04_graph.c        |  583 
 drivers/gpu/drm/nouveau/nv04_instmem.c      |  207 
 drivers/gpu/drm/nouveau/nv04_mc.c           |   20 
 drivers/gpu/drm/nouveau/nv04_timer.c        |   51 
 drivers/gpu/drm/nouveau/nv04_tv.c           |  304 
 drivers/gpu/drm/nouveau/nv10_fb.c           |   24 
 drivers/gpu/drm/nouveau/nv10_fifo.c         |  177 
 drivers/gpu/drm/nouveau/nv10_graph.c        |  945 +
 drivers/gpu/drm/nouveau/nv17_tv.c           |  660 
 drivers/gpu/drm/nouveau/nv17_tv.h           |  156 
 drivers/gpu/drm/nouveau/nv17_tv_modes.c     |  582 
 drivers/gpu/drm/nouveau/nv20_graph.c        |  784 
 drivers/gpu/drm/nouveau/nv40_fb.c           |   62 
 drivers/gpu/drm/nouveau/nv40_fifo.c         |  223 
 drivers/gpu/drm/nouveau/nv40_graph.c        | 2203 ++
 drivers/gpu/drm/nouveau/nv40_mc.c           |   38 
 drivers/gpu/drm/nouveau/nv50_crtc.c         |  799 +
 drivers/gpu/drm/nouveau/nv50_cursor.c       |  151 
 drivers/gpu/drm/nouveau/nv50_dac.c          |  296 
 drivers/gpu/drm/nouveau/nv50_display.c      |  905 +
 drivers/gpu/drm/nouveau/nv50_display.h      |   46 
 drivers/gpu/drm/nouveau/nv50_evo.h          |  113 
 drivers/gpu/drm/nouveau/nv50_fbcon.c        |  256 
 drivers/gpu/drm/nouveau/nv50_fifo.c         |  475 
 drivers/gpu/drm/nouveau/nv50_graph.c        |  443 
 drivers/gpu/drm/nouveau/nv50_grctx.h        |22284 ++++++++++++++++++++++++++++
 drivers/gpu/drm/nouveau/nv50_instmem.c      |  499 
 drivers/gpu/drm/nouveau/nv50_mc.c           |   40 
 drivers/gpu/drm/nouveau/nv50_sor.c          |  250 
 drivers/gpu/drm/nouveau/nvreg.h             |  535 
 drivers/gpu/drm/ttm/ttm_bo.c                |    4 
 include/drm/Kbuild                          |    1 
 include/drm/drmP.h                          |    2 
 include/drm/i2c/ch7006.h                    |   86 
 include/drm/nouveau_drm.h                   |  216 
 86 files changed, 57983 insertions(+), 21 deletions(-)

Index: drm-nouveau.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/drm-nouveau.patch,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -p -r1.52 -r1.53
--- drm-nouveau.patch	11 Sep 2009 01:34:12 -0000	1.52
+++ drm-nouveau.patch	11 Sep 2009 07:05:05 -0000	1.53
@@ -1494,10 +1494,10 @@ index 0000000..576bbea
 +#endif
 diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile
 new file mode 100644
-index 0000000..5a46cdd
+index 0000000..a4e8223
 --- /dev/null
 +++ b/drivers/gpu/drm/nouveau/Makefile
-@@ -0,0 +1,27 @@
+@@ -0,0 +1,28 @@
 +#
 +# Makefile for the drm device driver.  This driver provides support for the
 +# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
@@ -1523,8 +1523,142 @@ index 0000000..5a46cdd
 +
 +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
+diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
+new file mode 100644
+index 0000000..49514c6
+--- /dev/null
++++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
+@@ -0,0 +1,127 @@
++#include <linux/pci.h>
++#include <linux/acpi.h>
++#include <acpi/acpi_drivers.h>
++#include <acpi/acpi_bus.h>
++
++#include "drmP.h"
++#include "drm.h"
++#include "drm_sarea.h"
++#include "drm_crtc_helper.h"
++#include "nouveau_drv.h"
++#include "nouveau_drm.h"
++#include "nv50_display.h"
++
++#define NOUVEAU_DSM_SUPPORTED 0x00
++#define NOUVEAU_DSM_SUPPORTED_FUNCTIONS 0x00
++
++#define NOUVEAU_DSM_ACTIVE 0x01
++#define NOUVEAU_DSM_ACTIVE_QUERY 0x00
++
++#define NOUVEAU_DSM_LED 0x02
++#define NOUVEAU_DSM_LED_STATE 0x00
++#define NOUVEAU_DSM_LED_OFF 0x10
++#define NOUVEAU_DSM_LED_STAMINA 0x11
++#define NOUVEAU_DSM_LED_SPEED 0x12
++
++#define NOUVEAU_DSM_POWER 0x03
++#define NOUVEAU_DSM_POWER_STATE 0x00
++#define NOUVEAU_DSM_POWER_SPEED 0x01
++#define NOUVEAU_DSM_POWER_STAMINA 0x02
++
++static int nvidia_dsm(struct pci_dev *dev, int func, int arg, int *result)
++{
++	static char muid[] = {
++		0xA0, 0xA0, 0x95, 0x9D, 0x60, 0x00, 0x48, 0x4D,
++		0xB3, 0x4D, 0x7E, 0x5F, 0xEA, 0x12, 0x9F, 0xD4,
++	};
++
++	struct acpi_handle *handle;
++	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
++	struct acpi_object_list input;
++	union acpi_object params[4];
++	union acpi_object *obj;
++	int err;
++
++	handle = DEVICE_ACPI_HANDLE(&dev->dev);
++
++	if (!handle)
++		return -ENODEV;
++
++	input.count = 4;
++	input.pointer = params;
++	params[0].type = ACPI_TYPE_BUFFER;
++	params[0].buffer.length = sizeof(muid);
++	params[0].buffer.pointer = (char *)muid;
++	params[1].type = ACPI_TYPE_INTEGER;
++	params[1].integer.value = 0x00000102;
++	params[2].type = ACPI_TYPE_INTEGER;
++	params[2].integer.value = func;
++	params[3].type = ACPI_TYPE_INTEGER;
++	params[3].integer.value = arg;
++
++	err = acpi_evaluate_object(handle, "_DSM", &input, &output);
++	if (err) {
++		printk(KERN_ERR "nvidia-control: failed to evaluate _DSM: %d\n",
++		       err);
++		return err;
++	}
++
++	obj = (union acpi_object *)output.pointer;
++
++	if (obj->type == ACPI_TYPE_INTEGER)
++		if (obj->integer.value == 0x80000002)
++			return -ENODEV;
++
++	if (obj->type == ACPI_TYPE_BUFFER) {
++		if (obj->buffer.length == 4 && result) {
++			*result = 0;
++			*result |= obj->buffer.pointer[0];
++			*result |= (obj->buffer.pointer[1] << 8);
++			*result |= (obj->buffer.pointer[2] << 16);
++			*result |= (obj->buffer.pointer[3] << 24);
++		}
++	}
++
++	kfree(output.pointer);
++	return 0;
++}
++
++int nouveau_hybrid_setup(struct drm_device *dev)
++{
++	struct pci_dev *pdev = dev->pdev;
++	int result;
++
++	if (nvidia_dsm(pdev, NOUVEAU_DSM_ACTIVE, NOUVEAU_DSM_ACTIVE_QUERY,
++		       &result))
++		return -ENODEV;
++
++	printk(KERN_INFO "nouveau: _DSM hardware status gave 0x%x\n", result);
++
++	if (result &= 0x1) {	/* Stamina mode - disable the external GPU */
++		nvidia_dsm(pdev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_STAMINA,
++			   NULL);
++		nvidia_dsm(pdev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_STAMINA,
++			   NULL);
++	} else {		/* Ensure that the external GPU is enabled */
++		nvidia_dsm(pdev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_SPEED, NULL);
++		nvidia_dsm(pdev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_SPEED,
++			   NULL);
++	}
++
++	return 0;
++}
++
++bool nouveau_dsm_probe(struct drm_device *dev)
++{
++	struct pci_dev *pdev = dev->pdev;
++	int support = 0;
++
++	if (nvidia_dsm(pdev, NOUVEAU_DSM_SUPPORTED,
++		       NOUVEAU_DSM_SUPPORTED_FUNCTIONS, &support))
++		return false;
++
++	if (!support)
++		return false;
++
++	return true;
++}
 diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c
 new file mode 100644
 index 0000000..20564f8
@@ -10772,10 +10906,10 @@ index 0000000..f2b8b17
 +MODULE_LICENSE("GPL and additional rights");
 diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
 new file mode 100644
-index 0000000..57e8db3
+index 0000000..6c9158e
 --- /dev/null
 +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
-@@ -0,0 +1,1202 @@
+@@ -0,0 +1,1218 @@
 +/*
 + * Copyright 2005 Stephane Marchesin.
 + * All Rights Reserved.
@@ -11344,6 +11478,7 @@ index 0000000..57e8db3
 +	} susres;
 +
 +	struct backlight_device *backlight;
++	bool acpi_dsm;
 +
 +	struct nouveau_channel *evo;
 +
@@ -11531,6 +11666,21 @@ index 0000000..57e8db3
 +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 *);
@@ -19573,10 +19723,10 @@ index 0000000..d30c988
 +}
 diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
 new file mode 100644
-index 0000000..b39f11e
+index 0000000..2d62bdc
 --- /dev/null
 +++ b/drivers/gpu/drm/nouveau/nouveau_state.c
-@@ -0,0 +1,829 @@
+@@ -0,0 +1,834 @@
 +/*
 + * Copyright 2005 Stephane Marchesin
 + * Copyright 2008 Stuart Bennett
@@ -20120,6 +20270,11 @@ index 0000000..b39f11e
 +	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) */


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1793
retrieving revision 1.1794
diff -u -p -r1.1793 -r1.1794
--- kernel.spec	11 Sep 2009 01:34:12 -0000	1.1793
+++ kernel.spec	11 Sep 2009 07:05:08 -0000	1.1794
@@ -2019,6 +2019,9 @@ fi
 
 %changelog
 * Fri Sep 11 2009 Ben Skeggs <bskeggs at redhat.com>
+- nouveau: bring in Matthew Garret's initial switchable graphics support
+
+* Fri Sep 11 2009 Ben Skeggs <bskeggs at redhat.com>
 - nouveau: fixed use of strap-based panel mode when required (rh#522649)
 - nouveau: temporarily block accel on NVAC chipsets (rh#522361, rh#522575)
 




More information about the scm-commits mailing list