drm/amdgpu: use dirty framebuffer helper
Subsystems (2)
PATCH 1/1 drm/amdgpu: use dirty framebuffer helper
Currently, we aren't handling DRM_IOCTL_MODE_DIRTYFB. So, use drm_atomic_helper_dirtyfb() as the dirty callback in the amdgpu_fb_funcs struct.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 -0
@@ -38,6 +38,7 @@#include <linux/pci.h> #include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_damage_helper.h> #include <drm/drm_edid.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h>
@@ -496,6 +497,7 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, + .dirty = drm_atomic_helper_dirtyfb, }; uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
Signature · 1 line
2.37.2
Quoted 6 lines · Hamza Mahfooz
Currently, we aren't handling
DRM_IOCTL_MODE_DIRTYFB. So, usedrm_atomic_helper_dirtyfb()as the dirty callback in theamdgpu_fb_funcsstruct.Signed-off-by Hamza Mahfooz <[email protected]>
Quoted 27 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2
-1@@ -38,6 +38,7 @@#include <linux/pci.h> #include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_damage_helper.h> #include <drm/drm_edid.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h> @@ -496,6 +497,7 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, + .dirty = drm_atomic_helper_dirtyfb, }; uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, --2.37.2
root
Acked-by Alex DeucherHi, I recently experienced lock-ups that only responded to magic sysreq reboots when the amdgpu module was loading on my pc (Athlon II X4 640 CPU, with Radeon R7 250 - Cape Verde).
.config has:
CONFIG_DRM_AMDGPU=mCONFIG_DRM_AMDGPU_SI=y
# CONFIG_DRM_AMDGPU_CIK is not set
# CONFIG_DRM_AMDGPU_USERPTR is not set
kernel command line has:
amdgpu.audio=1 amdgpu.si_support=1 radeon.si_support=0 page_owner=on \
amdgpu.gpu_recovery=1
Bisecting lead to:
commit 66f99628eb24409cb8feb5061f78283c8b65f820
Author: Hamza Mahfooz <[email protected]> Date: Tue Sep 6 15:01:49 2022 -0400
drm/amdgpu: use dirty framebuffer helper
Currently, we aren't handling DRM_IOCTL_MODE_DIRTYFB. So, use drm_atomic_helper_dirtyfb() as the dirty callback in the amdgpu_fb_funcs struct.
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 -0
@@ -38,6 +38,7 @@#include <linux/pci.h> #include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_damage_helper.h> #include <drm/drm_edid.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h>
@@ -496,6 +497,7 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, + .dirty = drm_atomic_helper_dirtyfb, }; uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
After doing a git bisect reset, git pull and reverting the patch above, I rebuilt the kernel and am successfully running with the amdgpu module loaded and using the Radeon R7 250 GPU.
I am happy to supply any further configuration details.
Arthur Marsh.
I have done a delayed load of amdgpu with the 6.0-rc6 kernel using:
modprobe amdgpu si_support=1
and saved the dmesg output:
[ 455.424263] udevd[414]: specified group 'sgx' unknown [ 455.514818] ACPI: bus type drm_connector registered [ 457.759316] [drm] amdgpu kernel modesetting enabled. [ 457.759491] amdgpu 0000:01:00.0: vgaarb: deactivate vga console [ 457.760459] Console: switching to colour dummy device 80x25 [ 457.760689] [drm] initializing kernel modesetting (VERDE 0x1002:0x682B 0x1458:0x22CA 0x87). [ 457.760717] [drm] register mmio base: 0xFE8C0000 [ 457.760720] [drm] register mmio size: 262144 [ 457.760872] [drm] add ip block number 0 <si_common> [ 457.760887] [drm] add ip block number 1 <gmc_v6_0> [ 457.760890] [drm] add ip block number 2 <si_ih> [ 457.760893] [drm] add ip block number 3 <gfx_v6_0> [ 457.760896] [drm] add ip block number 4 <si_dma> [ 457.760898] [drm] add ip block number 5 <si_dpm> [ 457.760901] [drm] add ip block number 6 <dce_v6_0> [ 457.760903] [drm] add ip block number 7 <uvd_v3_1> [ 457.804366] [drm] BIOS signature incorrect 20 7 [ 457.804376] resource sanity check: requesting [mem 0x000c0000-0x000dffff], which spans more than PCI Bus 0000:00 [mem 0x000d0000-0x000dffff window] [ 457.804383] caller pci_map_rom+0x68/0x1b0 mapping multiple BARs [ 457.804398] amdgpu 0000:01:00.0: No more image in the PCI ROM [ 457.805746] amdgpu 0000:01:00.0: amdgpu: Fetched VBIOS from ROM BAR [ 457.805752] amdgpu: ATOM BIOS: xxx-xxx-xxx [ 457.805775] amdgpu 0000:01:00.0: amdgpu: Trusted Memory Zone (TMZ) feature not supported [ 457.805781] amdgpu 0000:01:00.0: amdgpu: PCIE atomic ops is not supported [ 457.806204] [drm] PCIE gen 2 link speeds already enabled [ 457.806632] [drm] vm size is 64 GB, 2 levels, block size is 10-bit, fragment size is 9-bit [ 457.869590] amdgpu 0000:01:00.0: amdgpu: VRAM: 2048M 0x000000F400000000 - 0x000000F47FFFFFFF (2048M used) [ 457.869605] amdgpu 0000:01:00.0: amdgpu: GART: 1024M 0x000000FF00000000 - 0x000000FF3FFFFFFF [ 457.869622] [drm] Detected VRAM RAM=2048M, BAR=256M [ 457.869625] [drm] RAM width 128bits DDR3 [ 457.869706] [drm] amdgpu: 2048M of VRAM memory ready [ 457.869710] [drm] amdgpu: 3979M of GTT memory ready. [ 457.869734] [drm] GART: num cpu pages 262144, num gpu pages 262144 [ 457.870061] amdgpu 0000:01:00.0: amdgpu: PCIE GART of 1024M enabled (table at 0x000000F400A00000). [ 457.908024] [drm] Internal thermal controller with fan control [ 457.908045] [drm] amdgpu: dpm initialized [ 457.908126] [drm] AMDGPU Display Connectors [ 457.908128] [drm] Connector 0: [ 457.908131] [drm] HDMI-A-1 [ 457.908133] [drm] HPD1 [ 457.908135] [drm] DDC: 0x194c 0x194c 0x194d 0x194d 0x194e 0x194e 0x194f 0x194f [ 457.908139] [drm] Encoders: [ 457.908141] [drm] DFP1: INTERNAL_UNIPHY [ 457.908144] [drm] Connector 1: [ 457.908145] [drm] DVI-D-1 [ 457.908147] [drm] HPD2 [ 457.908149] [drm] DDC: 0x1950 0x1950 0x1951 0x1951 0x1952 0x1952 0x1953 0x1953 [ 457.908153] [drm] Encoders: [ 457.908155] [drm] DFP2: INTERNAL_UNIPHY [ 457.908157] [drm] Connector 2: [ 457.908159] [drm] VGA-1 [ 457.908160] [drm] DDC: 0x1970 0x1970 0x1971 0x1971 0x1972 0x1972 0x1973 0x1973 [ 457.908164] [drm] Encoders: [ 457.908166] [drm] CRT1: INTERNAL_KLDSCP_DAC1 [ 457.959506] [drm] Found UVD firmware Version: 64.0 Family ID: 13 [ 458.497761] [drm] UVD initialized successfully. [ 458.498549] amdgpu 0000:01:00.0: amdgpu: SE 1, SH per SE 2, CU per SH 5, active_cu_number 8 [ 458.836681] [drm] Initialized amdgpu 3.48.0 20150101 for 0000:01:00.0 on minor 0 [ 458.909127] fbcon: amdgpudrmfb (fb0) is primary device [ 458.936086] Console: switching to colour frame buffer device 240x67 [ 458.936126] BUG: kernel NULL pointer dereference, address: 0000000000000010 [ 458.936128] #PF: supervisor read access in kernel mode [ 458.936130] #PF: error_code(0x0000) - not-present page [ 458.936132] PGD 0 P4D 0 [ 458.936134] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 458.936137] CPU: 3 PID: 81 Comm: kworker/3:1 Not tainted 6.0.0-rc6 #5144 [ 458.936140] Hardware name: System manufacturer System Product Name/M3A78 PRO, BIOS 1701 01/27/2011 [ 458.936141] Workqueue: events drm_fb_helper_damage_work [drm_kms_helper] [ 458.936162] RIP: 0010:drm_atomic_helper_dirtyfb+0x13c/0x240 [drm_kms_helper] [ 458.936176] Code: 05 c0 02 00 00 4c 8d 7a f8 48 39 c2 74 58 49 8b 74 24 48 4d 8d 77 20 4c 89 f7 e8 0f b5 f5 ff 85 c0 75 4b 49 8b 87 58 02 00 00 <48> 39 68 10 75 bf 4c 89 fe 4c 89 e7 e8 23 bf f5 ff 48 3d 00 f0 ff [ 458.936178] RSP: 0018:ffffb75080db3da8 EFLAGS: 00010246 [ 458.936180] RAX: 0000000000000000 RBX: ffff9dbae32e2880 RCX: 000000000000003b [ 458.936181] RDX: ffffb75080db3dd8 RSI: ffffb75080db3dd8 RDI: ffff9dbad6329c48 [ 458.936182] RBP: ffff9dbae9b41100 R08: ffffb75080db3dd8 R09: ffff9dbae33e01f8 [ 458.936184] R10: ffff9dbadf388028 R11: 0000000000000001 R12: ffff9dbad150e880 [ 458.936185] R13: ffff9dbaee0d9980 R14: ffff9dbad6329c20 R15: ffff9dbad6329c00 [ 458.936186] FS: 0000000000000000(0000) GS:ffff9dbbe7cc0000(0000) knlGS:0000000000000000 [ 458.936188] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 458.936189] CR2: 0000000000000010 CR3: 000000012337c000 CR4: 00000000000006e0 [ 458.936190] Call Trace: [ 458.936192] <TASK> [ 458.936194] drm_fb_helper_damage_work+0x1a4/0x2d0 [drm_kms_helper] [ 458.936208] process_one_work+0x1ae/0x370 [ 458.936213] worker_thread+0x4d/0x3b0 [ 458.936215] ? _raw_spin_lock_irqsave+0x22/0x60 [ 458.936219] ? process_one_work+0x370/0x370 [ 458.936221] kthread+0xe3/0x110 [ 458.936224] ? kthread_complete_and_exit+0x20/0x20 [ 458.936226] ret_from_fork+0x22/0x30 [ 458.936229] </TASK> [ 458.936230] Modules linked in: amdgpu(+) gpu_sched drm_buddy drm_ttm_helper ttm drm_display_helper drm_kms_helper drm i2c_algo_bit fb_sys_fops syscopyarea sysfillrect sysimgblt bnep bluetooth jitterentropy_rng sha512_ssse3 sha512_generic hmac drbg ansi_cprng ecdh_generic ecc nfc rfkill snd_hrtimer cpufreq_userspace cpufreq_conservative cpufreq_powersave xt_dscp xt_tcpudp nft_compat x_tables binfmt_misc scsi_transport_iscsi nf_tables nfnetlink exfat max6650 hwmon_vid parport_pc ppdev lp parport edac_mce_amd snd_emu10k1_synth kvm_amd ccp snd_emux_synth rng_core snd_seq_midi_emul snd_seq_virmidi snd_seq_midi snd_seq_midi_event snd_seq kvm wmi_bmof snd_hda_codec_hdmi snd_emu10k1 irqbypass snd_hda_intel snd_intel_dspcfg snd_util_mem snd_hda_codec snd_ac97_codec snd_hda_core ac97_bus snd_hwdep snd_rawmidi snd_seq_device snd_pcm_oss snd_mixer_oss snd_pcm k10temp evdev pcspkr serio_raw emu10k1_gp gameport snd_timer snd wmi button asus_atk0110 acpi_cpufreq sp5100_tco soundcore ext4 crc16 mbcache [ 458.936286] jbd2 btrfs blake2b_generic xor raid6_pq zstd_compress libcrc32c crc32c_generic uas usb_storage sg hid_generic sd_mod t10_pi usbhid hid sr_mod crc64_rocksoft crc64 cdrom ata_generic ohci_pci ahci pata_atiixp libahci r8169 libata firewire_ohci xhci_pci firewire_core crc_itu_t realtek ohci_hcd ehci_pci mdio_devres xhci_hcd ehci_hcd i2c_piix4 scsi_mod libphy scsi_common usbcore usb_common [ 458.936314] CR2: 0000000000000010 [ 458.936315] ---[ end trace 0000000000000000 ]--- [ 458.936317] RIP: 0010:drm_atomic_helper_dirtyfb+0x13c/0x240 [drm_kms_helper] [ 458.936330] Code: 05 c0 02 00 00 4c 8d 7a f8 48 39 c2 74 58 49 8b 74 24 48 4d 8d 77 20 4c 89 f7 e8 0f b5 f5 ff 85 c0 75 4b 49 8b 87 58 02 00 00 <48> 39 68 10 75 bf 4c 89 fe 4c 89 e7 e8 23 bf f5 ff 48 3d 00 f0 ff [ 458.936332] RSP: 0018:ffffb75080db3da8 EFLAGS: 00010246 [ 458.936333] RAX: 0000000000000000 RBX: ffff9dbae32e2880 RCX: 000000000000003b [ 458.936335] RDX: ffffb75080db3dd8 RSI: ffffb75080db3dd8 RDI: ffff9dbad6329c48 [ 458.936336] RBP: ffff9dbae9b41100 R08: ffffb75080db3dd8 R09: ffff9dbae33e01f8 [ 458.936337] R10: ffff9dbadf388028 R11: 0000000000000001 R12: ffff9dbad150e880 [ 458.936338] R13: ffff9dbaee0d9980 R14: ffff9dbad6329c20 R15: ffff9dbad6329c00 [ 458.936339] FS: 0000000000000000(0000) GS:ffff9dbbe7cc0000(0000) knlGS:0000000000000000 [ 458.936341] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 458.936342] CR2: 0000000000000010 CR3: 000000012337c000 CR4: 00000000000006e0 [ 458.957983] amdgpu 0000:01:00.0: [drm] fb0: amdgpudrmfb frame buffer device
Regards,
Arthur Marsh.
Quoted 54 lines · root
Hi, I recently experienced lock-ups that only responded to magic sysreq reboots when the amdgpu module was loading on my pc (Athlon II X4 640 CPU, with Radeon R7 250 - Cape Verde).
.config has:
CONFIG_DRM_AMDGPU=mCONFIG_DRM_AMDGPU_SI=y
#CONFIG_DRM_AMDGPU_CIKis not set
#CONFIG_DRM_AMDGPU_USERPTRis not setkernel command line has:
amdgpu.audio=1 amdgpu.si_support=1 radeon.si_support=0 page_owner=on \
amdgpu.gpu_recovery=1Bisecting lead to:
commit
66f99628eb24409cb8feb5061f78283c8b65f820Author: Hamza Mahfooz <[email protected]> Date: Tue Sep 6 15:01:49 2022 -0400drm/amdgpu: use dirty framebuffer helper
Currently, we aren't handling
DRM_IOCTL_MODE_DIRTYFB. So, usedrm_atomic_helper_dirtyfb()as the dirty callback in theamdgpu_fb_funcsstruct.Signed-off-by Hamza Mahfooz <[email protected]>Acked-by Alex Deucher <[email protected]>Signed-off-by Alex Deucher <[email protected]>drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2
-0@@ -38,6 +38,7 @@#include <linux/pci.h> #include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_damage_helper.h> #include <drm/drm_edid.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h> @@ -496,6 +497,7 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, + .dirty = drm_atomic_helper_dirtyfb, }; uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
Quoted 5 lines
After doing a git bisect reset, git pull and reverting the patch above, I rebuilt the kernel and am successfully running with the amdgpu module loaded and using the Radeon R7 250 GPU.
I am happy to supply any further configuration details.
Does the attached patch help?
Alex
Quoted 2 lines
Arthur Marsh.
From 5e49c68c1ac1fbb98b1c84407485abfb7d309783 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Mon, 19 Sep 2022 12:26:20 -0400
Subject: [PATCH] drm/amdgpu: don't register a dirty callback for non-atomic
Some asics still support non-atomic code paths.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +10 -1
@@ -39,6 +39,7 @@#include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_damage_helper.h> +#include <drm/drm_drv.h> #include <drm/drm_edid.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h>
@@ -497,6 +498,11 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, +}; + +static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = { + .destroy = drm_gem_fb_destroy, + .create_handle = drm_gem_fb_create_handle, .dirty = drm_atomic_helper_dirtyfb, };
@@ -1102,7 +1108,10 @@ static int amdgpu_display_gem_fb_verify_and_init(struct drm_device *dev,if (ret) goto err; - ret =drm_framebuffer_init (dev, &rfb->base, &amdgpu_fb_funcs); +if (drm_drv_uses_atomic_modeset (dev)) + ret =drm_framebuffer_init (dev, &rfb->base, &amdgpu_fb_funcs_atomic); +else + ret =drm_framebuffer_init (dev, &rfb->base, &amdgpu_fb_funcs);if (ret) goto err;
Signature · 1 line
2.37.3
Thanks, the patch applied against 6.0-rc6 kernel worked and the amdgpu module loaded and works on my Radeon R7 250 (Cape Verde) GPU.
Arthur Marsh.
Quoted 68 lines · Alex Deucher
Quoted 54 lines · root
Hi, I recently experienced lock-ups that only responded to magic sysreq reboots when the amdgpu module was loading on my pc (Athlon II X4 640 CPU, with Radeon R7 250 - Cape Verde).
.config has:
CONFIG_DRM_AMDGPU=mCONFIG_DRM_AMDGPU_SI=y
#CONFIG_DRM_AMDGPU_CIKis not set
#CONFIG_DRM_AMDGPU_USERPTRis not setkernel command line has:
amdgpu.audio=1 amdgpu.si_support=1 radeon.si_support=0 page_owner=on \
amdgpu.gpu_recovery=1Bisecting lead to:
commit
66f99628eb24409cb8feb5061f78283c8b65f820Author: Hamza Mahfooz <[email protected]> Date: Tue Sep 6 15:01:49 2022 -0400drm/amdgpu: use dirty framebuffer helper
Currently, we aren't handling
DRM_IOCTL_MODE_DIRTYFB. So, usedrm_atomic_helper_dirtyfb()as the dirty callback in theamdgpu_fb_funcsstruct.Signed-off-by Hamza Mahfooz <[email protected]>Acked-by Alex Deucher <[email protected]>Signed-off-by Alex Deucher <[email protected]>drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2
-0@@ -38,6 +38,7 @@#include <linux/pci.h> #include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_damage_helper.h> #include <drm/drm_edid.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h> @@ -496,6 +497,7 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, + .dirty = drm_atomic_helper_dirtyfb, }; uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,Quoted 5 lines
After doing a git bisect reset, git pull and reverting the patch above, I rebuilt the kernel and am successfully running with the amdgpu module loaded and using the Radeon R7 250 GPU.
I am happy to supply any further configuration details.
Does the attached patch help?
Alex
Quoted 2 lines
Arthur Marsh.
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Hi
Am 06.09.22 um 21:57 schrieb Hamza Mahfooz:
Quoted 3 lines
Currently, we aren't handling
DRM_IOCTL_MODE_DIRTYFB. So, usedrm_atomic_helper_dirtyfb()as the dirty callback in theamdgpu_fb_funcsstruct.
drm_atomic_helper_dirtyfb() creates a new atomic commit for the frambuffer's planes. Drivers can then updates these planes' output (e.g., writeback to video memory). I thought that amdgpu simply scans out from the framebuffer's memory regions in VRAM. So I'm curious why this patch is necessary.
Best regards
Thomas
Quoted 26 lines
Signed-off-by Hamza Mahfooz <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2
-0@@ -38,6 +38,7 @@#include <linux/pci.h> #include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_damage_helper.h> #include <drm/drm_edid.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h> @@ -496,6 +497,7 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, + .dirty = drm_atomic_helper_dirtyfb, }; uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Quoted 8 lines · Thomas Zimmermann
Hi
Am 06.09.22 um 21:57 schrieb Hamza Mahfooz:
Quoted 3 lines
Currently, we aren't handling
DRM_IOCTL_MODE_DIRTYFB. So, usedrm_atomic_helper_dirtyfb()as the dirty callback in theamdgpu_fb_funcsstruct.
Quoted 5 lines
drm_atomic_helper_dirtyfb()creates a new atomic commit for the frambuffer's planes. Drivers can then updates these planes' output (e.g., writeback to video memory). I thought that amdgpu simply scans out from the framebuffer's memory regions in VRAM. So I'm curious why this patch is necessary.
I think in this particular case, the problem is that there are still some asic which default to non-atomic code which is what is causing the problem here. Something like this would fix that:
(quoted diff) +0 -0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 5b09c8f4fe95..f5e9dd454c54 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0 -0
@@ -497,6 +497,11 @@ bool amdgpu_display_ddc_probe(struct
amdgpu_connector *amdgpu_connector,
static const struct drm_framebuffer_funcs amdgpu_fb_funcs = {
.destroy = drm_gem_fb_destroy,
.create_handle = drm_gem_fb_create_handle,
+};
+
+static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = {
+ .destroy = drm_gem_fb_destroy,
+ .create_handle = drm_gem_fb_create_handle,
.dirty = drm_atomic_helper_dirtyfb,
};
@@ -1102,7 +1107,10 @@ static int amdgpu_display_gem_fb_verify_and_init(struct drm_device *dev,
if (ret)
goto err;- ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
+ if (drm_drv_uses_atomic_modeset(adev_to_drm(adev)))
+ ret = drm_framebuffer_init(dev, &rfb->base,&amdgpu_fb_funcs_atomic);
+ else
+ ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
if (ret)
goto err;As for why we need the dirty callback, I think it's used for PSR.
Alex
Quoted 38 lines
Best regards
ThomasQuoted 19 lines
Signed-off-by Hamza Mahfooz <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +1
-0@@ -38,6 +38,7 @@#include <linux/pci.h> #include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_damage_helper.h> #include <drm/drm_edid.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector, · line 503
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +1
-0@@ -496,6 +497,7 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, + .dirty = drm_atomic_helper_dirtyfb, }; uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev