Skip to content

Commit 42f8204

Browse files
committed
Merge tag 'drm-fixes-2020-07-10' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "I've been off most of the week, but some fixes have piled up. Seems a bit busier than last week, but they are pretty spread out across a bunch of drivers, none of them seem that big or worried me too much. amdgpu: - Fix a suspend/resume issue with PSP - Backlight fix for Renoir - Fix for gpu recovery debugging radeon: - Fix a double free in error path i915: - fbc fencing fix - debugfs panic fix - gem vma constuction fix - gem pin under vm->nutex fix nouveau: - SVM fixes - display fixes meson: - OSD burst length fixes hibmc: - runtime warning fix mediatek: - cmdq, mmsys fixes - visibility check fixes" * tag 'drm-fixes-2020-07-10' of git://anongit.freedesktop.org/drm/drm: (24 commits) drm/amdgpu: don't do soft recovery if gpu_recovery=0 drm/radeon: fix double free drm/amd/display: add dmcub check on RENOIR drm/amdgpu: add TMR destory function for psp drm/amdgpu: asd function needs to be unloaded in suspend phase drm/hisilicon/hibmc: Move drm_fbdev_generic_setup() down to avoid the splat drm/nouveau/nouveau: fix page fault on device private memory drm/nouveau/svm: fix migrate page regression drm/nouveau/i2c/g94-: increase NV_PMGR_DP_AUXCTL_TRANSACTREQ timeout drm/nouveau/kms/nv50-: bail from nv50_audio_disable() early if audio not enabled drm/i915/gt: Pin the rings before marking active drm/i915: Also drop vm.ref along error paths for vma construction drm/i915: Drop vm.ref for duplicate vma on construction drm/i915/fbc: Fix fence_y_offset handling drm/i915: Skip stale object handle for debugfs per-file-stats drm/mediatek: mtk_hdmi: Remove debug messages for function calls drm/mediatek: mtk_mt8173_hdmi_phy: Remove unnused const variables drm/mediatek: Delete not used of_device_get_match_data drm/mediatek: Remove unnecessary conversion to bool drm/meson: viu: fix setting the OSD burst length in VIU_OSD1_FIFO_CTRL_STAT ...
2 parents d4e6045 + 38794a5 commit 42f8204

File tree

26 files changed

+145
-155
lines changed

26 files changed

+145
-155
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job)
3737

3838
memset(&ti, 0, sizeof(struct amdgpu_task_info));
3939

40-
if (amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) {
40+
if (amdgpu_gpu_recovery &&
41+
amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) {
4142
DRM_ERROR("ring %s timeout, but soft recovered\n",
4243
s_job->sched->name);
4344
return;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,52 @@ static int psp_tmr_load(struct psp_context *psp)
372372
return ret;
373373
}
374374

375+
static void psp_prep_tmr_unload_cmd_buf(struct psp_context *psp,
376+
struct psp_gfx_cmd_resp *cmd)
377+
{
378+
if (amdgpu_sriov_vf(psp->adev))
379+
cmd->cmd_id = GFX_CMD_ID_DESTROY_VMR;
380+
else
381+
cmd->cmd_id = GFX_CMD_ID_DESTROY_TMR;
382+
}
383+
384+
static int psp_tmr_unload(struct psp_context *psp)
385+
{
386+
int ret;
387+
struct psp_gfx_cmd_resp *cmd;
388+
389+
cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
390+
if (!cmd)
391+
return -ENOMEM;
392+
393+
psp_prep_tmr_unload_cmd_buf(psp, cmd);
394+
DRM_INFO("free PSP TMR buffer\n");
395+
396+
ret = psp_cmd_submit_buf(psp, NULL, cmd,
397+
psp->fence_buf_mc_addr);
398+
399+
kfree(cmd);
400+
401+
return ret;
402+
}
403+
404+
static int psp_tmr_terminate(struct psp_context *psp)
405+
{
406+
int ret;
407+
void *tmr_buf;
408+
void **pptr;
409+
410+
ret = psp_tmr_unload(psp);
411+
if (ret)
412+
return ret;
413+
414+
/* free TMR memory buffer */
415+
pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
416+
amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr);
417+
418+
return 0;
419+
}
420+
375421
static void psp_prep_asd_load_cmd_buf(struct psp_gfx_cmd_resp *cmd,
376422
uint64_t asd_mc, uint32_t size)
377423
{
@@ -1779,8 +1825,6 @@ static int psp_hw_fini(void *handle)
17791825
{
17801826
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
17811827
struct psp_context *psp = &adev->psp;
1782-
void *tmr_buf;
1783-
void **pptr;
17841828

17851829
if (psp->adev->psp.ta_fw) {
17861830
psp_ras_terminate(psp);
@@ -1790,10 +1834,9 @@ static int psp_hw_fini(void *handle)
17901834

17911835
psp_asd_unload(psp);
17921836

1837+
psp_tmr_terminate(psp);
17931838
psp_ring_destroy(psp, PSP_RING_TYPE__KM);
17941839

1795-
pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
1796-
amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr);
17971840
amdgpu_bo_free_kernel(&psp->fw_pri_bo,
17981841
&psp->fw_pri_mc_addr, &psp->fw_pri_buf);
17991842
amdgpu_bo_free_kernel(&psp->fence_buf_bo,
@@ -1840,6 +1883,18 @@ static int psp_suspend(void *handle)
18401883
}
18411884
}
18421885

1886+
ret = psp_asd_unload(psp);
1887+
if (ret) {
1888+
DRM_ERROR("Failed to unload asd\n");
1889+
return ret;
1890+
}
1891+
1892+
ret = psp_tmr_terminate(psp);
1893+
if (ret) {
1894+
DRM_ERROR("Falied to terminate tmr\n");
1895+
return ret;
1896+
}
1897+
18431898
ret = psp_ring_stop(psp, PSP_RING_TYPE__KM);
18441899
if (ret) {
18451900
DRM_ERROR("PSP ring stop failed\n");

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ static int dm_late_init(void *handle)
13581358
struct dmcu *dmcu = NULL;
13591359
bool ret;
13601360

1361-
if (!adev->dm.fw_dmcu)
1361+
if (!adev->dm.fw_dmcu && !adev->dm.dmub_fw)
13621362
return detect_mst_link_for_all_connectors(adev->ddev);
13631363

13641364
dmcu = adev->dm.dc->res_pool->dmcu;

drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,6 @@ static int hibmc_load(struct drm_device *dev)
307307
/* reset all the states of crtc/plane/encoder/connector */
308308
drm_mode_config_reset(dev);
309309

310-
drm_fbdev_generic_setup(dev, dev->mode_config.preferred_depth);
311-
312310
return 0;
313311

314312
err:
@@ -355,6 +353,9 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
355353
ret);
356354
goto err_unload;
357355
}
356+
357+
drm_fbdev_generic_setup(dev, dev->mode_config.preferred_depth);
358+
358359
return 0;
359360

360361
err_unload:

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3822,6 +3822,17 @@ skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state,
38223822
return true;
38233823
}
38243824

3825+
unsigned int
3826+
intel_plane_fence_y_offset(const struct intel_plane_state *plane_state)
3827+
{
3828+
int x = 0, y = 0;
3829+
3830+
intel_plane_adjust_aligned_offset(&x, &y, plane_state, 0,
3831+
plane_state->color_plane[0].offset, 0);
3832+
3833+
return y;
3834+
}
3835+
38253836
static int skl_check_main_surface(struct intel_plane_state *plane_state)
38263837
{
38273838
struct drm_i915_private *dev_priv = to_i915(plane_state->uapi.plane->dev);

drivers/gpu/drm/i915/display/intel_display.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ unsigned int i9xx_plane_max_stride(struct intel_plane *plane,
608608
u32 pixel_format, u64 modifier,
609609
unsigned int rotation);
610610
int bdw_get_pipemisc_bpp(struct intel_crtc *crtc);
611+
unsigned int intel_plane_fence_y_offset(const struct intel_plane_state *plane_state);
611612

612613
struct intel_display_error_state *
613614
intel_display_capture_error_state(struct drm_i915_private *dev_priv);

drivers/gpu/drm/i915/display/intel_fbc.c

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,6 @@
4747
#include "intel_fbc.h"
4848
#include "intel_frontbuffer.h"
4949

50-
/*
51-
* In some platforms where the CRTC's x:0/y:0 coordinates doesn't match the
52-
* frontbuffer's x:0/y:0 coordinates we lie to the hardware about the plane's
53-
* origin so the x and y offsets can actually fit the registers. As a
54-
* consequence, the fence doesn't really start exactly at the display plane
55-
* address we program because it starts at the real start of the buffer, so we
56-
* have to take this into consideration here.
57-
*/
58-
static unsigned int get_crtc_fence_y_offset(struct intel_fbc *fbc)
59-
{
60-
return fbc->state_cache.plane.y - fbc->state_cache.plane.adjusted_y;
61-
}
62-
6350
/*
6451
* For SKL+, the plane source size used by the hardware is based on the value we
6552
* write to the PLANE_SIZE register. For BDW-, the hardware looks at the value
@@ -141,7 +128,7 @@ static void i8xx_fbc_activate(struct drm_i915_private *dev_priv)
141128
fbc_ctl2 |= FBC_CTL_CPU_FENCE;
142129
intel_de_write(dev_priv, FBC_CONTROL2, fbc_ctl2);
143130
intel_de_write(dev_priv, FBC_FENCE_OFF,
144-
params->crtc.fence_y_offset);
131+
params->fence_y_offset);
145132
}
146133

147134
/* enable it... */
@@ -175,7 +162,7 @@ static void g4x_fbc_activate(struct drm_i915_private *dev_priv)
175162
if (params->fence_id >= 0) {
176163
dpfc_ctl |= DPFC_CTL_FENCE_EN | params->fence_id;
177164
intel_de_write(dev_priv, DPFC_FENCE_YOFF,
178-
params->crtc.fence_y_offset);
165+
params->fence_y_offset);
179166
} else {
180167
intel_de_write(dev_priv, DPFC_FENCE_YOFF, 0);
181168
}
@@ -243,7 +230,7 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv)
243230
intel_de_write(dev_priv, SNB_DPFC_CTL_SA,
244231
SNB_CPU_FENCE_ENABLE | params->fence_id);
245232
intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET,
246-
params->crtc.fence_y_offset);
233+
params->fence_y_offset);
247234
}
248235
} else {
249236
if (IS_GEN(dev_priv, 6)) {
@@ -253,7 +240,7 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv)
253240
}
254241

255242
intel_de_write(dev_priv, ILK_DPFC_FENCE_YOFF,
256-
params->crtc.fence_y_offset);
243+
params->fence_y_offset);
257244
/* enable it... */
258245
intel_de_write(dev_priv, ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN);
259246

@@ -320,7 +307,7 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv)
320307
intel_de_write(dev_priv, SNB_DPFC_CTL_SA,
321308
SNB_CPU_FENCE_ENABLE | params->fence_id);
322309
intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET,
323-
params->crtc.fence_y_offset);
310+
params->fence_y_offset);
324311
} else if (dev_priv->ggtt.num_fences) {
325312
intel_de_write(dev_priv, SNB_DPFC_CTL_SA, 0);
326313
intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET, 0);
@@ -631,8 +618,8 @@ static bool rotation_is_valid(struct drm_i915_private *dev_priv,
631618
/*
632619
* For some reason, the hardware tracking starts looking at whatever we
633620
* programmed as the display plane base address register. It does not look at
634-
* the X and Y offset registers. That's why we look at the crtc->adjusted{x,y}
635-
* variables instead of just looking at the pipe/plane size.
621+
* the X and Y offset registers. That's why we include the src x/y offsets
622+
* instead of just looking at the plane size.
636623
*/
637624
static bool intel_fbc_hw_tracking_covers_screen(struct intel_crtc *crtc)
638625
{
@@ -705,14 +692,15 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc,
705692
cache->plane.src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
706693
cache->plane.adjusted_x = plane_state->color_plane[0].x;
707694
cache->plane.adjusted_y = plane_state->color_plane[0].y;
708-
cache->plane.y = plane_state->uapi.src.y1 >> 16;
709695

710696
cache->plane.pixel_blend_mode = plane_state->hw.pixel_blend_mode;
711697

712698
cache->fb.format = fb->format;
713699
cache->fb.stride = fb->pitches[0];
714700
cache->fb.modifier = fb->modifier;
715701

702+
cache->fence_y_offset = intel_plane_fence_y_offset(plane_state);
703+
716704
drm_WARN_ON(&dev_priv->drm, plane_state->flags & PLANE_HAS_FENCE &&
717705
!plane_state->vma->fence);
718706

@@ -883,10 +871,10 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc,
883871
memset(params, 0, sizeof(*params));
884872

885873
params->fence_id = cache->fence_id;
874+
params->fence_y_offset = cache->fence_y_offset;
886875

887876
params->crtc.pipe = crtc->pipe;
888877
params->crtc.i9xx_plane = to_intel_plane(crtc->base.primary)->i9xx_plane;
889-
params->crtc.fence_y_offset = get_crtc_fence_y_offset(fbc);
890878

891879
params->fb.format = cache->fb.format;
892880
params->fb.stride = cache->fb.stride;

drivers/gpu/drm/i915/gt/intel_context.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,25 +204,25 @@ static int __ring_active(struct intel_ring *ring)
204204
{
205205
int err;
206206

207-
err = i915_active_acquire(&ring->vma->active);
207+
err = intel_ring_pin(ring);
208208
if (err)
209209
return err;
210210

211-
err = intel_ring_pin(ring);
211+
err = i915_active_acquire(&ring->vma->active);
212212
if (err)
213-
goto err_active;
213+
goto err_pin;
214214

215215
return 0;
216216

217-
err_active:
218-
i915_active_release(&ring->vma->active);
217+
err_pin:
218+
intel_ring_unpin(ring);
219219
return err;
220220
}
221221

222222
static void __ring_retire(struct intel_ring *ring)
223223
{
224-
intel_ring_unpin(ring);
225224
i915_active_release(&ring->vma->active);
225+
intel_ring_unpin(ring);
226226
}
227227

228228
__i915_active_call

drivers/gpu/drm/i915/i915_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static int per_file_stats(int id, void *ptr, void *data)
230230
struct file_stats *stats = data;
231231
struct i915_vma *vma;
232232

233-
if (!kref_get_unless_zero(&obj->base.refcount))
233+
if (IS_ERR_OR_NULL(obj) || !kref_get_unless_zero(&obj->base.refcount))
234234
return 0;
235235

236236
stats->count++;

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,6 @@ struct intel_fbc {
410410
int adjusted_x;
411411
int adjusted_y;
412412

413-
int y;
414-
415413
u16 pixel_blend_mode;
416414
} plane;
417415

@@ -420,6 +418,8 @@ struct intel_fbc {
420418
unsigned int stride;
421419
u64 modifier;
422420
} fb;
421+
422+
unsigned int fence_y_offset;
423423
u16 gen9_wa_cfb_stride;
424424
s8 fence_id;
425425
} state_cache;
@@ -435,7 +435,6 @@ struct intel_fbc {
435435
struct {
436436
enum pipe pipe;
437437
enum i9xx_plane_id i9xx_plane;
438-
unsigned int fence_y_offset;
439438
} crtc;
440439

441440
struct {
@@ -444,6 +443,7 @@ struct intel_fbc {
444443
} fb;
445444

446445
int cfb_size;
446+
unsigned int fence_y_offset;
447447
u16 gen9_wa_cfb_stride;
448448
s8 fence_id;
449449
bool plane_visible;

0 commit comments

Comments
 (0)