Merge branch 'drm-intel-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel into drm-fixes

* 'drm-intel-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel:
drm/i915: fix corruptions on i8xx due to relaxed fencing
drm/i915: skip FDI & PCH enabling for DP_A
agp/intel: Experiment with a 855GM GWB bit
drm/i915: don't enable FDI & transcoder interrupts after all
drm/i915: Ignore a hung GPU when flushing the framebuffer prior to a switch

+126 -46
+1
drivers/char/agp/intel-agp.h
··· 130 130 #define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) 131 131 132 132 #define I915_IFPADDR 0x60 133 + #define I830_HIC 0x70 133 134 134 135 /* Intel 965G registers */ 135 136 #define I965_MSAC 0x62
+21 -35
drivers/char/agp/intel-gtt.c
··· 21 21 #include <linux/kernel.h> 22 22 #include <linux/pagemap.h> 23 23 #include <linux/agp_backend.h> 24 + #include <linux/delay.h> 24 25 #include <asm/smp.h> 25 26 #include "agp.h" 26 27 #include "intel-agp.h" ··· 71 70 u32 __iomem *gtt; /* I915G */ 72 71 bool clear_fake_agp; /* on first access via agp, fill with scratch */ 73 72 int num_dcache_entries; 74 - union { 75 - void __iomem *i9xx_flush_page; 76 - void *i8xx_flush_page; 77 - }; 73 + void __iomem *i9xx_flush_page; 78 74 char *i81x_gtt_table; 79 - struct page *i8xx_page; 80 75 struct resource ifp_resource; 81 76 int resource_valid; 82 77 struct page *scratch_page; ··· 719 722 720 723 static void i830_cleanup(void) 721 724 { 722 - if (intel_private.i8xx_flush_page) { 723 - kunmap(intel_private.i8xx_flush_page); 724 - intel_private.i8xx_flush_page = NULL; 725 - } 726 - 727 - __free_page(intel_private.i8xx_page); 728 - intel_private.i8xx_page = NULL; 729 - } 730 - 731 - static void intel_i830_setup_flush(void) 732 - { 733 - /* return if we've already set the flush mechanism up */ 734 - if (intel_private.i8xx_page) 735 - return; 736 - 737 - intel_private.i8xx_page = alloc_page(GFP_KERNEL); 738 - if (!intel_private.i8xx_page) 739 - return; 740 - 741 - intel_private.i8xx_flush_page = kmap(intel_private.i8xx_page); 742 - if (!intel_private.i8xx_flush_page) 743 - i830_cleanup(); 744 725 } 745 726 746 727 /* The chipset_flush interface needs to get data that has already been ··· 733 758 */ 734 759 static void i830_chipset_flush(void) 735 760 { 736 - unsigned int *pg = intel_private.i8xx_flush_page; 761 + unsigned long timeout = jiffies + msecs_to_jiffies(1000); 737 762 738 - memset(pg, 0, 1024); 763 + /* Forcibly evict everything from the CPU write buffers. 764 + * clflush appears to be insufficient. 765 + */ 766 + wbinvd_on_all_cpus(); 739 767 740 - if (cpu_has_clflush) 741 - clflush_cache_range(pg, 1024); 742 - else if (wbinvd_on_all_cpus() != 0) 743 - printk(KERN_ERR "Timed out waiting for cache flush.\n"); 768 + /* Now we've only seen documents for this magic bit on 855GM, 769 + * we hope it exists for the other gen2 chipsets... 770 + * 771 + * Also works as advertised on my 845G. 772 + */ 773 + writel(readl(intel_private.registers+I830_HIC) | (1<<31), 774 + intel_private.registers+I830_HIC); 775 + 776 + while (readl(intel_private.registers+I830_HIC) & (1<<31)) { 777 + if (time_after(jiffies, timeout)) 778 + break; 779 + 780 + udelay(50); 781 + } 744 782 } 745 783 746 784 static void i830_write_entry(dma_addr_t addr, unsigned int entry, ··· 836 848 return -ENOMEM; 837 849 838 850 intel_private.gtt_bus_addr = reg_addr + I810_PTE_BASE; 839 - 840 - intel_i830_setup_flush(); 841 851 842 852 return 0; 843 853 }
+15 -1
drivers/gpu/drm/i915/i915_gem_tiling.c
··· 184 184 static bool 185 185 i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) 186 186 { 187 - int tile_width; 187 + int tile_width, tile_height; 188 188 189 189 /* Linear is always fine */ 190 190 if (tiling_mode == I915_TILING_NONE) ··· 214 214 return false; 215 215 } 216 216 } 217 + 218 + if (IS_GEN2(dev) || 219 + (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev))) 220 + tile_height = 32; 221 + else 222 + tile_height = 8; 223 + /* i8xx is strange: It has 2 interleaved rows of tiles, so needs an even 224 + * number of tile rows. */ 225 + if (IS_GEN2(dev)) 226 + tile_height *= 2; 227 + 228 + /* Size needs to be aligned to a full tile row */ 229 + if (size & (tile_height * stride - 1)) 230 + return false; 217 231 218 232 /* 965+ just needs multiples of tile width */ 219 233 if (INTEL_INFO(dev)->gen >= 4) {
+3 -3
drivers/gpu/drm/i915/i915_irq.c
··· 316 316 struct drm_mode_config *mode_config = &dev->mode_config; 317 317 struct intel_encoder *encoder; 318 318 319 + DRM_DEBUG_KMS("running encoder hotplug functions\n"); 320 + 319 321 list_for_each_entry(encoder, &mode_config->encoder_list, base.head) 320 322 if (encoder->hot_plug) 321 323 encoder->hot_plug(encoder); ··· 1651 1649 } else { 1652 1650 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | 1653 1651 SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; 1654 - hotplug_mask |= SDE_AUX_MASK | SDE_FDI_MASK | SDE_TRANS_MASK; 1655 - I915_WRITE(FDI_RXA_IMR, 0); 1656 - I915_WRITE(FDI_RXB_IMR, 0); 1652 + hotplug_mask |= SDE_AUX_MASK; 1657 1653 } 1658 1654 1659 1655 dev_priv->pch_irq_mask = ~hotplug_mask;
+86 -7
drivers/gpu/drm/i915/intel_display.c
··· 1630 1630 struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; 1631 1631 1632 1632 wait_event(dev_priv->pending_flip_queue, 1633 + atomic_read(&dev_priv->mm.wedged) || 1633 1634 atomic_read(&obj->pending_flip) == 0); 1634 1635 1635 1636 /* Big Hammer, we also need to ensure that any pending 1636 1637 * MI_WAIT_FOR_EVENT inside a user batch buffer on the 1637 1638 * current scanout is retired before unpinning the old 1638 1639 * framebuffer. 1640 + * 1641 + * This should only fail upon a hung GPU, in which case we 1642 + * can safely continue. 1639 1643 */ 1640 1644 ret = i915_gem_object_flush_gpu(obj, false); 1641 - if (ret) { 1642 - i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj); 1643 - mutex_unlock(&dev->struct_mutex); 1644 - return ret; 1645 - } 1645 + (void) ret; 1646 1646 } 1647 1647 1648 1648 ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, ··· 2045 2045 atomic_read(&obj->pending_flip) == 0); 2046 2046 } 2047 2047 2048 + static bool intel_crtc_driving_pch(struct drm_crtc *crtc) 2049 + { 2050 + struct drm_device *dev = crtc->dev; 2051 + struct drm_mode_config *mode_config = &dev->mode_config; 2052 + struct intel_encoder *encoder; 2053 + 2054 + /* 2055 + * If there's a non-PCH eDP on this crtc, it must be DP_A, and that 2056 + * must be driven by its own crtc; no sharing is possible. 2057 + */ 2058 + list_for_each_entry(encoder, &mode_config->encoder_list, base.head) { 2059 + if (encoder->base.crtc != crtc) 2060 + continue; 2061 + 2062 + switch (encoder->type) { 2063 + case INTEL_OUTPUT_EDP: 2064 + if (!intel_encoder_is_pch_edp(&encoder->base)) 2065 + return false; 2066 + continue; 2067 + } 2068 + } 2069 + 2070 + return true; 2071 + } 2072 + 2048 2073 static void ironlake_crtc_enable(struct drm_crtc *crtc) 2049 2074 { 2050 2075 struct drm_device *dev = crtc->dev; ··· 2078 2053 int pipe = intel_crtc->pipe; 2079 2054 int plane = intel_crtc->plane; 2080 2055 u32 reg, temp; 2056 + bool is_pch_port = false; 2081 2057 2082 2058 if (intel_crtc->active) 2083 2059 return; ··· 2092 2066 I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN); 2093 2067 } 2094 2068 2095 - ironlake_fdi_enable(crtc); 2069 + is_pch_port = intel_crtc_driving_pch(crtc); 2070 + 2071 + if (is_pch_port) 2072 + ironlake_fdi_enable(crtc); 2073 + else { 2074 + /* disable CPU FDI tx and PCH FDI rx */ 2075 + reg = FDI_TX_CTL(pipe); 2076 + temp = I915_READ(reg); 2077 + I915_WRITE(reg, temp & ~FDI_TX_ENABLE); 2078 + POSTING_READ(reg); 2079 + 2080 + reg = FDI_RX_CTL(pipe); 2081 + temp = I915_READ(reg); 2082 + temp &= ~(0x7 << 16); 2083 + temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; 2084 + I915_WRITE(reg, temp & ~FDI_RX_ENABLE); 2085 + 2086 + POSTING_READ(reg); 2087 + udelay(100); 2088 + 2089 + /* Ironlake workaround, disable clock pointer after downing FDI */ 2090 + if (HAS_PCH_IBX(dev)) 2091 + I915_WRITE(FDI_RX_CHICKEN(pipe), 2092 + I915_READ(FDI_RX_CHICKEN(pipe) & 2093 + ~FDI_RX_PHASE_SYNC_POINTER_ENABLE)); 2094 + 2095 + /* still set train pattern 1 */ 2096 + reg = FDI_TX_CTL(pipe); 2097 + temp = I915_READ(reg); 2098 + temp &= ~FDI_LINK_TRAIN_NONE; 2099 + temp |= FDI_LINK_TRAIN_PATTERN_1; 2100 + I915_WRITE(reg, temp); 2101 + 2102 + reg = FDI_RX_CTL(pipe); 2103 + temp = I915_READ(reg); 2104 + if (HAS_PCH_CPT(dev)) { 2105 + temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; 2106 + temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; 2107 + } else { 2108 + temp &= ~FDI_LINK_TRAIN_NONE; 2109 + temp |= FDI_LINK_TRAIN_PATTERN_1; 2110 + } 2111 + /* BPC in FDI rx is consistent with that in PIPECONF */ 2112 + temp &= ~(0x07 << 16); 2113 + temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; 2114 + I915_WRITE(reg, temp); 2115 + 2116 + POSTING_READ(reg); 2117 + udelay(100); 2118 + } 2096 2119 2097 2120 /* Enable panel fitting for LVDS */ 2098 2121 if (dev_priv->pch_pf_size && ··· 2174 2099 I915_WRITE(reg, temp | DISPLAY_PLANE_ENABLE); 2175 2100 intel_flush_display_plane(dev, plane); 2176 2101 } 2102 + 2103 + /* Skip the PCH stuff if possible */ 2104 + if (!is_pch_port) 2105 + goto done; 2177 2106 2178 2107 /* For PCH output, training FDI link */ 2179 2108 if (IS_GEN6(dev)) ··· 2263 2184 I915_WRITE(reg, temp | TRANS_ENABLE); 2264 2185 if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100)) 2265 2186 DRM_ERROR("failed to enable transcoder %d\n", pipe); 2266 - 2187 + done: 2267 2188 intel_crtc_load_lut(crtc); 2268 2189 intel_update_fbc(dev); 2269 2190 intel_crtc_update_cursor(crtc, true);