DC Linux Patches Jul 25, 2017
Subsystems (3)
cover DC Linux Patches Jul 25, 2017
From: "Leo (Sunpeng) Li" <[email protected]>
* Start of cleanup for midlayer abstractions
* Laying down foundations for FBC
* Future-proofing of DCN functions
* Pipe splitting features for Raven
* General bug fixes for Raven
Amy Zhang (1):
drm/amd/display: Re-enable Vsync Interrupts for Gradual Refresh Ramp
Andrey Grodzovsky (17):
drm/amd/display: Create dm_crtc_state stubs. drm/amd/display: Move dm_plane_state to DAL header. drm/amd/display: Remove unblanaced drm_vblank_put. drm/amd/display: Update atomic state hooks. drm/amd/display: Remove acrtc->stream
drm/amd/display: Undo dc_update_surfaces_and_stream change. drm/amd/display: Refactor dc_commit_streams drm/amd/display: Leave all validate_ctx life cycle management to DC. drm/amd/display: Clean dm_plane_state hooks. drm/amd/display: Attach surface to dm_plane_state. drm/amd/display: Introduce refcount for dc_validate_context drm/amd/display: Skip DC validation for flips and cursor. drm/amd/display: Release dm_state->context when state is cleared. drm/amd/display: dc_validate_ctx refocunt fixes. drm/amd/display: Preserve refcount for S3 case. drm/amd/display: Release cached atomic state in S3. drm/amd/display: Fix S3 gamma corruption.
Anthony Koo (3):
drm/amd/display: add hyst frames for fixed refresh drm/amd/display: Fix MPO visual confirm drm/amd/display: Add regkey for DRR control for internal panel
Bhawanpreet Lakha (3):
drm/amd/display: remove unneeded FBC hw programming code drm/amd/display: Connect DC resource to FBC compressor drm/amd/display: Set static screen register for stoney/carrizo
Charlene Liu (5):
drm/amd/display: Enabling VSR on 4K display causes black screen drm/amd/display: change non_dpm0 state's default SR latency drm/amd/display: fix 4k@30 with 10bit deep color and avi for BT2020 drm/amd/display: fix DVI connected to HDMI connector max tmds clock drm/amd/display: fix aviInfoFrame bar Info and add set_avMute
Corbin McElhanney (3):
drm/amd/display: Add clock info struct drm/amd/display: Add extra mode and clock info to DTN logs drm/amd/display: Fix context copy memory leak
Ding Wang (1):
drm/amd/display: link training fallback actions
Dmytro Laktyushkin (17):
drm/amd/display: fix dcn pipe reset sequence drm/amd/display: enable diags compilation drm/amd/display: Change max OPP
drm/amd/display: Rename DCN TG specific function prefixes to tg drm/amd/display: Rename DCN mem input specific function prefixes to
min.
drm/amd/display: Rename DCN opp specific function prefixes to oppn10 drm/amd/display: Enable ipp compilation
drm/amd/display: Remove SMU_INTERRUPT_CONTROL drm/amd/display: refactor dcn10 hw_sequencer to new reg access style drm/amd/display: get dal1.1 to run
drm/amd/display: minor dcn10_hwseq clean up/refactor drm/amd/display: dal1.1 opp prog update
drm/amd/display: dal1.1 ipp prog update
drm/amd/display: dal1.1 xfm prog update
drm/amd/display: dal1.1 hwseq prog update drm/amd/display: add line number to reg_wait timeout print drm/amd/display: hwseq init sequence update
Eric Yang (7):
drm/amd/display: move number of memory channel calc out of pplib call drm/amd/display: block modes that require read bw greater than 30% drm/amd/display: Change how we disable pipe split drm/amd/display: call pplib to update clocks drm/amd/display: fix mpo exit hang
drm/amd/display: properly turn off unused mpc before front end
programming
drm/amd/display: powergate fe of reused pipes to reset ttu
Harry Wentland (8):
drm/amd/display: Make mode_config_funcs const drm/amd/display: Create dm_atomic_state drm/amd/display: Hook dm private state into atomic_check drm/amd/display: Add correct retain/release drm/amd/display: Commit validation set from state drm/amd/display: Add validate_context to atomic_state drm/amd/display: Use validate_context from atomic_check in commit drm/amd/display: Get freesync properties
John Wu (1):
drm/amd/display: Fix eDP power isn't off when lid close
Ken Chalmers (1):
drm/amd/display: RV stereo support
Leo (Sunpeng) Li (3):
drm/amd/display: Move drm_get_vblank from legacy code drm/amd/display: Flattening to dc_transfer_func drm/amd/display: Do not release state objects on atomic check fail
Tony Cheng (5):
drm/amd/display: update DPM bounding box
drm/amd/display: change order of HUBP and MPC disable according to HW
guide
drm/amd/display: avoid disabling opp clk before hubp is blanked. drm/amd/display: ensure OTG is locked before proceeding drm/amd/display: revert order change of HUBP and MPC disable
Vikrant Mhaske (1):
drm/amd/display: Coding for backcompatible tiling support for Gfx7
Vitaly Prosyak (3):
drm/amd/display: Fix for hdmi frame pack stereo drm/amd/display: Rename trasnform to dpp for dcn's drm/amd/display: Move view port registers and programming to memory
input.
Yongqiang Sun (1):
drm/amd/display: set drr during program timing.
Yue Hin Lau (1):
drm/amd/display: Add DC interface for custom CSC matrix
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 60 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 847 ++++++++-------- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h | 27 +- .../gpu/drm/amd/display/dc/basics/log_helpers.c | 30 +- drivers/gpu/drm/amd/display/dc/basics/logger.c | 6 +- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 173 ++-- drivers/gpu/drm/amd/display/dc/core/dc.c | 286 ++++-- .../gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 6 - drivers/gpu/drm/amd/display/dc/core/dc_link.c | 10 + drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 239 ++++- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 4 +- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 64 +- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 6 +- drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 19 +- drivers/gpu/drm/amd/display/dc/dc.h | 33 +- drivers/gpu/drm/amd/display/dc/dc_helper.c | 6 +- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 8 +- drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c | 8 +- drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h | 41 +- drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h | 188 +++- .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 6 + .../gpu/drm/amd/display/dc/dce/dce_link_encoder.h | 2 - .../drm/amd/display/dc/dce/dce_stream_encoder.c | 13 +- .../drm/amd/display/dc/dce110/dce110_compressor.c | 578 +++-------- .../drm/amd/display/dc/dce110/dce110_compressor.h | 5 +- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 67 +- .../amd/display/dc/dce110/dce110_hw_sequencer.h | 1 + .../drm/amd/display/dc/dce110/dce110_resource.c | 10 + .../display/dc/dce110/dce110_timing_generator.c | 21 + .../drm/amd/display/dc/dce110/dce110_transform_v.c | 4 +- .../drm/amd/display/dc/dce120/dce120_resource.c | 17 +- .../display/dc/dce120/dce120_timing_generator.c | 19 +- drivers/gpu/drm/amd/display/dc/dcn10/Makefile | 2 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c | 1028 +++++++++++++++++++ drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h | 383 +++++++ .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 948 +++++++---------- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h | 2 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c | 108 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.h | 92 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c | 139 ++- .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h | 131 ++- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c | 24 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h | 14 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c | 156 ++- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h | 101 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 91 +- .../amd/display/dc/dcn10/dcn10_timing_generator.c | 185 ++-- .../amd/display/dc/dcn10/dcn10_timing_generator.h | 59 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_transform.c | 1063 -------------------- .../gpu/drm/amd/display/dc/dcn10/dcn10_transform.h | 416 -------- drivers/gpu/drm/amd/display/dc/dm_helpers.h | 3 +- drivers/gpu/drm/amd/display/dc/dm_services.h | 2 +- drivers/gpu/drm/amd/display/dc/dm_services_types.h | 6 + drivers/gpu/drm/amd/display/dc/inc/compressor.h | 46 +- drivers/gpu/drm/amd/display/dc/inc/core_dc.h | 6 + drivers/gpu/drm/amd/display/dc/inc/core_types.h | 11 +- drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h | 8 + drivers/gpu/drm/amd/display/dc/inc/dcn_calcs.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h | 4 + drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h | 1 + .../gpu/drm/amd/display/dc/inc/hw/stream_encoder.h | 3 + drivers/gpu/drm/amd/display/dc/inc/hw/transform.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h | 9 +- drivers/gpu/drm/amd/display/dc/inc/reg_helper.h | 68 +- drivers/gpu/drm/amd/display/dc/inc/resource.h | 1 + .../display/dc/virtual/virtual_stream_encoder.c | 4 + .../drm/amd/display/include/link_service_types.h | 9 + .../gpu/drm/amd/display/include/logger_interface.h | 5 + drivers/gpu/drm/amd/display/include/logger_types.h | 1 + .../drm/amd/display/modules/freesync/freesync.c | 160 +-- .../gpu/drm/amd/display/modules/inc/mod_freesync.h | 4 + 72 files changed, 4271 insertions(+), 3830 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.h
Signature · 6 lines
2.7.4 _______________________________________________ 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): 1500990881-6100-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org
PATCH 1/81 drm/amd/display: RV stereo support
From: Ken Chalmers <[email protected]>
Fix moving directly from frame packed to frame sequential mode: disable OTG_3D_STRUCTURE_EN if the stereo mode is not frame packed.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c +4 -4
@@ -1082,11 +1082,11 @@ static void dcn10_enable_stereo(struct timing_generator *tg,REG_UPDATE (OTG_STEREO_CONTROL ,OTG_DISABLE_STEREOSYNC_OUTPUT_FOR_DP ,1 ); -if (flags->PROGRAM_STEREO && flags->FRAME_PACKED) +if (flags->PROGRAM_STEREO)REG_UPDATE_3 (OTG_3D_STRUCTURE_CONTROL , -OTG_3D_STRUCTURE_EN ,1 , -OTG_3D_STRUCTURE_V_UPDATE_MODE ,1 , -OTG_3D_STRUCTURE_STEREO_SEL_OVR ,1 ); +OTG_3D_STRUCTURE_EN , flags->FRAME_PACKED, +OTG_3D_STRUCTURE_V_UPDATE_MODE , flags->FRAME_PACKED, +OTG_3D_STRUCTURE_STEREO_SEL_OVR , flags->FRAME_PACKED); }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/81 drm/amd/display: Move drm_get_vblank from legacy code
In reply to a message not in the archiveFrom: "Leo (Sunpeng) Li" <[email protected]>
Previously, we assumed that allow_modeset=false => page flip. This assumption breaks when an atomic commit is submitted with allow_modeset set to false, since the legacy flip code is never called (the legacy code grabs the vblank reference).
Fix: Move drm_vblank_get() from amdgpu_atomic_helper_page_flip() to amdgpu_dm_commit_surfaces().
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +4 -6
@@ -977,10 +977,6 @@ static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc,if (!state)return -ENOMEM ; - ret =drm_crtc_vblank_get (crtc); -if (ret) -return ret; - state->acquire_ctx =drm_modeset_legacy_acquire_ctx (crtc); retry: crtc_state =drm_atomic_get_crtc_state (state, crtc);
@@ -2551,8 +2547,6 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,if (!con_state)continue ; - -add_surface (dm->dc, crtc, plane, &dc_surfaces_constructed[planes_count]);if (dc_surfaces_constructed[planes_count] ==NULL ) {
@@ -2571,6 +2565,10 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state, acrtc_attach->flip_flags &DRM_MODE_PAGE_FLIP_ASYNC ? false : true; +/* TODO: Needs rework for multiplane flip */ +if (plane->type ==DRM_PLANE_TYPE_PRIMARY ) +drm_crtc_vblank_get (crtc); + amdgpu_dm_do_flip( crtc, fb,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/81 drm/amd/display: Make mode_config_funcs const
In reply to a message not in the archiveFrom: Harry Wentland <[email protected]>
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -2
@@ -634,8 +634,7 @@ const struct amdgpu_ip_block_version dm_ip_block = .funcs = &amdgpu_dm_funcs, }; -/* TODO: it is temporary non-const, should fixed later */ -static struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { +static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { .fb_create = amdgpu_user_framebuffer_create, .output_poll_changed = amdgpu_output_poll_changed, .atomic_check = amdgpu_dm_atomic_check,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/81 drm/amd/display: Create dm_crtc_state stubs.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
These stubs are initial only since we need to flatten DC objects (steran at least) to implement deep copy.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 74 +++++++++++++++++++++- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h | 10 +++ 2 files changed, 81 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +71 -3
@@ -1034,16 +1034,84 @@ static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc, goto retry; } +static void dm_crtc_destroy_state (struct drm_crtc *crtc, +struct drm_crtc_state *state) +{ +struct dm_crtc_state *cur =to_dm_crtc_state (state); + +if (cur->dc_stream) { +/* TODO Destroy dc_stream objects are stream object is flattened */ +dm_free (cur->dc_stream); + }else +WARN_ON (1 ); + +__drm_atomic_helper_crtc_destroy_state (state); + + +kfree (state); +} + +static void dm_crtc_reset_state (struct drm_crtc *crtc) +{ +struct dm_crtc_state *state; + +if (crtc->state) +dm_crtc_destroy_state (crtc, crtc->state); + + state =kzalloc (sizeof (*state),GFP_KERNEL ); +if (WARN_ON (!state)) +return ; + + + crtc->state = &state->base; + crtc->state->crtc = crtc; + + state->dc_stream =dm_alloc (sizeof (*state->dc_stream)); +WARN_ON (!state->dc_stream); +} + +static struct drm_crtc_state * +dm_crtc_duplicate_state (struct drm_crtc *crtc) +{ +struct dm_crtc_state *state, *cur; +struct dc_stream *dc_stream; + +if (WARN_ON (!crtc->state)) +return NULL ; + + cur =to_dm_crtc_state (crtc->state); +if (WARN_ON (!cur->dc_stream)) +return NULL ; + + dc_stream =dm_alloc (sizeof (*dc_stream)); +if (WARN_ON (!dc_stream)) +return NULL ; + + state =dm_alloc (sizeof (*state)); +if (WARN_ON (!state)) { +dm_free (dc_stream); +return NULL ; + } + +__drm_atomic_helper_crtc_duplicate_state (crtc, &state->base); + + state->dc_stream = dc_stream; + +/* TODO Duplicate dc_stream after objects are stream object is flattened */ + +return &state->base; +} +/* Implemented only the options currently availible for the driver */ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = { - .reset = drm_atomic_helper_crtc_reset, + .reset = dm_crtc_reset_state, .destroy = amdgpu_dm_crtc_destroy, .gamma_set = drm_atomic_helper_legacy_gamma_set, .set_config = drm_atomic_helper_set_config, .set_property = drm_atomic_helper_crtc_set_property, .page_flip = amdgpu_atomic_helper_page_flip, - .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, + .atomic_duplicate_state = dm_crtc_duplicate_state, + .atomic_destroy_state = dm_crtc_destroy_state, }; static enum drm_connector_status
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h +10 -0
@@ -32,6 +32,16 @@ struct amdgpu_framebuffer;struct amdgpu_display_manager ;struct dc_validation_set ;struct dc_surface ; +/* TODO rename to dc_stream_state */ +struct dc_stream ; + + +struct dm_crtc_state { +struct drm_crtc_state base; +struct dc_stream *dc_stream; +}; + +#define to_dm_crtc_state (x) container_of(x, struct dm_crtc_state, base)struct dm_plane_state {struct drm_plane_state base;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/81 drm/amd/display: Add clock info struct
In reply to a message not in the archiveFrom: Corbin McElhanney <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dm_services_types.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/dm_services_types.h +6 -0
@@ -271,4 +271,10 @@ struct dm_pp_static_clock_info { enum dm_pp_clocks_state max_clocks_state; }; +struct dtn_min_clk_info { +uint32_t disp_clk_khz; +uint32_t min_engine_clock_khz; +uint32_t min_memory_clock_khz; +}; +#endif
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/81 drm/amd/display: remove unneeded FBC hw programming code
In reply to a message not in the archiveFrom: Bhawanpreet Lakha <[email protected]>
- Removed uneeded FBC code.
- Initial placeholder for FBC implementation on stoney/carrizo
--- .../drm/amd/display/dc/dce110/dce110_compressor.c | 534 ++++----------------- .../drm/amd/display/dc/dce110/dce110_compressor.h | 3 + drivers/gpu/drm/amd/display/dc/inc/compressor.h | 46 +- 3 files changed, 137 insertions(+), 446 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c +90 -444
@@ -94,199 +94,8 @@ enum fbc_idle_force { FBC_IDLE_FORCE_CG_STATIC_SCREEN_IS_INACTIVE = 0x20000000, }; -static uint32_t lpt_size_alignment (struct dce110_compressor *cp110) -{ -/*LPT_ALIGNMENT (in bytes) = ROW_SIZE * #BANKS * # DRAM CHANNELS. */ -return cp110->base.raw_size * cp110->base.banks_num * - cp110->base.dram_channels_num; -} - -static uint32_t lpt_memory_control_config (struct dce110_compressor *cp110, -uint32_t lpt_control) -{ -/*LPT MC Config */ -if (cp110->base.options.bits.LPT_MC_CONFIG ==1 ) { -/* POSSIBLE VALUES for LPT NUM_PIPES (DRAM CHANNELS): -* 00 - 1 CHANNEL -* 01 - 2 CHANNELS -* 02 - 4 OR 6 CHANNELS -* (Only for discrete GPU, N/A for CZ) -* 03 - 8 OR 12 CHANNELS -* (Only for discrete GPU, N/A for CZ) */ -switch (cp110->base.dram_channels_num) { -case 2 : -set_reg_field_value ( - lpt_control, -1 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_NUM_PIPES ); -break ; -case 1 : -set_reg_field_value ( - lpt_control, -0 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_NUM_PIPES ); -break ; -default : -dm_logger_write ( - cp110->base.ctx->logger,LOG_WARNING , -"%s: Invalid LPT NUM_PIPES!!!" , - __func__); -break ; - } - -/* The mapping for LPT NUM_BANKS is in -* GRPH_CONTROL.GRPH_NUM_BANKS register field -* Specifies the number of memory banks for tiling -* purposes. Only applies to 2D and 3D tiling modes. -* POSSIBLE VALUES: -* 00 - DCP_GRPH_NUM_BANKS_2BANK: ADDR_SURF_2_BANK -* 01 - DCP_GRPH_NUM_BANKS_4BANK: ADDR_SURF_4_BANK -* 02 - DCP_GRPH_NUM_BANKS_8BANK: ADDR_SURF_8_BANK -* 03 - DCP_GRPH_NUM_BANKS_16BANK: ADDR_SURF_16_BANK */ -switch (cp110->base.banks_num) { -case 16 : -set_reg_field_value ( - lpt_control, -3 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_NUM_BANKS ); -break ; -case 8 : -set_reg_field_value ( - lpt_control, -2 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_NUM_BANKS ); -break ; -case 4 : -set_reg_field_value ( - lpt_control, -1 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_NUM_BANKS ); -break ; -case 2 : -set_reg_field_value ( - lpt_control, -0 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_NUM_BANKS ); -break ; -default : -dm_logger_write ( - cp110->base.ctx->logger,LOG_WARNING , -"%s: Invalid LPT NUM_BANKS!!!" , - __func__); -break ; - } - -/* The mapping is in DMIF_ADDR_CALC. -* ADDR_CONFIG_PIPE_INTERLEAVE_SIZE register field for -* Carrizo specifies the memory interleave per pipe. -* It effectively specifies the location of pipe bits in -* the memory address. -* POSSIBLE VALUES: -* 00 - ADDR_CONFIG_PIPE_INTERLEAVE_256B: 256 byte -* interleave -* 01 - ADDR_CONFIG_PIPE_INTERLEAVE_512B: 512 byte -* interleave -*/ -switch (cp110->base.channel_interleave_size) { -case 256 :/*256B */ -set_reg_field_value ( - lpt_control, -0 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_PIPE_INTERLEAVE_SIZE ); -break ; -case 512 :/*512B */ -set_reg_field_value ( - lpt_control, -1 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_PIPE_INTERLEAVE_SIZE ); -break ; -default : -dm_logger_write ( - cp110->base.ctx->logger,LOG_WARNING , -"%s: Invalid LPT INTERLEAVE_SIZE!!!" , - __func__); -break ; - } -/* The mapping for LOW_POWER_TILING_ROW_SIZE is in -* DMIF_ADDR_CALC.ADDR_CONFIG_ROW_SIZE register field -* for Carrizo. Specifies the size of dram row in bytes. -* This should match up with NOOFCOLS field in -* MC_ARB_RAMCFG (ROW_SIZE = 4 * 2 ^^ columns). -* This register DMIF_ADDR_CALC is not used by the -* hardware as it is only used for addrlib assertions. -* POSSIBLE VALUES: -* 00 - ADDR_CONFIG_1KB_ROW: Treat 1KB as DRAM row -* boundary -* 01 - ADDR_CONFIG_2KB_ROW: Treat 2KB as DRAM row -* boundary -* 02 - ADDR_CONFIG_4KB_ROW: Treat 4KB as DRAM row -* boundary */ -switch (cp110->base.raw_size) { -case 4096 :/*4 KB */ -set_reg_field_value ( - lpt_control, -2 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_ROW_SIZE ); -break ; -case 2048 : -set_reg_field_value ( - lpt_control, -1 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_ROW_SIZE ); -break ; -case 1024 : -set_reg_field_value ( - lpt_control, -0 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_ROW_SIZE ); -break ; -default : -dm_logger_write ( - cp110->base.ctx->logger,LOG_WARNING , -"%s: Invalid LPT ROW_SIZE!!!" , - __func__); -break ; - } - }else { -dm_logger_write ( - cp110->base.ctx->logger,LOG_WARNING , -"%s: LPT MC Configuration is not provided" , - __func__); - } - -return lpt_control; -} - -static bool is_source_bigger_than_epanel_size ( -struct dce110_compressor *cp110, -uint32_t source_view_width, -uint32_t source_view_height) -{ -if (cp110->base.embedded_panel_h_size !=0 && - cp110->base.embedded_panel_v_size !=0 && - ((source_view_width * source_view_height) > - (cp110->base.embedded_panel_h_size * - cp110->base.embedded_panel_v_size))) -return true; - -return false; -} - -static uint32_t align_to_chunks_number_per_line ( -struct dce110_compressor *cp110, -uint32_t pixels) +static uint32_t align_to_chunks_number_per_line (uint32_t pixels) {return 256 * ((pixels +255 ) /256 ); }
@@ -372,25 +181,11 @@ void dce110_compressor_enable_fbc(struct dce110_compressor *cp110 =TO_DCE110_COMPRESSOR (compressor);if (compressor->options.bits.FBC_SUPPORT && - (compressor->options.bits.DUMMY_BACKEND ==0 ) && - (!dce110_compressor_is_fbc_enabled_in_hw (compressor,NULL )) && - (!is_source_bigger_than_epanel_size ( - cp110, - params->source_view_width, - params->source_view_height))) { + (!dce110_compressor_is_fbc_enabled_in_hw (compressor,NULL ))) {uint32_t addr;uint32_t value; -/* Before enabling FBC first need to enable LPT if applicable -* LPT state should always be changed (enable/disable) while FBC -* is disabled */ -if (compressor->options.bits.LPT_SUPPORT && (paths_num <2 ) && - (params->source_view_width * - params->source_view_height <= - dce11_one_lpt_channel_max_resolution)) { -dce110_compressor_enable_lpt (compressor); - } addr = mmFBC_CNTL; value =dm_read_reg (compressor->ctx, addr);
@@ -432,11 +227,6 @@ void dce110_compressor_disable_fbc(struct compressor *compressor) compressor->attached_inst =0 ; compressor->is_enabled = false; -/* Whenever disabling FBC make sure LPT is disabled if LPT -* supported */ -if (compressor->options.bits.LPT_SUPPORT) -dce110_compressor_disable_lpt (compressor); -wait_for_fbc_state_changed (cp110, false); } }
@@ -469,17 +259,6 @@ bool dce110_compressor_is_fbc_enabled_in_hw(return false; } -bool dce110_compressor_is_lpt_enabled_in_hw (struct compressor *compressor) -{ -/* Check the hardware register */ -uint32_t value =dm_read_reg (compressor->ctx, - mmLOW_POWER_TILING_CONTROL); - -return get_reg_field_value ( - value, -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_ENABLE ); -} void dce110_compressor_program_compressed_surface_address_and_pitch( struct compressor *compressor,
@@ -499,17 +278,6 @@ void dce110_compressor_program_compressed_surface_address_and_pitch(dm_write_reg (compressor->ctx,DCP_REG (mmGRPH_COMPRESS_SURFACE_ADDRESS),0 ); -if (compressor->options.bits.LPT_SUPPORT) { -uint32_t lpt_alignment =lpt_size_alignment (cp110); - -if (lpt_alignment !=0 ) { - compressed_surf_address_low_part = - ((compressed_surf_address_low_part - + (lpt_alignment -1 )) / lpt_alignment) - * lpt_alignment; - } - } -/* Write address, HIGH has to be first. */ dm_write_reg(compressor->ctx, DCP_REG(mmGRPH_COMPRESS_SURFACE_ADDRESS_HIGH),
@@ -518,9 +286,7 @@ void dce110_compressor_program_compressed_surface_address_and_pitch(DCP_REG (mmGRPH_COMPRESS_SURFACE_ADDRESS), compressed_surf_address_low_part); - fbc_pitch =align_to_chunks_number_per_line ( - cp110, - params->source_view_width); + fbc_pitch =align_to_chunks_number_per_line (params->source_view_width);if (compressor->min_compress_ratio ==FBC_COMPRESS_RATIO_1TO1 ) fbc_pitch = fbc_pitch /8 ;
@@ -543,197 +309,6 @@ void dce110_compressor_program_compressed_surface_address_and_pitch( } -void dce110_compressor_disable_lpt (struct compressor *compressor) -{ -struct dce110_compressor *cp110 =TO_DCE110_COMPRESSOR (compressor); -uint32_t value; -uint32_t addr; -uint32_t inx; - -/* Disable all pipes LPT Stutter */ -for (inx =0 ; inx <3 ; inx++) { - value = -dm_read_reg ( - compressor->ctx, -DMIF_REG (mmDPG_PIPE_STUTTER_CONTROL_NONLPTCH)); -set_reg_field_value ( - value, -0 , -DPG_PIPE_STUTTER_CONTROL_NONLPTCH , -STUTTER_ENABLE_NONLPTCH ); -dm_write_reg ( - compressor->ctx, -DMIF_REG (mmDPG_PIPE_STUTTER_CONTROL_NONLPTCH), - value); - } -/* Disable Underlay pipe LPT Stutter */ - addr = mmDPGV0_PIPE_STUTTER_CONTROL_NONLPTCH; - value =dm_read_reg (compressor->ctx, addr); -set_reg_field_value ( - value, -0 , -DPGV0_PIPE_STUTTER_CONTROL_NONLPTCH , -STUTTER_ENABLE_NONLPTCH ); -dm_write_reg (compressor->ctx, addr, value); - -/* Disable LPT */ - addr = mmLOW_POWER_TILING_CONTROL; - value =dm_read_reg (compressor->ctx, addr); -set_reg_field_value ( - value, -0 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_ENABLE ); -dm_write_reg (compressor->ctx, addr, value); - -/* Clear selection of Channel(s) containing Compressed Surface */ - addr = mmGMCON_LPT_TARGET; - value =dm_read_reg (compressor->ctx, addr); -set_reg_field_value ( - value, -0xFFFFFFFF , -GMCON_LPT_TARGET , -STCTRL_LPT_TARGET ); -dm_write_reg (compressor->ctx, mmGMCON_LPT_TARGET, value); -} - -void dce110_compressor_enable_lpt (struct compressor *compressor) -{ -struct dce110_compressor *cp110 =TO_DCE110_COMPRESSOR (compressor); -uint32_t value; -uint32_t addr; -uint32_t value_control; -uint32_t channels; - -/* Enable LPT Stutter from Display pipe */ - value =dm_read_reg (compressor->ctx, -DMIF_REG (mmDPG_PIPE_STUTTER_CONTROL_NONLPTCH)); -set_reg_field_value ( - value, -1 , -DPG_PIPE_STUTTER_CONTROL_NONLPTCH , -STUTTER_ENABLE_NONLPTCH ); -dm_write_reg (compressor->ctx, -DMIF_REG (mmDPG_PIPE_STUTTER_CONTROL_NONLPTCH), value); - -/* Enable Underlay pipe LPT Stutter */ - addr = mmDPGV0_PIPE_STUTTER_CONTROL_NONLPTCH; - value =dm_read_reg (compressor->ctx, addr); -set_reg_field_value ( - value, -1 , -DPGV0_PIPE_STUTTER_CONTROL_NONLPTCH , -STUTTER_ENABLE_NONLPTCH ); -dm_write_reg (compressor->ctx, addr, value); - -/* Selection of Channel(s) containing Compressed Surface: 0xfffffff -* will disable LPT. -* STCTRL_LPT_TARGETn corresponds to channel n. */ - addr = mmLOW_POWER_TILING_CONTROL; - value_control =dm_read_reg (compressor->ctx, addr); - channels =get_reg_field_value (value_control, -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_MODE ); - - addr = mmGMCON_LPT_TARGET; - value =dm_read_reg (compressor->ctx, addr); -set_reg_field_value ( - value, - channels +1 ,/* not mentioned in programming guide, -but follow DCE8.1 */ -GMCON_LPT_TARGET , -STCTRL_LPT_TARGET ); -dm_write_reg (compressor->ctx, addr, value); - -/* Enable LPT */ - addr = mmLOW_POWER_TILING_CONTROL; - value =dm_read_reg (compressor->ctx, addr); -set_reg_field_value ( - value, -1 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_ENABLE ); -dm_write_reg (compressor->ctx, addr, value); -} - -void dce110_compressor_program_lpt_control ( -struct compressor *compressor, -struct compr_addr_and_pitch_params *params) -{ -struct dce110_compressor *cp110 =TO_DCE110_COMPRESSOR (compressor); -uint32_t rows_per_channel; -uint32_t lpt_alignment; -uint32_t source_view_width; -uint32_t source_view_height; -uint32_t lpt_control =0 ; - -if (!compressor->options.bits.LPT_SUPPORT) -return ; - - lpt_control =dm_read_reg (compressor->ctx, - mmLOW_POWER_TILING_CONTROL); - -/* POSSIBLE VALUES for Low Power Tiling Mode: -* 00 - Use channel 0 -* 01 - Use Channel 0 and 1 -* 02 - Use Channel 0,1,2,3 -* 03 - reserved */ -switch (compressor->lpt_channels_num) { -/* case 2: -* Use Channel 0 & 1 / Not used for DCE 11 */ -case 1 : -/*Use Channel 0 for LPT for DCE 11 */ -set_reg_field_value ( - lpt_control, -0 , -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_MODE ); -break ; -default : -dm_logger_write ( - compressor->ctx->logger,LOG_WARNING , -"%s: Invalid selected DRAM channels for LPT!!!" , - __func__); -break ; - } - - lpt_control =lpt_memory_control_config (cp110, lpt_control); - -/* Program LOW_POWER_TILING_ROWS_PER_CHAN field which depends on -* FBC compressed surface pitch. -* LOW_POWER_TILING_ROWS_PER_CHAN = Roundup ((Surface Height * -* Surface Pitch) / (Row Size * Number of Channels * -* Number of Banks)). */ - rows_per_channel =0 ; - lpt_alignment =lpt_size_alignment (cp110); - source_view_width = -align_to_chunks_number_per_line ( - cp110, - params->source_view_width); - source_view_height = (params->source_view_height +1 ) & (~0x1 ); - -if (lpt_alignment !=0 ) { - rows_per_channel = source_view_width * source_view_height *4 ; - rows_per_channel = - (rows_per_channel % lpt_alignment) ? - (rows_per_channel / lpt_alignment +1 ) : - rows_per_channel / lpt_alignment; - } - -set_reg_field_value ( - lpt_control, - rows_per_channel, -LOW_POWER_TILING_CONTROL , -LOW_POWER_TILING_ROWS_PER_CHAN ); - -dm_write_reg (compressor->ctx, - mmLOW_POWER_TILING_CONTROL, lpt_control); -} - -/* -* DCE 11 Frame Buffer Compression Implementation -*/ -void dce110_compressor_set_fbc_invalidation_triggers (struct compressor *compressor,uint32_t fbc_trigger)
@@ -792,21 +367,20 @@ void dce110_compressor_set_fbc_invalidation_triggers( }bool dce110_compressor_construct (struct dce110_compressor *compressor, -struct dc_context *ctx) +struct dc_context *ctx) { -struct dc_bios *bp = ctx->dc_bios; -struct embedded_panel_info panel_info; compressor->base.options.bits.FBC_SUPPORT = true; - compressor->base.options.bits.LPT_SUPPORT = true; -/* For DCE 11 always use one DRAM channel for LPT */ + +/* for dce 11 always use one dram channel for lpt */ compressor->base.lpt_channels_num =1 ; compressor->base.options.bits.DUMMY_BACKEND = false; -/* Check if this system has more than 1 DRAM channel; if only 1 then LPT -* should not be supported */ -if (compressor->base.memory_bus_width ==64 ) - compressor->base.options.bits.LPT_SUPPORT = false; +/* +* check if this system has more than 1 dram channel; if only 1 then lpt +* should not be supported +*/ + compressor->base.options.bits.CLK_GATING_DISABLED = false;
@@ -826,13 +400,6 @@ bool dce110_compressor_construct(struct dce110_compressor *compressor, compressor->base.attached_inst =0 ; compressor->base.is_enabled = false; -if (BP_RESULT_OK == - bp->funcs->get_embedded_panel_info (bp, &panel_info)) { - compressor->base.embedded_panel_h_size = - panel_info.lcd_timing.horizontal_addressable; - compressor->base.embedded_panel_v_size = - panel_info.lcd_timing.vertical_addressable; - }return true; }
@@ -857,3 +424,82 @@ void dce110_compressor_destroy(struct compressor **compressor)dm_free (TO_DCE110_COMPRESSOR (*compressor)); *compressor =NULL ; } + +bool dce110_get_required_compressed_surfacesize (struct fbc_input_info fbc_input_info, +struct fbc_requested_compressed_size size) +{ +bool result = false; + +unsigned int max_x =FBC_MAX_X , max_y =FBC_MAX_Y ; + +get_max_support_fbc_buffersize (&max_x, &max_y); + +if (fbc_input_info.dynamic_fbc_buffer_alloc ==0 ) { +/* +* For DCE11 here use Max HW supported size: HW Support up to 3840x2400 resolution +* or 18000 chunks. +*/ + size.preferred_size = size.min_size =align_to_chunks_number_per_line (max_x) * max_y *4 ;/* (For FBC when LPT not supported). */ + size.preferred_size_alignment = size.min_size_alignment =0x100 ;/* For FBC when LPT not supported */ + size.bits.preferred_must_be_framebuffer_pool =1 ; + size.bits.min_must_be_framebuffer_pool =1 ; + + result = true; + } +/* +* Maybe to add registry key support with optional size here to override above +* for debugging purposes +*/ + +return result; +} + + +void get_max_support_fbc_buffersize (unsigned int *max_x,unsigned int *max_y) +{ + *max_x =FBC_MAX_X ; + *max_y =FBC_MAX_Y ; + +/* if (m_smallLocalFrameBufferMemory == 1) +* { +* *max_x = FBC_MAX_X_SG; +* *max_y = FBC_MAX_Y_SG; +* } +*/ +} + + +unsigned int controller_id_to_index (enum controller_id controller_id) +{ +unsigned int index =0 ; + +switch (controller_id) { +case CONTROLLER_ID_D0 : + index =0 ; +break ; +case CONTROLLER_ID_D1 : + index =1 ; +break ; +case CONTROLLER_ID_D2 : + index =2 ; +break ; +case CONTROLLER_ID_D3 : + index =3 ; +break ; +default : +break ; + } +return index; +} + + +static const struct compressor_funcs dce110_compressor_funcs = { + .power_up_fbc = dce110_compressor_power_up_fbc, + .enable_fbc = dce110_compressor_enable_fbc, + .disable_fbc = dce110_compressor_disable_fbc, + .set_fbc_invalidation_triggers = dce110_compressor_set_fbc_invalidation_triggers, + .surface_address_and_pitch = dce110_compressor_program_compressed_surface_address_and_pitch, + .is_fbc_enabled_in_hw = dce110_compressor_is_fbc_enabled_in_hw +}; + +
drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.h +3 -0
@@ -75,4 +75,7 @@ void dce110_compressor_program_lpt_control(struct compressor *cp,bool dce110_compressor_is_lpt_enabled_in_hw (struct compressor *cp); +void get_max_support_fbc_buffersize (unsigned int *max_x,unsigned int *max_y); +#endif +
drivers/gpu/drm/amd/display/dc/inc/compressor.h +44 -2
68 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/81 drm/amd/display: fix dcn pipe reset sequence
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
This change fixes dcn10 front end reset sequence. Previously we would reset front end during flip which led to issues in certain MPO and 4k/5k scenarios. We would also never properly power gate our front end.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 2 +- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 19 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 22 +- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 7 + drivers/gpu/drm/amd/display/dc/dc.h | 3 - .../amd/display/dc/dce110/dce110_hw_sequencer.c | 17 +- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 226 ++++++++++----------- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c | 17 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h | 4 +- .../amd/display/dc/dcn10/dcn10_timing_generator.c | 6 +- .../amd/display/dc/dcn10/dcn10_timing_generator.h | 4 + drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h | 2 +- 13 files changed, 155 insertions(+), 175 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +1 -1
@@ -2544,7 +2544,7 @@ static void amdgpu_dm_do_flip( surface_updates->flip_addr = &addr; -dc_update_surfaces_for_stream (adev->dm.dc, surface_updates,1 , acrtc->stream); +dc_update_surfaces_and_stream (adev->dm.dc, surface_updates,1 , acrtc->stream,NULL ); DRM_DEBUG_DRIVER("%s Flipping to hi: 0x%x, low: 0x%x \n", __func__,
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +11 -8
@@ -511,12 +511,14 @@ static void split_stream_across_pipes(struct pipe_ctx *primary_pipe, struct pipe_ctx *secondary_pipe) { + int pipe_idx = secondary_pipe->pipe_idx; +if (!primary_pipe->surface)return ; - secondary_pipe->stream = primary_pipe->stream; - secondary_pipe->tg = primary_pipe->tg; + *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];
@@ -528,8 +530,6 @@ static void split_stream_across_pipes( } primary_pipe->bottom_pipe = secondary_pipe; secondary_pipe->top_pipe = primary_pipe; - secondary_pipe->surface = primary_pipe->surface; - secondary_pipe->pipe_dlg_param = primary_pipe->pipe_dlg_param;resource_build_scaling_params (primary_pipe);resource_build_scaling_params (secondary_pipe);
@@ -1011,10 +1011,13 @@ bool dcn_validate_bandwidth(dcn_bw_calc_rq_dlg_ttu (dc, v, hsplit_pipe); }else if (hsplit_pipe && hsplit_pipe->surface == pipe->surface) {/* merge previously split pipe */ -if (pipe->bottom_pipe->bottom_pipe) - pipe->bottom_pipe->bottom_pipe->top_pipe = pipe; -memset (pipe->bottom_pipe,0 ,sizeof (*pipe->bottom_pipe)); - pipe->bottom_pipe = pipe->bottom_pipe->bottom_pipe; + pipe->bottom_pipe = hsplit_pipe->bottom_pipe; +if (hsplit_pipe->bottom_pipe) + hsplit_pipe->bottom_pipe->top_pipe = pipe; + hsplit_pipe->surface =NULL ; + hsplit_pipe->stream =NULL ; + hsplit_pipe->top_pipe =NULL ; + hsplit_pipe->bottom_pipe =NULL ;resource_build_scaling_params (pipe); }/* for now important to do this after pipe split for building e2e params */
drivers/gpu/drm/amd/display/dc/core/dc.c +5 -17
@@ -963,11 +963,8 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)for (i =0 ; i < core_dc->res_pool->pipe_count; i++)if (context->res_ctx.pipe_ctx[i].stream ==NULL - || context->res_ctx.pipe_ctx[i].surface ==NULL ) { - context->res_ctx.pipe_ctx[i].pipe_idx = i; - core_dc->hwss.power_down_front_end ( - core_dc, &context->res_ctx.pipe_ctx[i]); - } + || context->res_ctx.pipe_ctx[i].surface ==NULL ) + core_dc->hwss.power_down_front_end (core_dc, i);/* 3rd param should be true, temp w/a for RV*/ #if defined(CONFIG_DRM_AMD_DC_DCN1_0 )
@@ -989,7 +986,6 @@ bool dc_commit_surfaces_to_stream(struct dc_plane_info plane_info[MAX_SURFACES ];struct dc_scaling_info scaling_info[MAX_SURFACES ];int i; -bool ret;struct dc_stream_update *stream_update =dm_alloc (sizeof (struct dc_stream_update ));
@@ -1038,10 +1034,10 @@ bool dc_commit_surfaces_to_stream( new_surface_count, dc_stream, stream_update); - ret =dc_post_update_surfaces_to_stream (dc); +dc_post_update_surfaces_to_stream (dc);dm_free (stream_update); -return ret; +return true; } static bool is_surface_in_context(
@@ -1217,14 +1213,6 @@ enum surface_update_type dc_check_update_surfaces_for_stream(return overall_type; } -void dc_update_surfaces_for_stream (struct dc *dc, -struct dc_surface_update *surface_updates,int surface_count, -const struct dc_stream *dc_stream) -{ -dc_update_surfaces_and_stream (dc, surface_updates, surface_count, - dc_stream,NULL ); -} -enum surface_update_type update_surface_trace_level =UPDATE_TYPE_FULL ; void dc_update_surfaces_and_stream(struct dc *dc,
@@ -1401,7 +1389,7 @@ void dc_update_surfaces_and_stream(struct dc *dc, } } -if (!surface_count)/* reset */ +if (surface_count ==0 ) core_dc->hwss.apply_ctx_for_surface (core_dc,NULL , context);/* Lock pipes for provided surfaces, or all active if full update*/
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +7 -0
@@ -1096,6 +1096,10 @@ bool resource_attach_surfaces_to_context( free_pipe->surface = surface;if (tail_pipe) { + free_pipe->tg = tail_pipe->tg; + free_pipe->stream_enc = tail_pipe->stream_enc; + free_pipe->audio = tail_pipe->audio; + free_pipe->clock_source = tail_pipe->clock_source; free_pipe->top_pipe = tail_pipe; tail_pipe->bottom_pipe = free_pipe; }
@@ -2300,6 +2304,9 @@ bool pipe_need_reprogram( struct pipe_ctx *pipe_ctx_old, struct pipe_ctx *pipe_ctx) { +if (!pipe_ctx_old->stream) +return false; +if (pipe_ctx_old->stream->sink != pipe_ctx->stream->sink)return true;
drivers/gpu/drm/amd/display/dc/dc.h +0 -3
@@ -415,9 +415,6 @@ bool dc_commit_surfaces_to_stream(bool dc_post_update_surfaces_to_stream (struct dc *dc); -void dc_update_surfaces_for_stream (struct dc *dc,struct dc_surface_update *updates, -int surface_count,const struct dc_stream *stream); -/* Surface update type is used by dc_update_surfaces_and_stream * The update type is determined at the very beginning of the function based * on parameters passed in and decides how much programming (or updating) is
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +8 -9
@@ -1185,8 +1185,7 @@ static void disable_vga_and_power_gate_all_controllers(enable_display_pipe_clock_gating (ctx, true); - dc->hwss.power_down_front_end ( - dc, &dc->current_context->res_ctx.pipe_ctx[i]); + dc->hwss.power_down_front_end (dc, i); } }
@@ -1340,7 +1339,7 @@ static void reset_single_pipe_hw_ctx(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); + dc->hwss.power_down_front_end ((struct core_dc *)dc, pipe_ctx->pipe_idx); pipe_ctx->stream =NULL ; }
@@ -2538,17 +2537,17 @@ static void dce110_apply_ctx_for_surface( } } -static void dce110_power_down_fe (struct core_dc *dc,struct pipe_ctx *pipe) +static void dce110_power_down_fe (struct core_dc *dc,int fe_idx) {/* Do not power down fe when stream is active on dce*/ -if (pipe->stream) +if (dc->current_context->res_ctx.pipe_ctx[fe_idx].stream)return ; dc->hwss.enable_display_power_gating ( - dc, pipe->pipe_idx, dc->ctx->dc_bios,PIPE_GATING_CONTROL_ENABLE ); -if (pipe->xfm) - pipe->xfm->funcs->transform_reset (pipe->xfm); -memset (&pipe->scl_data,0 ,sizeof (struct scaler_data )); + dc, fe_idx, dc->ctx->dc_bios,PIPE_GATING_CONTROL_ENABLE ); + + dc->res_pool->transforms[fe_idx]->funcs->transform_reset ( + dc->res_pool->transforms[fe_idx]); }static const struct hw_sequencer_funcs dce110_funcs = {
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +102 -124
384 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c +9 -8
@@ -65,17 +65,17 @@ void dcn10_mpcc_set_bg_color(static void set_output_mux (struct dcn10_mpcc *mpcc10,int opp_id,int mpcc_id) { -ASSERT (mpcc10->opp_id ==0xf || opp_id == mpcc10->opp_id); - mpcc10->opp_id = opp_id; +ASSERT (mpcc10->base.opp_id ==0xf || opp_id == mpcc10->base.opp_id); + mpcc10->base.opp_id = opp_id;REG_UPDATE (OPP_PIPE_CONTROL [opp_id],OPP_PIPE_CLOCK_EN ,1 );REG_SET (MUX [opp_id],0 ,MPC_OUT_MUX , mpcc_id); }static void reset_output_mux (struct dcn10_mpcc *mpcc10) { -REG_SET (MUX [mpcc10->opp_id],0 ,MPC_OUT_MUX ,0xf ); -REG_UPDATE (OPP_PIPE_CONTROL [mpcc10->opp_id],OPP_PIPE_CLOCK_EN ,0 ); - mpcc10->opp_id =0xf ; +REG_SET (MUX [mpcc10->base.opp_id],0 ,MPC_OUT_MUX ,0xf ); +REG_UPDATE (OPP_PIPE_CONTROL [mpcc10->base.opp_id],OPP_PIPE_CLOCK_EN ,0 ); + mpcc10->base.opp_id =0xf ; }static void dcn10_mpcc_set (struct mpcc *mpcc,struct mpcc_cfg *cfg)
@@ -104,16 +104,17 @@ static void dcn10_mpcc_set(struct mpcc *mpcc, struct mpcc_cfg *cfg)if (cfg->top_of_tree) {if (cfg->opp_id !=0xf )set_output_mux (mpcc10, cfg->opp_id, mpcc->inst); -else +else if (mpcc->opp_id !=0xf )reset_output_mux (mpcc10); } + mpcc10->base.opp_id = cfg->opp_id; }static void dcn10_mpcc_wait_idle (struct mpcc *mpcc) {struct dcn10_mpcc *mpcc10 =TO_DCN10_MPCC (mpcc); -REG_WAIT (MPCC_STATUS ,MPCC_IDLE ,1 ,1000 ,1000 ); +REG_WAIT (MPCC_STATUS ,MPCC_BUSY ,0 ,1000 ,1000 ); }
@@ -139,5 +140,5 @@ void dcn10_mpcc_construct(struct dcn10_mpcc *mpcc10, mpcc10->mpcc_shift = mpcc_shift; mpcc10->mpcc_mask = mpcc_mask; - mpcc10->opp_id = inst; + mpcc10->base.opp_id = inst; }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h +2 -2
@@ -68,6 +68,7 @@ struct dcn_mpcc_registers {SF (MPCC0_MPCC_CONTROL ,MPCC_ALPHA_MULTIPLIED_MODE , mask_sh),\SF (MPCC0_MPCC_CONTROL ,MPCC_BLND_ACTIVE_OVERLAP_ONLY , mask_sh),\SF (MPCC0_MPCC_STATUS ,MPCC_IDLE , mask_sh),\ +SF (MPCC0_MPCC_STATUS ,MPCC_BUSY , mask_sh),\SF (MPCC0_MPCC_OPP_ID ,MPCC_OPP_ID , mask_sh),\SF (MPCC0_MPCC_BG_G_Y ,MPCC_BG_G_Y , mask_sh),\ SF(MPCC0_MPCC_BG_R_CR, MPCC_BG_R_CR, mask_sh),\
@@ -83,6 +84,7 @@ struct dcn_mpcc_registers {type MPCC_ALPHA_MULTIPLIED_MODE ;\type MPCC_BLND_ACTIVE_OVERLAP_ONLY ;\type MPCC_IDLE ;\ +type MPCC_BUSY ;\type MPCC_OPP_ID ;\type MPCC_BG_G_Y ;\type MPCC_BG_R_CR ;\
@@ -103,8 +105,6 @@ struct dcn10_mpcc {const struct dcn_mpcc_registers *mpcc_regs;const struct dcn_mpcc_shift *mpcc_shift;const struct dcn_mpcc_mask *mpcc_mask; - -int opp_id; }; void dcn10_mpcc_construct(struct dcn10_mpcc *mpcc10,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c +4 -2
@@ -575,6 +575,8 @@ void dcn10_lock(struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg); +REG_SET (OTG_GLOBAL_CONTROL0 ,0 , +OTG_MASTER_UPDATE_LOCK_SEL , tg->inst);REG_SET (OTG_MASTER_UPDATE_LOCK ,0 ,OTG_MASTER_UPDATE_LOCK ,1 ); }
@@ -587,9 +589,9 @@ void dcn10_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 dcn10_get_position(struct timing_generator *tg,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.h +4 -0
@@ -37,6 +37,7 @@SRI (OTG_VREADY_PARAM ,OTG , inst),\SRI (OTG_BLANK_CONTROL ,OTG , inst),\SRI (OTG_MASTER_UPDATE_LOCK ,OTG , inst),\ +SRI (OTG_GLOBAL_CONTROL0 ,OTG , inst),\SRI (OTG_DOUBLE_BUFFER_CONTROL ,OTG , inst),\SRI (OTG_H_TOTAL ,OTG , inst),\ SRI(OTG_H_BLANK_START_END, OTG, inst),\
@@ -83,6 +84,7 @@ struct dcn_tg_registers {uint32_t OTG_VREADY_PARAM ;uint32_t OTG_BLANK_CONTROL ;uint32_t OTG_MASTER_UPDATE_LOCK ; +uint32_t OTG_GLOBAL_CONTROL0 ;uint32_t OTG_DOUBLE_BUFFER_CONTROL ;uint32_t OTG_H_TOTAL ;uint32_t OTG_H_BLANK_START_END ;
@@ -134,6 +136,7 @@ struct dcn_tg_registers {SF (OTG0_OTG_BLANK_CONTROL ,OTG_BLANK_DE_MODE , mask_sh),\SF (OTG0_OTG_BLANK_CONTROL ,OTG_CURRENT_BLANK_STATE , mask_sh),\SF (OTG0_OTG_MASTER_UPDATE_LOCK ,OTG_MASTER_UPDATE_LOCK , mask_sh),\ +SF (OTG0_OTG_GLOBAL_CONTROL0 ,OTG_MASTER_UPDATE_LOCK_SEL , mask_sh),\SF (OTG0_OTG_DOUBLE_BUFFER_CONTROL ,OTG_UPDATE_PENDING , mask_sh),\SF (OTG0_OTG_DOUBLE_BUFFER_CONTROL ,OTG_BLANK_DATA_DOUBLE_BUFFER_EN , mask_sh),\ SF(OTG0_OTG_H_TOTAL, OTG_H_TOTAL, mask_sh),\
@@ -224,6 +227,7 @@ struct dcn_tg_registers {type OTG_CURRENT_BLANK_STATE ;\type OTG_MASTER_UPDATE_LOCK ;\type OTG_UPDATE_PENDING ;\ +type OTG_MASTER_UPDATE_LOCK_SEL ;\type OTG_BLANK_DATA_DOUBLE_BUFFER_EN ;\type OTG_H_TOTAL ;\type OTG_H_BLANK_START ;\
drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h +1 -0
@@ -40,6 +40,7 @@ struct mpcc {const struct mpcc_funcs *funcs;struct dc_context *ctx;int inst; +int opp_id; };struct mpcc_funcs {
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +1 -1
@@ -105,7 +105,7 @@ struct hw_sequencer_funcs {struct dc_bios *dcb, enum pipe_gating_control power_gating); -void (*power_down_front_end)(struct core_dc *dc,struct pipe_ctx *pipe); +void (*power_down_front_end)(struct core_dc *dc,int fe_idx); void (*power_on_front_end)(struct core_dc *dc, struct pipe_ctx *pipe,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/81 drm/amd/display: Move dm_plane_state to DAL header.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h +5 -0
@@ -36,6 +36,11 @@ struct dc_surface;struct dc_stream ; +struct dm_plane_state { +struct drm_plane_state base; +struct dc_surface *dc_surface; +}; +struct dm_crtc_state {struct drm_crtc_state base;struct dc_stream *dc_stream;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/81 drm/amd/display: add hyst frames for fixed refresh
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
--- .../drm/amd/display/modules/freesync/freesync.c | 56 ++++++++++++++-------- 1 file changed, 36 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +36 -20
@@ -37,6 +37,9 @@#define RENDER_TIMES_MAX_COUNT 20/* Threshold to exit BTR (to avoid frequent enter-exits at the lower limit) */ #define BTR_EXIT_MARGIN 2000 +/* Number of consecutive frames to check before entering/exiting fixed refresh*/ +#define FIXED_REFRESH_ENTER_FRAME_COUNT 5 +#define FIXED_REFRESH_EXIT_FRAME_COUNT 5#define FREESYNC_REGISTRY_NAME "freesync_v1"
@@ -72,8 +75,9 @@ struct below_the_range { };struct fixed_refresh { -bool fixed_refresh_active; -bool program_fixed_refresh; +bool fixed_active; +bool program_fixed; +unsigned int frame_counter; };struct freesync_range {
@@ -168,8 +172,8 @@ struct mod_freesync *mod_freesync_create(struct dc *dc)/* Create initial module folder in registry for freesync enable data */ flag.save_per_edid = true; flag.save_per_link = false; -dm_write_persistent_data (core_dc->ctx,NULL ,FREESYNC_REGISTRY_NAME ,NULL ,NULL , -0 , &flag); +dm_write_persistent_data (core_dc->ctx,NULL ,FREESYNC_REGISTRY_NAME , +NULL ,NULL ,0 , &flag); flag.save_per_edid = false; flag.save_per_link = false; if (dm_read_persistent_data(core_dc->ctx, NULL, NULL,
@@ -422,7 +426,7 @@ static void calc_freesync_range(struct core_freesync *core_freesync, min_frame_duration_in_ns) * stream->timing.pix_clk_khz), stream->timing.h_total), 1000000); -/* In case of 4k free sync monitor, vmin or vmax cannot be less than vtotal */ +/* vmin/vmax cannot be less than vtotal */ if (state->freesync_range.vmin < vtotal) {/* Error of 1 is permissible */ ASSERT ((state->freesync_range.vmin +1 ) >= vtotal);
@@ -553,8 +557,8 @@ static void reset_freesync_state_variables(struct freesync_state* state) state->btr.inserted_frame_duration_in_us =0 ; state->btr.program_btr = false; - state->fixed_refresh.fixed_refresh_active = false; - state->fixed_refresh.program_fixed_refresh = false; + state->fixed_refresh.fixed_active = false; + state->fixed_refresh.program_fixed = false; }/* * Sets freesync mode on a stream depending on current freesync state.
@@ -594,7 +598,7 @@ static bool set_freesync_on_streams(struct core_freesync *core_freesync,if (core_freesync->map[map_index].user_enable. enable_for_gaming == true && state->fullscreen == true && - state->fixed_refresh.fixed_refresh_active == false) { + state->fixed_refresh.fixed_active == false) {/* Enable freesync */ v_total_min = state->freesync_range.vmin;
@@ -1240,29 +1244,39 @@ static void update_timestamps(struct core_freesync *core_freesync, state->btr.frame_counter =0 ;/* Exit Fixed Refresh mode */ - }else if (state->fixed_refresh.fixed_refresh_active) { + }else if (state->fixed_refresh.fixed_active) { - state->fixed_refresh.program_fixed_refresh = true; - state->fixed_refresh.fixed_refresh_active = false; + state->fixed_refresh.frame_counter++; +if (state->fixed_refresh.frame_counter > +FIXED_REFRESH_EXIT_FRAME_COUNT ) { + state->fixed_refresh.frame_counter =0 ; + state->fixed_refresh.program_fixed = true; + state->fixed_refresh.fixed_active = false; + } } }else if (last_render_time_in_us > state->time.max_render_time_in_us) {/* Enter Below the Range */ if (!state->btr.btr_active && - core_freesync->map[map_index].caps->btr_supported) { + core_freesync->map[map_index].caps->btr_supported) { state->btr.program_btr = true; state->btr.btr_active = true;/* Enter Fixed Refresh mode */ - }else if (!state->fixed_refresh.fixed_refresh_active && + }else if (!state->fixed_refresh.fixed_active && !core_freesync->map[map_index].caps->btr_supported) { - state->fixed_refresh.program_fixed_refresh = true; - state->fixed_refresh.fixed_refresh_active = true; + state->fixed_refresh.frame_counter++; +if (state->fixed_refresh.frame_counter > +FIXED_REFRESH_ENTER_FRAME_COUNT ) { + state->fixed_refresh.frame_counter =0 ; + state->fixed_refresh.program_fixed = true; + state->fixed_refresh.fixed_active = true; + } } }
@@ -1316,7 +1330,8 @@ static void apply_below_the_range(struct core_freesync *core_freesync, frame_time_in_us = last_render_time_in_us / mid_point_frames_ceil; - delta_from_mid_point_in_us_1 = (state->btr.mid_point_in_us > + delta_from_mid_point_in_us_1 = + (state->btr.mid_point_in_us > frame_time_in_us) ? (state->btr.mid_point_in_us - frame_time_in_us): (frame_time_in_us - state->btr.mid_point_in_us);
@@ -1332,7 +1347,8 @@ static void apply_below_the_range(struct core_freesync *core_freesync, frame_time_in_us = last_render_time_in_us / mid_point_frames_floor; - delta_from_mid_point_in_us_2 = (state->btr.mid_point_in_us > + delta_from_mid_point_in_us_2 = + (state->btr.mid_point_in_us > frame_time_in_us) ? (state->btr.mid_point_in_us - frame_time_in_us): (frame_time_in_us - state->btr.mid_point_in_us);
@@ -1374,15 +1390,15 @@ static void apply_fixed_refresh(struct core_freesync *core_freesync,unsigned int vmin =0 , vmax =0 ;struct freesync_state *state = &core_freesync->map[map_index].state; -if (!state->fixed_refresh.program_fixed_refresh) +if (!state->fixed_refresh.program_fixed)return ; - state->fixed_refresh.program_fixed_refresh = false; + state->fixed_refresh.program_fixed = false;/* Program Fixed Refresh */ /* Fixed Refresh set to "not active" so disengage */ -if (!state->fixed_refresh.fixed_refresh_active) { +if (!state->fixed_refresh.fixed_active) {set_freesync_on_streams (core_freesync, &stream,1 );/* Fixed Refresh set to "active" so engage (fix to max) */
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/81 drm/amd/display: Connect DC resource to FBC compressor
In reply to a message not in the archiveFrom: Bhawanpreet Lakha <[email protected]>
- Connected DC resource to FBC compressor,
- Initial Implementation of FBC for Stoney/Carrizo
- Code is currently guarded with "ENABLE_FBC" compile time flag
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 19 ++++++ .../drm/amd/display/dc/dce110/dce110_compressor.c | 78 +++++++++++----------- .../drm/amd/display/dc/dce110/dce110_compressor.h | 2 +- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 15 +++++ .../drm/amd/display/dc/dce110/dce110_resource.c | 10 +++ drivers/gpu/drm/amd/display/dc/inc/compressor.h | 6 +- drivers/gpu/drm/amd/display/dc/inc/core_dc.h | 6 ++ 7 files changed, 94 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +19 -0
@@ -843,6 +843,11 @@ bool dc_enable_stereo(int i, j;struct pipe_ctx *pipe;struct core_dc *core_dc =DC_TO_CORE (dc); + +#ifdef ENABLE_FBC +struct compressor *fbc_compressor = core_dc->fbc_compressor; +#endif +for (i =0 ; i <MAX_PIPES ; i++) {if (context !=NULL ) pipe = &context->res_ctx.pipe_ctx[i];
@@ -854,6 +859,14 @@ bool dc_enable_stereo( core_dc->hwss.setup_stereo (pipe, core_dc); } } + +#ifdef ENABLE_FBC +if (fbc_compressor !=NULL && + fbc_compressor->funcs->is_fbc_enabled_in_hw (core_dc->fbc_compressor, + &pipe->tg->inst)) + fbc_compressor->funcs->disable_fbc (fbc_compressor); + +#endif return ret; }
@@ -1232,6 +1245,12 @@ void dc_update_surfaces_and_stream(struct dc *dc,if (!stream_status)return ;/* Cannot commit surface to stream that is not committed */ +#ifdef ENABLE_FBC +if (srf_updates->flip_addr) { +if (srf_updates->flip_addr->address.grph.addr.low_part ==0 ) +ASSERT (0 ); + } +#endif context = core_dc->current_context;/* update current stream with the new updates */
drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c +40 -38
93 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.h +1 -1
@@ -50,7 +50,7 @@ void dce110_compressor_destroy(struct compressor **cp);/* FBC RELATED */ void dce110_compressor_power_up_fbc (struct compressor *cp); -void dce110_compressor_enable_fbc (struct compressor *cp,uint32_t paths_num, +void dce110_compressor_enable_fbc (struct compressor *cp,struct compr_addr_and_pitch_params *params);void dce110_compressor_disable_fbc (struct compressor *cp);
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +15 -0
@@ -33,6 +33,10 @@#include "dce110_timing_generator.h" #include "dce/dce_hwseq.h" +#ifdef ENABLE_FBC +#include "dce110_compressor.h" +#endif +#include "bios/bios_parser_helper.h" #include "timing_generator.h" #include "mem_input.h"
@@ -1166,6 +1170,10 @@ static void power_down_all_hw_blocks(struct core_dc *dc)power_down_controllers (dc);power_down_clock_sources (dc); + +#ifdef ENABLE_FBC + dc->fbc_compressor->funcs->disable_fbc (dc->fbc_compressor); +#endif } static void disable_vga_and_power_gate_all_controllers(
@@ -1630,6 +1638,10 @@ 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); +#endif /*TODO: when pplib works*/ apply_min_clocks (dc, context, &clocks_state, true);
@@ -2215,6 +2227,9 @@ static void init_hw(struct core_dc *dc) abm->funcs->init_backlight (abm); abm->funcs->abm_init (abm); } +#ifdef ENABLE_FBC + dc->fbc_compressor->funcs->power_up_fbc (dc->fbc_compressor); +#endif } void dce110_fill_display_configs(
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +10 -0
@@ -52,6 +52,10 @@#include "dce/dce_abm.h" #include "dce/dce_dmcu.h" +#ifdef ENABLE_FBC +#include "dce110/dce110_compressor.h" +#endif +#include "reg_helper.h" #include "dce/dce_11_0_d.h"
@@ -1347,6 +1351,12 @@ static bool construct( } } +#ifdef ENABLE_FBC + dc->fbc_compressor =dce110_compressor_create (ctx); + + + +#endif if (!underlay_create (ctx, &pool->base)) goto res_create_fail;
drivers/gpu/drm/amd/display/dc/inc/compressor.h +3 -3
@@ -45,7 +45,7 @@ union fbc_physical_address { };struct compr_addr_and_pitch_params { -enum controller_id controller_id; +/* enum controller_id controller_id; */ uint32_t inst;uint32_t source_view_width;uint32_t source_view_height;
@@ -63,7 +63,7 @@ struct compressor;struct compressor_funcs {void (*power_up_fbc)(struct compressor *cp); -void (*enable_fbc)(struct compressor *cp,uint32_t paths_num, +void (*enable_fbc)(struct compressor *cp,struct compr_addr_and_pitch_params *params);void (*disable_fbc)(struct compressor *cp); void (*set_fbc_invalidation_triggers)(struct compressor *cp,
@@ -78,7 +78,7 @@ struct compressor {struct dc_context *ctx;uint32_t attached_inst;bool is_enabled; -const struct compressor_funcs funcs; +const struct compressor_funcs *funcs; union { uint32_t raw; struct {
drivers/gpu/drm/amd/display/dc/inc/core_dc.h +6 -0
@@ -10,6 +10,7 @@#include "core_types.h" #include "hw_sequencer.h" +#include "compressor.h" #define DC_TO_CORE (dc)\ container_of(dc, struct core_dc, public)
@@ -44,6 +45,11 @@ struct core_dc {* to compare to see if display config changed */ struct dm_pp_display_configuration prev_display_config; + +/* FBC compressor */ +#ifdef ENABLE_FBC +struct compressor *fbc_compressor; +#endif };#endif /* __CORE_DC_H__ */
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/81 drm/amd/display: Add extra mode and clock info to DTN logs
In reply to a message not in the archiveFrom: Corbin McElhanney <[email protected]>
Adds some additional information to logs in dc_commit_streams to better match Dal2.
Also adds a new function, dc_raw_log, that has the same functionality as dc_conn_log, but does not attach display specific prefixes to the log output.
Finally, adds a new DC log type, LOG_DTN, that logs to LogMinor_DispConnect_dtn in DM. This new log type and dc_raw_log are used to generate clock info in the logs to match Dal2.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +- .../gpu/drm/amd/display/dc/basics/log_helpers.c | 30 +++++++++++++++++++++- drivers/gpu/drm/amd/display/dc/basics/logger.c | 6 +++-- drivers/gpu/drm/amd/display/dc/core/dc.c | 7 ++++- drivers/gpu/drm/amd/display/dc/dm_helpers.h | 3 ++- .../gpu/drm/amd/display/include/logger_interface.h | 5 ++++ drivers/gpu/drm/amd/display/include/logger_types.h | 1 + 7 files changed, 48 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +1 -1
@@ -321,7 +321,7 @@ bool dm_helpers_dp_mst_send_payload_allocation(return true; } -bool dm_helpers_dc_conn_log (struct dc_context *ctx,const char *msg) +bool dm_helpers_dc_conn_log (struct dc_context *ctx,struct log_entry *entry,enum dc_log_type event) {return true; }
drivers/gpu/drm/amd/display/dc/basics/log_helpers.c +29 -1
@@ -95,7 +95,35 @@ void dc_conn_log(struct dc_context *ctx,dm_logger_append (&entry,"%2.2X " , hex_data[i]);dm_logger_append (&entry,"^\n" ); -dm_helpers_dc_conn_log (ctx, entry.buf); +dm_helpers_dc_conn_log (ctx, &entry, event); +dm_logger_close (&entry); + +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 +4 -2
@@ -59,7 +59,8 @@ static const struct dc_log_type_info log_type_info_tbl[] = { {LOG_EVENT_LINK_TRAINING, "LKTN"}, {LOG_EVENT_LINK_LOSS, "LinkLoss"}, {LOG_EVENT_UNDERFLOW, "Underflow"}, - {LOG_IF_TRACE, "InterfaceTrace"} + {LOG_IF_TRACE, "InterfaceTrace"}, + {LOG_DTN, "DTN"} };
@@ -84,7 +85,8 @@ static const struct dc_log_type_info log_type_info_tbl[] = { (1 <<LOG_DETECTION_DP_CAPS ) | \ (1 << LOG_BACKLIGHT)) | \ (1 <<LOG_I2C_AUX ) | \ - (1 <<LOG_IF_TRACE )/* | \ + (1 <<LOG_IF_TRACE ) | \ + (1 <<LOG_DTN )/* | \ (1 << LOG_DEBUG) | \ (1 << LOG_BIOS) | \ (1 << LOG_SURFACE) | \
drivers/gpu/drm/amd/display/dc/core/dc.c +6 -1
@@ -944,9 +944,14 @@ bool dc_commit_streams(dc_enable_stereo (dc, context, streams, stream_count); } -CONN_MSG_MODE (sink->link,"{%dx%d, %dx%d@%dKhz}" , +CONN_MSG_MODE (sink->link,"{%ux%u, %ux%u@%u, %ux%u@%uKhz}" , + context->streams[i]->public.src.width, + context->streams[i]->public.src.height, context->streams[i]->public.timing.h_addressable, context->streams[i]->public.timing.v_addressable, + context->streams[i]->public.timing.pix_clk_khz *1000 / + context->streams[i]->public.timing.h_total / + context->streams[i]->public.timing.v_total,// Refresh rate context->streams[i]->public.timing.h_total, context->streams[i]->public.timing.v_total, context->streams[i]->public.timing.pix_clk_khz);
drivers/gpu/drm/amd/display/dc/dm_helpers.h +2 -1
@@ -70,7 +70,8 @@ bool dm_helpers_dp_mst_start_top_mgr(bool dm_helpers_dc_conn_log (struct dc_context *ctx, -const char *msg); +struct log_entry *entry, +enum dc_log_type event); void dm_helpers_dp_mst_stop_top_mgr( struct dc_context *ctx,
drivers/gpu/drm/amd/display/include/logger_interface.h +5 -0
@@ -70,6 +70,11 @@ 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,
drivers/gpu/drm/amd/display/include/logger_types.h +1 -0
@@ -37,6 +37,7 @@ enum dc_log_type {LOG_WARNING ,LOG_DEBUG ,LOG_DC , +LOG_DTN ,LOG_SURFACE ,LOG_HW_HOTPLUG , LOG_HW_LINK_TRAINING,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/81 drm/amd/display: enable diags compilation
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c | 8 ++--- drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h | 41 ++++------------------ .../drm/amd/display/dc/dce120/dce120_resource.c | 17 +-------- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 22 +++--------- .../gpu/drm/amd/display/dc/dcn10/dcn10_transform.h | 23 ++++++------ drivers/gpu/drm/amd/display/dc/inc/resource.h | 1 + 6 files changed, 27 insertions(+), 85 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c +2 -6
@@ -781,11 +781,7 @@ struct display_clock *dce112_disp_clk_create(return &clk_dce->base; } -struct display_clock *dce120_disp_clk_create ( -struct dc_context *ctx, -const struct dce_disp_clk_registers *regs, -const struct dce_disp_clk_shift *clk_shift, -const struct dce_disp_clk_mask *clk_mask) +struct display_clock *dce120_disp_clk_create (struct dc_context *ctx) {struct dce_disp_clk *clk_dce =dm_alloc (sizeof (*clk_dce));struct dm_pp_clock_levels_with_voltage clk_level_info = {0 };
@@ -800,7 +796,7 @@ struct display_clock *dce120_disp_clk_create( sizeof(dce120_max_clks_by_state));dce_disp_clk_construct ( - clk_dce, ctx, regs, clk_shift, clk_mask); + clk_dce, ctx,NULL ,NULL ,NULL ); clk_dce->base.funcs = &dce120_funcs;
drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h +6 -35
72 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +1 -16
@@ -137,18 +137,6 @@ static const struct dce110_timing_generator_offsets dce120_tg_offsets[] = {* end *********************/ -static const struct dce_disp_clk_registers disp_clk_regs = { -CLK_COMMON_REG_LIST_DCE_BASE () -}; - -static const struct dce_disp_clk_shift disp_clk_shift = { -CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE (__SHIFT) -}; - -static const struct dce_disp_clk_mask disp_clk_mask = { -CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE (_MASK) -}; -static const struct dce_dmcu_registers dmcu_regs = {DMCU_DCE110_COMMON_REG_LIST () };
@@ -904,10 +892,7 @@ static bool construct( } } - pool->base.display_clock =dce120_disp_clk_create (ctx, - &disp_clk_regs, - &disp_clk_shift, - &disp_clk_mask); + pool->base.display_clock =dce120_disp_clk_create (ctx);if (pool->base.display_clock ==NULL ) {dm_error ("DC: failed to create display clock!\n" );BREAK_TO_DEBUGGER ();
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +4 -18
@@ -136,17 +136,6 @@ enum dcn10_clk_src_array_id {/* macros to expend register list macro defined in HW object header file * end *********************/ -static const struct dce_disp_clk_registers disp_clk_regs = { -CLK_DCN10_REG_LIST () -}; - -static const struct dce_disp_clk_shift disp_clk_shift = { -CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE (__SHIFT) -}; - -static const struct dce_disp_clk_mask disp_clk_mask = { -CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE (_MASK) -};static const struct dce_dmcu_registers dmcu_regs = {DMCU_DCN10_REG_LIST ()
@@ -317,7 +306,7 @@ static const struct dcn10_opp_mask opp_mask = {#define tf_regs (id)\ [id] = {\ - TF_REG_LIST_DCN(id),\ + TF_REG_LIST_DCN10(id),\ }static const struct dcn_transform_registers tf_regs[] = {
@@ -328,11 +317,11 @@ static const struct dcn_transform_registers tf_regs[] = { };static const struct dcn_transform_shift tf_shift = { -TF_REG_LIST_SH_MASK_DCN (__SHIFT) +TF_REG_LIST_SH_MASK_DCN10 (__SHIFT) };static const struct dcn_transform_mask tf_mask = { -TF_REG_LIST_SH_MASK_DCN (_MASK), +TF_REG_LIST_SH_MASK_DCN10 (_MASK), };
@@ -1338,10 +1327,7 @@ static bool construct( }if (!IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment)) { - pool->base.display_clock =dce120_disp_clk_create (ctx, - &disp_clk_regs, - &disp_clk_shift, - &disp_clk_mask); + pool->base.display_clock =dce120_disp_clk_create (ctx);if (pool->base.display_clock ==NULL ) {dm_error ("DC: failed to create display clock!\n" );BREAK_TO_DEBUGGER ();
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.h +13 -10
@@ -58,7 +58,6 @@SRI (DCSURF_SEC_VIEWPORT_START ,HUBP , id), \SRI (DCSURF_PRI_VIEWPORT_DIMENSION_C ,HUBP , id), \SRI (DCSURF_PRI_VIEWPORT_START_C ,HUBP , id), \ -SRI (CM_GAMUT_REMAP_CONTROL ,CM , id), \SRI (MPC_SIZE ,DSCL , id), \SRI (SCL_HORZ_FILTER_SCALE_RATIO ,DSCL , id), \ SRI(SCL_VERT_FILTER_SCALE_RATIO, DSCL, id), \
@@ -71,7 +70,10 @@SRI (SCL_VERT_FILTER_INIT_C ,DSCL , id), \SRI (SCL_VERT_FILTER_INIT_BOT_C ,DSCL , id), \SRI (RECOUT_START ,DSCL , id), \ -SRI (RECOUT_SIZE ,DSCL , id), \ + SRI(RECOUT_SIZE, DSCL, id) + +#define TF_REG_LIST_DCN10 (id) \ + TF_REG_LIST_DCN(id), \ SRI(CM_GAMUT_REMAP_CONTROL, CM, id),\ SRI(CM_GAMUT_REMAP_C11_C12, CM, id),\ SRI(CM_GAMUT_REMAP_C13_C14, CM, id),\
@@ -92,8 +94,6 @@SRI (CM_COMB_C31_C32 ,CM , id),\ SRI(CM_COMB_C33_C34, CM, id) - -#define TF_REG_LIST_SH_MASK_DCN (mask_sh)\ TF_SF(DSCL0_DSCL_EXT_OVERSCAN_LEFT_RIGHT, EXT_OVERSCAN_LEFT, mask_sh),\ TF_SF(DSCL0_DSCL_EXT_OVERSCAN_LEFT_RIGHT, EXT_OVERSCAN_RIGHT, mask_sh),\
@@ -103,11 +103,6 @@TF_SF (DSCL0_OTG_H_BLANK ,OTG_H_BLANK_END , mask_sh),\TF_SF (DSCL0_OTG_V_BLANK ,OTG_V_BLANK_START , mask_sh),\TF_SF (DSCL0_OTG_V_BLANK ,OTG_V_BLANK_END , mask_sh),\ -TF_SF (DSCL0_LB_DATA_FORMAT ,PIXEL_DEPTH , mask_sh),\ -TF_SF (DSCL0_LB_DATA_FORMAT ,PIXEL_EXPAN_MODE , mask_sh),\ -TF_SF (DSCL0_LB_DATA_FORMAT ,PIXEL_REDUCE_MODE , mask_sh),\ -TF_SF (DSCL0_LB_DATA_FORMAT ,DYNAMIC_PIXEL_DEPTH , mask_sh),\ -TF_SF (DSCL0_LB_DATA_FORMAT ,DITHER_EN , mask_sh),\TF_SF (DSCL0_LB_DATA_FORMAT ,INTERLEAVE_EN , mask_sh),\TF_SF (DSCL0_LB_DATA_FORMAT ,ALPHA_EN , mask_sh),\ TF_SF(DSCL0_LB_MEMORY_CTRL, MEMORY_CONFIG, mask_sh),\
@@ -172,7 +167,15 @@TF_SF (DSCL0_SCL_VERT_FILTER_INIT_BOT_C ,SCL_V_INIT_FRAC_BOT_C , mask_sh),\TF_SF (DSCL0_SCL_VERT_FILTER_INIT_BOT_C ,SCL_V_INIT_INT_BOT_C , mask_sh),\TF_SF (DSCL0_SCL_MODE ,SCL_CHROMA_COEF_MODE , mask_sh),\ -TF_SF (DSCL0_SCL_MODE ,SCL_COEF_RAM_SELECT_CURRENT , mask_sh),\ + TF_SF(DSCL0_SCL_MODE, SCL_COEF_RAM_SELECT_CURRENT, mask_sh) + +#define TF_REG_LIST_SH_MASK_DCN10 (mask_sh)\ + TF_REG_LIST_SH_MASK_DCN(mask_sh),\ + TF_SF(DSCL0_LB_DATA_FORMAT, PIXEL_DEPTH, mask_sh),\ + TF_SF(DSCL0_LB_DATA_FORMAT, PIXEL_EXPAN_MODE, mask_sh),\ + TF_SF(DSCL0_LB_DATA_FORMAT, PIXEL_REDUCE_MODE, mask_sh),\ + TF_SF(DSCL0_LB_DATA_FORMAT, DYNAMIC_PIXEL_DEPTH, mask_sh),\ + TF_SF(DSCL0_LB_DATA_FORMAT, DITHER_EN, mask_sh),\ TF_SF(CM0_CM_GAMUT_REMAP_CONTROL, CM_GAMUT_REMAP_MODE, mask_sh),\ TF_SF(CM0_CM_GAMUT_REMAP_C11_C12, CM_GAMUT_REMAP_C11, mask_sh),\ TF_SF(CM0_CM_GAMUT_REMAP_C11_C12, CM_GAMUT_REMAP_C12, mask_sh),\
drivers/gpu/drm/amd/display/dc/inc/resource.h +1 -0
@@ -42,6 +42,7 @@ struct resource_caps {int num_audio;int num_stream_encoder;int num_pll; +int num_dwb; };struct resource_straps {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/81 drm/amd/display: Change max OPP
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h +1 -1
@@ -30,7 +30,7 @@#define TO_DCN10_MPCC (mpcc_base) \ container_of(mpcc_base, struct dcn10_mpcc, base) -#define MAX_OPP 4 +#define MAX_OPP 6#define MPC_COMMON_REG_LIST_DCN1_0 (inst) \ SRII(MUX, MPC_OUT, inst),\
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/81 drm/amd/display: Add DC interface for custom CSC matrix
In reply to a message not in the archiveFrom: Yue Hin Lau <[email protected]>
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 26 +++++ drivers/gpu/drm/amd/display/dc/dc.h | 3 + .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 23 ++++ drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c | 117 ++++++++++++++++++++- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h | 76 +++++++++++++ .../gpu/drm/amd/display/dc/dcn10/dcn10_transform.c | 5 +- drivers/gpu/drm/amd/display/dc/inc/hw/transform.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h | 5 + 8 files changed, 252 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +26 -0
@@ -221,6 +221,29 @@ static bool set_gamut_remap(struct dc *dc, const struct dc_stream *stream)return ret; } +static bool program_csc_matrix (struct dc *dc,const struct dc_stream *stream) +{ +struct core_dc *core_dc =DC_TO_CORE (dc); +struct core_stream *core_stream =DC_STREAM_TO_CORE (stream); +int i =0 ; +bool ret = false; +struct pipe_ctx *pipes; + +for (i =0 ; i <MAX_PIPES ; i++) { +if (core_dc->current_context->res_ctx.pipe_ctx[i].stream + == core_stream) { + + pipes = &core_dc->current_context->res_ctx.pipe_ctx[i]; + core_dc->hwss.program_csc_matrix (pipes, + core_stream->public.output_color_space, + core_stream->public.csc_color_matrix.matrix); + ret = true; + } + } + +return ret; +} + static void set_static_screen_events(struct dc *dc, const struct dc_stream **stream, int num_streams,
@@ -373,6 +396,9 @@ static void allocate_dc_stream_funcs(struct core_dc *core_dc) core_dc->public.stream_funcs.set_gamut_remap = set_gamut_remap; + core_dc->public.stream_funcs.program_csc_matrix = + program_csc_matrix; + core_dc->public.stream_funcs.set_dither_option = set_dither_option;
drivers/gpu/drm/amd/display/dc/dc.h +3 -0
@@ -118,6 +118,9 @@ struct dc_stream_funcs {bool (*set_gamut_remap)(struct dc *dc,const struct dc_stream *stream); +bool (*program_csc_matrix)(struct dc *dc, +const struct dc_stream *stream); + void (*set_static_screen_events)(struct dc *dc, const struct dc_stream **stream, int num_streams,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +23 -0
@@ -1623,6 +1623,28 @@ static void program_gamut_remap(struct pipe_ctx *pipe_ctx) pipe_ctx->xfm->funcs->transform_set_gamut_remap (pipe_ctx->xfm, &adjust); } + +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->public.csc_color_matrix.enable_adjustment + == true) { +enum dc_color_space color_space = + pipe_ctx->stream->public.output_color_space; + +//uint16_t matrix[12]; +for (i =0 ; i <12 ; i++) + tbl_entry.regval[i] = pipe_ctx->stream->public.csc_color_matrix.matrix[i]; + + tbl_entry.color_space = color_space; +//tbl_entry.regval = matrix; + pipe_ctx->opp->funcs->opp_set_csc_adjustment (pipe_ctx->opp, &tbl_entry); + } +}static bool is_lower_pipe_tree_visible (struct pipe_ctx *pipe_ctx) {if (pipe_ctx->surface->public.visible)
@@ -2103,6 +2125,7 @@ static void dcn10_setup_stereo(struct pipe_ctx *pipe_ctx,static const struct hw_sequencer_funcs dcn10_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 = dcn10_apply_ctx_for_surface,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c +116 -1
138 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h +76 -0
104 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.c +2 -3
@@ -1027,9 +1027,8 @@ static struct transform_funcs dcn10_transform_funcs = { .transform_reset = transform_reset, .transform_set_scaler = transform_set_scaler_manual_scale, - .transform_get_optimal_number_of_taps = - transform_get_optimal_number_of_taps, - .transform_set_gamut_remap = dcn_transform_set_gamut_remap + .transform_get_optimal_number_of_taps = transform_get_optimal_number_of_taps, + .transform_set_gamut_remap = dcn_transform_set_gamut_remap, };/*****************************************/
drivers/gpu/drm/amd/display/dc/inc/hw/transform.h +1 -0
@@ -180,6 +180,7 @@ struct transform_funcs {struct transform *xfm, const struct xfm_grph_csc_adjustment *adjust); + void (*transform_set_pixel_storage_depth)( struct transform *xfm, enum lb_pixel_depth depth,
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +5 -0
@@ -70,6 +70,11 @@ struct hw_sequencer_funcs {void (*program_gamut_remap)(struct pipe_ctx *pipe_ctx); +void (*program_csc_matrix)( +struct pipe_ctx *pipe_ctx, +enum dc_color_space colorspace, +uint16_t *matrix); +void (*update_plane_addr)(const struct core_dc *dc,struct pipe_ctx *pipe_ctx);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/81 drm/amd/display: Re-enable Vsync Interrupts for Gradual Refresh Ramp
In reply to a message not in the archiveFrom: Amy Zhang <[email protected]>
- Make sure Vsync interrupts are disabled in static screen case and enabled when not to save power
- Create no_static_for_external_dp debug option
--- drivers/gpu/drm/amd/display/dc/dc.h | 1 + .../drm/amd/display/modules/freesync/freesync.c | 38 ++++++++++++++++------ .../gpu/drm/amd/display/modules/inc/mod_freesync.h | 5 +++ 3 files changed, 34 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -188,6 +188,7 @@ struct dc_debug {bool disable_dmcu;bool disable_psr;bool force_abm_enable; +bool no_static_for_external_dp; };struct dc {
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +28 -10
@@ -440,14 +440,11 @@ static void calc_freesync_range(struct core_freesync *core_freesync, }/* Determine whether BTR can be supported */ -//if (max_frame_duration_in_ns >= -// 2 * min_frame_duration_in_ns) -// core_freesync->map[index].caps->btr_supported = true; -//else -// core_freesync->map[index].caps->btr_supported = false; - -/* Temp, keep btr disabled */ - core_freesync->map[index].caps->btr_supported = false; +if (max_frame_duration_in_ns >= +2 * min_frame_duration_in_ns) + core_freesync->map[index].caps->btr_supported = true; +else + core_freesync->map[index].caps->btr_supported = false;/* Cache the time variables */ state->time.max_render_time_in_us =
@@ -882,8 +879,10 @@ void mod_freesync_update_state(struct mod_freesync *mod_freesync,* panels. Also change core variables only if there * is a change. */ -if (dc_is_embedded_signal ( - streams[stream_index]->sink->sink_signal) && +if ((dc_is_embedded_signal ( + streams[stream_index]->sink->sink_signal) || + core_freesync->map[map_index].caps-> + no_static_for_external_dp == false) && state->static_screen != freesync_params->enable) {
@@ -1035,6 +1034,25 @@ bool mod_freesync_get_user_enable(struct mod_freesync *mod_freesync,return true; } +bool mod_freesync_get_static_ramp_active (struct mod_freesync *mod_freesync, +const struct dc_stream *stream, +bool *is_ramp_active) +{ +unsigned int index =0 ; +struct core_freesync *core_freesync =NULL ; + +if (mod_freesync ==NULL ) +return false; + + core_freesync =MOD_FREESYNC_TO_CORE (mod_freesync); + index =map_index_from_stream (core_freesync, stream); + + *is_ramp_active = + core_freesync->map[index].state.static_ramp.ramp_is_active; + +return true; +} + bool mod_freesync_override_min_max(struct mod_freesync *mod_freesync, const struct dc_stream *streams, unsigned int min_refresh,
drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h +5 -0
@@ -88,6 +88,7 @@ struct mod_freesync_caps {unsigned int max_refresh_in_micro_hz;bool btr_supported; +bool no_static_for_external_dp; };struct mod_freesync_params {
@@ -129,6 +130,10 @@ bool mod_freesync_get_user_enable(struct mod_freesync *mod_freesync,const struct dc_stream *stream, struct mod_freesync_user_enable *user_enable); +bool mod_freesync_get_static_ramp_active (struct mod_freesync *mod_freesync, +const struct dc_stream *stream, +bool *is_ramp_active); + bool mod_freesync_override_min_max(struct mod_freesync *mod_freesync, const struct dc_stream *streams, unsigned int min_refresh,
Signature · 6 lines
2.7.4 _______________________________________________ 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): 1500990881-6100-16-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 15/81] drm/amd/display: Re-enable Vsync Interrupts for Gradual Refresh Ramp
Quoted 4 lines · On 25/07/17 10:53 PM, [email protected] wrote:
From: Amy Zhang <[email protected]>
- Make sure Vsync interrupts are disabled in static screen case and enabled when not to save power
What exactly does this mean? FWIW, the interrupt whose handler calls drm_handle_vblank() must be enabled from when the drm_driver::enable_vblank hook is called until when the drm_driver::disable_vblank hook is called.
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
A message that is not in the archive (sent off-list or not yet received): f1763d72-5caf-671b-df61-5064920ad67d-otUistvHUpPR7s880joybQ@public.gmane.org
Re: [PATCH 15/81] drm/amd/display: Re-enable Vsync Interrupts for Gradual Refresh Ramp
Quoted 12 lines · Michel Dänzer
Quoted 4 lines · On 25/07/17 10:53 PM, [email protected] wrote:
From: Amy Zhang <[email protected]>
- Make sure Vsync interrupts are disabled in static screen case and enabled when not to save power
What exactly does this mean? FWIW, the interrupt whose handler calls
drm_handle_vblank()must be enabled from when thedrm_driver::enable_vblankhook is called until when thedrm_driver::disable_vblankhook is called.
This comment is misleading and should've been trimmed when preparing the patches for the open tree. This change should not have an impact on vblank interrupts on Linux. Sorry for the confusion.
Harry
_______________________________________________
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): 5454135a-51b2-36c6-c4a7-1544a0249894-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 15/81] drm/amd/display: Re-enable Vsync Interrupts for Gradual Refresh Ramp
Quoted 7 lines · Harry Wentland
Quoted 6 lines · Michel Dänzer
Quoted 4 lines · On 25/07/17 10:53 PM, [email protected] wrote:
From: Amy Zhang <[email protected]>
- Make sure Vsync interrupts are disabled in static screen case and enabled when not to save power
Quoted 8 lines
Quoted 4 lines
What exactly does this mean? FWIW, the interrupt whose handler calls
drm_handle_vblank()must be enabled from when thedrm_driver::enable_vblankhook is called until when thedrm_driver::disable_vblankhook is called.This comment is misleading and should've been trimmed when preparing the patches for the open tree. This change should not have an impact on vblank interrupts on Linux.
That's good to know.
Quoted 1 line
Sorry for the confusion.
No worries, just making sure.
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
PATCH 16/81 drm/amd/display: Enabling VSR on 4K display causes black screen
In reply to a message not in the archiveFrom: Charlene Liu <[email protected]>
--- 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
@@ -1819,7 +1819,7 @@ static void program_all_pipe_in_tree( pipe_ctx->tg->funcs->set_blank (pipe_ctx->tg, !is_pipe_tree_visible (pipe_ctx)); } -if (pipe_ctx->surface->public.visible) { +if (pipe_ctx->surface !=NULL ) {dcn10_power_on_fe (dc, pipe_ctx, context);update_dchubp_dpp (dc, pipe_ctx, context); }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 17/81 drm/amd/display: Coding for backcompatible tiling support for Gfx7
In reply to a message not in the archiveFrom: Vikrant Mhaske <[email protected]>
after the diags build error correction.
Change-Id: If851c70ecfad2ebc3dfaea6c0e772406d547d584
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h | 1615 +++++++++++++------- 1 file changed, 1060 insertions(+), 555 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h +1060 -555
@@ -1,4 +1,5 @@ -/* Copyright 2012-15 Advanced Micro Devices, Inc. +/* +* Copyright 2012-15 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"),
@@ -21,573 +22,1077 @@* Authors: AMD * */ +#include "dm_services.h" +#include "dce_calcs.h" +#include "dcn10_mem_input.h" +#include "reg_helper.h" +#include "basics/conversion.h" -#ifndef __DC_MEM_INPUT_DCN10_H__ -#define __DC_MEM_INPUT_DCN10_H__ - -#include "mem_input.h" - -#define TO_DCN10_MEM_INPUT (mi)\ - container_of(mi, struct dcn10_mem_input, base) - - -#define MI_DCN10_REG_LIST (id)\ - SRI(DCHUBP_CNTL, HUBP, id),\ - SRI(HUBPREQ_DEBUG_DB, HUBP, id),\ - SRI(DCSURF_ADDR_CONFIG, HUBP, id),\ - SRI(DCSURF_TILING_CONFIG, HUBP, id),\ - SRI(DCSURF_SURFACE_PITCH, HUBPREQ, id),\ - SRI(DCSURF_SURFACE_PITCH_C, HUBPREQ, id),\ - SRI(DCSURF_SURFACE_CONFIG, HUBP, id),\ - SRI(DCSURF_FLIP_CONTROL, HUBPREQ, id),\ - SRI(DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH, HUBPREQ, id),\ - SRI(DCSURF_PRIMARY_SURFACE_ADDRESS, HUBPREQ, id),\ - SRI(DCSURF_SECONDARY_SURFACE_ADDRESS_HIGH, HUBPREQ, id),\ - SRI(DCSURF_SECONDARY_SURFACE_ADDRESS, HUBPREQ, id),\ - SRI(DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH, HUBPREQ, id),\ - SRI(DCSURF_PRIMARY_META_SURFACE_ADDRESS, HUBPREQ, id),\ - SRI(DCSURF_SECONDARY_META_SURFACE_ADDRESS_HIGH, HUBPREQ, id),\ - SRI(DCSURF_SECONDARY_META_SURFACE_ADDRESS, HUBPREQ, id),\ - SRI(DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH_C, HUBPREQ, id),\ - SRI(DCSURF_PRIMARY_SURFACE_ADDRESS_C, HUBPREQ, id),\ - SRI(DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH_C, HUBPREQ, id),\ - SRI(DCSURF_PRIMARY_META_SURFACE_ADDRESS_C, HUBPREQ, id),\ - SRI(DCSURF_SURFACE_INUSE, HUBPREQ, id),\ - SRI(DCSURF_SURFACE_INUSE_HIGH, HUBPREQ, id),\ - SRI(DCSURF_SURFACE_INUSE_C, HUBPREQ, id),\ - SRI(DCSURF_SURFACE_INUSE_HIGH_C, HUBPREQ, id),\ - SRI(DCSURF_SURFACE_EARLIEST_INUSE, HUBPREQ, id),\ - SRI(DCSURF_SURFACE_EARLIEST_INUSE_HIGH, HUBPREQ, id),\ - SRI(DCSURF_SURFACE_EARLIEST_INUSE_C, HUBPREQ, id),\ - SRI(DCSURF_SURFACE_EARLIEST_INUSE_HIGH_C, HUBPREQ, id),\ - SRI(DCSURF_SURFACE_CONTROL, HUBPREQ, id),\ - SRI(HUBPRET_CONTROL, HUBPRET, id),\ - SRI(DCN_EXPANSION_MODE, HUBPREQ, id),\ - SRI(DCHUBP_REQ_SIZE_CONFIG, HUBP, id),\ - SRI(DCHUBP_REQ_SIZE_CONFIG_C, HUBP, id),\ - SRI(BLANK_OFFSET_0, HUBPREQ, id),\ - 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),\ - SRI(VBLANK_PARAMETERS_3, HUBPREQ, id),\ - SRI(NOM_PARAMETERS_0, HUBPREQ, id),\ - SRI(NOM_PARAMETERS_1, HUBPREQ, id),\ - SRI(NOM_PARAMETERS_4, HUBPREQ, id),\ - 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),\ - SRI(NOM_PARAMETERS_3, HUBPREQ, id),\ - SRI(NOM_PARAMETERS_6, HUBPREQ, id),\ - SRI(NOM_PARAMETERS_7, HUBPREQ, id),\ - SRI(DCN_TTU_QOS_WM, HUBPREQ, id),\ - SRI(DCN_GLOBAL_TTU_CNTL, HUBPREQ, id),\ - SRI(DCN_SURF0_TTU_CNTL0, HUBPREQ, id),\ - SRI(DCN_SURF0_TTU_CNTL1, HUBPREQ, id),\ - SRI(DCN_SURF1_TTU_CNTL0, HUBPREQ, id),\ - SRI(DCN_SURF1_TTU_CNTL1, 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),\ - SRI(DCN_VM_CONTEXT0_PAGE_TABLE_START_ADDR_LSB, HUBPREQ, id),\ - SRI(DCN_VM_CONTEXT0_PAGE_TABLE_END_ADDR_MSB, HUBPREQ, id),\ - SRI(DCN_VM_CONTEXT0_PAGE_TABLE_END_ADDR_LSB, HUBPREQ, id),\ - SRI(DCN_VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_MSB, HUBPREQ, id),\ - SRI(DCN_VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_LSB, HUBPREQ, id),\ - SRI(DCN_VM_MX_L1_TLB_CNTL, HUBPREQ, id),\ - SRI(DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB, HUBPREQ, id),\ - SRI(DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB, HUBPREQ, id),\ - SRI(DCN_VM_SYSTEM_APERTURE_LOW_ADDR_MSB, HUBPREQ, id),\ - SRI(DCN_VM_SYSTEM_APERTURE_LOW_ADDR_LSB, HUBPREQ, id),\ - SRI(DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_MSB, HUBPREQ, id),\ - SRI(DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB, HUBPREQ, id),\ - SR(DCHUBBUB_SDPIF_FB_TOP),\ - SR(DCHUBBUB_SDPIF_FB_BASE),\ - SR(DCHUBBUB_SDPIF_FB_OFFSET),\ - SR(DCHUBBUB_SDPIF_AGP_BASE),\ - SR(DCHUBBUB_SDPIF_AGP_BOT),\ - SR(DCHUBBUB_SDPIF_AGP_TOP),\ - SR(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_A),\ - SR(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_A),\ - SR(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A),\ - SR(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_A),\ - SR(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_A),\ - SR(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_B),\ - SR(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_B),\ - SR(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_B),\ - SR(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_B),\ - SR(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_B),\ - SR(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_C),\ - SR(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_C),\ - SR(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_C),\ - SR(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_C),\ - SR(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_C),\ - SR(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_D),\ - SR(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_D),\ - SR(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_D),\ - SR(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_D),\ - SR(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_D),\ - SR(DCHUBBUB_ARB_WATERMARK_CHANGE_CNTL),\ - SR(DCHUBBUB_ARB_DRAM_STATE_CNTL),\ - SR(DCHUBBUB_ARB_SAT_LEVEL),\ - SR(DCHUBBUB_ARB_DF_REQ_OUTSTAND),\ -/* todo: get these from GVM instead of reading registers ourselves */ \ -MMHUB_SR (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32 ),\ -MMHUB_SR (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32 ),\ -MMHUB_SR (VM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32 ),\ -MMHUB_SR (VM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32 ),\ -MMHUB_SR (VM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32 ),\ -MMHUB_SR (VM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32 ),\ -MMHUB_SR (VM_L2_PROTECTION_FAULT_DEFAULT_ADDR_HI32 ),\ -MMHUB_SR (VM_L2_PROTECTION_FAULT_DEFAULT_ADDR_LO32 ),\ -MMHUB_SR (MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB ),\ -MMHUB_SR (MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB ),\ -MMHUB_SR (MC_VM_SYSTEM_APERTURE_LOW_ADDR ),\ - MMHUB_SR(MC_VM_SYSTEM_APERTURE_HIGH_ADDR) - -struct dcn_mi_registers { - uint32_t DCHUBP_CNTL; -uint32_t HUBPREQ_DEBUG_DB ; -uint32_t DCSURF_ADDR_CONFIG ; -uint32_t DCSURF_TILING_CONFIG ; -uint32_t DCSURF_SURFACE_PITCH ; -uint32_t DCSURF_SURFACE_PITCH_C ; -uint32_t DCSURF_SURFACE_CONFIG ; -uint32_t DCSURF_FLIP_CONTROL ; -uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH ; -uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS ; -uint32_t DCSURF_SECONDARY_SURFACE_ADDRESS_HIGH ; -uint32_t DCSURF_SECONDARY_SURFACE_ADDRESS ; -uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH ; -uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS ; -uint32_t DCSURF_SECONDARY_META_SURFACE_ADDRESS_HIGH ; -uint32_t DCSURF_SECONDARY_META_SURFACE_ADDRESS ; -uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH_C ; -uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_C ; -uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH_C ; -uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS_C ; -uint32_t DCSURF_SURFACE_INUSE ; -uint32_t DCSURF_SURFACE_INUSE_HIGH ; -uint32_t DCSURF_SURFACE_INUSE_C ; -uint32_t DCSURF_SURFACE_INUSE_HIGH_C ; -uint32_t DCSURF_SURFACE_EARLIEST_INUSE ; -uint32_t DCSURF_SURFACE_EARLIEST_INUSE_HIGH ; -uint32_t DCSURF_SURFACE_EARLIEST_INUSE_C ; -uint32_t DCSURF_SURFACE_EARLIEST_INUSE_HIGH_C ; -uint32_t DCSURF_SURFACE_CONTROL ; -uint32_t HUBPRET_CONTROL ; -uint32_t DCN_EXPANSION_MODE ; -uint32_t DCHUBP_REQ_SIZE_CONFIG ; -uint32_t DCHUBP_REQ_SIZE_CONFIG_C ; -uint32_t BLANK_OFFSET_0 ; -uint32_t BLANK_OFFSET_1 ; -uint32_t DST_DIMENSIONS ; -uint32_t DST_AFTER_SCALER ; -uint32_t PREFETCH_SETTINS ; -uint32_t VBLANK_PARAMETERS_0 ; -uint32_t REF_FREQ_TO_PIX_FREQ ; -uint32_t VBLANK_PARAMETERS_1 ; -uint32_t VBLANK_PARAMETERS_3 ; -uint32_t NOM_PARAMETERS_0 ; -uint32_t NOM_PARAMETERS_1 ; -uint32_t NOM_PARAMETERS_4 ; -uint32_t NOM_PARAMETERS_5 ; -uint32_t PER_LINE_DELIVERY_PRE ; -uint32_t PER_LINE_DELIVERY ; -uint32_t PREFETCH_SETTINS_C ; -uint32_t VBLANK_PARAMETERS_2 ; -uint32_t VBLANK_PARAMETERS_4 ; -uint32_t NOM_PARAMETERS_2 ; -uint32_t NOM_PARAMETERS_3 ; -uint32_t NOM_PARAMETERS_6 ; -uint32_t NOM_PARAMETERS_7 ; -uint32_t DCN_TTU_QOS_WM ; -uint32_t DCN_GLOBAL_TTU_CNTL ; -uint32_t DCN_SURF0_TTU_CNTL0 ; -uint32_t DCN_SURF0_TTU_CNTL1 ; -uint32_t DCN_SURF1_TTU_CNTL0 ; -uint32_t DCN_SURF1_TTU_CNTL1 ; -uint32_t DCN_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_MSB ; -uint32_t DCN_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LSB ; -uint32_t DCN_VM_CONTEXT0_PAGE_TABLE_START_ADDR_MSB ; -uint32_t DCN_VM_CONTEXT0_PAGE_TABLE_START_ADDR_LSB ; -uint32_t DCN_VM_CONTEXT0_PAGE_TABLE_END_ADDR_MSB ; -uint32_t DCN_VM_CONTEXT0_PAGE_TABLE_END_ADDR_LSB ; -uint32_t DCN_VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_MSB ; -uint32_t DCN_VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_LSB ; -uint32_t DCN_VM_MX_L1_TLB_CNTL ; -uint32_t DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB ; -uint32_t DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB ; -uint32_t DCN_VM_SYSTEM_APERTURE_LOW_ADDR_MSB ; -uint32_t DCN_VM_SYSTEM_APERTURE_LOW_ADDR_LSB ; -uint32_t DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_MSB ; -uint32_t DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB ; -uint32_t DCHUBBUB_SDPIF_FB_TOP ; -uint32_t DCHUBBUB_SDPIF_FB_BASE ; -uint32_t DCHUBBUB_SDPIF_FB_OFFSET ; -uint32_t DCHUBBUB_SDPIF_AGP_BASE ; -uint32_t DCHUBBUB_SDPIF_AGP_BOT ; -uint32_t DCHUBBUB_SDPIF_AGP_TOP ; -uint32_t DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_A ; -uint32_t DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_A ; -uint32_t DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A ; -uint32_t DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_A ; -uint32_t DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_A ; -uint32_t DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_B ; -uint32_t DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_B ; -uint32_t DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_B ; -uint32_t DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_B ; -uint32_t DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_B ; -uint32_t DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_C ; -uint32_t DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_C ; -uint32_t DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_C ; -uint32_t DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_C ; -uint32_t DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_C ; -uint32_t DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_D ; -uint32_t DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_D ; -uint32_t DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_D ; -uint32_t DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_D ; -uint32_t DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_D ; -uint32_t DCHUBBUB_ARB_WATERMARK_CHANGE_CNTL ; -uint32_t DCHUBBUB_ARB_DRAM_STATE_CNTL ; -uint32_t DCHUBBUB_ARB_SAT_LEVEL ; -uint32_t DCHUBBUB_ARB_DF_REQ_OUTSTAND ; - -/* GC registers. read only. temporary hack */ -uint32_t VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32 ; -uint32_t VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32 ; -uint32_t VM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32 ; -uint32_t VM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32 ; -uint32_t VM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32 ; -uint32_t VM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32 ; -uint32_t VM_L2_PROTECTION_FAULT_DEFAULT_ADDR_HI32 ; -uint32_t VM_L2_PROTECTION_FAULT_DEFAULT_ADDR_LO32 ; -uint32_t MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB ; -uint32_t MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB ; -uint32_t MC_VM_SYSTEM_APERTURE_LOW_ADDR ; -uint32_t MC_VM_SYSTEM_APERTURE_HIGH_ADDR ; -}; +#define REG (reg)\ + mi->mi_regs->reg + +#define CTX \ + mi->base.ctx + +#undef FN +#define FN (reg_name, field_name) \ + mi->mi_shift->field_name, mi->mi_mask->field_name + +static void min10_set_blank (struct mem_input *mem_input,bool blank) +{ +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); +uint32_t blank_en = blank ?1 :0 ; + +REG_UPDATE_2 (DCHUBP_CNTL , +HUBP_BLANK_EN , blank_en, +HUBP_TTU_DISABLE , blank_en); +} + +static void min10_vready_workaround (struct mem_input *mem_input, +struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest) +{ +uint32_t value =0 ; +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); + +/* set HBUBREQ_DEBUG_DB[12] = 1 */ + value =REG_READ (HUBPREQ_DEBUG_DB ); + +/* hack mode disable */ + value |=0x100 ; + value &= ~0x1000 ; + +if ((pipe_dest->vstartup_start -2 *(pipe_dest->vready_offset+pipe_dest->vupdate_width + + pipe_dest->vupdate_offset) / pipe_dest->htotal) <= pipe_dest->vblank_end) { +/* if (eco_fix_needed(otg_global_sync_timing) +* set HBUBREQ_DEBUG_DB[12] = 1 */ + value |=0x1000 ; + } + +REG_WRITE (HUBPREQ_DEBUG_DB , value); +} + +static void min10_program_tiling ( +struct dcn10_mem_input *mi, +const union dc_tiling_info *info, +const enum surface_pixel_format pixel_format) +{ +REG_UPDATE_6 (DCSURF_ADDR_CONFIG , +NUM_PIPES ,log_2 (info->gfx9.num_pipes), +NUM_BANKS ,log_2 (info->gfx9.num_banks), +PIPE_INTERLEAVE , info->gfx9.pipe_interleave, +NUM_SE ,log_2 (info->gfx9.num_shader_engines), +NUM_RB_PER_SE ,log_2 (info->gfx9.num_rb_per_se), +MAX_COMPRESSED_FRAGS ,log_2 (info->gfx9.max_compressed_frags)); + +REG_UPDATE_4 (DCSURF_TILING_CONFIG , +SW_MODE , info->gfx9.swizzle, +META_LINEAR , info->gfx9.meta_linear, +RB_ALIGNED , info->gfx9.rb_aligned, +PIPE_ALIGNED , info->gfx9.pipe_aligned); +} + +static void min10_program_size_and_rotation ( +struct dcn10_mem_input *mi, +enum dc_rotation_angle rotation, +enum surface_pixel_format format, +const union plane_size *plane_size, +struct dc_plane_dcc_param *dcc, +bool horizontal_mirror) +{ +uint32_t pitch, meta_pitch, pitch_c, meta_pitch_c, mirror; + +/* Program data and meta surface pitch (calculation from addrlib) +* 444 or 420 luma +*/ +if (format >=SURFACE_PIXEL_FORMAT_VIDEO_BEGIN ) { + pitch = plane_size->video.luma_pitch -1 ; + meta_pitch = dcc->video.meta_pitch_l -1 ; + pitch_c = plane_size->video.chroma_pitch -1 ; + meta_pitch_c = dcc->video.meta_pitch_c -1 ; + }else { + pitch = plane_size->grph.surface_pitch -1 ; + meta_pitch = dcc->grph.meta_pitch -1 ; + pitch_c =0 ; + meta_pitch_c =0 ; + } + +if (!dcc->enable) { + meta_pitch =0 ; + meta_pitch_c =0 ; + } + +REG_UPDATE_2 (DCSURF_SURFACE_PITCH , +PITCH , pitch,META_PITCH , meta_pitch); + +if (format >=SURFACE_PIXEL_FORMAT_VIDEO_BEGIN ) +REG_UPDATE_2 (DCSURF_SURFACE_PITCH_C , +PITCH_C , pitch_c,META_PITCH_C , meta_pitch_c); + +if (horizontal_mirror) + mirror =1 ; +else + mirror =0 ; + + +/* Program rotation angle and horz mirror - no mirror */ +if (rotation ==ROTATION_ANGLE_0 ) +REG_UPDATE_2 (DCSURF_SURFACE_CONFIG , +ROTATION_ANGLE ,0 , +H_MIRROR_EN , mirror); +else if (rotation ==ROTATION_ANGLE_90 ) +REG_UPDATE_2 (DCSURF_SURFACE_CONFIG , +ROTATION_ANGLE ,1 , +H_MIRROR_EN , mirror); +else if (rotation ==ROTATION_ANGLE_180 ) +REG_UPDATE_2 (DCSURF_SURFACE_CONFIG , +ROTATION_ANGLE ,2 , +H_MIRROR_EN , mirror); +else if (rotation ==ROTATION_ANGLE_270 ) +REG_UPDATE_2 (DCSURF_SURFACE_CONFIG , +ROTATION_ANGLE ,3 , +H_MIRROR_EN , mirror); +} + +static void min10_program_pixel_format ( +struct dcn10_mem_input *mi, +enum surface_pixel_format format) +{ +uint32_t red_bar =3 ; +uint32_t blue_bar =2 ; + +/* swap for ABGR format */ +if (format ==SURFACE_PIXEL_FORMAT_GRPH_ABGR8888 + || format ==SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010 + || format ==SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS + || format ==SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F ) { + red_bar =2 ; + blue_bar =3 ; + } + +REG_UPDATE_2 (HUBPRET_CONTROL , +CROSSBAR_SRC_CB_B , blue_bar, +CROSSBAR_SRC_CR_R , red_bar); + +/* Mapping is same as ipp programming (cnvc) */ + +switch (format) { +case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555 : +REG_UPDATE (DCSURF_SURFACE_CONFIG , +SURFACE_PIXEL_FORMAT ,1 ); +break ; +case SURFACE_PIXEL_FORMAT_GRPH_RGB565 : +REG_UPDATE (DCSURF_SURFACE_CONFIG , +SURFACE_PIXEL_FORMAT ,3 ); +break ; +case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 : +case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888 : +REG_UPDATE (DCSURF_SURFACE_CONFIG , +SURFACE_PIXEL_FORMAT ,8 ); +break ; +case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010 : +case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010 : +case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS : +REG_UPDATE (DCSURF_SURFACE_CONFIG , +SURFACE_PIXEL_FORMAT ,10 ); +break ; +case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 : +REG_UPDATE (DCSURF_SURFACE_CONFIG , +SURFACE_PIXEL_FORMAT ,22 ); +break ; +case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F : +case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F :/*we use crossbar already*/ +REG_UPDATE (DCSURF_SURFACE_CONFIG , +SURFACE_PIXEL_FORMAT ,24 ); +break ; + +case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr: +REG_UPDATE (DCSURF_SURFACE_CONFIG , +SURFACE_PIXEL_FORMAT ,65 ); +break ; +case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb: +REG_UPDATE (DCSURF_SURFACE_CONFIG , +SURFACE_PIXEL_FORMAT ,64 ); +break ; +case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr: +REG_UPDATE (DCSURF_SURFACE_CONFIG , +SURFACE_PIXEL_FORMAT ,67 ); +break ; +case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb: +REG_UPDATE (DCSURF_SURFACE_CONFIG , +SURFACE_PIXEL_FORMAT ,66 ); +break ; +default : +BREAK_TO_DEBUGGER (); +break ; + } + +/* don't see the need of program the xbar in DCN 1.0 */ +} + +static bool min10_program_surface_flip_and_addr ( +struct mem_input *mem_input, +const struct dc_plane_address *address, +bool flip_immediate) +{ +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); + +/* program flip type */ +REG_SET (DCSURF_FLIP_CONTROL ,0 , +SURFACE_FLIP_TYPE , flip_immediate); + +/* HW automatically latch rest of address register on write to +* DCSURF_PRIMARY_SURFACE_ADDRESS if SURFACE_UPDATE_LOCK is not used +* +* program high first and then the low addr, order matters! +*/ +switch (address->type) { +case PLN_ADDR_TYPE_GRAPHICS : +/* DCN1.0 does not support const color +* TODO: program DCHUBBUB_RET_PATH_DCC_CFGx_0/1 +* base on address->grph.dcc_const_color +* x = 0, 2, 4, 6 for pipe 0, 1, 2, 3 for rgb and luma +* x = 1, 3, 5, 7 for pipe 0, 1, 2, 3 for chroma +*/ + +if (address->grph.addr.quad_part ==0 ) +break ; + +if (address->grph.meta_addr.quad_part !=0 ) { +REG_SET (DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH ,0 , +PRIMARY_META_SURFACE_ADDRESS_HIGH , + address->grph.meta_addr.high_part); + +REG_SET (DCSURF_PRIMARY_META_SURFACE_ADDRESS ,0 , +PRIMARY_META_SURFACE_ADDRESS , + address->grph.meta_addr.low_part); + } + +REG_SET (DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH ,0 , +PRIMARY_SURFACE_ADDRESS_HIGH , + address->grph.addr.high_part); + +REG_SET (DCSURF_PRIMARY_SURFACE_ADDRESS ,0 , +PRIMARY_SURFACE_ADDRESS , + address->grph.addr.low_part); +break ; +case PLN_ADDR_TYPE_VIDEO_PROGRESSIVE : +if (address->video_progressive.luma_addr.quad_part ==0 + || address->video_progressive.chroma_addr.quad_part ==0 ) +break ; + +if (address->video_progressive.luma_meta_addr.quad_part !=0 ) { +REG_SET (DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH_C ,0 , +PRIMARY_META_SURFACE_ADDRESS_HIGH_C , + address->video_progressive.chroma_meta_addr.high_part); + +REG_SET (DCSURF_PRIMARY_META_SURFACE_ADDRESS_C ,0 , +PRIMARY_META_SURFACE_ADDRESS_C , + address->video_progressive.chroma_meta_addr.low_part); + +REG_SET (DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH ,0 , +PRIMARY_META_SURFACE_ADDRESS_HIGH , + address->video_progressive.luma_meta_addr.high_part); + +REG_SET (DCSURF_PRIMARY_META_SURFACE_ADDRESS ,0 , +PRIMARY_META_SURFACE_ADDRESS , + address->video_progressive.luma_meta_addr.low_part); + } + +REG_SET (DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH_C ,0 , +PRIMARY_SURFACE_ADDRESS_HIGH_C , + address->video_progressive.chroma_addr.high_part); + +REG_SET (DCSURF_PRIMARY_SURFACE_ADDRESS_C ,0 , +PRIMARY_SURFACE_ADDRESS_C , + address->video_progressive.chroma_addr.low_part); + +REG_SET (DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH ,0 , +PRIMARY_SURFACE_ADDRESS_HIGH , + address->video_progressive.luma_addr.high_part); + +REG_SET (DCSURF_PRIMARY_SURFACE_ADDRESS ,0 , +PRIMARY_SURFACE_ADDRESS , + address->video_progressive.luma_addr.low_part); +break ; +case PLN_ADDR_TYPE_GRPH_STEREO : +if (address->grph_stereo.left_addr.quad_part ==0 ) +break ; +if (address->grph_stereo.right_addr.quad_part ==0 ) +break ; +if (address->grph_stereo.right_meta_addr.quad_part !=0 ) { + +REG_SET (DCSURF_SECONDARY_META_SURFACE_ADDRESS_HIGH ,0 , +SECONDARY_META_SURFACE_ADDRESS_HIGH , + address->grph_stereo.right_meta_addr.high_part); + +REG_SET (DCSURF_SECONDARY_META_SURFACE_ADDRESS ,0 , +SECONDARY_META_SURFACE_ADDRESS , + address->grph_stereo.right_meta_addr.low_part); + } +if (address->grph_stereo.left_meta_addr.quad_part !=0 ) { + +REG_SET (DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH ,0 , +PRIMARY_META_SURFACE_ADDRESS_HIGH , + address->grph_stereo.left_meta_addr.high_part); + +REG_SET (DCSURF_PRIMARY_META_SURFACE_ADDRESS ,0 , +PRIMARY_META_SURFACE_ADDRESS , + address->grph_stereo.left_meta_addr.low_part); + } + +REG_SET (DCSURF_SECONDARY_SURFACE_ADDRESS_HIGH ,0 , +SECONDARY_SURFACE_ADDRESS_HIGH , + address->grph_stereo.right_addr.high_part); + +REG_SET (DCSURF_SECONDARY_SURFACE_ADDRESS ,0 , +SECONDARY_SURFACE_ADDRESS , + address->grph_stereo.right_addr.low_part); + +REG_SET (DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH ,0 , +PRIMARY_SURFACE_ADDRESS_HIGH , + address->grph_stereo.left_addr.high_part); + +REG_SET (DCSURF_PRIMARY_SURFACE_ADDRESS ,0 , +PRIMARY_SURFACE_ADDRESS , + address->grph_stereo.left_addr.low_part); +break ; +default : +BREAK_TO_DEBUGGER (); +break ; + } + + mem_input->request_address = *address; + +if (flip_immediate) + mem_input->current_address = *address; + +return true; +} + +static void min10_dcc_control (struct mem_input *mem_input,bool enable, +bool independent_64b_blks) +{ +uint32_t dcc_en = enable ?1 :0 ; +uint32_t dcc_ind_64b_blk = independent_64b_blks ?1 :0 ; +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); + +REG_UPDATE_2 (DCSURF_SURFACE_CONTROL , +PRIMARY_SURFACE_DCC_EN , dcc_en, +PRIMARY_SURFACE_DCC_IND_64B_BLK , dcc_ind_64b_blk); +} + +static void min10_program_surface_config ( +struct mem_input *mem_input, +enum surface_pixel_format format, +union dc_tiling_info *tiling_info, +union plane_size *plane_size, +enum dc_rotation_angle rotation, +struct dc_plane_dcc_param *dcc, +bool horizontal_mirror) +{ +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); + +min10_dcc_control (mem_input, dcc->enable, dcc->grph.independent_64b_blks); +min10_program_tiling (mi, tiling_info, format); +min10_program_size_and_rotation ( + mi, rotation, format, plane_size, dcc, horizontal_mirror); +min10_program_pixel_format (mi, format); +} + +static void min10_program_requestor ( +struct mem_input *mem_input, +struct _vcs_dpi_display_rq_regs_st *rq_regs) +{ + +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); + +REG_UPDATE (HUBPRET_CONTROL , +DET_BUF_PLANE1_BASE_ADDRESS , rq_regs->plane1_base_address); +REG_SET_4 (DCN_EXPANSION_MODE ,0 , +DRQ_EXPANSION_MODE , rq_regs->drq_expansion_mode, +PRQ_EXPANSION_MODE , rq_regs->prq_expansion_mode, +MRQ_EXPANSION_MODE , rq_regs->mrq_expansion_mode, +CRQ_EXPANSION_MODE , rq_regs->crq_expansion_mode); +REG_SET_8 (DCHUBP_REQ_SIZE_CONFIG ,0 , +CHUNK_SIZE , rq_regs->rq_regs_l.chunk_size, +MIN_CHUNK_SIZE , rq_regs->rq_regs_l.min_chunk_size, +META_CHUNK_SIZE , rq_regs->rq_regs_l.meta_chunk_size, +MIN_META_CHUNK_SIZE , rq_regs->rq_regs_l.min_meta_chunk_size, +DPTE_GROUP_SIZE , rq_regs->rq_regs_l.dpte_group_size, +MPTE_GROUP_SIZE , rq_regs->rq_regs_l.mpte_group_size, +SWATH_HEIGHT , rq_regs->rq_regs_l.swath_height, +PTE_ROW_HEIGHT_LINEAR , rq_regs->rq_regs_l.pte_row_height_linear); +REG_SET_8 (DCHUBP_REQ_SIZE_CONFIG_C ,0 , +CHUNK_SIZE_C , rq_regs->rq_regs_c.chunk_size, +MIN_CHUNK_SIZE_C , rq_regs->rq_regs_c.min_chunk_size, +META_CHUNK_SIZE_C , rq_regs->rq_regs_c.meta_chunk_size, +MIN_META_CHUNK_SIZE_C , rq_regs->rq_regs_c.min_meta_chunk_size, +DPTE_GROUP_SIZE_C , rq_regs->rq_regs_c.dpte_group_size, +MPTE_GROUP_SIZE_C , rq_regs->rq_regs_c.mpte_group_size, +SWATH_HEIGHT_C , rq_regs->rq_regs_c.swath_height, +PTE_ROW_HEIGHT_LINEAR_C , rq_regs->rq_regs_c.pte_row_height_linear); +} + + +static void min10_program_deadline ( +struct mem_input *mem_input, +struct _vcs_dpi_display_dlg_regs_st *dlg_attr, +struct _vcs_dpi_display_ttu_regs_st *ttu_attr) +{ +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); + +/* DLG - Per hubp */ +REG_SET_2 (BLANK_OFFSET_0 ,0 , +REFCYC_H_BLANK_END , dlg_attr->refcyc_h_blank_end, +DLG_V_BLANK_END , dlg_attr->dlg_vblank_end); + +REG_SET (BLANK_OFFSET_1 ,0 , +MIN_DST_Y_NEXT_START , dlg_attr->min_dst_y_next_start); + +REG_SET (DST_DIMENSIONS ,0 , +REFCYC_PER_HTOTAL , dlg_attr->refcyc_per_htotal); + +REG_SET_2 (DST_AFTER_SCALER ,0 , +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); + +REG_SET_2 (VBLANK_PARAMETERS_0 ,0 , +DST_Y_PER_VM_VBLANK , dlg_attr->dst_y_per_vm_vblank, +DST_Y_PER_ROW_VBLANK , dlg_attr->dst_y_per_row_vblank); + +REG_SET (REF_FREQ_TO_PIX_FREQ ,0 , +REF_FREQ_TO_PIX_FREQ , dlg_attr->ref_freq_to_pix_freq); + +/* DLG - Per luma/chroma */ +REG_SET (VBLANK_PARAMETERS_1 ,0 , +REFCYC_PER_PTE_GROUP_VBLANK_L , dlg_attr->refcyc_per_pte_group_vblank_l); + +REG_SET (VBLANK_PARAMETERS_3 ,0 , +REFCYC_PER_META_CHUNK_VBLANK_L , dlg_attr->refcyc_per_meta_chunk_vblank_l); + +REG_SET (NOM_PARAMETERS_0 ,0 , +DST_Y_PER_PTE_ROW_NOM_L , dlg_attr->dst_y_per_pte_row_nom_l); + +REG_SET (NOM_PARAMETERS_1 ,0 , +REFCYC_PER_PTE_GROUP_NOM_L , dlg_attr->refcyc_per_pte_group_nom_l); + +REG_SET (NOM_PARAMETERS_4 ,0 , +DST_Y_PER_META_ROW_NOM_L , dlg_attr->dst_y_per_meta_row_nom_l); + +REG_SET (NOM_PARAMETERS_5 ,0 , +REFCYC_PER_META_CHUNK_NOM_L , dlg_attr->refcyc_per_meta_chunk_nom_l); + +REG_SET_2 (PER_LINE_DELIVERY_PRE ,0 , +REFCYC_PER_LINE_DELIVERY_PRE_L , dlg_attr->refcyc_per_line_delivery_pre_l, +REFCYC_PER_LINE_DELIVERY_PRE_C , dlg_attr->refcyc_per_line_delivery_pre_c); + +REG_SET_2 (PER_LINE_DELIVERY ,0 , +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); + +REG_SET (VBLANK_PARAMETERS_2 ,0 , +REFCYC_PER_PTE_GROUP_VBLANK_C , dlg_attr->refcyc_per_pte_group_vblank_c); + +REG_SET (VBLANK_PARAMETERS_4 ,0 , +REFCYC_PER_META_CHUNK_VBLANK_C , dlg_attr->refcyc_per_meta_chunk_vblank_c); + +REG_SET (NOM_PARAMETERS_2 ,0 , +DST_Y_PER_PTE_ROW_NOM_C , dlg_attr->dst_y_per_pte_row_nom_c); + +REG_SET (NOM_PARAMETERS_3 ,0 , +REFCYC_PER_PTE_GROUP_NOM_C , dlg_attr->refcyc_per_pte_group_nom_c); + +REG_SET (NOM_PARAMETERS_6 ,0 , +DST_Y_PER_META_ROW_NOM_C , dlg_attr->dst_y_per_meta_row_nom_c); + +REG_SET (NOM_PARAMETERS_7 ,0 , +REFCYC_PER_META_CHUNK_NOM_C , dlg_attr->refcyc_per_meta_chunk_nom_c); + +/* TTU - per hubp */ +REG_SET_2 (DCN_TTU_QOS_WM ,0 , + QoS_LEVEL_LOW_WM, ttu_attr->qos_level_low_wm, + QoS_LEVEL_HIGH_WM, ttu_attr->qos_level_high_wm); + +REG_SET_2 (DCN_GLOBAL_TTU_CNTL ,0 , +MIN_TTU_VBLANK , ttu_attr->min_ttu_vblank, + QoS_LEVEL_FLIP, ttu_attr->qos_level_flip); + +/* TTU - per luma/chroma */ +/* Assumed surf0 is luma and 1 is chroma */ + +REG_SET_3 (DCN_SURF0_TTU_CNTL0 ,0 , +REFCYC_PER_REQ_DELIVERY , ttu_attr->refcyc_per_req_delivery_l, + QoS_LEVEL_FIXED, ttu_attr->qos_level_fixed_l, + QoS_RAMP_DISABLE, ttu_attr->qos_ramp_disable_l); + +REG_SET (DCN_SURF0_TTU_CNTL1 ,0 , +REFCYC_PER_REQ_DELIVERY_PRE , + ttu_attr->refcyc_per_req_delivery_pre_l); + +REG_SET_3 (DCN_SURF1_TTU_CNTL0 ,0 , +REFCYC_PER_REQ_DELIVERY , ttu_attr->refcyc_per_req_delivery_c, + QoS_LEVEL_FIXED, ttu_attr->qos_level_fixed_c, + QoS_RAMP_DISABLE, ttu_attr->qos_ramp_disable_c); -#define MI_SF (reg_name, field_name, post_fix)\ - .field_name = reg_name ## __ ## field_name ## post_fix - -#define MI_DCN10_MASK_SH_LIST (mask_sh)\ - MI_SF(HUBP0_DCHUBP_CNTL, HUBP_BLANK_EN, mask_sh),\ - MI_SF(HUBP0_DCHUBP_CNTL, HUBP_TTU_DISABLE, mask_sh),\ - MI_SF(HUBP0_DCSURF_ADDR_CONFIG, NUM_PIPES, mask_sh),\ - MI_SF(HUBP0_DCSURF_ADDR_CONFIG, NUM_BANKS, mask_sh),\ - MI_SF(HUBP0_DCSURF_ADDR_CONFIG, PIPE_INTERLEAVE, mask_sh),\ - MI_SF(HUBP0_DCSURF_ADDR_CONFIG, NUM_SE, mask_sh),\ - MI_SF(HUBP0_DCSURF_ADDR_CONFIG, NUM_RB_PER_SE, mask_sh),\ - MI_SF(HUBP0_DCSURF_ADDR_CONFIG, MAX_COMPRESSED_FRAGS, mask_sh),\ - MI_SF(HUBP0_DCSURF_TILING_CONFIG, SW_MODE, mask_sh),\ - MI_SF(HUBP0_DCSURF_TILING_CONFIG, META_LINEAR, mask_sh),\ - MI_SF(HUBP0_DCSURF_TILING_CONFIG, RB_ALIGNED, mask_sh),\ - MI_SF(HUBP0_DCSURF_TILING_CONFIG, PIPE_ALIGNED, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_PITCH, PITCH, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_PITCH, META_PITCH, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_PITCH_C, PITCH_C, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_PITCH_C, META_PITCH_C, mask_sh),\ - MI_SF(HUBP0_DCSURF_SURFACE_CONFIG, ROTATION_ANGLE, mask_sh),\ - MI_SF(HUBP0_DCSURF_SURFACE_CONFIG, H_MIRROR_EN, mask_sh),\ - MI_SF(HUBP0_DCSURF_SURFACE_CONFIG, SURFACE_PIXEL_FORMAT, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_FLIP_CONTROL, SURFACE_FLIP_TYPE, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_FLIP_CONTROL, SURFACE_UPDATE_PENDING, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_FLIP_CONTROL, SURFACE_UPDATE_LOCK, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH, PRIMARY_SURFACE_ADDRESS_HIGH, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_PRIMARY_SURFACE_ADDRESS, PRIMARY_SURFACE_ADDRESS, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SECONDARY_SURFACE_ADDRESS_HIGH, SECONDARY_SURFACE_ADDRESS_HIGH, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SECONDARY_SURFACE_ADDRESS, SECONDARY_SURFACE_ADDRESS, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH, PRIMARY_META_SURFACE_ADDRESS_HIGH, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_PRIMARY_META_SURFACE_ADDRESS, PRIMARY_META_SURFACE_ADDRESS, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SECONDARY_META_SURFACE_ADDRESS_HIGH, SECONDARY_META_SURFACE_ADDRESS_HIGH, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SECONDARY_META_SURFACE_ADDRESS, SECONDARY_META_SURFACE_ADDRESS, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH_C, PRIMARY_SURFACE_ADDRESS_HIGH_C, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_PRIMARY_SURFACE_ADDRESS_C, PRIMARY_SURFACE_ADDRESS_C, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH_C, PRIMARY_META_SURFACE_ADDRESS_HIGH_C, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_PRIMARY_META_SURFACE_ADDRESS_C, PRIMARY_META_SURFACE_ADDRESS_C, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_INUSE, SURFACE_INUSE_ADDRESS, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_INUSE_HIGH, SURFACE_INUSE_ADDRESS_HIGH, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_INUSE_C, SURFACE_INUSE_ADDRESS_C, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_INUSE_HIGH_C, SURFACE_INUSE_ADDRESS_HIGH_C, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_EARLIEST_INUSE, SURFACE_EARLIEST_INUSE_ADDRESS, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_EARLIEST_INUSE_HIGH, SURFACE_EARLIEST_INUSE_ADDRESS_HIGH, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_EARLIEST_INUSE_C, SURFACE_EARLIEST_INUSE_ADDRESS_C, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_EARLIEST_INUSE_HIGH_C, SURFACE_EARLIEST_INUSE_ADDRESS_HIGH_C, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_CONTROL, PRIMARY_SURFACE_DCC_EN, mask_sh),\ - MI_SF(HUBPREQ0_DCSURF_SURFACE_CONTROL, PRIMARY_SURFACE_DCC_IND_64B_BLK, mask_sh),\ - MI_SF(HUBPRET0_HUBPRET_CONTROL, DET_BUF_PLANE1_BASE_ADDRESS, mask_sh),\ - MI_SF(HUBPRET0_HUBPRET_CONTROL, CROSSBAR_SRC_CB_B, mask_sh),\ - MI_SF(HUBPRET0_HUBPRET_CONTROL, CROSSBAR_SRC_CR_R, mask_sh),\ - MI_SF(HUBPREQ0_DCN_EXPANSION_MODE, DRQ_EXPANSION_MODE, mask_sh),\ - MI_SF(HUBPREQ0_DCN_EXPANSION_MODE, PRQ_EXPANSION_MODE, mask_sh),\ - MI_SF(HUBPREQ0_DCN_EXPANSION_MODE, MRQ_EXPANSION_MODE, mask_sh),\ - MI_SF(HUBPREQ0_DCN_EXPANSION_MODE, CRQ_EXPANSION_MODE, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG, CHUNK_SIZE, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG, MIN_CHUNK_SIZE, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG, META_CHUNK_SIZE, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG, MIN_META_CHUNK_SIZE, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG, DPTE_GROUP_SIZE, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG, MPTE_GROUP_SIZE, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG, SWATH_HEIGHT, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG, PTE_ROW_HEIGHT_LINEAR, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG_C, CHUNK_SIZE_C, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG_C, MIN_CHUNK_SIZE_C, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG_C, META_CHUNK_SIZE_C, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG_C, MIN_META_CHUNK_SIZE_C, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG_C, DPTE_GROUP_SIZE_C, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG_C, MPTE_GROUP_SIZE_C, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG_C, SWATH_HEIGHT_C, mask_sh),\ - MI_SF(HUBP0_DCHUBP_REQ_SIZE_CONFIG_C, PTE_ROW_HEIGHT_LINEAR_C, mask_sh),\ - MI_SF(HUBPREQ0_BLANK_OFFSET_0, REFCYC_H_BLANK_END, mask_sh),\ - MI_SF(HUBPREQ0_BLANK_OFFSET_0, DLG_V_BLANK_END, mask_sh),\ - MI_SF(HUBPREQ0_BLANK_OFFSET_1, MIN_DST_Y_NEXT_START, mask_sh),\ - 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),\ - MI_SF(HUBPREQ0_VBLANK_PARAMETERS_1, REFCYC_PER_PTE_GROUP_VBLANK_L, mask_sh),\ - MI_SF(HUBPREQ0_VBLANK_PARAMETERS_3, REFCYC_PER_META_CHUNK_VBLANK_L, mask_sh),\ - MI_SF(HUBPREQ0_NOM_PARAMETERS_0, DST_Y_PER_PTE_ROW_NOM_L, mask_sh),\ - MI_SF(HUBPREQ0_NOM_PARAMETERS_1, REFCYC_PER_PTE_GROUP_NOM_L, mask_sh),\ - MI_SF(HUBPREQ0_NOM_PARAMETERS_4, DST_Y_PER_META_ROW_NOM_L, mask_sh),\ - MI_SF(HUBPREQ0_NOM_PARAMETERS_5, REFCYC_PER_META_CHUNK_NOM_L, mask_sh),\ - MI_SF(HUBPREQ0_PER_LINE_DELIVERY_PRE, REFCYC_PER_LINE_DELIVERY_PRE_L, mask_sh),\ - 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),\ - MI_SF(HUBPREQ0_NOM_PARAMETERS_3, REFCYC_PER_PTE_GROUP_NOM_C, mask_sh),\ - MI_SF(HUBPREQ0_NOM_PARAMETERS_6, DST_Y_PER_META_ROW_NOM_C, mask_sh),\ - MI_SF(HUBPREQ0_NOM_PARAMETERS_7, REFCYC_PER_META_CHUNK_NOM_C, mask_sh),\ - MI_SF(HUBPREQ0_DCN_TTU_QOS_WM, QoS_LEVEL_LOW_WM, mask_sh),\ - MI_SF(HUBPREQ0_DCN_TTU_QOS_WM, QoS_LEVEL_HIGH_WM, mask_sh),\ - MI_SF(HUBPREQ0_DCN_GLOBAL_TTU_CNTL, MIN_TTU_VBLANK, mask_sh),\ - MI_SF(HUBPREQ0_DCN_GLOBAL_TTU_CNTL, QoS_LEVEL_FLIP, mask_sh),\ - MI_SF(HUBPREQ0_DCN_SURF0_TTU_CNTL0, REFCYC_PER_REQ_DELIVERY, mask_sh),\ - MI_SF(HUBPREQ0_DCN_SURF0_TTU_CNTL0, QoS_LEVEL_FIXED, mask_sh),\ - MI_SF(HUBPREQ0_DCN_SURF0_TTU_CNTL0, QoS_RAMP_DISABLE, mask_sh),\ - MI_SF(HUBPREQ0_DCN_SURF0_TTU_CNTL1, REFCYC_PER_REQ_DELIVERY_PRE, 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),\ - MI_SF(HUBPREQ0_DCN_VM_CONTEXT0_PAGE_TABLE_START_ADDR_LSB, VM_CONTEXT0_PAGE_TABLE_START_ADDR_LSB, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_CONTEXT0_PAGE_TABLE_END_ADDR_MSB, VM_CONTEXT0_PAGE_TABLE_END_ADDR_MSB, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_CONTEXT0_PAGE_TABLE_END_ADDR_LSB, VM_CONTEXT0_PAGE_TABLE_END_ADDR_LSB, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_MSB, VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_MSB, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_LSB, VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_LSB, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_MX_L1_TLB_CNTL, SYSTEM_ACCESS_MODE, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB, MC_VM_SYSTEM_APERTURE_DEFAULT_SYSTEM, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB, MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB, MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_SYSTEM_APERTURE_LOW_ADDR_MSB, MC_VM_SYSTEM_APERTURE_LOW_ADDR_MSB, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_SYSTEM_APERTURE_LOW_ADDR_LSB, MC_VM_SYSTEM_APERTURE_LOW_ADDR_LSB, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_MSB, MC_VM_SYSTEM_APERTURE_HIGH_ADDR_MSB, mask_sh),\ - MI_SF(HUBPREQ0_DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB, MC_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB, mask_sh),\ - MI_SF(DCHUBBUB_SDPIF_FB_TOP, SDPIF_FB_TOP, mask_sh),\ - MI_SF(DCHUBBUB_SDPIF_FB_BASE, SDPIF_FB_BASE, mask_sh),\ - MI_SF(DCHUBBUB_SDPIF_FB_OFFSET, SDPIF_FB_OFFSET, mask_sh),\ - MI_SF(DCHUBBUB_SDPIF_AGP_BASE, SDPIF_AGP_BASE, mask_sh),\ - MI_SF(DCHUBBUB_SDPIF_AGP_BOT, SDPIF_AGP_BOT, mask_sh),\ - MI_SF(DCHUBBUB_SDPIF_AGP_TOP, SDPIF_AGP_TOP, mask_sh),\ - MI_SF(DCHUBBUB_ARB_WATERMARK_CHANGE_CNTL, DCHUBBUB_ARB_WATERMARK_CHANGE_REQUEST, mask_sh),\ - MI_SF(DCHUBBUB_ARB_WATERMARK_CHANGE_CNTL, DCHUBBUB_ARB_WATERMARK_CHANGE_DONE_INTERRUPT_DISABLE, mask_sh),\ - MI_SF(DCHUBBUB_ARB_DRAM_STATE_CNTL, DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_VALUE, mask_sh),\ - MI_SF(DCHUBBUB_ARB_DRAM_STATE_CNTL, DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_ENABLE, mask_sh),\ - MI_SF(DCHUBBUB_ARB_SAT_LEVEL, DCHUBBUB_ARB_SAT_LEVEL, mask_sh),\ - MI_SF(DCHUBBUB_ARB_DF_REQ_OUTSTAND, DCHUBBUB_ARB_MIN_REQ_OUTSTAND, mask_sh),\ -/* todo: get these from GVM instead of reading registers ourselves */ \ -MI_SF (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32 ,PAGE_DIRECTORY_ENTRY_HI32 , mask_sh),\ -MI_SF (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32 ,PAGE_DIRECTORY_ENTRY_LO32 , mask_sh),\ -MI_SF (VM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32 ,LOGICAL_PAGE_NUMBER_HI4 , mask_sh),\ -MI_SF (VM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32 ,LOGICAL_PAGE_NUMBER_LO32 , mask_sh),\ -MI_SF (VM_L2_PROTECTION_FAULT_DEFAULT_ADDR_HI32 ,PHYSICAL_PAGE_ADDR_HI4 , mask_sh),\ -MI_SF (VM_L2_PROTECTION_FAULT_DEFAULT_ADDR_LO32 ,PHYSICAL_PAGE_ADDR_LO32 , mask_sh),\ -MI_SF (MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB ,PHYSICAL_PAGE_NUMBER_MSB , mask_sh),\ -MI_SF (MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB ,PHYSICAL_PAGE_NUMBER_LSB , mask_sh),\ - MI_SF(MC_VM_SYSTEM_APERTURE_LOW_ADDR, LOGICAL_ADDR, mask_sh) - -#define DCN_MI_REG_FIELD_LIST(type) \ - type HUBP_BLANK_EN;\ -type HUBP_TTU_DISABLE ;\ -type NUM_PIPES ;\ -type NUM_BANKS ;\ -type PIPE_INTERLEAVE ;\ -type NUM_SE ;\ -type NUM_RB_PER_SE ;\ -type MAX_COMPRESSED_FRAGS ;\ -type SW_MODE ;\ -type META_LINEAR ;\ -type RB_ALIGNED ;\ -type PIPE_ALIGNED ;\ -type PITCH ;\ -type META_PITCH ;\ -type PITCH_C ;\ -type META_PITCH_C ;\ -type ROTATION_ANGLE ;\ -type H_MIRROR_EN ;\ -type SURFACE_PIXEL_FORMAT ;\ -type SURFACE_FLIP_TYPE ;\ -type SURFACE_UPDATE_LOCK ;\ -type SURFACE_UPDATE_PENDING ;\ -type PRIMARY_SURFACE_ADDRESS_HIGH ;\ -type PRIMARY_SURFACE_ADDRESS ;\ -type SECONDARY_SURFACE_ADDRESS_HIGH ;\ -type SECONDARY_SURFACE_ADDRESS ;\ -type PRIMARY_META_SURFACE_ADDRESS_HIGH ;\ -type PRIMARY_META_SURFACE_ADDRESS ;\ -type SECONDARY_META_SURFACE_ADDRESS_HIGH ;\ -type SECONDARY_META_SURFACE_ADDRESS ;\ -type PRIMARY_SURFACE_ADDRESS_HIGH_C ;\ -type PRIMARY_SURFACE_ADDRESS_C ;\ -type PRIMARY_META_SURFACE_ADDRESS_HIGH_C ;\ -type PRIMARY_META_SURFACE_ADDRESS_C ;\ -type SURFACE_INUSE_ADDRESS ;\ -type SURFACE_INUSE_ADDRESS_HIGH ;\ -type SURFACE_INUSE_ADDRESS_C ;\ -type SURFACE_INUSE_ADDRESS_HIGH_C ;\ -type SURFACE_EARLIEST_INUSE_ADDRESS ;\ -type SURFACE_EARLIEST_INUSE_ADDRESS_HIGH ;\ -type SURFACE_EARLIEST_INUSE_ADDRESS_C ;\ -type SURFACE_EARLIEST_INUSE_ADDRESS_HIGH_C ;\ -type PRIMARY_SURFACE_DCC_EN ;\ -type PRIMARY_SURFACE_DCC_IND_64B_BLK ;\ -type DET_BUF_PLANE1_BASE_ADDRESS ;\ -type CROSSBAR_SRC_CB_B ;\ -type CROSSBAR_SRC_CR_R ;\ -type DRQ_EXPANSION_MODE ;\ -type PRQ_EXPANSION_MODE ;\ -type MRQ_EXPANSION_MODE ;\ -type CRQ_EXPANSION_MODE ;\ -type CHUNK_SIZE ;\ -type MIN_CHUNK_SIZE ;\ -type META_CHUNK_SIZE ;\ -type MIN_META_CHUNK_SIZE ;\ -type DPTE_GROUP_SIZE ;\ -type MPTE_GROUP_SIZE ;\ -type SWATH_HEIGHT ;\ -type PTE_ROW_HEIGHT_LINEAR ;\ -type CHUNK_SIZE_C ;\ -type MIN_CHUNK_SIZE_C ;\ -type META_CHUNK_SIZE_C ;\ -type MIN_META_CHUNK_SIZE_C ;\ -type DPTE_GROUP_SIZE_C ;\ -type MPTE_GROUP_SIZE_C ;\ -type SWATH_HEIGHT_C ;\ -type PTE_ROW_HEIGHT_LINEAR_C ;\ -type REFCYC_H_BLANK_END ;\ -type DLG_V_BLANK_END ;\ -type MIN_DST_Y_NEXT_START ;\ -type REFCYC_PER_HTOTAL ;\ -type REFCYC_X_AFTER_SCALER ;\ -type DST_Y_AFTER_SCALER ;\ -type DST_Y_PREFETCH ;\ -type VRATIO_PREFETCH ;\ -type DST_Y_PER_VM_VBLANK ;\ -type DST_Y_PER_ROW_VBLANK ;\ -type REF_FREQ_TO_PIX_FREQ ;\ -type REFCYC_PER_PTE_GROUP_VBLANK_L ;\ -type REFCYC_PER_META_CHUNK_VBLANK_L ;\ -type DST_Y_PER_PTE_ROW_NOM_L ;\ -type REFCYC_PER_PTE_GROUP_NOM_L ;\ -type DST_Y_PER_META_ROW_NOM_L ;\ -type REFCYC_PER_META_CHUNK_NOM_L ;\ -type REFCYC_PER_LINE_DELIVERY_PRE_L ;\ -type REFCYC_PER_LINE_DELIVERY_PRE_C ;\ -type REFCYC_PER_LINE_DELIVERY_L ;\ -type REFCYC_PER_LINE_DELIVERY_C ;\ -type VRATIO_PREFETCH_C ;\ -type REFCYC_PER_PTE_GROUP_VBLANK_C ;\ -type REFCYC_PER_META_CHUNK_VBLANK_C ;\ -type DST_Y_PER_PTE_ROW_NOM_C ;\ -type REFCYC_PER_PTE_GROUP_NOM_C ;\ -type DST_Y_PER_META_ROW_NOM_C ;\ -type REFCYC_PER_META_CHUNK_NOM_C ;\ -type QoS_LEVEL_LOW_WM;\ -type QoS_LEVEL_HIGH_WM;\ -type MIN_TTU_VBLANK ;\ -type QoS_LEVEL_FLIP;\ -type REFCYC_PER_REQ_DELIVERY ;\ -type QoS_LEVEL_FIXED;\ -type QoS_RAMP_DISABLE;\ -type REFCYC_PER_REQ_DELIVERY_PRE ;\ -type VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_MSB ;\ -type VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LSB ;\ -type VM_CONTEXT0_PAGE_TABLE_START_ADDR_MSB ;\ -type VM_CONTEXT0_PAGE_TABLE_START_ADDR_LSB ;\ -type VM_CONTEXT0_PAGE_TABLE_END_ADDR_MSB ;\ -type VM_CONTEXT0_PAGE_TABLE_END_ADDR_LSB ;\ -type VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_MSB ;\ -type VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_LSB ;\ -type ENABLE_L1_TLB ;\ -type SYSTEM_ACCESS_MODE ;\ -type MC_VM_SYSTEM_APERTURE_DEFAULT_SYSTEM ;\ -type MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB ;\ -type MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB ;\ -type MC_VM_SYSTEM_APERTURE_LOW_ADDR_MSB ;\ -type MC_VM_SYSTEM_APERTURE_LOW_ADDR_LSB ;\ -type MC_VM_SYSTEM_APERTURE_HIGH_ADDR_MSB ;\ -type MC_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB ;\ -type SDPIF_FB_TOP ;\ -type SDPIF_FB_BASE ;\ -type SDPIF_FB_OFFSET ;\ -type SDPIF_AGP_BASE ;\ -type SDPIF_AGP_BOT ;\ -type SDPIF_AGP_TOP ;\ -type DCHUBBUB_ARB_WATERMARK_CHANGE_REQUEST ;\ -type DCHUBBUB_ARB_WATERMARK_CHANGE_DONE_INTERRUPT_DISABLE ;\ -type DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_VALUE ;\ -type DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_ENABLE ;\ -type DCHUBBUB_ARB_SAT_LEVEL ;\ -type DCHUBBUB_ARB_MIN_REQ_OUTSTAND ;\ -/* todo: get these from GVM instead of reading registers ourselves */ \ -type PAGE_DIRECTORY_ENTRY_HI32 ;\ -type PAGE_DIRECTORY_ENTRY_LO32 ;\ -type LOGICAL_PAGE_NUMBER_HI4 ;\ -type LOGICAL_PAGE_NUMBER_LO32 ;\ -type PHYSICAL_PAGE_ADDR_HI4 ;\ -type PHYSICAL_PAGE_ADDR_LO32 ;\ -type PHYSICAL_PAGE_NUMBER_MSB ;\ -type PHYSICAL_PAGE_NUMBER_LSB ;\ - type LOGICAL_ADDR - -struct dcn_mi_shift { -DCN_MI_REG_FIELD_LIST (uint8_t ); +REG_SET (DCN_SURF1_TTU_CNTL1 ,0 , +REFCYC_PER_REQ_DELIVERY_PRE , + ttu_attr->refcyc_per_req_delivery_pre_c); +} + +static void min10_setup ( +struct mem_input *mem_input, +struct _vcs_dpi_display_dlg_regs_st *dlg_attr, +struct _vcs_dpi_display_ttu_regs_st *ttu_attr, +struct _vcs_dpi_display_rq_regs_st *rq_regs, +struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest) +{ +/* otg is locked when this func is called. Register are double buffered. +* disable the requestors is not needed +*/ +min10_program_requestor (mem_input, rq_regs); +min10_program_deadline (mem_input, dlg_attr, ttu_attr); +min10_vready_workaround (mem_input, pipe_dest); +} + +static uint32_t convert_and_clamp ( +uint32_t wm_ns, +uint32_t refclk_mhz, +uint32_t clamp_value) +{ +uint32_t ret_val =0 ; + ret_val = wm_ns * refclk_mhz; + ret_val /=1000 ; + +if (ret_val > clamp_value) + ret_val = clamp_value; + +return ret_val; +} + +static void min10_program_watermarks ( +struct mem_input *mem_input, +struct dcn_watermark_set *watermarks, +unsigned int refclk_mhz) +{ +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); +uint32_t force_en = mem_input->ctx->dc->debug.disable_stutter ?1 :0 ; +/* +* Need to clamp to max of the register values (i.e. no wrap) +* for dcn1, all wm registers are 21-bit wide +*/ +uint32_t prog_wm_value; + +/* Repeat for water mark set A, B, C and D. */ +/* clock state A */ + prog_wm_value =convert_and_clamp (watermarks->a.urgent_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_A , prog_wm_value); + +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"URGENCY_WATERMARK_A calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->a.urgent_ns, prog_wm_value); + + prog_wm_value =convert_and_clamp (watermarks->a.pte_meta_urgent_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_A , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"PTE_META_URGENCY_WATERMARK_A calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->a.pte_meta_urgent_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->a.cstate_pstate.cstate_enter_plus_exit_ns, + refclk_mhz,0x1fffff ); + +REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"SR_ENTER_EXIT_WATERMARK_A calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->a.cstate_pstate.cstate_enter_plus_exit_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->a.cstate_pstate.cstate_exit_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_A , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"SR_EXIT_WATERMARK_A calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->a.cstate_pstate.cstate_exit_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->a.cstate_pstate.pstate_change_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_A , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"DRAM_CLK_CHANGE_WATERMARK_A calculated =%d\n" +"HW register value = 0x%x\n\n" , + watermarks->a.cstate_pstate.pstate_change_ns, prog_wm_value); + + +/* clock state B */ + prog_wm_value =convert_and_clamp ( + watermarks->b.urgent_ns, refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_B , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"URGENCY_WATERMARK_B calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->b.urgent_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->b.pte_meta_urgent_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_B , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"PTE_META_URGENCY_WATERMARK_B calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->b.pte_meta_urgent_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->b.cstate_pstate.cstate_enter_plus_exit_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_B , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"SR_ENTER_WATERMARK_B calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->b.cstate_pstate.cstate_enter_plus_exit_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->b.cstate_pstate.cstate_exit_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_B , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"SR_EXIT_WATERMARK_B calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->b.cstate_pstate.cstate_exit_ns, prog_wm_value); + + prog_wm_value =convert_and_clamp ( + watermarks->b.cstate_pstate.pstate_change_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_B , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"DRAM_CLK_CHANGE_WATERMARK_B calculated =%d\n\n" +"HW register value = 0x%x\n" , + watermarks->b.cstate_pstate.pstate_change_ns, prog_wm_value); + +/* clock state C */ + prog_wm_value =convert_and_clamp ( + watermarks->c.urgent_ns, refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_C , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"URGENCY_WATERMARK_C calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->c.urgent_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->c.pte_meta_urgent_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_C , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"PTE_META_URGENCY_WATERMARK_C calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->c.pte_meta_urgent_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->c.cstate_pstate.cstate_enter_plus_exit_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_C , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"SR_ENTER_WATERMARK_C calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->c.cstate_pstate.cstate_enter_plus_exit_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->c.cstate_pstate.cstate_exit_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_C , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"SR_EXIT_WATERMARK_C calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->c.cstate_pstate.cstate_exit_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->c.cstate_pstate.pstate_change_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_C , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"DRAM_CLK_CHANGE_WATERMARK_C calculated =%d\n\n" +"HW register value = 0x%x\n" , + watermarks->c.cstate_pstate.pstate_change_ns, prog_wm_value); + +/* clock state D */ + prog_wm_value =convert_and_clamp ( + watermarks->d.urgent_ns, refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_D , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"URGENCY_WATERMARK_D calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->d.urgent_ns, prog_wm_value); + + prog_wm_value =convert_and_clamp ( + watermarks->d.pte_meta_urgent_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_D , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"PTE_META_URGENCY_WATERMARK_D calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->d.pte_meta_urgent_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->d.cstate_pstate.cstate_enter_plus_exit_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_D , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"SR_ENTER_WATERMARK_D calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->d.cstate_pstate.cstate_enter_plus_exit_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->d.cstate_pstate.cstate_exit_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_D , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"SR_EXIT_WATERMARK_D calculated =%d\n" +"HW register value = 0x%x\n" , + watermarks->d.cstate_pstate.cstate_exit_ns, prog_wm_value); + + + prog_wm_value =convert_and_clamp ( + watermarks->d.cstate_pstate.pstate_change_ns, + refclk_mhz,0x1fffff ); +REG_WRITE (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_D , prog_wm_value); +dm_logger_write (mem_input->ctx->logger,LOG_HW_MARKS , +"DRAM_CLK_CHANGE_WATERMARK_D calculated =%d\n" +"HW register value = 0x%x\n\n" , + watermarks->d.cstate_pstate.pstate_change_ns, prog_wm_value); + +REG_UPDATE (DCHUBBUB_ARB_WATERMARK_CHANGE_CNTL , +DCHUBBUB_ARB_WATERMARK_CHANGE_REQUEST ,1 ); +REG_UPDATE (DCHUBBUB_ARB_WATERMARK_CHANGE_CNTL , +DCHUBBUB_ARB_WATERMARK_CHANGE_REQUEST ,0 ); +REG_UPDATE (DCHUBBUB_ARB_SAT_LEVEL , +DCHUBBUB_ARB_SAT_LEVEL ,60 * refclk_mhz); +REG_UPDATE (DCHUBBUB_ARB_DF_REQ_OUTSTAND , +DCHUBBUB_ARB_MIN_REQ_OUTSTAND ,68 ); + +REG_UPDATE_2 (DCHUBBUB_ARB_DRAM_STATE_CNTL , +DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_VALUE ,0 , +DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_ENABLE , force_en); + +#if 0 +REG_UPDATE_2 (DCHUBBUB_ARB_WATERMARK_CHANGE_CNTL , +DCHUBBUB_ARB_WATERMARK_CHANGE_DONE_INTERRUPT_DISABLE ,1 , +DCHUBBUB_ARB_WATERMARK_CHANGE_REQUEST ,1 ); +#endif +} + +static void min10_program_display_marks ( +struct mem_input *mem_input, +struct dce_watermarks nbp, +struct dce_watermarks stutter, +struct dce_watermarks urgent, +uint32_t total_dest_line_time_ns) +{ +/* only for dce +* dcn use only program_watermarks +*/ +} + +static bool min10_is_flip_pending (struct mem_input *mem_input) +{ +uint32_t flip_pending =0 ; +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); +struct dc_plane_address earliest_inuse_address; + +REG_GET (DCSURF_FLIP_CONTROL , +SURFACE_FLIP_PENDING , &flip_pending); + +REG_GET (DCSURF_SURFACE_EARLIEST_INUSE , +SURFACE_EARLIEST_INUSE_ADDRESS , &earliest_inuse_address.grph.addr.low_part); + +REG_GET (DCSURF_SURFACE_EARLIEST_INUSE_HIGH , +SURFACE_EARLIEST_INUSE_ADDRESS_HIGH , &earliest_inuse_address.grph.addr.high_part); + +if (flip_pending) +return true; + +if (earliest_inuse_address.grph.addr.quad_part != mem_input->request_address.grph.addr.quad_part) +return true; + + mem_input->current_address = mem_input->request_address; +return false; +} + +static void min10_update_dchub ( +struct mem_input *mem_input, +struct dchub_init_data *dh_data) +{ +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); +/* TODO: port code from dal2 */ +switch (dh_data->fb_mode) { +case FRAME_BUFFER_MODE_ZFB_ONLY : +/*For ZFB case need to put DCHUB FB BASE and TOP upside down to indicate ZFB mode*/ +REG_UPDATE (DCHUBBUB_SDPIF_FB_TOP , +SDPIF_FB_TOP ,0 ); + +REG_UPDATE (DCHUBBUB_SDPIF_FB_BASE , +SDPIF_FB_BASE ,0x0FFFF ); + +REG_UPDATE (DCHUBBUB_SDPIF_AGP_BASE , +SDPIF_AGP_BASE , dh_data->zfb_phys_addr_base >>22 ); + +REG_UPDATE (DCHUBBUB_SDPIF_AGP_BOT , +SDPIF_AGP_BOT , dh_data->zfb_mc_base_addr >>22 ); + +REG_UPDATE (DCHUBBUB_SDPIF_AGP_TOP , +SDPIF_AGP_TOP , (dh_data->zfb_mc_base_addr + + dh_data->zfb_size_in_byte -1 ) >>22 ); +break ; +case FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL : +/*Should not touch FB LOCATION (done by VBIOS on AsicInit table)*/ + +REG_UPDATE (DCHUBBUB_SDPIF_AGP_BASE , +SDPIF_AGP_BASE , dh_data->zfb_phys_addr_base >>22 ); + +REG_UPDATE (DCHUBBUB_SDPIF_AGP_BOT , +SDPIF_AGP_BOT , dh_data->zfb_mc_base_addr >>22 ); + +REG_UPDATE (DCHUBBUB_SDPIF_AGP_TOP , +SDPIF_AGP_TOP , (dh_data->zfb_mc_base_addr + + dh_data->zfb_size_in_byte -1 ) >>22 ); +break ; +case FRAME_BUFFER_MODE_LOCAL_ONLY : +/*Should not touch FB LOCATION (done by VBIOS on AsicInit table)*/ +REG_UPDATE (DCHUBBUB_SDPIF_AGP_BASE , +SDPIF_AGP_BASE ,0 ); + +REG_UPDATE (DCHUBBUB_SDPIF_AGP_BOT , +SDPIF_AGP_BOT ,0X03FFFF ); + +REG_UPDATE (DCHUBBUB_SDPIF_AGP_TOP , +SDPIF_AGP_TOP ,0 ); +break ; +default : +break ; + } + + dh_data->dchub_initialzied = true; + dh_data->dchub_info_valid = false; +} + +struct vm_system_aperture_param { +PHYSICAL_ADDRESS_LOC sys_default; +PHYSICAL_ADDRESS_LOC sys_low; +PHYSICAL_ADDRESS_LOC sys_high; }; -struct dcn_mi_mask { -DCN_MI_REG_FIELD_LIST (uint32_t ); +static void min10_read_vm_system_aperture_settings (struct dcn10_mem_input *mi, +struct vm_system_aperture_param *apt) +{ +PHYSICAL_ADDRESS_LOC physical_page_number; +uint32_t logical_addr_low; +uint32_t logical_addr_high; + +REG_GET (MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB , +PHYSICAL_PAGE_NUMBER_MSB , &physical_page_number.high_part); +REG_GET (MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB , +PHYSICAL_PAGE_NUMBER_LSB , &physical_page_number.low_part); + +REG_GET (MC_VM_SYSTEM_APERTURE_LOW_ADDR , +LOGICAL_ADDR , &logical_addr_low); + +REG_GET (MC_VM_SYSTEM_APERTURE_HIGH_ADDR , +LOGICAL_ADDR , &logical_addr_high); + + apt->sys_default.quad_part = physical_page_number.quad_part <<12 ; + apt->sys_low.quad_part = (int64_t )logical_addr_low <<18 ; + apt->sys_high.quad_part = (int64_t )logical_addr_high <<18 ; +} + +static void min10_set_vm_system_aperture_settings (struct dcn10_mem_input *mi, +struct vm_system_aperture_param *apt) +{ +PHYSICAL_ADDRESS_LOC mc_vm_apt_default; +PHYSICAL_ADDRESS_LOC mc_vm_apt_low; +PHYSICAL_ADDRESS_LOC mc_vm_apt_high; + + mc_vm_apt_default.quad_part = apt->sys_default.quad_part >>12 ; + mc_vm_apt_low.quad_part = apt->sys_low.quad_part >>12 ; + mc_vm_apt_high.quad_part = apt->sys_high.quad_part >>12 ; + +REG_SET_2 (DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB ,0 , +MC_VM_SYSTEM_APERTURE_DEFAULT_SYSTEM ,1 ,/* 1 = system physical memory */ +MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB , mc_vm_apt_default.high_part); +REG_SET (DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB ,0 , +MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB , mc_vm_apt_default.low_part); + +REG_SET (DCN_VM_SYSTEM_APERTURE_LOW_ADDR_MSB ,0 , +MC_VM_SYSTEM_APERTURE_LOW_ADDR_MSB , mc_vm_apt_low.high_part); +REG_SET (DCN_VM_SYSTEM_APERTURE_LOW_ADDR_LSB ,0 , +MC_VM_SYSTEM_APERTURE_LOW_ADDR_LSB , mc_vm_apt_low.low_part); + +REG_SET (DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_MSB ,0 , +MC_VM_SYSTEM_APERTURE_HIGH_ADDR_MSB , mc_vm_apt_high.high_part); +REG_SET (DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB ,0 , +MC_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB , mc_vm_apt_high.low_part); +} + +struct vm_context0_param { +PHYSICAL_ADDRESS_LOC pte_base; +PHYSICAL_ADDRESS_LOC pte_start; +PHYSICAL_ADDRESS_LOC pte_end; +PHYSICAL_ADDRESS_LOC fault_default; }; -struct dcn10_mem_input { -struct mem_input base; -const struct dcn_mi_registers *mi_regs; -const struct dcn_mi_shift *mi_shift; -const struct dcn_mi_mask *mi_mask; +/* Temporary read settings, future will get values from kmd directly */ +static void min10_read_vm_context0_settings (struct dcn10_mem_input *mi, +struct vm_context0_param *vm0) +{ +PHYSICAL_ADDRESS_LOC fb_base; +PHYSICAL_ADDRESS_LOC fb_offset; +uint32_t fb_base_value; +uint32_t fb_offset_value; + +REG_GET (DCHUBBUB_SDPIF_FB_BASE ,SDPIF_FB_BASE , &fb_base_value); +REG_GET (DCHUBBUB_SDPIF_FB_OFFSET ,SDPIF_FB_OFFSET , &fb_offset_value); + +REG_GET (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32 , +PAGE_DIRECTORY_ENTRY_HI32 , &vm0->pte_base.high_part); +REG_GET (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32 , +PAGE_DIRECTORY_ENTRY_LO32 , &vm0->pte_base.low_part); + +REG_GET (VM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32 , +LOGICAL_PAGE_NUMBER_HI4 , &vm0->pte_start.high_part); +REG_GET (VM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32 , +LOGICAL_PAGE_NUMBER_LO32 , &vm0->pte_start.low_part); + +REG_GET (VM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32 , +LOGICAL_PAGE_NUMBER_HI4 , &vm0->pte_end.high_part); +REG_GET (VM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32 , +LOGICAL_PAGE_NUMBER_LO32 , &vm0->pte_end.low_part); + +REG_GET (VM_L2_PROTECTION_FAULT_DEFAULT_ADDR_HI32 , +PHYSICAL_PAGE_ADDR_HI4 , &vm0->fault_default.high_part); +REG_GET (VM_L2_PROTECTION_FAULT_DEFAULT_ADDR_LO32 , +PHYSICAL_PAGE_ADDR_LO32 , &vm0->fault_default.low_part); + +/* +* The values in VM_CONTEXT0_PAGE_TABLE_BASE_ADDR is in UMA space. +* Therefore we need to do +* DCN_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR = VM_CONTEXT0_PAGE_TABLE_BASE_ADDR +* - DCHUBBUB_SDPIF_FB_OFFSET + DCHUBBUB_SDPIF_FB_BASE +*/ + fb_base.quad_part = (uint64_t )fb_base_value <<24 ; + fb_offset.quad_part = (uint64_t )fb_offset_value <<24 ; + vm0->pte_base.quad_part += fb_base.quad_part; + vm0->pte_base.quad_part -= fb_offset.quad_part; +} + +static void min10_set_vm_context0_settings (struct dcn10_mem_input *mi, +const struct vm_context0_param *vm0) +{ +/* pte base */ +REG_SET (DCN_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_MSB ,0 , +VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_MSB , vm0->pte_base.high_part); +REG_SET (DCN_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LSB ,0 , +VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LSB , vm0->pte_base.low_part); + +/* pte start */ +REG_SET (DCN_VM_CONTEXT0_PAGE_TABLE_START_ADDR_MSB ,0 , +VM_CONTEXT0_PAGE_TABLE_START_ADDR_MSB , vm0->pte_start.high_part); +REG_SET (DCN_VM_CONTEXT0_PAGE_TABLE_START_ADDR_LSB ,0 , +VM_CONTEXT0_PAGE_TABLE_START_ADDR_LSB , vm0->pte_start.low_part); + +/* pte end */ +REG_SET (DCN_VM_CONTEXT0_PAGE_TABLE_END_ADDR_MSB ,0 , +VM_CONTEXT0_PAGE_TABLE_END_ADDR_MSB , vm0->pte_end.high_part); +REG_SET (DCN_VM_CONTEXT0_PAGE_TABLE_END_ADDR_LSB ,0 , +VM_CONTEXT0_PAGE_TABLE_END_ADDR_LSB , vm0->pte_end.low_part); + +/* fault handling */ +REG_SET (DCN_VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_MSB ,0 , +VM_CONTEXT0_PAGE_TABLE_END_ADDR_MSB , vm0->fault_default.high_part); +/* VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_SYSTEM, 0 */ +REG_SET (DCN_VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_LSB ,0 , +VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_LSB , vm0->fault_default.low_part); +} + +static void min10_program_pte_vm (struct mem_input *mem_input, +enum surface_pixel_format format, +union dc_tiling_info *tiling_info, +enum dc_rotation_angle rotation) +{ +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); +struct vm_system_aperture_param apt = { {{0 } } }; +struct vm_context0_param vm0 = { { {0 } } }; + + +min10_read_vm_system_aperture_settings (mi, &apt); +min10_read_vm_context0_settings (mi, &vm0); + +min10_set_vm_system_aperture_settings (mi, &apt); +min10_set_vm_context0_settings (mi, &vm0); + +/* control: enable VM PTE*/ +REG_SET_2 (DCN_VM_MX_L1_TLB_CNTL ,0 , +ENABLE_L1_TLB ,1 , +SYSTEM_ACCESS_MODE ,3 ); +} + +static struct mem_input_funcs dcn10_mem_input_funcs = { + .mem_input_program_display_marks = min10_program_display_marks, + .mem_input_program_surface_flip_and_addr = + min10_program_surface_flip_and_addr, + .mem_input_program_surface_config = + min10_program_surface_config, + .mem_input_is_flip_pending = min10_is_flip_pending, + .mem_input_setup = min10_setup, + .program_watermarks = min10_program_watermarks, + .mem_input_update_dchub = min10_update_dchub, + .mem_input_program_pte_vm = min10_program_pte_vm, + .set_blank = min10_set_blank, + .dcc_control = min10_dcc_control, }; + +/*****************************************/ +/* Constructor, Destructor */ +/*****************************************/ +bool dcn10_mem_input_construct (struct dcn10_mem_input *mi,struct dc_context *ctx,uint32_t inst,const struct dcn_mi_registers *mi_regs,const struct dcn_mi_shift *mi_shift, -const struct dcn_mi_mask *mi_mask); +const struct dcn_mi_mask *mi_mask) +{ + mi->base.funcs = &dcn10_mem_input_funcs; + mi->base.ctx = ctx; + mi->mi_regs = mi_regs; + mi->mi_shift = mi_shift; + mi->mi_mask = mi_mask; + mi->base.inst = inst; +return true; +} -#endif
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 18/81 drm/amd/display: Fix for hdmi frame pack stereo
In reply to a message not in the archiveFrom: Vitaly Prosyak <[email protected]>
--- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 10 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 +- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 +- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 11 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h | 1615 +++++++------------- 5 files changed, 574 insertions(+), 1067 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +9 -1
@@ -987,7 +987,15 @@ bool dcn_validate_bandwidth(if (pipe->surface) {struct pipe_ctx *hsplit_pipe = pipe->bottom_pipe; -if (v->dpp_per_plane[input_idx] ==2 ) { +if (v->dpp_per_plane[input_idx] ==2 || + ((pipe->stream->public.view_format == +VIEW_3D_FORMAT_SIDE_BY_SIDE || + pipe->stream->public.view_format == +VIEW_3D_FORMAT_TOP_AND_BOTTOM ) && + (pipe->stream->public.timing.timing_3d_format == +TIMING_3D_FORMAT_TOP_AND_BOTTOM || + pipe->stream->public.timing.timing_3d_format == +TIMING_3D_FORMAT_SIDE_BY_SIDE ))) {if (hsplit_pipe && hsplit_pipe->surface == pipe->surface) {/* update previously split pipe */ hsplit_pipe->pipe_dlg_param.vupdate_width = v->v_update_width[input_idx];
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -2
@@ -967,7 +967,6 @@ bool dc_commit_streams(DC_SURFACE_TO_CORE (context->stream_status[i].surfaces[j]); core_dc->hwss.apply_ctx_for_surface (core_dc, surface, context); -dc_enable_stereo (dc, context, streams, stream_count); } CONN_MSG_MODE(sink->link, "{%ux%u, %ux%u@%u, %ux%u@%uKhz}",
@@ -982,7 +981,7 @@ bool dc_commit_streams( context->streams[i]->public.timing.v_total, context->streams[i]->public.timing.pix_clk_khz); } - +dc_enable_stereo (dc, context, streams, stream_count);dc_resource_validate_ctx_destruct (core_dc->current_context);dm_free (core_dc->current_context);
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
@@ -626,7 +626,7 @@ static void calculate_scaling_ratios(struct pipe_ctx *pipe_ctx)if (stream->public.view_format ==VIEW_3D_FORMAT_SIDE_BY_SIDE ) pipe_ctx->scl_data.ratios.horz.value *=2 ; -else if (surface->stereo_format ==PLANE_STEREO_FORMAT_TOP_AND_BOTTOM ) +else if (stream->public.view_format ==VIEW_3D_FORMAT_TOP_AND_BOTTOM ) pipe_ctx->scl_data.ratios.vert.value *=2 ; pipe_ctx->scl_data.ratios.vert.value = div64_s64(
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +8 -3
@@ -891,7 +891,6 @@ static void reset_hw_ctx_wrap( } } -static bool patch_address_for_sbs_tb_stereo (struct pipe_ctx *pipe_ctx,PHYSICAL_ADDRESS_LOC *addr) {
@@ -904,11 +903,17 @@ static bool patch_address_for_sbs_tb_stereo( pipe_ctx->stream->public.timing.timing_3d_format == TIMING_3D_FORMAT_TOP_AND_BOTTOM)) { *addr = surface->public.address.grph_stereo.left_addr; - surface->public.address.grph_stereo.left_addr =\ + surface->public.address.grph_stereo.left_addr = surface->public.address.grph_stereo.right_addr;return true; + }else { +if (pipe_ctx->stream->public.view_format !=VIEW_3D_FORMAT_NONE && + surface->public.address.type !=PLN_ADDR_TYPE_GRPH_STEREO ) { + surface->public.address.type =PLN_ADDR_TYPE_GRPH_STEREO ; + surface->public.address.grph_stereo.right_addr = + surface->public.address.grph_stereo.left_addr; + } } -return false; }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h +555 -1060
1,636 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 19/81 drm/amd/display: Set static screen register for stoney/carrizo
In reply to a message not in the archiveFrom: Bhawanpreet Lakha <[email protected]>
-Set CRTC_STATIC_SCREEN_EVENT for stoney/carrizo for FBC implementation -Code is currently guarded with "ENABLE_FBC" compile time flag
--- drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +4 -0
@@ -1395,6 +1395,10 @@ static void set_static_screen_control(struct pipe_ctx **pipe_ctx,if (events->cursor_update) value |=0x2 ; +#ifdef ENABLE_FBC + value |=0x84 ; +#endif +for (i =0 ; i < num_pipes; i++) pipe_ctx[i]->tg->funcs->set_static_screen_control (pipe_ctx[i]->tg, value);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 20/81 drm/amd/display: Rename DCN TG specific function prefixes to tg
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- .../amd/display/dc/dcn10/dcn10_timing_generator.c | 159 +++++++++------------ .../amd/display/dc/dcn10/dcn10_timing_generator.h | 53 +++---- 2 files changed, 94 insertions(+), 118 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c +66 -93
@@ -44,7 +44,7 @@* This is a workaround for a bug that has existed since R5xx and has not been * fixed keep Front porch at minimum 2 for Interlaced mode or 1 for progressive. */ -static void tg_apply_front_porch_workaround ( +static void tgn10_apply_front_porch_workaround (struct timing_generator *tg,struct dc_crtc_timing *timing) {
@@ -57,7 +57,7 @@ static void tg_apply_front_porch_workaround( } } -static void dcn10_program_global_sync ( +static void tgn10_program_global_sync (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -78,7 +78,7 @@ static void dcn10_program_global_sync( VREADY_OFFSET, tg->dlg_otg_param.vready_offset); } -static void dcn10_disable_stereo (struct timing_generator *tg) +static void tgn10_disable_stereo (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -101,9 +101,10 @@ static void dcn10_disable_stereo(struct timing_generator *tg)* Program CRTC Timing Registers - OTG_H_*, OTG_V_*, Pixel repetition. * Including SYNC. Call BIOS command table to program Timings. */ -static void tg_program_timing_generator ( +static void tgn10_program_timing (struct timing_generator *tg, -const struct dc_crtc_timing *dc_crtc_timing) +const struct dc_crtc_timing *dc_crtc_timing, +bool use_vbios) {struct dc_crtc_timing patched_crtc_timing;uint32_t vesa_sync_start;
@@ -118,11 +119,10 @@ static void tg_program_timing_generator(uint32_t field_num =0 ;uint32_t h_div_2; -struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg); patched_crtc_timing = *dc_crtc_timing; -tg_apply_front_porch_workaround (tg, &patched_crtc_timing); +tgn10_apply_front_porch_workaround (tg, &patched_crtc_timing);/* Load horizontal timing */
@@ -253,7 +253,7 @@ static void tg_program_timing_generator(OTG_START_POINT_CNTL , start_point, OTG_FIELD_NUMBER_CNTL, field_num); -dcn10_program_global_sync (tg); +tgn10_program_global_sync (tg);/* TODO * patched_crtc_timing.flags.HORZ_COUNT_BY_TWO == 1
@@ -273,25 +273,11 @@ static void tg_program_timing_generator( } -/** tg_program_blanking -* Only programmed part of OTG_H, OTG_V register for set_plane_config -* Assume other OTG registers are programmed by video mode set already. -* This function is for underlay. DCN will have new sequence. -* This function will be removed. Need remove it from set_plane_config -*/ - -static void tg_program_timing (struct timing_generator *tg, -const struct dc_crtc_timing *timing, -bool use_vbios) -{ -tg_program_timing_generator (tg, timing); -} -/** * unblank_crtc * Call ASIC Control Object to UnBlank CRTC. */ -static void tg_unblank_crtc (struct timing_generator *tg) +static void tgn10_unblank_crtc (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -305,7 +291,7 @@ static void tg_unblank_crtc(struct timing_generator *tg)* Call ASIC Control Object to Blank CRTC. */ -static void tg_blank_crtc (struct timing_generator *tg) +static void tgn10_blank_crtc (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -324,16 +310,16 @@ static void tg_blank_crtc(struct timing_generator *tg) OTG_BLANK_DATA_DOUBLE_BUFFER_EN, 0); } -static void tg_set_blank (struct timing_generator *tg, +static void tgn10_set_blank (struct timing_generator *tg,bool enable_blanking) {if (enable_blanking) -tg_blank_crtc (tg); +tgn10_blank_crtc (tg);else -tg_unblank_crtc (tg); +tgn10_unblank_crtc (tg); } -static bool tg_is_blanked (struct timing_generator *tg) +static bool tgn10_is_blanked (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);uint32_t blank_en;
@@ -346,7 +332,7 @@ static bool tg_is_blanked(struct timing_generator *tg)return blank_en && blank_state; } -static void enable_optc_clock (struct timing_generator *tg,bool enable) +static void tgn10_enable_optc_clock (struct timing_generator *tg,bool enable) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -388,7 +374,7 @@ static void enable_optc_clock(struct timing_generator *tg, bool enable)* Enable CRTC * Enable CRTC - call ASIC Control Object to enable Timing generator. */ -static bool tg_enable_crtc (struct timing_generator *tg) +static bool tgn10_enable_crtc (struct timing_generator *tg) {/* TODO FPGA wait for answer * OTG_MASTER_UPDATE_MODE != CRTC_MASTER_UPDATE_MODE
@@ -415,7 +401,7 @@ static bool tg_enable_crtc(struct timing_generator *tg) }/* disable_crtc - call ASIC Control Object to disable Timing generator. */ -static bool tg_disable_crtc (struct timing_generator *tg) +static bool tgn10_disable_crtc (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -438,7 +424,7 @@ static bool tg_disable_crtc(struct timing_generator *tg) } -static void tg_program_blank_color ( +static void tgn10_program_blank_color (struct timing_generator *tg,const struct tg_color *black_color) {
@@ -464,7 +450,7 @@ static void tg_program_blank_color(* We may move init_hw into DC specific so that we can remove * .disable_vga from upper layer stack */ -static void dcn10_timing_generator_disable_vga ( +static void tgn10_disable_vga (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -487,7 +473,7 @@ static void dcn10_timing_generator_disable_vga( } } -static bool tg_validate_timing ( +static bool tgn10_validate_timing (struct timing_generator *tg,const struct dc_crtc_timing *timing) {
@@ -560,7 +546,7 @@ static bool tg_validate_timing(* @return * Counter of frames, which should equal to number of vblanks. */ -static uint32_t tg_get_vblank_counter (struct timing_generator *tg) +static uint32_t tgn10_get_vblank_counter (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);uint32_t frame_count;
@@ -571,7 +557,7 @@ static uint32_t tg_get_vblank_counter(struct timing_generator *tg)return frame_count; } -void dcn10_lock (struct timing_generator *tg) +static void tgn10_lock (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -581,7 +567,7 @@ void dcn10_lock(struct timing_generator *tg) OTG_MASTER_UPDATE_LOCK, 1); } -void dcn10_unlock (struct timing_generator *tg) +static void tgn10_unlock (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -594,7 +580,7 @@ void dcn10_unlock(struct timing_generator *tg)20000, 200000);*/ } -static void dcn10_get_position (struct timing_generator *tg, +static void tgn10_get_position (struct timing_generator *tg,struct crtc_position *position) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -607,7 +593,7 @@ static void dcn10_get_position(struct timing_generator *tg, OTG_VERT_COUNT_NOM, &position->nominal_vcount); } -bool dcn10_is_counter_moving (struct timing_generator *tg) +static bool tgn10_is_counter_moving (struct timing_generator *tg) {struct crtc_position position1, position2;
@@ -621,7 +607,7 @@ bool dcn10_is_counter_moving(struct timing_generator *tg)return true; } -static bool dcn10_did_triggered_reset_occur ( +static bool tgn10_did_triggered_reset_occur (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -633,7 +619,7 @@ static bool dcn10_did_triggered_reset_occur(return occurred !=0 ; } -static void dcn10_enable_reset_trigger (struct timing_generator *tg,int source_tg_inst) +static void tgn10_enable_reset_trigger (struct timing_generator *tg,int source_tg_inst) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);uint32_t falling_edge;
@@ -667,7 +653,7 @@ static void dcn10_enable_reset_trigger(struct timing_generator *tg, int source_t OTG_FORCE_COUNT_NOW_MODE, 2); } -static void dcn10_disable_reset_trigger (struct timing_generator *tg) +static void tgn10_disable_reset_trigger (struct timing_generator *tg) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -677,7 +663,7 @@ static void dcn10_disable_reset_trigger(struct timing_generator *tg) OTG_FORCE_COUNT_NOW_CLEAR, 1); } -static void dcn10_wait_for_state (struct timing_generator *tg, +static void tgn10_wait_for_state (struct timing_generator *tg,enum crtc_state state) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -700,7 +686,7 @@ static void dcn10_wait_for_state(struct timing_generator *tg, } } -static void set_early_control ( +static void tgn10_set_early_control (struct timing_generator *tg,uint32_t early_cntl) {
@@ -710,7 +696,7 @@ static void set_early_control( } -static void set_static_screen_control ( +static void tgn10_set_static_screen_control (struct timing_generator *tg,uint32_t value) {
@@ -739,7 +725,7 @@ static void set_static_screen_control(* ***************************************************************************** */ -void dcn10_timing_generator_set_drr ( +static void tgn10_set_drr (struct timing_generator *tg,const struct drr_params *params) {
@@ -776,7 +762,7 @@ void dcn10_timing_generator_set_drr( } } -static void dcn10_timing_generator_set_test_pattern( +static void tgn10_set_test_pattern( struct timing_generator *tg,/* TODO: replace 'controller_dp_test_pattern' by 'test_pattern_mode' * because this is not DP-specific (which is probably somewhere in DP
@@ -1035,7 +1021,7 @@ static void dcn10_timing_generator_set_test_pattern( } } -void dcn10_timing_generator_get_crtc_scanoutpos( +static void tgn10_get_crtc_scanoutpos( struct timing_generator *tg, uint32_t *v_blank_start, uint32_t *v_blank_end,
@@ -1049,7 +1035,7 @@ void dcn10_timing_generator_get_crtc_scanoutpos(OTG_V_BLANK_START , v_blank_start, OTG_V_BLANK_END, v_blank_end); -dcn10_get_position (tg, &position); +tgn10_get_position (tg, &position); *h_position = position.horizontal_count; *v_position = position.vertical_count;
@@ -1057,7 +1043,7 @@ void dcn10_timing_generator_get_crtc_scanoutpos( -static void dcn10_enable_stereo (struct timing_generator *tg, +static void tgn10_enable_stereo (struct timing_generator *tg,const struct dc_crtc_timing *timing,struct crtc_stereo_flags *flags) {struct dcn10_timing_generator *tgn10 =DCN10TG_FROM_TG (tg);
@@ -1099,17 +1085,17 @@ static void dcn10_enable_stereo(struct timing_generator *tg, OPPBUF_3D_VACT_SPACE1_SIZE, space1_size); } -static void dcn10_program_stereo (struct timing_generator *tg, +static void tgn10_program_stereo (struct timing_generator *tg,const struct dc_crtc_timing *timing,struct crtc_stereo_flags *flags) {if (flags->PROGRAM_STEREO) -dcn10_enable_stereo (tg, timing, flags); +tgn10_enable_stereo (tg, timing, flags);else -dcn10_disable_stereo (tg); +tgn10_disable_stereo (tg); } -static bool dcn10_is_stereo_left_eye (struct timing_generator *tg) +static bool tgn10_is_stereo_left_eye (struct timing_generator *tg) {bool ret = false;uint32_t left_eye =0 ;
@@ -1126,46 +1112,34 @@ static bool dcn10_is_stereo_left_eye(struct timing_generator *tg) }static struct timing_generator_funcs dcn10_tg_funcs = { - .validate_timing = tg_validate_timing, - .program_timing = tg_program_timing, - .program_global_sync = dcn10_program_global_sync, - .enable_crtc = tg_enable_crtc, - .disable_crtc = tg_disable_crtc, + .validate_timing = tgn10_validate_timing, + .program_timing = tgn10_program_timing, + .program_global_sync = tgn10_program_global_sync, + .enable_crtc = tgn10_enable_crtc, + .disable_crtc = tgn10_disable_crtc,/* used by enable_timing_synchronization. Not need for FPGA */ - .is_counter_moving = dcn10_is_counter_moving, -/* never be called */ - .get_position = dcn10_get_position, - .get_frame_count = tg_get_vblank_counter, - .get_scanoutpos = dcn10_timing_generator_get_crtc_scanoutpos, - .set_early_control = set_early_control, + .is_counter_moving = tgn10_is_counter_moving, + .get_position = tgn10_get_position, + .get_frame_count = tgn10_get_vblank_counter, + .get_scanoutpos = tgn10_get_crtc_scanoutpos, + .set_early_control = tgn10_set_early_control,/* used by enable_timing_synchronization. Not need for FPGA */ - .wait_for_state = dcn10_wait_for_state, - .set_blank = tg_set_blank, - .is_blanked = tg_is_blanked, -/* never be called */ - .set_colors =NULL , -/* this function will be called by .progam_scaler. dcn and dce -* scaler top level functions are different. .program_scaler is -* not need for dcn. within program_scaler, dcn will return -* early before set_overscan_blank_color is reached -*/ - .set_overscan_blank_color =NULL , - .set_blank_color = tg_program_blank_color, -/* dcn10_timing_generator_disable_vga */ - .disable_vga = dcn10_timing_generator_disable_vga, - .did_triggered_reset_occur = dcn10_did_triggered_reset_occur, - .enable_reset_trigger = dcn10_enable_reset_trigger, - .disable_reset_trigger = dcn10_disable_reset_trigger, - .lock = dcn10_lock, - .unlock = dcn10_unlock, -/* dcn10_timing_generator_enable_advanced_request*/ - .enable_advanced_request =NULL , - .enable_optc_clock = enable_optc_clock, - .set_drr = dcn10_timing_generator_set_drr, - .set_static_screen_control = set_static_screen_control, - .set_test_pattern = dcn10_timing_generator_set_test_pattern, - .program_stereo = dcn10_program_stereo, - .is_stereo_left_eye = dcn10_is_stereo_left_eye + .wait_for_state = tgn10_wait_for_state, + .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, + .lock = tgn10_lock, + .unlock = tgn10_unlock, + .enable_optc_clock = tgn10_enable_optc_clock, + .set_drr = tgn10_set_drr, + .set_static_screen_control = tgn10_set_static_screen_control, + .set_test_pattern = tgn10_set_test_pattern, + .program_stereo = tgn10_program_stereo, + .is_stereo_left_eye = tgn10_is_stereo_left_eye };void dcn10_timing_generator_init (struct dcn10_timing_generator *tgn10)
@@ -1181,4 +1155,3 @@ void dcn10_timing_generator_init(struct dcn10_timing_generator *tgn10) tgn10->min_h_sync_width =8 ; tgn10->min_v_sync_width =1 ; } -
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.h +28 -25
107 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 21/81 drm/amd/display: Rename DCN mem input specific function prefixes to min.
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
Also updated relevant registers.
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c | 96 ++++++++++------------ .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h | 93 +++++++++++++-------- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 6 +- 3 files changed, 104 insertions(+), 91 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c +44 -52
@@ -38,7 +38,7 @@#define FN (reg_name, field_name) \ mi->mi_shift->field_name, mi->mi_mask->field_name -static void dcn_mi_set_blank (struct mem_input *mem_input,bool blank) +static void min10_set_blank (struct mem_input *mem_input,bool blank) {struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input);uint32_t blank_en = blank ?1 :0 ;
@@ -48,7 +48,7 @@ static void dcn_mi_set_blank(struct mem_input *mem_input, bool blank) HUBP_TTU_DISABLE, blank_en); } -static void vready_workaround (struct mem_input *mem_input, +static void min10_vready_workaround (struct mem_input *mem_input,struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest) {uint32_t value =0 ;
@@ -71,7 +71,7 @@ static void vready_workaround(struct mem_input *mem_input,REG_WRITE (HUBPREQ_DEBUG_DB , value); } -static void program_tiling ( +static void min10_program_tiling (struct dcn10_mem_input *mi,const union dc_tiling_info *info,const enum surface_pixel_format pixel_format)
@@ -91,7 +91,7 @@ static void program_tiling( PIPE_ALIGNED, info->gfx9.pipe_aligned); } -static void program_size_and_rotation( +static void min10_program_size_and_rotation( struct dcn10_mem_input *mi, enum dc_rotation_angle rotation, enum surface_pixel_format format,
@@ -153,7 +153,7 @@ static void program_size_and_rotation( H_MIRROR_EN, mirror); } -static void program_pixel_format ( +static void min10_program_pixel_format (struct dcn10_mem_input *mi,enum surface_pixel_format format) {
@@ -229,7 +229,7 @@ static void program_pixel_format(/* don't see the need of program the xbar in DCN 1.0 */ } -static bool mem_input_program_surface_flip_and_addr ( +static bool min10_program_surface_flip_and_addr (struct mem_input *mem_input,const struct dc_plane_address *address,bool flip_immediate)
@@ -369,7 +369,7 @@ static bool mem_input_program_surface_flip_and_addr(return true; } -static void dcc_control (struct mem_input *mem_input,bool enable, +static void min10_dcc_control (struct mem_input *mem_input,bool enable,bool independent_64b_blks) {uint32_t dcc_en = enable ?1 :0 ;
@@ -381,13 +381,7 @@ static void dcc_control(struct mem_input *mem_input, bool enable, PRIMARY_SURFACE_DCC_IND_64B_BLK, dcc_ind_64b_blk); } -static void program_control (struct dcn10_mem_input *mi, -struct dc_plane_dcc_param *dcc) -{ -dcc_control (&mi->base, dcc->enable, dcc->grph.independent_64b_blks); -} - -static void mem_input_program_surface_config( +static void min10_program_surface_config( struct mem_input *mem_input, enum surface_pixel_format format, union dc_tiling_info *tiling_info,
@@ -398,14 +392,14 @@ static void mem_input_program_surface_config( {struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); -program_control (mi, dcc); -program_tiling (mi, tiling_info, format); -program_size_and_rotation ( +min10_dcc_control (mem_input, dcc->enable, dcc->grph.independent_64b_blks); +min10_program_tiling (mi, tiling_info, format); +min10_program_size_and_rotation ( mi, rotation, format, plane_size, dcc, horizontal_mirror); -program_pixel_format (mi, format); +min10_program_pixel_format (mi, format); } -static void program_requestor ( +static void min10_program_requestor (struct mem_input *mem_input,struct _vcs_dpi_display_rq_regs_st *rq_regs) {
@@ -440,7 +434,7 @@ static void program_requestor( } -static void program_deadline ( +static void min10_program_deadline (struct mem_input *mem_input,struct _vcs_dpi_display_dlg_regs_st *dlg_attr,struct _vcs_dpi_display_ttu_regs_st *ttu_attr)
@@ -552,7 +546,7 @@ static void program_deadline( ttu_attr->refcyc_per_req_delivery_pre_c); } -static void mem_input_setup( +static void min10_setup( struct mem_input *mem_input, struct _vcs_dpi_display_dlg_regs_st *dlg_attr, struct _vcs_dpi_display_ttu_regs_st *ttu_attr,
@@ -562,9 +556,9 @@ static void mem_input_setup(/* otg is locked when this func is called. Register are double buffered. * disable the requestors is not needed */ -program_requestor (mem_input, rq_regs); -program_deadline (mem_input, dlg_attr, ttu_attr); -vready_workaround (mem_input, pipe_dest); +min10_program_requestor (mem_input, rq_regs); +min10_program_deadline (mem_input, dlg_attr, ttu_attr); +min10_vready_workaround (mem_input, pipe_dest); } static uint32_t convert_and_clamp(
@@ -582,7 +576,7 @@ static uint32_t convert_and_clamp(return ret_val; } -static void program_watermarks ( +static void min10_program_watermarks (struct mem_input *mem_input,struct dcn_watermark_set *watermarks,unsigned int refclk_mhz)
@@ -811,7 +805,7 @@ static void program_watermarks(#endif } -static void mem_input_program_display_marks( +static void min10_program_display_marks( struct mem_input *mem_input, struct dce_watermarks nbp, struct dce_watermarks stutter,
@@ -823,14 +817,14 @@ static void mem_input_program_display_marks(*/ } -bool mem_input_is_flip_pending (struct mem_input *mem_input) +static bool min10_is_flip_pending (struct mem_input *mem_input) { -uint32_t update_pending =0 ; +uint32_t flip_pending =0 ;struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input);struct dc_plane_address earliest_inuse_address;REG_GET (DCSURF_FLIP_CONTROL , -SURFACE_UPDATE_PENDING , &update_pending); +SURFACE_FLIP_PENDING , &flip_pending);REG_GET (DCSURF_SURFACE_EARLIEST_INUSE ,SURFACE_EARLIEST_INUSE_ADDRESS , &earliest_inuse_address.grph.addr.low_part);
@@ -838,7 +832,7 @@ bool mem_input_is_flip_pending(struct mem_input *mem_input)REG_GET (DCSURF_SURFACE_EARLIEST_INUSE_HIGH ,SURFACE_EARLIEST_INUSE_ADDRESS_HIGH , &earliest_inuse_address.grph.addr.high_part); -if (update_pending) +if (flip_pending)return true;if (earliest_inuse_address.grph.addr.quad_part != mem_input->request_address.grph.addr.quad_part)
@@ -848,7 +842,7 @@ bool mem_input_is_flip_pending(struct mem_input *mem_input)return false; } -static void mem_input_update_dchub ( +static void min10_update_dchub (struct mem_input *mem_input,struct dchub_init_data *dh_data) {
@@ -911,7 +905,7 @@ struct vm_system_aperture_param {PHYSICAL_ADDRESS_LOC sys_high; }; -static void read_vm_system_aperture_settings (struct dcn10_mem_input *mi, +static void min10_read_vm_system_aperture_settings (struct dcn10_mem_input *mi,struct vm_system_aperture_param *apt) {PHYSICAL_ADDRESS_LOC physical_page_number;
@@ -934,7 +928,7 @@ static void read_vm_system_aperture_settings(struct dcn10_mem_input *mi, apt->sys_high.quad_part = (int64_t )logical_addr_high <<18 ; } -static void set_vm_system_aperture_settings (struct dcn10_mem_input *mi, +static void min10_set_vm_system_aperture_settings (struct dcn10_mem_input *mi,struct vm_system_aperture_param *apt) {PHYSICAL_ADDRESS_LOC mc_vm_apt_default;
@@ -970,7 +964,7 @@ struct vm_context0_param { };/* Temporary read settings, future will get values from kmd directly */ -static void read_vm_context0_settings (struct dcn10_mem_input *mi, +static void min10_read_vm_context0_settings (struct dcn10_mem_input *mi,struct vm_context0_param *vm0) {PHYSICAL_ADDRESS_LOC fb_base;
@@ -1013,7 +1007,7 @@ static void read_vm_context0_settings(struct dcn10_mem_input *mi, vm0->pte_base.quad_part -= fb_offset.quad_part; } -static void set_vm_context0_settings (struct dcn10_mem_input *mi, +static void min10_set_vm_context0_settings (struct dcn10_mem_input *mi,const struct vm_context0_param *vm0) {/* pte base */
@@ -1042,7 +1036,7 @@ static void set_vm_context0_settings(struct dcn10_mem_input *mi, VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR_LSB, vm0->fault_default.low_part); } -void dcn_mem_input_program_pte_vm (struct mem_input *mem_input, +static void min10_program_pte_vm (struct mem_input *mem_input,enum surface_pixel_format format,union dc_tiling_info *tiling_info,enum dc_rotation_angle rotation)
@@ -1052,11 +1046,11 @@ void dcn_mem_input_program_pte_vm(struct mem_input *mem_input,struct vm_context0_param vm0 = { { {0 } } }; -read_vm_system_aperture_settings (mi, &apt); -read_vm_context0_settings (mi, &vm0); +min10_read_vm_system_aperture_settings (mi, &apt); +min10_read_vm_context0_settings (mi, &vm0); -set_vm_system_aperture_settings (mi, &apt); -set_vm_context0_settings (mi, &vm0); +min10_set_vm_system_aperture_settings (mi, &apt); +min10_set_vm_context0_settings (mi, &vm0);/* control: enable VM PTE*/ REG_SET_2(DCN_VM_MX_L1_TLB_CNTL, 0,
@@ -1065,20 +1059,18 @@ void dcn_mem_input_program_pte_vm(struct mem_input *mem_input, }static struct mem_input_funcs dcn10_mem_input_funcs = { - .mem_input_program_display_marks = mem_input_program_display_marks, - .allocate_mem_input =NULL , - .free_mem_input =NULL , + .mem_input_program_display_marks = min10_program_display_marks, .mem_input_program_surface_flip_and_addr = - mem_input_program_surface_flip_and_addr, + min10_program_surface_flip_and_addr, .mem_input_program_surface_config = - mem_input_program_surface_config, - .mem_input_is_flip_pending = mem_input_is_flip_pending, - .mem_input_setup = mem_input_setup, - .program_watermarks = program_watermarks, - .mem_input_update_dchub = mem_input_update_dchub, - .mem_input_program_pte_vm = dcn_mem_input_program_pte_vm, - .set_blank = dcn_mi_set_blank, - .dcc_control = dcc_control, + min10_program_surface_config, + .mem_input_is_flip_pending = min10_is_flip_pending, + .mem_input_setup = min10_setup, + .program_watermarks = min10_program_watermarks, + .mem_input_update_dchub = min10_update_dchub, + .mem_input_program_pte_vm = min10_program_pte_vm, + .set_blank = min10_set_blank, + .dcc_control = min10_dcc_control, };
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h +57 -36
176 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +3 -3
@@ -374,7 +374,7 @@ static const struct bios_registers bios_regs = {#define mi_regs (id)\ [id] = {\ - MI_DCN10_REG_LIST(id)\ + MI_REG_LIST_DCN10(id)\ }
@@ -386,11 +386,11 @@ static const struct dcn_mi_registers mi_regs[] = { };static const struct dcn_mi_shift mi_shift = { -MI_DCN10_MASK_SH_LIST (__SHIFT) +MI_MASK_SH_LIST_DCN10 (__SHIFT) };static const struct dcn_mi_mask mi_mask = { -MI_DCN10_MASK_SH_LIST (_MASK) +MI_MASK_SH_LIST_DCN10 (_MASK) };#define clk_src_regs (index, pllid)\
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 22/81 drm/amd/display: Rename DCN opp specific function prefixes to oppn10
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
Also update relevant registers.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c | 189 ++++++++++----------- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h | 79 ++++----- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 6 +- 3 files changed, 138 insertions(+), 136 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c +94 -95
@@ -37,7 +37,7 @@#define CTX \ oppn10->base.ctx -static void opp_set_regamma_mode ( +static void oppn10_set_regamma_mode (struct output_pixel_processor *opp,enum opp_regamma mode) {
@@ -167,7 +167,7 @@ static void set_spatial_dither( FMT_RGB_RANDOM_ENABLE, params->flags.RGB_RANDOM); } -static void opp_program_bit_depth_reduction ( +static void oppn10_program_bit_depth_reduction (struct output_pixel_processor *opp,const struct bit_depth_reduction_params *params) {
@@ -255,7 +255,7 @@ static void opp_set_clamping( } -static void opp_set_dyn_expansion( +static void oppn10_set_dyn_expansion( struct output_pixel_processor *opp, enum dc_color_space color_sp, enum dc_color_depth color_dpth,
@@ -304,7 +304,7 @@ static void opp_program_clamping_and_pixel_encoding(set_pixel_encoding (oppn10, params); } -static void opp_program_fmt ( +static void oppn10_program_fmt (struct output_pixel_processor *opp,struct bit_depth_reduction_params *fmt_bit_depth,struct clamping_and_pixel_encoding_params *clamping)
@@ -316,7 +316,7 @@ static void opp_program_fmt(/* dithering is affected by <CrtcSourceSelect>, hence should be * programmed afterwards */ -opp_program_bit_depth_reduction ( +oppn10_program_bit_depth_reduction ( opp, fmt_bit_depth);
@@ -327,7 +327,7 @@ static void opp_program_fmt(return ; } -static void opp_set_output_csc_default ( +static void oppn10_set_output_csc_default (struct output_pixel_processor *opp,const struct default_adjustment *default_adjust) {
@@ -703,7 +703,7 @@ static void opp_configure_regamma_lut(REG_SET (CM_RGAM_LUT_INDEX ,0 ,CM_RGAM_LUT_INDEX ,0 ); } -static void opp_power_on_regamma_lut ( +static void oppn10_power_on_regamma_lut (struct output_pixel_processor *opp,bool power_on) {
@@ -713,7 +713,78 @@ static void opp_power_on_regamma_lut( } -void opp_set_output_csc_adjustment ( + +static void oppn10_program_color_matrix (struct dcn10_opp *oppn10, +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 ]); + } +} + +void oppn10_set_output_csc_adjustment (struct output_pixel_processor *opp,const struct out_csc_color_matrix *tbl_entry) {
@@ -752,7 +823,7 @@ void opp_set_output_csc_adjustment(*/ REG_SET (CM_OCSC_CONTROL ,0 ,CM_OCSC_MODE , ocsc_mode); -program_color_matrix (oppn10, tbl_entry); +oppn10_program_color_matrix (oppn10, tbl_entry); } static void opp_program_regamma_lut(
@@ -778,20 +849,18 @@ static void opp_program_regamma_lut( } - - -static bool opp_set_regamma_pwl ( +static bool oppn10_set_regamma_pwl (struct output_pixel_processor *opp,const struct pwl_params *params) {struct dcn10_opp *oppn10 =TO_DCN10_OPP (opp); -opp_power_on_regamma_lut (opp, true); +oppn10_power_on_regamma_lut (opp, true);opp_configure_regamma_lut (opp, oppn10->is_write_to_ram_a_safe);if (oppn10->is_write_to_ram_a_safe) -opp_program_regamma_luta_settings (opp, params); +opp_program_regamma_luta_settings (opp, params);else -opp_program_regamma_lutb_settings (opp, params); +opp_program_regamma_lutb_settings (opp, params);opp_program_regamma_lut ( opp, params->rgb_resulted, params->hw_points_num);
@@ -799,7 +868,7 @@ static bool opp_set_regamma_pwl(return true; } -static void opp_set_stereo_polarity ( +static void oppn10_set_stereo_polarity (struct output_pixel_processor *opp,bool enable,bool rightEyePolarity) {
@@ -819,15 +888,15 @@ static void dcn10_opp_destroy(struct output_pixel_processor **opp) }static struct opp_funcs dcn10_opp_funcs = { - .opp_power_on_regamma_lut = opp_power_on_regamma_lut, - .opp_set_csc_adjustment = opp_set_output_csc_adjustment, - .opp_set_csc_default = opp_set_output_csc_default, - .opp_set_dyn_expansion = opp_set_dyn_expansion, - .opp_program_regamma_pwl = opp_set_regamma_pwl, - .opp_set_regamma_mode = opp_set_regamma_mode, - .opp_program_fmt = opp_program_fmt, - .opp_program_bit_depth_reduction = opp_program_bit_depth_reduction, - .opp_set_stereo_polarity = opp_set_stereo_polarity, + .opp_power_on_regamma_lut = oppn10_power_on_regamma_lut, + .opp_set_csc_adjustment = oppn10_set_output_csc_adjustment, + .opp_set_csc_default = oppn10_set_output_csc_default, + .opp_set_dyn_expansion = oppn10_set_dyn_expansion, + .opp_program_regamma_pwl = oppn10_set_regamma_pwl, + .opp_set_regamma_mode = oppn10_set_regamma_mode, + .opp_program_fmt = oppn10_program_fmt, + .opp_program_bit_depth_reduction = oppn10_program_bit_depth_reduction, + .opp_set_stereo_polarity = oppn10_set_stereo_polarity, .opp_destroy = dcn10_opp_destroy };
@@ -847,73 +916,3 @@ void dcn10_opp_construct(struct dcn10_opp *oppn10, oppn10->opp_mask = opp_mask; } - -void program_color_matrix (struct dcn10_opp *oppn10, -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 ]); - } -}
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h +41 -38
107 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +3 -3
@@ -286,7 +286,7 @@ static const struct dcn10_ipp_mask ipp_mask = {#define opp_regs (id)\ [id] = {\ - OPP_DCN10_REG_LIST(id),\ + OPP_REG_LIST_DCN10(id),\ }static const struct dcn10_opp_registers opp_regs[] = {
@@ -297,11 +297,11 @@ static const struct dcn10_opp_registers opp_regs[] = { };static const struct dcn10_opp_shift opp_shift = { -OPP_DCN10_MASK_SH_LIST (__SHIFT) +OPP_MASK_SH_LIST_DCN10 (__SHIFT) };static const struct dcn10_opp_mask opp_mask = { -OPP_DCN10_MASK_SH_LIST (_MASK), +OPP_MASK_SH_LIST_DCN10 (_MASK), };#define tf_regs (id)\
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 23/81 drm/amd/display: Enable ipp compilation
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
Update relevant registers
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c | 19 ++--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.h | 91 +++++++++++----------- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 6 +- 3 files changed, 54 insertions(+), 62 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c +5 -14
@@ -421,7 +421,10 @@ static void dcn10_ipp_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 ); +if (ippn10->ipp_mask->CM_BYPASS_EN) +REG_UPDATE (CM_CONTROL ,CM_BYPASS_EN ,0 ); +else +REG_UPDATE (CM_CONTROL ,CM_BYPASS ,0 ); }
@@ -484,7 +487,7 @@ static bool dcn10_cursor_program_control(REG_UPDATE_2 (CURSOR0_CONTROL ,CUR0_MODE , color_format, -CUR0_INVERT_MODE ,0 ); +CUR0_EXPANSION_MODE ,0 );if (color_format ==CURSOR_MODE_MONO ) {/* todo: clarify what to program these to */
@@ -501,18 +504,6 @@ static bool dcn10_cursor_program_control(ALPHA_EN ,1 , FORMAT_EXPANSION_MODE, 0); -REG_UPDATE (CURSOR0_CONTROL , -CUR0_EXPANSION_MODE ,0 ); - -if (0 /*attributes->attribute_flags.bits.MIN_MAX_INVERT*/ ) { -REG_UPDATE (CURSOR0_CONTROL , -CUR0_MAX , -0 /* TODO */ ); -REG_UPDATE (CURSOR0_CONTROL , -CUR0_MIN , -0 /* TODO */ ); - } -return true; }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.h +46 -45
179 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +3 -3
@@ -266,7 +266,7 @@ static const struct dce110_link_enc_registers link_enc_regs[] = {#define ipp_regs (id)\ [id] = {\ - IPP_DCN10_REG_LIST(id),\ + IPP_REG_LIST_DCN10(id),\ }static const struct dcn10_ipp_registers ipp_regs[] = {
@@ -277,11 +277,11 @@ static const struct dcn10_ipp_registers ipp_regs[] = { };static const struct dcn10_ipp_shift ipp_shift = { -IPP_DCN10_MASK_SH_LIST (__SHIFT) +IPP_MASK_SH_LIST_DCN10 (__SHIFT) };static const struct dcn10_ipp_mask ipp_mask = { -IPP_DCN10_MASK_SH_LIST (_MASK), +IPP_MASK_SH_LIST_DCN10 (_MASK), };#define opp_regs (id)\
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 24/81 drm/amd/display: Remove SMU_INTERRUPT_CONTROL
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.h | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.h +0 -2
@@ -50,7 +50,6 @@SR (DMCU_IRAM_RD_CTRL ), \SR (DMCU_IRAM_RD_DATA ), \SR (DMCU_INTERRUPT_TO_UC_EN_MASK ), \ -SR (SMU_INTERRUPT_CONTROL ), \SRI (DIG_BE_CNTL ,DIG , id), \SRI (DIG_BE_EN_CNTL ,DIG , id), \ SRI(DP_CONFIG, DP, id), \
@@ -137,7 +136,6 @@ struct dce110_link_enc_registers {uint32_t DMCU_IRAM_RD_CTRL ;uint32_t DMCU_IRAM_RD_DATA ;uint32_t DMCU_INTERRUPT_TO_UC_EN_MASK ; -uint32_t SMU_INTERRUPT_CONTROL ;/* Common DP registers */ uint32_t DIG_BE_CNTL ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 25/81 drm/amd/display: Remove unblanaced drm_vblank_put.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Since drm_vblank_get moved from this function to just before do_flip no need to release vblank here in case of error.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +1 -2
@@ -1016,8 +1016,7 @@ static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc,if (ret == -EDEADLK ) goto backoff; -if (ret) -drm_crtc_vblank_put (crtc); +drm_atomic_state_put (state);return ret; backoff:
Signature · 6 lines
2.7.4 _______________________________________________ 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): 1500990881-6100-26-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 25/81] drm/amd/display: Remove unblanaced drm_vblank_put.
Quoted 19 lines · On 25/07/17 10:53 PM, [email protected] wrote:
From: Andrey Grodzovsky <[email protected]>
Since
drm_vblank_getmoved from this function to just beforedo_flipno need to release vblank here in case of error.Change-Id Iedc900618da2a0c940f49fe63299c6ae3eec260dSigned-off-by Andrey Grodzovsky <[email protected]>Reviewed-by Tony Cheng <[email protected]>Acked-by Harry Wentland <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +0
-0
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc, · line 1022
Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +1
-2@@ -1016,8 +1016,7 @@ static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc,if (ret == -EDEADLK ) goto backoff; -if (ret) -drm_crtc_vblank_put (crtc); +drm_atomic_state_put (state);return ret; backoff:
This kind of fixup should generally be squashed into the previous patch which introduced the bug.
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
PATCH 26/81 drm/amd/display: set drr during program timing.
In reply to a message not in the archiveFrom: Yongqiang Sun <[email protected]>
--- .../amd/display/dc/dce110/dce110_timing_generator.c | 21 +++++++++++++++++++++ .../amd/display/dc/dce120/dce120_timing_generator.c | 19 ++++++++++++++++--- .../amd/display/dc/dcn10/dcn10_timing_generator.c | 8 ++++++++ 3 files changed, 45 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c +21 -0
@@ -629,6 +629,27 @@ void dce110_timing_generator_program_blanking( CRTC_V_TOTAL);dm_write_reg (ctx, addr, value); +/* In case of V_TOTAL_CONTROL is on, make sure V_TOTAL_MAX and +* V_TOTAL_MIN are equal to V_TOTAL. +*/ + addr =CRTC_REG (mmCRTC_V_TOTAL_MAX); + value =dm_read_reg (ctx, addr); +set_reg_field_value ( + value, + timing->v_total -1 , +CRTC_V_TOTAL_MAX , +CRTC_V_TOTAL_MAX ); +dm_write_reg (ctx, addr, value); + + addr =CRTC_REG (mmCRTC_V_TOTAL_MIN); + value =dm_read_reg (ctx, addr); +set_reg_field_value ( + value, + timing->v_total -1 , +CRTC_V_TOTAL_MIN , +CRTC_V_TOTAL_MIN ); +dm_write_reg (ctx, addr, value); + addr =CRTC_REG (mmCRTC_H_BLANK_START_END); value =dm_read_reg (ctx, addr);
drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c +16 -3
@@ -441,15 +441,28 @@ void dce120_timing_generator_program_blanking(struct dce110_timing_generator *tg110 =DCE110TG_FROM_TG (tg);CRTC_REG_UPDATE ( -CRTC0_CRTC_H_TOTAL , -CRTC_H_TOTAL , - timing->h_total -1 ); +CRTC0_CRTC_H_TOTAL , +CRTC_H_TOTAL , + timing->h_total -1 );CRTC_REG_UPDATE (CRTC0_CRTC_V_TOTAL ,CRTC_V_TOTAL , timing->v_total -1 ); +/* In case of V_TOTAL_CONTROL is on, make sure V_TOTAL_MAX and +* V_TOTAL_MIN are equal to V_TOTAL. +*/ +CRTC_REG_UPDATE ( +CRTC0_CRTC_V_TOTAL_MAX , +CRTC_V_TOTAL_MAX , + timing->v_total -1 ); + +CRTC_REG_UPDATE ( +CRTC0_CRTC_V_TOTAL_MIN , +CRTC_V_TOTAL_MIN , + timing->v_total -1 ); + tmp1 = timing->h_total - (h_sync_start + timing->h_border_left); tmp2 = tmp1 + timing->h_addressable +
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c +8 -0
@@ -177,6 +177,14 @@ static void tgn10_program_timing(REG_SET (OTG_V_TOTAL ,0 ,OTG_V_TOTAL , v_total); +/* In case of V_TOTAL_CONTROL is on, make sure OTG_V_TOTAL_MAX and +* OTG_V_TOTAL_MIN are equal to V_TOTAL. +*/ +REG_SET (OTG_V_TOTAL_MAX ,0 , +OTG_V_TOTAL_MAX , v_total); +REG_SET (OTG_V_TOTAL_MIN ,0 , +OTG_V_TOTAL_MIN , v_total); +/* v_sync_start = 0, v_sync_end = v_sync_width */ v_sync_end = patched_crtc_timing.v_sync_width * interlace_factor;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 27/81 drm/amd/display: Create dm_atomic_state
In reply to a message not in the archiveFrom: Harry Wentland <[email protected]>
We really want to use the new private_atomic_state but can't right now as we have to maintain some backward compatibility to older kernels. For now let's follow Intel's approach and extend the drm_atomic_state.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 37 +++++++++++++++++++++- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h | 8 +++-- 2 files changed, 41 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +36 -1
@@ -634,11 +634,46 @@ const struct amdgpu_ip_block_version dm_ip_block = .funcs = &amdgpu_dm_funcs, }; + +struct drm_atomic_state * +dm_atomic_state_alloc (struct drm_device *dev) +{ +struct dm_atomic_state *state =kzalloc (sizeof (*state),GFP_KERNEL ); + +if (!state ||drm_atomic_state_init (dev, &state->base) <0 ) { +kfree (state); +return NULL ; + } + +return &state->base; +} + +void dm_atomic_state_clear (struct drm_atomic_state *s) +{ +struct dm_atomic_state *state =to_dm_atomic_state (s); +drm_atomic_state_default_clear (&state->base); +} + + +static void dm_atomic_state_free (struct drm_atomic_state *state) +{ +struct dm_atomic_state *dm_state =to_dm_atomic_state (state); + +drm_atomic_state_default_release (state); + +kfree (dm_state); +} + + +static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { .fb_create = amdgpu_user_framebuffer_create, .output_poll_changed = amdgpu_output_poll_changed, .atomic_check = amdgpu_dm_atomic_check, - .atomic_commit = drm_atomic_helper_commit + .atomic_commit = drm_atomic_helper_commit, + .atomic_state_alloc = dm_atomic_state_alloc, + .atomic_state_clear = dm_atomic_state_clear, + .atomic_state_free = dm_atomic_state_free, };static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h +5 -3
@@ -27,6 +27,7 @@#define __AMDGPU_DM_TYPES_H__#include <drm/drmP.h> +#include <drm/drm_atomic.h> struct amdgpu_framebuffer ;struct amdgpu_display_manager ;
@@ -48,11 +49,12 @@ struct dm_crtc_state {#define to_dm_crtc_state (x) container_of(x, struct dm_crtc_state, base) -struct dm_plane_state { -struct drm_plane_state base; -struct dc_surface *dc_surface; +struct dm_atomic_state { +struct drm_atomic_state base; }; +#define to_dm_atomic_state (x) container_of(x, struct dm_atomic_state, base) +/*TODO Jodan Hersen use the one in amdgpu_dm*/ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 28/81 drm/amd/display: Hook dm private state into atomic_check
In reply to a message not in the archiveFrom: Harry Wentland <[email protected]>
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 64 +++++++++++----------- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h | 5 ++ 2 files changed, 37 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +32 -32
@@ -3126,15 +3126,14 @@ static int do_aquire_global_lock(int amdgpu_dm_atomic_check (struct drm_device *dev,struct drm_atomic_state *state) { +struct dm_atomic_state *dm_state;struct drm_crtc *crtc;struct drm_crtc_state *crtc_state;struct drm_plane *plane;struct drm_plane_state *plane_state;int i, j;int ret; -int set_count;int new_stream_count; -struct dc_validation_set set[MAX_STREAMS ] = {{0 }};struct dc_stream *new_streams[MAX_STREAMS ] = {0 };struct drm_crtc *crtc_set[MAX_STREAMS ] = {0 };struct amdgpu_device *adev = dev->dev_private;
@@ -3159,17 +3158,19 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ret = -EINVAL ; + dm_state =to_dm_atomic_state (state); +/* copy existing configuration */ new_stream_count =0 ; - set_count =0 ; + dm_state->set_count =0 ;list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc);if (acrtc->stream) { - set[set_count].stream = acrtc->stream; - crtc_set[set_count] = crtc; - ++set_count; + dm_state->set[dm_state->set_count].stream = acrtc->stream; + crtc_set[dm_state->set_count] = crtc; + ++dm_state->set_count; } }
@@ -3198,16 +3199,16 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,struct dc_stream *new_stream =NULL ;struct drm_connector_state *conn_state =NULL ; -struct dm_connector_state *dm_state =NULL ; +struct dm_connector_state *dm_conn_state =NULL ;if (aconnector) { conn_state =drm_atomic_get_connector_state (state, &aconnector->base);if (IS_ERR (conn_state))return ret; - dm_state =to_dm_connector_state (conn_state); + dm_conn_state =to_dm_connector_state (conn_state); } - new_stream =create_stream_for_sink (aconnector, &crtc_state->mode, dm_state); + new_stream =create_stream_for_sink (aconnector, &crtc_state->mode, dm_conn_state);/* * we can have no stream on ACTION_SET if a display
@@ -3222,10 +3223,10 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, } new_streams[new_stream_count] = new_stream; - set_count =update_in_val_sets_stream ( - set, + dm_state->set_count =update_in_val_sets_stream ( + dm_state->set, crtc_set, - set_count, + dm_state->set_count, acrtc->stream, new_stream, crtc);
@@ -3238,9 +3239,9 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,/* i.e. reset mode */ if (acrtc->stream) { - set_count =remove_from_val_sets ( - set, - set_count, + dm_state->set_count =remove_from_val_sets ( + dm_state->set, + dm_state->set_count, acrtc->stream); aquire_global_lock = true; }
@@ -3291,10 +3292,10 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, } new_streams[new_stream_count] = new_stream; - set_count =update_in_val_sets_stream ( - set, + dm_state->set_count =update_in_val_sets_stream ( + dm_state->set, crtc_set, - set_count, + dm_state->set_count, acrtc->stream, new_stream, &acrtc->base);
@@ -3304,12 +3305,12 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, aquire_global_lock = true; } -for (i =0 ; i < set_count; i++) { +for (i =0 ; i < dm_state->set_count; i++) {for_each_plane_in_state (state, plane, plane_state, j) {struct drm_crtc *crtc = plane_state->crtc;struct drm_framebuffer *fb = plane_state->fb;struct drm_connector *connector; -struct dm_connector_state *dm_state =NULL ; +struct dm_connector_state *dm_conn_state =NULL ;struct drm_crtc_state *crtc_state;bool pflip_needed;
@@ -3330,7 +3331,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,list_for_each_entry (connector, &dev->mode_config.connector_list, head) {if (connector->state->crtc == crtc) { - dm_state =to_dm_connector_state ( + dm_conn_state =to_dm_connector_state ( connector->state);break ; }
@@ -3350,7 +3351,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,* Also it should be needed when used with actual * drm_atomic_commit ioctl in future */ -if (!dm_state) +if (!dm_conn_state)continue ; surface =dc_create_surface (dc);
@@ -3360,11 +3361,10 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, plane_state, false); -add_val_sets_surface ( - set, - set_count, - set[i].stream, - surface); +add_val_sets_surface (dm_state->set, + dm_state->set_count, + dm_state->set[i].stream, + surface); need_to_validate = true; aquire_global_lock = true;
@@ -3372,9 +3372,9 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, } } - context =dc_get_validate_context (dc, set, set_count); + context =dc_get_validate_context (dc, dm_state->set, dm_state->set_count); -if (need_to_validate == false || set_count ==0 || context) { +if (need_to_validate == false || dm_state->set_count ==0 || context) { ret =0 ;/*
@@ -3396,9 +3396,9 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,dm_free (context); } -for (i =0 ; i < set_count; i++) -for (j =0 ; j < set[i].surface_count; j++) -dc_surface_release (set[i].surfaces[j]); +for (i =0 ; i < dm_state->set_count; i++) +for (j =0 ; j < dm_state->set[i].surface_count; j++) +dc_surface_release (dm_state->set[i].surfaces[j]);for (i =0 ; i < new_stream_count; i++)dc_stream_release (new_streams[i]);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h +5 -0
@@ -28,6 +28,7 @@#include <drm/drmP.h> #include <drm/drm_atomic.h> +#include "dc.h" struct amdgpu_framebuffer ;struct amdgpu_display_manager ;
@@ -51,6 +52,10 @@ struct dm_crtc_state {struct dm_atomic_state {struct drm_atomic_state base; + +struct dc_validation_set set[MAX_STREAMS ]; +int set_count; + };#define to_dm_atomic_state (x) container_of(x, struct dm_atomic_state, base)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 29/81 drm/amd/display: Add correct retain/release
In reply to a message not in the archiveFrom: Harry Wentland <[email protected]>
Needed by objs in dm_atomic_state
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 6 ++++++ 2 files changed, 16 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -0
@@ -658,9 +658,19 @@ void dm_atomic_state_clear(struct drm_atomic_state *s)static void dm_atomic_state_free (struct drm_atomic_state *state) {struct dm_atomic_state *dm_state =to_dm_atomic_state (state); +int i, j;drm_atomic_state_default_release (state); +for (i =0 ; i < dm_state->set_count; i++) { +for (j =0 ; j < dm_state->set[i].surface_count; j++) { +dc_surface_release (dm_state->set[i].surfaces[j]); + } + } + +for (i =0 ; i < dm_state->set_count; i++) +dc_stream_release (dm_state->set[i].stream); +kfree (dm_state); }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +6 -0
@@ -3038,11 +3038,15 @@ static uint32_t update_in_val_sets_stream( } val_sets[i].stream = new_stream; +dc_stream_retain (new_stream); crtcs[i] = crtc;if (i == set_count) {/* nothing found. add new one to the end */ return set_count +1 ; + }else { +/* update. relase old stream */ +dc_stream_release (old_stream); }return set_count;
@@ -3064,6 +3068,7 @@ static uint32_t remove_from_val_sets(return set_count; } +dc_stream_release (stream); set_count--;for (; i < set_count; i++) {
@@ -3168,6 +3173,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc);if (acrtc->stream) { +dc_stream_retain (acrtc->stream); dm_state->set[dm_state->set_count].stream = acrtc->stream; crtc_set[dm_state->set_count] = crtc; ++dm_state->set_count;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 30/81 drm/amd/display: Commit validation set from state
In reply to a message not in the archiveFrom: Harry Wentland <[email protected]>
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 34 +++--- drivers/gpu/drm/amd/display/dc/core/dc.c | 118 +++++++++++++++++++++ drivers/gpu/drm/amd/display/dc/dc.h | 16 +++ 3 files changed, 152 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +18 -16
@@ -2681,20 +2681,22 @@ void amdgpu_dm_atomic_commit_tail(struct drm_device *dev = state->dev;struct amdgpu_device *adev = dev->dev_private;struct amdgpu_display_manager *dm = &adev->dm; +struct dm_atomic_state *dm_state;uint32_t i, j; -uint32_t commit_streams_count =0 ;uint32_t new_crtcs_count =0 ;struct drm_crtc *crtc, *pcrtc;struct drm_crtc_state *old_crtc_state; -const struct dc_stream *commit_streams[MAX_STREAMS ];struct amdgpu_crtc *new_crtcs[MAX_STREAMS ]; -const struct dc_stream *new_stream; +const struct dc_stream *new_stream =NULL ;unsigned long flags;bool wait_for_vblank = true;struct drm_connector *connector;struct drm_connector_state *old_conn_state;drm_atomic_helper_update_legacy_modeset_state (dev, state); + + dm_state =to_dm_atomic_state (state); +/* update changed items */ for_each_crtc_in_state (state, crtc, old_crtc_state, i) {struct amdgpu_crtc *acrtc;
@@ -2725,16 +2727,16 @@ void amdgpu_dm_atomic_commit_tail(*/ if (modeset_required (new_state)) { -struct dm_connector_state *dm_state =NULL ; +struct dm_connector_state *dm_conn_state =NULL ; new_stream =NULL ;if (aconnector) - dm_state =to_dm_connector_state (aconnector->base.state); + dm_conn_state =to_dm_connector_state (aconnector->base.state); new_stream =create_stream_for_sink ( aconnector, &crtc->state->mode, - dm_state); + dm_conn_state);DRM_INFO ("Atomic commit: SET crtc id %d: [%p]\n" , acrtc->crtc_id, acrtc);
@@ -2762,6 +2764,13 @@ void amdgpu_dm_atomic_commit_tail(if (acrtc->stream)remove_stream (adev, acrtc); +/* TODO clean this stupid hack */ +for (j =0 ; j < dm_state->set_count; j++) +if (dm_state->set[j].stream->priv == acrtc) { +ASSERT (acrtc->stream ==NULL ); + new_stream = dm_state->set[j].stream; +break ; + }/* * this loop saves set mode crtcs * we needed to enable vblanks once all
@@ -2820,15 +2829,6 @@ void amdgpu_dm_atomic_commit_tail(dm_error ("%s: Failed to update stream scaling!\n" , __func__); } -list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { - -struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc); - -if (acrtc->stream) { - commit_streams[commit_streams_count] = acrtc->stream; - ++commit_streams_count; - } - }/* * Add streams after required streams from new and replaced streams
@@ -2857,7 +2857,8 @@ void amdgpu_dm_atomic_commit_tail( }/* DC is optimized not to do anything if 'streams' didn't change. */ -WARN_ON (!dc_commit_streams (dm->dc, commit_streams, commit_streams_count)); +WARN_ON (!dc_commit_validation_set (dm->dc, dm_state->set, + dm_state->set_count));list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc);
@@ -3215,6 +3216,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, } new_stream =create_stream_for_sink (aconnector, &crtc_state->mode, dm_conn_state); + new_stream->priv = acrtc;/* * we can have no stream on ACTION_SET if a display
drivers/gpu/drm/amd/display/dc/core/dc.c +118 -0
130 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc.h +16 -0
@@ -481,6 +481,8 @@ struct dc_stream {/* TODO: ABM info (DMCU) */ /* TODO: PSR info */ /* TODO: CEA VIC */ + +void *priv; };struct dc_stream_update {
@@ -580,6 +582,20 @@ void dc_resource_validate_ctx_copy_construct(void dc_resource_validate_ctx_destruct (struct validate_context *context);/* +* TODO update to make it about validation sets +* Set up streams and links associated to drive sinks +* The streams parameter is an absolute set of all active streams. +* +* After this call: +* Phy, Encoder, Timing Generator are programmed and enabled. +* New streams are enabled with blank stream; no memory read. +*/ +bool dc_commit_validation_set ( +const struct dc *dc, +const struct dc_validation_set set[], +uint8_t set_count); + +/* * Set up streams and links associated to drive sinks * The streams parameter is an absolute set of all active streams. *
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 31/81 drm/amd/display: Add validate_context to atomic_state
In reply to a message not in the archiveFrom: Harry Wentland <[email protected]>
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 18 ++---------------- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h | 2 +- 2 files changed, 3 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +2 -16
@@ -3145,7 +3145,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,struct amdgpu_device *adev = dev->dev_private;struct dc *dc = adev->dm.dc;bool need_to_validate = false; -struct validate_context *context;struct drm_connector *connector;struct drm_connector_state *conn_state;/*
@@ -3380,10 +3379,9 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, } } - context =dc_get_validate_context (dc, dm_state->set, dm_state->set_count); - -if (need_to_validate == false || dm_state->set_count ==0 || context) { + dm_state->context =dc_get_validate_context (dc, dm_state->set, dm_state->set_count); +if (need_to_validate == false || dm_state->set_count ==0 || dm_state->context) { ret =0 ;/* * For full updates case when
@@ -3399,18 +3397,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, } -if (context) { -dc_resource_validate_ctx_destruct (context); -dm_free (context); - } - -for (i =0 ; i < dm_state->set_count; i++) -for (j =0 ; j < dm_state->set[i].surface_count; j++) -dc_surface_release (dm_state->set[i].surfaces[j]); - -for (i =0 ; i < new_stream_count; i++) -dc_stream_release (new_streams[i]); -if (ret !=0 ) {if (ret == -EDEADLK )DRM_DEBUG_KMS ("Atomic check stopped due to to deadlock.\n" );
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h +1 -1
@@ -55,7 +55,7 @@ struct dm_atomic_state {struct dc_validation_set set[MAX_STREAMS ];int set_count; - +struct validate_context *context; };#define to_dm_atomic_state (x) container_of(x, struct dm_atomic_state, base)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 32/81 drm/amd/display: Use validate_context from atomic_check in commit
In reply to a message not in the archiveFrom: Harry Wentland <[email protected]>
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 18 ++++-- drivers/gpu/drm/amd/display/dc/core/dc.c | 71 +++++++--------------- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 6 +- drivers/gpu/drm/amd/display/dc/dc.h | 5 +- 4 files changed, 40 insertions(+), 60 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +12 -6
@@ -2771,6 +2771,7 @@ void amdgpu_dm_atomic_commit_tail( new_stream = dm_state->set[j].stream;break ; } +/* * this loop saves set mode crtcs * we needed to enable vblanks once all
@@ -2829,7 +2830,6 @@ void amdgpu_dm_atomic_commit_tail(dm_error ("%s: Failed to update stream scaling!\n" , __func__); } -/* * Add streams after required streams from new and replaced streams * are removed from freesync module
@@ -2857,15 +2857,19 @@ void amdgpu_dm_atomic_commit_tail( }/* DC is optimized not to do anything if 'streams' didn't change. */ -WARN_ON (!dc_commit_validation_set (dm->dc, dm_state->set, - dm_state->set_count)); +WARN_ON (!dc_commit_context (dm->dc, dm_state->context));list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc); -if (acrtc->stream !=NULL ) - acrtc->otg_inst = -dc_stream_get_status (acrtc->stream)->primary_otg_inst; +if (acrtc->stream !=NULL ) { +const struct dc_stream_status *status =dc_stream_get_status (acrtc->stream); + +if (!status) +DC_ERR ("got no status for stream %p on acrtc%p\n" , acrtc->stream, acrtc); +else + acrtc->otg_inst = status->primary_otg_inst; + } }for (i =0 ; i < new_crtcs_count; i++) {
@@ -3048,6 +3052,7 @@ static uint32_t update_in_val_sets_stream( }else {/* update. relase old stream */ dc_stream_release (old_stream); + }return set_count;
@@ -3228,6 +3233,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, __func__, acrtc->base.base.id);break ; } + new_stream->priv = acrtc; new_streams[new_stream_count] = new_stream; dm_state->set_count = update_in_val_sets_stream(
drivers/gpu/drm/amd/display/dc/core/dc.c +23 -48
120 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +4 -2
@@ -164,9 +164,11 @@ const struct dc_stream_status *dc_stream_get_status(struct core_stream *stream =DC_STREAM_TO_CORE (dc_stream);struct core_dc *dc =DC_TO_CORE (stream->ctx->dc); -for (i =0 ; i < dc->current_context->stream_count; i++) -if (stream == dc->current_context->streams[i]) +for (i =0 ; i < dc->current_context->stream_count; i++) { +if (stream == dc->current_context->streams[i]) {return &dc->current_context->stream_status[i]; + } + }return NULL ; }
drivers/gpu/drm/amd/display/dc/dc.h +1 -4
@@ -590,10 +590,7 @@ void dc_resource_validate_ctx_destruct(struct validate_context *context);* Phy, Encoder, Timing Generator are programmed and enabled. * New streams are enabled with blank stream; no memory read. */ -bool dc_commit_validation_set ( -const struct dc *dc, -const struct dc_validation_set set[], -uint8_t set_count); +bool dc_commit_context (struct dc *dc,struct validate_context *context);/* * Set up streams and links associated to drive sinks
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 33/81 drm/amd/display: Update atomic state hooks.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Reimplement atomic_state_alloc and atomic_state_clear to release validate_ctx.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 25 +++++++++------------- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 2 +- 2 files changed, 11 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -15
@@ -648,33 +648,29 @@ dm_atomic_state_alloc(struct drm_device *dev)return &state->base; } -void dm_atomic_state_clear (struct drm_atomic_state *s) -{ -struct dm_atomic_state *state =to_dm_atomic_state (s); -drm_atomic_state_default_clear (&state->base); -} - -static void dm_atomic_state_free (struct drm_atomic_state *state) +void dm_atomic_state_clear (struct drm_atomic_state *state) {struct dm_atomic_state *dm_state =to_dm_atomic_state (state);int i, j; -drm_atomic_state_default_release (state); -for (i =0 ; i < dm_state->set_count; i++) {for (j =0 ; j < dm_state->set[i].surface_count; j++) {dc_surface_release (dm_state->set[i].surfaces[j]); + dm_state->set[i].surfaces[j] =NULL ; } - } -for (i =0 ; i < dm_state->set_count; i++)dc_stream_release (dm_state->set[i].stream); + dm_state->set[i].stream =NULL ; + } + dm_state->set_count =0 ; -kfree (dm_state); -} - +dc_resource_validate_ctx_destruct (dm_state->context); +dm_free (dm_state->context); + dm_state->context =NULL ; +drm_atomic_state_default_clear (state); +}static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { .fb_create = amdgpu_user_framebuffer_create,
@@ -683,7 +679,6 @@ static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { .atomic_commit = drm_atomic_helper_commit, .atomic_state_alloc = dm_atomic_state_alloc, .atomic_state_clear = dm_atomic_state_clear, - .atomic_state_free = dm_atomic_state_free, };static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +1 -1
@@ -2859,6 +2859,7 @@ void amdgpu_dm_atomic_commit_tail(/* DC is optimized not to do anything if 'streams' didn't change. */ WARN_ON (!dc_commit_context (dm->dc, dm_state->context)); +list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc);
@@ -3233,7 +3234,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, __func__, acrtc->base.base.id);break ; } - new_stream->priv = acrtc; new_streams[new_stream_count] = new_stream; dm_state->set_count = update_in_val_sets_stream(
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 34/81 drm/amd/display: Remove acrtc->stream
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Remove acrtc->stream and move it into dm_crtc_state. This allows to get rid of dm_atomic_state->dm_set. Also reuse streams created in atomic_check during commit.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 33 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 411 +++++++++++---------- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h | 9 +- drivers/gpu/drm/amd/display/dc/dc.h | 2 - 4 files changed, 232 insertions(+), 223 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +14 -19
@@ -100,13 +100,16 @@ static u32 dm_vblank_get_counter(struct amdgpu_device *adev, int crtc)return 0 ; else {struct amdgpu_crtc *acrtc = adev->mode_info.crtcs[crtc]; +struct dm_crtc_state *acrtc_state =to_dm_crtc_state ( + acrtc->base.state); -if (NULL == acrtc->stream) { + +if (acrtc_state->stream ==NULL ) {DRM_ERROR ("dc_stream is NULL for crtc '%d'!\n" , crtc);return 0 ; } -return dc_stream_get_vblank_counter (acrtc->stream); +return dc_stream_get_vblank_counter (acrtc_state->stream); } }
@@ -119,8 +122,10 @@ static int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtc,return -EINVAL ; else {struct amdgpu_crtc *acrtc = adev->mode_info.crtcs[crtc]; +struct dm_crtc_state *acrtc_state =to_dm_crtc_state ( + acrtc->base.state); -if (NULL == acrtc->stream) { +if (acrtc_state->stream ==NULL ) {DRM_ERROR ("dc_stream is NULL for crtc '%d'!\n" , crtc);return 0 ; }
@@ -129,7 +134,7 @@ static int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtc,* TODO rework base driver to use values directly. * for now parse it back into reg-format */ - dc_stream_get_scanoutpos(acrtc->stream, + dc_stream_get_scanoutpos(acrtc_state->stream, &v_blank_start, &v_blank_end, &h_position,
@@ -652,22 +657,12 @@ dm_atomic_state_alloc(struct drm_device *dev)void dm_atomic_state_clear (struct drm_atomic_state *state) {struct dm_atomic_state *dm_state =to_dm_atomic_state (state); -int i, j; - -for (i =0 ; i < dm_state->set_count; i++) { -for (j =0 ; j < dm_state->set[i].surface_count; j++) { -dc_surface_release (dm_state->set[i].surfaces[j]); - dm_state->set[i].surfaces[j] =NULL ; - } -dc_stream_release (dm_state->set[i].stream); - dm_state->set[i].stream =NULL ; +if (dm_state->context) { +dc_resource_validate_ctx_destruct (dm_state->context); +dm_free (dm_state->context); + dm_state->context =NULL ; } - dm_state->set_count =0 ; - -dc_resource_validate_ctx_destruct (dm_state->context); -dm_free (dm_state->context); - dm_state->context =NULL ;drm_atomic_state_default_clear (state); }
@@ -676,7 +671,7 @@ static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { .fb_create = amdgpu_user_framebuffer_create, .output_poll_changed = amdgpu_output_poll_changed, .atomic_check = amdgpu_dm_atomic_check, - .atomic_commit = drm_atomic_helper_commit, + .atomic_commit = amdgpu_dm_atomic_commit, .atomic_state_alloc = dm_atomic_state_alloc, .atomic_state_clear = dm_atomic_state_clear, };
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +212 -199
757 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h +6 -3
@@ -45,7 +45,7 @@ struct dm_plane_state {struct dm_crtc_state {struct drm_crtc_state base; -struct dc_stream *dc_stream; +const struct dc_stream *stream; };#define to_dm_crtc_state (x) container_of(x, struct dm_crtc_state, base)
@@ -53,8 +53,6 @@ struct dm_crtc_state {struct dm_atomic_state {struct drm_atomic_state base; -struct dc_validation_set set[MAX_STREAMS ]; -int set_count;struct validate_context *context; };
@@ -83,6 +81,11 @@ void amdgpu_dm_encoder_destroy(struct drm_encoder *encoder);int amdgpu_dm_connector_get_modes (struct drm_connector *connector); +int amdgpu_dm_atomic_commit ( +struct drm_device *dev, +struct drm_atomic_state *state, +bool nonblock); +void amdgpu_dm_atomic_commit_tail (struct drm_atomic_state *state);
drivers/gpu/drm/amd/display/dc/dc.h +0 -2
@@ -481,8 +481,6 @@ struct dc_stream {/* TODO: ABM info (DMCU) */ /* TODO: PSR info */ /* TODO: CEA VIC */ - -void *priv; };struct dc_stream_update {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 35/81 drm/amd/display: Undo dc_update_surfaces_and_stream change.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Restoring conditional call to in_transfer_func since no reason to call it unconditionally.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -4
@@ -1603,10 +1603,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,if (update_type ==UPDATE_TYPE_FAST )continue ; -/* TODO find out why check is false */ -/* TODO with this still not programming some color stuff... panel is dark-ish */ -/*if (is_new_pipe_surface || -srf_updates[i].in_transfer_func)*/ +if (srf_updates[i].in_transfer_func) core_dc->hwss.set_input_transfer_func ( pipe_ctx, pipe_ctx->surface);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 36/81 drm/amd/display: update DPM bounding box
In reply to a message not in the archiveFrom: Tony Cheng <[email protected]>
value based on STA target aligned to FCLK for SS corners with 10% margin
also
- group all latency together
- group all voltage state related together
--- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 71 ++++++++++++++++-------- 1 file changed, 48 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +48 -23
@@ -36,40 +36,65 @@/* Defaults from spreadsheet rev#247 */ const struct dcn_soc_bounding_box dcn10_soc_defaults = { - .sr_exit_time =17 ,/*us*/ /*update based on HW Request for 118773*/ +/* latencies */ + .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*/ .percent_of_ideal_drambw_received_after_urg_latency =80 ,/*%*/ - .max_request_size =256 ,/*bytes*/ - .dcfclkv_max0p9 =600 ,/*MHz*/ - .dcfclkv_nom0p8 =600 ,/*MHz*/ - .dcfclkv_mid0p72 =300 ,/*MHz*/ - .dcfclkv_min0p65 =300 ,/*MHz*/ - .max_dispclk_vmax0p9 =1086 ,/*MHz*/ - .max_dispclk_vnom0p8 =661 ,/*MHz*/ - .max_dispclk_vmid0p72 =608 ,/*MHz*/ - .max_dispclk_vmin0p65 =608 ,/*MHz*/ - .max_dppclk_vmax0p9 =661 ,/*MHz*/ - .max_dppclk_vnom0p8 =661 ,/*MHz*/ - .max_dppclk_vmid0p72 =435 ,/*MHz*/ - .max_dppclk_vmin0p65 =435 ,/*MHz*/ - .socclk =208 ,/*MHz*/ + +/* below default clocks derived from STA target base on +* slow-slow corner + 10% margin with voltages aligned to FCLK. +* +* Use these value if fused value doesn't make sense as earlier +* part don't have correct value fused */ +/* default DCF CLK DPM on RV*/ + .dcfclkv_max0p9 =655 ,/* MHz, = 3600/5.5 */ + .dcfclkv_nom0p8 =626 ,/* MHz, = 3600/5.75 */ + .dcfclkv_mid0p72 =600 ,/* MHz, = 3600/6, bypass */ + .dcfclkv_min0p65 =300 ,/* MHz, = 3600/12, bypass */ + +/* default DISP CLK voltage state on RV */ + .max_dispclk_vmax0p9 =1108 ,/* MHz, = 3600/3.25 */ + .max_dispclk_vnom0p8 =1029 ,/* MHz, = 3600/3.5 */ + .max_dispclk_vmid0p72 =960 ,/* MHz, = 3600/3.75 */ + .max_dispclk_vmin0p65 =626 ,/* MHz, = 3600/5.75 */ + +/* default DPP CLK voltage state on RV */ + .max_dppclk_vmax0p9 =720 ,/* MHz, = 3600/5 */ + .max_dppclk_vnom0p8 =686 ,/* MHz, = 3600/5.25 */ + .max_dppclk_vmid0p72 =626 ,/* MHz, = 3600/5.75 */ + .max_dppclk_vmin0p65 =400 ,/* MHz, = 3600/9 */ + +/* default PHY CLK voltage state on RV */ + .phyclkv_max0p9 =900 ,/*MHz*/ + .phyclkv_nom0p8 =847 ,/*MHz*/ + .phyclkv_mid0p72 =800 ,/*MHz*/ + .phyclkv_min0p65 =600 ,/*MHz*/ + +/* BW depend on FCLK, MCLK, # of channels */ +/* dual channel BW */ .fabric_and_dram_bandwidth_vmax0p9 =38.4f ,/*GB/s*/ - .fabric_and_dram_bandwidth_vnom0p8 =34.1f ,/*GB/s*/ - .fabric_and_dram_bandwidth_vmid0p72 =29.8f ,/*GB/s*/ + .fabric_and_dram_bandwidth_vnom0p8 =34.133f ,/*GB/s*/ + .fabric_and_dram_bandwidth_vmid0p72 =29.866f ,/*GB/s*/ .fabric_and_dram_bandwidth_vmin0p65 =12.8f ,/*GB/s*/ - .phyclkv_max0p9 =810 ,/*MHz*/ - .phyclkv_nom0p8 =810 ,/*MHz*/ - .phyclkv_mid0p72 =540 ,/*MHz*/ - .phyclkv_min0p65 =540 ,/*MHz*/ +/* single channel BW +.fabric_and_dram_bandwidth_vmax0p9 = 19.2f, +.fabric_and_dram_bandwidth_vnom0p8 = 17.066f, +.fabric_and_dram_bandwidth_vmid0p72 = 14.933f, +.fabric_and_dram_bandwidth_vmin0p65 = 12.8f, +*/ + + .number_of_channels =2 , + + .socclk =208 ,/*MHz*/ .downspreading =0.5f ,/*%*/ .round_trip_ping_latency_cycles =128 ,/*DCFCLK Cycles*/ .urgent_out_of_order_return_per_channel =256 ,/*bytes*/ - .number_of_channels =2 , .vmm_page_size =4096 ,/*bytes*/ - .dram_clock_change_latency =17 ,/*us*/ .return_bus_width =64 ,/*bytes*/ + .max_request_size =256 ,/*bytes*/ };const struct dcn_ip_params dcn10_ip_defaults = {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 37/81 drm/amd/display: move number of memory channel calc out of pplib call
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
Move number of memory channel calculation out of dcn_bw_update_from_pplib
Fill in fabric_and_dram_bandwidth for single channel case.
--- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 4 ---- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 13 +++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +0 -4
@@ -1215,10 +1215,6 @@ void dcn_bw_update_from_pplib(struct core_dc *dc)struct dm_pp_clock_levels_with_voltage clks2 = {0 };kernel_fpu_begin (); - dc->dcn_soc.number_of_channels = dc->ctx->asic_id.vram_width / ddr4_dram_width; -ASSERT (dc->dcn_soc.number_of_channels && dc->dcn_soc.number_of_channels <3 ); -if (dc->dcn_soc.number_of_channels ==0 )/*old sbios bug*/ - dc->dcn_soc.number_of_channels =2 ; if (dm_pp_get_clock_levels_by_type_with_voltage( ctx, DM_PP_CLOCK_TYPE_DISPLAY_CLK, &clks2) &&
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +13 -0
@@ -1358,6 +1358,19 @@ static bool construct(dml_init_instance (&dc->dml,DML_PROJECT_RAVEN1 ); dc->dcn_ip = dcn10_ip_defaults; dc->dcn_soc = dcn10_soc_defaults; + + dc->dcn_soc.number_of_channels = dc->ctx->asic_id.vram_width / ddr4_dram_width; +ASSERT (dc->dcn_soc.number_of_channels <3 ); +if (dc->dcn_soc.number_of_channels ==0 )/*old sbios bug*/ + dc->dcn_soc.number_of_channels =2 ; + +if (dc->dcn_soc.number_of_channels ==1 ) { + dc->dcn_soc.fabric_and_dram_bandwidth_vmax0p9 =19.2f ; + dc->dcn_soc.fabric_and_dram_bandwidth_vnom0p8 =17.066f ; + dc->dcn_soc.fabric_and_dram_bandwidth_vmid0p72 =14.933f ; + dc->dcn_soc.fabric_and_dram_bandwidth_vmin0p65 =12.8f ; + } +if (!dc->public.debug.disable_pplib_clock_request)dcn_bw_update_from_pplib (dc);dcn_bw_sync_calcs_and_dml (dc);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 38/81 drm/amd/display: block modes that require read bw greater than 30%
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
--- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 18 +++++++++++++++++- drivers/gpu/drm/amd/display/dc/inc/dcn_calcs.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +17 -1
@@ -95,6 +95,9 @@ const struct dcn_soc_bounding_box dcn10_soc_defaults = { .vmm_page_size = 4096, /*bytes*/ .return_bus_width = 64, /*bytes*/ .max_request_size = 256, /*bytes*/ + +/* Depends on user class (client vs embedded, workstation, etc) */ + .percent_disp_bw_limit =0.3f /*%*/ };const struct dcn_ip_params dcn10_ip_defaults = {
@@ -695,6 +698,8 @@ bool dcn_validate_bandwidth(struct dcn_bw_internal_vars *v = &context->dcn_bw_vars;int i, input_idx;int vesa_sync_start, asic_blank_end, asic_blank_start; +bool bw_limit_pass; +float bw_limit;if (dcn_bw_apply_registry_override (DC_TO_CORE (&dc->public)))dcn_bw_sync_calcs_and_dml (DC_TO_CORE (&dc->public));
@@ -1072,8 +1077,19 @@ bool dcn_validate_bandwidth( dc_core->dml.soc.sr_exit_time_us = dc_core->dcn_soc.sr_exit_time; } +/* +* BW limit is set to prevent display from impacting other system functions +*/ + + bw_limit = dc->dcn_soc.percent_disp_bw_limit * v->fabric_and_dram_bandwidth_vmax0p9; + bw_limit_pass = (v->total_data_read_bandwidth /1000.0 ) < bw_limit; +kernel_fpu_end (); -return v->voltage_level !=5 ; + +if (bw_limit_pass && v->voltage_level !=5 ) +return true; +else +return false; } unsigned int dcn_find_normalized_clock_vdd_Level(
drivers/gpu/drm/amd/display/dc/inc/dcn_calcs.h +1 -0
@@ -572,6 +572,7 @@ struct dcn_soc_bounding_box {int vmm_page_size;/*bytes*/ float dram_clock_change_latency;/*us*/ int return_bus_width;/*bytes*/ +float percent_disp_bw_limit;/*%*/ };extern const struct dcn_soc_bounding_box dcn10_soc_defaults;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 39/81 drm/amd/display: Change how we disable pipe split
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
Before this change, pipe split was disabled by bumping up dpp clock bounding box for DPM level 0 and 1, this allows validation to pass without splitting at a lower DPM level. This change reverts this and instead lowers display clock at DPM level 0, this forces configurations that need pipe split at DPM level 0 to go to DPM level 1, where they can be driven without split.
--- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +1 -2
@@ -822,8 +822,7 @@ bool dcn_validate_bandwidth( v->phyclk_per_state[0 ] = v->phyclkv_min0p65;if (dc->public.debug.disable_pipe_split) { - v->max_dppclk[1 ] = v->max_dppclk_vnom0p8; - v->max_dppclk[0 ] = v->max_dppclk_vnom0p8; + v->max_dispclk[0 ] = v->max_dppclk_vmin0p65; }if (v->voltage_override == dcn_bw_v_max0p9) {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 40/81 drm/amd/display: call pplib to update clocks
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
Allow pplib to update fclk and dcfclk for different voltage levels. PPlib's values for dispclk and phyclk is not correct, so we are not getting it from them. fclk is currently not used correctly, although does not effect the actual fclk we request.
--- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 46 +++--------------------- 1 file changed, 4 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +4 -42
@@ -1226,28 +1226,13 @@ unsigned int dcn_find_dcfclk_suits_all(void dcn_bw_update_from_pplib (struct core_dc *dc) {struct dc_context *ctx = dc->ctx; -struct dm_pp_clock_levels_with_latency clks = {0 }; -struct dm_pp_clock_levels_with_voltage clks2 = {0 }; +struct dm_pp_clock_levels_with_voltage clks = {0 };kernel_fpu_begin (); +/* TODO: This is not the proper way to obtain fabric_and_dram_bandwidth, should be min(fclk, memclk) */ +if (dm_pp_get_clock_levels_by_type_with_voltage ( - ctx,DM_PP_CLOCK_TYPE_DISPLAY_CLK , &clks2) && - clks2.num_levels >=3 ) { - dc->dcn_soc.max_dispclk_vmin0p65 = clks2.data[0 ].clocks_in_khz /1000.0 ; - dc->dcn_soc.max_dispclk_vmid0p72 = clks2.data[clks2.num_levels -3 ].clocks_in_khz /1000.0 ; - dc->dcn_soc.max_dispclk_vnom0p8 = clks2.data[clks2.num_levels -2 ].clocks_in_khz /1000.0 ; - dc->dcn_soc.max_dispclk_vmax0p9 = clks2.data[clks2.num_levels -1 ].clocks_in_khz /1000.0 ; - }else -BREAK_TO_DEBUGGER (); -/* -if (dm_pp_get_clock_levels_by_type_with_latency( -ctx, DM_PP_CLOCK_TYPE_MEMORY_CLK, &clks) && -clks.num_levels != 0) { -//this is to get DRAM data_rate -//FabricAndDRAMBandwidth = min(64*FCLK , Data rate * single_Channel_Width * number of channels); -}*/ -if (dm_pp_get_clock_levels_by_type_with_latency ( ctx,DM_PP_CLOCK_TYPE_FCLK , &clks) && clks.num_levels !=0 ) {ASSERT (clks.num_levels >=3 );
@@ -1265,7 +1250,7 @@ void dcn_bw_update_from_pplib(struct core_dc *dc) (clks.data[clks.num_levels -1 ].clocks_in_khz /1000.0 ) * ddr4_dram_factor_single_Channel /1000.0 ; }else BREAK_TO_DEBUGGER (); -if (dm_pp_get_clock_levels_by_type_with_latency ( +if (dm_pp_get_clock_levels_by_type_with_voltage ( ctx,DM_PP_CLOCK_TYPE_DCFCLK , &clks) && clks.num_levels >=3 ) { dc->dcn_soc.dcfclkv_min0p65 = clks.data[0 ].clocks_in_khz /1000.0 ;
@@ -1274,30 +1259,7 @@ void dcn_bw_update_from_pplib(struct core_dc *dc) dc->dcn_soc.dcfclkv_max0p9 = clks.data[clks.num_levels -1 ].clocks_in_khz /1000.0 ; }else BREAK_TO_DEBUGGER (); -if (dm_pp_get_clock_levels_by_type_with_voltage ( - ctx,DM_PP_CLOCK_TYPE_DISPLAYPHYCLK , &clks2) && - clks2.num_levels >=3 ) { - dc->dcn_soc.phyclkv_min0p65 = clks2.data[0 ].clocks_in_khz /1000.0 ; - dc->dcn_soc.phyclkv_mid0p72 = clks2.data[clks2.num_levels -3 ].clocks_in_khz /1000.0 ; - dc->dcn_soc.phyclkv_nom0p8 = clks2.data[clks2.num_levels -2 ].clocks_in_khz /1000.0 ; - dc->dcn_soc.phyclkv_max0p9 = clks2.data[clks2.num_levels -1 ].clocks_in_khz /1000.0 ; - }else -BREAK_TO_DEBUGGER (); -if (dm_pp_get_clock_levels_by_type_with_latency ( - ctx,DM_PP_CLOCK_TYPE_DPPCLK , &clks) && - clks.num_levels >=3 ) { - dc->dcn_soc.max_dppclk_vmin0p65 = clks.data[0 ].clocks_in_khz /1000.0 ; - dc->dcn_soc.max_dppclk_vmid0p72 = clks.data[clks.num_levels -3 ].clocks_in_khz /1000.0 ; - dc->dcn_soc.max_dppclk_vnom0p8 = clks.data[clks.num_levels -2 ].clocks_in_khz /1000.0 ; - dc->dcn_soc.max_dppclk_vmax0p9 = clks.data[clks.num_levels -1 ].clocks_in_khz /1000.0 ; - } -if (dm_pp_get_clock_levels_by_type_with_latency ( - ctx,DM_PP_CLOCK_TYPE_SOCCLK , &clks) && - clks.num_levels >=3 ) { - dc->dcn_soc.socclk = clks.data[0 ].clocks_in_khz /1000.0 ; - }else -BREAK_TO_DEBUGGER ();kernel_fpu_end (); }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 41/81 drm/amd/display: Refactor dc_commit_streams
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Change it to sue dc_commit_context. dc_commit_context is used directly from Linux DM.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 99 +++++++++++++------------------- 1 file changed, 41 insertions(+), 58 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +41 -58
@@ -913,33 +913,22 @@ bool dc_enable_stereo(return ret; } -/* TODO operate on validation set (or something like it) */ -bool dc_commit_context (struct dc *dc,struct validate_context *context) + +/* +* Applies given context to HW and copy it into current context. +* It's up to the user to release the src context afterwards. +*/ +static bool dc_commit_context_no_check (struct dc *dc,struct validate_context *context) {struct core_dc *core_dc =DC_TO_CORE (dc);struct dc_bios *dcb = core_dc->ctx->dc_bios;enum dc_status result =DC_ERROR_UNEXPECTED ;struct pipe_ctx *pipe;int i, j, k, l; +const struct dc_stream *dc_streams[MAX_STREAMS ] = {0 }; -if (!context) -dm_logger_write (core_dc->ctx->logger,LOG_ERROR , -"%s: dc_commit_context with no context!\n" , - __func__); - -if (false ==context_changed (core_dc, context)) -return DC_OK ; - -dm_logger_write (core_dc->ctx->logger,LOG_DC ,"%s: %d streams\n" , - __func__, context->stream_count); - -for (i =0 ; i < context->stream_count; i++) { -const struct dc_stream *stream = &context->streams[i]->public; - -dc_stream_log (stream, - core_dc->ctx->logger, -LOG_DC ); - } +for (i =0 ; i < context->stream_count; i++) + dc_streams[i] = &context->streams[i]->public;if (!dcb->funcs->is_accelerated_mode (dcb)) core_dc->hwss.enable_accelerated_mode (core_dc);
@@ -981,22 +970,49 @@ bool dc_commit_context(struct dc *dc, struct validate_context *context) context->streams[i]->public.timing.pix_clk_khz); } +dc_enable_stereo (dc, context, dc_streams, context->stream_count); +dc_resource_validate_ctx_copy_construct (context, core_dc->current_context);return (result ==DC_OK ); } +bool dc_commit_context (struct dc *dc,struct validate_context *context) +{ +enum dc_status result =DC_ERROR_UNEXPECTED ; +struct core_dc *core_dc =DC_TO_CORE (dc); +int i; + +if (false ==context_changed (core_dc, context)) +return DC_OK ; + +dm_logger_write (core_dc->ctx->logger,LOG_DC ,"%s: %d streams\n" , + __func__, context->stream_count); + +for (i =0 ; i < context->stream_count; i++) { +const struct dc_stream *stream = &context->streams[i]->public; + +dc_stream_log (stream, + core_dc->ctx->logger, +LOG_DC ); + } + + result =dc_commit_context_no_check (dc, context); + +return (result ==DC_OK ); +} + +bool dc_commit_streams (struct dc *dc,const struct dc_stream *streams[],uint8_t stream_count) {struct core_dc *core_dc =DC_TO_CORE (dc); -struct dc_bios *dcb = core_dc->ctx->dc_bios;enum dc_status result =DC_ERROR_UNEXPECTED ;struct validate_context *context;struct dc_validation_set set[MAX_STREAMS ] = { {0 , {0 } } }; -int i, j; +int i;if (false ==streams_changed (core_dc, streams, stream_count))return DC_OK ;
@@ -1039,43 +1055,10 @@ bool dc_commit_streams( goto fail; } -if (!dcb->funcs->is_accelerated_mode (dcb)) { - core_dc->hwss.enable_accelerated_mode (core_dc); - } - -if (result ==DC_OK ) { - result = core_dc->hwss.apply_ctx_to_hw (core_dc, context); - } - -program_timing_sync (core_dc, context); - -for (i =0 ; i < context->stream_count; i++) { -const struct core_sink *sink = context->streams[i]->sink; - -for (j =0 ; j < context->stream_status[i].surface_count; j++) { -struct core_surface *surface = -DC_SURFACE_TO_CORE (context->stream_status[i].surfaces[j]); - - core_dc->hwss.apply_ctx_for_surface (core_dc, surface, context); - } + result =dc_commit_context_no_check (dc, context); -CONN_MSG_MODE (sink->link,"{%ux%u, %ux%u@%u, %ux%u@%uKhz}" , - context->streams[i]->public.src.width, - context->streams[i]->public.src.height, - context->streams[i]->public.timing.h_addressable, - context->streams[i]->public.timing.v_addressable, - context->streams[i]->public.timing.pix_clk_khz *1000 / - context->streams[i]->public.timing.h_total / - context->streams[i]->public.timing.v_total,// Refresh rate - context->streams[i]->public.timing.h_total, - context->streams[i]->public.timing.v_total, - context->streams[i]->public.timing.pix_clk_khz); - } -dc_enable_stereo (dc, context, streams, stream_count); -dc_resource_validate_ctx_destruct (core_dc->current_context); -dm_free (core_dc->current_context); - - core_dc->current_context = context; +dc_resource_validate_ctx_destruct (context); +dm_free (context);return (result ==DC_OK );
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 42/81 drm/amd/display: refactor dcn10 hw_sequencer to new reg access style
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h | 177 ++++++- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 530 +++++---------------- drivers/gpu/drm/amd/display/dc/inc/reg_helper.h | 66 ++- 3 files changed, 343 insertions(+), 430 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +166 -11
@@ -122,11 +122,56 @@ HWSEQ_PHYPLL_REG_LIST(CRTC)#if defined(CONFIG_DRM_AMD_DC_DCN1_0 ) -#define HWSEQ_DCN1_REG_LIST ()\ +#define HWSEQ_DCN_REG_LIST ()\ HWSEQ_PIXEL_RATE_REG_LIST(OTG), \ - HWSEQ_PHYPLL_REG_LIST(OTG) + HWSEQ_PHYPLL_REG_LIST(OTG), \ + SRII(OTG_GLOBAL_SYNC_STATUS, OTG, 0), \ + SRII(OTG_GLOBAL_SYNC_STATUS, OTG, 1), \ + SRII(OTG_GLOBAL_SYNC_STATUS, OTG, 2), \ + SRII(OTG_GLOBAL_SYNC_STATUS, OTG, 3), \ + SRII(DCHUBP_CNTL, HUBP, 0), \ + SRII(DCHUBP_CNTL, HUBP, 1), \ + SRII(DCHUBP_CNTL, HUBP, 2), \ + SRII(DCHUBP_CNTL, HUBP, 3), \ + SRII(HUBP_CLK_CNTL, HUBP, 0), \ + SRII(HUBP_CLK_CNTL, HUBP, 1), \ + SRII(HUBP_CLK_CNTL, HUBP, 2), \ + SRII(HUBP_CLK_CNTL, HUBP, 3), \ + SRII(DPP_CONTROL, DPP_TOP, 0), \ + SRII(DPP_CONTROL, DPP_TOP, 1), \ + SRII(DPP_CONTROL, DPP_TOP, 2), \ + SRII(DPP_CONTROL, DPP_TOP, 3), \ + SR(REFCLK_CNTL), \ + SR(DCHUBBUB_GLOBAL_TIMER_CNTL), \ + SR(DC_IP_REQUEST_CNTL), \ + SR(DOMAIN0_PG_CONFIG), \ + SR(DOMAIN1_PG_CONFIG), \ + SR(DOMAIN2_PG_CONFIG), \ + SR(DOMAIN3_PG_CONFIG), \ + SR(DOMAIN4_PG_CONFIG), \ + SR(DOMAIN5_PG_CONFIG), \ + SR(DOMAIN6_PG_CONFIG), \ + SR(DOMAIN7_PG_CONFIG), \ + SR(DOMAIN0_PG_STATUS), \ + SR(DOMAIN1_PG_STATUS), \ + SR(DOMAIN2_PG_STATUS), \ + SR(DOMAIN3_PG_STATUS), \ + SR(DOMAIN4_PG_STATUS), \ + SR(DOMAIN5_PG_STATUS), \ + SR(DOMAIN6_PG_STATUS), \ + SR(DOMAIN7_PG_STATUS), \ + SR(DIO_MEM_PWR_CTRL), \ + SR(DCCG_GATE_DISABLE_CNTL), \ + SR(DCCG_GATE_DISABLE_CNTL2), \ + SR(DCFCLK_CNTL) +#endif + +#if defined(CONFIG_DRM_AMD_DC_DCN1_0 ) +#define HWSEQ_DCN1_REG_LIST ()\ + HWSEQ_DCN_REG_LIST()#endif +struct dce_hwseq_registers {uint32_t DCFE_CLOCK_CONTROL[6 ];uint32_t DCFEV_CLOCK_CONTROL;
@@ -134,13 +179,39 @@ struct dce_hwseq_registers {uint32_t BLND_V_UPDATE_LOCK [6 ];uint32_t BLND_CONTROL [6 ];uint32_t BLNDV_CONTROL ; - -#if defined(CONFIG_DRM_AMD_DC_DCN1_0 ) -/* DCE + DCN */ -#endif uint32_t CRTC_H_BLANK_START_END [6 ];uint32_t PIXEL_RATE_CNTL [6 ];uint32_t PHYPLL_PIXEL_RATE_CNTL [6 ]; + +#if defined(CONFIG_DRM_AMD_DC_DCN1_0 ) +uint32_t OTG_GLOBAL_SYNC_STATUS [4 ]; +uint32_t DCHUBP_CNTL [4 ]; +uint32_t HUBP_CLK_CNTL [4 ]; +uint32_t DPP_CONTROL [4 ]; +uint32_t REFCLK_CNTL ; +uint32_t DCHUBBUB_GLOBAL_TIMER_CNTL ; +uint32_t DC_IP_REQUEST_CNTL ; +uint32_t DOMAIN0_PG_CONFIG ; +uint32_t DOMAIN1_PG_CONFIG ; +uint32_t DOMAIN2_PG_CONFIG ; +uint32_t DOMAIN3_PG_CONFIG ; +uint32_t DOMAIN4_PG_CONFIG ; +uint32_t DOMAIN5_PG_CONFIG ; +uint32_t DOMAIN6_PG_CONFIG ; +uint32_t DOMAIN7_PG_CONFIG ; +uint32_t DOMAIN0_PG_STATUS ; +uint32_t DOMAIN1_PG_STATUS ; +uint32_t DOMAIN2_PG_STATUS ; +uint32_t DOMAIN3_PG_STATUS ; +uint32_t DOMAIN4_PG_STATUS ; +uint32_t DOMAIN5_PG_STATUS ; +uint32_t DOMAIN6_PG_STATUS ; +uint32_t DOMAIN7_PG_STATUS ; +uint32_t DIO_MEM_PWR_CTRL ; +uint32_t DCCG_GATE_DISABLE_CNTL ; +uint32_t DCCG_GATE_DISABLE_CNTL2 ; +uint32_t DCFCLK_CNTL ; +#endif };/* set field name */ #define HWS_SF (blk_name, reg_name, field_name, post_fix)\
@@ -202,12 +273,52 @@ struct dce_hwseq_registers { HWSEQ_PHYPLL_MASK_SH_LIST(mask_sh, CRTC0_)#if defined(CONFIG_DRM_AMD_DC_DCN1_0 ) -#define HWSEQ_DCN1_MASK_SH_LIST (mask_sh)\ +#define HWSEQ_DCN_MASK_SH_LIST (mask_sh)\ HWSEQ_PIXEL_RATE_MASK_SH_LIST(mask_sh, OTG0_),\ - HWSEQ_PHYPLL_MASK_SH_LIST(mask_sh, OTG0_) + HWSEQ_PHYPLL_MASK_SH_LIST(mask_sh, OTG0_),\ + HWS_SF(OTG0_, OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_EVENT_CLEAR, mask_sh), \ + HWS_SF(OTG0_, OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_EVENT_OCCURRED, mask_sh), \ + HWS_SF(HUBP0_, DCHUBP_CNTL, HUBP_NO_OUTSTANDING_REQ, mask_sh), \ + HWS_SF(HUBP0_, DCHUBP_CNTL, HUBP_VTG_SEL, mask_sh), \ + HWS_SF(HUBP0_, HUBP_CLK_CNTL, HUBP_CLOCK_ENABLE, mask_sh), \ + HWS_SF(DPP_TOP0_, DPP_CONTROL, DPP_CLOCK_ENABLE, mask_sh), \ + HWS_SF(, DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_ENABLE, mask_sh), \ + HWS_SF(, DC_IP_REQUEST_CNTL, IP_REQUEST_EN, mask_sh), \ + HWS_SF(, DOMAIN0_PG_CONFIG, DOMAIN0_POWER_FORCEON, mask_sh), \ + HWS_SF(, DOMAIN0_PG_CONFIG, DOMAIN0_POWER_GATE, mask_sh), \ + HWS_SF(, DOMAIN1_PG_CONFIG, DOMAIN1_POWER_FORCEON, mask_sh), \ + HWS_SF(, DOMAIN1_PG_CONFIG, DOMAIN1_POWER_GATE, mask_sh), \ + HWS_SF(, DOMAIN2_PG_CONFIG, DOMAIN2_POWER_FORCEON, mask_sh), \ + HWS_SF(, DOMAIN2_PG_CONFIG, DOMAIN2_POWER_GATE, mask_sh), \ + HWS_SF(, DOMAIN3_PG_CONFIG, DOMAIN3_POWER_FORCEON, mask_sh), \ + HWS_SF(, DOMAIN3_PG_CONFIG, DOMAIN3_POWER_GATE, mask_sh), \ + HWS_SF(, DOMAIN4_PG_CONFIG, DOMAIN4_POWER_FORCEON, mask_sh), \ + HWS_SF(, DOMAIN4_PG_CONFIG, DOMAIN4_POWER_GATE, mask_sh), \ + HWS_SF(, DOMAIN5_PG_CONFIG, DOMAIN5_POWER_FORCEON, mask_sh), \ + HWS_SF(, DOMAIN5_PG_CONFIG, DOMAIN5_POWER_GATE, mask_sh), \ + HWS_SF(, DOMAIN6_PG_CONFIG, DOMAIN6_POWER_FORCEON, mask_sh), \ + HWS_SF(, DOMAIN6_PG_CONFIG, DOMAIN6_POWER_GATE, mask_sh), \ + HWS_SF(, DOMAIN7_PG_CONFIG, DOMAIN7_POWER_FORCEON, mask_sh), \ + HWS_SF(, DOMAIN7_PG_CONFIG, DOMAIN7_POWER_GATE, mask_sh), \ + HWS_SF(, DOMAIN0_PG_STATUS, DOMAIN0_PGFSM_PWR_STATUS, mask_sh), \ + HWS_SF(, DOMAIN1_PG_STATUS, DOMAIN1_PGFSM_PWR_STATUS, mask_sh), \ + HWS_SF(, DOMAIN2_PG_STATUS, DOMAIN2_PGFSM_PWR_STATUS, mask_sh), \ + HWS_SF(, DOMAIN3_PG_STATUS, DOMAIN3_PGFSM_PWR_STATUS, mask_sh), \ + HWS_SF(, DOMAIN4_PG_STATUS, DOMAIN4_PGFSM_PWR_STATUS, mask_sh), \ + HWS_SF(, DOMAIN5_PG_STATUS, DOMAIN5_PGFSM_PWR_STATUS, mask_sh), \ + HWS_SF(, DOMAIN6_PG_STATUS, DOMAIN6_PGFSM_PWR_STATUS, mask_sh), \ + HWS_SF(, DOMAIN7_PG_STATUS, DOMAIN7_PGFSM_PWR_STATUS, mask_sh), \ + HWS_SF(, DCFCLK_CNTL, DCFCLK_GATE_DIS, mask_sh) +#endif + +#if defined(CONFIG_DRM_AMD_DC_DCN1_0 ) +#define HWSEQ_DCN1_MASK_SH_LIST (mask_sh)\ + HWSEQ_DCN_MASK_SH_LIST(mask_sh), \ + HWS_SF1(OTG0_, PHYPLL_PIXEL_RATE_CNTL, PIXEL_RATE_PLL_SOURCE, mask_sh), \ + HWS_SF(DPP_TOP0_, DPP_CONTROL, DPPCLK_RATE_CONTROL, mask_sh)#endif -#define HWSEQ_REG_FIED_LIST (type) \ +#define HWSEQ_REG_FIELD_LIST (type) \ type DCFE_CLOCK_ENABLE; \ type DCFEV_CLOCK_ENABLE; \ type DC_MEM_GLOBAL_PWR_REQ_DIS; \
@@ -225,12 +336,56 @@ 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; \ + type HUBP_NO_OUTSTANDING_REQ; \ + type HUBP_VTG_SEL; \ + type HUBP_CLOCK_ENABLE; \ + type DPP_CLOCK_ENABLE; \ + type DPPCLK_RATE_CONTROL; \ + type DCHUBBUB_GLOBAL_TIMER_ENABLE; \ + type IP_REQUEST_EN; \ + type DOMAIN0_POWER_FORCEON; \ + type DOMAIN0_POWER_GATE; \ + type DOMAIN1_POWER_FORCEON; \ + type DOMAIN1_POWER_GATE; \ + type DOMAIN2_POWER_FORCEON; \ + type DOMAIN2_POWER_GATE; \ + type DOMAIN3_POWER_FORCEON; \ + type DOMAIN3_POWER_GATE; \ + type DOMAIN4_POWER_FORCEON; \ + type DOMAIN4_POWER_GATE; \ + type DOMAIN5_POWER_FORCEON; \ + type DOMAIN5_POWER_GATE; \ + type DOMAIN6_POWER_FORCEON; \ + type DOMAIN6_POWER_GATE; \ + type DOMAIN7_POWER_FORCEON; \ + type DOMAIN7_POWER_GATE; \ + type DOMAIN0_PGFSM_PWR_STATUS; \ + type DOMAIN1_PGFSM_PWR_STATUS; \ + type DOMAIN2_PGFSM_PWR_STATUS; \ + type DOMAIN3_PGFSM_PWR_STATUS; \ + type DOMAIN4_PGFSM_PWR_STATUS; \ + type DOMAIN5_PGFSM_PWR_STATUS; \ + type DOMAIN6_PGFSM_PWR_STATUS; \ + type DOMAIN7_PGFSM_PWR_STATUS; \ + type DCFCLK_GATE_DIS; +#endif +struct dce_hwseq_shift { - HWSEQ_REG_FIED_LIST(uint8_t) + 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_FIED_LIST(uint32_t) + HWSEQ_REG_FIELD_LIST(uint32_t) +#if defined(CONFIG_DRM_AMD_DC_DCN1_0 ) + HWSEQ_DCN_REG_FIELD_LIST(uint32_t) +#endif };
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +112 -418
750 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/reg_helper.h +65 -1
78 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 43/81 drm/amd/display: Fix MPO visual confirm
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
1. Need to blend non-active area to show visual confirm borders
2. Set number of Visual Confirm lines based on pipe instance
3. Set Different colors representing surface format of bottom most plan
--- .../gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 6 --- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 16 ++++---- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 8 ++-- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 8 +++- .../drm/amd/display/dc/dce110/dce110_transform_v.c | 4 +- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 45 +++++++++++++++++++++- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c | 5 ++- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 2 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_transform.c | 13 ++++--- .../gpu/drm/amd/display/dc/dcn10/dcn10_transform.h | 1 + 10 files changed, 77 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +0 -6
@@ -59,12 +59,6 @@ void color_space_to_black_color(enum dc_color_space colorspace, struct tg_color *black_color) { -if (dc->public.debug.surface_visual_confirm) { - *black_color = - black_color_format[BLACK_COLOR_FORMAT_DEBUG ]; -return ; - } - switch (colorspace) { case COLOR_SPACE_YCBCR601: case COLOR_SPACE_YCBCR709:
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +8 -8
@@ -399,11 +399,11 @@ static enum pixel_format convert_pixel_format_to_dalsurface(break ;case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb: - dal_pixel_format =PIXEL_FORMAT_420BPP12 ; + dal_pixel_format =PIXEL_FORMAT_420BPP8 ;break ;case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr:case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb: - dal_pixel_format =PIXEL_FORMAT_420BPP15 ; + dal_pixel_format =PIXEL_FORMAT_420BPP10 ;break ;case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 :default :
@@ -433,8 +433,8 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)struct scaler_data *data = &pipe_ctx->scl_data;struct rect surf_src = surface->src_rect;struct rect clip = {0 }; -int vpc_div = (data->format ==PIXEL_FORMAT_420BPP12 - || data->format ==PIXEL_FORMAT_420BPP15 ) ?2 :1 ; +int vpc_div = (data->format ==PIXEL_FORMAT_420BPP8 + || data->format ==PIXEL_FORMAT_420BPP10 ) ?2 :1 ;bool pri_split = pipe_ctx->bottom_pipe && pipe_ctx->bottom_pipe->surface == pipe_ctx->surface; bool sec_split = pipe_ctx->top_pipe &&
@@ -637,8 +637,8 @@ static void calculate_scaling_ratios(struct pipe_ctx *pipe_ctx) pipe_ctx->scl_data.ratios.horz_c = pipe_ctx->scl_data.ratios.horz; pipe_ctx->scl_data.ratios.vert_c = pipe_ctx->scl_data.ratios.vert; -if (pipe_ctx->scl_data.format ==PIXEL_FORMAT_420BPP12 - || pipe_ctx->scl_data.format ==PIXEL_FORMAT_420BPP15 ) { +if (pipe_ctx->scl_data.format ==PIXEL_FORMAT_420BPP8 + || pipe_ctx->scl_data.format ==PIXEL_FORMAT_420BPP10 ) { pipe_ctx->scl_data.ratios.horz_c.value /=2 ; pipe_ctx->scl_data.ratios.vert_c.value /=2 ; }
@@ -648,8 +648,8 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r {struct scaler_data *data = &pipe_ctx->scl_data;struct rect src = pipe_ctx->surface->public.src_rect; -int vpc_div = (data->format ==PIXEL_FORMAT_420BPP12 - || data->format ==PIXEL_FORMAT_420BPP15 ) ?2 :1 ; +int vpc_div = (data->format ==PIXEL_FORMAT_420BPP8 + || data->format ==PIXEL_FORMAT_420BPP10 ) ?2 :1 ; if (pipe_ctx->surface->public.rotation == ROTATION_ANGLE_90 ||
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +4 -4
@@ -214,15 +214,15 @@ enum pixel_format {PIXEL_FORMAT_ARGB2101010_XRBIAS ,PIXEL_FORMAT_FP16 ,/*video*/ -PIXEL_FORMAT_420BPP12 , -PIXEL_FORMAT_420BPP15 , +PIXEL_FORMAT_420BPP8 , +PIXEL_FORMAT_420BPP10 ,/*end of pixel format definition*/ PIXEL_FORMAT_INVALID ,PIXEL_FORMAT_GRPH_BEGIN =PIXEL_FORMAT_INDEX8 ,PIXEL_FORMAT_GRPH_END =PIXEL_FORMAT_FP16 , -PIXEL_FORMAT_VIDEO_BEGIN =PIXEL_FORMAT_420BPP12 , -PIXEL_FORMAT_VIDEO_END =PIXEL_FORMAT_420BPP15 , +PIXEL_FORMAT_VIDEO_BEGIN =PIXEL_FORMAT_420BPP8 , +PIXEL_FORMAT_VIDEO_END =PIXEL_FORMAT_420BPP10 ,PIXEL_FORMAT_UNKNOWN };
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +6 -2
@@ -916,11 +916,15 @@ static void get_surface_visual_confirm_color(const struct pipe_ctx *pipe_ctx,/* set boarder color to blue */ color->color_b_cb = color_value;break ; -case PIXEL_FORMAT_420BPP12 : -case PIXEL_FORMAT_420BPP15 : +case PIXEL_FORMAT_420BPP8 :/* set boarder color to green */ color->color_g_y = color_value;break ; +case PIXEL_FORMAT_420BPP10 : +/* set boarder color to yellow */ + color->color_g_y = color_value; + color->color_r_cr = color_value; +break ;case PIXEL_FORMAT_FP16 :/* set boarder color to white */ color->color_r_cr = color_value;
drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.c +2 -2
@@ -59,7 +59,7 @@ static void calculate_viewport( chroma_viewport->height = luma_viewport->height; chroma_viewport->width = luma_viewport->width; -if (scl_data->format ==PIXEL_FORMAT_420BPP12 ) { +if (scl_data->format ==PIXEL_FORMAT_420BPP8 ) { luma_viewport->height += luma_viewport->height %2 ; luma_viewport->width += luma_viewport->width %2 ;/*for 420 video chroma is 1/4 the area of luma, scaled
@@ -184,7 +184,7 @@ static bool setup_scaling_configuration(set_reg_field_value (value,1 ,SCLV_MODE ,SCL_MODE_C );set_reg_field_value (value,1 ,SCLV_MODE ,SCL_PSCL_EN_C ); is_scaling_needed = true; - }else if (data->format !=PIXEL_FORMAT_420BPP12 ) { + }else if (data->format !=PIXEL_FORMAT_420BPP8 ) { set_reg_field_value( value, get_reg_field_value(value, SCLV_MODE, SCL_MODE),
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +43 -2
57 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c +4 -1
@@ -25,6 +25,7 @@#include "reg_helper.h" #include "dcn10_mpc.h" +#include "dc.h" #define REG (reg)\ mpcc10->mpcc_regs->reg
@@ -85,6 +86,8 @@ static void dcn10_mpcc_set(struct mpcc *mpcc, struct mpcc_cfg *cfg) BLND_PP_ALPHA :BLND_GLOBAL_ALPHA ;int mpcc_mode = cfg->bot_mpcc_id !=0xf ?MODE_BLEND :MODE_TOP_ONLY ; +bool blend_active_only = cfg->top_of_tree && + !mpcc->ctx->dc->debug.surface_visual_confirm;REG_SET (MPCC_OPP_ID ,0 ,MPCC_OPP_ID , cfg->opp_id);
@@ -99,7 +102,7 @@ static void dcn10_mpcc_set(struct mpcc *mpcc, struct mpcc_cfg *cfg)MPCC_MODE , mpcc_mode,MPCC_ALPHA_BLND_MODE , alpha_blnd_mode,MPCC_ALPHA_MULTIPLIED_MODE , cfg->pre_multiplied_alpha, - MPCC_BLND_ACTIVE_OVERLAP_ONLY, cfg->top_of_tree); + MPCC_BLND_ACTIVE_OVERLAP_ONLY, blend_active_only);if (cfg->top_of_tree) {if (cfg->opp_id !=0xf )
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +1 -1
@@ -465,7 +465,7 @@ static struct transform *dcn10_transform_create(if (!transform)return NULL ; -if (dcn10_transform_construct (transform, ctx, +if (dcn10_transform_construct (transform, ctx, inst, &tf_regs[inst], &tf_shift, &tf_mask))return &transform->base;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.c +8 -5
@@ -171,8 +171,8 @@ static enum dscl_mode_sel get_dscl_mode( && data->format <= PIXEL_FORMAT_VIDEO_END) ycbcr = true; -if (data->format ==PIXEL_FORMAT_420BPP12 || - data->format ==PIXEL_FORMAT_420BPP15 ) +if (data->format ==PIXEL_FORMAT_420BPP8 || + data->format ==PIXEL_FORMAT_420BPP10 ) format420 = true; if (data->ratios.horz.value == one
@@ -579,8 +579,8 @@ static enum lb_memory_config find_lb_memory_config(const struct scaler_data *scl && is_lb_conf_valid(ceil_vratio_c, num_part_c, vtaps_c))return LB_MEMORY_CONFIG_2 ; -if (scl_data->format ==PIXEL_FORMAT_420BPP12 - || scl_data->format ==PIXEL_FORMAT_420BPP15 ) { +if (scl_data->format ==PIXEL_FORMAT_420BPP8 + || scl_data->format ==PIXEL_FORMAT_420BPP10 ) {calc_lb_num_partitions ( scl_data,LB_MEMORY_CONFIG_3 , &num_part_y, &num_part_c);
@@ -675,7 +675,8 @@ static void transform_set_recout(RECOUT_WIDTH , recout->width,/* Number of RECOUT vertical lines */ RECOUT_HEIGHT , recout->height - - xfm->base.ctx->dc->debug.surface_visual_confirm * 2); + - xfm->base.ctx->dc->debug.surface_visual_confirm *4 * + (xfm->base.inst + 1)); } static void transform_set_manual_ratio_init(
@@ -1038,12 +1039,14 @@ static struct transform_funcs dcn10_transform_funcs = {bool dcn10_transform_construct (struct dcn10_transform *xfm,struct dc_context *ctx, +uint32_t inst,const struct dcn_transform_registers *tf_regs,const struct dcn_transform_shift *tf_shift,const struct dcn_transform_mask *tf_mask) { xfm->base.ctx = ctx; + xfm->base.inst = inst; xfm->base.funcs = &dcn10_transform_funcs; xfm->tf_regs = tf_regs;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.h +1 -0
@@ -413,6 +413,7 @@ struct dcn10_transform {bool dcn10_transform_construct (struct dcn10_transform *xfm110,struct dc_context *ctx, +uint32_t inst,const struct dcn_transform_registers *tf_regs,const struct dcn_transform_shift *tf_shift,const struct dcn_transform_mask *tf_mask);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 44/81 drm/amd/display: get dal1.1 to run
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h | 2 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +1 -1
@@ -275,7 +275,7 @@ struct dce_hwseq_registers {#if defined(CONFIG_DRM_AMD_DC_DCN1_0 )#define HWSEQ_DCN_MASK_SH_LIST (mask_sh)\ HWSEQ_PIXEL_RATE_MASK_SH_LIST(mask_sh, OTG0_),\ - HWSEQ_PHYPLL_MASK_SH_LIST(mask_sh, OTG0_),\ + HWS_SF1(OTG0_, PHYPLL_PIXEL_RATE_CNTL, PHYPLL_PIXEL_RATE_SOURCE, mask_sh), \ HWS_SF(OTG0_, OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_EVENT_CLEAR, mask_sh), \ HWS_SF(OTG0_, OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_EVENT_OCCURRED, mask_sh), \ HWS_SF(HUBP0_, DCHUBP_CNTL, HUBP_NO_OUTSTANDING_REQ, mask_sh), \
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c +1 -1
@@ -784,7 +784,7 @@ static void oppn10_program_color_matrix(struct dcn10_opp *oppn10, } } -void oppn10_set_output_csc_adjustment ( +static void oppn10_set_output_csc_adjustment (struct output_pixel_processor *opp,const struct out_csc_color_matrix *tbl_entry) {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 45/81 drm/amd/display: minor dcn10_hwseq clean up/refactor
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 49 ++++++---------------- 1 file changed, 12 insertions(+), 37 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +12 -37
@@ -53,15 +53,6 @@#define FN (reg_name, field_name) \ hws->shifts->field_name, hws->masks->field_name -static void disable_clocks ( -struct dce_hwseq *hws, -uint8_t plane_id) -{ -REG_UPDATE (HUBP_CLK_CNTL [plane_id],HUBP_CLOCK_ENABLE ,0 ); - -REG_UPDATE (DPP_CONTROL [plane_id],DPP_CLOCK_ENABLE ,0 ); -} - static void enable_dppclk( struct dce_hwseq *hws, uint8_t plane_id,
@@ -214,25 +205,6 @@ static void power_on_plane( "Un-gated front end for pipe %d\n", plane_id); } -/* fully check bios enabledisplaypowergating table. dal only need dce init -* other power, clock gate register will be handle by dal itself. -* further may be put within init_hw -*/ -static bool dcn10_enable_display_power_gating ( -struct core_dc *dc, -uint8_t controller_id, -struct dc_bios *dcb, -enum pipe_gating_control power_gating) -{ -/* TODOFPGA */ -#if 0 -if (power_gating !=PIPE_GATING_CONTROL_ENABLE ) -dce110_init_pte (ctx); -#endif - -return true; -} -static void bios_golden_init (struct core_dc *dc) {struct dc_bios *bp = dc->ctx->dc_bios;
@@ -525,7 +497,8 @@ static void reset_front_end( mpcc->funcs->wait_for_idle (mpcc); mi->funcs->set_blank (mi, true);REG_WAIT (DCHUBP_CNTL [fe_idx],HUBP_NO_OUTSTANDING_REQ ,1 ,20000 ,200000 ); -disable_clocks (dc->hwseq, fe_idx); +REG_UPDATE (HUBP_CLK_CNTL [fe_idx],HUBP_CLOCK_ENABLE ,0 ); +REG_UPDATE (DPP_CONTROL [fe_idx],DPP_CLOCK_ENABLE ,0 ); xfm->funcs->transform_reset (xfm);
@@ -1803,8 +1776,8 @@ static void set_plane_config(program_gamut_remap (pipe_ctx); } -static void dcn10_config_stereo_parameters (struct core_stream *stream,\ -struct crtc_stereo_flags *flags) +static void dcn10_config_stereo_parameters ( +struct core_stream *stream,struct crtc_stereo_flags *flags) {enum view_3d_format view_format = stream->public.view_format; enum dc_timing_3d_format timing_3d_format =\
@@ -1840,8 +1813,7 @@ static void dcn10_config_stereo_parameters(struct core_stream *stream,\return ; } -static void dcn10_setup_stereo (struct pipe_ctx *pipe_ctx, -struct core_dc *dc) +static void dcn10_setup_stereo (struct pipe_ctx *pipe_ctx,struct core_dc *dc) {struct crtc_stereo_flags flags = {0 };struct core_stream *stream = pipe_ctx->stream;
@@ -1858,11 +1830,15 @@ static void dcn10_setup_stereo(struct pipe_ctx *pipe_ctx, &stream->public.timing, &flags); - -return ; } +static bool dcn10_dummy_display_power_gating ( +struct core_dc *dc, +uint8_t controller_id, +struct dc_bios *dcb, +enum pipe_gating_control power_gating) {return true; } +static const struct hw_sequencer_funcs dcn10_funcs = { .program_gamut_remap = program_gamut_remap, .program_csc_matrix = program_csc_matrix,
@@ -1881,8 +1857,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = { .enable_stream = dce110_enable_stream, .disable_stream = dce110_disable_stream, .unblank_stream = dce110_unblank_stream, - .enable_display_pipe_clock_gating = NULL, /* TODOFPGA */ - .enable_display_power_gating = dcn10_enable_display_power_gating, + .enable_display_power_gating = dcn10_dummy_display_power_gating, .power_down_front_end = dcn10_power_down_fe, .power_on_front_end = dcn10_power_on_fe, .pipe_control_lock = dcn10_pipe_control_lock,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 46/81 drm/amd/display: dal1.1 opp prog update
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.h +3 -3
@@ -138,10 +138,11 @@OPP_SF (FMT0_FMT_BIT_DEPTH_CONTROL ,FMT_RGB_RANDOM_ENABLE , mask_sh), \OPP_SF (FMT0_FMT_CONTROL ,FMT_SPATIAL_DITHER_FRAME_COUNTER_MAX , mask_sh), \OPP_SF (FMT0_FMT_CONTROL ,FMT_SPATIAL_DITHER_FRAME_COUNTER_BIT_SWAP , mask_sh), \ +OPP_SF (FMT0_FMT_CONTROL ,FMT_PIXEL_ENCODING , mask_sh), \ +OPP_SF (FMT0_FMT_CONTROL ,FMT_STEREOSYNC_OVERRIDE , mask_sh), \OPP_SF (FMT0_FMT_DITHER_RAND_R_SEED ,FMT_RAND_R_SEED , mask_sh), \OPP_SF (FMT0_FMT_DITHER_RAND_G_SEED ,FMT_RAND_G_SEED , mask_sh), \OPP_SF (FMT0_FMT_DITHER_RAND_B_SEED ,FMT_RAND_B_SEED , mask_sh), \ -OPP_SF (FMT0_FMT_CONTROL ,FMT_PIXEL_ENCODING , mask_sh), \OPP_SF (FMT0_FMT_CLAMP_CNTL ,FMT_CLAMP_DATA_EN , mask_sh), \OPP_SF (FMT0_FMT_CLAMP_CNTL ,FMT_CLAMP_COLOR_FORMAT , mask_sh), \ OPP_SF(FMT0_FMT_DYNAMIC_EXP_CNTL, FMT_DYNAMIC_EXP_EN, mask_sh), \
@@ -353,8 +354,7 @@OPP_SF (CM0_CM_RGAM_LUT_WRITE_EN_MASK ,CM_RGAM_LUT_WRITE_SEL , mask_sh), \OPP_SF (CM0_CM_RGAM_LUT_INDEX ,CM_RGAM_LUT_INDEX , mask_sh), \OPP_SF (CM0_CM_MEM_PWR_CTRL ,RGAM_MEM_PWR_FORCE , mask_sh), \ -OPP_SF (CM0_CM_RGAM_LUT_DATA ,CM_RGAM_LUT_DATA , mask_sh), \ - OPP_SF(FMT0_FMT_CONTROL, FMT_STEREOSYNC_OVERRIDE, mask_sh) + OPP_SF(CM0_CM_RGAM_LUT_DATA, CM_RGAM_LUT_DATA, mask_sh)#define OPP_DCN10_REG_FIELD_LIST (type) \ type CM_OCSC_C11; \
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 47/81 drm/amd/display: dal1.1 ipp prog update
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c | 99 +++++++++++------------- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.h | 1 + 2 files changed, 48 insertions(+), 52 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c +47 -52
@@ -69,7 +69,7 @@ enum dcn10_input_csc_select { INPUT_CSC_SELECT_COMA }; -static void dcn10_program_input_csc ( +static void ippn10_program_input_csc (struct input_pixel_processor *ipp,enum dc_color_space color_space,enum dcn10_input_csc_select select)
@@ -159,7 +159,7 @@ static void dcn10_program_input_csc( }/*program de gamma RAM B*/ -static void dcn10_ipp_program_degamma_lutb_settings ( +static void ippn10_program_degamma_lutb_settings (struct input_pixel_processor *ipp,const struct pwl_params *params) {
@@ -266,7 +266,7 @@ static void dcn10_ipp_program_degamma_lutb_settings( }/*program de gamma RAM A*/ -static void dcn10_ipp_program_degamma_luta_settings ( +static void ippn10_program_degamma_luta_settings (struct input_pixel_processor *ipp,const struct pwl_params *params) {
@@ -372,7 +372,7 @@ static void dcn10_ipp_program_degamma_luta_settings( CM_DGAM_RAMA_EXP_REGION15_NUM_SEGMENTS, curve[1].segments_num); } -static void ipp_power_on_degamma_lut ( +static void ippn10_power_on_degamma_lut (struct input_pixel_processor *ipp,bool power_on) {
@@ -383,7 +383,7 @@ static void ipp_power_on_degamma_lut( } -static void ipp_program_degamma_lut( +static void ippn10_program_degamma_lut( struct input_pixel_processor *ipp, const struct pwl_result_data *rgb, uint32_t num,
@@ -410,25 +410,19 @@ static void ipp_program_degamma_lut( CM_DGAM_LUT_DATA, rgb[i].delta_green_reg);REG_SET (CM_DGAM_LUT_DATA ,0 ,CM_DGAM_LUT_DATA , rgb[i].delta_blue_reg); - } - } -static void dcn10_ipp_enable_cm_block ( +static void ippn10_enable_cm_block (struct input_pixel_processor *ipp) {struct dcn10_ipp *ippn10 =TO_DCN10_IPP (ipp);REG_UPDATE (DPP_CONTROL ,DPP_CLOCK_ENABLE ,1 ); -if (ippn10->ipp_mask->CM_BYPASS_EN) -REG_UPDATE (CM_CONTROL ,CM_BYPASS_EN ,0 ); -else -REG_UPDATE (CM_CONTROL ,CM_BYPASS ,0 ); +REG_UPDATE (CM_CONTROL ,CM_BYPASS_EN ,0 ); } - -static void dcn10_ipp_full_bypass (struct input_pixel_processor *ipp) +static void ippn10_full_bypass (struct input_pixel_processor *ipp) {struct dcn10_ipp *ippn10 =TO_DCN10_IPP (ipp);
@@ -450,12 +444,12 @@ static void dcn10_ipp_full_bypass(struct input_pixel_processor *ipp)REG_SET (CM_IGAM_CONTROL ,0 ,CM_IGAM_LUT_MODE ,0 ); } -static void dcn10_ipp_set_degamma ( +static void ippn10_set_degamma (struct input_pixel_processor *ipp,enum ipp_degamma_mode mode) {struct dcn10_ipp *ippn10 =TO_DCN10_IPP (ipp); -dcn10_ipp_enable_cm_block (ipp); +ippn10_enable_cm_block (ipp);switch (mode) {case IPP_DEGAMMA_MODE_BYPASS :
@@ -474,7 +468,7 @@ static void dcn10_ipp_set_degamma( } } -static bool dcn10_cursor_program_control ( +static bool ippn10_cursor_program_control (struct dcn10_ipp *ippn10,bool pixel_data_invert,enum dc_cursor_color_format color_format)
@@ -520,7 +514,7 @@ enum cursor_lines_per_chunk { CURSOR_LINE_PER_CHUNK_16 }; -static enum cursor_pitch dcn10_get_cursor_pitch ( +static enum cursor_pitch ippn10_get_cursor_pitch (unsigned int pitch) {enum cursor_pitch hw_pitch;
@@ -544,7 +538,7 @@ static enum cursor_pitch dcn10_get_cursor_pitch(return hw_pitch; } -static enum cursor_lines_per_chunk dcn10_get_lines_per_chunk ( +static enum cursor_lines_per_chunk ippn10_get_lines_per_chunk (unsigned int cur_width,enum dc_cursor_color_format format) {
@@ -565,13 +559,13 @@ static enum cursor_lines_per_chunk dcn10_get_lines_per_chunk(return line_per_chunk; } -static void dcn10_cursor_set_attributes ( +static void ippn10_cursor_set_attributes (struct input_pixel_processor *ipp,const struct dc_cursor_attributes *attr) {struct dcn10_ipp *ippn10 =TO_DCN10_IPP (ipp); -enum cursor_pitch hw_pitch =dcn10_get_cursor_pitch (attr->pitch); -enum cursor_lines_per_chunk lpc =dcn10_get_lines_per_chunk ( +enum cursor_pitch hw_pitch =ippn10_get_cursor_pitch (attr->pitch); +enum cursor_lines_per_chunk lpc =ippn10_get_lines_per_chunk ( attr->width, attr->color_format); ippn10->curs_attr = *attr;
@@ -590,12 +584,12 @@ static void dcn10_cursor_set_attributes(CURSOR_PITCH , hw_pitch, CURSOR_LINES_PER_CHUNK, lpc); -dcn10_cursor_program_control (ippn10, +ippn10_cursor_program_control (ippn10, attr->attribute_flags.bits.INVERT_PIXEL_DATA, attr->color_format); } -static void dcn10_cursor_set_position ( +static void ippn10_cursor_set_position (struct input_pixel_processor *ipp,const struct dc_cursor_position *pos,const struct dc_cursor_mi_param *param)
@@ -632,7 +626,7 @@ static void dcn10_cursor_set_position( cur_en =0 ;/* not visible beyond left edge*/ if (cur_en &®_READ (CURSOR_SURFACE_ADDRESS ) ==0 ) -dcn10_cursor_set_attributes (ipp, &ippn10->curs_attr); +ippn10_cursor_set_attributes (ipp, &ippn10->curs_attr);REG_UPDATE (CURSOR_CONTROL ,CURSOR_ENABLE , cur_en); REG_UPDATE(CURSOR0_CONTROL,
@@ -658,7 +652,7 @@ enum pixel_format_description { }; -static void dcn10_setup_format_flags (enum surface_pixel_format input_format,\ +static void ippn10_setup_format_flags (enum surface_pixel_format input_format,\enum pixel_format_description *fmt) {
@@ -671,7 +665,7 @@ static void dcn10_setup_format_flags(enum surface_pixel_format input_format,\ *fmt =PIXEL_FORMAT_FIXED ; } -static void dcn10_ipp_set_degamma_format_float (struct input_pixel_processor *ipp, +static void ippn10_set_degamma_format_float (struct input_pixel_processor *ipp,bool is_float) {struct dcn10_ipp *ippn10 =TO_DCN10_IPP (ipp);
@@ -686,7 +680,7 @@ static void dcn10_ipp_set_degamma_format_float(struct input_pixel_processor *ipp } -static void dcn10_ipp_cnv_setup ( +static void ippn10_cnv_setup ( struct input_pixel_processor *ipp, enum surface_pixel_format input_format, enum expansion_mode mode,
@@ -701,7 +695,7 @@ static void dcn10_ipp_cnv_setup (struct dcn10_ipp *ippn10 =TO_DCN10_IPP (ipp);bool force_disable_cursor = false; -dcn10_setup_format_flags (input_format, &fmt); +ippn10_setup_format_flags (input_format, &fmt); alpha_en =1 ; pixel_format =0 ; color_space =COLOR_SPACE_SRGB ;
@@ -729,7 +723,7 @@ static void dcn10_ipp_cnv_setup (break ; } -dcn10_ipp_set_degamma_format_float (ipp, is_float); +ippn10_set_degamma_format_float (ipp, is_float);switch (input_format) {case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555 :
@@ -787,7 +781,7 @@ static void dcn10_ipp_cnv_setup ( CNVC_SURFACE_PIXEL_FORMAT, pixel_format);REG_UPDATE (FORMAT_CONTROL ,ALPHA_EN , alpha_en); -dcn10_program_input_csc (ipp, color_space, select); +ippn10_program_input_csc (ipp, color_space, select);if (force_disable_cursor) { REG_UPDATE(CURSOR_CONTROL,
@@ -798,7 +792,7 @@ static void dcn10_ipp_cnv_setup ( } -static bool dcn10_degamma_ram_inuse (struct input_pixel_processor *ipp, +static bool ippn10_degamma_ram_inuse (struct input_pixel_processor *ipp,bool *ram_a_inuse) {bool ret = false;
@@ -818,7 +812,7 @@ static bool dcn10_degamma_ram_inuse(struct input_pixel_processor *ipp,return ret; } -static bool dcn10_ingamma_ram_inuse (struct input_pixel_processor *ipp, +static bool ippn10_ingamma_ram_inuse (struct input_pixel_processor *ipp,bool *ram_a_inuse) {bool in_use = false;
@@ -840,7 +834,7 @@ static bool dcn10_ingamma_ram_inuse(struct input_pixel_processor *ipp,return in_use; } -static void dcn10_degamma_ram_select (struct input_pixel_processor *ipp, +static void ippn10_degamma_ram_select (struct input_pixel_processor *ipp,bool use_ram_a) {struct dcn10_ipp *ippn10 =TO_DCN10_IPP (ipp);
@@ -852,22 +846,22 @@ static void dcn10_degamma_ram_select(struct input_pixel_processor *ipp, } -static void dcn10_ipp_set_degamma_pwl (struct input_pixel_processor *ipp, +static void ippn10_set_degamma_pwl (struct input_pixel_processor *ipp,const struct pwl_params *params) {bool is_ram_a = true; -ipp_power_on_degamma_lut (ipp, true); -dcn10_ipp_enable_cm_block (ipp); -dcn10_degamma_ram_inuse (ipp, &is_ram_a); +ippn10_power_on_degamma_lut (ipp, true); +ippn10_enable_cm_block (ipp); +ippn10_degamma_ram_inuse (ipp, &is_ram_a);if (is_ram_a == true) -dcn10_ipp_program_degamma_lutb_settings (ipp, params); +ippn10_program_degamma_lutb_settings (ipp, params);else -dcn10_ipp_program_degamma_luta_settings (ipp, params); +ippn10_program_degamma_luta_settings (ipp, params); -ipp_program_degamma_lut (ipp, params->rgb_resulted, +ippn10_program_degamma_lut (ipp, params->rgb_resulted, params->hw_points_num, !is_ram_a); -dcn10_degamma_ram_select (ipp, !is_ram_a); +ippn10_degamma_ram_select (ipp, !is_ram_a); }/*
@@ -879,7 +873,7 @@ static void dcn10_ipp_set_degamma_pwl(struct input_pixel_processor *ipp,* In the future, this function should support additional input gamma methods, * such as piecewise linear mapping, and input gamma bypass. */ -void dcn10_ipp_program_input_lut ( +static void ippn10_program_input_lut (struct input_pixel_processor *ipp,const struct dc_gamma *gamma) {
@@ -889,9 +883,9 @@ void dcn10_ipp_program_input_lut(uint32_t ram_num;// Power on LUT memory. REG_SET (CM_MEM_PWR_CTRL ,0 ,SHARED_MEM_PWR_DIS ,1 ); -dcn10_ipp_enable_cm_block (ipp); +ippn10_enable_cm_block (ipp);// Determine whether to use RAM A or RAM B -dcn10_ingamma_ram_inuse (ipp, &rama_occupied); +ippn10_ingamma_ram_inuse (ipp, &rama_occupied);if (!rama_occupied)REG_UPDATE (CM_IGAM_LUT_RW_CONTROL ,CM_IGAM_LUT_SEL ,0 );else
@@ -936,13 +930,13 @@ static void dcn10_ipp_destroy(struct input_pixel_processor **ipp) }static const struct ipp_funcs dcn10_ipp_funcs = { - .ipp_cursor_set_attributes = dcn10_cursor_set_attributes, - .ipp_cursor_set_position = dcn10_cursor_set_position, - .ipp_set_degamma = dcn10_ipp_set_degamma, - .ipp_program_input_lut = dcn10_ipp_program_input_lut, - .ipp_full_bypass = dcn10_ipp_full_bypass, - .ipp_setup = dcn10_ipp_cnv_setup, - .ipp_program_degamma_pwl = dcn10_ipp_set_degamma_pwl, + .ipp_cursor_set_attributes = ippn10_cursor_set_attributes, + .ipp_cursor_set_position = ippn10_cursor_set_position, + .ipp_set_degamma = ippn10_set_degamma, + .ipp_program_input_lut = ippn10_program_input_lut, + .ipp_full_bypass = ippn10_full_bypass, + .ipp_setup = ippn10_cnv_setup, + .ipp_program_degamma_pwl = ippn10_set_degamma_pwl, .ipp_destroy = dcn10_ipp_destroy };
@@ -962,3 +956,4 @@ void dcn10_ipp_construct( ippn10->ipp_shift = ipp_shift; ippn10->ipp_mask = ipp_mask; } +
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.h +1 -0
@@ -292,6 +292,7 @@ IPP_SF(CNVC_CFG0_FORMAT_CONTROL, OUTPUT_FP, mask_sh)#define IPP_DCN10_REG_FIELD_LIST (type) \ + type CM_DGAM_CONFIG_STATUS; \ type CM_ICSC_MODE; \ type CM_ICSC_C11; \ type CM_ICSC_C12; \
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 48/81 drm/amd/display: dal1.1 xfm prog update
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_transform.c | 10 ++--- .../gpu/drm/amd/display/dc/dcn10/dcn10_transform.h | 43 +++++++++++----------- 2 files changed, 27 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.c +5 -5
@@ -212,7 +212,7 @@ static int get_pixel_depth_val(enum lb_pixel_depth depth) } } -static void transform_set_lb ( +static void xfmn10_set_lb (struct dcn10_transform *xfm,const struct line_buffer_params *lb_params,enum lb_memory_config mem_size_config)
@@ -622,7 +622,7 @@ void transform_set_scaler_auto_scale(return ; lb_config =find_lb_memory_config (scl_data); -transform_set_lb (xfm, &scl_data->lb_params, lb_config); +xfmn10_set_lb (xfm, &scl_data->lb_params, lb_config);if (dscl_mode ==DSCL_MODE_SCALING_444_BYPASS )return ;
@@ -738,7 +738,7 @@ static void transform_set_manual_ratio_init( }/* Main function to program scaler and line buffer in manual scaling mode */ -static void transform_set_scaler_manual_scale ( +static void xfmn10_set_scaler_manual_scale (struct transform *xfm_base,const struct scaler_data *scl_data) {
@@ -769,7 +769,7 @@ static void transform_set_scaler_manual_scale(return ;/* LB */ lb_config =find_lb_memory_config (scl_data); -transform_set_lb (xfm, &scl_data->lb_params, lb_config); +xfmn10_set_lb (xfm, &scl_data->lb_params, lb_config);if (dscl_mode ==DSCL_MODE_SCALING_444_BYPASS )return ;
@@ -1027,7 +1027,7 @@ static void dcn_transform_set_gamut_remap(static struct transform_funcs dcn10_transform_funcs = { .transform_reset = transform_reset, - .transform_set_scaler = transform_set_scaler_manual_scale, + .transform_set_scaler = xfmn10_set_scaler_manual_scale, .transform_get_optimal_number_of_taps = transform_get_optimal_number_of_taps, .transform_set_gamut_remap = dcn_transform_set_gamut_remap, };
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.h +22 -21
76 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 49/81 drm/amd/display: dal1.1 hwseq prog update
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +4 -8
@@ -64,17 +64,13 @@ static void enable_dppclk( plane_id, dppclk_div); -if (dppclk_div) { -/* 1/2 DISPCLK*/ +if (hws->shifts->DPPCLK_RATE_CONTROL)REG_UPDATE_2 (DPP_CONTROL [plane_id], -DPPCLK_RATE_CONTROL ,1 , +DPPCLK_RATE_CONTROL , dppclk_div,DPP_CLOCK_ENABLE ,1 ); - }else { -/* DISPCLK */ -REG_UPDATE_2 (DPP_CONTROL [plane_id], -DPPCLK_RATE_CONTROL ,0 , +else +REG_UPDATE (DPP_CONTROL [plane_id],DPP_CLOCK_ENABLE ,1 ); - } } static void enable_power_gating_plane(
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 50/81 drm/amd/display: Fix context copy memory leak
In reply to a message not in the archiveFrom: Corbin McElhanney <[email protected]>
This change corrects an error introduced in 355f123f. Instead of using the copy constructor to assign the new context, we swap the pointer.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -4
@@ -972,7 +972,9 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *cdc_enable_stereo (dc, context, dc_streams, context->stream_count); -dc_resource_validate_ctx_copy_construct (context, core_dc->current_context); +dc_resource_validate_ctx_destruct (core_dc->current_context); +dm_free (core_dc->current_context); + core_dc->current_context = context;return (result ==DC_OK ); }
@@ -1057,9 +1059,6 @@ bool dc_commit_streams( result =dc_commit_context_no_check (dc, context); -dc_resource_validate_ctx_destruct (context); -dm_free (context); -return (result ==DC_OK ); fail:
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 51/81 drm/amd/display: Leave all validate_ctx life cycle management to DC.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Follow DC fix.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 --------------- 1 file changed, 15 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -15
@@ -653,27 +653,12 @@ dm_atomic_state_alloc(struct drm_device *dev)return &state->base; } - -void dm_atomic_state_clear (struct drm_atomic_state *state) -{ -struct dm_atomic_state *dm_state =to_dm_atomic_state (state); - -if (dm_state->context) { -dc_resource_validate_ctx_destruct (dm_state->context); -dm_free (dm_state->context); - dm_state->context =NULL ; - } - -drm_atomic_state_default_clear (state); -} -static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { .fb_create = amdgpu_user_framebuffer_create, .output_poll_changed = amdgpu_output_poll_changed, .atomic_check = amdgpu_dm_atomic_check, .atomic_commit = amdgpu_dm_atomic_commit, .atomic_state_alloc = dm_atomic_state_alloc, - .atomic_state_clear = dm_atomic_state_clear, };static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 52/81 drm/amd/display: Clean dm_plane_state hooks.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
New surface is created in check only, in duplicate we just reference exsisting surface and in destroy we release it.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 43 +++------------------- 1 file changed, 6 insertions(+), 37 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +6 -37
@@ -1575,7 +1575,6 @@ const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs = {static void dm_drm_plane_reset (struct drm_plane *plane) {struct dm_plane_state *amdgpu_state =NULL ; -struct amdgpu_device *adev = plane->dev->dev_private;if (plane->state) plane->funcs->atomic_destroy_state (plane, plane->state);
@@ -1586,9 +1585,6 @@ static void dm_drm_plane_reset(struct drm_plane *plane) plane->state = &amdgpu_state->base; plane->state->plane = plane; plane->state->rotation =DRM_ROTATE_0 ; - - amdgpu_state->dc_surface =dc_create_surface (adev->dm.dc); -WARN_ON (!amdgpu_state->dc_surface); }else WARN_ON (1 );
@@ -1598,35 +1594,17 @@ static struct drm_plane_state * dm_drm_plane_duplicate_state(struct drm_plane *plane) {struct dm_plane_state *dm_plane_state, *old_dm_plane_state; -struct amdgpu_device *adev = plane->dev->dev_private; old_dm_plane_state =to_dm_plane_state (plane->state); dm_plane_state =kzalloc (sizeof (*dm_plane_state),GFP_KERNEL );if (!dm_plane_state)return NULL ; -if (old_dm_plane_state->dc_surface) { -struct dc_surface *dc_surface =dc_create_surface (adev->dm.dc); -if (WARN_ON (!dc_surface)) -return NULL ; - -__drm_atomic_helper_plane_duplicate_state (plane, &dm_plane_state->base); - -memcpy (dc_surface, old_dm_plane_state->dc_surface,sizeof (*dc_surface)); +__drm_atomic_helper_plane_duplicate_state (plane, &dm_plane_state->base); -if (old_dm_plane_state->dc_surface->gamma_correction) -dc_gamma_retain (dc_surface->gamma_correction); - -if (old_dm_plane_state->dc_surface->in_transfer_func) -dc_transfer_func_retain (dc_surface->in_transfer_func); - - dm_plane_state->dc_surface = dc_surface; - -/*TODO Check for inferred values to be reset */ - } -else { -WARN_ON (1 ); -return NULL ; +if (old_dm_plane_state->dc_surface) { + dm_plane_state->dc_surface = old_dm_plane_state->dc_surface; +dc_surface_retain (dm_plane_state->dc_surface); }return &dm_plane_state->base;
@@ -1637,17 +1615,8 @@ void dm_drm_plane_destroy_state(struct drm_plane *plane, {struct dm_plane_state *dm_plane_state =to_dm_plane_state (state); -if (dm_plane_state->dc_surface) { -struct dc_surface *dc_surface = dm_plane_state->dc_surface; - -if (dc_surface->gamma_correction) -dc_gamma_release (&dc_surface->gamma_correction); - -if (dc_surface->in_transfer_func) -dc_transfer_func_release (dc_surface->in_transfer_func); - -dc_surface_release (dc_surface); - } +if (dm_plane_state->dc_surface) +dc_surface_release (dm_plane_state->dc_surface);__drm_atomic_helper_plane_destroy_state (state);kfree (dm_plane_state);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 53/81 drm/amd/display: Attach surface to dm_plane_state.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Attach surface to state.
Remove Create surface from commit.
Propogate any surface creation and initialization error back to atomic_check caller. clean outdated code in check and commit.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 348 +++++++++------------ .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h | 2 +- 2 files changed, 147 insertions(+), 203 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +146 -202
@@ -300,16 +300,16 @@ static bool fill_rects_from_plane_state(return true; } -static bool get_fb_info ( +static int get_fb_info (const struct amdgpu_framebuffer *amdgpu_fb,uint64_t *tiling_flags,uint64_t *fb_location) {struct amdgpu_bo *rbo =gem_to_amdgpu_bo (amdgpu_fb->obj);int r =amdgpu_bo_reserve (rbo, false); -if (unlikely (r !=0 )){ +if (unlikely (r)) {DRM_ERROR ("Unable to reserve buffer\n" ); -return false; +return r; }if (fb_location)
@@ -320,9 +320,10 @@ static bool get_fb_info(amdgpu_bo_unreserve (rbo); -return true; +return r; } -static void fill_plane_attributes_from_fb ( + +static int fill_plane_attributes_from_fb (struct amdgpu_device *adev,struct dc_surface *surface,const struct amdgpu_framebuffer *amdgpu_fb,bool addReq)
@@ -331,13 +332,16 @@ static void fill_plane_attributes_from_fb(uint64_t fb_location =0 ;unsigned int awidth;const struct drm_framebuffer *fb = &amdgpu_fb->base; +int ret =0 ;struct drm_format_name_buf format_name; -get_fb_info ( + ret =get_fb_info ( amdgpu_fb, &tiling_flags, addReq == true ? &fb_location:NULL ); +if (ret) +return ret;switch (fb->format->format) {case DRM_FORMAT_C8 :
@@ -367,7 +371,7 @@ static void fill_plane_attributes_from_fb(default :DRM_ERROR ("Unsupported screen format %s\n" ,drm_get_format_name (fb->format->format, &format_name)); -return ; +return -EINVAL ; }if (surface->format <SURFACE_PIXEL_FORMAT_VIDEO_BEGIN ) {
@@ -468,23 +472,26 @@ static void fill_plane_attributes_from_fb( surface->scaling_quality.v_taps =0 ; surface->stereo_format =PLANE_STEREO_FORMAT_NONE ; +return ret; + }#define NUM_OF_RAW_GAMMA_RAMP_RGB_256 256 -static void fill_gamma_from_crtc ( -const struct drm_crtc *crtc, +static void fill_gamma_from_crtc_state ( +const struct drm_crtc_state *crtc_state,struct dc_surface *dc_surface) {int i;struct dc_gamma *gamma; -struct drm_crtc_state *state = crtc->state; -struct drm_color_lut *lut = (struct drm_color_lut *) state->gamma_lut->data; +struct drm_color_lut *lut = (struct drm_color_lut *) crtc_state->gamma_lut->data; gamma =dc_create_gamma (); -if (gamma ==NULL ) +if (gamma ==NULL ) { +WARN_ON (1 );return ; + }for (i =0 ; i <NUM_OF_RAW_GAMMA_RAMP_RGB_256 ; i++) { gamma->red[i] = lut[i].red;
@@ -495,27 +502,35 @@ static void fill_gamma_from_crtc( dc_surface->gamma_correction = gamma; } -static void fill_plane_attributes ( +static int fill_plane_attributes (struct amdgpu_device *adev,struct dc_surface *surface, -struct drm_plane_state *state,bool addrReq) +struct drm_plane_state *plane_state, +struct drm_crtc_state *crtc_state, +bool addrReq) {const struct amdgpu_framebuffer *amdgpu_fb = -to_amdgpu_framebuffer (state->fb); -const struct drm_crtc *crtc = state->crtc; +to_amdgpu_framebuffer (plane_state->fb); +const struct drm_crtc *crtc = plane_state->crtc;struct dc_transfer_func *input_tf; +int ret =0 ; -fill_rects_from_plane_state (state, surface); -fill_plane_attributes_from_fb ( +if (!fill_rects_from_plane_state (plane_state, surface)) +return -EINVAL ; + + ret =fill_plane_attributes_from_fb ( crtc->dev->dev_private, surface, amdgpu_fb, addrReq); +if (ret) +return ret; + input_tf =dc_create_transfer_func ();if (input_tf ==NULL ) -return ; +return -ENOMEM ; input_tf->type =TF_TYPE_PREDEFINED ; input_tf->tf =TRANSFER_FUNCTION_SRGB ;
@@ -523,9 +538,10 @@ static void fill_plane_attributes( surface->in_transfer_func = input_tf;/* In case of gamma set, update gamma value */ -if (state->crtc->state->gamma_lut) { -fill_gamma_from_crtc (crtc, surface); - } +if (crtc_state->gamma_lut) +fill_gamma_from_crtc_state (crtc_state, surface); + +return ret; }/*****************************************************************************/
@@ -608,57 +624,6 @@ static void update_stream_scaling_settings( } -static void add_surface (struct dc *dc, -struct drm_crtc *crtc, -struct drm_plane *plane, -const struct dc_surface **dc_surfaces) -{ -struct dc_surface *dc_surface; -struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc); -struct dm_crtc_state *acrtc_state =to_dm_crtc_state (crtc->state); -const struct dc_stream *dc_stream = acrtc_state->stream; -unsigned long flags; - -spin_lock_irqsave (&crtc->dev->event_lock, flags); -if (acrtc->pflip_status !=AMDGPU_FLIP_NONE ) { -DRM_ERROR ("add_surface: acrtc %d, already busy\n" , - acrtc->crtc_id); -spin_unlock_irqrestore (&crtc->dev->event_lock, flags); -/* In comit tail framework this cannot happen */ -BUG_ON (0 ); - } -spin_unlock_irqrestore (&crtc->dev->event_lock, flags); - -if (!dc_stream) { -dm_error ( -"%s: Failed to obtain stream on crtc (%d)!\n" , - __func__, - acrtc->crtc_id); - goto fail; - } - - dc_surface =dc_create_surface (dc); - -if (!dc_surface) { -dm_error ( -"%s: Failed to create a surface!\n" , - __func__); - goto fail; - } - -/* Surface programming */ -fill_plane_attributes ( - crtc->dev->dev_private, - dc_surface, - plane->state, - true); - - *dc_surfaces = dc_surface; - -fail: -return ; -} -static enum dc_color_depth convert_color_depth_from_display_info (const struct drm_connector *connector) {
@@ -1602,9 +1567,9 @@ dm_drm_plane_duplicate_state(struct drm_plane *plane)__drm_atomic_helper_plane_duplicate_state (plane, &dm_plane_state->base); -if (old_dm_plane_state->dc_surface) { - dm_plane_state->dc_surface = old_dm_plane_state->dc_surface; -dc_surface_retain (dm_plane_state->dc_surface); +if (old_dm_plane_state->surface) { + dm_plane_state->surface = old_dm_plane_state->surface; +dc_surface_retain (dm_plane_state->surface); }return &dm_plane_state->base;
@@ -1615,8 +1580,8 @@ void dm_drm_plane_destroy_state(struct drm_plane *plane, {struct dm_plane_state *dm_plane_state =to_dm_plane_state (state); -if (dm_plane_state->dc_surface) -dc_surface_release (dm_plane_state->dc_surface); +if (dm_plane_state->surface) +dc_surface_release (dm_plane_state->surface);__drm_atomic_helper_plane_destroy_state (state);kfree (dm_plane_state);
@@ -1640,6 +1605,11 @@ static int dm_plane_helper_prepare_fb(struct drm_gem_object *obj;struct amdgpu_bo *rbo;int r; +struct dm_plane_state *dm_plane_state_new, *dm_plane_state_old; +unsigned int awidth; + + dm_plane_state_old =to_dm_plane_state (plane->state); + dm_plane_state_new =to_dm_plane_state (new_state);if (!new_state->fb) {DRM_DEBUG_KMS ("No FB bound\n" );
@@ -1656,6 +1626,7 @@ static int dm_plane_helper_prepare_fb( r =amdgpu_bo_pin (rbo,AMDGPU_GEM_DOMAIN_VRAM , &afb->address); +amdgpu_bo_unreserve (rbo);if (unlikely (r !=0 )) {
@@ -1665,6 +1636,23 @@ static int dm_plane_helper_prepare_fb(amdgpu_bo_ref (rbo); +if (dm_plane_state_new->surface && + dm_plane_state_old->surface != dm_plane_state_new->surface) { +struct dc_surface *surface = dm_plane_state_new->surface; + +if (surface->format <SURFACE_PIXEL_FORMAT_VIDEO_BEGIN ) { + surface->address.grph.addr.low_part =lower_32_bits (afb->address); + surface->address.grph.addr.high_part =upper_32_bits (afb->address); + }else { + awidth =ALIGN (new_state->fb->width,64 ); + surface->address.video_progressive.luma_addr.low_part + =lower_32_bits (afb->address); + surface->address.video_progressive.chroma_addr.low_part + =lower_32_bits (afb->address) + + (awidth * new_state->fb->height); + } + } +/* It's a hack for s3 since in 4.9 kernel filter out cursor buffer * prepare and cleanup in drm_atomic_helper_prepare_planes * and drm_atomic_helper_cleanup_planes because fb doens't in s3.
@@ -2529,59 +2517,43 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,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 ; +unsigned long flags;/* update planes when needed */ for_each_plane_in_state (state, plane, old_plane_state, i) {struct drm_plane_state *plane_state = plane->state;struct drm_crtc *crtc = plane_state->crtc;struct drm_framebuffer *fb = plane_state->fb; -struct drm_connector *connector; -struct dm_connector_state *con_state =NULL ;bool pflip_needed; +struct dm_plane_state *dm_plane_state =to_dm_plane_state (plane_state);if (plane->type ==DRM_PLANE_TYPE_CURSOR ) {handle_cursor_update (plane, old_plane_state);continue ; } -if (!fb || !crtc || pcrtc != crtc || !crtc->state->active) +if (!fb || !crtc || pcrtc != crtc || !crtc->state->active || + (!crtc->state->planes_changed && + !pcrtc->state->color_mgmt_changed))continue ; pflip_needed = !state->allow_modeset; + +spin_lock_irqsave (&crtc->dev->event_lock, flags); +if (acrtc_attach->pflip_status !=AMDGPU_FLIP_NONE ) { +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 */ +WARN_ON (1 ); + } +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); +if (!pflip_needed) { -list_for_each_entry (connector, - &dev->mode_config.connector_list, - head) { -if (connector->state->crtc == crtc) { - con_state =to_dm_connector_state ( - connector->state); -break ; - } - } +WARN_ON (!dm_plane_state->surface); -/* -* This situation happens in the following case: -* we are about to get set mode for connector who's only -* possible crtc (in encoder crtc mask) is used by -* another connector, that is why it will try to -* re-assing crtcs in order to make configuration -* supported. For our implementation we need to make all -* encoders support all crtcs, then this issue will -* never arise again. But to guard code from this issue -* check is left. -* -* Also it should be needed when used with actual -* drm_atomic_commit ioctl in future -*/ -if (!con_state) -continue ; + dc_surfaces_constructed[planes_count] = dm_plane_state->surface; -add_surface (dm->dc, crtc, plane, - &dc_surfaces_constructed[planes_count]); -if (dc_surfaces_constructed[planes_count] ==NULL ) { -dm_error ("%s: Failed to add surface!\n" , __func__); -continue ; - } dc_stream_attach = acrtc_state->stream; planes_count++;
@@ -2628,9 +2600,6 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state, planes_count, dc_stream_attach))dm_error ("%s: Failed to attach surface!\n" , __func__); - -for (i =0 ; i < planes_count; i++) -dc_surface_release (dc_surfaces_constructed[i]); }else {/*TODO BUG Here should go disable planes on CRTC. */
@@ -3014,7 +2983,6 @@ static uint32_t add_val_sets_surface( static uint32_t update_in_val_sets_stream( struct dc_validation_set *val_sets, - struct drm_crtc **crtcs, uint32_t set_count, const struct dc_stream *old_stream, const struct dc_stream *new_stream,
@@ -3029,7 +2997,6 @@ static uint32_t update_in_val_sets_stream( } val_sets[i].stream = new_stream; - crtcs[i] = crtc;if (i == set_count)/* nothing found. add new one to the end */
@@ -3123,10 +3090,8 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,struct drm_plane_state *plane_state;int i, j;int ret; -struct drm_crtc *crtc_set[MAX_STREAMS ] = {0 };struct amdgpu_device *adev = dev->dev_private;struct dc *dc = adev->dm.dc; -bool need_to_validate = false;struct drm_connector *connector;struct drm_connector_state *conn_state;int set_count;
@@ -3142,13 +3107,10 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ret =drm_atomic_helper_check (dev, state);if (ret) { -DRM_ERROR ("Atomic state validation failed with error :%d !\n" , - ret); +DRM_ERROR ("Atomic state validation failed with error :%d !\n" , ret);return ret; } - ret = -EINVAL ; - dm_state =to_dm_atomic_state (state);/* copy existing configuration */
@@ -3160,7 +3122,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,if (old_acrtc_state->stream) {dc_stream_retain (old_acrtc_state->stream); set[set_count].stream = old_acrtc_state->stream; - crtc_set[set_count] = crtc; ++set_count; } }
@@ -3195,8 +3156,11 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,if (aconnector) { conn_state =drm_atomic_get_connector_state (state, &aconnector->base); -if (IS_ERR (conn_state)) -return ret; +if (IS_ERR (conn_state)) { + ret =PTR_ERR_OR_ZERO (conn_state); + goto fail_crtcs; + } + dm_conn_state =to_dm_connector_state (conn_state); }
@@ -3216,17 +3180,16 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,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, - crtc_set, set_count, old_acrtc_state->stream, new_acrtc_state->stream, crtc); - need_to_validate = true; aquire_global_lock = true; }else if (modereset_required (crtc_state)) {
@@ -3254,9 +3217,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ret =drm_atomic_add_affected_planes (state, crtc);if (ret) -return ret; - - ret = -EINVAL ; + goto fail_crtcs; } }
@@ -3281,118 +3242,101 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,if (!is_scaling_state_different (con_new_state, con_old_state))continue ; - need_to_validate = true; aquire_global_lock = true; } -for (i =0 ; i < set_count; i++) { +for_each_crtc_in_state (state, crtc, crtc_state, i) { + new_acrtc_state =to_dm_crtc_state (crtc_state); +for_each_plane_in_state (state, plane, plane_state, j) { -struct drm_crtc *crtc = plane_state->crtc; +struct drm_crtc *plane_crtc = plane_state->crtc;struct drm_framebuffer *fb = plane_state->fb; -struct drm_connector *connector; -struct dm_connector_state *dm_conn_state =NULL ; -struct drm_crtc_state *crtc_state;bool pflip_needed; +struct dm_plane_state *dm_plane_state =to_dm_plane_state (plane_state);/*TODO Implement atomic check for cursor plane */ if (plane->type ==DRM_PLANE_TYPE_CURSOR )continue ; -if (!fb || !crtc || crtc_set[i] != crtc || - !crtc->state->planes_changed || !crtc->state->active) +if (!fb || !plane_crtc || crtc != plane_crtc || + (!crtc_state->planes_changed && + !crtc_state->color_mgmt_changed) || + !crtc_state->active)continue ; +WARN_ON (!new_acrtc_state->stream); - crtc_state =drm_atomic_get_crtc_state (state, crtc); pflip_needed = !state->allow_modeset;if (!pflip_needed) {struct dc_surface *surface; -list_for_each_entry (connector, - &dev->mode_config.connector_list, head) { -if (connector->state->crtc == crtc) { - dm_conn_state =to_dm_connector_state ( - connector->state); -break ; - } - } - -/* -* This situation happens in the following case: -* we are about to get set mode for connector who's only -* possible crtc (in encoder crtc mask) is used by -* another connector, that is why it will try to -* re-assing crtcs in order to make configuration -* supported. For our implementation we need to make all -* encoders support all crtcs, then this issue will -* never arise again. But to guard code from this issue -* check is left. -* -* Also it should be needed when used with actual -* drm_atomic_commit ioctl in future -*/ -if (!dm_conn_state) -continue ; - surface =dc_create_surface (dc); -fill_plane_attributes ( - crtc->dev->dev_private, + + ret =fill_plane_attributes ( + plane_crtc->dev->dev_private, surface, plane_state, + crtc_state, false); +if (ret) + goto fail_planes; + + +if (dm_plane_state->surface) +dc_surface_release (dm_plane_state->surface); + + dm_plane_state->surface = surface;add_val_sets_surface (set, set_count, - set[i].stream, + new_acrtc_state->stream, surface); - need_to_validate = true; aquire_global_lock = true; } } } dm_state->context =dc_get_validate_context (dc, set, set_count); - -if (need_to_validate == false || set_count ==0 || dm_state->context) { - ret =0 ; -/* -* For full updates case when -* removing/adding/updateding streams on once CRTC while flipping -* on another CRTC, -* acquiring global lock will guarantee that any such full -* update commit -* will wait for completion of any outstanding flip using DRMs -* synchronization events. -*/ -if (aquire_global_lock) - ret =do_aquire_global_lock (dev, state); - +if (!dm_state->context) { + ret = -EINVAL ; + goto fail_planes; } -/* TODO until surfaces are moved into dm_plane_state release them -* here +/* +* For full updates case when +* removing/adding/updating streams on once CRTC while flipping +* on another CRTC, +* acquiring global lock will guarantee that any such full +* update commit +* will wait for completion of any outstanding flip using DRMs +* synchronization events. */ +if (aquire_global_lock) { + ret =do_aquire_global_lock (dev, state); +if (ret) + goto fail_planes; + } + +/* Must be success */ +WARN_ON (ret); +return ret; + +fail_planes:for (i =0 ; i < set_count; i++)for (j =0 ; j < set[i].surface_count; j++)dc_surface_release (set[i].surfaces[j]); -list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { - old_acrtc_state =to_dm_crtc_state (crtc->state); - -if (old_acrtc_state->stream) -dc_stream_release (old_acrtc_state->stream); - } - +fail_crtcs: +for (i =0 ; i < set_count; i++) +dc_stream_release (set[i].stream); -if (ret !=0 ) { -if (ret == -EDEADLK ) -DRM_DEBUG_KMS ("Atomic check stopped due to to deadlock.\n" ); -else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS ) -DRM_DEBUG_KMS ("Atomic check stopped due to to signal.\n" ); -else -DRM_ERROR ("Atomic check failed.\n" ); - } +if (ret == -EDEADLK ) +DRM_DEBUG_KMS ("Atomic check stopped due to to deadlock.\n" ); +else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS ) +DRM_DEBUG_KMS ("Atomic check stopped due to to signal.\n" ); +else +DRM_ERROR ("Atomic check failed with err: %d .\n" , ret);return ret; }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h +1 -1
@@ -40,7 +40,7 @@ struct dc_stream;struct dm_plane_state {struct drm_plane_state base; -struct dc_surface *dc_surface; +struct dc_surface *surface; };struct dm_crtc_state {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 54/81 drm/amd/display: Flattening to dc_transfer_func
In reply to a message not in the archiveFrom: "Leo (Sunpeng) Li" <[email protected]>
Flattening dc transfer functions in the following manner:transfer_func > core_transfer_func > dc_transfer_func
References to deleted structs are updated as needed.
--- drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 19 ++++--------------- drivers/gpu/drm/amd/display/dc/dc.h | 10 ++++++---- .../drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 10 +++++----- .../gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 10 +++++----- drivers/gpu/drm/amd/display/dc/inc/core_types.h | 8 -------- 5 files changed, 20 insertions(+), 37 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +4 -15
@@ -45,18 +45,11 @@ struct gamma {int ref_count; }; -struct transfer_func { -struct core_transfer_func 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 DC_TRANSFER_FUNC_TO_TRANSFER_FUNC (dc_tf) \ - container_of(dc_tf, struct transfer_func, protected.public)#define CORE_GAMMA_TO_GAMMA (core_gamma) \ container_of(core_gamma, struct gamma, protected)
@@ -208,18 +201,14 @@ struct dc_gamma *dc_create_gamma()return NULL ; } -void dc_transfer_func_retain (const struct dc_transfer_func *dc_tf) +void dc_transfer_func_retain (struct dc_transfer_func *tf) { -struct transfer_func *tf =DC_TRANSFER_FUNC_TO_TRANSFER_FUNC (dc_tf); -ASSERT (tf->ref_count >0 ); ++tf->ref_count; } -void dc_transfer_func_release (const struct dc_transfer_func *dc_tf) +void dc_transfer_func_release (struct dc_transfer_func *tf) { -struct transfer_func *tf =DC_TRANSFER_FUNC_TO_TRANSFER_FUNC (dc_tf); -ASSERT (tf->ref_count >0 ); --tf->ref_count;
@@ -229,14 +218,14 @@ void dc_transfer_func_release(const struct dc_transfer_func *dc_tf)struct dc_transfer_func *dc_create_transfer_func () { -struct transfer_func *tf =dm_alloc (sizeof (*tf)); +struct dc_transfer_func *tf =dm_alloc (sizeof (*tf));if (tf ==NULL ) goto alloc_fail; ++tf->ref_count; -return &tf->protected.public; +return tf; alloc_fail:return NULL ;
drivers/gpu/drm/amd/display/dc/dc.h +6 -4
@@ -293,6 +293,8 @@ struct dc_transfer_func {struct dc_transfer_func_distributed_points tf_pts;enum dc_transfer_func_type type;enum dc_transfer_func_predefined tf; +struct dc_context *ctx; +int ref_count; };struct dc_surface {
@@ -310,7 +312,7 @@ struct dc_surface {struct dc_hdr_static_metadata hdr_static_ctx;const struct dc_gamma *gamma_correction; -const struct dc_transfer_func *in_transfer_func; +struct dc_transfer_func *in_transfer_func;enum dc_color_space color_space;enum surface_pixel_format format;
@@ -384,8 +386,8 @@ void dc_gamma_retain(const struct dc_gamma *dc_gamma);void dc_gamma_release (const struct dc_gamma **dc_gamma);struct dc_gamma *dc_create_gamma (void ); -void dc_transfer_func_retain (const struct dc_transfer_func *dc_tf); -void dc_transfer_func_release (const struct dc_transfer_func *dc_tf); +void dc_transfer_func_retain (struct dc_transfer_func *dc_tf); +void dc_transfer_func_release (struct dc_transfer_func *dc_tf);struct dc_transfer_func *dc_create_transfer_func (void );/*
@@ -465,7 +467,7 @@ struct dc_stream {struct freesync_context freesync_ctx; -const struct dc_transfer_func *out_transfer_func; +struct dc_transfer_func *out_transfer_func;struct colorspace_transform gamut_remap_matrix;struct csc_transform csc_color_matrix;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +5 -5
@@ -242,7 +242,7 @@ static bool dce110_set_input_transfer_func( const struct core_surface *surface) {struct input_pixel_processor *ipp = pipe_ctx->ipp; -const struct core_transfer_func *tf =NULL ; +const struct dc_transfer_func *tf =NULL ;struct ipp_prescale_params prescale_params = {0 };bool result = true;
@@ -250,7 +250,7 @@ static bool dce110_set_input_transfer_func(return false;if (surface->public.in_transfer_func) - tf =DC_TRANSFER_FUNC_TO_CORE (surface->public.in_transfer_func); + tf = surface->public.in_transfer_func;build_prescale_params (&prescale_params, surface); ipp->funcs->ipp_program_prescale (ipp, &prescale_params);
@@ -262,8 +262,8 @@ static bool dce110_set_input_transfer_func(/* Default case if no input transfer function specified */ ipp->funcs->ipp_set_degamma (ipp, IPP_DEGAMMA_MODE_HW_sRGB); - }else if (tf->public.type ==TF_TYPE_PREDEFINED ) { -switch (tf->public.tf) { + }else if (tf->type ==TF_TYPE_PREDEFINED ) { +switch (tf->tf) {case TRANSFER_FUNCTION_SRGB : ipp->funcs->ipp_set_degamma (ipp, IPP_DEGAMMA_MODE_HW_sRGB);
@@ -283,7 +283,7 @@ static bool dce110_set_input_transfer_func( result = false;break ; } - }else if (tf->public.type ==TF_TYPE_BYPASS ) { + }else if (tf->type ==TF_TYPE_BYPASS ) { ipp->funcs->ipp_set_degamma (ipp,IPP_DEGAMMA_MODE_BYPASS ); }else {/*TF_TYPE_DISTRIBUTED_POINTS - Not supported in DCE 11*/
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +5 -5
@@ -602,14 +602,14 @@ static bool dcn10_set_input_transfer_func( struct pipe_ctx *pipe_ctx, const struct core_surface *surface) { struct input_pixel_processor *ipp = pipe_ctx->ipp; -const struct core_transfer_func *tf =NULL ; +const struct dc_transfer_func *tf =NULL ;bool result = true;if (ipp ==NULL )return false;if (surface->public.in_transfer_func) - tf =DC_TRANSFER_FUNC_TO_CORE (surface->public.in_transfer_func); + tf = surface->public.in_transfer_func; if (surface->public.gamma_correction && dce_use_lut(surface)) ipp->funcs->ipp_program_input_lut(ipp,
@@ -617,8 +617,8 @@ static bool dcn10_set_input_transfer_func(if (tf ==NULL ) ipp->funcs->ipp_set_degamma (ipp,IPP_DEGAMMA_MODE_BYPASS ); -else if (tf->public.type ==TF_TYPE_PREDEFINED ) { -switch (tf->public.tf) { +else if (tf->type ==TF_TYPE_PREDEFINED ) { +switch (tf->tf) {case TRANSFER_FUNCTION_SRGB : ipp->funcs->ipp_set_degamma (ipp, IPP_DEGAMMA_MODE_HW_sRGB);
@@ -638,7 +638,7 @@ static bool dcn10_set_input_transfer_func( result = false;break ; } - }else if (tf->public.type ==TF_TYPE_BYPASS ) { + }else if (tf->type ==TF_TYPE_BYPASS ) { ipp->funcs->ipp_set_degamma (ipp,IPP_DEGAMMA_MODE_BYPASS ); }else {/*TF_TYPE_DISTRIBUTED_POINTS*/
drivers/gpu/drm/amd/display/dc/inc/core_types.h +0 -8
@@ -49,9 +49,6 @@ struct core_stream;#define DC_GAMMA_TO_CORE (dc_gamma) \ container_of(dc_gamma, struct core_gamma, public) -#define DC_TRANSFER_FUNC_TO_CORE (dc_transfer_func) \ - container_of(dc_transfer_func, struct core_transfer_func, public) -struct core_surface {struct dc_surface public;struct dc_surface_status status;
@@ -63,11 +60,6 @@ struct core_gamma {struct dc_context *ctx; }; -struct core_transfer_func { -struct dc_transfer_func public; -struct dc_context *ctx; -}; -void enable_surface_flip_reporting (struct dc_surface *dc_surface,uint32_t controller_id);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 55/81 drm/amd/display: change non_dpm0 state's default SR latency
In reply to a message not in the archiveFrom: Charlene Liu <[email protected]>
--- 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
@@ -37,8 +37,8 @@/* Defaults from spreadsheet rev#247 */ const struct dcn_soc_bounding_box dcn10_soc_defaults = {/* latencies */ - .sr_exit_time =17 ,/*us*/ - .sr_enter_plus_exit_time =19 ,/*us*/ + .sr_exit_time =13 ,/*us*/ + .sr_enter_plus_exit_time =15 ,/*us*/ .urgent_latency =4 ,/*us*/ .dram_clock_change_latency =17 ,/*us*/ .write_back_latency =12 ,/*us*/
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 56/81 drm/amd/display: Introduce refcount for dc_validate_context
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Linux requires to be able to release allocated context in case it was never commited.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 64 ++++++++++++++++++------- drivers/gpu/drm/amd/display/dc/dc.h | 4 ++ drivers/gpu/drm/amd/display/dc/inc/core_types.h | 2 + 3 files changed, 54 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +48 -16
@@ -423,7 +423,7 @@ static void allocate_dc_stream_funcs(struct core_dc *core_dc)static void destruct (struct core_dc *dc) { -dc_resource_validate_ctx_destruct (dc->current_context); +dc_release_validate_context (dc->current_context);destroy_links (dc);
@@ -467,6 +467,8 @@ static bool construct(struct core_dc *dc, goto val_ctx_fail; } + dc->current_context->ref_count++; + dc_ctx->cgs_device = init_params->cgs_device; dc_ctx->driver_context = init_params->driver; dc_ctx->dc = &dc->public;
@@ -683,6 +685,8 @@ struct validate_context *dc_get_validate_context(if (context ==NULL ) goto context_alloc_fail; + ++context->ref_count; +if (!is_validation_required (core_dc, set, set_count)) {dc_resource_validate_ctx_copy_construct (core_dc->current_context, context);return context;
@@ -698,8 +702,7 @@ struct validate_context *dc_get_validate_context( __func__, result); -dc_resource_validate_ctx_destruct (context); -dm_free (context); +dc_release_validate_context (context); context =NULL ; }
@@ -720,6 +723,8 @@ bool dc_validate_resources(if (context ==NULL ) goto context_alloc_fail; + ++context->ref_count; + result = core_dc->res_pool->funcs->validate_with_context ( core_dc, set, set_count, context,NULL );
@@ -731,8 +736,7 @@ bool dc_validate_resources( result); } -dc_resource_validate_ctx_destruct (context); -dm_free (context); +dc_release_validate_context (context); context =NULL ;return result ==DC_OK ;
@@ -750,11 +754,12 @@ bool dc_validate_guaranteed(if (context ==NULL ) goto context_alloc_fail; + ++context->ref_count; + result = core_dc->res_pool->funcs->validate_guaranteed ( core_dc, stream, context); -dc_resource_validate_ctx_destruct (context); -dm_free (context); +dc_release_validate_context (context); context_alloc_fail:if (result !=DC_OK ) {
@@ -972,8 +977,10 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *cdc_enable_stereo (dc, context, dc_streams, context->stream_count); -dc_resource_validate_ctx_destruct (core_dc->current_context); -dm_free (core_dc->current_context); +dc_release_validate_context (core_dc->current_context); + +dc_retain_validate_context (context); + core_dc->current_context = context;return (result ==DC_OK );
@@ -1045,6 +1052,8 @@ bool dc_commit_streams(if (context ==NULL ) goto context_alloc_fail; + ++context->ref_count; + result = core_dc->res_pool->funcs->validate_with_context ( core_dc, set, stream_count, context, core_dc->current_context);if (result !=DC_OK ){
@@ -1053,7 +1062,6 @@ bool dc_commit_streams( __func__, result);BREAK_TO_DEBUGGER (); -dc_resource_validate_ctx_destruct (context); goto fail; }
@@ -1062,7 +1070,7 @@ bool dc_commit_streams(return (result ==DC_OK ); fail: -dm_free (context); +dc_release_validate_context (context); context_alloc_fail:return (result ==DC_OK );
@@ -1155,6 +1163,23 @@ bool dc_commit_surfaces_to_stream(return true; } +void dc_retain_validate_context (struct validate_context *context) +{ +ASSERT (context->ref_count >0 ); + ++context->ref_count; +} + +void dc_release_validate_context (struct validate_context *context) +{ +ASSERT (context->ref_count >0 ); + --context->ref_count; + +if (context->ref_count ==0 ) { +dc_resource_validate_ctx_destruct (context); +dm_free (context); + } +} +static bool is_surface_in_context (const struct validate_context *context,const struct dc_surface *surface)
@@ -1341,6 +1366,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,enum surface_update_type update_type;const struct dc_stream_status *stream_status;struct core_stream *stream =DC_STREAM_TO_CORE (dc_stream); +struct dc_context *dc_ctx = core_dc->ctx; stream_status =dc_stream_get_status (dc_stream);ASSERT (stream_status);
@@ -1403,6 +1429,11 @@ void dc_update_surfaces_and_stream(struct dc *dc,/* initialize scratch memory for building context */ context =dm_alloc (sizeof (*context)); +if (context ==NULL ) + goto context_alloc_fail; + + ++context->ref_count; +dc_resource_validate_ctx_copy_construct ( core_dc->current_context, context);
@@ -1624,16 +1655,17 @@ void dc_update_surfaces_and_stream(struct dc *dc, }if (core_dc->current_context != context) { -dc_resource_validate_ctx_destruct (core_dc->current_context); -dm_free (core_dc->current_context); - +dc_release_validate_context (core_dc->current_context); +dc_retain_validate_context (context); core_dc->current_context = context; }return ; fail: -dc_resource_validate_ctx_destruct (context); -dm_free (context); +dc_release_validate_context (context); + +context_alloc_fail: +DC_ERROR ("Failed to allocate new validate context!\n" ); }uint8_t dc_get_current_stream_count (const struct dc *dc)
drivers/gpu/drm/amd/display/dc/dc.h +4 -0
@@ -643,6 +643,10 @@ enum surface_update_type dc_check_update_surfaces_for_stream(struct dc_stream_update *stream_update, const struct dc_stream_status *stream_status); + +void dc_retain_validate_context (struct validate_context *context); +void dc_release_validate_context (struct validate_context *context); +/******************************************************************************* * Link Interfaces ******************************************************************************/
drivers/gpu/drm/amd/display/dc/inc/core_types.h +2 -0
@@ -361,6 +361,8 @@ struct validate_context {#ifdef CONFIG_DRM_AMD_DC_DCN1_0 struct dcn_bw_internal_vars dcn_bw_vars;#endif + + int ref_count; };#endif /* _CORE_TYPES_H_ */
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 57/81 drm/amd/display: Skip DC validation for flips and cursor.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Nothing to validate in DC in this case. Skip it.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +18 -17
@@ -1469,8 +1469,7 @@ int amdgpu_dm_connector_mode_valid(if (context) { result =MODE_OK ; -dc_resource_validate_ctx_destruct (context); -dm_free (context); +dc_release_validate_context (context); }dc_stream_release (stream);
@@ -2766,8 +2765,8 @@ void amdgpu_dm_atomic_commit_tail( } } -/* DC is optimized not to do anything if 'streams' didn't change. */ -WARN_ON (!dc_commit_context (dm->dc, dm_state->context)); +if (dm_state->context) +WARN_ON (!dc_commit_context (dm->dc, dm_state->context));list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {
@@ -3100,9 +3099,9 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,/* * This bool will be set for true for any modeset/reset -* or surface update which implies non fast surfae update. +* or surface update which implies non fast surface update. */ -bool aquire_global_lock = false; +bool lock_and_validation_needed = false; ret =drm_atomic_helper_check (dev, state);
@@ -3190,7 +3189,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, new_acrtc_state->stream, crtc); - aquire_global_lock = true; + lock_and_validation_needed = true; }else if (modereset_required (crtc_state)) {
@@ -3204,7 +3203,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,dc_stream_release (new_acrtc_state->stream); new_acrtc_state->stream =NULL ; - aquire_global_lock = true; + lock_and_validation_needed = true; } }
@@ -3242,7 +3241,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,if (!is_scaling_state_different (con_new_state, con_old_state))continue ; - aquire_global_lock = true; + lock_and_validation_needed = true; }for_each_crtc_in_state (state, crtc, crtc_state, i) {
@@ -3292,17 +3291,11 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, new_acrtc_state->stream, surface); - aquire_global_lock = true; + lock_and_validation_needed = true; } } } - dm_state->context =dc_get_validate_context (dc, set, set_count); -if (!dm_state->context) { - ret = -EINVAL ; - goto fail_planes; - } -/* * For full updates case when * removing/adding/updating streams on once CRTC while flipping
@@ -3312,10 +3305,18 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,* will wait for completion of any outstanding flip using DRMs * synchronization events. */ -if (aquire_global_lock) { + +if (lock_and_validation_needed) { + ret =do_aquire_global_lock (dev, state);if (ret) goto fail_planes; + + dm_state->context =dc_get_validate_context (dc, set, set_count); +if (!dm_state->context) { + ret = -EINVAL ; + goto fail_planes; + } }/* Must be success */
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 58/81 drm/amd/display: Release dm_state->context when state is cleared.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Handling a use case of TEST_ONLY request from DRM where commit is not goiing to be called. We need to release the allocated dc_validate_context in this case.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 23 ++++++++++++++++++++++ .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 1 + 2 files changed, 24 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +23 -0
@@ -653,12 +653,35 @@ dm_atomic_state_alloc(struct drm_device *dev)return &state->base; } +static void +dm_atomic_state_clear (struct drm_atomic_state *state) +{ +struct dm_atomic_state *dm_state =to_dm_atomic_state (state); + +if (dm_state->context) { +dc_release_validate_context (dm_state->context); + dm_state->context =NULL ; + } + +drm_atomic_state_default_clear (state); +} + +static void +dm_atomic_state_alloc_free (struct drm_atomic_state *state) +{ +struct dm_atomic_state *dm_state =to_dm_atomic_state (state); +drm_atomic_state_default_release (state); +kfree (dm_state); +} +static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { .fb_create = amdgpu_user_framebuffer_create, .output_poll_changed = amdgpu_output_poll_changed, .atomic_check = amdgpu_dm_atomic_check, .atomic_commit = amdgpu_dm_atomic_commit, .atomic_state_alloc = dm_atomic_state_alloc, + .atomic_state_clear = dm_atomic_state_clear, + .atomic_state_free = dm_atomic_state_alloc_free };static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +1 -0
@@ -3312,6 +3312,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,if (ret) goto fail_planes; +WARN_ON (dm_state->context); dm_state->context =dc_get_validate_context (dc, set, set_count);if (!dm_state->context) { ret = -EINVAL ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 59/81 drm/amd/display: Fix eDP power isn't off when lid close
In reply to a message not in the archiveFrom: John Wu <[email protected]>
--- 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
@@ -112,8 +112,10 @@ void dp_disable_link_phy(struct core_link *link, enum signal_type signal)if (!link->wa_flags.dp_keep_receiver_powered)dp_receiver_power_ctrl (link, false); -if (signal ==SIGNAL_TYPE_EDP ) +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); + } link->link_enc->funcs->disable_output (link->link_enc, signal);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 60/81 drm/amd/display: change order of HUBP and MPC disable according to HW guide
In reply to a message not in the archiveFrom: Tony Cheng <[email protected]>
blank hubp first before disconnect MPC
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 10 +++++++--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +7 -3
@@ -477,9 +477,14 @@ static void reset_front_end(if (mpcc->opp_id ==0xf )return ; - mi->funcs->dcc_control (mi, false, false); tg->funcs->lock (tg); + mi->funcs->dcc_control (mi, false, false); + mi->funcs->set_blank (mi, true); +REG_WAIT (DCHUBP_CNTL [fe_idx], +HUBP_NO_OUTSTANDING_REQ ,1 , +1 ,200 ); + mpcc_cfg.opp_id =0xf ; mpcc_cfg.top_dpp_id =0xf ; mpcc_cfg.bot_mpcc_id =0xf ;
@@ -491,8 +496,7 @@ static void reset_front_end(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); -REG_WAIT (DCHUBP_CNTL [fe_idx],HUBP_NO_OUTSTANDING_REQ ,1 ,20000 ,200000 ); +REG_UPDATE (HUBP_CLK_CNTL [fe_idx],HUBP_CLOCK_ENABLE ,0 );REG_UPDATE (DPP_CONTROL [fe_idx],DPP_CLOCK_ENABLE ,0 );
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c +3 -1
@@ -117,7 +117,9 @@ static void dcn10_mpcc_wait_idle(struct mpcc *mpcc) {struct dcn10_mpcc *mpcc10 =TO_DCN10_MPCC (mpcc); -REG_WAIT (MPCC_STATUS ,MPCC_BUSY ,0 ,1000 ,1000 ); +REG_WAIT (MPCC_STATUS , +MPCC_BUSY ,0 , +1000 ,1000 ); }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 61/81 drm/amd/display: dc_validate_ctx refocunt fixes.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
In dc_resource_validate_ctx_copy_construct don't override dst context refcount.
Remove extra retain to new ctx in dc_update_surfaces_and_stream
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 5 +---- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -4
@@ -424,6 +424,7 @@ static void allocate_dc_stream_funcs(struct core_dc *core_dc)static void destruct (struct core_dc *dc) {dc_release_validate_context (dc->current_context); + dc->current_context =NULL ;destroy_links (dc);
@@ -441,9 +442,6 @@ static void destruct(struct core_dc *dc)if (dc->ctx->logger)dal_logger_destroy (&dc->ctx->logger); -dm_free (dc->current_context); - dc->current_context =NULL ; -dm_free (dc->ctx); dc->ctx =NULL ; }
@@ -1656,7 +1654,6 @@ void dc_update_surfaces_and_stream(struct dc *dc,if (core_dc->current_context != context) {dc_release_validate_context (core_dc->current_context); -dc_retain_validate_context (context); core_dc->current_context = context; }return ;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +5 -0
@@ -2166,6 +2166,7 @@ void dc_resource_validate_ctx_copy_construct( struct validate_context *dst_ctx) {int i, j; +int ref_count = dst_ctx->ref_count; *dst_ctx = *src_ctx;
@@ -2186,6 +2187,10 @@ void dc_resource_validate_ctx_copy_construct(dc_surface_retain ( dst_ctx->stream_status[i].surfaces[j]); } + +/* context refcount should not be overridden */ + dst_ctx->ref_count = ref_count; + } struct clock_source *dc_resource_find_first_free_pll(
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 62/81 drm/amd/display: avoid disabling opp clk before hubp is blanked.
In reply to a message not in the archiveFrom: Tony Cheng <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h | 7 +++++++ .../gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 18 ++++++++++++++---- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c | 2 -- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h | 8 ++------ 4 files changed, 23 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +7 -0
@@ -141,6 +141,10 @@SRII (DPP_CONTROL ,DPP_TOP ,1 ), \SRII (DPP_CONTROL ,DPP_TOP ,2 ), \SRII (DPP_CONTROL ,DPP_TOP ,3 ), \ +SRII (OPP_PIPE_CONTROL ,OPP_PIPE ,0 ), \ +SRII (OPP_PIPE_CONTROL ,OPP_PIPE ,1 ), \ +SRII (OPP_PIPE_CONTROL ,OPP_PIPE ,2 ), \ +SRII (OPP_PIPE_CONTROL ,OPP_PIPE ,3 ), \SR (REFCLK_CNTL ), \SR (DCHUBBUB_GLOBAL_TIMER_CNTL ), \ SR(DC_IP_REQUEST_CNTL), \
@@ -188,6 +192,7 @@ struct dce_hwseq_registers {uint32_t DCHUBP_CNTL [4 ];uint32_t HUBP_CLK_CNTL [4 ];uint32_t DPP_CONTROL [4 ]; +uint32_t OPP_PIPE_CONTROL [4 ];uint32_t REFCLK_CNTL ;uint32_t DCHUBBUB_GLOBAL_TIMER_CNTL ;uint32_t DC_IP_REQUEST_CNTL ;
@@ -282,6 +287,7 @@ struct dce_hwseq_registers {HWS_SF (HUBP0_ ,DCHUBP_CNTL ,HUBP_VTG_SEL , mask_sh), \HWS_SF (HUBP0_ ,HUBP_CLK_CNTL ,HUBP_CLOCK_ENABLE , mask_sh), \HWS_SF (DPP_TOP0_ ,DPP_CONTROL ,DPP_CLOCK_ENABLE , mask_sh), \ +HWS_SF (OPP_PIPE0_ ,OPP_PIPE_CONTROL ,OPP_PIPE_CLOCK_EN , mask_sh),\ HWS_SF(, DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_ENABLE, mask_sh), \ HWS_SF(, DC_IP_REQUEST_CNTL, IP_REQUEST_EN, mask_sh), \ HWS_SF(, DOMAIN0_PG_CONFIG, DOMAIN0_POWER_FORCEON, mask_sh), \
@@ -346,6 +352,7 @@ struct dce_hwseq_registers {type DPP_CLOCK_ENABLE ; \type DPPCLK_RATE_CONTROL ; \type DCHUBBUB_GLOBAL_TIMER_ENABLE ; \ +type OPP_PIPE_CLOCK_EN ;\type IP_REQUEST_EN ; \type DOMAIN0_POWER_FORCEON ; \type DOMAIN0_POWER_GATE ; \
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +14 -4
@@ -472,9 +472,10 @@ static void reset_front_end(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;/*Already reset*/ -if (mpcc->opp_id ==0xf ) +if (opp_id ==0xf )return ; tg->funcs->lock (tg);
@@ -497,8 +498,12 @@ static void reset_front_end( mpcc->funcs->wait_for_idle (mpcc); -REG_UPDATE (HUBP_CLK_CNTL [fe_idx],HUBP_CLOCK_ENABLE ,0 ); -REG_UPDATE (DPP_CONTROL [fe_idx],DPP_CLOCK_ENABLE ,0 ); +REG_UPDATE (HUBP_CLK_CNTL [fe_idx], +HUBP_CLOCK_ENABLE ,0 ); +REG_UPDATE (DPP_CONTROL [fe_idx], +DPP_CLOCK_ENABLE ,0 ); +REG_UPDATE (OPP_PIPE_CONTROL [opp_id], +OPP_PIPE_CLOCK_EN ,0 ); xfm->funcs->transform_reset (xfm);
@@ -1211,7 +1216,12 @@ static void dcn10_power_on_fe( pipe_ctx->pipe_idx);/* enable DCFCLK current DCHUB */ -REG_UPDATE (HUBP_CLK_CNTL [pipe_ctx->pipe_idx],HUBP_CLOCK_ENABLE ,1 ); +REG_UPDATE (HUBP_CLK_CNTL [pipe_ctx->pipe_idx], +HUBP_CLOCK_ENABLE ,1 ); + +/* make sure OPP_PIPE_CLOCK_EN = 1 */ +REG_UPDATE (OPP_PIPE_CONTROL [pipe_ctx->tg->inst], +OPP_PIPE_CLOCK_EN ,1 );if (dc_surface) { dm_logger_write(dc->ctx->logger, LOG_DC,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c +0 -2
@@ -68,14 +68,12 @@ static void set_output_mux(struct dcn10_mpcc *mpcc10, int opp_id, int mpcc_id) {ASSERT (mpcc10->base.opp_id ==0xf || opp_id == mpcc10->base.opp_id); mpcc10->base.opp_id = opp_id; -REG_UPDATE (OPP_PIPE_CONTROL [opp_id],OPP_PIPE_CLOCK_EN ,1 );REG_SET (MUX [opp_id],0 ,MPC_OUT_MUX , mpcc_id); }static void reset_output_mux (struct dcn10_mpcc *mpcc10) {REG_SET (MUX [mpcc10->base.opp_id],0 ,MPC_OUT_MUX ,0xf ); -REG_UPDATE (OPP_PIPE_CONTROL [mpcc10->base.opp_id],OPP_PIPE_CLOCK_EN ,0 ); mpcc10->base.opp_id =0xf ; }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h +2 -6
@@ -33,8 +33,7 @@#define MAX_OPP 6#define MPC_COMMON_REG_LIST_DCN1_0 (inst) \ - SRII(MUX, MPC_OUT, inst),\ - SRII(OPP_PIPE_CONTROL, OPP_PIPE, inst) + SRII(MUX, MPC_OUT, inst)#define MPCC_COMMON_REG_LIST_DCN1_0 (inst) \ SRI(MPCC_TOP_SEL, MPCC, inst),\
@@ -56,7 +55,6 @@ struct dcn_mpcc_registers {uint32_t MPCC_BG_G_Y ;uint32_t MPCC_BG_R_CR ;uint32_t MPCC_BG_B_CB ; -uint32_t OPP_PIPE_CONTROL [MAX_OPP ];uint32_t MUX [MAX_OPP ]; };
@@ -73,8 +71,7 @@ struct dcn_mpcc_registers {SF (MPCC0_MPCC_BG_G_Y ,MPCC_BG_G_Y , mask_sh),\SF (MPCC0_MPCC_BG_R_CR ,MPCC_BG_R_CR , mask_sh),\SF (MPCC0_MPCC_BG_B_CB ,MPCC_BG_B_CB , mask_sh),\ -SF (MPC_OUT0_MUX ,MPC_OUT_MUX , mask_sh),\ - SF(OPP_PIPE0_OPP_PIPE_CONTROL, OPP_PIPE_CLOCK_EN, mask_sh) + SF(MPC_OUT0_MUX, MPC_OUT_MUX, mask_sh)#define MPCC_REG_FIELD_LIST (type) \ type MPCC_TOP_SEL;\
@@ -90,7 +87,6 @@ struct dcn_mpcc_registers {type MPCC_BG_R_CR ;\type MPCC_BG_B_CB ;\type MPC_OUT_MUX ;\ -type OPP_PIPE_CLOCK_EN ;\struct dcn_mpcc_shift {MPCC_REG_FIELD_LIST (uint8_t )
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 63/81 drm/amd/display: fix 4k@30 with 10bit deep color and avi for BT2020
In reply to a message not in the archiveFrom: Charlene Liu <[email protected]>
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2 -1
@@ -1661,7 +1661,8 @@ static void set_avi_info_frame(/* C0, C1 : Colorimetry */ if (color_space ==COLOR_SPACE_YCBCR709 || - color_space ==COLOR_SPACE_YCBCR709_LIMITED ) + color_space ==COLOR_SPACE_YCBCR709_LIMITED || + color_space ==COLOR_SPACE_2020_YCBCR ) hdmi_info->bits.C0_C1 =COLORIMETRY_ITU709 ;else if (color_space ==COLOR_SPACE_YCBCR601 || color_space ==COLOR_SPACE_YCBCR601_LIMITED )
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 64/81 drm/amd/display: Get freesync properties
In reply to a message not in the archiveFrom: Harry Wentland <[email protected]>
Eventually we should create proper atomic properties for freesync but currently freesync is broken and we still have the legacy properties. Simply return the legacy properties.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +9 -8
@@ -1228,6 +1228,7 @@ int amdgpu_dm_connector_atomic_get_property(struct dm_connector_state *dm_state =to_dm_connector_state (state);int ret = -EINVAL ; +int i;if (property == dev->mode_config.scaling_mode_property) {switch (dm_state->scaling) {
@@ -1255,14 +1256,14 @@ int amdgpu_dm_connector_atomic_get_property( }else if (property == adev->mode_info.underscan_property) { *val = dm_state->underscan_enable; ret =0 ; - }else if (property == adev->mode_info.freesync_property) { -//TODO - *val =0 ; - ret =0 ; - }else if (property == adev->mode_info.freesync_capable_property) { -//TODO - *val =0 ; - ret =0 ; + }else if ((property == adev->mode_info.freesync_property) || + (property == adev->mode_info.freesync_capable_property)) { +for (i =0 ; i < connector->base.properties->count; i++) { +if (connector->base.properties->properties[i] == property) { + *val = connector->base.properties->values[i]; + ret =0 ; + } + } }return ret; }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 65/81 drm/amd/display: ensure OTG is locked before proceeding
In reply to a message not in the archiveFrom: Tony Cheng <[email protected]>
also remove tg lock at init_hw as not all OTG is running
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 -- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c | 4 ++++ drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.h | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -2
@@ -283,13 +283,11 @@ static void init_hw(struct core_dc *dc) dc->res_pool->mpcc[i];struct mpcc_cfg mpcc_cfg; - tg->funcs->lock (tg); mpcc_cfg.opp_id =0xf ; mpcc_cfg.top_dpp_id =0xf ; mpcc_cfg.bot_mpcc_id =0xf ; mpcc_cfg.top_of_tree = true; mpcc->funcs->set (mpcc, &mpcc_cfg); - tg->funcs->unlock (tg); tg->funcs->disable_vga (tg);/* Blank controller using driver code instead of
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c +4 -0
@@ -573,6 +573,10 @@ static void tgn10_lock(struct timing_generator *tg) OTG_MASTER_UPDATE_LOCK_SEL, tg->inst);REG_SET (OTG_MASTER_UPDATE_LOCK ,0 ,OTG_MASTER_UPDATE_LOCK ,1 ); + +REG_WAIT (OTG_MASTER_UPDATE_LOCK , +UPDATE_LOCK_STATUS ,1 , +1 ,100 ); }static void tgn10_unlock (struct timing_generator *tg)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.h +2 -0
@@ -140,6 +140,7 @@ struct dcn_tg_registers {SF (OTG0_OTG_BLANK_CONTROL ,OTG_BLANK_DE_MODE , mask_sh),\SF (OTG0_OTG_BLANK_CONTROL ,OTG_CURRENT_BLANK_STATE , mask_sh),\SF (OTG0_OTG_MASTER_UPDATE_LOCK ,OTG_MASTER_UPDATE_LOCK , mask_sh),\ +SF (OTG0_OTG_MASTER_UPDATE_LOCK ,UPDATE_LOCK_STATUS , mask_sh),\SF (OTG0_OTG_GLOBAL_CONTROL0 ,OTG_MASTER_UPDATE_LOCK_SEL , mask_sh),\SF (OTG0_OTG_DOUBLE_BUFFER_CONTROL ,OTG_UPDATE_PENDING , mask_sh),\ SF(OTG0_OTG_DOUBLE_BUFFER_CONTROL, OTG_BLANK_DATA_DOUBLE_BUFFER_EN, mask_sh),\
@@ -233,6 +234,7 @@ struct dcn_tg_registers {type OTG_BLANK_DE_MODE ;\type OTG_CURRENT_BLANK_STATE ;\type OTG_MASTER_UPDATE_LOCK ;\ +type UPDATE_LOCK_STATUS ;\type OTG_UPDATE_PENDING ;\type OTG_MASTER_UPDATE_LOCK_SEL ;\type OTG_BLANK_DATA_DOUBLE_BUFFER_EN ;\
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 66/81 drm/amd/display: fix mpo exit hang
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +12 -5
@@ -500,8 +500,10 @@ static void reset_front_end( HUBP_CLOCK_ENABLE, 0);REG_UPDATE (DPP_CONTROL [fe_idx],DPP_CLOCK_ENABLE ,0 ); -REG_UPDATE (OPP_PIPE_CONTROL [opp_id], -OPP_PIPE_CLOCK_EN ,0 ); + +if (mpcc_cfg.top_of_tree) +REG_UPDATE (OPP_PIPE_CONTROL [opp_id], +OPP_PIPE_CLOCK_EN ,0 ); xfm->funcs->transform_reset (xfm);
@@ -1584,7 +1586,7 @@ static void dcn10_apply_ctx_for_surface(int i;/* reset unused mpcc */ -/*for (i = 0; i < dc->res_pool->pipe_count; i++) { +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];
@@ -1593,7 +1595,12 @@ static void dcn10_apply_ctx_for_surface( || (!pipe_ctx->stream && old_pipe_ctx->stream)) {struct mpcc_cfg mpcc_cfg; - mpcc_cfg.opp_id =0xf ; +if (!old_pipe_ctx->top_pipe) { +ASSERT (0 ); +continue ; + } + + mpcc_cfg.opp_id = old_pipe_ctx->mpcc->opp_id; mpcc_cfg.top_dpp_id =0xf ; mpcc_cfg.bot_mpcc_id =0xf ; mpcc_cfg.top_of_tree = !old_pipe_ctx->top_pipe;
@@ -1607,7 +1614,7 @@ static void dcn10_apply_ctx_for_surface("Reset mpcc for pipe %d\n" , old_pipe_ctx->pipe_idx); } -}*/ + }if (!surface)return ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 67/81 drm/amd/display: Rename trasnform to dpp for dcn's
In reply to a message not in the archiveFrom: Vitaly Prosyak <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dcn10/Makefile | 2 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c | 1064 +++++++++++++++++++ drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h | 419 ++++++++ .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 + .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 38 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_transform.c | 1065 -------------------- .../gpu/drm/amd/display/dc/dcn10/dcn10_transform.h | 421 -------- 7 files changed, 1505 insertions(+), 1506 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.h
drivers/gpu/drm/amd/display/dc/dcn10/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for DCN. DCN10 = dcn10_resource.o dcn10_ipp.o dcn10_hw_sequencer.o \ - dcn10_transform.o dcn10_opp.o dcn10_timing_generator.o \ + dcn10_dpp.o dcn10_opp.o dcn10_timing_generator.o \ dcn10_mem_input.o dcn10_mpc.o AMD_DAL_DCN10 = $(addprefix $(AMDDALPATH)/dc/dcn10/,$(DCN10))
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c new file +1064 -0
1,064 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h new file +419 -0
419 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -0
@@ -33,6 +33,8 @@#include "dce110/dce110_hw_sequencer.h" #include "dce/dce_hwseq.h" #include "abm.h" +#include "dcn10/dcn10_dpp.h" +#include "dcn10/dcn10_mpc.h" #include "mem_input.h" #include "timing_generator.h" #include "opp.h"
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +19 -19
@@ -33,7 +33,7 @@#include "dcn10/dcn10_ipp.h" #include "dcn10/dcn10_mpc.h" #include "irq/dcn10/irq_service_dcn10.h" -#include "dcn10/dcn10_transform.h" +#include "dcn10/dcn10_dpp.h" #include "dcn10/dcn10_timing_generator.h" #include "dcn10/dcn10_hw_sequencer.h" #include "dce110/dce110_hw_sequencer.h"
@@ -309,18 +309,18 @@ static const struct dcn10_opp_mask opp_mask = { TF_REG_LIST_DCN10(id),\ } -static const struct dcn_transform_registers tf_regs[] = { +static const struct dcn_dpp_registers tf_regs[] = {tf_regs (0 ),tf_regs (1 ),tf_regs (2 ),tf_regs (3 ), }; -static const struct dcn_transform_shift tf_shift = { +static const struct dcn_dpp_shift tf_shift = {TF_REG_LIST_SH_MASK_DCN10 (__SHIFT) }; -static const struct dcn_transform_mask tf_mask = { +static const struct dcn_dpp_mask tf_mask = {TF_REG_LIST_SH_MASK_DCN10 (_MASK), };
@@ -449,28 +449,28 @@ static const struct dc_debug debug_defaults_diags = {#endif }; -static void dcn10_transform_destroy (struct transform **xfm) +static void dcn10_dpp_destroy (struct transform **xfm) { -dm_free (TO_DCN10_TRANSFORM (*xfm)); +dm_free (TO_DCN10_DPP (*xfm)); *xfm =NULL ; } -static struct transform *dcn10_transform_create ( +static struct transform *dcn10_dpp_create (struct dc_context *ctx,uint32_t inst) { -struct dcn10_transform *transform = -dm_alloc (sizeof (struct dcn10_transform )); +struct dcn10_dpp *dpp = +dm_alloc (sizeof (struct dcn10_dpp )); -if (!transform) +if (!dpp)return NULL ; -if (dcn10_transform_construct (transform, ctx, inst, +if (dcn10_dpp_construct (dpp, ctx, inst, &tf_regs[inst], &tf_shift, &tf_mask)) -return &transform->base; +return &dpp->base;BREAK_TO_DEBUGGER (); -dm_free (transform); +dm_free (dpp);return NULL ; }
@@ -710,7 +710,7 @@ static void destruct(struct dcn10_resource_pool *pool) pool->base.opps[i]->funcs->opp_destroy (&pool->base.opps[i]);if (pool->base.transforms[i] !=NULL ) -dcn10_transform_destroy (&pool->base.transforms[i]); +dcn10_dpp_destroy (&pool->base.transforms[i]);if (pool->base.ipps[i] !=NULL ) pool->base.ipps[i]->funcs->ipp_destroy (&pool->base.ipps[i]);
@@ -1387,7 +1387,7 @@ static bool construct(#endif } -/* mem input -> ipp -> transform -> opp -> TG */ +/* mem input -> ipp -> dpp -> opp -> TG */ for (i =0 ; i < pool->base.pipe_count; i++) { pool->base.mis[i] =dcn10_mem_input_create (ctx, i);if (pool->base.mis[i] ==NULL ) {
@@ -1405,12 +1405,12 @@ static bool construct( goto ipp_create_fail; } - pool->base.transforms[i] =dcn10_transform_create (ctx, i); + pool->base.transforms[i] =dcn10_dpp_create (ctx, i);if (pool->base.transforms[i] ==NULL ) {BREAK_TO_DEBUGGER ();dm_error ( -"DC: failed to create transform!\n" ); - goto transform_create_fail; +"DC: failed to create dpp!\n" ); + goto dpp_create_fail; } pool->base.opps[i] =dcn10_opp_create (ctx, i);
@@ -1452,7 +1452,7 @@ static bool construct( mpcc_create_fail: otg_create_fail: opp_create_fail: -transform_create_fail: +dpp_create_fail: ipp_create_fail: mi_create_fail: irqs_create_fail:
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.c deleted +0 -1065
1,065 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_transform.h deleted +0 -421
331 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.7.4 _______________________________________________ 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.
PATCH 68/81 drm/amd/display: Preserve refcount for S3 case.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Curent_context is zerroed out for suspend, keep the refcount. Minor code move in dc_commit_context_no_check
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +8 -4
@@ -977,10 +977,10 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *cdc_release_validate_context (core_dc->current_context); -dc_retain_validate_context (context); - core_dc->current_context = context; +dc_retain_validate_context (core_dc->current_context); +return (result ==DC_OK ); }
@@ -1065,8 +1065,6 @@ bool dc_commit_streams( result =dc_commit_context_no_check (dc, context); -return (result ==DC_OK ); - fail:dc_release_validate_context (context);
@@ -1736,6 +1734,7 @@ void dc_set_power_state( enum dc_acpi_cm_power_state power_state) {struct core_dc *core_dc =DC_TO_CORE (dc); +int ref_count;switch (power_state) {case DC_ACPI_CM_POWER_STATE_D0 :
@@ -1749,8 +1748,13 @@ void dc_set_power_state(* clean state, and dc hw programming optimizations will not * cause any trouble. */ + +/* Preserve refcount */ + ref_count = core_dc->current_context->ref_count; +dc_resource_validate_ctx_destruct (core_dc->current_context);memset (core_dc->current_context,0 ,sizeof (*core_dc->current_context)); + core_dc->current_context->ref_count = ref_count;break ; }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 69/81 drm/amd/display: Release cached atomic state in S3.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Fixes memory leak.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -0
@@ -508,6 +508,7 @@ static int dm_suspend(void *handle)amdgpu_dm_irq_suspend (adev); +WARN_ON (adev->dm.cached_state); adev->dm.cached_state =drm_atomic_helper_suspend (adev->ddev); dc_set_power_state(
@@ -607,6 +608,9 @@ int amdgpu_dm_display_resume(struct amdgpu_device *adev ) ret =drm_atomic_helper_resume (ddev, adev->dm.cached_state); +drm_atomic_state_put (adev->dm.cached_state); + adev->dm.cached_state =NULL ; +amdgpu_dm_irq_resume_late (adev);return ret;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 70/81 drm/amd/display: add line number to reg_wait timeout print
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dc_helper.c | 6 +++--- drivers/gpu/drm/amd/display/dc/dm_services.h | 2 +- drivers/gpu/drm/amd/display/dc/inc/reg_helper.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_helper.c +3 -3
@@ -129,7 +129,7 @@ uint32_t generic_reg_get(const struct dc_context *ctx,uint32_t generic_reg_wait (const struct dc_context *ctx,uint32_t addr,uint32_t shift,uint32_t mask,uint32_t condition_value,unsigned int delay_between_poll_us,unsigned int time_out_num_tries, -const char *func_name) +const char *func_name,int line) {uint32_t field_value;uint32_t reg_val;
@@ -158,8 +158,8 @@ uint32_t generic_reg_wait(const struct dc_context *ctx,return reg_val; } -dm_error ("REG_WAIT timeout %dus * %d tries - %s\n" , - delay_between_poll_us, time_out_num_tries, func_name); +dm_error ("REG_WAIT timeout %dus * %d tries - %s line:%d\n" , + delay_between_poll_us, time_out_num_tries, func_name, line);if (!IS_FPGA_MAXIMUS_DC (ctx->dce_environment))BREAK_TO_DEBUGGER ();
drivers/gpu/drm/amd/display/dc/dm_services.h +1 -1
@@ -194,7 +194,7 @@ uint32_t generic_reg_update_ex(const struct dc_context *ctx,unsigned int generic_reg_wait (const struct dc_context *ctx,uint32_t addr,uint32_t mask,uint32_t shift,uint32_t condition_value,unsigned int delay_between_poll_us,unsigned int time_out_num_tries, -const char *func_name); +const char *func_name,int line);/* These macros need to be used with soc15 registers in order to retrieve
drivers/gpu/drm/amd/display/dc/inc/reg_helper.h +1 -1
@@ -188,7 +188,7 @@#define REG_WAIT (reg_name, field, val, delay_between_poll_us, max_try) \ generic_reg_wait(CTX, \ REG(reg_name), FN(reg_name, field), val,\ - delay_between_poll_us, max_try, __func__) + delay_between_poll_us, max_try, __func__, __LINE__)/* macro to update (read, modify, write) register fields */
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 71/81 drm/amd/display: hwseq init sequence update
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h | 8 +++- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 51 +++++----------------- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h | 2 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c | 1 - 4 files changed, 20 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +7 -1
@@ -216,6 +216,11 @@ struct dce_hwseq_registers {uint32_t DCCG_GATE_DISABLE_CNTL ;uint32_t DCCG_GATE_DISABLE_CNTL2 ;uint32_t DCFCLK_CNTL ; +uint32_t MICROSECOND_TIME_BASE_DIV ; +uint32_t MILLISECOND_TIME_BASE_DIV ; +uint32_t DISPCLK_FREQ_CHANGE_CNTL ; +uint32_t RBBMIF_TIMEOUT_DIS ; +uint32_t RBBMIF_TIMEOUT_DIS_2 ;#endif };/* set field name */
@@ -378,7 +383,8 @@ struct dce_hwseq_registers {type DOMAIN5_PGFSM_PWR_STATUS ; \type DOMAIN6_PGFSM_PWR_STATUS ; \type DOMAIN7_PGFSM_PWR_STATUS ; \ -type DCFCLK_GATE_DIS ; +type DCFCLK_GATE_DIS ; \ +type DCHUBBUB_GLOBAL_TIMER_REFDIV ;#endif struct dce_hwseq_shift {
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +12 -39
115 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h +1 -1
@@ -30,7 +30,7 @@struct core_dc ; -bool dcn10_hw_sequencer_construct (struct core_dc *dc); +void dcn10_hw_sequencer_construct (struct core_dc *dc);extern void fill_display_configs (const struct validate_context *context,struct dm_pp_display_configuration *pp_display_cfg);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c +0 -1
@@ -403,7 +403,6 @@ static void min10_program_requestor(struct mem_input *mem_input, struct _vcs_dpi_display_rq_regs_st *rq_regs) { - struct dcn10_mem_input *mi = TO_DCN10_MEM_INPUT(mem_input); REG_UPDATE(HUBPRET_CONTROL,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 72/81 drm/amd/display: Move view port registers and programming to memory input.
In reply to a message not in the archiveFrom: Vitaly Prosyak <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c | 36 --------------------- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h | 36 --------------------- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 ++ .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c | 37 +++++++++++++++++++++- .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h | 36 +++++++++++++++++++++ drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h | 4 +++ 6 files changed, 78 insertions(+), 73 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c +0 -36
@@ -452,37 +452,6 @@ static void dpp_set_scl_filter( } } -static void dpp_set_viewport ( -struct dcn10_dpp *xfm, -const struct rect *viewport, -const struct rect *viewport_c) -{ -REG_SET_2 (DCSURF_PRI_VIEWPORT_DIMENSION ,0 , -PRI_VIEWPORT_WIDTH , viewport->width, -PRI_VIEWPORT_HEIGHT , viewport->height); - -REG_SET_2 (DCSURF_PRI_VIEWPORT_START ,0 , -PRI_VIEWPORT_X_START , viewport->x, -PRI_VIEWPORT_Y_START , viewport->y); - -/*for stereo*/ -REG_SET_2 (DCSURF_SEC_VIEWPORT_DIMENSION ,0 , -SEC_VIEWPORT_WIDTH , viewport->width, -SEC_VIEWPORT_HEIGHT , viewport->height); - -REG_SET_2 (DCSURF_SEC_VIEWPORT_START ,0 , -SEC_VIEWPORT_X_START , viewport->x, -SEC_VIEWPORT_Y_START , viewport->y); - -/* DC supports NV12 only at the moment */ -REG_SET_2 (DCSURF_PRI_VIEWPORT_DIMENSION_C ,0 , -PRI_VIEWPORT_WIDTH_C , viewport_c->width, -PRI_VIEWPORT_HEIGHT_C , viewport_c->height); - -REG_SET_2 (DCSURF_PRI_VIEWPORT_START_C ,0 , -PRI_VIEWPORT_X_START_C , viewport_c->x, -PRI_VIEWPORT_Y_START_C , viewport_c->y); -}static int get_lb_depth_bpc (enum lb_pixel_depth depth) {
@@ -616,8 +585,6 @@ void dpp_set_scaler_auto_scale(REG_UPDATE (SCL_MODE ,DSCL_MODE , dscl_mode); -dpp_set_viewport (xfm, &scl_data->viewport, &scl_data->viewport_c); -if (dscl_mode ==DSCL_MODE_DSCL_BYPASS )return ;
@@ -762,9 +729,6 @@ static void dpp_set_scaler_manual_scale(/* SCL mode */ REG_UPDATE (SCL_MODE ,DSCL_MODE , dscl_mode); -/* Viewport */ -dpp_set_viewport (xfm, &scl_data->viewport, &scl_data->viewport_c); -if (dscl_mode ==DSCL_MODE_DSCL_BYPASS )return ;/* LB */
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.h +0 -36
@@ -59,12 +59,6 @@SRI (SCL_COEF_RAM_TAP_SELECT ,DSCL , id), \SRI (SCL_COEF_RAM_TAP_DATA ,DSCL , id), \SRI (DSCL_2TAP_CONTROL ,DSCL , id), \ -SRI (DCSURF_PRI_VIEWPORT_DIMENSION ,HUBP , id), \ -SRI (DCSURF_PRI_VIEWPORT_START ,HUBP , id), \ -SRI (DCSURF_SEC_VIEWPORT_DIMENSION ,HUBP , id), \ -SRI (DCSURF_SEC_VIEWPORT_START ,HUBP , id), \ -SRI (DCSURF_PRI_VIEWPORT_DIMENSION_C ,HUBP , id), \ -SRI (DCSURF_PRI_VIEWPORT_START_C ,HUBP , id), \SRI (MPC_SIZE ,DSCL , id), \SRI (SCL_HORZ_FILTER_SCALE_RATIO ,DSCL , id), \ SRI(SCL_VERT_FILTER_SCALE_RATIO, DSCL, id), \
@@ -144,18 +138,6 @@TF_SF (DSCL0_DSCL_2TAP_CONTROL ,SCL_V_2TAP_SHARP_EN , mask_sh),\TF_SF (DSCL0_DSCL_2TAP_CONTROL ,SCL_V_2TAP_SHARP_FACTOR , mask_sh),\TF_SF (DSCL0_SCL_MODE ,SCL_COEF_RAM_SELECT , mask_sh),\ -TF_SF (HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION ,PRI_VIEWPORT_WIDTH , mask_sh),\ -TF_SF (HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION ,PRI_VIEWPORT_HEIGHT , mask_sh),\ -TF_SF (HUBP0_DCSURF_PRI_VIEWPORT_START ,PRI_VIEWPORT_X_START , mask_sh),\ -TF_SF (HUBP0_DCSURF_PRI_VIEWPORT_START ,PRI_VIEWPORT_Y_START , mask_sh),\ -TF_SF (HUBP0_DCSURF_SEC_VIEWPORT_DIMENSION ,SEC_VIEWPORT_WIDTH , mask_sh),\ -TF_SF (HUBP0_DCSURF_SEC_VIEWPORT_DIMENSION ,SEC_VIEWPORT_HEIGHT , mask_sh),\ -TF_SF (HUBP0_DCSURF_SEC_VIEWPORT_START ,SEC_VIEWPORT_X_START , mask_sh),\ -TF_SF (HUBP0_DCSURF_SEC_VIEWPORT_START ,SEC_VIEWPORT_Y_START , mask_sh),\ -TF_SF (HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_C ,PRI_VIEWPORT_WIDTH_C , mask_sh),\ -TF_SF (HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_C ,PRI_VIEWPORT_HEIGHT_C , mask_sh),\ -TF_SF (HUBP0_DCSURF_PRI_VIEWPORT_START_C ,PRI_VIEWPORT_X_START_C , mask_sh),\ -TF_SF (HUBP0_DCSURF_PRI_VIEWPORT_START_C ,PRI_VIEWPORT_Y_START_C , mask_sh),\TF_SF (DSCL0_SCL_MODE ,DSCL_MODE , mask_sh),\TF_SF (DSCL0_RECOUT_START ,RECOUT_START_X , mask_sh),\ TF_SF(DSCL0_RECOUT_START, RECOUT_START_Y, mask_sh),\
@@ -257,18 +239,6 @@type SCL_V_2TAP_SHARP_EN ; \type SCL_V_2TAP_SHARP_FACTOR ; \type SCL_COEF_RAM_SELECT ; \ -type PRI_VIEWPORT_WIDTH ; \ -type PRI_VIEWPORT_HEIGHT ; \ -type PRI_VIEWPORT_X_START ; \ -type PRI_VIEWPORT_Y_START ; \ -type SEC_VIEWPORT_WIDTH ; \ -type SEC_VIEWPORT_HEIGHT ; \ -type SEC_VIEWPORT_X_START ; \ -type SEC_VIEWPORT_Y_START ; \ -type PRI_VIEWPORT_WIDTH_C ; \ -type PRI_VIEWPORT_HEIGHT_C ; \ -type PRI_VIEWPORT_X_START_C ; \ -type PRI_VIEWPORT_Y_START_C ; \type DSCL_MODE ; \type RECOUT_START_X ; \type RECOUT_START_Y ; \
@@ -355,12 +325,6 @@ struct dcn_dpp_registers {uint32_t SCL_COEF_RAM_TAP_SELECT ;uint32_t SCL_COEF_RAM_TAP_DATA ;uint32_t DSCL_2TAP_CONTROL ; -uint32_t DCSURF_PRI_VIEWPORT_DIMENSION ; -uint32_t DCSURF_PRI_VIEWPORT_START ; -uint32_t DCSURF_SEC_VIEWPORT_DIMENSION ; -uint32_t DCSURF_SEC_VIEWPORT_START ; -uint32_t DCSURF_PRI_VIEWPORT_DIMENSION_C ; -uint32_t DCSURF_PRI_VIEWPORT_START_C ;uint32_t MPC_SIZE ;uint32_t SCL_HORZ_FILTER_SCALE_RATIO ;uint32_t SCL_VERT_FILTER_SCALE_RATIO ;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -0
@@ -1470,6 +1470,8 @@ static void update_dchubp_dpp(/* scaler configuration */ pipe_ctx->xfm->funcs->transform_set_scaler ( pipe_ctx->xfm, &pipe_ctx->scl_data); + mi->funcs->mem_program_viewport (mi, + &pipe_ctx->scl_data.viewport, &pipe_ctx->scl_data.viewport_c);/*gamut remap*/ program_gamut_remap (pipe_ctx);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c +36 -1
@@ -1057,6 +1057,41 @@ static void min10_program_pte_vm(struct mem_input *mem_input, SYSTEM_ACCESS_MODE, 3); } +static void min_set_viewport ( +struct mem_input *mem_input, +const struct rect *viewport, +const struct rect *viewport_c) +{ +struct dcn10_mem_input *mi =TO_DCN10_MEM_INPUT (mem_input); + +REG_SET_2 (DCSURF_PRI_VIEWPORT_DIMENSION ,0 , +PRI_VIEWPORT_WIDTH , viewport->width, +PRI_VIEWPORT_HEIGHT , viewport->height); + +REG_SET_2 (DCSURF_PRI_VIEWPORT_START ,0 , +PRI_VIEWPORT_X_START , viewport->x, +PRI_VIEWPORT_Y_START , viewport->y); + +/*for stereo*/ +REG_SET_2 (DCSURF_SEC_VIEWPORT_DIMENSION ,0 , +SEC_VIEWPORT_WIDTH , viewport->width, +SEC_VIEWPORT_HEIGHT , viewport->height); + +REG_SET_2 (DCSURF_SEC_VIEWPORT_START ,0 , +SEC_VIEWPORT_X_START , viewport->x, +SEC_VIEWPORT_Y_START , viewport->y); + +/* DC supports NV12 only at the moment */ +REG_SET_2 (DCSURF_PRI_VIEWPORT_DIMENSION_C ,0 , +PRI_VIEWPORT_WIDTH_C , viewport_c->width, +PRI_VIEWPORT_HEIGHT_C , viewport_c->height); + +REG_SET_2 (DCSURF_PRI_VIEWPORT_START_C ,0 , +PRI_VIEWPORT_X_START_C , viewport_c->x, +PRI_VIEWPORT_Y_START_C , viewport_c->y); +} + +static struct mem_input_funcs dcn10_mem_input_funcs = { .mem_input_program_display_marks = min10_program_display_marks, .mem_input_program_surface_flip_and_addr =
@@ -1070,9 +1105,9 @@ static struct mem_input_funcs dcn10_mem_input_funcs = { .mem_input_program_pte_vm = min10_program_pte_vm, .set_blank = min10_set_blank, .dcc_control = min10_dcc_control, + .mem_program_viewport = min_set_viewport, }; -/*****************************************/ /* Constructor, Destructor */ /*****************************************/
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h +36 -0
@@ -40,6 +40,12 @@SRI (DCSURF_SURFACE_PITCH_C ,HUBPREQ , id),\SRI (DCSURF_SURFACE_CONFIG ,HUBP , id),\SRI (DCSURF_FLIP_CONTROL ,HUBPREQ , id),\ +SRI (DCSURF_PRI_VIEWPORT_DIMENSION ,HUBP , id), \ +SRI (DCSURF_PRI_VIEWPORT_START ,HUBP , id), \ +SRI (DCSURF_SEC_VIEWPORT_DIMENSION ,HUBP , id), \ +SRI (DCSURF_SEC_VIEWPORT_START ,HUBP , id), \ +SRI (DCSURF_PRI_VIEWPORT_DIMENSION_C ,HUBP , id), \ +SRI (DCSURF_PRI_VIEWPORT_START_C ,HUBP , id), \SRI (DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH ,HUBPREQ , id),\SRI (DCSURF_PRIMARY_SURFACE_ADDRESS ,HUBPREQ , id),\ SRI(DCSURF_SECONDARY_SURFACE_ADDRESS_HIGH, HUBPREQ, id),\
@@ -164,6 +170,12 @@ struct dcn_mi_registers {uint32_t DCSURF_SURFACE_PITCH_C ;uint32_t DCSURF_SURFACE_CONFIG ;uint32_t DCSURF_FLIP_CONTROL ; +uint32_t DCSURF_PRI_VIEWPORT_DIMENSION ; +uint32_t DCSURF_PRI_VIEWPORT_START ; +uint32_t DCSURF_SEC_VIEWPORT_DIMENSION ; +uint32_t DCSURF_SEC_VIEWPORT_START ; +uint32_t DCSURF_PRI_VIEWPORT_DIMENSION_C ; +uint32_t DCSURF_PRI_VIEWPORT_START_C ;uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH ;uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS ;uint32_t DCSURF_SECONDARY_SURFACE_ADDRESS_HIGH ;
@@ -312,6 +324,18 @@ struct dcn_mi_registers {MI_SF (HUBPREQ0_DCSURF_FLIP_CONTROL ,SURFACE_FLIP_TYPE , mask_sh),\MI_SF (HUBPREQ0_DCSURF_FLIP_CONTROL ,SURFACE_FLIP_PENDING , mask_sh),\MI_SF (HUBPREQ0_DCSURF_FLIP_CONTROL ,SURFACE_UPDATE_LOCK , mask_sh),\ +MI_SF (HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION ,PRI_VIEWPORT_WIDTH , mask_sh),\ +MI_SF (HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION ,PRI_VIEWPORT_HEIGHT , mask_sh),\ +MI_SF (HUBP0_DCSURF_PRI_VIEWPORT_START ,PRI_VIEWPORT_X_START , mask_sh),\ +MI_SF (HUBP0_DCSURF_PRI_VIEWPORT_START ,PRI_VIEWPORT_Y_START , mask_sh),\ +MI_SF (HUBP0_DCSURF_SEC_VIEWPORT_DIMENSION ,SEC_VIEWPORT_WIDTH , mask_sh),\ +MI_SF (HUBP0_DCSURF_SEC_VIEWPORT_DIMENSION ,SEC_VIEWPORT_HEIGHT , mask_sh),\ +MI_SF (HUBP0_DCSURF_SEC_VIEWPORT_START ,SEC_VIEWPORT_X_START , mask_sh),\ +MI_SF (HUBP0_DCSURF_SEC_VIEWPORT_START ,SEC_VIEWPORT_Y_START , mask_sh),\ +MI_SF (HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_C ,PRI_VIEWPORT_WIDTH_C , mask_sh),\ +MI_SF (HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_C ,PRI_VIEWPORT_HEIGHT_C , mask_sh),\ +MI_SF (HUBP0_DCSURF_PRI_VIEWPORT_START_C ,PRI_VIEWPORT_X_START_C , mask_sh),\ +MI_SF (HUBP0_DCSURF_PRI_VIEWPORT_START_C ,PRI_VIEWPORT_Y_START_C , mask_sh),\MI_SF (HUBPREQ0_DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH ,PRIMARY_SURFACE_ADDRESS_HIGH , mask_sh),\MI_SF (HUBPREQ0_DCSURF_PRIMARY_SURFACE_ADDRESS ,PRIMARY_SURFACE_ADDRESS , mask_sh),\ MI_SF(HUBPREQ0_DCSURF_SECONDARY_SURFACE_ADDRESS_HIGH, SECONDARY_SURFACE_ADDRESS_HIGH, mask_sh),\
@@ -459,6 +483,18 @@ struct dcn_mi_registers {type SURFACE_FLIP_TYPE ;\type SURFACE_UPDATE_LOCK ;\type SURFACE_FLIP_PENDING ;\ +type PRI_VIEWPORT_WIDTH ; \ +type PRI_VIEWPORT_HEIGHT ; \ +type PRI_VIEWPORT_X_START ; \ +type PRI_VIEWPORT_Y_START ; \ +type SEC_VIEWPORT_WIDTH ; \ +type SEC_VIEWPORT_HEIGHT ; \ +type SEC_VIEWPORT_X_START ; \ +type SEC_VIEWPORT_Y_START ; \ +type PRI_VIEWPORT_WIDTH_C ; \ +type PRI_VIEWPORT_HEIGHT_C ; \ +type PRI_VIEWPORT_X_START_C ; \ +type PRI_VIEWPORT_Y_START_C ; \type PRIMARY_SURFACE_ADDRESS_HIGH ;\type PRIMARY_SURFACE_ADDRESS ;\type SECONDARY_SURFACE_ADDRESS_HIGH ;\
drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h +4 -0
@@ -89,6 +89,10 @@ struct mem_input_funcs {void (*dcc_control)(struct mem_input *mem_input,bool enable,bool independent_64b_blks); +void (*mem_program_viewport)( +struct mem_input *mem_input, +const struct rect *viewport, +const struct rect *viewport_c);#endif void (*mem_input_program_display_marks)(
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 73/81 drm/amd/display: Fix S3 gamma corruption.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
On S3 resume gamma is corrupted since no gamma programming took place.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -0
@@ -1120,11 +1120,13 @@ bool dc_commit_surfaces_to_stream( stream_update->src = dc_stream->src; stream_update->dst = dc_stream->dst; + stream_update->out_transfer_func = dc_stream->out_transfer_func;for (i =0 ; i < new_surface_count; i++) { updates[i].surface = new_surfaces[i]; updates[i].gamma = (struct dc_gamma *)new_surfaces[i]->gamma_correction; + updates[i].in_transfer_func = new_surfaces[i]->in_transfer_func; flip_addr[i].address = new_surfaces[i]->address; flip_addr[i].flip_immediate = new_surfaces[i]->flip_immediate; plane_info[i].color_space = new_surfaces[i]->color_space;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 74/81 drm/amd/display: link training fallback actions
In reply to a message not in the archiveFrom: Ding Wang <[email protected]>
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 239 +++++++++++++++++---- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h | 8 + .../drm/amd/display/include/link_service_types.h | 9 + 4 files changed, 215 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +197 -42
@@ -731,7 +731,7 @@ static enum hw_dp_training_pattern get_supported_tp(struct core_link *link)return HW_DP_TRAINING_PATTERN_2 ; } -static bool perform_channel_equalization_sequence ( +static enum link_training_result perform_channel_equalization_sequence (struct core_link *link,struct link_training_settings *lt_settings) {
@@ -777,19 +777,19 @@ static bool perform_channel_equalization_sequence(/* 5. check CR done*/ if (!is_cr_done (lane_count, dpcd_lane_status)) -return false; +return LINK_TRAINING_EQ_FAIL_CR ;/* 6. check CHEQ done*/ if (is_ch_eq_done (lane_count, dpcd_lane_status, &dpcd_lane_status_updated)) -return true; +return LINK_TRAINING_SUCCESS ;/* 7. update VS/PE/PC2 in lt_settings*/ update_drive_settings (lt_settings, req_settings); } -return false; +return LINK_TRAINING_EQ_FAIL_EQ ; }
@@ -943,18 +943,17 @@ static inline bool perform_link_training_int(return status; } -bool dc_link_dp_perform_link_training ( +enum link_training_result dc_link_dp_perform_link_training (struct dc_link *link,const struct dc_link_settings *link_setting,bool skip_video_pattern) { +enum link_training_result status =LINK_TRAINING_SUCCESS ;struct core_link *core_link =DC_LINK_TO_CORE (link); -bool status;char *link_rate ="Unknown" ;struct link_training_settings lt_settings; - status = false;memset (<_settings,'\0' ,sizeof (lt_settings)); lt_settings.link_settings.link_rate = link_setting->link_rate;
@@ -976,16 +975,23 @@ bool dc_link_dp_perform_link_training(/* 2. perform link training (set link training done * to false is done as well)*/ -if (perform_clock_recovery_sequence (core_link, <_settings)) { - -if (perform_channel_equalization_sequence (core_link, - <_settings)) - status = true; +if (!perform_clock_recovery_sequence (core_link, <_settings)) { + status =LINK_TRAINING_CR_FAIL ; + }else { + status =perform_channel_equalization_sequence (core_link, + <_settings); } -if (status || !skip_video_pattern) - status =perform_link_training_int (core_link, - <_settings, status); +if ((status ==LINK_TRAINING_SUCCESS ) || !skip_video_pattern) { +if (!perform_link_training_int (core_link, + <_settings, + status ==LINK_TRAINING_SUCCESS )) { +/* the next link training setting in this case +* would be the same as CR failure case. +*/ + status =LINK_TRAINING_CR_FAIL ; + } + }/* 6. print status message*/ switch (lt_settings.link_settings.link_rate) {
@@ -1013,7 +1019,9 @@ bool dc_link_dp_perform_link_training(CONN_MSG_LT (core_link,"%sx%d %s VS=%d, PE=%d" , link_rate, lt_settings.link_settings.lane_count, - status ?"pass" :"fail" , + (status ==LINK_TRAINING_SUCCESS ) ?"pass" : + ((status ==LINK_TRAINING_CR_FAIL ) ?"CR failed" : +"EQ failed" ), lt_settings.lane_settings[0 ].VOLTAGE_SWING, lt_settings.lane_settings[0 ].PRE_EMPHASIS);
@@ -1035,7 +1043,7 @@ bool perform_link_training_with_retries(if (dc_link_dp_perform_link_training ( &link->public, link_setting, - skip_video_pattern)) + skip_video_pattern) ==LINK_TRAINING_SUCCESS )return true;msleep (delay_between_attempts);
@@ -1068,15 +1076,6 @@ static const struct dc_link_settings *get_link_training_fallback_table(return &link_training_fallback_table[i]; } -static bool exceeded_limit_link_setting ( -const struct dc_link_settings *link_setting, -const struct dc_link_settings *limit_link_setting) -{ -return (link_setting->lane_count * link_setting->link_rate - > limit_link_setting->lane_count * limit_link_setting->link_rate ? - true : false); -} -static struct dc_link_settings get_max_link_cap (struct core_link *link) {/* Set Default link settings */
@@ -1109,13 +1108,15 @@ bool dp_hbr_verify_link_cap( struct dc_link_settings *known_limit_link_setting) {struct dc_link_settings max_link_cap = {0 }; +struct dc_link_settings cur_link_setting = {0 }; +struct dc_link_settings *cur = &cur_link_setting; +struct dc_link_settings initial_link_settings = {0 };bool success;bool skip_link_training; -const struct dc_link_settings *cur;bool skip_video_pattern; -uint32_t i;struct clock_source *dp_cs;enum clock_source_id dp_cs_id =CLOCK_SOURCE_ID_EXTERNAL ; +enum link_training_result status; success = false; skip_link_training = false;
@@ -1142,19 +1143,16 @@ bool dp_hbr_verify_link_cap(ASSERT (dp_cs); } -for (i =0 ; i <get_link_training_fallback_table_len (link) && - !success; i++) { - cur =get_link_training_fallback_table (link, i); - -if (known_limit_link_setting->lane_count !=LANE_COUNT_UNKNOWN && -exceeded_limit_link_setting (cur, - known_limit_link_setting)) -continue ; - -if (!is_link_setting_supported (cur, &max_link_cap)) -continue ; - +/* link training starts with the maximum common settings +* supported by both sink and ASIC. +*/ + initial_link_settings =get_common_supported_link_settings ( + *known_limit_link_setting, + max_link_cap); + cur_link_setting = initial_link_settings; + do { skip_video_pattern = true; + if (cur->link_rate == LINK_RATE_LOW) skip_video_pattern = false;
@@ -1167,10 +1165,12 @@ bool dp_hbr_verify_link_cap(if (skip_link_training) success = true;else { - success =dc_link_dp_perform_link_training ( + status =dc_link_dp_perform_link_training ( &link->public, cur, skip_video_pattern); +if (status ==LINK_TRAINING_SUCCESS ) + success = true; }if (success)
@@ -1181,7 +1181,8 @@ bool dp_hbr_verify_link_cap(* based on the actual mode we're driving */ dp_disable_link_phy (link, link->public.connector_signal); - } + }while (!success &&decide_fallback_link_setting ( + initial_link_settings, cur, status));/* Link Training failed for all Link Settings * (Lane Count is still unknown)
@@ -1202,6 +1203,160 @@ bool dp_hbr_verify_link_cap(return success; } +struct dc_link_settings get_common_supported_link_settings ( +struct dc_link_settings link_setting_a, +struct dc_link_settings link_setting_b) +{ +struct dc_link_settings link_settings = {0 }; + + link_settings.lane_count = + (link_setting_a.lane_count <= + link_setting_b.lane_count) ? + link_setting_a.lane_count : + link_setting_b.lane_count; + link_settings.link_rate = + (link_setting_a.link_rate <= + link_setting_b.link_rate) ? + link_setting_a.link_rate : + link_setting_b.link_rate; + link_settings.link_spread =LINK_SPREAD_DISABLED ; + +/* in DP compliance test, DPR-120 may have +* a random value in its MAX_LINK_BW dpcd field. +* We map it to the maximum supported link rate that +* is smaller than MAX_LINK_BW in this case. +*/ +if (link_settings.link_rate >LINK_RATE_HIGH3 ) { + link_settings.link_rate =LINK_RATE_HIGH3 ; + }else if (link_settings.link_rate <LINK_RATE_HIGH3 + && link_settings.link_rate >LINK_RATE_HIGH2 ) { + link_settings.link_rate =LINK_RATE_HIGH2 ; + }else if (link_settings.link_rate <LINK_RATE_HIGH2 + && link_settings.link_rate >LINK_RATE_HIGH ) { + link_settings.link_rate =LINK_RATE_HIGH ; + }else if (link_settings.link_rate <LINK_RATE_HIGH + && link_settings.link_rate >LINK_RATE_LOW ) { + link_settings.link_rate =LINK_RATE_LOW ; + }else if (link_settings.link_rate <LINK_RATE_LOW ) { + link_settings.link_rate =LINK_RATE_UNKNOWN ; + } + +return link_settings; +} + +bool reached_minimum_lane_count (enum dc_lane_count lane_count) +{ +return lane_count <=LANE_COUNT_ONE ; +} + +bool reached_minimum_link_rate (enum dc_link_rate link_rate) +{ +return link_rate <=LINK_RATE_LOW ; +} + +enum dc_lane_count reduce_lane_count (enum dc_lane_count lane_count) +{ +switch (lane_count) { +case LANE_COUNT_FOUR : +return LANE_COUNT_TWO ; +case LANE_COUNT_TWO : +return LANE_COUNT_ONE ; +case LANE_COUNT_ONE : +return LANE_COUNT_UNKNOWN ; +default : +return LANE_COUNT_UNKNOWN ; + } +} + +enum dc_link_rate reduce_link_rate (enum dc_link_rate link_rate) +{ +switch (link_rate) { +case LINK_RATE_HIGH3 : +return LINK_RATE_HIGH2 ; +case LINK_RATE_HIGH2 : +return LINK_RATE_HIGH ; +case LINK_RATE_HIGH : +return LINK_RATE_LOW ; +case LINK_RATE_LOW : +return LINK_RATE_UNKNOWN ; +default : +return LINK_RATE_UNKNOWN ; + } +} + +/* +* function: set link rate and lane count fallback based +* on current link setting and last link training result +* return value: +* true - link setting could be set +* false - has reached minimum setting +* and no further fallback could be done +*/ +bool decide_fallback_link_setting ( +struct dc_link_settings initial_link_settings, +struct dc_link_settings *current_link_setting, +enum link_training_result training_result) +{ +if (!current_link_setting) +return false; + +switch (training_result) { +case LINK_TRAINING_CR_FAIL : + { +if (!reached_minimum_link_rate + (current_link_setting->link_rate)) { + current_link_setting->link_rate = +reduce_link_rate ( + current_link_setting->link_rate); + }else if (!reached_minimum_lane_count + (current_link_setting->lane_count)) { + current_link_setting->link_rate = + initial_link_settings.link_rate; + current_link_setting->lane_count = +reduce_lane_count ( + current_link_setting->lane_count); + }else { +return false; + } +break ; + } +case LINK_TRAINING_EQ_FAIL_EQ : + { +if (!reached_minimum_lane_count + (current_link_setting->lane_count)) { + current_link_setting->lane_count = +reduce_lane_count ( + current_link_setting->lane_count); + }else if (!reached_minimum_link_rate + (current_link_setting->link_rate)) { + current_link_setting->lane_count = + initial_link_settings.lane_count; + current_link_setting->link_rate = +reduce_link_rate ( + current_link_setting->link_rate); + }else { +return false; + } +break ; + } +case LINK_TRAINING_EQ_FAIL_CR : + { +if (!reached_minimum_link_rate + (current_link_setting->link_rate)) { + current_link_setting->link_rate = +reduce_link_rate ( + current_link_setting->link_rate); + }else { +return false; + } +break ; + } +default : +return false; + } +return true; +} +static uint32_t bandwidth_in_kbps_from_timing (const struct dc_crtc_timing *timing) {
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
@@ -777,7 +777,7 @@ void dc_link_dp_set_drive_settings(const struct dc_link *link, struct link_training_settings *lt_settings); -bool dc_link_dp_perform_link_training ( +enum link_training_result dc_link_dp_perform_link_training (struct dc_link *link,const struct dc_link_settings *link_setting,bool skip_video_pattern);
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +8 -0
@@ -37,6 +37,14 @@ bool dp_hbr_verify_link_cap(struct core_link *link, struct dc_link_settings *known_limit_link_setting); +bool decide_fallback_link_setting (struct dc_link_settings link_setting_init, +struct dc_link_settings *link_setting_current, +enum link_training_result training_result); + +struct dc_link_settings get_common_supported_link_settings ( +struct dc_link_settings link_setting_a, +struct dc_link_settings link_setting_b); +bool dp_validate_mode_timing (struct core_link *link,const struct dc_crtc_timing *timing);
drivers/gpu/drm/amd/display/include/link_service_types.h +9 -0
@@ -56,6 +56,15 @@ enum {LINK_RATE_REF_FREQ_IN_KHZ =27000 /*27MHz*/ }; +enum link_training_result { +LINK_TRAINING_SUCCESS , +LINK_TRAINING_CR_FAIL , +/* CR DONE bit is cleared during EQ step */ +LINK_TRAINING_EQ_FAIL_CR , +/* other failure during EQ step */ +LINK_TRAINING_EQ_FAIL_EQ , +}; +struct link_training_settings {struct dc_link_settings link_settings;struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX ];
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 75/81 drm/amd/display: fix DVI connected to HDMI connector max tmds clock
In reply to a message not in the archiveFrom: Charlene Liu <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +6 -0
@@ -830,6 +830,12 @@ bool dce110_link_encoder_validate_dvi_output(if (crtc_timing->pixel_encoding !=PIXEL_ENCODING_RGB )return false; +/*connect DVI via adpater's HDMI connector*/ +if ((connector_signal ==SIGNAL_TYPE_DVI_SINGLE_LINK || + connector_signal ==SIGNAL_TYPE_HDMI_TYPE_A ) && + signal !=SIGNAL_TYPE_HDMI_TYPE_A && + crtc_timing->pix_clk_khz >TMDS_MAX_PIXEL_CLOCK ) +return false;if (crtc_timing->pix_clk_khz <TMDS_MIN_PIXEL_CLOCK )return false;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 76/81 drm/amd/display: properly turn off unused mpc before front end programming
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
MPCC_OPP_ID must be programmed to 0xf to properly turn off the mpcc. However the software state of the mpcc must keep track of the opp that the mpcc is attached to for reset to properly happen. This is kinda hacky right now, but a good solution may involve a lot of work.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +8 -1
@@ -1572,17 +1572,24 @@ static void dcn10_apply_ctx_for_surface(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->top_pipe) {ASSERT (0 );continue ; } - mpcc_cfg.opp_id = old_pipe_ctx->mpcc->opp_id; + mpcc_cfg.opp_id =0xf ; mpcc_cfg.top_dpp_id =0xf ; 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); +/* +* the mpcc is the only thing that keeps track of the mpcc +* mapping for reset front end right now. Might need some +* rework. +*/ + old_pipe_ctx->mpcc->opp_id = opp_id_cached; old_pipe_ctx->top_pipe =NULL ; old_pipe_ctx->bottom_pipe =NULL ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 77/81 drm/amd/display: fix aviInfoFrame bar Info and add set_avMute
In reply to a message not in the archiveFrom: Charlene Liu <[email protected]>
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 10 ++++++ drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 37 ++++++++++++++++++---- .../drm/amd/display/dc/dce/dce_stream_encoder.c | 13 +++++++- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 13 ++++++-- .../amd/display/dc/dce110/dce110_hw_sequencer.h | 1 + .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 3 +- drivers/gpu/drm/amd/display/dc/inc/core_types.h | 1 + .../gpu/drm/amd/display/dc/inc/hw/stream_encoder.h | 3 ++ drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h | 2 ++ .../display/dc/virtual/virtual_stream_encoder.c | 4 +++ 10 files changed, 77 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +10 -0
@@ -1911,3 +1911,13 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx)disable_link (pipe_ctx->stream->sink->link, pipe_ctx->stream->signal); } +void core_link_set_avmute (struct pipe_ctx *pipe_ctx,bool enable) +{ +struct core_dc *core_dc =DC_TO_CORE (pipe_ctx->stream->ctx->dc); + +if (pipe_ctx->stream->signal !=SIGNAL_TYPE_HDMI_TYPE_A ) +return ; + + core_dc->hwss.set_avmute (pipe_ctx, enable); +} +
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +31 -6
@@ -1607,6 +1607,8 @@ static void set_avi_info_frame(uint8_t *check_sum =NULL ;uint8_t byte_index =0 ;union hdmi_info_packet *hdmi_info = &info_frame.avi_info_packet.info_packet_hdmi; +unsigned int vic = pipe_ctx->stream->public.timing.vic; +enum dc_timing_3d_format format; color_space = pipe_ctx->stream->public.output_color_space;if (color_space ==COLOR_SPACE_UNKNOWN )
@@ -1661,8 +1663,7 @@ static void set_avi_info_frame(/* C0, C1 : Colorimetry */ if (color_space ==COLOR_SPACE_YCBCR709 || - color_space ==COLOR_SPACE_YCBCR709_LIMITED || - color_space ==COLOR_SPACE_2020_YCBCR ) + color_space ==COLOR_SPACE_YCBCR709_LIMITED ) hdmi_info->bits.C0_C1 =COLORIMETRY_ITU709 ;else if (color_space ==COLOR_SPACE_YCBCR601 || color_space ==COLOR_SPACE_YCBCR601_LIMITED )
@@ -1722,9 +1723,29 @@ static void set_avi_info_frame( hdmi_info->bits.Q0_Q1 =RGB_QUANTIZATION_DEFAULT_RANGE ; hdmi_info->bits.YQ0_YQ1 =YYC_QUANTIZATION_LIMITED_RANGE ; } - - hdmi_info->bits.VIC0_VIC7 = - stream->public.timing.vic; +///VIC + format = stream->public.timing.timing_3d_format; +/*todo, add 3DStereo support*/ +if (format !=TIMING_3D_FORMAT_NONE ) { +// Based on HDMI specs hdmi vic needs to be converted to cea vic when 3D is enabled +switch (pipe_ctx->stream->public.timing.hdmi_vic) { +case 1 : + vic =95 ; +break ; +case 2 : + vic =94 ; +break ; +case 3 : + vic =93 ; +break ; +case 4 : + vic =98 ; +break ; +default : +break ; + } + } + hdmi_info->bits.VIC0_VIC7 = vic;/* pixel repetition * PR0 - PR3 start from 0 whereas pHwPathMode->mode.timing.flags.pixel
@@ -1737,7 +1758,7 @@ static void set_avi_info_frame(* barLeft: Pixel Number of End of Left Bar. * barRight: Pixel Number of Start of Right Bar. */ hdmi_info->bits.bar_top = stream->public.timing.v_border_top; - hdmi_info->bits.bar_bottom = (stream->public.timing.v_border_top + hdmi_info->bits.bar_bottom = (stream->public.timing.v_total - stream->public.timing.v_border_bottom +1 ); hdmi_info->bits.bar_left = stream->public.timing.h_border_left; hdmi_info->bits.bar_right = (stream->public.timing.h_total
@@ -1776,6 +1797,10 @@ static void set_vendor_info_packet(uint8_t checksum =0 ;uint32_t i =0 ;enum dc_timing_3d_format format; +// Can be different depending on packet content /*todo*/ +// unsigned int length = pPathMode->dolbyVision ? 24 : 5; + + info_packet->valid = false; format = stream->public.timing.timing_3d_format;if (stream->public.view_format ==VIEW_3D_FORMAT_NONE )
drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c +12 -1
@@ -1003,6 +1003,16 @@ static void dce110_stream_encoder_dp_unblank(REG_UPDATE (DP_VID_STREAM_CNTL ,DP_VID_STREAM_ENABLE , true); } +static void dce110_stream_encoder_set_avmute ( +struct stream_encoder *enc, +bool enable) +{ +struct dce110_stream_encoder *enc110 =DCE110STRENC_FROM_STRENC (enc); +unsigned int value = enable ?1 :0 ; + +REG_UPDATE (HDMI_GC ,HDMI_GC_AVMUTE , value); +} +#define DP_SEC_AUD_N__DP_SEC_AUD_N__DEFAULT 0x8000#define DP_SEC_TIMESTAMP__DP_SEC_TIMESTAMP_MODE__AUTO_CALC 1
@@ -1582,7 +1592,6 @@ static const struct stream_encoder_funcs dce110_str_enc_funcs = { dce110_stream_encoder_dp_blank, .dp_unblank = dce110_stream_encoder_dp_unblank, - .audio_mute_control = dce110_se_audio_mute_control, .dp_audio_setup = dce110_se_dp_audio_setup,
@@ -1592,6 +1601,8 @@ static const struct stream_encoder_funcs dce110_str_enc_funcs = { .hdmi_audio_setup = dce110_se_hdmi_audio_setup, .hdmi_audio_disable = dce110_se_hdmi_audio_disable, .setup_stereo_sync = setup_stereo_sync, + .set_avmute = dce110_stream_encoder_set_avmute, + }; bool dce110_stream_encoder_construct(
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +11 -2
@@ -801,6 +801,13 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx, pipe_ctx->stream_enc->funcs->dp_unblank (pipe_ctx->stream_enc, ¶ms); } + +void dce110_set_avmute (struct pipe_ctx *pipe_ctx,bool enable) +{ +if (pipe_ctx !=NULL && pipe_ctx->stream_enc !=NULL ) + pipe_ctx->stream_enc->funcs->set_avmute (pipe_ctx->stream_enc, enable); +} +static enum audio_dto_source translate_to_dto_source (enum controller_id crtc_id) {switch (crtc_id) {
@@ -1095,10 +1102,11 @@ static enum dc_status apply_single_controller_ctx_to_hw( (pipe_ctx->stream->signal ==SIGNAL_TYPE_DVI_DUAL_LINK ) ? true : false); +resource_build_info_frame (pipe_ctx); +if (!pipe_ctx_old->stream) {core_link_enable_stream (pipe_ctx); -resource_build_info_frame (pipe_ctx);dce110_update_info_frame (pipe_ctx);if (dc_is_dp_signal (pipe_ctx->stream->signal)) dce110_unblank_stream(pipe_ctx,
@@ -2600,7 +2608,8 @@ static const struct hw_sequencer_funcs dce110_funcs = { .set_static_screen_control = set_static_screen_control, .reset_hw_ctx_wrap = reset_hw_ctx_wrap, .prog_pixclk_crtc_otg = dce110_prog_pixclk_crtc_otg, - .setup_stereo = NULL + .setup_stereo = NULL, + .set_avmute = dce110_set_avmute, };bool dce110_hw_sequencer_construct (struct core_dc *dc)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h +1 -0
@@ -54,6 +54,7 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,void dce110_update_info_frame (struct pipe_ctx *pipe_ctx); +void dce110_set_avmute (struct pipe_ctx *pipe_ctx,bool enable);void dce110_enable_accelerated_mode (struct core_dc *dc);void dce110_power_down (struct core_dc *dc);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -1
@@ -1867,7 +1867,8 @@ static const struct hw_sequencer_funcs dcn10_funcs = { .set_drr = set_drr, .get_position = get_position, .set_static_screen_control = set_static_screen_control, - .setup_stereo = dcn10_setup_stereo + .setup_stereo = dcn10_setup_stereo, + .set_avmute = dce110_set_avmute, };
drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -0
@@ -179,6 +179,7 @@ void core_link_enable_stream(struct pipe_ctx *pipe_ctx);void core_link_disable_stream (struct pipe_ctx *pipe_ctx); +void core_link_set_avmute (struct pipe_ctx *pipe_ctx,bool enable);/********** DAL Core*********************/ #include "display_clock.h" #include "transform.h"
drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h +3 -0
@@ -123,6 +123,9 @@ struct stream_encoder_funcs {struct stream_encoder *enc, int tg_inst, bool enable); + +void (*set_avmute)( + struct stream_encoder *enc, bool enable); };#endif /* STREAM_ENCODER_H_ */
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +2 -0
@@ -152,6 +152,8 @@ struct hw_sequencer_funcs {void (*setup_stereo)(struct pipe_ctx *pipe_ctx,struct core_dc *dc); + +void (*set_avmute)(struct pipe_ctx *pipe_ctx,bool enable); }; void color_space_to_black_color(
drivers/gpu/drm/amd/display/dc/virtual/virtual_stream_encoder.c +4 -0
@@ -53,6 +53,9 @@ static void virtual_stream_encoder_update_hdmi_info_packets(static void virtual_stream_encoder_stop_hdmi_info_packets (struct stream_encoder *enc) {} +static void virtual_stream_encoder_set_avmute ( +struct stream_encoder *enc, +bool enable) {}static void virtual_stream_encoder_update_dp_info_packets (struct stream_encoder *enc,const struct encoder_info_frame *info_frame) {}
@@ -94,6 +97,7 @@ static const struct stream_encoder_funcs virtual_str_enc_funcs = { virtual_stream_encoder_dp_unblank, .audio_mute_control = virtual_audio_mute_control, + .set_avmute = virtual_stream_encoder_set_avmute, }; bool virtual_stream_encoder_construct(
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 78/81 drm/amd/display: revert order change of HUBP and MPC disable
In reply to a message not in the archiveFrom: Tony Cheng <[email protected]>
- root cause was we disable opp clk in MPC disconnect
- hubp_blank is not double buffered, so we can't blank until MPC disconnect or we have risk of underflow
--- drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h | 2 -- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 41 +++++++++++++--------- .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c | 5 +++ .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h | 2 ++ 4 files changed, 32 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +0 -2
@@ -288,7 +288,6 @@ struct dce_hwseq_registers {HWS_SF1 (OTG0_ ,PHYPLL_PIXEL_RATE_CNTL ,PHYPLL_PIXEL_RATE_SOURCE , mask_sh), \HWS_SF (OTG0_ ,OTG_GLOBAL_SYNC_STATUS ,VUPDATE_NO_LOCK_EVENT_CLEAR , mask_sh), \HWS_SF (OTG0_ ,OTG_GLOBAL_SYNC_STATUS ,VUPDATE_NO_LOCK_EVENT_OCCURRED , mask_sh), \ -HWS_SF (HUBP0_ ,DCHUBP_CNTL ,HUBP_NO_OUTSTANDING_REQ , mask_sh), \HWS_SF (HUBP0_ ,DCHUBP_CNTL ,HUBP_VTG_SEL , mask_sh), \HWS_SF (HUBP0_ ,HUBP_CLK_CNTL ,HUBP_CLOCK_ENABLE , mask_sh), \ HWS_SF(DPP_TOP0_, DPP_CONTROL, DPP_CLOCK_ENABLE, mask_sh), \
@@ -351,7 +350,6 @@ struct dce_hwseq_registers {#define HWSEQ_DCN_REG_FIELD_LIST (type) \ type VUPDATE_NO_LOCK_EVENT_CLEAR; \ type VUPDATE_NO_LOCK_EVENT_OCCURRED; \ - type HUBP_NO_OUTSTANDING_REQ; \ type HUBP_VTG_SEL; \ type HUBP_CLOCK_ENABLE; \ type DPP_CLOCK_ENABLE; \
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +25 -16
77 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c +5 -0
@@ -46,6 +46,11 @@ static void min10_set_blank(struct mem_input *mem_input, bool blank)REG_UPDATE_2 (DCHUBP_CNTL ,HUBP_BLANK_EN , blank_en,HUBP_TTU_DISABLE , blank_en); + +if (blank) +REG_WAIT (DCHUBP_CNTL , +HUBP_NO_OUTSTANDING_REQ ,1 , +1 ,200 ); } static void min10_vready_workaround(struct mem_input *mem_input,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.h +2 -0
@@ -304,6 +304,7 @@ struct dcn_mi_registers {#define MI_MASK_SH_LIST_DCN (mask_sh)\ MI_SF(HUBP0_DCHUBP_CNTL, HUBP_BLANK_EN, mask_sh),\ MI_SF(HUBP0_DCHUBP_CNTL, HUBP_TTU_DISABLE, mask_sh),\ + MI_SF(HUBP0_DCHUBP_CNTL, HUBP_NO_OUTSTANDING_REQ, mask_sh),\ MI_SF(HUBP0_DCSURF_ADDR_CONFIG, NUM_PIPES, mask_sh),\ MI_SF(HUBP0_DCSURF_ADDR_CONFIG, NUM_BANKS, mask_sh),\ MI_SF(HUBP0_DCSURF_ADDR_CONFIG, PIPE_INTERLEAVE, mask_sh),\
@@ -463,6 +464,7 @@ struct dcn_mi_registers {#define DCN_MI_REG_FIELD_LIST (type) \ type HUBP_BLANK_EN;\ type HUBP_TTU_DISABLE;\ + type HUBP_NO_OUTSTANDING_REQ;\ type NUM_PIPES;\ type NUM_BANKS;\ type PIPE_INTERLEAVE;\
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 79/81 drm/amd/display: Add regkey for DRR control for internal panel
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
Also need to change default to off
--- drivers/gpu/drm/amd/display/dc/dc.h | 1 - .../drm/amd/display/modules/freesync/freesync.c | 74 ++++++++++++---------- .../gpu/drm/amd/display/modules/inc/mod_freesync.h | 1 - 3 files changed, 40 insertions(+), 36 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +0 -1
@@ -188,7 +188,6 @@ struct dc_debug {bool disable_dmcu;bool disable_psr;bool force_abm_enable; -bool no_static_for_external_dp; };struct dc {
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +40 -34
128 lines not on this page · raw message
drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h +0 -1
@@ -88,7 +88,6 @@ struct mod_freesync_caps {unsigned int max_refresh_in_micro_hz;bool btr_supported; -bool no_static_for_external_dp; };struct mod_freesync_params {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 80/81 drm/amd/display: powergate fe of reused pipes to reset ttu
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
When we exit MPO, disconnected pipes cannot be immediately powergated because registers are double buffered, and actual disconnection does not happen until VUPDATE. So it is differred for many flips. However in the case of exiting full screen, the transition from MPO to grph only back to MPO is very fast and also involves increasing of watermarks. Since the underlay pipe is never powergated in this scenario, it keeps its old TTU counter, which causes allowPstateSwitch signal to be de-asserted when compared to the new increased watermark. Since the new pipe is not enabled yet, the signal will be continously de-asserted and hangs SMU, who's waiting for the signal to do pstate switching.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +9 -0
@@ -1577,6 +1577,14 @@ static void dcn10_apply_ctx_for_surface(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]; +/* +* 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 ) +dcn10_power_down_fe (dc, pipe_ctx->pipe_idx); + }if ((!pipe_ctx->surface && old_pipe_ctx->surface) || (!pipe_ctx->stream && old_pipe_ctx->stream)) {
@@ -1588,6 +1596,7 @@ static void dcn10_apply_ctx_for_surface(continue ; } +/* reset mpc */ mpcc_cfg.opp_id =0xf ; mpcc_cfg.top_dpp_id =0xf ; mpcc_cfg.bot_mpcc_id =0xf ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 81/81 drm/amd/display: Do not release state objects on atomic check fail
In reply to a message not in the archiveFrom: "Leo (Sunpeng) Li" <[email protected]>
In any drm ioctl call, drm_atomic_state_clear() is called at the end to destroy the states; even if atomic check fails. Therefore, releasing states on atomic check failure is incorrect.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +6 -15
@@ -3158,7 +3158,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, conn_state =drm_atomic_get_connector_state (state, &aconnector->base);if (IS_ERR (conn_state)) { ret =PTR_ERR_OR_ZERO (conn_state); - goto fail_crtcs; + goto fail; } dm_conn_state =to_dm_connector_state (conn_state);
@@ -3217,7 +3217,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ret =drm_atomic_add_affected_planes (state, crtc);if (ret) - goto fail_crtcs; + goto fail; } }
@@ -3279,7 +3279,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, crtc_state, false);if (ret) - goto fail_planes; + goto fail;if (dm_plane_state->surface)
@@ -3311,13 +3311,12 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ret =do_aquire_global_lock (dev, state);if (ret) - goto fail_planes; - + goto fail;WARN_ON (dm_state->context); dm_state->context =dc_get_validate_context (dc, set, set_count);if (!dm_state->context) { ret = -EINVAL ; - goto fail_planes; + goto fail; } }
@@ -3325,15 +3324,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,WARN_ON (ret);return ret; -fail_planes: -for (i =0 ; i < set_count; i++) -for (j =0 ; j < set[i].surface_count; j++) -dc_surface_release (set[i].surfaces[j]); - -fail_crtcs: -for (i =0 ; i < set_count; i++) -dc_stream_release (set[i].stream); - +fail:if (ret == -EDEADLK )DRM_DEBUG_KMS ("Atomic check stopped due to to deadlock.\n" );else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS )
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx