rpms/kernel/devel drm-nouveau.patch, 1.12, 1.13 kernel.spec, 1.1356, 1.1357
Ben Skeggs
bskeggs at fedoraproject.org
Mon Mar 2 06:13:20 UTC 2009
Author: bskeggs
Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv32307
Modified Files:
drm-nouveau.patch kernel.spec
Log Message:
* Mon Mar 02 2009 Ben Skeggs <bskeggs at redhat.com>
- nouveau fixes for recent drm-next changes, and various kms issues
drm-nouveau.patch:
Index: drm-nouveau.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/drm-nouveau.patch,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- drm-nouveau.patch 27 Feb 2009 07:03:54 -0000 1.12
+++ drm-nouveau.patch 2 Mar 2009 06:13:20 -0000 1.13
@@ -22,15 +22,71 @@
+ userspaces with this enabled will cause pain.
+
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
-index 9aba961..954fd51 100644
+index 03ceb3e..3df55d7 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
-@@ -26,4 +26,5 @@ obj-$(CONFIG_DRM_I915) += i915/
+@@ -27,4 +27,5 @@ obj-$(CONFIG_DRM_I915) += i915/
obj-$(CONFIG_DRM_SIS) += sis/
obj-$(CONFIG_DRM_SAVAGE)+= savage/
obj-$(CONFIG_DRM_VIA) +=via/
+obj-$(CONFIG_DRM_NOUVEAU) +=nouveau/
+diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
+index 325b4aa..25cf6a7 100644
+--- a/drivers/gpu/drm/drm_bufs.c
++++ b/drivers/gpu/drm/drm_bufs.c
+@@ -51,38 +51,23 @@ resource_size_t drm_get_resource_len(struct drm_device *dev, unsigned int resour
+
+ EXPORT_SYMBOL(drm_get_resource_len);
+
+-static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
+- struct drm_local_map *map)
++struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
++ struct drm_local_map *map)
+ {
+ struct drm_map_list *entry;
+ list_for_each_entry(entry, &dev->maplist, head) {
+- /*
+- * Because the kernel-userspace ABI is fixed at a 32-bit offset
+- * while PCI resources may live above that, we ignore the map
+- * offset for maps of type _DRM_FRAMEBUFFER or _DRM_REGISTERS.
+- * It is assumed that each driver will have only one resource of
+- * each type.
+- */
+ if (!entry->map ||
+ map->type != entry->map->type ||
+ entry->master != dev->primary->master)
+ continue;
+- switch (map->type) {
+- case _DRM_SHM:
+- if (map->flags != _DRM_CONTAINS_LOCK)
+- break;
+- case _DRM_REGISTERS:
+- case _DRM_FRAME_BUFFER:
+- return entry;
+- default: /* Make gcc happy */
+- ;
+- }
++
+ if (entry->map->offset == map->offset)
+ return entry;
+ }
+
+ return NULL;
+ }
++EXPORT_SYMBOL(drm_find_matching_map);
+
+ static int drm_map_handle(struct drm_device *dev, struct drm_hash_item *hash,
+ unsigned long user_token, int hashed_handle, int shm)
+@@ -349,7 +334,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
+ /* We do it here so that dev->struct_mutex protects the increment */
+ user_token = (map->type == _DRM_SHM) ? (unsigned long)map->handle :
+ map->offset;
+- ret = drm_map_handle(dev, &list->hash, user_token, 0,
++ ret = drm_map_handle(dev, &list->hash, user_token, 1,
+ (map->type == _DRM_SHM));
+ if (ret) {
+ if (map->type == _DRM_REGISTERS)
diff --git a/drivers/gpu/drm/drm_fence.c b/drivers/gpu/drm/drm_fence.c
index f1c386c..fd62fd9 100644
--- a/drivers/gpu/drm/drm_fence.c
@@ -44,6 +100,55 @@
if (mask & ~fence->type) {
DRM_ERROR("Wait trying to extend fence type"
+diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
+index 7e277c7..e5efd4a 100644
+--- a/drivers/gpu/drm/drm_stub.c
++++ b/drivers/gpu/drm/drm_stub.c
+@@ -414,14 +414,14 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
+ if (dev->driver->load) {
+ ret = dev->driver->load(dev, ent->driver_data);
+ if (ret)
+- goto err_g3;
++ goto err_g4;
+ }
+
+ /* setup the grouping for the legacy output */
+ if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+ ret = drm_mode_group_init_legacy_group(dev, &dev->primary->mode_group);
+ if (ret)
+- goto err_g3;
++ goto err_g4;
+ }
+
+ list_add_tail(&dev->driver_item, &driver->device_list);
+@@ -432,8 +432,11 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
+
+ return 0;
+
+-err_g3:
++err_g4:
+ drm_put_minor(&dev->primary);
++err_g3:
++ if (drm_core_check_feature(dev, DRIVER_MODESET))
++ drm_put_minor(&dev->control);
+ err_g2:
+ pci_disable_device(pdev);
+ err_g1:
+@@ -515,11 +518,11 @@ void drm_put_dev(struct drm_device *dev)
+ dev->agp = NULL;
+ }
+
+- drm_ht_remove(&dev->map_hash);
+- drm_ctxbitmap_cleanup(dev);
+-
+ list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head)
+ drm_rmmap(dev, r_list->map);
++ drm_ht_remove(&dev->map_hash);
++
++ drm_ctxbitmap_cleanup(dev);
+
+ if (drm_core_check_feature(dev, DRIVER_MODESET))
+ drm_put_minor(&dev->control);
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile
new file mode 100644
index 0000000..d2cbeb3
@@ -2214,10 +2319,10 @@
+#endif
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c
new file mode 100644
-index 0000000..4cb35f3
+index 0000000..f5adfef
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.c
-@@ -0,0 +1,139 @@
+@@ -0,0 +1,160 @@
+/*
+ * Copyright 2005 Stephane Marchesin.
+ * All Rights Reserved.
@@ -2251,9 +2356,12 @@
+int nouveau_mm_enabled = 0;
+module_param_named(mm_enabled, nouveau_mm_enabled, int, 0400);
+
-+int nouveau_modeset = 0; /* kms */
++int nouveau_modeset = -1; /* kms */
+module_param_named(modeset, nouveau_modeset, int, 0400);
+
++int nouveau_fbpercrtc = 0;
++module_param_named(fbpercrtc, nouveau_fbpercrtc, int, 0400);
++
+static struct pci_device_id pciidlist[] = {
+ {
+ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID),
@@ -2270,6 +2378,22 @@
+
+MODULE_DEVICE_TABLE(pci, pciidlist);
+
++static struct drm_driver driver;
++
++static int __devinit
++nouveau_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
++{
++ return drm_get_dev(pdev, ent, &driver);
++}
++
++static void
++nouveau_pci_remove(struct pci_dev *pdev)
++{
++ struct drm_device *dev = pci_get_drvdata(pdev);
++
++ drm_put_dev(dev);
++}
++
+extern struct drm_ioctl_desc nouveau_ioctls[];
+extern int nouveau_max_ioctl;
+
@@ -2305,6 +2429,8 @@
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
++ .probe = nouveau_pci_probe,
++ .remove = nouveau_pci_remove,
+ },
+
+ .gem_init_object = nouveau_gem_object_new,
@@ -2359,10 +2485,10 @@
+MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
new file mode 100644
-index 0000000..cd618e6
+index 0000000..adb7fdb
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
-@@ -0,0 +1,736 @@
+@@ -0,0 +1,737 @@
+/*
+ * Copyright 2005 Stephane Marchesin.
+ * All Rights Reserved.
@@ -2419,6 +2545,7 @@
+
+ struct drm_gem_object *gem;
+ struct drm_buffer_object *bo;
++ bool mappable;
+};
+
+static inline struct nouveau_gem_object *
@@ -2434,7 +2561,7 @@
+ uint64_t size;
+ struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
+ int flags;
-+ drm_local_map_t *map;
++ struct drm_local_map *map;
+ drm_handle_t map_handle;
+
+ struct drm_buffer_object *bo;
@@ -2490,9 +2617,9 @@
+ /* owner of this fifo */
+ struct drm_file *file_priv;
+ /* mapping of the fifo itself */
-+ drm_local_map_t *map;
++ struct drm_local_map *map;
+ /* mapping of the regs controling the fifo */
-+ drm_local_map_t *regs;
++ struct drm_local_map *regs;
+
+ /* Fencing */
+ uint32_t next_sequence;
@@ -2511,7 +2638,7 @@
+ /* Notifier memory */
+ struct mem_block *notifier_block;
+ struct mem_block *notifier_heap;
-+ drm_local_map_t *notifier_map;
++ struct drm_local_map *notifier_map;
+
+ /* PFIFO context */
+ struct nouveau_gpuobj_ref *ramfc;
@@ -2638,10 +2765,10 @@
+ int chipset;
+ int flags;
+
-+ drm_local_map_t *mmio;
-+ drm_local_map_t *fb;
-+ drm_local_map_t *ramin_map;
-+ drm_local_map_t *ramin;
++ struct drm_local_map *mmio;
++ struct drm_local_map *fb;
++ struct drm_local_map *ramin_map;
++ struct drm_local_map *ramin;
+
+ int fifo_alloc_count;
+ struct nouveau_channel *fifos[NOUVEAU_MAX_CHANNEL_NR];
@@ -3201,10 +3328,10 @@
+#endif /* __NOUVEAU_FB_H__ */
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
new file mode 100644
-index 0000000..c2ceef7
+index 0000000..4da3d40
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
-@@ -0,0 +1,932 @@
+@@ -0,0 +1,933 @@
+/*
+ * Copyright © 2007 David Airlie
+ *
@@ -3253,6 +3380,8 @@
+#include "nouveau_fb.h"
+#include "nouveau_fbcon.h"
+
++extern int nouveau_fbpercrtc;
++
+static int nouveau_fbcon_setcolreg(unsigned regno, unsigned red, unsigned green,
+ unsigned blue, unsigned transp,
+ struct fb_info *info)
@@ -3662,13 +3791,12 @@
+ ngem = gem->driver_private;
+
+ ret = nouveau_gem_pin(gem, NOUVEAU_GEM_DOMAIN_VRAM);
++ mutex_lock(&dev->struct_mutex);
+ if (ret) {
+ DRM_ERROR("failed to pin fb: %d\n", ret);
+ goto out_unref;
+ }
+
-+ mutex_lock(&dev->struct_mutex);
-+
+ fb = nouveau_framebuffer_create(dev, gem, &mode_cmd);
+ if (!fb) {
+ ret = -ENOMEM;
@@ -4103,7 +4231,7 @@
+
+ /* mode a first */
+ /* search for an fb */
-+ if (0 /*nouveau_fbpercrtc == 1*/) {
++ if (nouveau_fbpercrtc) {
+ ret = nouveau_fbcon_multi_fb_probe(dev);
+ } else {
+ ret = nouveau_fbcon_single_fb_probe(dev);
@@ -5005,10 +5133,10 @@
+int nouveau_max_ioctl = DRM_ARRAY_SIZE(nouveau_ioctls);
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
new file mode 100644
-index 0000000..1ab0884
+index 0000000..7abee4c
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
-@@ -0,0 +1,702 @@
+@@ -0,0 +1,714 @@
+/*
+ * Copyright (C) 2008 Ben Skeggs.
+ * All Rights Reserved.
@@ -5104,6 +5232,7 @@
+ if (!gem)
+ return -ENOMEM;
+ ngem = gem->driver_private;
++ ngem->mappable = true;
+
+ ret = drm_buffer_object_create(dev, size, drm_bo_type_device, flags,
+ 0, align, 0, &ngem->bo);
@@ -5114,8 +5243,13 @@
+ int class = chan ? chan->id : 0;
+
+ flags = 0;
-+ if (domain & NOUVEAU_GEM_DOMAIN_VRAM)
-+ flags |= DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0;
++ if (domain & NOUVEAU_GEM_DOMAIN_VRAM) {
++ flags |= DRM_BO_FLAG_MEM_VRAM;
++ if (flags & NOUVEAU_GEM_DOMAIN_NOMAP) {
++ flags |= DRM_BO_FLAG_MEM_PRIV0;
++ ngem->mappable = false;
++ }
++ }
+ if (domain & NOUVEAU_GEM_DOMAIN_GART)
+ flags |= DRM_BO_FLAG_MEM_TT;
+
@@ -5219,7 +5353,7 @@
+ if (write_domains) {
+ if ((valid_domains & NOUVEAU_GEM_DOMAIN_VRAM) &&
+ (write_domains & NOUVEAU_GEM_DOMAIN_VRAM))
-+ flags = (DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0);
++ flags = DRM_BO_FLAG_MEM_VRAM;
+ else
+ if ((valid_domains & NOUVEAU_GEM_DOMAIN_GART) &&
+ (write_domains & NOUVEAU_GEM_DOMAIN_GART))
@@ -5231,7 +5365,7 @@
+ (read_domains & NOUVEAU_GEM_DOMAIN_VRAM) &&
+ (bo->mem.mem_type == DRM_BO_MEM_VRAM ||
+ bo->mem.mem_type == DRM_BO_MEM_PRIV0))
-+ flags = (DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0);
++ flags = DRM_BO_FLAG_MEM_VRAM;
+ else
+ if ((valid_domains & NOUVEAU_GEM_DOMAIN_GART) &&
+ (read_domains & NOUVEAU_GEM_DOMAIN_GART) &&
@@ -5240,11 +5374,14 @@
+ else
+ if ((valid_domains & NOUVEAU_GEM_DOMAIN_VRAM) &&
+ (read_domains & NOUVEAU_GEM_DOMAIN_VRAM))
-+ flags = (DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0);
++ flags = DRM_BO_FLAG_MEM_VRAM;
+ else
+ flags = DRM_BO_FLAG_MEM_TT;
+ }
+
++ if ((flags & (DRM_BO_FLAG_MEM_VRAM)) && !ngem->mappable)
++ flags |= DRM_BO_FLAG_MEM_PRIV0;
++
+ if (read_domains)
+ flags |= DRM_BO_FLAG_READ;
+
@@ -5603,6 +5740,9 @@
+ return -EINVAL;
+ ngem = gem->driver_private;
+
++ if (!ngem->mappable)
++ return -EINVAL;
++
+ if (ngem->bo->mem.mem_type == DRM_BO_MEM_LOCAL) {
+ ret = drm_bo_do_validate(ngem->bo, DRM_BO_FLAG_MEM_TT,
+ DRM_BO_MASK_MEMTYPE,
@@ -6405,10 +6545,10 @@
+}
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
new file mode 100644
-index 0000000..5b4a646
+index 0000000..ca2b935
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
-@@ -0,0 +1,1063 @@
+@@ -0,0 +1,1066 @@
+/*
+ * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
+ * Copyright 2005 Stephane Marchesin
@@ -6720,7 +6860,7 @@
+ if (flags & 0x80000000) {
+ while (size) {
+ struct nouveau_gpuobj *pt = pgt[virt / (512*1024*1024)];
-+ int pte = ((virt % (512*1024*1024)) / psz) * 2;
++ int pte = ((u32)(virt % (512*1024*1024)) / psz) * 2;
+
+ INSTANCE_WR(pt, pte++, 0x00000000);
+ INSTANCE_WR(pt, pte++, 0x00000000);
@@ -6731,7 +6871,7 @@
+ } else {
+ while (size) {
+ struct nouveau_gpuobj *pt = pgt[virt / (512*1024*1024)];
-+ int pte = ((virt % (512*1024*1024)) / psz) * 2;
++ int pte = ((u32)(virt % (512*1024*1024)) / psz) * 2;
+
+ INSTANCE_WR(pt, pte++, phys | pfl);
+ INSTANCE_WR(pt, pte++, flags);
@@ -7179,8 +7319,11 @@
+ if (!block)
+ return NULL;
+
-+ if (flags & (NOUVEAU_MEM_FB | NOUVEAU_MEM_FB_ACCEPTABLE))
++ if (flags & (NOUVEAU_MEM_FB | NOUVEAU_MEM_FB_ACCEPTABLE)) {
+ memtype |= DRM_BO_FLAG_MEM_VRAM;
++ if (!(flags & NOUVEAU_MEM_MAPPED))
++ memtype |= DRM_BO_FLAG_MEM_PRIV0;
++ }
+ if (flags & NOUVEAU_MEM_AGP)
+ memtype |= DRM_BO_FLAG_MEM_TT;
+ if (flags & NOUVEAU_MEM_NOVM)
@@ -10099,7 +10242,7 @@
+}
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
new file mode 100644
-index 0000000..ead4c55
+index 0000000..19c8861
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -0,0 +1,935 @@
@@ -10561,7 +10704,7 @@
+ ret);
+ return -EINVAL;
+ }
-+ DRM_DEBUG("regs mapped ok at 0x%lx\n", dev_priv->mmio->offset);
++ DRM_DEBUG("regs mapped ok at 0x%lx\n", (unsigned long)dev_priv->mmio->offset);
+
+#if defined(__powerpc__)
+ /* Put the card in BE mode if it's not */
@@ -16853,10 +16996,10 @@
+}
diff --git a/drivers/gpu/drm/nouveau/nv50_connector.c b/drivers/gpu/drm/nouveau/nv50_connector.c
new file mode 100644
-index 0000000..1458d0e
+index 0000000..6e7d5fe
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nv50_connector.c
-@@ -0,0 +1,625 @@
+@@ -0,0 +1,593 @@
+/*
+ * Copyright (C) 2008 Maarten Maathuis.
+ * All Rights Reserved.
@@ -16997,42 +17140,27 @@
+ return NULL;
+}
+
-+static int nv50_connector_hpd_detect(struct nouveau_connector *connector)
++static bool nv50_connector_hpd_detect(struct nouveau_connector *connector)
+{
+ struct drm_nouveau_private *dev_priv = connector->base.dev->dev_private;
-+ bool present = 0;
-+ uint32_t reg = 0;
-+
-+ /* No i2c port, no idea what to do for hotplug. */
-+ if (connector->i2c_chan->index == 15) {
-+ DRM_ERROR("You have a non-LVDS SOR with no i2c port, "
-+ "please report\n");
-+ return -EINVAL;
-+ }
-+
-+ if (connector->i2c_chan->index > 3) {
-+ DRM_ERROR("You have an unusual configuration, index is %d\n",
-+ connector->i2c_chan->index);
-+ DRM_ERROR("Please report.\n");
-+ return -EINVAL;
-+ }
++ uint32_t bus = connector->bus, reg;
++ bool present = false;
+
-+ /* Check hotplug pins. */
+ reg = nv_rd32(NV50_PCONNECTOR_HOTPLUG_STATE);
-+ if (reg & (NV50_PCONNECTOR_HOTPLUG_STATE_PIN_CONNECTED_I2C0 <<
-+ (4 * connector->i2c_chan->index)))
-+ present = 1;
++ if (reg & (NV50_PCONNECTOR_HOTPLUG_STATE_PIN_CONNECTED_I2C0 << (4 * bus)))
++ present = true;
+
-+ DRM_DEBUG("hpd_detect: bus=%d present=%d\n", connector->bus, present);
++ DRM_DEBUG("hpd_detect: bus=%d reg=0x%08x present=%d\n",
++ connector->bus, reg, present);
+ return present;
+}
+
-+static int nv50_connector_i2c_detect(struct nouveau_connector *connector)
++static bool nv50_connector_i2c_detect(struct nouveau_connector *connector)
+{
+ /* kindly borrrowed from the intel driver, hope it works. */
+ uint8_t out_buf[] = { 0x0, 0x0};
+ uint8_t buf[2];
-+ int ret;
++ bool ret;
+ struct i2c_msg msgs[] = {
+ {
+ .addr = 0x50,
@@ -17049,7 +17177,7 @@
+ };
+
+ if (!connector->i2c_chan)
-+ return -EINVAL;
++ return false;
+
+ ret = (i2c_transfer(&connector->i2c_chan->adapter, msgs, 2) == 2);
+
@@ -17112,24 +17240,15 @@
+ struct nouveau_connector *connector = to_nouveau_connector(drm_connector);
+ struct nouveau_encoder *encoder = NULL;
+ struct drm_encoder_helper_funcs *helper = NULL;
-+ int ret;
++ bool hpd, i2c;
+
+ if (drm_connector->connector_type == DRM_MODE_CONNECTOR_LVDS) {
-+ struct drm_connector_helper_funcs *helper_funcs =
-+ drm_connector->helper_private;
-+
-+ /* Always report LVDS as connected, as long as we know the
-+ * panel's native mode.
-+ */
-+ nv50_connector_set_digital(connector, true);
-+ if (!connector->native_mode)
-+ helper_funcs->get_modes(drm_connector);
-+
+ if (!connector->native_mode) {
+ DRM_ERROR("No native mode for LVDS.\n");
+ return connector_status_disconnected;
+ }
+
++ nv50_connector_set_digital(connector, true);
+ return connector_status_connected;
+ }
+
@@ -17143,11 +17262,18 @@
+ return connector_status_connected;
+ }
+
-+ ret = nv50_connector_hpd_detect(connector);
-+ if (ret < 0)
-+ ret = nv50_connector_i2c_detect(connector);
++ /* It's not certain if we can trust the hotplug pins just yet,
++ * at least, we haven't found a reliable way of determining which
++ * pin is wired to which connector. We'll do both hpd and single-byte
++ * i2c detect, and report if they differ for reference, and then
++ * trust i2c detect.
++ */
++ hpd = nv50_connector_hpd_detect(connector);
++ i2c = nv50_connector_i2c_detect(connector);
++ if (hpd != i2c)
++ DRM_INFO("i2c and hpd detect differ: %d vs %d\n", i2c, hpd);
+
-+ if (ret == 1) {
++ if (i2c) {
+ nv50_connector_set_digital(connector, true);
+ return connector_status_connected;
+ }
@@ -17267,11 +17393,6 @@
+ return drm_mode_duplicate(dev, mode);
+ }
+
-+ if (connector->base.connector_type == DRM_MODE_CONNECTOR_LVDS) {
-+ mode = nv50_connector_lvds_native_mode(dev);
-+ return mode;
-+ }
-+
+ return NULL;
+}
+
@@ -17356,22 +17477,11 @@
+}
+
+static struct drm_encoder *
-+nv50_connector_best_encoder(struct drm_connector *connector)
++nv50_connector_best_encoder(struct drm_connector *drm_connector)
+{
-+ int enc_id = connector->encoder_ids[0];
-+ struct drm_mode_object *obj;
-+ struct drm_encoder *encoder;
-+
-+ /* pick the encoder ids */
-+ if (enc_id) {
-+ obj = drm_mode_object_find(connector->dev, enc_id, DRM_MODE_OBJECT_ENCODER);
-+ if (!obj)
-+ return NULL;
-+ encoder = obj_to_encoder(obj);
-+ return encoder;
-+ }
++ struct nouveau_connector *connector = to_nouveau_connector(drm_connector);
+
-+ return NULL;
++ return &connector->to_encoder(connector, connector->digital)->base;
+}
+
+static const struct drm_connector_helper_funcs nv50_connector_helper_funcs = {
@@ -17414,6 +17524,7 @@
+ DRM_INFO("Detected a DVI-I connector\n");
+ break;
+ case DRM_MODE_CONNECTOR_LVDS:
++ connector->native_mode = nv50_connector_lvds_native_mode(dev);
+ DRM_INFO("Detected a LVDS connector\n");
+ break;
+ case DRM_MODE_CONNECTOR_SVIDEO:
@@ -17484,10 +17595,10 @@
+}
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c
new file mode 100644
-index 0000000..48aa0ca
+index 0000000..95376f9
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nv50_crtc.c
-@@ -0,0 +1,726 @@
+@@ -0,0 +1,728 @@
+/*
+ * Copyright (C) 2008 Maarten Maathuis.
+ * All Rights Reserved.
@@ -17542,7 +17653,6 @@
+
+ OUT_MODE(NV50_CRTC0_CLUT_MODE + offset,
+ NV50_CRTC0_CLUT_MODE_BLANK);
-+ OUT_MODE(NV50_CRTC0_CLUT_OFFSET + offset, 0);
+ if (dev_priv->chipset != 0x50)
+ OUT_MODE(NV84_CRTC0_BLANK_UNK1 + offset,
+ NV84_CRTC0_BLANK_UNK1_BLANK);
@@ -17552,9 +17662,6 @@
+ OUT_MODE(NV84_CRTC0_BLANK_UNK2 + offset,
+ NV84_CRTC0_BLANK_UNK2_BLANK);
+ } else {
-+ struct nouveau_framebuffer *fb = to_nouveau_framebuffer(crtc->base.fb);
-+ uint32_t v_lut = crtc->lut->bo->offset - dev_priv->vm_vram_base;
-+
+ crtc->cursor->set_offset(crtc);
+
+ if (dev_priv->chipset != 0x50)
@@ -17566,9 +17673,6 @@
+ else
+ crtc->cursor->hide(crtc);
+
-+ OUT_MODE(NV50_CRTC0_CLUT_MODE + offset, fb->base.depth == 8 ?
-+ NV50_CRTC0_CLUT_MODE_OFF : NV50_CRTC0_CLUT_MODE_ON);
-+ OUT_MODE(NV50_CRTC0_CLUT_OFFSET + offset, v_lut >> 8);
+ if (dev_priv->chipset != 0x50)
+ OUT_MODE(NV84_CRTC0_BLANK_UNK1 + offset,
+ NV84_CRTC0_BLANK_UNK1_UNBLANK);
@@ -17637,6 +17741,9 @@
+
+ DRM_DEBUG("\n");
+
++ if (!connector->digital)
++ scaling_mode = DRM_MODE_SCALE_NON_GPU;
++
+ switch (scaling_mode) {
+ case DRM_MODE_SCALE_NO_SCALE:
+ case DRM_MODE_SCALE_NON_GPU:
@@ -17846,6 +17953,7 @@
+static void nv50_crtc_destroy(struct drm_crtc *drm_crtc)
+{
+ struct nouveau_crtc *crtc = to_nouveau_crtc(drm_crtc);
++ struct drm_device *dev = drm_crtc->dev;
+
+ DRM_DEBUG("\n");
+
@@ -17857,7 +17965,7 @@
+ nv50_lut_destroy(crtc);
+ nv50_cursor_destroy(crtc);
+
-+ kfree(crtc->mode);
++ drm_mode_destroy(dev, crtc->mode);
+ kfree(crtc);
+}
+
@@ -17980,10 +18088,10 @@
+ hsync_start_to_end = mode->htotal - mode->hsync_start;
+ vsync_start_to_end = mode->vtotal - mode->vsync_start;
+ /* I can't give this a proper name, anyone else can? */
-+ hunk1 = mode->htotal - mode->hsync_start + mode->hdisplay + 1;
-+ vunk1 = mode->vtotal - mode->vsync_start + mode->vdisplay + 1;
++ hunk1 = mode->htotal - mode->hsync_start + mode->hdisplay;
++ vunk1 = mode->vtotal - mode->vsync_start + mode->vdisplay;
+ /* Another strange value, this time only for interlaced modes. */
-+ vunk2a = 2*mode->vtotal - mode->vsync_start + mode->vdisplay + 1;
++ vunk2a = 2*mode->vtotal - mode->vsync_start + mode->vdisplay;
+ vunk2b = mode->vtotal - mode->vsync_start + mode->vtotal;
+
+ if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
@@ -18132,6 +18240,7 @@
+ struct nouveau_framebuffer *fb = to_nouveau_framebuffer(drm_fb);
+ struct nouveau_gem_object *ngem = nouveau_gem_object(fb->gem);
+ uint32_t v_vram = ngem->bo->offset - dev_priv->vm_vram_base;
++ uint32_t v_lut = crtc->lut->bo->offset - dev_priv->vm_vram_base;
+ uint32_t offset = crtc->index * 0x400;
+
+ OUT_MODE(NV50_CRTC0_FB_OFFSET + offset, v_vram >> 8);
@@ -18162,6 +18271,10 @@
+ NV50_CRTC_COLOR_CTRL_MODE_COLOR);
+ OUT_MODE(NV50_CRTC0_FB_POS + offset, (y << 16) | x);
+
++ OUT_MODE(NV50_CRTC0_CLUT_MODE + offset, fb->base.depth == 8 ?
++ NV50_CRTC0_CLUT_MODE_OFF : NV50_CRTC0_CLUT_MODE_ON);
++ OUT_MODE(NV50_CRTC0_CLUT_OFFSET + offset, v_lut >> 8);
++
+ OUT_MODE(NV50_UPDATE_DISPLAY, 0);
+ return 0;
+}
@@ -18188,7 +18301,7 @@
+ if (!crtc)
+ return -ENOMEM;
+
-+ crtc->mode = kzalloc(sizeof(*crtc->mode), GFP_KERNEL);
++ crtc->mode = drm_mode_create(dev);
+ if (!crtc->mode) {
+ kfree(crtc);
+ return -ENOMEM;
@@ -18760,10 +18873,10 @@
+
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
new file mode 100644
-index 0000000..0008fca
+index 0000000..0fbcf67
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
-@@ -0,0 +1,437 @@
+@@ -0,0 +1,439 @@
+/*
+ * Copyright (C) 2008 Maarten Maathuis.
+ * All Rights Reserved.
@@ -18908,13 +19021,15 @@
+ OUT_MODE(NV50_CRTC0_DISPLAY_START, 0);
+ OUT_MODE(NV50_CRTC0_UNK82C, 0);
+
++ OUT_MODE(NV50_UPDATE_DISPLAY, 0);
++
+ /* enable clock change interrupts. */
+// nv_wr32(NV50_PDISPLAY_SUPERVISOR_INTR, nv_rd32(NV50_PDISPLAY_SUPERVISOR_INTR) | 0x70);
+
+ /* enable hotplug interrupts */
++ nv_wr32(NV50_PCONNECTOR_HOTPLUG_CTRL, 0x7FFF7FFF);
+// nv_wr32(NV50_PCONNECTOR_HOTPLUG_INTR, 0x7FFF7FFF);
+
-+ OUT_MODE(NV50_UPDATE_DISPLAY, 0);
+
+ return 0;
+}
@@ -42441,10 +42556,10 @@
+}
diff --git a/drivers/gpu/drm/nouveau/nv50_sor.c b/drivers/gpu/drm/nouveau/nv50_sor.c
new file mode 100644
-index 0000000..179ca1a
+index 0000000..fd29ffc
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nv50_sor.c
-@@ -0,0 +1,272 @@
+@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2008 Maarten Maathuis.
+ * All Rights Reserved.
@@ -42584,8 +42699,11 @@
+
+ if ((connector->scaling_mode != DRM_MODE_SCALE_NON_GPU &&
+ connector->scaling_mode != DRM_MODE_SCALE_NO_SCALE) &&
-+ connector->native_mode)
++ connector->native_mode) {
++ int id = adjusted_mode->base.id;
+ *adjusted_mode = *connector->native_mode;
++ adjusted_mode->base.id = id;
++ }
+
+ return true;
+}
@@ -42727,10 +42845,10 @@
unifdef-y += via_drm.h
+unifdef-y += nouveau_drm.h
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
-index c963f25..7c6d668 100644
+index 99e348d..e57c98f 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
-@@ -1206,6 +1206,8 @@ extern void drm_idlelock_release(struct drm_lock_data *lock_data);
+@@ -1267,6 +1267,8 @@ extern void drm_idlelock_release(struct drm_lock_data *lock_data);
extern int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv);
/* Buffer management support (drm_bufs.h) */
@@ -42738,7 +42856,7 @@
+ drm_local_map_t *map);
extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request);
extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request);
- extern int drm_addmap(struct drm_device *dev, unsigned int offset,
+ extern int drm_addmap(struct drm_device *dev, resource_size_t offset,
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h
new file mode 100644
index 0000000..4147f35
@@ -43044,42 +43162,3 @@
+#define DRM_NOUVEAU_GEM_TILE 0x48
+
+#endif /* __NOUVEAU_DRM_H__ */
-diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
-index 445c762..a528dc9 100644
---- a/drivers/gpu/drm/drm_bufs.c
-+++ b/drivers/gpu/drm/drm_bufs.c
-@@ -51,7 +51,7 @@ resource_size_t drm_get_resource_len(struct drm_device *dev, unsigned int resour
-
- EXPORT_SYMBOL(drm_get_resource_len);
-
--static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
-+struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
- struct drm_local_map *map)
- {
- struct drm_map_list *entry;
-@@ -83,6 +83,7 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
-
- return NULL;
- }
-+EXPORT_SYMBOL(drm_find_matching_map);
-
- static int drm_map_handle(struct drm_device *dev, struct drm_hash_item *hash,
- unsigned long user_token, int hashed_handle, int shm)
-diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
-index 7c41600..82b0731 100644
---- a/drivers/gpu/drm/drm_stub.c
-+++ b/drivers/gpu/drm/drm_stub.c
-@@ -501,11 +501,10 @@ void drm_put_dev(struct drm_device *dev)
- dev->agp = NULL;
- }
-
-- drm_ht_remove(&dev->map_hash);
-- drm_ctxbitmap_cleanup(dev);
--
- list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head)
- drm_rmmap(dev, r_list->map);
-+ drm_ht_remove(&dev->map_hash);
-+ drm_ctxbitmap_cleanup(dev);
-
- if (drm_core_check_feature(dev, DRIVER_MODESET))
- drm_put_minor(&dev->control);
Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1356
retrieving revision 1.1357
diff -u -r1.1356 -r1.1357
--- kernel.spec 28 Feb 2009 15:35:26 -0000 1.1356
+++ kernel.spec 2 Mar 2009 06:13:20 -0000 1.1357
@@ -649,7 +649,6 @@
#Patch1815: drm-intel-next.patch
Patch1816: drm-no-gem-on-i8xx.patch
Patch1818: drm-i915-resume-force-mode.patch
-Patch1819: drm-maybe-fix-nouveau.patch
# kludge to make ich9 e1000 work
Patch2000: linux-2.6-e1000-ich9.patch
@@ -1185,7 +1184,6 @@
#ApplyPatch drm-intel-next.patch
ApplyPatch drm-no-gem-on-i8xx.patch
ApplyPatch drm-i915-resume-force-mode.patch
-ApplyPatch drm-maybe-fix-nouveau.patch
# linux1394 git patches
ApplyPatch linux-2.6-firewire-git-update.patch
@@ -1792,6 +1790,9 @@
# and build.
%changelog
+* Mon Mar 02 2009 Ben Skeggs <bskeggs at redhat.com>
+- nouveau fixes for recent drm-next changes, and various kms issues
+
* Sat Feb 28 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29-0.176.rc6.git5
- Linux 2.6.29-rc6-git5
- Removed parts of v4l-fixes patch that were merged upstream.
More information about the fedora-extras-commits
mailing list