/* * 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 * */ #include "dm_services.h" #include "basics/conversion.h" #include "dce_opp.h" #include "reg_helper.h" #define REG(reg) … #undef FN #define FN(reg_name, field_name) … #define CTX … enum { … }; enum { … }; enum { … }; /* ***************************************************************************** * Function: regamma_config_regions_and_segments * * build regamma curve by using predefined hw points * uses interface parameters ,like EDID coeff. * * @param : parameters interface parameters * @return void * * @note * * @see * ***************************************************************************** */ /* * set_truncation * 1) set truncation depth: 0 for 18 bpp or 1 for 24 bpp * 2) enable truncation * 3) HW remove 12bit FMT support for DCE11 power saving reason. */ static void set_truncation( struct dce110_opp *opp110, const struct bit_depth_reduction_params *params) { … } #if defined(CONFIG_DRM_AMD_DC_SI) /* * dce60_set_truncation * 1) set truncation depth: 0 for 18 bpp or 1 for 24 bpp * 2) enable truncation * 3) HW remove 12bit FMT support for DCE11 power saving reason. */ static void dce60_set_truncation( struct dce110_opp *opp110, const struct bit_depth_reduction_params *params) { … } #endif /* * set_spatial_dither * 1) set spatial dithering mode: pattern of seed * 2) set spatial dithering depth: 0 for 18bpp or 1 for 24bpp * 3) set random seed * 4) set random mode * lfsr is reset every frame or not reset * RGB dithering method * 0: RGB data are all dithered with x^28+x^3+1 * 1: R data is dithered with x^28+x^3+1 * G data is dithered with x^28+X^9+1 * B data is dithered with x^28+x^13+1 * enable high pass filter or not * 5) enable spatical dithering */ static void set_spatial_dither( struct dce110_opp *opp110, const struct bit_depth_reduction_params *params) { … } /* * SetTemporalDither (Frame Modulation) * 1) set temporal dither depth * 2) select pattern: from hard-coded pattern or programmable pattern * 3) select optimized strips for BGR or RGB LCD sub-pixel * 4) set s matrix * 5) set t matrix * 6) set grey level for 0.25, 0.5, 0.75 * 7) enable temporal dithering */ static void set_temporal_dither( struct dce110_opp *opp110, const struct bit_depth_reduction_params *params) { … } /* * Set Clamping * 1) Set clamping format based on bpc - 0 for 6bpc (No clamping) * 1 for 8 bpc * 2 for 10 bpc * 3 for 12 bpc * 7 for programable * 2) Enable clamp if Limited range requested */ void dce110_opp_set_clamping( struct dce110_opp *opp110, const struct clamping_and_pixel_encoding_params *params) { … } #if defined(CONFIG_DRM_AMD_DC_SI) /* * Set Clamping for DCE6 parts * 1) Set clamping format based on bpc - 0 for 6bpc (No clamping) * 1 for 8 bpc * 2 for 10 bpc * 3 for 12 bpc * 7 for programable * 2) Enable clamp if Limited range requested */ static void dce60_opp_set_clamping( struct dce110_opp *opp110, const struct clamping_and_pixel_encoding_params *params) { … } #endif /* * set_pixel_encoding * * Set Pixel Encoding * 0: RGB 4:4:4 or YCbCr 4:4:4 or YOnly * 1: YCbCr 4:2:2 */ static void set_pixel_encoding( struct dce110_opp *opp110, const struct clamping_and_pixel_encoding_params *params) { … } #if defined(CONFIG_DRM_AMD_DC_SI) /* * dce60_set_pixel_encoding * DCE6 has no FMT_SUBSAMPLING_{MODE,ORDER} bits in FMT_CONTROL reg * Set Pixel Encoding * 0: RGB 4:4:4 or YCbCr 4:4:4 or YOnly * 1: YCbCr 4:2:2 */ static void dce60_set_pixel_encoding( struct dce110_opp *opp110, const struct clamping_and_pixel_encoding_params *params) { … } #endif void dce110_opp_program_bit_depth_reduction( struct output_pixel_processor *opp, const struct bit_depth_reduction_params *params) { … } #if defined(CONFIG_DRM_AMD_DC_SI) static void dce60_opp_program_bit_depth_reduction( struct output_pixel_processor *opp, const struct bit_depth_reduction_params *params) { … } #endif void dce110_opp_program_clamping_and_pixel_encoding( struct output_pixel_processor *opp, const struct clamping_and_pixel_encoding_params *params) { … } #if defined(CONFIG_DRM_AMD_DC_SI) static void dce60_opp_program_clamping_and_pixel_encoding( struct output_pixel_processor *opp, const struct clamping_and_pixel_encoding_params *params) { … } #endif static void program_formatter_420_memory(struct output_pixel_processor *opp) { … } void dce110_opp_set_dyn_expansion( struct output_pixel_processor *opp, enum dc_color_space color_sp, enum dc_color_depth color_dpth, enum signal_type signal) { … } static void program_formatter_reset_dig_resync_fifo(struct output_pixel_processor *opp) { … } void dce110_opp_program_fmt( struct output_pixel_processor *opp, struct bit_depth_reduction_params *fmt_bit_depth, struct clamping_and_pixel_encoding_params *clamping) { … } #if defined(CONFIG_DRM_AMD_DC_SI) static void dce60_opp_program_fmt( struct output_pixel_processor *opp, struct bit_depth_reduction_params *fmt_bit_depth, struct clamping_and_pixel_encoding_params *clamping) { … } #endif /*****************************************/ /* Constructor, Destructor */ /*****************************************/ static const struct opp_funcs funcs = …; #if defined(CONFIG_DRM_AMD_DC_SI) static const struct opp_funcs dce60_opp_funcs = …; #endif void dce110_opp_construct(struct dce110_opp *opp110, struct dc_context *ctx, uint32_t inst, const struct dce_opp_registers *regs, const struct dce_opp_shift *opp_shift, const struct dce_opp_mask *opp_mask) { … } #if defined(CONFIG_DRM_AMD_DC_SI) void dce60_opp_construct(struct dce110_opp *opp110, struct dc_context *ctx, uint32_t inst, const struct dce_opp_registers *regs, const struct dce_opp_shift *opp_shift, const struct dce_opp_mask *opp_mask) { … } #endif void dce110_opp_destroy(struct output_pixel_processor **opp) { … }