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

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



 debian/changelog      |   57 ++++++++++++
 debian/control        |    4 
 src/Makefile.am       |    2 
 src/drmmode_display.c |  158 +++++++++++++++++++---------------
 src/nouveau_bios.h    |    2 
 src/nouveau_dri2.c    |    3 
 src/nouveau_exa.c     |  183 +++++++++++++++++++++++++++++----------
 src/nouveau_hw.c      |   72 +++++++++++++--
 src/nouveau_hw.h      |    4 
 src/nouveau_local.h   |   12 --
 src/nouveau_ms.h      |  156 ++++++++++++++++++++++++++++++++++
 src/nouveau_wfb.c     |  193 ++++++++++++++++++++++++++++++++++++++++++
 src/nouveau_xv.c      |   23 ++---
 src/nv30_exa.c        |    5 -
 src/nv30_xv_tex.c     |    6 -
 src/nv40_exa.c        |    5 -
 src/nv40_xv_tex.c     |    6 -
 src/nv50_exa.c        |    6 -
 src/nv50_randr.c      |    4 
 src/nv50_xv.c         |   10 +-
 src/nv_bios.c         |  124 ++++++++++++++++-----------
 src/nv_const.h        |    2 
 src/nv_crtc.c         |   99 ++++++++++-----------
 src/nv_cursor.c       |   22 ++--
 src/nv_dri.c          |    2 
 src/nv_driver.c       |  229 ++++++++++++++------------------------------------
 src/nv_output.c       |  124 ++++++++++++++-------------
 src/nv_proto.h        |   16 ++-
 src/nv_setup.c        |   64 ++-----------
 src/nv_type.h         |  113 +-----------------------
 30 files changed, 1037 insertions(+), 669 deletions(-)

New commits:
commit dce88a3d787398667baf015182fd5aaf245baed9
Author: Chris Lamb <lamby@debian.org>
Date:   Sat Jul 4 21:00:45 2009 +0100

    releasing version 1:0.0.10~git+20090701+c0bf670-1

diff --git a/debian/changelog b/debian/changelog
index f4353d2..988a794 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-xserver-xorg-video-nouveau (1:0.0.10~git+20090701+c0bf670-1) UNRELEASED; urgency=low
+xserver-xorg-video-nouveau (1:0.0.10~git+20090701+c0bf670-1) experimental; urgency=low
 
   * New upstream snapshot.
     - c0bf670... wfb: fix stupid thinko + more safety
@@ -53,7 +53,7 @@ xserver-xorg-video-nouveau (1:0.0.10~git+20090701+c0bf670-1) UNRELEASED; urgency
   * Bump Build-Depends on libdrm-dev.
   * Bump Standards-Version to 3.8.2.
 
- -- Chris Lamb <lamby@debian.org>  Wed, 01 Jul 2009 00:24:20 +0100
+ -- Chris Lamb <lamby@debian.org>  Sat, 04 Jul 2009 21:00:34 +0100
 
 xserver-xorg-video-nouveau (1:0.0.10~git+20090519+9656762-1) experimental; urgency=low
 

commit ef6bdabeb83c1f131df20a546c4dcc35074b7576
Author: Chris Lamb <lamby@debian.org>
Date:   Wed Jul 1 00:27:33 2009 +0100

    Bump Standards-Version to 3.8.2.

diff --git a/debian/changelog b/debian/changelog
index f7155fa..f4353d2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -51,6 +51,7 @@ xserver-xorg-video-nouveau (1:0.0.10~git+20090701+c0bf670-1) UNRELEASED; urgency
     - db9ff95... kms: clip sw transition dims to smallest common area
     - 2688c97... don't run vbios parser when kms enabled
   * Bump Build-Depends on libdrm-dev.
+  * Bump Standards-Version to 3.8.2.
 
  -- Chris Lamb <lamby@debian.org>  Wed, 01 Jul 2009 00:24:20 +0100
 
diff --git a/debian/control b/debian/control
index b920475..5b996c4 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
 Uploaders: Chris Lamb <lamby@debian.org>, Matthew Johnson <mjj29@debian.org>
 Build-Depends: debhelper (>= 7), pkg-config, xserver-xorg-dev (>= 2:1.2.99.902), x11proto-video-dev, x11proto-core-dev, x11proto-fonts-dev, x11proto-randr-dev (>= 1.2), x11proto-render-dev, x11proto-xext-dev, libdrm-dev (>= 2.4.11+git+20090630), x11proto-xf86dri-dev, x11proto-gl-dev, mesa-common-dev, automake, libtool, xutils-dev, xserver-xorg-dev
-Standards-Version: 3.8.1
+Standards-Version: 3.8.2
 Homepage: http://nouveau.freedesktop.org/wiki/
 Vcs-Git: git://git.debian.org/git/pkg-xorg/driver/xserver-xorg-video-nouveau
 Vcs-Browser: http://git.debian.org/?=pkg-xorg/driver/xserver-xorg-video-nouveau.git

commit f4e28e937aeaf62a0929f70a45d03e122cc6cdec
Author: Chris Lamb <lamby@debian.org>
Date:   Wed Jul 1 00:27:17 2009 +0100

    Bump Build-Depends on libdrm-dev.

diff --git a/debian/changelog b/debian/changelog
index 89b600b..f7155fa 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -50,6 +50,7 @@ xserver-xorg-video-nouveau (1:0.0.10~git+20090701+c0bf670-1) UNRELEASED; urgency
     - 6c09ad5... Tolerate missing fp bios table (rh#502371)
     - db9ff95... kms: clip sw transition dims to smallest common area
     - 2688c97... don't run vbios parser when kms enabled
+  * Bump Build-Depends on libdrm-dev.
 
  -- Chris Lamb <lamby@debian.org>  Wed, 01 Jul 2009 00:24:20 +0100
 
diff --git a/debian/control b/debian/control
index d8361dd..b920475 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: x11
 Priority: optional
 Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
 Uploaders: Chris Lamb <lamby@debian.org>, Matthew Johnson <mjj29@debian.org>
-Build-Depends: debhelper (>= 7), pkg-config, xserver-xorg-dev (>= 2:1.2.99.902), x11proto-video-dev, x11proto-core-dev, x11proto-fonts-dev, x11proto-randr-dev (>= 1.2), x11proto-render-dev, x11proto-xext-dev, libdrm-dev (>= 2.4.11), x11proto-xf86dri-dev, x11proto-gl-dev, mesa-common-dev, automake, libtool, xutils-dev, xserver-xorg-dev
+Build-Depends: debhelper (>= 7), pkg-config, xserver-xorg-dev (>= 2:1.2.99.902), x11proto-video-dev, x11proto-core-dev, x11proto-fonts-dev, x11proto-randr-dev (>= 1.2), x11proto-render-dev, x11proto-xext-dev, libdrm-dev (>= 2.4.11+git+20090630), x11proto-xf86dri-dev, x11proto-gl-dev, mesa-common-dev, automake, libtool, xutils-dev, xserver-xorg-dev
 Standards-Version: 3.8.1
 Homepage: http://nouveau.freedesktop.org/wiki/
 Vcs-Git: git://git.debian.org/git/pkg-xorg/driver/xserver-xorg-video-nouveau

commit 4c4a1d4aff2edd7dba9a61eda1b148b401e4cef5
Author: Chris Lamb <lamby@debian.org>
Date:   Wed Jul 1 00:25:06 2009 +0100

    Add long changelog.

diff --git a/debian/changelog b/debian/changelog
index 9597320..89b600b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,55 @@
 xserver-xorg-video-nouveau (1:0.0.10~git+20090701+c0bf670-1) UNRELEASED; urgency=low
 
   * New upstream snapshot.
+    - c0bf670... wfb: fix stupid thinko + more safety
+    - a12cb5c... bios: oops
+    - e66867e... bios: use image from PRAMIN in preference to PROM on NV50
+    - 42c5730... wrap BlockHandler a little earlier
+    - 09e663a... kms: safer fb resize func
+    - 90be5d5... wfb: use straight memcpy hook if no tiled wraps present
+    - 86d905d... wfb: be more cautious in a few places
+    - 1bcbc4b... kms: small cleanup
+    - c2d3550... kms: fix rotation buffer pitch
+    - 6fd9829... kms: point rotation pixmap at correct buffer
+    - 67f8ebe... nv50: create non-linear scanout buffers for rotation
+    - b7e3306... Add DVI-A output info for Mac card missing bios tables 
+      (#21273)
+    - 01b19c9... nv50: sigh
+    - 4d9e63b... wfb: "mode0" tiles have the same pitch as the others
+    - 02ed6b6... wfb: work-around wfb suckage
+    - 669c59e... wfb: need a 64-bit datatype for multiply_factor
+    - 86dedb7... fix some pitch issues
+    - 794a277... nv50: use libwfb for pixmap access when driver pixmaps 
+      enabled
+    - 11d9690... exa: use the sane CreatePixmap hook, if available
+    - 6ee4533... xv: fix some issues with driver pixmaps
+    - 67c5287... exa: wait_marker becomes a NOP with driver pixmaps
+    - f44e528... nv50: make use of larger tile sizes
+    - 30c44ce... exa: create unacceleratable pixmaps (ie. 1bpp) in system 
+      memory
+    - 1aa22d5... nv50: use non-linear scanout buffer when driver pixmaps 
+      enabled
+    - 13d8d49... nv50: use tile_mode from bo
+    - bd9f5f2... exa: fix compile against latest libdrm_nouveau
+    - 5f97afe... randr12: split from pre-randr12 structs into new header, 
+      de-typedef
+    - 0c17b87... Move head getting into nouveau_hw.c
+    - 12314fa... randr12: improve uniformity of props code
+    - b541c1c... Remove "TMDS table script pointers not stubbed" bios warning
+    - 8af5028... Remove useless loader symbol lists.
+    - 317b581... randr12: disable lvds (invalidate all modes) if bios lvds 
+      parsing fails
+    - e897191... randr12: better behaviour (avoid crash) when fp native mode 
+      can't be found
+    - 0316748... randr12: line length improvements
+    - b60c16c... Simplify tests for digital fp outputs
+    - 992d4b5... randr12: a bunch of trivial improvements and tidyups
+    - 6f0a324... Fix oopsy from 81bbdd4e causing broken framebuffer
+    - c579918... randr12: fix two colour cursor on second head
+    - 81bbdd4... explicitly mark buffers mappable
+    - 6c09ad5... Tolerate missing fp bios table (rh#502371)
+    - db9ff95... kms: clip sw transition dims to smallest common area
+    - 2688c97... don't run vbios parser when kms enabled
 
  -- Chris Lamb <lamby@debian.org>  Wed, 01 Jul 2009 00:24:20 +0100
 

commit 4b0af6fb2de8d82e54f5131fe52a7bcaa472ba92
Author: Chris Lamb <lamby@debian.org>
Date:   Wed Jul 1 00:24:27 2009 +0100

    New upstream snapshot.

diff --git a/debian/changelog b/debian/changelog
index bfe275f..9597320 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+xserver-xorg-video-nouveau (1:0.0.10~git+20090701+c0bf670-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot.
+
+ -- Chris Lamb <lamby@debian.org>  Wed, 01 Jul 2009 00:24:20 +0100
+
 xserver-xorg-video-nouveau (1:0.0.10~git+20090519+9656762-1) experimental; urgency=low
 
   * New upstream snapshot (Closes: #526144, #524456)

commit c0bf670ac6b58cff60a01ab6b174ece6b1b7d892
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Thu Jun 25 07:26:54 2009 +1000

    wfb: fix stupid thinko + more safety

diff --git a/src/nouveau_wfb.c b/src/nouveau_wfb.c
index 7c60ed1..ae5f3af 100644
--- a/src/nouveau_wfb.c
+++ b/src/nouveau_wfb.c
@@ -125,7 +125,7 @@ void
 nouveau_wfb_setup_wrap(ReadMemoryProcPtr *pRead, WriteMemoryProcPtr *pWrite,
 		       DrawablePtr pDraw)
 {
-	struct nouveau_pixmap *nvpix;
+	struct nouveau_pixmap *nvpix = NULL;
 	struct wfb_pixmap *wfb;
 	PixmapPtr ppix = NULL;
 	int wrap, have_tiled = 0;
@@ -175,7 +175,6 @@ nouveau_wfb_setup_wrap(ReadMemoryProcPtr *pRead, WriteMemoryProcPtr *pWrite,
 void
 nouveau_wfb_finish_wrap(DrawablePtr pDraw)
 {
-	struct wfb_pixmap *wfb = &wfb_pixmap[0];
 	PixmapPtr ppix;
 	int i;
 
@@ -184,11 +183,11 @@ nouveau_wfb_finish_wrap(DrawablePtr pDraw)
 		return;
 
 	for (i = 0; i < 6; i++) {
-		if (wfb->ppix != ppix)
-			continue;
-
-		wfb->ppix = NULL;
-		break;
+		if (wfb_pixmap[i].ppix == ppix) {
+			wfb_pixmap[i].ppix = NULL;
+			wfb_pixmap[i].base = ~0UL;
+			break;
+		}
 	}
 }
 

commit a12cb5c8c0a85a601188178c5fc0d84a13abd87e
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Thu Jun 18 14:28:25 2009 +1000

    bios: oops

diff --git a/src/nv_bios.c b/src/nv_bios.c
index b307fc6..5578928 100644
--- a/src/nv_bios.c
+++ b/src/nv_bios.c
@@ -197,13 +197,15 @@ struct methods {
 static struct methods nv04_methods[] = {
 	{ "PROM", load_vbios_prom, false },
 	{ "PRAMIN", load_vbios_pramin, true },
-	{ "PCI ROM", load_vbios_pci, true }
+	{ "PCI ROM", load_vbios_pci, true },
+	{ }
 };
 
 static struct methods nv50_methods[] = {
 	{ "PRAMIN", load_vbios_pramin, true },
 	{ "PROM", load_vbios_prom, false },
-	{ "PCI ROM", load_vbios_pci, true }
+	{ "PCI ROM", load_vbios_pci, true },
+	{ }
 };
 
 static bool NVShadowVBIOS(ScrnInfoPtr pScrn, uint8_t *data)

commit e66867e4cf9f0bc8a1971664ccc3d5c56b08b2fb
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Tue Jun 16 10:28:00 2009 +1000

    bios: use image from PRAMIN in preference to PROM on NV50
    
    There's at least one known case (rh#492658) where the DCB table present in
    the VBIOS image from PROM is not suitable for use.  It contained all 16
    entries filled, each entry valid in itself, but contradicting other entries.
    
    The VBIOS image in PRAMIN however, still has all 16 entries filled, but the
    first few entries now match what is present on the hardware, and the rest
    are set as type 0xf, which we ignore.

diff --git a/src/nv_bios.c b/src/nv_bios.c
index 865b22d..b307fc6 100644
--- a/src/nv_bios.c
+++ b/src/nv_bios.c
@@ -187,42 +187,62 @@ static void load_vbios_pci(NVPtr pNv, uint8_t *data)
 #endif
 }
 
+struct methods {
+	const char desc[8];
+	void (*loadbios)(NVPtr, uint8_t *);
+	const bool rw;
+	int score;
+};
+
+static struct methods nv04_methods[] = {
+	{ "PROM", load_vbios_prom, false },
+	{ "PRAMIN", load_vbios_pramin, true },
+	{ "PCI ROM", load_vbios_pci, true }
+};
+
+static struct methods nv50_methods[] = {
+	{ "PRAMIN", load_vbios_pramin, true },
+	{ "PROM", load_vbios_prom, false },
+	{ "PCI ROM", load_vbios_pci, true }
+};
+
 static bool NVShadowVBIOS(ScrnInfoPtr pScrn, uint8_t *data)
 {
 	NVPtr pNv = NVPTR(pScrn);
-	struct methods {
-		const char desc[8];
-		void (*loadbios)(NVPtr, uint8_t *);
-		const bool rw;
-		int score;
-	} method[] = {
-		{ "PROM", load_vbios_prom, false },
-		{ "PRAMIN", load_vbios_pramin, true },
-		{ "PCI ROM", load_vbios_pci, true }
-	};
-	int i, testscore = 3;
-
-	for (i = 0; i < sizeof(method) / sizeof(struct methods); i++) {
+	struct methods *methods, *method;
+	int testscore = 3;
+
+	if (pNv->Architecture < NV_ARCH_50)
+		methods = nv04_methods;
+	else
+		methods = nv50_methods;
+
+	method = methods;
+	while (method->loadbios) {
 		NV_TRACE(pScrn, "Attempting to load BIOS image from %s\n",
-			 method[i].desc);
+			 method->desc);
 		data[0] = data[1] = 0;	/* avoid reuse of previous image */
-		method[i].loadbios(pNv, data);
-		method[i].score = score_vbios(pScrn, data, method[i].rw);
-		if (method[i].score == testscore)
+		method->loadbios(pNv, data);
+		method->score = score_vbios(pScrn, data, method->rw);
+		if (method->score == testscore)
 			return true;
+		method++;
 	}
 
-	while (--testscore > 0)
-		for (i = 0; i < sizeof(method) / sizeof(struct methods); i++)
-			if (method[i].score == testscore) {
+	while (--testscore > 0) {
+		method = methods;
+		while (method->loadbios) {
+			if (method->score == testscore) {
 				NV_TRACE(pScrn, "Using BIOS image from %s\n",
-					 method[i].desc);
-				method[i].loadbios(pNv, data);
+					 method->desc);
+				method->loadbios(pNv, data);
 				return true;
 			}
+			method++;
+		}
+	}
 
 	NV_ERROR(pScrn, "No valid BIOS image found\n");
-
 	return false;
 }
 

commit 42c5730a4f6c243b75fbd40f1dc26e8433191c7b
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Tue Jun 16 09:48:39 2009 +1000

    wrap BlockHandler a little earlier

diff --git a/src/nv_driver.c b/src/nv_driver.c
index 1afe882..24bec53 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -1919,7 +1919,6 @@ NVDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
 /* Mandatory */
 
 /* This gets called at the start of each server generation */
-
 static Bool
 NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 {
@@ -2117,6 +2116,14 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
 	NVInitVideo(pScreen);
 
+	/* Wrap the block handler here, if we do it after the EnterVT we
+	 * can end up in the unfortunate case where we've wrapped the
+	 * xf86RotateBlockHandler which sometimes is not expecting to
+	 * be in the wrap chain and calls a NULL pointer...
+	 */
+	pNv->BlockHandler = pScreen->BlockHandler;
+	pScreen->BlockHandler = NVBlockHandler;
+
 	pScrn->vtSema = TRUE;
 	pScrn->pScreen = pScreen;
 	if (!NVEnterVT(pScrn->scrnIndex, 0))
@@ -2160,9 +2167,6 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	pNv->CloseScreen = pScreen->CloseScreen;
 	pScreen->CloseScreen = NVCloseScreen;
 
-	pNv->BlockHandler = pScreen->BlockHandler;
-	pScreen->BlockHandler = NVBlockHandler;
-
 	/* Report any unused options (only for the first generation) */
 	if (serverGeneration == 1)
 		xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);

commit 09e663aea82403f69a0e44e3b7cd89dfe96970d5
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Mon Jun 15 16:09:27 2009 +1000

    kms: safer fb resize func

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9f43649..2d1b0a8 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -134,7 +134,6 @@ drmmode_fb_pixmap(ScrnInfoPtr pScrn, int id, unsigned *w, unsigned *h)
 {
 	ScreenPtr pScreen = pScrn->pScreen;
 	struct nouveau_pixmap *nvpix;
-	struct drm_gem_flink req;
 	NVPtr pNv = NVPTR(pScrn);
 	drmModeFBPtr fb;
 	PixmapPtr ppix;
@@ -930,15 +929,18 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
 }
 
 static Bool
-drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
+drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 {
-	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
-	drmmode_crtc_private_ptr drmmode_crtc = config->crtc[0]->driver_private;
-	drmmode_ptr drmmode = drmmode_crtc->drmmode;
+	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+	ScreenPtr screen = screenInfo.screens[scrn->scrnIndex];
 	NVPtr pNv = NVPTR(scrn);
+	drmmode_crtc_private_ptr
+		    drmmode_crtc = xf86_config->crtc[0]->driver_private;
+	drmmode_ptr drmmode = drmmode_crtc->drmmode;
+	uint32_t pitch, old_width, old_height, old_pitch, old_fb_id;
+	struct nouveau_bo *old_bo = NULL;
+	uint32_t tile_mode = 0, tile_flags = 0;
 	PixmapPtr ppix;
-	struct nouveau_bo *bo = NULL;
-	unsigned pitch, flags, tile_mode = 0, tile_flags = 0, old_id;
 	int ret, i;
 
 	ErrorF("resize called %d %d\n", width, height);
@@ -954,57 +956,71 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 	if (scrn->virtualX == width && scrn->virtualY == height)
 		return TRUE;
 
-	pitch = width * scrn->bitsPerPixel / 8;
-
-	flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP;
+	pitch = width * (scrn->bitsPerPixel >> 3);
 	if (pNv->Architecture >= NV_ARCH_50) {
 		tile_mode = 4;
 		tile_flags = 0x7a00;
 		height = NOUVEAU_ALIGN(height, 1 << (tile_mode + 2));
 	}
-
 	pitch = NOUVEAU_ALIGN(pitch, 64);
 
-	ret = nouveau_bo_new_tile(pNv->dev, flags, 0, pitch * height,
-				  tile_mode, tile_flags, &bo);
+	old_width = scrn->virtualX;
+	old_height = scrn->virtualY;
+	old_pitch = scrn->displayWidth;
+	old_fb_id = drmmode->fb_id;
+	nouveau_bo_ref(pNv->FB, &old_bo);
+	nouveau_bo_ref(NULL, &pNv->FB);
+
+	scrn->virtualX = width;
+	scrn->virtualY = height;
+	scrn->displayWidth = pitch / (scrn->bitsPerPixel >> 3);
+
+	ret = nouveau_bo_new_tile(pNv->dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP |
+				  NOUVEAU_BO_PIN, 0,
+				  pitch * height, tile_mode, tile_flags,
+				  &pNv->FB);
 	if (ret)
-		return FALSE;
+		goto fail;
 
-	/* work around libdrm_nouveau api issue... */
-	nouveau_bo_map(bo, NOUVEAU_BO_WR);
-	nouveau_bo_unmap(bo);
+	nouveau_bo_map(pNv->FB, NOUVEAU_BO_RDWR);
+	pNv->FBMap = pNv->FB->map;
+	nouveau_bo_unmap(pNv->FB);
 
-	old_id = drmmode->fb_id;
-	ret = drmModeAddFB(nouveau_device(pNv->dev)->fd, width, height,
-			   scrn->depth, scrn->bitsPerPixel, pitch,
-			   bo->handle, &drmmode->fb_id);
-	if (ret) {
-		nouveau_bo_ref(NULL, &bo);
-		return FALSE;
-	}
+	ret = drmModeAddFB(drmmode->fd, width, height, scrn->depth,
+			   scrn->bitsPerPixel, pitch, pNv->FB->handle,
+			   &drmmode->fb_id);
+	if (ret)
+		goto fail;
 
-	ppix = scrn->pScreen->GetScreenPixmap(scrn->pScreen);
-	miModifyPixmapHeader(ppix, width, height, -1, -1, pitch, NULL);
+	ppix = screen->GetScreenPixmap(screen);
 
-	nouveau_bo_ref(bo, &nouveau_pixmap(ppix)->bo);
+	nouveau_bo_ref(pNv->FB, &nouveau_pixmap(ppix)->bo);
+	screen->ModifyPixmapHeader(ppix, width, height, -1, -1, pitch, NULL);
 
-	for (i = 0; i < config->num_crtc; i++) {
-		xf86CrtcPtr crtc = config->crtc[i];
+	for (i = 0; i < xf86_config->num_crtc; i++) {
+		xf86CrtcPtr crtc = xf86_config->crtc[i];
 
 		if (!crtc->enabled)
 			continue;
 
-		drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
-				       crtc->x, crtc->y);
+		drmmode_set_mode_major(crtc, &crtc->mode,
+				       crtc->rotation, crtc->x, crtc->y);
 	}
 
-	if (old_id)
-		drmModeRmFB(drmmode->fd, old_id);
+	if (old_fb_id)
+		drmModeRmFB(drmmode->fd, old_fb_id);
+	nouveau_bo_ref(NULL, &old_bo);
 
-	scrn->virtualX = width;
-	scrn->virtualY = height;
-	scrn->displayWidth = pitch / (scrn->bitsPerPixel / 8);
 	return TRUE;
+
+ fail:
+	nouveau_bo_ref(old_bo, &pNv->FB);
+	scrn->virtualX = old_width;
+	scrn->virtualY = old_height;
+	scrn->displayWidth = old_pitch;
+	drmmode->fb_id = old_fb_id;
+
+	return FALSE;
 }
 
 static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {

commit 90be5d5d6a696564bda23e9a2dad14a3a1808868
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Mon Jun 15 13:43:21 2009 +1000

    wfb: use straight memcpy hook if no tiled wraps present

diff --git a/src/nouveau_wfb.c b/src/nouveau_wfb.c
index f7dc6e9..7c60ed1 100644
--- a/src/nouveau_wfb.c
+++ b/src/nouveau_wfb.c
@@ -128,7 +128,7 @@ nouveau_wfb_setup_wrap(ReadMemoryProcPtr *pRead, WriteMemoryProcPtr *pWrite,
 	struct nouveau_pixmap *nvpix;
 	struct wfb_pixmap *wfb;
 	PixmapPtr ppix = NULL;
-	int wrap;
+	int wrap, have_tiled = 0;
 
 	if (!pRead || !pWrite)
 		return;
@@ -143,8 +143,11 @@ nouveau_wfb_setup_wrap(ReadMemoryProcPtr *pRead, WriteMemoryProcPtr *pWrite,
 	}
 
 	wrap = 0;
-	while (wfb_pixmap[wrap].ppix)
+	while (wfb_pixmap[wrap].ppix) {
+		if (wfb_pixmap[wrap].pitch)
+			have_tiled = 1;
 		wrap++;
+	}
 	wfb = &wfb_pixmap[wrap];
 
 	wfb->ppix = ppix;
@@ -157,10 +160,16 @@ nouveau_wfb_setup_wrap(ReadMemoryProcPtr *pRead, WriteMemoryProcPtr *pWrite,
 		wfb->multiply_factor = (0xFFFFFFFF / wfb->pitch) + 1;
 		wfb->tile_height = nvpix->bo->tile_mode + 2;
 		wfb->horiz_tiles = wfb->pitch / 64;
+		have_tiled = 1;
 	}
 
-	*pRead = nouveau_wfb_rd_tiled;
-	*pWrite = nouveau_wfb_wr_tiled;
+	if (have_tiled) {
+		*pRead = nouveau_wfb_rd_tiled;
+		*pWrite = nouveau_wfb_wr_tiled;
+	} else {
+		*pRead = nouveau_wfb_rd_linear;
+		*pWrite = nouveau_wfb_wr_linear;
+	}
 }
 
 void

commit 86d905d34a5693e3d9b986660d4a2bcd6f30a06a
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Mon Jun 15 13:41:21 2009 +1000

    wfb: be more cautious in a few places

diff --git a/src/nouveau_wfb.c b/src/nouveau_wfb.c
index 08f6e14..f7dc6e9 100644
--- a/src/nouveau_wfb.c
+++ b/src/nouveau_wfb.c
@@ -127,16 +127,20 @@ nouveau_wfb_setup_wrap(ReadMemoryProcPtr *pRead, WriteMemoryProcPtr *pWrite,
 {
 	struct nouveau_pixmap *nvpix;
 	struct wfb_pixmap *wfb;
-	PixmapPtr ppix;
+	PixmapPtr ppix = NULL;
 	int wrap;
 
 	if (!pRead || !pWrite)
 		return;
 
 	ppix = NVGetDrawablePixmap(pDraw);
-	if (!ppix)
+	if (ppix)
+		nvpix = nouveau_pixmap(ppix);
+	if (!nvpix || !nvpix->bo) {
+		*pRead = nouveau_wfb_rd_linear;
+		*pWrite = nouveau_wfb_wr_linear;
 		return;
-	nvpix = nouveau_pixmap(ppix);
+	}
 
 	wrap = 0;
 	while (wfb_pixmap[wrap].ppix)
@@ -164,13 +168,18 @@ nouveau_wfb_finish_wrap(DrawablePtr pDraw)
 {
 	struct wfb_pixmap *wfb = &wfb_pixmap[0];
 	PixmapPtr ppix;
+	int i;
 
 	ppix = NVGetDrawablePixmap(pDraw);
 	if (!ppix)
 		return;
 
-	while (wfb->ppix != ppix)
-		wfb++;
-	wfb->ppix = NULL;
+	for (i = 0; i < 6; i++) {
+		if (wfb->ppix != ppix)
+			continue;
+
+		wfb->ppix = NULL;
+		break;
+	}
 }
 

commit 1bcbc4b26f71f90345bd82b836fc634e741aced8
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Mon Jun 15 10:19:53 2009 +1000

    kms: small cleanup

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 432a44e..9f43649 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -161,22 +161,7 @@ drmmode_fb_pixmap(ScrnInfoPtr pScrn, int id, unsigned *w, unsigned *h)
 			*h = fb->height;
 	}
 
-	/* This is kinda rediculous, libdrm_nouveau needs to be taught
-	 * how to create a nouveau_bo from a GEM handle, and not just
-	 * a GEM name.
-	 */
-	{
-		req.handle = fb->handle;
-		ret = ioctl(nouveau_device(pNv->dev)->fd, DRM_IOCTL_GEM_FLINK,
-					   &req);
-		if (ret) {
-			pScreen->DestroyPixmap(ppix);
-			drmFree(fb);
-			return NULL;
-		}
-	}
-
-	ret = nouveau_bo_handle_ref(pNv->dev, req.name, &nvpix->bo);
+	ret = nouveau_bo_wrap(pNv->dev, fb->handle, &nvpix->bo);
 	drmFree(fb);
 	if (ret) {
 		pScreen->DestroyPixmap(ppix);

commit c2d3550aafeb3e7c4df3334f0ac3554a8aa15da3
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Mon Jun 15 09:16:10 2009 +1000

    kms: fix rotation buffer pitch

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 31c541b..432a44e 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -382,7 +382,7 @@ drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;
 	NVPtr pNv = NVPTR(crtc->scrn);
 	uint32_t tile_mode = 0, tile_flags = 0;
-	int rotate_pitch, size, ah = height;
+	int rotate_pitch, ah = height;
 	int ret;
 
 	if (pNv->Architecture >= NV_ARCH_50) {
@@ -391,11 +391,10 @@ drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
 		ah = NOUVEAU_ALIGN(height, 1 << (tile_mode + 2));
 	}
 
-	rotate_pitch = crtc->scrn->displayWidth * drmmode->cpp;
-	size = rotate_pitch * ah;
+	rotate_pitch = NOUVEAU_ALIGN(width * drmmode->cpp, 64);
 
 	ret = nouveau_bo_new_tile(pNv->dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP, 0,
-				  size, tile_mode, tile_flags,
+				  rotate_pitch * ah, tile_mode, tile_flags,
 				  &drmmode_crtc->rotate_bo);
 	if (ret) {
 		xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,

commit 6fd982979e03ce3eace7dc7523c428aca2c30b4a
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Mon Jun 15 09:00:02 2009 +1000

    kms: point rotation pixmap at correct buffer

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 7a48a5d..31c541b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -454,6 +454,14 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
 		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 			   "Couldn't allocate shadow pixmap for rotated CRTC\n");
 	}
+
+	if (drmmode_crtc->rotate_bo) {
+		struct nouveau_pixmap *nvpix = nouveau_pixmap(rotate_pixmap);
+
+		if (nvpix)
+			nouveau_bo_ref(drmmode_crtc->rotate_bo, &nvpix->bo);
+	}
+
 	return rotate_pixmap;
 
 }

commit 67f8ebe77f047c12d76e508b4d7f6384baed39ac
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Mon Jun 15 08:52:36 2009 +1000

    nv50: create non-linear scanout buffers for rotation

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 3470e49..7a48a5d 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -381,15 +381,22 @@ drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;
 	NVPtr pNv = NVPTR(crtc->scrn);
-	int size;
-	unsigned long rotate_pitch;
+	uint32_t tile_mode = 0, tile_flags = 0;
+	int rotate_pitch, size, ah = height;
 	int ret;
 
+	if (pNv->Architecture >= NV_ARCH_50) {
+		tile_mode = 4;
+		tile_flags = 0x7a00;
+		ah = NOUVEAU_ALIGN(height, 1 << (tile_mode + 2));
+	}
+
 	rotate_pitch = crtc->scrn->displayWidth * drmmode->cpp;
-	size = rotate_pitch * height;
+	size = rotate_pitch * ah;
 
-	ret = nouveau_bo_new(pNv->dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP, 0,
-			     size, &drmmode_crtc->rotate_bo);
+	ret = nouveau_bo_new_tile(pNv->dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP, 0,
+				  size, tile_mode, tile_flags,
+				  &drmmode_crtc->rotate_bo);
 	if (ret) {
 		xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
 			   "Couldn't allocate shadow memory for rotated CRTC\n");

commit b7e3306ddc3693699f6f9de7b22913ee22ed31ed
Author: Stuart Bennett <stuart@freedesktop.org>
Date:   Sun May 31 00:26:13 2009 +0100

    Add DVI-A output info for Mac card missing bios tables (#21273)
    
    The reporter indicates the card also has DVI-D and ADC, but those can't be
    tested to deduce the fake correct data at present

diff --git a/src/nv_bios.c b/src/nv_bios.c
index 182456a..865b22d 100644
--- a/src/nv_bios.c
+++ b/src/nv_bios.c
@@ -4050,10 +4050,15 @@ static int parse_bmp_structure(ScrnInfoPtr pScrn, struct nvbios *bios, unsigned
 	bios->legacy.i2c_indices.crt = bios->data[legacy_i2c_offset];
 	bios->legacy.i2c_indices.tv = bios->data[legacy_i2c_offset + 1];
 	bios->legacy.i2c_indices.panel = bios->data[legacy_i2c_offset + 2];
-	bios->bdcb.dcb.i2c[0].write = bios->data[legacy_i2c_offset + 4];
-	bios->bdcb.dcb.i2c[0].read = bios->data[legacy_i2c_offset + 5];
-	bios->bdcb.dcb.i2c[1].write = bios->data[legacy_i2c_offset + 6];
-	bios->bdcb.dcb.i2c[1].read = bios->data[legacy_i2c_offset + 7];
+	/* don't overwrite defaults with zero (mac braindamage) */
+	if (bios->data[legacy_i2c_offset + 4])
+		bios->bdcb.dcb.i2c[0].write = bios->data[legacy_i2c_offset + 4];
+	if (bios->data[legacy_i2c_offset + 5])
+		bios->bdcb.dcb.i2c[0].read = bios->data[legacy_i2c_offset + 5];
+	if (bios->data[legacy_i2c_offset + 6])
+		bios->bdcb.dcb.i2c[1].write = bios->data[legacy_i2c_offset + 6];
+	if (bios->data[legacy_i2c_offset + 7])
+		bios->bdcb.dcb.i2c[1].read = bios->data[legacy_i2c_offset + 7];
 
 	if (bmplength > 74) {
 		bios->fmaxvco = ROM32(bmp[67]);
@@ -4205,7 +4210,8 @@ static struct dcb_entry * new_dcb_entry(struct parsed_dcb *dcb)
 	return entry;
 }
 
-static void fabricate_vga_output(struct parsed_dcb *dcb, int i2c, int heads)
+static void
+fabricate_vga_output(struct parsed_dcb *dcb, int i2c, int heads, int or)
 {
 	struct dcb_entry *entry = new_dcb_entry(dcb);
 
@@ -4213,7 +4219,8 @@ static void fabricate_vga_output(struct parsed_dcb *dcb, int i2c, int heads)
 	entry->i2c_index = i2c;
 	entry->heads = heads;
 	entry->location = DCB_LOC_ON_CHIP;
-	/* "or" mostly unused in early gen crt modesetting, 0 is fine */
+	/* setting "or" to 0 for early gen crt modesetting is fine (unused) */
+	entry->or = or;
 }
 
 static void fabricate_dvi_i_output(struct parsed_dcb *dcb, bool twoHeads)
@@ -4238,7 +4245,7 @@ static void fabricate_dvi_i_output(struct parsed_dcb *dcb, bool twoHeads)
 	 *
 	 * with this introduction, dvi-a left as an exercise for the reader.
 	 */
-	fabricate_vga_output(dcb, LEGACY_I2C_PANEL, entry->heads);
+	fabricate_vga_output(dcb, LEGACY_I2C_PANEL, entry->heads, 0);
 #endif
 }
 
@@ -4365,7 +4372,7 @@ parse_dcb15_entry(ScrnInfoPtr pScrn, struct parsed_dcb *dcb,
 	case OUTPUT_TMDS:
 		/* invent a DVI-A output, by copying the fields of the DVI-D
 		 * output; reported to work by math_b on an NV20(!) */
-		fabricate_vga_output(dcb, entry->i2c_index, entry->heads);
+		fabricate_vga_output(dcb, entry->i2c_index, entry->heads, 0);
 	}
 
 	return true;
@@ -4454,10 +4461,19 @@ static int parse_dcb_table(ScrnInfoPtr pScrn, struct nvbios *bios, bool twoHeads
 	dcbptr = ROM16(bios->data[0x36]);
 
 	if (dcbptr == 0x0) {
+#ifdef __powerpc__
+		if ((NVPTR(pScrn)->Chipset & 0xffff) == 0x0172) {
+			/* retarded PowerMac G4 has DVI and ADC (#21273) */
+			NV_WARN(pScrn, "Working around missing output tables\n");
+			/* this is the dvi-a */
+			fabricate_vga_output(dcb, LEGACY_I2C_PANEL, 0x3, 2);
+			return 0;
+		}
+#endif
 		NV_WARN(pScrn, "No output data (DCB) found in BIOS, "
 			       "assuming a CRT output exists\n");
 		/* this situation likely means a really old card, pre DCB */
-		fabricate_vga_output(dcb, LEGACY_I2C_CRT, 1);
+		fabricate_vga_output(dcb, LEGACY_I2C_CRT, 1, 0);
 		return 0;
 	}
 
@@ -4517,7 +4533,7 @@ static int parse_dcb_table(ScrnInfoPtr pScrn, struct nvbios *bios, bool twoHeads
 		 */
 		NV_TRACEWARN(pScrn, "No useful information in BIOS output table; "
 				    "adding all possible outputs\n");
-		fabricate_vga_output(dcb, LEGACY_I2C_CRT, 1);
+		fabricate_vga_output(dcb, LEGACY_I2C_CRT, 1, 0);
 		if (bios->tmds.output0_script_ptr ||
 		    bios->tmds.output1_script_ptr)
 			fabricate_dvi_i_output(dcb, twoHeads);

commit 01b19c9fc25b147596e1719008ed9d861246ced9
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Wed Jun 10 18:00:05 2009 +1000

    nv50: sigh

diff --git a/src/nouveau_hw.h b/src/nouveau_hw.h
index 98c0b13..ffd3140 100644
--- a/src/nouveau_hw.h
+++ b/src/nouveau_hw.h
@@ -326,7 +326,7 @@ static inline uint32_t nv_pitch_align(NVPtr pNv, uint32_t width, int bpp)
 	/* Alignment requirements taken from the Haiku driver */
 	if (pNv->Architecture == NV_ARCH_04)
 		mask = 128 / bpp - 1;
-	if (pNv->Architecture >= NV_ARCH_50)
+	if (pNv->Architecture >= NV_ARCH_50 && pNv->exa_driver_pixmaps)
 		mask = 64 / bpp - 1;
 	else
 		mask = 512 / bpp - 1;

commit 4d9e63baff079fad727430fc605cb1e43c4303a7
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Wed Jun 10 11:38:43 2009 +1000

    wfb: "mode0" tiles have the same pitch as the others
    
    This appears to be the case now (as in: after making the GPU do some of the
    dirty work) even though it didn't in the previous wfb patches.

diff --git a/src/nouveau_wfb.c b/src/nouveau_wfb.c
index 2a64a4a..08f6e14 100644
--- a/src/nouveau_wfb.c
+++ b/src/nouveau_wfb.c
@@ -33,7 +33,6 @@ struct wfb_pixmap {
 	unsigned long end;
 	unsigned pitch;
 	unsigned tile_height;
-	unsigned tile_pitch;
 	unsigned horiz_tiles;
 	uint64_t multiply_factor;
 };
@@ -55,10 +54,10 @@ nouveau_wfb_wr_linear(void *dst, FbBits value, int size)
 	memcpy(dst, &value, size);
 }
 
-#define TP wfb->tile_pitch
+#define TP 6
 #define TH wfb->tile_height
-#define TPM ((1 << wfb->tile_pitch) - 1)
-#define THM ((1 << wfb->tile_height) - 1)
+#define TPM ((1 << TP) - 1)
+#define THM ((1 << TH) - 1)
 
 static FbBits
 nouveau_wfb_rd_tiled(const void *ptr, int size) {
@@ -75,7 +74,7 @@ nouveau_wfb_rd_tiled(const void *ptr, int size) {
 		}
 	}
 
-	if (!wfb || !wfb->tile_pitch)
+	if (!wfb || !wfb->pitch)
 		return nouveau_wfb_rd_linear(ptr, size);
 
 	offset -= wfb->base;
@@ -105,7 +104,7 @@ nouveau_wfb_wr_tiled(void *ptr, FbBits value, int size) {
 		}
 	}
 
-	if (!wfb || !wfb->tile_pitch) {
+	if (!wfb || !wfb->pitch) {
 		nouveau_wfb_wr_linear(ptr, value, size);
 		return;
 	}
@@ -148,13 +147,12 @@ nouveau_wfb_setup_wrap(ReadMemoryProcPtr *pRead, WriteMemoryProcPtr *pWrite,
 	wfb->base = (unsigned long)ppix->devPrivate.ptr;


Reply to: