]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/log
mirror_ubuntu-jammy-kernel.git
7 years agoRevert "amdgpu/dc: inline a bunch of float operations."
Harry Wentland [Tue, 17 Oct 2017 02:15:57 +0000 (22:15 -0400)]
Revert "amdgpu/dc: inline a bunch of float operations."

This reverts commit d1209512e028a917e6e70b13297ff185234ba24d.

Unfortunately these clash with our DML update from the HW guys.

Rerolling this after the fact won't save us anything anymore,
unfortunately so we're back to non-inline for this.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoRevert "amdgpu/dc: drop display_pipe_clocks.c."
Harry Wentland [Tue, 17 Oct 2017 02:11:18 +0000 (22:11 -0400)]
Revert "amdgpu/dc: drop display_pipe_clocks.c."

This reverts commit b3fbdcec5e6c16c93867289ae0960a64c423eb34.

Unfortunately these clash with our DML update from the HW guys
as it's starting to get used now.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoRevert "amdgpu/dc: inline a bunch of the dml wrappers."
Harry Wentland [Tue, 17 Oct 2017 02:11:04 +0000 (22:11 -0400)]
Revert "amdgpu/dc: inline a bunch of the dml wrappers."

This reverts commit 3e8c3108dab197858e74dbb740c5312ae636ea9b.

Unfortunately these clash with our DML update from the HW guys.
Will attempt to reroll them after.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoRevert "amdgpu/dc: drop dml_util_is_420"
Harry Wentland [Tue, 17 Oct 2017 02:10:54 +0000 (22:10 -0400)]
Revert "amdgpu/dc: drop dml_util_is_420"

This reverts commit e5bcf3d83e40cc7acc9d111519b7bacaf4a01070.

Unfortunately these clash with our DML update from the HW guys.
Will attempt to reroll them after.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoRevert "amdgpu/dc: drop dml display_mode_support.c (v2)"
Harry Wentland [Tue, 17 Oct 2017 02:10:31 +0000 (22:10 -0400)]
Revert "amdgpu/dc: drop dml display_mode_support.c (v2)"

This reverts commit 5e0adbff084f33202db36be798c583a115990392.

Unfortunately these clash with our DML update from the HW guys.
Will attempt to reroll them after.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoRevert "amdgpu/dc: inline dml_round_to_multiple"
Harry Wentland [Tue, 17 Oct 2017 02:10:19 +0000 (22:10 -0400)]
Revert "amdgpu/dc: inline dml_round_to_multiple"

This reverts commit d8c893b44b2199f5935fe8667708253c38353782.

Unfortunately these clash with our DML update from the HW guys.
Will attempt to reroll them after.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Expose some mem_input functions for reuse
Yue Hin Lau [Wed, 27 Sep 2017 19:34:35 +0000 (15:34 -0400)]
drm/amd/display: Expose some mem_input functions for reuse

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: soc_bound_box -update DML based on HW.
Charlene Liu [Wed, 27 Sep 2017 20:08:47 +0000 (16:08 -0400)]
drm/amd/display: soc_bound_box -update DML based on HW.

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Add override for reporting wm ranges
Eric Yang [Wed, 27 Sep 2017 15:44:43 +0000 (11:44 -0400)]
drm/amd/display: Add override for reporting wm ranges

For verification of watermark select with SMU team, proper
implementation will follow

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: disconnect on HPD low even if edid is the same
Wenjing Liu [Mon, 25 Sep 2017 18:53:14 +0000 (14:53 -0400)]
drm/amd/display: disconnect on HPD low even if edid is the same

[Description]
There are many occasions we need to retrieve sink capability and
notify connectivity change to os even if edid is not changed
on a HPD toggle.
(HDMI2.0 display needs re-enable link on every hpd,
display changes other capability outside from edid
 need to be queried again and possibly reset the mode, etc.)

In these cases we cannot keep the same sink without letting DM know.

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: align DCLK to voltage level
Tony Cheng [Wed, 27 Sep 2017 13:20:51 +0000 (09:20 -0400)]
drm/amd/display: align DCLK to voltage level

in past program SMU will use all voltage headroom.  RV does not

if DAL need higher voltage for DCFCLK or DISPCLK, also increase FCLK
to improve stutter as voltage is already

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Move power control from link encoder to hwsequencer
Andrew Jiang [Mon, 25 Sep 2017 22:03:14 +0000 (18:03 -0400)]
drm/amd/display: Move power control from link encoder to hwsequencer

A recent commit moved the backlight control code along with the register
defines, but did not move the power control code. This along with
remnant fields in the dce110_link_enc_registers struct made it so that
the code still compiled, but any attempts to access the
LVTMA_PWRSEQ_STATE register led to reading from an address of 0. This
patch corrects that.

Also, rename blacklight_control to edp_backlight_control (Typo fix).

Signed-off-by: Andrew Jiang <Andrew.Jiang@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: moving cursor functions from ipp to mem_input
Yue Hin Lau [Tue, 19 Sep 2017 21:29:28 +0000 (17:29 -0400)]
drm/amd/display: moving cursor functions from ipp to mem_input

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Fix ref_count messed up issue
Jerry Zuo [Mon, 25 Sep 2017 20:39:45 +0000 (16:39 -0400)]
drm/amd/display: Fix ref_count messed up issue

In the full update type, need to add ref_count to the newly
created dc_state->stream. It made mistake to add ref_count to
dc->current_state->stream which keeps adding up without release.

Signed-off-by: Jerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: dal 3.1.03
Tony Cheng [Tue, 26 Sep 2017 21:06:26 +0000 (17:06 -0400)]
drm/amd/display: dal 3.1.03

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: fix bug in force_single_disp_pipe_split
Tony Cheng [Tue, 26 Sep 2017 14:16:34 +0000 (10:16 -0400)]
drm/amd/display: fix bug in force_single_disp_pipe_split

should only lower dpp clock.

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: option to maximize lb usage
Tony Cheng [Tue, 26 Sep 2017 05:56:00 +0000 (01:56 -0400)]
drm/amd/display: option to maximize lb usage

experimental change for testing if max line buffer result in better stutter efficiency

for 1080p, LB can hold up to 9 line at 10bpcc, potentially add 10 line time of
latency hiding.

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: add option to disable DCC for DCC 128b request
Tony Cheng [Mon, 25 Sep 2017 22:06:11 +0000 (18:06 -0400)]
drm/amd/display: add option to disable DCC for DCC 128b request

1. reverts commit e67f51012740 ("dc: temp disable DCC on high res.")
- default still DCC enabled

2. add debug options to decide how DCC is disabled
- disable DCC
- disable DCC if DCC requires 128b (aka. half) request
-- observed compressed data corruption result in screen corruption in
full (256b) request while half (128b) would cause DCN to hang, result in
DF hang

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: enable optional pipe split for single display
Tony Cheng [Mon, 25 Sep 2017 14:52:07 +0000 (10:52 -0400)]
drm/amd/display: enable optional pipe split for single display

also refactor debug option.  now pipe_split_policy are
dynamic = no hack around dcn_calcs.  will split based on HW recommendation
avoid = avoid split if we can support the config with higher voltage
avoid_multi_display = allow split with single display output.

force_single_disp_pipe_split
force single display to pipe split to improve stutter efficiency
by using DET buffers using 2 HUBP.

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: temp disable DCC on high res.
Charlene Liu [Mon, 25 Sep 2017 19:52:49 +0000 (15:52 -0400)]
drm/amd/display: temp disable DCC on high res.

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Fix MST daisy chain SST not light up
Jerry Zuo [Wed, 20 Sep 2017 19:04:52 +0000 (15:04 -0400)]
drm/amd/display: Fix MST daisy chain SST not light up

In SST daisy chain scenario, edid is getting read in mst hotplug
routine. It is getting conflict with drm send_enum_path_resources
kernel thread in terms of i2c bus which is getting locked up in
such case.

Have edid being read in get_mode hook, instead of in hotplug
routine.

Signed-off-by: Jerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Only reset top pipe back end.
Yongqiang Sun [Fri, 22 Sep 2017 20:06:04 +0000 (16:06 -0400)]
drm/amd/display: Only reset top pipe back end.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Early return when turn off a plane.
Yongqiang Sun [Fri, 22 Sep 2017 17:41:13 +0000 (13:41 -0400)]
drm/amd/display: Early return when turn off a plane.

In case of two monitor connected and turn off one of the monitors,
OTG0 is locked after graphic plane off due to redundant programming
front end regs.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Program stream's csc matrix instead of using default
SivapiriyanKumarasamy [Fri, 22 Sep 2017 16:48:54 +0000 (12:48 -0400)]
drm/amd/display: Program stream's csc matrix instead of using default

Signed-off-by: SivapiriyanKumarasamy <sivapiriyan.kumarasamy@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: update link type to mst before topology discovery
Wenjing Liu [Thu, 21 Sep 2017 22:53:40 +0000 (18:53 -0400)]
drm/amd/display: update link type to mst before topology discovery

[Description]
link type is not updated before mst topology discovery.
This causes issue when branch device response to link address after before
the start topology discovery event finishes.

[Solution]
update link type to mst before topology discovery

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Use active + border for bw validation
Eric Yang [Thu, 21 Sep 2017 22:16:01 +0000 (18:16 -0400)]
drm/amd/display: Use active + border for bw validation

When doing SLS, KMD gives us clipped v_addressable with
border. This results in bw validation failure.

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Fixed incorrect return value for validaton
Yongqiang Sun [Thu, 21 Sep 2017 14:46:33 +0000 (10:46 -0400)]
drm/amd/display: Fixed incorrect return value for validaton

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: screen flickers when connected to ext monitor in clone
Hersen Wu [Wed, 20 Sep 2017 20:30:44 +0000 (16:30 -0400)]
drm/amd/display: screen flickers when connected to ext monitor in clone

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Hersen Wu <hersenxs.wu@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: version 3.1.02
Tony Cheng [Wed, 6 Sep 2017 01:13:55 +0000 (21:13 -0400)]
drm/amd/display: version 3.1.02

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Fixed validation return wrong result.
Yongqiang Sun [Wed, 20 Sep 2017 21:06:18 +0000 (17:06 -0400)]
drm/amd/display: Fixed validation return wrong result.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: add hubp/dpp pg debug key
Charlene Liu [Wed, 20 Sep 2017 20:15:18 +0000 (16:15 -0400)]
drm/amd/display: add hubp/dpp pg debug key

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: make sure BL off to mainlink off has enough time
Charlene Liu [Wed, 20 Sep 2017 18:06:24 +0000 (14:06 -0400)]
drm/amd/display: make sure BL off to mainlink off has enough time

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: fix ASSERT() caused by missing registers.
Ken Chalmers [Wed, 20 Sep 2017 15:48:47 +0000 (11:48 -0400)]
drm/amd/display: fix ASSERT() caused by missing registers.

Signed-off-by: Ken Chalmers <ken.chalmers@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: edp backlight regression fix
Yue Hin Lau [Tue, 19 Sep 2017 15:35:23 +0000 (11:35 -0400)]
drm/amd/display: edp backlight regression fix

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: moving backlight registers to hwsequencer
Yue Hin Lau [Fri, 15 Sep 2017 21:42:20 +0000 (17:42 -0400)]
drm/amd/display: moving backlight registers to hwsequencer

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: update blending mode and set output denorm
Eric Bernstein [Thu, 14 Sep 2017 22:01:40 +0000 (18:01 -0400)]
drm/amd/display: update blending mode and set output denorm

Signed-off-by: Eric Bernstein <eric.bernstein@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: add back removed hack for mpcc add
Eric Yang [Thu, 14 Sep 2017 23:03:04 +0000 (19:03 -0400)]
drm/amd/display: add back removed hack for mpcc add

A previous changed removed the hack to match mpcc_idd
with mi instance. This causes pstate hang on resume
from hibernate for yet unknown reason. Add the hack
back for now to work around the issue. More debugging
required in init_hw to root cause the hang.

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: set cp25201 to use TPS4
Wenjing Liu [Thu, 14 Sep 2017 22:50:32 +0000 (18:50 -0400)]
drm/amd/display: set cp25201 to use TPS4

[Description]
hbr2 compliance eye output is unstable
(toggling on and off) with debugger break.
This caueses intermittent PHY automation failure.
Need to look into the root cause later

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: removing remaining register definitions work around
Yue Hin Lau [Thu, 14 Sep 2017 15:27:34 +0000 (11:27 -0400)]
drm/amd/display: removing remaining register definitions work around

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: power_down_Hw need signal type to turnoff backlight
Andrew Jiang [Wed, 13 Sep 2017 15:36:34 +0000 (11:36 -0400)]
drm/amd/display: power_down_Hw need signal type to turnoff backlight

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: make tile changing run at ISR
ShihChen Chen [Tue, 12 Sep 2017 03:10:12 +0000 (11:10 +0800)]
drm/amd/display: make tile changing run at ISR

Signed-off-by: ShihChen Chen <ShihChen.Chen@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Refactor dc_update_planes_and_stream.
Bhawanpreet Lakha [Tue, 12 Sep 2017 17:56:57 +0000 (13:56 -0400)]
drm/amd/display: Refactor dc_update_planes_and_stream.

Split update_planes_and_stream_state (split Software and Hardware
programming) as the state is already build, so we only need to
program the hardware

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Fix NULL pointer on MST chained mode
Jerry Zuo [Fri, 8 Sep 2017 20:40:34 +0000 (16:40 -0400)]
drm/amd/display: Fix NULL pointer on MST chained mode

Prevent NULL pointer on new_stream being added to ctx
when added MST connectors cannot be found in existing crtc_state
in the chained mode

Signed-off-by: Jerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Exclude MST from fake sink
Jerry Zuo [Fri, 8 Sep 2017 15:52:45 +0000 (11:52 -0400)]
drm/amd/display: Exclude MST from fake sink

Needs effort to take care of the fake sink scenario
in downstream daisy chain device. Exclude MST from
fake sink feature for now.

Signed-off-by: Jerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: fixing register includes
Yue Hin Lau [Tue, 12 Sep 2017 16:08:14 +0000 (12:08 -0400)]
drm/amd/display: fixing register includes

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Match actual state during S3 resume.
Leo (Sunpeng) Li [Thu, 7 Sep 2017 21:05:38 +0000 (17:05 -0400)]
drm/amd/display: Match actual state during S3 resume.

During system suspend, we:

1. Cache a duplicate of the current DRM atomic state, which calls hooks
   to duplicate our internal states.
2. Call hooks to disable all functionalities.
3. System suspended.

During resume, we attempt to restore the cached state. However, our
interal states are now stale, since step 1 was done before step 2.
i.e. our cached state does not reflect the disabled nature of things.

This change resolves that by destroying all relevant states to reflect
the actual state during resume.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: update mpc add/remove functions
Eric Bernstein [Mon, 11 Sep 2017 20:56:51 +0000 (16:56 -0400)]
drm/amd/display: update mpc add/remove functions

Signed-off-by: Eric Bernstein <eric.bernstein@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: fix multi-display on CZ
Roman Li [Mon, 11 Sep 2017 20:28:21 +0000 (16:28 -0400)]
drm/amd/display: fix multi-display on CZ

- fixed wrong index in dce110_validate_surface_sets()
- formatted for better readability

Signed-off-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
igned-off-by: Alex Deucher <alexander.deucher@amd.com>

7 years agodrm/amd/display: Refactor dcn10_dpp_cm_helper to dcn10_cm_common
Yue Hin Lau [Mon, 11 Sep 2017 18:30:02 +0000 (14:30 -0400)]
drm/amd/display: Refactor dcn10_dpp_cm_helper to dcn10_cm_common

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Don't report fake sink as connected
Harry Wentland [Thu, 17 Aug 2017 18:58:07 +0000 (14:58 -0400)]
drm/amd/display: Don't report fake sink as connected

This was missed in the previous fake sink change. The fake sink
allows us to enable a pipe with a disconnected display. We
shouldn't report it as connected.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: To prevent detecting new sink from spurious HPD
Martin Tsai [Fri, 8 Sep 2017 11:25:35 +0000 (19:25 +0800)]
drm/amd/display: To prevent detecting new sink from spurious HPD

Signed-off-by: Martin Tsai <martin.tsai@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Add FBC on/off to front-end programming
Roman Li [Thu, 7 Sep 2017 21:02:47 +0000 (17:02 -0400)]
drm/amd/display: Add FBC on/off to front-end programming

- Fixing text mode for cases when VT-switch doesn't result
in timing change

Signed-off-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: fix usb-c dongle regression
Eric Yang [Thu, 7 Sep 2017 18:53:23 +0000 (14:53 -0400)]
drm/amd/display: fix usb-c dongle regression

A previous change moved link_disconnect_sink after dpcd read,
this causes the sink count to be overwritten which in turn causes
another detection to be triggered in the short pulse handler, which
brings down the display.

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Force always scale chroma, set always_scaled to false
Andrew Jiang [Wed, 6 Sep 2017 22:56:46 +0000 (18:56 -0400)]
drm/amd/display: Force always scale chroma, set always_scaled to false

This allows us to not always have scaling on, which causes issues with
validation and causes the text to blur slightly.

Signed-off-by: Andrew Jiang <Andrew.Jiang@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Driver message to SMU to indicate display off
Hersen Wu [Tue, 5 Sep 2017 16:20:39 +0000 (12:20 -0400)]
drm/amd/display: Driver message to SMU to indicate display off

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: To prevent detecting new sink from spurious HPD
Martin Tsai [Thu, 7 Sep 2017 05:02:05 +0000 (13:02 +0800)]
drm/amd/display: To prevent detecting new sink from spurious HPD

Signed-off-by: Martin Tsai <martin.tsai@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoMerge remote-tracking branch 'pfdo/drm-next' into drm-next
Dave Airlie [Tue, 17 Oct 2017 00:45:05 +0000 (10:45 +1000)]
Merge remote-tracking branch 'pfdo/drm-next' into drm-next

Pull in drm-next for the object find API changes.

Fix the one place the API crashes.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrm/amd/display: drop unused dm_delay_in_microseconds
Alex Deucher [Wed, 11 Oct 2017 16:44:13 +0000 (12:44 -0400)]
drm/amd/display: drop unused dm_delay_in_microseconds

No longer used.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display/dc: drop dm_delay_in_microseconds
Alex Deucher [Wed, 11 Oct 2017 16:42:30 +0000 (12:42 -0400)]
drm/amd/display/dc: drop dm_delay_in_microseconds

Use udelay directly.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: make amdgpu_dm_irq_handler static
Alex Deucher [Wed, 11 Oct 2017 14:03:10 +0000 (10:03 -0400)]
drm/amd/display: make amdgpu_dm_irq_handler static

It's not used outside the file.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: remove unused functions in amdgpu_dm_irq.c
Alex Deucher [Wed, 11 Oct 2017 13:59:50 +0000 (09:59 -0400)]
drm/amd/display: remove unused functions in amdgpu_dm_irq.c

Not used.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: whitespace cleanup in amdgpu_dm_irq.c/h
Alex Deucher [Wed, 11 Oct 2017 13:53:16 +0000 (09:53 -0400)]
drm/amd/display: whitespace cleanup in amdgpu_dm_irq.c/h

To match kernel standards.  No intended functional change.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: make log_dpcd static
Alex Deucher [Wed, 11 Oct 2017 13:47:04 +0000 (09:47 -0400)]
drm/amd/display: make log_dpcd static

It's only used in this file.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: whitespace cleanup in amdgpu_dm_mst_types.c/h
Alex Deucher [Wed, 11 Oct 2017 13:44:50 +0000 (09:44 -0400)]
drm/amd/display: whitespace cleanup in amdgpu_dm_mst_types.c/h

To match kernel standards.  No intended functional change.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: drop unused functions in amdgpu_dm_services.c
Alex Deucher [Tue, 10 Oct 2017 22:33:14 +0000 (18:33 -0400)]
drm/amd/display: drop unused functions in amdgpu_dm_services.c

not used.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: drop unused functions in amdgpu_dm.c
Alex Deucher [Tue, 10 Oct 2017 21:53:24 +0000 (17:53 -0400)]
drm/amd/display: drop unused functions in amdgpu_dm.c

Not used anywhere.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: make a bunch of stuff in amdgpu_dm.c static
Alex Deucher [Tue, 10 Oct 2017 21:51:02 +0000 (17:51 -0400)]
drm/amd/display: make a bunch of stuff in amdgpu_dm.c static

Not used outside of that file.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: whitespace cleanup in amdgpu_dm.c/h
Alex Deucher [Tue, 10 Oct 2017 21:44:52 +0000 (17:44 -0400)]
drm/amd/display: whitespace cleanup in amdgpu_dm.c/h

To match kernel standards.  No intended functional change.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: fix typo in function name
Alex Deucher [Fri, 13 Oct 2017 18:04:26 +0000 (14:04 -0400)]
drm/amd/display: fix typo in function name

s/amdgpu_dm_find_first_crct_matching_connector/
amdgpu_dm_find_first_crtc_matching_connector/

And while here, make it static.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Remove useless pcrtc pointer
Leo (Sunpeng) Li [Thu, 12 Oct 2017 21:15:11 +0000 (17:15 -0400)]
drm/amd/display: Remove useless pcrtc pointer

in amdgpu_dm_atomic_commit_tail. Just use crtc instead.

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Fix typo
Leo (Sunpeng) Li [Thu, 12 Oct 2017 21:15:10 +0000 (17:15 -0400)]
drm/amd/display: Fix typo

undersacn -> underscan

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Unify amdgpu_dm state variable namings.
Leo (Sunpeng) Li [Thu, 12 Oct 2017 21:15:09 +0000 (17:15 -0400)]
drm/amd/display: Unify amdgpu_dm state variable namings.

Use dm_new_*_state and dm_old_*_state for their respective amdgpu_dm new
and old object states. Helps with readability, and enforces use of new
DRM api (choose either new, or old).

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Unify DRM state variable namings.
Leo (Sunpeng) Li [Thu, 12 Oct 2017 21:15:08 +0000 (17:15 -0400)]
drm/amd/display: Unify DRM state variable namings.

Use new_*_state and old_*_state for their respective new/old DRM object
states.

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Use new DRM API where possible
Leo (Sunpeng) Li [Thu, 12 Oct 2017 21:15:07 +0000 (17:15 -0400)]
drm/amd/display: Use new DRM API where possible

To conform to DRM's new API, we should not be accessing a DRM object's
internal state directly. Rather, the DRM for_each_old/new_* iterators,
and drm_atomic_get_old/new_* interface should be used.

This is an ongoing process. For now, update the DRM-facing atomic
functions, where the atomic state object is given.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Use DRM new-style object iterators.
Dave Airlie [Mon, 9 Oct 2017 00:33:04 +0000 (10:33 +1000)]
drm/amd/display: Use DRM new-style object iterators.

Use the correct for_each_new/old_* iterators instead of for_each_*

The following functions were considered:

amdgpu_dm_find_first_crtc_matching_connector: use for_each_new
    - Old from_state_var flag was always choosing the new state

amdgpu_dm_display_resume: use for_each_new
    - drm_atomic_helper_duplicate_state is called during suspend to
      cache the state
    - It sets 'state' within the state triplet to 'new_state'

amdgpu_dm_commit_planes: use for_each_old
    - Called after the state was swapped (via atomic commit tail)

amdgpu_dm_atomic_commit: use for_each_new
    - Called before the state is swapped

amdgpu_dm_atomic_commit_tail: use for_each_old
    - Called after the state was swapped

dm_update_crtcs_state: use for_each_new
    - Called before the state is swapped (via atomic check)

amdgpu_dm_atomic_check: use for_each_new
    - Called before the state is swapped

v2: Split out typo fixes to a new patch.

v3: Say "functions considered" instead of "affected functions". The
    latter implies that changes are made to each.

[airlied: squashed with my hacks]

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoMerge tag 'drm-misc-next-2017-10-16' of git://anongit.freedesktop.org/drm/drm-misc...
Dave Airlie [Tue, 17 Oct 2017 00:10:17 +0000 (10:10 +1000)]
Merge tag 'drm-misc-next-2017-10-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

Quick 4.15 misc pull for the build fix:

Cross-subsystem Changes:
- piles an piles of misc/trivial patches all over, some more from
  outreachy applicants

Core Changes:
- build fix for the bridge/of cleanup (Maarten)
- fix vblank count in arm_vblank_event (Ville)
- some kerneldoc typo fixes from Thierry

Driver Changes:
- vc4: Fix T-format tiling scanout, cleanup clock divider w/a (Anholt)
- sun4i: small cleanups and improved code comments all over (Chen-Yu
  Tsai)

* tag 'drm-misc-next-2017-10-16' of git://anongit.freedesktop.org/drm/drm-misc: (21 commits)
  drm/via: use ARRAY_SIZE
  drm/gma500: use ARRAY_SIZE
  drm/sun4i: hdmi: Move PAD_CTRL1 setting to mode_set function
  drm/sun4i: hdmi: Document PAD_CTRL1 output invert bits
  drm/sun4i: backend: Add comment explaining why registers are cleared
  drm/sun4i: backend: Use drm_fb_cma_get_gem_addr() to get display memory
  drm/sun4i: backend: Create regmap after access is possible
  drm/sun4i: don't add components that are already in the queue
  drm/vc4: Fix pitch setup for T-format scanout.
  drm/vc4: Move the DSI clock divider workaround closer to the clock call.
  drm: Replace kzalloc with kcalloc
  drm/tinydrm: Remove explicit .best_encoder assignment
  drm/tinydrm: Replace dev_error with DRM_DEV_ERROR
  drm/drm_of: Move drm_of_panel_bridge_remove_function into header.
  drm/atomic-helper: Fix reference to drm_crtc_send_vblank_event()
  drm/atomic-helper: Fix typo
  drm: Add missing __user annotation to drm_syncobj_array_find()
  drm/rockchip: add PINCTRL dependency for LVDS
  drm/kirin: Checking for IS_ERR() instead of NULL
  driver:gpu: return -ENOMEM on allocation failure.
  ...

7 years agodrm/via: use ARRAY_SIZE
Jérémy Lefaure [Mon, 16 Oct 2017 02:33:56 +0000 (22:33 -0400)]
drm/via: use ARRAY_SIZE

Using the ARRAY_SIZE macro improves the readability of the code.

Found with Coccinelle with the following semantic patch:
@r depends on (org || report)@
type T;
T[] E;
position p;
@@
(
 (sizeof(E)@p /sizeof(*E))
|
 (sizeof(E)@p /sizeof(E[...]))
|
 (sizeof(E)@p /sizeof(T))
)

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171016023357.20174-1-jeremy.lefaure@lse.epita.fr
7 years agodrm/gma500: use ARRAY_SIZE
Jérémy Lefaure [Mon, 16 Oct 2017 02:30:46 +0000 (22:30 -0400)]
drm/gma500: use ARRAY_SIZE

Using the ARRAY_SIZE macro improves the readability of the code. Also,
it is useless to re-invent it.

Found with Coccinelle with the following semantic patch:
@r depends on (org || report)@
type T;
T[] E;
position p;
@@
(
 (sizeof(E)@p /sizeof(*E))
|
 (sizeof(E)@p /sizeof(E[...]))
|
 (sizeof(E)@p /sizeof(T))
)

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171016023047.19145-1-jeremy.lefaure@lse.epita.fr
7 years agodrm/sun4i: hdmi: Move PAD_CTRL1 setting to mode_set function
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:52 +0000 (12:02 +0800)]
drm/sun4i: hdmi: Move PAD_CTRL1 setting to mode_set function

Initially we configured the PAD_CTRL1 register at probe/bind time.
However it seems the HDMI controller will modify some of the bits
in this register by itself. On the A10 it is particularly annoying
as it toggles the output invert bits, which inverts the colors on
the display output.

The U-boot driver this driver is based on sets this register twice,
though it seems it's only needed for actual display output. Hence
we move it to the mode_set function.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-8-wens@csie.org
7 years agodrm/sun4i: hdmi: Document PAD_CTRL1 output invert bits
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:51 +0000 (12:02 +0800)]
drm/sun4i: hdmi: Document PAD_CTRL1 output invert bits

While debugging inverted color from the HDMI output on the A10, I
found that the lowest 3 bits were set. These were cleared on A20
boards that had normal display output. By manually toggling these
bits the mapping of the color components to these bits was found.

While these are not used anywhere, it would be nice to document
them somewhere.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-7-wens@csie.org
7 years agodrm/sun4i: backend: Add comment explaining why registers are cleared
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:49 +0000 (12:02 +0800)]
drm/sun4i: backend: Add comment explaining why registers are cleared

Many of the backend's layer configuration registers have undefined
default values. This poses a risk as we use regmap_update_bits in
some places, and don't overwrite the whole register.

At probe/bind time we explicitly clear all the control registers
by writing 0 to them. This patch adds a more detailed explanation
on why we're doing this.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-5-wens@csie.org
7 years agodrm/sun4i: backend: Use drm_fb_cma_get_gem_addr() to get display memory
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:48 +0000 (12:02 +0800)]
drm/sun4i: backend: Use drm_fb_cma_get_gem_addr() to get display memory

Commit 4636ce93d5b2 ("drm/fb-cma-helper: Add drm_fb_cma_get_gem_addr()")
adds a new helper, which covers fetching a drm_framebuffer's GEM object
and calculating the buffer address for a given plane.

This patch uses this helper to replace our own open coded version of the
same function.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-4-wens@csie.org
7 years agodrm/sun4i: backend: Create regmap after access is possible
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:47 +0000 (12:02 +0800)]
drm/sun4i: backend: Create regmap after access is possible

The backend has various clocks and reset controls that need to be
enabled and deasserted before register access is possible.

Move the creation of the regmap to after the clocks and reset controls
have been configured where it makes more sense.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-3-wens@csie.org
7 years agodrm/sun4i: don't add components that are already in the queue
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:46 +0000 (12:02 +0800)]
drm/sun4i: don't add components that are already in the queue

Even though the components framework can handle duplicate entries,
the extra entries cause a lot more debug messages to be generated,
which would be confusing to developers not familiar with our driver
and the framework in general.

Instead, we can scan the relatively small queue and check if the
component to be added is already queued up. Since the display
pipelines are symmetrical (not considering the third display
pipeline on the A80), and we add components level by level, when
we get to the second instance at the same level, any shared downstream
components would already be in the queue.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-2-wens@csie.org
7 years agodrm/vc4: Fix pitch setup for T-format scanout.
Eric Anholt [Wed, 27 Sep 2017 19:32:09 +0000 (12:32 -0700)]
drm/vc4: Fix pitch setup for T-format scanout.

The documentation said to use src_w here, and I didn't consider that
we actually needed to be using pitch somewhere in our setup.  Fixes
scanout on my DSI panel when X11 does initial setup with 1920x1080
HDMI and 800x480 DSI both at 0,0 of the same framebuffer.

v2: Add some comments requested by Boris

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 98830d91da08 ("drm/vc4: Add T-format scanout support.")
Link: https://patchwork.freedesktop.org/patch/msgid/20170927193209.11870-1-eric@anholt.net
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
7 years agoMerge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm...
Dave Airlie [Fri, 13 Oct 2017 23:39:56 +0000 (09:39 +1000)]
Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next

Most notable addition this time is the support for the GPU performance
counters by Christian. This has been in the making for some time and it
has matured a lot. Since this is adding UAPI, the corresponding WIP
userspace can be found at [1] mesa/libdrm repos. I expect that
Christian sends out the final userspace patches for this once you have
pulled the kernel bits.

Philipp optimized the probe path, so etnaviv gets out of the way for
systems that want to boot real quick.

I've done mostly cleanups, disentangling etnaviv from the IOMMU API,
with some MMUv1 optimizations on the way.

* 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux: (36 commits)
  drm/etnaviv: remove unnecessary clock stabilization delay
  drm/etnaviv: reduce reset delay
  drm/etnaviv: remove unused function etnaviv_gem_new
  drm/etnaviv: remove stale comment
  drm/etnaviv: submit supports performance monitor requests
  drm/etnaviv: enable debug registers on demand
  drm/etnaviv: need to disable clock gating when doing profiling
  drm/etnaviv: add MC perf domain
  drm/etnaviv: add TX perf domain
  drm/etnaviv: add RA perf domain
  drm/etnaviv: add SE perf domain
  drm/etnaviv: add PA perf domain
  drm/etnaviv: add SH perf domain
  drm/etnaviv: add PE perf domain
  drm/etnaviv: add HI perf domain
  drm/etnaviv: use 'sync points' for performance monitor requests
  drm/etnaviv: clear alloced event
  drm/etnaviv: add 'sync point' support
  drm/etnaviv: add performance monitor request processing
  drm/etnaviv: copy pmrs from userspace
  ...

7 years agodrm/vc4: Move the DSI clock divider workaround closer to the clock call.
Eric Anholt [Tue, 15 Aug 2017 23:47:18 +0000 (16:47 -0700)]
drm/vc4: Move the DSI clock divider workaround closer to the clock call.

We want the adjusted_mode->clock to be the actual clock we're
expecting to program, so that consumers see the right values for clock
and vrefresh.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170815234722.20700-1-eric@anholt.net
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
7 years agodrm: Replace kzalloc with kcalloc
Harsha Sharma [Fri, 13 Oct 2017 07:37:47 +0000 (13:07 +0530)]
drm: Replace kzalloc with kcalloc

Prefer kcalloc over kzalloc to allocate an array.
This patch fixes checkcpatch issue.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171013073747.29877-1-harshasharmaiitr@gmail.com
Link: https://patchwork.freedesktop.org/patch/msgid/20171013073747.29877-1-harshasharmaiitr@gmail.com
7 years agodrm/tinydrm: Remove explicit .best_encoder assignment
Haneen Mohammed [Tue, 10 Oct 2017 20:58:58 +0000 (14:58 -0600)]
drm/tinydrm: Remove explicit .best_encoder assignment

Since the driver is relying on the atomic helpers, remove the explicit
.best_encoder assignment and let the core call
drm_atomic_helper_best_encoder().

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010205858.GA4806@Haneen
7 years agodrm/tinydrm: Replace dev_error with DRM_DEV_ERROR
Harsha Sharma [Fri, 6 Oct 2017 22:17:38 +0000 (03:47 +0530)]
drm/tinydrm: Replace dev_error with DRM_DEV_ERROR

Convert instances of dev_error to DRM_DEV_ERROR as we have
DRM_DEV_ERROR variants of drm print macros.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171006221738.30200-1-harshasharmaiitr@gmail.com
7 years agodrm/drm_of: Move drm_of_panel_bridge_remove_function into header.
Maarten Lankhorst [Fri, 13 Oct 2017 14:08:53 +0000 (16:08 +0200)]
drm/drm_of: Move drm_of_panel_bridge_remove_function into header.

Core drm shouldn't depend on anything in drm-kms-helper, or the drm
module will fail to load.

insmod drm fails with
[ 6087.674390] drm: Unknown symbol drm_panel_bridge_remove (err 0)

which is defined in drm_kms_helper.ko

This call was added by commit c70087e8f16f ("drm/drm_of: add
drm_of_panel_bridge_remove function"), and the fix is defining it in the
drm_of.h header, to break the circular dependency.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/8f95e623-9480-97dc-2414-77086d8aa49d@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@intel.com> #irc
Fixes: c70087e8f16f ("drm/drm_of: add drm_of_panel_bridge_remove function")
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
7 years agodrm/atomic-helper: Fix reference to drm_crtc_send_vblank_event()
Thierry Reding [Thu, 12 Oct 2017 14:08:57 +0000 (16:08 +0200)]
drm/atomic-helper: Fix reference to drm_crtc_send_vblank_event()

Fix up this reference so that the proper link is generated in the
documentation and so that people don't go chasing after the wrong
function for an embarrassingly long time.

Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171012140857.9559-1-thierry.reding@gmail.com
7 years agodrm/atomic-helper: Fix typo
Thierry Reding [Thu, 12 Oct 2017 14:06:16 +0000 (16:06 +0200)]
drm/atomic-helper: Fix typo

Fix "esay-to-use" to "easy-to-use" typo.

Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171012140616.9002-1-thierry.reding@gmail.com
7 years agodrm: Add missing __user annotation to drm_syncobj_array_find()
Ville Syrjälä [Fri, 1 Sep 2017 16:53:26 +0000 (19:53 +0300)]
drm: Add missing __user annotation to drm_syncobj_array_find()

'user_handles' needs a __user annotation for fix the following sparse
warning:
drm_syncobj.c:813:37: warning: incorrect type in argument 2 (different address spaces)
drm_syncobj.c:813:37:    expected void const [noderef] <asn:1>*from
drm_syncobj.c:813:37:    got void *user_handles
drm_syncobj.c:875:38: warning: incorrect type in argument 2 (different address spaces)
drm_syncobj.c:875:38:    expected void *user_handles
drm_syncobj.c:875:38:    got void [noderef] <asn:1>*<noident>
drm_syncobj.c:908:38: warning: incorrect type in argument 2 (different address spaces)
drm_syncobj.c:908:38:    expected void *user_handles
drm_syncobj.c:908:38:    got void [noderef] <asn:1>*<noident>
drm_syncobj.c:941:38: warning: incorrect type in argument 2 (different address spaces)
drm_syncobj.c:941:38:    expected void *user_handles
drm_syncobj.c:941:38:    got void [noderef] <asn:1>*<noident>

Cc: Jason Ekstrand <jason@jlekstrand.net>
Fixes: 3e6fb72d6cef ("drm/syncobj: Add a syncobj_array_find helper")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170901165328.24459-2-ville.syrjala@linux.intel.com
Reviewed-by: Thierry Reding <treding@nvidia.com>
7 years agoMerge tag 'omapdrm-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux...
Dave Airlie [Fri, 13 Oct 2017 07:33:07 +0000 (17:33 +1000)]
Merge tag 'omapdrm-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into drm-next

omapdrm changes for 4.15

* OMAP4 HDMI CEC support

* tag 'omapdrm-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux:
  omapdrm: omapdss_hdmi_ops: add lost_hotplug op
  omapdrm: hdmi4: hook up the HDMI CEC support
  omapdrm: hdmi4_cec: add OMAP4 HDMI CEC support
  omapdrm: hdmi4: refcount hdmi_power_on/off_core
  omapdrm: hdmi4: move hdmi4_core_powerdown_disable to hdmi_power_on_core()
  omapdrm: hdmi4: prepare irq handling for HDMI CEC support
  omapdrm: hdmi4: make low-level functions available
  omapdrm: hdmi.h: extend hdmi_core_data with CEC fields
  omapdrm: encoder-tpd12s015: keep ls_oe_gpio high

7 years agoMerge tag 'drm-misc-next-2017-10-12' of git://anongit.freedesktop.org/drm/drm-misc...
Dave Airlie [Fri, 13 Oct 2017 06:24:59 +0000 (16:24 +1000)]
Merge tag 'drm-misc-next-2017-10-12' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

More 4.15 drm-misc stuff:

Cross-subsystem Changes:
- bridge cleanup refactor (Benjamin Gaignard)

Core Changes:
- less surprising atomic iterators (Maarten), fixes an oops introduced
  in drm-next
- better gem/fb helper docs (Noralf)
- fix dma-buf rcu races (Christian König)

Driver Changes:
- adv7511: CEC support (Hans Verkuil)
- sun4i update from Chen-Yu to improve hdmi and A31 support
- sii8620: add remote control support (Maceiej Purski)

New drivers:
- SiI9234 bridge driver (Maciej Purski)
- 7" rpi touch panel (Eric Anholt)

Note that this contains a topic pull from regmap, needed by the sun4i
changes. Mark Brown sent that out for pulling into drm-misc.

* tag 'drm-misc-next-2017-10-12' of git://anongit.freedesktop.org/drm/drm-misc: (29 commits)
  drm/dp: WARN about invalid/unknown link rates and bw codes
  drm/msm/mdp5: remove less than 0 comparison for unsigned value
  drm/bridge/sii8620: add remote control support
  drm/sun4i: hdmi: Add support for A31's HDMI controller
  drm/sun4i: hdmi: Add A31 specific DDC register definitions
  drm/sun4i: hdmi: Add support for controller hardware variants
  dt-bindings: display: sun4i: Add binding for A31 HDMI controller
  drm/sun4i: hdmi: Allow using second PLL as TMDS clk parent
  drm/sun4i: hdmi: create a regmap for later use
  drm/sun4i: hdmi: Disable clks in bind function error path and unbind function
  drm/sun4i: tcon: Add support for demuxing TCON output on A31
  drm/sun4i: tcon: Add variant callback for TCON output muxing
  drm/bridge/synopsys: dsi :remove is_panel_bridge
  drm/vc4: remove bridge from driver internal structure
  drm/stm: ltdc: remove bridge from driver internal structure
  drm/drm_of: add drm_of_panel_bridge_remove function
  drm/bridge: make drm_panel_bridge_remove more robust
  dma-fence: fix dma_fence_get_rcu_safe v2
  dma-buf: make reservation_object_copy_fences rcu save
  drm/atomic: Unref duplicated drm_atomic_state in drm_atomic_helper_resume()
  ...

7 years agodrm/rockchip: add PINCTRL dependency for LVDS
Arnd Bergmann [Thu, 5 Oct 2017 12:09:39 +0000 (14:09 +0200)]
drm/rockchip: add PINCTRL dependency for LVDS

The new driver fails to build when CONFIG_PINCTRL is disabled:

drivers/gpu/drm/rockchip/rockchip_lvds.c: In function 'rockchip_lvds_grf_config':
drivers/gpu/drm/rockchip/rockchip_lvds.c:229:39: error: dereferencing pointer to incomplete type 'struct dev_pin_info'
   if (lvds->pins && !IS_ERR(lvds->pins->default_state))

This adds the respective Kconfig dependency.

Fixes: 34cc0aa25456 ("drm/rockchip: Add support for Rockchip Soc LVDS")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171005120957.485433-1-arnd@arndb.de
7 years agodrm: vblank: remove drm_timestamp_monotonic parameter
Arnd Bergmann [Wed, 11 Oct 2017 15:20:13 +0000 (17:20 +0200)]
drm: vblank: remove drm_timestamp_monotonic parameter

There is a risk of overflowing vblank timestamps in 2038 or 2106 if
someone sets the drm_timestamp_monotonic module parameter to zero.

I found no indication of anyone ever setting the parameter, or
complaining about the default being wrong, after it was introduced
as a way to handle backwards-compatibility with linux prior to
c61eef726a78 ("drm: add support for monotonic vblank timestamps"),
so it's probably safer to just remove the parameter completely
and only allowing the default behavior.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrm: vblank: use ktime_t instead of timeval
Arnd Bergmann [Wed, 11 Oct 2017 15:20:12 +0000 (17:20 +0200)]
drm: vblank: use ktime_t instead of timeval

The drm vblank handling uses 'timeval' to store timestamps in either
monotonic or wall-clock time base. In either case, it reads the current
time as a ktime_t in get_drm_timestamp() and converts it from there.

This is a bit suspicious, as users of 'timeval' often suffer from
the time_t overflow in y2038. I have gone through this code and
found that it is unlikely to cause problems here:

- The user space ABI does not use time_t or timeval, but uses
  'u32' and 'long' as the types. This means at least that rebuilding
  user programs against a new libc with 64-bit time_t does not
  change the ABI.

- As of commit c61eef726a78 ("drm: add support for monotonic vblank
  timestamps") in linux-3.8, the monotonic timestamp is the default
  and can only get reverted to wall-clock through a module-parameter.

- With the default monotonic timestamps, there is no problem at all.

- The drm_wait_vblank_ioctl() interface is alway safe on 64-bit
  architectures, on 32-bit it might overflow the 'long' timestamps
  in 2038 with wall-clock timestamps.

- The event handling uses 'u32' seconds, which overflow in 2106
  on both 32-bit and 64-bit machines, when wall-clock timestamps
  are used.

- The effect of overflowing either of the two is only temporary
  (during the overflow, and is likely to keep working again
  afterwards. It is likely the same problem as observing a
  'settimeofday()' call, which was the reason for moving to the
  monotonic timestamps in the first place.

Overall, this seems good enough, so my patch removes the use of
'timeval' from the vblank handling altogether and uses ktime_t
consistently, except for the part where we copy the data to user
space structures in the existing format.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrm/kirin: Checking for IS_ERR() instead of NULL
Dan Carpenter [Thu, 5 Oct 2017 12:57:51 +0000 (15:57 +0300)]
drm/kirin: Checking for IS_ERR() instead of NULL

The of_graph_get_remote_node() function doesn't return error pointers,
it returns NULL on error so I've updated the check.

Fixes: 86418f90a4c1 ("drm: convert drivers to use of_graph_get_remote_node")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171005125751.jvtjms62vbtxuvak@mwanda