/* * Copyright 2018 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"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: AMD * */ #include "dcn10/dcn10_hubp.h" #include "dcn21_hubp.h" #include "dm_services.h" #include "reg_helper.h" #include "dc_dmub_srv.h" #define DC_LOGGER … #define DC_LOGGER_INIT(logger) … #define REG(reg) … #define CTX … #undef FN #define FN(reg_name, field_name) … /* * In DCN2.1, the non-double buffered version of the following 4 DLG registers are used in RTL. * As a result, if S/W updates any of these registers during a mode change, * the current frame before the mode change will use the new value right away * and can lead to generating incorrect request deadlines and incorrect TTU/QoS behavior. * * REFCYC_PER_VM_GROUP_FLIP[22:0] * REFCYC_PER_VM_GROUP_VBLANK[22:0] * REFCYC_PER_VM_REQ_FLIP[22:0] * REFCYC_PER_VM_REQ_VBLANK[22:0] * * REFCYC_PER_VM_*_FLIP affects the deadline of the VM requests generated * when flipping to a new surface * * REFCYC_PER_VM_*_VBLANK affects the deadline of the VM requests generated * during prefetch period of a frame. The prefetch starts at a pre-determined * number of lines before the display active per frame * * DCN may underflow due to incorrectly programming these registers * during VM stage of prefetch/iflip. First lines of display active * or a sub-region of active using a new surface will be corrupted * until the VM data returns at flip/mode change transitions * * Work around: * workaround is always opt to use the more aggressive settings. * On any mode switch, if the new reg values are smaller than the current values, * then update the regs with the new values. * * Link to the ticket: http://ontrack-internal.amd.com/browse/DEDCN21-142 * */ void apply_DEDCN21_142_wa_for_hostvm_deadline( struct hubp *hubp, struct _vcs_dpi_display_dlg_regs_st *dlg_attr) { … } void hubp21_program_deadline( struct hubp *hubp, struct _vcs_dpi_display_dlg_regs_st *dlg_attr, struct _vcs_dpi_display_ttu_regs_st *ttu_attr) { … } void hubp21_program_requestor( struct hubp *hubp, struct _vcs_dpi_display_rq_regs_st *rq_regs) { … } static void hubp21_setup( struct hubp *hubp, 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) { … } static void hubp21_set_viewport( struct hubp *hubp, const struct rect *viewport, const struct rect *viewport_c) { … } static void hubp21_set_vm_system_aperture_settings(struct hubp *hubp, struct vm_system_aperture_param *apt) { … } static void hubp21_validate_dml_output(struct hubp *hubp, struct dc_context *ctx, struct _vcs_dpi_display_rq_regs_st *dml_rq_regs, struct _vcs_dpi_display_dlg_regs_st *dml_dlg_attr, struct _vcs_dpi_display_ttu_regs_st *dml_ttu_attr) { … } static void program_surface_flip_and_addr(struct hubp *hubp, struct surface_flip_registers *flip_regs) { … } static void dmcub_PLAT_54186_wa(struct hubp *hubp, struct surface_flip_registers *flip_regs) { … } static bool hubp21_program_surface_flip_and_addr( struct hubp *hubp, const struct dc_plane_address *address, bool flip_immediate) { … } static void hubp21_init(struct hubp *hubp) { … } static struct hubp_funcs dcn21_hubp_funcs = …; bool hubp21_construct( struct dcn21_hubp *hubp21, struct dc_context *ctx, uint32_t inst, const struct dcn_hubp2_registers *hubp_regs, const struct dcn_hubp2_shift *hubp_shift, const struct dcn_hubp2_mask *hubp_mask) { … }