Skip to content

Commit 44db63d

Browse files
committed
Merge tag 'drm-fixes-2021-06-25' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "This is a bit bigger than I'd like at this stage, and I guess last week was extra quiet, but it's mostly one fix across three drivers to wait for buffer move pinning to complete. There was one locking change that got reverted so it's just noise. Otherwise the amdgpu/nouveau changes are for known regressions, and otherwise it's just misc changes in kmb/atmel/vc4 drivers. Summary: core: - auth locking change + brown paper bag revert radeon/nouveau/amdgpu/ttm: - wait for BO to be pinned after moving it (same fix in three drivers) amdgpu: - Revert GFX9/10 doorbell fixes, we just end up trading one bug for another - Potential memory corruption fix in framebuffer handling nouveau: - fix regression checking dma addresses kmb: - error return fix atmel-hlcdc: - fix kernel warnings at boot - enable async flips vc4: - fix CPU hang due to power management" * tag 'drm-fixes-2021-06-25' of git://anongit.freedesktop.org/drm/drm: drm/nouveau: fix dma_address check for CPU/GPU sync drm/kmb: Fix error return code in kmb_hw_init() drm/amdgpu: wait for moving fence after pinning drm/radeon: wait for moving fence after pinning drm/nouveau: wait for moving fence after pinning v2 Revert "drm: add a locked version of drm_is_current_master" Revert "drm/amdgpu/gfx9: fix the doorbell missing when in CGPG issue." Revert "drm/amdgpu/gfx10: enlarge CP_MEC_DOORBELL_RANGE_UPPER to cover full doorbell." drm/amdgpu: Call drm_framebuffer_init last for framebuffer init drm: add a locked version of drm_is_current_master drm/atmel-hlcdc: Allow async page flips drm/panel: ld9040: reference spi_device_id table drm: atmel_hlcdc: Enable the crtc vblank prior to crtc usage. drm/vc4: hdmi: Make sure the controller is powered in detect drm/vc4: hdmi: Move the HSM clock enable to runtime_pm
2 parents 4a09d38 + 5e0e7a4 commit 44db63d

File tree

12 files changed

+100
-39
lines changed

12 files changed

+100
-39
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,11 +1047,12 @@ int amdgpu_display_gem_fb_init(struct drm_device *dev,
10471047

10481048
rfb->base.obj[0] = obj;
10491049
drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd);
1050-
ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
1050+
1051+
ret = amdgpu_display_framebuffer_init(dev, rfb, mode_cmd, obj);
10511052
if (ret)
10521053
goto err;
10531054

1054-
ret = amdgpu_display_framebuffer_init(dev, rfb, mode_cmd, obj);
1055+
ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
10551056
if (ret)
10561057
goto err;
10571058

@@ -1071,9 +1072,6 @@ int amdgpu_display_gem_fb_verify_and_init(
10711072

10721073
rfb->base.obj[0] = obj;
10731074
drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd);
1074-
ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
1075-
if (ret)
1076-
goto err;
10771075
/* Verify that the modifier is supported. */
10781076
if (!drm_any_plane_has_format(dev, mode_cmd->pixel_format,
10791077
mode_cmd->modifier[0])) {
@@ -1092,6 +1090,10 @@ int amdgpu_display_gem_fb_verify_and_init(
10921090
if (ret)
10931091
goto err;
10941092

1093+
ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
1094+
if (ret)
1095+
goto err;
1096+
10951097
return 0;
10961098
err:
10971099
drm_dbg_kms(dev, "Failed to verify and init gem fb: %d\n", ret);

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,21 @@ static int amdgpu_dma_buf_pin(struct dma_buf_attachment *attach)
214214
{
215215
struct drm_gem_object *obj = attach->dmabuf->priv;
216216
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
217+
int r;
217218

218219
/* pin buffer into GTT */
219-
return amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT);
220+
r = amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT);
221+
if (r)
222+
return r;
223+
224+
if (bo->tbo.moving) {
225+
r = dma_fence_wait(bo->tbo.moving, true);
226+
if (r) {
227+
amdgpu_bo_unpin(bo);
228+
return r;
229+
}
230+
}
231+
return 0;
220232
}
221233

222234
/**

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6871,12 +6871,8 @@ static int gfx_v10_0_kiq_init_register(struct amdgpu_ring *ring)
68716871
if (ring->use_doorbell) {
68726872
WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER,
68736873
(adev->doorbell_index.kiq * 2) << 2);
6874-
/* If GC has entered CGPG, ringing doorbell > first page doesn't
6875-
* wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to workaround
6876-
* this issue.
6877-
*/
68786874
WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER,
6879-
(adev->doorbell.size - 4));
6875+
(adev->doorbell_index.userqueue_end * 2) << 2);
68806876
}
68816877

68826878
WREG32_SOC15(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3673,12 +3673,8 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)
36733673
if (ring->use_doorbell) {
36743674
WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER,
36753675
(adev->doorbell_index.kiq * 2) << 2);
3676-
/* If GC has entered CGPG, ringing doorbell > first page doesn't
3677-
* wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to workaround
3678-
* this issue.
3679-
*/
36803676
WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER,
3681-
(adev->doorbell.size - 4));
3677+
(adev->doorbell_index.userqueue_end * 2) << 2);
36823678
}
36833679

36843680
WREG32_SOC15_RLC(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,

drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ static void atmel_hlcdc_crtc_atomic_enable(struct drm_crtc *c,
232232

233233
pm_runtime_put_sync(dev->dev);
234234

235-
drm_crtc_vblank_on(c);
236235
}
237236

238237
#define ATMEL_HLCDC_RGB444_OUTPUT BIT(0)
@@ -343,8 +342,17 @@ static int atmel_hlcdc_crtc_atomic_check(struct drm_crtc *c,
343342

344343
static void atmel_hlcdc_crtc_atomic_begin(struct drm_crtc *c,
345344
struct drm_atomic_state *state)
345+
{
346+
drm_crtc_vblank_on(c);
347+
}
348+
349+
static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *c,
350+
struct drm_atomic_state *state)
346351
{
347352
struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
353+
unsigned long flags;
354+
355+
spin_lock_irqsave(&c->dev->event_lock, flags);
348356

349357
if (c->state->event) {
350358
c->state->event->pipe = drm_crtc_index(c);
@@ -354,12 +362,7 @@ static void atmel_hlcdc_crtc_atomic_begin(struct drm_crtc *c,
354362
crtc->event = c->state->event;
355363
c->state->event = NULL;
356364
}
357-
}
358-
359-
static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc,
360-
struct drm_atomic_state *state)
361-
{
362-
/* TODO: write common plane control register if available */
365+
spin_unlock_irqrestore(&c->dev->event_lock, flags);
363366
}
364367

365368
static const struct drm_crtc_helper_funcs lcdc_crtc_helper_funcs = {

drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ static int atmel_hlcdc_dc_modeset_init(struct drm_device *dev)
593593
dev->mode_config.max_width = dc->desc->max_width;
594594
dev->mode_config.max_height = dc->desc->max_height;
595595
dev->mode_config.funcs = &mode_config_funcs;
596+
dev->mode_config.async_page_flip = true;
596597

597598
return 0;
598599
}

drivers/gpu/drm/kmb/kmb_drv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ static int kmb_hw_init(struct drm_device *drm, unsigned long flags)
137137
/* Allocate LCD interrupt resources */
138138
irq_lcd = platform_get_irq(pdev, 0);
139139
if (irq_lcd < 0) {
140+
ret = irq_lcd;
140141
drm_err(&kmb->drm, "irq_lcd not found");
141142
goto setup_fail;
142143
}

drivers/gpu/drm/nouveau/nouveau_bo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ nouveau_bo_sync_for_device(struct nouveau_bo *nvbo)
546546
struct ttm_tt *ttm_dma = (struct ttm_tt *)nvbo->bo.ttm;
547547
int i, j;
548548

549-
if (!ttm_dma)
549+
if (!ttm_dma || !ttm_dma->dma_address)
550550
return;
551551
if (!ttm_dma->pages) {
552552
NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma);
@@ -582,7 +582,7 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo *nvbo)
582582
struct ttm_tt *ttm_dma = (struct ttm_tt *)nvbo->bo.ttm;
583583
int i, j;
584584

585-
if (!ttm_dma)
585+
if (!ttm_dma || !ttm_dma->dma_address)
586586
return;
587587
if (!ttm_dma->pages) {
588588
NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma);

drivers/gpu/drm/nouveau/nouveau_prime.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,22 @@ int nouveau_gem_prime_pin(struct drm_gem_object *obj)
9393
if (ret)
9494
return -EINVAL;
9595

96-
return 0;
96+
ret = ttm_bo_reserve(&nvbo->bo, false, false, NULL);
97+
if (ret)
98+
goto error;
99+
100+
if (nvbo->bo.moving)
101+
ret = dma_fence_wait(nvbo->bo.moving, true);
102+
103+
ttm_bo_unreserve(&nvbo->bo);
104+
if (ret)
105+
goto error;
106+
107+
return ret;
108+
109+
error:
110+
nouveau_bo_unpin(nvbo);
111+
return ret;
97112
}
98113

99114
void nouveau_gem_prime_unpin(struct drm_gem_object *obj)

drivers/gpu/drm/panel/panel-samsung-ld9040.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ MODULE_DEVICE_TABLE(spi, ld9040_ids);
383383
static struct spi_driver ld9040_driver = {
384384
.probe = ld9040_probe,
385385
.remove = ld9040_remove,
386+
.id_table = ld9040_ids,
386387
.driver = {
387388
.name = "panel-samsung-ld9040",
388389
.of_match_table = ld9040_of_match,

0 commit comments

Comments
 (0)