diff mbox series

[1/2] drm/i915: Swap ggtt_vma during legacy cursor update

Message ID 20230621114827.167713-1-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915: Swap ggtt_vma during legacy cursor update | expand

Commit Message

Maarten Lankhorst June 21, 2023, 11:48 a.m. UTC
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_cursor.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Souza, Jose June 23, 2023, 10:38 p.m. UTC | #1
On Wed, 2023-06-21 at 13:48 +0200, Maarten Lankhorst wrote:
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_cursor.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cursor.c b/drivers/gpu/drm/i915/display/intel_cursor.c
> index 4962247911d41..6f34098ea314d 100644
> --- a/drivers/gpu/drm/i915/display/intel_cursor.c
> +++ b/drivers/gpu/drm/i915/display/intel_cursor.c
> @@ -688,9 +688,8 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
>  	if (ret)
>  		goto out_free;
>  
> -	ret = intel_plane_pin_fb(new_plane_state);
> -	if (ret)
> -		goto out_free;
> +	/* magic trick! */
> +	swap(new_plane_state->ggtt_vma, old_plane_state->ggtt_vma);
>  
>  	intel_frontbuffer_flush(to_intel_frontbuffer(new_plane_state->hw.fb),
>  				ORIGIN_CURSOR_UPDATE);

Getting a opps with this. This is missing the unbind block(https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/282#note_1947355):

[  219.866996] [drm:drm_helper_probe_single_connector_modes [drm_kms_helper]] [CONNECTOR:276:DP-4]
[  219.867005] xe 0000:03:00.0: [drm:intel_dp_detect [xe]] [CONNECTOR:276:DP-4]
[  219.867053] [drm:drm_helper_probe_single_connector_modes [drm_kms_helper]] [CONNECTOR:276:DP-4] disconnected
[  219.867073] [drm:drm_helper_probe_single_connector_modes [drm_kms_helper]] [CONNECTOR:284:HDMI-A-3]
[  219.867082] xe 0000:03:00.0: [drm:intel_hdmi_detect [xe]] [CONNECTOR:284:HDMI-A-3]
[  219.867127] [drm:drm_helper_probe_single_connector_modes [drm_kms_helper]] [CONNECTOR:284:HDMI-A-3] disconnected
[  222.635935] BUG: kernel NULL pointer dereference, address: 0000000000000000
[  222.642930] #PF: supervisor read access in kernel mode
[  222.648081] #PF: error_code(0x0000) - not-present page
[  222.653229] PGD 0 P4D 0
[  222.655778] Oops: 0000 [#1] PREEMPT SMP NOPTI
[  222.660147] CPU: 0 PID: 3049 Comm: InputThread Not tainted 6.3.0+zeh-xe+ #1023
[  222.667378] Hardware name: Intel Corporation Alder Lake Client Platform/AlderLake-S ADP-S DDR4 UDIMM CRB, BIOS ADLSFWI1.R00.3385.A00.2209161457
09/16/2022
[  222.681196] RIP: 0010:__xe_unpin_fb_vma+0x4/0x190 [xe]
[  222.686404] Code: 00 00 e9 65 ff ff ff e8 ea 56 9e e1 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 41 54 55 53
<48> 8b 07 48 89 fb 48 8b 6b 08 48 8b 50 08 48 8b ba e8 22 00 00 48
[  222.705163] RSP: 0018:ffffc9000350fb50 EFLAGS: 00010206
[  222.710398] RAX: 0000000000000000 RBX: ffff88821f3a4c00 RCX: 0000000000000040
[  222.717544] RDX: 0000000000000000 RSI: ffffffff8253a99b RDI: 0000000000000000
[  222.724691] RBP: ffff888142dda800 R08: 0000000000000001 R09: 0000000000000001
[  222.731833] R10: 0000000000000007 R11: 0000000000000003 R12: ffff88811b5fa000
[  222.738979] R13: 0000000000000000 R14: 0000000001000000 R15: ffff88821f3a4c00
[  222.746125] FS:  00007fd3e4a4f640(0000) GS:ffff88849e600000(0000) knlGS:0000000000000000
[  222.754221] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  222.759979] CR2: 0000000000000000 CR3: 000000011c300006 CR4: 0000000000770ef0
[  222.767125] PKRU: 55555554
[  222.769847] Call Trace:
[  222.772311]  <TASK>
[  222.774426]  intel_plane_unpin_fb+0x10/0x30 [xe]
[  222.779105]  intel_legacy_cursor_update+0x2fc/0x3d0 [xe]
[  222.784481]  drm_mode_cursor_universal+0x126/0x240
[  222.789286]  drm_mode_cursor_common+0xfc/0x230
[  222.793746]  ? __pfx_drm_mode_cursor_ioctl+0x10/0x10
[  222.798723]  drm_mode_cursor_ioctl+0x46/0x70
[  222.803010]  drm_ioctl_kernel+0xc0/0x170
[  222.806947]  drm_ioctl+0x212/0x470
[  222.810366]  ? __pfx_drm_mode_cursor_ioctl+0x10/0x10
[  222.815341]  __x64_sys_ioctl+0x8a/0xb0
[  222.819104]  do_syscall_64+0x38/0x90
[  222.822700]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
[  222.827769] RIP: 0033:0x7fd3f831aaff
[  222.831364] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05
<41> 89 c0 3d 00 f0 ff ff 77 1f 48 8b 44 24 18 64 48 2b 04 25 28 00
[  222.850121] RSP: 002b:00007fd3e4a4d1e0 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[  222.857701] RAX: ffffffffffffffda RBX: 00007fd3e4a4d270 RCX: 00007fd3f831aaff
[  222.864847] RDX: 00007fd3e4a4d270 RSI: 00000000c01c64a3 RDI: 000000000000000e
[  222.871991] RBP: 00000000c01c64a3 R08: 0000000000000710 R09: 0000000000000001
[  222.879137] R10: 0000000000000004 R11: 0000000000000246 R12: 00005639c66aef90
[  222.886283] R13: 000000000000000e R14: 0000000000000150 R15: 0000000000000150
[  222.893430]  </TASK>
[  222.895635] Modules linked in: snd_hda_codec_hdmi xe drm_ttm_helper gpu_sched drm_suballoc_helper i2c_algo_bit drm_buddy ttm drm_display_helper
drm_kms_helper syscopyarea sysfillrect sysimgblt mei_hdcp mei_pxp pmt_telemetry pmt_class snd_hda_codec_realtek x86_pkg_temp_thermal
snd_hda_codec_generic ledtrig_audio coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel kvm_intel snd_hda_intel snd_intel_dspcfg snd_hda_codec
snd_hwdep snd_hda_core e1000e i2c_i801 ptp snd_pcm i2c_smbus pps_core wmi_bmof mei_me mei intel_vsec video wmi pinctrl_alderlake fuse
[  222.944655] CR2: 0000000000000000
[  222.947984] ---[ end trace 0000000000000000 ]---
[  223.009508] RIP: 0010:__xe_unpin_fb_vma+0x4/0x190 [xe]
[  223.014713] Code: 00 00 e9 65 ff ff ff e8 ea 56 9e e1 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 41 54 55 53
<48> 8b 07 48 89 fb 48 8b 6b 08 48 8b 50 08 48 8b ba e8 22 00 00 48
[  223.033470] RSP: 0018:ffffc9000350fb50 EFLAGS: 00010206
[  223.038705] RAX: 0000000000000000 RBX: ffff88821f3a4c00 RCX: 0000000000000040
[  223.045851] RDX: 0000000000000000 RSI: ffffffff8253a99b RDI: 0000000000000000
[  223.052996] RBP: ffff888142dda800 R08: 0000000000000001 R09: 0000000000000001
[  223.060142] R10: 0000000000000007 R11: 0000000000000003 R12: ffff88811b5fa000
[  223.067288] R13: 0000000000000000 R14: 0000000001000000 R15: ffff88821f3a4c00
[  223.074433] FS:  00007fd3e4a4f640(0000) GS:ffff88849e600000(0000) knlGS:0000000000000000
[  223.082529] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  223.088289] CR2: 0000000000000000 CR3: 000000011c300006 CR4: 0000000000770ef0
[  223.095437] PKRU: 55555554
[  223.098159] note: InputThread[3049] exited with irqs disabled
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_cursor.c b/drivers/gpu/drm/i915/display/intel_cursor.c
index 4962247911d41..6f34098ea314d 100644
--- a/drivers/gpu/drm/i915/display/intel_cursor.c
+++ b/drivers/gpu/drm/i915/display/intel_cursor.c
@@ -688,9 +688,8 @@  intel_legacy_cursor_update(struct drm_plane *_plane,
 	if (ret)
 		goto out_free;
 
-	ret = intel_plane_pin_fb(new_plane_state);
-	if (ret)
-		goto out_free;
+	/* magic trick! */
+	swap(new_plane_state->ggtt_vma, old_plane_state->ggtt_vma);
 
 	intel_frontbuffer_flush(to_intel_frontbuffer(new_plane_state->hw.fb),
 				ORIGIN_CURSOR_UPDATE);