diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-08-19 12:09:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-08-19 12:09:11 -0400 |
commit | fbf21849edaf0cd2a9b33307ab965757a93b8d75 (patch) | |
tree | 3fb2bfef9f04c2643feef507359cd5ca6d58d039 | |
parent | 2203547f82b7727e2cd3fee3e56fceae2b2b691c (diff) | |
parent | 3387ed83943daf6cb1bb4195ae369067b9cd80ce (diff) |
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie:
"Bit late with these, was under the weather for a a few days, nothing
too crazy:
Some radeon regression fixes, one intel regression fix, and one fix to
avoid a warn with i915 when used with dma-buf"
* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
drm/i915: unpin backing storage in dmabuf_unmap
drm/radeon: fix WREG32_OR macro setting bits in a register
drm/radeon/r7xx: fix copy paste typo in golden register setup
drm/i915: Don't deref pipe->cpu_transcoder in the hangcheck code
drm/radeon: fix UVD message buffer validation
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_dmabuf.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 86 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_uvd.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rv770.c | 12 |
5 files changed, 80 insertions, 36 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 | ||
93 | static void i915_gem_dmabuf_release(struct dma_buf *dma_buf) | 101 | static void i915_gem_dmabuf_release(struct dma_buf *dma_buf) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e38b45786653..be79f477a38f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -10042,6 +10042,8 @@ struct intel_display_error_state { | |||
10042 | 10042 | ||
10043 | u32 power_well_driver; | 10043 | u32 power_well_driver; |
10044 | 10044 | ||
10045 | int num_transcoders; | ||
10046 | |||
10045 | struct intel_cursor_error_state { | 10047 | struct intel_cursor_error_state { |
10046 | u32 control; | 10048 | u32 control; |
10047 | u32 position; | 10049 | u32 position; |
@@ -10050,16 +10052,7 @@ struct intel_display_error_state { | |||
10050 | } cursor[I915_MAX_PIPES]; | 10052 | } cursor[I915_MAX_PIPES]; |
10051 | 10053 | ||
10052 | struct intel_pipe_error_state { | 10054 | struct intel_pipe_error_state { |
10053 | enum transcoder cpu_transcoder; | ||
10054 | u32 conf; | ||
10055 | u32 source; | 10055 | u32 source; |
10056 | |||
10057 | u32 htotal; | ||
10058 | u32 hblank; | ||
10059 | u32 hsync; | ||
10060 | u32 vtotal; | ||
10061 | u32 vblank; | ||
10062 | u32 vsync; | ||
10063 | } pipe[I915_MAX_PIPES]; | 10056 | } pipe[I915_MAX_PIPES]; |
10064 | 10057 | ||
10065 | struct intel_plane_error_state { | 10058 | struct intel_plane_error_state { |
@@ -10071,6 +10064,19 @@ struct intel_display_error_state { | |||
10071 | u32 surface; | 10064 | u32 surface; |
10072 | u32 tile_offset; | 10065 | u32 tile_offset; |
10073 | } 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]; | ||
10074 | }; | 10080 | }; |
10075 | 10081 | ||
10076 | struct intel_display_error_state * | 10082 | struct intel_display_error_state * |
@@ -10078,9 +10084,17 @@ intel_display_capture_error_state(struct drm_device *dev) | |||
10078 | { | 10084 | { |
10079 | drm_i915_private_t *dev_priv = dev->dev_private; | 10085 | drm_i915_private_t *dev_priv = dev->dev_private; |
10080 | struct intel_display_error_state *error; | 10086 | struct intel_display_error_state *error; |
10081 | enum transcoder cpu_transcoder; | 10087 | int transcoders[] = { |
10088 | TRANSCODER_A, | ||
10089 | TRANSCODER_B, | ||
10090 | TRANSCODER_C, | ||
10091 | TRANSCODER_EDP, | ||
10092 | }; | ||
10082 | int i; | 10093 | int i; |
10083 | 10094 | ||
10095 | if (INTEL_INFO(dev)->num_pipes == 0) | ||
10096 | return NULL; | ||
10097 | |||
10084 | error = kmalloc(sizeof(*error), GFP_ATOMIC); | 10098 | error = kmalloc(sizeof(*error), GFP_ATOMIC); |
10085 | if (error == NULL) | 10099 | if (error == NULL) |
10086 | return NULL; | 10100 | return NULL; |
@@ -10089,9 +10103,6 @@ intel_display_capture_error_state(struct drm_device *dev) | |||
10089 | error->power_well_driver = I915_READ(HSW_PWR_WELL_DRIVER); | 10103 | error->power_well_driver = I915_READ(HSW_PWR_WELL_DRIVER); |
10090 | 10104 | ||
10091 | for_each_pipe(i) { | 10105 | for_each_pipe(i) { |
10092 | cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, i); | ||
10093 | error->pipe[i].cpu_transcoder = cpu_transcoder; | ||
10094 | |||
10095 | if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev)) { | 10106 | if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev)) { |
10096 | error->cursor[i].control = I915_READ(CURCNTR(i)); | 10107 | error->cursor[i].control = I915_READ(CURCNTR(i)); |
10097 | error->cursor[i].position = I915_READ(CURPOS(i)); | 10108 | error->cursor[i].position = I915_READ(CURPOS(i)); |
@@ -10115,14 +10126,25 @@ intel_display_capture_error_state(struct drm_device *dev) | |||
10115 | error->plane[i].tile_offset = I915_READ(DSPTILEOFF(i)); | 10126 | error->plane[i].tile_offset = I915_READ(DSPTILEOFF(i)); |
10116 | } | 10127 | } |
10117 | 10128 | ||
10118 | error->pipe[i].conf = I915_READ(PIPECONF(cpu_transcoder)); | ||
10119 | error->pipe[i].source = I915_READ(PIPESRC(i)); | 10129 | error->pipe[i].source = I915_READ(PIPESRC(i)); |
10120 | error->pipe[i].htotal = I915_READ(HTOTAL(cpu_transcoder)); | 10130 | } |
10121 | error->pipe[i].hblank = I915_READ(HBLANK(cpu_transcoder)); | 10131 | |
10122 | error->pipe[i].hsync = I915_READ(HSYNC(cpu_transcoder)); | 10132 | error->num_transcoders = INTEL_INFO(dev)->num_pipes; |
10123 | error->pipe[i].vtotal = I915_READ(VTOTAL(cpu_transcoder)); | 10133 | if (HAS_DDI(dev_priv->dev)) |
10124 | error->pipe[i].vblank = I915_READ(VBLANK(cpu_transcoder)); | 10134 | error->num_transcoders++; /* Account for eDP. */ |
10125 | 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)); | ||
10126 | } | 10148 | } |
10127 | 10149 | ||
10128 | /* 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 |
@@ -10144,22 +10166,16 @@ intel_display_print_error_state(struct drm_i915_error_state_buf *m, | |||
10144 | { | 10166 | { |
10145 | int i; | 10167 | int i; |
10146 | 10168 | ||
10169 | if (!error) | ||
10170 | return; | ||
10171 | |||
10147 | 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); |
10148 | if (HAS_POWER_WELL(dev)) | 10173 | if (HAS_POWER_WELL(dev)) |
10149 | err_printf(m, "PWR_WELL_CTL2: %08x\n", | 10174 | err_printf(m, "PWR_WELL_CTL2: %08x\n", |
10150 | error->power_well_driver); | 10175 | error->power_well_driver); |
10151 | for_each_pipe(i) { | 10176 | for_each_pipe(i) { |
10152 | err_printf(m, "Pipe [%d]:\n", i); | 10177 | err_printf(m, "Pipe [%d]:\n", i); |
10153 | err_printf(m, " CPU transcoder: %c\n", | ||
10154 | transcoder_name(error->pipe[i].cpu_transcoder)); | ||
10155 | err_printf(m, " CONF: %08x\n", error->pipe[i].conf); | ||
10156 | err_printf(m, " SRC: %08x\n", error->pipe[i].source); | 10178 | err_printf(m, " SRC: %08x\n", error->pipe[i].source); |
10157 | err_printf(m, " HTOTAL: %08x\n", error->pipe[i].htotal); | ||
10158 | err_printf(m, " HBLANK: %08x\n", error->pipe[i].hblank); | ||
10159 | err_printf(m, " HSYNC: %08x\n", error->pipe[i].hsync); | ||
10160 | err_printf(m, " VTOTAL: %08x\n", error->pipe[i].vtotal); | ||
10161 | err_printf(m, " VBLANK: %08x\n", error->pipe[i].vblank); | ||
10162 | err_printf(m, " VSYNC: %08x\n", error->pipe[i].vsync); | ||
10163 | 10179 | ||
10164 | err_printf(m, "Plane [%d]:\n", i); | 10180 | err_printf(m, "Plane [%d]:\n", i); |
10165 | err_printf(m, " CNTR: %08x\n", error->plane[i].control); | 10181 | err_printf(m, " CNTR: %08x\n", error->plane[i].control); |
@@ -10180,5 +10196,17 @@ intel_display_print_error_state(struct drm_i915_error_state_buf *m, | |||
10180 | err_printf(m, " POS: %08x\n", error->cursor[i].position); | 10196 | err_printf(m, " POS: %08x\n", error->cursor[i].position); |
10181 | err_printf(m, " BASE: %08x\n", error->cursor[i].base); | 10197 | err_printf(m, " BASE: %08x\n", error->cursor[i].base); |
10182 | } | 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 | } | ||
10183 | } | 10211 | } |
10184 | #endif | 10212 | #endif |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 274b8e1b889f..9f19259667df 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -2163,7 +2163,7 @@ void cik_mm_wdoorbell(struct radeon_device *rdev, u32 offset, u32 v); | |||
2163 | WREG32(reg, tmp_); \ | 2163 | WREG32(reg, tmp_); \ |
2164 | } while (0) | 2164 | } while (0) |
2165 | #define WREG32_AND(reg, and) WREG32_P(reg, 0, and) | 2165 | #define WREG32_AND(reg, and) WREG32_P(reg, 0, and) |
2166 | #define WREG32_OR(reg, or) WREG32_P(reg, or, ~or) | 2166 | #define WREG32_OR(reg, or) WREG32_P(reg, or, ~(or)) |
2167 | #define WREG32_PLL_P(reg, val, mask) \ | 2167 | #define WREG32_PLL_P(reg, val, mask) \ |
2168 | do { \ | 2168 | do { \ |
2169 | uint32_t tmp_ = RREG32_PLL(reg); \ | 2169 | uint32_t tmp_ = RREG32_PLL(reg); \ |
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index f1c15754e73c..b79f4f5cdd62 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -356,6 +356,14 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, | |||
356 | return -EINVAL; | 356 | return -EINVAL; |
357 | } | 357 | } |
358 | 358 | ||
359 | if (bo->tbo.sync_obj) { | ||
360 | r = radeon_fence_wait(bo->tbo.sync_obj, false); | ||
361 | if (r) { | ||
362 | DRM_ERROR("Failed waiting for UVD message (%d)!\n", r); | ||
363 | return r; | ||
364 | } | ||
365 | } | ||
366 | |||
359 | r = radeon_bo_kmap(bo, &ptr); | 367 | r = radeon_bo_kmap(bo, &ptr); |
360 | if (r) { | 368 | if (r) { |
361 | DRM_ERROR("Failed mapping the UVD message (%d)!\n", r); | 369 | DRM_ERROR("Failed mapping the UVD message (%d)!\n", r); |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index bcc68ec204ad..f5e92cfcc140 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -744,10 +744,10 @@ static void rv770_init_golden_registers(struct radeon_device *rdev) | |||
744 | (const u32)ARRAY_SIZE(r7xx_golden_dyn_gpr_registers)); | 744 | (const u32)ARRAY_SIZE(r7xx_golden_dyn_gpr_registers)); |
745 | radeon_program_register_sequence(rdev, | 745 | radeon_program_register_sequence(rdev, |
746 | rv730_golden_registers, | 746 | rv730_golden_registers, |
747 | (const u32)ARRAY_SIZE(rv770_golden_registers)); | 747 | (const u32)ARRAY_SIZE(rv730_golden_registers)); |
748 | radeon_program_register_sequence(rdev, | 748 | radeon_program_register_sequence(rdev, |
749 | rv730_mgcg_init, | 749 | rv730_mgcg_init, |
750 | (const u32)ARRAY_SIZE(rv770_mgcg_init)); | 750 | (const u32)ARRAY_SIZE(rv730_mgcg_init)); |
751 | break; | 751 | break; |
752 | case CHIP_RV710: | 752 | case CHIP_RV710: |
753 | radeon_program_register_sequence(rdev, | 753 | radeon_program_register_sequence(rdev, |
@@ -758,18 +758,18 @@ static void rv770_init_golden_registers(struct radeon_device *rdev) | |||
758 | (const u32)ARRAY_SIZE(r7xx_golden_dyn_gpr_registers)); | 758 | (const u32)ARRAY_SIZE(r7xx_golden_dyn_gpr_registers)); |
759 | radeon_program_register_sequence(rdev, | 759 | radeon_program_register_sequence(rdev, |
760 | rv710_golden_registers, | 760 | rv710_golden_registers, |
761 | (const u32)ARRAY_SIZE(rv770_golden_registers)); | 761 | (const u32)ARRAY_SIZE(rv710_golden_registers)); |
762 | radeon_program_register_sequence(rdev, | 762 | radeon_program_register_sequence(rdev, |
763 | rv710_mgcg_init, | 763 | rv710_mgcg_init, |
764 | (const u32)ARRAY_SIZE(rv770_mgcg_init)); | 764 | (const u32)ARRAY_SIZE(rv710_mgcg_init)); |
765 | break; | 765 | break; |
766 | case CHIP_RV740: | 766 | case CHIP_RV740: |
767 | radeon_program_register_sequence(rdev, | 767 | radeon_program_register_sequence(rdev, |
768 | rv740_golden_registers, | 768 | rv740_golden_registers, |
769 | (const u32)ARRAY_SIZE(rv770_golden_registers)); | 769 | (const u32)ARRAY_SIZE(rv740_golden_registers)); |
770 | radeon_program_register_sequence(rdev, | 770 | radeon_program_register_sequence(rdev, |
771 | rv740_mgcg_init, | 771 | rv740_mgcg_init, |
772 | (const u32)ARRAY_SIZE(rv770_mgcg_init)); | 772 | (const u32)ARRAY_SIZE(rv740_mgcg_init)); |
773 | break; | 773 | break; |
774 | default: | 774 | default: |
775 | break; | 775 | break; |