Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
83ca5fb
Documentation
LICENSES
arch
block
certs
crypto
drivers
accessibility
acpi
amba
android
ata
atm
auxdisplay
base
bcma
block
bluetooth
bus
cdrom
char
clk
clocksource
comedi
connector
counter
cpufreq
cpuidle
crypto
cxl
dax
dca
devfreq
dio
dma-buf
dma
edac
eisa
extcon
firewire
firmware
fpga
fsi
gnss
gpio
gpu
drm
amd
acp
amdgpu
amdkfd
display
amdgpu_dm
Makefile
amdgpu_dm.c
amdgpu_dm.h
amdgpu_dm_color.c
amdgpu_dm_crc.c
amdgpu_dm_crc.h
amdgpu_dm_crtc.c
amdgpu_dm_crtc.h
amdgpu_dm_debugfs.c
amdgpu_dm_debugfs.h
amdgpu_dm_hdcp.c
amdgpu_dm_hdcp.h
amdgpu_dm_helpers.c
amdgpu_dm_irq.c
amdgpu_dm_irq.h
amdgpu_dm_irq_params.h
amdgpu_dm_mst_types.c
amdgpu_dm_mst_types.h
amdgpu_dm_plane.c
amdgpu_dm_plane.h
amdgpu_dm_pp_smu.c
amdgpu_dm_psr.c
amdgpu_dm_psr.h
amdgpu_dm_services.c
amdgpu_dm_trace.h
dc_fpu.c
dc_fpu.h
dc
dmub
include
modules
Kconfig
Makefile
TODO
include
pm
arm
armada
aspeed
ast
atmel-hlcdc
bridge
display
etnaviv
exynos
fsl-dcu
gma500
gud
hisilicon
hyperv
i2c
i810
i915
imx
ingenic
kmb
lib
lima
logicvc
mcde
mediatek
meson
mga
mgag200
msm
mxsfb
nouveau
omapdrm
panel
panfrost
pl111
qxl
r128
radeon
rcar-du
rockchip
savage
scheduler
selftests
shmobile
sis
solomon
sprd
sti
stm
sun4i
tdfx
tegra
tests
tidss
tilcdc
tiny
ttm
tve200
udl
v3d
vboxvideo
vc4
vgem
via
virtio
vkms
vmwgfx
xen
xlnx
Kconfig
Makefile
drm_agpsupport.c
drm_aperture.c
drm_atomic.c
drm_atomic_helper.c
drm_atomic_state_helper.c
drm_atomic_uapi.c
drm_auth.c
drm_blend.c
drm_bridge.c
drm_bridge_connector.c
drm_buddy.c
drm_bufs.c
drm_cache.c
drm_client.c
drm_client_modeset.c
drm_color_mgmt.c
drm_connector.c
drm_context.c
drm_crtc.c
drm_crtc_helper.c
drm_crtc_helper_internal.h
drm_crtc_internal.h
drm_damage_helper.c
drm_debugfs.c
drm_debugfs_crc.c
drm_displayid.c
drm_dma.c
drm_drv.c
drm_dumb_buffers.c
drm_edid.c
drm_edid_load.c
drm_encoder.c
drm_encoder_slave.c
drm_fb_cma_helper.c
drm_fb_helper.c
drm_file.c
drm_flip_work.c
drm_format_helper.c
drm_fourcc.c
drm_framebuffer.c
drm_gem.c
drm_gem_atomic_helper.c
drm_gem_cma_helper.c
drm_gem_framebuffer_helper.c
drm_gem_shmem_helper.c
drm_gem_ttm_helper.c
drm_gem_vram_helper.c
drm_hashtab.c
drm_internal.h
drm_ioc32.c
drm_ioctl.c
drm_irq.c
drm_kms_helper_common.c
drm_lease.c
drm_legacy.h
drm_legacy_misc.c
drm_lock.c
drm_managed.c
drm_memory.c
drm_mipi_dbi.c
drm_mipi_dsi.c
drm_mm.c
drm_mode_config.c
drm_mode_object.c
drm_modes.c
drm_modeset_helper.c
drm_modeset_lock.c
drm_nomodeset.c
drm_of.c
drm_panel.c
drm_panel_orientation_quirks.c
drm_pci.c
drm_plane.c
drm_plane_helper.c
drm_prime.c
drm_print.c
drm_privacy_screen.c
drm_privacy_screen_x86.c
drm_probe_helper.c
drm_property.c
drm_rect.c
drm_scatter.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c
drm_syncobj.c
drm_sysfs.c
drm_trace.h
drm_trace_points.c
drm_vblank.c
drm_vblank_work.c
drm_vm.c
drm_vma_manager.c
drm_writeback.c
host1x
ipu-v3
trace
vga
Makefile
greybus
hid
hsi
hte
hv
hwmon
hwspinlock
hwtracing
i2c
i3c
idle
iio
infiniband
input
interconnect
iommu
ipack
irqchip
isdn
leds
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc
mmc
most
mtd
mux
net
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
opp
parisc
parport
pci
pcmcia
peci
perf
phy
pinctrl
platform
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi
sh
siox
slimbus
soc
soundwire
spi
spmi
ssb
staging
target
tc
tee
thermal
thunderbolt
tty
ufs
uio
usb
vdpa
vfio
vhost
video
virt
virtio
vlynq
w1
watchdog
xen
zorro
Kconfig
Makefile
fs
include
init
io_uring
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
drivers
/
gpu
/
drm
/
amd
/
display
/
amdgpu_dm
/
amdgpu_dm_psr.c
Copy path
Blame
Blame
Latest commit
History
History
211 lines (175 loc) · 5.86 KB
Breadcrumbs
linux
/
drivers
/
gpu
/
drm
/
amd
/
display
/
amdgpu_dm
/
amdgpu_dm_psr.c
Top
File metadata and controls
Code
Blame
211 lines (175 loc) · 5.86 KB
Raw
/* * Copyright 2021 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: AMD * */ #include "amdgpu_dm_psr.h" #include "dc.h" #include "dm_helpers.h" #include "amdgpu_dm.h" #include "modules/power/power_helpers.h" static bool link_supports_psrsu(struct dc_link *link) { struct dc *dc = link->ctx->dc; if (!dc->caps.dmcub_support) return false; if (dc->ctx->dce_version < DCN_VERSION_3_1) return false; if (!is_psr_su_specific_panel(link)) return false; if (!link->dpcd_caps.alpm_caps.bits.AUX_WAKE_ALPM_CAP || !link->dpcd_caps.psr_info.psr_dpcd_caps.bits.Y_COORDINATE_REQUIRED) return false; if (link->dpcd_caps.psr_info.psr_dpcd_caps.bits.SU_GRANULARITY_REQUIRED && !link->dpcd_caps.psr_info.psr2_su_y_granularity_cap) return false; return true; } /* * amdgpu_dm_set_psr_caps() - set link psr capabilities * @link: link * */ void amdgpu_dm_set_psr_caps(struct dc_link *link) { if (!(link->connector_signal & SIGNAL_TYPE_EDP)) return; if (link->type == dc_connection_none) return; if (link->dpcd_caps.psr_info.psr_version == 0) { link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED; link->psr_settings.psr_feature_enabled = false; } else { if (link_supports_psrsu(link)) link->psr_settings.psr_version = DC_PSR_VERSION_SU_1; else link->psr_settings.psr_version = DC_PSR_VERSION_1; link->psr_settings.psr_feature_enabled = true; } DRM_INFO("PSR support %d, DC PSR ver %d, sink PSR ver %d DPCD caps 0x%x su_y_granularity %d\n", link->psr_settings.psr_feature_enabled, link->psr_settings.psr_version, link->dpcd_caps.psr_info.psr_version, link->dpcd_caps.psr_info.psr_dpcd_caps.raw, link->dpcd_caps.psr_info.psr2_su_y_granularity_cap); } /* * amdgpu_dm_link_setup_psr() - configure psr link * @stream: stream state * * Return: true if success */ bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream) { struct dc_link *link = NULL; struct psr_config psr_config = {0}; struct psr_context psr_context = {0}; struct dc *dc = NULL; bool ret = false; if (stream == NULL) return false; link = stream->link; dc = link->ctx->dc; if (link->psr_settings.psr_version != DC_PSR_VERSION_UNSUPPORTED) { mod_power_calc_psr_configs(&psr_config, link, stream); /* linux DM specific updating for psr config fields */ psr_config.allow_smu_optimizations = (amdgpu_dc_feature_mask & DC_PSR_ALLOW_SMU_OPT) && mod_power_only_edp(dc->current_state, stream); psr_config.allow_multi_disp_optimizations = (amdgpu_dc_feature_mask & DC_PSR_ALLOW_MULTI_DISP_OPT); ret = dc_link_setup_psr(link, stream, &psr_config, &psr_context); } DRM_DEBUG_DRIVER("PSR link: %d\n", link->psr_settings.psr_feature_enabled); return ret; } /* * amdgpu_dm_psr_enable() - enable psr f/w * @stream: stream state * * Return: true if success */ bool amdgpu_dm_psr_enable(struct dc_stream_state *stream) { struct dc_link *link = stream->link; unsigned int vsync_rate_hz = 0; struct dc_static_screen_params params = {0}; /* Calculate number of static frames before generating interrupt to * enter PSR. */ // Init fail safe of 2 frames static unsigned int num_frames_static = 2; unsigned int power_opt = 0; bool psr_enable = true; DRM_DEBUG_DRIVER("Enabling psr...\n"); vsync_rate_hz = div64_u64(div64_u64(( stream->timing.pix_clk_100hz * 100), stream->timing.v_total), stream->timing.h_total); /* Round up * Calculate number of frames such that at least 30 ms of time has * passed. */ if (vsync_rate_hz != 0) { unsigned int frame_time_microsec = 1000000 / vsync_rate_hz; num_frames_static = (30000 / frame_time_microsec) + 1; } params.triggers.cursor_update = true; params.triggers.overlay_update = true; params.triggers.surface_update = true; params.num_frames = num_frames_static; dc_stream_set_static_screen_params(link->ctx->dc, &stream, 1, ¶ms); /* * Only enable static-screen optimizations for PSR1. For PSR SU, this * causes vstartup interrupt issues, used by amdgpu_dm to send vblank * events. */ if (link->psr_settings.psr_version < DC_PSR_VERSION_SU_1) power_opt |= psr_power_opt_z10_static_screen; return dc_link_set_psr_allow_active(link, &psr_enable, false, false, &power_opt); } /* * amdgpu_dm_psr_disable() - disable psr f/w * @stream: stream state * * Return: true if success */ bool amdgpu_dm_psr_disable(struct dc_stream_state *stream) { unsigned int power_opt = 0; bool psr_enable = false; DRM_DEBUG_DRIVER("Disabling psr...\n"); return dc_link_set_psr_allow_active(stream->link, &psr_enable, true, false, &power_opt); } /* * amdgpu_dm_psr_disable() - disable psr f/w * if psr is enabled on any stream * * Return: true if success */ bool amdgpu_dm_psr_disable_all(struct amdgpu_display_manager *dm) { DRM_DEBUG_DRIVER("Disabling psr if psr is enabled on any stream\n"); return dc_set_psr_allow_active(dm->dc, false); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
You can’t perform that action at this time.