diff --git a/packages/linux/patches/linux-2.6.37-rc3-110-drm_nouveau_upstream-20101122.patch b/packages/linux/patches/linux-2.6.37-rc3-110-drm_nouveau_upstream-20101205.patch similarity index 95% rename from packages/linux/patches/linux-2.6.37-rc3-110-drm_nouveau_upstream-20101122.patch rename to packages/linux/patches/linux-2.6.37-rc3-110-drm_nouveau_upstream-20101205.patch index eadd453274..118d59f7e6 100644 --- a/packages/linux/patches/linux-2.6.37-rc3-110-drm_nouveau_upstream-20101122.patch +++ b/packages/linux/patches/linux-2.6.37-rc3-110-drm_nouveau_upstream-20101205.patch @@ -1,6 +1,6 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/Makefile linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/Makefile --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/Makefile 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/Makefile 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/Makefile 2010-12-03 04:56:22.000000000 +0100 @@ -5,7 +5,7 @@ ccflags-y := -Iinclude/drm nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \ @@ -23,7 +23,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/Makefile linux-2.6.37-rc3.no nv04_crtc.o nv04_display.o nv04_cursor.o nv04_fbcon.o \ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bios.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_bios.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bios.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_bios.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_bios.c 2010-12-03 04:56:22.000000000 +0100 @@ -6039,7 +6039,6 @@ if (type != cte->type) NV_WARN(dev, " -> type 0x%02x\n", cte->type); @@ -177,7 +177,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bios.c linux-2.6.37- diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bo.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_bo.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bo.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_bo.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_bo.c 2010-12-03 04:56:22.000000000 +0100 @@ -46,9 +46,7 @@ if (unlikely(nvbo->gem)) DRM_ERROR("bo %p still attached to GEM object\n", bo); @@ -189,7 +189,46 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bo.c linux-2.6.37-rc kfree(nvbo); } -@@ -426,8 +424,9 @@ +@@ -244,7 +242,7 @@ + + nouveau_bo_placement_set(nvbo, memtype, 0); + +- ret = ttm_bo_validate(bo, &nvbo->placement, false, false, false); ++ ret = nouveau_bo_validate(nvbo, false, false, false); + if (ret == 0) { + switch (bo->mem.mem_type) { + case TTM_PL_VRAM: +@@ -280,7 +278,7 @@ + + nouveau_bo_placement_set(nvbo, bo->mem.placement, 0); + +- ret = ttm_bo_validate(bo, &nvbo->placement, false, false, false); ++ ret = nouveau_bo_validate(nvbo, false, false, false); + if (ret == 0) { + switch (bo->mem.mem_type) { + case TTM_PL_VRAM: +@@ -319,6 +317,20 @@ + ttm_bo_kunmap(&nvbo->kmap); + } + ++int ++nouveau_bo_validate(struct nouveau_bo *nvbo, bool interruptible, ++ bool no_wait_reserve, bool no_wait_gpu) ++{ ++ int ret; ++ ++ ret = ttm_bo_validate(&nvbo->bo, &nvbo->placement, interruptible, ++ no_wait_reserve, no_wait_gpu); ++ if (ret) ++ return ret; ++ ++ return 0; ++} ++ + u16 + nouveau_bo_rd16(struct nouveau_bo *nvbo, unsigned index) + { +@@ -426,8 +438,9 @@ switch (dev_priv->gart_info.type) { case NOUVEAU_GART_AGP: man->flags = TTM_MEMTYPE_FLAG_MAPPABLE; @@ -201,7 +240,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bo.c linux-2.6.37-rc break; case NOUVEAU_GART_SGDMA: man->flags = TTM_MEMTYPE_FLAG_MAPPABLE | -@@ -485,16 +484,9 @@ +@@ -485,16 +498,9 @@ if (ret) return ret; @@ -219,7 +258,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bo.c linux-2.6.37-rc return ret; } -@@ -683,17 +675,24 @@ +@@ -683,17 +689,24 @@ int ret; chan = nvbo->channel; @@ -248,7 +287,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bo.c linux-2.6.37-rc } static int -@@ -792,7 +791,8 @@ +@@ -792,7 +805,8 @@ } else if (dev_priv->card_type >= NV_10) { *new_tile = nv10_mem_set_tiling(dev, offset, new_mem->size, @@ -258,7 +297,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bo.c linux-2.6.37-rc } return 0; -@@ -808,9 +808,7 @@ +@@ -808,9 +822,7 @@ if (dev_priv->card_type >= NV_10 && dev_priv->card_type < NV_50) { @@ -269,10 +308,14 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bo.c linux-2.6.37-rc *old_tile = new_tile; } } -@@ -942,6 +940,22 @@ - return ttm_bo_validate(bo, &nvbo->placement, false, true, false); - } - +@@ -939,7 +951,23 @@ + nvbo->placement.fpfn = 0; + nvbo->placement.lpfn = dev_priv->fb_mappable_pages; + nouveau_bo_placement_set(nvbo, TTM_PL_VRAM, 0); +- return ttm_bo_validate(bo, &nvbo->placement, false, true, false); ++ return nouveau_bo_validate(nvbo, false, true, false); ++} ++ +void +nouveau_bo_fence(struct nouveau_bo *nvbo, struct nouveau_fence *fence) +{ @@ -287,12 +330,10 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bo.c linux-2.6.37-rc + spin_unlock(&nvbo->bo.lock); + + nouveau_fence_unref(&old_fence); -+} -+ + } + struct ttm_bo_driver nouveau_bo_driver = { - .create_ttm_backend_entry = nouveau_bo_create_ttm_backend_entry, - .invalidate_caches = nouveau_bo_invalidate_caches, -@@ -949,11 +963,11 @@ +@@ -949,11 +977,11 @@ .evict_flags = nouveau_bo_evict_flags, .move = nouveau_bo_move, .verify_access = nouveau_bo_verify_access, @@ -311,7 +352,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_bo.c linux-2.6.37-rc .io_mem_free = &nouveau_ttm_io_mem_free, diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_channel.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_channel.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_channel.c 2010-12-03 04:56:22.000000000 +0100 @@ -39,22 +39,22 @@ if (dev_priv->card_type >= NV_50) { @@ -358,7 +399,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. chan->pushbuf_base = pb->bo.mem.start << PAGE_SHIFT; } -@@ -107,53 +106,56 @@ +@@ -107,74 +106,60 @@ int nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, struct drm_file *file_priv, @@ -370,9 +411,8 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; struct nouveau_channel *chan; - int channel, user; -- int ret; + unsigned long flags; -+ int user, ret; + int ret; - /* - * Alright, here is the full story @@ -444,30 +484,28 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. return ret; } -@@ -161,18 +163,18 @@ - - /* Locate channel's user control regs */ - if (dev_priv->card_type < NV_40) + nouveau_dma_pre_init(chan); +- +- /* Locate channel's user control regs */ +- if (dev_priv->card_type < NV_40) - user = NV03_USER(channel); -+ user = NV03_USER(chan->id); - else - if (dev_priv->card_type < NV_50) +- else +- if (dev_priv->card_type < NV_50) - user = NV40_USER(channel); -+ user = NV40_USER(chan->id); - else +- else - user = NV50_USER(channel); -+ user = NV50_USER(chan->id); - - chan->user = ioremap(pci_resource_start(dev->pdev, 0) + user, - PAGE_SIZE); - if (!chan->user) { - NV_ERROR(dev, "ioremap of regs failed.\n"); +- +- chan->user = ioremap(pci_resource_start(dev->pdev, 0) + user, +- PAGE_SIZE); +- if (!chan->user) { +- NV_ERROR(dev, "ioremap of regs failed.\n"); - nouveau_channel_free(chan); -+ nouveau_channel_put(&chan); - return -ENOMEM; - } +- return -ENOMEM; +- } chan->user_put = 0x40; -@@ -182,15 +184,15 @@ + chan->user_get = 0x44; + +@@ -182,15 +167,15 @@ ret = nouveau_notifier_init_channel(chan); if (ret) { NV_ERROR(dev, "ntfy %d\n", ret); @@ -486,7 +524,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. return ret; } -@@ -198,7 +200,7 @@ +@@ -198,7 +183,7 @@ ret = nouveau_channel_pushbuf_ctxdma_init(chan); if (ret) { NV_ERROR(dev, "pbctxdma %d\n", ret); @@ -495,7 +533,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. return ret; } -@@ -206,16 +208,18 @@ +@@ -206,16 +191,18 @@ pfifo->reassign(dev, false); /* Create a graphics context for new channel */ @@ -519,7 +557,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. return ret; } -@@ -225,83 +229,108 @@ +@@ -225,83 +212,108 @@ if (!ret) ret = nouveau_fence_channel_init(chan); if (ret) { @@ -606,13 +644,13 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. - ret = nouveau_fence_wait(fence, NULL, false, false); - nouveau_fence_unref((void *)&fence); - } -- -- if (ret) -- NV_ERROR(dev, "Failed to idle channel %d.\n", chan->id); -- } + /* give it chance to idle */ + nouveau_channel_idle(chan); +- if (ret) +- NV_ERROR(dev, "Failed to idle channel %d.\n", chan->id); +- } +- - /* Ensure all outstanding fences are signaled. They should be if the + /* ensure all outstanding fences are signaled. they should be if the * above attempts at idling were OK, but if we failed this'll tell TTM @@ -669,11 +707,14 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. nouveau_gpuobj_ref(NULL, &chan->pushbuf); if (chan->pushbuf_bo) { nouveau_bo_unmap(chan->pushbuf_bo); -@@ -310,44 +339,83 @@ +@@ -310,44 +322,80 @@ } nouveau_gpuobj_channel_takedown(chan); nouveau_notifier_takedown_channel(chan); -+ +- if (chan->user) +- iounmap(chan->user); + +- dev_priv->fifos[chan->id] = NULL; + nouveau_channel_ref(NULL, pchan); +} + @@ -690,10 +731,6 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. + struct nouveau_channel *chan = + container_of(ref, struct nouveau_channel, ref); + - if (chan->user) - iounmap(chan->user); - -- dev_priv->fifos[chan->id] = NULL; kfree(chan); } @@ -771,7 +808,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. /*********************************** * ioctls wrapping the functions -@@ -395,24 +463,26 @@ +@@ -395,24 +443,26 @@ /* Named memory object area */ ret = drm_gem_handle_create(file_priv, chan->notifier_bo->gem, &init->notifier_handle); @@ -806,7 +843,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. return 0; } -@@ -421,18 +491,18 @@ +@@ -421,18 +471,18 @@ ***********************************/ struct drm_ioctl_desc nouveau_ioctls[] = { @@ -839,7 +876,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_channel.c linux-2.6. int nouveau_max_ioctl = DRM_ARRAY_SIZE(nouveau_ioctls); diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_connector.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_connector.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_connector.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_connector.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_connector.c 2010-12-03 04:56:22.000000000 +0100 @@ -37,6 +37,8 @@ #include "nouveau_connector.h" #include "nouveau_hw.h" @@ -938,7 +975,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_connector.c linux-2. +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_display.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_display.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_display.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_display.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_display.c 2010-12-03 04:56:22.000000000 +0100 @@ -29,6 +29,9 @@ #include "nouveau_drv.h" #include "nouveau_fb.h" @@ -1157,9 +1194,32 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_display.c linux-2.6. + spin_unlock_irqrestore(&dev->event_lock, flags); + return 0; +} +diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_dma.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_dma.c +--- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_dma.c 2010-11-22 00:18:56.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_dma.c 2010-12-03 04:56:22.000000000 +0100 +@@ -59,17 +59,11 @@ + { + struct drm_device *dev = chan->dev; + struct drm_nouveau_private *dev_priv = dev->dev_private; +- struct nouveau_gpuobj *obj = NULL; + int ret, i; + + /* Create NV_MEMORY_TO_MEMORY_FORMAT for buffer moves */ +- ret = nouveau_gpuobj_gr_new(chan, dev_priv->card_type < NV_50 ? +- 0x0039 : 0x5039, &obj); +- if (ret) +- return ret; +- +- ret = nouveau_ramht_insert(chan, NvM2MF, obj); +- nouveau_gpuobj_ref(NULL, &obj); ++ ret = nouveau_gpuobj_gr_new(chan, NvM2MF, dev_priv->card_type < NV_50 ? ++ 0x0039 : 0x5039); + if (ret) + return ret; + diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_dp.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_dp.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_dp.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_dp.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_dp.c 2010-12-03 04:56:22.000000000 +0100 @@ -279,7 +279,7 @@ struct bit_displayport_encoder_table *dpe; int dpe_headerlen; @@ -1189,7 +1249,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_dp.c linux-2.6.37-rc } diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_drv.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_drv.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_drv.c 2010-12-03 04:56:22.000000000 +0100 @@ -115,6 +115,10 @@ int nouveau_perflvl_wr; module_param_named(perflvl_wr, nouveau_perflvl_wr, int, 0400); @@ -1314,7 +1374,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.c linux-2.6.37-r } diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_drv.h --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_drv.h 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_drv.h 2010-12-03 04:56:22.000000000 +0100 @@ -54,6 +54,7 @@ #include "nouveau_drm.h" #include "nouveau_reg.h" @@ -1640,7 +1700,20 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern int nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state); extern int nouveau_pci_resume(struct pci_dev *pdev); -@@ -775,13 +808,12 @@ +@@ -762,8 +795,10 @@ + struct drm_file *); + extern int nouveau_ioctl_setparam(struct drm_device *, void *data, + struct drm_file *); +-extern bool nouveau_wait_until(struct drm_device *, uint64_t timeout, +- uint32_t reg, uint32_t mask, uint32_t val); ++extern bool nouveau_wait_eq(struct drm_device *, uint64_t timeout, ++ uint32_t reg, uint32_t mask, uint32_t val); ++extern bool nouveau_wait_ne(struct drm_device *, uint64_t timeout, ++ uint32_t reg, uint32_t mask, uint32_t val); + extern bool nouveau_wait_for_idle(struct drm_device *); + extern int nouveau_card_init(struct drm_device *); + +@@ -775,13 +810,12 @@ extern int nouveau_mem_init_agp(struct drm_device *); extern int nouveau_mem_reset_agp(struct drm_device *); extern void nouveau_mem_close(struct drm_device *); @@ -1660,7 +1733,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern int nv50_mem_vm_bind_linear(struct drm_device *, uint64_t virt, uint32_t size, uint32_t flags, uint64_t phys); -@@ -803,21 +835,44 @@ +@@ -803,21 +837,44 @@ extern struct drm_ioctl_desc nouveau_ioctls[]; extern int nouveau_max_ioctl; extern void nouveau_channel_cleanup(struct drm_device *, struct drm_file *); @@ -1709,7 +1782,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern int nouveau_gpuobj_channel_init(struct nouveau_channel *, uint32_t vram_h, uint32_t tt_h); extern void nouveau_gpuobj_channel_takedown(struct nouveau_channel *); -@@ -832,21 +887,26 @@ +@@ -832,21 +889,25 @@ extern int nouveau_gpuobj_dma_new(struct nouveau_channel *, int class, uint64_t offset, uint64_t size, int access, int target, struct nouveau_gpuobj **); @@ -1717,10 +1790,11 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r - uint64_t offset, uint64_t size, - int access, struct nouveau_gpuobj **, - uint32_t *o_ret); - extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, int class, - struct nouveau_gpuobj **); +-extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, int class, +- struct nouveau_gpuobj **); -extern int nouveau_gpuobj_sw_new(struct nouveau_channel *, int class, - struct nouveau_gpuobj **); ++extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, u32 handle, int class); +extern int nv50_gpuobj_dma_new(struct nouveau_channel *, int class, u64 base, + u64 size, int target, int access, u32 type, + u32 comp, struct nouveau_gpuobj **pobj); @@ -1742,7 +1816,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern void nouveau_irq_preinstall(struct drm_device *); extern int nouveau_irq_postinstall(struct drm_device *); extern void nouveau_irq_uninstall(struct drm_device *); -@@ -966,18 +1026,25 @@ +@@ -966,18 +1027,25 @@ /* nv10_fb.c */ extern int nv10_fb_init(struct drm_device *); extern void nv10_fb_takedown(struct drm_device *); @@ -1772,7 +1846,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r /* nv50_fb.c */ extern int nv50_fb_init(struct drm_device *); extern void nv50_fb_takedown(struct drm_device *); -@@ -989,6 +1056,7 @@ +@@ -989,6 +1057,7 @@ /* nv04_fifo.c */ extern int nv04_fifo_init(struct drm_device *); @@ -1780,7 +1854,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern void nv04_fifo_disable(struct drm_device *); extern void nv04_fifo_enable(struct drm_device *); extern bool nv04_fifo_reassign(struct drm_device *, bool); -@@ -998,19 +1066,18 @@ +@@ -998,19 +1067,18 @@ extern void nv04_fifo_destroy_context(struct nouveau_channel *); extern int nv04_fifo_load_context(struct nouveau_channel *); extern int nv04_fifo_unload_context(struct drm_device *); @@ -1801,7 +1875,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern int nv40_fifo_load_context(struct nouveau_channel *); extern int nv40_fifo_unload_context(struct drm_device *); -@@ -1038,7 +1105,6 @@ +@@ -1038,7 +1106,6 @@ extern int nvc0_fifo_unload_context(struct drm_device *); /* nv04_graph.c */ @@ -1809,7 +1883,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern int nv04_graph_init(struct drm_device *); extern void nv04_graph_takedown(struct drm_device *); extern void nv04_graph_fifo_access(struct drm_device *, bool); -@@ -1047,10 +1113,11 @@ +@@ -1047,10 +1114,11 @@ extern void nv04_graph_destroy_context(struct nouveau_channel *); extern int nv04_graph_load_context(struct nouveau_channel *); extern int nv04_graph_unload_context(struct drm_device *); @@ -1823,7 +1897,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern int nv10_graph_init(struct drm_device *); extern void nv10_graph_takedown(struct drm_device *); extern struct nouveau_channel *nv10_graph_channel(struct drm_device *); -@@ -1058,13 +1125,11 @@ +@@ -1058,13 +1126,11 @@ extern void nv10_graph_destroy_context(struct nouveau_channel *); extern int nv10_graph_load_context(struct nouveau_channel *); extern int nv10_graph_unload_context(struct drm_device *); @@ -1840,7 +1914,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern int nv20_graph_create_context(struct nouveau_channel *); extern void nv20_graph_destroy_context(struct nouveau_channel *); extern int nv20_graph_load_context(struct nouveau_channel *); -@@ -1072,11 +1137,9 @@ +@@ -1072,11 +1138,9 @@ extern int nv20_graph_init(struct drm_device *); extern void nv20_graph_takedown(struct drm_device *); extern int nv30_graph_init(struct drm_device *); @@ -1853,7 +1927,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern int nv40_graph_init(struct drm_device *); extern void nv40_graph_takedown(struct drm_device *); extern struct nouveau_channel *nv40_graph_channel(struct drm_device *); -@@ -1085,11 +1148,9 @@ +@@ -1085,11 +1149,9 @@ extern int nv40_graph_load_context(struct nouveau_channel *); extern int nv40_graph_unload_context(struct drm_device *); extern void nv40_grctx_init(struct nouveau_grctx *); @@ -1866,7 +1940,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern int nv50_graph_init(struct drm_device *); extern void nv50_graph_takedown(struct drm_device *); extern void nv50_graph_fifo_access(struct drm_device *, bool); -@@ -1098,7 +1159,6 @@ +@@ -1098,7 +1160,6 @@ extern void nv50_graph_destroy_context(struct nouveau_channel *); extern int nv50_graph_load_context(struct nouveau_channel *); extern int nv50_graph_unload_context(struct drm_device *); @@ -1874,7 +1948,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern int nv50_grctx_init(struct nouveau_grctx *); extern void nv50_graph_tlb_flush(struct drm_device *dev); extern void nv86_graph_tlb_flush(struct drm_device *dev); -@@ -1113,16 +1173,22 @@ +@@ -1113,16 +1174,22 @@ extern int nvc0_graph_load_context(struct nouveau_channel *); extern int nvc0_graph_unload_context(struct drm_device *); @@ -1902,7 +1976,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern void nv04_instmem_flush(struct drm_device *); /* nv50_instmem.c */ -@@ -1130,11 +1196,10 @@ +@@ -1130,11 +1197,10 @@ extern void nv50_instmem_takedown(struct drm_device *); extern int nv50_instmem_suspend(struct drm_device *); extern void nv50_instmem_resume(struct drm_device *); @@ -1918,7 +1992,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern void nv50_instmem_flush(struct drm_device *); extern void nv84_instmem_flush(struct drm_device *); extern void nv50_vm_flush(struct drm_device *, int engine); -@@ -1144,11 +1209,10 @@ +@@ -1144,11 +1210,10 @@ extern void nvc0_instmem_takedown(struct drm_device *); extern int nvc0_instmem_suspend(struct drm_device *); extern void nvc0_instmem_resume(struct drm_device *); @@ -1934,15 +2008,17 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r extern void nvc0_instmem_flush(struct drm_device *); /* nv04_mc.c */ -@@ -1219,6 +1283,7 @@ +@@ -1219,6 +1284,9 @@ extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val); extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index); extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val); +extern void nouveau_bo_fence(struct nouveau_bo *, struct nouveau_fence *); ++extern int nouveau_bo_validate(struct nouveau_bo *, bool interruptible, ++ bool no_wait_reserve, bool no_wait_gpu); /* nouveau_fence.c */ struct nouveau_fence; -@@ -1234,12 +1299,35 @@ +@@ -1234,12 +1302,35 @@ void (*work)(void *priv, bool signalled), void *priv); struct nouveau_channel *nouveau_fence_channel(struct nouveau_fence *); @@ -1983,7 +2059,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r /* nouveau_gem.c */ extern int nouveau_gem_new(struct drm_device *, struct nouveau_channel *, -@@ -1259,15 +1347,28 @@ +@@ -1259,15 +1350,28 @@ extern int nouveau_gem_ioctl_info(struct drm_device *, void *, struct drm_file *); @@ -2013,7 +2089,18 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r /* nv50_calc. */ int nv50_calc_pll(struct drm_device *, struct pll_lims *, int clk, -@@ -1447,6 +1548,22 @@ +@@ -1334,7 +1438,9 @@ + } + + #define nv_wait(dev, reg, mask, val) \ +- nouveau_wait_until(dev, 2000000000ULL, (reg), (mask), (val)) ++ nouveau_wait_eq(dev, 2000000000ULL, (reg), (mask), (val)) ++#define nv_wait_ne(dev, reg, mask, val) \ ++ nouveau_wait_ne(dev, 2000000000ULL, (reg), (mask), (val)) + + /* PRAMIN access */ + static inline u32 nv_ri32(struct drm_device *dev, unsigned offset) +@@ -1447,6 +1553,22 @@ dev->pdev->subsystem_device == sub_device; } @@ -2036,7 +2123,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r #define NV_SW 0x0000506e #define NV_SW_DMA_SEMAPHORE 0x00000060 #define NV_SW_SEMAPHORE_OFFSET 0x00000064 -@@ -1457,5 +1574,6 @@ +@@ -1457,5 +1579,6 @@ #define NV_SW_VBLSEM_OFFSET 0x00000400 #define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404 #define NV_SW_VBLSEM_RELEASE 0x00000408 @@ -2045,7 +2132,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-r #endif /* __NOUVEAU_DRV_H__ */ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fbcon.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_fbcon.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fbcon.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_fbcon.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_fbcon.c 2010-12-03 04:56:22.000000000 +0100 @@ -49,6 +49,96 @@ #include "nouveau_fbcon.h" #include "nouveau_dma.h" @@ -2268,7 +2355,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fbcon.c linux-2.6.37 diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fbcon.h linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_fbcon.h --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fbcon.h 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_fbcon.h 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_fbcon.h 2010-12-03 04:56:22.000000000 +0100 @@ -40,13 +40,13 @@ void nouveau_fbcon_restore(void); @@ -2291,7 +2378,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fbcon.h linux-2.6.37 void nouveau_fbcon_gpu_lockup(struct fb_info *info); diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fence.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_fence.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fence.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_fence.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_fence.c 2010-12-03 04:56:22.000000000 +0100 @@ -64,6 +64,7 @@ struct nouveau_fence *fence = container_of(ref, struct nouveau_fence, refcount); @@ -2352,7 +2439,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fence.c linux-2.6.37 { struct nouveau_fence *fence = nouveau_fence(sync_obj); struct nouveau_channel *chan = fence->channel; -@@ -214,13 +215,13 @@ +@@ -214,13 +215,14 @@ } int @@ -2360,6 +2447,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fence.c linux-2.6.37 +__nouveau_fence_wait(void *sync_obj, void *sync_arg, bool lazy, bool intr) { unsigned long timeout = jiffies + (3 * DRM_HZ); ++ unsigned long sleep_time = jiffies + 1; int ret = 0; while (1) { @@ -2368,7 +2456,16 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fence.c linux-2.6.37 break; if (time_after_eq(jiffies, timeout)) { -@@ -368,7 +369,7 @@ +@@ -230,7 +232,7 @@ + + __set_current_state(intr ? TASK_INTERRUPTIBLE + : TASK_UNINTERRUPTIBLE); +- if (lazy) ++ if (lazy && time_after_eq(jiffies, sleep_time)) + schedule_timeout(1); + + if (intr && signal_pending(current)) { +@@ -368,7 +370,7 @@ kref_get(&sema->ref); nouveau_fence_work(fence, semaphore_work, sema); @@ -2377,7 +2474,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fence.c linux-2.6.37 return 0; } -@@ -380,33 +381,49 @@ +@@ -380,33 +382,49 @@ struct nouveau_channel *chan = nouveau_fence_channel(fence); struct drm_device *dev = wchan->dev; struct nouveau_semaphore *sema; @@ -2435,27 +2532,38 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fence.c linux-2.6.37 { return 0; } -@@ -420,7 +437,7 @@ +@@ -420,12 +438,7 @@ int ret; /* Create an NV_SW object for various sync purposes */ - ret = nouveau_gpuobj_sw_new(chan, NV_SW, &obj); -+ ret = nouveau_gpuobj_gr_new(chan, NV_SW, &obj); +- if (ret) +- return ret; +- +- ret = nouveau_ramht_insert(chan, NvSw, obj); +- nouveau_gpuobj_ref(NULL, &obj); ++ ret = nouveau_gpuobj_gr_new(chan, NvSw, NV_SW); if (ret) return ret; -@@ -442,8 +459,8 @@ +@@ -437,13 +450,12 @@ + + /* Create a DMA object for the shared cross-channel sync area. */ + if (USE_SEMA(dev)) { +- struct drm_mm_node *mem = dev_priv->fence.bo->bo.mem.mm_node; ++ struct ttm_mem_reg *mem = &dev_priv->fence.bo->bo.mem; + ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY, mem->start << PAGE_SHIFT, - mem->size << PAGE_SHIFT, +- mem->size << PAGE_SHIFT, - NV_DMA_ACCESS_RW, - NV_DMA_TARGET_VIDMEM, &obj); -+ NV_MEM_ACCESS_RW, ++ mem->size, NV_MEM_ACCESS_RW, + NV_MEM_TARGET_VRAM, &obj); if (ret) return ret; -@@ -473,6 +490,8 @@ +@@ -473,6 +485,8 @@ { struct nouveau_fence *tmp, *fence; @@ -2464,7 +2572,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fence.c linux-2.6.37 list_for_each_entry_safe(fence, tmp, &chan->fence.pending, entry) { fence->signalled = true; list_del(&fence->entry); -@@ -482,6 +501,8 @@ +@@ -482,6 +496,8 @@ kref_put(&fence->refcount, nouveau_fence_del); } @@ -2475,7 +2583,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_fence.c linux-2.6.37 int diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_gem.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_gem.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_gem.c 2010-12-03 04:56:22.000000000 +0100 @@ -48,9 +48,6 @@ return; nvbo->gem = NULL; @@ -2581,12 +2689,13 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r } return 0; -@@ -384,10 +359,11 @@ +@@ -383,11 +358,11 @@ + } nvbo->channel = (b->read_domains & (1 << 31)) ? NULL : chan; - ret = ttm_bo_validate(&nvbo->bo, &nvbo->placement, +- ret = ttm_bo_validate(&nvbo->bo, &nvbo->placement, - false, false, false); -+ true, false, false); ++ ret = nouveau_bo_validate(nvbo, true, false, false); nvbo->channel = NULL; if (unlikely(ret)) { - NV_ERROR(dev, "fail ttm_validate\n"); @@ -2595,7 +2704,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r return ret; } -@@ -439,13 +415,15 @@ +@@ -439,13 +414,15 @@ ret = validate_init(chan, file_priv, pbbo, nr_buffers, op); if (unlikely(ret)) { @@ -2613,7 +2722,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r validate_fini(op, NULL); return ret; } -@@ -453,7 +431,8 @@ +@@ -453,7 +430,8 @@ ret = validate_list(chan, &op->gart_list, pbbo, user_buffers); if (unlikely(ret < 0)) { @@ -2623,7 +2732,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r validate_fini(op, NULL); return ret; } -@@ -461,7 +440,8 @@ +@@ -461,7 +439,8 @@ ret = validate_list(chan, &op->both_list, pbbo, user_buffers); if (unlikely(ret < 0)) { @@ -2633,7 +2742,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r validate_fini(op, NULL); return ret; } -@@ -585,7 +565,9 @@ +@@ -585,7 +564,9 @@ struct nouveau_fence *fence = NULL; int i, j, ret = 0, do_reloc = 0; @@ -2644,7 +2753,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r req->vram_available = dev_priv->fb_aper_free; req->gart_available = dev_priv->gart_info.aper_free; -@@ -595,28 +577,34 @@ +@@ -595,28 +576,34 @@ if (unlikely(req->nr_push > NOUVEAU_GEM_MAX_PUSH)) { NV_ERROR(dev, "pushbuf push count exceeds limit: %d max %d\n", req->nr_push, NOUVEAU_GEM_MAX_PUSH); @@ -2680,7 +2789,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r return PTR_ERR(bo); } -@@ -639,7 +627,8 @@ +@@ -639,7 +626,8 @@ ret = nouveau_gem_pushbuf_validate(chan, file_priv, bo, req->buffers, req->nr_buffers, &op, &do_reloc); if (ret) { @@ -2690,7 +2799,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r goto out; } -@@ -732,7 +721,7 @@ +@@ -732,7 +720,7 @@ out: validate_fini(&op, fence); @@ -2699,7 +2808,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r kfree(bo); kfree(push); -@@ -750,6 +739,7 @@ +@@ -750,6 +738,7 @@ req->suffix1 = 0x00000000; } @@ -2707,7 +2816,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r return ret; } -@@ -781,26 +771,9 @@ +@@ -781,26 +770,9 @@ return -ENOENT; nvbo = nouveau_gem_object(gem); @@ -2737,7 +2846,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r drm_gem_object_unreference_unlocked(gem); return ret; } -@@ -809,26 +782,7 @@ +@@ -809,26 +781,7 @@ nouveau_gem_ioctl_cpu_fini(struct drm_device *dev, void *data, struct drm_file *file_priv) { @@ -2767,7 +2876,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_gem.c linux-2.6.37-r int diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_hw.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_hw.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_hw.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_hw.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_hw.c 2010-12-03 04:56:22.000000000 +0100 @@ -953,7 +953,7 @@ NVWriteCRTC(dev, head, NV_PCRTC_850, regp->crtc_850); @@ -2777,6 +2886,17 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_hw.c linux-2.6.37-rc NVWriteRAMDAC(dev, head, NV_PRAMDAC_900, reg900 | 0x10000); else NVWriteRAMDAC(dev, head, NV_PRAMDAC_900, reg900 & ~0x10000); +@@ -999,8 +999,8 @@ + if (dev_priv->card_type == NV_10) { + /* Not waiting for vertical retrace before modifying + CRE_53/CRE_54 causes lockups. */ +- nouveau_wait_until(dev, 650000000, NV_PRMCIO_INP0__COLOR, 0x8, 0x8); +- nouveau_wait_until(dev, 650000000, NV_PRMCIO_INP0__COLOR, 0x8, 0x0); ++ nouveau_wait_eq(dev, 650000000, NV_PRMCIO_INP0__COLOR, 0x8, 0x8); ++ nouveau_wait_eq(dev, 650000000, NV_PRMCIO_INP0__COLOR, 0x8, 0x0); + } + + wr_cio_state(dev, head, regp, NV_CIO_CRE_53); @@ -1017,8 +1017,9 @@ NVWriteCRTC(dev, head, NV_PCRTC_START, regp->fb_start); @@ -2791,7 +2911,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_hw.c linux-2.6.37-rc diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_irq.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_irq.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_irq.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_irq.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_irq.c 2010-12-03 04:56:22.000000000 +0100 @@ -36,18 +36,7 @@ #include "nouveau_drv.h" #include "nouveau_reg.h" @@ -4064,7 +4184,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_irq.c linux-2.6.37-r } diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_mem.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_mem.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_mem.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_mem.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_mem.c 2010-12-03 04:56:22.000000000 +0100 @@ -42,83 +42,104 @@ */ @@ -4218,7 +4338,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_mem.c linux-2.6.37-r /* diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_notifier.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_notifier.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_notifier.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_notifier.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_notifier.c 2010-12-03 04:56:22.000000000 +0100 @@ -99,7 +99,6 @@ int size, uint32_t *b_offset) { @@ -4284,7 +4404,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_notifier.c linux-2.6 } diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_object.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_object.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_object.c 2010-12-03 04:56:22.000000000 +0100 @@ -36,6 +36,101 @@ #include "nouveau_drm.h" #include "nouveau_ramht.h" @@ -4444,11 +4564,11 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 - nouveau_gpuobj_ref(NULL, &gpuobj); - return -ENOMEM; - } - +- - ramin = drm_mm_get_block_atomic(ramin, size, align); - spin_unlock(&dev_priv->ramin_lock); - } while (ramin == NULL); -- + - /* on nv50 it's ok to fail, we have a fallback path */ - if (!ramin && dev_priv->card_type < NV_50) { - nouveau_gpuobj_ref(NULL, &gpuobj); @@ -4595,7 +4715,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 gpuobj->vinst = vinst; if (gpuobj->flags & NVOBJ_FLAG_ZERO_ALLOC) { -@@ -335,113 +399,157 @@ +@@ -335,113 +399,154 @@ The method below creates a DMA object in instance RAM and returns a handle to it that can be used to set up context objects. */ @@ -4713,8 +4833,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 + int ret; - instmem->flush(dev); -+ ret = nouveau_gpuobj_new(dev, chan, 24, 16, NVOBJ_FLAG_ZERO_ALLOC | -+ NVOBJ_FLAG_ZERO_FREE, pobj); ++ ret = nouveau_gpuobj_new(dev, chan, 24, 16, NVOBJ_FLAG_ZERO_FREE, pobj); + if (ret) + return ret; @@ -4819,9 +4938,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 + flags0 |= (base & 0x00000fff) << 20; + flags2 |= (base & 0xfffff000); + -+ ret = nouveau_gpuobj_new(dev, chan, (dev_priv->card_type >= NV_40) ? -+ 32 : 16, 16, NVOBJ_FLAG_ZERO_ALLOC | -+ NVOBJ_FLAG_ZERO_FREE, &obj); ++ ret = nouveau_gpuobj_new(dev, chan, 16, 16, NVOBJ_FLAG_ZERO_FREE, &obj); + if (ret) + return ret; + @@ -4837,7 +4954,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 } /* Context objects in the instance RAM have the following structure. -@@ -495,23 +603,86 @@ +@@ -495,82 +600,122 @@ entry[5]: set to 0? */ @@ -4845,13 +4962,9 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 +nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class, + struct nouveau_gpuobj **gpuobj_ret) +{ -+ struct drm_nouveau_private *dev_priv; ++ struct drm_nouveau_private *dev_priv = chan->dev->dev_private; + struct nouveau_gpuobj *gpuobj; + -+ if (!chan || !gpuobj_ret || *gpuobj_ret != NULL) -+ return -EINVAL; -+ dev_priv = chan->dev->dev_private; -+ + gpuobj = kzalloc(sizeof(*gpuobj), GFP_KERNEL); + if (!gpuobj) + return -ENOMEM; @@ -4869,13 +4982,15 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 +} + int - nouveau_gpuobj_gr_new(struct nouveau_channel *chan, int class, - struct nouveau_gpuobj **gpuobj) +-nouveau_gpuobj_gr_new(struct nouveau_channel *chan, int class, +- struct nouveau_gpuobj **gpuobj) ++nouveau_gpuobj_gr_new(struct nouveau_channel *chan, u32 handle, int class) { + struct drm_nouveau_private *dev_priv = chan->dev->dev_private; struct drm_device *dev = chan->dev; - struct drm_nouveau_private *dev_priv = dev->dev_private; + struct nouveau_gpuobj_class *oc; ++ struct nouveau_gpuobj *gpuobj; int ret; NV_DEBUG(dev, "ch%d class=0x%04x\n", chan->id, class); @@ -4889,10 +5004,12 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 + return -EINVAL; + +found: -+ if (oc->engine == NVOBJ_ENGINE_SW) -+ return nouveau_gpuobj_sw_new(chan, class, gpuobj); -+ + switch (oc->engine) { ++ case NVOBJ_ENGINE_SW: ++ ret = nouveau_gpuobj_sw_new(chan, class, &gpuobj); ++ if (ret) ++ return ret; ++ goto insert; + case NVOBJ_ENGINE_GR: + if (dev_priv->card_type >= NV_50 && !chan->ramin_grctx) { + struct nouveau_pgraph_engine *pgraph = @@ -4919,14 +5036,45 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 nouveau_gpuobj_class_instmem_size(dev, class), 16, NVOBJ_FLAG_ZERO_ALLOC | NVOBJ_FLAG_ZERO_FREE, - gpuobj); +- gpuobj); ++ &gpuobj); if (ret) { - NV_ERROR(dev, "Error creating gpuobj: %d\n", ret); + NV_ERROR(dev, "error creating gpuobj: %d\n", ret); return ret; } -@@ -541,35 +712,8 @@ + if (dev_priv->card_type >= NV_50) { +- nv_wo32(*gpuobj, 0, class); +- nv_wo32(*gpuobj, 20, 0x00010000); ++ nv_wo32(gpuobj, 0, class); ++ nv_wo32(gpuobj, 20, 0x00010000); + } else { + switch (class) { + case NV_CLASS_NULL: +- nv_wo32(*gpuobj, 0, 0x00001030); +- nv_wo32(*gpuobj, 4, 0xFFFFFFFF); ++ nv_wo32(gpuobj, 0, 0x00001030); ++ nv_wo32(gpuobj, 4, 0xFFFFFFFF); + break; + default: + if (dev_priv->card_type >= NV_40) { +- nv_wo32(*gpuobj, 0, class); ++ nv_wo32(gpuobj, 0, class); + #ifdef __BIG_ENDIAN +- nv_wo32(*gpuobj, 8, 0x01000000); ++ nv_wo32(gpuobj, 8, 0x01000000); + #endif + } else { + #ifdef __BIG_ENDIAN +- nv_wo32(*gpuobj, 0, class | 0x00080000); ++ nv_wo32(gpuobj, 0, class | 0x00080000); + #else +- nv_wo32(*gpuobj, 0, class); ++ nv_wo32(gpuobj, 0, class); + #endif + } + } } dev_priv->engine.instmem.flush(dev); @@ -4945,7 +5093,9 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 - if (!chan || !gpuobj_ret || *gpuobj_ret != NULL) - return -EINVAL; - dev_priv = chan->dev->dev_private; -- ++ gpuobj->engine = oc->engine; ++ gpuobj->class = oc->id; + - gpuobj = kzalloc(sizeof(*gpuobj), GFP_KERNEL); - if (!gpuobj) - return -ENOMEM; @@ -4959,12 +5109,17 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 - list_add_tail(&gpuobj->list, &dev_priv->gpuobj_list); - spin_unlock(&dev_priv->ramin_lock); - *gpuobj_ret = gpuobj; -+ (*gpuobj)->engine = oc->engine; -+ (*gpuobj)->class = oc->id; - return 0; +- return 0; ++insert: ++ ret = nouveau_ramht_insert(chan, handle, gpuobj); ++ if (ret) ++ NV_ERROR(dev, "error adding gpuobj to RAMHT: %d\n", ret); ++ nouveau_gpuobj_ref(NULL, &gpuobj); ++ return ret; } -@@ -585,7 +729,7 @@ + static int +@@ -585,7 +730,7 @@ NV_DEBUG(dev, "ch%d\n", chan->id); /* Base amount for object storage (4KiB enough?) */ @@ -4973,7 +5128,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 base = 0; /* PGRAPH context */ -@@ -701,8 +845,8 @@ +@@ -701,8 +846,8 @@ if (dev_priv->card_type >= NV_50) { ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY, 0, dev_priv->vm_end, @@ -4984,7 +5139,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 if (ret) { NV_ERROR(dev, "Error creating VRAM ctxdma: %d\n", ret); return ret; -@@ -710,8 +854,8 @@ +@@ -710,8 +855,8 @@ } else { ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY, 0, dev_priv->fb_available_size, @@ -4995,7 +5150,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 if (ret) { NV_ERROR(dev, "Error creating VRAM ctxdma: %d\n", ret); return ret; -@@ -729,20 +873,13 @@ +@@ -729,20 +874,13 @@ if (dev_priv->card_type >= NV_50) { ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY, 0, dev_priv->vm_end, @@ -5022,7 +5177,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 } if (ret) { -@@ -791,119 +928,69 @@ +@@ -791,147 +929,91 @@ struct nouveau_gpuobj *gpuobj; int i; @@ -5117,7 +5272,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 struct drm_nouveau_grobj_alloc *init = data; - struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; - struct nouveau_pgraph_object_class *grc; - struct nouveau_gpuobj *gr = NULL; +- struct nouveau_gpuobj *gr = NULL; struct nouveau_channel *chan; int ret; @@ -5151,19 +5306,18 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 - ret = nouveau_gpuobj_gr_new(chan, grc->id, &gr); - else - ret = nouveau_gpuobj_sw_new(chan, grc->id, &gr); -+ ret = nouveau_gpuobj_gr_new(chan, init->class, &gr); ++ ret = nouveau_gpuobj_gr_new(chan, init->handle, init->class); if (ret) { NV_ERROR(dev, "Error creating object: %d (%d/0x%08x)\n", ret, init->channel, init->handle); - return ret; -+ goto out; - } - - ret = nouveau_ramht_insert(chan, init->handle, gr); -@@ -911,27 +998,30 @@ - if (ret) { - NV_ERROR(dev, "Error referencing object: %d (%d/0x%08x)\n", - ret, init->channel, init->handle); +- } +- +- ret = nouveau_ramht_insert(chan, init->handle, gr); +- nouveau_gpuobj_ref(NULL, &gr); +- if (ret) { +- NV_ERROR(dev, "Error referencing object: %d (%d/0x%08x)\n", +- ret, init->channel, init->handle); - return ret; } @@ -5202,7 +5356,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_object.c linux-2.6.3 u32 diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_pm.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_pm.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_pm.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_pm.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_pm.c 2010-12-03 04:56:22.000000000 +0100 @@ -27,6 +27,10 @@ #include "nouveau_drv.h" #include "nouveau_pm.h" @@ -5263,7 +5417,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_pm.c linux-2.6.37-rc } diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_ramht.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_ramht.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_ramht.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_ramht.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_ramht.c 2010-12-03 04:56:22.000000000 +0100 @@ -104,17 +104,17 @@ nouveau_gpuobj_ref(gpuobj, &entry->gpuobj); @@ -5309,7 +5463,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_ramht.c linux-2.6.37 struct nouveau_gpuobj * diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_ramht.h linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_ramht.h --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_ramht.h 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_ramht.h 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_ramht.h 2010-12-03 04:56:22.000000000 +0100 @@ -48,7 +48,7 @@ extern int nouveau_ramht_insert(struct nouveau_channel *, u32 handle, @@ -5321,7 +5475,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_ramht.h linux-2.6.37 diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_reg.h linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_reg.h --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_reg.h 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_reg.h 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_reg.h 2010-12-03 04:56:22.000000000 +0100 @@ -45,6 +45,11 @@ # define NV04_PFB_REF_CMD_REFRESH (1 << 0) #define NV04_PFB_PRE 0x001002d4 @@ -5445,7 +5599,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_reg.h linux-2.6.37-r #define NV50_PDISPLAY_CRTC_C(i, r) (4 + (i) * 0x540 + NV50_PDISPLAY_CRTC_##r) diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_sgdma.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_sgdma.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_sgdma.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_sgdma.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_sgdma.c 2010-12-03 04:56:22.000000000 +0100 @@ -144,19 +144,15 @@ pte = nvbe->pte_start; @@ -5540,7 +5694,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_sgdma.c linux-2.6.37 diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_state.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_state.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_state.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_state.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_state.c 2010-12-03 04:56:22.000000000 +0100 @@ -53,10 +53,10 @@ engine->instmem.takedown = nv04_instmem_takedown; engine->instmem.suspend = nv04_instmem_suspend; @@ -6100,7 +6254,39 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_state.c linux-2.6.37 case NOUVEAU_GETPARAM_GRAPH_UNITS: /* NV40 and NV50 versions are quite different, but register * address is the same. User is supposed to know the card -@@ -1105,7 +1144,13 @@ +@@ -1087,8 +1126,9 @@ + } + + /* Wait until (value(reg) & mask) == val, up until timeout has hit */ +-bool nouveau_wait_until(struct drm_device *dev, uint64_t timeout, +- uint32_t reg, uint32_t mask, uint32_t val) ++bool ++nouveau_wait_eq(struct drm_device *dev, uint64_t timeout, ++ uint32_t reg, uint32_t mask, uint32_t val) + { + struct drm_nouveau_private *dev_priv = dev->dev_private; + struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; +@@ -1102,10 +1142,33 @@ + return false; + } + ++/* Wait until (value(reg) & mask) != val, up until timeout has hit */ ++bool ++nouveau_wait_ne(struct drm_device *dev, uint64_t timeout, ++ uint32_t reg, uint32_t mask, uint32_t val) ++{ ++ struct drm_nouveau_private *dev_priv = dev->dev_private; ++ struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; ++ uint64_t start = ptimer->read(dev); ++ ++ do { ++ if ((nv_rd32(dev, reg) & mask) != val) ++ return true; ++ } while (ptimer->read(dev) - start < timeout); ++ ++ return false; ++} ++ /* Waits for PGRAPH to go completely idle */ bool nouveau_wait_for_idle(struct drm_device *dev) { @@ -6117,7 +6303,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_state.c linux-2.6.37 return false; diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_util.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_util.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_util.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_util.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_util.c 2010-12-03 04:56:22.000000000 +0100 @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 Nouveau Project @@ -6190,7 +6376,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_util.c linux-2.6.37- +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_util.h linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_util.h --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_util.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_util.h 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nouveau_util.h 2010-12-03 04:56:22.000000000 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Nouveau Project @@ -6239,7 +6425,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nouveau_util.h linux-2.6.37- +#endif diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_crtc.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_crtc.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_crtc.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_crtc.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_crtc.c 2010-12-03 04:56:22.000000000 +0100 @@ -551,7 +551,10 @@ if (dev_priv->card_type >= NV_30) regp->gpio_ext = NVReadCRTC(dev, 0, NV_PCRTC_GPIO_EXT); @@ -6276,9 +6462,33 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_crtc.c linux-2.6.37-rc3 .destroy = nv_crtc_destroy, }; +diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_dac.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_dac.c +--- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_dac.c 2010-11-22 00:18:56.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_dac.c 2010-12-03 04:56:22.000000000 +0100 +@@ -74,14 +74,14 @@ + * use a 10ms timeout (guards against crtc being inactive, in + * which case blank state would never change) + */ +- if (!nouveau_wait_until(dev, 10000000, NV_PRMCIO_INP0__COLOR, +- 0x00000001, 0x00000000)) ++ if (!nouveau_wait_eq(dev, 10000000, NV_PRMCIO_INP0__COLOR, ++ 0x00000001, 0x00000000)) + return -EBUSY; +- if (!nouveau_wait_until(dev, 10000000, NV_PRMCIO_INP0__COLOR, +- 0x00000001, 0x00000001)) ++ if (!nouveau_wait_eq(dev, 10000000, NV_PRMCIO_INP0__COLOR, ++ 0x00000001, 0x00000001)) + return -EBUSY; +- if (!nouveau_wait_until(dev, 10000000, NV_PRMCIO_INP0__COLOR, +- 0x00000001, 0x00000000)) ++ if (!nouveau_wait_eq(dev, 10000000, NV_PRMCIO_INP0__COLOR, ++ 0x00000001, 0x00000000)) + return -EBUSY; + + udelay(100); diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_display.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_display.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_display.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_display.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_display.c 2010-12-03 04:56:22.000000000 +0100 @@ -32,6 +32,9 @@ #include "nouveau_encoder.h" #include "nouveau_connector.h" @@ -6327,7 +6537,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_display.c linux-2.6.37- +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fbcon.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_fbcon.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fbcon.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_fbcon.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_fbcon.c 2010-12-03 04:56:22.000000000 +0100 @@ -28,52 +28,39 @@ #include "nouveau_ramht.h" #include "nouveau_fbcon.h" @@ -6449,17 +6659,73 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fbcon.c linux-2.6.37-rc BEGIN_RING(chan, NvSubGdiRect, 0x0c00, iter_len); OUT_RINGp(chan, data, iter_len); -@@ -157,6 +134,7 @@ +@@ -157,22 +134,7 @@ } FIRE_RING(chan); +-} +- +-static int +-nv04_fbcon_grobj_new(struct drm_device *dev, int class, uint32_t handle) +-{ +- struct drm_nouveau_private *dev_priv = dev->dev_private; +- struct nouveau_gpuobj *obj = NULL; +- int ret; +- +- ret = nouveau_gpuobj_gr_new(dev_priv->channel, class, &obj); +- if (ret) +- return ret; +- +- ret = nouveau_ramht_insert(dev_priv->channel, handle, obj); +- nouveau_gpuobj_ref(NULL, &obj); +- return ret; + return 0; } - static int + int +@@ -214,29 +176,31 @@ + return -EINVAL; + } + +- ret = nv04_fbcon_grobj_new(dev, dev_priv->card_type >= NV_10 ? +- 0x0062 : 0x0042, NvCtxSurf2D); ++ ret = nouveau_gpuobj_gr_new(chan, NvCtxSurf2D, ++ dev_priv->card_type >= NV_10 ? ++ 0x0062 : 0x0042); + if (ret) + return ret; + +- ret = nv04_fbcon_grobj_new(dev, 0x0019, NvClipRect); ++ ret = nouveau_gpuobj_gr_new(chan, NvClipRect, 0x0019); + if (ret) + return ret; + +- ret = nv04_fbcon_grobj_new(dev, 0x0043, NvRop); ++ ret = nouveau_gpuobj_gr_new(chan, NvRop, 0x0043); + if (ret) + return ret; + +- ret = nv04_fbcon_grobj_new(dev, 0x0044, NvImagePatt); ++ ret = nouveau_gpuobj_gr_new(chan, NvImagePatt, 0x0044); + if (ret) + return ret; + +- ret = nv04_fbcon_grobj_new(dev, 0x004a, NvGdiRect); ++ ret = nouveau_gpuobj_gr_new(chan, NvGdiRect, 0x004a); + if (ret) + return ret; + +- ret = nv04_fbcon_grobj_new(dev, dev_priv->chipset >= 0x11 ? +- 0x009f : 0x005f, NvImageBlit); ++ ret = nouveau_gpuobj_gr_new(chan, NvImageBlit, ++ dev_priv->chipset >= 0x11 ? ++ 0x009f : 0x005f); + if (ret) + return ret; + diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fifo.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_fifo.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fifo.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_fifo.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_fifo.c 2010-12-03 04:56:22.000000000 +0100 @@ -28,6 +28,7 @@ #include "drm.h" #include "nouveau_drv.h" @@ -6468,7 +6734,19 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fifo.c linux-2.6.37-rc3 #define NV04_RAMFC(c) (dev_priv->ramfc->pinst + ((c) * NV04_RAMFC__SIZE)) #define NV04_RAMFC__SIZE 32 -@@ -151,10 +152,27 @@ +@@ -128,6 +129,11 @@ + if (ret) + return ret; + ++ chan->user = ioremap(pci_resource_start(dev->pdev, 0) + ++ NV03_USER(chan->id), PAGE_SIZE); ++ if (!chan->user) ++ return -ENOMEM; ++ + spin_lock_irqsave(&dev_priv->context_switch_lock, flags); + + /* Setup initial state */ +@@ -151,10 +157,31 @@ nv04_fifo_destroy_context(struct nouveau_channel *chan) { struct drm_device *dev = chan->dev; @@ -6480,14 +6758,14 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fifo.c linux-2.6.37-rc3 - nv_rd32(dev, NV04_PFIFO_MODE) & ~(1 << chan->id)); + spin_lock_irqsave(&dev_priv->context_switch_lock, flags); + pfifo->reassign(dev, false); -+ + + /* Unload the context if it's the currently active one */ + if (pfifo->channel_id(dev) == chan->id) { + pfifo->disable(dev); + pfifo->unload_context(dev); + pfifo->enable(dev); + } - ++ + /* Keep it from being rescheduled */ + nv_mask(dev, NV04_PFIFO_MODE, 1 << chan->id, 0); + @@ -6495,10 +6773,14 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fifo.c linux-2.6.37-rc3 + spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); + + /* Free the channel resources */ ++ if (chan->user) { ++ iounmap(chan->user); ++ chan->user = NULL; ++ } nouveau_gpuobj_ref(NULL, &chan->ramfc); } -@@ -208,7 +226,7 @@ +@@ -208,7 +235,7 @@ if (chid < 0 || chid >= dev_priv->engine.fifo.channels) return 0; @@ -6507,7 +6789,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fifo.c linux-2.6.37-rc3 if (!chan) { NV_ERROR(dev, "Inactive channel on PFIFO: %d\n", chid); return -EINVAL; -@@ -267,6 +285,7 @@ +@@ -267,6 +294,7 @@ static void nv04_fifo_init_intr(struct drm_device *dev) { @@ -6515,7 +6797,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fifo.c linux-2.6.37-rc3 nv_wr32(dev, 0x002100, 0xffffffff); nv_wr32(dev, 0x002140, 0xffffffff); } -@@ -289,7 +308,7 @@ +@@ -289,7 +317,7 @@ pfifo->reassign(dev, true); for (i = 0; i < dev_priv->engine.fifo.channels; i++) { @@ -6524,7 +6806,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fifo.c linux-2.6.37-rc3 uint32_t mode = nv_rd32(dev, NV04_PFIFO_MODE); nv_wr32(dev, NV04_PFIFO_MODE, mode | (1 << i)); } -@@ -298,3 +317,207 @@ +@@ -298,3 +326,207 @@ return 0; } @@ -6734,7 +7016,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_fifo.c linux-2.6.37-rc3 +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_graph.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_graph.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_graph.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_graph.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_graph.c 2010-12-03 04:56:22.000000000 +0100 @@ -26,6 +26,11 @@ #include "drm.h" #include "nouveau_drm.h" @@ -7605,7 +7887,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_graph.c linux-2.6.37-rc +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_instmem.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_instmem.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_instmem.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_instmem.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv04_instmem.c 2010-12-03 04:56:22.000000000 +0100 @@ -98,42 +98,66 @@ } @@ -7687,7 +7969,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv04_instmem.c linux-2.6.37- +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv10_fb.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv10_fb.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv10_fb.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv10_fb.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv10_fb.c 2010-12-03 04:56:22.000000000 +0100 @@ -3,23 +3,109 @@ #include "nouveau_drv.h" #include "nouveau_drm.h" @@ -7841,8 +8123,20 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv10_fb.c linux-2.6.37-rc3.n } diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv10_fifo.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv10_fifo.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv10_fifo.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv10_fifo.c 2010-11-22 06:33:32.000000000 +0100 -@@ -73,17 +73,6 @@ ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv10_fifo.c 2010-12-03 04:56:22.000000000 +0100 +@@ -53,6 +53,11 @@ + if (ret) + return ret; + ++ chan->user = ioremap(pci_resource_start(dev->pdev, 0) + ++ NV03_USER(chan->id), PAGE_SIZE); ++ if (!chan->user) ++ return -ENOMEM; ++ + /* Fill entries that are seen filled in dumps of nvidia driver just + * after channel's is put into DMA mode + */ +@@ -73,17 +78,6 @@ return 0; } @@ -7860,7 +8154,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv10_fifo.c linux-2.6.37-rc3 static void nv10_fifo_do_load_context(struct drm_device *dev, int chid) { -@@ -219,6 +208,7 @@ +@@ -219,6 +213,7 @@ static void nv10_fifo_init_intr(struct drm_device *dev) { @@ -7868,7 +8162,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv10_fifo.c linux-2.6.37-rc3 nv_wr32(dev, 0x002100, 0xffffffff); nv_wr32(dev, 0x002140, 0xffffffff); } -@@ -241,7 +231,7 @@ +@@ -241,7 +236,7 @@ pfifo->reassign(dev, true); for (i = 0; i < dev_priv->engine.fifo.channels; i++) { @@ -7879,7 +8173,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv10_fifo.c linux-2.6.37-rc3 } diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv10_graph.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv10_graph.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv10_graph.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv10_graph.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv10_graph.c 2010-12-03 04:56:22.000000000 +0100 @@ -26,6 +26,10 @@ #include "drm.h" #include "nouveau_drm.h" @@ -8196,7 +8490,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv10_graph.c linux-2.6.37-rc +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv20_graph.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv20_graph.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv20_graph.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv20_graph.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv20_graph.c 2010-12-03 04:56:22.000000000 +0100 @@ -32,6 +32,10 @@ #define NV34_GRCTX_SIZE (18140) #define NV35_36_GRCTX_SIZE (22396) @@ -8529,7 +8823,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv20_graph.c linux-2.6.37-rc +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv30_fb.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv30_fb.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv30_fb.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv30_fb.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv30_fb.c 2010-12-03 04:56:22.000000000 +0100 @@ -29,6 +29,27 @@ #include "nouveau_drv.h" #include "nouveau_drm.h" @@ -8569,7 +8863,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv30_fb.c linux-2.6.37-rc3.n if (dev_priv->chipset == 0x30 || diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv40_fb.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv40_fb.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv40_fb.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv40_fb.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv40_fb.c 2010-12-03 04:56:22.000000000 +0100 @@ -4,26 +4,22 @@ #include "nouveau_drm.h" @@ -8616,8 +8910,20 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv40_fb.c linux-2.6.37-rc3.n } diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv40_fifo.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv40_fifo.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv40_fifo.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv40_fifo.c 2010-11-22 06:33:32.000000000 +0100 -@@ -70,17 +70,6 @@ ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv40_fifo.c 2010-12-03 04:56:22.000000000 +0100 +@@ -47,6 +47,11 @@ + if (ret) + return ret; + ++ chan->user = ioremap(pci_resource_start(dev->pdev, 0) + ++ NV40_USER(chan->id), PAGE_SIZE); ++ if (!chan->user) ++ return -ENOMEM; ++ + spin_lock_irqsave(&dev_priv->context_switch_lock, flags); + + nv_wi32(dev, fc + 0, chan->pushbuf_base); +@@ -70,17 +75,6 @@ return 0; } @@ -8635,7 +8941,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv40_fifo.c linux-2.6.37-rc3 static void nv40_fifo_do_load_context(struct drm_device *dev, int chid) { -@@ -279,6 +268,7 @@ +@@ -279,6 +273,7 @@ static void nv40_fifo_init_intr(struct drm_device *dev) { @@ -8643,7 +8949,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv40_fifo.c linux-2.6.37-rc3 nv_wr32(dev, 0x002100, 0xffffffff); nv_wr32(dev, 0x002140, 0xffffffff); } -@@ -301,7 +291,7 @@ +@@ -301,7 +296,7 @@ pfifo->reassign(dev, true); for (i = 0; i < dev_priv->engine.fifo.channels; i++) { @@ -8654,7 +8960,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv40_fifo.c linux-2.6.37-rc3 } diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv40_graph.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv40_graph.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv40_graph.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv40_graph.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv40_graph.c 2010-12-03 04:56:22.000000000 +0100 @@ -29,6 +29,9 @@ #include "nouveau_drv.h" #include "nouveau_grctx.h" @@ -8925,7 +9231,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv40_graph.c linux-2.6.37-rc +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_crtc.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_crtc.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_crtc.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_crtc.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_crtc.c 2010-12-03 04:56:22.000000000 +0100 @@ -437,6 +437,7 @@ .cursor_move = nv50_crtc_cursor_move, .gamma_set = nv50_crtc_gamma_set, @@ -8952,7 +9258,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_crtc.c linux-2.6.37-rc3 if (ret) { diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_display.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_display.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_display.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_display.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_display.c 2010-12-03 04:56:22.000000000 +0100 @@ -33,6 +33,8 @@ #include "nouveau_ramht.h" #include "drm_crtc_helper.h" @@ -9552,7 +9858,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_display.c linux-2.6.37- - diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_display.h linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_display.h --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_display.h 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_display.h 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_display.h 2010-12-03 04:56:22.000000000 +0100 @@ -35,9 +35,7 @@ #include "nouveau_crtc.h" #include "nv50_evo.h" @@ -9565,7 +9871,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_display.h linux-2.6.37- int nv50_display_create(struct drm_device *dev); diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_evo.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_evo.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_evo.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_evo.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_evo.c 2010-12-03 04:56:22.000000000 +0100 @@ -0,0 +1,318 @@ +/* + * Copyright 2010 Red Hat Inc. @@ -9887,7 +10193,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_evo.c linux-2.6.37-rc3. +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_evo.h linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_evo.h --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_evo.h 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_evo.h 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_evo.h 2010-12-03 04:56:22.000000000 +0100 @@ -24,6 +24,15 @@ * */ @@ -9911,7 +10217,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_evo.h linux-2.6.37-rc3. +#endif diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fb.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_fb.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fb.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_fb.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_fb.c 2010-12-03 04:56:22.000000000 +0100 @@ -3,30 +3,75 @@ #include "nouveau_drv.h" #include "nouveau_drm.h" @@ -10040,7 +10346,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fb.c linux-2.6.37-rc3.n "channel %d (0x%08x)\n", diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fbcon.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_fbcon.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fbcon.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_fbcon.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_fbcon.c 2010-12-03 04:56:22.000000000 +0100 @@ -4,26 +4,18 @@ #include "nouveau_ramht.h" #include "nouveau_fbcon.h" @@ -10127,7 +10433,9 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fbcon.c linux-2.6.37-rc - if (info->state != FBINFO_STATE_RUNNING) - return; -- ++ if (image->depth != 1) ++ return -ENODEV; + - if (image->depth != 1) { - cfb_imageblit(info, image); - return; @@ -10136,9 +10444,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fbcon.c linux-2.6.37-rc - if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 11)) { - nouveau_fbcon_gpu_lockup(info); - } -+ if (image->depth != 1) -+ return -ENODEV; - +- - if (info->flags & FBINFO_HWACCEL_DISABLED) { - cfb_imageblit(info, image); - return; @@ -10172,9 +10478,34 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fbcon.c linux-2.6.37-rc } int +@@ -157,9 +134,8 @@ + struct drm_device *dev = nfbdev->dev; + struct drm_nouveau_private *dev_priv = dev->dev_private; + struct nouveau_channel *chan = dev_priv->channel; +- struct nouveau_gpuobj *eng2d = NULL; +- uint64_t fb; + int ret, format; ++ uint64_t fb; + + fb = info->fix.smem_start - dev_priv->fb_phys + dev_priv->vm_vram_base; + +@@ -190,12 +166,7 @@ + return -EINVAL; + } + +- ret = nouveau_gpuobj_gr_new(dev_priv->channel, 0x502d, &eng2d); +- if (ret) +- return ret; +- +- ret = nouveau_ramht_insert(dev_priv->channel, Nv2D, eng2d); +- nouveau_gpuobj_ref(NULL, &eng2d); ++ ret = nouveau_gpuobj_gr_new(dev_priv->channel, Nv2D, 0x502d); + if (ret) + return ret; + diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fifo.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_fifo.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fifo.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_fifo.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_fifo.c 2010-12-03 04:56:22.000000000 +0100 @@ -44,7 +44,8 @@ /* We never schedule channel 0 or 127 */ @@ -10221,7 +10552,19 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fifo.c linux-2.6.37-rc3 nouveau_gpuobj_ref(NULL, &pfifo->playlist[0]); nouveau_gpuobj_ref(NULL, &pfifo->playlist[1]); } -@@ -291,10 +296,23 @@ +@@ -256,6 +261,11 @@ + } + ramfc = chan->ramfc; + ++ chan->user = ioremap(pci_resource_start(dev->pdev, 0) + ++ NV50_USER(chan->id), PAGE_SIZE); ++ if (!chan->user) ++ return -ENOMEM; ++ + spin_lock_irqsave(&dev_priv->context_switch_lock, flags); + + nv_wo32(ramfc, 0x48, chan->pushbuf->cinst >> 4); +@@ -291,10 +301,23 @@ nv50_fifo_destroy_context(struct nouveau_channel *chan) { struct drm_device *dev = chan->dev; @@ -10245,7 +10588,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fifo.c linux-2.6.37-rc3 /* This will ensure the channel is seen as disabled. */ nouveau_gpuobj_ref(chan->ramfc, &ramfc); nouveau_gpuobj_ref(NULL, &chan->ramfc); -@@ -305,6 +323,10 @@ +@@ -305,6 +328,14 @@ nv50_fifo_channel_disable(dev, 127); nv50_fifo_playlist_update(dev); @@ -10253,10 +10596,14 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fifo.c linux-2.6.37-rc3 + spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); + + /* Free the channel resources */ ++ if (chan->user) { ++ iounmap(chan->user); ++ chan->user = NULL; ++ } nouveau_gpuobj_ref(NULL, &ramfc); nouveau_gpuobj_ref(NULL, &chan->cache); } -@@ -392,7 +414,7 @@ +@@ -392,7 +423,7 @@ if (chid < 1 || chid >= dev_priv->engine.fifo.channels - 1) return 0; @@ -10267,7 +10614,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_fifo.c linux-2.6.37-rc3 return -EINVAL; diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_gpio.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_gpio.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_gpio.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_gpio.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_gpio.c 2010-12-03 04:56:22.000000000 +0100 @@ -26,6 +26,28 @@ #include "nouveau_drv.h" #include "nouveau_hw.h" @@ -10506,7 +10853,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_gpio.c linux-2.6.37-rc3 +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_graph.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_graph.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_graph.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_graph.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_graph.c 2010-12-03 04:56:22.000000000 +0100 @@ -29,6 +29,11 @@ #include "nouveau_drv.h" #include "nouveau_ramht.h" @@ -11259,7 +11606,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_graph.c linux-2.6.37-rc +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_instmem.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_instmem.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_instmem.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_instmem.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv50_instmem.c 2010-12-03 04:56:22.000000000 +0100 @@ -131,10 +131,10 @@ } @@ -11540,7 +11887,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv50_instmem.c linux-2.6.37- void diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv84_crypt.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv84_crypt.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv84_crypt.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv84_crypt.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nv84_crypt.c 2010-12-03 04:56:22.000000000 +0100 @@ -0,0 +1,137 @@ +/* + * Copyright 2010 Red Hat Inc. @@ -11681,7 +12028,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nv84_crypt.c linux-2.6.37-rc +} diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nvc0_instmem.c linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nvc0_instmem.c --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nvc0_instmem.c 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nvc0_instmem.c 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nvc0_instmem.c 2010-12-03 04:56:22.000000000 +0100 @@ -26,67 +26,89 @@ #include "nouveau_drv.h" @@ -11856,7 +12203,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nvc0_instmem.c linux-2.6.37- void diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nvreg.h linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nvreg.h --- linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nvreg.h 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nvreg.h 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/drivers/gpu/drm/nouveau/nvreg.h 2010-12-03 04:56:22.000000000 +0100 @@ -153,7 +153,8 @@ #define NV_PCRTC_START 0x00600800 #define NV_PCRTC_CONFIG 0x00600804 @@ -11869,7 +12216,7 @@ diff -Naur linux-2.6.37-rc3/drivers/gpu/drm/nouveau/nvreg.h linux-2.6.37-rc3.nou # define NV_PCRTC_CURSOR_CONFIG_DOUBLE_SCAN_ENABLE (1 << 4) diff -Naur linux-2.6.37-rc3/include/drm/nouveau_drm.h linux-2.6.37-rc3.nouveau/include/drm/nouveau_drm.h --- linux-2.6.37-rc3/include/drm/nouveau_drm.h 2010-11-22 00:18:56.000000000 +0100 -+++ linux-2.6.37-rc3.nouveau/include/drm/nouveau_drm.h 2010-11-22 06:33:32.000000000 +0100 ++++ linux-2.6.37-rc3.nouveau/include/drm/nouveau_drm.h 2010-12-03 04:56:22.000000000 +0100 @@ -71,16 +71,15 @@ #define NOUVEAU_GETPARAM_PCI_VENDOR 3 #define NOUVEAU_GETPARAM_PCI_DEVICE 4