Path: blob/master/drivers/gpu/drm/amd/display/dc/dc_dsc.h
26535 views
#ifndef DC_DSC_H_1#define DC_DSC_H_2/*3* Copyright 2019 Advanced Micro Devices, Inc.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the "Software"),7* to deal in the Software without restriction, including without limitation8* the rights to use, copy, modify, merge, publish, distribute, sublicense,9* and/or sell copies of the Software, and to permit persons to whom the10* Software is furnished to do so, subject to the following conditions:11*12* The above copyright notice and this permission notice shall be included in13* all copies or substantial portions of the Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL18* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR19* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,20* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR21* OTHER DEALINGS IN THE SOFTWARE.22*23* Author: AMD24*/2526/* put it here temporarily until linux has the new addresses official defined */27/* DP Extended DSC Capabilities */28#define DP_DSC_BRANCH_OVERALL_THROUGHPUT_0 0x0a0 /* DP 1.4a SCR */29#define DP_DSC_BRANCH_OVERALL_THROUGHPUT_1 0x0a130#define DP_DSC_BRANCH_MAX_LINE_WIDTH 0x0a231#include "dc_types.h"3233struct dc_dsc_bw_range {34uint32_t min_kbps; /* Bandwidth if min_target_bpp_x16 is used */35uint32_t min_target_bpp_x16;36uint32_t max_kbps; /* Bandwidth if max_target_bpp_x16 is used */37uint32_t max_target_bpp_x16;38uint32_t stream_kbps; /* Uncompressed stream bandwidth */39};4041struct display_stream_compressor {42const struct dsc_funcs *funcs;43struct dc_context *ctx;44int inst;45};4647struct dc_dsc_policy {48bool use_min_slices_h;49int max_slices_h; // Maximum available if 050int min_slice_height; // Must not be less than 851uint32_t max_target_bpp;52uint32_t min_target_bpp;53bool enable_dsc_when_not_needed;54};5556struct dc_dsc_config_options {57uint32_t dsc_min_slice_height_override;58uint32_t max_target_bpp_limit_override_x16;59uint32_t slice_height_granularity;60uint32_t dsc_force_odm_hslice_override;61bool force_dsc_when_not_needed;62};6364bool dc_dsc_parse_dsc_dpcd(const struct dc *dc,65const uint8_t *dpcd_dsc_basic_data,66const uint8_t *dpcd_dsc_ext_data,67struct dsc_dec_dpcd_caps *dsc_sink_caps);6869bool dc_dsc_compute_bandwidth_range(70const struct display_stream_compressor *dsc,71uint32_t dsc_min_slice_height_override,72uint32_t min_bpp_x16,73uint32_t max_bpp_x16,74const struct dsc_dec_dpcd_caps *dsc_sink_caps,75const struct dc_crtc_timing *timing,76const enum dc_link_encoding_format link_encoding,77struct dc_dsc_bw_range *range);7879bool dc_dsc_compute_config(80const struct display_stream_compressor *dsc,81const struct dsc_dec_dpcd_caps *dsc_sink_caps,82const struct dc_dsc_config_options *options,83uint32_t target_bandwidth_kbps,84const struct dc_crtc_timing *timing,85const enum dc_link_encoding_format link_encoding,86struct dc_dsc_config *dsc_cfg);8788uint32_t dc_dsc_stream_bandwidth_in_kbps(const struct dc_crtc_timing *timing,89uint32_t bpp_x16, uint32_t num_slices_h, bool is_dp);9091uint32_t dc_dsc_stream_bandwidth_overhead_in_kbps(92const struct dc_crtc_timing *timing,93const int num_slices_h,94const bool is_dp);9596void dc_dsc_dump_decoder_caps(const struct display_stream_compressor *dsc,97const struct dsc_dec_dpcd_caps *dsc_sink_caps);98void dc_dsc_dump_encoder_caps(const struct display_stream_compressor *dsc,99const struct dc_crtc_timing *timing);100101/* TODO - Hardware/specs limitation should be owned by dc dsc and returned to DM,102* and DM can choose to OVERRIDE the limitation on CASE BY CASE basis.103* Hardware/specs limitation should not be writable by DM.104* It should be decoupled from DM specific policy and named differently.105*/106void dc_dsc_get_policy_for_timing(const struct dc_crtc_timing *timing,107uint32_t max_target_bpp_limit_override_x16,108struct dc_dsc_policy *policy,109const enum dc_link_encoding_format link_encoding);110111void dc_dsc_policy_set_max_target_bpp_limit(uint32_t limit);112113void dc_dsc_policy_set_enable_dsc_when_not_needed(bool enable);114115void dc_dsc_policy_set_disable_dsc_stream_overhead(bool disable);116117void dc_dsc_get_default_config_option(const struct dc *dc, struct dc_dsc_config_options *options);118119#endif120121122