[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-nouveau: Changes to 'upstream-experimental'



 configure.ac          |   13 -
 src/Makefile.am       |    2 
 src/drmmode_display.c |  616 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/drmmode_display.h |   65 +++++
 src/nouveau_bo.c      |    1 
 src/nouveau_bo.h      |    1 
 src/nouveau_device.c  |    9 
 src/nv50_randr.c      |   12 
 src/nv50_sor.c        |   10 
 src/nv_bios.c         |   16 -
 src/nv_const.h        |    4 
 src/nv_crtc.c         |   52 ----
 src/nv_cursor.c       |   64 +----
 src/nv_dac.c          |   61 +---
 src/nv_dri.c          |   71 +++++
 src/nv_driver.c       |  231 +++++++++++++-----
 src/nv_exa.c          |   59 +---
 src/nv_hw.c           |  161 +++++++++----
 src/nv_i2c.c          |   22 +
 src/nv_include.h      |    2 
 src/nv_local.h        |   62 +----
 src/nv_output.c       |   69 -----
 src/nv_proto.h        |    3 
 src/nv_setup.c        |   65 ++---
 src/nv_shadow.c       |   24 +
 src/nv_type.h         |   13 -
 26 files changed, 1266 insertions(+), 442 deletions(-)

New commits:
commit 48c2116fb31872111239f5434215f30c8707091e
Author: Maarten Maathuis <madman2003@gmail.com>
Date:   Wed Jul 2 19:04:58 2008 +0200

    NV50_KMS: no int10 please

diff --git a/src/nv_driver.c b/src/nv_driver.c
index 2fe8819..e715e79 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -1105,7 +1105,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
 	}
 
 	/* Save current console video mode */
-	if (pNv->Architecture >= NV_ARCH_50 && pNv->pInt10) {
+	if (pNv->Architecture >= NV_ARCH_50 && pNv->pInt10 && !pNv->kms_enable) {
 		const xf86Int10InfoPtr pInt10 = pNv->pInt10;
 
 		pInt10->num = 0x10;

commit 11102af2896b3fdf2364854b2d7939b2802c5b2a
Author: Stuart Bennett <sb476@cam.ac.uk>
Date:   Fri Jun 27 16:21:19 2008 +0100

    Backport console font save/restore from nouveau_ms

diff --git a/src/nv_driver.c b/src/nv_driver.c
index 9abca5a..2fe8819 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -2043,6 +2043,8 @@ NVRestore(ScrnInfoPtr pScrn)
 			for (i = 0; i < xf86_config->num_crtc; i++)
 				xf86_config->crtc[i]->funcs->restore(xf86_config->crtc[i]);
 
+			nv_save_restore_vga_fonts(pScrn, 0);
+
 			for (i = 0; i < xf86_config->num_crtc; i++)
 				NVCrtcLockUnlock(xf86_config->crtc[i], 1);
 		}
@@ -2618,6 +2620,8 @@ NVSave(ScrnInfoPtr pScrn)
 		xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
 		int i;
 
+		nv_save_restore_vga_fonts(pScrn, 1);
+
 		for (i = 0; i < xf86_config->num_crtc; i++) {
 			xf86_config->crtc[i]->funcs->save(xf86_config->crtc[i]);
 		}
diff --git a/src/nv_hw.c b/src/nv_hw.c
index 5f12428..d5ba9f8 100644
--- a/src/nv_hw.c
+++ b/src/nv_hw.c
@@ -1,5 +1,6 @@
 /*
  * Copyright 1993-2003 NVIDIA, Corporation
+ * Copyright 2008 Stuart Bennett
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -1343,3 +1344,90 @@ uint32_t nv_pitch_align(NVPtr pNv, uint32_t width, int bpp)
 
 	return (width + mask) & ~mask;
 }
+
+#define VGA_SEQ_PLANE_WRITE     0x02
+#define VGA_SEQ_MEMORY_MODE     0x04
+#define VGA_GFX_PLANE_READ      0x04
+#define VGA_GFX_MODE            0x05
+#define VGA_GFX_MISC            0x06
+
+void nv_save_restore_vga_fonts(ScrnInfoPtr pScrn, bool save)
+{
+	NVPtr pNv = NVPTR(pScrn);
+	bool graphicsmode;
+	uint8_t misc, gr4, gr5, gr6, seq2, seq4;
+	int i;
+
+	NVSetEnablePalette(pNv, 0, true);
+	graphicsmode = NVReadVgaAttr(pNv, 0, 0x10) & 1;
+	NVSetEnablePalette(pNv, 0, false);
+
+	if (graphicsmode)	/* graphics mode => framebuffer => no need to save */
+		return;
+
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%sing VGA fonts\n", save ? "Sav" : "Restor");
+	if (pNv->twoHeads)
+		NVBlankScreen(pScrn, 1, true);
+	NVBlankScreen(pScrn, 0, true);
+
+	/* save control regs */
+	misc = NVReadPVIO(pNv, 0, VGA_MISC_OUT_R);
+	seq2 = NVReadVgaSeq(pNv, 0, VGA_SEQ_PLANE_WRITE);
+	seq4 = NVReadVgaSeq(pNv, 0, VGA_SEQ_MEMORY_MODE);
+	gr4 = NVReadVgaGr(pNv, 0, VGA_GFX_PLANE_READ);
+	gr5 = NVReadVgaGr(pNv, 0, VGA_GFX_MODE);
+	gr6 = NVReadVgaGr(pNv, 0, VGA_GFX_MISC);
+
+	NVWritePVIO(pNv, 0, VGA_MISC_OUT_W, 0x67);
+	NVWriteVgaSeq(pNv, 0, VGA_SEQ_MEMORY_MODE, 0x6);
+	NVWriteVgaGr(pNv, 0, VGA_GFX_MODE, 0x0);
+	NVWriteVgaGr(pNv, 0, VGA_GFX_MISC, 0x5);
+
+	/* store font in plane 0 */
+	NVWriteVgaSeq(pNv, 0, VGA_SEQ_PLANE_WRITE, 0x1);
+	NVWriteVgaGr(pNv, 0, VGA_GFX_PLANE_READ, 0x0);
+	for (i = 0; i < 16384; i++)
+		if (save)
+			pNv->saved_vga_font[0][i] = MMIO_IN32(pNv->FB_BAR, i * 4);
+		else
+			MMIO_OUT32(pNv->FB_BAR, i * 4, pNv->saved_vga_font[0][i]);
+
+	/* store font in plane 1 */
+	NVWriteVgaSeq(pNv, 0, VGA_SEQ_PLANE_WRITE, 0x2);
+	NVWriteVgaGr(pNv, 0, VGA_GFX_PLANE_READ, 0x1);
+	for (i = 0; i < 16384; i++)
+		if (save)
+			pNv->saved_vga_font[1][i] = MMIO_IN32(pNv->FB_BAR, i * 4);
+		else
+			MMIO_OUT32(pNv->FB_BAR, i * 4, pNv->saved_vga_font[1][i]);
+
+	/* store font in plane 2 */
+	NVWriteVgaSeq(pNv, 0, VGA_SEQ_PLANE_WRITE, 0x4);
+	NVWriteVgaGr(pNv, 0, VGA_GFX_PLANE_READ, 0x2);
+	for (i = 0; i < 16384; i++)
+		if (save)
+			pNv->saved_vga_font[2][i] = MMIO_IN32(pNv->FB_BAR, i * 4);
+		else
+			MMIO_OUT32(pNv->FB_BAR, i * 4, pNv->saved_vga_font[2][i]);
+
+	/* store font in plane 3 */
+	NVWriteVgaSeq(pNv, 0, VGA_SEQ_PLANE_WRITE, 0x8);
+	NVWriteVgaGr(pNv, 0, VGA_GFX_PLANE_READ, 0x3);
+	for (i = 0; i < 16384; i++)
+		if (save)
+			pNv->saved_vga_font[3][i] = MMIO_IN32(pNv->FB_BAR, i * 4);
+		else
+			MMIO_OUT32(pNv->FB_BAR, i * 4, pNv->saved_vga_font[3][i]);
+
+	/* restore control regs */
+	NVWritePVIO(pNv, 0, VGA_MISC_OUT_W, misc);
+	NVWriteVgaGr(pNv, 0, VGA_GFX_PLANE_READ, gr4);
+	NVWriteVgaGr(pNv, 0, VGA_GFX_MODE, gr5);
+	NVWriteVgaGr(pNv, 0, VGA_GFX_MISC, gr6);
+	NVWriteVgaSeq(pNv, 0, VGA_SEQ_PLANE_WRITE, seq2);
+	NVWriteVgaSeq(pNv, 0, VGA_SEQ_MEMORY_MODE, seq4);
+
+	if (pNv->twoHeads)
+		NVBlankScreen(pScrn, 1, false);
+	NVBlankScreen(pScrn, 0, false);
+}
diff --git a/src/nv_proto.h b/src/nv_proto.h
index 8f7a5a0..4562cb0 100644
--- a/src/nv_proto.h
+++ b/src/nv_proto.h
@@ -139,6 +139,7 @@ void nv4UpdateArbitrationSettings (unsigned      VClk,
 				   unsigned     *lwm,
 				   NVPtr        pNv);
 uint32_t nv_pitch_align(NVPtr pNv, uint32_t width, int bpp);
+void nv_save_restore_vga_fonts(ScrnInfoPtr pScrn, bool save);
 
 /* in nv_i2c.c */
 Bool NV_I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name);
diff --git a/src/nv_setup.c b/src/nv_setup.c
index bad1541..71a20b1 100644
--- a/src/nv_setup.c
+++ b/src/nv_setup.c
@@ -359,9 +359,13 @@ NVCommonSetup(ScrnInfoPtr pScrn)
 	pNv->REGS = xf86MapPciMem(pScrn->scrnIndex, 
 			VIDMEM_MMIO | VIDMEM_READSIDEEFFECT, 
 			pNv->PciTag, pNv->IOAddress, 0x01000000);
+	pNv->FB_BAR = xf86MapPciMem(pScrn->scrnIndex,
+			VIDMEM_MMIO | VIDMEM_READSIDEEFFECT,
+			pNv->PciTag, pNv->VRAMPhysical, 0x10000);
 #else
 	/* 0x01000000 is the size */
 	pci_device_map_range(pNv->PciInfo, pNv->IOAddress, 0x01000000, PCI_DEV_MAP_FLAG_WRITABLE, (void *)&pNv->REGS);
+	pci_device_map_range(pNv->PciInfo, pNv->VRAMPhysical, 0x10000, PCI_DEV_MAP_FLAG_WRITABLE, (void *)&pNv->FB_BAR);
 #endif /* XSERVER_LIBPCIACCESS */
 
 	pNv->PRAMIN   = pNv->REGS + (NV_PRAMIN_OFFSET/4);
diff --git a/src/nv_type.h b/src/nv_type.h
index 2564b91..bc0e8bf 100644
--- a/src/nv_type.h
+++ b/src/nv_type.h
@@ -360,6 +360,7 @@ typedef struct _NVRec *NVPtr;
 typedef struct _NVRec {
     RIVA_HW_STATE       SavedReg;
     RIVA_HW_STATE       ModeReg;
+    uint32_t saved_vga_font[4][16384];
     uint32_t              Architecture;
     EntityInfoPtr       pEnt;
 #ifndef XSERVER_LIBPCIACCESS
@@ -404,6 +405,7 @@ typedef struct _NVRec {
     CARD32              RamAmountKBytes;
 
     volatile CARD32 *REGS;
+    volatile CARD32 *FB_BAR;
     volatile CARD32 *PGRAPH;
     volatile CARD32 *PRAMIN;
     volatile CARD32 *CURSOR;

commit ca2c55dfbf65ac268d43ba62db2399976eaf8f0a
Author: Stuart Bennett <sb476@cam.ac.uk>
Date:   Thu Jun 26 14:44:45 2008 +0100

    randr12: fix mode detection for when screen size changes
    
    also some mem leaks

diff --git a/src/nv_output.c b/src/nv_output.c
index cca78bf..e6a6be1 100644
--- a/src/nv_output.c
+++ b/src/nv_output.c
@@ -499,6 +499,7 @@ nv_output_get_modes(xf86OutputPtr output, xf86MonPtr mon)
 		int i;
 		DisplayModePtr mode;
 
+		nv_output->fpHeight = nv_output->fpWidth = 0;
 		for (i = 0; i < DET_TIMINGS; i++) {
 			/* We only look at detailed timings atm */
 			if (mon->det_mon[i].type != DT)
@@ -514,10 +515,11 @@ nv_output_get_modes(xf86OutputPtr output, xf86MonPtr mon)
 			return NULL;
 		}
 
-		if (nv_output->native_mode)
+		if (nv_output->native_mode) {
 			xfree(nv_output->native_mode);
+			nv_output->native_mode = NULL;
+		}
 
-		/* Prefer ddc modes. */
 		for (mode = ddc_modes; mode != NULL; mode = mode->next) {
 			if (mode->HDisplay == nv_output->fpWidth &&
 				mode->VDisplay == nv_output->fpHeight) {
@@ -528,6 +530,8 @@ nv_output_get_modes(xf86OutputPtr output, xf86MonPtr mon)
 				}
 				/* Find the highest refresh mode otherwise. */
 				if (!nv_output->native_mode || (mode->VRefresh > nv_output->native_mode->VRefresh)) {
+					if (nv_output->native_mode)
+						xfree(nv_output->native_mode);
 					mode->type |= M_T_PREFERRED;
 					nv_output->native_mode = xf86DuplicateMode(mode);
 				}
@@ -864,6 +868,8 @@ nv_lvds_output_get_modes(xf86OutputPtr output)
 	xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Panel size is %u x %u\n",
 		nv_output->fpWidth, nv_output->fpHeight);
 
+	if (nv_output->native_mode)
+		xfree(nv_output->native_mode);
 	nv_output->native_mode = xf86DuplicateMode(pNv->VBIOS.fp.native_mode);
 
 	return xf86DuplicateMode(pNv->VBIOS.fp.native_mode);

commit 9c6eb667aa48f87f6bbbdae10cc9f4d237bdb0c6
Author: Maarten Maathuis <madman2003@gmail.com>
Date:   Sat Jun 28 15:47:18 2008 +0200

    NV04-NV4E: Save and restore FB_START

diff --git a/src/nv_crtc.c b/src/nv_crtc.c
index 672cd9f..292c6bb 100644
--- a/src/nv_crtc.c
+++ b/src/nv_crtc.c
@@ -1658,6 +1658,9 @@ static void nv_crtc_load_state_ext(xf86CrtcPtr crtc, RIVA_HW_STATE *state, Bool
 		NVWriteVgaCrtc(pNv, nv_crtc->head, NV_VGA_CRTCX_86, regp->CRTC[NV_VGA_CRTCX_86]);
 	}
 
+	if (override)
+		NVCrtcWriteCRTC(crtc, NV_CRTC_START, regp->fb_start);
+
 	/* Setting 1 on this value gives you interrupts for every vblank period. */
 	NVCrtcWriteCRTC(crtc, NV_CRTC_INTR_EN_0, 0);
 	NVCrtcWriteCRTC(crtc, NV_CRTC_INTR_0, NV_CRTC_INTR_VBLANK);
@@ -1754,6 +1757,8 @@ static void nv_crtc_save_state_ext(xf86CrtcPtr crtc, RIVA_HW_STATE *state)
 		regp->CRTC[NV_VGA_CRTCX_85] = NVReadVgaCrtc(pNv, nv_crtc->head, NV_VGA_CRTCX_85);
 		regp->CRTC[NV_VGA_CRTCX_86] = NVReadVgaCrtc(pNv, nv_crtc->head, NV_VGA_CRTCX_86);
 	}
+
+	regp->fb_start = NVCrtcReadCRTC(crtc, NV_CRTC_START);
 }
 
 static void nv_crtc_save_state_ramdac(xf86CrtcPtr crtc, RIVA_HW_STATE *state)
@@ -1884,9 +1889,6 @@ NVCrtcSetBase (xf86CrtcPtr crtc, int x, int y, Bool bios_restore)
 	/* 30 bits addresses in 32 bits according to haiku */
 	NVCrtcWriteCRTC(crtc, NV_CRTC_START, start & 0xfffffffc);
 
-	/* set NV4/NV10 byte adress: (bit0 - 1) */
-	NVWriteVgaAttr(pNv, nv_crtc->head, 0x13, (start & 0x3) << 1);
-
 	crtc->x = x;
 	crtc->y = y;
 }
diff --git a/src/nv_type.h b/src/nv_type.h
index d9b11d5..2564b91 100644
--- a/src/nv_type.h
+++ b/src/nv_type.h
@@ -152,6 +152,7 @@ typedef struct _nv_crtc_reg
 	uint32_t unk850;
 	uint32_t head;
 	uint32_t config;
+	uint32_t fb_start;
 
 	/* These are former output regs, but are believed to be crtc related */
 	uint32_t general;

commit 82fe9a21596ab80157df20b269ce8df41315de83
Author: Maarten Maathuis <madman2003@gmail.com>
Date:   Fri Jun 27 18:49:16 2008 +0200

    NV50_KMS: switch to output dpms

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 674f005..80b514b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -151,49 +151,10 @@ static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {
 	drmmode_xf86crtc_resize
 };
 
-/* dpms based on setting a NULL mode when mode is off */
 static void
 drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
 {
-	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
-	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-	drmmode_ptr drmmode = drmmode_crtc->drmmode;
-	struct drm_mode_modeinfo kmode;
-	uint32_t *output_ids;
-	int output_count = 0;
-	int i;
-
-	if (mode == drmmode_crtc->dpms_mode)
-		return;
-
-	output_ids = xcalloc(sizeof(uint32_t), xf86_config->num_output);
-	if (!output_ids) {
-		return;
-	}
-
-	for (i = 0; i < xf86_config->num_output; i++) {
-		xf86OutputPtr output = xf86_config->output[i];
-		drmmode_output_private_ptr drmmode_output;
-
-		if (output->crtc != crtc)
-			continue;
-
-		drmmode_output = output->driver_private;
-		output_ids[output_count] = drmmode_output->mode_output->connector_id;
-		output_count++;
-	}
-
-	if (mode == DPMSModeOn) {
-		drmmode_ConvertToKMode(crtc->scrn, &kmode, &crtc->mode);
-		drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
-			drmmode->fb_id, crtc->x, crtc->y, output_ids, output_count, &kmode);
-	} else {
-		drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
-			drmmode->fb_id, crtc->x, crtc->y, output_ids, output_count, NULL);
-	}
-
-	if (output_ids)
-		xfree(output_ids);
+	return;
 }
 
 static Bool
@@ -260,8 +221,6 @@ done:
 		crtc->y = saved_y;
 		crtc->rotation = saved_rotation;
 		crtc->mode = saved_mode;
-	} else {
-		drmmode_crtc->dpms_mode = DPMSModeOn;
 	}
 
 	if (output_ids)
@@ -411,9 +370,13 @@ drmmode_output_get_modes(xf86OutputPtr output)
 		props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
 		if (props && (props->flags & DRM_MODE_PROP_BLOB)) {
 			if (!strcmp(props->name, "EDID")) {
+				ErrorF("EDID property found\n");
 				if (drmmode_output->edid_blob)
 					drmModeFreePropertyBlob(drmmode_output->edid_blob);
 				drmmode_output->edid_blob = drmModeGetPropertyBlob(drmmode->fd, koutput->prop_values[i]);
+
+				if (!drmmode_output->edid_blob)
+					ErrorF("No EDID blob\n");
 			}
 			drmModeFreeProperty(props);
 		}
@@ -450,7 +413,24 @@ drmmode_output_destroy(xf86OutputPtr output)
 static void
 drmmode_output_dpms(xf86OutputPtr output, int mode)
 {
-	return;
+	drmmode_output_private_ptr drmmode_output = output->driver_private;
+	drmModeConnectorPtr koutput = drmmode_output->mode_output;
+	drmmode_ptr drmmode = drmmode_output->drmmode;
+	drmModePropertyPtr props;
+	int i;
+
+	ErrorF("drmmode_output_dpms called with mode %d\n", mode);
+
+	for (i = 0; i < koutput->count_props; i++) {
+		props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
+		if (props && (props->flags & DRM_MODE_PROP_ENUM)) {
+			if (!strcmp(props->name, "DPMS")) {
+				ErrorF("DPMS property found\n");
+				drmModeConnectorSetProperty(drmmode->fd, drmmode_output->output_id, props->prop_id, mode); 
+			}
+			drmModeFreeProperty(props);
+		}
+	}
 }
 
 static const xf86OutputFuncsRec drmmode_output_funcs = {
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 10f35d0..b1ba3a9 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -47,7 +47,6 @@ typedef struct {
 	int index;
 	drmmode_ptr drmmode;
 	drmModeCrtcPtr mode_crtc;
-	int dpms_mode;
 } drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
 
 typedef struct {

commit 13ce1f4c1d02e70333a192db2efefb3f6a6765e3
Author: Maarten Maathuis <madman2003@gmail.com>
Date:   Wed Jun 25 19:45:12 2008 +0200

    Properly close drm when exiting + misc cleanup.

diff --git a/src/nouveau_device.c b/src/nouveau_device.c
index f32dff1..159fd72 100644
--- a/src/nouveau_device.c
+++ b/src/nouveau_device.c
@@ -69,9 +69,9 @@ nouveau_device_open(struct nouveau_device **userdev, const char *busid)
 
 	ret = nouveau_device_open_existing(userdev, 1, fd, ctx);
 	if (ret) {
-	    drmDestroyContext(fd, ctx);
-	    drmClose(fd);
-	    return ret;
+		drmDestroyContext(fd, ctx);
+		drmClose(fd);
+		return ret;
 	}
 
 	return 0;
@@ -88,7 +88,8 @@ nouveau_device_close(struct nouveau_device **userdev)
 	*userdev = NULL;
 
 	if (nv->needs_close) {
-		drmDestroyContext(nv->fd, nv->ctx);
+		if (nv->ctx)
+			drmDestroyContext(nv->fd, nv->ctx);
 		drmClose(nv->fd);
 	}
 	free(nv);
diff --git a/src/nv_dri.c b/src/nv_dri.c
index 7e8fba7..94d76dd 100644
--- a/src/nv_dri.c
+++ b/src/nv_dri.c
@@ -294,7 +294,7 @@ Bool NVDRIScreenInit(ScrnInfoPtr pScrn)
 	int drm_fd;
 
 #ifdef XF86DRM_MODE
-	/* drm already open */
+	/* drm already open, reuse it */
 	if (pNv->drmmode) {
 		drmmode_ptr drmmode = pNv->drmmode;
 		drm_fd = drmmode->fd;
@@ -374,7 +374,8 @@ Bool NVDRIScreenInit(ScrnInfoPtr pScrn)
 		return FALSE;
 	}
 
-	if (nouveau_device_open_existing(&pNv->dev, 0, drm_fd, 0)) {
+	/* turn on need_close, so we explictly drmClose() on exit */
+	if (nouveau_device_open_existing(&pNv->dev, 1, drm_fd, 0)) {
 		xf86DrvMsg(pScreen->myNum, X_ERROR, "Error creating device\n");
 		xfree(pDRIInfo->devPrivate);
 		pDRIInfo->devPrivate = NULL;
@@ -419,3 +420,12 @@ Bool NVDRIFinishScreenInit(ScrnInfoPtr pScrn)
 	return TRUE;
 }
 
+void NVDRICloseScreen(ScrnInfoPtr pScrn)
+{
+	ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+	NVPtr pNv = NVPTR(pScrn);
+
+	DRICloseScreen(pScreen);
+	nouveau_device_close(&pNv->dev);
+}
+
diff --git a/src/nv_driver.c b/src/nv_driver.c
index 255f961..9abca5a 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -841,15 +841,34 @@ NVCloseScreen(int scrnIndex, ScreenPtr pScreen)
 
 	NVUnmapMem(pScrn);
 	vgaHWUnmapMem(pScrn);
-	nouveau_device_close(&pNv->dev);
+	NVDRICloseScreen(pScrn);
 	if (pNv->CursorInfoRec)
 		xf86DestroyCursorInfoRec(pNv->CursorInfoRec);
-	if (pNv->ShadowPtr)
+	if (pNv->ShadowPtr) {
 		xfree(pNv->ShadowPtr);
-	if (pNv->overlayAdaptor)
+		pNv->ShadowPtr = NULL;
+	}
+	if (pNv->overlayAdaptor) {
 		xfree(pNv->overlayAdaptor);
-	if (pNv->blitAdaptor)
+		pNv->overlayAdaptor = NULL;
+	}
+	if (pNv->blitAdaptor) {
 		xfree(pNv->blitAdaptor);
+		pNv->blitAdaptor = NULL;
+	}
+	if (pNv->textureAdaptor[0]) {
+		xfree(pNv->textureAdaptor[0]);
+		pNv->textureAdaptor[0] = NULL;
+	}
+	if (pNv->textureAdaptor[1]) {
+		xfree(pNv->textureAdaptor[1]);
+		pNv->textureAdaptor[1] = NULL;
+	}
+	if (pNv->EXADriverPtr) {
+		exaDriverFini(pScreen);
+		xfree(pNv->EXADriverPtr);
+		pNv->EXADriverPtr = NULL;
+	}
 
 	pScrn->vtSema = FALSE;
 	pScreen->CloseScreen = pNv->CloseScreen;
diff --git a/src/nv_proto.h b/src/nv_proto.h
index fc0ade1..8f7a5a0 100644
--- a/src/nv_proto.h
+++ b/src/nv_proto.h
@@ -16,6 +16,7 @@ Bool NVMatchModePrivate(DisplayModePtr mode, uint32_t flags);
 /* in nv_dri.c */
 Bool NVDRIScreenInit(ScrnInfoPtr pScrn);
 Bool NVDRIFinishScreenInit(ScrnInfoPtr pScrn);
+void NVDRICloseScreen(ScrnInfoPtr pScrn);
 extern const char *drmSymbols[], *driSymbols[];
 Bool NVDRIGetVersion(ScrnInfoPtr pScrn);
 

commit 7cb0eed603ea0bd196a7471e43d60fa5e518c7fb
Author: Maarten Maathuis <madman2003@gmail.com>
Date:   Wed Jun 25 19:07:58 2008 +0200

    Fixup and add some license statements.
    
    - The changed statements are a response to nv commit 2fdcda8ea62eba1b7885f0a75249884715936247.

diff --git a/src/nv_crtc.c b/src/nv_crtc.c
index e09a7d1..672cd9f 100644
--- a/src/nv_crtc.c
+++ b/src/nv_crtc.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright 1993-2003 NVIDIA, Corporation
  * Copyright 2006 Dave Airlie
  * Copyright 2007 Maarten Maathuis
  *
@@ -21,10 +22,6 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
-/*
- * this code uses ideas taken from the NVIDIA nv driver - the nvidia license
- * decleration is at the bottom of this file as it is rather ugly 
- */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1928,42 +1925,3 @@ static void nv_crtc_load_state_palette(xf86CrtcPtr crtc, RIVA_HW_STATE *state)
 
 	NVSetEnablePalette(pNv, nv_crtc->head, false);
 }
-
-/*************************************************************************** \
-|*                                                                           *|
-|*       Copyright 1993-2003 NVIDIA, Corporation.  All rights reserved.      *|
-|*                                                                           *|
-|*     NOTICE TO USER:   The source code  is copyrighted under  U.S. and     *|
-|*     international laws.  Users and possessors of this source code are     *|
-|*     hereby granted a nonexclusive,  royalty-free copyright license to     *|
-|*     use this code in individual and commercial software.                  *|
-|*                                                                           *|
-|*     Any use of this source code must include,  in the user documenta-     *|
-|*     tion and  internal comments to the code,  notices to the end user     *|
-|*     as follows:                                                           *|
-|*                                                                           *|
-|*       Copyright 1993-1999 NVIDIA, Corporation.  All rights reserved.      *|
-|*                                                                           *|
-|*     NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY     *|
-|*     OF  THIS SOURCE  CODE  FOR ANY PURPOSE.  IT IS  PROVIDED  "AS IS"     *|
-|*     WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.  NVIDIA, CORPOR-     *|
-|*     ATION DISCLAIMS ALL WARRANTIES  WITH REGARD  TO THIS SOURCE CODE,     *|
-|*     INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE-     *|
-|*     MENT,  AND FITNESS  FOR A PARTICULAR PURPOSE.   IN NO EVENT SHALL     *|
-|*     NVIDIA, CORPORATION  BE LIABLE FOR ANY SPECIAL,  INDIRECT,  INCI-     *|
-|*     DENTAL, OR CONSEQUENTIAL DAMAGES,  OR ANY DAMAGES  WHATSOEVER RE-     *|
-|*     SULTING FROM LOSS OF USE,  DATA OR PROFITS,  WHETHER IN AN ACTION     *|
-|*     OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,  ARISING OUT OF     *|
-|*     OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.     *|
-|*                                                                           *|
-|*     U.S. Government  End  Users.   This source code  is a "commercial     *|
-|*     item,"  as that  term is  defined at  48 C.F.R. 2.101 (OCT 1995),     *|
-|*     consisting  of "commercial  computer  software"  and  "commercial     *|
-|*     computer  software  documentation,"  as such  terms  are  used in     *|
-|*     48 C.F.R. 12.212 (SEPT 1995)  and is provided to the U.S. Govern-     *|
-|*     ment only as  a commercial end item.   Consistent with  48 C.F.R.     *|
-|*     12.212 and  48 C.F.R. 227.7202-1 through  227.7202-4 (JUNE 1995),     *|
-|*     all U.S. Government End Users  acquire the source code  with only     *|
-|*     those rights set forth herein.                                        *|
-|*                                                                           *|
- \***************************************************************************/
diff --git a/src/nv_cursor.c b/src/nv_cursor.c
index bdf25ae..7b504cf 100644
--- a/src/nv_cursor.c
+++ b/src/nv_cursor.c
@@ -1,45 +1,25 @@
- /***************************************************************************\
-|*                                                                           *|
-|*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
-|*                                                                           *|
-|*     NOTICE TO USER:   The source code  is copyrighted under  U.S. and     *|
-|*     international laws.  Users and possessors of this source code are     *|
-|*     hereby granted a nonexclusive,  royalty-free copyright license to     *|
-|*     use this code in individual and commercial software.                  *|
-|*                                                                           *|
-|*     Any use of this source code must include,  in the user documenta-     *|
-|*     tion and  internal comments to the code,  notices to the end user     *|
-|*     as follows:                                                           *|
-|*                                                                           *|
-|*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
-|*                                                                           *|
-|*     NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY     *|
-|*     OF  THIS SOURCE  CODE  FOR ANY PURPOSE.  IT IS  PROVIDED  "AS IS"     *|
-|*     WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.  NVIDIA, CORPOR-     *|
-|*     ATION DISCLAIMS ALL WARRANTIES  WITH REGARD  TO THIS SOURCE CODE,     *|
-|*     INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE-     *|
-|*     MENT,  AND FITNESS  FOR A PARTICULAR PURPOSE.   IN NO EVENT SHALL     *|
-|*     NVIDIA, CORPORATION  BE LIABLE FOR ANY SPECIAL,  INDIRECT,  INCI-     *|
-|*     DENTAL, OR CONSEQUENTIAL DAMAGES,  OR ANY DAMAGES  WHATSOEVER RE-     *|
-|*     SULTING FROM LOSS OF USE,  DATA OR PROFITS,  WHETHER IN AN ACTION     *|
-|*     OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,  ARISING OUT OF     *|
-|*     OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.     *|
-|*                                                                           *|
-|*     U.S. Government  End  Users.   This source code  is a "commercial     *|
-|*     item,"  as that  term is  defined at  48 C.F.R. 2.101 (OCT 1995),     *|
-|*     consisting  of "commercial  computer  software"  and  "commercial     *|
-|*     computer  software  documentation,"  as such  terms  are  used in     *|
-|*     48 C.F.R. 12.212 (SEPT 1995)  and is provided to the U.S. Govern-     *|
-|*     ment only as  a commercial end item.   Consistent with  48 C.F.R.     *|
-|*     12.212 and  48 C.F.R. 227.7202-1 through  227.7202-4 (JUNE 1995),     *|
-|*     all U.S. Government End Users  acquire the source code  with only     *|
-|*     those rights set forth herein.                                        *|
-|*                                                                           *|
- \***************************************************************************/
-
-/* Copyright 2007 Maarten Maathuis */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c,v 1.13 2004/03/13 22:07:05 mvojkovi Exp $ */
+/*
+ * Copyright 2003 NVIDIA, Corporation
+ * Copyright 2007 Maarten Maathuis
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
 
 #include "nv_include.h"
 
diff --git a/src/nv_dac.c b/src/nv_dac.c
index b8c07dc..02aa6ec 100644
--- a/src/nv_dac.c
+++ b/src/nv_dac.c
@@ -1,43 +1,24 @@
- /***************************************************************************\
-|*                                                                           *|
-|*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
-|*                                                                           *|
-|*     NOTICE TO USER:   The source code  is copyrighted under  U.S. and     *|
-|*     international laws.  Users and possessors of this source code are     *|
-|*     hereby granted a nonexclusive,  royalty-free copyright license to     *|
-|*     use this code in individual and commercial software.                  *|
-|*                                                                           *|
-|*     Any use of this source code must include,  in the user documenta-     *|
-|*     tion and  internal comments to the code,  notices to the end user     *|
-|*     as follows:                                                           *|
-|*                                                                           *|
-|*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
-|*                                                                           *|
-|*     NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY     *|
-|*     OF  THIS SOURCE  CODE  FOR ANY PURPOSE.  IT IS  PROVIDED  "AS IS"     *|
-|*     WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.  NVIDIA, CORPOR-     *|
-|*     ATION DISCLAIMS ALL WARRANTIES  WITH REGARD  TO THIS SOURCE CODE,     *|
-|*     INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE-     *|
-|*     MENT,  AND FITNESS  FOR A PARTICULAR PURPOSE.   IN NO EVENT SHALL     *|
-|*     NVIDIA, CORPORATION  BE LIABLE FOR ANY SPECIAL,  INDIRECT,  INCI-     *|
-|*     DENTAL, OR CONSEQUENTIAL DAMAGES,  OR ANY DAMAGES  WHATSOEVER RE-     *|
-|*     SULTING FROM LOSS OF USE,  DATA OR PROFITS,  WHETHER IN AN ACTION     *|
-|*     OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,  ARISING OUT OF     *|
-|*     OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.     *|
-|*                                                                           *|
-|*     U.S. Government  End  Users.   This source code  is a "commercial     *|
-|*     item,"  as that  term is  defined at  48 C.F.R. 2.101 (OCT 1995),     *|
-|*     consisting  of "commercial  computer  software"  and  "commercial     *|
-|*     computer  software  documentation,"  as such  terms  are  used in     *|
-|*     48 C.F.R. 12.212 (SEPT 1995)  and is provided to the U.S. Govern-     *|
-|*     ment only as  a commercial end item.   Consistent with  48 C.F.R.     *|
-|*     12.212 and  48 C.F.R. 227.7202-1 through  227.7202-4 (JUNE 1995),     *|
-|*     all U.S. Government End Users  acquire the source code  with only     *|
-|*     those rights set forth herein.                                        *|
-|*                                                                           *|
- \***************************************************************************/
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c,v 1.45 2005/07/09 00:53:00 mvojkovi Exp $ */
+/*
+ * Copyright 2003 NVIDIA, Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
 
 #include "nv_include.h"
 
diff --git a/src/nv_dri.c b/src/nv_dri.c
index 2152e74..7e8fba7 100644
--- a/src/nv_dri.c
+++ b/src/nv_dri.c
@@ -1,3 +1,26 @@
+/*
+ * Copyright 2006 Stephane Marchesin
+ * Copyright 2006 Ben Skeggs
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
 #include "nv_include.h"
 
 #define _XF86DRI_SERVER_
diff --git a/src/nv_driver.c b/src/nv_driver.c
index 8860dae..255f961 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -1,7 +1,5 @@
-/* $XdotOrg: driver/xf86-video-nv/src/nv_driver.c,v 1.21 2006/01/24 16:45:29 aplattner Exp $ */
-/* $XConsortium: nv_driver.c /main/3 1996/10/28 05:13:37 kaleb $ */
 /*
- * Copyright 1996-1997  David J. McKay
+ * Copyright 1996-1997 David J. McKay
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -16,17 +14,12 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * DAVID J. MCKAY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
 
-/* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen
-   <jpaana@s2.org> */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.144 2006/06/16 00:19:32 mvojkovi Exp $ */
-
 #include <stdio.h>
 
 #include "nv_include.h"
diff --git a/src/nv_exa.c b/src/nv_exa.c
index d74914f..51ac51c 100644
--- a/src/nv_exa.c
+++ b/src/nv_exa.c
@@ -1,44 +1,23 @@
- /***************************************************************************\
-|*                                                                           *|
-|*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
-|*                                                                           *|
-|*     NOTICE TO USER:   The source code  is copyrighted under  U.S. and     *|
-|*     international laws.  Users and possessors of this source code are     *|
-|*     hereby granted a nonexclusive,  royalty-free copyright license to     *|
-|*     use this code in individual and commercial software.                  *|
-|*                                                                           *|
-|*     Any use of this source code must include,  in the user documenta-     *|
-|*     tion and  internal comments to the code,  notices to the end user     *|
-|*     as follows:                                                           *|
-|*                                                                           *|
-|*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
-|*                                                                           *|
-|*     NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY     *|
-|*     OF  THIS SOURCE  CODE  FOR ANY PURPOSE.  IT IS  PROVIDED  "AS IS"     *|
-|*     WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.  NVIDIA, CORPOR-     *|
-|*     ATION DISCLAIMS ALL WARRANTIES  WITH REGARD  TO THIS SOURCE CODE,     *|
-|*     INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE-     *|
-|*     MENT,  AND FITNESS  FOR A PARTICULAR PURPOSE.   IN NO EVENT SHALL     *|
-|*     NVIDIA, CORPORATION  BE LIABLE FOR ANY SPECIAL,  INDIRECT,  INCI-     *|
-|*     DENTAL, OR CONSEQUENTIAL DAMAGES,  OR ANY DAMAGES  WHATSOEVER RE-     *|
-|*     SULTING FROM LOSS OF USE,  DATA OR PROFITS,  WHETHER IN AN ACTION     *|
-|*     OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,  ARISING OUT OF     *|
-|*     OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.     *|
-|*                                                                           *|
-|*     U.S. Government  End  Users.   This source code  is a "commercial     *|
-|*     item,"  as that  term is  defined at  48 C.F.R. 2.101 (OCT 1995),     *|
-|*     consisting  of "commercial  computer  software"  and  "commercial     *|
-|*     computer  software  documentation,"  as such  terms  are  used in     *|
-|*     48 C.F.R. 12.212 (SEPT 1995)  and is provided to the U.S. Govern-     *|
-|*     ment only as  a commercial end item.   Consistent with  48 C.F.R.     *|
-|*     12.212 and  48 C.F.R. 227.7202-1 through  227.7202-4 (JUNE 1995),     *|
-|*     all U.S. Government End Users  acquire the source code  with only     *|
-|*     those rights set forth herein.                                        *|
-|*                                                                           *|
- \***************************************************************************/
-
 /*
-  Exa Modifications (c) Lars Knoll (lars@trolltech.com)
+ * Copyright 2003 NVIDIA, Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  */
 
 #include "nv_include.h"
diff --git a/src/nv_hw.c b/src/nv_hw.c
index 80f904f..5f12428 100644
--- a/src/nv_hw.c
+++ b/src/nv_hw.c
@@ -1,42 +1,24 @@
-/***************************************************************************\
-|*                                                                           *|
-|*       Copyright 1993-2003 NVIDIA, Corporation.  All rights reserved.      *|
-|*                                                                           *|
-|*     NOTICE TO USER:   The source code  is copyrighted under  U.S. and     *|
-|*     international laws.  Users and possessors of this source code are     *|
-|*     hereby granted a nonexclusive,  royalty-free copyright license to     *|
-|*     use this code in individual and commercial software.                  *|
-|*                                                                           *|
-|*     Any use of this source code must include,  in the user documenta-     *|
-|*     tion and  internal comments to the code,  notices to the end user     *|
-|*     as follows:                                                           *|
-|*                                                                           *|
-|*       Copyright 1993-2003 NVIDIA, Corporation.  All rights reserved.      *|
-|*                                                                           *|
-|*     NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY     *|
-|*     OF  THIS SOURCE  CODE  FOR ANY PURPOSE.  IT IS  PROVIDED  "AS IS"     *|
-|*     WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.  NVIDIA, CORPOR-     *|
-|*     ATION DISCLAIMS ALL WARRANTIES  WITH REGARD  TO THIS SOURCE CODE,     *|
-|*     INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE-     *|
-|*     MENT,  AND FITNESS  FOR A PARTICULAR PURPOSE.   IN NO EVENT SHALL     *|
-|*     NVIDIA, CORPORATION  BE LIABLE FOR ANY SPECIAL,  INDIRECT,  INCI-     *|
-|*     DENTAL, OR CONSEQUENTIAL DAMAGES,  OR ANY DAMAGES  WHATSOEVER RE-     *|
-|*     SULTING FROM LOSS OF USE,  DATA OR PROFITS,  WHETHER IN AN ACTION     *|
-|*     OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,  ARISING OUT OF     *|
-|*     OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.     *|
-|*                                                                           *|
-|*     U.S. Government  End  Users.   This source code  is a "commercial     *|
-|*     item,"  as that  term is  defined at  48 C.F.R. 2.101 (OCT 1995),     *|
-|*     consisting  of "commercial  computer  software"  and  "commercial     *|
-|*     computer  software  documentation,"  as such  terms  are  used in     *|
-|*     48 C.F.R. 12.212 (SEPT 1995)  and is provided to the U.S. Govern-     *|
-|*     ment only as  a commercial end item.   Consistent with  48 C.F.R.     *|
-|*     12.212 and  48 C.F.R. 227.7202-1 through  227.7202-4 (JUNE 1995),     *|
-|*     all U.S. Government End Users  acquire the source code  with only     *|
-|*     those rights set forth herein.                                        *|
-|*                                                                           *|
- \***************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_hw.c,v 1.21 2006/06/16 00:19:33 mvojkovi Exp $ */
+/*
+ * Copyright 1993-2003 NVIDIA, Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
 
 #include "nv_include.h"
 #include "nv_local.h"
diff --git a/src/nv_i2c.c b/src/nv_i2c.c
index c63d909..a08e096 100644
--- a/src/nv_i2c.c
+++ b/src/nv_i2c.c
@@ -1,3 +1,25 @@


Reply to: