sfrench/cifs-2.6.git
2 years agoMerge branch 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux into...
Dave Airlie [Thu, 16 Nov 2017 02:39:40 +0000 (12:39 +1000)]
Merge branch 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux into drm-next

Various fixes for DC for 4.15.

* 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux:
  drm/amd/display: fix MST link training fail division by 0
  drm/amd/display: Fix formatting for null pointer dereference fix
  drm/amd/display: Remove dangling planes on dc commit state
  drm/amd/display: add flip_immediate to commit update for stream
  drm/amd/display: Miss register MST encoder cbs
  drm/amd/display: Fix warnings on S3 resume
  drm/amd/display: use num_timing_generator instead of pipe_count
  drm/amd/display: use configurable FBC option in dm
  drm/amd/display: fix AZ clock not enabled before program AZ endpoint
  amdgpu/dm: Don't use DRM_ERROR in amdgpu_dm_atomic_check

2 years agodrm/amd/display: fix MST link training fail division by 0
Eric Yang [Wed, 1 Nov 2017 19:43:47 +0000 (15:43 -0400)]
drm/amd/display: fix MST link training fail division by 0

When link training fail in MST case, we will divide by 0
when calculating avg_time_slots_per_mtp, so we cannot
proceed.

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Fix formatting for null pointer dereference fix
Harry Wentland [Thu, 26 Oct 2017 06:17:42 +0000 (11:47 +0530)]
drm/amd/display: Fix formatting for null pointer dereference fix

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Remove dangling planes on dc commit state
Leo (Sunpeng) Li [Tue, 7 Nov 2017 18:21:02 +0000 (13:21 -0500)]
drm/amd/display: Remove dangling planes on dc commit state

When disabling pipe splitting, we need to make sure we disable both
planes used.

This should be done for Linux as well.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@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>
2 years agodrm/amd/display: add flip_immediate to commit update for stream
Bhawanpreet Lakha [Tue, 31 Oct 2017 18:39:36 +0000 (14:39 -0400)]
drm/amd/display: add flip_immediate to commit update for stream

This struct is not updated on page flip and causes vblank_mode
to not work as expected

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Miss register MST encoder cbs
Jerry (Fangzhi) Zuo [Fri, 3 Nov 2017 18:19:06 +0000 (14:19 -0400)]
drm/amd/display: Miss register MST encoder cbs

It is to fix: MST display failed to resume from S3

Need to properly setup MST encoder cbs. Otherwise drm_device
encoder doesn't register its own cbs, leading to NULL
encoder->funcs in drm_atomic_helper_resume().

Signed-off-by: Jerry (Fangzhi) 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>
2 years agodrm/amd/display: Fix warnings on S3 resume
Leo (Sunpeng) Li [Wed, 1 Nov 2017 20:49:14 +0000 (16:49 -0400)]
drm/amd/display: Fix warnings on S3 resume

This is a followup to the following revert:

Rex Zhu    Revert "drm/amd/display: Match actual state during S3
           resume."

Three things needed to be addressed:

1. Potential memory leak on dc_state creation in atomic_check during
   s3 resume
2. Warnings are now seen in dmesg during S3 resume
3. Since dc_state is now created in atomic_check, what the reverted
   patch was addressing needs to be reevaluated.

This change addresses the above:

1. Since the suspend procedure calls drm_atomic_state_clear, our hook
   for releasing the dc_state is called. This frees it before
   atomic_check creates it during resume. The leak does not occur.

2. The dc_crtc/plane_state references kept by the atomic states need to
   be released before calling atomic_check, which warns if they are
   non-null. This is because atomic_check is responsible for creating
   the dc_*_states. This is a special case for S3 resume, since the
   atomic state duplication that occurs during suspend also copies a
   reference to the dc_*_states.

3. See 2. comments are also updated to reflect this.

Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
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>
2 years agodrm/amd/display: use num_timing_generator instead of pipe_count
Ken Chalmers [Thu, 2 Nov 2017 14:45:12 +0000 (10:45 -0400)]
drm/amd/display: use num_timing_generator instead of pipe_count

The two are not necessarily the same.

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>
2 years agodrm/amd/display: use configurable FBC option in dm
Roman Li [Thu, 26 Oct 2017 22:43:58 +0000 (18:43 -0400)]
drm/amd/display: use configurable FBC option in dm

Replace ENABLE_FBC macro with config option CONFIG_DRM_AMD_DC_FBC
in dm. DC code has been already updated the same way.

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>
2 years agodrm/amd/display: fix AZ clock not enabled before program AZ endpoint
Charlene Liu [Wed, 25 Oct 2017 18:12:51 +0000 (14:12 -0400)]
drm/amd/display: fix AZ clock not enabled before program AZ endpoint

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>
2 years agoamdgpu/dm: Don't use DRM_ERROR in amdgpu_dm_atomic_check
Michel Dänzer [Thu, 9 Nov 2017 17:38:09 +0000 (18:38 +0100)]
amdgpu/dm: Don't use DRM_ERROR in amdgpu_dm_atomic_check

The atomic_check hook is expected to fail in some cases, e.g. if the
modeset operation requested by userspace cannot be performed, so it must
not spam dmesg on failure.

Fixes spurious

 [drm:amdgpu_dm_atomic_check [amdgpu]] *ERROR* Atomic state validation failed with error :-35 !

error messages on DPMS off with CONFIG_DEBUG_WW_MUTEX_SLOWPATH enabled.

While we're at it, fix up the existing DRM_DEBUG_DRIVER strings.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agoMerge branch 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux into...
Dave Airlie [Thu, 9 Nov 2017 02:01:08 +0000 (12:01 +1000)]
Merge branch 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux into drm-next

A bunch of smatch fixes for the dc code.

* 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux:
  amd/display: Fix potential null dereference in dce_calcs.c
  amdgpu/dm: Remove unused forward declaration
  drm/amdgpu: Remove unused dc_stream from amdgpu_crtc
  amdgpu/dc: Fix double unlock in amdgpu_dm_commit_planes
  amdgpu/dc: Fix missing null checks in amdgpu_dm.c
  amdgpu/dc: Fix potential null dereferences in amdgpu_dm.c
  amdgpu/dc: fix more indentation warnings
  amdgpu/dc: handle allocation failures in dc_commit_planes_to_stream.
  amdgpu/dc: fix indentation warning from smatch.
  amdgpu/dc: fix non-ansi function decls.
  drm/amd/display: remove some unneeded code
  drm/amd/display: checking for NULL instead of IS_ERR()
  drm/amd/display: small cleanup in destruct()

2 years agoamd/display: Fix potential null dereference in dce_calcs.c
Ernst Sjöstrand [Wed, 8 Nov 2017 21:47:06 +0000 (22:47 +0100)]
amd/display: Fix potential null dereference in dce_calcs.c

Reported by smatch:
bw_calcs() error: potential null dereference 'data'

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Ernst Sjöstrand <ernstp@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agoamdgpu/dm: Remove unused forward declaration
Harry Wentland [Wed, 8 Nov 2017 00:29:40 +0000 (19:29 -0500)]
amdgpu/dm: Remove unused forward declaration

dc_stream has long been renamed to dc_stream_state, so this
forward declaration hasn't been used at all.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amdgpu: Remove unused dc_stream from amdgpu_crtc
Harry Wentland [Wed, 8 Nov 2017 00:33:55 +0000 (19:33 -0500)]
drm/amdgpu: Remove unused dc_stream from amdgpu_crtc

It's no longer used. In fact, there is no more dc_stream object.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agoamdgpu/dc: Fix double unlock in amdgpu_dm_commit_planes
Ernst Sjöstrand [Tue, 7 Nov 2017 20:18:06 +0000 (21:18 +0100)]
amdgpu/dc: Fix double unlock in amdgpu_dm_commit_planes

Reported by smartch:
amdgpu_dm_commit_planes() error: double unlock 'spin_lock:&crtc->dev->event_lock'
amdgpu_dm_commit_planes() error: double unlock 'irqsave:flags'

The error path doesn't return so we only need a single unlock.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Ernst Sjöstrand <ernstp@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agoamdgpu/dc: Fix missing null checks in amdgpu_dm.c
Ernst Sjöstrand [Tue, 7 Nov 2017 20:06:59 +0000 (21:06 +0100)]
amdgpu/dc: Fix missing null checks in amdgpu_dm.c

From smatch:
error: we previously assumed X could be null

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Ernst Sjöstrand <ernstp@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agoamdgpu/dc: Fix potential null dereferences in amdgpu_dm.c
Ernst Sjöstrand [Tue, 7 Nov 2017 20:06:58 +0000 (21:06 +0100)]
amdgpu/dc: Fix potential null dereferences in amdgpu_dm.c

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Ernst Sjöstrand <ernstp@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agoamdgpu/dc: fix more indentation warnings
Ernst Sjöstrand [Tue, 7 Nov 2017 20:06:57 +0000 (21:06 +0100)]
amdgpu/dc: fix more indentation warnings

More "warn: inconsistent indenting" fixes from smatch.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Ernst Sjöstrand <ernstp@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agoamdgpu/dc: handle allocation failures in dc_commit_planes_to_stream.
Dave Airlie [Mon, 6 Nov 2017 19:21:18 +0000 (05:21 +1000)]
amdgpu/dc: handle allocation failures in dc_commit_planes_to_stream.

Reported-by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:966 dc_commit_planes_to_stream() error: potential null dereference 'flip_addr'.  (kcalloc returns null)
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:968 dc_commit_planes_to_stream() error: potential null dereference 'plane_info'.  (kcalloc returns null)
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:978 dc_commit_planes_to_stream() error: potential null dereference 'scaling_info'.  (kcalloc returns null)

Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agoamdgpu/dc: fix indentation warning from smatch.
Dave Airlie [Mon, 6 Nov 2017 19:30:47 +0000 (05:30 +1000)]
amdgpu/dc: fix indentation warning from smatch.

This fixes all the current smatch:
warn: inconsistent indenting

Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agoamdgpu/dc: fix non-ansi function decls.
Dave Airlie [Mon, 6 Nov 2017 19:17:12 +0000 (05:17 +1000)]
amdgpu/dc: fix non-ansi function decls.

smatch reported:
drivers/gpu/drm/amd/amdgpu/../display/dc/bios/dce80/command_table_helper_dce80.c:351:71: warning: non-ANSI function declaration of function 'dal_cmd_tbl_helper_dce80_get_table'
drivers/gpu/drm/amd/amdgpu/../display/dc/bios/dce110/command_table_helper_dce110.c:361:72: warning: non-ANSI function declaration of function 'dal_cmd_tbl_helper_dce110_get_table'
drivers/gpu/drm/amd/amdgpu/../display/dc/bios/dce112/command_table_helper_dce112.c:415:72: warning: non-ANSI function declaration of function 'dal_cmd_tbl_helper_dce112_get_table'
drivers/gpu/drm/amd/amdgpu/../display/dc/bios/dce112/command_table_helper2_dce112.c:415:73: warning: non-ANSI function declaration of function 'dal_cmd_tbl_helper_dce112_get_table2'
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_surface.c:148:34: warning: non-ANSI function declaration of function 'dc_create_gamma'
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_surface.c:178:50: warning: non-ANSI function declaration of function 'dc_create_transfer_func'

This fixes them.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: remove some unneeded code
Dan Carpenter [Mon, 6 Nov 2017 11:44:22 +0000 (14:44 +0300)]
drm/amd/display: remove some unneeded code

We assign "v_init = asic_blank_start;" a few lines earlier so there is
no need to do it again inside the if statements.  Also "v_init" is
unsigned so it can't be less than zero.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: checking for NULL instead of IS_ERR()
Dan Carpenter [Mon, 6 Nov 2017 11:43:41 +0000 (14:43 +0300)]
drm/amd/display: checking for NULL instead of IS_ERR()

backlight_device_register() never returns NULL, it returns error
pointers on error so the check here is wrong.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: small cleanup in destruct()
Dan Carpenter [Mon, 6 Nov 2017 07:07:33 +0000 (10:07 +0300)]
drm/amd/display: small cleanup in destruct()

Static analysis tools get annoyed that we don't indent this if
statement.  Actually, the if statement isn't required because kfree()
can handle NULL pointers just fine.  The DCE110STRENC_FROM_STRENC()
macro is a wrapper around container_of() but it's basically a no-op or a
cast.  Anyway, it's not really appropriate here so it should be removed
as well.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agoMerge branch 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux into...
Dave Airlie [Thu, 2 Nov 2017 19:32:08 +0000 (05:32 +1000)]
Merge branch 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux into drm-next

A few fixes for DC for 4.15.

* 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux:
  drm/amdgpu/display: fix integer arithmetic problem
  drm/amdgpu/display: remove unused REG_OFFSET macro
  drm/amdgpu/display: provide ASSERT macros unconditionally
  drm/amd/display: Read resource_straps from registers for DCE12
  drm/amd: Add DCE12 resource strap registers
  drm/amd/display: Explicitly call ->reset for each object
  drm/amd/display: Use single fail label in init_drm_dev
  drm/amd/display: Use plane pointer to avoid line breaks
  drm/amd/display: fix null pointer dereference
  amdgpu/dc: Avoid dereferencing NULL pointer
  drm/amd/display: Don't print error when bo_pin is interrupted
  drm/amd/display: Use constants from atom.h for HDMI caps read
  drm/amd/display: check if modeset is required before adding plane
  drm/amd/display: fix high part address in dm_plane_helper_prepare_fb()
  drm/amd/display : add high part address calculation for underlay
  drm/amd/display: Fix no display on Fiji
  Revert "drm/amd/display: Match actual state during S3 resume."

2 years agodrm/amdgpu/display: fix integer arithmetic problem
Arnd Bergmann [Thu, 2 Nov 2017 11:26:43 +0000 (12:26 +0100)]
drm/amdgpu/display: fix integer arithmetic problem

gcc warns about an ambiguous integer calculation:

drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c: In function 'calculate_bandwidth':
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:534:5: error: this decimal constant is unsigned only in ISO C90 [-Werror]
     data->lb_line_pitch = bw_ceil2(bw_mul(bw_div(bw_frc_to_fixed(2401171875100000000), bw_int_to_fixed(3)), bw_ceil2(data->source_width_in_lb, bw_int_to_fixed(8))), bw_int_to_fixed(48));
     ^~~~

Marking the constant as explicitly unsigned makes it work fine everywhere
without warnings.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amdgpu/display: remove unused REG_OFFSET macro
Arnd Bergmann [Thu, 2 Nov 2017 11:26:42 +0000 (12:26 +0100)]
drm/amdgpu/display: remove unused REG_OFFSET macro

The name conflicts with another macro of the same name on the ARM ixp4xx
platform, leading to build errors.
Neither of the users actually should use a name that generic, but the
other one was here first and the dc driver doesn't actually use it.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amdgpu/display: provide ASSERT macros unconditionally
Arnd Bergmann [Thu, 2 Nov 2017 14:24:40 +0000 (15:24 +0100)]
drm/amdgpu/display: provide ASSERT macros unconditionally

It seems impossible to build this driver without setting either
CONFIG_DEBUG_KERNEL or CONFIG_DEBUG_DRIVER:

drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h: In function 'set_reg_field_value_ex':
drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:132:2: error: implicit declaration of function 'ASSERT'; did you mean 'IS_ERR'? [-Werror=implicit-function-declaration]

This moves the ASSERT() macro and related helpers outside of
the #ifdef to get it to build again.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Read resource_straps from registers for DCE12
Leo (Sunpeng) Li [Wed, 1 Nov 2017 14:24:51 +0000 (10:24 -0400)]
drm/amd/display: Read resource_straps from registers for DCE12

Now that the registers exist, assign them to the resource_straps struct.

v2: Fix indentation
v3: Fix trailing whitespace and checkpatch warnings.

bug: https://bugs.freedesktop.org/show_bug.cgi?id=103404
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>
2 years agodrm/amd: Add DCE12 resource strap registers
Leo (Sunpeng) Li [Tue, 31 Oct 2017 20:28:57 +0000 (16:28 -0400)]
drm/amd: Add DCE12 resource strap registers

We need them for initializing audio properly.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Explicitly call ->reset for each object
Harry Wentland [Fri, 20 Oct 2017 12:43:40 +0000 (08:43 -0400)]
drm/amd/display: Explicitly call ->reset for each object

We need to avoid calling reset after detection because the next
commit adds freesync properties on the atomic_state which are set
during detection. Calling reset after this clears them.

The easiest way to accomplish this right now is to call ->reset on
the connector right after creation but before detection. To stay
consistent call ->reset on every other object as well after creation.

v2: Provide better reason for this change in commit msg.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Use single fail label in init_drm_dev
Harry Wentland [Fri, 20 Oct 2017 12:28:59 +0000 (08:28 -0400)]
drm/amd/display: Use single fail label in init_drm_dev

No need for multiple labels as kfree will always do a NULL check
before freeing the memory.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Use plane pointer to avoid line breaks
Harry Wentland [Fri, 20 Oct 2017 12:42:41 +0000 (08:42 -0400)]
drm/amd/display: Use plane pointer to avoid line breaks

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Mikita Lipski <Mikita.Lipski@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: fix null pointer dereference
Shirish S [Thu, 26 Oct 2017 06:17:42 +0000 (11:47 +0530)]
drm/amd/display: fix null pointer dereference

While setting cursor position in case of mpo,
input_pixel_processor is not available for underlay,
hence add check of the same to avoid null pointer
access issue.

Signed-off-by: Shirish S <shirish.s@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>
2 years agoamdgpu/dc: Avoid dereferencing NULL pointer
Drew Davenport [Fri, 27 Oct 2017 18:34:46 +0000 (12:34 -0600)]
amdgpu/dc: Avoid dereferencing NULL pointer

crtc is dereferenced from within drm_atomic_get_new_crtc_state, so
check for NULL before initializing new_crtc_state.

Signed-off-by: Drew Davenport <ddavenport@chromium.org>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Don't print error when bo_pin is interrupted
Harry Wentland [Thu, 26 Oct 2017 19:35:14 +0000 (15:35 -0400)]
drm/amd/display: Don't print error when bo_pin is interrupted

v2: Also don't print for ERESTARTSYS or EAGAIN
v3: Best practice is to only ignore ERESTARTSYS

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Use constants from atom.h for HDMI caps read
Andrew Jiang [Fri, 20 Oct 2017 20:40:45 +0000 (16:40 -0400)]
drm/amd/display: Use constants from atom.h for HDMI caps read

Get rid of the constant we copied over before and just directly use the
constants from the file.

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>
3 years agodrm/amd/display: check if modeset is required before adding plane
Shirish S [Fri, 27 Oct 2017 03:25:55 +0000 (03:25 +0000)]
drm/amd/display: check if modeset is required before adding plane

Adding affected planes without checking if modeset is requested from the user space causes performance regression in video p/b scenarios when full screen p/b is not composited.

Hence add a check before adding a plane as affected.

bug: https://bugs.freedesktop.org/show_bug.cgi?id=103408

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Shirish S <shirish.s@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: fix high part address in dm_plane_helper_prepare_fb()
Shirish S [Thu, 26 Oct 2017 10:45:01 +0000 (16:15 +0530)]
drm/amd/display: fix high part address in dm_plane_helper_prepare_fb()

The high part calculation of luma and chroma address' was
missing in dm_plane_helper_prepare_fb().

This fix brings uniformity in the address' at atomic_check
and atomic_commit for both RGB & YUV planes.

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display : add high part address calculation for underlay
Shirish S [Thu, 19 Oct 2017 17:04:15 +0000 (22:34 +0530)]
drm/amd/display : add high part address calculation for underlay

Currently the high part of the address structure is not
populated in case of luma and chroma.
This patch adds this calculation.

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix no display on Fiji
Jerry Zuo [Tue, 17 Oct 2017 19:36:13 +0000 (15:36 -0400)]
drm/amd/display: Fix no display on Fiji

Allocate memory for the second pipe allocate_mem_input() needs to
be done prior to program pipe front end. It shows sensitive to
Fiji. Failure to do so will cause error in allocate memory 
allocate_mem_input() on the second connected display.

Signed-off-by: Jerry Zuo <Jerry.Zuo@amd.com>
Signed-off-by: Yongqiang Sun <yongqiang.sun@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>
3 years agoRevert "drm/amd/display: Match actual state during S3 resume."
Rex Zhu [Thu, 26 Oct 2017 04:03:27 +0000 (00:03 -0400)]
Revert "drm/amd/display: Match actual state during S3 resume."

This reverts commit 4f346e655d24140fb40b46f814506ba17ac34ea1.

fix s3 hang issue.

Acked-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>
3 years agoMerge branch 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux into...
Dave Airlie [Mon, 23 Oct 2017 01:17:54 +0000 (11:17 +1000)]
Merge branch 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux into drm-next

Last batch of new stuff for DC. Highlights:
- Fix some memory leaks
- S3 fixes
- Hotplug fixes
- Fix some CX multi-display issues
- MST fixes
- DML updates from the hw team
- Various code cleanups
- Misc bug fixes

* 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux: (155 commits)
  drm/amd/display:: Fix NULL pointer in Raven hotplug
  drm/amd/display: Fix memoryleak during S3 resume.
  drm/amd/display: add hardware_planes_only to list of affected planes
  drm/amd/display: Fix brace style
  drm/amd/display: Remove needless cast in amdgpu_dm_connector_init()
  drm/amd/display: Fix brace style in amdgpu_dm_connector_ddc_get_modes()
  drm/amd/display: Tidy up dm_drm_plane_reset()
  drm/amd/display: Fix indentation in create_eml_sink()
  drm/amd/display: Replace block with strncpy() in fill_audio_info()
  drm/amd/display: Fix brace style in amdgpu_dm_initialize_drm_device()
  drm/amd/display: Simplify handle_hpd_rx_irq()
  drm/amd/display: Fix brace style in dm_handle_hpd_rx_irq()
  drm/amd/display: Fix brace style in amdgpu_dm_update_connector_after_detect()
  drm/amd/display: Fix indentation in dm_resume()
  drm/amd/display: Fix indentation in dm_suspend()
  drm/amd/display: Simplify dm_late_init()
  amdgpu/dc: inline dml_round_to_multiple
  amdgpu/dc: drop dml_util_is_420
  drm/amd/display: Add bunch of missing license headers in DML
  amdgpu/dc: inline a bunch of the dml wrappers.
  ...

3 years agodrm/amd/display:: Fix NULL pointer in Raven hotplug
Jerry (Fangzhi) Zuo [Fri, 20 Oct 2017 20:45:53 +0000 (16:45 -0400)]
drm/amd/display:: Fix NULL pointer in Raven hotplug

Programming sequence to frontend and backend has been switched.
In such case, program_scaler() is getting called when programming
frontend, and should be removed from backend programming routine.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Jerry (Fangzhi) Zuo <Jerry.Zuo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix memoryleak during S3 resume.
Leo (Sunpeng) Li [Fri, 20 Oct 2017 17:59:53 +0000 (13:59 -0400)]
drm/amd/display: Fix memoryleak during S3 resume.

Do not create dc_state within display_resume, since it's being
constructed within atomic check.

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>
3 years agodrm/amd/display: add hardware_planes_only to list of affected planes
Shirish S [Wed, 27 Sep 2017 09:45:38 +0000 (15:15 +0530)]
drm/amd/display: add hardware_planes_only to list of affected planes

For SoC's having software designed cursor plane,
should be treated differently than hardware cursor planes.

The DRM core initializes cursor plane by default with
legacy_cursor_update set.

Hence legacy_cursor_update can be use effectively
to handle software cursor planes' update and atomicity
functionalities.

This patch uses this variable to decide in the atomic_check
to whether add a requested plane to the list of affected planes or
not, hence fixing the issue of co-existence of MPO, i.e,
setting of available hardware planes like underlay and
updation of cursor planes as well.

Without this patch when underlay is set from user space,
only blank screen with backlight is visible.

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix brace style
Tom St Denis [Tue, 17 Oct 2017 16:13:39 +0000 (12:13 -0400)]
drm/amd/display: Fix brace style

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Remove needless cast in amdgpu_dm_connector_init()
Tom St Denis [Tue, 17 Oct 2017 14:40:08 +0000 (10:40 -0400)]
drm/amd/display: Remove needless cast in amdgpu_dm_connector_init()

The cast of dc_link is redundant.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix brace style in amdgpu_dm_connector_ddc_get_modes()
Tom St Denis [Tue, 17 Oct 2017 14:38:27 +0000 (10:38 -0400)]
drm/amd/display: Fix brace style in amdgpu_dm_connector_ddc_get_modes()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Tidy up dm_drm_plane_reset()
Tom St Denis [Tue, 17 Oct 2017 14:16:39 +0000 (10:16 -0400)]
drm/amd/display: Tidy up dm_drm_plane_reset()

Move WARN_ON higher up and in doing so fix brace style.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix indentation in create_eml_sink()
Tom St Denis [Tue, 17 Oct 2017 14:15:12 +0000 (10:15 -0400)]
drm/amd/display: Fix indentation in create_eml_sink()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Replace block with strncpy() in fill_audio_info()
Tom St Denis [Tue, 17 Oct 2017 13:46:54 +0000 (09:46 -0400)]
drm/amd/display: Replace block with strncpy() in fill_audio_info()

Replace inlined strncpy with library call.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix brace style in amdgpu_dm_initialize_drm_device()
Tom St Denis [Tue, 17 Oct 2017 13:09:42 +0000 (09:09 -0400)]
drm/amd/display: Fix brace style in amdgpu_dm_initialize_drm_device()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Simplify handle_hpd_rx_irq()
Tom St Denis [Tue, 17 Oct 2017 13:04:25 +0000 (09:04 -0400)]
drm/amd/display: Simplify handle_hpd_rx_irq()

There is a local reference to the dc_link that wasn't being
used so we shorten references throughout the function.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix brace style in dm_handle_hpd_rx_irq()
Tom St Denis [Tue, 17 Oct 2017 13:00:33 +0000 (09:00 -0400)]
drm/amd/display: Fix brace style in dm_handle_hpd_rx_irq()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix brace style in amdgpu_dm_update_connector_after_detect()
Tom St Denis [Tue, 17 Oct 2017 12:59:18 +0000 (08:59 -0400)]
drm/amd/display: Fix brace style in amdgpu_dm_update_connector_after_detect()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix indentation in dm_resume()
Tom St Denis [Tue, 17 Oct 2017 12:49:13 +0000 (08:49 -0400)]
drm/amd/display: Fix indentation in dm_resume()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix indentation in dm_suspend()
Tom St Denis [Tue, 17 Oct 2017 12:48:44 +0000 (08:48 -0400)]
drm/amd/display: Fix indentation in dm_suspend()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Simplify dm_late_init()
Tom St Denis [Tue, 17 Oct 2017 12:47:25 +0000 (08:47 -0400)]
drm/amd/display: Simplify dm_late_init()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Andrey Grodzovsky <andey.grodzovsky@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoamdgpu/dc: inline dml_round_to_multiple
Dave Airlie [Fri, 29 Sep 2017 07:13:31 +0000 (17:13 +1000)]
amdgpu/dc: inline dml_round_to_multiple

turns out to be a win to inline this.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoamdgpu/dc: drop dml_util_is_420
Dave Airlie [Thu, 28 Sep 2017 00:55:25 +0000 (10:55 +1000)]
amdgpu/dc: drop dml_util_is_420

This is unused code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Add bunch of missing license headers in DML
Harry Wentland [Tue, 17 Oct 2017 02:58:18 +0000 (22:58 -0400)]
drm/amd/display: Add bunch of missing license headers in DML

All files should have MIT headers.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoamdgpu/dc: inline a bunch of the dml wrappers.
Harry Wentland [Thu, 28 Sep 2017 00:45:26 +0000 (10:45 +1000)]
amdgpu/dc: inline a bunch of the dml wrappers.

This reduces the code size.

This is basically a redo of Dave's change with the same name
on top of the latest DML.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Small comment on dc_commit_planes_to_stream
Harry Wentland [Tue, 17 Oct 2017 00:10:00 +0000 (20:10 -0400)]
drm/amd/display: Small comment on dc_commit_planes_to_stream

Having one struct on the stack was somewhat confusing. Also mention
that the whole function should eventually go.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Minor update to DML
Dmytro Laktyushkin [Fri, 13 Oct 2017 02:45:25 +0000 (22:45 -0400)]
drm/amd/display: Minor update to DML

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>
3 years agodrm/amd/display: change dml numdpp var to uint
Dmytro Laktyushkin [Fri, 13 Oct 2017 16:53:38 +0000 (12:53 -0400)]
drm/amd/display: change dml numdpp var to uint

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>
3 years agodrm/amd/display: default force_single_disp_pipe_split = 1 on RV
Tony Cheng [Thu, 5 Oct 2017 18:38:46 +0000 (14:38 -0400)]
drm/amd/display: default force_single_disp_pipe_split = 1 on RV

1080p idle, stutter efficiency goes up from 95.8% to 97.8%
result in 5mW saving from APU and 8mW saving from DDR4

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>
3 years agodrm/amd/display: Remove redundant condition in dml vba
Harry Wentland [Fri, 13 Oct 2017 19:12:04 +0000 (15:12 -0400)]
drm/amd/display: Remove redundant condition in dml vba

Found by 0-day
https://lists.freedesktop.org/archives/dri-devel/2017-October/154698.html

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-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>
3 years agodrm/amd/display: dal 3.1.07
Tony Cheng [Fri, 13 Oct 2017 02:18:12 +0000 (22:18 -0400)]
drm/amd/display: dal 3.1.07

- regression fixes in dal 3.1.06
- more linux upstream backport

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>
3 years agodrm/amd/display: Reduce stack size of commit_planes_to_stream
Harry Wentland [Thu, 12 Oct 2017 18:15:26 +0000 (14:15 -0400)]
drm/amd/display: Reduce stack size of commit_planes_to_stream

This function likes to blow 1024 stack size when something is
added to the addr struct. For now just dynamically allocate.

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>
3 years agodrm/amd/display: Fix one more place for dc_stream_state leak
Harry Wentland [Tue, 12 Sep 2017 16:10:25 +0000 (17:10 +0100)]
drm/amd/display: Fix one more place for dc_stream_state leak

One more thing that happened due to uneven applying of patches. This
mirrors what Darren Salt fixed.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Move OS types to os_types.h
Harry Wentland [Thu, 12 Oct 2017 16:27:48 +0000 (12:27 -0400)]
drm/amd/display: Move OS types to os_types.h

Some of this stuff is not really dm_services

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>
3 years agodrm/amd/display: LGD panel willl flash line under window
Hersen Wu [Tue, 10 Oct 2017 20:28:02 +0000 (16:28 -0400)]
drm/amd/display: LGD panel willl flash line under window

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>
3 years agodrm/amd/display: DAL 3.1.06
Tony Cheng [Thu, 12 Oct 2017 14:59:42 +0000 (10:59 -0400)]
drm/amd/display: DAL 3.1.06

Raven bug fixes
- RS3 MPO stability improvement
- SLS fixes
- AM4 fixes

DAL 3.1
- merge in upstream patches from DRM maintainer Dave Arilie
- hubp, dpp HW objects

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>
3 years agodrm/amd/display: rename dscl functions
Yue Hin Lau [Tue, 10 Oct 2017 21:58:41 +0000 (17:58 -0400)]
drm/amd/display: rename dscl functions

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>
3 years agodrm/amd/display: WA for 3 display play video hot plug.
Yongqiang Sun [Tue, 10 Oct 2017 18:01:33 +0000 (14:01 -0400)]
drm/amd/display: WA for 3 display play video hot plug.

Three monitor connected and playing a video will
occupy all 4 pipes, if hot plug forth display,
commit streams will be failed due to no free pipe
can be found.
Work around:
When forth monitor connected, mark video plane as
a fake plane, remove it in dc, keep it in dm and
report address to OS, until OS turn off MPO.

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>
3 years agodrm/amd/display: Add DIGD case when getting retimer settings
Andrew Jiang [Wed, 11 Oct 2017 19:12:58 +0000 (15:12 -0400)]
drm/amd/display: Add DIGD case when getting retimer settings

One of the HDMI ports map to DIGD, which we did not map to DP3 ext
HDMI settings. Add the DIGD case so that we can get proper retimer
settings from SBIOS for that port.

Signed-off-by: Andrew Jiang <Andrew.Jiang@amd.com>
Reviewed-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>
3 years agodrm/amd/display: Add chip mask to HDMI retimer/redriver check
Andrew Jiang [Wed, 11 Oct 2017 18:59:51 +0000 (14:59 -0400)]
drm/amd/display: Add chip mask to HDMI retimer/redriver check

There were cases where the chip caps held additional bits that led to
the retimer/redriver check failing; use the proper mask to ensure that
we have only the bits that we care about for the check in question.

Signed-off-by: Andrew Jiang <Andrew.Jiang@amd.com>
Reviewed-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>
3 years agodrm/amd/display: Correct timings in build scaling params
Andrew Jiang [Tue, 10 Oct 2017 18:36:39 +0000 (14:36 -0400)]
drm/amd/display: Correct timings in build scaling params

A previous patch set the addressable timing as active + border,
when in fact, the VESA standard specifies active as equal to
addressable + border.

This patch makes the fix more correct and in line with the standard.

Signed-off-by: Andrew Jiang <Andrew.Jiang@amd.com>
Reviewed-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>
3 years agodrm/amd/display: check SR_WATERMARK regs prior to write
Eric Bernstein [Wed, 11 Oct 2017 19:14:46 +0000 (15:14 -0400)]
drm/amd/display: check SR_WATERMARK regs prior to write

Signed-off-by: Eric Bernstein <eric.bernstein@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>
3 years agodrm/amd/display: drop display_pipe_clocks.c.
Dave Airlie [Thu, 28 Sep 2017 00:10:22 +0000 (10:10 +1000)]
drm/amd/display: drop display_pipe_clocks.c.

This code isn't used at all in the kernel tree, perhaps it can wait to
be imported when it is. It also does a lot of floating point calcs,
so probably good to drop it until it's needed and we can ensure
proper fpu accessors.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix up some whitespace in handle_cursor_update
Harry Wentland [Wed, 13 Sep 2017 00:04:48 +0000 (20:04 -0400)]
drm/amd/display: Fix up some whitespace in handle_cursor_update

Use combo of tabs and spaces

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@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>
3 years agodrm/amd/display: Fix warning about uninitialized variable
Harry Wentland [Wed, 4 Oct 2017 17:54:35 +0000 (13:54 -0400)]
drm/amd/display: Fix warning about uninitialized variable

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>
3 years agodrm/amd/display: Don't set cursor address is 0 logging as errors
Andrew Jiang [Fri, 6 Oct 2017 22:02:23 +0000 (18:02 -0400)]
drm/amd/display: Don't set cursor address is 0 logging as errors

This actually happens quite a bit, and having it as an error causes
false positive messages when running tests.

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>
3 years agodrm/amd/display: fix ifnullfree.cocci warnings
kbuild test robot [Thu, 12 Oct 2017 23:17:48 +0000 (07:17 +0800)]
drm/amd/display: fix ifnullfree.cocci warnings

drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:134:3-8: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:175:4-9: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: f09cd1f46388 ("drm/amd/display: Use kernel alloc/free")
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/dc: fix semicolon.cocci warnings
kbuild test robot [Thu, 12 Oct 2017 23:35:54 +0000 (07:35 +0800)]
drm/amd/dc: fix semicolon.cocci warnings

drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:134:2-3: Unneeded semicolon

 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

Fixes: 80be23c57868 ("drm/amd/dc: Add dc display driver (v2)")
CC: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix warning about overflow
Harry Wentland [Tue, 10 Oct 2017 15:23:50 +0000 (11:23 -0400)]
drm/amd/display: Fix warning about overflow

v2: convert value to bool using !!

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>
3 years agodrm/amd/display: Fix non-DCN build
Harry Wentland [Fri, 13 Oct 2017 16:42:01 +0000 (12:42 -0400)]
drm/amd/display: Fix non-DCN build

Acquire_first_split_pipe only makes sense for DCN.

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>
3 years agodrm/amd/display: ASSERT on dc_create_state failing.
Leo (Sunpeng) Li [Fri, 6 Oct 2017 19:11:41 +0000 (15:11 -0400)]
drm/amd/display: ASSERT on dc_create_state failing.

dc_create_state() returns NULL on allocation failure. Raise warning when
that happens.

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>
3 years agodrm/amd/display: Report stream as different on scaling change
Leo (Sunpeng) Li [Fri, 6 Oct 2017 15:57:40 +0000 (11:57 -0400)]
drm/amd/display: Report stream as different on scaling change

When scaling is enabled, our preference is to scale up to the prefered
(native) mode. This means that hardware timings will be the same across
a modeset.

Therefore, also report mode as changed if source or destination
rectangle is different.

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>
3 years agodrm/amd/display: Set addressable region as active + border
Dmytro Laktyushkin [Thu, 5 Oct 2017 23:15:25 +0000 (19:15 -0400)]
drm/amd/display: Set addressable region as active + border

This ensures that we do not draw the blank region onscreen, and that we
do underscan instead.

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>
3 years agodrm/amd/display: add performance trace macro to dc
Dmytro Laktyushkin [Fri, 6 Oct 2017 19:40:07 +0000 (15:40 -0400)]
drm/amd/display: add performance trace macro to dc

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>
3 years agodrm/amd/display: Remove a false-positive error message
Jerry Zuo [Fri, 6 Oct 2017 19:08:07 +0000 (15:08 -0400)]
drm/amd/display: Remove a false-positive error message

To avoid confusion, need to suppress the error message when get
-ERESTARTSYS error code. It is normal when getting interrupted
by signals in the process of a wait for the buffer to become
unreserved. Only propagate to user-mode for further action,
no need to pop up error message.

Signed-off-by: Jerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Sun peng Li <Sunpeng.Li@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Do not set bandwidth on page flips.
Leo (Sunpeng) Li [Wed, 4 Oct 2017 16:47:13 +0000 (12:47 -0400)]
drm/amd/display: Do not set bandwidth on page flips.

Which removes a lockdep warning for a possible deadlock situation:

While holding the drm event mutex (hard irq safe),
dc_post_update_surfaces_to_stream eventually acquires the atom context
lock, which is hard irq unsafe. We should only be calling it on full
updates anyways.

Also remove a redundant call to dc_post_update_surfaces_to_stream,
dc_commit_updates_for_stream already calls it.

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>
3 years agodrm/amd/display: rename transform to dpp for dcn
Yue Hin Lau [Thu, 5 Oct 2017 20:47:49 +0000 (16:47 -0400)]
drm/amd/display: rename transform to dpp for dcn

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Eric Bernstein <Eric.Bernstein@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: add null check for cursor functions
Yue Hin Lau [Thu, 5 Oct 2017 21:57:35 +0000 (17:57 -0400)]
drm/amd/display: add null check for cursor functions

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>
3 years agodrm/amd/display: fix null dereference in reset hw ctx
Eric Yang [Thu, 5 Oct 2017 20:00:29 +0000 (16:00 -0400)]
drm/amd/display: fix null dereference in reset hw ctx

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>
3 years agodrm/amd/display: Fix a logic defect in cursor move
Jerry Zuo [Thu, 5 Oct 2017 19:37:46 +0000 (15:37 -0400)]
drm/amd/display: Fix a logic defect in cursor move

Regression caused by: Ib98354194d7

Need to check crtc->stream before updating cursor attributes
and position.

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>
3 years agodrm/amd/display: [RV] bug in cm programming
Vitaly Prosyak [Thu, 5 Oct 2017 15:45:50 +0000 (10:45 -0500)]
drm/amd/display: [RV] bug in cm programming

When surface bigger then 10 bpc the output pixel
does not match to the required value.Update CRC's.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Jordan Lazare <Jordan.Lazare@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>