aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-05-07 11:09:09 -0400
committerDave Airlie <airlied@redhat.com>2012-05-07 11:09:35 -0400
commit4f256e8aa3eda15c11c3cec3ec5336e1fc579cbd (patch)
tree33c02b5e18e79756005a3edfa7c862a47de668d5 /drivers/gpu/drm
parent4086b1e2b19729eebf632073b9d4ab811726d8eb (diff)
parentdc257cf154be708ecc47b8b89c12ad8cd2cc35e4 (diff)
Merge branch 'for-airlied' of git://people.freedesktop.org/~danvet/drm-intel into drm-core-next
Daniel prepared this branch with a back-merge as git was getting very confused about changes in intel_display.c
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_bufs.c12
-rw-r--r--drivers/gpu/drm/drm_crtc.c10
-rw-r--r--drivers/gpu/drm/drm_fops.c6
-rw-r--r--drivers/gpu/drm/drm_usb.c6
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gem.c34
-rw-r--r--drivers/gpu/drm/gma500/mdfld_dsi_output.h1
-rw-r--r--drivers/gpu/drm/i810/i810_dma.c6
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c3
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c15
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c4
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c8
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c29
-rw-r--r--drivers/gpu/drm/i915/intel_display.c23
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h4
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c4
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c2
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c10
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c2
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c8
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c34
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_acpi.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bios.c10
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_hdmi.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_pm.c1
-rw-r--r--drivers/gpu/drm/nouveau/nv10_gpio.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv50_sor.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_fb.c5
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c7
-rw-r--r--drivers/gpu/drm/radeon/r600.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq_kms.c6
-rw-r--r--drivers/gpu/drm/radeon/rv770.c4
-rw-r--r--drivers/gpu/drm/radeon/si.c5
35 files changed, 160 insertions, 124 deletions
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 30372f7b2d45..348b367debeb 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -1510,8 +1510,8 @@ int drm_freebufs(struct drm_device *dev, void *data,
1510 * \param arg pointer to a drm_buf_map structure. 1510 * \param arg pointer to a drm_buf_map structure.
1511 * \return zero on success or a negative number on failure. 1511 * \return zero on success or a negative number on failure.
1512 * 1512 *
1513 * Maps the AGP, SG or PCI buffer region with do_mmap(), and copies information 1513 * Maps the AGP, SG or PCI buffer region with vm_mmap(), and copies information
1514 * about each buffer into user space. For PCI buffers, it calls do_mmap() with 1514 * about each buffer into user space. For PCI buffers, it calls vm_mmap() with
1515 * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls 1515 * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls
1516 * drm_mmap_dma(). 1516 * drm_mmap_dma().
1517 */ 1517 */
@@ -1553,18 +1553,14 @@ int drm_mapbufs(struct drm_device *dev, void *data,
1553 retcode = -EINVAL; 1553 retcode = -EINVAL;
1554 goto done; 1554 goto done;
1555 } 1555 }
1556 down_write(&current->mm->mmap_sem); 1556 virtual = vm_mmap(file_priv->filp, 0, map->size,
1557 virtual = do_mmap(file_priv->filp, 0, map->size,
1558 PROT_READ | PROT_WRITE, 1557 PROT_READ | PROT_WRITE,
1559 MAP_SHARED, 1558 MAP_SHARED,
1560 token); 1559 token);
1561 up_write(&current->mm->mmap_sem);
1562 } else { 1560 } else {
1563 down_write(&current->mm->mmap_sem); 1561 virtual = vm_mmap(file_priv->filp, 0, dma->byte_count,
1564 virtual = do_mmap(file_priv->filp, 0, dma->byte_count,
1565 PROT_READ | PROT_WRITE, 1562 PROT_READ | PROT_WRITE,
1566 MAP_SHARED, 0); 1563 MAP_SHARED, 0);
1567 up_write(&current->mm->mmap_sem);
1568 } 1564 }
1569 if (virtual > -1024UL) { 1565 if (virtual > -1024UL) {
1570 /* Real error */ 1566 /* Real error */
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 3519b6c174a9..ee63a123235c 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -3376,10 +3376,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
3376 3376
3377 ret = crtc->funcs->page_flip(crtc, fb, e); 3377 ret = crtc->funcs->page_flip(crtc, fb, e);
3378 if (ret) { 3378 if (ret) {
3379 spin_lock_irqsave(&dev->event_lock, flags); 3379 if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
3380 file_priv->event_space += sizeof e->event; 3380 spin_lock_irqsave(&dev->event_lock, flags);
3381 spin_unlock_irqrestore(&dev->event_lock, flags); 3381 file_priv->event_space += sizeof e->event;
3382 kfree(e); 3382 spin_unlock_irqrestore(&dev->event_lock, flags);
3383 kfree(e);
3384 }
3383 } 3385 }
3384 3386
3385out: 3387out:
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index cdfbf27b2b3c..123de28f94ef 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -507,12 +507,12 @@ int drm_release(struct inode *inode, struct file *filp)
507 507
508 drm_events_release(file_priv); 508 drm_events_release(file_priv);
509 509
510 if (dev->driver->driver_features & DRIVER_GEM)
511 drm_gem_release(dev, file_priv);
512
513 if (dev->driver->driver_features & DRIVER_MODESET) 510 if (dev->driver->driver_features & DRIVER_MODESET)
514 drm_fb_release(file_priv); 511 drm_fb_release(file_priv);
515 512
513 if (dev->driver->driver_features & DRIVER_GEM)
514 drm_gem_release(dev, file_priv);
515
516 mutex_lock(&dev->ctxlist_mutex); 516 mutex_lock(&dev->ctxlist_mutex);
517 if (!list_empty(&dev->ctxlist)) { 517 if (!list_empty(&dev->ctxlist)) {
518 struct drm_ctx_list *pos, *n; 518 struct drm_ctx_list *pos, *n;
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index c8c83dad2ce1..37c9a523dd1c 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -1,6 +1,6 @@
1#include "drmP.h" 1#include "drmP.h"
2#include <linux/usb.h> 2#include <linux/usb.h>
3#include <linux/export.h> 3#include <linux/module.h>
4 4
5int drm_get_usb_dev(struct usb_interface *interface, 5int drm_get_usb_dev(struct usb_interface *interface,
6 const struct usb_device_id *id, 6 const struct usb_device_id *id,
@@ -114,3 +114,7 @@ void drm_usb_exit(struct drm_driver *driver,
114 usb_deregister(udriver); 114 usb_deregister(udriver);
115} 115}
116EXPORT_SYMBOL(drm_usb_exit); 116EXPORT_SYMBOL(drm_usb_exit);
117
118MODULE_AUTHOR("David Airlie");
119MODULE_DESCRIPTION("USB DRM support");
120MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index 26d51979116b..1dffa8359f88 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -149,22 +149,12 @@ static int exynos_drm_gem_map_pages(struct drm_gem_object *obj,
149 unsigned long pfn; 149 unsigned long pfn;
150 150
151 if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { 151 if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) {
152 unsigned long usize = buf->size;
153
154 if (!buf->pages) 152 if (!buf->pages)
155 return -EINTR; 153 return -EINTR;
156 154
157 while (usize > 0) { 155 pfn = page_to_pfn(buf->pages[page_offset++]);
158 pfn = page_to_pfn(buf->pages[page_offset++]); 156 } else
159 vm_insert_mixed(vma, f_vaddr, pfn); 157 pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset;
160 f_vaddr += PAGE_SIZE;
161 usize -= PAGE_SIZE;
162 }
163
164 return 0;
165 }
166
167 pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset;
168 158
169 return vm_insert_mixed(vma, f_vaddr, pfn); 159 return vm_insert_mixed(vma, f_vaddr, pfn);
170} 160}
@@ -524,6 +514,8 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp,
524 if (!buffer->pages) 514 if (!buffer->pages)
525 return -EINVAL; 515 return -EINVAL;
526 516
517 vma->vm_flags |= VM_MIXEDMAP;
518
527 do { 519 do {
528 ret = vm_insert_page(vma, uaddr, buffer->pages[i++]); 520 ret = vm_insert_page(vma, uaddr, buffer->pages[i++]);
529 if (ret) { 521 if (ret) {
@@ -581,10 +573,8 @@ int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data,
581 obj->filp->f_op = &exynos_drm_gem_fops; 573 obj->filp->f_op = &exynos_drm_gem_fops;
582 obj->filp->private_data = obj; 574 obj->filp->private_data = obj;
583 575
584 down_write(&current->mm->mmap_sem); 576 addr = vm_mmap(obj->filp, 0, args->size,
585 addr = do_mmap(obj->filp, 0, args->size,
586 PROT_READ | PROT_WRITE, MAP_SHARED, 0); 577 PROT_READ | PROT_WRITE, MAP_SHARED, 0);
587 up_write(&current->mm->mmap_sem);
588 578
589 drm_gem_object_unreference_unlocked(obj); 579 drm_gem_object_unreference_unlocked(obj);
590 580
@@ -712,7 +702,6 @@ int exynos_drm_gem_dumb_destroy(struct drm_file *file_priv,
712int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 702int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
713{ 703{
714 struct drm_gem_object *obj = vma->vm_private_data; 704 struct drm_gem_object *obj = vma->vm_private_data;
715 struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj);
716 struct drm_device *dev = obj->dev; 705 struct drm_device *dev = obj->dev;
717 unsigned long f_vaddr; 706 unsigned long f_vaddr;
718 pgoff_t page_offset; 707 pgoff_t page_offset;
@@ -724,21 +713,10 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
724 713
725 mutex_lock(&dev->struct_mutex); 714 mutex_lock(&dev->struct_mutex);
726 715
727 /*
728 * allocate all pages as desired size if user wants to allocate
729 * physically non-continuous memory.
730 */
731 if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) {
732 ret = exynos_drm_gem_get_pages(obj);
733 if (ret < 0)
734 goto err;
735 }
736
737 ret = exynos_drm_gem_map_pages(obj, vma, f_vaddr, page_offset); 716 ret = exynos_drm_gem_map_pages(obj, vma, f_vaddr, page_offset);
738 if (ret < 0) 717 if (ret < 0)
739 DRM_ERROR("failed to map pages.\n"); 718 DRM_ERROR("failed to map pages.\n");
740 719
741err:
742 mutex_unlock(&dev->struct_mutex); 720 mutex_unlock(&dev->struct_mutex);
743 721
744 return convert_to_vm_err_msg(ret); 722 return convert_to_vm_err_msg(ret);
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.h b/drivers/gpu/drm/gma500/mdfld_dsi_output.h
index 21071cef92a4..36eb0744841c 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.h
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.h
@@ -29,7 +29,6 @@
29#define __MDFLD_DSI_OUTPUT_H__ 29#define __MDFLD_DSI_OUTPUT_H__
30 30
31#include <linux/backlight.h> 31#include <linux/backlight.h>
32#include <linux/version.h>
33#include <drm/drmP.h> 32#include <drm/drmP.h>
34#include <drm/drm.h> 33#include <drm/drm.h>
35#include <drm/drm_crtc.h> 34#include <drm/drm_crtc.h>
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index 2c8a60c3b98e..f920fb5e42b6 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -129,6 +129,7 @@ static int i810_map_buffer(struct drm_buf *buf, struct drm_file *file_priv)
129 if (buf_priv->currently_mapped == I810_BUF_MAPPED) 129 if (buf_priv->currently_mapped == I810_BUF_MAPPED)
130 return -EINVAL; 130 return -EINVAL;
131 131
132 /* This is all entirely broken */
132 down_write(&current->mm->mmap_sem); 133 down_write(&current->mm->mmap_sem);
133 old_fops = file_priv->filp->f_op; 134 old_fops = file_priv->filp->f_op;
134 file_priv->filp->f_op = &i810_buffer_fops; 135 file_priv->filp->f_op = &i810_buffer_fops;
@@ -157,11 +158,8 @@ static int i810_unmap_buffer(struct drm_buf *buf)
157 if (buf_priv->currently_mapped != I810_BUF_MAPPED) 158 if (buf_priv->currently_mapped != I810_BUF_MAPPED)
158 return -EINVAL; 159 return -EINVAL;
159 160
160 down_write(&current->mm->mmap_sem); 161 retcode = vm_munmap((unsigned long)buf_priv->virtual,
161 retcode = do_munmap(current->mm,
162 (unsigned long)buf_priv->virtual,
163 (size_t) buf->total); 162 (size_t) buf->total);
164 up_write(&current->mm->mmap_sem);
165 163
166 buf_priv->currently_mapped = I810_BUF_UNMAPPED; 164 buf_priv->currently_mapped = I810_BUF_UNMAPPED;
167 buf_priv->virtual = NULL; 165 buf_priv->virtual = NULL;
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 35462df7cefd..a8db38617f4a 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1274,6 +1274,9 @@ static int i915_emon_status(struct seq_file *m, void *unused)
1274 unsigned long temp, chipset, gfx; 1274 unsigned long temp, chipset, gfx;
1275 int ret; 1275 int ret;
1276 1276
1277 if (!IS_GEN5(dev))
1278 return -ENODEV;
1279
1277 ret = mutex_lock_interruptible(&dev->struct_mutex); 1280 ret = mutex_lock_interruptible(&dev->struct_mutex);
1278 if (ret) 1281 if (ret)
1279 return ret; 1282 return ret;
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index a813f652fa1f..068958cdd555 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1706,6 +1706,9 @@ void i915_update_gfx_val(struct drm_i915_private *dev_priv)
1706 unsigned long diffms; 1706 unsigned long diffms;
1707 u32 count; 1707 u32 count;
1708 1708
1709 if (dev_priv->info->gen != 5)
1710 return;
1711
1709 getrawmonotonic(&now); 1712 getrawmonotonic(&now);
1710 diff1 = timespec_sub(now, dev_priv->last_time2); 1713 diff1 = timespec_sub(now, dev_priv->last_time2);
1711 1714
@@ -2148,12 +2151,14 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2148 setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed, 2151 setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed,
2149 (unsigned long) dev); 2152 (unsigned long) dev);
2150 2153
2151 spin_lock(&mchdev_lock); 2154 if (IS_GEN5(dev)) {
2152 i915_mch_dev = dev_priv; 2155 spin_lock(&mchdev_lock);
2153 dev_priv->mchdev_lock = &mchdev_lock; 2156 i915_mch_dev = dev_priv;
2154 spin_unlock(&mchdev_lock); 2157 dev_priv->mchdev_lock = &mchdev_lock;
2158 spin_unlock(&mchdev_lock);
2155 2159
2156 ips_ping_for_i915_load(); 2160 ips_ping_for_i915_load();
2161 }
2157 2162
2158 return 0; 2163 return 0;
2159 2164
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 7bc4a40132ad..dd87937e921f 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1026,11 +1026,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
1026 if (obj == NULL) 1026 if (obj == NULL)
1027 return -ENOENT; 1027 return -ENOENT;
1028 1028
1029 down_write(&current->mm->mmap_sem); 1029 addr = vm_mmap(obj->filp, 0, args->size,
1030 addr = do_mmap(obj->filp, 0, args->size,
1031 PROT_READ | PROT_WRITE, MAP_SHARED, 1030 PROT_READ | PROT_WRITE, MAP_SHARED,
1032 args->offset); 1031 args->offset);
1033 up_write(&current->mm->mmap_sem);
1034 drm_gem_object_unreference_unlocked(obj); 1032 drm_gem_object_unreference_unlocked(obj);
1035 if (IS_ERR((void *)addr)) 1033 if (IS_ERR((void *)addr))
1036 return addr; 1034 return addr;
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 68ec0130a626..c77bfa9ad340 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1116,6 +1116,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
1116 return -EINVAL; 1116 return -EINVAL;
1117 } 1117 }
1118 1118
1119 if (args->num_cliprects > UINT_MAX / sizeof(*cliprects)) {
1120 DRM_DEBUG("execbuf with %u cliprects\n",
1121 args->num_cliprects);
1122 return -EINVAL;
1123 }
1119 cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects), 1124 cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects),
1120 GFP_KERNEL); 1125 GFP_KERNEL);
1121 if (cliprects == NULL) { 1126 if (cliprects == NULL) {
@@ -1387,7 +1392,8 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
1387 struct drm_i915_gem_exec_object2 *exec2_list = NULL; 1392 struct drm_i915_gem_exec_object2 *exec2_list = NULL;
1388 int ret; 1393 int ret;
1389 1394
1390 if (args->buffer_count < 1) { 1395 if (args->buffer_count < 1 ||
1396 args->buffer_count > UINT_MAX / sizeof(*exec2_list)) {
1391 DRM_DEBUG("execbuf2 with %d buffers\n", args->buffer_count); 1397 DRM_DEBUG("execbuf2 with %d buffers\n", args->buffer_count);
1392 return -EINVAL; 1398 return -EINVAL;
1393 } 1399 }
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 0976137ab79a..417ca99e697d 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -449,8 +449,8 @@ intel_crt_detect(struct drm_connector *connector, bool force)
449{ 449{
450 struct drm_device *dev = connector->dev; 450 struct drm_device *dev = connector->dev;
451 struct intel_crt *crt = intel_attached_crt(connector); 451 struct intel_crt *crt = intel_attached_crt(connector);
452 struct drm_crtc *crtc;
453 enum drm_connector_status status; 452 enum drm_connector_status status;
453 struct intel_load_detect_pipe tmp;
454 454
455 if (I915_HAS_HOTPLUG(dev)) { 455 if (I915_HAS_HOTPLUG(dev)) {
456 if (intel_crt_detect_hotplug(connector)) { 456 if (intel_crt_detect_hotplug(connector)) {
@@ -469,23 +469,16 @@ intel_crt_detect(struct drm_connector *connector, bool force)
469 return connector->status; 469 return connector->status;
470 470
471 /* for pre-945g platforms use load detect */ 471 /* for pre-945g platforms use load detect */
472 crtc = crt->base.base.crtc; 472 if (intel_get_load_detect_pipe(&crt->base, connector, NULL,
473 if (crtc && crtc->enabled) { 473 &tmp)) {
474 status = intel_crt_load_detect(crt); 474 if (intel_crt_detect_ddc(connector))
475 } else { 475 status = connector_status_connected;
476 struct intel_load_detect_pipe tmp; 476 else
477 477 status = intel_crt_load_detect(crt);
478 if (intel_get_load_detect_pipe(&crt->base, connector, NULL, 478 intel_release_load_detect_pipe(&crt->base, connector,
479 &tmp)) { 479 &tmp);
480 if (intel_crt_detect_ddc(connector)) 480 } else
481 status = connector_status_connected; 481 status = connector_status_unknown;
482 else
483 status = intel_crt_load_detect(crt);
484 intel_release_load_detect_pipe(&crt->base, connector,
485 &tmp);
486 } else
487 status = connector_status_unknown;
488 }
489 482
490 return status; 483 return status;
491} 484}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 4c844c68ec80..8c239f2d6bcd 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3078,8 +3078,11 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
3078 return false; 3078 return false;
3079 } 3079 }
3080 3080
3081 /* All interlaced capable intel hw wants timings in frames. */ 3081 /* All interlaced capable intel hw wants timings in frames. Note though
3082 drm_mode_set_crtcinfo(adjusted_mode, 0); 3082 * that intel_lvds_mode_fixup does some funny tricks with the crtc
3083 * timings, so we need to be careful not to clobber these.*/
3084 if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET))
3085 drm_mode_set_crtcinfo(adjusted_mode, 0);
3083 3086
3084 return true; 3087 return true;
3085} 3088}
@@ -5385,9 +5388,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc)
5385 struct drm_device *dev = crtc->dev; 5388 struct drm_device *dev = crtc->dev;
5386 drm_i915_private_t *dev_priv = dev->dev_private; 5389 drm_i915_private_t *dev_priv = dev->dev_private;
5387 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 5390 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5388 int pipe = intel_crtc->pipe;
5389 int dpll_reg = DPLL(pipe);
5390 int dpll = I915_READ(dpll_reg);
5391 5391
5392 if (HAS_PCH_SPLIT(dev)) 5392 if (HAS_PCH_SPLIT(dev))
5393 return; 5393 return;
@@ -5400,10 +5400,15 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc)
5400 * the manual case. 5400 * the manual case.
5401 */ 5401 */
5402 if (!HAS_PIPE_CXSR(dev) && intel_crtc->lowfreq_avail) { 5402 if (!HAS_PIPE_CXSR(dev) && intel_crtc->lowfreq_avail) {
5403 int pipe = intel_crtc->pipe;
5404 int dpll_reg = DPLL(pipe);
5405 int dpll;
5406
5403 DRM_DEBUG_DRIVER("downclocking LVDS\n"); 5407 DRM_DEBUG_DRIVER("downclocking LVDS\n");
5404 5408
5405 assert_panel_unlocked(dev_priv, pipe); 5409 assert_panel_unlocked(dev_priv, pipe);
5406 5410
5411 dpll = I915_READ(dpll_reg);
5407 dpll |= DISPLAY_RATE_SELECT_FPA1; 5412 dpll |= DISPLAY_RATE_SELECT_FPA1;
5408 I915_WRITE(dpll_reg, dpll); 5413 I915_WRITE(dpll_reg, dpll);
5409 intel_wait_for_vblank(dev, pipe); 5414 intel_wait_for_vblank(dev, pipe);
@@ -5793,7 +5798,13 @@ static int intel_gen6_queue_flip(struct drm_device *dev,
5793 OUT_RING(fb->pitches[0] | obj->tiling_mode); 5798 OUT_RING(fb->pitches[0] | obj->tiling_mode);
5794 OUT_RING(obj->gtt_offset); 5799 OUT_RING(obj->gtt_offset);
5795 5800
5796 pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE; 5801 /* Contrary to the suggestions in the documentation,
5802 * "Enable Panel Fitter" does not seem to be required when page
5803 * flipping with a non-native mode, and worse causes a normal
5804 * modeset to fail.
5805 * pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE;
5806 */
5807 pf = 0;
5797 pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; 5808 pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff;
5798 OUT_RING(pf | pipesrc); 5809 OUT_RING(pf | pipesrc);
5799 ADVANCE_LP_RING(); 5810 ADVANCE_LP_RING();
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index c5bf8bebf0b0..7a7cae77f0ca 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -117,6 +117,10 @@
117#define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) 117#define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0)
118#define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) 118#define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT)
119#define INTEL_MODE_DP_FORCE_6BPC (0x10) 119#define INTEL_MODE_DP_FORCE_6BPC (0x10)
120/* This flag must be set by the encoder's mode_fixup if it changes the crtc
121 * timings in the mode to prevent the crtc fixup from overwriting them.
122 * Currently only lvds needs that. */
123#define INTEL_MODE_CRTC_TIMINGS_SET (0x20)
120 124
121static inline void 125static inline void
122intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, 126intel_mode_set_pixel_multiplier(struct drm_display_mode *mode,
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 71ef2896be96..bf8690720a0c 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -279,6 +279,8 @@ void intel_fb_restore_mode(struct drm_device *dev)
279 struct drm_mode_config *config = &dev->mode_config; 279 struct drm_mode_config *config = &dev->mode_config;
280 struct drm_plane *plane; 280 struct drm_plane *plane;
281 281
282 mutex_lock(&dev->mode_config.mutex);
283
282 ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); 284 ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper);
283 if (ret) 285 if (ret)
284 DRM_DEBUG("failed to restore crtc mode\n"); 286 DRM_DEBUG("failed to restore crtc mode\n");
@@ -286,4 +288,6 @@ void intel_fb_restore_mode(struct drm_device *dev)
286 /* Be sure to shut off any planes that may be active */ 288 /* Be sure to shut off any planes that may be active */
287 list_for_each_entry(plane, &config->plane_list, head) 289 list_for_each_entry(plane, &config->plane_list, head)
288 plane->funcs->disable_plane(plane); 290 plane->funcs->disable_plane(plane);
291
292 mutex_unlock(&dev->mode_config.mutex);
289} 293}
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 7de2d3b85b32..1eef50d470d2 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -136,7 +136,7 @@ static void i9xx_write_infoframe(struct drm_encoder *encoder,
136 136
137 val &= ~VIDEO_DIP_SELECT_MASK; 137 val &= ~VIDEO_DIP_SELECT_MASK;
138 138
139 I915_WRITE(VIDEO_DIP_CTL, val | port | flags); 139 I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags);
140 140
141 for (i = 0; i < len; i += 4) { 141 for (i = 0; i < len; i += 4) {
142 I915_WRITE(VIDEO_DIP_DATA, *data); 142 I915_WRITE(VIDEO_DIP_DATA, *data);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 17a4630cec8a..9dee82350def 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -187,6 +187,8 @@ centre_horizontally(struct drm_display_mode *mode,
187 187
188 mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; 188 mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos;
189 mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; 189 mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width;
190
191 mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET;
190} 192}
191 193
192static void 194static void
@@ -208,6 +210,8 @@ centre_vertically(struct drm_display_mode *mode,
208 210
209 mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; 211 mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos;
210 mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; 212 mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width;
213
214 mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET;
211} 215}
212 216
213static inline u32 panel_fitter_scaling(u32 source, u32 target) 217static inline u32 panel_fitter_scaling(u32 source, u32 target)
@@ -283,6 +287,8 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
283 for_each_pipe(pipe) 287 for_each_pipe(pipe)
284 I915_WRITE(BCLRPAT(pipe), 0); 288 I915_WRITE(BCLRPAT(pipe), 0);
285 289
290 drm_mode_set_crtcinfo(adjusted_mode, 0);
291
286 switch (intel_lvds->fitting_mode) { 292 switch (intel_lvds->fitting_mode) {
287 case DRM_MODE_SCALE_CENTER: 293 case DRM_MODE_SCALE_CENTER:
288 /* 294 /*
@@ -744,7 +750,7 @@ static const struct dmi_system_id intel_no_lvds[] = {
744 .ident = "Hewlett-Packard t5745", 750 .ident = "Hewlett-Packard t5745",
745 .matches = { 751 .matches = {
746 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), 752 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
747 DMI_MATCH(DMI_BOARD_NAME, "hp t5745"), 753 DMI_MATCH(DMI_PRODUCT_NAME, "hp t5745"),
748 }, 754 },
749 }, 755 },
750 { 756 {
@@ -752,7 +758,7 @@ static const struct dmi_system_id intel_no_lvds[] = {
752 .ident = "Hewlett-Packard st5747", 758 .ident = "Hewlett-Packard st5747",
753 .matches = { 759 .matches = {
754 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), 760 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
755 DMI_MATCH(DMI_BOARD_NAME, "hp st5747"), 761 DMI_MATCH(DMI_PRODUCT_NAME, "hp st5747"),
756 }, 762 },
757 }, 763 },
758 { 764 {
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index cad45ff8251b..2b2e011e9055 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -50,8 +50,6 @@ intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,
50 adjusted_mode->vtotal = fixed_mode->vtotal; 50 adjusted_mode->vtotal = fixed_mode->vtotal;
51 51
52 adjusted_mode->clock = fixed_mode->clock; 52 adjusted_mode->clock = fixed_mode->clock;
53
54 drm_mode_set_crtcinfo(adjusted_mode, 0);
55} 53}
56 54
57/* adjusted_mode has been preset to be the panel's fixed mode */ 55/* adjusted_mode has been preset to be the panel's fixed mode */
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 12d9bc789dfb..b5ef7c145ee5 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -418,6 +418,14 @@ static int init_render_ring(struct intel_ring_buffer *ring)
418 if (INTEL_INFO(dev)->gen >= 6) { 418 if (INTEL_INFO(dev)->gen >= 6) {
419 I915_WRITE(INSTPM, 419 I915_WRITE(INSTPM,
420 INSTPM_FORCE_ORDERING << 16 | INSTPM_FORCE_ORDERING); 420 INSTPM_FORCE_ORDERING << 16 | INSTPM_FORCE_ORDERING);
421
422 /* From the Sandybridge PRM, volume 1 part 3, page 24:
423 * "If this bit is set, STCunit will have LRA as replacement
424 * policy. [...] This bit must be reset. LRA replacement
425 * policy is not supported."
426 */
427 I915_WRITE(CACHE_MODE_0,
428 CM0_STC_EVICT_DISABLE_LRA_SNB << CM0_MASK_SHIFT);
421 } 429 }
422 430
423 return ret; 431 return ret;
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index c330efd59a0e..3d9dfa57130b 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -745,6 +745,7 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,
745 uint16_t width, height; 745 uint16_t width, height;
746 uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len; 746 uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len;
747 uint16_t h_sync_offset, v_sync_offset; 747 uint16_t h_sync_offset, v_sync_offset;
748 int mode_clock;
748 749
749 width = mode->crtc_hdisplay; 750 width = mode->crtc_hdisplay;
750 height = mode->crtc_vdisplay; 751 height = mode->crtc_vdisplay;
@@ -759,7 +760,11 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,
759 h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start; 760 h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start;
760 v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start; 761 v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start;
761 762
762 dtd->part1.clock = mode->clock / 10; 763 mode_clock = mode->clock;
764 mode_clock /= intel_mode_get_pixel_multiplier(mode) ?: 1;
765 mode_clock /= 10;
766 dtd->part1.clock = mode_clock;
767
763 dtd->part1.h_active = width & 0xff; 768 dtd->part1.h_active = width & 0xff;
764 dtd->part1.h_blank = h_blank_len & 0xff; 769 dtd->part1.h_blank = h_blank_len & 0xff;
765 dtd->part1.h_high = (((width >> 8) & 0xf) << 4) | 770 dtd->part1.h_high = (((width >> 8) & 0xf) << 4) |
@@ -1010,7 +1015,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1010 struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder); 1015 struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder);
1011 u32 sdvox; 1016 u32 sdvox;
1012 struct intel_sdvo_in_out_map in_out; 1017 struct intel_sdvo_in_out_map in_out;
1013 struct intel_sdvo_dtd input_dtd; 1018 struct intel_sdvo_dtd input_dtd, output_dtd;
1014 int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); 1019 int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode);
1015 int rate; 1020 int rate;
1016 1021
@@ -1035,20 +1040,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1035 intel_sdvo->attached_output)) 1040 intel_sdvo->attached_output))
1036 return; 1041 return;
1037 1042
1038 /* We have tried to get input timing in mode_fixup, and filled into 1043 /* lvds has a special fixed output timing. */
1039 * adjusted_mode. 1044 if (intel_sdvo->is_lvds)
1040 */ 1045 intel_sdvo_get_dtd_from_mode(&output_dtd,
1041 if (intel_sdvo->is_tv || intel_sdvo->is_lvds) { 1046 intel_sdvo->sdvo_lvds_fixed_mode);
1042 input_dtd = intel_sdvo->input_dtd; 1047 else
1043 } else { 1048 intel_sdvo_get_dtd_from_mode(&output_dtd, mode);
1044 /* Set the output timing to the screen */ 1049 (void) intel_sdvo_set_output_timing(intel_sdvo, &output_dtd);
1045 if (!intel_sdvo_set_target_output(intel_sdvo,
1046 intel_sdvo->attached_output))
1047 return;
1048
1049 intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode);
1050 (void) intel_sdvo_set_output_timing(intel_sdvo, &input_dtd);
1051 }
1052 1050
1053 /* Set the input timing to the screen. Assume always input 0. */ 1051 /* Set the input timing to the screen. Assume always input 0. */
1054 if (!intel_sdvo_set_target_input(intel_sdvo)) 1052 if (!intel_sdvo_set_target_input(intel_sdvo))
@@ -1066,6 +1064,10 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1066 !intel_sdvo_set_tv_format(intel_sdvo)) 1064 !intel_sdvo_set_tv_format(intel_sdvo))
1067 return; 1065 return;
1068 1066
1067 /* We have tried to get input timing in mode_fixup, and filled into
1068 * adjusted_mode.
1069 */
1070 intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode);
1069 (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd); 1071 (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd);
1070 1072
1071 switch (pixel_multiplier) { 1073 switch (pixel_multiplier) {
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index 7814a760c164..284bd25d5d21 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -270,7 +270,7 @@ static bool nouveau_dsm_detect(void)
270 struct acpi_buffer buffer = {sizeof(acpi_method_name), acpi_method_name}; 270 struct acpi_buffer buffer = {sizeof(acpi_method_name), acpi_method_name};
271 struct pci_dev *pdev = NULL; 271 struct pci_dev *pdev = NULL;
272 int has_dsm = 0; 272 int has_dsm = 0;
273 int has_optimus; 273 int has_optimus = 0;
274 int vga_count = 0; 274 int vga_count = 0;
275 bool guid_valid; 275 bool guid_valid;
276 int retval; 276 int retval;
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
index 80963d05b54a..0be4a815e706 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -6156,10 +6156,14 @@ dcb_fake_connectors(struct nvbios *bios)
6156 6156
6157 /* heuristic: if we ever get a non-zero connector field, assume 6157 /* heuristic: if we ever get a non-zero connector field, assume
6158 * that all the indices are valid and we don't need fake them. 6158 * that all the indices are valid and we don't need fake them.
6159 *
6160 * and, as usual, a blacklist of boards with bad bios data..
6159 */ 6161 */
6160 for (i = 0; i < dcbt->entries; i++) { 6162 if (!nv_match_device(bios->dev, 0x0392, 0x107d, 0x20a2)) {
6161 if (dcbt->entry[i].connector) 6163 for (i = 0; i < dcbt->entries; i++) {
6162 return; 6164 if (dcbt->entry[i].connector)
6165 return;
6166 }
6163 } 6167 }
6164 6168
6165 /* no useful connector info available, we need to make it up 6169 /* no useful connector info available, we need to make it up
diff --git a/drivers/gpu/drm/nouveau/nouveau_hdmi.c b/drivers/gpu/drm/nouveau/nouveau_hdmi.c
index 59ea1c14eca0..c3de36384522 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hdmi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_hdmi.c
@@ -32,7 +32,9 @@ static bool
32hdmi_sor(struct drm_encoder *encoder) 32hdmi_sor(struct drm_encoder *encoder)
33{ 33{
34 struct drm_nouveau_private *dev_priv = encoder->dev->dev_private; 34 struct drm_nouveau_private *dev_priv = encoder->dev->dev_private;
35 if (dev_priv->chipset < 0xa3) 35 if (dev_priv->chipset < 0xa3 ||
36 dev_priv->chipset == 0xaa ||
37 dev_priv->chipset == 0xac)
36 return false; 38 return false;
37 return true; 39 return true;
38} 40}
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c
index 34d591b7d4ef..da3e7c3abab7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.c
@@ -235,6 +235,7 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile)
235 return -EPERM; 235 return -EPERM;
236 236
237 strncpy(string, profile, sizeof(string)); 237 strncpy(string, profile, sizeof(string));
238 string[sizeof(string) - 1] = 0;
238 if ((ptr = strchr(string, '\n'))) 239 if ((ptr = strchr(string, '\n')))
239 *ptr = '\0'; 240 *ptr = '\0';
240 241
diff --git a/drivers/gpu/drm/nouveau/nv10_gpio.c b/drivers/gpu/drm/nouveau/nv10_gpio.c
index 550ad3fcf0af..9d79180069df 100644
--- a/drivers/gpu/drm/nouveau/nv10_gpio.c
+++ b/drivers/gpu/drm/nouveau/nv10_gpio.c
@@ -65,7 +65,7 @@ nv10_gpio_drive(struct drm_device *dev, int line, int dir, int out)
65 if (line < 10) { 65 if (line < 10) {
66 line = (line - 2) * 4; 66 line = (line - 2) * 4;
67 reg = NV_PCRTC_GPIO_EXT; 67 reg = NV_PCRTC_GPIO_EXT;
68 mask = 0x00000003 << ((line - 2) * 4); 68 mask = 0x00000003;
69 data = (dir << 1) | out; 69 data = (dir << 1) | out;
70 } else 70 } else
71 if (line < 14) { 71 if (line < 14) {
diff --git a/drivers/gpu/drm/nouveau/nv50_sor.c b/drivers/gpu/drm/nouveau/nv50_sor.c
index a7844ab6a50c..274640212475 100644
--- a/drivers/gpu/drm/nouveau/nv50_sor.c
+++ b/drivers/gpu/drm/nouveau/nv50_sor.c
@@ -42,7 +42,7 @@ nv50_sor_dp_lane_map(struct drm_device *dev, struct dcb_entry *dcb, u8 lane)
42 struct drm_nouveau_private *dev_priv = dev->dev_private; 42 struct drm_nouveau_private *dev_priv = dev->dev_private;
43 static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */ 43 static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */
44 static const u8 nv50[] = { 16, 8, 0, 24 }; 44 static const u8 nv50[] = { 16, 8, 0, 24 };
45 if (dev_priv->card_type == 0xaf) 45 if (dev_priv->chipset == 0xaf)
46 return nvaf[lane]; 46 return nvaf[lane];
47 return nv50[lane]; 47 return nv50[lane];
48} 48}
diff --git a/drivers/gpu/drm/nouveau/nvc0_fb.c b/drivers/gpu/drm/nouveau/nvc0_fb.c
index 5bf55038fd92..f704e942372e 100644
--- a/drivers/gpu/drm/nouveau/nvc0_fb.c
+++ b/drivers/gpu/drm/nouveau/nvc0_fb.c
@@ -54,6 +54,11 @@ nvc0_mfb_isr(struct drm_device *dev)
54 nvc0_mfb_subp_isr(dev, unit, subp); 54 nvc0_mfb_subp_isr(dev, unit, subp);
55 units &= ~(1 << unit); 55 units &= ~(1 << unit);
56 } 56 }
57
58 /* we do something horribly wrong and upset PMFB a lot, so mask off
59 * interrupts from it after the first one until it's fixed
60 */
61 nv_mask(dev, 0x000640, 0x02000000, 0x00000000);
57} 62}
58 63
59static void 64static void
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 2fab38f5a08e..01d77d1554f4 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -575,6 +575,9 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
575 575
576 if (rdev->family < CHIP_RV770) 576 if (rdev->family < CHIP_RV770)
577 pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; 577 pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP;
578 /* use frac fb div on APUs */
579 if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev))
580 pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV;
578 } else { 581 } else {
579 pll->flags |= RADEON_PLL_LEGACY; 582 pll->flags |= RADEON_PLL_LEGACY;
580 583
@@ -954,8 +957,8 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
954 break; 957 break;
955 } 958 }
956 959
957 if (radeon_encoder->active_device & 960 if ((radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) ||
958 (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) { 961 (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE)) {
959 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 962 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
960 struct drm_connector *connector = 963 struct drm_connector *connector =
961 radeon_get_connector_for_encoder(encoder); 964 radeon_get_connector_for_encoder(encoder);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 87a2333c0c6b..d02f13fdaa66 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1135,7 +1135,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc
1135 } 1135 }
1136 if (rdev->flags & RADEON_IS_AGP) { 1136 if (rdev->flags & RADEON_IS_AGP) {
1137 size_bf = mc->gtt_start; 1137 size_bf = mc->gtt_start;
1138 size_af = 0xFFFFFFFF - mc->gtt_end + 1; 1138 size_af = 0xFFFFFFFF - mc->gtt_end;
1139 if (size_bf > size_af) { 1139 if (size_bf > size_af) {
1140 if (mc->mc_vram_size > size_bf) { 1140 if (mc->mc_vram_size > size_bf) {
1141 dev_warn(rdev->dev, "limiting VRAM\n"); 1141 dev_warn(rdev->dev, "limiting VRAM\n");
@@ -1149,7 +1149,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc
1149 mc->real_vram_size = size_af; 1149 mc->real_vram_size = size_af;
1150 mc->mc_vram_size = size_af; 1150 mc->mc_vram_size = size_af;
1151 } 1151 }
1152 mc->vram_start = mc->gtt_end; 1152 mc->vram_start = mc->gtt_end + 1;
1153 } 1153 }
1154 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; 1154 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
1155 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", 1155 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n",
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 71fa389e10fe..2914c5761cfc 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1026,7 +1026,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
1026 1026
1027 encoder = obj_to_encoder(obj); 1027 encoder = obj_to_encoder(obj);
1028 1028
1029 if (encoder->encoder_type != DRM_MODE_ENCODER_DAC || 1029 if (encoder->encoder_type != DRM_MODE_ENCODER_DAC &&
1030 encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) 1030 encoder->encoder_type != DRM_MODE_ENCODER_TVDAC)
1031 continue; 1031 continue;
1032 1032
@@ -1056,6 +1056,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
1056 * cases the DVI port is actually a virtual KVM port connected to the service 1056 * cases the DVI port is actually a virtual KVM port connected to the service
1057 * processor. 1057 * processor.
1058 */ 1058 */
1059out:
1059 if ((!rdev->is_atom_bios) && 1060 if ((!rdev->is_atom_bios) &&
1060 (ret == connector_status_disconnected) && 1061 (ret == connector_status_disconnected) &&
1061 rdev->mode_info.bios_hardcoded_edid_size) { 1062 rdev->mode_info.bios_hardcoded_edid_size) {
@@ -1063,7 +1064,6 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
1063 ret = connector_status_connected; 1064 ret = connector_status_connected;
1064 } 1065 }
1065 1066
1066out:
1067 /* updated in get modes as well since we need to know if it's analog or digital */ 1067 /* updated in get modes as well since we need to know if it's analog or digital */
1068 radeon_connector_update_scratch_regs(connector, ret); 1068 radeon_connector_update_scratch_regs(connector, ret);
1069 return ret; 1069 return ret;
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index d18f0c4a9886..ff28210dedec 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -241,8 +241,8 @@ int radeon_wb_init(struct radeon_device *rdev)
241 rdev->wb.use_event = true; 241 rdev->wb.use_event = true;
242 } 242 }
243 } 243 }
244 /* always use writeback/events on NI */ 244 /* always use writeback/events on NI, APUs */
245 if (ASIC_IS_DCE5(rdev)) { 245 if (rdev->family >= CHIP_PALM) {
246 rdev->wb.enabled = true; 246 rdev->wb.enabled = true;
247 rdev->wb.use_event = true; 247 rdev->wb.use_event = true;
248 } 248 }
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 8086c96e0b06..0a1d4bd65edc 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -533,7 +533,7 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
533 radeon_legacy_init_crtc(dev, radeon_crtc); 533 radeon_legacy_init_crtc(dev, radeon_crtc);
534} 534}
535 535
536static const char *encoder_names[36] = { 536static const char *encoder_names[37] = {
537 "NONE", 537 "NONE",
538 "INTERNAL_LVDS", 538 "INTERNAL_LVDS",
539 "INTERNAL_TMDS1", 539 "INTERNAL_TMDS1",
@@ -570,6 +570,7 @@ static const char *encoder_names[36] = {
570 "INTERNAL_UNIPHY2", 570 "INTERNAL_UNIPHY2",
571 "NUTMEG", 571 "NUTMEG",
572 "TRAVIS", 572 "TRAVIS",
573 "INTERNAL_VCE"
573}; 574};
574 575
575static const char *connector_names[15] = { 576static const char *connector_names[15] = {
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index 170f1718d92a..5df58d1aba06 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -149,6 +149,12 @@ static bool radeon_msi_ok(struct radeon_device *rdev)
149 (rdev->pdev->subsystem_device == 0x01fd)) 149 (rdev->pdev->subsystem_device == 0x01fd))
150 return true; 150 return true;
151 151
152 /* RV515 seems to have MSI issues where it loses
153 * MSI rearms occasionally. This leads to lockups and freezes.
154 * disable it by default.
155 */
156 if (rdev->family == CHIP_RV515)
157 return false;
152 if (rdev->flags & RADEON_IS_IGP) { 158 if (rdev->flags & RADEON_IS_IGP) {
153 /* APUs work fine with MSIs */ 159 /* APUs work fine with MSIs */
154 if (rdev->family >= CHIP_PALM) 160 if (rdev->family >= CHIP_PALM)
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index cacec0e20ae3..a8b001641e4b 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -969,7 +969,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
969 } 969 }
970 if (rdev->flags & RADEON_IS_AGP) { 970 if (rdev->flags & RADEON_IS_AGP) {
971 size_bf = mc->gtt_start; 971 size_bf = mc->gtt_start;
972 size_af = 0xFFFFFFFF - mc->gtt_end + 1; 972 size_af = 0xFFFFFFFF - mc->gtt_end;
973 if (size_bf > size_af) { 973 if (size_bf > size_af) {
974 if (mc->mc_vram_size > size_bf) { 974 if (mc->mc_vram_size > size_bf) {
975 dev_warn(rdev->dev, "limiting VRAM\n"); 975 dev_warn(rdev->dev, "limiting VRAM\n");
@@ -983,7 +983,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
983 mc->real_vram_size = size_af; 983 mc->real_vram_size = size_af;
984 mc->mc_vram_size = size_af; 984 mc->mc_vram_size = size_af;
985 } 985 }
986 mc->vram_start = mc->gtt_end; 986 mc->vram_start = mc->gtt_end + 1;
987 } 987 }
988 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; 988 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
989 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", 989 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n",
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 0bad5ff651d5..779f0b604fad 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2989,8 +2989,8 @@ int si_rlc_init(struct radeon_device *rdev)
2989 } 2989 }
2990 r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM, 2990 r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM,
2991 &rdev->rlc.save_restore_gpu_addr); 2991 &rdev->rlc.save_restore_gpu_addr);
2992 radeon_bo_unreserve(rdev->rlc.save_restore_obj);
2992 if (r) { 2993 if (r) {
2993 radeon_bo_unreserve(rdev->rlc.save_restore_obj);
2994 dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r); 2994 dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r);
2995 si_rlc_fini(rdev); 2995 si_rlc_fini(rdev);
2996 return r; 2996 return r;
@@ -3013,9 +3013,8 @@ int si_rlc_init(struct radeon_device *rdev)
3013 } 3013 }
3014 r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM, 3014 r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM,
3015 &rdev->rlc.clear_state_gpu_addr); 3015 &rdev->rlc.clear_state_gpu_addr);
3016 radeon_bo_unreserve(rdev->rlc.clear_state_obj);
3016 if (r) { 3017 if (r) {
3017
3018 radeon_bo_unreserve(rdev->rlc.clear_state_obj);
3019 dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r); 3018 dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r);
3020 si_rlc_fini(rdev); 3019 si_rlc_fini(rdev);
3021 return r; 3020 return r;