aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-09-09 12:05:37 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-09-09 12:05:37 -0400
commit65320fcedaa7affd1736cd7aa51f5e70b5c7e7f2 (patch)
tree2fb1bdf8a1139262dd13fa671055c7517cb3fffb /drivers/gpu/drm/i915
parentc3f31f6a6f68bcb51689c90733282ec263602a9d (diff)
parentd8dfad3876e4386666b759da3c833d62fb8b2267 (diff)
Merge tag 'v3.11-rc7' into stable/for-linus-3.12
Linux 3.11-rc7 As we need the git commit 28817e9de4f039a1a8c1fe1df2fa2df524626b9e Author: Chuck Anderson <chuck.anderson@oracle.com> Date: Tue Aug 6 15:12:19 2013 -0700 xen/smp: initialize IPI vectors before marking CPU online * tag 'v3.11-rc7': (443 commits) Linux 3.11-rc7 ARC: [lib] strchr breakage in Big-endian configuration VFS: collect_mounts() should return an ERR_PTR bfs: iget_locked() doesn't return an ERR_PTR efs: iget_locked() doesn't return an ERR_PTR() proc: kill the extra proc_readfd_common()->dir_emit_dots() cope with potentially long ->d_dname() output for shmem/hugetlb usb: phy: fix build breakage USB: OHCI: add missing PCI PM callbacks to ohci-pci.c staging: comedi: bug-fix NULL pointer dereference on failed attach lib/lz4: correct the LZ4 license memcg: get rid of swapaccount leftovers nilfs2: fix issue with counting number of bio requests for BIO_EOPNOTSUPP error detection nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error drivers/platform/olpc/olpc-ec.c: initialise earlier ipv4: expose IPV4_DEVCONF ipv6: handle Redirect ICMP Message with no Redirected Header option be2net: fix disabling TX in be_close() Revert "ACPI / video: Always call acpi_video_init_brightness() on init" Revert "genetlink: fix family dump race" ... Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_dmabuf.c8
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h14
-rw-r--r--drivers/gpu/drm/i915/intel_display.c90
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c18
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c18
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c12
6 files changed, 125 insertions, 35 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
index dc53a527126b..9e6578330801 100644
--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
@@ -85,9 +85,17 @@ static void i915_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
85 struct sg_table *sg, 85 struct sg_table *sg,
86 enum dma_data_direction dir) 86 enum dma_data_direction dir)
87{ 87{
88 struct drm_i915_gem_object *obj = attachment->dmabuf->priv;
89
90 mutex_lock(&obj->base.dev->struct_mutex);
91
88 dma_unmap_sg(attachment->dev, sg->sgl, sg->nents, dir); 92 dma_unmap_sg(attachment->dev, sg->sgl, sg->nents, dir);
89 sg_free_table(sg); 93 sg_free_table(sg);
90 kfree(sg); 94 kfree(sg);
95
96 i915_gem_object_unpin_pages(obj);
97
98 mutex_unlock(&obj->base.dev->struct_mutex);
91} 99}
92 100
93static void i915_gem_dmabuf_release(struct dma_buf *dma_buf) 101static void i915_gem_dmabuf_release(struct dma_buf *dma_buf)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index f2326fc60ac9..53cddd985406 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -752,6 +752,8 @@
752 will not assert AGPBUSY# and will only 752 will not assert AGPBUSY# and will only
753 be delivered when out of C3. */ 753 be delivered when out of C3. */
754#define INSTPM_FORCE_ORDERING (1<<7) /* GEN6+ */ 754#define INSTPM_FORCE_ORDERING (1<<7) /* GEN6+ */
755#define INSTPM_TLB_INVALIDATE (1<<9)
756#define INSTPM_SYNC_FLUSH (1<<5)
755#define ACTHD 0x020c8 757#define ACTHD 0x020c8
756#define FW_BLC 0x020d8 758#define FW_BLC 0x020d8
757#define FW_BLC2 0x020dc 759#define FW_BLC2 0x020dc
@@ -1856,10 +1858,16 @@
1856#define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) 1858#define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
1857 1859
1858#define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114) 1860#define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114)
1859/* HDMI/DP bits are gen4+ */ 1861/*
1860#define PORTB_HOTPLUG_LIVE_STATUS (1 << 29) 1862 * HDMI/DP bits are gen4+
1863 *
1864 * WARNING: Bspec for hpd status bits on gen4 seems to be completely confused.
1865 * Please check the detailed lore in the commit message for for experimental
1866 * evidence.
1867 */
1868#define PORTD_HOTPLUG_LIVE_STATUS (1 << 29)
1861#define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) 1869#define PORTC_HOTPLUG_LIVE_STATUS (1 << 28)
1862#define PORTD_HOTPLUG_LIVE_STATUS (1 << 27) 1870#define PORTB_HOTPLUG_LIVE_STATUS (1 << 27)
1863#define PORTD_HOTPLUG_INT_STATUS (3 << 21) 1871#define PORTD_HOTPLUG_INT_STATUS (3 << 21)
1864#define PORTC_HOTPLUG_INT_STATUS (3 << 19) 1872#define PORTC_HOTPLUG_INT_STATUS (3 << 19)
1865#define PORTB_HOTPLUG_INT_STATUS (3 << 17) 1873#define PORTB_HOTPLUG_INT_STATUS (3 << 17)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5fb305840db8..be79f477a38f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8269,9 +8269,11 @@ check_crtc_state(struct drm_device *dev)
8269 8269
8270 list_for_each_entry(encoder, &dev->mode_config.encoder_list, 8270 list_for_each_entry(encoder, &dev->mode_config.encoder_list,
8271 base.head) { 8271 base.head) {
8272 enum pipe pipe;
8272 if (encoder->base.crtc != &crtc->base) 8273 if (encoder->base.crtc != &crtc->base)
8273 continue; 8274 continue;
8274 if (encoder->get_config) 8275 if (encoder->get_config &&
8276 encoder->get_hw_state(encoder, &pipe))
8275 encoder->get_config(encoder, &pipe_config); 8277 encoder->get_config(encoder, &pipe_config);
8276 } 8278 }
8277 8279
@@ -10040,6 +10042,8 @@ struct intel_display_error_state {
10040 10042
10041 u32 power_well_driver; 10043 u32 power_well_driver;
10042 10044
10045 int num_transcoders;
10046
10043 struct intel_cursor_error_state { 10047 struct intel_cursor_error_state {
10044 u32 control; 10048 u32 control;
10045 u32 position; 10049 u32 position;
@@ -10048,16 +10052,7 @@ struct intel_display_error_state {
10048 } cursor[I915_MAX_PIPES]; 10052 } cursor[I915_MAX_PIPES];
10049 10053
10050 struct intel_pipe_error_state { 10054 struct intel_pipe_error_state {
10051 enum transcoder cpu_transcoder;
10052 u32 conf;
10053 u32 source; 10055 u32 source;
10054
10055 u32 htotal;
10056 u32 hblank;
10057 u32 hsync;
10058 u32 vtotal;
10059 u32 vblank;
10060 u32 vsync;
10061 } pipe[I915_MAX_PIPES]; 10056 } pipe[I915_MAX_PIPES];
10062 10057
10063 struct intel_plane_error_state { 10058 struct intel_plane_error_state {
@@ -10069,6 +10064,19 @@ struct intel_display_error_state {
10069 u32 surface; 10064 u32 surface;
10070 u32 tile_offset; 10065 u32 tile_offset;
10071 } plane[I915_MAX_PIPES]; 10066 } plane[I915_MAX_PIPES];
10067
10068 struct intel_transcoder_error_state {
10069 enum transcoder cpu_transcoder;
10070
10071 u32 conf;
10072
10073 u32 htotal;
10074 u32 hblank;
10075 u32 hsync;
10076 u32 vtotal;
10077 u32 vblank;
10078 u32 vsync;
10079 } transcoder[4];
10072}; 10080};
10073 10081
10074struct intel_display_error_state * 10082struct intel_display_error_state *
@@ -10076,9 +10084,17 @@ intel_display_capture_error_state(struct drm_device *dev)
10076{ 10084{
10077 drm_i915_private_t *dev_priv = dev->dev_private; 10085 drm_i915_private_t *dev_priv = dev->dev_private;
10078 struct intel_display_error_state *error; 10086 struct intel_display_error_state *error;
10079 enum transcoder cpu_transcoder; 10087 int transcoders[] = {
10088 TRANSCODER_A,
10089 TRANSCODER_B,
10090 TRANSCODER_C,
10091 TRANSCODER_EDP,
10092 };
10080 int i; 10093 int i;
10081 10094
10095 if (INTEL_INFO(dev)->num_pipes == 0)
10096 return NULL;
10097
10082 error = kmalloc(sizeof(*error), GFP_ATOMIC); 10098 error = kmalloc(sizeof(*error), GFP_ATOMIC);
10083 if (error == NULL) 10099 if (error == NULL)
10084 return NULL; 10100 return NULL;
@@ -10087,9 +10103,6 @@ intel_display_capture_error_state(struct drm_device *dev)
10087 error->power_well_driver = I915_READ(HSW_PWR_WELL_DRIVER); 10103 error->power_well_driver = I915_READ(HSW_PWR_WELL_DRIVER);
10088 10104
10089 for_each_pipe(i) { 10105 for_each_pipe(i) {
10090 cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, i);
10091 error->pipe[i].cpu_transcoder = cpu_transcoder;
10092
10093 if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev)) { 10106 if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev)) {
10094 error->cursor[i].control = I915_READ(CURCNTR(i)); 10107 error->cursor[i].control = I915_READ(CURCNTR(i));
10095 error->cursor[i].position = I915_READ(CURPOS(i)); 10108 error->cursor[i].position = I915_READ(CURPOS(i));
@@ -10113,14 +10126,25 @@ intel_display_capture_error_state(struct drm_device *dev)
10113 error->plane[i].tile_offset = I915_READ(DSPTILEOFF(i)); 10126 error->plane[i].tile_offset = I915_READ(DSPTILEOFF(i));
10114 } 10127 }
10115 10128
10116 error->pipe[i].conf = I915_READ(PIPECONF(cpu_transcoder));
10117 error->pipe[i].source = I915_READ(PIPESRC(i)); 10129 error->pipe[i].source = I915_READ(PIPESRC(i));
10118 error->pipe[i].htotal = I915_READ(HTOTAL(cpu_transcoder)); 10130 }
10119 error->pipe[i].hblank = I915_READ(HBLANK(cpu_transcoder)); 10131
10120 error->pipe[i].hsync = I915_READ(HSYNC(cpu_transcoder)); 10132 error->num_transcoders = INTEL_INFO(dev)->num_pipes;
10121 error->pipe[i].vtotal = I915_READ(VTOTAL(cpu_transcoder)); 10133 if (HAS_DDI(dev_priv->dev))
10122 error->pipe[i].vblank = I915_READ(VBLANK(cpu_transcoder)); 10134 error->num_transcoders++; /* Account for eDP. */
10123 error->pipe[i].vsync = I915_READ(VSYNC(cpu_transcoder)); 10135
10136 for (i = 0; i < error->num_transcoders; i++) {
10137 enum transcoder cpu_transcoder = transcoders[i];
10138
10139 error->transcoder[i].cpu_transcoder = cpu_transcoder;
10140
10141 error->transcoder[i].conf = I915_READ(PIPECONF(cpu_transcoder));
10142 error->transcoder[i].htotal = I915_READ(HTOTAL(cpu_transcoder));
10143 error->transcoder[i].hblank = I915_READ(HBLANK(cpu_transcoder));
10144 error->transcoder[i].hsync = I915_READ(HSYNC(cpu_transcoder));
10145 error->transcoder[i].vtotal = I915_READ(VTOTAL(cpu_transcoder));
10146 error->transcoder[i].vblank = I915_READ(VBLANK(cpu_transcoder));
10147 error->transcoder[i].vsync = I915_READ(VSYNC(cpu_transcoder));
10124 } 10148 }
10125 10149
10126 /* In the code above we read the registers without checking if the power 10150 /* In the code above we read the registers without checking if the power
@@ -10142,22 +10166,16 @@ intel_display_print_error_state(struct drm_i915_error_state_buf *m,
10142{ 10166{
10143 int i; 10167 int i;
10144 10168
10169 if (!error)
10170 return;
10171
10145 err_printf(m, "Num Pipes: %d\n", INTEL_INFO(dev)->num_pipes); 10172 err_printf(m, "Num Pipes: %d\n", INTEL_INFO(dev)->num_pipes);
10146 if (HAS_POWER_WELL(dev)) 10173 if (HAS_POWER_WELL(dev))
10147 err_printf(m, "PWR_WELL_CTL2: %08x\n", 10174 err_printf(m, "PWR_WELL_CTL2: %08x\n",
10148 error->power_well_driver); 10175 error->power_well_driver);
10149 for_each_pipe(i) { 10176 for_each_pipe(i) {
10150 err_printf(m, "Pipe [%d]:\n", i); 10177 err_printf(m, "Pipe [%d]:\n", i);
10151 err_printf(m, " CPU transcoder: %c\n",
10152 transcoder_name(error->pipe[i].cpu_transcoder));
10153 err_printf(m, " CONF: %08x\n", error->pipe[i].conf);
10154 err_printf(m, " SRC: %08x\n", error->pipe[i].source); 10178 err_printf(m, " SRC: %08x\n", error->pipe[i].source);
10155 err_printf(m, " HTOTAL: %08x\n", error->pipe[i].htotal);
10156 err_printf(m, " HBLANK: %08x\n", error->pipe[i].hblank);
10157 err_printf(m, " HSYNC: %08x\n", error->pipe[i].hsync);
10158 err_printf(m, " VTOTAL: %08x\n", error->pipe[i].vtotal);
10159 err_printf(m, " VBLANK: %08x\n", error->pipe[i].vblank);
10160 err_printf(m, " VSYNC: %08x\n", error->pipe[i].vsync);
10161 10179
10162 err_printf(m, "Plane [%d]:\n", i); 10180 err_printf(m, "Plane [%d]:\n", i);
10163 err_printf(m, " CNTR: %08x\n", error->plane[i].control); 10181 err_printf(m, " CNTR: %08x\n", error->plane[i].control);
@@ -10178,5 +10196,17 @@ intel_display_print_error_state(struct drm_i915_error_state_buf *m,
10178 err_printf(m, " POS: %08x\n", error->cursor[i].position); 10196 err_printf(m, " POS: %08x\n", error->cursor[i].position);
10179 err_printf(m, " BASE: %08x\n", error->cursor[i].base); 10197 err_printf(m, " BASE: %08x\n", error->cursor[i].base);
10180 } 10198 }
10199
10200 for (i = 0; i < error->num_transcoders; i++) {
10201 err_printf(m, " CPU transcoder: %c\n",
10202 transcoder_name(error->transcoder[i].cpu_transcoder));
10203 err_printf(m, " CONF: %08x\n", error->transcoder[i].conf);
10204 err_printf(m, " HTOTAL: %08x\n", error->transcoder[i].htotal);
10205 err_printf(m, " HBLANK: %08x\n", error->transcoder[i].hblank);
10206 err_printf(m, " HSYNC: %08x\n", error->transcoder[i].hsync);
10207 err_printf(m, " VTOTAL: %08x\n", error->transcoder[i].vtotal);
10208 err_printf(m, " VBLANK: %08x\n", error->transcoder[i].vblank);
10209 err_printf(m, " VSYNC: %08x\n", error->transcoder[i].vsync);
10210 }
10181} 10211}
10182#endif 10212#endif
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 67e2c1f1c9a8..5950888ae1d0 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -497,8 +497,11 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level, u32 max)
497 goto out; 497 goto out;
498 } 498 }
499 499
500 /* scale to hardware */ 500 /* scale to hardware, but be careful to not overflow */
501 level = level * freq / max; 501 if (freq < max)
502 level = level * freq / max;
503 else
504 level = freq / max * level;
502 505
503 dev_priv->backlight.level = level; 506 dev_priv->backlight.level = level;
504 if (dev_priv->backlight.device) 507 if (dev_priv->backlight.device)
@@ -515,6 +518,17 @@ void intel_panel_disable_backlight(struct drm_device *dev)
515 struct drm_i915_private *dev_priv = dev->dev_private; 518 struct drm_i915_private *dev_priv = dev->dev_private;
516 unsigned long flags; 519 unsigned long flags;
517 520
521 /*
522 * Do not disable backlight on the vgaswitcheroo path. When switching
523 * away from i915, the other client may depend on i915 to handle the
524 * backlight. This will leave the backlight on unnecessarily when
525 * another client is not activated.
526 */
527 if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) {
528 DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n");
529 return;
530 }
531
518 spin_lock_irqsave(&dev_priv->backlight.lock, flags); 532 spin_lock_irqsave(&dev_priv->backlight.lock, flags);
519 533
520 dev_priv->backlight.enabled = false; 534 dev_priv->backlight.enabled = false;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index f895d1508df8..b0e4a0bd1313 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -5063,8 +5063,26 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable)
5063 } 5063 }
5064 } else { 5064 } else {
5065 if (enable_requested) { 5065 if (enable_requested) {
5066 unsigned long irqflags;
5067 enum pipe p;
5068
5066 I915_WRITE(HSW_PWR_WELL_DRIVER, 0); 5069 I915_WRITE(HSW_PWR_WELL_DRIVER, 0);
5070 POSTING_READ(HSW_PWR_WELL_DRIVER);
5067 DRM_DEBUG_KMS("Requesting to disable the power well\n"); 5071 DRM_DEBUG_KMS("Requesting to disable the power well\n");
5072
5073 /*
5074 * After this, the registers on the pipes that are part
5075 * of the power well will become zero, so we have to
5076 * adjust our counters according to that.
5077 *
5078 * FIXME: Should we do this in general in
5079 * drm_vblank_post_modeset?
5080 */
5081 spin_lock_irqsave(&dev->vbl_lock, irqflags);
5082 for_each_pipe(p)
5083 if (p != PIPE_A)
5084 dev->last_vblank[p] = 0;
5085 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
5068 } 5086 }
5069 } 5087 }
5070} 5088}
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 664118d8c1d6..079ef0129e74 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -968,6 +968,18 @@ void intel_ring_setup_status_page(struct intel_ring_buffer *ring)
968 968
969 I915_WRITE(mmio, (u32)ring->status_page.gfx_addr); 969 I915_WRITE(mmio, (u32)ring->status_page.gfx_addr);
970 POSTING_READ(mmio); 970 POSTING_READ(mmio);
971
972 /* Flush the TLB for this page */
973 if (INTEL_INFO(dev)->gen >= 6) {
974 u32 reg = RING_INSTPM(ring->mmio_base);
975 I915_WRITE(reg,
976 _MASKED_BIT_ENABLE(INSTPM_TLB_INVALIDATE |
977 INSTPM_SYNC_FLUSH));
978 if (wait_for((I915_READ(reg) & INSTPM_SYNC_FLUSH) == 0,
979 1000))
980 DRM_ERROR("%s: wait for SyncFlush to complete for TLB invalidation timed out\n",
981 ring->name);
982 }
971} 983}
972 984
973static int 985static int