/* * 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"), * 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 *
*/
/* Bit 24 - Memory write to region 0 defined by MC registers. */
FBC_IDLE_FORCE_MEMORY_WRITE_TO_REGION0 = 0x01000000, /* Bit 25 - Memory write to region 1 defined by MC registers */
FBC_IDLE_FORCE_MEMORY_WRITE_TO_REGION1 = 0x02000000, /* Bit 26 - Memory write to region 2 defined by MC registers */
FBC_IDLE_FORCE_MEMORY_WRITE_TO_REGION2 = 0x04000000, /* Bit 27 - Memory write to region 3 defined by MC registers. */
FBC_IDLE_FORCE_MEMORY_WRITE_TO_REGION3 = 0x08000000,
/* Bit 28 - Memory write from any client other than MCIF */
FBC_IDLE_FORCE_MEMORY_WRITE_OTHER_THAN_MCIF = 0x10000000, /* Bit 29 - CG statics screen signal is inactive */
FBC_IDLE_FORCE_CG_STATIC_SCREEN_IS_INACTIVE = 0x20000000,
};
static uint32_t lpt_memory_control_config(struct dce112_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:
DC_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:
DC_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:
DC_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:
DC_LOG_WARNING( "%s: Invalid LPT ROW_SIZE!!!",
__func__); break;
}
} else {
DC_LOG_WARNING( "%s: LPT MC Configuration is not provided",
__func__);
}
/* 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)) {
dce112_compressor_enable_lpt(compressor);
}
/* Keep track of enum controller_id FBC is attached to */
compressor->is_enabled = true;
compressor->attached_inst = params->inst;
cp110->offsets = reg_offsets[params->inst];
/*Toggle it as there is bug in HW */
set_reg_field_value(value, 0, FBC_CNTL, FBC_GRPH_COMP_EN);
dm_write_reg(compressor->ctx, addr, value);
set_reg_field_value(value, 1, FBC_CNTL, FBC_GRPH_COMP_EN);
dm_write_reg(compressor->ctx, addr, value);
/* Whenever disabling FBC make sure LPT is disabled if LPT
* supported */ if (compressor->options.bits.LPT_SUPPORT)
dce112_compressor_disable_lpt(compressor);
value = dm_read_reg(compressor->ctx, mmFBC_STATUS); if (get_reg_field_value(value, FBC_STATUS, FBC_ENABLE_STATUS)) { if (inst != NULL)
*inst = compressor->attached_inst; returntrue;
}
value = dm_read_reg(compressor->ctx, mmFBC_MISC); if (get_reg_field_value(value, FBC_MISC, FBC_STOP_ON_HFLIP_EVENT)) {
value = dm_read_reg(compressor->ctx, mmFBC_CNTL);
if (get_reg_field_value(value, FBC_CNTL, FBC_GRPH_COMP_EN)) { if (inst != NULL)
*inst =
compressor->attached_inst; returntrue;
}
} returnfalse;
}
bool dce112_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);
/* Write address, HIGH has to be first. */
dm_write_reg(compressor->ctx,
DCP_REG(mmGRPH_COMPRESS_SURFACE_ADDRESS_HIGH),
compressor->compr_surface_address.addr.high_part);
dm_write_reg(compressor->ctx,
DCP_REG(mmGRPH_COMPRESS_SURFACE_ADDRESS),
compressed_surf_address_low_part);
/* 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:
DC_LOG_WARNING( "%s: Invalid selected DRAM channels for LPT!!!",
__func__); break;
}
void dce112_compressor_set_fbc_invalidation_triggers( struct compressor *compressor,
uint32_t fbc_trigger)
{ /* Disable region hit event, FBC_MEMORY_REGION_MASK = 0 (bits 16-19) * for DCE 11 regions cannot be used - does not work with S/G
*/
uint32_t addr = mmFBC_CLIENT_REGION_MASK;
uint32_t value = dm_read_reg(compressor->ctx, addr);
/* Setup events when to clear all CSM entries (effectively marking * current compressed data invalid) * For DCE 11 CSM metadata 11111 means - "Not Compressed" * Used as the initial value of the metadata sent to the compressor * after invalidation, to indicate that the compressor should attempt * to compress all chunks on the current pass. Also used when the chunk * is not successfully written to memory. * When this CSM value is detected, FBC reads from the uncompressed * buffer. Set events according to passed in value, these events are * valid for DCE11: * - bit 0 - display register updated * - bit 28 - memory write from any client except from MCIF * - bit 29 - CG static screen signal is inactive * In addition, DCE11.1 also needs to set new DCE11.1 specific events * that are used to trigger invalidation on certain register changes, * for example enabling of Alpha Compression may trigger invalidation of * FBC once bit is set. These events are as follows: * - Bit 2 - FBC_GRPH_COMP_EN register updated * - Bit 3 - FBC_SRC_SEL register updated * - Bit 4 - FBC_MIN_COMPRESSION register updated * - Bit 5 - FBC_ALPHA_COMP_EN register updated * - Bit 6 - FBC_ZERO_ALPHA_CHUNK_SKIP_EN register updated * - Bit 7 - FBC_FORCE_COPY_TO_COMP_BUF register updated
*/
addr = mmFBC_IDLE_FORCE_CLEAR_MASK;
value = dm_read_reg(compressor->ctx, addr);
set_reg_field_value(
value,
fbc_trigger |
FBC_IDLE_FORCE_GRPH_COMP_EN |
FBC_IDLE_FORCE_SRC_SEL_CHANGE |
FBC_IDLE_FORCE_MIN_COMPRESSION_CHANGE |
FBC_IDLE_FORCE_ALPHA_COMP_EN |
FBC_IDLE_FORCE_ZERO_ALPHA_CHUNK_SKIP_EN |
FBC_IDLE_FORCE_FORCE_COPY_TO_COMP_BUF,
FBC_IDLE_FORCE_CLEAR_MASK,
FBC_IDLE_FORCE_CLEAR_MASK);
dm_write_reg(compressor->ctx, addr, value);
}
compressor->base.options.raw = 0;
compressor->base.options.bits.FBC_SUPPORT = true;
compressor->base.options.bits.LPT_SUPPORT = true; /* For DCE 11 always use one DRAM channel for LPT */
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;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.