platform/kernel/linux-rpi.git
6 years agodrm/amd/pp: Add a pp feature mask bit for AutoWattman feature
Rex Zhu [Thu, 22 Feb 2018 09:45:11 +0000 (17:45 +0800)]
drm/amd/pp: Add a pp feature mask bit for AutoWattman feature

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Change default value of module parameter amdgpu_pp_feature_mask
Rex Zhu [Thu, 22 Feb 2018 09:39:22 +0000 (17:39 +0800)]
drm/amdgpu: Change default value of module parameter amdgpu_pp_feature_mask

Currently all pp features are enabled by default except
OVERDRIVE

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: fix thermal interrupts on vega10
Eric Huang [Thu, 22 Feb 2018 17:00:35 +0000 (12:00 -0500)]
drm/amd/powerplay: fix thermal interrupts on vega10

a bug in programming thermal interrupt register masks out
interrupts and driver cannot receive interrupts. Setting
0 to mask bits will fix it.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Add query vram width in CGS query system info
Rex Zhu [Thu, 8 Feb 2018 07:57:10 +0000 (15:57 +0800)]
drm/amdgpu: Add query vram width in CGS query system info

powerplay need vram width to set default mclk optimization
settings(uphyst/downhyst/activity threshold)

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: use the TTM dummy page instead of allocating one
Christian König [Thu, 22 Feb 2018 07:35:11 +0000 (08:35 +0100)]
drm/amdgpu: use the TTM dummy page instead of allocating one

We have a global dummy page in TTM, use that one instead of allocating a
new one.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Fix bug that dpm level was not really locked
Rex Zhu [Fri, 9 Feb 2018 08:47:53 +0000 (16:47 +0800)]
drm/amd/pp: Fix bug that dpm level was not really locked

Lock the dpm levels when we use SW method to modify
the dpm tables directly to avoid a possible race
with the smu.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Fix error handling when smu return failed on Vega10.
Rex Zhu [Sun, 11 Feb 2018 04:38:58 +0000 (12:38 +0800)]
drm/amd/pp: Fix error handling when smu return failed on Vega10.

Clamp the clock index to a valid range when reading it back

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: set TTM_OPT_FLAG_FORCE_ALLOC in ttm_bo_force_list_clean
Roger He [Tue, 6 Feb 2018 07:00:06 +0000 (15:00 +0800)]
drm/ttm: set TTM_OPT_FLAG_FORCE_ALLOC in ttm_bo_force_list_clean

Because ttm_bo_force_list_clean() is only called on two occasions:
1. By ttm_bo_evict_mm() during suspend.
2. By ttm_bo_clean_mm() when the driver unloads.
On both cases we absolutely don't want any memory allocation failure.

Signed-off-by: Roger He <Hongbo.He@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: add bit flag TTM_OPT_FLAG_FORCE_ALLOC
Roger He [Wed, 17 Jan 2018 07:07:23 +0000 (15:07 +0800)]
drm/ttm: add bit flag TTM_OPT_FLAG_FORCE_ALLOC

set TTM_OPT_FLAG_FORCE_ALLOC when we are servicing for page
fault routine.

for ttm_mem_global_reserve if in page fault routine, allow the gtt
pages reservation always. because page fault routing already grabbed
system memory and the allowance of this exception is harmless.
Otherwise, it will trigger OOM killer.

will be used later.

v2: set the FORCE_ALLOC always
v3: minor refine

Signed-off-by: Roger He <Hongbo.He@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: use bit flag to replace allow_reserved_eviction in ttm_operation_ctx
Roger He [Tue, 6 Feb 2018 03:22:57 +0000 (11:22 +0800)]
drm/ttm: use bit flag to replace allow_reserved_eviction in ttm_operation_ctx

for saving memory and more bit flag can be used in future

Signed-off-by: Roger He <Hongbo.He@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoradeon: hide pointless #warning when compile testing
Arnd Bergmann [Fri, 16 Feb 2018 15:26:57 +0000 (16:26 +0100)]
radeon: hide pointless #warning when compile testing

In randconfig testing, we sometimes get this warning:

drivers/gpu/drm/radeon/radeon_object.c: In function 'radeon_bo_create':
drivers/gpu/drm/radeon/radeon_object.c:242:2: error: #warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance thanks to write-combining [-Werror=cpp]
 #warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \

This is rather annoying since almost all other code produces no build-time
output unless we have found a real bug. We already fixed this in the
amdgpu driver in commit 31bb90f1cd08 ("drm/amdgpu: shut up #warning for
compile testing") by adding a CONFIG_COMPILE_TEST check last year and
agreed to do the same here, but both Michel and I then forgot about it
until I came across the issue again now.

For stable kernels, as this is one of very few remaining randconfig
warnings in 4.14.

Cc: stable@vger.kernel.org
Link: https://patchwork.kernel.org/patch/9550009/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: set page mapping during allocation
Christian König [Thu, 1 Feb 2018 13:52:50 +0000 (14:52 +0100)]
drm/ttm: set page mapping during allocation

To aid debugging set the page mapping during allocation instead of
during VM faults.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoRevert "drm/radeon/pm: autoswitch power state when in balanced mode"
Alex Deucher [Thu, 15 Feb 2018 13:40:30 +0000 (08:40 -0500)]
Revert "drm/radeon/pm: autoswitch power state when in balanced mode"

This reverts commit 1c331f75aa6ccbf64ebcc5a019183e617c9d818a.

Breaks resume on some systems.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100759
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/radeon: use drm_gem_private_object_init
Christian König [Fri, 16 Feb 2018 09:08:24 +0000 (10:08 +0100)]
drm/radeon: use drm_gem_private_object_init

We use our own backing store and don't need the shmem file.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: use drm_gem_private_object_init
Christian König [Fri, 16 Feb 2018 08:52:51 +0000 (09:52 +0100)]
drm/amdgpu: use drm_gem_private_object_init

We use our own backing store and don't need the shmem file.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: mitigate workaround for i915
Christian König [Mon, 19 Feb 2018 10:29:35 +0000 (11:29 +0100)]
drm/amdgpu: mitigate workaround for i915

To be able to use DRI_PRIME with amdgpu and i915 we add all our fences
only as exclusive ones.

Disable that behavior when sharing between amdgpu itself cause it
hinders concurrent execution.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: implement amdgpu_gem_map_(attach/detach)
Christian König [Fri, 16 Feb 2018 12:16:11 +0000 (13:16 +0100)]
drm/amdgpu: implement amdgpu_gem_map_(attach/detach)

Instead of the pin/unpin callback implement the attach/detach ones.

Functional identical, but allows us access to the attachment.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/powerplay/smu7: drop refresh rate checks for mclk switching
Alex Deucher [Tue, 13 Feb 2018 19:37:36 +0000 (14:37 -0500)]
drm/amdgpu/powerplay/smu7: drop refresh rate checks for mclk switching

The logic has moved to cgs.  mclk switching with DC at higher refresh
rates should work.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
6 years agodrm/amdgpu/cgs: add refresh rate checking to non-DC display code
Alex Deucher [Tue, 13 Feb 2018 19:33:51 +0000 (14:33 -0500)]
drm/amdgpu/cgs: add refresh rate checking to non-DC display code

Clamp the vblank period to 0 if the refresh rate is larger than
120 hz for non-DC.  This allows us to remove the refresh rate
checks from powerplay for mclk switching.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay/smu7: allow mclk switching with no displays
Alex Deucher [Tue, 13 Feb 2018 19:26:54 +0000 (14:26 -0500)]
drm/amd/powerplay/smu7: allow mclk switching with no displays

If there are no displays attached, there is no reason to disable
mclk switching.

Fixes mclks getting set to high when there are no displays attached.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/powerplay/vega10: allow mclk switching with no displays
Alex Deucher [Tue, 13 Feb 2018 19:25:11 +0000 (14:25 -0500)]
drm/amd/powerplay/vega10: allow mclk switching with no displays

If there are no displays attached, there is no reason to disable
mclk switching.

Fixes mclks getting set to high when there are no displays attached.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/powerplay: use PP_CAP macro for disable_mclk_switching_for_frame_lock
Alex Deucher [Tue, 13 Feb 2018 19:22:46 +0000 (14:22 -0500)]
drm/amd/powerplay: use PP_CAP macro for disable_mclk_switching_for_frame_lock

Rather than open coding it.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: remove unused headers
Corentin Labbe [Wed, 14 Feb 2018 14:46:17 +0000 (14:46 +0000)]
drm/amd/powerplay: remove unused headers

All thoses headers are not used by any source files.
Lets just remove them.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm
Gustavo A. R. Silva [Thu, 15 Feb 2018 05:20:00 +0000 (23:20 -0600)]
drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm

Currently, if amdgpu_vm_bo_update() fails, the returned error
is being ignored.

Fix this by properly checking _r_ after calling amdgpu_vm_bo_update.
Also, remove redundant code just before label _error_.

Addresses-Coverity-ID: 1464280 ("Unused value")
Fixes: 0abc6878fc2d ("drm/amdgpu: update VM PDs after the PTs")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: update the PASID mapping only on demand
Christian König [Mon, 5 Feb 2018 16:38:01 +0000 (17:38 +0100)]
drm/amdgpu: update the PASID mapping only on demand

Updating the PASID is rather heavyweight and shouldn't be done all the
time.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: separate PASID mapping from VM flush v2
Christian König [Sun, 4 Feb 2018 09:32:35 +0000 (10:32 +0100)]
drm/amdgpu: separate PASID mapping from VM flush v2

Stuffing the PASID mapping into the VM flush isn't flexible enough since
the PASID mapping changes not as often as we need a VM flush.

v2: add missing use of gmc_v7_0_emit_pasid_mapping

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fix increment when sampling OTF in DCE
Leo (Sunpeng) Li [Fri, 9 Feb 2018 17:51:01 +0000 (12:51 -0500)]
drm/amd/display: Fix increment when sampling OTF in DCE

Previously, the number of software segmets per region was reduced to 16.
This needs to be reflected in the sampling distance (increment) used when
translating to the hardware format.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: De PQ implementation
Vitaly Prosyak [Tue, 6 Feb 2018 21:06:23 +0000 (15:06 -0600)]
drm/amd/display: De PQ implementation

Some refactoring and optimizations in color module.
Added de gamma 2.2 & 2.4, also re gamma 2.2.
Added interface for diagnostic for de gamma & de pq.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove unused dm_pp_ interfaces
Harry Wentland [Mon, 5 Feb 2018 23:41:45 +0000 (18:41 -0500)]
drm/amd/display: Remove unused dm_pp_ interfaces

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add logging for aux DPCD access
Eric Yang [Tue, 6 Feb 2018 22:28:46 +0000 (17:28 -0500)]
drm/amd/display: Add logging for aux DPCD access

Add basic logging for DPCD access. Does not print
by default.

Currently only prints first byte of the data accessed.

Technical debt: Need to make it so that the entire
data block accessed is printed. Also need to log
address space that's not DPCD.

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>
6 years agodrm/amd/display: Set vsc pack revision when DPCD revision is >= 1.2
Tao [Thu, 8 Feb 2018 21:04:25 +0000 (16:04 -0500)]
drm/amd/display: Set vsc pack revision when DPCD revision is >= 1.2

Brightness couldn't change when booting up in DC mode.
It was because "psr_enabled" flag was not set to true before
setting vsc packet revision, causing packet rev setup was skipped.
Now instead of checking the psr flag, it checks if the DPCD_REV >= 1.2
and set the vsc packet revision.

Signed-off-by: Tao <xtao@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>
6 years agodrm/amd/display: provide an interface to query firmware version
Anthony Koo [Thu, 8 Feb 2018 04:25:43 +0000 (23:25 -0500)]
drm/amd/display: provide an interface to query firmware version

Signed-off-by: Anthony Koo <Anthony.Koo@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>
6 years agodrm/amd/display: Add missing Vega defines to dal_asic_id
Harry Wentland [Thu, 1 Feb 2018 16:29:58 +0000 (11:29 -0500)]
drm/amd/display: Add missing Vega defines to dal_asic_id

Signed-off-by: Harry Wentland <harry.wentland@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>
6 years agodrm/amd/display: Treat bad EDID as no EDID
Eric Yang [Thu, 8 Feb 2018 19:05:14 +0000 (14:05 -0500)]
drm/amd/display: Treat bad EDID as no EDID

We have an mst dock firmware that will emulate an EDID with bad
checksum.

v2: Tread -> Treat

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>
6 years agodrm/amd/display: Remove duplicate entries from BIOS function table
Ken Chalmers [Wed, 7 Feb 2018 19:58:53 +0000 (14:58 -0500)]
drm/amd/display: Remove duplicate entries from BIOS function table

Identical to the two entries above them.

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>
6 years agodrm/amd/display: Make FBC work without fbdev emulation
Roman Li [Tue, 6 Feb 2018 23:47:26 +0000 (18:47 -0500)]
drm/amd/display: Make FBC work without fbdev emulation

Previously, FBC dynamic allocation relied on connector modes
populated during dm init. This is only the case if
DRM_FBDEV_EMULATION config flag is enabled.
Moving fbc allocation from dm_late_init() to
amdgpu_dm_connector_get_modes() where actual modes init happens.

Signed-off-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Shirish Shankarappa <Shirish.S@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove delay on disconnect patch
John Barberiz [Tue, 6 Feb 2018 17:25:17 +0000 (12:25 -0500)]
drm/amd/display: Remove delay on disconnect patch

HDMI HPD's generic solution makes the monitor
patch code unnecessary so anything related has
been removed.

Signed-off-by: John Barberiz <jbarberi@amd.com>
Reviewed-by: John Barberiz <jbarberi@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Skip 2 frames when first reading CRC
Leo (Sunpeng) Li [Tue, 6 Feb 2018 15:20:46 +0000 (10:20 -0500)]
drm/amd/display: Skip 2 frames when first reading CRC

Skipping the first frame will prevent uncoooked values most of the time.
However, in some unlikely cases, the second frame will be uncooked as
well.

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>
6 years agodrm/amd/display: Expose DCE110 CRC functions for DCE8
Leo (Sunpeng) Li [Mon, 5 Feb 2018 21:11:19 +0000 (16:11 -0500)]
drm/amd/display: Expose DCE110 CRC functions for DCE8

Implement CRC for DCE8. Registers remain the same, so call DCE110 code
directly.

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>
6 years agodrm/amd/display: Rework DCE transform bit depth reduction programming.
Leo (Sunpeng) Li [Tue, 6 Feb 2018 21:35:21 +0000 (16:35 -0500)]
drm/amd/display: Rework DCE transform bit depth reduction programming.

Clear up the logic, and enable programming truncation as a bit reduction
mode.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: When enabling CRC, disable dither & enable truncation
Leo (Sunpeng) Li [Tue, 23 Jan 2018 22:43:37 +0000 (17:43 -0500)]
drm/amd/display: When enabling CRC, disable dither & enable truncation

When user-mode is using 8bpc, the hardware represents it internally
using a higher bit depth. This causes problems when comparing CRCs for
color managment tests.

We need to disable dithering as well, since it makes CRC values
non-deterministic.

It's easy to see why dithering needs to be disabled, The reason why
truncation also needs to be enabled is better described with an example.
Consider the folowing which tests the color transform matrix (CTM):

Expected CRC = FB_A -> Degamma (Bypassed) -> CTM (Bypassed)
                                                  |
                                                  v
                            Obtain CRC  <- Regamma(Bypassed)

Actual CRC = FB_B -> Degamma (Bypassed) -> CTM (0.5*Identity)
                                                  |
                                                  v
                            Obtain CRC  <- Regamma(Bypassed)

FB_A contains a solid red color at half intensity (127 @ 8bpc)
FB_B contains a solid red color at full intensity (255 @ 8bpc)

We expect that Expected CRC = Actual CRC, but that's not the case. When
the CTM is applied, the output is at half intensity, but also at a
higher bit depth within hardware. i.e. 255/2 = 127.5: not representable
in 8bpc, but can be at 10bpc. This causes the two CRC's to be different.

The solution is to truncate the output bit depth to the same as input
when enabling CRC capture. Since Linux only supports 8bpc, hard code
that for now.

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>
6 years agodrm/amd/display: Expose dither setting functionality to Linux
Leo (Sunpeng) Li [Tue, 6 Feb 2018 14:50:49 +0000 (09:50 -0500)]
drm/amd/display: Expose dither setting functionality to Linux

We will need this to disable dither for CRC capture.

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>
6 years agodrm/amd/display: Refactor max color lut entries into a macro.
Leo (Sunpeng) Li [Tue, 30 Jan 2018 16:14:27 +0000 (11:14 -0500)]
drm/amd/display: Refactor max color lut entries into a macro.

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>
6 years agodrm/amd/display: Hookup color management functions
Leo (Sunpeng) Li [Fri, 2 Feb 2018 15:18:56 +0000 (10:18 -0500)]
drm/amd/display: Hookup color management functions

Hookup new color management functions into amdgpu_dm:

- Notify DRM that we support CRTC color management during CRTC init
- Call color management functions within atomic check to update dc
  states in preparation for a commit

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>
6 years agodrm/amd/display: Implement color management
Leo (Sunpeng) Li [Fri, 2 Feb 2018 15:18:05 +0000 (10:18 -0500)]
drm/amd/display: Implement color management

Implement color management functionalities within amdgpu_dm_color, and
expose functions within amdgpu_dm.h.

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>
6 years agodrm/amd/display: Add color module's gamma helpers to Linux build
Leo (Sunpeng) Li [Mon, 5 Feb 2018 19:29:57 +0000 (14:29 -0500)]
drm/amd/display: Add color module's gamma helpers to Linux build

Also guard includes that we don't need.

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>
6 years agodrm/amd/display: Use hardware max low point when sampling OTF
Leo (Sunpeng) Li [Fri, 2 Feb 2018 14:46:41 +0000 (09:46 -0500)]
drm/amd/display: Use hardware max low point when sampling OTF

The MAX_LOW_POINT macro should reflect the maximum low point within
hardware. Otherwise, sampling for the hardware points from the output
transfer function (OTF) will be incorrect.

Also, fix usage of MAX_LOW_POINT accordingly.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Make couple functions in DCE80 TG static
Harry Wentland [Wed, 24 Jan 2018 16:23:28 +0000 (11:23 -0500)]
drm/amd/display: Make couple functions in DCE80 TG static

Signed-off-by: Harry Wentland <harry.wentland@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>
6 years agodrm/amd/display: Re-use DCE100 display_power_gating for DCE80
Harry Wentland [Wed, 24 Jan 2018 16:16:49 +0000 (11:16 -0500)]
drm/amd/display: Re-use DCE100 display_power_gating for DCE80

Both functions are the same

Signed-off-by: Harry Wentland <harry.wentland@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>
6 years agodrm/amd/display: Remove unused DCE80 compressor
Harry Wentland [Wed, 24 Jan 2018 15:47:37 +0000 (10:47 -0500)]
drm/amd/display: Remove unused DCE80 compressor

Signed-off-by: Harry Wentland <harry.wentland@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>
6 years agodrm/amd/display: Keep eDP stream enabled during boot.
Yongqiang Sun [Fri, 2 Feb 2018 22:35:00 +0000 (17:35 -0500)]
drm/amd/display: Keep eDP stream enabled during boot.

This path fixed specific eDP panel cold boot black screen
due to unnecessary enable link.
Change:
In case of boot up with eDP, if OS is going to set mode
on eDP, keep eDP light up, do not disable and reset corresponding
HW.
This change may affect dce asics and S3/S4 Resume with multi-monitor.

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>
6 years agodrm/amd/display: dal 3.1.34
Tony Cheng [Fri, 2 Feb 2018 06:16:47 +0000 (01:16 -0500)]
drm/amd/display: dal 3.1.34

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>
6 years agodrm/amd/display: disable seamless vp adjustment for mirrored surface
Dmytro Laktyushkin [Mon, 29 Jan 2018 21:34:16 +0000 (16:34 -0500)]
drm/amd/display: disable seamless vp adjustment for mirrored surface

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@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>
6 years agodrm/amd/display: add monitor patch for delay after DP receive power up
Martin Tsai [Thu, 1 Feb 2018 12:03:17 +0000 (20:03 +0800)]
drm/amd/display: add monitor patch for delay after DP receive power up

Signed-off-by: Martin Tsai <martin.tsai@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>
6 years agodrm/amd/display: Change blackout time to 0 on CZ/ST
Harry Wentland [Tue, 30 Jan 2018 19:58:42 +0000 (14:58 -0500)]
drm/amd/display: Change blackout time to 0 on CZ/ST

These should only be non-0 if big hammer w/a is implemented. Currently
DC doesn't implement it, so leave them 0.

Signed-off-by: Harry Wentland <harry.wentland@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>
6 years agodrm/amd/display: add force_trigger even to static screen control
Charlene Liu [Thu, 1 Feb 2018 20:16:20 +0000 (15:16 -0500)]
drm/amd/display: add force_trigger even to static screen control

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>
6 years agodrm/amd/display: dal 3.1.33
Tony Cheng [Thu, 1 Feb 2018 20:32:55 +0000 (15:32 -0500)]
drm/amd/display: dal 3.1.33

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>
6 years agodrm/amd/display: boot up/S4 fix mainlink off before BL.
Charlene Liu [Wed, 31 Jan 2018 21:45:26 +0000 (16:45 -0500)]
drm/amd/display: boot up/S4 fix mainlink off before BL.

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: VGA black screen from s3 when attached to hook
Hersen Wu [Tue, 30 Jan 2018 16:46:16 +0000 (11:46 -0500)]
drm/amd/display: VGA black screen from s3 when attached to hook

[Description] For MST, DC already notify MST sink for MST mode, DC stll
check DP SINK DPCD register to see if MST enabled. DP RX firmware may
not handle this properly.

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>
6 years agodrm/amd/display: Rearchitecture HDMI HPD
John Barberiz [Fri, 26 Jan 2018 22:39:19 +0000 (17:39 -0500)]
drm/amd/display: Rearchitecture HDMI HPD

- Disabled HPD filter and used HPD software timer instead
- Allows DM to disable HPD filtering

Signed-off-by: John Barberiz <jbarberi@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Fix potential uninitialized use of 'idle' in amdgpu_ids.c
Harry Wentland [Fri, 9 Feb 2018 17:15:45 +0000 (12:15 -0500)]
drm/amdgpu: Fix potential uninitialized use of 'idle' in amdgpu_ids.c

v2: Use NULL and reverse christmas tree ordering

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Unify the dm resume calls into one
Mikita Lipski [Sat, 3 Feb 2018 20:19:20 +0000 (15:19 -0500)]
drm/amdgpu: Unify the dm resume calls into one

amdgpu_dm_display_resume is now called from dm_resume to
unify DAL resume call into a single function call

There is no more need to separately call 2 resume functions
for DM.

Initially they were separated to resume display state after
cursor is pinned. But because there is no longer any corruption
with the cursor - the calls can be merged into one function hook.

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Add a missing lock for drm_mm_takedown
Mikita Lipski [Fri, 19 Jan 2018 16:21:04 +0000 (11:21 -0500)]
drm/amdgpu: Add a missing lock for drm_mm_takedown

Inside amdgpu_gtt_mgr_fini add a missing lock to maintain
locking balance

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: cleanup VCN IB generation
Christian König [Wed, 7 Feb 2018 19:48:22 +0000 (20:48 +0100)]
drm/amdgpu: cleanup VCN IB generation

Start to use amdgpu_bo_create_reserved v2.

v2:
Fix missing pointer init to NULL.
Remove extra new lines.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Tested-and-Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix and cleanup UVD IB generation
Christian König [Wed, 7 Feb 2018 19:48:21 +0000 (20:48 +0100)]
drm/amdgpu: fix and cleanup UVD IB generation

We didn't synced the BO after validating it. Also sart to use
amdgpu_bo_create_reserved to simplify things.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove unused CFLAGS entry in DML Makefile
Harry Wentland [Thu, 8 Feb 2018 21:46:30 +0000 (16:46 -0500)]
drm/amd/display: Remove unused CFLAGS entry in DML Makefile

Missed that with a previous change that removed unused files.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/radeon: remove extra TT unpopulated check
Christian König [Thu, 1 Feb 2018 13:41:37 +0000 (14:41 +0100)]
drm/radeon: remove extra TT unpopulated check

The subsystem should check that, not the driver.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: remove extra TT unpopulated check
Christian König [Thu, 1 Feb 2018 13:40:35 +0000 (14:40 +0100)]
drm/amdgpu: remove extra TT unpopulated check

The subsystem should check that, not the driver.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: add ttm_tt_populate wrapper
Christian König [Thu, 1 Feb 2018 13:39:29 +0000 (14:39 +0100)]
drm/ttm: add ttm_tt_populate wrapper

Stop calling the driver callback directly.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoamdgpu/dc/calcs: Support clang option for stack alignment
Matthias Kaehlcke [Thu, 8 Feb 2018 20:53:16 +0000 (12:53 -0800)]
amdgpu/dc/calcs: Support clang option for stack alignment

calcs uses the compiler option -mpreferred-stack-boundary=4 to configure
a stack alignment of 16 bytes. Clang uses the option -mstack-alignment
instead, which expects as parameter the alignment in bytes, and not a
power of two like -mpreferred-stack-boundary.

Probe for both compiler options and use the correct one, similar to
what is done in arch/x86/Makefile.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoamdgpu/dc/dml: Support clang option for stack alignment
Matthias Kaehlcke [Thu, 8 Feb 2018 20:53:15 +0000 (12:53 -0800)]
amdgpu/dc/dml: Support clang option for stack alignment

DML uses the compiler option -mpreferred-stack-boundary=4 to configure
a stack alignment of 16 bytes. Clang uses the option -mstack-alignment
instead, which expects as parameter the alignment in bytes, and not a
power of two like -mpreferred-stack-boundary.

Probe for both compiler options and use the correct one, similar to
what is done in arch/x86/Makefile.

Reported-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoamdgpu/dc/calcs: Consolidate redundant CFLAGS
Matthias Kaehlcke [Thu, 8 Feb 2018 20:53:14 +0000 (12:53 -0800)]
amdgpu/dc/calcs: Consolidate redundant CFLAGS

Use a variable for common CFLAGS instead of specifying the same flags
for every source file.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoamdgpu/dc/dml: Consolidate redundant CFLAGS
Matthias Kaehlcke [Thu, 8 Feb 2018 20:53:13 +0000 (12:53 -0800)]
amdgpu/dc/dml: Consolidate redundant CFLAGS

Use a variable for common CFLAGS instead of specifying the same flags
for every source file.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Add place holder for soc15 asic init on emulation
Shaoyun Liu [Thu, 1 Feb 2018 23:13:23 +0000 (18:13 -0500)]
drm/amdgpu: Add place holder for soc15 asic init on emulation

Add common smu_soc_asic_init function to emulate the sillicon post sequence

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Double the timeout count on emulation mode
Shaoyun Liu [Wed, 7 Feb 2018 19:43:13 +0000 (14:43 -0500)]
drm/amdgpu: Double the timeout count on emulation mode

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Avoid get vram info from atom bios on emulation mode
Shaoyun Liu [Tue, 6 Feb 2018 22:29:35 +0000 (17:29 -0500)]
drm/amdgpu: Avoid get vram info from atom bios on emulation mode

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Fix none-powerplay issue when load driver on emulation mode
Shaoyun Liu [Mon, 5 Feb 2018 21:41:33 +0000 (16:41 -0500)]
drm/amdgpu: Fix none-powerplay issue when load driver on emulation mode

On emulation mode , driver will be loaded with powerplay disabled

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Basic emulation support
Shaoyun Liu [Thu, 1 Feb 2018 22:37:50 +0000 (17:37 -0500)]
drm/amdgpu: Basic emulation support

Add amdgpu_emu_mode module parameter to control the emulation mode
Avoid vbios operation on emulation since there is no vbios post duirng emulation,
use the common hw_init to simulate the post

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Acked-By: Alex Deucher <alexander.deucher@amd.com>
Acked-By: Christian Konig <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add new device to use atpx quirk
Kai-Heng Feng [Thu, 8 Feb 2018 09:46:01 +0000 (17:46 +0800)]
drm/amdgpu: add new device to use atpx quirk

The affected system (0x0813) is pretty similar to another one (0x0812),
it also needs to use ATPX power control.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/pp: Restore power profile mode in auto dpm level on Vega10
Rex Zhu [Fri, 2 Feb 2018 09:13:02 +0000 (17:13 +0800)]
drm/amd/pp: Restore power profile mode in auto dpm level on Vega10

As auto power profile mode still not support on vega10, so
just restore default profile mode in auto dpm level.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Get/set dgpu power cap via hwmon API
Rex Zhu [Mon, 29 Jan 2018 10:07:01 +0000 (18:07 +0800)]
drm/amdgpu: Get/set dgpu power cap via hwmon API

v2: change power unit to microWatt

Adust power limit through power1_cap
Get min/max power limit through power1_cap_min/power1_cap_max

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Expose set/get_power_limit for DGPU
Rex Zhu [Mon, 29 Jan 2018 10:04:18 +0000 (18:04 +0800)]
drm/amd/pp: Expose set/get_power_limit for DGPU

User can change power limit between
[0, 1] * max power limit.

Set power limit to 0, restore to max power limit.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoamdgpu/dc: Fix enum mismatch in calls to program_color_matrix()
Matthias Kaehlcke [Wed, 7 Feb 2018 21:43:52 +0000 (13:43 -0800)]
amdgpu/dc: Fix enum mismatch in calls to program_color_matrix()

The driver passes GRAPHICS_CSC_ADJUST_TYPE_SW of type enum
graphics_csc_adjust_type to program_color_matrix(), however the function
expects a parameter of type enum grph_color_adjust_option. Supposedly
the intention was to pass GRPH_COLOR_MATRIX_SW, which has the same value
as GRAPHICS_CSC_ADJUST_TYPE_SW, so the mismatch didn't cause any trouble.

Pass GRPH_COLOR_MATRIX_SW to program_color_matrix() instead of
GRAPHICS_CSC_ADJUST_TYPE_SW, this also fixes the following warning when
building the kernel with clang:

drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.c:1129:24:
  error: implicit conversion from enumeration type
  'enum graphics_csc_adjust_type' to different enumeration type
  'enum grph_color_adjust_option' [-Werror,-Wenum-conversion]
    xfm_dce, tbl_entry, GRAPHICS_CSC_ADJUST_TYPE_SW);

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove extra pairs of parentheses in dce_calcs.c
Matthias Kaehlcke [Wed, 7 Feb 2018 19:49:28 +0000 (11:49 -0800)]
drm/amd/display: Remove extra pairs of parentheses in dce_calcs.c

The double parentheses are not needed. Removing them fixes multiple
warnings like this when building with clang:

drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:617:42:
  error: equality comparison with extraneous parentheses
    [-Werror,-Wparentheses-equality]
  if ((data->graphics_micro_tile_mode == bw_def_rotated_micro_tiling)) {

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Enable ip block bit mask print out info by default
Shaoyun Liu [Thu, 1 Feb 2018 21:45:26 +0000 (16:45 -0500)]
drm/amdgpu: Enable ip block bit mask print out info by default

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Christian Konig <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: Remove extra pair of parentheses
Matthias Kaehlcke [Wed, 7 Feb 2018 19:10:17 +0000 (11:10 -0800)]
drm/amd/powerplay: Remove extra pair of parentheses

The double parentheses are not needed. Removing them fixes the following
warning when building with clang:

drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c:419:29:
  error: equality comparison with extraneous parentheses
    [-Werror,-Wparentheses-equality]
  if ((data->vdd_gfx_control == SMU7_VOLTAGE_CONTROL_BY_SVID2)) {

Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: Fix enum mismatch
Matthias Kaehlcke [Wed, 7 Feb 2018 18:58:43 +0000 (10:58 -0800)]
drm/amd/powerplay: Fix enum mismatch

In several locations the driver uses AMD_CG_STATE_UNGATE (type enum
amd_clockgating_state) instead of AMD_PG_STATE_UNGATE (type enum
amd_powergating_stat) and vice versa. Both constants have the same
value, so this doesn't cause any problems, but we still want to pass
the correct type.

Fixing the mismatch resolves multiple warnings like this when building
with clang:

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/cz_clockpowergating.c:169:7:
  error: implicit conversion from enumeration type 'enum
  amd_powergating_state' to different enumeration type 'enum
  amd_clockgating_state' [-Werror,-Wenum-conversion]
    AMD_PG_STATE_UNGATE);

Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add mmhub powergating set by smu
Eric Huang [Tue, 6 Feb 2018 21:21:05 +0000 (16:21 -0500)]
drm/amdgpu: add mmhub powergating set by smu

PSP will disable legacy mmhub PG setting that is programming
registers, and drive will use SMC message to
set it up.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: add mmhub powergating by smu in powerplay
Eric Huang [Tue, 6 Feb 2018 19:38:38 +0000 (14:38 -0500)]
drm/amd/powerplay: add mmhub powergating by smu in powerplay

new generic interface is added in powerplay.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: implement set_mmhub_powergating_by_smu for Raven
Eric Huang [Tue, 6 Feb 2018 19:42:04 +0000 (14:42 -0500)]
drm/amd/powerplay: implement set_mmhub_powergating_by_smu for Raven

mmhub PG is enabled by SMU FW only for Raven.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add an interface of amdgpu_dpm_set_mmhub_powergating_by_smu
Eric Huang [Tue, 6 Feb 2018 21:19:24 +0000 (16:19 -0500)]
drm/amdgpu: add an interface of amdgpu_dpm_set_mmhub_powergating_by_smu

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: delete some dead code
Dan Carpenter [Tue, 6 Feb 2018 12:35:00 +0000 (15:35 +0300)]
drm/amd/powerplay: delete some dead code

We deleted some code in e154162ef75d ("drm/amd/powerplay: refine pp code
for raven") but there were a few related bits that were missed.  Let's
delete them as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: Zero out power data in AMDGPU_PP_SENSOR_GPU_POWER readout
Tom St Denis [Tue, 6 Feb 2018 19:00:01 +0000 (14:00 -0500)]
drm/amd/powerplay:  Zero out power data in AMDGPU_PP_SENSOR_GPU_POWER readout

Since 12 of the 16 bytes are not initialized with anything let's ensure they're
sensibly zeroed out otherwise debugfs callers will read back garbage
(because they assume debugfs wrote sensible data back...)

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add primary tmz_c and meta tmz tmz_c.
Yongqiang Sun [Tue, 23 Jan 2018 22:21:43 +0000 (17:21 -0500)]
drm/amd/display: Add primary tmz_c and meta tmz tmz_c.

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>
6 years agodrm/amd/display: enable #PME code path for RV.
Charlene Liu [Mon, 29 Jan 2018 17:44:33 +0000 (12:44 -0500)]
drm/amd/display: enable #PME code path for RV.

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>
6 years agodrm/amd/display: dal 3.1.32
Tony Cheng [Thu, 25 Jan 2018 06:06:31 +0000 (01:06 -0500)]
drm/amd/display: dal 3.1.32

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>
6 years agodrm/amd/display: Optimize regamma calculations
Krunoslav Kovac [Fri, 19 Jan 2018 22:55:26 +0000 (17:55 -0500)]
drm/amd/display: Optimize regamma calculations

There are several optimizations:
1) Use predefined SRGB, don't calculate. This is the most common case.
2) Precompute HW X points at boot since they're fixed in ColModule
3) Precompute PQ - it never changes and is very CPU intensive in fixed pt.
4) Reduce number of points in ColModule to 512 (32x16) from 1024. This also
requires reducing some regions for legacy DCEs to 16 pts at most.

Performance
1) is super-fast, build_output_tf is 1-2us, down from 25000-30000.
Programming also fast since only one reg write.
2)+3) gives build_output_tf for PQ in ~100us range, down from ~80000-110000
2) + 4) results in slightly over 50% improvement. It gives an idea of the
savings when we can't use SRGB or PQ table (e.g. sdr white level > 80).

There's also a bit of refactoring: renaming some stuff that was misleading
and removing a lot of magic numbers that novices might not be able to
understand where they come from and what they mean.

Signed-off-by: Krunoslav Kovac <Krunoslav.Kovac@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>
6 years agodrm/amd/display: resume from S3 bypass power down HW block.
Charlene Liu [Wed, 24 Jan 2018 18:18:57 +0000 (13:18 -0500)]
drm/amd/display: resume from S3 bypass power down HW block.

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: add eDP 1.2+ polling for T7
Charlene Liu [Fri, 19 Jan 2018 00:09:06 +0000 (19:09 -0500)]
drm/amd/display: add eDP 1.2+ polling for T7

Signed-off-by: Charlene Liu <charlene.liu@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>
6 years agodrm/amd/display: dal 3.1.31
Tony Cheng [Wed, 24 Jan 2018 08:22:22 +0000 (03:22 -0500)]
drm/amd/display: dal 3.1.31

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>