Skip to contentSkip to conversation

DC Patches Aug 9, 2017

PATCH In review Harry Wentland 2 participants 122 messages Aug 9, 2017 – Aug 10, 2017 2 messages not in the archive Page 1 of 2

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover DC Patches Aug 9, 2017

A whole lot of stuff this time around because it's Raven crunchtime and a bunch of us found time to keep massaging DC in DRM's image.

* Bunch more work to align DC with DRM
* Flattened most core/dc objects
* dc_surface is now dc_plane_state
* dc_stream is now dc_stream_state (aka crtc_state)
* Started work on dividing pipe_ctx into per-plane and per-stream ctx
* Per-plane & per-stream validation
* Align some DCN HW objects better with actual HW
* Merged amdgpu_dm_types.c with amdgpu_dm.c
* Add a couple missing register defines
* Bunch of fixes, mostly for Raven

AMD\ktsao (1):
drm/amd/display: remove DCN1 guard as DCN1 is already open sourced.

Andrey Grodzovsky (7):
drm/amd/display: Move stream validations into seperate function. drm/amd/display: Use stream validation hook. drm/amd/display: Add per surface validation hook. drm/amd/display: add preferred mode from Video Format Preference Data
Block
drm/amd/display: Implement plane atomic_check. drm/amd/display: Add stateless surface validation to
validate_resources
drm/amd/display: fix >340 Mhz with deep color pipe split no display

Anthony Koo (1):
drm/amd/display: implement DXGI Gamma Ramps

Bhawanpreet Lakha (3):
drm/amd/display: Move and Rename "is_stream_changed()" drm/amd/display: Avoid full modeset when not required drm/amd/display: Fix comment placement for when new_stream is null

Charlene Liu (7):
drm/amd/display: fix YCbCr420 deep color mode not supported drm/amd/display: single PSR display not allow CSTATE sw w/a drm/amd/display: fix PHYCLK in formula. drm/amd/display: fix PHYCLK in formula. drm/amd/display: update predefined latency for Rv1_F0 drm/amd/display: fix dlg ttu calculation input drm/amd/display: fix eDP power down sequence

Corbin McElhanney (4):
drm/amd/display: Add more pstate sanity checks drm/amd/display: Fix accessing freed memory drm/amd/display: Fix hw state logging regression drm/amd/display: fix HDMI 12bits last two bits are zero issue

Ding Wang (1):
drm/amd/display: fix decide_link_settings

Dmytro Laktyushkin (10):
drm/amd/display: fix dcn10_resource read_dce_straps drm/amd/display: update dcn register headers drm/amd/display: revert dcn10 soc defaults to 17 19 drm/amd/display: support for updated register headers on DCN drm/amd/display: collapse dce11 reset_hw_ctx_wrap into 1 function drm/amd/display: mpc block redesign
drm/amd/display: fix mpcc idle wait
drm/amd/display: fix dcn fe reset memory access error drm/amd/display: fix bw_calc for hdmi and 420 outputs drm/amd/display: do not report min_memory_clock_khz to pplib for dce8

    & 10

Eric Yang (8):
drm/amd/display: fix locking in apply_ctx_for_surface drm/amd/display: Fix generic_reg_wait 1000ms case drm/amd/display: add idle wait for passive surface update and modeset drm/amd/display: add missing func for dce11o to avoid crash drm/amd/display: break up plane disable and disconnect in set mode drm/amd/display: reduce 40s time out to 1s in disable crtc drm/amd/display: update clocks we report to PPlib drm/amd/display: add programming for 0 plane case

Harry Wentland (38):
drm/amd/include: Add DC_PINSTRAPS.AUDIO defines drm/amd/include: Add DCHUBBUB_TEST_DEBUG register defines drm/amd: Add missing SURFACE_TMZ register shift/mask drm/amd/display: Roll surface struct into core_surface drm/amd/display: Roll core_surface into dc_surface drm/amd/display: Roll core_link into dc_link drm/amd/display: Roll sink struct into core_sink drm/amd/display: Roll core_sink into dc_sink
Revert "drm/amd/display: Roll core_sink into dc_sink" drm/amd/display: Roll core_sink into dc_sink drm/amd/display: Roll gamma struct into core_gamma drm/amd/display: Roll core_gamma into dc_gamma drm/amd/display: Minor fix for dc_link refactor drm/amd/display: Minor fix for dc_sink refactor drm/amd/display: Fix compilation with DCN disabled drm/amd/display: Rename firmware_info to dc_firmware_info drm/amd/display: Merge amdgpu_dm_types and amdgpu_dm drm/amd/display: Fix ckeckpatch problems in amdgpu_dm drm/amd/display: Rename dc_surface to dc_plane_state drm/amd/display: Rename dc_stream to dc_stream_state drm/amd/display: Rename more dc_surface stuff to plane_state drm/amd/display: Remove struct from stack in dp_set_test_pattern drm/amd/display: Stub new resource objects drm/amd/display: Move scl_data to plane_res drm/amd/display: Move mi, ipp, xfm to plane_res drm/amd/display: Move OPP to stream_res drm/amd/display: Move TG to stream_res drm/amd/display: Move stream_enc to stream_res drm/amd/display: Move audio to stream_res drm/amd/display: Move pix_clk_params into stream_res drm/amd/display: Move encoder_info_frame to stream_res drm/amd/display: Fix plane_atomic_check when no dc_state drm/amd/display: Clean up cursor code drm/amd/display: Use public plane destroy helper drm/amd/display: Couple newline fixes drm/amd/display: Fix regression in dce110_apply_ctx_for_surfaces drm/amd/display: Pass correct number for gamma entries drm/amd/display: Fix warnings about uninitialized use

Jerry Zuo (1):
drm/amd/display: Add surface to dm_plane_state if fb reserve fails

Kenny Tsao (1):
drm/amd/display: remove remaining DCN1 guard

Leo (Sunpeng) Li (2):
drm/amd/display: Roll core_stream into dc_stream drm/amd/display: Roll stream into dc_stream

Roman Li (6):
drm/amd/display: fix index and union overwrite in compressor drm/amd/display: Fix eDP panel light-up drm/amd/display: safeguard compressor api drm/amd/display: add detect caps for edp drm/amd/display: Initial prototype of FBC implementation drm/amd/display: Initial prototype of FBC implementation

Tony Cheng (12):
drm/amd/display: register programming consolidation drm/amd/display: plumbing to allow easy print of HW state for DTN drm/amd/display: mpo debug sanity checks
drm/amd/display: mpcc disconnect and pipe pg in multi-display drm/amd/display: move VGA to HWSS from TG drm/amd/display: move ocsc programming from opp to dpp drm/amd/display: separate plane disable sequence drm/amd/display: log HUBP using DTN logging drm/amd/display: log HW state when we about to encounter DF DPM hang drm/amd/display: log underflow
drm/amd/display: use some sensible time out drm/amd/display: log watermarks

Vikrant Mhaske (1):
drm/amd/display: Fix DCN compile errors

Vitaly Prosyak (1):
drm/amd/display: Add interfaces for new CM blocks

Wenjing Liu (2):
drm/amd/display: Return hpd_irq_dpcd from hpd_rx handler drm/amd/display: Move verify link cap after read edid

Wesley Chalmers (1):
drm/amd/display: Change DTN_INFO macro

Yongqiang Sun (5):
drm/amd/display: Disable timestamp and entry heading drm/amd/display: Keep blank until set visibility to true after mode
switch
drm/amd/display: Implement tmz surface.
drm/amd/display: Clear water mark change request bit before
programing.
drm/amd/display: Workaround for underflow.

Yue Hin Lau (4):
drm/amd/display: move RGAM programming from opp to dpp drm/amd/display: move ocsc programming from opp to dpp drm/amd/display: move ocsc programming from opp to dpp for dce drm/amd/display: move regamma from opp to dpp for dce

Zeyu Fan (4):
drm/amd/display: Set i2c speed to 100khz for DCE11.2 and later. drm/amd/display: Implement logic for hdmi info packet bits. drm/amd/display: Move DCHUBBUB block from MemInput to HW sequencer. drm/amd/display: Clean up some DCN1 guards

 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h           |    6 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/Makefile     |    2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  | 3437 ++++++++++++++++++-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h  |  120 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c  |   16 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |    2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_services.c |    1 -
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 3445 --------------------
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h    |  135 -
 .../gpu/drm/amd/display/dc/basics/log_helpers.c    |   28 -
 drivers/gpu/drm/amd/display/dc/bios/bios_parser.c  |   14 +-
 drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c |    8 +-
 .../amd/display/dc/bios/command_table_helper2.c    |    1 +
 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c   |   72 +-
 .../gpu/drm/amd/display/dc/calcs/dcn_calc_auto.c   |   13 +-
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c   |  337 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  532 +--
 drivers/gpu/drm/amd/display/dc/core/dc_debug.c     |  196 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      |  380 +--
 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c  |    6 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   |  430 ++-
 drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c |   67 +-
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |  740 +++--
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c      |   52 +-
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    |  178 +-
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   |  124 +-
 drivers/gpu/drm/amd/display/dc/dc.h                |  312 +-
 drivers/gpu/drm/amd/display/dc/dc_bios_types.h     |    2 +-
 drivers/gpu/drm/amd/display/dc/dc_ddc_types.h      |    2 +-
 drivers/gpu/drm/amd/display/dc/dc_helper.c         |   13 +-
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h       |   29 +-
 drivers/gpu/drm/amd/display/dc/dc_types.h          |   35 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.c       |   11 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.h       |   91 +-
 .../gpu/drm/amd/display/dc/dce/dce_clock_source.c  |    6 +-
 .../gpu/drm/amd/display/dc/dce/dce_clock_source.h  |    2 -
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c    |    4 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c      |    8 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.h      |   20 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.c     |    8 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h     |  161 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c       |   14 +-
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c  |   17 +-
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.h  |   17 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c |   54 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.c       |  438 +--
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.h       |  144 +-
 .../drm/amd/display/dc/dce/dce_stream_encoder.h    |    6 -
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.c |  450 +++
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.h |  118 +
 .../amd/display/dc/dce100/dce100_hw_sequencer.c    |    4 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    |   58 +-
 .../drm/amd/display/dc/dce100/dce100_resource.h    |    2 +
 .../drm/amd/display/dc/dce110/dce110_compressor.c  |    4 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  820 +++--
 .../drm/amd/display/dc/dce110/dce110_opp_csc_v.c   |   45 +-
 .../amd/display/dc/dce110/dce110_opp_regamma_v.c   |   88 +-
 .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.c   |    5 -
 .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.h   |   17 -
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  117 +-
 .../drm/amd/display/dc/dce110/dce110_transform_v.c |    5 +
 .../drm/amd/display/dc/dce110/dce110_transform_v.h |   21 +
 .../drm/amd/display/dc/dce112/dce112_compressor.c  |    4 +-
 .../drm/amd/display/dc/dce112/dce112_resource.c    |   52 +-
 .../drm/amd/display/dc/dce112/dce112_resource.h    |    2 +-
 .../amd/display/dc/dce120/dce120_hw_sequencer.c    |   64 +
 .../drm/amd/display/dc/dce120/dce120_resource.c    |    9 +-
 .../drm/amd/display/dc/dce80/dce80_compressor.c    |    4 +-
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |   51 +-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c   |  580 ++++
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h   | 1022 +++++-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 1348 ++++++--
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c   |   29 +-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.h   |    9 +-
 .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c |  375 +--
 .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h |  111 +-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c   |  245 +-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h   |   82 +-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c   |  585 +---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h   |  547 +---
 .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c  |  168 +-
 .../amd/display/dc/dcn10/dcn10_timing_generator.c  |   86 +-
 drivers/gpu/drm/amd/display/dc/dm_helpers.h        |   12 +-
 drivers/gpu/drm/amd/display/dc/dm_services.h       |   14 +-
 drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c   |    1 +
 drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c |    1 +
 drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c     |   21 +-
 drivers/gpu/drm/amd/display/dc/inc/compressor.h    |    1 +
 drivers/gpu/drm/amd/display/dc/inc/core_dc.h       |    2 +-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |  163 +-
 drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h   |    2 +-
 drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h    |   22 +-
 drivers/gpu/drm/amd/display/dc/inc/dcn_calcs.h     |    5 +
 .../gpu/drm/amd/display/dc/inc/hw/display_clock.h  |    2 -
 drivers/gpu/drm/amd/display/dc/inc/hw/dmcu.h       |    2 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h  |   47 +
 drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h        |    2 -
 .../gpu/drm/amd/display/dc/inc/hw/link_encoder.h   |    3 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h  |   15 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h        |   26 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h        |   62 +-
 .../drm/amd/display/dc/inc/hw/timing_generator.h   |    7 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/transform.h  |   55 +-
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |   17 +-
 drivers/gpu/drm/amd/display/dc/inc/link_hwss.h     |   22 +-
 drivers/gpu/drm/amd/display/dc/inc/resource.h      |   17 +-
 .../amd/display/dc/irq/dce110/irq_service_dce110.c |    2 +-
 .../amd/display/dc/virtual/virtual_link_encoder.c  |    2 +-
 drivers/gpu/drm/amd/display/include/dal_asic_id.h  |    7 +-
 drivers/gpu/drm/amd/display/include/dal_types.h    |    3 +-
 .../amd/display/include/grph_object_ctrl_defs.h    |    2 +-
 .../gpu/drm/amd/display/include/logger_interface.h |   32 +-
 .../drm/amd/display/modules/freesync/freesync.c    |   62 +-
 .../gpu/drm/amd/display/modules/inc/mod_freesync.h |   28 +-
 .../include/asic_reg/raven1/DCN/dcn_1_0_offset.h   |    6 +
 .../include/asic_reg/raven1/DCN/dcn_1_0_sh_mask.h  |    5 +
 116 files changed, 10466 insertions(+), 9067 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
 delete mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20170809150246.8835-1-harry.wentland-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/120 drm/amd/include: Add DC_PINSTRAPS.AUDIO defines

---
 drivers/gpu/drm/amd/include/asic_reg/raven1/DCN/dcn_1_0_offset.h  | 2 ++
 drivers/gpu/drm/amd/include/asic_reg/raven1/DCN/dcn_1_0_sh_mask.h | 3 +++
 2 files changed, 5 insertions(+)
drivers/gpu/drm/amd/include/asic_reg/raven1/DCN/dcn_1_0_offset.h +2 -0
index b39fb6821faa..3580218702ce 100644
@@ -10361,6 +10361,8 @@
 #define mmUNIPHYG_CHANNEL_XBAR_CNTL_BASE_IDX                                                           2
 #define mmDCIO_WRCMD_DELAY                                                                             0x287e
 #define mmDCIO_WRCMD_DELAY_BASE_IDX                                                                    2
+#define mmDC_PINSTRAPS                                                                                 0x2880
+#define mmDC_PINSTRAPS_BASE_IDX                                                                        2
 #define mmDC_DVODATA_CONFIG                                                                            0x2882
 #define mmDC_DVODATA_CONFIG_BASE_IDX                                                                   2
 #define mmLVTMA_PWRSEQ_CNTL                                                                            0x2883
drivers/gpu/drm/amd/include/asic_reg/raven1/DCN/dcn_1_0_sh_mask.h +3 -0
index 1e98ce86ed19..ecbe5bfa989b 100644
@@ -39956,6 +39956,9 @@
 #define DCIO_WRCMD_DELAY__DPHY_DELAY_MASK                                                                     0x00000F00L
 #define DCIO_WRCMD_DELAY__DCRXPHY_DELAY_MASK                                                                  0x0000F000L
 #define DCIO_WRCMD_DELAY__ZCAL_DELAY_MASK                                                                     0x000F0000L
+//DC_PINSTRAPS
+#define DC_PINSTRAPS__DC_PINSTRAPS_AUDIO__SHIFT                                                               0xe
+#define DC_PINSTRAPS__DC_PINSTRAPS_AUDIO_MASK                                                                 0x0000C000L
 //DC_DVODATA_CONFIG
 #define DC_DVODATA_CONFIG__VIP_MUX_EN__SHIFT                                                                  0x13
 #define DC_DVODATA_CONFIG__VIP_ALTER_MAPPING_EN__SHIFT                                                        0x14
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

PATCH 2/120 drm/amd/include: Add DCHUBBUB_TEST_DEBUG register defines

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/include/asic_reg/raven1/DCN/dcn_1_0_offset.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/include/asic_reg/raven1/DCN/dcn_1_0_offset.h +4 -0
index 3580218702ce..4ccf9681c45d 100644
@@ -2283,6 +2283,10 @@
 #define mmDCHUBBUB_VLINE_SNAPSHOT_BASE_IDX                                                             2
 #define mmDCHUBBUB_SPARE                                                                               0x0534
 #define mmDCHUBBUB_SPARE_BASE_IDX                                                                      2
+#define mmDCHUBBUB_TEST_DEBUG_INDEX                                                                    0x053a
+#define mmDCHUBBUB_TEST_DEBUG_INDEX_BASE_IDX                                                           2
+#define mmDCHUBBUB_TEST_DEBUG_DATA                                                                     0x053b
+#define mmDCHUBBUB_TEST_DEBUG_DATA_BASE_IDX                                                            2
 
 
 // addressBlock: dce_dc_dchubbub_dchubbub_dcperfmon_dc_perfmon_dispdec
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#4 lore raw

PATCH 3/120 drm/amd: Add missing SURFACE_TMZ register shift/mask

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/include/asic_reg/raven1/DCN/dcn_1_0_sh_mask.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/include/asic_reg/raven1/DCN/dcn_1_0_sh_mask.h +2 -0
index ecbe5bfa989b..b28d4b64c05d 100644
@@ -9361,12 +9361,14 @@
 #define HUBPREQ0_DCSURF_SECONDARY_META_SURFACE_ADDRESS_HIGH_C__SECONDARY_META_SURFACE_ADDRESS_HIGH_C__SHIFT   0x0
 #define HUBPREQ0_DCSURF_SECONDARY_META_SURFACE_ADDRESS_HIGH_C__SECONDARY_META_SURFACE_ADDRESS_HIGH_C_MASK     0x0000FFFFL
 //HUBPREQ0_DCSURF_SURFACE_CONTROL
+#define HUBPREQ0_DCSURF_SURFACE_CONTROL__PRIMARY_SURFACE_TMZ__SHIFT                                           0x0
 #define HUBPREQ0_DCSURF_SURFACE_CONTROL__PRIMARY_SURFACE_DCC_EN__SHIFT                                        0x1
 #define HUBPREQ0_DCSURF_SURFACE_CONTROL__PRIMARY_SURFACE_DCC_IND_64B_BLK__SHIFT                               0x2
 #define HUBPREQ0_DCSURF_SURFACE_CONTROL__PRIMARY_SURFACE_DCC_IND_64B_BLK_C__SHIFT                             0x5
 #define HUBPREQ0_DCSURF_SURFACE_CONTROL__SECONDARY_SURFACE_DCC_EN__SHIFT                                      0x9
 #define HUBPREQ0_DCSURF_SURFACE_CONTROL__SECONDARY_SURFACE_DCC_IND_64B_BLK__SHIFT                             0xa
 #define HUBPREQ0_DCSURF_SURFACE_CONTROL__SECONDARY_SURFACE_DCC_IND_64B_BLK_C__SHIFT                           0xd
+#define HUBPREQ0_DCSURF_SURFACE_CONTROL__PRIMARY_SURFACE_TMZ_MASK                                             0x00000001L
 #define HUBPREQ0_DCSURF_SURFACE_CONTROL__PRIMARY_SURFACE_DCC_EN_MASK                                          0x00000002L
 #define HUBPREQ0_DCSURF_SURFACE_CONTROL__PRIMARY_SURFACE_DCC_IND_64B_BLK_MASK                                 0x00000004L
 #define HUBPREQ0_DCSURF_SURFACE_CONTROL__PRIMARY_SURFACE_DCC_IND_64B_BLK_C_MASK                               0x00000020L
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#5 lore raw

PATCH 4/120 drm/amd/display: fix dcn10_resource read_dce_straps

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I59d7c0f15ad9eeff32038e0df269f5fa23e65452
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +2 -6
index 4a996f9ae468..b5f0f547ee83 100644
@@ -610,12 +610,8 @@ static void read_dce_straps(
 	struct dc_context *ctx,
 	struct resource_straps *straps)
 {
-	/* TODO: Registers are missing */
-	/*REG_GET_2(CC_DC_HDMI_STRAPS,
-			HDMI_DISABLE, &straps->hdmi_disable,
-			AUDIO_STREAM_NUMBER, &straps->audio_stream_number);
-
-	REG_GET(DC_PINSTRAPS, DC_PINSTRAPS_AUDIO, &straps->dc_pinstraps_audio);*/
+	generic_reg_get(ctx, mmDC_PINSTRAPS + BASE(mmDC_PINSTRAPS_BASE_IDX),
+		FN(DC_PINSTRAPS, DC_PINSTRAPS_AUDIO), &straps->dc_pinstraps_audio);
 }
 
 static struct audio *create_audio(
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#6 lore raw

PATCH 5/120 drm/amd/display: Set i2c speed to 100khz for DCE11.2 and later.

In reply to a message not in the archive

From: Zeyu Fan <[email protected]>

Change-Id I816c374dcce253fd81b8614f5ff95bf7792ddc62
---
 drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c +10 -2
index 983645b1be78..45e766ea79e3 100644
@@ -337,6 +337,9 @@ enum {
 	DEFAULT_I2C_SW_SPEED = 50,
 	DEFAULT_I2C_HW_SPEED = 50,
 
+	DEFAULT_I2C_SW_SPEED_100KHZ = 100,
+	DEFAULT_I2C_HW_SPEED_100KHZ = 100,
+
 	/* This is the timeout as defined in DP 1.2a,
 	 * 2.3.4 "Detailed uPacket TX AUX CH State Description". */
 	AUX_TIMEOUT_PERIOD = 400,
@@ -436,8 +439,13 @@ bool dal_i2caux_construct(
 	i2caux->aux_timeout_period =
 		SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD;
 
-	i2caux->default_i2c_sw_speed = DEFAULT_I2C_SW_SPEED;
-	i2caux->default_i2c_hw_speed = DEFAULT_I2C_HW_SPEED;
+	if (ctx->dce_version >= DCE_VERSION_11_2) {
+		i2caux->default_i2c_hw_speed = DEFAULT_I2C_HW_SPEED_100KHZ;
+		i2caux->default_i2c_sw_speed = DEFAULT_I2C_SW_SPEED_100KHZ;
+	} else {
+		i2caux->default_i2c_hw_speed = DEFAULT_I2C_HW_SPEED;
+		i2caux->default_i2c_sw_speed = DEFAULT_I2C_SW_SPEED;
+	}
 
 	return true;
 }
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#7 lore raw

PATCH 6/120 drm/amd/display: Return hpd_irq_dpcd from hpd_rx handler

In reply to a message not in the archive

From: Wenjing Liu <[email protected]>

Change-Id I0a7a84dabac0929c42f6cbf410b2caa90f81a019
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c  | 5 ++++-
 drivers/gpu/drm/amd/display/dc/dc.h               | 3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
index 83775758f83d..8f1805841150 100644
@@ -914,7 +914,7 @@ static void handle_hpd_rx_irq(void *param)
 	if (aconnector->dc_link->type != dc_connection_mst_branch)
 		mutex_lock(&aconnector->hpd_lock);
 
-	if (dc_link_handle_hpd_rx_irq(aconnector->dc_link) &&
+	if (dc_link_handle_hpd_rx_irq(aconnector->dc_link, NULL) &&
 			!is_mst_root_connector) {
 		/* Downstream Port status changed. */
 		if (dc_link_detect(aconnector->dc_link, false)) {
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +4 -1
index dd3f57fce834..445cd226d36d 100644
@@ -1924,7 +1924,7 @@ static void handle_automated_test(struct core_link *link)
 			sizeof(test_response));
 }
 
-bool dc_link_handle_hpd_rx_irq(const struct dc_link *dc_link)
+bool dc_link_handle_hpd_rx_irq(const struct dc_link *dc_link, union hpd_irq_data *out_hpd_irq_dpcd_data)
 {
 	struct core_link *link = DC_LINK_TO_LINK(dc_link);
 	union hpd_irq_data hpd_irq_dpcd_data = {{{{0}}}};
@@ -1939,12 +1939,15 @@ bool dc_link_handle_hpd_rx_irq(const struct dc_link *dc_link)
 		"%s: Got short pulse HPD on link %d\n",
 		__func__, link->public.link_index);
 
+
 	 /* All the "handle_hpd_irq_xxx()" methods
 		 * should be called only after
 		 * dal_dpsst_ls_read_hpd_irq_data
 		 * Order of calls is important too
 		 */
 	result = read_hpd_rx_irq_data(link, &hpd_irq_dpcd_data);
+	if (out_hpd_irq_dpcd_data)
+		*out_hpd_irq_dpcd_data = hpd_irq_dpcd_data;
 
 	if (result != DC_OK) {
 		dm_logger_write(link->ctx->logger, LOG_HW_HPD_IRQ,
drivers/gpu/drm/amd/display/dc/dc.h +2 -1
index 07f064f53d85..7ecbff792e66 100644
@@ -755,7 +755,8 @@ bool dc_link_detect(const struct dc_link *dc_link, bool boot);
  * detection.
  * false - no change in Downstream port status. No further action required
  * from DM. */
-bool dc_link_handle_hpd_rx_irq(const struct dc_link *dc_link);
+bool dc_link_handle_hpd_rx_irq(const struct dc_link *dc_link,
+		union hpd_irq_data *hpd_irq_dpcd_data);
 
 struct dc_sink_init_data;
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#8 lore raw

PATCH 7/120 drm/amd/display: fix index and union overwrite in compressor

In reply to a message not in the archive

From: Roman Li <[email protected]>

Fixing 2 bugs in compressor:
- array out of bounds due to incorrect index
- compressor options always 0 due to union overwrite

Change-Id I364dcb346baaed8caa3e068b4b4fd68da40341a3
---
 drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c | 4 ++--
 drivers/gpu/drm/amd/display/dc/dce112/dce112_compressor.c | 4 ++--
 drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.c   | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c +2 -2
index 1e59f4e31a6a..9759d8e790a3 100644
@@ -198,7 +198,7 @@ void dce110_compressor_enable_fbc(
 		/* Keep track of enum controller_id FBC is attached to */
 		compressor->is_enabled = true;
 		compressor->attached_inst = params->inst;
-		cp110->offsets = reg_offsets[params->inst - 1];
+		cp110->offsets = reg_offsets[params->inst];
 
 		/*Toggle it as there is bug in HW */
 		set_reg_field_value(value, 0, FBC_CNTL, FBC_GRPH_COMP_EN);
@@ -469,6 +469,7 @@ bool dce110_compressor_construct(struct dce110_compressor *compressor,
 	struct dc_context *ctx)
 {
 
+	compressor->base.options.raw = 0;
 	compressor->base.options.bits.FBC_SUPPORT = true;
 
 	/* for dce 11 always use one dram channel for lpt */
@@ -490,7 +491,6 @@ bool dce110_compressor_construct(struct dce110_compressor *compressor,
 	compressor->base.allocated_size = 0;
 	compressor->base.preferred_requested_size = 0;
 	compressor->base.min_compress_ratio = FBC_COMPRESS_RATIO_INVALID;
-	compressor->base.options.raw = 0;
 	compressor->base.banks_num = 0;
 	compressor->base.raw_size = 0;
 	compressor->base.channel_interleave_size = 0;
drivers/gpu/drm/amd/display/dc/dce112/dce112_compressor.c +2 -2
index 22a5aba073ca..75af2125344b 100644
@@ -404,7 +404,7 @@ void dce112_compressor_enable_fbc(
 		/* Keep track of enum controller_id FBC is attached to */
 		compressor->is_enabled = true;
 		compressor->attached_inst = params->inst;
-		cp110->offsets = reg_offsets[params->inst - 1];
+		cp110->offsets = reg_offsets[params->inst];
 
 		/*Toggle it as there is bug in HW */
 		set_reg_field_value(value, 0, FBC_CNTL, FBC_GRPH_COMP_EN);
@@ -797,6 +797,7 @@ bool dce112_compressor_construct(struct dce112_compressor *compressor,
 	struct dc_bios *bp = ctx->dc_bios;
 	struct embedded_panel_info panel_info;
 
+	compressor->base.options.raw = 0;
 	compressor->base.options.bits.FBC_SUPPORT = true;
 	compressor->base.options.bits.LPT_SUPPORT = true;
 	 /* For DCE 11 always use one DRAM channel for LPT */
@@ -817,7 +818,6 @@ bool dce112_compressor_construct(struct dce112_compressor *compressor,
 	compressor->base.allocated_size = 0;
 	compressor->base.preferred_requested_size = 0;
 	compressor->base.min_compress_ratio = FBC_COMPRESS_RATIO_INVALID;
-	compressor->base.options.raw = 0;
 	compressor->base.banks_num = 0;
 	compressor->base.raw_size = 0;
 	compressor->base.channel_interleave_size = 0;
drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.c +2 -2
index eeedb7c4fe53..77626d7624c6 100644
@@ -407,7 +407,7 @@ void dce80_compressor_enable_fbc(
 		/* Keep track of enum controller_id FBC is attached to */
 		compressor->is_enabled = true;
 		compressor->attached_inst = params->inst;
-		cp80->offsets = reg_offsets[params->inst - 1];
+		cp80->offsets = reg_offsets[params->inst];
 
 		/*Toggle it as there is bug in HW */
 		set_reg_field_value(value, 0, FBC_CNTL, FBC_GRPH_COMP_EN);
@@ -777,6 +777,7 @@ bool dce80_compressor_construct(struct dce80_compressor *compressor,
 	struct dc_bios *bp = ctx->dc_bios;
 	struct embedded_panel_info panel_info;
 
+	compressor->base.options.raw = 0;
 	compressor->base.options.bits.FBC_SUPPORT = true;
 	compressor->base.options.bits.LPT_SUPPORT = true;
 	 /* For DCE 11 always use one DRAM channel for LPT */
@@ -797,7 +798,6 @@ bool dce80_compressor_construct(struct dce80_compressor *compressor,
 	compressor->base.allocated_size = 0;
 	compressor->base.preferred_requested_size = 0;
 	compressor->base.min_compress_ratio = FBC_COMPRESS_RATIO_INVALID;
-	compressor->base.options.raw = 0;
 	compressor->base.banks_num = 0;
 	compressor->base.raw_size = 0;
 	compressor->base.channel_interleave_size = 0;
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#9 lore raw

PATCH 8/120 drm/amd/display: register programming consolidation

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

remove redundant DPP_CLOCK_ENABLE in ipp. clock programmed by HWSS

Change-Id Ic329e4bfdb06f85d0e2362bb26641ace94c786a6
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c | 1 -
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.h | 2 --
 2 files changed, 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c +0 -1
index 4910d4c59b31..53dd9a9593f0 100644
@@ -418,7 +418,6 @@ static void ippn10_enable_cm_block(
 {
 	struct dcn10_ipp *ippn10 = TO_DCN10_IPP(ipp);
 
-	REG_UPDATE(DPP_CONTROL, DPP_CLOCK_ENABLE, 1);
 	REG_UPDATE(CM_CONTROL, CM_BYPASS_EN, 0);
 }
 
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.h +0 -2
index 1703589623b0..f14e208dbf1c 100644
@@ -235,7 +235,6 @@
 	IPP_SF(CM0_CM_DGAM_LUT_WRITE_EN_MASK, CM_DGAM_LUT_WRITE_SEL, mask_sh), \
 	IPP_SF(CM0_CM_DGAM_LUT_INDEX, CM_DGAM_LUT_INDEX, mask_sh), \
 	IPP_SF(CM0_CM_DGAM_LUT_DATA, CM_DGAM_LUT_DATA, mask_sh), \
-	IPP_SF(DPP_TOP0_DPP_CONTROL, DPP_CLOCK_ENABLE, mask_sh), \
 	IPP_SF(CNVC_CFG0_CNVC_SURFACE_PIXEL_FORMAT, CNVC_SURFACE_PIXEL_FORMAT, mask_sh), \
 	IPP_SF(CNVC_CFG0_FORMAT_CONTROL, CNVC_BYPASS, mask_sh), \
 	IPP_SF(CNVC_CFG0_FORMAT_CONTROL, ALPHA_EN, mask_sh), \
@@ -433,7 +432,6 @@
 	type CM_DGAM_LUT_WRITE_SEL; \
 	type CM_DGAM_LUT_INDEX; \
 	type CM_DGAM_LUT_DATA; \
-	type DPP_CLOCK_ENABLE; \
 	type CM_BYPASS_EN; \
 	type CM_BYPASS; \
 	type CNVC_SURFACE_PIXEL_FORMAT; \
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#10 lore raw

PATCH 9/120 drm/amd/display: plumbing to allow easy print of HW state for DTN

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

Change-Id I90ddf8918dcfa60d1dd468f8c1ba9dc59806cb70
---
 drivers/gpu/drm/amd/display/dc/core/dc.c                  |  7 +++++++
 drivers/gpu/drm/amd/display/dc/dc.h                       |  2 ++
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 12 ++++++++++++
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h         |  2 ++
 drivers/gpu/drm/amd/display/include/logger_interface.h    |  4 ++++
 5 files changed, 27 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +7 -0
index eda36c7a5c57..ad1b90563eb6 100644
@@ -2035,3 +2035,10 @@ bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data)
 
 }
 
+void dc_log_hw_state(struct dc *dc)
+{
+	struct core_dc *core_dc = DC_TO_CORE(dc);
+
+	if (core_dc->hwss.log_hw_state)
+		core_dc->hwss.log_hw_state(core_dc);
+}
drivers/gpu/drm/amd/display/dc/dc.h +2 -0
index 7ecbff792e66..7b8e11c28c62 100644
@@ -236,6 +236,8 @@ void dc_destroy(struct dc **dc);
 
 bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data);
 
+void dc_log_hw_state(struct dc *dc);
+
 /*******************************************************************************
  * Surface Interfaces
  ******************************************************************************/
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +12 -0
index 6543027469af..c0aa32b71ad1 100644
@@ -1851,6 +1851,17 @@ static void dcn10_setup_stereo(struct pipe_ctx *pipe_ctx, struct core_dc *dc)
 	return;
 }
 
+static void dcn10_log_hw_state(struct core_dc *dc)
+{
+	struct dc_context *dc_ctx = dc->ctx;
+
+	DTN_INFO("%s: Hello World", __func__);
+
+	/* todo: add meaningful register reads and print out HW state
+	 *
+	 */
+}
+
 static bool dcn10_dummy_display_power_gating(
 	struct core_dc *dc,
 	uint8_t controller_id,
@@ -1887,6 +1898,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = {
 	.set_static_screen_control = set_static_screen_control,
 	.setup_stereo = dcn10_setup_stereo,
 	.set_avmute = dce110_set_avmute,
+	.log_hw_state = dcn10_log_hw_state,
 };
 
 
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +2 -0
index d94e8e446ce5..4c027a98cfd3 100644
@@ -154,6 +154,8 @@ struct hw_sequencer_funcs {
 			struct core_dc *dc);
 
 	void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable);
+
+	void (*log_hw_state)(struct core_dc *dc);
 };
 
 void color_space_to_black_color(
drivers/gpu/drm/amd/display/include/logger_interface.h +4 -0
index ce5fef243b09..c861e726cd8f 100644
@@ -123,6 +123,10 @@ void context_clock_trace(
 	dm_logger_write(dc_ctx->logger, LOG_ERROR, \
 		__VA_ARGS__);
 
+#define DTN_INFO(...) \
+	dm_logger_write(dc_ctx->logger, LOG_DTN, \
+		__VA_ARGS__)
+
 #define DC_SYNC_INFO(...) \
 	dm_logger_write(dc_ctx->logger, LOG_SYNC, \
 		__VA_ARGS__);
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#11 lore raw

PATCH 10/120 drm/amd/display: mpo debug sanity checks

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

Change-Id I4f9619e79269c84efbf4f8e7448d500205d05c69
---
 drivers/gpu/drm/amd/display/dc/dc.h                |   1 +
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h     |   6 +
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 152 ++++++++++++++++++++-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c   |  21 +++
 .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c  |   1 +
 5 files changed, 179 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index 7b8e11c28c62..617270829936 100644
@@ -160,6 +160,7 @@ struct dc_config {
 
 struct dc_debug {
 	bool surface_visual_confirm;
+	bool sanity_checks;
 	bool max_disp_clk;
 	bool surface_trace;
 	bool timing_trace;
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +6 -0
index 94d12b5fb7c6..0479554bc231 100644
@@ -147,6 +147,9 @@
 	SRII(OPP_PIPE_CONTROL, OPP_PIPE, 3), \
 	SR(REFCLK_CNTL), \
 	SR(DCHUBBUB_GLOBAL_TIMER_CNTL), \
+	SR(DCHUBBUB_ARB_DRAM_STATE_CNTL), \
+	SR(DCHUBBUB_TEST_DEBUG_INDEX), \
+	SR(DCHUBBUB_TEST_DEBUG_DATA), \
 	SR(DC_IP_REQUEST_CNTL), \
 	SR(DOMAIN0_PG_CONFIG), \
 	SR(DOMAIN1_PG_CONFIG), \
@@ -195,6 +198,9 @@ struct dce_hwseq_registers {
 	uint32_t OPP_PIPE_CONTROL[4];
 	uint32_t REFCLK_CNTL;
 	uint32_t DCHUBBUB_GLOBAL_TIMER_CNTL;
+	uint32_t DCHUBBUB_ARB_DRAM_STATE_CNTL;
+	uint32_t DCHUBBUB_TEST_DEBUG_INDEX;
+	uint32_t DCHUBBUB_TEST_DEBUG_DATA;
 	uint32_t DC_IP_REQUEST_CNTL;
 	uint32_t DOMAIN0_PG_CONFIG;
 	uint32_t DOMAIN1_PG_CONFIG;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +150 -2

240 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c +21 -0
index de3341d572be..9af288167e2e 100644
@@ -77,6 +77,24 @@ static void reset_output_mux(struct dcn10_mpcc *mpcc10)
 	mpcc10->base.opp_id = 0xf;
 }
 
+static void assert_mpcc_idle_before_connect(struct dcn10_mpcc *mpcc10)
+{
+	unsigned int top_sel;
+	unsigned int mpcc_busy, mpcc_idle, mpcc_status;
+
+	REG_GET(MPCC_TOP_SEL,
+			MPCC_TOP_SEL, &top_sel);
+
+	if (top_sel == 0xf) {
+		mpcc_status = REG_GET_2(MPCC_STATUS,
+				MPCC_BUSY, &mpcc_busy,
+				MPCC_IDLE, &mpcc_idle);
+
+		ASSERT(mpcc_busy == 0);
+		ASSERT(mpcc_idle == 1);
+	}
+}
+
 static void dcn10_mpcc_set(struct mpcc *mpcc, struct mpcc_cfg *cfg)
 {
 	struct dcn10_mpcc *mpcc10 = TO_DCN10_MPCC(mpcc);
@@ -87,6 +105,9 @@ static void dcn10_mpcc_set(struct mpcc *mpcc, struct mpcc_cfg *cfg)
 	bool blend_active_only = cfg->top_of_tree &&
 			!mpcc->ctx->dc->debug.surface_visual_confirm;
 
+	if (mpcc->ctx->dc->debug.sanity_checks)
+		assert_mpcc_idle_before_connect(mpcc10);
+
 	REG_SET(MPCC_OPP_ID, 0,
 		MPCC_OPP_ID, cfg->opp_id);
 
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +1 -0
index b5f0f547ee83..eec0d5b22a9f 100644
@@ -424,6 +424,7 @@ static const struct resource_caps res_cap = {
 
 static const struct dc_debug debug_defaults_drv = {
 		.disable_dcc = false,
+		.sanity_checks = true,
 		.disable_dmcu = true,
 		.force_abm_enable = false,
 		.timing_trace = false,
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#12 lore raw

PATCH 11/120 drm/amd/display: update dcn register headers

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I7c45b9b75f949247dbca035133fee6aef43d8370
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.h       |  7 ++++---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h | 12 +++++++-----
 2 files changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.h +4 -3
index f14e208dbf1c..69db441e78c4 100644
@@ -87,7 +87,6 @@
 	SRI(CM_DGAM_CONTROL, CM, id), \
 	SRI(FORMAT_CONTROL, CNVC_CFG, id), \
 	SRI(DPP_CONTROL, DPP_TOP, id), \
-	SRI(CURSOR_SETTINS, HUBPREQ, id), \
 	SRI(CNVC_SURFACE_PIXEL_FORMAT, CNVC_CFG, id), \
 	SRI(CURSOR0_CONTROL, CNVC_CUR, id), \
 	SRI(CURSOR0_COLOR0, CNVC_CUR, id), \
@@ -95,6 +94,7 @@
 
 #define IPP_REG_LIST_DCN10(id) \
 	IPP_REG_LIST_DCN(id), \
+	SRI(CURSOR_SETTINS, HUBPREQ, id), \
 	SRI(CM_IGAM_CONTROL, CM, id), \
 	SRI(CM_COMA_C11_C12, CM, id), \
 	SRI(CM_COMA_C13_C14, CM, id), \
@@ -240,8 +240,6 @@
 	IPP_SF(CNVC_CFG0_FORMAT_CONTROL, ALPHA_EN, mask_sh), \
 	IPP_SF(CNVC_CFG0_FORMAT_CONTROL, FORMAT_EXPANSION_MODE, mask_sh), \
 	IPP_SF(CM0_CM_DGAM_CONTROL, CM_DGAM_LUT_MODE, mask_sh), \
-	IPP_SF(HUBPREQ0_CURSOR_SETTINS, CURSOR0_DST_Y_OFFSET, mask_sh), \
-	IPP_SF(HUBPREQ0_CURSOR_SETTINS, CURSOR0_CHUNK_HDL_ADJUST, mask_sh), \
 	IPP_SF(CNVC_CUR0_CURSOR0_CONTROL, CUR0_MODE, mask_sh), \
 	IPP_SF(CNVC_CUR0_CURSOR0_COLOR0, CUR0_COLOR0, mask_sh), \
 	IPP_SF(CNVC_CUR0_CURSOR0_COLOR1, CUR0_COLOR1, mask_sh), \
@@ -250,6 +248,8 @@
 
 #define IPP_MASK_SH_LIST_DCN10(mask_sh) \
 	IPP_MASK_SH_LIST_DCN(mask_sh),\
+	IPP_SF(HUBPREQ0_CURSOR_SETTINS, CURSOR0_DST_Y_OFFSET, mask_sh), \
+	IPP_SF(HUBPREQ0_CURSOR_SETTINS, CURSOR0_CHUNK_HDL_ADJUST, mask_sh), \
 	IPP_SF(CM0_CM_COMA_C11_C12, CM_COMA_C11, mask_sh), \
 	IPP_SF(CM0_CM_COMA_C11_C12, CM_COMA_C12, mask_sh), \
 	IPP_SF(CM0_CM_COMA_C13_C14, CM_COMA_C13, mask_sh), \
@@ -537,6 +537,7 @@ struct dcn10_ipp_registers {
 	uint32_t CM_IGAM_CONTROL;
 	uint32_t DPP_CONTROL;
 	uint32_t CURSOR_SETTINS;
+	uint32_t CURSOR_SETTINGS;
 	uint32_t CNVC_SURFACE_PIXEL_FORMAT;
 	uint32_t CURSOR0_CONTROL;
 	uint32_t CURSOR0_COLOR0;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h +7 -5
index a0a1cef38d18..0f4d247c4237 100644
@@ -75,7 +75,6 @@
 	SRI(BLANK_OFFSET_1, HUBPREQ, id),\
 	SRI(DST_DIMENSIONS, HUBPREQ, id),\
 	SRI(DST_AFTER_SCALER, HUBPREQ, id),\
-	SRI(PREFETCH_SETTINS, HUBPREQ, id),\
 	SRI(VBLANK_PARAMETERS_0, HUBPREQ, id),\
 	SRI(REF_FREQ_TO_PIX_FREQ, HUBPREQ, id),\
 	SRI(VBLANK_PARAMETERS_1, HUBPREQ, id),\
@@ -86,7 +85,6 @@
 	SRI(NOM_PARAMETERS_5, HUBPREQ, id),\
 	SRI(PER_LINE_DELIVERY_PRE, HUBPREQ, id),\
 	SRI(PER_LINE_DELIVERY, HUBPREQ, id),\
-	SRI(PREFETCH_SETTINS_C, HUBPREQ, id),\
 	SRI(VBLANK_PARAMETERS_2, HUBPREQ, id),\
 	SRI(VBLANK_PARAMETERS_4, HUBPREQ, id),\
 	SRI(NOM_PARAMETERS_2, HUBPREQ, id),\
@@ -140,6 +138,8 @@
 
 #define MI_REG_LIST_DCN10(id)\
 	MI_REG_LIST_DCN(id),\
+	SRI(PREFETCH_SETTINS, HUBPREQ, id),\
+	SRI(PREFETCH_SETTINS_C, HUBPREQ, id),\
 	SRI(DCN_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_MSB, HUBPREQ, id),\
 	SRI(DCN_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LSB, HUBPREQ, id),\
 	SRI(DCN_VM_CONTEXT0_PAGE_TABLE_START_ADDR_MSB, HUBPREQ, id),\
@@ -206,6 +206,7 @@ struct dcn_mi_registers {
 	uint32_t DST_DIMENSIONS;
 	uint32_t DST_AFTER_SCALER;
 	uint32_t PREFETCH_SETTINS;
+	uint32_t PREFETCH_SETTINGS;
 	uint32_t VBLANK_PARAMETERS_0;
 	uint32_t REF_FREQ_TO_PIX_FREQ;
 	uint32_t VBLANK_PARAMETERS_1;
@@ -217,6 +218,7 @@ struct dcn_mi_registers {
 	uint32_t PER_LINE_DELIVERY_PRE;
 	uint32_t PER_LINE_DELIVERY;
 	uint32_t PREFETCH_SETTINS_C;
+	uint32_t PREFETCH_SETTINGS_C;
 	uint32_t VBLANK_PARAMETERS_2;
 	uint32_t VBLANK_PARAMETERS_4;
 	uint32_t NOM_PARAMETERS_2;
@@ -388,8 +390,6 @@ struct dcn_mi_registers {
 	MI_SF(HUBPREQ0_DST_DIMENSIONS, REFCYC_PER_HTOTAL, mask_sh),\
 	MI_SF(HUBPREQ0_DST_AFTER_SCALER, REFCYC_X_AFTER_SCALER, mask_sh),\
 	MI_SF(HUBPREQ0_DST_AFTER_SCALER, DST_Y_AFTER_SCALER, mask_sh),\
-	MI_SF(HUBPREQ0_PREFETCH_SETTINS, DST_Y_PREFETCH, mask_sh),\
-	MI_SF(HUBPREQ0_PREFETCH_SETTINS, VRATIO_PREFETCH, mask_sh),\
 	MI_SF(HUBPREQ0_VBLANK_PARAMETERS_0, DST_Y_PER_VM_VBLANK, mask_sh),\
 	MI_SF(HUBPREQ0_VBLANK_PARAMETERS_0, DST_Y_PER_ROW_VBLANK, mask_sh),\
 	MI_SF(HUBPREQ0_REF_FREQ_TO_PIX_FREQ, REF_FREQ_TO_PIX_FREQ, mask_sh),\
@@ -403,7 +403,6 @@ struct dcn_mi_registers {
 	MI_SF(HUBPREQ0_PER_LINE_DELIVERY_PRE, REFCYC_PER_LINE_DELIVERY_PRE_C, mask_sh),\
 	MI_SF(HUBPREQ0_PER_LINE_DELIVERY, REFCYC_PER_LINE_DELIVERY_L, mask_sh),\
 	MI_SF(HUBPREQ0_PER_LINE_DELIVERY, REFCYC_PER_LINE_DELIVERY_C, mask_sh),\
-	MI_SF(HUBPREQ0_PREFETCH_SETTINS_C, VRATIO_PREFETCH_C, mask_sh),\
 	MI_SF(HUBPREQ0_VBLANK_PARAMETERS_2, REFCYC_PER_PTE_GROUP_VBLANK_C, mask_sh),\
 	MI_SF(HUBPREQ0_VBLANK_PARAMETERS_4, REFCYC_PER_META_CHUNK_VBLANK_C, mask_sh),\
 	MI_SF(HUBPREQ0_NOM_PARAMETERS_2, DST_Y_PER_PTE_ROW_NOM_C, mask_sh),\
@@ -429,6 +428,9 @@ struct dcn_mi_registers {
 
 #define MI_MASK_SH_LIST_DCN10(mask_sh)\
 	MI_MASK_SH_LIST_DCN(mask_sh),\
+	MI_SF(HUBPREQ0_PREFETCH_SETTINS, DST_Y_PREFETCH, mask_sh),\
+	MI_SF(HUBPREQ0_PREFETCH_SETTINS, VRATIO_PREFETCH, mask_sh),\
+	MI_SF(HUBPREQ0_PREFETCH_SETTINS_C, VRATIO_PREFETCH_C, mask_sh),\
 	MI_SF(HUBPREQ0_DCN_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_MSB, VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_MSB, mask_sh),\
 	MI_SF(HUBPREQ0_DCN_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LSB, VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LSB, mask_sh),\
 	MI_SF(HUBPREQ0_DCN_VM_CONTEXT0_PAGE_TABLE_START_ADDR_MSB, VM_CONTEXT0_PAGE_TABLE_START_ADDR_MSB, mask_sh),\
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#13 lore raw

PATCH 12/120 drm/amd/display: mpcc disconnect and pipe pg in multi-display

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

still quite hacky. but this address not properly shutdown pipe video underlay
+ enable another display case, as well as mode changes with video overlay.

Change-Id I28dde6776bbf05e32324dcad6fbf1e91478c5452
---
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 23 +++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +18 -5
index b5a925362c8c..d607ca94bd13 100644
@@ -1669,30 +1669,46 @@ static void dcn10_apply_ctx_for_surface(
 		struct core_surface *surface,
 		struct validate_context *context)
 {
-	int i;
+	int i, be_idx;
 
 	if (dc->public.debug.sanity_checks)
 		verify_allow_pstate_change_high(dc->hwseq);
 
+	if (!surface)
+		return;
+
+	for (be_idx = 0; be_idx < dc->res_pool->pipe_count; be_idx++)
+		if (surface == context->res_ctx.pipe_ctx[be_idx].surface)
+			break;
+
 	/* reset unused mpcc */
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
 		struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
 		struct pipe_ctx *old_pipe_ctx =
 				&dc->current_context->res_ctx.pipe_ctx[i];
+
+		if (!pipe_ctx->surface && !old_pipe_ctx->surface)
+			continue;
+
 		/*
 		 * Powergate reused pipes that are not powergated
 		 * fairly hacky right now, using opp_id as indicator
 		 */
+
 		if (pipe_ctx->surface && !old_pipe_ctx->surface) {
-			if (pipe_ctx->mpcc->opp_id != 0xf)
+			if (pipe_ctx->mpcc->opp_id != 0xf && pipe_ctx->tg->inst == be_idx)
 				dcn10_power_down_fe(dc, pipe_ctx->pipe_idx);
 		}
 
+
 		if ((!pipe_ctx->surface && old_pipe_ctx->surface)
 				|| (!pipe_ctx->stream && old_pipe_ctx->stream)) {
 			struct mpcc_cfg mpcc_cfg;
 			int opp_id_cached = old_pipe_ctx->mpcc->opp_id;
 
+			if (old_pipe_ctx->tg->inst != be_idx)
+				continue;
+
 			if (!old_pipe_ctx->top_pipe) {
 				ASSERT(0);
 				continue;
@@ -1725,9 +1741,6 @@ static void dcn10_apply_ctx_for_surface(
 		}
 	}
 
-	if (!surface)
-		return;
-
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
 		struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#14 lore raw

PATCH 13/120 drm/amd/display: fix locking in apply_ctx_for_surface

In reply to a message not in the archive

From: Eric Yang <[email protected]>

Change-Id If5e717b102d47305e3225a7169926fdc17d73648
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +7 -1
index d607ca94bd13..6db78d9f8e3b 100644
@@ -1696,8 +1696,14 @@ static void dcn10_apply_ctx_for_surface(
 		 */
 
 		if (pipe_ctx->surface && !old_pipe_ctx->surface) {
-			if (pipe_ctx->mpcc->opp_id != 0xf && pipe_ctx->tg->inst == be_idx)
+			if (pipe_ctx->mpcc->opp_id != 0xf && pipe_ctx->tg->inst == be_idx) {
 				dcn10_power_down_fe(dc, pipe_ctx->pipe_idx);
+				/*
+				 * power down fe will unlock when calling reset, need
+				 * to lock it back here. Messy, need rework.
+				 */
+				pipe_ctx->tg->funcs->lock(pipe_ctx->tg);
+			}
 		}
 
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#15 lore raw

PATCH 14/120 drm/amd/display: revert dcn10 soc defaults to 17 19

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id If3ea9843dd808702c2eb369f531593c64b6e9ba7
---
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +2 -2
index 0ea0dab49e0f..a1eabc47558e 100644
@@ -37,8 +37,8 @@
 /* Defaults from spreadsheet rev#247 */
 const struct dcn_soc_bounding_box dcn10_soc_defaults = {
 		/* latencies */
-		.sr_exit_time = 13, /*us*/
-		.sr_enter_plus_exit_time = 15, /*us*/
+		.sr_exit_time = 17, /*us*/
+		.sr_enter_plus_exit_time = 19, /*us*/
 		.urgent_latency = 4, /*us*/
 		.dram_clock_change_latency = 17, /*us*/
 		.write_back_latency = 12, /*us*/
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#16 lore raw

PATCH 15/120 drm/amd/display: Implement logic for hdmi info packet bits.

In reply to a message not in the archive

From: Zeyu Fan <[email protected]>

Change-Id I000c4ad8f82c40265c4cab6f4b920a1cfa469b9c
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 68 +++++++++++++++++++----
 drivers/gpu/drm/amd/display/dc/dc_types.h         | 25 +++++++++
 2 files changed, 83 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +58 -10
index d196d0d728b1..7437c3d94800 100644
@@ -1603,10 +1603,13 @@ static void set_avi_info_frame(
 	enum scanning_type scan_type = SCANNING_TYPE_NODATA;
 	enum dc_aspect_ratio aspect = ASPECT_RATIO_NO_DATA;
 	bool itc = false;
+	uint8_t itc_value = 0;
 	uint8_t cn0_cn1 = 0;
+	unsigned int cn0_cn1_value = 0;
 	uint8_t *check_sum = NULL;
 	uint8_t byte_index = 0;
 	union hdmi_info_packet *hdmi_info = &info_frame.avi_info_packet.info_packet_hdmi;
+	union display_content_support support = {0};
 	unsigned int vic = pipe_ctx->stream->public.timing.vic;
 	enum dc_timing_3d_format format;
 
@@ -1703,26 +1706,71 @@ static void set_avi_info_frame(
 	hdmi_info->bits.R0_R3 = ACTIVE_FORMAT_ASPECT_RATIO_SAME_AS_PICTURE;
 
 	/* TODO: un-hardcode cn0_cn1 and itc */
+
 	cn0_cn1 = 0;
-	itc = false;
+	cn0_cn1_value = 0;
+
+	itc = true;
+	itc_value = 1;
+
+	support = stream->public.sink->edid_caps.content_support;
 
 	if (itc) {
-		hdmi_info->bits.ITC     = 1;
-		hdmi_info->bits.CN0_CN1 = cn0_cn1;
+		if (!support.bits.valid_content_type) {
+			cn0_cn1_value = 0;
+		} else {
+			if (cn0_cn1 == DISPLAY_CONTENT_TYPE_GRAPHICS) {
+				if (support.bits.graphics_content == 1) {
+					cn0_cn1_value = 0;
+				}
+			} else if (cn0_cn1 == DISPLAY_CONTENT_TYPE_PHOTO) {
+				if (support.bits.photo_content == 1) {
+					cn0_cn1_value = 1;
+				} else {
+					cn0_cn1_value = 0;
+					itc_value = 0;
+				}
+			} else if (cn0_cn1 == DISPLAY_CONTENT_TYPE_CINEMA) {
+				if (support.bits.cinema_content == 1) {
+					cn0_cn1_value = 2;
+				} else {
+					cn0_cn1_value = 0;
+					itc_value = 0;
+				}
+			} else if (cn0_cn1 == DISPLAY_CONTENT_TYPE_GAME) {
+				if (support.bits.game_content == 1) {
+					cn0_cn1_value = 3;
+				} else {
+					cn0_cn1_value = 0;
+					itc_value = 0;
+				}
+			}
+		}
+		hdmi_info->bits.CN0_CN1 = cn0_cn1_value;
+		hdmi_info->bits.ITC = itc_value;
 	}
 
 	/* TODO : We should handle YCC quantization */
 	/* but we do not have matrix calculation */
-	if (color_space == COLOR_SPACE_SRGB) {
-		hdmi_info->bits.Q0_Q1   = RGB_QUANTIZATION_FULL_RANGE;
-		hdmi_info->bits.YQ0_YQ1 = YYC_QUANTIZATION_FULL_RANGE;
-	} else if (color_space == COLOR_SPACE_SRGB_LIMITED) {
-		hdmi_info->bits.Q0_Q1   = RGB_QUANTIZATION_LIMITED_RANGE;
-		hdmi_info->bits.YQ0_YQ1 = YYC_QUANTIZATION_LIMITED_RANGE;
+	if (stream->public.sink->edid_caps.qs_bit == 1 &&
+			stream->public.sink->edid_caps.qy_bit == 1) {
+		if (color_space == COLOR_SPACE_SRGB ||
+			color_space == COLOR_SPACE_2020_RGB_FULLRANGE) {
+			hdmi_info->bits.Q0_Q1   = RGB_QUANTIZATION_FULL_RANGE;
+			hdmi_info->bits.YQ0_YQ1 = YYC_QUANTIZATION_FULL_RANGE;
+		} else if (color_space == COLOR_SPACE_SRGB_LIMITED ||
+					color_space == COLOR_SPACE_2020_RGB_LIMITEDRANGE) {
+			hdmi_info->bits.Q0_Q1   = RGB_QUANTIZATION_LIMITED_RANGE;
+			hdmi_info->bits.YQ0_YQ1 = YYC_QUANTIZATION_LIMITED_RANGE;
+		} else {
+			hdmi_info->bits.Q0_Q1   = RGB_QUANTIZATION_DEFAULT_RANGE;
+			hdmi_info->bits.YQ0_YQ1 = YYC_QUANTIZATION_LIMITED_RANGE;
+		}
 	} else {
 		hdmi_info->bits.Q0_Q1   = RGB_QUANTIZATION_DEFAULT_RANGE;
-		hdmi_info->bits.YQ0_YQ1 = YYC_QUANTIZATION_LIMITED_RANGE;
+		hdmi_info->bits.YQ0_YQ1   = YYC_QUANTIZATION_LIMITED_RANGE;
 	}
+
 	///VIC
 	format = stream->public.timing.timing_3d_format;
 	/*todo, add 3DStereo support*/
drivers/gpu/drm/amd/display/dc/dc_types.h +25 -0
index 9662f2c68f83..c7539fe36b66 100644
@@ -177,6 +177,18 @@ struct dc_edid {
 
 #define AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS 20
 
+union display_content_support {
+	unsigned int raw;
+	struct {
+		unsigned int valid_content_type :1;
+		unsigned int game_content :1;
+		unsigned int cinema_content :1;
+		unsigned int photo_content :1;
+		unsigned int graphics_content :1;
+		unsigned int reserved :27;
+	} bits;
+};
+
 struct dc_edid_caps {
 	/* sink identification */
 	uint16_t manufacturer_id;
@@ -193,6 +205,11 @@ struct dc_edid_caps {
 	uint32_t audio_latency;
 	uint32_t video_latency;
 
+	union display_content_support content_support;
+
+	uint8_t qs_bit;
+	uint8_t qy_bit;
+
 	/*HDMI 2.0 caps*/
 	bool lte_340mcsc_scramble;
 
@@ -384,6 +401,14 @@ enum scaling_transformation {
 		SCALING_TRANSFORMATION_PRESERVE_ASPECT_RATIO_SCALE
 };
 
+enum display_content_type {
+	DISPLAY_CONTENT_TYPE_NO_DATA = 0,
+	DISPLAY_CONTENT_TYPE_GRAPHICS = 1,
+	DISPLAY_CONTENT_TYPE_PHOTO = 2,
+	DISPLAY_CONTENT_TYPE_CINEMA = 4,
+	DISPLAY_CONTENT_TYPE_GAME = 8
+};
+
 /* audio*/
 
 union audio_sample_rates {
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#17 lore raw

PATCH 16/120 drm/amd/display: Change DTN_INFO macro

In reply to a message not in the archive

From: Wesley Chalmers <[email protected]>

Change-Id Icef7abde21b3a4f2320df06cb13da6920ef4be15
---
 drivers/gpu/drm/amd/display/include/logger_interface.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/include/logger_interface.h +1 -1
index c861e726cd8f..6e6fd4e8fc00 100644
@@ -124,7 +124,7 @@ void context_clock_trace(
 		__VA_ARGS__);
 
 #define DTN_INFO(...) \
-	dm_logger_write(dc_ctx->logger, LOG_DTN, \
+	dc_raw_log(dc_ctx, LOG_DTN, \
 		__VA_ARGS__)
 
 #define DC_SYNC_INFO(...) \
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#18 lore raw

PATCH 17/120 drm/amd/display: support for updated register headers on DCN

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I76c1db678a803dbd3dd9f7c9b7ad7b8538d9f613
---
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h     | 12 +++++++-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  2 +-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 14 +++++++--
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c   | 17 +++++++---
 .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c | 19 +++++++++---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h   | 15 ++++++++-
 .../amd/display/dc/dcn10/dcn10_timing_generator.c  | 36 ++++++++++++----------
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h        |  4 +++
 8 files changed, 88 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +11 -1
index 0479554bc231..80ee1ac32fee 100644
@@ -227,6 +227,15 @@ struct dce_hwseq_registers {
 	uint32_t DISPCLK_FREQ_CHANGE_CNTL;
 	uint32_t RBBMIF_TIMEOUT_DIS;
 	uint32_t RBBMIF_TIMEOUT_DIS_2;
+	uint32_t DENTIST_DISPCLK_CNTL;
+	uint32_t DCHUBBUB_CRC_CTRL;
+	uint32_t DPP_TOP0_DPP_CRC_CTRL;
+	uint32_t DPP_TOP0_DPP_CRC_VAL_R_G;
+	uint32_t DPP_TOP0_DPP_CRC_VAL_B_A;
+	uint32_t MPC_CRC_CTRL;
+	uint32_t MPC_CRC_RESULT_GB;
+	uint32_t MPC_CRC_RESULT_C;
+	uint32_t MPC_CRC_RESULT_AR;
 #endif
 };
  /* set field name */
@@ -388,7 +397,8 @@ struct dce_hwseq_registers {
 	type DOMAIN6_PGFSM_PWR_STATUS; \
 	type DOMAIN7_PGFSM_PWR_STATUS; \
 	type DCFCLK_GATE_DIS; \
-	type DCHUBBUB_GLOBAL_TIMER_REFDIV;
+	type DCHUBBUB_GLOBAL_TIMER_REFDIV; \
+	type DENTIST_DPPCLK_WDIVIDER;
 #endif
 
 struct dce_hwseq_shift {
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -1
index b691ef956d45..baafe6609d24 100644
@@ -256,7 +256,7 @@ static bool dce110_set_input_transfer_func(
 	ipp->funcs->ipp_program_prescale(ipp, &prescale_params);
 
 	if (surface->public.gamma_correction && dce_use_lut(surface))
-	    ipp->funcs->ipp_program_input_lut(ipp, surface->public.gamma_correction);
+		ipp->funcs->ipp_program_input_lut(ipp, surface->public.gamma_correction);
 
 	if (tf == NULL) {
 		/* Default case if no input transfer function specified */
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +12 -2
index 6db78d9f8e3b..ce7da8864507 100644
@@ -550,7 +550,9 @@ static void reset_front_end(
 	if (dc->public.debug.sanity_checks)
 		verify_allow_pstate_change_high(dc->hwseq);
 
-	REG_WAIT(OTG_GLOBAL_SYNC_STATUS[tg->inst], VUPDATE_NO_LOCK_EVENT_OCCURRED, 1, 20000, 200000);
+	if (tg->ctx->dce_environment != DCE_ENV_FPGA_MAXIMUS)
+		REG_WAIT(OTG_GLOBAL_SYNC_STATUS[tg->inst],
+				VUPDATE_NO_LOCK_EVENT_OCCURRED, 1, 20000, 200000);
 
 	mpcc->funcs->wait_for_idle(mpcc);
 
@@ -1295,6 +1297,7 @@ static void dcn10_power_on_fe(
 	/* make sure OPP_PIPE_CLOCK_EN = 1 */
 	REG_UPDATE(OPP_PIPE_CONTROL[pipe_ctx->tg->inst],
 			OPP_PIPE_CLOCK_EN, 1);
+	/*TODO: REG_UPDATE(DENTIST_DISPCLK_CNTL, DENTIST_DPPCLK_WDIVIDER, 0x1f);*/
 
 	if (dc_surface) {
 		dm_logger_write(dc->ctx->logger, LOG_DC,
@@ -1984,9 +1987,16 @@ static void dcn10_setup_stereo(struct pipe_ctx *pipe_ctx, struct core_dc *dc)
 static void dcn10_log_hw_state(struct core_dc *dc)
 {
 	struct dc_context *dc_ctx = dc->ctx;
+	struct dce_hwseq *hws = dc->hwseq;
 
 	DTN_INFO("%s: Hello World", __func__);
 
+	if (REG(MPC_CRC_RESULT_GB))
+		DTN_INFO("MPC_CRC_RESULT_GB:%d MPC_CRC_RESULT_C:%d MPC_CRC_RESULT_AR:%d\n",
+		REG_READ(MPC_CRC_RESULT_GB), REG_READ(MPC_CRC_RESULT_C), REG_READ(MPC_CRC_RESULT_AR));
+	if (REG(DPP_TOP0_DPP_CRC_VAL_B_A))
+		DTN_INFO("DPP_TOP0_DPP_CRC_VAL_B_A:%d DPP_TOP0_DPP_CRC_VAL_R_G:%d\n",
+		REG_READ(DPP_TOP0_DPP_CRC_VAL_B_A), REG_READ(DPP_TOP0_DPP_CRC_VAL_R_G));
 	/* todo: add meaningful register reads and print out HW state
 	 *
 	 */
@@ -2065,7 +2075,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = {
 	.set_static_screen_control = set_static_screen_control,
 	.setup_stereo = dcn10_setup_stereo,
 	.set_avmute = dce110_set_avmute,
-	.log_hw_state = dcn10_log_hw_state,
+	.log_hw_state = dcn10_log_hw_state
 };
 
 
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c +12 -5
index 53dd9a9593f0..ee12f671d8ea 100644
@@ -472,11 +472,18 @@ static bool ippn10_cursor_program_control(
 		bool pixel_data_invert,
 		enum dc_cursor_color_format color_format)
 {
-	REG_SET_2(CURSOR_SETTINS, 0,
-			/* no shift of the cursor HDL schedule */
-			CURSOR0_DST_Y_OFFSET, 0,
-			 /* used to shift the cursor chunk request deadline */
-			CURSOR0_CHUNK_HDL_ADJUST, 3);
+	if (REG(CURSOR_SETTINS))
+		REG_SET_2(CURSOR_SETTINS, 0,
+				/* no shift of the cursor HDL schedule */
+				CURSOR0_DST_Y_OFFSET, 0,
+				 /* used to shift the cursor chunk request deadline */
+				CURSOR0_CHUNK_HDL_ADJUST, 3);
+	else
+		REG_SET_2(CURSOR_SETTINGS, 0,
+				/* no shift of the cursor HDL schedule */
+				CURSOR0_DST_Y_OFFSET, 0,
+				 /* used to shift the cursor chunk request deadline */
+				CURSOR0_CHUNK_HDL_ADJUST, 3);
 
 	REG_UPDATE_2(CURSOR0_CONTROL,
 			CUR0_MODE, color_format,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c +14 -5
index 8054794dd96d..1f86295d6db6 100644
@@ -460,9 +460,14 @@ static void min10_program_deadline(
 		REFCYC_X_AFTER_SCALER, dlg_attr->refcyc_x_after_scaler,
 		DST_Y_AFTER_SCALER, dlg_attr->dst_y_after_scaler);
 
-	REG_SET_2(PREFETCH_SETTINS, 0,
-		DST_Y_PREFETCH, dlg_attr->dst_y_prefetch,
-		VRATIO_PREFETCH, dlg_attr->vratio_prefetch);
+	if (REG(PREFETCH_SETTINS))
+		REG_SET_2(PREFETCH_SETTINS, 0,
+			DST_Y_PREFETCH, dlg_attr->dst_y_prefetch,
+			VRATIO_PREFETCH, dlg_attr->vratio_prefetch);
+	else
+		REG_SET_2(PREFETCH_SETTINGS, 0,
+			DST_Y_PREFETCH, dlg_attr->dst_y_prefetch,
+			VRATIO_PREFETCH, dlg_attr->vratio_prefetch);
 
 	REG_SET_2(VBLANK_PARAMETERS_0, 0,
 		DST_Y_PER_VM_VBLANK, dlg_attr->dst_y_per_vm_vblank,
@@ -498,8 +503,12 @@ static void min10_program_deadline(
 		REFCYC_PER_LINE_DELIVERY_L, dlg_attr->refcyc_per_line_delivery_l,
 		REFCYC_PER_LINE_DELIVERY_C, dlg_attr->refcyc_per_line_delivery_c);
 
-	REG_SET(PREFETCH_SETTINS_C, 0,
-		VRATIO_PREFETCH_C, dlg_attr->vratio_prefetch_c);
+	if (REG(PREFETCH_SETTINS_C))
+		REG_SET(PREFETCH_SETTINS_C, 0,
+			VRATIO_PREFETCH_C, dlg_attr->vratio_prefetch_c);
+	else
+		REG_SET(PREFETCH_SETTINGS_C, 0,
+			VRATIO_PREFETCH_C, dlg_attr->vratio_prefetch_c);
 
 	REG_SET(VBLANK_PARAMETERS_2, 0,
 		REFCYC_PER_PTE_GROUP_VBLANK_C, dlg_attr->refcyc_per_pte_group_vblank_c);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h +14 -1
index de0b631736bb..d9d66a4afb19 100644
@@ -123,7 +123,6 @@
 	SRI(CM_MEM_PWR_CTRL, CM, id), \
 	SRI(CM_RGAM_LUT_DATA, CM, id)
 
-
 #define OPP_MASK_SH_LIST_DCN(mask_sh) \
 	OPP_SF(DSCL0_OBUF_CONTROL, OBUF_BYPASS, mask_sh), \
 	OPP_SF(FMT0_FMT_BIT_DEPTH_CONTROL, FMT_TRUNCATE_EN, mask_sh), \
@@ -357,6 +356,16 @@
 	OPP_SF(CM0_CM_RGAM_LUT_DATA, CM_RGAM_LUT_DATA, mask_sh)
 
 #define OPP_DCN10_REG_FIELD_LIST(type) \
+	type DPG_EN; \
+	type DPG_MODE; \
+	type DPG_VRES; \
+	type DPG_HRES; \
+	type DPG_COLOUR0_R_CR; \
+	type DPG_COLOUR1_R_CR; \
+	type DPG_COLOUR0_B_CB; \
+	type DPG_COLOUR1_B_CB; \
+	type DPG_COLOUR0_G_Y; \
+	type DPG_COLOUR1_G_Y; \
 	type CM_OCSC_C11; \
 	type CM_OCSC_C12; \
 	type CM_OCSC_C13; \
@@ -594,6 +603,10 @@ struct dcn10_opp_mask {
 };
 
 struct dcn10_opp_registers {
+	uint32_t DPG_CONTROL;
+	uint32_t DPG_COLOUR_B_CB;
+	uint32_t DPG_COLOUR_G_Y;
+	uint32_t DPG_COLOUR_R_CR;
 	uint32_t CM_OCSC_C11_C12;
 	uint32_t CM_OCSC_C13_C14;
 	uint32_t CM_OCSC_C21_C22;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c +20 -16
index 12d7f3570cfa..b2e796d87dac 100644
@@ -345,17 +345,18 @@ static void tgn10_enable_optc_clock(struct timing_generator *tg, bool enable)
 	struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg);
 
 	if (enable) {
-		REG_UPDATE(OPTC_INPUT_CLOCK_CONTROL,
-				OPTC_INPUT_CLK_EN, 1);
+		REG_UPDATE_2(OPTC_INPUT_CLOCK_CONTROL,
+				OPTC_INPUT_CLK_EN, 1,
+				OPTC_INPUT_CLK_GATE_DIS, 1);
 
 		REG_WAIT(OPTC_INPUT_CLOCK_CONTROL,
 				OPTC_INPUT_CLK_ON, 1,
 				2000, 500);
 
 		/* Enable clock */
-		REG_UPDATE(OTG_CLOCK_CONTROL,
-				OTG_CLOCK_EN, 1);
-
+		REG_UPDATE_2(OTG_CLOCK_CONTROL,
+				OTG_CLOCK_EN, 1,
+				OTG_CLOCK_GATE_DIS, 1);
 		REG_WAIT(OTG_CLOCK_CONTROL,
 				OTG_CLOCK_ON, 1,
 				2000, 500);
@@ -364,17 +365,19 @@ static void tgn10_enable_optc_clock(struct timing_generator *tg, bool enable)
 				OTG_CLOCK_GATE_DIS, 0,
 				OTG_CLOCK_EN, 0);
 
-		REG_WAIT(OTG_CLOCK_CONTROL,
-				OTG_CLOCK_ON, 0,
-				2000, 500);
+		if (tg->ctx->dce_environment != DCE_ENV_FPGA_MAXIMUS)
+			REG_WAIT(OTG_CLOCK_CONTROL,
+					OTG_CLOCK_ON, 0,
+					2000, 500);
 
 		REG_UPDATE_2(OPTC_INPUT_CLOCK_CONTROL,
 				OPTC_INPUT_CLK_GATE_DIS, 0,
 				OPTC_INPUT_CLK_EN, 0);
 
-		REG_WAIT(OPTC_INPUT_CLOCK_CONTROL,
-				OPTC_INPUT_CLK_ON, 0,
-				2000, 500);
+		if (tg->ctx->dce_environment != DCE_ENV_FPGA_MAXIMUS)
+			REG_WAIT(OPTC_INPUT_CLOCK_CONTROL,
+					OPTC_INPUT_CLK_ON, 0,
+					2000, 500);
 	}
 }
 
@@ -574,9 +577,10 @@ static void tgn10_lock(struct timing_generator *tg)
 	REG_SET(OTG_MASTER_UPDATE_LOCK, 0,
 			OTG_MASTER_UPDATE_LOCK, 1);
 
-	REG_WAIT(OTG_MASTER_UPDATE_LOCK,
-			UPDATE_LOCK_STATUS, 1,
-			1, 100);
+	if (tg->ctx->dce_environment != DCE_ENV_FPGA_MAXIMUS)
+		REG_WAIT(OTG_MASTER_UPDATE_LOCK,
+				UPDATE_LOCK_STATUS, 1,
+				1, 100);
 }
 
 static void tgn10_unlock(struct timing_generator *tg)
@@ -587,9 +591,9 @@ static void tgn10_unlock(struct timing_generator *tg)
 			OTG_MASTER_UPDATE_LOCK, 0);
 
 	/* why are we waiting here? */
-	/*REG_WAIT(OTG_DOUBLE_BUFFER_CONTROL,
+	REG_WAIT(OTG_DOUBLE_BUFFER_CONTROL,
 			OTG_UPDATE_PENDING, 0,
-			20000, 200000);*/
+			20000, 200000);
 }
 
 static void tgn10_get_position(struct timing_generator *tg,
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +4 -0
index a101f4b5e0c7..4b0c28eef352 100644
@@ -324,6 +324,10 @@ struct opp_funcs {
 			struct output_pixel_processor *opp,
 			bool enable,
 			bool rightEyePolarity);
+
+	void (*opp_set_test_pattern)(
+			struct output_pixel_processor *opp,
+			bool enable);
 };
 
 #endif
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#19 lore raw

PATCH 18/120 drm/amd/display: Roll surface struct into core_surface

In reply to a message not in the archive
Change-Id I4d6400e7e7f8c364ada2fbeda5c998ca90d7a834
---
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 37 +++++++++---------------
 drivers/gpu/drm/amd/display/dc/inc/core_types.h  |  4 +++
 2 files changed, 18 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +14 -23
index d44ddfb85748..3784358d35ef 100644
@@ -34,20 +34,11 @@
 /*******************************************************************************
  * Private structures
  ******************************************************************************/
-struct surface {
-	struct core_surface protected;
-	enum dc_irq_source irq_source;
-	int ref_count;
-};
-
 struct gamma {
 	struct core_gamma protected;
 	int ref_count;
 };
 
-#define DC_SURFACE_TO_SURFACE(dc_surface) container_of(dc_surface, struct surface, protected.public)
-#define CORE_SURFACE_TO_SURFACE(core_surface) container_of(core_surface, struct surface, protected)
-
 #define DC_GAMMA_TO_GAMMA(dc_gamma) \
 	container_of(dc_gamma, struct gamma, protected.public)
 #define CORE_GAMMA_TO_GAMMA(core_gamma) \
@@ -56,23 +47,23 @@ struct gamma {
 /*******************************************************************************
  * Private functions
  ******************************************************************************/
-static bool construct(struct dc_context *ctx, struct surface *surface)
+static bool construct(struct dc_context *ctx, struct core_surface *surface)
 {
-	surface->protected.ctx = ctx;
-	memset(&surface->protected.public.hdr_static_ctx,
+	surface->ctx = ctx;
+	memset(&surface->public.hdr_static_ctx,
 			0, sizeof(struct dc_hdr_static_metadata));
 	return true;
 }
 
-static void destruct(struct surface *surface)
+static void destruct(struct core_surface *surface)
 {
-	if (surface->protected.public.gamma_correction != NULL) {
-		dc_gamma_release(&surface->protected.public.gamma_correction);
+	if (surface->public.gamma_correction != NULL) {
+		dc_gamma_release(&surface->public.gamma_correction);
 	}
-	if (surface->protected.public.in_transfer_func != NULL) {
+	if (surface->public.in_transfer_func != NULL) {
 		dc_transfer_func_release(
-				surface->protected.public.in_transfer_func);
-		surface->protected.public.in_transfer_func = NULL;
+				surface->public.in_transfer_func);
+		surface->public.in_transfer_func = NULL;
 	}
 }
 
@@ -82,7 +73,7 @@ static void destruct(struct surface *surface)
 void enable_surface_flip_reporting(struct dc_surface *dc_surface,
 		uint32_t controller_id)
 {
-	struct surface *surface = DC_SURFACE_TO_SURFACE(dc_surface);
+	struct core_surface *surface = DC_SURFACE_TO_CORE(dc_surface);
 	surface->irq_source = controller_id + DC_IRQ_SOURCE_PFLIP1 - 1;
 	/*register_flip_interrupt(surface);*/
 }
@@ -91,7 +82,7 @@ struct dc_surface *dc_create_surface(const struct dc *dc)
 {
 	struct core_dc *core_dc = DC_TO_CORE(dc);
 
-	struct surface *surface = dm_alloc(sizeof(*surface));
+	struct core_surface *surface = dm_alloc(sizeof(*surface));
 
 	if (NULL == surface)
 		goto alloc_fail;
@@ -101,7 +92,7 @@ struct dc_surface *dc_create_surface(const struct dc *dc)
 
 	++surface->ref_count;
 
-	return &surface->protected.public;
+	return &surface->public;
 
 construct_fail:
 	dm_free(surface);
@@ -146,7 +137,7 @@ const struct dc_surface_status *dc_surface_get_status(
 
 void dc_surface_retain(const struct dc_surface *dc_surface)
 {
-	struct surface *surface = DC_SURFACE_TO_SURFACE(dc_surface);
+	struct core_surface *surface = DC_SURFACE_TO_CORE(dc_surface);
 
 	ASSERT(surface->ref_count > 0);
 	++surface->ref_count;
@@ -154,7 +145,7 @@ void dc_surface_retain(const struct dc_surface *dc_surface)
 
 void dc_surface_release(const struct dc_surface *dc_surface)
 {
-	struct surface *surface = DC_SURFACE_TO_SURFACE(dc_surface);
+	struct core_surface *surface = DC_SURFACE_TO_CORE(dc_surface);
 
 	ASSERT(surface->ref_count > 0);
 	--surface->ref_count;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +4 -0
index d75368030917..30177f839b8a 100644
@@ -53,6 +53,10 @@ struct core_surface {
 	struct dc_surface public;
 	struct dc_surface_status status;
 	struct dc_context *ctx;
+
+	/* private to dc_surface.c */
+	enum dc_irq_source irq_source;
+	int ref_count;
 };
 
 struct core_gamma {
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#20 lore raw

PATCH 19/120 drm/amd/display: fix decide_link_settings

In reply to a message not in the archive

From: Ding Wang <[email protected]>

Change-Id I564f7b593893b459d2c455ffe3c4767c030c4a96
---
 drivers/gpu/drm/amd/display/dc/core/dc.c         |   6 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 140 ++++++++++-------------
 drivers/gpu/drm/amd/display/dc/dc.h              |   1 +
 3 files changed, 63 insertions(+), 84 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -4
index ad1b90563eb6..de05ad09599f 100644
@@ -308,10 +308,8 @@ static void set_preferred_link_settings(struct dc *dc,
 {
 	struct core_link *core_link = DC_LINK_TO_CORE(link);
 
-	core_link->public.verified_link_cap.lane_count =
-				link_setting->lane_count;
-	core_link->public.verified_link_cap.link_rate =
-				link_setting->link_rate;
+	core_link->public.preferred_link_setting =
+				*link_setting;
 	dp_retrain_link_dp_test(core_link, link_setting, false);
 }
 
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +60 -80

184 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index 617270829936..ee04c3562081 100644
@@ -674,6 +674,7 @@ struct dc_link {
 	struct dc_link_settings max_link_setting;
 	struct dc_link_settings cur_link_settings;
 	struct dc_lane_settings cur_lane_setting;
+	struct dc_link_settings preferred_link_setting;
 
 	uint8_t ddc_hw_inst;
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#21 lore raw

PATCH 20/120 drm/amd/display: move VGA to HWSS from TG

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

Change-Id I44037c65816a4adab4e852c1c0b476a56862cd2d
---
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h     | 11 ++++++-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  3 +-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 12 ++++++-
 .../amd/display/dc/dcn10/dcn10_timing_generator.c  | 38 ----------------------
 4 files changed, 23 insertions(+), 41 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +10 -1
index 80ee1ac32fee..7feb1ca9b8c0 100644
@@ -170,7 +170,12 @@
 	SR(DIO_MEM_PWR_CTRL), \
 	SR(DCCG_GATE_DISABLE_CNTL), \
 	SR(DCCG_GATE_DISABLE_CNTL2), \
-	SR(DCFCLK_CNTL)
+	SR(DCFCLK_CNTL),\
+	SR(DCFCLK_CNTL), \
+	SR(D1VGA_CONTROL), \
+	SR(D2VGA_CONTROL), \
+	SR(D3VGA_CONTROL), \
+	SR(D4VGA_CONTROL)
 #endif
 
 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
@@ -236,6 +241,10 @@ struct dce_hwseq_registers {
 	uint32_t MPC_CRC_RESULT_GB;
 	uint32_t MPC_CRC_RESULT_C;
 	uint32_t MPC_CRC_RESULT_AR;
+	uint32_t D1VGA_CONTROL;
+	uint32_t D2VGA_CONTROL;
+	uint32_t D3VGA_CONTROL;
+	uint32_t D4VGA_CONTROL;
 #endif
 };
  /* set field name */
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +2 -1
index baafe6609d24..72e099953a05 100644
@@ -1198,7 +1198,8 @@ static void disable_vga_and_power_gate_all_controllers(
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
 		tg = dc->res_pool->timing_generators[i];
 
-		tg->funcs->disable_vga(tg);
+		if (tg->funcs->disable_vga)
+			tg->funcs->disable_vga(tg);
 
 		/* Enable CLOCK gating for each pipe BEFORE controller
 		 * powergating. */
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +11 -1
index ce7da8864507..64f2fd0d539e 100644
@@ -163,6 +163,15 @@ static void enable_power_gating_plane(
 	REG_UPDATE(DOMAIN7_PG_CONFIG, DOMAIN7_POWER_FORCEON, force_on);
 }
 
+static void disable_vga(
+	struct dce_hwseq *hws)
+{
+	REG_WRITE(D1VGA_CONTROL, 0);
+	REG_WRITE(D2VGA_CONTROL, 0);
+	REG_WRITE(D3VGA_CONTROL, 0);
+	REG_WRITE(D4VGA_CONTROL, 0);
+}
+
 static void dpp_pg_control(
 		struct dce_hwseq *hws,
 		unsigned int dpp_inst,
@@ -312,6 +321,8 @@ static void dcn10_init_hw(struct core_dc *dc)
 
 	bios_golden_init(dc);
 
+	disable_vga(dc->hwseq);
+
 	for (i = 0; i < dc->link_count; i++) {
 		/* Power up AND update implementation according to the
 		 * required signal (which may be different from the
@@ -335,7 +346,6 @@ static void dcn10_init_hw(struct core_dc *dc)
 		mpcc_cfg.top_of_tree = true;
 		mpcc->funcs->set(mpcc, &mpcc_cfg);
 
-		tg->funcs->disable_vga(tg);
 		/* Blank controller using driver code instead of
 		 * command table.
 		 */
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c +0 -38
index b2e796d87dac..0ef5d8f0625c 100644
@@ -447,43 +447,6 @@ static void tgn10_program_blank_color(
 			OTG_BLACK_COLOR_R_CR, black_color->color_r_cr);
 }
 
-/**
- * dcn10_dcn10_timing_generator_disable_vga
- * Turn OFF VGA Mode and Timing  - DxVGA_CONTROL
- * VGA Mode and VGA Timing is used by VBIOS on CRT Monitors;
- */
-/* TODO FPGA FPGA setup is done by Diag which does not enable VGA mode.
- * VGA is disable by ASIC default. This function is not needed for
- * FPGA story.
- * usage:
- * init_hw  within dc.c
- * disable_vga_and_power_gate_all_controllers within dce110_hw_sequencer.c
- * We may move init_hw into DC specific so that we can remove
- * .disable_vga from upper layer stack
- */
-static void tgn10_disable_vga(
-			struct timing_generator *tg)
-{
-	struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg);
-
-	switch (tgn10->base.inst) {
-	case 0:
-		REG_WRITE(D1VGA_CONTROL, 0);
-		break;
-	case 1:
-		REG_WRITE(D2VGA_CONTROL, 0);
-		break;
-	case 2:
-		REG_WRITE(D2VGA_CONTROL, 0);
-		break;
-	case 3:
-		REG_WRITE(D4VGA_CONTROL, 0);
-		break;
-	default:
-		break;
-	}
-}
-
 static bool tgn10_validate_timing(
 	struct timing_generator *tg,
 	const struct dc_crtc_timing *timing)
@@ -1144,7 +1107,6 @@ static struct timing_generator_funcs dcn10_tg_funcs = {
 		.set_blank = tgn10_set_blank,
 		.is_blanked = tgn10_is_blanked,
 		.set_blank_color = tgn10_program_blank_color,
-		.disable_vga = tgn10_disable_vga,
 		.did_triggered_reset_occur = tgn10_did_triggered_reset_occur,
 		.enable_reset_trigger = tgn10_enable_reset_trigger,
 		.disable_reset_trigger = tgn10_disable_reset_trigger,
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#22 lore raw

PATCH 21/120 drm/amd/display: Fix generic_reg_wait 1000ms case

In reply to a message not in the archive

From: Eric Yang <[email protected]>

Change-Id I1259c3903bbdc35d31153ff0247f5eea7b73ad3d
---
 drivers/gpu/drm/amd/display/dc/dc_helper.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_helper.c +3 -4
index 87b7f6f8870e..f219bd2068e5 100644
@@ -143,11 +143,10 @@ uint32_t generic_reg_wait(const struct dc_context *ctx,
 
 	for (i = 0; i <= time_out_num_tries; i++) {
 		if (i) {
-			if (0 < delay_between_poll_us && delay_between_poll_us < 1000)
-				udelay(delay_between_poll_us);
-
-			if (delay_between_poll_us > 1000)
+			if (delay_between_poll_us >= 1000)
 				msleep(delay_between_poll_us/1000);
+			else if (delay_between_poll_us > 0)
+				udelay(delay_between_poll_us);
 		}
 
 		reg_val = dm_read_reg(ctx, addr);
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#23 lore raw

PATCH 22/120 drm/amd/display: add idle wait for passive surface update and modeset

In reply to a message not in the archive

From: Eric Yang <[email protected]>

Change-Id I035d028c97e941e7842b43544cc91bc892df36ab
---
 drivers/gpu/drm/amd/display/dc/core/dc.c              | 19 +++++++++++++++++++
 .../gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 18 +++++++++++++++++-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c      |  4 ++++
 drivers/gpu/drm/amd/display/dc/inc/core_types.h       |  2 --
 drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h     |  3 +++
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h           |  1 +
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h     |  2 ++
 7 files changed, 46 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +19 -0
index de05ad09599f..9ef671735125 100644
@@ -934,6 +934,10 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c
 	if (!dcb->funcs->is_accelerated_mode(dcb))
 		core_dc->hwss.enable_accelerated_mode(core_dc);
 
+	for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
+		pipe = &context->res_ctx.pipe_ctx[i];
+		core_dc->hwss.wait_for_mpcc_disconnect(core_dc->res_pool, pipe);
+	}
 	result = core_dc->hwss.apply_ctx_to_hw(core_dc, context);
 
 	program_timing_sync(core_dc, context);
@@ -1537,6 +1541,21 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 		}
 	}
 
+	if (update_type > UPDATE_TYPE_FAST) {
+		for (i = 0; i < surface_count; i++) {
+			struct core_surface *surface = DC_SURFACE_TO_CORE(srf_updates[i].surface);
+
+			for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
+				struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
+
+				if (pipe_ctx->surface != surface)
+					continue;
+
+				core_dc->hwss.wait_for_mpcc_disconnect(core_dc->res_pool, pipe_ctx);
+			}
+		}
+	}
+
 	if (surface_count == 0)
 		core_dc->hwss.apply_ctx_for_surface(core_dc, NULL, context);
 
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +17 -1
index 64f2fd0d539e..633d858caf6f 100644
@@ -1739,6 +1739,7 @@ static void dcn10_apply_ctx_for_surface(
 			mpcc_cfg.bot_mpcc_id = 0xf;
 			mpcc_cfg.top_of_tree = !old_pipe_ctx->top_pipe;
 			old_pipe_ctx->mpcc->funcs->set(old_pipe_ctx->mpcc, &mpcc_cfg);
+			old_pipe_ctx->top_pipe->opp->mpcc_disconnect_pending[old_pipe_ctx->mpcc->inst] = true;
 
 			if (dc->public.debug.sanity_checks)
 				verify_allow_pstate_change_high(dc->hwseq);
@@ -2012,6 +2013,20 @@ static void dcn10_log_hw_state(struct core_dc *dc)
 	 */
 }
 
+static void dcn10_wait_for_mpcc_disconnect(struct resource_pool *res_pool, struct pipe_ctx *pipe_ctx)
+{
+	int i;
+	for (i = 0; i < MAX_PIPES; i++) {
+		if (!pipe_ctx->opp || !pipe_ctx->mpcc)
+			continue;
+
+		if (pipe_ctx->opp->mpcc_disconnect_pending[i]) {
+			pipe_ctx->mpcc->funcs->wait_for_idle(res_pool->mpcc[i]);
+			pipe_ctx->opp->mpcc_disconnect_pending[i] = false;
+		}
+	}
+}
+
 static bool dcn10_dummy_display_power_gating(
 	struct core_dc *dc,
 	uint8_t controller_id,
@@ -2085,7 +2100,8 @@ static const struct hw_sequencer_funcs dcn10_funcs = {
 	.set_static_screen_control = set_static_screen_control,
 	.setup_stereo = dcn10_setup_stereo,
 	.set_avmute = dce110_set_avmute,
-	.log_hw_state = dcn10_log_hw_state
+	.log_hw_state = dcn10_log_hw_state,
+	.wait_for_mpcc_disconnect = dcn10_wait_for_mpcc_disconnect
 };
 
 
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c +4 -0
index 669ac4b67ea9..c2aa69deecc2 100644
@@ -907,10 +907,14 @@ void dcn10_opp_construct(struct dcn10_opp *oppn10,
 	const struct dcn10_opp_shift *opp_shift,
 	const struct dcn10_opp_mask *opp_mask)
 {
+	int i;
 	oppn10->base.ctx = ctx;
 	oppn10->base.inst = inst;
 	oppn10->base.funcs = &dcn10_opp_funcs;
 
+	for (i = 0; i < MAX_PIPES; i++)
+		oppn10->base.mpcc_disconnect_pending[i] = false;
+
 	oppn10->regs = regs;
 	oppn10->opp_shift = opp_shift;
 	oppn10->opp_mask = opp_mask;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +0 -2
index 30177f839b8a..cc65cfdea66f 100644
@@ -38,10 +38,8 @@
 
 struct core_stream;
 
-#define MAX_PIPES 6
 #define MAX_CLOCK_SOURCES 7
 
-
 /********* core_surface **********/
 #define DC_SURFACE_TO_CORE(dc_surface) \
 	container_of(dc_surface, struct core_surface, public)
drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h +3 -0
index 907e0a9a8474..0212618a36be 100644
@@ -32,6 +32,9 @@
 /******************************************************************************
  * Data types shared between different Virtual HW blocks
  ******************************************************************************/
+
+#define MAX_PIPES 6
+
 struct gamma_curve {
 	uint32_t offset;
 	uint32_t segments_num;
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +1 -0
index 4b0c28eef352..57bdd6c8f955 100644
@@ -207,6 +207,7 @@ struct output_pixel_processor {
 	struct dc_context *ctx;
 	uint32_t inst;
 	struct pwl_params regamma_params;
+	bool mpcc_disconnect_pending[MAX_PIPES];
 	const struct opp_funcs *funcs;
 };
 
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +2 -0
index 4c027a98cfd3..22aca5a375ae 100644
@@ -156,6 +156,8 @@ struct hw_sequencer_funcs {
 	void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable);
 
 	void (*log_hw_state)(struct core_dc *dc);
+
+	void (*wait_for_mpcc_disconnect)(struct resource_pool *res_pool, struct pipe_ctx *pipe_ctx);
 };
 
 void color_space_to_black_color(
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#24 lore raw

PATCH 23/120 drm/amd/display: move ocsc programming from opp to dpp

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

Change-Id Ib7eac942a62548ca81f0bdc1655ab4d80634df45
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c   | 148 +++++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h   |  46 ++++++-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  |   2 +-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c   | 147 --------------------
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h   |  40 ------
 drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h  |  37 ++++++
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h        |  21 ---
 drivers/gpu/drm/amd/display/dc/inc/hw/transform.h  |  26 ++--
 8 files changed, 242 insertions(+), 225 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c +148 -0
index fff81a14b21c..0f3f1a31f10b 100644
@@ -988,11 +988,159 @@ static void dcn_dpp_set_gamut_remap(
 	}
 }
 
+static void oppn10_set_output_csc_default(
+		struct transform *xfm_base,
+		const struct default_adjustment *default_adjust)
+{
+
+	struct dcn10_dpp *xfm = TO_DCN10_DPP(xfm_base);
+	uint32_t ocsc_mode = 0;
+
+	if (default_adjust != NULL) {
+		switch (default_adjust->out_color_space) {
+		case COLOR_SPACE_SRGB:
+		case COLOR_SPACE_2020_RGB_FULLRANGE:
+			ocsc_mode = 0;
+			break;
+		case COLOR_SPACE_SRGB_LIMITED:
+		case COLOR_SPACE_2020_RGB_LIMITEDRANGE:
+			ocsc_mode = 1;
+			break;
+		case COLOR_SPACE_YCBCR601:
+		case COLOR_SPACE_YCBCR601_LIMITED:
+			ocsc_mode = 2;
+			break;
+		case COLOR_SPACE_YCBCR709:
+		case COLOR_SPACE_YCBCR709_LIMITED:
+		case COLOR_SPACE_2020_YCBCR:
+			ocsc_mode = 3;
+			break;
+		case COLOR_SPACE_UNKNOWN:
+		default:
+			break;
+		}
+	}
+
+	REG_SET(CM_OCSC_CONTROL, 0, CM_OCSC_MODE, ocsc_mode);
+
+}
+
+static void oppn10_program_color_matrix(
+		struct dcn10_dpp *xfm,
+		const struct out_csc_color_matrix *tbl_entry)
+{
+	uint32_t mode;
+
+	REG_GET(CM_OCSC_CONTROL, CM_OCSC_MODE, &mode);
+
+	if (tbl_entry == NULL) {
+		BREAK_TO_DEBUGGER();
+		return;
+	}
+
+	if (mode == 4) {
+		/*R*/
+		REG_SET_2(CM_OCSC_C11_C12, 0,
+			CM_OCSC_C11, tbl_entry->regval[0],
+			CM_OCSC_C12, tbl_entry->regval[1]);
+
+		REG_SET_2(CM_OCSC_C13_C14, 0,
+			CM_OCSC_C13, tbl_entry->regval[2],
+			CM_OCSC_C14, tbl_entry->regval[3]);
+
+		/*G*/
+		REG_SET_2(CM_OCSC_C21_C22, 0,
+			CM_OCSC_C21, tbl_entry->regval[4],
+			CM_OCSC_C22, tbl_entry->regval[5]);
+
+		REG_SET_2(CM_OCSC_C23_C24, 0,
+			CM_OCSC_C23, tbl_entry->regval[6],
+			CM_OCSC_C24, tbl_entry->regval[7]);
+
+		/*B*/
+		REG_SET_2(CM_OCSC_C31_C32, 0,
+			CM_OCSC_C31, tbl_entry->regval[8],
+			CM_OCSC_C32, tbl_entry->regval[9]);
+
+		REG_SET_2(CM_OCSC_C33_C34, 0,
+			CM_OCSC_C33, tbl_entry->regval[10],
+			CM_OCSC_C34, tbl_entry->regval[11]);
+	} else {
+		/*R*/
+		REG_SET_2(CM_COMB_C11_C12, 0,
+			CM_COMB_C11, tbl_entry->regval[0],
+			CM_COMB_C12, tbl_entry->regval[1]);
+
+		REG_SET_2(CM_COMB_C13_C14, 0,
+			CM_COMB_C13, tbl_entry->regval[2],
+			CM_COMB_C14, tbl_entry->regval[3]);
+
+		/*G*/
+		REG_SET_2(CM_COMB_C21_C22, 0,
+			CM_COMB_C21, tbl_entry->regval[4],
+			CM_COMB_C22, tbl_entry->regval[5]);
+
+		REG_SET_2(CM_COMB_C23_C24, 0,
+			CM_COMB_C23, tbl_entry->regval[6],
+			CM_COMB_C24, tbl_entry->regval[7]);
+
+		/*B*/
+		REG_SET_2(CM_COMB_C31_C32, 0,
+			CM_COMB_C31, tbl_entry->regval[8],
+			CM_COMB_C32, tbl_entry->regval[9]);
+
+		REG_SET_2(CM_COMB_C33_C34, 0,
+			CM_COMB_C33, tbl_entry->regval[10],
+			CM_COMB_C34, tbl_entry->regval[11]);
+	}
+}
+
+static void oppn10_set_output_csc_adjustment(
+		struct transform *xfm_base,
+		const struct out_csc_color_matrix *tbl_entry)
+{
+	struct dcn10_dpp *xfm = TO_DCN10_DPP(xfm_base);
+	//enum csc_color_mode config = CSC_COLOR_MODE_GRAPHICS_OUTPUT_CSC;
+	uint32_t ocsc_mode = 4;
+
+	/**
+	*if (tbl_entry != NULL) {
+	*	switch (tbl_entry->color_space) {
+	*	case COLOR_SPACE_SRGB:
+	*	case COLOR_SPACE_2020_RGB_FULLRANGE:
+	*		ocsc_mode = 0;
+	*		break;
+	*	case COLOR_SPACE_SRGB_LIMITED:
+	*	case COLOR_SPACE_2020_RGB_LIMITEDRANGE:
+	*		ocsc_mode = 1;
+	*		break;
+	*	case COLOR_SPACE_YCBCR601:
+	*	case COLOR_SPACE_YCBCR601_LIMITED:
+	*		ocsc_mode = 2;
+	*		break;
+	*	case COLOR_SPACE_YCBCR709:
+	*	case COLOR_SPACE_YCBCR709_LIMITED:
+	*	case COLOR_SPACE_2020_YCBCR:
+	*		ocsc_mode = 3;
+	*		break;
+	*	case COLOR_SPACE_UNKNOWN:
+	*	default:
+	*		break;
+	*	}
+	*}
+	*/
+
+	REG_SET(CM_OCSC_CONTROL, 0, CM_OCSC_MODE, ocsc_mode);
+	oppn10_program_color_matrix(xfm, tbl_entry);
+}
+
 static struct transform_funcs dcn10_dpp_funcs = {
 		.transform_reset = dpp_reset,
 		.transform_set_scaler = dpp_set_scaler_manual_scale,
 		.transform_get_optimal_number_of_taps = dpp_get_optimal_number_of_taps,
 		.transform_set_gamut_remap = dcn_dpp_set_gamut_remap,
+		.opp_set_csc_adjustment = oppn10_set_output_csc_adjustment,
+		.opp_set_csc_default = oppn10_set_output_csc_default,
 };
 
 /*****************************************/
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h +43 -3

70 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
index 633d858caf6f..4cbca15e1cc5 100644
@@ -1588,7 +1588,7 @@ static void update_dchubp_dpp(
 
 	/*TODO add adjustments parameters*/
 	ocsc.out_color_space = pipe_ctx->stream->public.output_color_space;
-	pipe_ctx->opp->funcs->opp_set_csc_default(pipe_ctx->opp, &ocsc);
+	pipe_ctx->xfm->funcs->opp_set_csc_default(pipe_ctx->xfm, &ocsc);
 
 	mi->funcs->mem_input_program_surface_config(
 		mi,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c +0 -147

167 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h +0 -40
index d9d66a4afb19..900298d6e5b5 100644
@@ -46,21 +46,8 @@
 
 #define OPP_REG_LIST_DCN10(id) \
 	OPP_REG_LIST_DCN(id), \
-	SRI(CM_OCSC_C11_C12, CM, id), \
-	SRI(CM_OCSC_C13_C14, CM, id), \
-	SRI(CM_OCSC_C21_C22, CM, id), \
-	SRI(CM_OCSC_C23_C24, CM, id), \
-	SRI(CM_OCSC_C31_C32, CM, id), \
-	SRI(CM_OCSC_C33_C34, CM, id), \
-	SRI(CM_COMB_C11_C12, CM, id), \
-	SRI(CM_COMB_C13_C14, CM, id), \
-	SRI(CM_COMB_C21_C22, CM, id), \
-	SRI(CM_COMB_C23_C24, CM, id), \
-	SRI(CM_COMB_C31_C32, CM, id), \
-	SRI(CM_COMB_C33_C34, CM, id), \
 	SRI(CM_RGAM_LUT_WRITE_EN_MASK, CM, id), \
 	SRI(CM_RGAM_CONTROL, CM, id), \
-	SRI(CM_OCSC_CONTROL, CM, id), \
 	SRI(CM_RGAM_RAMB_START_CNTL_B, CM, id), \
 	SRI(CM_RGAM_RAMB_START_CNTL_G, CM, id), \
 	SRI(CM_RGAM_RAMB_START_CNTL_R, CM, id), \
@@ -151,32 +138,7 @@
 #define OPP_MASK_SH_LIST_DCN10(mask_sh) \
 	OPP_MASK_SH_LIST_DCN(mask_sh), \
 	OPP_SF(DSCL0_OBUF_CONTROL, OBUF_H_2X_UPSCALE_EN, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C11_C12, CM_OCSC_C11, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C11_C12, CM_OCSC_C12, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C13_C14, CM_OCSC_C13, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C13_C14, CM_OCSC_C14, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C21_C22, CM_OCSC_C21, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C21_C22, CM_OCSC_C22, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C23_C24, CM_OCSC_C23, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C23_C24, CM_OCSC_C24, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C31_C32, CM_OCSC_C31, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C31_C32, CM_OCSC_C32, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C33_C34, CM_OCSC_C33, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_C33_C34, CM_OCSC_C34, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C11_C12, CM_COMB_C11, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C11_C12, CM_COMB_C12, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C13_C14, CM_COMB_C13, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C13_C14, CM_COMB_C14, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C21_C22, CM_COMB_C21, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C21_C22, CM_COMB_C22, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C23_C24, CM_COMB_C23, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C23_C24, CM_COMB_C24, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C31_C32, CM_COMB_C31, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C31_C32, CM_COMB_C32, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C33_C34, CM_COMB_C33, mask_sh), \
-	OPP_SF(CM0_CM_COMB_C33_C34, CM_COMB_C34, mask_sh), \
 	OPP_SF(CM0_CM_RGAM_CONTROL, CM_RGAM_LUT_MODE, mask_sh), \
-	OPP_SF(CM0_CM_OCSC_CONTROL, CM_OCSC_MODE, mask_sh), \
 	OPP_SF(CM0_CM_RGAM_RAMB_START_CNTL_B, CM_RGAM_RAMB_EXP_REGION_START_B, mask_sh), \
 	OPP_SF(CM0_CM_RGAM_RAMB_START_CNTL_B, CM_RGAM_RAMB_EXP_REGION_START_SEGMENT_B, mask_sh), \
 	OPP_SF(CM0_CM_RGAM_RAMB_START_CNTL_G, CM_RGAM_RAMB_EXP_REGION_START_G, mask_sh), \
@@ -414,7 +376,6 @@
 	type FMT_DYNAMIC_EXP_EN; \
 	type FMT_DYNAMIC_EXP_MODE; \
 	type FMT_MAP420MEM_PWR_FORCE; \
-	type CM_OCSC_MODE; \
 	type CM_RGAM_RAMB_EXP_REGION_START_B; \
 	type CM_RGAM_RAMB_EXP_REGION_START_SEGMENT_B; \
 	type CM_RGAM_RAMB_EXP_REGION_START_G; \
@@ -630,7 +591,6 @@ struct dcn10_opp_registers {
 	uint32_t FMT_CLAMP_CNTL;
 	uint32_t FMT_DYNAMIC_EXP_CNTL;
 	uint32_t FMT_MAP420_MEMORY_CONTROL;
-	uint32_t CM_OCSC_CONTROL;
 	uint32_t CM_RGAM_RAMB_START_CNTL_B;
 	uint32_t CM_RGAM_RAMB_START_CNTL_G;
 	uint32_t CM_RGAM_RAMB_START_CNTL_R;
drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h +37 -0
index 0212618a36be..137b4c8dc9d5 100644
@@ -28,6 +28,7 @@
 
 #include "os_types.h"
 #include "fixed31_32.h"
+#include "dc_hw_types.h"
 
 /******************************************************************************
  * Data types shared between different Virtual HW blocks
@@ -76,4 +77,40 @@ struct pwl_params {
 	struct pwl_result_data rgb_resulted[256 + 3];
 	uint32_t hw_points_num;
 };
+
+/* move to dpp
+ * while we are moving functionality out of opp to dpp to align
+ * HW programming to HW IP, we define these struct in hw_shared
+ * so we can still compile while refactoring
+ */
+
+enum lb_pixel_depth {
+	/* do not change the values because it is used as bit vector */
+	LB_PIXEL_DEPTH_18BPP = 1,
+	LB_PIXEL_DEPTH_24BPP = 2,
+	LB_PIXEL_DEPTH_30BPP = 4,
+	LB_PIXEL_DEPTH_36BPP = 8
+};
+
+enum graphics_csc_adjust_type {
+	GRAPHICS_CSC_ADJUST_TYPE_BYPASS = 0,
+	GRAPHICS_CSC_ADJUST_TYPE_HW, /* without adjustments */
+	GRAPHICS_CSC_ADJUST_TYPE_SW  /*use adjustments */
+};
+
+struct default_adjustment {
+	enum lb_pixel_depth lb_color_depth;
+	enum dc_color_space out_color_space;
+	enum dc_color_space in_color_space;
+	enum dc_color_depth color_depth;
+	enum pixel_format surface_pixel_format;
+	enum graphics_csc_adjust_type csc_adjust_type;
+	bool force_hw_default;
+};
+
+struct out_csc_color_matrix {
+	enum dc_color_space color_space;
+	uint16_t regval[12];
+};
+
 #endif /* __DAL_HW_SHARED_H__ */
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +0 -21
index 57bdd6c8f955..ef36ffdf2a68 100644
@@ -217,22 +217,6 @@ enum fmt_stereo_action {
 	FMT_STEREO_ACTION_UPDATE_POLARITY
 };
 
-enum graphics_csc_adjust_type {
-	GRAPHICS_CSC_ADJUST_TYPE_BYPASS = 0,
-	GRAPHICS_CSC_ADJUST_TYPE_HW, /* without adjustments */
-	GRAPHICS_CSC_ADJUST_TYPE_SW  /*use adjustments */
-};
-
-struct default_adjustment {
-	enum lb_pixel_depth lb_color_depth;
-	enum dc_color_space out_color_space;
-	enum dc_color_space in_color_space;
-	enum dc_color_depth color_depth;
-	enum pixel_format surface_pixel_format;
-	enum graphics_csc_adjust_type csc_adjust_type;
-	bool force_hw_default;
-};
-
 enum grph_color_adjust_option {
 	GRPH_COLOR_MATRIX_HW_DEFAULT = 1,
 	GRPH_COLOR_MATRIX_SW
@@ -250,11 +234,6 @@ struct opp_grph_csc_adjustment {
 	int32_t grph_hue;
 };
 
-struct out_csc_color_matrix {
-	enum dc_color_space color_space;
-	uint16_t regval[12];
-};
-
 /* Underlay related types */
 
 struct hw_adjustment_range {
drivers/gpu/drm/amd/display/dc/inc/hw/transform.h +13 -13
index b4862c376b41..132c5db07456 100644
@@ -26,6 +26,7 @@
 #ifndef __DAL_TRANSFORM_H__
 #define __DAL_TRANSFORM_H__
 
+#include "hw_shared.h"
 #include "dc_hw_types.h"
 #include "fixed31_32.h"
 
@@ -112,14 +113,6 @@ struct xfm_grph_csc_adjustment {
 	enum graphics_gamut_adjust_type gamut_adjust_type;
 };
 
-enum lb_pixel_depth {
-	/* do not change the values because it is used as bit vector */
-	LB_PIXEL_DEPTH_18BPP = 1,
-	LB_PIXEL_DEPTH_24BPP = 2,
-	LB_PIXEL_DEPTH_30BPP = 4,
-	LB_PIXEL_DEPTH_36BPP = 8
-};
-
 struct overscan_info {
 	int left;
 	int right;
@@ -176,11 +169,6 @@ struct transform_funcs {
 	void (*transform_set_scaler)(struct transform *xfm,
 			const struct scaler_data *scl_data);
 
-	void (*transform_set_gamut_remap)(
-			struct transform *xfm,
-			const struct xfm_grph_csc_adjustment *adjust);
-
-
 	void (*transform_set_pixel_storage_depth)(
 			struct transform *xfm,
 			enum lb_pixel_depth depth,
@@ -190,6 +178,18 @@ struct transform_funcs {
 			struct transform *xfm,
 			struct scaler_data *scl_data,
 			const struct scaling_taps *in_taps);
+
+	void (*transform_set_gamut_remap)(
+			struct transform *xfm,
+			const struct xfm_grph_csc_adjustment *adjust);
+
+	void (*opp_set_csc_default)(
+		struct transform *xfm,
+		const struct default_adjustment *default_adjust);
+
+	void (*opp_set_csc_adjustment)(
+		struct transform *xfm,
+		const struct out_csc_color_matrix *tbl_entry);
 };
 
 extern const uint16_t filter_2tap_16p[18];
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#25 lore raw

PATCH 24/120 drm/amd/display: add missing func for dce11o to avoid crash

In reply to a message not in the archive

From: Eric Yang <[email protected]>

Change-Id Ifafd61f3d5b46cdc4f53958b6e2542df88f457fc
---
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +6 -0
index 72e099953a05..6ab9712ed808 100644
@@ -2582,6 +2582,11 @@ static void dce110_power_down_fe(struct core_dc *dc, int fe_idx)
 				dc->res_pool->transforms[fe_idx]);
 }
 
+static void dce110_wait_for_mpcc_disconnect(struct resource_pool *res_pool, struct pipe_ctx *pipe_ctx)
+{
+	/* do nothing*/
+}
+
 static const struct hw_sequencer_funcs dce110_funcs = {
 	.program_gamut_remap = program_gamut_remap,
 	.init_hw = init_hw,
@@ -2611,6 +2616,7 @@ static const struct hw_sequencer_funcs dce110_funcs = {
 	.prog_pixclk_crtc_otg = dce110_prog_pixclk_crtc_otg,
 	.setup_stereo = NULL,
 	.set_avmute = dce110_set_avmute,
+	.wait_for_mpcc_disconnect = dce110_wait_for_mpcc_disconnect
 };
 
 bool dce110_hw_sequencer_construct(struct core_dc *dc)
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#26 lore raw

PATCH 25/120 drm/amd/display: fix YCbCr420 deep color mode not supported

In reply to a message not in the archive

From: Charlene Liu <[email protected]>

Change-Id I293c8500c1a67873a2b793129b70d9f952fc8f89
---
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +2 -0
index a1eabc47558e..17b28280236f 100644
@@ -858,6 +858,8 @@ bool dcn_validate_bandwidth(
 				- pipe->stream->public.timing.v_front_porch;
 		v->vactive[input_idx] = pipe->stream->public.timing.v_addressable;
 		v->pixel_clock[input_idx] = pipe->stream->public.timing.pix_clk_khz / 1000.0f;
+		if (pipe->stream->public.timing.pixel_encoding == PIXEL_ENCODING_YCBCR420)
+			v->pixel_clock[input_idx] /= 2;
 
 
 		if (!pipe->surface){
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#27 lore raw

PATCH 26/120 drm/amd/display: move RGAM programming from opp to dpp

In reply to a message not in the archive

From: Yue Hin Lau <[email protected]>

Change-Id Icac2b9268287e2aeee72672aae95935fc45141d0
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c   | 432 ++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h   | 499 ++++++++++++++++++++-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  |  16 +-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c   | 428 ------------------
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h   | 492 +-------------------
 drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h  |   7 +
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h        |   7 -
 drivers/gpu/drm/amd/display/dc/inc/hw/transform.h  |  29 ++
 8 files changed, 972 insertions(+), 938 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c +432 -0
index 0f3f1a31f10b..b6aaa95d442b 100644
@@ -1134,6 +1134,431 @@ static void oppn10_set_output_csc_adjustment(
 	oppn10_program_color_matrix(xfm, tbl_entry);
 }
 
+static void oppn10_power_on_regamma_lut(
+	struct transform *xfm_base,
+	bool power_on)
+{
+	struct dcn10_dpp *xfm = TO_DCN10_DPP(xfm_base);
+	REG_SET(CM_MEM_PWR_CTRL, 0,
+			RGAM_MEM_PWR_FORCE, power_on == true ? 0:1);
+
+}
+
+static void opp_program_regamma_lut(
+		struct transform *xfm_base,
+		const struct pwl_result_data *rgb,
+		uint32_t num)
+{
+	uint32_t i;
+	struct dcn10_dpp *xfm = TO_DCN10_DPP(xfm_base);
+	for (i = 0 ; i < num; i++) {
+		REG_SET(CM_RGAM_LUT_DATA, 0, CM_RGAM_LUT_DATA, rgb[i].red_reg);
+		REG_SET(CM_RGAM_LUT_DATA, 0, CM_RGAM_LUT_DATA, rgb[i].green_reg);
+		REG_SET(CM_RGAM_LUT_DATA, 0, CM_RGAM_LUT_DATA, rgb[i].blue_reg);
+
+		REG_SET(CM_RGAM_LUT_DATA, 0,
+				CM_RGAM_LUT_DATA, rgb[i].delta_red_reg);
+		REG_SET(CM_RGAM_LUT_DATA, 0,
+				CM_RGAM_LUT_DATA, rgb[i].delta_green_reg);
+		REG_SET(CM_RGAM_LUT_DATA, 0,
+				CM_RGAM_LUT_DATA, rgb[i].delta_blue_reg);
+
+	}
+
+}
+
+static void opp_configure_regamma_lut(
+		struct transform *xfm_base,
+		bool is_ram_a)
+{
+	struct dcn10_dpp *xfm = TO_DCN10_DPP(xfm_base);
+
+	REG_UPDATE(CM_RGAM_LUT_WRITE_EN_MASK,
+			CM_RGAM_LUT_WRITE_EN_MASK, 7);
+	REG_UPDATE(CM_RGAM_LUT_WRITE_EN_MASK,
+			CM_RGAM_LUT_WRITE_SEL, is_ram_a == true ? 0:1);
+	REG_SET(CM_RGAM_LUT_INDEX, 0, CM_RGAM_LUT_INDEX, 0);
+}
+
+/*program re gamma RAM A*/
+static void opp_program_regamma_luta_settings(
+		struct transform *xfm_base,
+		const struct pwl_params *params)
+{
+	const struct gamma_curve *curve;
+	struct dcn10_dpp *xfm = TO_DCN10_DPP(xfm_base);
+
+	REG_SET_2(CM_RGAM_RAMA_START_CNTL_B, 0,
+		CM_RGAM_RAMA_EXP_REGION_START_B, params->arr_points[0].custom_float_x,
+		CM_RGAM_RAMA_EXP_REGION_START_SEGMENT_B, 0);
+	REG_SET_2(CM_RGAM_RAMA_START_CNTL_G, 0,
+		CM_RGAM_RAMA_EXP_REGION_START_G, params->arr_points[0].custom_float_x,
+		CM_RGAM_RAMA_EXP_REGION_START_SEGMENT_G, 0);
+	REG_SET_2(CM_RGAM_RAMA_START_CNTL_R, 0,
+		CM_RGAM_RAMA_EXP_REGION_START_R, params->arr_points[0].custom_float_x,
+		CM_RGAM_RAMA_EXP_REGION_START_SEGMENT_R, 0);
+
+	REG_SET(CM_RGAM_RAMA_SLOPE_CNTL_B, 0,
+		CM_RGAM_RAMA_EXP_REGION_LINEAR_SLOPE_B, params->arr_points[0].custom_float_slope);
+	REG_SET(CM_RGAM_RAMA_SLOPE_CNTL_G, 0,
+		CM_RGAM_RAMA_EXP_REGION_LINEAR_SLOPE_G, params->arr_points[0].custom_float_slope);
+	REG_SET(CM_RGAM_RAMA_SLOPE_CNTL_R, 0,
+		CM_RGAM_RAMA_EXP_REGION_LINEAR_SLOPE_R, params->arr_points[0].custom_float_slope);
+
+	REG_SET(CM_RGAM_RAMA_END_CNTL1_B, 0,
+		CM_RGAM_RAMA_EXP_REGION_END_B, params->arr_points[1].custom_float_x);
+	REG_SET_2(CM_RGAM_RAMA_END_CNTL2_B, 0,
+		CM_RGAM_RAMA_EXP_REGION_END_SLOPE_B, params->arr_points[1].custom_float_slope,
+		CM_RGAM_RAMA_EXP_REGION_END_BASE_B, params->arr_points[1].custom_float_y);
+
+	REG_SET(CM_RGAM_RAMA_END_CNTL1_G, 0,
+		CM_RGAM_RAMA_EXP_REGION_END_G, params->arr_points[1].custom_float_x);
+	REG_SET_2(CM_RGAM_RAMA_END_CNTL2_G, 0,
+		CM_RGAM_RAMA_EXP_REGION_END_SLOPE_G, params->arr_points[1].custom_float_slope,
+		CM_RGAM_RAMA_EXP_REGION_END_BASE_G, params->arr_points[1].custom_float_y);
+
+	REG_SET(CM_RGAM_RAMA_END_CNTL1_R, 0,
+		CM_RGAM_RAMA_EXP_REGION_END_R, params->arr_points[1].custom_float_x);
+	REG_SET_2(CM_RGAM_RAMA_END_CNTL2_R, 0,
+		CM_RGAM_RAMA_EXP_REGION_END_SLOPE_R, params->arr_points[1].custom_float_slope,
+		CM_RGAM_RAMA_EXP_REGION_END_BASE_R, params->arr_points[1].custom_float_y);
+
+	curve = params->arr_curve_points;
+	REG_SET_4(CM_RGAM_RAMA_REGION_0_1, 0,
+		CM_RGAM_RAMA_EXP_REGION0_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION0_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION1_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION1_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_2_3, 0,
+		CM_RGAM_RAMA_EXP_REGION2_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION2_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION3_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION3_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_4_5, 0,
+		CM_RGAM_RAMA_EXP_REGION4_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION4_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION5_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION5_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_6_7, 0,
+		CM_RGAM_RAMA_EXP_REGION6_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION6_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION7_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION7_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_8_9, 0,
+		CM_RGAM_RAMA_EXP_REGION8_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION8_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION9_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION9_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_10_11, 0,
+		CM_RGAM_RAMA_EXP_REGION10_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION10_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION11_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION11_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_12_13, 0,
+		CM_RGAM_RAMA_EXP_REGION12_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION12_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION13_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION13_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_14_15, 0,
+		CM_RGAM_RAMA_EXP_REGION14_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION14_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION15_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION15_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_16_17, 0,
+		CM_RGAM_RAMA_EXP_REGION16_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION16_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION17_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION17_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_18_19, 0,
+		CM_RGAM_RAMA_EXP_REGION18_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION18_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION19_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION19_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_20_21, 0,
+		CM_RGAM_RAMA_EXP_REGION20_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION20_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION21_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION21_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_22_23, 0,
+		CM_RGAM_RAMA_EXP_REGION22_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION22_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION23_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION23_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_24_25, 0,
+		CM_RGAM_RAMA_EXP_REGION24_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION24_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION25_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION25_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_26_27, 0,
+		CM_RGAM_RAMA_EXP_REGION26_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION26_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION27_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION27_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_28_29, 0,
+		CM_RGAM_RAMA_EXP_REGION28_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION28_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION29_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION29_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_30_31, 0,
+		CM_RGAM_RAMA_EXP_REGION30_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION30_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION31_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION31_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMA_REGION_32_33, 0,
+		CM_RGAM_RAMA_EXP_REGION32_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMA_EXP_REGION32_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMA_EXP_REGION33_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMA_EXP_REGION33_NUM_SEGMENTS, curve[1].segments_num);
+}
+
+/*program re gamma RAM B*/
+static void opp_program_regamma_lutb_settings(
+		struct transform *xfm_base,
+		const struct pwl_params *params)
+{
+	const struct gamma_curve *curve;
+	struct dcn10_dpp *xfm = TO_DCN10_DPP(xfm_base);
+
+	REG_SET_2(CM_RGAM_RAMB_START_CNTL_B, 0,
+		CM_RGAM_RAMB_EXP_REGION_START_B, params->arr_points[0].custom_float_x,
+		CM_RGAM_RAMB_EXP_REGION_START_SEGMENT_B, 0);
+	REG_SET_2(CM_RGAM_RAMB_START_CNTL_G, 0,
+		CM_RGAM_RAMB_EXP_REGION_START_G, params->arr_points[0].custom_float_x,
+		CM_RGAM_RAMB_EXP_REGION_START_SEGMENT_G, 0);
+	REG_SET_2(CM_RGAM_RAMB_START_CNTL_R, 0,
+		CM_RGAM_RAMB_EXP_REGION_START_R, params->arr_points[0].custom_float_x,
+		CM_RGAM_RAMB_EXP_REGION_START_SEGMENT_R, 0);
+
+	REG_SET(CM_RGAM_RAMB_SLOPE_CNTL_B, 0,
+		CM_RGAM_RAMB_EXP_REGION_LINEAR_SLOPE_B, params->arr_points[0].custom_float_slope);
+	REG_SET(CM_RGAM_RAMB_SLOPE_CNTL_G, 0,
+		CM_RGAM_RAMB_EXP_REGION_LINEAR_SLOPE_G, params->arr_points[0].custom_float_slope);
+	REG_SET(CM_RGAM_RAMB_SLOPE_CNTL_R, 0,
+		CM_RGAM_RAMB_EXP_REGION_LINEAR_SLOPE_R, params->arr_points[0].custom_float_slope);
+
+	REG_SET(CM_RGAM_RAMB_END_CNTL1_B, 0,
+		CM_RGAM_RAMB_EXP_REGION_END_B, params->arr_points[1].custom_float_x);
+	REG_SET_2(CM_RGAM_RAMB_END_CNTL2_B, 0,
+		CM_RGAM_RAMB_EXP_REGION_END_SLOPE_B, params->arr_points[1].custom_float_slope,
+		CM_RGAM_RAMB_EXP_REGION_END_BASE_B, params->arr_points[1].custom_float_y);
+
+	REG_SET(CM_RGAM_RAMB_END_CNTL1_G, 0,
+		CM_RGAM_RAMB_EXP_REGION_END_G, params->arr_points[1].custom_float_x);
+	REG_SET_2(CM_RGAM_RAMB_END_CNTL2_G, 0,
+		CM_RGAM_RAMB_EXP_REGION_END_SLOPE_G, params->arr_points[1].custom_float_slope,
+		CM_RGAM_RAMB_EXP_REGION_END_BASE_G, params->arr_points[1].custom_float_y);
+
+	REG_SET(CM_RGAM_RAMB_END_CNTL1_R, 0,
+		CM_RGAM_RAMB_EXP_REGION_END_R, params->arr_points[1].custom_float_x);
+	REG_SET_2(CM_RGAM_RAMB_END_CNTL2_R, 0,
+		CM_RGAM_RAMB_EXP_REGION_END_SLOPE_R, params->arr_points[1].custom_float_slope,
+		CM_RGAM_RAMB_EXP_REGION_END_BASE_R, params->arr_points[1].custom_float_y);
+
+	curve = params->arr_curve_points;
+	REG_SET_4(CM_RGAM_RAMB_REGION_0_1, 0,
+		CM_RGAM_RAMB_EXP_REGION0_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION0_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION1_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION1_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_2_3, 0,
+		CM_RGAM_RAMB_EXP_REGION2_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION2_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION3_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION3_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_4_5, 0,
+		CM_RGAM_RAMB_EXP_REGION4_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION4_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION5_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION5_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_6_7, 0,
+		CM_RGAM_RAMB_EXP_REGION6_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION6_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION7_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION7_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_8_9, 0,
+		CM_RGAM_RAMB_EXP_REGION8_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION8_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION9_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION9_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_10_11, 0,
+		CM_RGAM_RAMB_EXP_REGION10_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION10_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION11_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION11_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_12_13, 0,
+		CM_RGAM_RAMB_EXP_REGION12_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION12_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION13_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION13_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_14_15, 0,
+		CM_RGAM_RAMB_EXP_REGION14_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION14_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION15_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION15_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_16_17, 0,
+		CM_RGAM_RAMB_EXP_REGION16_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION16_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION17_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION17_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_18_19, 0,
+		CM_RGAM_RAMB_EXP_REGION18_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION18_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION19_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION19_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_20_21, 0,
+		CM_RGAM_RAMB_EXP_REGION20_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION20_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION21_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION21_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_22_23, 0,
+		CM_RGAM_RAMB_EXP_REGION22_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION22_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION23_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION23_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_24_25, 0,
+		CM_RGAM_RAMB_EXP_REGION24_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION24_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION25_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION25_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_26_27, 0,
+		CM_RGAM_RAMB_EXP_REGION26_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION26_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION27_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION27_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_28_29, 0,
+		CM_RGAM_RAMB_EXP_REGION28_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION28_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION29_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION29_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_30_31, 0,
+		CM_RGAM_RAMB_EXP_REGION30_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION30_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION31_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION31_NUM_SEGMENTS, curve[1].segments_num);
+
+	curve += 2;
+	REG_SET_4(CM_RGAM_RAMB_REGION_32_33, 0,
+		CM_RGAM_RAMB_EXP_REGION32_LUT_OFFSET, curve[0].offset,
+		CM_RGAM_RAMB_EXP_REGION32_NUM_SEGMENTS, curve[0].segments_num,
+		CM_RGAM_RAMB_EXP_REGION33_LUT_OFFSET, curve[1].offset,
+		CM_RGAM_RAMB_EXP_REGION33_NUM_SEGMENTS, curve[1].segments_num);
+
+}
+
+static bool oppn10_set_regamma_pwl(
+	struct transform *xfm_base, const struct pwl_params *params)
+{
+	struct dcn10_dpp *xfm = TO_DCN10_DPP(xfm_base);
+
+	oppn10_power_on_regamma_lut(xfm_base, true);
+	opp_configure_regamma_lut(xfm_base, xfm->is_write_to_ram_a_safe);
+
+	if (xfm->is_write_to_ram_a_safe)
+		opp_program_regamma_luta_settings(xfm_base, params);
+	else
+		opp_program_regamma_lutb_settings(xfm_base, params);
+
+	opp_program_regamma_lut(
+			xfm_base, params->rgb_resulted, params->hw_points_num);
+
+	return true;
+}
+
+static void oppn10_set_regamma_mode(
+	struct transform *xfm_base,
+	enum opp_regamma mode)
+{
+	struct dcn10_dpp *xfm = TO_DCN10_DPP(xfm_base);
+	uint32_t re_mode = 0;
+	uint32_t obuf_bypass = 0; /* need for pipe split */
+	uint32_t obuf_hupscale = 0;
+
+	switch (mode) {
+	case OPP_REGAMMA_BYPASS:
+		re_mode = 0;
+		break;
+	case OPP_REGAMMA_SRGB:
+		re_mode = 1;
+		break;
+	case OPP_REGAMMA_3_6:
+		re_mode = 2;
+		break;
+	case OPP_REGAMMA_USER:
+		re_mode = xfm->is_write_to_ram_a_safe ? 3 : 4;
+		xfm->is_write_to_ram_a_safe = !xfm->is_write_to_ram_a_safe;
+		break;
+	default:
+		break;
+	}
+
+	REG_SET(CM_RGAM_CONTROL, 0, CM_RGAM_LUT_MODE, re_mode);
+	REG_UPDATE_2(OBUF_CONTROL,
+			OBUF_BYPASS, obuf_bypass,
+			OBUF_H_2X_UPSCALE_EN, obuf_hupscale);
+}
+
 static struct transform_funcs dcn10_dpp_funcs = {
 		.transform_reset = dpp_reset,
 		.transform_set_scaler = dpp_set_scaler_manual_scale,
@@ -1141,6 +1566,13 @@ static struct transform_funcs dcn10_dpp_funcs = {
 		.transform_set_gamut_remap = dcn_dpp_set_gamut_remap,
 		.opp_set_csc_adjustment = oppn10_set_output_csc_adjustment,
 		.opp_set_csc_default = oppn10_set_output_csc_default,
+		.opp_power_on_regamma_lut = oppn10_power_on_regamma_lut,
+		.opp_program_regamma_lut = opp_program_regamma_lut,
+		.opp_configure_regamma_lut = opp_configure_regamma_lut,
+		.opp_program_regamma_lutb_settings = opp_program_regamma_lutb_settings,
+		.opp_program_regamma_luta_settings = opp_program_regamma_luta_settings,
+		.opp_program_regamma_pwl = oppn10_set_regamma_pwl,
+		.opp_set_regamma_mode = oppn10_set_regamma_mode
 };
 
 /*****************************************/
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h +494 -5

541 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +8 -8
index 4cbca15e1cc5..d61b63df16b8 100644
@@ -1054,25 +1054,25 @@ static bool dcn10_set_output_transfer_func(
 	struct pipe_ctx *pipe_ctx,
 	const struct core_stream *stream)
 {
-	struct output_pixel_processor *opp = pipe_ctx->opp;
+	struct transform *xfm = pipe_ctx->xfm;
 
-	if (opp == NULL)
+	if (xfm == NULL)
 		return false;
 
-	opp->regamma_params.hw_points_num = GAMMA_HW_POINTS_NUM;
+	xfm->regamma_params.hw_points_num = GAMMA_HW_POINTS_NUM;
 
 	if (stream->public.out_transfer_func &&
 		stream->public.out_transfer_func->type ==
 			TF_TYPE_PREDEFINED &&
 		stream->public.out_transfer_func->tf ==
 			TRANSFER_FUNCTION_SRGB) {
-		opp->funcs->opp_set_regamma_mode(opp, OPP_REGAMMA_SRGB);
+		xfm->funcs->opp_set_regamma_mode(xfm, OPP_REGAMMA_SRGB);
 	} else if (dcn10_translate_regamma_to_hw_format(
-				stream->public.out_transfer_func, &opp->regamma_params)) {
-			opp->funcs->opp_program_regamma_pwl(opp, &opp->regamma_params);
-			opp->funcs->opp_set_regamma_mode(opp, OPP_REGAMMA_USER);
+				stream->public.out_transfer_func, &xfm->regamma_params)) {
+			xfm->funcs->opp_program_regamma_pwl(xfm, &xfm->regamma_params);
+			xfm->funcs->opp_set_regamma_mode(xfm, OPP_REGAMMA_USER);
 	} else {
-		opp->funcs->opp_set_regamma_mode(opp, OPP_REGAMMA_BYPASS);
+		xfm->funcs->opp_set_regamma_mode(xfm, OPP_REGAMMA_BYPASS);
 	}
 
 	return true;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c +0 -428

448 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h +2 -490

536 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h +7 -0
index 137b4c8dc9d5..589bddad7e66 100644
@@ -113,4 +113,11 @@ struct out_csc_color_matrix {
 	uint16_t regval[12];
 };
 
+enum opp_regamma {
+	OPP_REGAMMA_BYPASS = 0,
+	OPP_REGAMMA_SRGB,
+	OPP_REGAMMA_3_6,
+	OPP_REGAMMA_USER
+};
+
 #endif /* __DAL_HW_SHARED_H__ */
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +0 -7
index ef36ffdf2a68..a43a09b3f414 100644
@@ -196,13 +196,6 @@ struct pwl_float_data {
 	struct fixed31_32 b;
 };
 
-enum opp_regamma {
-	OPP_REGAMMA_BYPASS = 0,
-	OPP_REGAMMA_SRGB,
-	OPP_REGAMMA_3_6,
-	OPP_REGAMMA_USER,
-};
-
 struct output_pixel_processor {
 	struct dc_context *ctx;
 	uint32_t inst;
drivers/gpu/drm/amd/display/dc/inc/hw/transform.h +29 -0
index 132c5db07456..f3d66752ed90 100644
@@ -38,6 +38,7 @@ struct transform {
 	const struct transform_funcs *funcs;
 	struct dc_context *ctx;
 	int inst;
+	struct pwl_params regamma_params;
 };
 
 /* Colorimetry */
@@ -190,6 +191,34 @@ struct transform_funcs {
 	void (*opp_set_csc_adjustment)(
 		struct transform *xfm,
 		const struct out_csc_color_matrix *tbl_entry);
+
+	void (*opp_power_on_regamma_lut)(
+		struct transform *xfm,
+		bool power_on);
+
+	void (*opp_program_regamma_lut)(
+			struct transform *xfm,
+			const struct pwl_result_data *rgb,
+			uint32_t num);
+
+	void (*opp_configure_regamma_lut)(
+			struct transform *xfm,
+			bool is_ram_a);
+
+	void (*opp_program_regamma_lutb_settings)(
+			struct transform *xfm,
+			const struct pwl_params *params);
+
+	void (*opp_program_regamma_luta_settings)(
+			struct transform *xfm,
+			const struct pwl_params *params);
+
+	bool (*opp_program_regamma_pwl)(
+		struct transform *xfm, const struct pwl_params *params);
+
+	void (*opp_set_regamma_mode)(
+			struct transform *xfm_base,
+			enum opp_regamma mode);
 };
 
 extern const uint16_t filter_2tap_16p[18];
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#28 lore raw

PATCH 27/120 drm/amd/display: Move DCHUBBUB block from MemInput to HW sequencer.

In reply to a message not in the archive

From: Zeyu Fan <[email protected]>

Change-Id I6aa5a5dae9bbc3a1a2d1f5ff5bf1a9bb86c599ce
---
 drivers/gpu/drm/amd/display/dc/core/dc.c           |   6 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h     | 116 +++++++-
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c |  54 +---
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |   1 +
 .../amd/display/dc/dce120/dce120_hw_sequencer.c    |  64 +++++
 .../drm/amd/display/dc/dce120/dce120_resource.c    |   2 +-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 304 ++++++++++++++++++++-
 .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c | 303 --------------------
 .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h |  76 +-----
 drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h  |   7 +-
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |   4 +
 11 files changed, 492 insertions(+), 445 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -3
index 9ef671735125..e89a2e5c8902 100644
@@ -2042,10 +2042,10 @@ bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data)
 		return false;
 	}
 
-	if (mi->funcs->mem_input_update_dchub)
-		mi->funcs->mem_input_update_dchub(mi, dh_data);
+	if (core_dc->hwss.update_dchub)
+		core_dc->hwss.update_dchub(core_dc->hwseq, dh_data);
 	else
-		ASSERT(mi->funcs->mem_input_update_dchub);
+		ASSERT(core_dc->hwss.update_dchub);
 
 
 	return true;
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +113 -3

180 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c +1 -53

66 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -0
index 6ab9712ed808..efba8d7964eb 100644
@@ -49,6 +49,7 @@
 #include "abm.h"
 #include "audio.h"
 #include "dce/dce_hwseq.h"
+#include "reg_helper.h"
 
 /* include DCE11 register header files */
 #include "dce/dce_11_0_d.h"
drivers/gpu/drm/amd/display/dc/dce120/dce120_hw_sequencer.c +64 -0

88 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +1 -1
index 82481247a812..f829b6e58bcb 100644
@@ -598,7 +598,7 @@ static struct stream_encoder *dce120_stream_encoder_create(
 					mm ## block ## id ## _ ## reg_name
 
 static const struct dce_hwseq_registers hwseq_reg = {
-		HWSEQ_DCE112_REG_LIST()
+		HWSEQ_DCE120_REG_LIST()
 };
 
 static const struct dce_hwseq_shift hwseq_shift = {
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +302 -2

322 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c +0 -303

321 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h +2 -74

123 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h +1 -6
index 1b7d151a66f8..fd3ce742af2c 100644
@@ -75,11 +75,6 @@ struct mem_input {
 
 struct mem_input_funcs {
 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
-	void (*program_watermarks)(
-			struct mem_input *mem_input,
-			struct dcn_watermark_set *watermarks,
-			unsigned int refclk_period_ns);
-
 	void (*mem_input_setup)(
 			struct mem_input *mem_input,
 			struct _vcs_dpi_display_dlg_regs_st *dlg_regs,
@@ -143,7 +138,7 @@ struct mem_input_funcs {
 	bool (*mem_input_is_flip_pending)(struct mem_input *mem_input);
 
 	void (*mem_input_update_dchub)(struct mem_input *mem_input,
-			struct dchub_init_data *dh_data);
+				struct dchub_init_data *dh_data);
 
 	void (*set_blank)(struct mem_input *mi, bool blank);
 };
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +4 -0
index 22aca5a375ae..d865df802c88 100644
@@ -79,6 +79,10 @@ struct hw_sequencer_funcs {
 		const struct core_dc *dc,
 		struct pipe_ctx *pipe_ctx);
 
+	void (*update_dchub)(
+		struct dce_hwseq *hws,
+		struct dchub_init_data *dh_data);
+
 	void (*update_pending_status)(
 			struct pipe_ctx *pipe_ctx);
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#29 lore raw

PATCH 28/120 drm/amd/display: Roll core_surface into dc_surface

In reply to a message not in the archive
Change-Id Id4be5e785fc6f030851882d6a11c8f55bf2dbdfc
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    |   8 +-
 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c   |  16 ++--
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c   |  26 +++---
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  73 +++++++--------
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |  42 ++++-----
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    |   4 +-
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   |  44 ++++-----
 drivers/gpu/drm/amd/display/dc/dc.h                |  45 +++++----
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.c     |   4 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h     |   2 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 102 ++++++++++-----------
 .../drm/amd/display/dc/dce110/dce110_resource.c    |   2 +-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  |  76 +++++++--------
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |  16 +---
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |   4 +-
 drivers/gpu/drm/amd/display/dc/inc/resource.h      |   2 +-
 16 files changed, 226 insertions(+), 240 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +4 -4
index 3089997365e8..c8ea1010ea20 100644
@@ -2497,7 +2497,7 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
 	struct drm_plane *plane;
 	struct drm_plane_state *old_plane_state;
 	const struct dc_stream *dc_stream_attach;
-	const struct dc_surface *dc_surfaces_constructed[MAX_SURFACES];
+	struct dc_surface *dc_surfaces_constructed[MAX_SURFACES];
 	struct amdgpu_crtc *acrtc_attach = to_amdgpu_crtc(pcrtc);
 	struct dm_crtc_state *acrtc_state = to_dm_crtc_state(pcrtc->state);
 	int planes_count = 0;
@@ -2777,7 +2777,7 @@ void amdgpu_dm_atomic_commit_tail(
 		struct dm_connector_state *con_old_state =
 				to_dm_connector_state(old_conn_state);
 		struct amdgpu_crtc *acrtc = to_amdgpu_crtc(con_new_state->base.crtc);
-		const struct dc_stream_status *status = NULL;
+		struct dc_stream_status *status = NULL;
 
 		/* Skip any modesets/resets */
 		if (!acrtc || drm_atomic_crtc_needs_modeset(acrtc->base.state))
@@ -2802,7 +2802,7 @@ void amdgpu_dm_atomic_commit_tail(
 		/*TODO How it works with MPO ?*/
 		if (!dc_commit_surfaces_to_stream(
 				dm->dc,
-				(const struct dc_surface **)status->surfaces,
+				status->surfaces,
 				status->surface_count,
 				new_acrtc_state->stream))
 			dm_error("%s: Failed to update stream scaling!\n", __func__);
@@ -2946,7 +2946,7 @@ static uint32_t add_val_sets_surface(
 	struct dc_validation_set *val_sets,
 	uint32_t set_count,
 	const struct dc_stream *stream,
-	const struct dc_surface *surface)
+	struct dc_surface *surface)
 {
 	uint32_t i = 0, j = 0;
 
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +8 -8
index 87666987429e..5ef44ff4bcf8 100644
@@ -2597,12 +2597,12 @@ static void populate_initial_data(
 		ASSERT(pipe[i].surface);
 
 		if (num_displays == 0) {
-			if (!pipe[i].surface->public.visible)
+			if (!pipe[i].surface->visible)
 				data->d0_underlay_mode = bw_def_underlay_only;
 			else
 				data->d0_underlay_mode = bw_def_blend;
 		} else {
-			if (!pipe[i].surface->public.visible)
+			if (!pipe[i].surface->visible)
 				data->d1_underlay_mode = bw_def_underlay_only;
 			else
 				data->d1_underlay_mode = bw_def_blend;
@@ -2620,7 +2620,7 @@ static void populate_initial_data(
 		data->v_taps[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.taps.v_taps);
 		data->h_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.horz.value);
 		data->v_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.vert.value);
-		switch (pipe[i].surface->public.rotation) {
+		switch (pipe[i].surface->rotation) {
 		case ROTATION_ANGLE_0:
 			data->rotation_angle[num_displays + 4] = bw_int_to_fixed(0);
 			break;
@@ -2636,7 +2636,7 @@ static void populate_initial_data(
 		default:
 			break;
 		}
-		switch (pipe[i].surface->public.format) {
+		switch (pipe[i].surface->format) {
 		case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:
 		case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:
 		case SURFACE_PIXEL_FORMAT_GRPH_RGB565:
@@ -2670,14 +2670,14 @@ static void populate_initial_data(
 			data->src_height[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.viewport.height);
 			data->src_width[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.viewport.width);
 			data->pitch_in_pixels[num_displays * 2 + j] = bw_int_to_fixed(
-					pipe[i].bottom_pipe->surface->public.plane_size.grph.surface_pitch);
+					pipe[i].bottom_pipe->surface->plane_size.grph.surface_pitch);
 			data->h_taps[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.taps.h_taps);
 			data->v_taps[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.taps.v_taps);
 			data->h_scale_ratio[num_displays * 2 + j] = fixed31_32_to_bw_fixed(
 					pipe[i].bottom_pipe->scl_data.ratios.horz.value);
 			data->v_scale_ratio[num_displays * 2 + j] = fixed31_32_to_bw_fixed(
 					pipe[i].bottom_pipe->scl_data.ratios.vert.value);
-			switch (pipe[i].bottom_pipe->surface->public.rotation) {
+			switch (pipe[i].bottom_pipe->surface->rotation) {
 			case ROTATION_ANGLE_0:
 				data->rotation_angle[num_displays * 2 + j] = bw_int_to_fixed(0);
 				break;
@@ -2718,7 +2718,7 @@ static void populate_initial_data(
 			data->v_taps[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.taps.v_taps);
 			data->h_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.horz.value);
 			data->v_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.vert.value);
-			switch (pipe[i].surface->public.rotation) {
+			switch (pipe[i].surface->rotation) {
 			case ROTATION_ANGLE_0:
 				data->rotation_angle[num_displays + 4] = bw_int_to_fixed(0);
 				break;
@@ -2734,7 +2734,7 @@ static void populate_initial_data(
 			default:
 				break;
 			}
-			switch (pipe[i].surface->public.format) {
+			switch (pipe[i].surface->format) {
 			case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:
 			case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb:
 			case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +13 -13
index 17b28280236f..1651b7548d40 100644
@@ -238,11 +238,11 @@ static void pipe_ctx_to_e2e_pipe_params (
 	else if (pipe->bottom_pipe != NULL && pipe->bottom_pipe->surface == pipe->surface)
 		input->src.is_hsplit = true;
 
-	input->src.dcc                 = pipe->surface->public.dcc.enable;
+	input->src.dcc                 = pipe->surface->dcc.enable;
 	input->src.dcc_rate            = 1;
-	input->src.meta_pitch          = pipe->surface->public.dcc.grph.meta_pitch;
+	input->src.meta_pitch          = pipe->surface->dcc.grph.meta_pitch;
 	input->src.source_scan         = dm_horz;
-	input->src.sw_mode             = pipe->surface->public.tiling_info.gfx9.swizzle;
+	input->src.sw_mode             = pipe->surface->tiling_info.gfx9.swizzle;
 
 	input->src.viewport_width      = pipe->scl_data.viewport.width;
 	input->src.viewport_height     = pipe->scl_data.viewport.height;
@@ -251,7 +251,7 @@ static void pipe_ctx_to_e2e_pipe_params (
 	input->src.cur0_src_width      = 128; /* TODO: Cursor calcs, not curently stored */
 	input->src.cur0_bpp            = 32;
 
-	switch (pipe->surface->public.tiling_info.gfx9.swizzle) {
+	switch (pipe->surface->tiling_info.gfx9.swizzle) {
 	/* for 4/8/16 high tiles */
 	case DC_SW_LINEAR:
 		input->src.is_display_sw = 1;
@@ -299,7 +299,7 @@ static void pipe_ctx_to_e2e_pipe_params (
 		break;
 	}
 
-	switch (pipe->surface->public.rotation) {
+	switch (pipe->surface->rotation) {
 	case ROTATION_ANGLE_0:
 	case ROTATION_ANGLE_180:
 		input->src.source_scan = dm_horz;
@@ -314,7 +314,7 @@ static void pipe_ctx_to_e2e_pipe_params (
 	}
 
 	/* TODO: Fix pixel format mappings */
-	switch (pipe->surface->public.format) {
+	switch (pipe->surface->format) {
 	case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:
 	case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb:
 		input->src.source_format = dm_420_8;
@@ -455,7 +455,7 @@ static void dcn_bw_calc_rq_dlg_ttu(
 			true,
 			true,
 			v->pte_enable == dcn_bw_yes,
-			pipe->surface->public.flip_immediate);
+			pipe->surface->flip_immediate);
 }
 
 static void dcn_dml_wm_override(
@@ -527,7 +527,7 @@ static void dcn_dml_wm_override(
 			true,
 			true,
 			v->pte_enable == dcn_bw_yes,
-			pipe->surface->public.flip_immediate);
+			pipe->surface->flip_immediate);
 		in_idx++;
 	}
 	dm_free(input);
@@ -883,7 +883,7 @@ bool dcn_validate_bandwidth(
 			v->scaler_rec_out_width[input_idx] = pipe->scl_data.recout.width;
 			v->scaler_recout_height[input_idx] = pipe->scl_data.recout.height;
 			if (pipe->bottom_pipe && pipe->bottom_pipe->surface == pipe->surface) {
-				if (pipe->surface->public.rotation % 2 == 0) {
+				if (pipe->surface->rotation % 2 == 0) {
 					int viewport_end = pipe->scl_data.viewport.width
 							+ pipe->scl_data.viewport.x;
 					int viewport_b_end = pipe->bottom_pipe->scl_data.viewport.width
@@ -912,17 +912,17 @@ bool dcn_validate_bandwidth(
 						+ pipe->bottom_pipe->scl_data.recout.width;
 			}
 
-			v->dcc_enable[input_idx] = pipe->surface->public.dcc.enable ? dcn_bw_yes : dcn_bw_no;
+			v->dcc_enable[input_idx] = pipe->surface->dcc.enable ? dcn_bw_yes : dcn_bw_no;
 			v->source_pixel_format[input_idx] = tl_pixel_format_to_bw_defs(
-					pipe->surface->public.format);
+					pipe->surface->format);
 			v->source_surface_mode[input_idx] = tl_sw_mode_to_bw_defs(
-					pipe->surface->public.tiling_info.gfx9.swizzle);
+					pipe->surface->tiling_info.gfx9.swizzle);
 			v->lb_bit_per_pixel[input_idx] = tl_lb_bpp_to_int(pipe->scl_data.lb_params.depth);
 			v->override_hta_ps[input_idx] = pipe->scl_data.taps.h_taps;
 			v->override_vta_ps[input_idx] = pipe->scl_data.taps.v_taps;
 			v->override_hta_pschroma[input_idx] = pipe->scl_data.taps.h_taps_c;
 			v->override_vta_pschroma[input_idx] = pipe->scl_data.taps.v_taps_c;
-			v->source_scan[input_idx] = (pipe->surface->public.rotation % 2) ? dcn_bw_vert : dcn_bw_hor;
+			v->source_scan[input_idx] = (pipe->surface->rotation % 2) ? dcn_bw_vert : dcn_bw_hor;
 		}
 		if (v->is_line_buffer_bpp_fixed == dcn_bw_yes)
 			v->lb_bit_per_pixel[input_idx] = v->line_buffer_fixed_bpp;
drivers/gpu/drm/amd/display/dc/core/dc.c +35 -38

174 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_resource.c +21 -21

135 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_stream.c +2 -2
index ead7b63caab7..73712fd6f64a 100644
@@ -157,7 +157,7 @@ struct dc_stream *dc_create_stream_for_sink(
 	return NULL;
 }
 
-const struct dc_stream_status *dc_stream_get_status(
+struct dc_stream_status *dc_stream_get_status(
 	const struct dc_stream *dc_stream)
 {
 	uint8_t i;
@@ -252,7 +252,7 @@ bool dc_stream_set_cursor_position(
 				!pipe_ctx->ipp || !pipe_ctx->surface)
 			continue;
 
-		if (pipe_ctx->surface->public.address.type
+		if (pipe_ctx->surface->address.type
 				== PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)
 			pos_cpy.enable = false;
 
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +19 -25

111 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc.h +27 -18

99 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.c +2 -2
index cc3178acfc54..a8c254f66c98 100644
@@ -193,9 +193,9 @@ void dce_crtc_switch_to_clk_src(struct dce_hwseq *hws,
 }
 
 /* Only use LUT for 8 bit formats */
-bool dce_use_lut(const struct core_surface *surface)
+bool dce_use_lut(const struct dc_surface *surface)
 {
-	switch (surface->public.format) {
+	switch (surface->format) {
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
 		return true;
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +1 -1
index a8a5569cf3f7..490ca128dada 100644
@@ -558,5 +558,5 @@ void dce_crtc_switch_to_clk_src(struct dce_hwseq *hws,
 		struct clock_source *clk_src,
 		unsigned int tg_inst);
 
-bool dce_use_lut(const struct core_surface *surface);
+bool dce_use_lut(const struct dc_surface *surface);
 #endif   /*__DCE_HWSEQ_H__*/
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +51 -51

217 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 -1
index 8b7bc1cc2b7b..0fcb1cf4b4ce 100644
@@ -766,7 +766,7 @@ static bool is_surface_pixel_format_supported(struct pipe_ctx *pipe_ctx, unsigne
 		return true;
 	if (!pipe_ctx->surface)
 		return false;
-	if (pipe_ctx->surface->public.format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
+	if (pipe_ctx->surface->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
 		return false;
 	return true;
 }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +38 -38

181 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -15
index cc65cfdea66f..07a1aec5a28b 100644
@@ -40,23 +40,9 @@ struct core_stream;
 
 #define MAX_CLOCK_SOURCES 7
 
-/********* core_surface **********/
-#define DC_SURFACE_TO_CORE(dc_surface) \
-	container_of(dc_surface, struct core_surface, public)
-
 #define DC_GAMMA_TO_CORE(dc_gamma) \
 	container_of(dc_gamma, struct core_gamma, public)
 
-struct core_surface {
-	struct dc_surface public;
-	struct dc_surface_status status;
-	struct dc_context *ctx;
-
-	/* private to dc_surface.c */
-	enum dc_irq_source irq_source;
-	int ref_count;
-};
-
 struct core_gamma {
 	struct dc_gamma public;
 	struct dc_context *ctx;
@@ -263,7 +249,7 @@ struct resource_pool {
 };
 
 struct pipe_ctx {
-	struct core_surface *surface;
+	struct dc_surface *surface;
 	struct core_stream *stream;
 
 	struct mem_input *mi;
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +2 -2
index d865df802c88..2343beb4ef87 100644
@@ -59,7 +59,7 @@ struct hw_sequencer_funcs {
 
 	void (*apply_ctx_for_surface)(
 			struct core_dc *dc,
-			struct core_surface *surface,
+			const struct dc_surface *surface,
 			struct validate_context *context);
 
 	void (*set_plane_config)(
@@ -88,7 +88,7 @@ struct hw_sequencer_funcs {
 
 	bool (*set_input_transfer_func)(
 				struct pipe_ctx *pipe_ctx,
-				const struct core_surface *surface);
+				const struct dc_surface *surface);
 
 	bool (*set_output_transfer_func)(
 				struct pipe_ctx *pipe_ctx,
drivers/gpu/drm/amd/display/dc/inc/resource.h +1 -1
index 04e5fd1d8c89..ed94df16a2d3 100644
@@ -119,7 +119,7 @@ struct pipe_ctx *resource_get_head_pipe_for_stream(
 		const struct core_stream *stream);
 
 bool resource_attach_surfaces_to_context(
-		const struct dc_surface *const *surfaces,
+		struct dc_surface *const *surfaces,
 		int surface_count,
 		const struct dc_stream *dc_stream,
 		struct validate_context *context,
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#30 lore raw

PATCH 29/120 drm/amd/display: Roll core_link into dc_link

In reply to a message not in the archive
Change-Id Ibbc981040f6ba6c4e8bf9cdb463e995958d6eba8
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h           |   2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    |   4 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h    |   2 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c           | 100 ++++----
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      | 229 +++++++++---------
 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c  |   6 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   | 264 ++++++++++-----------
 drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c |  40 ++--
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |   8 +-
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c      |   9 +-
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    |   4 +-
 drivers/gpu/drm/amd/display/dc/dc.h                | 112 ++++++---
 drivers/gpu/drm/amd/display/dc/dc_ddc_types.h      |   2 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c      |   4 +-
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c  |   2 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    |   2 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  16 +-
 .../drm/amd/display/dc/dce110/dce110_resource.c    |   2 +-
 .../drm/amd/display/dc/dce112/dce112_resource.c    |   2 +-
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |   2 +-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  |   4 +-
 .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c  |   2 +-
 drivers/gpu/drm/amd/display/dc/inc/core_dc.h       |   2 +-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |  58 +----
 drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h   |   2 +-
 drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h    |  16 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/dmcu.h       |   2 +-
 drivers/gpu/drm/amd/display/dc/inc/link_hwss.h     |  22 +-
 .../gpu/drm/amd/display/include/logger_interface.h |   8 +-
 29 files changed, 444 insertions(+), 484 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +1 -1
index 44a3b50a5d89..f57a5134a327 100644
@@ -568,7 +568,7 @@ struct amdgpu_connector {
 	/* The 'old' sink - before an HPD.
 	 * The 'current' sink is in dc_link->sink. */
 	const struct dc_sink *dc_sink;
-	const struct dc_link *dc_link;
+	struct dc_link *dc_link;
 	const struct dc_sink *dc_em_sink;
 	const struct dc_stream *stream;
 	void *con_priv;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +2 -2
index c8ea1010ea20..456f66573ede 100644
@@ -2018,7 +2018,7 @@ void amdgpu_dm_connector_init_helper(
 	struct amdgpu_display_manager *dm,
 	struct amdgpu_connector *aconnector,
 	int connector_type,
-	const struct dc_link *link,
+	struct dc_link *link,
 	int link_index)
 {
 	struct amdgpu_device *adev = dm->ddev->dev_private;
@@ -2149,7 +2149,7 @@ int amdgpu_dm_connector_init(
 	int res = 0;
 	int connector_type;
 	struct dc *dc = dm->dc;
-	const struct dc_link *link = dc_get_link_at_index(dc, link_index);
+	struct dc_link *link = dc_get_link_at_index(dc, link_index);
 	struct amdgpu_i2c_adapter *i2c;
 	((struct dc_link *)link)->priv = aconnector;
 
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h +1 -1
index 115d9081d964..c565787cd782 100644
@@ -114,7 +114,7 @@ void amdgpu_dm_connector_init_helper(
 	struct amdgpu_display_manager *dm,
 	struct amdgpu_connector *aconnector,
 	int connector_type,
-	const struct dc_link *link,
+	struct dc_link *link,
 	int link_index);
 
 int amdgpu_dm_connector_mode_valid(
drivers/gpu/drm/amd/display/dc/core/dc.c +44 -56

274 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_link.c +109 -120

691 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c +3 -3
index 2f5a89c5b063..d09e539397ea 100644
@@ -354,7 +354,7 @@ static uint32_t defer_delay_converter_wa(
 	struct ddc_service *ddc,
 	uint32_t defer_delay)
 {
-	struct core_link *link = ddc->link;
+	struct dc_link *link = ddc->link;
 
 	if (link->dpcd_caps.branch_dev_id == DP_BRANCH_DEVICE_ID_4 &&
 		!memcmp(link->dpcd_caps.branch_dev_name,
@@ -423,7 +423,7 @@ static bool i2c_read(
 
 	return dm_helpers_submit_i2c(
 			ddc->ctx,
-			&ddc->link->public,
+			ddc->link,
 			&command);
 }
 
@@ -624,7 +624,7 @@ bool dal_ddc_service_query_ddc_data(
 
 		ret = dm_helpers_submit_i2c(
 				ddc->ctx,
-				&ddc->link->public,
+				ddc->link,
 				&command);
 
 		dal_ddc_i2c_payloads_destroy(&payloads);
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +127 -137

822 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +20 -20
index 0092e70b9efd..aac2420caefa 100644
@@ -16,13 +16,13 @@
 #include "dpcd_defs.h"
 
 enum dc_status core_link_read_dpcd(
-	struct core_link* link,
+	struct dc_link *link,
 	uint32_t address,
 	uint8_t *data,
 	uint32_t size)
 {
 	if (!dm_helpers_dp_read_dpcd(link->ctx,
-			&link->public,
+			link,
 			address, data, size))
 			return DC_ERROR_UNEXPECTED;
 
@@ -30,20 +30,20 @@ enum dc_status core_link_read_dpcd(
 }
 
 enum dc_status core_link_write_dpcd(
-	struct core_link* link,
+	struct dc_link *link,
 	uint32_t address,
 	const uint8_t *data,
 	uint32_t size)
 {
 	if (!dm_helpers_dp_write_dpcd(link->ctx,
-			&link->public,
+			link,
 			address, data, size))
 				return DC_ERROR_UNEXPECTED;
 
 	return DC_OK;
 }
 
-void dp_receiver_power_ctrl(struct core_link *link, bool on)
+void dp_receiver_power_ctrl(struct dc_link *link, bool on)
 {
 	uint8_t state;
 
@@ -54,7 +54,7 @@ void dp_receiver_power_ctrl(struct core_link *link, bool on)
 }
 
 void dp_enable_link_phy(
-	struct core_link *link,
+	struct dc_link *link,
 	enum signal_type signal,
 	enum clock_source_id clock_source,
 	const struct dc_link_settings *link_settings)
@@ -107,7 +107,7 @@ void dp_enable_link_phy(
 	dp_receiver_power_ctrl(link, true);
 }
 
-void dp_disable_link_phy(struct core_link *link, enum signal_type signal)
+void dp_disable_link_phy(struct dc_link *link, enum signal_type signal)
 {
 	if (!link->wa_flags.dp_keep_receiver_powered)
 		dp_receiver_power_ctrl(link, false);
@@ -120,11 +120,11 @@ void dp_disable_link_phy(struct core_link *link, enum signal_type signal)
 	link->link_enc->funcs->disable_output(link->link_enc, signal);
 
 	/* Clear current link setting.*/
-	memset(&link->public.cur_link_settings, 0,
-			sizeof(link->public.cur_link_settings));
+	memset(&link->cur_link_settings, 0,
+			sizeof(link->cur_link_settings));
 }
 
-void dp_disable_link_phy_mst(struct core_link *link, enum signal_type signal)
+void dp_disable_link_phy_mst(struct dc_link *link, enum signal_type signal)
 {
 	/* MST disable link only when no stream use the link */
 	if (link->mst_stream_alloc_table.stream_count > 0)
@@ -137,7 +137,7 @@ void dp_disable_link_phy_mst(struct core_link *link, enum signal_type signal)
 }
 
 bool dp_set_hw_training_pattern(
-	struct core_link *link,
+	struct dc_link *link,
 	enum hw_dp_training_pattern pattern)
 {
 	enum dp_test_pattern test_pattern = DP_TEST_PATTERN_UNSUPPORTED;
@@ -165,7 +165,7 @@ bool dp_set_hw_training_pattern(
 }
 
 void dp_set_hw_lane_settings(
-	struct core_link *link,
+	struct dc_link *link,
 	const struct link_training_settings *link_settings)
 {
 	struct link_encoder *encoder = link->link_enc;
@@ -174,13 +174,13 @@ void dp_set_hw_lane_settings(
 	encoder->funcs->dp_set_lane_settings(encoder, link_settings);
 }
 
-enum dp_panel_mode dp_get_panel_mode(struct core_link *link)
+enum dp_panel_mode dp_get_panel_mode(struct dc_link *link)
 {
 	/* We need to explicitly check that connector
 	 * is not DP. Some Travis_VGA get reported
 	 * by video bios as DP.
 	 */
-	if (link->public.connector_signal != SIGNAL_TYPE_DISPLAY_PORT) {
+	if (link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT) {
 
 		switch (link->dpcd_caps.branch_dev_id) {
 		case DP_BRANCH_DEVICE_ID_2:
@@ -215,7 +215,7 @@ enum dp_panel_mode dp_get_panel_mode(struct core_link *link)
 }
 
 void dp_set_hw_test_pattern(
-	struct core_link *link,
+	struct dc_link *link,
 	enum dp_test_pattern test_pattern,
 	uint8_t *custom_pattern,
 	uint32_t custom_pattern_size)
@@ -231,7 +231,7 @@ void dp_set_hw_test_pattern(
 	encoder->funcs->dp_set_phy_pattern(encoder, &pattern_param);
 }
 
-void dp_retrain_link_dp_test(struct core_link *link,
+void dp_retrain_link_dp_test(struct dc_link *link,
 			struct dc_link_settings *link_setting,
 			bool skip_video_pattern)
 {
@@ -263,8 +263,8 @@ void dp_retrain_link_dp_test(struct core_link *link,
 					SIGNAL_TYPE_DISPLAY_PORT);
 
 			/* Clear current link setting. */
-			memset(&link->public.cur_link_settings, 0,
-				sizeof(link->public.cur_link_settings));
+			memset(&link->cur_link_settings, 0,
+				sizeof(link->cur_link_settings));
 
 			link->link_enc->funcs->enable_dp_output(
 						link->link_enc,
@@ -274,11 +274,11 @@ void dp_retrain_link_dp_test(struct core_link *link,
 			dp_receiver_power_ctrl(link, true);
 
 			dc_link_dp_perform_link_training(
-					&link->public,
+					link,
 					link_setting,
 					skip_video_pattern);
 
-			link->public.cur_link_settings = *link_setting;
+			link->cur_link_settings = *link_setting;
 
 			link->dc->hwss.enable_stream(&pipes[i]);
 
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +3 -5
index 857a2a395c1b..ec4714eab2be 100644
@@ -1269,7 +1269,7 @@ static struct stream_encoder *find_first_free_match_stream_enc_for_link(
 {
 	int i;
 	int j = -1;
-	struct core_link *link = stream->sink->link;
+	struct dc_link *link = stream->sink->link;
 
 	for (i = 0; i < pool->stream_enc_count; i++) {
 		if (!res_ctx->is_stream_enc_acquired[i] &&
@@ -1322,9 +1322,7 @@ static void update_stream_signal(struct core_stream *stream)
 		const struct dc_sink *dc_sink = stream->public.sink;
 
 		if (dc_sink->sink_signal == SIGNAL_TYPE_NONE)
-			stream->signal =
-					stream->sink->link->
-					public.connector_signal;
+			stream->signal = stream->sink->link->connector_signal;
 		else
 			stream->signal = dc_sink->sink_signal;
 	} else {
@@ -1380,7 +1378,7 @@ static struct core_stream *find_pll_sharable_stream(
 		if (resource_are_streams_timing_synchronizable(
 			stream_needs_pll, stream_has_pll)
 			&& !dc_is_dp_signal(stream_has_pll->signal)
-			&& stream_has_pll->sink->link->public.connector_signal
+			&& stream_has_pll->sink->link->connector_signal
 			!= SIGNAL_TYPE_VIRTUAL)
 			return stream_has_pll;
 
drivers/gpu/drm/amd/display/dc/core/dc_sink.c +4 -5
index da9955675fbf..7f0ba7267682 100644
@@ -54,15 +54,14 @@ static void destruct(struct sink *sink)
 static bool construct(struct sink *sink, const struct dc_sink_init_data *init_params)
 {
 
-	struct core_link *core_link = DC_LINK_TO_LINK(init_params->link);
+	struct dc_link *link = init_params->link;
 
-	if (!core_link) {
+	if (!link)
 		return false;
-	}
 
 	sink->protected.public.sink_signal = init_params->sink_signal;
-	sink->protected.link = core_link;
-	sink->protected.ctx = core_link->ctx;
+	sink->protected.link = link;
+	sink->protected.ctx = link->ctx;
 	sink->protected.public.dongle_max_pix_clk = init_params->dongle_max_pix_clk;
 	sink->protected.public.converter_disable_audio =
 			init_params->converter_disable_audio;
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +2 -2
index 73712fd6f64a..a329709de360 100644
@@ -91,7 +91,7 @@ static bool construct(struct core_stream *stream,
 	/* EDID CAP translation for HDMI 2.0 */
 	stream->public.timing.flags.LTE_340MCSC_SCRAMBLE = dc_sink_data->edid_caps.lte_340mcsc_scramble;
 
-	stream->status.link = &stream->sink->link->public;
+	stream->status.link = stream->sink->link;
 	return true;
 }
 
@@ -355,5 +355,5 @@ void dc_stream_log(
 	dm_logger_write(dm_logger,
 			log_type,
 			"\tlink: %d\n",
-			core_stream->sink->link->public.link_index);
+			core_stream->sink->link->link_index);
 }
drivers/gpu/drm/amd/display/dc/dc.h +78 -34

201 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc_ddc_types.h +1 -1
index b143fe88f49f..e1affeb5cc51 100644
@@ -105,7 +105,7 @@ struct ddc_service {
 	enum ddc_transaction_type transaction_type;
 	enum display_dongle_type dongle_type;
 	struct dc_context *ctx;
-	struct core_link *link;
+	struct dc_link *link;
 
 	uint32_t address;
 	uint32_t edid_buf_len;
drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c +2 -2
index 0fe3ee8e29d3..aaff946a6d0a 100644
@@ -142,7 +142,7 @@ static void dce_dmcu_set_psr_enable(struct dmcu *dmcu, bool enable)
 }
 
 static void dce_dmcu_setup_psr(struct dmcu *dmcu,
-		struct core_link *link,
+		struct dc_link *link,
 		struct psr_context *psr_context)
 {
 	struct dce_dmcu *dmcu_dce = TO_DCE_DMCU(dmcu);
@@ -382,7 +382,7 @@ static void dcn10_dmcu_set_psr_enable(struct dmcu *dmcu, bool enable)
 }
 
 static void dcn10_dmcu_setup_psr(struct dmcu *dmcu,
-		struct core_link *link,
+		struct dc_link *link,
 		struct psr_context *psr_context)
 {
 	struct dce_dmcu *dmcu_dce = TO_DCE_DMCU(dmcu);
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +1 -1
index 5663d3dbd7d5..318673da189b 100644
@@ -1020,7 +1020,7 @@ bool dce110_link_encoder_validate_output_with_stream(
 	case SIGNAL_TYPE_DVI_DUAL_LINK:
 		is_valid = dce110_link_encoder_validate_dvi_output(
 			enc110,
-			stream->sink->link->public.connector_signal,
+			stream->sink->link->connector_signal,
 			pipe_ctx->stream->signal,
 			&stream->public.timing);
 	break;
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +1 -1
index 716f664f40ce..6938158bed7f 100644
@@ -661,7 +661,7 @@ static enum dc_status validate_mapped_resource(
 
 	for (i = 0; i < context->stream_count; i++) {
 		struct core_stream *stream = context->streams[i];
-		struct core_link *link = stream->sink->link;
+		struct dc_link *link = stream->sink->link;
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +8 -8
index cf6bf2098b7c..fe8084e290a3 100644
@@ -700,10 +700,10 @@ void dce110_update_info_frame(struct pipe_ctx *pipe_ctx)
 void dce110_enable_stream(struct pipe_ctx *pipe_ctx)
 {
 	enum dc_lane_count lane_count =
-		pipe_ctx->stream->sink->link->public.cur_link_settings.lane_count;
+		pipe_ctx->stream->sink->link->cur_link_settings.lane_count;
 
 	struct dc_crtc_timing *timing = &pipe_ctx->stream->public.timing;
-	struct core_link *link = pipe_ctx->stream->sink->link;
+	struct dc_link *link = pipe_ctx->stream->sink->link;
 
 	/* 1. update AVI info frame (HDMI, DP)
 	 * we always need to update info frame
@@ -746,7 +746,7 @@ void dce110_enable_stream(struct pipe_ctx *pipe_ctx)
 void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
 {
 	struct core_stream *stream = pipe_ctx->stream;
-	struct core_link *link = stream->sink->link;
+	struct dc_link *link = stream->sink->link;
 
 	if (pipe_ctx->audio) {
 		pipe_ctx->audio->funcs->az_disable(pipe_ctx->audio);
@@ -1111,7 +1111,7 @@ static enum dc_status apply_single_controller_ctx_to_hw(
 	dce110_update_info_frame(pipe_ctx);
 		if (dc_is_dp_signal(pipe_ctx->stream->signal))
 			dce110_unblank_stream(pipe_ctx,
-				&stream->sink->link->public.cur_link_settings);
+				&stream->sink->link->cur_link_settings);
 	}
 
 	pipe_ctx->scl_data.lb_params.alpha_en = pipe_ctx->bottom_pipe != 0;
@@ -2220,7 +2220,7 @@ static void init_hw(struct core_dc *dc)
 		/* Power up AND update implementation according to the
 		 * required signal (which may be different from the
 		 * default signal on connector). */
-		struct core_link *link = dc->links[i];
+		struct dc_link *link = dc->links[i];
 		link->link_enc->funcs->hw_init(link->link_enc);
 	}
 
@@ -2283,11 +2283,11 @@ void dce110_fill_display_configs(
 		cfg->transmitter =
 			stream->sink->link->link_enc->transmitter;
 		cfg->link_settings.lane_count =
-			stream->sink->link->public.cur_link_settings.lane_count;
+			stream->sink->link->cur_link_settings.lane_count;
 		cfg->link_settings.link_rate =
-			stream->sink->link->public.cur_link_settings.link_rate;
+			stream->sink->link->cur_link_settings.link_rate;
 		cfg->link_settings.link_spread =
-			stream->sink->link->public.cur_link_settings.link_spread;
+			stream->sink->link->cur_link_settings.link_spread;
 		cfg->sym_clock = stream->phy_pix_clk;
 		/* Round v_refresh*/
 		cfg->v_refresh = stream->public.timing.pix_clk_khz * 1000;
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 -1
index 0fcb1cf4b4ce..015306a6ef88 100644
@@ -781,7 +781,7 @@ static enum dc_status validate_mapped_resource(
 
 	for (i = 0; i < context->stream_count; i++) {
 		struct core_stream *stream = context->streams[i];
-		struct core_link *link = stream->sink->link;
+		struct dc_link *link = stream->sink->link;
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +1 -1
index 80f067343a91..ca1e13e2a3db 100644
@@ -730,7 +730,7 @@ static enum dc_status validate_mapped_resource(
 
 	for (i = 0; i < context->stream_count; i++) {
 		struct core_stream *stream = context->streams[i];
-		struct core_link *link = stream->sink->link;
+		struct dc_link *link = stream->sink->link;
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +1 -1
index 5861b3fdf7d2..b2319dbf3be3 100644
@@ -677,7 +677,7 @@ static enum dc_status validate_mapped_resource(
 
 	for (i = 0; i < context->stream_count; i++) {
 		struct core_stream *stream = context->streams[i];
-		struct core_link *link = stream->sink->link;
+		struct dc_link *link = stream->sink->link;
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -2
index 4390023ca6dc..c25a39214111 100644
@@ -628,7 +628,7 @@ static void dcn10_init_hw(struct core_dc *dc)
 		 * required signal (which may be different from the
 		 * default signal on connector).
 		 */
-		struct core_link *link = dc->links[i];
+		struct dc_link *link = dc->links[i];
 
 		link->link_enc->funcs->hw_init(link->link_enc);
 	}
@@ -2259,7 +2259,7 @@ static void dcn10_config_stereo_parameters(
 			timing_3d_format == TIMING_3D_FORMAT_DP_HDMI_INBAND_FA ||
 			timing_3d_format == TIMING_3D_FORMAT_SIDEBAND_FA) {
 			enum display_dongle_type dongle = \
-					stream->sink->link->public.ddc->dongle_type;
+					stream->sink->link->ddc->dongle_type;
 			if (dongle == DISPLAY_DONGLE_DP_VGA_CONVERTER ||
 				dongle == DISPLAY_DONGLE_DP_DVI_CONVERTER ||
 				dongle == DISPLAY_DONGLE_DP_HDMI_CONVERTER)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +1 -1
index eec0d5b22a9f..0110a431e289 100644
@@ -845,7 +845,7 @@ static enum dc_status validate_mapped_resource(
 
 	for (i = 0; i < context->stream_count; i++) {
 		struct core_stream *stream = context->streams[i];
-		struct core_link *link = stream->sink->link;
+		struct dc_link *link = stream->sink->link;
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream)) {
 			if (stream != NULL && old_context->streams[i] != NULL) {
drivers/gpu/drm/amd/display/dc/inc/core_dc.h +1 -1
index 785236a44aee..1ecb54603e17 100644
@@ -20,7 +20,7 @@ struct core_dc {
 	struct dc_context *ctx;
 
 	uint8_t link_count;
-	struct core_link *links[MAX_PIPES * 2];
+	struct dc_link *links[MAX_PIPES * 2];
 
 	struct validate_context *current_context;
 	struct resource_pool *res_pool;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +5 -53

79 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h +1 -1
index 9c2f670c3dc3..af7ea5eaf185 100644
@@ -84,7 +84,7 @@ void dal_ddc_aux_payloads_add(
 struct ddc_service_init_data {
 	struct graphics_object_id id;
 	struct dc_context *ctx;
-	struct core_link *link;
+	struct dc_link *link;
 };
 
 struct ddc_service *dal_ddc_service_create(
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +8 -8
index b6ef1bfd267c..d9af028a39df 100644
@@ -29,12 +29,12 @@
 #define LINK_TRAINING_ATTEMPTS 4
 #define LINK_TRAINING_RETRY_DELAY 50 /* ms */
 
-struct core_link;
+struct dc_link;
 struct core_stream;
 struct dc_link_settings;
 
 bool dp_hbr_verify_link_cap(
-	struct core_link *link,
+	struct dc_link *link,
 	struct dc_link_settings *known_limit_link_setting);
 
 bool decide_fallback_link_setting(struct dc_link_settings link_setting_init,
@@ -46,7 +46,7 @@ struct dc_link_settings get_common_supported_link_settings (
 		struct dc_link_settings link_setting_b);
 
 bool dp_validate_mode_timing(
-	struct core_link *link,
+	struct dc_link *link,
 	const struct dc_crtc_timing *timing);
 
 void decide_link_settings(
@@ -54,17 +54,17 @@ void decide_link_settings(
 	struct dc_link_settings *link_setting);
 
 bool perform_link_training_with_retries(
-	struct core_link *link,
+	struct dc_link *link,
 	const struct dc_link_settings *link_setting,
 	bool skip_video_pattern,
 	int attempts);
 
-bool is_mst_supported(struct core_link *link);
+bool is_mst_supported(struct dc_link *link);
 
-void detect_dp_sink_caps(struct core_link *link);
+void detect_dp_sink_caps(struct dc_link *link);
 
-bool is_dp_active_dongle(const struct core_link *link);
+bool is_dp_active_dongle(const struct dc_link *link);
 
-void dp_enable_mst_on_sink(struct core_link *link, bool enable);
+void dp_enable_mst_on_sink(struct dc_link *link, bool enable);
 
 #endif /* __DC_LINK_DP_H__ */
drivers/gpu/drm/amd/display/dc/inc/hw/dmcu.h +1 -1
index 6067f464d805..e34b25939a98 100644
@@ -39,7 +39,7 @@ struct dmcu_funcs {
 			unsigned int bytes);
 	void (*set_psr_enable)(struct dmcu *dmcu, bool enable);
 	void (*setup_psr)(struct dmcu *dmcu,
-			struct core_link *link,
+			struct dc_link *link,
 			struct psr_context *psr_context);
 	void (*get_psr_state)(struct dmcu *dmcu, uint32_t *psr_state);
 	void (*set_psr_wait_loop)(struct dmcu *dmcu,
drivers/gpu/drm/amd/display/dc/inc/link_hwss.h +11 -11
index 75d10e93b002..f7994cfc850d 100644
@@ -29,46 +29,46 @@
 #include "inc/core_status.h"
 
 enum dc_status core_link_read_dpcd(
-	struct core_link* link,
+	struct dc_link *link,
 	uint32_t address,
 	uint8_t *data,
 	uint32_t size);
 
 enum dc_status core_link_write_dpcd(
-	struct core_link* link,
+	struct dc_link *link,
 	uint32_t address,
 	const uint8_t *data,
 	uint32_t size);
 
 void dp_enable_link_phy(
-	struct core_link *link,
+	struct dc_link *link,
 	enum signal_type signal,
 	enum clock_source_id clock_source,
 	const struct dc_link_settings *link_settings);
 
-void dp_receiver_power_ctrl(struct core_link *link, bool on);
+void dp_receiver_power_ctrl(struct dc_link *link, bool on);
 
-void dp_disable_link_phy(struct core_link *link, enum signal_type signal);
+void dp_disable_link_phy(struct dc_link *link, enum signal_type signal);
 
-void dp_disable_link_phy_mst(struct core_link *link, enum signal_type signal);
+void dp_disable_link_phy_mst(struct dc_link *link, enum signal_type signal);
 
 bool dp_set_hw_training_pattern(
-	struct core_link *link,
+	struct dc_link *link,
 	enum hw_dp_training_pattern pattern);
 
 void dp_set_hw_lane_settings(
-	struct core_link *link,
+	struct dc_link *link,
 	const struct link_training_settings *link_settings);
 
 void dp_set_hw_test_pattern(
-	struct core_link *link,
+	struct dc_link *link,
 	enum dp_test_pattern test_pattern,
 	uint8_t *custom_pattern,
 	uint32_t custom_pattern_size);
 
-enum dp_panel_mode dp_get_panel_mode(struct core_link *link);
+enum dp_panel_mode dp_get_panel_mode(struct dc_link *link);
 
-void dp_retrain_link_dp_test(struct core_link *link,
+void dp_retrain_link_dp_test(struct dc_link *link,
 		struct dc_link_settings *link_setting,
 		bool skip_video_pattern);
 
drivers/gpu/drm/amd/display/include/logger_interface.h +4 -4
index 6e6fd4e8fc00..3adf3cfc7aba 100644
@@ -140,19 +140,19 @@ void context_clock_trace(
  */
 
 #define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \
-		dc_conn_log(link->ctx, &link->public, hex_data, hex_len, \
+		dc_conn_log(link->ctx, link, hex_data, hex_len, \
 				LOG_EVENT_DETECTION, ##__VA_ARGS__)
 
 #define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \
-		dc_conn_log(link->ctx, &link->public, hex_data, hex_len, \
+		dc_conn_log(link->ctx, link, hex_data, hex_len, \
 				LOG_EVENT_LINK_LOSS, ##__VA_ARGS__)
 
 #define CONN_MSG_LT(link, ...) \
-		dc_conn_log(link->ctx, &link->public, NULL, 0, \
+		dc_conn_log(link->ctx, link, NULL, 0, \
 				LOG_EVENT_LINK_TRAINING, ##__VA_ARGS__)
 
 #define CONN_MSG_MODE(link, ...) \
-		dc_conn_log(link->ctx, &link->public, NULL, 0, \
+		dc_conn_log(link->ctx, link, NULL, 0, \
 				LOG_EVENT_MODE_SET, ##__VA_ARGS__)
 
 #endif /* __DAL_LOGGER_INTERFACE_H__ */
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#31 lore raw

PATCH 30/120 drm/amd/display: Roll sink struct into core_sink

In reply to a message not in the archive
Change-Id I83e07a5f8301743afd93b67626e8af1ab6c83d86
---
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c   | 43 +++++++++----------------
 drivers/gpu/drm/amd/display/dc/inc/core_types.h |  3 ++
 2 files changed, 18 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_sink.c +15 -28
index 7f0ba7267682..1f7985ad5dba 100644
@@ -28,30 +28,18 @@
 #include "core_types.h"
 
 /*******************************************************************************
- * Private definitions
- ******************************************************************************/
-
-struct sink {
-	struct core_sink protected;
-	int ref_count;
-};
-
-#define DC_SINK_TO_SINK(dc_sink) \
-			container_of(dc_sink, struct sink, protected.public)
-
-/*******************************************************************************
  * Private functions
  ******************************************************************************/
 
-static void destruct(struct sink *sink)
+static void destruct(struct core_sink *sink)
 {
-	if (sink->protected.public.dc_container_id) {
-		dm_free(sink->protected.public.dc_container_id);
-		sink->protected.public.dc_container_id = NULL;
+	if (sink->public.dc_container_id) {
+		dm_free(sink->public.dc_container_id);
+		sink->public.dc_container_id = NULL;
 	}
 }
 
-static bool construct(struct sink *sink, const struct dc_sink_init_data *init_params)
+static bool construct(struct core_sink *sink, const struct dc_sink_init_data *init_params)
 {
 
 	struct dc_link *link = init_params->link;
@@ -59,13 +47,12 @@ static bool construct(struct sink *sink, const struct dc_sink_init_data *init_pa
 	if (!link)
 		return false;
 
-	sink->protected.public.sink_signal = init_params->sink_signal;
-	sink->protected.link = link;
-	sink->protected.ctx = link->ctx;
-	sink->protected.public.dongle_max_pix_clk = init_params->dongle_max_pix_clk;
-	sink->protected.public.converter_disable_audio =
-			init_params->converter_disable_audio;
-	sink->protected.public.dc_container_id = NULL;
+	sink->public.sink_signal = init_params->sink_signal;
+	sink->link = link;
+	sink->ctx = link->ctx;
+	sink->public.dongle_max_pix_clk = init_params->dongle_max_pix_clk;
+	sink->public.converter_disable_audio = init_params->converter_disable_audio;
+	sink->public.dc_container_id = NULL;
 
 	return true;
 }
@@ -76,7 +63,7 @@ static bool construct(struct sink *sink, const struct dc_sink_init_data *init_pa
 
 void dc_sink_retain(const struct dc_sink *dc_sink)
 {
-	struct sink *sink = DC_SINK_TO_SINK(dc_sink);
+	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
 
 	ASSERT(sink->ref_count > 0);
 	++sink->ref_count;
@@ -84,7 +71,7 @@ void dc_sink_retain(const struct dc_sink *dc_sink)
 
 void dc_sink_release(const struct dc_sink *dc_sink)
 {
-	struct sink *sink = DC_SINK_TO_SINK(dc_sink);
+	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
 
 	ASSERT(sink->ref_count > 0);
 	--sink->ref_count;
@@ -97,7 +84,7 @@ void dc_sink_release(const struct dc_sink *dc_sink)
 
 struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
 {
-	struct sink *sink = dm_alloc(sizeof(*sink));
+	struct core_sink *sink = dm_alloc(sizeof(*sink));
 
 	if (NULL == sink)
 		goto alloc_fail;
@@ -107,7 +94,7 @@ struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
 
 	++sink->ref_count;
 
-	return &sink->protected.public;
+	return &sink->public;
 
 construct_fail:
 	dm_free(sink);
drivers/gpu/drm/amd/display/dc/inc/core_types.h +3 -0
index 6cdfeeba0faf..eed31a827a90 100644
@@ -94,6 +94,9 @@ struct core_sink {
 	/* not used for now */
 	struct dc_link *link;
 	struct dc_context *ctx;
+
+	/* private to dc_sink.c */
+	int ref_count;
 };
 
 /************ link *****************/
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#32 lore raw

PATCH 31/120 drm/amd/display: Roll core_sink into dc_sink

In reply to a message not in the archive
Change-Id Ib17c7153e1b6d3be8056c1b7951ca133eb529a9d
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h           |  4 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    |  4 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  4 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      | 60 +++++++++++-----------
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |  2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c      | 30 +++++------
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    | 15 +++---
 drivers/gpu/drm/amd/display/dc/dc.h                | 19 ++++---
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  2 +-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    | 21 +-------
 11 files changed, 72 insertions(+), 91 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +2 -2
index f57a5134a327..cb173678f7df 100644
@@ -567,9 +567,9 @@ struct amdgpu_connector {
 	int num_modes;
 	/* The 'old' sink - before an HPD.
 	 * The 'current' sink is in dc_link->sink. */
-	const struct dc_sink *dc_sink;
+	struct dc_sink *dc_sink;
 	struct dc_link *dc_link;
-	const struct dc_sink *dc_em_sink;
+	struct dc_sink *dc_em_sink;
 	const struct dc_stream *stream;
 	void *con_priv;
 	bool dac_load_detect;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
index 8f1805841150..71178c88e39f 100644
@@ -697,7 +697,7 @@ void amdgpu_dm_update_connector_after_detect(
 {
 	struct drm_connector *connector = &aconnector->base;
 	struct drm_device *dev = connector->dev;
-	const struct dc_sink *sink;
+	struct dc_sink *sink;
 
 	/* MST handled by drm_mst framework */
 	if (aconnector->mst_mgr.mst_state == true)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +2 -2
index 456f66573ede..b7c01f353d33 100644
@@ -1409,7 +1409,7 @@ int amdgpu_dm_connector_mode_valid(
 		struct drm_display_mode *mode)
 {
 	int result = MODE_ERROR;
-	const struct dc_sink *dc_sink;
+	struct dc_sink *dc_sink;
 	struct amdgpu_device *adev = connector->dev->dev_private;
 	struct dc_validation_set val_set = { 0 };
 	/* TODO: Unhardcode stream count */
@@ -1679,7 +1679,7 @@ int dm_create_validation_set_for_connector(struct drm_connector *connector,
 		struct drm_display_mode *mode, struct dc_validation_set *val_set)
 {
 	int result = MODE_ERROR;
-	const struct dc_sink *dc_sink =
+	struct dc_sink *dc_sink =
 			to_amdgpu_connector(connector)->dc_sink;
 	/* TODO: Unhardcode stream count */
 	struct dc_stream *stream;
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -2
index 73740e2a5819..30374ffaae0b 100644
@@ -939,7 +939,7 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c
 	program_timing_sync(core_dc, context);
 
 	for (i = 0; i < context->stream_count; i++) {
-		const struct core_sink *sink = context->streams[i]->sink;
+		const struct dc_sink *sink = context->streams[i]->sink;
 
 		for (j = 0; j < context->stream_status[i].surface_count; j++) {
 			const struct dc_surface *surface =
@@ -1984,7 +1984,7 @@ void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink)
 	}
 }
 
-void dc_link_remove_remote_sink(struct dc_link *link, const struct dc_sink *sink)
+void dc_link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink)
 {
 	int i;
 
drivers/gpu/drm/amd/display/dc/core/dc_link.c +29 -31

115 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index ec4714eab2be..71723fbda7f8 100644
@@ -1528,7 +1528,7 @@ enum dc_status resource_map_pool_resources(
 			pipe_ctx->stream_enc);
 
 		/* TODO: Add check if ASIC support and EDID audio */
-		if (!stream->sink->public.converter_disable_audio &&
+		if (!stream->sink->converter_disable_audio &&
 			dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
 			stream->public.audio_info.mode_count) {
 			pipe_ctx->audio = find_first_free_audio(
drivers/gpu/drm/amd/display/dc/core/dc_sink.c +13 -17
index 1f7985ad5dba..a83f1243a9d1 100644
@@ -31,15 +31,15 @@
  * Private functions
  ******************************************************************************/
 
-static void destruct(struct core_sink *sink)
+static void destruct(struct dc_sink *sink)
 {
-	if (sink->public.dc_container_id) {
-		dm_free(sink->public.dc_container_id);
-		sink->public.dc_container_id = NULL;
+	if (sink->dc_container_id) {
+		dm_free(sink->dc_container_id);
+		sink->dc_container_id = NULL;
 	}
 }
 
-static bool construct(struct core_sink *sink, const struct dc_sink_init_data *init_params)
+static bool construct(struct dc_sink *sink, const struct dc_sink_init_data *init_params)
 {
 
 	struct dc_link *link = init_params->link;
@@ -47,12 +47,12 @@ static bool construct(struct core_sink *sink, const struct dc_sink_init_data *in
 	if (!link)
 		return false;
 
-	sink->public.sink_signal = init_params->sink_signal;
+	sink->sink_signal = init_params->sink_signal;
 	sink->link = link;
 	sink->ctx = link->ctx;
-	sink->public.dongle_max_pix_clk = init_params->dongle_max_pix_clk;
-	sink->public.converter_disable_audio = init_params->converter_disable_audio;
-	sink->public.dc_container_id = NULL;
+	sink->dongle_max_pix_clk = init_params->dongle_max_pix_clk;
+	sink->converter_disable_audio = init_params->converter_disable_audio;
+	sink->dc_container_id = NULL;
 
 	return true;
 }
@@ -61,18 +61,14 @@ static bool construct(struct core_sink *sink, const struct dc_sink_init_data *in
  * Public functions
  ******************************************************************************/
 
-void dc_sink_retain(const struct dc_sink *dc_sink)
+void dc_sink_retain(struct dc_sink *sink)
 {
-	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
-
 	ASSERT(sink->ref_count > 0);
 	++sink->ref_count;
 }
 
-void dc_sink_release(const struct dc_sink *dc_sink)
+void dc_sink_release(struct dc_sink *sink)
 {
-	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
-
 	ASSERT(sink->ref_count > 0);
 	--sink->ref_count;
 
@@ -84,7 +80,7 @@ void dc_sink_release(const struct dc_sink *dc_sink)
 
 struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
 {
-	struct core_sink *sink = dm_alloc(sizeof(*sink));
+	struct dc_sink *sink = dm_alloc(sizeof(*sink));
 
 	if (NULL == sink)
 		goto alloc_fail;
@@ -94,7 +90,7 @@ struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
 
 	++sink->ref_count;
 
-	return &sink->public;
+	return sink;
 
 construct_fail:
 	dm_free(sink);
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +7 -8
index a329709de360..5b356ddf5614 100644
@@ -46,11 +46,11 @@ struct stream {
  ******************************************************************************/
 
 static bool construct(struct core_stream *stream,
-	const struct dc_sink *dc_sink_data)
+	struct dc_sink *dc_sink_data)
 {
 	uint32_t i = 0;
 
-	stream->sink = DC_SINK_TO_CORE(dc_sink_data);
+	stream->sink = dc_sink_data;
 	stream->ctx = stream->sink->ctx;
 	stream->public.sink = dc_sink_data;
 
@@ -97,7 +97,7 @@ static bool construct(struct core_stream *stream,
 
 static void destruct(struct core_stream *stream)
 {
-	dc_sink_release(&stream->sink->public);
+	dc_sink_release(stream->sink);
 	if (stream->public.out_transfer_func != NULL) {
 		dc_transfer_func_release(
 				stream->public.out_transfer_func);
@@ -130,9 +130,8 @@ void dc_stream_release(const struct dc_stream *public)
 }
 
 struct dc_stream *dc_create_stream_for_sink(
-		const struct dc_sink *dc_sink)
+		struct dc_sink *sink)
 {
-	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
 	struct stream *stream;
 
 	if (sink == NULL)
@@ -143,7 +142,7 @@ struct dc_stream *dc_create_stream_for_sink(
 	if (NULL == stream)
 		goto alloc_fail;
 
-	if (false == construct(&stream->protected, dc_sink))
+	if (false == construct(&stream->protected, sink))
 			goto construct_fail;
 
 	stream->ref_count++;
@@ -350,8 +349,8 @@ void dc_stream_log(
 	dm_logger_write(dm_logger,
 			log_type,
 			"\tsink name: %s, serial: %d\n",
-			core_stream->sink->public.edid_caps.display_name,
-			core_stream->sink->public.edid_caps.serial_number);
+			core_stream->sink->edid_caps.display_name,
+			core_stream->sink->edid_caps.serial_number);
 	dm_logger_write(dm_logger,
 			log_type,
 			"\tlink: %d\n",
drivers/gpu/drm/amd/display/dc/dc.h +13 -6
index e15e8fb1eefe..77bd54659a8b 100644
@@ -629,7 +629,7 @@ bool dc_enable_stereo(
 /**
  * Create a new default stream for the requested sink
  */
-struct dc_stream *dc_create_stream_for_sink(const struct dc_sink *dc_sink);
+struct dc_stream *dc_create_stream_for_sink(struct dc_sink *dc_sink);
 
 void dc_stream_retain(const struct dc_stream *dc_stream);
 void dc_stream_release(const struct dc_stream *dc_stream);
@@ -712,9 +712,9 @@ struct link_mst_stream_allocation_table {
  * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
  */
 struct dc_link {
-	const struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
+	struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
 	unsigned int sink_count;
-	const struct dc_sink *local_sink;
+	struct dc_sink *local_sink;
 	unsigned int link_index;
 	enum dc_connection_type type;
 	enum signal_type connector_signal;
@@ -825,7 +825,7 @@ struct dc_sink *dc_link_add_remote_sink(
 
 void dc_link_remove_remote_sink(
 	struct dc_link *link,
-	const struct dc_sink *sink);
+	struct dc_sink *sink);
 
 /* Used by diagnostics for virtual link at the moment */
 void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink);
@@ -879,10 +879,17 @@ struct dc_sink {
 	void *priv;
 	struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX];
 	bool converter_disable_audio;
+
+	/* private to DC core */
+	struct dc_link *link;
+	struct dc_context *ctx;
+
+	/* private to dc_sink.c */
+	int ref_count;
 };
 
-void dc_sink_retain(const struct dc_sink *sink);
-void dc_sink_release(const struct dc_sink *sink);
+void dc_sink_retain(struct dc_sink *sink);
+void dc_sink_release(struct dc_sink *sink);
 
 const struct audio **dc_get_audios(struct dc *dc);
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -1
index fe8084e290a3..58701fdb7c94 100644
@@ -657,7 +657,7 @@ static enum dc_status bios_parser_crtc_source_select(
 	 * encoder block
 	 * note: video bios clears all FMT setting here. */
 	struct bp_crtc_source_select crtc_source_select = {0};
-	const struct core_sink *sink = pipe_ctx->stream->sink;
+	const struct dc_sink *sink = pipe_ctx->stream->sink;
 
 	crtc_source_select.engine_id = pipe_ctx->stream_enc->id;
 	crtc_source_select.controller_id = pipe_ctx->pipe_idx + 1;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -20
index eed31a827a90..1d733c837854 100644
@@ -68,7 +68,7 @@ struct core_stream {
 
 	/* field internal to DC */
 	struct dc_context *ctx;
-	const struct core_sink *sink;
+	struct dc_sink *sink;
 
 	/* used by DCP and FMT */
 	struct bit_depth_reduction_params bit_depth_params;
@@ -80,25 +80,6 @@ struct core_stream {
 	struct dc_stream_status status;
 };
 
-/************ core_sink *****************/
-
-#define DC_SINK_TO_CORE(dc_sink) \
-	container_of(dc_sink, struct core_sink, public)
-
-struct core_sink {
-	/** The public, read-only (for DM) area of sink. **/
-	struct dc_sink public;
-	/** End-of-public area. **/
-
-	/** The 'protected' area - read/write access, for use only inside DC **/
-	/* not used for now */
-	struct dc_link *link;
-	struct dc_context *ctx;
-
-	/* private to dc_sink.c */
-	int ref_count;
-};
-
 /************ link *****************/
 struct link_init_data {
 	const struct core_dc *dc;
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#33 lore raw

PATCH 32/120 Revert "drm/amd/display: Roll core_sink into dc_sink"

In reply to a message not in the archive

This reverts commit 1a636edfb1db887198014339a58aade7c688aa10.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h           |  4 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    |  4 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  4 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      | 60 +++++++++++-----------
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |  2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c      | 30 ++++++-----
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    | 15 +++---
 drivers/gpu/drm/amd/display/dc/dc.h                | 19 +++----
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  2 +-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    | 21 +++++++-
 11 files changed, 91 insertions(+), 72 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +2 -2
index cb173678f7df..f57a5134a327 100644
@@ -567,9 +567,9 @@ struct amdgpu_connector {
 	int num_modes;
 	/* The 'old' sink - before an HPD.
 	 * The 'current' sink is in dc_link->sink. */
-	struct dc_sink *dc_sink;
+	const struct dc_sink *dc_sink;
 	struct dc_link *dc_link;
-	struct dc_sink *dc_em_sink;
+	const struct dc_sink *dc_em_sink;
 	const struct dc_stream *stream;
 	void *con_priv;
 	bool dac_load_detect;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
index 71178c88e39f..8f1805841150 100644
@@ -697,7 +697,7 @@ void amdgpu_dm_update_connector_after_detect(
 {
 	struct drm_connector *connector = &aconnector->base;
 	struct drm_device *dev = connector->dev;
-	struct dc_sink *sink;
+	const struct dc_sink *sink;
 
 	/* MST handled by drm_mst framework */
 	if (aconnector->mst_mgr.mst_state == true)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +2 -2
index b7c01f353d33..456f66573ede 100644
@@ -1409,7 +1409,7 @@ int amdgpu_dm_connector_mode_valid(
 		struct drm_display_mode *mode)
 {
 	int result = MODE_ERROR;
-	struct dc_sink *dc_sink;
+	const struct dc_sink *dc_sink;
 	struct amdgpu_device *adev = connector->dev->dev_private;
 	struct dc_validation_set val_set = { 0 };
 	/* TODO: Unhardcode stream count */
@@ -1679,7 +1679,7 @@ int dm_create_validation_set_for_connector(struct drm_connector *connector,
 		struct drm_display_mode *mode, struct dc_validation_set *val_set)
 {
 	int result = MODE_ERROR;
-	struct dc_sink *dc_sink =
+	const struct dc_sink *dc_sink =
 			to_amdgpu_connector(connector)->dc_sink;
 	/* TODO: Unhardcode stream count */
 	struct dc_stream *stream;
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -2
index 30374ffaae0b..73740e2a5819 100644
@@ -939,7 +939,7 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c
 	program_timing_sync(core_dc, context);
 
 	for (i = 0; i < context->stream_count; i++) {
-		const struct dc_sink *sink = context->streams[i]->sink;
+		const struct core_sink *sink = context->streams[i]->sink;
 
 		for (j = 0; j < context->stream_status[i].surface_count; j++) {
 			const struct dc_surface *surface =
@@ -1984,7 +1984,7 @@ void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink)
 	}
 }
 
-void dc_link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink)
+void dc_link_remove_remote_sink(struct dc_link *link, const struct dc_sink *sink)
 {
 	int i;
 
drivers/gpu/drm/amd/display/dc/core/dc_link.c +31 -29

115 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index 71723fbda7f8..ec4714eab2be 100644
@@ -1528,7 +1528,7 @@ enum dc_status resource_map_pool_resources(
 			pipe_ctx->stream_enc);
 
 		/* TODO: Add check if ASIC support and EDID audio */
-		if (!stream->sink->converter_disable_audio &&
+		if (!stream->sink->public.converter_disable_audio &&
 			dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
 			stream->public.audio_info.mode_count) {
 			pipe_ctx->audio = find_first_free_audio(
drivers/gpu/drm/amd/display/dc/core/dc_sink.c +17 -13
index a83f1243a9d1..1f7985ad5dba 100644
@@ -31,15 +31,15 @@
  * Private functions
  ******************************************************************************/
 
-static void destruct(struct dc_sink *sink)
+static void destruct(struct core_sink *sink)
 {
-	if (sink->dc_container_id) {
-		dm_free(sink->dc_container_id);
-		sink->dc_container_id = NULL;
+	if (sink->public.dc_container_id) {
+		dm_free(sink->public.dc_container_id);
+		sink->public.dc_container_id = NULL;
 	}
 }
 
-static bool construct(struct dc_sink *sink, const struct dc_sink_init_data *init_params)
+static bool construct(struct core_sink *sink, const struct dc_sink_init_data *init_params)
 {
 
 	struct dc_link *link = init_params->link;
@@ -47,12 +47,12 @@ static bool construct(struct dc_sink *sink, const struct dc_sink_init_data *init
 	if (!link)
 		return false;
 
-	sink->sink_signal = init_params->sink_signal;
+	sink->public.sink_signal = init_params->sink_signal;
 	sink->link = link;
 	sink->ctx = link->ctx;
-	sink->dongle_max_pix_clk = init_params->dongle_max_pix_clk;
-	sink->converter_disable_audio = init_params->converter_disable_audio;
-	sink->dc_container_id = NULL;
+	sink->public.dongle_max_pix_clk = init_params->dongle_max_pix_clk;
+	sink->public.converter_disable_audio = init_params->converter_disable_audio;
+	sink->public.dc_container_id = NULL;
 
 	return true;
 }
@@ -61,14 +61,18 @@ static bool construct(struct dc_sink *sink, const struct dc_sink_init_data *init
  * Public functions
  ******************************************************************************/
 
-void dc_sink_retain(struct dc_sink *sink)
+void dc_sink_retain(const struct dc_sink *dc_sink)
 {
+	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
+
 	ASSERT(sink->ref_count > 0);
 	++sink->ref_count;
 }
 
-void dc_sink_release(struct dc_sink *sink)
+void dc_sink_release(const struct dc_sink *dc_sink)
 {
+	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
+
 	ASSERT(sink->ref_count > 0);
 	--sink->ref_count;
 
@@ -80,7 +84,7 @@ void dc_sink_release(struct dc_sink *sink)
 
 struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
 {
-	struct dc_sink *sink = dm_alloc(sizeof(*sink));
+	struct core_sink *sink = dm_alloc(sizeof(*sink));
 
 	if (NULL == sink)
 		goto alloc_fail;
@@ -90,7 +94,7 @@ struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
 
 	++sink->ref_count;
 
-	return sink;
+	return &sink->public;
 
 construct_fail:
 	dm_free(sink);
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +8 -7
index 5b356ddf5614..a329709de360 100644
@@ -46,11 +46,11 @@ struct stream {
  ******************************************************************************/
 
 static bool construct(struct core_stream *stream,
-	struct dc_sink *dc_sink_data)
+	const struct dc_sink *dc_sink_data)
 {
 	uint32_t i = 0;
 
-	stream->sink = dc_sink_data;
+	stream->sink = DC_SINK_TO_CORE(dc_sink_data);
 	stream->ctx = stream->sink->ctx;
 	stream->public.sink = dc_sink_data;
 
@@ -97,7 +97,7 @@ static bool construct(struct core_stream *stream,
 
 static void destruct(struct core_stream *stream)
 {
-	dc_sink_release(stream->sink);
+	dc_sink_release(&stream->sink->public);
 	if (stream->public.out_transfer_func != NULL) {
 		dc_transfer_func_release(
 				stream->public.out_transfer_func);
@@ -130,8 +130,9 @@ void dc_stream_release(const struct dc_stream *public)
 }
 
 struct dc_stream *dc_create_stream_for_sink(
-		struct dc_sink *sink)
+		const struct dc_sink *dc_sink)
 {
+	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
 	struct stream *stream;
 
 	if (sink == NULL)
@@ -142,7 +143,7 @@ struct dc_stream *dc_create_stream_for_sink(
 	if (NULL == stream)
 		goto alloc_fail;
 
-	if (false == construct(&stream->protected, sink))
+	if (false == construct(&stream->protected, dc_sink))
 			goto construct_fail;
 
 	stream->ref_count++;
@@ -349,8 +350,8 @@ void dc_stream_log(
 	dm_logger_write(dm_logger,
 			log_type,
 			"\tsink name: %s, serial: %d\n",
-			core_stream->sink->edid_caps.display_name,
-			core_stream->sink->edid_caps.serial_number);
+			core_stream->sink->public.edid_caps.display_name,
+			core_stream->sink->public.edid_caps.serial_number);
 	dm_logger_write(dm_logger,
 			log_type,
 			"\tlink: %d\n",
drivers/gpu/drm/amd/display/dc/dc.h +6 -13
index 77bd54659a8b..e15e8fb1eefe 100644
@@ -629,7 +629,7 @@ bool dc_enable_stereo(
 /**
  * Create a new default stream for the requested sink
  */
-struct dc_stream *dc_create_stream_for_sink(struct dc_sink *dc_sink);
+struct dc_stream *dc_create_stream_for_sink(const struct dc_sink *dc_sink);
 
 void dc_stream_retain(const struct dc_stream *dc_stream);
 void dc_stream_release(const struct dc_stream *dc_stream);
@@ -712,9 +712,9 @@ struct link_mst_stream_allocation_table {
  * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
  */
 struct dc_link {
-	struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
+	const struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
 	unsigned int sink_count;
-	struct dc_sink *local_sink;
+	const struct dc_sink *local_sink;
 	unsigned int link_index;
 	enum dc_connection_type type;
 	enum signal_type connector_signal;
@@ -825,7 +825,7 @@ struct dc_sink *dc_link_add_remote_sink(
 
 void dc_link_remove_remote_sink(
 	struct dc_link *link,
-	struct dc_sink *sink);
+	const struct dc_sink *sink);
 
 /* Used by diagnostics for virtual link at the moment */
 void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink);
@@ -879,17 +879,10 @@ struct dc_sink {
 	void *priv;
 	struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX];
 	bool converter_disable_audio;
-
-	/* private to DC core */
-	struct dc_link *link;
-	struct dc_context *ctx;
-
-	/* private to dc_sink.c */
-	int ref_count;
 };
 
-void dc_sink_retain(struct dc_sink *sink);
-void dc_sink_release(struct dc_sink *sink);
+void dc_sink_retain(const struct dc_sink *sink);
+void dc_sink_release(const struct dc_sink *sink);
 
 const struct audio **dc_get_audios(struct dc *dc);
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -1
index 58701fdb7c94..fe8084e290a3 100644
@@ -657,7 +657,7 @@ static enum dc_status bios_parser_crtc_source_select(
 	 * encoder block
 	 * note: video bios clears all FMT setting here. */
 	struct bp_crtc_source_select crtc_source_select = {0};
-	const struct dc_sink *sink = pipe_ctx->stream->sink;
+	const struct core_sink *sink = pipe_ctx->stream->sink;
 
 	crtc_source_select.engine_id = pipe_ctx->stream_enc->id;
 	crtc_source_select.controller_id = pipe_ctx->pipe_idx + 1;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +20 -1
index 1d733c837854..eed31a827a90 100644
@@ -68,7 +68,7 @@ struct core_stream {
 
 	/* field internal to DC */
 	struct dc_context *ctx;
-	struct dc_sink *sink;
+	const struct core_sink *sink;
 
 	/* used by DCP and FMT */
 	struct bit_depth_reduction_params bit_depth_params;
@@ -80,6 +80,25 @@ struct core_stream {
 	struct dc_stream_status status;
 };
 
+/************ core_sink *****************/
+
+#define DC_SINK_TO_CORE(dc_sink) \
+	container_of(dc_sink, struct core_sink, public)
+
+struct core_sink {
+	/** The public, read-only (for DM) area of sink. **/
+	struct dc_sink public;
+	/** End-of-public area. **/
+
+	/** The 'protected' area - read/write access, for use only inside DC **/
+	/* not used for now */
+	struct dc_link *link;
+	struct dc_context *ctx;
+
+	/* private to dc_sink.c */
+	int ref_count;
+};
+
 /************ link *****************/
 struct link_init_data {
 	const struct core_dc *dc;
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#34 lore raw

PATCH 33/120 drm/amd/display: Roll core_sink into dc_sink

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h           |  4 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    |  4 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  4 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      | 60 +++++++++++-----------
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |  2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c      | 30 +++++------
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    | 15 +++---
 drivers/gpu/drm/amd/display/dc/dc.h                | 19 ++++---
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  2 +-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    | 21 +-------
 11 files changed, 72 insertions(+), 91 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +2 -2
index f57a5134a327..cb173678f7df 100644
@@ -567,9 +567,9 @@ struct amdgpu_connector {
 	int num_modes;
 	/* The 'old' sink - before an HPD.
 	 * The 'current' sink is in dc_link->sink. */
-	const struct dc_sink *dc_sink;
+	struct dc_sink *dc_sink;
 	struct dc_link *dc_link;
-	const struct dc_sink *dc_em_sink;
+	struct dc_sink *dc_em_sink;
 	const struct dc_stream *stream;
 	void *con_priv;
 	bool dac_load_detect;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
index 8f1805841150..71178c88e39f 100644
@@ -697,7 +697,7 @@ void amdgpu_dm_update_connector_after_detect(
 {
 	struct drm_connector *connector = &aconnector->base;
 	struct drm_device *dev = connector->dev;
-	const struct dc_sink *sink;
+	struct dc_sink *sink;
 
 	/* MST handled by drm_mst framework */
 	if (aconnector->mst_mgr.mst_state == true)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +2 -2
index 456f66573ede..b7c01f353d33 100644
@@ -1409,7 +1409,7 @@ int amdgpu_dm_connector_mode_valid(
 		struct drm_display_mode *mode)
 {
 	int result = MODE_ERROR;
-	const struct dc_sink *dc_sink;
+	struct dc_sink *dc_sink;
 	struct amdgpu_device *adev = connector->dev->dev_private;
 	struct dc_validation_set val_set = { 0 };
 	/* TODO: Unhardcode stream count */
@@ -1679,7 +1679,7 @@ int dm_create_validation_set_for_connector(struct drm_connector *connector,
 		struct drm_display_mode *mode, struct dc_validation_set *val_set)
 {
 	int result = MODE_ERROR;
-	const struct dc_sink *dc_sink =
+	struct dc_sink *dc_sink =
 			to_amdgpu_connector(connector)->dc_sink;
 	/* TODO: Unhardcode stream count */
 	struct dc_stream *stream;
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -2
index 73740e2a5819..30374ffaae0b 100644
@@ -939,7 +939,7 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c
 	program_timing_sync(core_dc, context);
 
 	for (i = 0; i < context->stream_count; i++) {
-		const struct core_sink *sink = context->streams[i]->sink;
+		const struct dc_sink *sink = context->streams[i]->sink;
 
 		for (j = 0; j < context->stream_status[i].surface_count; j++) {
 			const struct dc_surface *surface =
@@ -1984,7 +1984,7 @@ void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink)
 	}
 }
 
-void dc_link_remove_remote_sink(struct dc_link *link, const struct dc_sink *sink)
+void dc_link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink)
 {
 	int i;
 
drivers/gpu/drm/amd/display/dc/core/dc_link.c +29 -31

115 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index ec4714eab2be..71723fbda7f8 100644
@@ -1528,7 +1528,7 @@ enum dc_status resource_map_pool_resources(
 			pipe_ctx->stream_enc);
 
 		/* TODO: Add check if ASIC support and EDID audio */
-		if (!stream->sink->public.converter_disable_audio &&
+		if (!stream->sink->converter_disable_audio &&
 			dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
 			stream->public.audio_info.mode_count) {
 			pipe_ctx->audio = find_first_free_audio(
drivers/gpu/drm/amd/display/dc/core/dc_sink.c +13 -17
index 1f7985ad5dba..a83f1243a9d1 100644
@@ -31,15 +31,15 @@
  * Private functions
  ******************************************************************************/
 
-static void destruct(struct core_sink *sink)
+static void destruct(struct dc_sink *sink)
 {
-	if (sink->public.dc_container_id) {
-		dm_free(sink->public.dc_container_id);
-		sink->public.dc_container_id = NULL;
+	if (sink->dc_container_id) {
+		dm_free(sink->dc_container_id);
+		sink->dc_container_id = NULL;
 	}
 }
 
-static bool construct(struct core_sink *sink, const struct dc_sink_init_data *init_params)
+static bool construct(struct dc_sink *sink, const struct dc_sink_init_data *init_params)
 {
 
 	struct dc_link *link = init_params->link;
@@ -47,12 +47,12 @@ static bool construct(struct core_sink *sink, const struct dc_sink_init_data *in
 	if (!link)
 		return false;
 
-	sink->public.sink_signal = init_params->sink_signal;
+	sink->sink_signal = init_params->sink_signal;
 	sink->link = link;
 	sink->ctx = link->ctx;
-	sink->public.dongle_max_pix_clk = init_params->dongle_max_pix_clk;
-	sink->public.converter_disable_audio = init_params->converter_disable_audio;
-	sink->public.dc_container_id = NULL;
+	sink->dongle_max_pix_clk = init_params->dongle_max_pix_clk;
+	sink->converter_disable_audio = init_params->converter_disable_audio;
+	sink->dc_container_id = NULL;
 
 	return true;
 }
@@ -61,18 +61,14 @@ static bool construct(struct core_sink *sink, const struct dc_sink_init_data *in
  * Public functions
  ******************************************************************************/
 
-void dc_sink_retain(const struct dc_sink *dc_sink)
+void dc_sink_retain(struct dc_sink *sink)
 {
-	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
-
 	ASSERT(sink->ref_count > 0);
 	++sink->ref_count;
 }
 
-void dc_sink_release(const struct dc_sink *dc_sink)
+void dc_sink_release(struct dc_sink *sink)
 {
-	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
-
 	ASSERT(sink->ref_count > 0);
 	--sink->ref_count;
 
@@ -84,7 +80,7 @@ void dc_sink_release(const struct dc_sink *dc_sink)
 
 struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
 {
-	struct core_sink *sink = dm_alloc(sizeof(*sink));
+	struct dc_sink *sink = dm_alloc(sizeof(*sink));
 
 	if (NULL == sink)
 		goto alloc_fail;
@@ -94,7 +90,7 @@ struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
 
 	++sink->ref_count;
 
-	return &sink->public;
+	return sink;
 
 construct_fail:
 	dm_free(sink);
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +7 -8
index a329709de360..5b356ddf5614 100644
@@ -46,11 +46,11 @@ struct stream {
  ******************************************************************************/
 
 static bool construct(struct core_stream *stream,
-	const struct dc_sink *dc_sink_data)
+	struct dc_sink *dc_sink_data)
 {
 	uint32_t i = 0;
 
-	stream->sink = DC_SINK_TO_CORE(dc_sink_data);
+	stream->sink = dc_sink_data;
 	stream->ctx = stream->sink->ctx;
 	stream->public.sink = dc_sink_data;
 
@@ -97,7 +97,7 @@ static bool construct(struct core_stream *stream,
 
 static void destruct(struct core_stream *stream)
 {
-	dc_sink_release(&stream->sink->public);
+	dc_sink_release(stream->sink);
 	if (stream->public.out_transfer_func != NULL) {
 		dc_transfer_func_release(
 				stream->public.out_transfer_func);
@@ -130,9 +130,8 @@ void dc_stream_release(const struct dc_stream *public)
 }
 
 struct dc_stream *dc_create_stream_for_sink(
-		const struct dc_sink *dc_sink)
+		struct dc_sink *sink)
 {
-	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
 	struct stream *stream;
 
 	if (sink == NULL)
@@ -143,7 +142,7 @@ struct dc_stream *dc_create_stream_for_sink(
 	if (NULL == stream)
 		goto alloc_fail;
 
-	if (false == construct(&stream->protected, dc_sink))
+	if (false == construct(&stream->protected, sink))
 			goto construct_fail;
 
 	stream->ref_count++;
@@ -350,8 +349,8 @@ void dc_stream_log(
 	dm_logger_write(dm_logger,
 			log_type,
 			"\tsink name: %s, serial: %d\n",
-			core_stream->sink->public.edid_caps.display_name,
-			core_stream->sink->public.edid_caps.serial_number);
+			core_stream->sink->edid_caps.display_name,
+			core_stream->sink->edid_caps.serial_number);
 	dm_logger_write(dm_logger,
 			log_type,
 			"\tlink: %d\n",
drivers/gpu/drm/amd/display/dc/dc.h +13 -6
index e15e8fb1eefe..77bd54659a8b 100644
@@ -629,7 +629,7 @@ bool dc_enable_stereo(
 /**
  * Create a new default stream for the requested sink
  */
-struct dc_stream *dc_create_stream_for_sink(const struct dc_sink *dc_sink);
+struct dc_stream *dc_create_stream_for_sink(struct dc_sink *dc_sink);
 
 void dc_stream_retain(const struct dc_stream *dc_stream);
 void dc_stream_release(const struct dc_stream *dc_stream);
@@ -712,9 +712,9 @@ struct link_mst_stream_allocation_table {
  * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
  */
 struct dc_link {
-	const struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
+	struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
 	unsigned int sink_count;
-	const struct dc_sink *local_sink;
+	struct dc_sink *local_sink;
 	unsigned int link_index;
 	enum dc_connection_type type;
 	enum signal_type connector_signal;
@@ -825,7 +825,7 @@ struct dc_sink *dc_link_add_remote_sink(
 
 void dc_link_remove_remote_sink(
 	struct dc_link *link,
-	const struct dc_sink *sink);
+	struct dc_sink *sink);
 
 /* Used by diagnostics for virtual link at the moment */
 void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink);
@@ -879,10 +879,17 @@ struct dc_sink {
 	void *priv;
 	struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX];
 	bool converter_disable_audio;
+
+	/* private to DC core */
+	struct dc_link *link;
+	struct dc_context *ctx;
+
+	/* private to dc_sink.c */
+	int ref_count;
 };
 
-void dc_sink_retain(const struct dc_sink *sink);
-void dc_sink_release(const struct dc_sink *sink);
+void dc_sink_retain(struct dc_sink *sink);
+void dc_sink_release(struct dc_sink *sink);
 
 const struct audio **dc_get_audios(struct dc *dc);
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -1
index fe8084e290a3..58701fdb7c94 100644
@@ -657,7 +657,7 @@ static enum dc_status bios_parser_crtc_source_select(
 	 * encoder block
 	 * note: video bios clears all FMT setting here. */
 	struct bp_crtc_source_select crtc_source_select = {0};
-	const struct core_sink *sink = pipe_ctx->stream->sink;
+	const struct dc_sink *sink = pipe_ctx->stream->sink;
 
 	crtc_source_select.engine_id = pipe_ctx->stream_enc->id;
 	crtc_source_select.controller_id = pipe_ctx->pipe_idx + 1;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -20
index eed31a827a90..1d733c837854 100644
@@ -68,7 +68,7 @@ struct core_stream {
 
 	/* field internal to DC */
 	struct dc_context *ctx;
-	const struct core_sink *sink;
+	struct dc_sink *sink;
 
 	/* used by DCP and FMT */
 	struct bit_depth_reduction_params bit_depth_params;
@@ -80,25 +80,6 @@ struct core_stream {
 	struct dc_stream_status status;
 };
 
-/************ core_sink *****************/
-
-#define DC_SINK_TO_CORE(dc_sink) \
-	container_of(dc_sink, struct core_sink, public)
-
-struct core_sink {
-	/** The public, read-only (for DM) area of sink. **/
-	struct dc_sink public;
-	/** End-of-public area. **/
-
-	/** The 'protected' area - read/write access, for use only inside DC **/
-	/* not used for now */
-	struct dc_link *link;
-	struct dc_context *ctx;
-
-	/* private to dc_sink.c */
-	int ref_count;
-};
-
 /************ link *****************/
 struct link_init_data {
 	const struct core_dc *dc;
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#35 lore raw

PATCH 34/120 drm/amd/display: Roll gamma struct into core_gamma

In reply to a message not in the archive
Change-Id I7961d552508c3809729b19a04aae528341654d15
---
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 21 ++++-----------------
 drivers/gpu/drm/amd/display/dc/inc/core_types.h  |  3 +++
 2 files changed, 7 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +4 -17
index 9a21ea71f4b3..a8b9515fd367 100644
@@ -32,19 +32,6 @@
 #include "transform.h"
 
 /*******************************************************************************
- * Private structures
- ******************************************************************************/
-struct gamma {
-	struct core_gamma protected;
-	int ref_count;
-};
-
-#define DC_GAMMA_TO_GAMMA(dc_gamma) \
-	container_of(dc_gamma, struct gamma, protected.public)
-#define CORE_GAMMA_TO_GAMMA(core_gamma) \
-	container_of(core_gamma, struct gamma, protected)
-
-/*******************************************************************************
  * Private functions
  ******************************************************************************/
 static bool construct(struct dc_context *ctx, struct dc_surface *surface)
@@ -152,7 +139,7 @@ void dc_surface_release(struct dc_surface *surface)
 
 void dc_gamma_retain(const struct dc_gamma *dc_gamma)
 {
-	struct gamma *gamma = DC_GAMMA_TO_GAMMA(dc_gamma);
+	struct core_gamma *gamma = DC_GAMMA_TO_CORE(dc_gamma);
 
 	ASSERT(gamma->ref_count > 0);
 	++gamma->ref_count;
@@ -160,7 +147,7 @@ void dc_gamma_retain(const struct dc_gamma *dc_gamma)
 
 void dc_gamma_release(const struct dc_gamma **dc_gamma)
 {
-	struct gamma *gamma = DC_GAMMA_TO_GAMMA(*dc_gamma);
+	struct core_gamma *gamma = DC_GAMMA_TO_CORE(*dc_gamma);
 
 	ASSERT(gamma->ref_count > 0);
 	--gamma->ref_count;
@@ -173,14 +160,14 @@ void dc_gamma_release(const struct dc_gamma **dc_gamma)
 
 struct dc_gamma *dc_create_gamma()
 {
-	struct gamma *gamma = dm_alloc(sizeof(*gamma));
+	struct core_gamma *gamma = dm_alloc(sizeof(*gamma));
 
 	if (gamma == NULL)
 		goto alloc_fail;
 
 	++gamma->ref_count;
 
-	return &gamma->protected.public;
+	return &gamma->public;
 
 alloc_fail:
 	return NULL;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +3 -0
index 1d733c837854..43e9ada278d3 100644
@@ -46,6 +46,9 @@ struct core_stream;
 struct core_gamma {
 	struct dc_gamma public;
 	struct dc_context *ctx;
+
+	/* private to dc_surface.c */
+	int ref_count;
 };
 
 void enable_surface_flip_reporting(struct dc_surface *dc_surface,
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#36 lore raw

PATCH 35/120 drm/amd/display: Roll core_gamma into dc_gamma

In reply to a message not in the archive
Change-Id Ibf1042eaf53c350df3344deaafc4d1629941c129
---
 drivers/gpu/drm/amd/display/dc/core/dc.c         |  6 ++----
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 22 +++++++++-------------
 drivers/gpu/drm/amd/display/dc/dc.h              |  6 +++---
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h     |  7 +++++++
 drivers/gpu/drm/amd/display/dc/inc/core_types.h  | 11 -----------
 5 files changed, 21 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -4
index 30374ffaae0b..d3873ac45cf3 100644
@@ -1500,12 +1500,10 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 		if (srf_updates[i].gamma &&
 			srf_updates[i].gamma != surface->gamma_correction) {
 			if (surface->gamma_correction != NULL)
-				dc_gamma_release(&surface->
-						gamma_correction);
+				dc_gamma_release(&surface->gamma_correction);
 
 			dc_gamma_retain(srf_updates[i].gamma);
-			surface->gamma_correction =
-						srf_updates[i].gamma;
+			surface->gamma_correction = srf_updates[i].gamma;
 		}
 
 		if (srf_updates[i].in_transfer_func &&
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +9 -13
index a8b9515fd367..eded6b7da97d 100644
@@ -137,37 +137,33 @@ void dc_surface_release(struct dc_surface *surface)
 	}
 }
 
-void dc_gamma_retain(const struct dc_gamma *dc_gamma)
+void dc_gamma_retain(struct dc_gamma *gamma)
 {
-	struct core_gamma *gamma = DC_GAMMA_TO_CORE(dc_gamma);
-
 	ASSERT(gamma->ref_count > 0);
 	++gamma->ref_count;
 }
 
-void dc_gamma_release(const struct dc_gamma **dc_gamma)
+void dc_gamma_release(struct dc_gamma **gamma)
 {
-	struct core_gamma *gamma = DC_GAMMA_TO_CORE(*dc_gamma);
-
-	ASSERT(gamma->ref_count > 0);
-	--gamma->ref_count;
+	ASSERT((*gamma)->ref_count > 0);
+	--(*gamma)->ref_count;
 
-	if (gamma->ref_count == 0)
-		dm_free(gamma);
+	if ((*gamma)->ref_count == 0)
+		dm_free((*gamma));
 
-	*dc_gamma = NULL;
+	*gamma = NULL;
 }
 
 struct dc_gamma *dc_create_gamma()
 {
-	struct core_gamma *gamma = dm_alloc(sizeof(*gamma));
+	struct dc_gamma *gamma = dm_alloc(sizeof(*gamma));
 
 	if (gamma == NULL)
 		goto alloc_fail;
 
 	++gamma->ref_count;
 
-	return &gamma->public;
+	return gamma;
 
 alloc_fail:
 	return NULL;
drivers/gpu/drm/amd/display/dc/dc.h +3 -3
index 77bd54659a8b..5523bb68f4e8 100644
@@ -326,7 +326,7 @@ struct dc_surface {
 	struct dc_plane_dcc_param dcc;
 	struct dc_hdr_static_metadata hdr_static_ctx;
 
-	const struct dc_gamma *gamma_correction;
+	struct dc_gamma *gamma_correction;
 	struct dc_transfer_func *in_transfer_func;
 
 	enum dc_color_space color_space;
@@ -394,8 +394,8 @@ const struct dc_surface_status *dc_surface_get_status(
 void dc_surface_retain(struct dc_surface *dc_surface);
 void dc_surface_release(struct dc_surface *dc_surface);
 
-void dc_gamma_retain(const struct dc_gamma *dc_gamma);
-void dc_gamma_release(const struct dc_gamma **dc_gamma);
+void dc_gamma_retain(struct dc_gamma *dc_gamma);
+void dc_gamma_release(struct dc_gamma **dc_gamma);
 struct dc_gamma *dc_create_gamma(void);
 
 void dc_transfer_func_retain(struct dc_transfer_func *dc_tf);
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +7 -0
index 05f030ee8cf0..4c5e797da5b1 100644
@@ -415,6 +415,13 @@ struct dc_gamma {
 	uint16_t red[INPUT_LUT_ENTRIES];
 	uint16_t green[INPUT_LUT_ENTRIES];
 	uint16_t blue[INPUT_LUT_ENTRIES];
+
+	/* private to DC core */
+	struct dc_context *ctx;
+
+	/* private to dc_surface.c */
+	int ref_count;
+
 };
 
 /* Used by both ipp amd opp functions*/
drivers/gpu/drm/amd/display/dc/inc/core_types.h +0 -11
index 43e9ada278d3..5a47d4c94df6 100644
@@ -40,17 +40,6 @@ struct core_stream;
 
 #define MAX_CLOCK_SOURCES 7
 
-#define DC_GAMMA_TO_CORE(dc_gamma) \
-	container_of(dc_gamma, struct core_gamma, public)
-
-struct core_gamma {
-	struct dc_gamma public;
-	struct dc_context *ctx;
-
-	/* private to dc_surface.c */
-	int ref_count;
-};
-
 void enable_surface_flip_reporting(struct dc_surface *dc_surface,
 		uint32_t controller_id);
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#37 lore raw

PATCH 36/120 drm/amd/display: single PSR display not allow CSTATE sw w/a

In reply to a message not in the archive

From: Charlene Liu <[email protected]>

Description:
HW issue when all the pipes are off, DCE_allow_cstate is 0. New sequence : blank OTG only instead of previous OTG_master_en=0)

Change-Id If9b7d1ea3e474dc58bee187bcc2be84be4538a16
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 6 ++++++
 drivers/gpu/drm/amd/display/dc/dc_types.h     | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +6 -0
index e7062069d9a1..7d03f6ca2eaf 100644
@@ -1548,6 +1548,12 @@ bool dc_link_setup_psr(struct dc_link *link,
 
 		psr_context->psr_level.u32all = 0;
 
+#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
+		/*skip power down the single pipe since it blocks the cstate*/
+		if (ASIC_REV_IS_RAVEN(ctx->asic_id.hw_internal_rev))
+			psr_context->psr_level.bits.SKIP_SINGLE_OTG_DISABLE = true;
+#endif
+
 		/* SMU will perform additional powerdown sequence.
 		 * For unsupported ASICs, set psr_level flag to skip PSR
 		 *  static screen notification to SMU.
drivers/gpu/drm/amd/display/dc/dc_types.h +2 -1
index c7539fe36b66..99b893fbcb42 100644
@@ -539,7 +539,8 @@ union dmcu_psr_level {
 		unsigned int SKIP_SMU_NOTIFICATION:1;
 		unsigned int SKIP_AUTO_STATE_ADVANCE:1;
 		unsigned int DISABLE_PSR_ENTRY_ABORT:1;
-		unsigned int RESERVED:23;
+		unsigned int SKIP_SINGLE_OTG_DISABLE:1;
+		unsigned int RESERVED:22;
 	} bits;
 	unsigned int u32all;
 };
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#38 lore raw

PATCH 37/120 drm/amd/display: separate plane disable sequence

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

- disconnect: trigger hw to disconnect plane on next vsync
- disable: disables HW block and disable clocks
- power_down: kill power

Change-Id Ibe14247377cbd8193198e7f78497488d2059b80c
---
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 83 ++++++++++++++++------
 1 file changed, 61 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +61 -22
index c25a39214111..3a0fcaad84c2 100644
@@ -815,8 +815,8 @@ static void reset_back_end_for_pipe(
 					pipe_ctx->pipe_idx, pipe_ctx->tg->inst);
 }
 
-static void plane_atomic_stop(
-		struct core_dc *dc,
+/* trigger HW to start disconnect plane from stream on the next vsync */
+static void plane_atomic_disconnect(struct core_dc *dc,
 		int fe_idx)
 {
 	struct mpcc_cfg mpcc_cfg;
@@ -824,6 +824,12 @@ static void plane_atomic_stop(
 	struct transform *xfm = dc->res_pool->transforms[fe_idx];
 	struct mpcc *mpcc = dc->res_pool->mpcc[fe_idx];
 	struct timing_generator *tg = dc->res_pool->timing_generators[mpcc->opp_id];
+	unsigned int opp_id = mpcc->opp_id;
+	int opp_id_cached = mpcc->opp_id;
+
+	/*Already reset*/
+	if (opp_id == 0xf)
+		return;
 
 	mi->funcs->dcc_control(mi, false, false);
 
@@ -833,11 +839,19 @@ static void plane_atomic_stop(
 	mpcc_cfg.top_of_tree = tg->inst == mpcc->inst;
 	mpcc->funcs->set(mpcc, &mpcc_cfg);
 
+	/* Hack to preserve old opp_id for plane_atomic_disable
+	 * to find the correct otg */
+	mpcc->opp_id = opp_id_cached;
+
+	/* todo:call remove pipe from tree */
+	/* flag mpcc idle pending */
+
 	xfm->funcs->transform_reset(xfm);
 }
 
-static void reset_front_end(
-		struct core_dc *dc,
+/* disable HW used by plane.
+ * note:  cannot disable until disconnect is complete */
+static void plane_atomic_disable(struct core_dc *dc,
 		int fe_idx)
 {
 	struct dce_hwseq *hws = dc->hwseq;
@@ -846,24 +860,9 @@ static void reset_front_end(
 	struct timing_generator *tg = dc->res_pool->timing_generators[mpcc->opp_id];
 	unsigned int opp_id = mpcc->opp_id;
 
-	/*Already reset*/
 	if (opp_id == 0xf)
 		return;
 
-	tg->funcs->lock(tg);
-
-	plane_atomic_stop(dc, fe_idx);
-
-	REG_UPDATE(OTG_GLOBAL_SYNC_STATUS[tg->inst], VUPDATE_NO_LOCK_EVENT_CLEAR, 1);
-	tg->funcs->unlock(tg);
-
-	if (dc->public.debug.sanity_checks)
-		verify_allow_pstate_change_high(dc->hwseq);
-
-	if (tg->ctx->dce_environment != DCE_ENV_FPGA_MAXIMUS)
-		REG_WAIT(OTG_GLOBAL_SYNC_STATUS[tg->inst],
-				VUPDATE_NO_LOCK_EVENT_OCCURRED, 1, 20000, 200000);
-
 	mpcc->funcs->wait_for_idle(mpcc);
 
 	mi->funcs->set_blank(mi, true);
@@ -880,14 +879,54 @@ static void reset_front_end(
 		REG_UPDATE(OPP_PIPE_CONTROL[opp_id],
 				OPP_PIPE_CLOCK_EN, 0);
 
-	dm_logger_write(dc->ctx->logger, LOG_DC,
-					"Reset front end %d\n",
-					fe_idx);
+	mpcc->opp_id = 0xf;
 
 	if (dc->public.debug.sanity_checks)
 		verify_allow_pstate_change_high(dc->hwseq);
 }
 
+/* kill power to plane hw
+ * note: cannot power down until plane is disable
+static void plane_atomic_power_down()
+{
+
+}
+*/
+
+static void reset_front_end(
+		struct core_dc *dc,
+		int fe_idx)
+{
+	struct dce_hwseq *hws = dc->hwseq;
+	struct mpcc *mpcc = dc->res_pool->mpcc[fe_idx];
+	struct timing_generator *tg = dc->res_pool->timing_generators[mpcc->opp_id];
+	unsigned int opp_id = mpcc->opp_id;
+
+	/*Already reset*/
+	if (opp_id == 0xf)
+		return;
+
+	tg->funcs->lock(tg);
+
+	plane_atomic_disconnect(dc, fe_idx);
+
+	REG_UPDATE(OTG_GLOBAL_SYNC_STATUS[tg->inst], VUPDATE_NO_LOCK_EVENT_CLEAR, 1);
+	tg->funcs->unlock(tg);
+
+	if (dc->public.debug.sanity_checks)
+		verify_allow_pstate_change_high(dc->hwseq);
+
+	if (tg->ctx->dce_environment != DCE_ENV_FPGA_MAXIMUS)
+		REG_WAIT(OTG_GLOBAL_SYNC_STATUS[tg->inst],
+				VUPDATE_NO_LOCK_EVENT_OCCURRED, 1, 20000, 200000);
+
+	plane_atomic_disable(dc, fe_idx);
+
+	dm_logger_write(dc->ctx->logger, LOG_DC,
+					"Reset front end %d\n",
+					fe_idx);
+}
+
 static void dcn10_power_down_fe(struct core_dc *dc, int fe_idx)
 {
 	struct dce_hwseq *hws = dc->hwseq;
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#39 lore raw

PATCH 38/120 drm/amd/display: break up plane disable and disconnect in set mode

In reply to a message not in the archive

From: Eric Yang <[email protected]>

Change-Id I4bc2cb158c90dc6d5ac774a7ab912d5cebab29ec
---
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  23 +++--
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |   5 +-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 102 ++++++++++++++++++---
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |   4 +-
 4 files changed, 111 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +14 -9
index d3873ac45cf3..79218805754e 100644
@@ -932,7 +932,7 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c
 
 	for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
 		pipe = &context->res_ctx.pipe_ctx[i];
-		core_dc->hwss.wait_for_mpcc_disconnect(core_dc->res_pool, pipe);
+		core_dc->hwss.wait_for_mpcc_disconnect(core_dc, core_dc->res_pool, pipe);
 	}
 	result = core_dc->hwss.apply_ctx_to_hw(core_dc, context);
 
@@ -1364,6 +1364,16 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 	struct core_stream *stream = DC_STREAM_TO_CORE(dc_stream);
 	struct dc_context *dc_ctx = core_dc->ctx;
 
+	/* Currently this function do not result in any HW programming
+	 * when called with 0 surface. But proceeding will cause
+	 * SW state to be updated in validate_context. So we might as
+	 * well make it not do anything at all until the hw programming
+	 * is implemented properly to handle 0 surface case.
+	 * TODO: fix hw programming then remove this early return
+	 */
+	if (surface_count == 0)
+		return;
+
 	stream_status = dc_stream_get_status(dc_stream);
 	ASSERT(stream_status);
 	if (!stream_status)
@@ -1535,15 +1545,10 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 	}
 
 	if (update_type > UPDATE_TYPE_FAST) {
-		for (i = 0; i < surface_count; i++) {
-			for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
-				struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
-
-				if (pipe_ctx->surface != srf_updates[i].surface)
-					continue;
+		for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
+			struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
 
-				core_dc->hwss.wait_for_mpcc_disconnect(core_dc->res_pool, pipe_ctx);
-			}
+			core_dc->hwss.wait_for_mpcc_disconnect(core_dc, core_dc->res_pool, pipe_ctx);
 		}
 	}
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +4 -1
index 58701fdb7c94..aa4777a8ec36 100644
@@ -2583,7 +2583,10 @@ static void dce110_power_down_fe(struct core_dc *dc, int fe_idx)
 				dc->res_pool->transforms[fe_idx]);
 }
 
-static void dce110_wait_for_mpcc_disconnect(struct resource_pool *res_pool, struct pipe_ctx *pipe_ctx)
+static void dce110_wait_for_mpcc_disconnect(
+		struct core_dc *dc,
+		struct resource_pool *res_pool,
+		struct pipe_ctx *pipe_ctx)
 {
 	/* do nothing*/
 }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +90 -12

171 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +3 -1
index 2343beb4ef87..a3eec078dead 100644
@@ -161,7 +161,9 @@ struct hw_sequencer_funcs {
 
 	void (*log_hw_state)(struct core_dc *dc);
 
-	void (*wait_for_mpcc_disconnect)(struct resource_pool *res_pool, struct pipe_ctx *pipe_ctx);
+	void (*wait_for_mpcc_disconnect)(struct core_dc *dc,
+			struct resource_pool *res_pool,
+			struct pipe_ctx *pipe_ctx);
 };
 
 void color_space_to_black_color(
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#40 lore raw

PATCH 39/120 drm/amd/display: Move stream validations into seperate function.

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

Stateless streams validations (not require resource population) moved into hook to be called directly from DM.

Call dc_validate_stream be before validate_with_context for non Linux APIs

Change-Id I3fdefbfd9d227abd06013eb63467c75f26fd4590
---
 drivers/gpu/drm/amd/display/dc/core/dc.c           | 24 +++++++++
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  | 61 +++++++++++++++-------
 drivers/gpu/drm/amd/display/dc/dc.h                |  2 +
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c  |  7 ++-
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.h  |  2 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    | 24 ++-------
 .../drm/amd/display/dc/dce110/dce110_resource.c    | 23 ++------
 .../drm/amd/display/dc/dce112/dce112_resource.c    | 25 ++-------
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  | 25 ++-------
 .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c  | 25 ++-------
 .../gpu/drm/amd/display/dc/inc/hw/link_encoder.h   |  2 +-
 .../amd/display/dc/virtual/virtual_link_encoder.c  |  2 +-
 12 files changed, 90 insertions(+), 132 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +24 -0
index 79218805754e..9c2faf8e4b14 100644
@@ -664,6 +664,20 @@ static bool is_validation_required(
 	return false;
 }
 
+static bool validate_streams (
+		const struct dc *dc,
+		const struct dc_validation_set set[],
+		int set_count)
+{
+	int i;
+
+	for (i = 0; i < set_count; i++)
+		if (!dc_validate_stream(dc, set[i].stream))
+			return false;
+
+	return true;
+}
+
 struct validate_context *dc_get_validate_context(
 		const struct dc *dc,
 		const struct dc_validation_set set[],
@@ -673,6 +687,7 @@ struct validate_context *dc_get_validate_context(
 	enum dc_status result = DC_ERROR_UNEXPECTED;
 	struct validate_context *context;
 
+
 	context = dm_alloc(sizeof(struct validate_context));
 	if (context == NULL)
 		goto context_alloc_fail;
@@ -711,6 +726,9 @@ bool dc_validate_resources(
 	enum dc_status result = DC_ERROR_UNEXPECTED;
 	struct validate_context *context;
 
+	if (!validate_streams(dc, set, set_count))
+		return false;
+
 	context = dm_alloc(sizeof(struct validate_context));
 	if (context == NULL)
 		goto context_alloc_fail;
@@ -742,6 +760,9 @@ bool dc_validate_guaranteed(
 	enum dc_status result = DC_ERROR_UNEXPECTED;
 	struct validate_context *context;
 
+	if (!dc_validate_stream(dc, stream))
+		return false;
+
 	context = dm_alloc(sizeof(struct validate_context));
 	if (context == NULL)
 		goto context_alloc_fail;
@@ -1044,6 +1065,9 @@ bool dc_commit_streams(
 
 	}
 
+	if (!validate_streams(dc, set, stream_count))
+		return false;
+
 	context = dm_alloc(sizeof(struct validate_context));
 	if (context == NULL)
 		goto context_alloc_fail;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +43 -18

77 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc.h +2 -0
index 5523bb68f4e8..f250e87d39dd 100644
@@ -559,6 +559,8 @@ struct dc_validation_set {
 	uint8_t surface_count;
 };
 
+bool dc_validate_stream(const struct dc *dc, const struct dc_stream *stream);
+
 /*
  * This function takes a set of resources and checks that they are cofunctional.
  *
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +3 -4
index 318673da189b..aff0a440d4d3 100644
@@ -1009,19 +1009,18 @@ bool dce110_link_encoder_construct(
 
 bool dce110_link_encoder_validate_output_with_stream(
 	struct link_encoder *enc,
-	struct pipe_ctx *pipe_ctx)
+	const struct core_stream *stream)
 {
-	struct core_stream *stream = pipe_ctx->stream;
 	struct dce110_link_encoder *enc110 = TO_DCE110_LINK_ENC(enc);
 	bool is_valid;
 
-	switch (pipe_ctx->stream->signal) {
+	switch (stream->signal) {
 	case SIGNAL_TYPE_DVI_SINGLE_LINK:
 	case SIGNAL_TYPE_DVI_DUAL_LINK:
 		is_valid = dce110_link_encoder_validate_dvi_output(
 			enc110,
 			stream->sink->link->connector_signal,
-			pipe_ctx->stream->signal,
+			stream->signal,
 			&stream->public.timing);
 	break;
 	case SIGNAL_TYPE_HDMI_TYPE_A:
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.h +1 -1
index fd6ba7efc0f9..ded6c61304e6 100644
@@ -199,7 +199,7 @@ bool dce110_link_encoder_validate_wireless_output(
 
 bool dce110_link_encoder_validate_output_with_stream(
 	struct link_encoder *enc,
-	struct pipe_ctx *pipe_ctx);
+	const struct core_stream *stream);
 
 /****************** HW programming ************************/
 
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +3 -21
index 6938158bed7f..3d25a90e49b4 100644
@@ -651,7 +651,7 @@ static void destruct(struct dce110_resource_pool *pool)
 		dal_irq_service_destroy(&pool->base.irqs);
 }
 
-static enum dc_status validate_mapped_resource(
+static enum dc_status build_mapped_resource(
 		const struct core_dc *dc,
 		struct validate_context *context,
 		struct validate_context *old_context)
@@ -661,7 +661,6 @@ static enum dc_status validate_mapped_resource(
 
 	for (i = 0; i < context->stream_count; i++) {
 		struct core_stream *stream = context->streams[i];
-		struct dc_link *link = stream->sink->link;
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
@@ -673,28 +672,11 @@ static enum dc_status validate_mapped_resource(
 			if (context->res_ctx.pipe_ctx[j].stream != stream)
 				continue;
 
-			if (!pipe_ctx->tg->funcs->validate_timing(
-				pipe_ctx->tg, &stream->public.timing))
-				return DC_FAIL_CONTROLLER_VALIDATE;
-
 			status = dce110_resource_build_pipe_hw_param(pipe_ctx);
 
 			if (status != DC_OK)
 				return status;
 
-			if (!link->link_enc->funcs->validate_output_with_stream(
-				link->link_enc,
-				pipe_ctx))
-				return DC_FAIL_ENC_VALIDATE;
-
-			/* TODO: validate audio ASIC caps, encoder */
-			status = dc_link_validate_mode_timing(stream,
-							      link,
-							      &stream->public.timing);
-
-			if (status != DC_OK)
-				return status;
-
 			resource_build_info_frame(pipe_ctx);
 
 			/* do not need to validate non root pipes */
@@ -769,7 +751,7 @@ enum dc_status dce100_validate_with_context(
 	}
 
 	if (result == DC_OK)
-		result = validate_mapped_resource(dc, context, old_context);
+		result = build_mapped_resource(dc, context, old_context);
 
 	if (result == DC_OK)
 		result = resource_build_scaling_params_for_context(dc, context);
@@ -798,7 +780,7 @@ enum dc_status dce100_validate_guaranteed(
 		result = resource_map_clock_resources(dc, context, NULL);
 
 	if (result == DC_OK)
-		result = validate_mapped_resource(dc, context, NULL);
+		result = build_mapped_resource(dc, context, NULL);
 
 	if (result == DC_OK) {
 		validate_guaranteed_copy_streams(
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +3 -20
index 015306a6ef88..c773351e93af 100644
@@ -771,7 +771,7 @@ static bool is_surface_pixel_format_supported(struct pipe_ctx *pipe_ctx, unsigne
 	return true;
 }
 
-static enum dc_status validate_mapped_resource(
+static enum dc_status build_mapped_resource(
 		const struct core_dc *dc,
 		struct validate_context *context,
 		struct validate_context *old_context)
@@ -781,7 +781,6 @@ static enum dc_status validate_mapped_resource(
 
 	for (i = 0; i < context->stream_count; i++) {
 		struct core_stream *stream = context->streams[i];
-		struct dc_link *link = stream->sink->link;
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
@@ -797,29 +796,13 @@ static enum dc_status validate_mapped_resource(
 					dc->res_pool->underlay_pipe_index))
 				return DC_SURFACE_PIXEL_FORMAT_UNSUPPORTED;
 
-			if (!pipe_ctx->tg->funcs->validate_timing(
-				pipe_ctx->tg, &stream->public.timing))
-				return DC_FAIL_CONTROLLER_VALIDATE;
-
 			status = dce110_resource_build_pipe_hw_param(pipe_ctx);
 
 			if (status != DC_OK)
 				return status;
 
-			if (!link->link_enc->funcs->validate_output_with_stream(
-				link->link_enc,
-				pipe_ctx))
-				return DC_FAIL_ENC_VALIDATE;
-
 			/* TODO: validate audio ASIC caps, encoder */
 
-			status = dc_link_validate_mode_timing(stream,
-							      link,
-							      &stream->public.timing);
-
-			if (status != DC_OK)
-				return status;
-
 			resource_build_info_frame(pipe_ctx);
 
 			/* do not need to validate non root pipes */
@@ -976,7 +959,7 @@ enum dc_status dce110_validate_with_context(
 	}
 
 	if (result == DC_OK)
-		result = validate_mapped_resource(dc, context, old_context);
+		result = build_mapped_resource(dc, context, old_context);
 
 	if (result == DC_OK)
 		result = resource_build_scaling_params_for_context(dc, context);
@@ -1005,7 +988,7 @@ enum dc_status dce110_validate_guaranteed(
 		result = resource_map_clock_resources(dc, context, NULL);
 
 	if (result == DC_OK)
-		result = validate_mapped_resource(dc, context, NULL);
+		result = build_mapped_resource(dc, context, NULL);
 
 	if (result == DC_OK) {
 		validate_guaranteed_copy_streams(
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +3 -22
index ca1e13e2a3db..19cd99923b24 100644
@@ -720,7 +720,7 @@ static struct clock_source *find_matching_pll(
 	return 0;
 }
 
-static enum dc_status validate_mapped_resource(
+static enum dc_status build_mapped_resource(
 		const struct core_dc *dc,
 		struct validate_context *context,
 		struct validate_context *old_context)
@@ -730,7 +730,6 @@ static enum dc_status validate_mapped_resource(
 
 	for (i = 0; i < context->stream_count; i++) {
 		struct core_stream *stream = context->streams[i];
-		struct dc_link *link = stream->sink->link;
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
@@ -742,29 +741,11 @@ static enum dc_status validate_mapped_resource(
 			if (context->res_ctx.pipe_ctx[j].stream != stream)
 				continue;
 
-			if (!pipe_ctx->tg->funcs->validate_timing(
-				pipe_ctx->tg, &stream->public.timing))
-				return DC_FAIL_CONTROLLER_VALIDATE;
-
 			status = dce110_resource_build_pipe_hw_param(pipe_ctx);
 
 			if (status != DC_OK)
 				return status;
 
-			if (!link->link_enc->funcs->validate_output_with_stream(
-				link->link_enc,
-				pipe_ctx))
-				return DC_FAIL_ENC_VALIDATE;
-
-			/* TODO: validate audio ASIC caps, encoder */
-
-			status = dc_link_validate_mode_timing(stream,
-							      link,
-							      &stream->public.timing);
-
-			if (status != DC_OK)
-				return status;
-
 			resource_build_info_frame(pipe_ctx);
 
 			/* do not need to validate non root pipes */
@@ -952,7 +933,7 @@ enum dc_status dce112_validate_with_context(
 	}
 
 	if (result == DC_OK)
-		result = validate_mapped_resource(dc, context, old_context);
+		result = build_mapped_resource(dc, context, old_context);
 
 	if (result == DC_OK)
 		result = resource_build_scaling_params_for_context(dc, context);
@@ -981,7 +962,7 @@ enum dc_status dce112_validate_guaranteed(
 		result = resource_map_phy_clock_resources(dc, context, NULL);
 
 	if (result == DC_OK)
-		result = validate_mapped_resource(dc, context, NULL);
+		result = build_mapped_resource(dc, context, NULL);
 
 	if (result == DC_OK) {
 		validate_guaranteed_copy_streams(
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +3 -22
index b2319dbf3be3..0123006e5360 100644
@@ -667,7 +667,7 @@ static void destruct(struct dce110_resource_pool *pool)
 	}
 }
 
-static enum dc_status validate_mapped_resource(
+static enum dc_status build_mapped_resource(
 		const struct core_dc *dc,
 		struct validate_context *context,
 		struct validate_context *old_context)
@@ -677,7 +677,6 @@ static enum dc_status validate_mapped_resource(
 
 	for (i = 0; i < context->stream_count; i++) {
 		struct core_stream *stream = context->streams[i];
-		struct dc_link *link = stream->sink->link;
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
@@ -689,29 +688,11 @@ static enum dc_status validate_mapped_resource(
 			if (context->res_ctx.pipe_ctx[j].stream != stream)
 				continue;
 
-			if (!pipe_ctx->tg->funcs->validate_timing(
-				pipe_ctx->tg, &stream->public.timing))
-				return DC_FAIL_CONTROLLER_VALIDATE;
-
 			status = dce110_resource_build_pipe_hw_param(pipe_ctx);
 
 			if (status != DC_OK)
 				return status;
 
-			if (!link->link_enc->funcs->validate_output_with_stream(
-				link->link_enc,
-				pipe_ctx))
-				return DC_FAIL_ENC_VALIDATE;
-
-			/* TODO: validate audio ASIC caps, encoder */
-
-			status = dc_link_validate_mode_timing(stream,
-							      link,
-							      &stream->public.timing);
-
-			if (status != DC_OK)
-				return status;
-
 			resource_build_info_frame(pipe_ctx);
 
 			/* do not need to validate non root pipes */
@@ -786,7 +767,7 @@ enum dc_status dce80_validate_with_context(
 	}
 
 	if (result == DC_OK)
-		result = validate_mapped_resource(dc, context, old_context);
+		result = build_mapped_resource(dc, context, old_context);
 
 	if (result == DC_OK)
 		result = resource_build_scaling_params_for_context(dc, context);
@@ -814,7 +795,7 @@ enum dc_status dce80_validate_guaranteed(
 		result = resource_map_clock_resources(dc, context, NULL);
 
 	if (result == DC_OK)
-		result = validate_mapped_resource(dc, context, NULL);
+		result = build_mapped_resource(dc, context, NULL);
 
 	if (result == DC_OK) {
 		validate_guaranteed_copy_streams(
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +3 -22
index 0110a431e289..b901ef9689a6 100644
@@ -835,7 +835,7 @@ static enum dc_status build_pipe_hw_param(struct pipe_ctx *pipe_ctx)
 	return DC_OK;
 }
 
-static enum dc_status validate_mapped_resource(
+static enum dc_status build_mapped_resource(
 		const struct core_dc *dc,
 		struct validate_context *context,
 		struct validate_context *old_context)
@@ -845,7 +845,6 @@ static enum dc_status validate_mapped_resource(
 
 	for (i = 0; i < context->stream_count; i++) {
 		struct core_stream *stream = context->streams[i];
-		struct dc_link *link = stream->sink->link;
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream)) {
 			if (stream != NULL && old_context->streams[i] != NULL) {
@@ -870,29 +869,11 @@ static enum dc_status validate_mapped_resource(
 			if (context->res_ctx.pipe_ctx[j].stream != stream)
 				continue;
 
-
-			if (!pipe_ctx->tg->funcs->validate_timing(
-					pipe_ctx->tg, &stream->public.timing))
-				return DC_FAIL_CONTROLLER_VALIDATE;
-
 			status = build_pipe_hw_param(pipe_ctx);
 
 			if (status != DC_OK)
 				return status;
 
-			if (!link->link_enc->funcs->validate_output_with_stream(
-				link->link_enc, pipe_ctx))
-				return DC_FAIL_ENC_VALIDATE;
-
-			/* TODO: validate audio ASIC caps, encoder */
-
-			status = dc_link_validate_mode_timing(
-				stream, link, &stream->public.timing);
-
-			if (status != DC_OK)
-				return status;
-
-
 			/* do not need to validate non root pipes */
 			break;
 		}
@@ -928,7 +909,7 @@ enum dc_status dcn10_validate_with_context(
 	if (result != DC_OK)
 		return result;
 
-	result = validate_mapped_resource(dc, context, old_context);
+	result = build_mapped_resource(dc, context, old_context);
 	if (result != DC_OK)
 		return result;
 
@@ -963,7 +944,7 @@ enum dc_status dcn10_validate_guaranteed(
 		result = resource_map_phy_clock_resources(dc, context, NULL);
 
 	if (result == DC_OK)
-		result = validate_mapped_resource(dc, context, NULL);
+		result = build_mapped_resource(dc, context, NULL);
 
 	if (result == DC_OK) {
 		validate_guaranteed_copy_streams(
drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h +1 -1
index d330d38aff16..0ee738774f9f 100644
@@ -94,7 +94,7 @@ struct link_encoder {
 
 struct link_encoder_funcs {
 	bool (*validate_output_with_stream)(
-		struct link_encoder *enc, struct pipe_ctx *pipe_ctx);
+		struct link_encoder *enc, const struct core_stream *stream);
 	void (*hw_init)(struct link_encoder *enc);
 	void (*setup)(struct link_encoder *enc,
 		enum signal_type signal);
drivers/gpu/drm/amd/display/dc/virtual/virtual_link_encoder.c +1 -1
index 12df49927f09..d312874d95b5 100644
@@ -30,7 +30,7 @@
 
 static bool virtual_link_encoder_validate_output_with_stream(
 	struct link_encoder *enc,
-	struct pipe_ctx *pipe_ctx) { return true; }
+	const struct core_stream *stream) { return true; }
 
 static void virtual_link_encoder_hw_init(struct link_encoder *enc) {}
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#41 lore raw

PATCH 40/120 drm/amd/display: Use stream validation hook.

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

Use dc_validate_stream from crtc atomic_check for single stream validation.

Change-Id Iebaf50b6ef8bf47f01a3e10d24a0b11cd0874b8c
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 86 ++++++++++++----------
 1 file changed, 48 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +48 -38
index b7c01f353d33..c0fdc1d03a22 100644
@@ -63,6 +63,24 @@ struct dm_connector_state {
 #define to_dm_connector_state(x)\
 	container_of((x), struct dm_connector_state, base)
 
+static bool modeset_required(struct drm_crtc_state *crtc_state)
+{
+	if (!drm_atomic_crtc_needs_modeset(crtc_state))
+		return false;
+
+	if (!crtc_state->enable)
+		return false;
+
+	return crtc_state->active;
+}
+
+static bool modereset_required(struct drm_crtc_state *crtc_state)
+{
+	if (!drm_atomic_crtc_needs_modeset(crtc_state))
+		return false;
+
+	return !crtc_state->enable || !crtc_state->active;
+}
 
 void amdgpu_dm_encoder_destroy(struct drm_encoder *encoder)
 {
@@ -1411,11 +1429,9 @@ int amdgpu_dm_connector_mode_valid(
 	int result = MODE_ERROR;
 	struct dc_sink *dc_sink;
 	struct amdgpu_device *adev = connector->dev->dev_private;
-	struct dc_validation_set val_set = { 0 };
 	/* TODO: Unhardcode stream count */
 	struct dc_stream *stream;
 	struct amdgpu_connector *aconnector = to_amdgpu_connector(connector);
-	struct validate_context *context;
 
 	if ((mode->flags & DRM_MODE_FLAG_INTERLACE) ||
 			(mode->flags & DRM_MODE_FLAG_DBLSCAN))
@@ -1432,35 +1448,28 @@ int amdgpu_dm_connector_mode_valid(
 
 	if (NULL == dc_sink) {
 		DRM_ERROR("dc_sink is NULL!\n");
-		goto null_sink;
+		goto fail;
 	}
 
 	stream = dc_create_stream_for_sink(dc_sink);
 	if (NULL == stream) {
 		DRM_ERROR("Failed to create stream for sink!\n");
-		goto stream_create_fail;
+		goto fail;
 	}
 
 	drm_mode_set_crtcinfo(mode, 0);
 	fill_stream_properties_from_drm_display_mode(stream, mode, connector);
 
-	val_set.stream = stream;
-	val_set.surface_count = 0;
 	stream->src.width = mode->hdisplay;
 	stream->src.height = mode->vdisplay;
 	stream->dst = stream->src;
 
-	context = dc_get_validate_context(adev->dm.dc, &val_set, 1);
-
-	if (context) {
+	if (dc_validate_stream(adev->dm.dc, stream))
 		result = MODE_OK;
-		dc_release_validate_context(context);
-	}
 
 	dc_stream_release(stream);
 
-stream_create_fail:
-null_sink:
+fail:
 	/* TODO: error handling*/
 	return result;
 }
@@ -1486,7 +1495,24 @@ static int dm_crtc_helper_atomic_check(
 	struct drm_crtc *crtc,
 	struct drm_crtc_state *state)
 {
-	return 0;
+	struct amdgpu_device *adev = crtc->dev->dev_private;
+	struct dc *dc = adev->dm.dc;
+	struct dm_crtc_state *dm_crtc_state = to_dm_crtc_state(state);
+	int ret = -EINVAL;
+
+	if (unlikely(!dm_crtc_state->stream && modeset_required(state))) {
+		WARN_ON(1);
+		return ret;
+	}
+
+	/* In some use cases, like reset, no stream  is attached */
+	if (!dm_crtc_state->stream)
+		return 0;
+
+	if (dc_validate_stream(dc, dm_crtc_state->stream))
+		return 0;
+
+	return ret;
 }
 
 static bool dm_crtc_helper_mode_fixup(
@@ -2271,25 +2297,6 @@ int amdgpu_dm_encoder_init(
 	return res;
 }
 
-static bool modeset_required(struct drm_crtc_state *crtc_state)
-{
-	if (!drm_atomic_crtc_needs_modeset(crtc_state))
-		return false;
-
-	if (!crtc_state->enable)
-		return false;
-
-	return crtc_state->active;
-}
-
-static bool modereset_required(struct drm_crtc_state *crtc_state)
-{
-	if (!drm_atomic_crtc_needs_modeset(crtc_state))
-		return false;
-
-	return !crtc_state->enable || !crtc_state->active;
-}
-
 static void manage_dm_interrupts(
 	struct amdgpu_device *adev,
 	struct amdgpu_crtc *acrtc,
@@ -3088,7 +3095,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 	 */
 	bool lock_and_validation_needed = false;
 
-	ret = drm_atomic_helper_check(dev, state);
+	ret = drm_atomic_helper_check_modeset(dev, state);
 
 	if (ret) {
 		DRM_ERROR("Atomic state validation failed with error :%d !\n", ret);
@@ -3110,6 +3117,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 		}
 	}
 
+	/*TODO Move this code into dm_crtc_atomic_check once we get rid of dc_validation_set */
 	/* update changed items */
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {
 		struct amdgpu_crtc *acrtc = NULL;
@@ -3242,10 +3250,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 			if (plane->type == DRM_PLANE_TYPE_CURSOR)
 				continue;
 
-			if (!fb || !plane_crtc || crtc != plane_crtc ||
-				(!crtc_state->planes_changed &&
-						!crtc_state->color_mgmt_changed) ||
-				!crtc_state->active)
+			if (!fb || !plane_crtc || crtc != plane_crtc || !crtc_state->active)
 				continue;
 
 			WARN_ON(!new_acrtc_state->stream);
@@ -3281,6 +3286,11 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 		}
 	}
 
+	/* Run this here since we want to validate the streams we created */
+	ret = drm_atomic_helper_check_planes(dev, state);
+	if (ret)
+		goto fail;
+
 	/*
 	 * For full updates case when
 	 * removing/adding/updating  streams on once CRTC while flipping
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#42 lore raw

PATCH 41/120 drm/amd/display: Fix eDP panel light-up

In reply to a message not in the archive

From: Roman Li <[email protected]>

Power-down panel on disale only if sink exists otherwise it fails edid read during init sequence

Change-Id Iefb7f16f7d465ad81ae83940237bc6a896429b29
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +3 -1
index aac2420caefa..5bdcd5067116 100644
@@ -114,7 +114,9 @@ void dp_disable_link_phy(struct dc_link *link, enum signal_type signal)
 
 	if (signal == SIGNAL_TYPE_EDP) {
 		link->link_enc->funcs->backlight_control(link->link_enc, false);
-		link->link_enc->funcs->power_control(link->link_enc, false);
+		if (link->dpcd_sink_count)
+			link->link_enc->funcs->power_control(link->link_enc,
+									false);
 	}
 
 	link->link_enc->funcs->disable_output(link->link_enc, signal);
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#43 lore raw

PATCH 42/120 drm/amd/display: move ocsc programming from opp to dpp

In reply to a message not in the archive

From: Yue Hin Lau <[email protected]>

Change-Id I9a0b999e4957893d7be7b71a21406a77cc8ff105
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
index bbe3e8705405..7c24e8f43bb1 100644
@@ -1809,7 +1809,7 @@ static void program_csc_matrix(struct pipe_ctx *pipe_ctx,
 
 			tbl_entry.color_space = color_space;
 			//tbl_entry.regval = matrix;
-			pipe_ctx->opp->funcs->opp_set_csc_adjustment(pipe_ctx->opp, &tbl_entry);
+			pipe_ctx->xfm->funcs->opp_set_csc_adjustment(pipe_ctx->xfm, &tbl_entry);
 	}
 }
 static bool is_lower_pipe_tree_visible(struct pipe_ctx *pipe_ctx)
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#44 lore raw

PATCH 43/120 drm/amd/display: Minor fix for dc_link refactor

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c     | 2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -1
index 7d03f6ca2eaf..fd2ae181cff2 100644
@@ -1550,7 +1550,7 @@ bool dc_link_setup_psr(struct dc_link *link,
 
 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 		/*skip power down the single pipe since it blocks the cstate*/
-		if (ASIC_REV_IS_RAVEN(ctx->asic_id.hw_internal_rev))
+		if (ASIC_REV_IS_RAVEN(link->ctx->asic_id.hw_internal_rev))
 			psr_context->psr_level.bits.SKIP_SINGLE_OTG_DISABLE = true;
 #endif
 
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index 32a24e8d2d4d..436850167aca 100644
@@ -2514,7 +2514,7 @@ bool dc_validate_stream(const struct dc *dc, const struct dc_stream *stream)
 	struct core_dc *core_dc = DC_TO_CORE(dc);
 	struct dc_context *dc_ctx = core_dc->ctx;
 	struct core_stream *core_stream = DC_STREAM_TO_CORE(stream);
-	struct core_link *link = core_stream->sink->link;
+	struct dc_link *link = core_stream->sink->link;
 	struct timing_generator *tg = core_dc->res_pool->timing_generators[0];
 	enum dc_status res = DC_OK;
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#45 lore raw

PATCH 44/120 drm/amd/display: Clean up some DCN1 guards

In reply to a message not in the archive

From: Zeyu Fan <[email protected]>

Change-Id I7fb5ce77a0b76ef78f5b47b61aec928d3ab26f9d
---
 drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c | 1 +
 drivers/gpu/drm/amd/display/dc/core/dc.c                    | 2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c           | 2 ++
 drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c       | 2 ++
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c             | 2 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 6 +++---
 drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c            | 1 +
 drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c          | 1 +
 drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c              | 5 +++--
 9 files changed, 15 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c +1 -0
index 84b1f515aa47..9084a32aab79 100644
@@ -58,6 +58,7 @@ bool dal_bios_parser_init_cmd_tbl_helper2(
 		*h = dal_cmd_tbl_helper_dce112_get_table2();
 		return true;
 #endif
+
 	case DCE_VERSION_12_0:
 		*h = dal_cmd_tbl_helper_dce112_get_table2();
 		return true;
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -1
index 9c2faf8e4b14..bab07f8d4880 100644
@@ -1109,7 +1109,7 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
 
 	/* 3rd param should be true, temp w/a for RV*/
 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
-	core_dc->hwss.set_bandwidth(core_dc, context, core_dc->ctx->dce_version != DCN_VERSION_1_0);
+	core_dc->hwss.set_bandwidth(core_dc, context, core_dc->ctx->dce_version < DCN_VERSION_1_0);
 #else
 	core_dc->hwss.set_bandwidth(core_dc, context, true);
 #endif
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2 -0
index 436850167aca..b3f7b44d5656 100644
@@ -120,6 +120,8 @@ struct resource_pool *dc_create_resource_pool(
 			num_virtual_links, dc);
 		break;
 #endif
+
+
 	default:
 		break;
 	}
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +2 -0
index 142b3a01c204..2205491c83e9 100644
@@ -589,6 +589,7 @@ static uint32_t dce110_get_pix_clk_dividers(
 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	case DCN_VERSION_1_0:
 #endif
+
 		dce112_get_pix_clk_dividers_helper(clk_src,
 				pll_settings, pix_clk_params);
 		break;
@@ -901,6 +902,7 @@ static bool dce110_program_pix_clk(
 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	case DCN_VERSION_1_0:
 #endif
+
 		if (clock_source->id != CLOCK_SOURCE_ID_DP_DTO) {
 			bp_pc_params.flags.SET_GENLOCK_REF_DIV_SRC =
 							pll_settings->use_external_clk;
drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c +1 -1
index f30cd4dff554..37d074f595fb 100644
@@ -614,7 +614,7 @@ static bool dce_apply_clock_voltage_request(
 	}
 	if (send_request) {
 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
-		if (clk->ctx->dce_version == DCN_VERSION_1_0) {
+		if (clk->ctx->dce_version >= DCN_VERSION_1_0) {
 			struct core_dc *core_dc = DC_TO_CORE(clk->ctx->dc);
 			/*use dcfclk request voltage*/
 			clock_voltage_req.clk_type = DM_PP_CLOCK_TYPE_DCFCLK;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +3 -3
index aa4777a8ec36..119365960cd0 100644
@@ -1104,11 +1104,11 @@ static enum dc_status apply_single_controller_ctx_to_hw(
 			true : false);
 
 	resource_build_info_frame(pipe_ctx);
-
+	dce110_update_info_frame(pipe_ctx);
 	if (!pipe_ctx_old->stream) {
 		core_link_enable_stream(pipe_ctx);
 
-	dce110_update_info_frame(pipe_ctx);
+
 		if (dc_is_dp_signal(pipe_ctx->stream->signal))
 			dce110_unblank_stream(pipe_ctx,
 				&stream->sink->link->cur_link_settings);
@@ -1664,7 +1664,7 @@ enum dc_status dce110_apply_ctx_to_hw(
 	apply_min_clocks(dc, context, &clocks_state, true);
 
 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
-	if (dc->ctx->dce_version == DCN_VERSION_1_0) {
+	if (dc->ctx->dce_version >= DCN_VERSION_1_0) {
 		if (context->bw.dcn.calc_clk.fclk_khz
 				> dc->current_context->bw.dcn.cur_clk.fclk_khz) {
 			struct dm_pp_clock_for_voltage_req clock;
drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c +1 -0
index 8a8b619a60a8..425f1c4fa891 100644
@@ -84,6 +84,7 @@ bool dal_hw_factory_init(
 		dal_hw_factory_dcn10_init(factory);
 		return true;
 #endif
+
 	default:
 		ASSERT_CRITICAL(false);
 		return false;
drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c +1 -0
index 36c082bda4ae..3b55d45b6775 100644
@@ -80,6 +80,7 @@ bool dal_hw_translate_init(
 		dal_hw_translate_dcn10_init(translate);
 		return true;
 #endif
+
 	default:
 		BREAK_TO_DEBUGGER();
 		return false;
drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c +3 -2
index 45e766ea79e3..10061cc4ba31 100644
@@ -88,10 +88,11 @@ struct i2caux *dal_i2caux_create(
 		return dal_i2caux_dce100_create(ctx);
 	case DCE_VERSION_12_0:
 		return dal_i2caux_dce120_create(ctx);
-	#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
+#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	case DCN_VERSION_1_0:
 		return dal_i2caux_dcn10_create(ctx);
-	#endif
+#endif
+
 	default:
 		BREAK_TO_DEBUGGER();
 		return NULL;
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#46 lore raw

PATCH 45/120 drm/amd/display: Minor fix for dc_sink refactor

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 +-
 drivers/gpu/drm/amd/display/dc/dc.h               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index b3f7b44d5656..7240a7028fa5 100644
@@ -1321,7 +1321,7 @@ static struct audio *find_first_free_audio(
 static void update_stream_signal(struct core_stream *stream)
 {
 	if (stream->public.output_signal == SIGNAL_TYPE_NONE) {
-		const struct dc_sink *dc_sink = stream->public.sink;
+		struct dc_sink *dc_sink = stream->public.sink;
 
 		if (dc_sink->sink_signal == SIGNAL_TYPE_NONE)
 			stream->signal = stream->sink->link->connector_signal;
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index f250e87d39dd..f87f6c12494c 100644
@@ -469,7 +469,7 @@ enum surface_update_type {
  * Stream Interfaces
  ******************************************************************************/
 struct dc_stream {
-	const struct dc_sink *sink;
+	struct dc_sink *sink;
 	struct dc_crtc_timing timing;
 
 	struct rect src; /* composition area */
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#47 lore raw

PATCH 46/120 drm/amd/display: Disable timestamp and entry heading

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

Change-Id I272fefe9574f4727c140a222116f531d9988abd2
---
 drivers/gpu/drm/amd/display/dc/basics/logger.c            | 3 ++-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/basics/logger.c +2 -1
index 0b17374b1535..dfd23783cc47 100644
@@ -428,7 +428,8 @@ void dm_logger_open(
 
 	logger->open_count++;
 
-	log_heading(entry);
+	if (log_type != LOG_DTN)
+		log_heading(entry);
 }
 
 void dm_logger_close(struct log_entry *entry)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
index 7c24e8f43bb1..03f404808a1c 100644
@@ -2407,7 +2407,7 @@ static void dcn10_log_hw_state(struct core_dc *dc)
 	struct dc_context *dc_ctx = dc->ctx;
 	struct dce_hwseq *hws = dc->hwseq;
 
-	DTN_INFO("%s: Hello World", __func__);
+	DTN_INFO("Hello World");
 
 	if (REG(MPC_CRC_RESULT_GB))
 		DTN_INFO("MPC_CRC_RESULT_GB:%d MPC_CRC_RESULT_C:%d MPC_CRC_RESULT_AR:%d\n",
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#48 lore raw

PATCH 47/120 drm/amd/display: Add interfaces for new CM blocks

In reply to a message not in the archive

From: Vitaly Prosyak <[email protected]>

Change-Id Iee43a2ed00ef1ee363f9534e95421606a16bb318
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c |   2 +-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h | 485 ++++++++++++++++++++++-
 2 files changed, 485 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c +1 -1
index b6aaa95d442b..e52e1f43f67b 100644
@@ -1572,7 +1572,7 @@ static struct transform_funcs dcn10_dpp_funcs = {
 		.opp_program_regamma_lutb_settings = opp_program_regamma_lutb_settings,
 		.opp_program_regamma_luta_settings = opp_program_regamma_luta_settings,
 		.opp_program_regamma_pwl = oppn10_set_regamma_pwl,
-		.opp_set_regamma_mode = oppn10_set_regamma_mode
+		.opp_set_regamma_mode = oppn10_set_regamma_mode,
 };
 
 /*****************************************/
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h +484 -1

509 lines not on this page · raw message

Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#49 lore raw

PATCH 48/120 drm/amd/display: log HUBP using DTN logging

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

also simplify DTN INFO. all we need is a way to have DC log register states some where we can compare with golden. going through connectivity is overkill.

Change-Id Id280d803d639635004eadd56bf13c808cf5dfa8c
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c  |  9 ++++
 .../gpu/drm/amd/display/dc/basics/log_helpers.c    | 28 ------------
 drivers/gpu/drm/amd/display/dc/basics/logger.c     |  3 +-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 53 +++++++++++++++++++---
 .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c | 34 ++++++++++++++
 .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h | 18 ++++++++
 drivers/gpu/drm/amd/display/dc/dm_helpers.h        |  6 ---
 drivers/gpu/drm/amd/display/dc/dm_services.h       | 12 +++++
 .../gpu/drm/amd/display/include/logger_interface.h | 24 +++++-----
 9 files changed, 133 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +9 -0
index df4d221e46c1..6c19a07709df 100644
@@ -327,6 +327,15 @@ bool dm_helpers_dc_conn_log(struct dc_context *ctx, struct log_entry *entry, enu
 	return true;
 }
 
+void dm_dtn_log_begin(struct dc_context *ctx)
+{}
+
+void dm_dtn_log_append_v(struct dc_context *ctx,
+		const char *pMsg, ...)
+{}
+
+void dm_dtn_log_end(struct dc_context *ctx)
+{}
 
 bool dm_helpers_dp_mst_start_top_mgr(
 		struct dc_context *ctx,
drivers/gpu/drm/amd/display/dc/basics/log_helpers.c +0 -28
index 070ae6f680e1..785b943b60ed 100644
@@ -100,31 +100,3 @@ void dc_conn_log(struct dc_context *ctx,
 
 	va_end(args);
 }
-
-void dc_raw_log(struct dc_context *ctx,
-		enum dc_log_type event,
-		const char *msg,
-		...)
-{
-	va_list args;
-	struct log_entry entry = { 0 };
-
-	dm_logger_open(ctx->logger, &entry, event);
-
-	va_start(args, msg);
-	entry.buf_offset += dm_log_to_buffer(
-		&entry.buf[entry.buf_offset],
-		LOG_MAX_LINE_SIZE - entry.buf_offset,
-		msg, args);
-
-	if (entry.buf[strlen(entry.buf) - 1] == '\n') {
-		entry.buf[strlen(entry.buf) - 1] = '\0';
-		entry.buf_offset--;
-	}
-
-	dm_logger_append(&entry, "^\n");
-	dm_helpers_dc_conn_log(ctx, &entry, event);
-	dm_logger_close(&entry);
-
-	va_end(args);
-}
drivers/gpu/drm/amd/display/dc/basics/logger.c +1 -2
index dfd23783cc47..0b17374b1535 100644
@@ -428,8 +428,7 @@ void dm_logger_open(
 
 	logger->open_count++;
 
-	if (log_type != LOG_DTN)
-		log_heading(entry);
+	log_heading(entry);
 }
 
 void dm_logger_close(struct log_entry *entry)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +46 -7

77 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c +34 -0
index c56a69b5a4d7..6f01db6a51dd 100644
@@ -804,6 +804,40 @@ static void min_set_viewport(
                        PRI_VIEWPORT_Y_START_C, viewport_c->y);
 }
 
+void dcn10_mem_input_read_state(struct dcn10_mem_input *mi,
+		struct dcn_hubp_state *s)
+{
+	REG_GET(DCSURF_SURFACE_CONFIG,
+			SURFACE_PIXEL_FORMAT, &s->pixel_format);
+
+	REG_GET(DCSURF_SURFACE_EARLIEST_INUSE_HIGH,
+			SURFACE_EARLIEST_INUSE_ADDRESS_HIGH, &s->inuse_addr_hi);
+
+	REG_GET_2(DCSURF_PRI_VIEWPORT_DIMENSION,
+			PRI_VIEWPORT_WIDTH, &s->viewport_width,
+			PRI_VIEWPORT_HEIGHT, &s->viewport_height);
+
+	REG_GET_2(DCSURF_SURFACE_CONFIG,
+			ROTATION_ANGLE, &s->rotation_angle,
+			H_MIRROR_EN, &s->h_mirror_en);
+
+	REG_GET(DCSURF_TILING_CONFIG,
+			SW_MODE, &s->sw_mode);
+
+	REG_GET(DCSURF_SURFACE_CONTROL,
+			PRIMARY_SURFACE_DCC_EN, &s->dcc_en);
+
+	REG_GET_2(DCHUBP_CNTL,
+			HUBP_BLANK_EN, &s->blank_en,
+			HUBP_TTU_DISABLE, &s->ttu_disable);
+
+	REG_GET(DCN_GLOBAL_TTU_CNTL,
+			MIN_TTU_VBLANK, &s->min_ttu_vblank);
+
+	REG_GET_2(DCN_TTU_QOS_WM,
+			QoS_LEVEL_LOW_WM, &s->qos_level_low_wm,
+			QoS_LEVEL_HIGH_WM, &s->qos_level_high_wm);
+}
 
 static struct mem_input_funcs dcn10_mem_input_funcs = {
 	.mem_input_program_display_marks = min10_program_display_marks,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h +18 -0
index 9130f5e0ab03..4f4e2c0708d5 100644
@@ -579,4 +579,22 @@ bool dcn10_mem_input_construct(
 	const struct dcn_mi_shift *mi_shift,
 	const struct dcn_mi_mask *mi_mask);
 
+struct dcn_hubp_state {
+	uint32_t pixel_format;
+	uint32_t inuse_addr_hi;
+	uint32_t viewport_width;
+	uint32_t viewport_height;
+	uint32_t rotation_angle;
+	uint32_t h_mirror_en;
+	uint32_t sw_mode;
+	uint32_t dcc_en;
+	uint32_t blank_en;
+	uint32_t ttu_disable;
+	uint32_t min_ttu_vblank;
+	uint32_t qos_level_low_wm;
+	uint32_t qos_level_high_wm;
+};
+void dcn10_mem_input_read_state(struct dcn10_mem_input *mi,
+		struct dcn_hubp_state *s);
+
 #endif
drivers/gpu/drm/amd/display/dc/dm_helpers.h +0 -6
index a831421c7ea0..e8bd501feb48 100644
@@ -68,15 +68,9 @@ bool dm_helpers_dp_mst_start_top_mgr(
 		const struct dc_link *link,
 		bool boot);
 
-bool dm_helpers_dc_conn_log(
-		struct dc_context*ctx,
-		struct log_entry *entry,
-		enum dc_log_type event);
-
 void dm_helpers_dp_mst_stop_top_mgr(
 		struct dc_context *ctx,
 		const struct dc_link *link);
-
 /**
  * OS specific aux read callback.
  */
drivers/gpu/drm/amd/display/dc/dm_services.h +12 -0
index ea494a71a80b..e9bf4c417cc7 100644
@@ -463,4 +463,16 @@ bool dm_dmcu_set_pipe(struct dc_context *ctx, unsigned int controller_id);
 #define dm_log_to_buffer(buffer, size, fmt, args)\
 	vsnprintf(buffer, size, fmt, args)
 
+/*
+ * Debug and verification hooks
+ */
+bool dm_helpers_dc_conn_log(
+		struct dc_context *ctx,
+		struct log_entry *entry,
+		enum dc_log_type event);
+
+void dm_dtn_log_begin(struct dc_context *ctx);
+void dm_dtn_log_append_v(struct dc_context *ctx, const char *msg, ...);
+void dm_dtn_log_end(struct dc_context *ctx);
+
 #endif /* __DM_SERVICES_H__ */
drivers/gpu/drm/amd/display/include/logger_interface.h +13 -11
index 3adf3cfc7aba..0a872472ecba 100644
@@ -70,11 +70,6 @@ void dc_conn_log(struct dc_context *ctx,
 		const char *msg,
 		...);
 
-void dc_raw_log(struct dc_context *ctx,
-		enum dc_log_type event,
-		const char *msg,
-		...);
-
 void logger_write(struct dal_logger *logger,
 		enum dc_log_type log_type,
 		const char *msg,
@@ -121,16 +116,11 @@ void context_clock_trace(
 
 #define DC_ERROR(...) \
 	dm_logger_write(dc_ctx->logger, LOG_ERROR, \
-		__VA_ARGS__);
-
-#define DTN_INFO(...) \
-	dc_raw_log(dc_ctx, LOG_DTN, \
 		__VA_ARGS__)
 
 #define DC_SYNC_INFO(...) \
 	dm_logger_write(dc_ctx->logger, LOG_SYNC, \
-		__VA_ARGS__);
-
+		__VA_ARGS__)
 
 /* Connectivity log format:
  * [time stamp]   [drm] [Major_minor] [connector name] message.....
@@ -155,4 +145,16 @@ void context_clock_trace(
 		dc_conn_log(link->ctx, link, NULL, 0, \
 				LOG_EVENT_MODE_SET, ##__VA_ARGS__)
 
+/*
+ * Display Test Next logging
+ */
+#define DTN_INFO_BEGIN() \
+	dm_dtn_log_begin(dc_ctx)
+
+#define DTN_INFO(msg, ...) \
+	dm_dtn_log_append_v(dc_ctx, msg, ##__VA_ARGS__)
+
+#define DTN_INFO_END() \
+	dm_dtn_log_end(dc_ctx)
+
 #endif /* __DAL_LOGGER_INTERFACE_H__ */
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#50 lore raw

PATCH 49/120 drm/amd/display: Roll core_stream into dc_stream

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Change-Id I4ba9615a927027e3321fb232fd0e5cbdd4e567f2
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |   2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    |  10 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h    |   2 +-
 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c   |  16 +-
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c   |  92 ++++----
 drivers/gpu/drm/amd/display/dc/core/dc.c           | 107 ++++-----
 drivers/gpu/drm/amd/display/dc/core/dc_debug.c     |   4 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      |  41 ++--
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   |   7 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c |   2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  | 259 ++++++++++-----------
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    | 118 +++++-----
 drivers/gpu/drm/amd/display/dc/dc.h                |  71 +++---
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c  |  10 +-
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.h  |   2 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    |  12 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 176 +++++++-------
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  46 ++--
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  16 +-
 .../drm/amd/display/dc/dce112/dce112_resource.h    |   2 +-
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |  12 +-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  |  72 +++---
 .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c  |  36 +--
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |  33 +--
 drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h    |   4 +-
 .../gpu/drm/amd/display/dc/inc/hw/link_encoder.h   |   3 +-
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |   2 +-
 drivers/gpu/drm/amd/display/dc/inc/resource.h      |  14 +-
 .../amd/display/dc/virtual/virtual_link_encoder.c  |   2 +-
 .../drm/amd/display/modules/freesync/freesync.c    |  60 +++--
 .../gpu/drm/amd/display/modules/inc/mod_freesync.h |  28 +--
 31 files changed, 612 insertions(+), 649 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
index 71178c88e39f..ddaa570a84da 100644
@@ -1406,7 +1406,7 @@ static int amdgpu_notify_freesync(struct drm_device *dev, void *data,
 	num_streams = dc_get_current_stream_count(adev->dm.dc);
 
 	for (i = 0; i < num_streams; i++) {
-		const struct dc_stream *stream;
+		struct dc_stream *stream;
 		stream = dc_get_stream_at_index(adev->dm.dc, i);
 
 		mod_freesync_update_state(adev->dm.freesync_module,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +5 -5
index c0fdc1d03a22..2ea14c259bd5 100644
@@ -2348,7 +2348,7 @@ static bool is_scaling_state_different(
 static void remove_stream(
 		struct amdgpu_device *adev,
 		struct amdgpu_crtc *acrtc,
-		const struct dc_stream *stream)
+		struct dc_stream *stream)
 {
 	/* this is the update mode case */
 	if (adev->dm.freesync_module)
@@ -2503,7 +2503,7 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
 	uint32_t i;
 	struct drm_plane *plane;
 	struct drm_plane_state *old_plane_state;
-	const struct dc_stream *dc_stream_attach;
+	struct dc_stream *dc_stream_attach;
 	struct dc_surface *dc_surfaces_constructed[MAX_SURFACES];
 	struct amdgpu_crtc *acrtc_attach = to_amdgpu_crtc(pcrtc);
 	struct dm_crtc_state *acrtc_state = to_dm_crtc_state(pcrtc->state);
@@ -2640,7 +2640,7 @@ void amdgpu_dm_atomic_commit_tail(
 	struct drm_crtc *crtc, *pcrtc;
 	struct drm_crtc_state *old_crtc_state;
 	struct amdgpu_crtc *new_crtcs[MAX_STREAMS];
-	const struct dc_stream *new_stream = NULL;
+	struct dc_stream *new_stream = NULL;
 	unsigned long flags;
 	bool wait_for_vblank = true;
 	struct drm_connector *connector;
@@ -2975,8 +2975,8 @@ static uint32_t add_val_sets_surface(
 static uint32_t update_in_val_sets_stream(
 	struct dc_validation_set *val_sets,
 	uint32_t set_count,
-	const struct dc_stream *old_stream,
-	const struct dc_stream *new_stream,
+	struct dc_stream *old_stream,
+	struct dc_stream *new_stream,
 	struct drm_crtc *crtc)
 {
 	uint32_t i = 0;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h +1 -1
index c565787cd782..94de6a3736fc 100644
@@ -45,7 +45,7 @@ struct dm_plane_state {
 
 struct dm_crtc_state {
 	struct drm_crtc_state base;
-	const struct dc_stream *stream;
+	struct dc_stream *stream;
 };
 
 #define to_dm_crtc_state(x)    container_of(x, struct dm_crtc_state, base)
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +8 -8
index 5ef44ff4bcf8..9a850227eeeb 100644
@@ -2610,9 +2610,9 @@ static void populate_initial_data(
 
 		data->fbc_en[num_displays + 4] = false;
 		data->lpt_en[num_displays + 4] = false;
-		data->h_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->public.timing.h_total);
-		data->v_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->public.timing.v_total);
-		data->pixel_rate[num_displays + 4] = bw_frc_to_fixed(pipe[i].stream->public.timing.pix_clk_khz, 1000);
+		data->h_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.h_total);
+		data->v_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.v_total);
+		data->pixel_rate[num_displays + 4] = bw_frc_to_fixed(pipe[i].stream->timing.pix_clk_khz, 1000);
 		data->src_width[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.viewport.width);
 		data->pitch_in_pixels[num_displays + 4] = data->src_width[num_displays + 4];
 		data->src_height[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.viewport.height);
@@ -2707,9 +2707,9 @@ static void populate_initial_data(
 
 		data->fbc_en[num_displays + 4] = false;
 		data->lpt_en[num_displays + 4] = false;
-		data->h_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->public.timing.h_total);
-		data->v_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->public.timing.v_total);
-		data->pixel_rate[num_displays + 4] = bw_frc_to_fixed(pipe[i].stream->public.timing.pix_clk_khz, 1000);
+		data->h_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.h_total);
+		data->v_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.v_total);
+		data->pixel_rate[num_displays + 4] = bw_frc_to_fixed(pipe[i].stream->timing.pix_clk_khz, 1000);
 		if (pipe[i].surface) {
 			data->src_width[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.viewport.width);
 			data->pitch_in_pixels[num_displays + 4] = data->src_width[num_displays + 4];
@@ -2759,9 +2759,9 @@ static void populate_initial_data(
 				break;
 			}
 		} else {
-			data->src_width[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->public.timing.h_addressable);
+			data->src_width[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.h_addressable);
 			data->pitch_in_pixels[num_displays + 4] = data->src_width[num_displays + 4];
-			data->src_height[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->public.timing.v_addressable);
+			data->src_height[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.v_addressable);
 			data->h_taps[num_displays + 4] = bw_int_to_fixed(1);
 			data->v_taps[num_displays + 4] = bw_int_to_fixed(1);
 			data->h_scale_ratio[num_displays + 4] = bw_int_to_fixed(1);
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +46 -46

144 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc.c +51 -56

335 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_debug.c +2 -2
index 9a5df3a848b5..bf127a88e533 100644
@@ -321,8 +321,8 @@ void context_timing_trace(
 
 		TIMING_TRACE("OTG_%d   H_tot:%d  V_tot:%d   H_pos:%d  V_pos:%d\n",
 				pipe_ctx->tg->inst,
-				pipe_ctx->stream->public.timing.h_total,
-				pipe_ctx->stream->public.timing.v_total,
+				pipe_ctx->stream->timing.h_total,
+				pipe_ctx->stream->timing.v_total,
 				h_pos[i], v_pos[i]);
 	}
 }
drivers/gpu/drm/amd/display/dc/core/dc_link.c +19 -22

156 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +3 -4
index c7b400786121..d9754b5f2543 100644
@@ -1434,7 +1434,7 @@ bool dp_validate_mode_timing(
 		return false;
 }
 
-void decide_link_settings(struct core_stream *stream,
+void decide_link_settings(struct dc_stream *stream,
 	struct dc_link_settings *link_setting)
 {
 
@@ -1446,8 +1446,7 @@ void decide_link_settings(struct core_stream *stream,
 	uint32_t req_bw;
 	uint32_t link_bw;
 
-	req_bw = bandwidth_in_kbps_from_timing(
-			&stream->public.timing);
+	req_bw = bandwidth_in_kbps_from_timing(&stream->timing);
 
 	link = stream->sink->link;
 
@@ -2327,7 +2326,7 @@ static void set_crtc_test_pattern(struct dc_link *link,
 {
 	enum controller_dp_test_pattern controller_test_pattern;
 	enum dc_color_depth color_depth = pipe_ctx->
-		stream->public.timing.display_color_depth;
+		stream->timing.display_color_depth;
 	struct bit_depth_reduction_params params;
 
 	memset(&params, 0, sizeof(params));
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +1 -1
index 5bdcd5067116..76dc16916821 100644
@@ -78,7 +78,7 @@ void dp_enable_link_phy(
 					pipes[i].clock_source->id != CLOCK_SOURCE_ID_DP_DTO) {
 				pipes[i].clock_source = dp_cs;
 				pipes[i].pix_clk_params.requested_pix_clk =
-						pipes[i].stream->public.timing.pix_clk_khz;
+						pipes[i].stream->timing.pix_clk_khz;
 				pipes[i].clock_source->funcs->program_pix_clk(
 							pipes[i].clock_source,
 							&pipes[i].pix_clk_params,
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +127 -132

711 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_stream.c +54 -64

276 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc.h +44 -27

164 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +5 -5
index aff0a440d4d3..24d0c48258ee 100644
@@ -1009,7 +1009,7 @@ bool dce110_link_encoder_construct(
 
 bool dce110_link_encoder_validate_output_with_stream(
 	struct link_encoder *enc,
-	const struct core_stream *stream)
+	const struct dc_stream *stream)
 {
 	struct dce110_link_encoder *enc110 = TO_DCE110_LINK_ENC(enc);
 	bool is_valid;
@@ -1021,22 +1021,22 @@ bool dce110_link_encoder_validate_output_with_stream(
 			enc110,
 			stream->sink->link->connector_signal,
 			stream->signal,
-			&stream->public.timing);
+			&stream->timing);
 	break;
 	case SIGNAL_TYPE_HDMI_TYPE_A:
 		is_valid = dce110_link_encoder_validate_hdmi_output(
 				enc110,
-				&stream->public.timing,
+				&stream->timing,
 				stream->phy_pix_clk);
 	break;
 	case SIGNAL_TYPE_DISPLAY_PORT:
 	case SIGNAL_TYPE_DISPLAY_PORT_MST:
 		is_valid = dce110_link_encoder_validate_dp_output(
-					enc110, &stream->public.timing);
+					enc110, &stream->timing);
 	break;
 	case SIGNAL_TYPE_EDP:
 		is_valid =
-			(stream->public.timing.
+			(stream->timing.
 				pixel_encoding == PIXEL_ENCODING_RGB) ? true : false;
 	break;
 	case SIGNAL_TYPE_VIRTUAL:
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.h +1 -1
index ded6c61304e6..a47b075f4869 100644
@@ -199,7 +199,7 @@ bool dce110_link_encoder_validate_wireless_output(
 
 bool dce110_link_encoder_validate_output_with_stream(
 	struct link_encoder *enc,
-	const struct core_stream *stream);
+	const struct dc_stream *stream);
 
 /****************** HW programming ************************/
 
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +6 -6
index 3d25a90e49b4..cf98f2471023 100644
@@ -660,7 +660,7 @@ static enum dc_status build_mapped_resource(
 	uint8_t i, j;
 
 	for (i = 0; i < context->stream_count; i++) {
-		struct core_stream *stream = context->streams[i];
+		struct dc_stream *stream = context->streams[i];
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
@@ -734,8 +734,8 @@ enum dc_status dce100_validate_with_context(
 		return DC_FAIL_SURFACE_VALIDATE;
 
 	for (i = 0; i < set_count; i++) {
-		context->streams[i] = DC_STREAM_TO_CORE(set[i].stream);
-		dc_stream_retain(&context->streams[i]->public);
+		context->streams[i] = set[i].stream;
+		dc_stream_retain(context->streams[i]);
 		context->stream_count++;
 	}
 
@@ -765,13 +765,13 @@ enum dc_status dce100_validate_with_context(
 
 enum dc_status dce100_validate_guaranteed(
 		const struct core_dc *dc,
-		const struct dc_stream *dc_stream,
+		struct dc_stream *dc_stream,
 		struct validate_context *context)
 {
 	enum dc_status result = DC_ERROR_UNEXPECTED;
 
-	context->streams[0] = DC_STREAM_TO_CORE(dc_stream);
-	dc_stream_retain(&context->streams[0]->public);
+	context->streams[0] = dc_stream;
+	dc_stream_retain(context->streams[0]);
 	context->stream_count++;
 
 	result = resource_map_pool_resources(dc, context, NULL);
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +88 -88

472 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +23 -23

120 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +8 -8
index 19cd99923b24..9589208ea0c8 100644
@@ -698,7 +698,7 @@ static void destruct(struct dce110_resource_pool *pool)
 static struct clock_source *find_matching_pll(
 		struct resource_context *res_ctx,
 		const struct resource_pool *pool,
-		const struct core_stream *const stream)
+		const struct dc_stream *const stream)
 {
 	switch (stream->sink->link->link_enc->transmitter) {
 	case TRANSMITTER_UNIPHY_A:
@@ -729,7 +729,7 @@ static enum dc_status build_mapped_resource(
 	uint8_t i, j;
 
 	for (i = 0; i < context->stream_count; i++) {
-		struct core_stream *stream = context->streams[i];
+		struct dc_stream *stream = context->streams[i];
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
@@ -843,7 +843,7 @@ enum dc_status resource_map_phy_clock_resources(
 
 	/* acquire new resources */
 	for (i = 0; i < context->stream_count; i++) {
-		struct core_stream *stream = context->streams[i];
+		struct dc_stream *stream = context->streams[i];
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
@@ -916,8 +916,8 @@ enum dc_status dce112_validate_with_context(
 		return DC_FAIL_SURFACE_VALIDATE;
 
 	for (i = 0; i < set_count; i++) {
-		context->streams[i] = DC_STREAM_TO_CORE(set[i].stream);
-		dc_stream_retain(&context->streams[i]->public);
+		context->streams[i] = set[i].stream;
+		dc_stream_retain(context->streams[i]);
 		context->stream_count++;
 	}
 
@@ -947,13 +947,13 @@ enum dc_status dce112_validate_with_context(
 
 enum dc_status dce112_validate_guaranteed(
 		const struct core_dc *dc,
-		const struct dc_stream *dc_stream,
+		struct dc_stream *stream,
 		struct validate_context *context)
 {
 	enum dc_status result = DC_ERROR_UNEXPECTED;
 
-	context->streams[0] = DC_STREAM_TO_CORE(dc_stream);
-	dc_stream_retain(&context->streams[0]->public);
+	context->streams[0] = stream;
+	dc_stream_retain(context->streams[0]);
 	context->stream_count++;
 
 	result = resource_map_pool_resources(dc, context, NULL);
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.h +1 -1
index c6c0bbac5335..cb2c69fb05a6 100644
@@ -44,7 +44,7 @@ enum dc_status dce112_validate_with_context(
 
 enum dc_status dce112_validate_guaranteed(
 		const struct core_dc *dc,
-		const struct dc_stream *dc_stream,
+		struct dc_stream *dc_stream,
 		struct validate_context *context);
 
 bool dce112_validate_bandwidth(
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +6 -6
index 0123006e5360..2fde43c91ad0 100644
@@ -676,7 +676,7 @@ static enum dc_status build_mapped_resource(
 	uint8_t i, j;
 
 	for (i = 0; i < context->stream_count; i++) {
-		struct core_stream *stream = context->streams[i];
+		struct dc_stream *stream = context->streams[i];
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream))
 			continue;
@@ -750,8 +750,8 @@ enum dc_status dce80_validate_with_context(
 		return DC_FAIL_SURFACE_VALIDATE;
 
 	for (i = 0; i < set_count; i++) {
-		context->streams[i] = DC_STREAM_TO_CORE(set[i].stream);
-		dc_stream_retain(&context->streams[i]->public);
+		context->streams[i] = set[i].stream;
+		dc_stream_retain(context->streams[i]);
 		context->stream_count++;
 	}
 
@@ -780,13 +780,13 @@ enum dc_status dce80_validate_with_context(
 
 enum dc_status dce80_validate_guaranteed(
 		const struct core_dc *dc,
-		const struct dc_stream *dc_stream,
+		struct dc_stream *dc_stream,
 		struct validate_context *context)
 {
 	enum dc_status result = DC_ERROR_UNEXPECTED;
 
-	context->streams[0] = DC_STREAM_TO_CORE(dc_stream);
-	dc_stream_retain(&context->streams[0]->public);
+	context->streams[0] = dc_stream;
+	dc_stream_retain(context->streams[0]);
 	context->stream_count++;
 
 	result = resource_map_pool_resources(dc, context, NULL);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +36 -36

205 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +18 -18
index b901ef9689a6..33beb0bc3ddf 100644
@@ -787,8 +787,8 @@ static void get_pixel_clock_parameters(
 	const struct pipe_ctx *pipe_ctx,
 	struct pixel_clk_params *pixel_clk_params)
 {
-	const struct core_stream *stream = pipe_ctx->stream;
-	pixel_clk_params->requested_pix_clk = stream->public.timing.pix_clk_khz;
+	const struct dc_stream *stream = pipe_ctx->stream;
+	pixel_clk_params->requested_pix_clk = stream->timing.pix_clk_khz;
 	pixel_clk_params->encoder_object_id = stream->sink->link->link_enc->id;
 	pixel_clk_params->signal_type = pipe_ctx->stream->signal;
 	pixel_clk_params->controller_id = pipe_ctx->pipe_idx + 1;
@@ -797,23 +797,23 @@ static void get_pixel_clock_parameters(
 		LINK_RATE_REF_FREQ_IN_KHZ;
 	pixel_clk_params->flags.ENABLE_SS = 0;
 	pixel_clk_params->color_depth =
-		stream->public.timing.display_color_depth;
+		stream->timing.display_color_depth;
 	pixel_clk_params->flags.DISPLAY_BLANKED = 1;
-	pixel_clk_params->pixel_encoding = stream->public.timing.pixel_encoding;
+	pixel_clk_params->pixel_encoding = stream->timing.pixel_encoding;
 
-	if (stream->public.timing.pixel_encoding == PIXEL_ENCODING_YCBCR422)
+	if (stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR422)
 		pixel_clk_params->color_depth = COLOR_DEPTH_888;
 
-	if (stream->public.timing.pixel_encoding == PIXEL_ENCODING_YCBCR420)
+	if (stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420)
 		pixel_clk_params->requested_pix_clk  /= 2;
 
 }
 
-static void build_clamping_params(struct core_stream *stream)
+static void build_clamping_params(struct dc_stream *stream)
 {
 	stream->clamping.clamping_level = CLAMPING_FULL_RANGE;
-	stream->clamping.c_depth = stream->public.timing.display_color_depth;
-	stream->clamping.pixel_encoding = stream->public.timing.pixel_encoding;
+	stream->clamping.c_depth = stream->timing.display_color_depth;
+	stream->clamping.pixel_encoding = stream->timing.pixel_encoding;
 }
 
 static enum dc_status build_pipe_hw_param(struct pipe_ctx *pipe_ctx)
@@ -826,7 +826,7 @@ static enum dc_status build_pipe_hw_param(struct pipe_ctx *pipe_ctx)
 		&pipe_ctx->pix_clk_params,
 		&pipe_ctx->pll_settings);
 
-	pipe_ctx->stream->clamping.pixel_encoding = pipe_ctx->stream->public.timing.pixel_encoding;
+	pipe_ctx->stream->clamping.pixel_encoding = pipe_ctx->stream->timing.pixel_encoding;
 
 	resource_build_bit_depth_reduction_params(pipe_ctx->stream,
 					&pipe_ctx->stream->bit_depth_params);
@@ -844,7 +844,7 @@ static enum dc_status build_mapped_resource(
 	uint8_t i, j;
 
 	for (i = 0; i < context->stream_count; i++) {
-		struct core_stream *stream = context->streams[i];
+		struct dc_stream *stream = context->streams[i];
 
 		if (old_context && resource_is_stream_unchanged(old_context, stream)) {
 			if (stream != NULL && old_context->streams[i] != NULL) {
@@ -852,7 +852,7 @@ static enum dc_status build_mapped_resource(
 				resource_build_bit_depth_reduction_params(stream,
 						&stream->bit_depth_params);
 				stream->clamping.pixel_encoding =
-						stream->public.timing.pixel_encoding;
+						stream->timing.pixel_encoding;
 
 				resource_build_bit_depth_reduction_params(stream,
 								&stream->bit_depth_params);
@@ -896,8 +896,8 @@ enum dc_status dcn10_validate_with_context(
 		return result;
 
 	for (i = 0; i < set_count; i++) {
-		context->streams[i] = DC_STREAM_TO_CORE(set[i].stream);
-		dc_stream_retain(&context->streams[i]->public);
+		context->streams[i] = set[i].stream;
+		dc_stream_retain(context->streams[i]);
 		context->stream_count++;
 	}
 
@@ -929,13 +929,13 @@ enum dc_status dcn10_validate_with_context(
 
 enum dc_status dcn10_validate_guaranteed(
 		const struct core_dc *dc,
-		const struct dc_stream *dc_stream,
+		struct dc_stream *dc_stream,
 		struct validate_context *context)
 {
 	enum dc_status result = DC_ERROR_UNEXPECTED;
 
-	context->streams[0] = DC_STREAM_TO_CORE(dc_stream);
-	dc_stream_retain(&context->streams[0]->public);
+	context->streams[0] = dc_stream;
+	dc_stream_retain(context->streams[0]);
 	context->stream_count++;
 
 	result = resource_map_pool_resources(dc, context, NULL);
@@ -960,7 +960,7 @@ enum dc_status dcn10_validate_guaranteed(
 static struct pipe_ctx *dcn10_acquire_idle_pipe_for_layer(
 		struct validate_context *context,
 		const struct resource_pool *pool,
-		struct core_stream *stream)
+		struct dc_stream *stream)
 {
 	struct resource_context *res_ctx = &context->res_ctx;
 	struct pipe_ctx *head_pipe = resource_get_head_pipe_for_stream(res_ctx, stream);
drivers/gpu/drm/amd/display/dc/inc/core_types.h +5 -28
index 5a47d4c94df6..2ae5a607fb5a 100644
@@ -36,41 +36,18 @@
 #include "mpc.h"
 #endif
 
-struct core_stream;
-
 #define MAX_CLOCK_SOURCES 7
 
 void enable_surface_flip_reporting(struct dc_surface *dc_surface,
 		uint32_t controller_id);
 
-/********* core_stream ************/
 #include "grph_object_id.h"
 #include "link_encoder.h"
 #include "stream_encoder.h"
 #include "clock_source.h"
 #include "audio.h"
 #include "hw_sequencer_types.h"
-#include "opp.h"
-
-#define DC_STREAM_TO_CORE(dc_stream) container_of( \
-	dc_stream, struct core_stream, public)
-
-struct core_stream {
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +2 -2
index d9af028a39df..5b4185053e9c 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h +1 -2
index 0ee738774f9f..28fb02fb677e 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +1 -1
index a3eec078dead..b2f7ba2115c9 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/display/dc/inc/resource.h +7 -7
index ed94df16a2d3..571bfae62a3c 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/display/dc/virtual/virtual_link_encoder.c +1 -1
index d312874d95b5..dd024c99fb7e 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/display/modules/freesync/freesync.c +27 -33

60 lines not on this page · raw message

drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h +14 -14
index 53c428b97902..2b9d45100bdd 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Part of the diff is not shown here. View the raw message.

#51 lore raw

PATCH 50/120 drm/amd/display: Roll stream into dc_stream

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Change-Id Ie2aa704041553ad5c8eca7e165b9e4b0fa6a3aea
---
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 29 +++++++------------------
 1 file changed, 8 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +8 -21
index 46ad1bc12f63..a77e1e80d7c2 100644
@@ -31,17 +31,6 @@
 #include "timing_generator.h"
 
 /*******************************************************************************
- * Private definitions
- ******************************************************************************/
-
-struct stream {
-	struct dc_stream protected;
-	int ref_count;
-};
-
-#define DC_STREAM_TO_STREAM(dc_stream) container_of(dc_stream, struct stream, protected)
-
-/*******************************************************************************
  * Private functions
  ******************************************************************************/
 
@@ -105,24 +94,22 @@ static void destruct(struct dc_stream *stream)
 	}
 }
 
-void dc_stream_retain(struct dc_stream *dc_stream)
+void dc_stream_retain(struct dc_stream *stream)
 {
-	struct stream *stream = DC_STREAM_TO_STREAM(dc_stream);
 
 	ASSERT(stream->ref_count > 0);
 	stream->ref_count++;
 }
 
-void dc_stream_release(struct dc_stream *public)
+void dc_stream_release(struct dc_stream *stream)
 {
-	struct stream *stream = DC_STREAM_TO_STREAM(public);
 
-	if (public != NULL) {
+	if (stream != NULL) {
 		ASSERT(stream->ref_count > 0);
 		stream->ref_count--;
 
 		if (stream->ref_count == 0) {
-			destruct(public);
+			destruct(stream);
 			dm_free(stream);
 		}
 	}
@@ -131,22 +118,22 @@ void dc_stream_release(struct dc_stream *public)
 struct dc_stream *dc_create_stream_for_sink(
 		struct dc_sink *sink)
 {
-	struct stream *stream;
+	struct dc_stream *stream;
 
 	if (sink == NULL)
 		goto alloc_fail;
 
-	stream = dm_alloc(sizeof(struct stream));
+	stream = dm_alloc(sizeof(struct dc_stream));
 
 	if (NULL == stream)
 		goto alloc_fail;
 
-	if (false == construct(&stream->protected, sink))
+	if (false == construct(stream, sink))
 			goto construct_fail;
 
 	stream->ref_count++;
 
-	return &stream->protected;
+	return stream;
 
 construct_fail:
 	dm_free(stream);
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#52 lore raw

PATCH 51/120 drm/amd/display: reduce 40s time out to 1s in disable crtc

In reply to a message not in the archive

From: Eric Yang <[email protected]>

Change-Id I3eba2070ff409af4823841beb53696200b5aec8c
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c +1 -1
index 0ef5d8f0625c..f4dce2806ae1 100644
@@ -429,7 +429,7 @@ static bool tgn10_disable_crtc(struct timing_generator *tg)
 	/* CRTC disabled, so disable  clock. */
 	REG_WAIT(OTG_CLOCK_CONTROL,
 			OTG_BUSY, 0,
-			2000, 20000);
+			2000, 500);
 
 	return true;
 }
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#53 lore raw

PATCH 52/120 drm/amd/display: safeguard compressor api

In reply to a message not in the archive

From: Roman Li <[email protected]>

Only call compressor api if it's available.

Change-Id I15f0bfa54ca231f804a1d2f00885faaa7237face
---
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +6 -3
index 15f6eeef343d..d45773087644 100644
@@ -1185,7 +1185,8 @@ static void power_down_all_hw_blocks(struct core_dc *dc)
 	power_down_clock_sources(dc);
 
 #ifdef ENABLE_FBC
-	dc->fbc_compressor->funcs->disable_fbc(dc->fbc_compressor);
+	if (dc->fbc_compressor)
+		dc->fbc_compressor->funcs->disable_fbc(dc->fbc_compressor);
 #endif
 }
 
@@ -1658,7 +1659,8 @@ enum dc_status dce110_apply_ctx_to_hw(
 	set_safe_displaymarks(&context->res_ctx, dc->res_pool);
 
 #ifdef ENABLE_FBC
-	dc->fbc_compressor->funcs->disable_fbc(dc->fbc_compressor);
+	if (dc->fbc_compressor)
+		dc->fbc_compressor->funcs->disable_fbc(dc->fbc_compressor);
 #endif
 	/*TODO: when pplib works*/
 	apply_min_clocks(dc, context, &clocks_state, true);
@@ -2246,7 +2248,8 @@ static void init_hw(struct core_dc *dc)
 		abm->funcs->abm_init(abm);
 	}
 #ifdef ENABLE_FBC
-	dc->fbc_compressor->funcs->power_up_fbc(dc->fbc_compressor);
+	if (dc->fbc_compressor)
+		dc->fbc_compressor->funcs->power_up_fbc(dc->fbc_compressor);
 #endif
 }
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#54 lore raw

PATCH 53/120 drm/amd/display: collapse dce11 reset_hw_ctx_wrap into 1 function

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I46ffcbd5d64f894d6b338f0981b0aaecb16f33a3
---
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 47 +++++++++-------------
 1 file changed, 20 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +20 -27
index d45773087644..6afe572cfb06 100644
@@ -1345,28 +1345,6 @@ static void switch_dp_clock_sources(
  * Public functions
  ******************************************************************************/
 
-static void reset_single_pipe_hw_ctx(
-		const struct core_dc *dc,
-		struct pipe_ctx *pipe_ctx,
-		struct validate_context *context)
-{
-	core_link_disable_stream(pipe_ctx);
-	pipe_ctx->tg->funcs->set_blank(pipe_ctx->tg, true);
-	if (!hwss_wait_for_blank_complete(pipe_ctx->tg)) {
-		dm_error("DC: failed to blank crtc!\n");
-		BREAK_TO_DEBUGGER();
-	}
-	pipe_ctx->tg->funcs->disable_crtc(pipe_ctx->tg);
-	pipe_ctx->mi->funcs->free_mem_input(
-				pipe_ctx->mi, context->stream_count);
-	resource_unreference_clock_source(&context->res_ctx, dc->res_pool,
-			 &pipe_ctx->clock_source);
-
-	dc->hwss.power_down_front_end((struct core_dc *)dc, pipe_ctx->pipe_idx);
-
-	pipe_ctx->stream = NULL;
-}
-
 static void set_drr(struct pipe_ctx **pipe_ctx,
 		int num_pipes, int vmin, int vmax)
 {
@@ -1580,7 +1558,7 @@ static enum dc_status apply_ctx_to_hw_fpga(
 	return DC_OK;
 }
 
-static void reset_hw_ctx_wrap(
+static void dce110_reset_hw_ctx_wrap(
 		struct core_dc *dc,
 		struct validate_context *context)
 {
@@ -1603,9 +1581,24 @@ static void reset_hw_ctx_wrap(
 			continue;
 
 		if (!pipe_ctx->stream ||
-				pipe_need_reprogram(pipe_ctx_old, pipe_ctx))
-			reset_single_pipe_hw_ctx(
-				dc, pipe_ctx_old, dc->current_context);
+				pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) {
+			core_link_disable_stream(pipe_ctx_old);
+			pipe_ctx_old->tg->funcs->set_blank(pipe_ctx_old->tg, true);
+			if (!hwss_wait_for_blank_complete(pipe_ctx_old->tg)) {
+				dm_error("DC: failed to blank crtc!\n");
+				BREAK_TO_DEBUGGER();
+			}
+			pipe_ctx_old->tg->funcs->disable_crtc(pipe_ctx_old->tg);
+			pipe_ctx_old->mi->funcs->free_mem_input(
+					pipe_ctx_old->mi, dc->current_context->stream_count);
+			resource_unreference_clock_source(
+					&dc->current_context->res_ctx, dc->res_pool,
+					&pipe_ctx_old->clock_source);
+
+			dc->hwss.power_down_front_end(dc, pipe_ctx_old->pipe_idx);
+
+			pipe_ctx_old->stream = NULL;
+		}
 	}
 }
 
@@ -2619,7 +2612,7 @@ static const struct hw_sequencer_funcs dce110_funcs = {
 	.set_drr = set_drr,
 	.get_position = get_position,
 	.set_static_screen_control = set_static_screen_control,
-	.reset_hw_ctx_wrap = reset_hw_ctx_wrap,
+	.reset_hw_ctx_wrap = dce110_reset_hw_ctx_wrap,
 	.prog_pixclk_crtc_otg = dce110_prog_pixclk_crtc_otg,
 	.setup_stereo = NULL,
 	.set_avmute = dce110_set_avmute,
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#55 lore raw

PATCH 54/120 drm/amd/display: mpc block redesign

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id Iaa7280f4413ad9cddda250e131a40b3259575358
---
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c   |   2 -
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |   5 +-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 146 +++++-------
 .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c |   8 +-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c   | 246 ++++++++++++++-------
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h   |  82 +++----
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c   |   3 +
 .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c  |  74 +++----
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |   3 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h  |   4 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h        |  26 ++-
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h        |   7 +
 12 files changed, 339 insertions(+), 267 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +0 -2
index ef10a8b49379..49b75765d900 100644
@@ -547,11 +547,9 @@ static void split_stream_across_pipes(
 	*secondary_pipe = *primary_pipe;
 
 	secondary_pipe->pipe_idx = pipe_idx;
-	secondary_pipe->mpcc = pool->mpcc[secondary_pipe->pipe_idx];
 	secondary_pipe->mi = pool->mis[secondary_pipe->pipe_idx];
 	secondary_pipe->ipp = pool->ipps[secondary_pipe->pipe_idx];
 	secondary_pipe->xfm = pool->transforms[secondary_pipe->pipe_idx];
-	secondary_pipe->opp = pool->opps[secondary_pipe->pipe_idx];
 	if (primary_pipe->bottom_pipe) {
 		secondary_pipe->bottom_pipe = primary_pipe->bottom_pipe;
 		secondary_pipe->bottom_pipe->top_pipe = secondary_pipe;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -4
index 7e4c38752855..a4b80a3a0bad 100644
@@ -1017,7 +1017,6 @@ static int acquire_first_split_pipe(
 			pipe_ctx->xfm = pool->transforms[i];
 			pipe_ctx->opp = pool->opps[i];
 			pipe_ctx->dis_clk = pool->display_clock;
-			pipe_ctx->mpcc = pool->mpcc[i];
 			pipe_ctx->pipe_idx = i;
 
 			pipe_ctx->stream = stream;
@@ -1096,6 +1095,7 @@ bool resource_attach_surfaces_to_context(
 
 		if (tail_pipe) {
 			free_pipe->tg = tail_pipe->tg;
+			free_pipe->opp = tail_pipe->opp;
 			free_pipe->stream_enc = tail_pipe->stream_enc;
 			free_pipe->audio = tail_pipe->audio;
 			free_pipe->clock_source = tail_pipe->clock_source;
@@ -1241,9 +1241,6 @@ static int acquire_first_free_pipe(
 		if (!res_ctx->pipe_ctx[i].stream) {
 			struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
-			pipe_ctx->mpcc = pool->mpcc[i];
-#endif
 			pipe_ctx->tg = pool->timing_generators[i];
 			pipe_ctx->mi = pool->mis[i];
 			pipe_ctx->ipp = pool->ipps[i];
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +59 -87

287 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c +7 -1
index 6f01db6a51dd..76879f5d7907 100644
@@ -47,10 +47,14 @@ static void min10_set_blank(struct mem_input *mem_input, bool blank)
 			HUBP_BLANK_EN, blank_en,
 			HUBP_TTU_DISABLE, blank_en);
 
-	if (blank)
+	if (blank) {
 		REG_WAIT(DCHUBP_CNTL,
 				HUBP_NO_OUTSTANDING_REQ, 1,
 				1, 200);
+		/*todo: unhack this
+		mem_input->mpcc_id = 0xf;
+		mem_input->opp_id = 0xf;*/
+	}
 }
 
 static void min10_vready_workaround(struct mem_input *mem_input,
@@ -871,6 +875,8 @@ bool dcn10_mem_input_construct(
 	mi->mi_shift = mi_shift;
 	mi->mi_mask = mi_mask;
 	mi->base.inst = inst;
+	mi->base.opp_id = 0xf;
+	mi->base.mpcc_id = 0xf;
 
 	return true;
 }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c +172 -74

312 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h +42 -40

115 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c +3 -0
index f8e4724a629d..38d15f7c2a88 100644
@@ -337,6 +337,9 @@ void dcn10_opp_construct(struct dcn10_opp *oppn10,
 	oppn10->base.inst = inst;
 	oppn10->base.funcs = &dcn10_opp_funcs;
 
+	oppn10->base.mpc_tree.dpp[0] = inst;
+	oppn10->base.mpc_tree.mpcc[0] = inst;
+	oppn10->base.mpc_tree.num_pipes = 1;
 	for (i = 0; i < MAX_PIPES; i++)
 		oppn10->base.mpcc_disconnect_pending[i] = false;
 
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +30 -44

129 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -2
index 2ae5a607fb5a..b312bb3b3350 100644
@@ -123,7 +123,7 @@ struct resource_pool {
 	struct timing_generator *timing_generators[MAX_PIPES];
 	struct stream_encoder *stream_enc[MAX_PIPES * 2];
 #ifdef CONFIG_DRM_AMD_DC_DCN1_0
-	struct mpcc *mpcc[MAX_PIPES];
+	struct mpc *mpc;
 #endif
 
 	unsigned int pipe_count;
@@ -183,7 +183,6 @@ struct pipe_ctx {
 	struct pipe_ctx *bottom_pipe;
 
 #ifdef CONFIG_DRM_AMD_DC_DCN1_0
-	struct mpcc *mpcc;
 	struct _vcs_dpi_display_dlg_regs_st dlg_regs;
 	struct _vcs_dpi_display_ttu_regs_st ttu_regs;
 	struct _vcs_dpi_display_rq_regs_st rq_regs;
drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h +3 -1
index fd3ce742af2c..a7c89c36f90f 100644
@@ -69,7 +69,9 @@ struct mem_input {
 	struct dc_context *ctx;
 	struct dc_plane_address request_address;
 	struct dc_plane_address current_address;
-	uint32_t inst;
+	int inst;
+	int opp_id;
+	int mpcc_id;
 	struct stutter_modes stutter_mode;
 };
 
drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h +14 -12
index 55c9c305a259..4bbcff48acc8 100644
@@ -26,27 +26,29 @@
 #define __DC_MPCC_H__
 
 #include "dc_hw_types.h"
+#include "opp.h"
 
 struct mpcc_cfg {
-	int top_dpp_id;
-	int bot_mpcc_id;
-	int opp_id;
+	struct mem_input *mi;
+	struct output_pixel_processor *opp;
+	unsigned int z_index;
+
+	struct tg_color black_color;
 	bool per_pixel_alpha;
 	bool pre_multiplied_alpha;
-	bool top_of_tree;
 };
 
-struct mpcc {
-	const struct mpcc_funcs *funcs;
+struct mpc {
+	const struct mpc_funcs *funcs;
 	struct dc_context *ctx;
-	int inst;
-	int opp_id;
 };
 
-struct mpcc_funcs {
-	void (*set)(struct mpcc *mpcc, struct mpcc_cfg *cfg);
-	void (*wait_for_idle)(struct mpcc *mpcc);
-	void (*set_bg_color)( struct mpcc *mpcc, struct tg_color *bg_color);
+struct mpc_funcs {
+	void (*add)(struct mpc *mpc, struct mpcc_cfg *cfg);
+	void (*remove)(struct mpc *mpc,
+			struct output_pixel_processor *opp,
+			int mpcc_inst);
+	void (*wait_for_idle)(struct mpc *mpc, int id);
 };
 
 #endif
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +7 -0
index a43a09b3f414..01d6957c07fb 100644
@@ -196,10 +196,17 @@ struct pwl_float_data {
 	struct fixed31_32 b;
 };
 
+struct mpc_tree_cfg {
+	int num_pipes;
+	int dpp[MAX_PIPES];
+	int mpcc[MAX_PIPES];
+};
+
 struct output_pixel_processor {
 	struct dc_context *ctx;
 	uint32_t inst;
 	struct pwl_params regamma_params;
+	struct mpc_tree_cfg mpc_tree;
 	bool mpcc_disconnect_pending[MAX_PIPES];
 	const struct opp_funcs *funcs;
 };
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#56 lore raw

PATCH 55/120 drm/amd/display: fix mpcc idle wait

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I531c1395e3ececf628cb358b2ac13130c9eef3b2
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c +1 -1
index 246b60a16521..036f161ab1c1 100644
@@ -71,7 +71,7 @@ static void mpc10_assert_idle_mpcc(struct mpc *mpc, int id)
 
 	ASSERT(!(mpc10->mpcc_in_use_mask & 1 << id));
 	REG_WAIT(MPCC_STATUS[id],
-			MPCC_BUSY, 0,
+			MPCC_IDLE, 1,
 			1000, 1000);
 }
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#57 lore raw

PATCH 56/120 drm/amd/display: add detect caps for edp

In reply to a message not in the archive

From: Roman Li <[email protected]>

1. The caps detect sequence for edp is different from dp. Added separate function for edp.
2. Removed max_link_setting and replaced it with verified to avoid confusion.
3. Reverted sink count guard for edp powerdown as unnecessary with the changes above.

Change-Id Id6ab2f76f1994da5357261e7ca9df74fb89d8a76
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      |  2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   | 11 ++++++++---
 drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c |  4 +---
 drivers/gpu/drm/amd/display/dc/dc.h                |  1 -
 drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h    |  2 ++
 5 files changed, 12 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -1
index 2487046457c8..a983a5ee3172 100644
@@ -585,7 +585,7 @@ bool dc_link_detect(struct dc_link *link, bool boot)
 		}
 
 		case SIGNAL_TYPE_EDP: {
-			detect_dp_sink_caps(link);
+			detect_edp_sink_caps(link);
 			sink_caps.transaction_type =
 				DDC_TRANSACTION_TYPE_I2C_OVER_AUX;
 			sink_caps.signal = SIGNAL_TYPE_EDP;
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +8 -3
index d9754b5f2543..17506345f97a 100644
@@ -1147,7 +1147,6 @@ bool dp_hbr_verify_link_cap(
 		LINK_SPREAD_DISABLED;
 	}
 
-	link->max_link_setting = link->verified_link_cap;
 
 	return success;
 }
@@ -1466,7 +1465,7 @@ void decide_link_settings(struct dc_stream *stream,
      * 2. could support the b/w requested by the timing
      */
 	while (current_link_setting.link_rate <=
-			link->max_link_setting.link_rate) {
+			link->verified_link_cap.link_rate) {
 		link_bw = bandwidth_in_kbps_from_link_settings(
 				&current_link_setting);
 		if (req_bw <= link_bw) {
@@ -1475,7 +1474,7 @@ void decide_link_settings(struct dc_stream *stream,
 		}
 
 		if (current_link_setting.lane_count <
-				link->max_link_setting.lane_count) {
+				link->verified_link_cap.lane_count) {
 			current_link_setting.lane_count =
 					increase_lane_count(
 							current_link_setting.lane_count);
@@ -2294,6 +2293,12 @@ void detect_dp_sink_caps(struct dc_link *link)
 	/* TODO save sink caps in link->sink */
 }
 
+void detect_edp_sink_caps(struct dc_link *link)
+{
+	retrieve_link_cap(link);
+	link->verified_link_cap = link->reported_link_cap;
+}
+
 void dc_link_dp_enable_hpd(const struct dc_link *link)
 {
 	struct link_encoder *encoder = link->link_enc;
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +1 -3
index 76dc16916821..f2f57a75f864 100644
@@ -114,9 +114,7 @@ void dp_disable_link_phy(struct dc_link *link, enum signal_type signal)
 
 	if (signal == SIGNAL_TYPE_EDP) {
 		link->link_enc->funcs->backlight_control(link->link_enc, false);
-		if (link->dpcd_sink_count)
-			link->link_enc->funcs->power_control(link->link_enc,
-									false);
+		link->link_enc->funcs->power_control(link->link_enc, false);
 	}
 
 	link->link_enc->funcs->disable_output(link->link_enc, signal);
drivers/gpu/drm/amd/display/dc/dc.h +0 -1
index b20f7bfcdc1f..58bfb867b71c 100644
@@ -744,7 +744,6 @@ struct dc_link {
 	 */
 	struct dc_link_settings reported_link_cap;
 	struct dc_link_settings verified_link_cap;
-	struct dc_link_settings max_link_setting;
 	struct dc_link_settings cur_link_settings;
 	struct dc_lane_settings cur_lane_setting;
 	struct dc_link_settings preferred_link_setting;
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +2 -0
index 5b4185053e9c..1a4a605cb449 100644
@@ -63,6 +63,8 @@ bool is_mst_supported(struct dc_link *link);
 
 void detect_dp_sink_caps(struct dc_link *link);
 
+void detect_edp_sink_caps(struct dc_link *link);
+
 bool is_dp_active_dongle(const struct dc_link *link);
 
 void dp_enable_mst_on_sink(struct dc_link *link, bool enable);
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#58 lore raw

PATCH 57/120 drm/amd/display: update clocks we report to PPlib

In reply to a message not in the archive

From: Eric Yang <[email protected]>

Change-Id I0f710787f7160a3f663d501627a30aca67c4a803
---
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 39 ++++++++++++------------
 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +20 -19
index 49b75765d900..875b98dae6e1 100644
@@ -1267,13 +1267,14 @@ void dcn_bw_notify_pplib_of_wm_ranges(struct core_dc *dc)
 {
 	struct dm_pp_wm_sets_with_clock_ranges_soc15 clk_ranges = {0};
 	int max_fclk_khz, nom_fclk_khz, min_fclk_khz, max_dcfclk_khz,
-		nom_dcfclk_khz, min_dcfclk_khz, socclk_khz;
+		nom_dcfclk_khz, mid_fclk_khz, min_dcfclk_khz, socclk_khz;
 	const int overdrive = 5000000; /* 5 GHz to cover Overdrive */
 	unsigned factor = (ddr4_dram_factor_single_Channel * dc->dcn_soc.number_of_channels);
 
 	kernel_fpu_begin();
 	max_fclk_khz = dc->dcn_soc.fabric_and_dram_bandwidth_vmax0p9 * 1000000 / factor;
 	nom_fclk_khz = dc->dcn_soc.fabric_and_dram_bandwidth_vnom0p8 * 1000000 / factor;
+	mid_fclk_khz = dc->dcn_soc.fabric_and_dram_bandwidth_vmid0p72 * 1000000 / factor;
 	min_fclk_khz = dc->dcn_soc.fabric_and_dram_bandwidth_vmin0p65 * 1000000 / 32;
 	max_dcfclk_khz = dc->dcn_soc.dcfclkv_max0p9 * 1000;
 	nom_dcfclk_khz = dc->dcn_soc.dcfclkv_nom0p8 * 1000;
@@ -1293,48 +1294,48 @@ void dcn_bw_notify_pplib_of_wm_ranges(struct core_dc *dc)
 	clk_ranges.num_wm_mcif_sets = 4;
 	clk_ranges.wm_dmif_clocks_ranges[0].wm_set_id = WM_SET_A;
 	clk_ranges.wm_dmif_clocks_ranges[0].wm_min_dcfclk_clk_in_khz = min_dcfclk_khz;
-	clk_ranges.wm_dmif_clocks_ranges[0].wm_max_dcfclk_clk_in_khz = nom_dcfclk_khz - 1;
+	clk_ranges.wm_dmif_clocks_ranges[0].wm_max_dcfclk_clk_in_khz = max_dcfclk_khz;
 	clk_ranges.wm_dmif_clocks_ranges[0].wm_min_memg_clk_in_khz = min_fclk_khz;
-	clk_ranges.wm_dmif_clocks_ranges[0].wm_max_mem_clk_in_khz = nom_fclk_khz - 1;
+	clk_ranges.wm_dmif_clocks_ranges[0].wm_max_mem_clk_in_khz = min_fclk_khz;
 	clk_ranges.wm_mcif_clocks_ranges[0].wm_set_id = WM_SET_A;
 	clk_ranges.wm_mcif_clocks_ranges[0].wm_min_socclk_clk_in_khz = socclk_khz;
 	clk_ranges.wm_mcif_clocks_ranges[0].wm_max_socclk_clk_in_khz = overdrive;
 	clk_ranges.wm_mcif_clocks_ranges[0].wm_min_memg_clk_in_khz = min_fclk_khz;
-	clk_ranges.wm_mcif_clocks_ranges[0].wm_max_mem_clk_in_khz = nom_fclk_khz - 1;
+	clk_ranges.wm_mcif_clocks_ranges[0].wm_max_mem_clk_in_khz = min_fclk_khz;
 
 	clk_ranges.wm_dmif_clocks_ranges[1].wm_set_id = WM_SET_B;
-	clk_ranges.wm_dmif_clocks_ranges[1].wm_min_dcfclk_clk_in_khz = min_dcfclk_khz;
-	clk_ranges.wm_dmif_clocks_ranges[1].wm_max_dcfclk_clk_in_khz = nom_dcfclk_khz - 1;
-	clk_ranges.wm_dmif_clocks_ranges[1].wm_min_memg_clk_in_khz = nom_fclk_khz;
-	clk_ranges.wm_dmif_clocks_ranges[1].wm_max_mem_clk_in_khz = max_fclk_khz;
+	clk_ranges.wm_dmif_clocks_ranges[1].wm_min_dcfclk_clk_in_khz = min_fclk_khz;
+	clk_ranges.wm_dmif_clocks_ranges[1].wm_max_dcfclk_clk_in_khz = max_dcfclk_khz;
+	clk_ranges.wm_dmif_clocks_ranges[1].wm_min_memg_clk_in_khz = mid_fclk_khz;
+	clk_ranges.wm_dmif_clocks_ranges[1].wm_max_mem_clk_in_khz = mid_fclk_khz;
 	clk_ranges.wm_mcif_clocks_ranges[1].wm_set_id = WM_SET_B;
 	clk_ranges.wm_mcif_clocks_ranges[1].wm_min_socclk_clk_in_khz = socclk_khz;
 	clk_ranges.wm_mcif_clocks_ranges[1].wm_max_socclk_clk_in_khz = overdrive;
-	clk_ranges.wm_mcif_clocks_ranges[1].wm_min_memg_clk_in_khz = nom_fclk_khz;
-	clk_ranges.wm_mcif_clocks_ranges[1].wm_max_mem_clk_in_khz = max_fclk_khz;
+	clk_ranges.wm_mcif_clocks_ranges[1].wm_min_memg_clk_in_khz = mid_fclk_khz;
+	clk_ranges.wm_mcif_clocks_ranges[1].wm_max_mem_clk_in_khz = mid_fclk_khz;
 
 
 	clk_ranges.wm_dmif_clocks_ranges[2].wm_set_id = WM_SET_C;
-	clk_ranges.wm_dmif_clocks_ranges[2].wm_min_dcfclk_clk_in_khz = nom_dcfclk_khz;
+	clk_ranges.wm_dmif_clocks_ranges[2].wm_min_dcfclk_clk_in_khz = min_fclk_khz;
 	clk_ranges.wm_dmif_clocks_ranges[2].wm_max_dcfclk_clk_in_khz = max_dcfclk_khz;
 	clk_ranges.wm_dmif_clocks_ranges[2].wm_min_memg_clk_in_khz = nom_fclk_khz;
-	clk_ranges.wm_dmif_clocks_ranges[2].wm_max_mem_clk_in_khz = max_fclk_khz;
+	clk_ranges.wm_dmif_clocks_ranges[2].wm_max_mem_clk_in_khz = nom_fclk_khz;
 	clk_ranges.wm_mcif_clocks_ranges[2].wm_set_id = WM_SET_C;
 	clk_ranges.wm_mcif_clocks_ranges[2].wm_min_socclk_clk_in_khz = socclk_khz;
 	clk_ranges.wm_mcif_clocks_ranges[2].wm_max_socclk_clk_in_khz = overdrive;
 	clk_ranges.wm_mcif_clocks_ranges[2].wm_min_memg_clk_in_khz = nom_fclk_khz;
-	clk_ranges.wm_mcif_clocks_ranges[2].wm_max_mem_clk_in_khz = max_fclk_khz;
+	clk_ranges.wm_mcif_clocks_ranges[2].wm_max_mem_clk_in_khz = nom_fclk_khz;
 
 	clk_ranges.wm_dmif_clocks_ranges[3].wm_set_id = WM_SET_D;
-	clk_ranges.wm_dmif_clocks_ranges[3].wm_min_dcfclk_clk_in_khz = max_dcfclk_khz + 1;
-	clk_ranges.wm_dmif_clocks_ranges[3].wm_max_dcfclk_clk_in_khz = overdrive;
-	clk_ranges.wm_dmif_clocks_ranges[3].wm_min_memg_clk_in_khz = max_fclk_khz + 1;
-	clk_ranges.wm_dmif_clocks_ranges[3].wm_max_mem_clk_in_khz = overdrive;
+	clk_ranges.wm_dmif_clocks_ranges[3].wm_min_dcfclk_clk_in_khz = min_fclk_khz;
+	clk_ranges.wm_dmif_clocks_ranges[3].wm_max_dcfclk_clk_in_khz = max_dcfclk_khz;
+	clk_ranges.wm_dmif_clocks_ranges[3].wm_min_memg_clk_in_khz = max_fclk_khz;
+	clk_ranges.wm_dmif_clocks_ranges[3].wm_max_mem_clk_in_khz = max_fclk_khz;
 	clk_ranges.wm_mcif_clocks_ranges[3].wm_set_id = WM_SET_D;
 	clk_ranges.wm_mcif_clocks_ranges[3].wm_min_socclk_clk_in_khz = socclk_khz;
 	clk_ranges.wm_mcif_clocks_ranges[3].wm_max_socclk_clk_in_khz = overdrive;
-	clk_ranges.wm_mcif_clocks_ranges[3].wm_min_memg_clk_in_khz = max_fclk_khz + 1;
-	clk_ranges.wm_mcif_clocks_ranges[3].wm_max_mem_clk_in_khz = overdrive;
+	clk_ranges.wm_mcif_clocks_ranges[3].wm_min_memg_clk_in_khz = max_fclk_khz;
+	clk_ranges.wm_mcif_clocks_ranges[3].wm_max_mem_clk_in_khz = max_fclk_khz;
 
 	/* Notify PP Lib/SMU which Watermarks to use for which clock ranges */
 	dm_pp_notify_wm_clock_changes_soc15(dc->ctx, &clk_ranges);
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#59 lore raw

PATCH 58/120 drm/amd/display: Fix compilation with DCN disabled

In reply to a message not in the archive

No need to guard the register defines.

Change-Id I44ed1b570307b76e09a2e7abc3ea5f963858a3b2
---
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +0 -6
index 490ca128dada..ade7507e99c7 100644
@@ -462,7 +462,6 @@ struct dce_hwseq_registers {
 	type PHYPLL_PIXEL_RATE_SOURCE; \
 	type PIXEL_RATE_PLL_SOURCE; \
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 #define HWSEQ_DCN_REG_FIELD_LIST(type) \
 	type VUPDATE_NO_LOCK_EVENT_CLEAR; \
 	type VUPDATE_NO_LOCK_EVENT_OCCURRED; \
@@ -518,20 +517,15 @@ struct dce_hwseq_registers {
 	type DCFCLK_GATE_DIS; \
 	type DCHUBBUB_GLOBAL_TIMER_REFDIV; \
 	type DENTIST_DPPCLK_WDIVIDER;
-#endif
 
 struct dce_hwseq_shift {
 	HWSEQ_REG_FIELD_LIST(uint8_t)
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	HWSEQ_DCN_REG_FIELD_LIST(uint8_t)
-#endif
 };
 
 struct dce_hwseq_mask {
 	HWSEQ_REG_FIELD_LIST(uint32_t)
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	HWSEQ_DCN_REG_FIELD_LIST(uint32_t)
-#endif
 };
 
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#60 lore raw

PATCH 59/120 drm/amd/display: Rename firmware_info to dc_firmware_info

In reply to a message not in the archive

This is to avoid conflicts with amdgpu's firmware_info once we merge amdgpu_dm_types with amdgpu_dm.

Change-Id I0b33ffcf0ab7885e61eaae9aaec1f4239f2a3e92
---
 drivers/gpu/drm/amd/display/dc/bios/bios_parser.c          | 14 +++++++-------
 drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c         |  8 ++++----
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c          |  2 +-
 drivers/gpu/drm/amd/display/dc/dc_bios_types.h             |  2 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c      |  4 ++--
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c            |  2 +-
 drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c    |  2 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c    |  2 +-
 drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c      |  2 +-
 drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c             |  2 +-
 .../gpu/drm/amd/display/include/grph_object_ctrl_defs.h    |  2 +-
 11 files changed, 21 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +7 -7
index 47a467688073..2c683d468bb8 100644
@@ -622,17 +622,17 @@ static enum bp_result bios_parser_get_device_tag(
 
 static enum bp_result get_firmware_info_v1_4(
 	struct bios_parser *bp,
-	struct firmware_info *info);
+	struct dc_firmware_info *info);
 static enum bp_result get_firmware_info_v2_1(
 	struct bios_parser *bp,
-	struct firmware_info *info);
+	struct dc_firmware_info *info);
 static enum bp_result get_firmware_info_v2_2(
 	struct bios_parser *bp,
-	struct firmware_info *info);
+	struct dc_firmware_info *info);
 
 static enum bp_result bios_parser_get_firmware_info(
 	struct dc_bios *dcb,
-	struct firmware_info *info)
+	struct dc_firmware_info *info)
 {
 	struct bios_parser *bp = BP_FROM_DCB(dcb);
 	enum bp_result result = BP_RESULT_BADBIOSTABLE;
@@ -676,7 +676,7 @@ static enum bp_result bios_parser_get_firmware_info(
 
 static enum bp_result get_firmware_info_v1_4(
 	struct bios_parser *bp,
-	struct firmware_info *info)
+	struct dc_firmware_info *info)
 {
 	ATOM_FIRMWARE_INFO_V1_4 *firmware_info =
 		GET_IMAGE(ATOM_FIRMWARE_INFO_V1_4,
@@ -726,7 +726,7 @@ static enum bp_result get_ss_info_v3_1(
 
 static enum bp_result get_firmware_info_v2_1(
 	struct bios_parser *bp,
-	struct firmware_info *info)
+	struct dc_firmware_info *info)
 {
 	ATOM_FIRMWARE_INFO_V2_1 *firmwareInfo =
 		GET_IMAGE(ATOM_FIRMWARE_INFO_V2_1, DATA_TABLES(FirmwareInfo));
@@ -810,7 +810,7 @@ static enum bp_result get_firmware_info_v2_1(
 
 static enum bp_result get_firmware_info_v2_2(
 	struct bios_parser *bp,
-	struct firmware_info *info)
+	struct dc_firmware_info *info)
 {
 	ATOM_FIRMWARE_INFO_V2_2 *firmware_info;
 	struct spread_spectrum_info internal_ss;
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +4 -4
index 3a69f9c5d20a..86fce5ae5856 100644
@@ -81,7 +81,7 @@ static enum bp_result get_gpio_i2c_info(struct bios_parser *bp,
 
 static enum bp_result bios_parser_get_firmware_info(
 	struct dc_bios *dcb,
-	struct firmware_info *info);
+	struct dc_firmware_info *info);
 
 static enum bp_result bios_parser_get_encoder_cap_info(
 	struct dc_bios *dcb,
@@ -90,7 +90,7 @@ static enum bp_result bios_parser_get_encoder_cap_info(
 
 static enum bp_result get_firmware_info_v3_1(
 	struct bios_parser *bp,
-	struct firmware_info *info);
+	struct dc_firmware_info *info);
 
 static struct atom_hpd_int_record *get_hpd_record(struct bios_parser *bp,
 		struct atom_display_object_path_v2 *object);
@@ -1583,7 +1583,7 @@ static void bios_parser_set_scratch_critical_state(
 
 static enum bp_result bios_parser_get_firmware_info(
 	struct dc_bios *dcb,
-	struct firmware_info *info)
+	struct dc_firmware_info *info)
 {
 	struct bios_parser *bp = BP_FROM_DCB(dcb);
 	enum bp_result result = BP_RESULT_BADBIOSTABLE;
@@ -1615,7 +1615,7 @@ static enum bp_result bios_parser_get_firmware_info(
 
 static enum bp_result get_firmware_info_v3_1(
 	struct bios_parser *bp,
-	struct firmware_info *info)
+	struct dc_firmware_info *info)
 {
 	struct atom_firmware_info_v3_1 *firmware_info;
 	struct atom_display_controller_info_v4_1 *dce_info = NULL;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index a4b80a3a0bad..36cd077ba2f5 100644
@@ -126,7 +126,7 @@ struct resource_pool *dc_create_resource_pool(
 		break;
 	}
 	if (res_pool != NULL) {
-		struct firmware_info fw_info = { { 0 } };
+		struct dc_firmware_info fw_info = { { 0 } };
 
 		if (dc->ctx->dc_bios->funcs->get_firmware_info(
 				dc->ctx->dc_bios, &fw_info) == BP_RESULT_OK) {
drivers/gpu/drm/amd/display/dc/dc_bios_types.h +1 -1
index 6e1291d5f51d..273d80a4ebce 100644
@@ -84,7 +84,7 @@ struct dc_vbios_funcs {
 		struct connector_device_tag_info *info);
 	enum bp_result (*get_firmware_info)(
 		struct dc_bios *bios,
-		struct firmware_info *info);
+		struct dc_firmware_info *info);
 	enum bp_result (*get_spread_spectrum_info)(
 		struct dc_bios *bios,
 		enum as_signal_type signal,
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +2 -2
index 2205491c83e9..dd7e1dd62636 100644
@@ -1103,7 +1103,7 @@ static bool calc_pll_max_vco_construct(
 			struct calc_pll_clock_source_init_data *init_data)
 {
 	uint32_t i;
-	struct firmware_info fw_info = { { 0 } };
+	struct dc_firmware_info fw_info = { { 0 } };
 	if (calc_pll_cs == NULL ||
 			init_data == NULL ||
 			init_data->bp == NULL)
@@ -1185,7 +1185,7 @@ bool dce110_clk_src_construct(
 	const struct dce110_clk_src_shift *cs_shift,
 	const struct dce110_clk_src_mask *cs_mask)
 {
-	struct firmware_info fw_info = { { 0 } };
+	struct dc_firmware_info fw_info = { { 0 } };
 	struct calc_pll_clock_source_init_data calc_pll_cs_init_data_hdmi;
 	struct calc_pll_clock_source_init_data calc_pll_cs_init_data;
 
drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c +1 -1
index 37d074f595fb..a73228b97da5 100644
@@ -424,7 +424,7 @@ static void dce_clock_read_integrated_info(struct dce_disp_clk *clk_dce)
 	struct dc_debug *debug = &clk_dce->base.ctx->dc->debug;
 	struct dc_bios *bp = clk_dce->base.ctx->dc_bios;
 	struct integrated_info info = { { { 0 } } };
-	struct firmware_info fw_info = { { 0 } };
+	struct dc_firmware_info fw_info = { { 0 } };
 	int i;
 
 	if (bp->integrated_info)
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +1 -1
index cf98f2471023..9ac246f05110 100644
@@ -819,7 +819,7 @@ static bool construct(
 {
 	unsigned int i;
 	struct dc_context *ctx = dc->ctx;
-	struct firmware_info info;
+	struct dc_firmware_info info;
 	struct dc_bios *bp;
 	struct dm_pp_static_clock_info static_clk_info = {0};
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 -1
index cc25c4b6c06f..5c1790b61290 100644
@@ -1190,7 +1190,7 @@ static bool construct(
 {
 	unsigned int i;
 	struct dc_context *ctx = dc->ctx;
-	struct firmware_info info;
+	struct dc_firmware_info info;
 	struct dc_bios *bp;
 	struct dm_pp_static_clock_info static_clk_info = {0};
 
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +1 -1
index 2fde43c91ad0..92f01ed97621 100644
@@ -833,7 +833,7 @@ static bool construct(
 {
 	unsigned int i;
 	struct dc_context *ctx = dc->ctx;
-	struct firmware_info info;
+	struct dc_firmware_info info;
 	struct dc_bios *bp;
 	struct dm_pp_static_clock_info static_clk_info = {0};
 
drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c +1 -1
index 10061cc4ba31..da08cc1c6dc3 100644
@@ -320,7 +320,7 @@ void dal_i2caux_destroy(
 uint32_t dal_i2caux_get_reference_clock(
 		struct dc_bios *bios)
 {
-	struct firmware_info info = { { 0 } };
+	struct dc_firmware_info info = { { 0 } };
 
 	if (bios->funcs->get_firmware_info(bios, &info) != BP_RESULT_OK)
 		return 0;
drivers/gpu/drm/amd/display/include/grph_object_ctrl_defs.h +1 -1
index 9c0bf6521dd9..6cdbf84f34e6 100644
@@ -154,7 +154,7 @@ struct embedded_panel_info {
 	bool realtek_eDPToLVDS;
 };
 
-struct firmware_info {
+struct dc_firmware_info {
 	struct pll_info {
 		uint32_t crystal_frequency; /* in KHz */
 		uint32_t min_input_pxl_clk_pll_frequency; /* in KHz */
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#61 lore raw

PATCH 60/120 drm/amd/display: Merge amdgpu_dm_types and amdgpu_dm

In reply to a message not in the archive

This separation stopped making sense a long time ago.

Change-Id I518e69e8cce2a24b580f6bdd38ccabbf837e8998
---
 drivers/gpu/drm/amd/display/amdgpu_dm/Makefile     |    2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  | 3414 ++++++++++++++++++-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h  |  108 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c  |    1 -
 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |    2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_services.c |    1 -
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 3455 --------------------
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h    |  135 -
 8 files changed, 3519 insertions(+), 3599 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
 delete mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h
drivers/gpu/drm/amd/display/amdgpu_dm/Makefile +1 -1
index 698b1d4f83f5..4699e47aa76b 100644
@@ -4,7 +4,7 @@
 
 
 
-AMDGPUDM = amdgpu_dm_types.o amdgpu_dm.o amdgpu_dm_irq.o amdgpu_dm_mst_types.o
+AMDGPUDM = amdgpu_dm.o amdgpu_dm_irq.o amdgpu_dm_mst_types.o
 
 ifneq ($(CONFIG_DRM_AMD_DC),)
 AMDGPUDM += amdgpu_dm_services.o amdgpu_dm_helpers.o
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3412 -2

2,992 lines not on this page · raw message

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +105 -3

108 lines not on this page · raw message

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +0 -1
index 6c19a07709df..0a615583de63 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1 -1
index 3349489d7991..3ce087f4e0ef 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c +0 -1
index a8a53b85905a..3348e90a0a37 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c deleted +0 -3455

3,455 lines not on this page · raw message

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h deleted +0 -135

135 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Part of the diff is not shown here. View the raw message.

#62 lore raw

PATCH 61/120 drm/amd/display: Fix ckeckpatch problems in amdgpu_dm

In reply to a message not in the archive
Change-Id I08cba4d9c1c62cb52c5f7a2ade581a40eb3ced81
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 179 ++++++++++++----------
 1 file changed, 94 insertions(+), 85 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +94 -85
index 986a96b768fa..fd26304a86f1 100644
@@ -1687,14 +1687,13 @@ static int dm_crtc_cursor_set(
 	int ret;
 
 	struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
-	ret		= EINVAL;
+	ret = EINVAL;
 
-	DRM_DEBUG_KMS(
-		"%s: crtc_id=%d with size %d to %d \n",
-		__func__,
-		amdgpu_crtc->crtc_id,
-		width,
-		height);
+	DRM_DEBUG_KMS("%s: crtc_id=%d with size %d to %d \n",
+		      __func__,
+		      amdgpu_crtc->crtc_id,
+		      width,
+		      height);
 
 	if (!address) {
 		/* turn off cursor */
@@ -1844,6 +1843,7 @@ static int get_fb_info(
 {
 	struct amdgpu_bo *rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
 	int r = amdgpu_bo_reserve(rbo, false);
+
 	if (unlikely(r)) {
 		DRM_ERROR("Unable to reserve buffer\n");
 		return r;
@@ -1951,10 +1951,9 @@ static int fill_plane_attributes_from_fb(
 
 	memset(&surface->tiling_info, 0, sizeof(surface->tiling_info));
 
-	/* Fill GFX params */
-	if (AMDGPU_TILING_GET(tiling_flags, ARRAY_MODE) == DC_ARRAY_2D_TILED_THIN1)
-	{
-		unsigned bankw, bankh, mtaspect, tile_split, num_banks;
+	/* Fill GFX8 params */
+	if (AMDGPU_TILING_GET(tiling_flags, ARRAY_MODE) == DC_ARRAY_2D_TILED_THIN1) {
+		unsigned int bankw, bankh, mtaspect, tile_split, num_banks;
 
 		bankw = AMDGPU_TILING_GET(tiling_flags, BANK_WIDTH);
 		bankh = AMDGPU_TILING_GET(tiling_flags, BANK_HEIGHT);
@@ -2167,7 +2166,8 @@ static enum dc_color_depth convert_color_depth_from_display_info(
 	uint32_t bpc = connector->display_info.bpc;
 
 	/* Limited color depth to 8bit
-	 * TODO: Still need to handle deep color*/
+	 * TODO: Still need to handle deep color
+	 */
 	if (bpc > 8)
 		bpc = 8;
 
@@ -2200,6 +2200,7 @@ static enum dc_aspect_ratio get_aspect_ratio(
 {
 	int32_t width = mode_in->crtc_hdisplay * 9;
 	int32_t height = mode_in->crtc_vdisplay * 16;
+
 	if ((width - height) < 10 && (width - height) > -10)
 		return ASPECT_RATIO_16_9;
 	else
@@ -2257,6 +2258,7 @@ static void fill_stream_properties_from_drm_display_mode(
 	const struct drm_connector *connector)
 {
 	struct dc_crtc_timing *timing_out = &stream->timing;
+
 	memset(timing_out, 0, sizeof(struct dc_crtc_timing));
 
 	timing_out->h_border_left = 0;
@@ -2301,6 +2303,7 @@ static void fill_stream_properties_from_drm_display_mode(
 
 	{
 		struct dc_transfer_func *tf = dc_create_transfer_func();
+
 		tf->type = TF_TYPE_PREDEFINED;
 		tf->tf = TRANSFER_FUNCTION_SRGB;
 		stream->out_transfer_func = tf;
@@ -2327,7 +2330,7 @@ static void fill_audio_info(
 		i++;
 	}
 
-	if(cea_revision >= 3) {
+	if (cea_revision >= 3) {
 		audio_info->mode_count = edid_caps->audio_mode_count;
 
 		for (i = 0; i < audio_info->mode_count; ++i) {
@@ -2346,7 +2349,7 @@ static void fill_audio_info(
 	audio_info->flags.all = edid_caps->speaker_flags;
 
 	/* TODO: We only check for the progressive mode, check for interlace mode too */
-	if(drm_connector->latency_present[0]) {
+	if (drm_connector->latency_present[0]) {
 		audio_info->video_latency = drm_connector->video_latency[0];
 		audio_info->audio_latency = drm_connector->audio_latency[0];
 	}
@@ -2364,7 +2367,7 @@ static void copy_crtc_timing_for_drm_display_mode(
 	dst_mode->crtc_clock = src_mode->crtc_clock;
 	dst_mode->crtc_hblank_start = src_mode->crtc_hblank_start;
 	dst_mode->crtc_hblank_end = src_mode->crtc_hblank_end;
-	dst_mode->crtc_hsync_start=  src_mode->crtc_hsync_start;
+	dst_mode->crtc_hsync_start =  src_mode->crtc_hsync_start;
 	dst_mode->crtc_hsync_end = src_mode->crtc_hsync_end;
 	dst_mode->crtc_htotal = src_mode->crtc_htotal;
 	dst_mode->crtc_hskew = src_mode->crtc_hskew;
@@ -2402,12 +2405,12 @@ static struct dc_stream *create_stream_for_sink(
 	struct drm_display_mode mode = *drm_mode;
 	bool native_mode_found = false;
 
-	if (NULL == aconnector) {
+	if (aconnector == NULL) {
 		DRM_ERROR("aconnector is NULL!\n");
 		goto drm_connector_null;
 	}
 
-	if (NULL == dm_state) {
+	if (dm_state == NULL) {
 		DRM_ERROR("dm_state is NULL!\n");
 		goto dm_state_null;
 	}
@@ -2415,7 +2418,7 @@ static struct dc_stream *create_stream_for_sink(
 	drm_connector = &aconnector->base;
 	stream = dc_create_stream_for_sink(aconnector->dc_sink);
 
-	if (NULL == stream) {
+	if (stream == NULL) {
 		DRM_ERROR("Failed to create stream for sink!\n");
 		goto stream_create_fail;
 	}
@@ -2433,7 +2436,7 @@ static struct dc_stream *create_stream_for_sink(
 				struct drm_display_mode,
 				head);
 
-	if (NULL == preferred_mode) {
+	if (preferred_mode == NULL) {
 		/* This may not be an error, the use case is when we we have no
 		 * usermode calls to reset and set mode upon hotplug. In this
 		 * case, we call set mode ourselves to restore the previous mode
@@ -2967,13 +2970,13 @@ int amdgpu_dm_connector_mode_valid(
 
 	dc_sink = to_amdgpu_connector(connector)->dc_sink;
 
-	if (NULL == dc_sink) {
+	if (dc_sink == NULL) {
 		DRM_ERROR("dc_sink is NULL!\n");
 		goto fail;
 	}
 
 	stream = dc_create_stream_for_sink(dc_sink);
-	if (NULL == stream) {
+	if (stream == NULL) {
 		DRM_ERROR("Failed to create stream for sink!\n");
 		goto fail;
 	}
@@ -2998,11 +3001,11 @@ int amdgpu_dm_connector_mode_valid(
 static const struct drm_connector_helper_funcs
 amdgpu_dm_connector_helper_funcs = {
 	/*
-	* If hotplug a second bigger display in FB Con mode, bigger resolution
-	* modes will be filtered by drm_mode_validate_size(), and those modes
-	* is missing after user start lightdm. So we need to renew modes list.
-	* in get_modes call back, not just return the modes count
-	*/
+	 * If hotplug a second bigger display in FB Con mode, bigger resolution
+	 * modes will be filtered by drm_mode_validate_size(), and those modes
+	 * is missing after user start lightdm. So we need to renew modes list.
+	 * in get_modes call back, not just return the modes count
+	 */
 	.get_modes = get_modes,
 	.mode_valid = amdgpu_dm_connector_mode_valid,
 	.best_encoder = best_encoder
@@ -3214,11 +3217,11 @@ static void dm_plane_helper_cleanup_fb(
 	if (unlikely(r)) {
 		DRM_ERROR("failed to reserve rbo before unpin\n");
 		return;
-	} else {
-		amdgpu_bo_unpin(rbo);
-		amdgpu_bo_unreserve(rbo);
-		amdgpu_bo_unref(&rbo);
-	};
+	}
+
+	amdgpu_bo_unpin(rbo);
+	amdgpu_bo_unreserve(rbo);
+	amdgpu_bo_unref(&rbo);
 }
 
 int dm_create_validation_set_for_connector(struct drm_connector *connector,
@@ -3234,14 +3237,14 @@ int dm_create_validation_set_for_connector(struct drm_connector *connector,
 			(mode->flags & DRM_MODE_FLAG_DBLSCAN))
 		return result;
 
-	if (NULL == dc_sink) {
+	if (dc_sink == NULL) {
 		DRM_ERROR("dc_sink is NULL!\n");
 		return result;
 	}
 
 	stream = dc_create_stream_for_sink(dc_sink);
 
-	if (NULL == stream) {
+	if (stream == NULL) {
 		DRM_ERROR("Failed to create stream for sink!\n");
 		return result;
 	}
@@ -3380,10 +3383,8 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
 	return 0;
 
 fail:
-	if (acrtc)
-		kfree(acrtc);
-	if (cursor_plane)
-		kfree(cursor_plane);
+	kfree(acrtc);
+	kfree(cursor_plane);
 	acrtc->crtc_id = -1;
 	return res;
 }
@@ -3430,12 +3431,13 @@ static void amdgpu_dm_get_native_mode(struct drm_connector *connector)
 
 	if (!list_empty(&connector->probed_modes)) {
 		struct drm_display_mode *preferred_mode = NULL;
+
 		list_for_each_entry(preferred_mode,
-				&connector->probed_modes,
-				head) {
-		if (preferred_mode->type & DRM_MODE_TYPE_PREFERRED) {
-			amdgpu_encoder->native_mode = *preferred_mode;
-		}
+				    &connector->probed_modes,
+				    head) {
+			if (preferred_mode->type & DRM_MODE_TYPE_PREFERRED)
+				amdgpu_encoder->native_mode = *preferred_mode;
+
 			break;
 		}
 
@@ -3453,7 +3455,7 @@ static struct drm_display_mode *amdgpu_dm_create_common_mode(
 
 	mode = drm_mode_duplicate(dev, native_mode);
 
-	if(mode == NULL)
+	if (mode == NULL)
 		return NULL;
 
 	mode->hdisplay = hdisplay;
@@ -3479,7 +3481,7 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder,
 		char name[DRM_DISPLAY_MODE_LEN];
 		int w;
 		int h;
-	}common_modes[] = {
+	} common_modes[] = {
 		{  "640x480",  640,  480},
 		{  "800x600",  800,  600},
 		{ "1024x768", 1024,  768},
@@ -3493,21 +3495,21 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder,
 		{"1920x1200", 1920, 1200}
 	};
 
-	n = sizeof(common_modes) / sizeof(common_modes[0]);
+	n = ARRAY_SIZE(common_modes);
 
 	for (i = 0; i < n; i++) {
 		struct drm_display_mode *curmode = NULL;
 		bool mode_existed = false;
 
 		if (common_modes[i].w > native_mode->hdisplay ||
-			common_modes[i].h > native_mode->vdisplay ||
-			(common_modes[i].w == native_mode->hdisplay &&
-			common_modes[i].h == native_mode->vdisplay))
-				continue;
+		    common_modes[i].h > native_mode->vdisplay ||
+		   (common_modes[i].w == native_mode->hdisplay &&
+		    common_modes[i].h == native_mode->vdisplay))
+			continue;
 
 		list_for_each_entry(curmode, &connector->probed_modes, head) {
 			if (common_modes[i].w == curmode->hdisplay &&
-				common_modes[i].h == curmode->vdisplay) {
+			    common_modes[i].h == curmode->vdisplay) {
 				mode_existed = true;
 				break;
 			}
@@ -3579,8 +3581,9 @@ void amdgpu_dm_connector_init_helper(
 
 	mutex_init(&aconnector->hpd_lock);
 
-	/*configure suport HPD hot plug connector_>polled default value is 0
-	 * which means HPD hot plug not supported*/
+	/* configure support HPD hot plug connector_>polled default value is 0
+	 * which means HPD hot plug not supported
+	 */
 	switch (connector_type) {
 	case DRM_MODE_CONNECTOR_HDMIA:
 		aconnector->base.polled = DRM_CONNECTOR_POLL_HPD;
@@ -3628,7 +3631,7 @@ int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,
 	int i;
 	int result = -EIO;
 
-	cmd.payloads = kzalloc(num * sizeof(struct i2c_payload), GFP_KERNEL);
+	cmd.payloads = kcalloc(num, sizeof(struct i2c_payload), GFP_KERNEL);
 
 	if (!cmd.payloads)
 		return result;
@@ -3672,12 +3675,12 @@ static struct amdgpu_i2c_adapter *create_i2c(
 	struct amdgpu_device *adev = ddc_service->ctx->driver_context;
 	struct amdgpu_i2c_adapter *i2c;
 
-	i2c = kzalloc(sizeof (struct amdgpu_i2c_adapter), GFP_KERNEL);
+	i2c = kzalloc(sizeof(struct amdgpu_i2c_adapter), GFP_KERNEL);
 	i2c->base.owner = THIS_MODULE;
 	i2c->base.class = I2C_CLASS_DDC;
 	i2c->base.dev.parent = &adev->pdev->dev;
 	i2c->base.algo = &amdgpu_dm_i2c_algo;
-	snprintf(i2c->base.name, sizeof (i2c->base.name), "AMDGPU DM i2c hw bus %d", link_index);
+	snprintf(i2c->base.name, sizeof(i2c->base.name), "AMDGPU DM i2c hw bus %d", link_index);
 	i2c_set_adapdata(&i2c->base, i2c);
 	i2c->ddc_service = ddc_service;
 
@@ -3685,7 +3688,8 @@ static struct amdgpu_i2c_adapter *create_i2c(
 }
 
 /* Note: this function assumes that dc_link_detect() was called for the
- * dc_link which will be represented by this aconnector. */
+ * dc_link which will be represented by this aconnector.
+ */
 int amdgpu_dm_connector_init(
 	struct amdgpu_display_manager *dm,
 	struct amdgpu_connector *aconnector,
@@ -3757,7 +3761,8 @@ int amdgpu_dm_connector_init(
 	if (link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) {
 		/* Event if registration failed, we should continue with
 		 * DM initialization because not having a backlight control
-		 * is better then a black screen. */
+		 * is better then a black screen.
+		 */
 		amdgpu_dm_register_backlight_device(dm);
 
 		if (dm->backlight_dev)
@@ -3859,9 +3864,9 @@ static bool is_scaling_state_different(
 	} else  if (dm_state->underscan_enable && !old_dm_state->underscan_enable) {
 		if (dm_state->underscan_hborder != 0 && dm_state->underscan_vborder != 0)
 			return true;
-	} else if (dm_state->underscan_hborder != old_dm_state->underscan_hborder
-				|| dm_state->underscan_vborder != old_dm_state->underscan_vborder)
-			return true;
+	} else if (dm_state->underscan_hborder != old_dm_state->underscan_hborder ||
+		   dm_state->underscan_vborder != old_dm_state->underscan_vborder)
+		return true;
 	return false;
 }
 
@@ -3952,11 +3957,11 @@ static void amdgpu_dm_do_flip(
 	target_vblank = target - drm_crtc_vblank_count(crtc) +
 			amdgpu_get_vblank_counter_kms(crtc->dev, acrtc->crtc_id);
 
-	/*TODO This might fail and hence better not used, wait
+	/* TODO This might fail and hence better not used, wait
 	 * explicitly on fences instead
 	 * and in general should be called for
 	 * blocking commit to as per framework helpers
-	 * */
+	 */
 	r = amdgpu_bo_reserve(abo, true);
 	if (unlikely(r != 0)) {
 		DRM_ERROR("failed to reserve buffer before flip\n");
@@ -4055,7 +4060,7 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
 			DRM_ERROR("add_surface: acrtc %d, already busy\n",
 					acrtc_attach->crtc_id);
 			spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
-			/* In comit tail framework this cannot happen */
+			/* In commit tail framework this cannot happen */
 			WARN_ON(1);
 		}
 		spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
@@ -4174,6 +4179,7 @@ void amdgpu_dm_atomic_commit_tail(
 	for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
 		struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
 		struct drm_crtc_state *new_state = crtc->state;
+
 		new_acrtc_state = to_dm_crtc_state(new_state);
 		old_acrtc_state = to_dm_crtc_state(old_crtc_state);
 
@@ -4199,20 +4205,20 @@ void amdgpu_dm_atomic_commit_tail(
 
 			if (!new_acrtc_state->stream) {
 				/*
-				* this could happen because of issues with
-				* userspace notifications delivery.
-				* In this case userspace tries to set mode on
-				* display which is disconnect in fact.
-				* dc_sink in NULL in this case on aconnector.
-				* We expect reset mode will come soon.
-				*
-				* This can also happen when unplug is done
-				* during resume sequence ended
-				*
-				* In this case, we want to pretend we still
-				* have a sink to keep the pipe running so that
-				* hw state is consistent with the sw state
-				*/
+				 * this could happen because of issues with
+				 * userspace notifications delivery.
+				 * In this case userspace tries to set mode on
+				 * display which is disconnect in fact.
+				 * dc_sink in NULL in this case on aconnector.
+				 * We expect reset mode will come soon.
+				 *
+				 * This can also happen when unplug is done
+				 * during resume sequence ended
+				 *
+				 * In this case, we want to pretend we still
+				 * have a sink to keep the pipe running so that
+				 * hw state is consistent with the sw state
+				 */
 				DRM_DEBUG_KMS("%s: Failed to create new stream for crtc %d\n",
 						__func__, acrtc->base.base.id);
 				continue;
@@ -4255,6 +4261,7 @@ void amdgpu_dm_atomic_commit_tail(
 	if (adev->dm.freesync_module) {
 		for (i = 0; i < new_crtcs_count; i++) {
 			struct amdgpu_connector *aconnector = NULL;
+
 			new_acrtc_state = to_dm_crtc_state(new_crtcs[i]->base.state);
 
 			new_stream = new_acrtc_state->stream;
@@ -4264,10 +4271,9 @@ void amdgpu_dm_atomic_commit_tail(
 					&new_crtcs[i]->base,
 					false);
 			if (!aconnector) {
-				DRM_INFO(
-						"Atomic commit: Failed to find connector for acrtc id:%d "
-						"skipping freesync init\n",
-						new_crtcs[i]->crtc_id);
+				DRM_INFO("Atomic commit: Failed to find connector for acrtc id:%d "
+					 "skipping freesync init\n",
+					 new_crtcs[i]->crtc_id);
 				continue;
 			}
 
@@ -4282,6 +4288,7 @@ void amdgpu_dm_atomic_commit_tail(
 
 	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
 		struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
+
 		new_acrtc_state = to_dm_crtc_state(crtc->state);
 
 		if (new_acrtc_state->stream != NULL) {
@@ -4339,6 +4346,7 @@ void amdgpu_dm_atomic_commit_tail(
 		 * loop to enable interrupts on newly arrived crtc
 		 */
 		struct amdgpu_crtc *acrtc = new_crtcs[i];
+
 		new_acrtc_state = to_dm_crtc_state(acrtc->base.state);
 
 		if (adev->dm.freesync_module)
@@ -4533,9 +4541,8 @@ static uint32_t remove_from_val_sets(
 
 	set_count--;
 
-	for (; i < set_count; i++) {
+	for (; i < set_count; i++)
 		val_sets[i] = val_sets[i + 1];
-	}
 
 	return set_count;
 }
@@ -4582,7 +4589,7 @@ static int do_aquire_global_lock(
 
 		if (ret == 0)
 			DRM_ERROR("[CRTC:%d:%s] hw_done or flip_done "
-					"timed out\n", crtc->base.id, crtc->name);
+				  "timed out\n", crtc->base.id, crtc->name);
 
 		drm_crtc_commit_put(commit);
 	}
@@ -4641,6 +4648,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {
 		struct amdgpu_crtc *acrtc = NULL;
 		struct amdgpu_connector *aconnector = NULL;
+
 		old_acrtc_state = to_dm_crtc_state(crtc->state);
 		new_acrtc_state = to_dm_crtc_state(crtc_state);
 		acrtc = to_amdgpu_crtc(crtc);
@@ -4749,7 +4757,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 		if (!acrtc || drm_atomic_crtc_needs_modeset(acrtc->base.state))
 			continue;
 
-		/* Skip any thing not scale or underscan chnages */
+		/* Skip any thing not scale or underscan changes */
 		if (!is_scaling_state_different(con_new_state, con_old_state))
 			continue;
 
@@ -4882,6 +4890,7 @@ void amdgpu_dm_add_sink_to_freesync_module(
 
 	struct drm_device *dev = connector->dev;
 	struct amdgpu_device *adev = dev->dev_private;
+
 	edid_check_required = false;
 	if (!amdgpu_connector->dc_sink) {
 		DRM_ERROR("dc_sink NULL, could not add free_sync module.\n");
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#63 lore raw

PATCH 62/120 drm/amd/display: move ocsc programming from opp to dpp for dce

In reply to a message not in the archive

From: Yue Hin Lau <[email protected]>

Change-Id Id843457078b1ef1d0971a6589e4ca8a0efac7761
---
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.c       | 201 +-------------------
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.h       |  31 ---
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 210 +++++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.h |  30 +++
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  35 +++-
 .../drm/amd/display/dc/dce110/dce110_opp_csc_v.c   |  45 +++--
 .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.c   |   2 -
 .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.h   |   6 -
 .../drm/amd/display/dc/dce110/dce110_transform_v.c |   2 +
 .../drm/amd/display/dc/dce110/dce110_transform_v.h |   7 +
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h        |   7 +-
 11 files changed, 306 insertions(+), 270 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_opp.c +2 -199
index f716a9e8784e..7abf252369fb 100644
@@ -55,31 +55,9 @@ enum {
 	OUTPUT_CSC_MATRIX_SIZE = 12
 };
 
-static const struct out_csc_color_matrix global_color_matrix[] = {
-{ COLOR_SPACE_SRGB,
-	{ 0x2000, 0, 0, 0, 0, 0x2000, 0, 0, 0, 0, 0x2000, 0} },
-{ COLOR_SPACE_SRGB_LIMITED,
-	{ 0x1B60, 0, 0, 0x200, 0, 0x1B60, 0, 0x200, 0, 0, 0x1B60, 0x200} },
-{ COLOR_SPACE_YCBCR601,
-	{ 0xE00, 0xF447, 0xFDB9, 0x1000, 0x82F, 0x1012, 0x31F, 0x200, 0xFB47,
-		0xF6B9, 0xE00, 0x1000} },
-{ COLOR_SPACE_YCBCR709, { 0xE00, 0xF349, 0xFEB7, 0x1000, 0x5D2, 0x1394, 0x1FA,
-	0x200, 0xFCCB, 0xF535, 0xE00, 0x1000} },
-/* TODO: correct values below */
-{ COLOR_SPACE_YCBCR601_LIMITED, { 0xE00, 0xF447, 0xFDB9, 0x1000, 0x991,
-	0x12C9, 0x3A6, 0x200, 0xFB47, 0xF6B9, 0xE00, 0x1000} },
-{ COLOR_SPACE_YCBCR709_LIMITED, { 0xE00, 0xF349, 0xFEB7, 0x1000, 0x6CE, 0x16E3,
-	0x24F, 0x200, 0xFCCB, 0xF535, 0xE00, 0x1000} }
-};
 
-enum csc_color_mode {
-	/* 00 - BITS2:0 Bypass */
-	CSC_COLOR_MODE_GRAPHICS_BYPASS,
-	/* 01 - hard coded coefficient TV RGB */
-	CSC_COLOR_MODE_GRAPHICS_PREDEFINED,
-	/* 04 - programmable OUTPUT CSC coefficient */
-	CSC_COLOR_MODE_GRAPHICS_OUTPUT_CSC,
-};
+
+
 
 
 
@@ -781,181 +759,8 @@ void dce110_opp_program_fmt(
 	return;
 }
 
-static void program_color_matrix(
-	struct dce110_opp *opp110,
-	const struct out_csc_color_matrix *tbl_entry,
-	enum grph_color_adjust_option options)
-{
-	{
-		REG_SET_2(OUTPUT_CSC_C11_C12, 0,
-			OUTPUT_CSC_C11, tbl_entry->regval[0],
-			OUTPUT_CSC_C12, tbl_entry->regval[1]);
-	}
-	{
-		REG_SET_2(OUTPUT_CSC_C13_C14, 0,
-			OUTPUT_CSC_C11, tbl_entry->regval[2],
-			OUTPUT_CSC_C12, tbl_entry->regval[3]);
-	}
-	{
-		REG_SET_2(OUTPUT_CSC_C21_C22, 0,
-			OUTPUT_CSC_C11, tbl_entry->regval[4],
-			OUTPUT_CSC_C12, tbl_entry->regval[5]);
-	}
-	{
-		REG_SET_2(OUTPUT_CSC_C23_C24, 0,
-			OUTPUT_CSC_C11, tbl_entry->regval[6],
-			OUTPUT_CSC_C12, tbl_entry->regval[7]);
-	}
-	{
-		REG_SET_2(OUTPUT_CSC_C31_C32, 0,
-			OUTPUT_CSC_C11, tbl_entry->regval[8],
-			OUTPUT_CSC_C12, tbl_entry->regval[9]);
-	}
-	{
-		REG_SET_2(OUTPUT_CSC_C33_C34, 0,
-			OUTPUT_CSC_C11, tbl_entry->regval[10],
-			OUTPUT_CSC_C12, tbl_entry->regval[11]);
-	}
-}
 
-static bool configure_graphics_mode(
-	struct dce110_opp *opp110,
-	enum csc_color_mode config,
-	enum graphics_csc_adjust_type csc_adjust_type,
-	enum dc_color_space color_space)
-{
-	REG_SET(OUTPUT_CSC_CONTROL, 0,
-		OUTPUT_CSC_GRPH_MODE, 0);
 
-	if (csc_adjust_type == GRAPHICS_CSC_ADJUST_TYPE_SW) {
-		if (config == CSC_COLOR_MODE_GRAPHICS_OUTPUT_CSC) {
-			REG_SET(OUTPUT_CSC_CONTROL, 0,
-				OUTPUT_CSC_GRPH_MODE, 4);
-		} else {
-
-			switch (color_space) {
-			case COLOR_SPACE_SRGB:
-				/* by pass */
-				REG_SET(OUTPUT_CSC_CONTROL, 0,
-					OUTPUT_CSC_GRPH_MODE, 0);
-				break;
-			case COLOR_SPACE_SRGB_LIMITED:
-				/* TV RGB */
-				REG_SET(OUTPUT_CSC_CONTROL, 0,
-					OUTPUT_CSC_GRPH_MODE, 1);
-				break;
-			case COLOR_SPACE_YCBCR601:
-			case COLOR_SPACE_YCBCR601_LIMITED:
-				/* YCbCr601 */
-				REG_SET(OUTPUT_CSC_CONTROL, 0,
-					OUTPUT_CSC_GRPH_MODE, 2);
-				break;
-			case COLOR_SPACE_YCBCR709:
-			case COLOR_SPACE_YCBCR709_LIMITED:
-				/* YCbCr709 */
-				REG_SET(OUTPUT_CSC_CONTROL, 0,
-					OUTPUT_CSC_GRPH_MODE, 3);
-				break;
-			default:
-				return false;
-			}
-		}
-	} else if (csc_adjust_type == GRAPHICS_CSC_ADJUST_TYPE_HW) {
-		switch (color_space) {
-		case COLOR_SPACE_SRGB:
-			/* by pass */
-			REG_SET(OUTPUT_CSC_CONTROL, 0,
-				OUTPUT_CSC_GRPH_MODE, 0);
-			break;
-			break;
-		case COLOR_SPACE_SRGB_LIMITED:
-			/* TV RGB */
-			REG_SET(OUTPUT_CSC_CONTROL, 0,
-				OUTPUT_CSC_GRPH_MODE, 1);
-			break;
-		case COLOR_SPACE_YCBCR601:
-		case COLOR_SPACE_YCBCR601_LIMITED:
-			/* YCbCr601 */
-			REG_SET(OUTPUT_CSC_CONTROL, 0,
-				OUTPUT_CSC_GRPH_MODE, 2);
-			break;
-		case COLOR_SPACE_YCBCR709:
-		case COLOR_SPACE_YCBCR709_LIMITED:
-			 /* YCbCr709 */
-			REG_SET(OUTPUT_CSC_CONTROL, 0,
-				OUTPUT_CSC_GRPH_MODE, 3);
-			break;
-		default:
-			return false;
-		}
-
-	} else
-		/* by pass */
-		REG_SET(OUTPUT_CSC_CONTROL, 0,
-			OUTPUT_CSC_GRPH_MODE, 0);
-
-	return true;
-}
-
-void dce110_opp_set_csc_adjustment(
-	struct output_pixel_processor *opp,
-	const struct out_csc_color_matrix *tbl_entry)
-{
-	struct dce110_opp *opp110 = TO_DCE110_OPP(opp);
-	enum csc_color_mode config =
-			CSC_COLOR_MODE_GRAPHICS_OUTPUT_CSC;
-
-	program_color_matrix(
-			opp110, tbl_entry, GRAPHICS_CSC_ADJUST_TYPE_SW);
-
-	/*  We did everything ,now program DxOUTPUT_CSC_CONTROL */
-	configure_graphics_mode(opp110, config, GRAPHICS_CSC_ADJUST_TYPE_SW,
-			tbl_entry->color_space);
-}
-
-void dce110_opp_set_csc_default(
-	struct output_pixel_processor *opp,
-	const struct default_adjustment *default_adjust)
-{
-	struct dce110_opp *opp110 = TO_DCE110_OPP(opp);
-	enum csc_color_mode config =
-			CSC_COLOR_MODE_GRAPHICS_PREDEFINED;
-
-	if (default_adjust->force_hw_default == false) {
-		const struct out_csc_color_matrix *elm;
-		/* currently parameter not in use */
-		enum grph_color_adjust_option option =
-			GRPH_COLOR_MATRIX_HW_DEFAULT;
-		uint32_t i;
-		/*
-		 * HW default false we program locally defined matrix
-		 * HW default true  we use predefined hw matrix and we
-		 * do not need to program matrix
-		 * OEM wants the HW default via runtime parameter.
-		 */
-		option = GRPH_COLOR_MATRIX_SW;
-
-		for (i = 0; i < ARRAY_SIZE(global_color_matrix); ++i) {
-			elm = &global_color_matrix[i];
-			if (elm->color_space != default_adjust->out_color_space)
-				continue;
-			/* program the matrix with default values from this
-			 * file */
-			program_color_matrix(opp110, elm, option);
-			config = CSC_COLOR_MODE_GRAPHICS_OUTPUT_CSC;
-			break;
-		}
-	}
-
-	/* configure the what we programmed :
-	 * 1. Default values from this file
-	 * 2. Use hardware default from ROM_A and we do not need to program
-	 * matrix */
-
-	configure_graphics_mode(opp110, config,
-		default_adjust->csc_adjust_type,
-		default_adjust->out_color_space);
-}
 
 
 /*****************************************/
@@ -964,8 +769,6 @@ void dce110_opp_set_csc_default(
 
 static const struct opp_funcs funcs = {
 	.opp_power_on_regamma_lut = dce110_opp_power_on_regamma_lut,
-	.opp_set_csc_adjustment = dce110_opp_set_csc_adjustment,
-	.opp_set_csc_default = dce110_opp_set_csc_default,
 	.opp_set_dyn_expansion = dce110_opp_set_dyn_expansion,
 	.opp_program_regamma_pwl = dce110_opp_program_regamma_pwl,
 	.opp_set_regamma_mode = dce110_opp_set_regamma_mode,
drivers/gpu/drm/amd/display/dc/dce/dce_opp.h +0 -31
index e5045d21a05c..ca09f52f49e5 100644
@@ -57,13 +57,6 @@ enum dce110_opp_reg_type {
 	SRI(REGAMMA_LUT_INDEX, DCP, id), \
 	SRI(REGAMMA_LUT_DATA, DCP, id), \
 	SRI(REGAMMA_CONTROL, DCP, id), \
-	SRI(OUTPUT_CSC_C11_C12, DCP, id), \
-	SRI(OUTPUT_CSC_C13_C14, DCP, id), \
-	SRI(OUTPUT_CSC_C21_C22, DCP, id), \
-	SRI(OUTPUT_CSC_C23_C24, DCP, id), \
-	SRI(OUTPUT_CSC_C31_C32, DCP, id), \
-	SRI(OUTPUT_CSC_C33_C34, DCP, id), \
-	SRI(OUTPUT_CSC_CONTROL, DCP, id), \
 	SRI(FMT_DYNAMIC_EXP_CNTL, FMT, id), \
 	SRI(FMT_BIT_DEPTH_CONTROL, FMT, id), \
 	SRI(FMT_CONTROL, FMT, id), \
@@ -129,9 +122,6 @@ enum dce110_opp_reg_type {
 	OPP_SF(REGAMMA_CNTLA_REGION_0_1, REGAMMA_CNTLA_EXP_REGION1_NUM_SEGMENTS, mask_sh),\
 	OPP_SF(REGAMMA_LUT_WRITE_EN_MASK, REGAMMA_LUT_WRITE_EN_MASK, mask_sh),\
 	OPP_SF(REGAMMA_CONTROL, GRPH_REGAMMA_MODE, mask_sh),\
-	OPP_SF(OUTPUT_CSC_C11_C12, OUTPUT_CSC_C11, mask_sh),\
-	OPP_SF(OUTPUT_CSC_C11_C12, OUTPUT_CSC_C12, mask_sh),\
-	OPP_SF(OUTPUT_CSC_CONTROL, OUTPUT_CSC_GRPH_MODE, mask_sh),\
 	OPP_SF(FMT_DYNAMIC_EXP_CNTL, FMT_DYNAMIC_EXP_EN, mask_sh),\
 	OPP_SF(FMT_DYNAMIC_EXP_CNTL, FMT_DYNAMIC_EXP_MODE, mask_sh),\
 	OPP_SF(FMT_BIT_DEPTH_CONTROL, FMT_TRUNCATE_EN, mask_sh),\
@@ -222,9 +212,6 @@ enum dce110_opp_reg_type {
 	OPP_SF(DCFE0_DCFE_MEM_PWR_STATUS, DCP_REGAMMA_MEM_PWR_STATE, mask_sh),\
 	OPP_SF(DCP0_REGAMMA_LUT_WRITE_EN_MASK, REGAMMA_LUT_WRITE_EN_MASK, mask_sh),\
 	OPP_SF(DCP0_REGAMMA_CONTROL, GRPH_REGAMMA_MODE, mask_sh),\
-	OPP_SF(DCP0_OUTPUT_CSC_C11_C12, OUTPUT_CSC_C11, mask_sh),\
-	OPP_SF(DCP0_OUTPUT_CSC_C11_C12, OUTPUT_CSC_C12, mask_sh),\
-	OPP_SF(DCP0_OUTPUT_CSC_CONTROL, OUTPUT_CSC_GRPH_MODE, mask_sh),\
 	OPP_SF(FMT0_FMT_DYNAMIC_EXP_CNTL, FMT_DYNAMIC_EXP_EN, mask_sh),\
 	OPP_SF(FMT0_FMT_DYNAMIC_EXP_CNTL, FMT_DYNAMIC_EXP_MODE, mask_sh),\
 	OPP_SF(FMT0_FMT_BIT_DEPTH_CONTROL, FMT_TRUNCATE_EN, mask_sh),\
@@ -288,9 +275,6 @@ enum dce110_opp_reg_type {
 	type REGAMMA_LUT_MEM_PWR_STATE; \
 	type REGAMMA_LUT_WRITE_EN_MASK; \
 	type GRPH_REGAMMA_MODE; \
-	type OUTPUT_CSC_C11; \
-	type OUTPUT_CSC_C12; \
-	type OUTPUT_CSC_GRPH_MODE; \
 	type FMT_DYNAMIC_EXP_EN; \
 	type FMT_DYNAMIC_EXP_MODE; \
 	type FMT_TRUNCATE_EN; \
@@ -362,13 +346,6 @@ struct dce_opp_registers {
 	uint32_t DCFE_MEM_PWR_STATUS;
 	uint32_t REGAMMA_LUT_DATA;
 	uint32_t REGAMMA_CONTROL;
-	uint32_t OUTPUT_CSC_C11_C12;
-	uint32_t OUTPUT_CSC_C13_C14;
-	uint32_t OUTPUT_CSC_C21_C22;
-	uint32_t OUTPUT_CSC_C23_C24;
-	uint32_t OUTPUT_CSC_C31_C32;
-	uint32_t OUTPUT_CSC_C33_C34;
-	uint32_t OUTPUT_CSC_CONTROL;
 	uint32_t FMT_DYNAMIC_EXP_CNTL;
 	uint32_t FMT_BIT_DEPTH_CONTROL;
 	uint32_t FMT_CONTROL;
@@ -417,14 +394,6 @@ bool dce110_opp_program_regamma_pwl(
 void dce110_opp_set_regamma_mode(struct output_pixel_processor *opp,
 		enum opp_regamma mode);
 
-void dce110_opp_set_csc_adjustment(
-	struct output_pixel_processor *opp,
-	const struct out_csc_color_matrix *tbl_entry);
-
-void dce110_opp_set_csc_default(
-	struct output_pixel_processor *opp,
-	const struct default_adjustment *default_adjust);
-
 /* FORMATTER RELATED */
 void dce110_opp_program_bit_depth_reduction(
 	struct output_pixel_processor *opp,
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c +210 -0

228 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_transform.h +30 -0
index ca6c621151b2..8632d8f4dac0 100644
@@ -44,6 +44,13 @@
 	SRI(GAMUT_REMAP_C23_C24, DCP, id), \
 	SRI(GAMUT_REMAP_C31_C32, DCP, id), \
 	SRI(GAMUT_REMAP_C33_C34, DCP, id), \
+	SRI(OUTPUT_CSC_C11_C12, DCP, id), \
+	SRI(OUTPUT_CSC_C13_C14, DCP, id), \
+	SRI(OUTPUT_CSC_C21_C22, DCP, id), \
+	SRI(OUTPUT_CSC_C23_C24, DCP, id), \
+	SRI(OUTPUT_CSC_C31_C32, DCP, id), \
+	SRI(OUTPUT_CSC_C33_C34, DCP, id), \
+	SRI(OUTPUT_CSC_CONTROL, DCP, id), \
 	SRI(DENORM_CONTROL, DCP, id), \
 	SRI(DCP_SPATIAL_DITHER_CNTL, DCP, id), \
 	SRI(OUT_ROUND_CONTROL, DCP, id), \
@@ -114,6 +121,9 @@
 	XFM_SF(GAMUT_REMAP_C33_C34, GAMUT_REMAP_C33, mask_sh), \
 	XFM_SF(GAMUT_REMAP_C33_C34, GAMUT_REMAP_C34, mask_sh), \
 	XFM_SF(GAMUT_REMAP_CONTROL, GRPH_GAMUT_REMAP_MODE, mask_sh), \
+	XFM_SF(OUTPUT_CSC_C11_C12, OUTPUT_CSC_C11, mask_sh),\
+	XFM_SF(OUTPUT_CSC_C11_C12, OUTPUT_CSC_C12, mask_sh),\
+	XFM_SF(OUTPUT_CSC_CONTROL, OUTPUT_CSC_GRPH_MODE, mask_sh),\
 	XFM_SF(SCL_MODE, SCL_MODE, mask_sh), \
 	XFM_SF(SCL_TAP_CONTROL, SCL_H_NUM_OF_TAPS, mask_sh), \
 	XFM_SF(SCL_TAP_CONTROL, SCL_V_NUM_OF_TAPS, mask_sh), \
@@ -183,6 +193,9 @@
 	XFM_SF(DCP0_GAMUT_REMAP_C33_C34, GAMUT_REMAP_C33, mask_sh), \
 	XFM_SF(DCP0_GAMUT_REMAP_C33_C34, GAMUT_REMAP_C34, mask_sh), \
 	XFM_SF(DCP0_GAMUT_REMAP_CONTROL, GRPH_GAMUT_REMAP_MODE, mask_sh), \
+	XFM_SF(DCP0_OUTPUT_CSC_C11_C12, OUTPUT_CSC_C11, mask_sh),\
+	XFM_SF(DCP0_OUTPUT_CSC_C11_C12, OUTPUT_CSC_C12, mask_sh),\
+	XFM_SF(DCP0_OUTPUT_CSC_CONTROL, OUTPUT_CSC_GRPH_MODE, mask_sh),\
 	XFM_SF(SCL0_SCL_MODE, SCL_MODE, mask_sh), \
 	XFM_SF(SCL0_SCL_TAP_CONTROL, SCL_H_NUM_OF_TAPS, mask_sh), \
 	XFM_SF(SCL0_SCL_TAP_CONTROL, SCL_V_NUM_OF_TAPS, mask_sh), \
@@ -249,6 +262,9 @@
 	type GAMUT_REMAP_C33; \
 	type GAMUT_REMAP_C34; \
 	type GRPH_GAMUT_REMAP_MODE; \
+	type OUTPUT_CSC_C11; \
+	type OUTPUT_CSC_C12; \
+	type OUTPUT_CSC_GRPH_MODE; \
 	type SCL_MODE; \
 	type SCL_BYPASS_MODE; \
 	type SCL_PSCL_EN; \
@@ -302,6 +318,13 @@ struct dce_transform_registers {
 	uint32_t GAMUT_REMAP_C23_C24;
 	uint32_t GAMUT_REMAP_C31_C32;
 	uint32_t GAMUT_REMAP_C33_C34;
+	uint32_t OUTPUT_CSC_C11_C12;
+	uint32_t OUTPUT_CSC_C13_C14;
+	uint32_t OUTPUT_CSC_C21_C22;
+	uint32_t OUTPUT_CSC_C23_C24;
+	uint32_t OUTPUT_CSC_C31_C32;
+	uint32_t OUTPUT_CSC_C33_C34;
+	uint32_t OUTPUT_CSC_CONTROL;
 	uint32_t DENORM_CONTROL;
 	uint32_t DCP_SPATIAL_DITHER_CNTL;
 	uint32_t OUT_ROUND_CONTROL;
@@ -381,5 +404,12 @@ bool dce_transform_get_optimal_number_of_taps(
 	struct scaler_data *scl_data,
 	const struct scaling_taps *in_taps);
 
+void dce110_opp_set_csc_adjustment(
+	struct transform *xfm,
+	const struct out_csc_color_matrix *tbl_entry);
+
+void dce110_opp_set_csc_default(
+	struct transform *xfm,
+	const struct default_adjustment *default_adjust);
 
 #endif /* _DCE_DCE_TRANSFORM_H_ */
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +29 -6
index 6afe572cfb06..ad831e586021 100644
@@ -1868,8 +1868,8 @@ static void set_default_colors(struct pipe_ctx *pipe_ctx)
 	/* Lb color depth */
 	default_adjust.lb_color_depth = pipe_ctx->scl_data.lb_params.depth;
 
-	pipe_ctx->opp->funcs->opp_set_csc_default(
-					pipe_ctx->opp, &default_adjust);
+	pipe_ctx->xfm->funcs->opp_set_csc_default(
+					pipe_ctx->xfm, &default_adjust);
 }
 
 
@@ -1991,8 +1991,8 @@ static void set_plane_config(
 			tbl_entry.regval[i] =
 			pipe_ctx->stream->csc_color_matrix.matrix[i];
 
-		pipe_ctx->opp->funcs->opp_set_csc_adjustment
-				(pipe_ctx->opp, &tbl_entry);
+		pipe_ctx->xfm->funcs->opp_set_csc_adjustment
+				(pipe_ctx->xfm, &tbl_entry);
 	}
 
 	if (pipe_ctx->stream->gamut_remap_matrix.enable_remap == true) {
@@ -2446,8 +2446,8 @@ static void dce110_program_front_end_for_pipe(
 			tbl_entry.regval[i] =
 			pipe_ctx->stream->csc_color_matrix.matrix[i];
 
-		pipe_ctx->opp->funcs->opp_set_csc_adjustment
-				(pipe_ctx->opp, &tbl_entry);
+		pipe_ctx->xfm->funcs->opp_set_csc_adjustment
+				(pipe_ctx->xfm, &tbl_entry);
 	}
 
 	if (pipe_ctx->stream->gamut_remap_matrix.enable_remap == true) {
@@ -2587,8 +2587,31 @@ static void dce110_wait_for_mpcc_disconnect(
 	/* do nothing*/
 }
 
+static void program_csc_matrix(struct pipe_ctx *pipe_ctx,
+		enum dc_color_space colorspace,
+		uint16_t *matrix)
+{
+	int i;
+	struct out_csc_color_matrix tbl_entry;
+
+	if (pipe_ctx->stream->csc_color_matrix.enable_adjustment
+				== true) {
+			enum dc_color_space color_space =
+				pipe_ctx->stream->output_color_space;
+
+			//uint16_t matrix[12];
+			for (i = 0; i < 12; i++)
+				tbl_entry.regval[i] = pipe_ctx->stream->csc_color_matrix.matrix[i];
+
+			tbl_entry.color_space = color_space;
+			//tbl_entry.regval = matrix;
+			pipe_ctx->xfm->funcs->opp_set_csc_adjustment(pipe_ctx->xfm, &tbl_entry);
+	}
+}
+
 static const struct hw_sequencer_funcs dce110_funcs = {
 	.program_gamut_remap = program_gamut_remap,
+	.program_csc_matrix = program_csc_matrix,
 	.init_hw = init_hw,
 	.apply_ctx_to_hw = dce110_apply_ctx_to_hw,
 	.apply_ctx_for_surface = dce110_apply_ctx_for_surface,
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_csc_v.c +25 -20

132 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_v.c +0 -2
index 6f8b414cabbc..24d9032faade 100644
@@ -39,8 +39,6 @@
 static const struct opp_funcs funcs = {
 		.opp_power_on_regamma_lut = dce110_opp_power_on_regamma_lut_v,
 		.opp_program_regamma_pwl = dce110_opp_program_regamma_pwl_v,
-		.opp_set_csc_default = dce110_opp_v_set_csc_default,
-		.opp_set_csc_adjustment = dce110_opp_v_set_csc_adjustment,
 		.opp_set_dyn_expansion = dce110_opp_set_dyn_expansion,
 		.opp_set_regamma_mode = dce110_opp_set_regamma_mode_v,
 		.opp_destroy = dce110_opp_destroy,
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_v.h +0 -6
index cb26c515d30f..7deaa4f5c659 100644
@@ -33,13 +33,7 @@ bool dce110_opp_v_construct(struct dce110_opp *opp110,
 	struct dc_context *ctx);
 
 /* underlay callbacks */
-void dce110_opp_v_set_csc_default(
-	struct output_pixel_processor *opp,
-	const struct default_adjustment *default_adjust);
 
-void dce110_opp_v_set_csc_adjustment(
-	struct output_pixel_processor *opp,
-	const struct out_csc_color_matrix *tbl_entry);
 
 bool dce110_opp_program_regamma_pwl_v(
 	struct output_pixel_processor *opp,
drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.c +2 -0
index 8548248d4b19..f655145b3c47 100644
@@ -681,6 +681,8 @@ static const struct transform_funcs dce110_xfmv_funcs = {
 	.transform_set_scaler = dce110_xfmv_set_scaler,
 	.transform_set_gamut_remap =
 		dce110_xfmv_set_gamut_remap,
+	.opp_set_csc_default = dce110_opp_v_set_csc_default,
+	.opp_set_csc_adjustment = dce110_opp_v_set_csc_adjustment,
 	.transform_set_pixel_storage_depth =
 			dce110_xfmv_set_pixel_storage_depth,
 	.transform_get_optimal_number_of_taps =
drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.h +7 -0
index 267af34db3e5..b7f8fdb392a5 100644
@@ -34,4 +34,11 @@ bool dce110_transform_v_construct(
 	struct dce_transform *xfm110,
 	struct dc_context *ctx);
 
+void dce110_opp_v_set_csc_default(
+	struct transform *xfm,
+	const struct default_adjustment *default_adjust);
+
+void dce110_opp_v_set_csc_adjustment(
+		struct transform *xfm,
+	const struct out_csc_color_matrix *tbl_entry);
 #endif
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +1 -6
index 01d6957c07fb..a4f8556d6797 100644
@@ -217,13 +217,8 @@ enum fmt_stereo_action {
 	FMT_STEREO_ACTION_UPDATE_POLARITY
 };
 
-enum grph_color_adjust_option {
-	GRPH_COLOR_MATRIX_HW_DEFAULT = 1,
-	GRPH_COLOR_MATRIX_SW
-};
-
 struct opp_grph_csc_adjustment {
-	enum grph_color_adjust_option color_adjust_option;
+	//enum grph_color_adjust_option color_adjust_option;
 	enum dc_color_space c_space;
 	enum dc_color_depth color_depth; /* clean up to uint32_t */
 	enum graphics_csc_adjust_type   csc_adjust_type;
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#64 lore raw

PATCH 63/120 drm/amd/display: Fix DCN compile errors

In reply to a message not in the archive

From: Vikrant Mhaske <[email protected]>

Fix for DCN compiler errors caused due to various submits

Change-Id I5315cd727f3e64fc61d1f524442299dd0870d47e
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -0
index 2299bdaca376..e1298d7029e6 100644
@@ -1475,6 +1475,8 @@ static void dcn10_pipe_control_lock(
 	struct pipe_ctx *pipe,
 	bool lock)
 {
+	struct mem_input *mi = NULL;
+	mi = dc->res_pool->mis[pipe->pipe_idx];
 	/* use TG master update lock to lock everything on the TG
 	 * therefore only top pipe need to lock
 	 */
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#65 lore raw

PATCH 64/120 drm/amd/display: Add per surface validation hook.

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

For now just validate pixel format in the hook.

Change-Id I14c953c56790a83ea4b671f7e50da4da7a848c93
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c       | 11 +++++++++++
 drivers/gpu/drm/amd/display/dc/dc.h                     |  1 +
 drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c | 12 +++++++++++-
 drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h |  2 ++
 drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c |  3 +++
 drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c |  5 ++++-
 drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c   |  4 +++-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h         |  2 ++
 8 files changed, 37 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +11 -0
index 36cd077ba2f5..a34b2562ff7a 100644
@@ -2535,3 +2535,14 @@ bool dc_validate_stream(const struct dc *dc, struct dc_stream *stream)
 
 	return res == DC_OK;
 }
+
+bool dc_validate_surface(const struct dc *dc, const struct dc_surface *surface)
+{
+	struct core_dc *core_dc = DC_TO_CORE(dc);
+
+	/* TODO For now validates pixel format only */
+	if (core_dc->res_pool->funcs->validate_surface)
+		return core_dc->res_pool->funcs->validate_surface(surface) == DC_OK;
+
+	return true;
+}
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index 58bfb867b71c..e9c9b91d1286 100644
@@ -589,6 +589,7 @@ struct dc_validation_set {
 
 bool dc_validate_stream(const struct dc *dc, struct dc_stream *stream);
 
+bool dc_validate_surface(const struct dc *dc, const struct dc_surface *surface);
 /*
  * This function takes a set of resources and checks that they are cofunctional.
  *
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +11 -1
index 9ac246f05110..59f4caf057f7 100644
@@ -804,12 +804,22 @@ static void dce100_destroy_resource_pool(struct resource_pool **pool)
 	*pool = NULL;
 }
 
+enum dc_status dce100_validate_surface(const struct dc_surface *surface)
+{
+
+	if (surface->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
+		return DC_OK;
+
+	return DC_FAIL_SURFACE_VALIDATE;
+}
+
 static const struct resource_funcs dce100_res_pool_funcs = {
 	.destroy = dce100_destroy_resource_pool,
 	.link_enc_create = dce100_link_encoder_create,
 	.validate_with_context = dce100_validate_with_context,
 	.validate_guaranteed = dce100_validate_guaranteed,
-	.validate_bandwidth = dce100_validate_bandwidth
+	.validate_bandwidth = dce100_validate_bandwidth,
+	.validate_surface = dce100_validate_surface,
 };
 
 static bool construct(
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h +2 -0
index bfd7518c94c9..13fc637eb731 100644
@@ -16,4 +16,6 @@ struct resource_pool *dce100_create_resource_pool(
 	uint8_t num_virtual_links,
 	struct core_dc *dc);
 
+enum dc_status dce100_validate_surface(const struct dc_surface *surface);
+
 #endif /* DCE100_RESOURCE_H_ */
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +3 -0
index 9589208ea0c8..495f38750ae4 100644
@@ -55,6 +55,8 @@
 #include "dce/dce_11_2_d.h"
 #include "dce/dce_11_2_sh_mask.h"
 
+#include "dce100/dce100_resource.h"
+
 #ifndef mmDP_DPHY_INTERNAL_CTRL
 	#define mmDP_DPHY_INTERNAL_CTRL 0x4aa7
 	#define mmDP0_DP_DPHY_INTERNAL_CTRL 0x4aa7
@@ -992,6 +994,7 @@ static const struct resource_funcs dce112_res_pool_funcs = {
 	.validate_with_context = dce112_validate_with_context,
 	.validate_guaranteed = dce112_validate_guaranteed,
 	.validate_bandwidth = dce112_validate_bandwidth,
+	.validate_surface = dce100_validate_surface
 };
 
 static void bw_calcs_data_update_from_pplib(struct core_dc *dc)
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +4 -1
index f829b6e58bcb..b31307b9d3e3 100644
@@ -60,6 +60,8 @@
 #include "vega10/NBIO/nbio_6_1_offset.h"
 #include "reg_helper.h"
 
+#include "dce100/dce100_resource.h"
+
 #ifndef mmDP0_DP_DPHY_INTERNAL_CTRL
 	#define mmDP0_DP_DPHY_INTERNAL_CTRL		0x210f
 	#define mmDP0_DP_DPHY_INTERNAL_CTRL_BASE_IDX	2
@@ -698,7 +700,8 @@ static const struct resource_funcs dce120_res_pool_funcs = {
 	.link_enc_create = dce120_link_encoder_create,
 	.validate_with_context = dce112_validate_with_context,
 	.validate_guaranteed = dce112_validate_guaranteed,
-	.validate_bandwidth = dce112_validate_bandwidth
+	.validate_bandwidth = dce112_validate_bandwidth,
+	.validate_surface = dce100_validate_surface
 };
 
 static void bw_calcs_data_update_from_pplib(struct core_dc *dc)
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +3 -1
index 92f01ed97621..6eeb5e9f656f 100644
@@ -49,6 +49,7 @@
 #include "dce/dce_audio.h"
 #include "dce/dce_hwseq.h"
 #include "dce80/dce80_hw_sequencer.h"
+#include "dce100/dce100_resource.h"
 
 #include "reg_helper.h"
 
@@ -823,7 +824,8 @@ static const struct resource_funcs dce80_res_pool_funcs = {
 	.link_enc_create = dce80_link_encoder_create,
 	.validate_with_context = dce80_validate_with_context,
 	.validate_guaranteed = dce80_validate_guaranteed,
-	.validate_bandwidth = dce80_validate_bandwidth
+	.validate_bandwidth = dce80_validate_bandwidth,
+	.validate_surface = dce100_validate_surface
 };
 
 static bool construct(
drivers/gpu/drm/amd/display/dc/inc/core_types.h +2 -0
index b312bb3b3350..ab389abf4e79 100644
@@ -105,6 +105,8 @@ struct resource_funcs {
 			struct validate_context *context,
 			const struct resource_pool *pool,
 			struct dc_stream *stream);
+
+	enum dc_status (*validate_surface)(const struct dc_surface *surface);
 };
 
 struct audio_support{
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#66 lore raw

PATCH 65/120 drm/amd/display: add preferred mode from Video Format Preference Data Block

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

Change-Id I37d313ca0e17b0d446a68575cafa94165849024e
---
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +0 -2
index 875b98dae6e1..be6e3ca9fb0d 100644
@@ -856,8 +856,6 @@ bool dcn_validate_bandwidth(
 				- pipe->stream->timing.v_front_porch;
 		v->vactive[input_idx] = pipe->stream->timing.v_addressable;
 		v->pixel_clock[input_idx] = pipe->stream->timing.pix_clk_khz / 1000.0f;
-		if (pipe->stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420)
-			v->pixel_clock[input_idx] /= 2;
 
 
 		if (!pipe->surface){
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20170809150246.8835-66-harry.wentland-5C7GfCeVMHo@public.gmane.org

#68 lore raw

Re: [PATCH 065/120] drm/amd/display: add preferred mode from Video Format Preference Data Block

Quoted 15 lines · Harry Wentland

From: Andrey Grodzovsky <[email protected]>

Change-Id I37d313ca0e17b0d446a68575cafa94165849024e
---
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +0 -0
index 875b98dae6e1..be6e3ca9fb0d 100644

drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c bool dcn_validate_bandwidth( · line 860

Quoted 5 lines
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +0 -2
@@ -856,8 +856,6 @@ bool dcn_validate_bandwidth(
 				- pipe->stream->timing.v_front_porch;
 		v->vactive[input_idx] = pipe->stream->timing.v_addressable;
 		v->pixel_clock[input_idx] = pipe->stream->timing.pix_clk_khz / 1000.0f;
-		if (pipe->stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420)
-			v->pixel_clock[input_idx] /= 2;

This code change doesn't seem to correspond to the commit log?

It looks like this reverts a previous patch in the series. There are other cases where a patch is reverted, and then possibly another patch has a revision of the same change. Would be it possible to eliminate that kind of redundancy before sending out a series like this?

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#69 lore raw

PATCH 66/120 drm/amd/display: Initial prototype of FBC implementation

In reply to a message not in the archive

From: Roman Li <[email protected]>

- Protected by ENABLE_FBC compile flag
- DC part will follow

Change-Id I0e5d18be9f3c5bfb8bf3d6c0a8d71ce239675a57
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 29 +++++++++++++++++++++++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 12 ++++++++++
 2 files changed, 41 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +29 -0
index fd26304a86f1..1b4e88d6386a 100644
@@ -297,6 +297,30 @@ static void hotplug_notify_work_func(struct work_struct *work)
 	drm_kms_helper_hotplug_event(dev);
 }
 
+#ifdef ENABLE_FBC
+#include "dal_asic_id.h"
+/* Allocate memory for FBC compressed data  */
+/* TODO: Dynamic allocation */
+#define AMDGPU_FBC_SIZE    (3840 * 2160 * 4)
+
+void amdgpu_dm_initialize_fbc(struct amdgpu_device *adev)
+{
+	int r;
+	struct dm_comressor_info *compressor = &adev->dm.compressor;
+
+	if (!compressor->bo_ptr) {
+		r = amdgpu_bo_create_kernel(adev, AMDGPU_FBC_SIZE, PAGE_SIZE,
+				AMDGPU_GEM_DOMAIN_VRAM, &compressor->bo_ptr,
+				&compressor->gpu_addr, &compressor->cpu_addr);
+
+		if (r)
+			DRM_ERROR("DM: Failed to initialize fbc\n");
+	}
+
+}
+#endif
+
+
 /* Init display KMS
  *
  * Returns 0 on success
@@ -347,6 +371,11 @@ int amdgpu_dm_init(struct amdgpu_device *adev)
 
 	init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;
 
+#ifdef ENABLE_FBC
+	if (adev->family == FAMILY_CZ)
+		amdgpu_dm_initialize_fbc(adev);
+	init_data.fbc_gpu_addr = adev->dm.compressor.gpu_addr;
+#endif
 	/* Display Core create. */
 	adev->dm.dc = dc_create(&init_data);
 
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +12 -0
index 16b2e0849a65..ce0223af7d5f 100644
@@ -72,6 +72,15 @@ struct irq_list_head {
 	struct work_struct work;
 };
 
+#ifdef ENABLE_FBC
+struct dm_comressor_info {
+	void *cpu_addr;
+	struct amdgpu_bo *bo_ptr;
+	uint64_t gpu_addr;
+};
+#endif
+
+
 struct amdgpu_display_manager {
 	struct dal *dal;
 	struct dc *dc;
@@ -133,6 +142,9 @@ struct amdgpu_display_manager {
 	 * Caches device atomic state for suspend/resume
 	 */
 	struct drm_atomic_state *cached_state;
+#ifdef ENABLE_FBC
+	struct dm_comressor_info compressor;
+#endif
 };
 
 /* basic init/fini API */
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#70 lore raw

PATCH 67/120 drm/amd/display: Initial prototype of FBC implementation

In reply to a message not in the archive

From: Roman Li <[email protected]>

- Protected by ENABLE_FBC compile flag

Change-Id Icd7834e79e97352c74c66f6a624302cfe522ddc8
---
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  7 ++-
 drivers/gpu/drm/amd/display/dc/dc.h                |  3 +
 drivers/gpu/drm/amd/display/dc/dc_types.h          |  3 +
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 69 ++++++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/inc/compressor.h    |  1 +
 5 files changed, 81 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +5 -2
index df8c5ca6b22a..1c0d21840cba 100644
@@ -475,7 +475,9 @@ static bool construct(struct core_dc *dc,
 
 	dc_version = resource_parse_asic_id(init_params->asic_id);
 	dc->ctx->dce_version = dc_version;
-
+#ifdef ENABLE_FBC
+	dc->ctx->fbc_gpu_addr = init_params->fbc_gpu_addr;
+#endif
 	/* Resource should construct all asic specific resources.
 	 * This should be the only place where we need to parse the asic id
 	 */
@@ -919,7 +921,7 @@ bool dc_enable_stereo(
 #ifdef ENABLE_FBC
 	if (fbc_compressor != NULL &&
 	    fbc_compressor->funcs->is_fbc_enabled_in_hw(core_dc->fbc_compressor,
-							&pipe->tg->inst))
+							NULL))
 		fbc_compressor->funcs->disable_fbc(fbc_compressor);
 
 #endif
@@ -2066,3 +2068,4 @@ void dc_log_hw_state(struct dc *dc)
 	if (core_dc->hwss.log_hw_state)
 		core_dc->hwss.log_hw_state(core_dc);
 }
+
drivers/gpu/drm/amd/display/dc/dc.h +3 -0
index e9c9b91d1286..63fd5b3de738 100644
@@ -231,6 +231,9 @@ struct dc_init_data {
 	enum dce_environment dce_environment;
 
 	struct dc_config flags;
+#ifdef ENABLE_FBC
+	uint64_t fbc_gpu_addr;
+#endif
 };
 
 struct dc *dc_create(const struct dc_init_data *init_params);
drivers/gpu/drm/amd/display/dc/dc_types.h +3 -0
index 99b893fbcb42..ee9e6bc88c32 100644
@@ -92,6 +92,9 @@ struct dc_context {
 	bool created_bios;
 	struct gpio_service *gpio_service;
 	struct i2caux *i2caux;
+#ifdef ENABLE_FBC
+	uint64_t fbc_gpu_addr;
+#endif
 };
 
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +69 -0

87 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/compressor.h +1 -0
index 24cca18f3c8f..bcb18f5e1e60 100644
@@ -42,6 +42,7 @@ union fbc_physical_address {
 		uint32_t low_part;
 		int32_t high_part;
 	} addr;
+	uint64_t quad_part;
 };
 
 struct compr_addr_and_pitch_params {
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#71 lore raw

PATCH 68/120 drm/amd/display: Implement plane atomic_check.

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

Use per surface validation hook.

Change-Id I33c8964b9e73f551608c73044fb1a487582d6adf
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +17 -0
index 1b4e88d6386a..6a3ca95b9622 100644
@@ -3291,9 +3291,26 @@ int dm_create_validation_set_for_connector(struct drm_connector *connector,
 	return MODE_OK;
 }
 
+int dm_plane_atomic_check(struct drm_plane *plane,
+			    struct drm_plane_state *state)
+{
+	struct amdgpu_device *adev = plane->dev->dev_private;
+	struct dc *dc = adev->dm.dc;
+	struct dm_plane_state *dm_plane_state = to_dm_plane_state(state);
+
+	if (!dm_plane_state->surface)
+		return true;
+
+	if (dc_validate_surface(dc, dm_plane_state->surface))
+		return 0;
+
+	return -EINVAL;
+}
+
 static const struct drm_plane_helper_funcs dm_plane_helper_funcs = {
 	.prepare_fb = dm_plane_helper_prepare_fb,
 	.cleanup_fb = dm_plane_helper_cleanup_fb,
+	.atomic_check = dm_plane_atomic_check,
 };
 
 /*
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#72 lore raw

PATCH 69/120 drm/amd/display: Add stateless surface validation to validate_resources

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

Change-Id Id92988383ccc6c072b25571cbfa72cd23f247e8d
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +21 -0
index 1c0d21840cba..83b8b196cc1e 100644
@@ -675,6 +675,21 @@ static bool validate_streams (
 	return true;
 }
 
+static bool validate_surfaces(
+		const struct dc *dc,
+		const struct dc_validation_set set[],
+		int set_count)
+{
+	int i, j;
+
+	for (i = 0; i < set_count; i++)
+		for (j = 0; j < set[i].surface_count; j++)
+			if (!dc_validate_surface(dc, set[i].surfaces[j]))
+				return false;
+
+	return true;
+}
+
 struct validate_context *dc_get_validate_context(
 		const struct dc *dc,
 		const struct dc_validation_set set[],
@@ -726,6 +741,9 @@ bool dc_validate_resources(
 	if (!validate_streams(dc, set, set_count))
 		return false;
 
+	if (!validate_surfaces(dc, set, set_count))
+		return false;
+
 	context = dm_alloc(sizeof(struct validate_context));
 	if (context == NULL)
 		goto context_alloc_fail;
@@ -1065,6 +1083,9 @@ bool dc_commit_streams(
 	if (!validate_streams(dc, set, stream_count))
 		return false;
 
+	if (!validate_surfaces(dc, set, stream_count))
+		return false;
+
 	context = dm_alloc(sizeof(struct validate_context));
 	if (context == NULL)
 		goto context_alloc_fail;
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#73 lore raw

PATCH 70/120 drm/amd/display: fix dcn fe reset memory access error

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id Ic38b3c2dcb9b7e3db1e697e405fe5b7be856420f
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +4 -3
index e1298d7029e6..fa19c6b92f29 100644
@@ -853,8 +853,9 @@ static void plane_atomic_disable(struct core_dc *dc,
 	struct dce_hwseq *hws = dc->hwseq;
 	struct mem_input *mi = dc->res_pool->mis[fe_idx];
 	struct mpc *mpc = dc->res_pool->mpc;
+	int opp_id = mi->opp_id;
 
-	if (mi->opp_id == 0xf)
+	if (opp_id == 0xf)
 		return;
 
 	mpc->funcs->wait_for_idle(mpc, mi->mpcc_id);
@@ -876,8 +877,8 @@ static void plane_atomic_disable(struct core_dc *dc,
 	REG_UPDATE(DPP_CONTROL[fe_idx],
 			DPP_CLOCK_ENABLE, 0);
 
-	if (dc->res_pool->opps[mi->opp_id]->mpc_tree.num_pipes == 0)
-		REG_UPDATE(OPP_PIPE_CONTROL[mi->opp_id],
+	if (dc->res_pool->opps[opp_id]->mpc_tree.num_pipes == 0)
+		REG_UPDATE(OPP_PIPE_CONTROL[opp_id],
 				OPP_PIPE_CLOCK_EN, 0);
 
 	if (dc->public.debug.sanity_checks)
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#74 lore raw

PATCH 71/120 drm/amd/display: Keep blank until set visibility to true after mode switch

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

Change-Id Ic399c4d985189a0c6ecc0e0447d8b2348692bbed
---
 drivers/gpu/drm/amd/display/dc/core/dc.c       | 21 +++++++++------------
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.c |  4 ++++
 2 files changed, 13 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +9 -12
index 83b8b196cc1e..ba8093317aa9 100644
@@ -1609,12 +1609,10 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 			if (!pipe_ctx->surface || pipe_ctx->top_pipe)
 				continue;
 
-			if (!pipe_ctx->tg->funcs->is_blanked(pipe_ctx->tg)) {
-				core_dc->hwss.pipe_control_lock(
-						core_dc,
-						pipe_ctx,
-						true);
-			}
+			core_dc->hwss.pipe_control_lock(
+					core_dc,
+					pipe_ctx,
+					true);
 		}
 		if (update_type == UPDATE_TYPE_FULL)
 			break;
@@ -1697,12 +1695,11 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 			if (!pipe_ctx->surface || pipe_ctx->top_pipe)
 				continue;
 
-			if (!pipe_ctx->tg->funcs->is_blanked(pipe_ctx->tg)) {
-				core_dc->hwss.pipe_control_lock(
-						core_dc,
-						pipe_ctx,
-						false);
-			}
+			core_dc->hwss.pipe_control_lock(
+					core_dc,
+					pipe_ctx,
+					false);
+
 			break;
 		}
 	}
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.c +4 -0
index a8c254f66c98..c46b3e82cdcc 100644
@@ -52,6 +52,10 @@ void dce_pipe_control_lock(struct core_dc *dc,
 	uint32_t dcp_grph, scl, blnd, update_lock_mode, val;
 	struct dce_hwseq *hws = dc->hwseq;
 
+	/* Not lock pipe when blank */
+	if (lock && pipe->tg->funcs->is_blanked(pipe->tg))
+		return;
+
 	val = REG_GET_4(BLND_V_UPDATE_LOCK[pipe->pipe_idx],
 			BLND_DCP_GRPH_V_UPDATE_LOCK, &dcp_grph,
 			BLND_SCL_V_UPDATE_LOCK, &scl,
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#75 lore raw

PATCH 72/120 drm/amd/display: fix bw_calc for hdmi and 420 outputs

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I0b8db982e98f3d2bf619addb693a5279de1edf28
---
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +4 -2
index be6e3ca9fb0d..c809ad3738e9 100644
@@ -923,8 +923,10 @@ bool dcn_validate_bandwidth(
 		if (v->is_line_buffer_bpp_fixed == dcn_bw_yes)
 			v->lb_bit_per_pixel[input_idx] = v->line_buffer_fixed_bpp;
 		v->dcc_rate[input_idx] = 1; /*TODO: Worst case? does this change?*/
-		v->output_format[input_idx] = dcn_bw_444;
-		v->output[input_idx] = dcn_bw_dp;
+		v->output_format[input_idx] = pipe->stream->timing.pixel_encoding ==
+				PIXEL_ENCODING_YCBCR420 ? dcn_bw_420 : dcn_bw_444;
+		v->output[input_idx] = pipe->stream->sink->sink_signal ==
+				SIGNAL_TYPE_HDMI_TYPE_A ? dcn_bw_hdmi : dcn_bw_dp;
 
 		input_idx++;
 	}
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#76 lore raw

PATCH 73/120 drm/amd/display: fix >340 Mhz with deep color pipe split no display

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

[Description]
the input to HW formula needs to take care the deep color.

Change-Id Ic1ee35224110dafa69554d4e60a77a079e457883
---
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c  | 13 ++++++++++++-
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c |  2 --
 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +12 -1
index c809ad3738e9..7f7cb8ff124d 100644
@@ -856,7 +856,18 @@ bool dcn_validate_bandwidth(
 				- pipe->stream->timing.v_front_porch;
 		v->vactive[input_idx] = pipe->stream->timing.v_addressable;
 		v->pixel_clock[input_idx] = pipe->stream->timing.pix_clk_khz / 1000.0f;
-
+		if (pipe->stream->sink->sink_signal ==  SIGNAL_TYPE_HDMI_TYPE_A) {
+			switch (pipe->stream->timing.display_color_depth) {
+			case COLOR_DEPTH_101010:
+					v->pixel_clock[input_idx]  = (v->pixel_clock[input_idx] * 30) / 24;
+				break;
+			case COLOR_DEPTH_121212:
+				v->pixel_clock[input_idx]  = (v->pixel_clock[input_idx] * 36) / 24;
+				break;
+			default:
+				break;
+			}
+		}
 
 		if (!pipe->surface){
 			v->dcc_enable[input_idx] = dcn_bw_yes;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +0 -2
index a34b2562ff7a..84efe7216d90 100644
@@ -1657,8 +1657,6 @@ static void set_avi_info_frame(
 			color_space == COLOR_SPACE_YCBCR601_LIMITED)
 		hdmi_info->bits.C0_C1 = COLORIMETRY_ITU601;
 	else {
-		if (stream->timing.pixel_encoding != PIXEL_ENCODING_RGB)
-			BREAK_TO_DEBUGGER();
 		hdmi_info->bits.C0_C1 = COLORIMETRY_NO_DATA;
 	}
 	if (color_space == COLOR_SPACE_2020_RGB_FULLRANGE ||
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#77 lore raw

PATCH 74/120 drm/amd/display: Move and Rename "is_stream_changed()"

In reply to a message not in the archive

From: Bhawanpreet Lakha <[email protected]>

-Move "is_stream_changed()" to DC interface -Rename "is_stream_changed()" to "dc_is_stream_changed()"

Change-Id I0e38458e061bbb4f9c37e685c32c9d180b3beab9
---
 drivers/gpu/drm/amd/display/dc/core/dc.c          | 2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 4 ++--
 drivers/gpu/drm/amd/display/dc/dc.h               | 2 ++
 drivers/gpu/drm/amd/display/dc/inc/resource.h     | 2 --
 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -1
index ba8093317aa9..5acf4c697ae8 100644
@@ -641,7 +641,7 @@ static bool is_validation_required(
 
 		if (set[i].surface_count != context->stream_status[i].surface_count)
 			return true;
-		if (!is_stream_unchanged(set[i].stream, context->streams[i]))
+		if (!dc_is_stream_unchanged(set[i].stream, context->streams[i]))
 			return true;
 
 		for (j = 0; j < set[i].surface_count; j++) {
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2 -2
index 84efe7216d90..4a1eaab34942 100644
@@ -1155,7 +1155,7 @@ static bool are_stream_backends_same(
 	return true;
 }
 
-bool is_stream_unchanged(
+bool dc_is_stream_unchanged(
 	struct dc_stream *old_stream, struct dc_stream *stream)
 {
 
@@ -1176,7 +1176,7 @@ bool resource_validate_attach_surfaces(
 
 	for (i = 0; i < set_count; i++) {
 		for (j = 0; old_context && j < old_context->stream_count; j++)
-			if (is_stream_unchanged(
+			if (dc_is_stream_unchanged(
 					old_context->streams[j],
 					context->streams[i])) {
 				if (!resource_attach_surfaces_to_context(
drivers/gpu/drm/amd/display/dc/dc.h +2 -0
index 63fd5b3de738..0918569eefa8 100644
@@ -534,6 +534,8 @@ struct dc_stream_update {
 	struct dc_transfer_func *out_transfer_func;
 };
 
+bool dc_is_stream_unchanged(
+	struct dc_stream *old_stream, struct dc_stream *stream);
 
 /*
  * Setup stream attributes if no stream updates are provided
drivers/gpu/drm/amd/display/dc/inc/resource.h +0 -2
index 571bfae62a3c..ca3f49379bea 100644
@@ -132,8 +132,6 @@ struct pipe_ctx *find_idle_secondary_pipe(
 bool resource_is_stream_unchanged(
 	struct validate_context *old_context, struct dc_stream *stream);
 
-bool is_stream_unchanged(
-	struct dc_stream *old_stream, struct dc_stream *stream);
 
 bool resource_validate_attach_surfaces(
 		const struct dc_validation_set set[],
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#78 lore raw

PATCH 75/120 drm/amd/display: Avoid full modeset when not required

In reply to a message not in the archive

From: Bhawanpreet Lakha <[email protected]>

Fix IGT test case (kms_atomic_transition)
-DRM sets the mode_changed flag, while we don't need to do a full
modeset.
-We want to override the mode_changed flag in this case

If we don't do this, we will still bypass the modeset in DC. This will fail to update the new stream_status, causing nullptr at a later stage when trying to access stream_status"

We now avoid this by discarding the new_stream instead of partially filling it.

Change-Id I76522e0b53ef3865b8911e7d71e3c0b19e412abc
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 97 +++++++++++++++--------
 1 file changed, 62 insertions(+), 35 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +62 -35
index 6a3ca95b9622..086471fca250 100644
@@ -1613,8 +1613,16 @@ struct dm_connector_state {
 #define to_dm_connector_state(x)\
 	container_of((x), struct dm_connector_state, base)
 
-static bool modeset_required(struct drm_crtc_state *crtc_state)
+static bool modeset_required(struct drm_crtc_state *crtc_state,
+			     struct dc_stream *new_stream,
+			     struct dc_stream *old_stream)
 {
+	if (dc_is_stream_unchanged(new_stream, old_stream)) {
+		crtc_state->mode_changed = false;
+		DRM_DEBUG_KMS("Mode change not required, setting mode_changed to %d",
+			      crtc_state->mode_changed);
+	}
+
 	if (!drm_atomic_crtc_needs_modeset(crtc_state))
 		return false;
 
@@ -3053,7 +3061,8 @@ static int dm_crtc_helper_atomic_check(
 	struct dm_crtc_state *dm_crtc_state = to_dm_crtc_state(state);
 	int ret = -EINVAL;
 
-	if (unlikely(!dm_crtc_state->stream && modeset_required(state))) {
+	if (unlikely(!dm_crtc_state->stream &&
+		     modeset_required(state, NULL, dm_crtc_state->stream))) {
 		WARN_ON(1);
 		return ret;
 	}
@@ -4245,7 +4254,7 @@ void amdgpu_dm_atomic_commit_tail(
 		 * aconnector as needed
 		 */
 
-		if (modeset_required(new_state)) {
+		if (modeset_required(new_state, new_acrtc_state->stream, old_acrtc_state->stream)) {
 
 			DRM_INFO("Atomic commit: SET crtc id %d: [%p]\n", acrtc->crtc_id, acrtc);
 
@@ -4694,6 +4703,9 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {
 		struct amdgpu_crtc *acrtc = NULL;
 		struct amdgpu_connector *aconnector = NULL;
+		struct dc_stream *new_stream = NULL;
+		struct drm_connector_state *conn_state = NULL;
+		struct dm_connector_state *dm_conn_state = NULL;
 
 		old_acrtc_state = to_dm_crtc_state(crtc->state);
 		new_acrtc_state = to_dm_crtc_state(crtc_state);
@@ -4713,23 +4725,50 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 			crtc_state->active_changed,
 			crtc_state->connectors_changed);
 
-		if (modeset_required(crtc_state)) {
+		if (modereset_required(crtc_state)) {
 
-			struct dc_stream *new_stream = NULL;
-			struct drm_connector_state *conn_state = NULL;
-			struct dm_connector_state *dm_conn_state = NULL;
+					/* i.e. reset mode */
+			if (new_acrtc_state->stream) {
+				set_count = remove_from_val_sets(
+						set,
+						set_count,
+						new_acrtc_state->stream);
+
+				dc_stream_release(new_acrtc_state->stream);
+				new_acrtc_state->stream = NULL;
+
+				lock_and_validation_needed = true;
+			}
+
+		} else {
 
 			if (aconnector) {
-				conn_state = drm_atomic_get_connector_state(state, &aconnector->base);
+				conn_state = drm_atomic_get_connector_state(state,
+									    &aconnector->base);
+
 				if (IS_ERR(conn_state)) {
 					ret = PTR_ERR_OR_ZERO(conn_state);
 					goto fail;
 				}
 
 				dm_conn_state = to_dm_connector_state(conn_state);
+
+				new_stream = create_stream_for_sink(aconnector,
+								    &crtc_state->mode,
+								    dm_conn_state);
+
+				if (!new_stream) {
+					DRM_DEBUG_KMS("%s: Failed to create new stream for crtc %d\n",
+							__func__, acrtc->base.base.id);
+					break;
+				}
+
+
 			}
 
-			new_stream = create_stream_for_sink(aconnector, &crtc_state->mode, dm_conn_state);
+			if (modeset_required(crtc_state, new_stream,
+					     old_acrtc_state->stream)) {
+
 
 			/*
 			 * we can have no stream on ACTION_SET if a display
@@ -4737,39 +4776,27 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 			 * error, the OS will be updated after detection, and
 			 * do the right thing on next atomic commit
 			 */
-			if (!new_stream) {
-				DRM_DEBUG_KMS("%s: Failed to create new stream for crtc %d\n",
-						__func__, acrtc->base.base.id);
-				break;
-			}
-
-			if (new_acrtc_state->stream)
-				dc_stream_release(new_acrtc_state->stream);
-
-			new_acrtc_state->stream = new_stream;
-
-			set_count = update_in_val_sets_stream(
-					set,
-					set_count,
-					old_acrtc_state->stream,
-					new_acrtc_state->stream,
-					crtc);
 
-			lock_and_validation_needed = true;
+				if (new_acrtc_state->stream)
+					dc_stream_release(new_acrtc_state->stream);
 
-		} else if (modereset_required(crtc_state)) {
+				new_acrtc_state->stream = new_stream;
 
-			/* i.e. reset mode */
-			if (new_acrtc_state->stream) {
-				set_count = remove_from_val_sets(
+				set_count = update_in_val_sets_stream(
 						set,
 						set_count,
-						new_acrtc_state->stream);
-
-				dc_stream_release(new_acrtc_state->stream);
-				new_acrtc_state->stream = NULL;
+						old_acrtc_state->stream,
+						new_acrtc_state->stream,
+						crtc);
 
 				lock_and_validation_needed = true;
+			} else {
+				/*
+				 * The new stream is unused, so we release it
+				 */
+				if (new_stream)
+					dc_stream_release(new_stream);
+
 			}
 		}
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#79 lore raw

PATCH 76/120 drm/amd/display: move regamma from opp to dpp for dce

In reply to a message not in the archive

From: Yue Hin Lau <[email protected]>

Change-Id I61a821dde4ec8e65384a75dd3071ca0e05da6790
---
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.c       | 237 --------------------
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.h       | 113 +---------
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 240 +++++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.h |  88 ++++++++
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  18 +-
 .../amd/display/dc/dce110/dce110_opp_regamma_v.c   |  88 ++++----
 .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.c   |   3 -
 .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.h   |  11 -
 .../drm/amd/display/dc/dce110/dce110_transform_v.c |   3 +
 .../drm/amd/display/dc/dce110/dce110_transform_v.h |  14 ++
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h        |  17 --
 11 files changed, 399 insertions(+), 433 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_opp.c +0 -237
index 7abf252369fb..348e4b7047f1 100644
@@ -92,242 +92,8 @@ enum {
  *
  *****************************************************************************
  */
-static void regamma_config_regions_and_segments(
-	struct dce110_opp *opp110,
-	const struct pwl_params *params)
-{
-	const struct gamma_curve *curve;
-
-	{
-		REG_SET_2(REGAMMA_CNTLA_START_CNTL, 0,
-			REGAMMA_CNTLA_EXP_REGION_START, params->arr_points[0].custom_float_x,
-			REGAMMA_CNTLA_EXP_REGION_START_SEGMENT, 0);
-	}
-	{
-		REG_SET(REGAMMA_CNTLA_SLOPE_CNTL, 0,
-			REGAMMA_CNTLA_EXP_REGION_LINEAR_SLOPE, params->arr_points[0].custom_float_slope);
-
-	}
-	{
-		REG_SET(REGAMMA_CNTLA_END_CNTL1, 0,
-			REGAMMA_CNTLA_EXP_REGION_END, params->arr_points[1].custom_float_x);
-	}
-	{
-		REG_SET_2(REGAMMA_CNTLA_END_CNTL2, 0,
-			REGAMMA_CNTLA_EXP_REGION_END_BASE, params->arr_points[1].custom_float_y,
-			REGAMMA_CNTLA_EXP_REGION_END_SLOPE, params->arr_points[2].custom_float_slope);
-	}
-
-	curve = params->arr_curve_points;
-
-	{
-		REG_SET_4(REGAMMA_CNTLA_REGION_0_1, 0,
-			REGAMMA_CNTLA_EXP_REGION0_LUT_OFFSET, curve[0].offset,
-			REGAMMA_CNTLA_EXP_REGION0_NUM_SEGMENTS, curve[0].segments_num,
-			REGAMMA_CNTLA_EXP_REGION1_LUT_OFFSET, curve[1].offset,
-			REGAMMA_CNTLA_EXP_REGION1_NUM_SEGMENTS, curve[1].segments_num);
-	}
-
-	curve += 2;
-
-	{
-		REG_SET_4(REGAMMA_CNTLA_REGION_2_3, 0,
-			REGAMMA_CNTLA_EXP_REGION0_LUT_OFFSET, curve[0].offset,
-			REGAMMA_CNTLA_EXP_REGION0_NUM_SEGMENTS, curve[0].segments_num,
-			REGAMMA_CNTLA_EXP_REGION1_LUT_OFFSET, curve[1].offset,
-			REGAMMA_CNTLA_EXP_REGION1_NUM_SEGMENTS, curve[1].segments_num);
-
-	}
-
-	curve += 2;
-
-	{
-		REG_SET_4(REGAMMA_CNTLA_REGION_4_5, 0,
-			REGAMMA_CNTLA_EXP_REGION0_LUT_OFFSET, curve[0].offset,
-			REGAMMA_CNTLA_EXP_REGION0_NUM_SEGMENTS, curve[0].segments_num,
-			REGAMMA_CNTLA_EXP_REGION1_LUT_OFFSET, curve[1].offset,
-			REGAMMA_CNTLA_EXP_REGION1_NUM_SEGMENTS, curve[1].segments_num);
-
-	}
-
-	curve += 2;
 
-	{
-		REG_SET_4(REGAMMA_CNTLA_REGION_6_7, 0,
-			REGAMMA_CNTLA_EXP_REGION0_LUT_OFFSET, curve[0].offset,
-			REGAMMA_CNTLA_EXP_REGION0_NUM_SEGMENTS, curve[0].segments_num,
-			REGAMMA_CNTLA_EXP_REGION1_LUT_OFFSET, curve[1].offset,
-			REGAMMA_CNTLA_EXP_REGION1_NUM_SEGMENTS, curve[1].segments_num);
 
-	}
-
-	curve += 2;
-
-	{
-		REG_SET_4(REGAMMA_CNTLA_REGION_8_9, 0,
-			REGAMMA_CNTLA_EXP_REGION0_LUT_OFFSET, curve[0].offset,
-			REGAMMA_CNTLA_EXP_REGION0_NUM_SEGMENTS, curve[0].segments_num,
-			REGAMMA_CNTLA_EXP_REGION1_LUT_OFFSET, curve[1].offset,
-			REGAMMA_CNTLA_EXP_REGION1_NUM_SEGMENTS, curve[1].segments_num);
-
-	}
-
-	curve += 2;
-
-	{
-		REG_SET_4(REGAMMA_CNTLA_REGION_10_11, 0,
-			REGAMMA_CNTLA_EXP_REGION0_LUT_OFFSET, curve[0].offset,
-			REGAMMA_CNTLA_EXP_REGION0_NUM_SEGMENTS, curve[0].segments_num,
-			REGAMMA_CNTLA_EXP_REGION1_LUT_OFFSET, curve[1].offset,
-			REGAMMA_CNTLA_EXP_REGION1_NUM_SEGMENTS, curve[1].segments_num);
-
-	}
-
-	curve += 2;
-
-	{
-		REG_SET_4(REGAMMA_CNTLA_REGION_12_13, 0,
-			REGAMMA_CNTLA_EXP_REGION0_LUT_OFFSET, curve[0].offset,
-			REGAMMA_CNTLA_EXP_REGION0_NUM_SEGMENTS, curve[0].segments_num,
-			REGAMMA_CNTLA_EXP_REGION1_LUT_OFFSET, curve[1].offset,
-			REGAMMA_CNTLA_EXP_REGION1_NUM_SEGMENTS, curve[1].segments_num);
-
-	}
-
-	curve += 2;
-
-	{
-		REG_SET_4(REGAMMA_CNTLA_REGION_14_15, 0,
-			REGAMMA_CNTLA_EXP_REGION0_LUT_OFFSET, curve[0].offset,
-			REGAMMA_CNTLA_EXP_REGION0_NUM_SEGMENTS, curve[0].segments_num,
-			REGAMMA_CNTLA_EXP_REGION1_LUT_OFFSET, curve[1].offset,
-			REGAMMA_CNTLA_EXP_REGION1_NUM_SEGMENTS, curve[1].segments_num);
-	}
-}
-
-static void program_pwl(
-	struct dce110_opp *opp110,
-	const struct pwl_params *params)
-{
-	uint32_t value;
-	int retval;
-
-	{
-		uint8_t max_tries = 10;
-		uint8_t counter = 0;
-
-		/* Power on LUT memory */
-		if (REG(DCFE_MEM_PWR_CTRL))
-			REG_UPDATE(DCFE_MEM_PWR_CTRL,
-				DCP_REGAMMA_MEM_PWR_DIS, 1);
-		else
-			REG_UPDATE(DCFE_MEM_LIGHT_SLEEP_CNTL,
-				REGAMMA_LUT_LIGHT_SLEEP_DIS, 1);
-
-		while (counter < max_tries) {
-			if (REG(DCFE_MEM_PWR_STATUS)) {
-				value = REG_READ(DCFE_MEM_PWR_STATUS);
-				REG_GET(DCFE_MEM_PWR_STATUS,
-						DCP_REGAMMA_MEM_PWR_STATE,
-						&retval);
-
-				if (retval == 0)
-						break;
-				++counter;
-			} else {
-				value = REG_READ(DCFE_MEM_LIGHT_SLEEP_CNTL);
-				REG_GET(DCFE_MEM_LIGHT_SLEEP_CNTL,
-						REGAMMA_LUT_MEM_PWR_STATE,
-						&retval);
-
-				if (retval == 0)
-						break;
-				++counter;
-			}
-		}
-
-		if (counter == max_tries) {
-			dm_logger_write(opp110->base.ctx->logger, LOG_WARNING,
-				"%s: regamma lut was not powered on "
-				"in a timely manner,"
-				" programming still proceeds\n",
-				__func__);
-		}
-	}
-
-	REG_UPDATE(REGAMMA_LUT_WRITE_EN_MASK,
-			REGAMMA_LUT_WRITE_EN_MASK, 7);
-
-	REG_WRITE(REGAMMA_LUT_INDEX, 0);
-
-	/* Program REGAMMA_LUT_DATA */
-	{
-		uint32_t i = 0;
-		const struct pwl_result_data *rgb = params->rgb_resulted;
-
-		while (i != params->hw_points_num) {
-
-			REG_WRITE(REGAMMA_LUT_DATA, rgb->red_reg);
-			REG_WRITE(REGAMMA_LUT_DATA, rgb->green_reg);
-			REG_WRITE(REGAMMA_LUT_DATA, rgb->blue_reg);
-			REG_WRITE(REGAMMA_LUT_DATA, rgb->delta_red_reg);
-			REG_WRITE(REGAMMA_LUT_DATA, rgb->delta_green_reg);
-			REG_WRITE(REGAMMA_LUT_DATA, rgb->delta_blue_reg);
-
-			++rgb;
-			++i;
-		}
-	}
-
-	/*  we are done with DCP LUT memory; re-enable low power mode */
-	if (REG(DCFE_MEM_PWR_CTRL))
-		REG_UPDATE(DCFE_MEM_PWR_CTRL,
-			DCP_REGAMMA_MEM_PWR_DIS, 0);
-	else
-		REG_UPDATE(DCFE_MEM_LIGHT_SLEEP_CNTL,
-			REGAMMA_LUT_LIGHT_SLEEP_DIS, 0);
-}
-
-bool dce110_opp_program_regamma_pwl(
-	struct output_pixel_processor *opp,
-	const struct pwl_params *params)
-{
-	struct dce110_opp *opp110 = TO_DCE110_OPP(opp);
-
-	/* Setup regions */
-	regamma_config_regions_and_segments(opp110, params);
-
-	/* Program PWL */
-	program_pwl(opp110, params);
-
-	return true;
-}
-
-void dce110_opp_power_on_regamma_lut(
-	struct output_pixel_processor *opp,
-	bool power_on)
-{
-	struct dce110_opp *opp110 = TO_DCE110_OPP(opp);
-
-	if (REG(DCFE_MEM_PWR_CTRL))
-		REG_UPDATE_2(DCFE_MEM_PWR_CTRL,
-			DCP_REGAMMA_MEM_PWR_DIS, power_on,
-			DCP_LUT_MEM_PWR_DIS, power_on);
-	else
-		REG_UPDATE_2(DCFE_MEM_LIGHT_SLEEP_CNTL,
-			REGAMMA_LUT_LIGHT_SLEEP_DIS, power_on,
-			DCP_LUT_LIGHT_SLEEP_DIS, power_on);
-
-}
-
-void dce110_opp_set_regamma_mode(struct output_pixel_processor *opp,
-		enum opp_regamma mode)
-{
-	struct dce110_opp *opp110 = TO_DCE110_OPP(opp);
-
-	REG_SET(REGAMMA_CONTROL, 0,
-			GRPH_REGAMMA_MODE, mode);
-}
 
 /**
  *	set_truncation
@@ -768,10 +534,7 @@ void dce110_opp_program_fmt(
 /*****************************************/
 
 static const struct opp_funcs funcs = {
-	.opp_power_on_regamma_lut = dce110_opp_power_on_regamma_lut,
 	.opp_set_dyn_expansion = dce110_opp_set_dyn_expansion,
-	.opp_program_regamma_pwl = dce110_opp_program_regamma_pwl,
-	.opp_set_regamma_mode = dce110_opp_set_regamma_mode,
 	.opp_destroy = dce110_opp_destroy,
 	.opp_program_fmt = dce110_opp_program_fmt,
 	.opp_program_bit_depth_reduction = dce110_opp_program_bit_depth_reduction
drivers/gpu/drm/amd/display/dc/dce/dce_opp.h +1 -112

200 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_transform.c +240 -0

253 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_transform.h +88 -0

128 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +9 -9
index b62a7614fd28..1f18fcf52661 100644
@@ -625,26 +625,26 @@ static bool dce110_set_output_transfer_func(
 	struct pipe_ctx *pipe_ctx,
 	const struct dc_stream *stream)
 {
-	struct output_pixel_processor *opp = pipe_ctx->opp;
+	struct transform *xfm = pipe_ctx->xfm;
 
-	opp->funcs->opp_power_on_regamma_lut(opp, true);
-	opp->regamma_params.hw_points_num = GAMMA_HW_POINTS_NUM;
+	xfm->funcs->opp_power_on_regamma_lut(xfm, true);
+	xfm->regamma_params.hw_points_num = GAMMA_HW_POINTS_NUM;
 
 	if (stream->out_transfer_func &&
 		stream->out_transfer_func->type ==
 			TF_TYPE_PREDEFINED &&
 		stream->out_transfer_func->tf ==
 			TRANSFER_FUNCTION_SRGB) {
-		opp->funcs->opp_set_regamma_mode(opp, OPP_REGAMMA_SRGB);
+		xfm->funcs->opp_set_regamma_mode(xfm, OPP_REGAMMA_SRGB);
 	} else if (dce110_translate_regamma_to_hw_format(
-				stream->out_transfer_func, &opp->regamma_params)) {
-			opp->funcs->opp_program_regamma_pwl(opp, &opp->regamma_params);
-			opp->funcs->opp_set_regamma_mode(opp, OPP_REGAMMA_USER);
+				stream->out_transfer_func, &xfm->regamma_params)) {
+		xfm->funcs->opp_program_regamma_pwl(xfm, &xfm->regamma_params);
+		xfm->funcs->opp_set_regamma_mode(xfm, OPP_REGAMMA_USER);
 	} else {
-		opp->funcs->opp_set_regamma_mode(opp, OPP_REGAMMA_BYPASS);
+		xfm->funcs->opp_set_regamma_mode(xfm, OPP_REGAMMA_BYPASS);
 	}
 
-	opp->funcs->opp_power_on_regamma_lut(opp, false);
+	xfm->funcs->opp_power_on_regamma_lut(xfm, false);
 
 	return true;
 }
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_regamma_v.c +44 -44

264 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_v.c +0 -3
index 24d9032faade..69d6a110dbc3 100644
@@ -37,10 +37,7 @@
 /*****************************************/
 
 static const struct opp_funcs funcs = {
-		.opp_power_on_regamma_lut = dce110_opp_power_on_regamma_lut_v,
-		.opp_program_regamma_pwl = dce110_opp_program_regamma_pwl_v,
 		.opp_set_dyn_expansion = dce110_opp_set_dyn_expansion,
-		.opp_set_regamma_mode = dce110_opp_set_regamma_mode_v,
 		.opp_destroy = dce110_opp_destroy,
 		.opp_program_fmt = dce110_opp_program_fmt,
 		.opp_program_bit_depth_reduction =
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_v.h +0 -11
index 7deaa4f5c659..269c1a88d5bb 100644
@@ -35,16 +35,5 @@ bool dce110_opp_v_construct(struct dce110_opp *opp110,
 /* underlay callbacks */
 
 
-bool dce110_opp_program_regamma_pwl_v(
-	struct output_pixel_processor *opp,
-	const struct pwl_params *params);
-
-void dce110_opp_power_on_regamma_lut_v(
-	struct output_pixel_processor *opp,
-	bool power_on);
-
-void dce110_opp_set_regamma_mode_v(
-	struct output_pixel_processor *opp,
-	enum opp_regamma mode);
 
 #endif /* __DC_OPP_DCE110_V_H__ */
drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.c +3 -0
index f655145b3c47..c84823a40f61 100644
@@ -683,6 +683,9 @@ static const struct transform_funcs dce110_xfmv_funcs = {
 		dce110_xfmv_set_gamut_remap,
 	.opp_set_csc_default = dce110_opp_v_set_csc_default,
 	.opp_set_csc_adjustment = dce110_opp_v_set_csc_adjustment,
+	.opp_power_on_regamma_lut = dce110_opp_power_on_regamma_lut_v,
+	.opp_program_regamma_pwl = dce110_opp_program_regamma_pwl_v,
+	.opp_set_regamma_mode = dce110_opp_set_regamma_mode_v,
 	.transform_set_pixel_storage_depth =
 			dce110_xfmv_set_pixel_storage_depth,
 	.transform_get_optimal_number_of_taps =
drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.h +14 -0
index b7f8fdb392a5..eeed3b9f90f7 100644
@@ -41,4 +41,18 @@ void dce110_opp_v_set_csc_default(
 void dce110_opp_v_set_csc_adjustment(
 		struct transform *xfm,
 	const struct out_csc_color_matrix *tbl_entry);
+
+
+bool dce110_opp_program_regamma_pwl_v(
+	struct transform *xfm,
+	const struct pwl_params *params);
+
+void dce110_opp_power_on_regamma_lut_v(
+	struct transform *xfm,
+	bool power_on);
+
+void dce110_opp_set_regamma_mode_v(
+	struct transform *xfm,
+	enum opp_regamma mode);
+
 #endif
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +0 -17
index a4f8556d6797..dadd2ad2e5b8 100644
@@ -251,24 +251,7 @@ enum ovl_csc_adjust_item {
 };
 
 struct opp_funcs {
-	void (*opp_power_on_regamma_lut)(
-		struct output_pixel_processor *opp,
-		bool power_on);
-
-	bool (*opp_program_regamma_pwl)(
-		struct output_pixel_processor *opp,
-		const struct pwl_params *params);
-
-	void (*opp_set_regamma_mode)(struct output_pixel_processor *opp,
-			enum opp_regamma mode);
 
-	void (*opp_set_csc_adjustment)(
-		struct output_pixel_processor *opp,
-		const struct out_csc_color_matrix *tbl_entry);
-
-	void (*opp_set_csc_default)(
-		struct output_pixel_processor *opp,
-		const struct default_adjustment *default_adjust);
 
 	/* FORMATTER RELATED */
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#80 lore raw

PATCH 77/120 drm/amd/display: remove DCN1 guard as DCN1 is already open sourced.

In reply to a message not in the archive

From: "AMD\\ktsao" <[email protected]>

Change-Id I0f41f9ec6fc3a37af6d28b6e91d57820759ddecb
---
 drivers/gpu/drm/amd/display/dc/dc.h                |  6 --
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.h       | 91 ++++++++++------------
 .../gpu/drm/amd/display/dc/dce/dce_clock_source.h  |  2 -
 drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.h      | 20 ++---
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.h  | 15 ++--
 .../drm/amd/display/dc/dce/dce_stream_encoder.h    |  6 --
 drivers/gpu/drm/amd/display/dc/dm_services.h       |  2 -
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |  2 -
 .../gpu/drm/amd/display/dc/inc/hw/display_clock.h  |  2 -
 drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h        |  2 -
 drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h  |  4 -
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h        |  2 -
 .../drm/amd/display/dc/inc/hw/timing_generator.h   |  7 +-
 drivers/gpu/drm/amd/display/include/dal_asic_id.h  |  4 -
 drivers/gpu/drm/amd/display/include/dal_types.h    |  3 +-
 15 files changed, 58 insertions(+), 110 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +0 -6
index 0918569eefa8..d03218d6210a 100644
@@ -96,13 +96,9 @@ struct dc_surface;
 struct validate_context;
 
 struct dc_cap_funcs {
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	bool (*get_dcc_compression_cap)(const struct dc *dc,
 			const struct dc_dcc_surface_param *input,
 			struct dc_surface_dcc_cap *output);
-#else
-	int i;
-#endif
 };
 
 struct dc_stream_funcs {
@@ -171,7 +167,6 @@ struct dc_debug {
 	bool disable_stutter;
 	bool disable_dcc;
 	bool disable_dfs_bypass;
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	bool disable_dpp_power_gate;
 	bool disable_hubp_power_gate;
 	bool disable_pplib_wm_range;
@@ -185,7 +180,6 @@ struct dc_debug {
 	int percent_of_ideal_drambw;
 	int dram_clock_change_latency_ns;
 	int always_scale;
-#endif
 	bool disable_pplib_clock_request;
 	bool disable_clock_gate;
 	bool disable_dmcu;
drivers/gpu/drm/amd/display/dc/dce/dce_abm.h +43 -48

103 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.h +0 -2
index e8bc98b3b622..fc923886e3d4 100644
@@ -55,7 +55,6 @@
 	CS_SF(PHYPLLA_PIXCLK_RESYNC_CNTL, PHYPLLA_DCCG_DEEP_COLOR_CNTL, mask_sh),\
 	CS_SF(PHYPLLA_PIXCLK_RESYNC_CNTL, PHYPLLA_PIXCLK_DOUBLE_RATE_ENABLE, mask_sh)
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 #define CS_COMMON_REG_LIST_DCN1_0(index, pllid) \
 		SRI(PIXCLK_RESYNC_CNTL, PHYPLL, pllid),\
 		SRII(PHASE, DP_DTO, 0),\
@@ -74,7 +73,6 @@
 #define CS_COMMON_MASK_SH_LIST_DCN1_0(mask_sh)\
 	CS_SF(PHYPLLA_PIXCLK_RESYNC_CNTL, PHYPLLA_DCCG_DEEP_COLOR_CNTL, mask_sh),\
 	CS_SF(OTG0_PIXEL_RATE_CNTL, DP_DTO0_ENABLE, mask_sh)
-#endif
 
 #define CS_REG_FIELD_LIST(type) \
 	type PLL_REF_DIV_SRC; \
drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.h +7 -13
index c421a0250016..b85f53c2f6f8 100644
@@ -48,11 +48,9 @@
 	DMCU_COMMON_REG_LIST_DCE_BASE(), \
 	SR(DCI_MEM_PWR_STATUS)
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
-	#define DMCU_DCN10_REG_LIST()\
-		DMCU_COMMON_REG_LIST_DCE_BASE(), \
-		SR(DMU_MEM_PWR_CNTL)
-#endif
+#define DMCU_DCN10_REG_LIST()\
+	DMCU_COMMON_REG_LIST_DCE_BASE(), \
+	SR(DMU_MEM_PWR_CNTL)
 
 #define DMCU_SF(reg_name, field_name, post_fix)\
 	.field_name = reg_name ## __ ## field_name ## post_fix
@@ -82,12 +80,10 @@
 	DMCU_SF(DCI_MEM_PWR_STATUS, \
 		DMCU_IRAM_MEM_PWR_STATE, mask_sh)
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
-	#define DMCU_MASK_SH_LIST_DCN10(mask_sh) \
-		DMCU_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(mask_sh), \
-		DMCU_SF(DMU_MEM_PWR_CNTL, \
-				DMCU_IRAM_MEM_PWR_STATE, mask_sh)
-#endif
+#define DMCU_MASK_SH_LIST_DCN10(mask_sh) \
+	DMCU_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(mask_sh), \
+	DMCU_SF(DMU_MEM_PWR_CNTL, \
+			DMCU_IRAM_MEM_PWR_STATE, mask_sh)
 
 #define DMCU_REG_FIELD_LIST(type) \
 	type DMCU_IRAM_MEM_PWR_STATE; \
@@ -211,13 +207,11 @@ struct dmcu *dce_dmcu_create(
 	const struct dce_dmcu_shift *dmcu_shift,
 	const struct dce_dmcu_mask *dmcu_mask);
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 struct dmcu *dcn10_dmcu_create(
 	struct dc_context *ctx,
 	const struct dce_dmcu_registers *regs,
 	const struct dce_dmcu_shift *dmcu_shift,
 	const struct dce_dmcu_mask *dmcu_mask);
-#endif
 
 void dce_dmcu_destroy(struct dmcu **dmcu);
 
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.h +6 -9
index a47b075f4869..5f05ca65281e 100644
@@ -100,15 +100,12 @@
 	SRI(DP_DPHY_HBR2_PATTERN_CONTROL, DP, id), \
 	SR(DCI_MEM_PWR_STATUS)
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
-	#define LE_DCN10_REG_LIST(id)\
-		LE_COMMON_REG_LIST_BASE(id), \
-		SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \
-		SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
-		SRI(DP_DPHY_HBR2_PATTERN_CONTROL, DP, id), \
-		SR(DMU_MEM_PWR_CNTL)
-#endif
-
+#define LE_DCN10_REG_LIST(id)\
+	LE_COMMON_REG_LIST_BASE(id), \
+	SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \
+	SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
+	SRI(DP_DPHY_HBR2_PATTERN_CONTROL, DP, id), \
+	SR(DMU_MEM_PWR_CNTL)
 
 struct dce110_link_enc_aux_registers {
 	uint32_t AUX_CONTROL;
drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.h +0 -6
index 0b548cb3af14..ff8ca1246650 100644
@@ -97,7 +97,6 @@
 	SE_COMMON_REG_LIST_DCE_BASE(id), \
 	SRI(AFMT_CNTL, DIG, id)
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 #define SE_DCN_REG_LIST(id)\
 	SE_COMMON_REG_LIST_BASE(id),\
 	SRI(AFMT_CNTL, DIG, id),\
@@ -112,7 +111,6 @@
 	SRI(DP_MSA_TIMING_PARAM3, DP, id), \
 	SRI(DP_MSA_TIMING_PARAM4, DP, id), \
 	SRI(HDMI_DB_CONTROL, DIG, id)
-#endif
 
 #define SE_SF(reg_name, field_name, post_fix)\
 	.field_name = reg_name ## __ ## field_name ## post_fix
@@ -328,7 +326,6 @@
 	SE_SF(DIG0_AFMT_AVI_INFO3, AFMT_AVI_INFO_VERSION, mask_sh),\
 	SE_SF(DP0_DP_VID_TIMING, DP_VID_M_DOUBLE_VALUE_EN, mask_sh)
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 #define SE_COMMON_MASK_SH_LIST_DCN10(mask_sh)\
 	SE_COMMON_MASK_SH_LIST_SOC(mask_sh),\
 	SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL, AFMT_GENERIC_LOCK_STATUS, mask_sh),\
@@ -368,7 +365,6 @@
 	SE_SF(DP0_DP_MSA_TIMING_PARAM4, DP_MSA_VHEIGHT, mask_sh),\
 	SE_SF(DIG0_HDMI_DB_CONTROL, HDMI_DB_DISABLE, mask_sh),\
 	SE_SF(DP0_DP_VID_TIMING, DP_VID_N_MUL, mask_sh)
-#endif
 
 struct dce_stream_encoder_shift {
 	uint8_t AFMT_GENERIC_INDEX;
@@ -684,7 +680,6 @@ struct dce110_stream_enc_registers {
 	uint32_t HDMI_ACR_48_0;
 	uint32_t HDMI_ACR_48_1;
 	uint32_t TMDS_CNTL;
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	uint32_t DP_DB_CNTL;
 	uint32_t DP_MSA_MISC;
 	uint32_t DP_MSA_COLORIMETRY;
@@ -693,7 +688,6 @@ struct dce110_stream_enc_registers {
 	uint32_t DP_MSA_TIMING_PARAM3;
 	uint32_t DP_MSA_TIMING_PARAM4;
 	uint32_t HDMI_DB_CONTROL;
-#endif
 };
 
 struct dce110_stream_encoder {
drivers/gpu/drm/amd/display/dc/dm_services.h +0 -2
index e9bf4c417cc7..a7d661d1ff1d 100644
@@ -75,9 +75,7 @@
 	BREAK_TO_DEBUGGER(); \
 } while (0)
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 #include <asm/fpu/api.h>
-#endif
 
 #define dm_alloc(size) kzalloc(size, GFP_KERNEL)
 #define dm_realloc(ptr, size) krealloc(ptr, size, GFP_KERNEL)
drivers/gpu/drm/amd/display/dc/inc/core_types.h +0 -2
index ab389abf4e79..da52971d3f06 100644
@@ -32,9 +32,7 @@
 #include "ddc_service_types.h"
 #include "dc_bios_types.h"
 #include "mem_input.h"
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 #include "mpc.h"
-#endif
 
 #define MAX_CLOCK_SOURCES 7
 
drivers/gpu/drm/amd/display/dc/inc/hw/display_clock.h +0 -2
index 240ab11d1d30..879c3db7cba6 100644
@@ -37,13 +37,11 @@ struct clocks_value {
 	bool dispclk_notify_pplib_done;
 	bool pixelclk_notify_pplib_done;
 	bool phyclk_notigy_pplib_done;
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	int dcfclock_in_khz;
 	int dppclk_in_khz;
 	int mclk_in_khz;
 	int phyclk_in_khz;
 	int common_vdd_level;
-#endif
 };
 
 
drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h +0 -2
index 1298d306db69..0f952e5b3ae8 100644
@@ -122,9 +122,7 @@ struct ipp_funcs {
 		struct input_pixel_processor *ipp,
 		const struct pwl_params *params);
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	void (*ipp_destroy)(struct input_pixel_processor **ipp);
-#endif
 };
 
 #endif /* __DAL_IPP_H__ */
drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h +0 -4
index a7c89c36f90f..a02f18ae527d 100644
@@ -28,7 +28,6 @@
 #include "dc.h"
 #include "include/grph_object_id.h"
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 #include "dml/display_mode_structs.h"
 
 struct cstate_pstate_watermarks_st {
@@ -49,7 +48,6 @@ struct dcn_watermark_set {
 	struct dcn_watermarks c;
 	struct dcn_watermarks d;
 };
-#endif
 
 struct dce_watermarks {
 	int a_mark;
@@ -76,7 +74,6 @@ struct mem_input {
 };
 
 struct mem_input_funcs {
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	void (*mem_input_setup)(
 			struct mem_input *mem_input,
 			struct _vcs_dpi_display_dlg_regs_st *dlg_regs,
@@ -90,7 +87,6 @@ struct mem_input_funcs {
 			struct mem_input *mem_input,
 			const struct rect *viewport,
 			const struct rect *viewport_c);
-#endif
 
 	void (*mem_input_program_display_marks)(
 		struct mem_input *mem_input,
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +0 -2
index dadd2ad2e5b8..75adb8fec551 100644
@@ -27,9 +27,7 @@
 #define __DAL_OPP_H__
 
 #include "hw_shared.h"
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 #include "dc_hw_types.h"
-#endif
 #include "transform.h"
 
 struct fixed31_32;
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h +1 -6
index 2b72d1d8012f..c6ab38c5b2be 100644
@@ -91,7 +91,7 @@ enum crtc_state {
 	CRTC_STATE_VBLANK = 0,
 	CRTC_STATE_VACTIVE
 };
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
+
 struct _dlg_otg_param {
 	int vstartup_start;
 	int vupdate_offset;
@@ -99,7 +99,6 @@ struct _dlg_otg_param {
 	int vready_offset;
 	enum signal_type signal;
 };
-#endif
 
 struct crtc_stereo_flags {
 	uint8_t PROGRAM_STEREO         : 1;
@@ -113,9 +112,7 @@ struct timing_generator {
 	const struct timing_generator_funcs *funcs;
 	struct dc_bios *bp;
 	struct dc_context *ctx;
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	struct _dlg_otg_param dlg_otg_param;
-#endif
 	int inst;
 };
 
@@ -176,10 +173,8 @@ struct timing_generator_funcs {
 
 	bool (*arm_vert_intr)(struct timing_generator *tg, uint8_t width);
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 	void (*program_global_sync)(struct timing_generator *tg);
 	void (*enable_optc_clock)(struct timing_generator *tg, bool enable);
-#endif
 	void (*program_stereo)(struct timing_generator *tg,
 		const struct dc_crtc_timing *timing, struct crtc_stereo_flags *flags);
 	bool (*is_stereo_left_eye)(struct timing_generator *tg);
drivers/gpu/drm/amd/display/include/dal_asic_id.h +0 -4
index 3d2ed5c83734..af9fa66b32b8 100644
@@ -109,18 +109,14 @@
 #define ASIC_REV_IS_STONEY(rev) \
 	((rev >= STONEY_A0) && (rev < CZ_UNKNOWN))
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 /* DCN1_0 */
 #define INTERNAL_REV_RAVEN_A0             0x00    /* First spin of Raven */
 #define RAVEN_A0 0x01
 #define RAVEN_UNKNOWN 0xFF
 
 #define ASIC_REV_IS_RAVEN(eChipRev) ((eChipRev >= RAVEN_A0) && eChipRev < RAVEN_UNKNOWN)
-#endif
 
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
 #define FAMILY_RV 142 /* DCN 1*/
-#endif
 
 /*
  * ASIC chip ID
drivers/gpu/drm/amd/display/include/dal_types.h +1 -2
index 50a2a3ebf36d..1bfc191574aa 100644
@@ -39,9 +39,8 @@ enum dce_version {
 	DCE_VERSION_11_0,
 	DCE_VERSION_11_2,
 	DCE_VERSION_12_0,
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
+	DCE_VERSION_MAX,
 	DCN_VERSION_1_0,
-#endif
 	DCN_VERSION_MAX
 };
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx