Skip to content

Commit ec35307

Browse files
committed
Merge tag 'drm-fixes-2023-02-17' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Just a final collection of misc fixes, the biggest disables the recently added dynamic debugging support, it has a regression that needs some bigger fixes. Otherwise a bunch of fixes across the board, vc4, amdgpu and vmwgfx mostly, with some smaller i915 and ast fixes. drm: - dynamic debug disable for now fbdev: - deferred i/o device close fix amdgpu: - Fix GC11.x suspend warning - Fix display warning vc4: - YUV planes fix - hdmi display fix - crtc reduced blanking fix ast: - fix start address computation vmwgfx: - fix bo/handle races i915: - gen11 WA fix" * tag 'drm-fixes-2023-02-17' of git://anongit.freedesktop.org/drm/drm: drm/amd/display: Fail atomic_check early on normalize_zpos error drm/amd/amdgpu: fix warning during suspend drm/vmwgfx: Do not drop the reference to the handle too soon drm/vmwgfx: Stop accessing buffer objects which failed init drm/i915/gen11: Wa_1408615072/Wa_1407596294 should be on GT list drm: Disable dynamic debug as broken drm/ast: Fix start address computation fbdev: Fix invalid page access after closing deferred I/O devices drm/vc4: crtc: Increase setup cost in core clock calculation to handle extreme reduced blanking drm/vc4: hdmi: Always enable GCP with AVMUTE cleared drm/vc4: Fix YUV plane handling when planes are in different buffers
2 parents 3ac88fa + f7597e3 commit ec35307

File tree

19 files changed

+73
-38
lines changed

19 files changed

+73
-38
lines changed

drivers/gpu/drm/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ config DRM_DEBUG_MM
5353

5454
config DRM_USE_DYNAMIC_DEBUG
5555
bool "use dynamic debug to implement drm.debug"
56-
default y
56+
default n
57+
depends on BROKEN
5758
depends on DRM
5859
depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE
5960
depends on JUMP_LABEL

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4268,6 +4268,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
42684268
}
42694269
adev->in_suspend = false;
42704270

4271+
if (adev->enable_mes)
4272+
amdgpu_mes_self_test(adev);
4273+
42714274
if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DEV_D0))
42724275
DRM_WARN("smart shift update failed\n");
42734276

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ static int mes_v11_0_late_init(void *handle)
13441344
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
13451345

13461346
/* it's only intended for use in mes_self_test case, not for s0ix and reset */
1347-
if (!amdgpu_in_reset(adev) && !adev->in_s0ix &&
1347+
if (!amdgpu_in_reset(adev) && !adev->in_s0ix && !adev->in_suspend &&
13481348
(adev->ip_versions[GC_HWIP][0] != IP_VERSION(11, 0, 3)))
13491349
amdgpu_mes_self_test(adev);
13501350

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9658,7 +9658,11 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
96589658
* `dcn10_can_pipe_disable_cursor`). By now, all modified planes are in
96599659
* atomic state, so call drm helper to normalize zpos.
96609660
*/
9661-
drm_atomic_normalize_zpos(dev, state);
9661+
ret = drm_atomic_normalize_zpos(dev, state);
9662+
if (ret) {
9663+
drm_dbg(dev, "drm_atomic_normalize_zpos() failed\n");
9664+
goto fail;
9665+
}
96629666

96639667
/* Remove exiting planes if they are modified */
96649668
for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) {

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ static int ast_primary_plane_init(struct ast_private *ast)
714714
struct ast_plane *ast_primary_plane = &ast->primary_plane;
715715
struct drm_plane *primary_plane = &ast_primary_plane->base;
716716
void __iomem *vaddr = ast->vram;
717-
u64 offset = ast->vram_base;
717+
u64 offset = 0; /* with shmem, the primary plane is always at offset 0 */
718718
unsigned long cursor_size = roundup(AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE, PAGE_SIZE);
719719
unsigned long size = ast->vram_fb_available - cursor_size;
720720
int ret;
@@ -972,7 +972,7 @@ static int ast_cursor_plane_init(struct ast_private *ast)
972972
return -ENOMEM;
973973

974974
vaddr = ast->vram + ast->vram_fb_available - size;
975-
offset = ast->vram_base + ast->vram_fb_available - size;
975+
offset = ast->vram_fb_available - size;
976976

977977
ret = ast_plane_init(dev, ast_cursor_plane, vaddr, offset, size,
978978
0x01, &ast_cursor_plane_funcs,

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,13 @@ icl_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal)
13551355
GAMT_CHKN_BIT_REG,
13561356
GAMT_CHKN_DISABLE_L3_COH_PIPE);
13571357

1358+
/*
1359+
* Wa_1408615072:icl,ehl (vsunit)
1360+
* Wa_1407596294:icl,ehl (hsunit)
1361+
*/
1362+
wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE,
1363+
VSUNIT_CLKGATE_DIS | HSUNIT_CLKGATE_DIS);
1364+
13581365
/* Wa_1407352427:icl,ehl */
13591366
wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE2,
13601367
PSDUNIT_CLKGATE_DIS);
@@ -2539,13 +2546,6 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal)
25392546
wa_masked_en(wal, GEN9_CSFE_CHICKEN1_RCS,
25402547
GEN11_ENABLE_32_PLANE_MODE);
25412548

2542-
/*
2543-
* Wa_1408615072:icl,ehl (vsunit)
2544-
* Wa_1407596294:icl,ehl (hsunit)
2545-
*/
2546-
wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE,
2547-
VSUNIT_CLKGATE_DIS | HSUNIT_CLKGATE_DIS);
2548-
25492549
/*
25502550
* Wa_1408767742:icl[a2..forever],ehl[all]
25512551
* Wa_1605460711:icl[a0..c0]

drivers/gpu/drm/vc4/vc4_crtc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
711711
struct vc4_encoder *vc4_encoder = to_vc4_encoder(encoder);
712712

713713
if (vc4_encoder->type == VC4_ENCODER_TYPE_HDMI0) {
714-
vc4_state->hvs_load = max(mode->clock * mode->hdisplay / mode->htotal + 1000,
714+
vc4_state->hvs_load = max(mode->clock * mode->hdisplay / mode->htotal + 8000,
715715
mode->clock * 9 / 10) * 1000;
716716
} else {
717717
vc4_state->hvs_load = mode->clock * 1000;

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@
9797
#define VC5_HDMI_GCP_WORD_1_GCP_SUBPACKET_BYTE_1_SHIFT 8
9898
#define VC5_HDMI_GCP_WORD_1_GCP_SUBPACKET_BYTE_1_MASK VC4_MASK(15, 8)
9999

100+
#define VC5_HDMI_GCP_WORD_1_GCP_SUBPACKET_BYTE_0_MASK VC4_MASK(7, 0)
101+
#define VC5_HDMI_GCP_WORD_1_GCP_SUBPACKET_BYTE_0_SET_AVMUTE BIT(0)
102+
#define VC5_HDMI_GCP_WORD_1_GCP_SUBPACKET_BYTE_0_CLEAR_AVMUTE BIT(4)
103+
100104
# define VC4_HD_M_SW_RST BIT(2)
101105
# define VC4_HD_M_ENABLE BIT(0)
102106

@@ -1306,7 +1310,6 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi,
13061310
VC4_HDMI_VERTB_VBP));
13071311
unsigned long flags;
13081312
unsigned char gcp;
1309-
bool gcp_en;
13101313
u32 reg;
13111314
int idx;
13121315

@@ -1341,16 +1344,13 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi,
13411344
switch (vc4_state->output_bpc) {
13421345
case 12:
13431346
gcp = 6;
1344-
gcp_en = true;
13451347
break;
13461348
case 10:
13471349
gcp = 5;
1348-
gcp_en = true;
13491350
break;
13501351
case 8:
13511352
default:
1352-
gcp = 4;
1353-
gcp_en = false;
1353+
gcp = 0;
13541354
break;
13551355
}
13561356

@@ -1359,8 +1359,7 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi,
13591359
* doesn't signal in GCP.
13601360
*/
13611361
if (vc4_state->output_format == VC4_HDMI_OUTPUT_YUV422) {
1362-
gcp = 4;
1363-
gcp_en = false;
1362+
gcp = 0;
13641363
}
13651364

13661365
reg = HDMI_READ(HDMI_DEEP_COLOR_CONFIG_1);
@@ -1373,11 +1372,12 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi,
13731372
reg = HDMI_READ(HDMI_GCP_WORD_1);
13741373
reg &= ~VC5_HDMI_GCP_WORD_1_GCP_SUBPACKET_BYTE_1_MASK;
13751374
reg |= VC4_SET_FIELD(gcp, VC5_HDMI_GCP_WORD_1_GCP_SUBPACKET_BYTE_1);
1375+
reg &= ~VC5_HDMI_GCP_WORD_1_GCP_SUBPACKET_BYTE_0_MASK;
1376+
reg |= VC5_HDMI_GCP_WORD_1_GCP_SUBPACKET_BYTE_0_CLEAR_AVMUTE;
13761377
HDMI_WRITE(HDMI_GCP_WORD_1, reg);
13771378

13781379
reg = HDMI_READ(HDMI_GCP_CONFIG);
1379-
reg &= ~VC5_HDMI_GCP_CONFIG_GCP_ENABLE;
1380-
reg |= gcp_en ? VC5_HDMI_GCP_CONFIG_GCP_ENABLE : 0;
1380+
reg |= VC5_HDMI_GCP_CONFIG_GCP_ENABLE;
13811381
HDMI_WRITE(HDMI_GCP_CONFIG, reg);
13821382

13831383
reg = HDMI_READ(HDMI_MISC_CONTROL);

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
340340
{
341341
struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
342342
struct drm_framebuffer *fb = state->fb;
343-
struct drm_gem_dma_object *bo = drm_fb_dma_get_gem_obj(fb, 0);
343+
struct drm_gem_dma_object *bo;
344344
int num_planes = fb->format->num_planes;
345345
struct drm_crtc_state *crtc_state;
346346
u32 h_subsample = fb->format->hsub;
@@ -359,8 +359,10 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
359359
if (ret)
360360
return ret;
361361

362-
for (i = 0; i < num_planes; i++)
362+
for (i = 0; i < num_planes; i++) {
363+
bo = drm_fb_dma_get_gem_obj(fb, i);
363364
vc4_state->offsets[i] = bo->dma_addr + fb->offsets[i];
365+
}
364366

365367
/*
366368
* We don't support subpixel source positioning for scaling,

drivers/gpu/drm/vmwgfx/vmwgfx_bo.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ int vmw_bo_create(struct vmw_private *vmw,
462462
return -ENOMEM;
463463
}
464464

465+
/*
466+
* vmw_bo_init will delete the *p_bo object if it fails
467+
*/
465468
ret = vmw_bo_init(vmw, *p_bo, size,
466469
placement, interruptible, pin,
467470
bo_free);
@@ -470,7 +473,6 @@ int vmw_bo_create(struct vmw_private *vmw,
470473

471474
return ret;
472475
out_error:
473-
kfree(*p_bo);
474476
*p_bo = NULL;
475477
return ret;
476478
}
@@ -596,6 +598,7 @@ static int vmw_user_bo_synccpu_release(struct drm_file *filp,
596598
ttm_bo_put(&vmw_bo->base);
597599
}
598600

601+
drm_gem_object_put(&vmw_bo->base.base);
599602
return ret;
600603
}
601604

@@ -636,6 +639,7 @@ int vmw_user_bo_synccpu_ioctl(struct drm_device *dev, void *data,
636639

637640
ret = vmw_user_bo_synccpu_grab(vbo, arg->flags);
638641
vmw_bo_unreference(&vbo);
642+
drm_gem_object_put(&vbo->base.base);
639643
if (unlikely(ret != 0)) {
640644
if (ret == -ERESTARTSYS || ret == -EBUSY)
641645
return -EBUSY;
@@ -693,7 +697,7 @@ int vmw_bo_unref_ioctl(struct drm_device *dev, void *data,
693697
* struct vmw_buffer_object should be placed.
694698
* Return: Zero on success, Negative error code on error.
695699
*
696-
* The vmw buffer object pointer will be refcounted.
700+
* The vmw buffer object pointer will be refcounted (both ttm and gem)
697701
*/
698702
int vmw_user_bo_lookup(struct drm_file *filp,
699703
uint32_t handle,
@@ -710,7 +714,6 @@ int vmw_user_bo_lookup(struct drm_file *filp,
710714

711715
*out = gem_to_vmw_bo(gobj);
712716
ttm_bo_get(&(*out)->base);
713-
drm_gem_object_put(gobj);
714717

715718
return 0;
716719
}
@@ -791,7 +794,8 @@ int vmw_dumb_create(struct drm_file *file_priv,
791794
ret = vmw_gem_object_create_with_handle(dev_priv, file_priv,
792795
args->size, &args->handle,
793796
&vbo);
794-
797+
/* drop reference from allocate - handle holds it now */
798+
drm_gem_object_put(&vbo->base.base);
795799
return ret;
796800
}
797801

drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,7 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv,
11601160
}
11611161
ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo, true, false);
11621162
ttm_bo_put(&vmw_bo->base);
1163+
drm_gem_object_put(&vmw_bo->base.base);
11631164
if (unlikely(ret != 0))
11641165
return ret;
11651166

@@ -1214,6 +1215,7 @@ static int vmw_translate_guest_ptr(struct vmw_private *dev_priv,
12141215
}
12151216
ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo, false, false);
12161217
ttm_bo_put(&vmw_bo->base);
1218+
drm_gem_object_put(&vmw_bo->base.base);
12171219
if (unlikely(ret != 0))
12181220
return ret;
12191221

drivers/gpu/drm/vmwgfx/vmwgfx_gem.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,12 @@ int vmw_gem_object_create_with_handle(struct vmw_private *dev_priv,
146146
&vmw_sys_placement :
147147
&vmw_vram_sys_placement,
148148
true, false, &vmw_gem_destroy, p_vbo);
149-
150-
(*p_vbo)->base.base.funcs = &vmw_gem_object_funcs;
151149
if (ret != 0)
152150
goto out_no_bo;
153151

152+
(*p_vbo)->base.base.funcs = &vmw_gem_object_funcs;
153+
154154
ret = drm_gem_handle_create(filp, &(*p_vbo)->base.base, handle);
155-
/* drop reference from allocate - handle holds it now */
156-
drm_gem_object_put(&(*p_vbo)->base.base);
157155
out_no_bo:
158156
return ret;
159157
}
@@ -180,6 +178,8 @@ int vmw_gem_object_create_ioctl(struct drm_device *dev, void *data,
180178
rep->map_handle = drm_vma_node_offset_addr(&vbo->base.base.vma_node);
181179
rep->cur_gmr_id = handle;
182180
rep->cur_gmr_offset = 0;
181+
/* drop reference from allocate - handle holds it now */
182+
drm_gem_object_put(&vbo->base.base);
183183
out_no_bo:
184184
return ret;
185185
}

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1815,8 +1815,10 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
18151815

18161816
err_out:
18171817
/* vmw_user_lookup_handle takes one ref so does new_fb */
1818-
if (bo)
1818+
if (bo) {
18191819
vmw_bo_unreference(&bo);
1820+
drm_gem_object_put(&bo->base.base);
1821+
}
18201822
if (surface)
18211823
vmw_surface_unreference(&surface);
18221824

drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data,
458458
ret = vmw_overlay_update_stream(dev_priv, buf, arg, true);
459459

460460
vmw_bo_unreference(&buf);
461+
drm_gem_object_put(&buf->base.base);
461462

462463
out_unlock:
463464
mutex_unlock(&overlay->mutex);

drivers/gpu/drm/vmwgfx/vmwgfx_shader.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv,
807807
num_output_sig, tfile, shader_handle);
808808
out_bad_arg:
809809
vmw_bo_unreference(&buffer);
810+
drm_gem_object_put(&buffer->base.base);
810811
return ret;
811812
}
812813

drivers/gpu/drm/vmwgfx/vmwgfx_surface.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ static void vmw_user_surface_base_release(struct ttm_base_object **p_base)
683683
container_of(base, struct vmw_user_surface, prime.base);
684684
struct vmw_resource *res = &user_srf->srf.res;
685685

686-
if (base->shareable && res && res->backup)
686+
if (res && res->backup)
687687
drm_gem_object_put(&res->backup->base.base);
688688

689689
*p_base = NULL;
@@ -864,7 +864,11 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
864864
goto out_unlock;
865865
}
866866
vmw_bo_reference(res->backup);
867-
drm_gem_object_get(&res->backup->base.base);
867+
/*
868+
* We don't expose the handle to the userspace and surface
869+
* already holds a gem reference
870+
*/
871+
drm_gem_handle_delete(file_priv, backup_handle);
868872
}
869873

870874
tmp = vmw_resource_reference(&srf->res);
@@ -1568,8 +1572,6 @@ vmw_gb_surface_define_internal(struct drm_device *dev,
15681572
drm_vma_node_offset_addr(&res->backup->base.base.vma_node);
15691573
rep->buffer_size = res->backup->base.base.size;
15701574
rep->buffer_handle = backup_handle;
1571-
if (user_srf->prime.base.shareable)
1572-
drm_gem_object_get(&res->backup->base.base);
15731575
} else {
15741576
rep->buffer_map_handle = 0;
15751577
rep->buffer_size = 0;

drivers/video/fbdev/core/fb_defio.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ void fb_deferred_io_open(struct fb_info *info,
313313
}
314314
EXPORT_SYMBOL_GPL(fb_deferred_io_open);
315315

316-
void fb_deferred_io_cleanup(struct fb_info *info)
316+
void fb_deferred_io_release(struct fb_info *info)
317317
{
318318
struct fb_deferred_io *fbdefio = info->fbdefio;
319319
struct page *page;
@@ -327,6 +327,14 @@ void fb_deferred_io_cleanup(struct fb_info *info)
327327
page = fb_deferred_io_page(info, i);
328328
page->mapping = NULL;
329329
}
330+
}
331+
EXPORT_SYMBOL_GPL(fb_deferred_io_release);
332+
333+
void fb_deferred_io_cleanup(struct fb_info *info)
334+
{
335+
struct fb_deferred_io *fbdefio = info->fbdefio;
336+
337+
fb_deferred_io_release(info);
330338

331339
kvfree(info->pagerefs);
332340
mutex_destroy(&fbdefio->lock);

drivers/video/fbdev/core/fbmem.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,10 @@ __releases(&info->lock)
14541454
struct fb_info * const info = file->private_data;
14551455

14561456
lock_fb_info(info);
1457+
#if IS_ENABLED(CONFIG_FB_DEFERRED_IO)
1458+
if (info->fbdefio)
1459+
fb_deferred_io_release(info);
1460+
#endif
14571461
if (info->fbops->fb_release)
14581462
info->fbops->fb_release(info,1);
14591463
module_put(info->fbops->owner);

include/linux/fb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ extern int fb_deferred_io_init(struct fb_info *info);
662662
extern void fb_deferred_io_open(struct fb_info *info,
663663
struct inode *inode,
664664
struct file *file);
665+
extern void fb_deferred_io_release(struct fb_info *info);
665666
extern void fb_deferred_io_cleanup(struct fb_info *info);
666667
extern int fb_deferred_io_fsync(struct file *file, loff_t start,
667668
loff_t end, int datasync);

0 commit comments

Comments
 (0)