Resguardo inicial

This commit is contained in:
lastdragon
2026-09-06 12:53:21 -06:00
parent 662efe3c2a
commit ad2088d178
94853 changed files with 43200404 additions and 0 deletions
@@ -0,0 +1,47 @@
/*
* Copyright 2019 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
*
*/
#ifndef MOD_COLOR_TYPES_H_
#define MOD_COLOR_TYPES_H_
enum predefined_gamut_type {
gamut_type_bt709,
gamut_type_bt601,
gamut_type_adobe_rgb,
gamut_type_srgb,
gamut_type_bt2020,
gamut_type_dcip3,
gamut_type_unknown,
};
enum predefined_white_point_type {
white_point_type_5000k_horizon,
white_point_type_6500k_noon,
white_point_type_7500k_north_sky,
white_point_type_9300k,
white_point_type_unknown,
};
#endif /* MOD_COLOR_TYPES_H_ */
@@ -0,0 +1,149 @@
/*
* Copyright 2016 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
*
*/
#ifndef MOD_FREESYNC_H_
#define MOD_FREESYNC_H_
#include "mod_shared.h"
// Access structures
struct mod_freesync {
int dummy;
};
// TODO: References to this should be removed
struct mod_freesync_caps {
bool supported;
unsigned int min_refresh_in_micro_hz;
unsigned int max_refresh_in_micro_hz;
};
enum mod_vrr_state {
VRR_STATE_UNSUPPORTED = 0,
VRR_STATE_DISABLED,
VRR_STATE_INACTIVE,
VRR_STATE_ACTIVE_VARIABLE,
VRR_STATE_ACTIVE_FIXED
};
struct mod_freesync_config {
enum mod_vrr_state state;
bool vsif_supported;
bool ramping;
bool btr;
unsigned int min_refresh_in_uhz;
unsigned int max_refresh_in_uhz;
unsigned int fixed_refresh_in_uhz;
};
struct mod_vrr_params_btr {
bool btr_enabled;
bool btr_active;
uint32_t mid_point_in_us;
uint32_t inserted_duration_in_us;
uint32_t frames_to_insert;
uint32_t frame_counter;
uint32_t margin_in_us;
};
struct mod_vrr_params_fixed_refresh {
bool fixed_active;
bool ramping_active;
bool ramping_done;
uint32_t target_refresh_in_uhz;
uint32_t frame_counter;
};
struct mod_vrr_params_flip_interval {
bool flip_interval_workaround_active;
bool program_flip_interval_workaround;
bool do_flip_interval_workaround_cleanup;
uint32_t flip_interval_detect_counter;
uint32_t vsyncs_between_flip;
uint32_t vsync_to_flip_in_us;
uint32_t v_update_timestamp_in_us;
};
struct mod_vrr_params {
bool supported;
bool send_info_frame;
bool m_const_engaged; // this is used when m_const is set up in OPTC so no overriding happens from FreeSync Module
enum mod_vrr_state state;
uint32_t min_refresh_in_uhz;
uint32_t max_duration_in_us;
uint32_t max_refresh_in_uhz;
uint32_t min_duration_in_us;
uint32_t fixed_refresh_in_uhz;
uint32_t m_const;
struct dc_crtc_timing_adjust adjust;
struct mod_vrr_params_fixed_refresh fixed;
struct mod_vrr_params_btr btr;
struct mod_vrr_params_flip_interval flip_interval;
};
struct mod_freesync *mod_freesync_create(struct dc *dc);
void mod_freesync_destroy(struct mod_freesync *mod_freesync);
void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync,
const struct dc_stream_state *stream,
const struct mod_vrr_params *vrr,
enum vrr_packet_type packet_type,
enum color_transfer_func app_tf,
struct dc_info_packet *infopacket,
bool pack_sdp_v1_3);
void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync,
const struct dc_stream_state *stream,
struct mod_freesync_config *in_config,
struct mod_vrr_params *in_out_vrr);
void mod_freesync_handle_preflip(struct mod_freesync *mod_freesync,
const struct dc_plane_state *plane,
const struct dc_stream_state *stream,
unsigned int curr_time_stamp_in_us,
struct mod_vrr_params *in_out_vrr);
void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,
const struct dc_stream_state *stream,
struct mod_vrr_params *in_out_vrr);
unsigned long long mod_freesync_calc_nominal_field_rate(
const struct dc_stream_state *stream);
unsigned int mod_freesync_calc_v_total_from_refresh(
const struct dc_stream_state *stream,
unsigned int refresh_in_uhz);
// Returns true when FreeSync is supported and enabled (even if it is inactive)
bool mod_freesync_get_freesync_enabled(struct mod_vrr_params *pVrr);
#endif
@@ -0,0 +1,377 @@
/*
* 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
*
*/
#ifndef MOD_HDCP_H_
#define MOD_HDCP_H_
#include "os_types.h"
#include "signal_types.h"
/* Forward Declarations */
struct mod_hdcp;
#define MAX_NUM_OF_DISPLAYS 6
#define MAX_NUM_OF_ATTEMPTS 4
#define MAX_NUM_OF_ERROR_TRACE 10
#define MOD_HDCP_STATUS_LIST(FORMAT) \
FORMAT(MOD_HDCP_STATUS_SUCCESS) \
FORMAT(MOD_HDCP_STATUS_FAILURE) \
FORMAT(MOD_HDCP_STATUS_RESET_NEEDED) \
FORMAT(MOD_HDCP_STATUS_DISPLAY_OUT_OF_BOUND) \
FORMAT(MOD_HDCP_STATUS_DISPLAY_NOT_FOUND) \
FORMAT(MOD_HDCP_STATUS_INVALID_STATE) \
FORMAT(MOD_HDCP_STATUS_NOT_IMPLEMENTED) \
FORMAT(MOD_HDCP_STATUS_INTERNAL_POLICY_FAILURE) \
FORMAT(MOD_HDCP_STATUS_UPDATE_TOPOLOGY_FAILURE) \
FORMAT(MOD_HDCP_STATUS_CREATE_PSP_SERVICE_FAILURE) \
FORMAT(MOD_HDCP_STATUS_DESTROY_PSP_SERVICE_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_CREATE_SESSION_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_DESTROY_SESSION_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_VALIDATE_ENCRYPTION_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_NOT_HDCP_REPEATER) \
FORMAT(MOD_HDCP_STATUS_HDCP1_NOT_CAPABLE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_R0_PRIME_PENDING) \
FORMAT(MOD_HDCP_STATUS_HDCP1_VALIDATE_RX_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_BKSV_REVOKED) \
FORMAT(MOD_HDCP_STATUS_HDCP1_KSV_LIST_NOT_READY) \
FORMAT(MOD_HDCP_STATUS_HDCP1_VALIDATE_KSV_LIST_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_KSV_LIST_REVOKED) \
FORMAT(MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_ENABLE_STREAM_ENCRYPTION_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_MAX_CASCADE_EXCEEDED_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_MAX_DEVS_EXCEEDED_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_DEVICE_COUNT_MISMATCH_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_LINK_INTEGRITY_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_REAUTH_REQUEST_ISSUED) \
FORMAT(MOD_HDCP_STATUS_HDCP1_LINK_MAINTENANCE_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP1_INVALID_BKSV) \
FORMAT(MOD_HDCP_STATUS_DDC_FAILURE) /* TODO: specific errors */ \
FORMAT(MOD_HDCP_STATUS_INVALID_OPERATION) \
FORMAT(MOD_HDCP_STATUS_HDCP2_NOT_CAPABLE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_CREATE_SESSION_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_DESTROY_SESSION_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_PREP_AKE_INIT_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_AKE_CERT_PENDING) \
FORMAT(MOD_HDCP_STATUS_HDCP2_H_PRIME_PENDING) \
FORMAT(MOD_HDCP_STATUS_HDCP2_PAIRING_INFO_PENDING) \
FORMAT(MOD_HDCP_STATUS_HDCP2_VALIDATE_AKE_CERT_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_AKE_CERT_REVOKED) \
FORMAT(MOD_HDCP_STATUS_HDCP2_VALIDATE_H_PRIME_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_VALIDATE_PAIRING_INFO_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_PREP_LC_INIT_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_L_PRIME_PENDING) \
FORMAT(MOD_HDCP_STATUS_HDCP2_VALIDATE_L_PRIME_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_PREP_EKS_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_ENABLE_ENCRYPTION_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_RX_ID_LIST_NOT_READY) \
FORMAT(MOD_HDCP_STATUS_HDCP2_VALIDATE_RX_ID_LIST_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_RX_ID_LIST_REVOKED) \
FORMAT(MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_STREAM_READY_PENDING) \
FORMAT(MOD_HDCP_STATUS_HDCP2_VALIDATE_STREAM_READY_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_PREPARE_STREAM_MANAGEMENT_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_REAUTH_REQUEST) \
FORMAT(MOD_HDCP_STATUS_HDCP2_REAUTH_LINK_INTEGRITY_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_DEVICE_COUNT_MISMATCH_FAILURE) \
FORMAT(MOD_HDCP_STATUS_UNSUPPORTED_PSP_VER_FAILURE) \
FORMAT(MOD_HDCP_STATUS_HDCP2_LOCALITY_COMBO_READ_FAILURE)
#define ENUM_FORMAT(entry) entry,
/* detailed return status */
enum mod_hdcp_status {
MOD_HDCP_STATUS_LIST(ENUM_FORMAT)
};
struct mod_hdcp_displayport {
uint8_t rev;
uint8_t assr_enabled;
uint8_t mst_enabled;
uint8_t dp2_enabled;
uint8_t usb4_enabled;
};
struct mod_hdcp_hdmi {
uint8_t frl_enabled;
uint8_t reserved;
};
enum mod_hdcp_operation_mode {
MOD_HDCP_MODE_OFF,
MOD_HDCP_MODE_DEFAULT,
MOD_HDCP_MODE_DP
};
enum mod_hdcp_display_state {
MOD_HDCP_DISPLAY_INACTIVE = 0,
MOD_HDCP_DISPLAY_ACTIVE,
MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED
};
struct mod_hdcp_psp_caps {
uint8_t dtm_v3_supported;
};
enum mod_hdcp_display_disable_option {
MOD_HDCP_DISPLAY_NOT_DISABLE = 0,
MOD_HDCP_DISPLAY_DISABLE_AUTHENTICATION,
MOD_HDCP_DISPLAY_DISABLE_ENCRYPTION,
};
struct mod_hdcp_atomic_op_i2c {
uint8_t address;
uint8_t offset;
uint8_t *data;
uint32_t size;
};
struct mod_hdcp_atomic_op_aux {
uint32_t address;
uint8_t *data;
uint32_t size;
};
struct mod_hdcp_ddc {
void *handle;
struct mod_hdcp_ddc_funcs {
bool (*read_i2c)(void *handle,
uint32_t address,
uint8_t offset,
uint8_t *data,
uint32_t size);
bool (*write_i2c)(void *handle,
uint32_t address,
const uint8_t *data,
uint32_t size);
bool (*read_dpcd)(void *handle,
uint32_t address,
uint8_t *data,
uint32_t size);
bool (*write_dpcd)(void *handle,
uint32_t address,
const uint8_t *data,
uint32_t size);
bool (*atomic_write_poll_read_i2c)(
void *handle,
const struct mod_hdcp_atomic_op_i2c *write,
const struct mod_hdcp_atomic_op_i2c *poll,
struct mod_hdcp_atomic_op_i2c *read,
uint32_t poll_timeout_us,
uint8_t poll_mask_msb
);
bool (*atomic_write_poll_read_aux)(
void *handle,
const struct mod_hdcp_atomic_op_aux *write,
const struct mod_hdcp_atomic_op_aux *poll,
struct mod_hdcp_atomic_op_aux *read,
uint32_t poll_timeout_us,
uint8_t poll_mask_msb
);
} funcs;
};
struct mod_hdcp_psp {
void *handle;
void *funcs;
struct mod_hdcp_psp_caps caps;
};
struct mod_hdcp_display_adjustment {
uint8_t disable : 2;
uint8_t reserved : 6;
};
struct mod_hdcp_link_adjustment_hdcp1 {
uint8_t disable : 1;
uint8_t postpone_encryption : 1;
uint8_t min_auth_retries_wa : 1;
uint8_t reserved : 5;
};
enum mod_hdcp_force_hdcp_type {
MOD_HDCP_FORCE_TYPE_MAX = 0,
MOD_HDCP_FORCE_TYPE_0,
MOD_HDCP_FORCE_TYPE_1
};
struct mod_hdcp_link_adjustment_hdcp2 {
uint8_t disable : 1;
uint8_t force_type : 2;
uint8_t force_no_stored_km : 1;
uint8_t increase_h_prime_timeout: 1;
uint8_t use_fw_locality_check : 1;
uint8_t use_sw_locality_fallback: 1;
uint8_t reserved : 1;
};
struct mod_hdcp_link_adjustment {
uint8_t auth_delay;
uint8_t retry_limit;
struct mod_hdcp_link_adjustment_hdcp1 hdcp1;
struct mod_hdcp_link_adjustment_hdcp2 hdcp2;
};
struct mod_hdcp_error {
enum mod_hdcp_status status;
uint8_t state_id;
};
struct mod_hdcp1_trace {
uint8_t attempt_count;
uint8_t downstream_device_count;
};
struct mod_hdcp2_trace {
uint8_t attempt_count;
uint8_t downstream_device_count;
uint8_t hdcp1_device_downstream;
uint8_t hdcp2_legacy_device_downstream;
};
struct mod_hdcp_trace {
struct mod_hdcp_error errors[MAX_NUM_OF_ERROR_TRACE];
uint8_t error_count;
struct mod_hdcp1_trace hdcp1;
struct mod_hdcp2_trace hdcp2;
};
enum mod_hdcp_encryption_status {
MOD_HDCP_ENCRYPTION_STATUS_HDCP_OFF = 0,
MOD_HDCP_ENCRYPTION_STATUS_HDCP1_ON,
MOD_HDCP_ENCRYPTION_STATUS_HDCP2_TYPE0_ON,
MOD_HDCP_ENCRYPTION_STATUS_HDCP2_TYPE1_ON,
MOD_HDCP_ENCRYPTION_STATUS_HDCP2_ON
};
/* per link events dm has to notify to hdcp module */
enum mod_hdcp_event {
MOD_HDCP_EVENT_CALLBACK = 0,
MOD_HDCP_EVENT_WATCHDOG_TIMEOUT,
MOD_HDCP_EVENT_CPIRQ
};
/* output flags from module requesting timer operations */
struct mod_hdcp_output {
uint8_t callback_needed;
uint8_t callback_stop;
uint8_t watchdog_timer_needed;
uint8_t watchdog_timer_stop;
uint16_t callback_delay;
uint16_t watchdog_timer_delay;
uint8_t auth_complete;
};
/* used to represent per display info */
struct mod_hdcp_display {
enum mod_hdcp_display_state state;
uint8_t index;
uint8_t controller;
uint8_t dig_fe;
uint8_t stream_enc_idx;
union {
uint8_t vc_id;
};
struct mod_hdcp_display_adjustment adjust;
};
/* used to represent per link info */
/* in case a link has multiple displays, they share the same link info */
struct mod_hdcp_link {
enum mod_hdcp_operation_mode mode;
uint8_t dig_be;
uint8_t ddc_line;
uint8_t link_enc_idx;
uint8_t phy_idx;
uint8_t dio_output_id;
uint8_t hdcp_supported_informational;
union {
struct mod_hdcp_displayport dp;
struct mod_hdcp_hdmi hdmi;
};
struct mod_hdcp_link_adjustment adjust;
};
/* a query structure for a display's hdcp information */
struct mod_hdcp_display_query {
const struct mod_hdcp_display *display;
const struct mod_hdcp_link *link;
const struct mod_hdcp_trace *trace;
enum mod_hdcp_encryption_status encryption_status;
};
/* contains values per on external display configuration change */
struct mod_hdcp_config {
struct mod_hdcp_psp psp;
struct mod_hdcp_ddc ddc;
uint8_t index;
};
/* dm allocates memory of mod_hdcp per dc_link on dm init based on memory size*/
size_t mod_hdcp_get_memory_size(void);
/* called per link on link creation */
enum mod_hdcp_status mod_hdcp_setup(struct mod_hdcp *hdcp,
struct mod_hdcp_config *config);
/* called per link on link destroy */
enum mod_hdcp_status mod_hdcp_teardown(struct mod_hdcp *hdcp);
/* called per display after stream is enabled */
enum mod_hdcp_status mod_hdcp_add_display(struct mod_hdcp *hdcp,
struct mod_hdcp_link *link, struct mod_hdcp_display *display,
struct mod_hdcp_output *output);
/* called per display before stream is disabled */
enum mod_hdcp_status mod_hdcp_remove_display(struct mod_hdcp *hdcp,
uint8_t index, struct mod_hdcp_output *output);
/* called per display to apply new authentication adjustment */
enum mod_hdcp_status mod_hdcp_update_display(struct mod_hdcp *hdcp,
uint8_t index,
struct mod_hdcp_link_adjustment *link_adjust,
struct mod_hdcp_display_adjustment *display_adjust,
struct mod_hdcp_output *output);
/* called to query hdcp information on a specific index */
enum mod_hdcp_status mod_hdcp_query_display(struct mod_hdcp *hdcp,
uint8_t index, struct mod_hdcp_display_query *query);
/* called per link on connectivity change */
enum mod_hdcp_status mod_hdcp_reset_connection(struct mod_hdcp *hdcp,
struct mod_hdcp_output *output);
/* called per link on events (i.e. callback, watchdog, CP_IRQ) */
enum mod_hdcp_status mod_hdcp_process_event(struct mod_hdcp *hdcp,
enum mod_hdcp_event event, struct mod_hdcp_output *output);
/* called to convert enum mod_hdcp_status to c string */
char *mod_hdcp_status_to_str(int32_t status);
/* called to convert state id to c string */
char *mod_hdcp_state_id_to_str(int32_t id);
/* called to convert signal type to operation mode */
enum mod_hdcp_operation_mode mod_hdcp_signal_type_to_operation_mode(
enum signal_type signal);
#endif /* MOD_HDCP_H_ */
@@ -0,0 +1,79 @@
/*
* 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
*
*/
#ifndef MOD_INFO_PACKET_H_
#define MOD_INFO_PACKET_H_
#include "dm_services.h"
#include "mod_info_packet_types.h"
#include "mod_shared.h"
//Forward Declarations
struct dc_stream_state;
struct dc_info_packet;
struct mod_vrr_params;
void set_vsc_packet_colorimetry_data(
const struct dc_stream_state *stream,
struct dc_info_packet *info_packet,
enum dc_color_space cs,
enum color_transfer_func tf);
void mod_build_vsc_infopacket(const struct dc_stream_state *stream,
struct dc_info_packet *info_packet,
enum dc_color_space cs,
enum color_transfer_func tf);
void mod_build_hf_vsif_infopacket(const struct dc_stream_state *stream,
struct dc_info_packet *info_packet, int ALLMEnabled, int ALLMValue);
enum adaptive_sync_sdp_version {
AS_SDP_VER_0 = 0x0,
AS_SDP_VER_1 = 0x1,
AS_SDP_VER_2 = 0x2,
};
#define AS_DP_SDP_LENGTH (9)
struct frame_duration_op {
bool support;
unsigned char frame_duration_hex;
};
struct AS_Df_params {
bool supportMode;
struct frame_duration_op increase;
struct frame_duration_op decrease;
};
void mod_build_adaptive_sync_infopacket(const struct dc_stream_state *stream,
enum adaptive_sync_type asType, const struct AS_Df_params *param,
struct dc_info_packet *info_packet);
void mod_build_adaptive_sync_infopacket_v2(const struct dc_stream_state *stream,
const struct AS_Df_params *param, struct dc_info_packet *info_packet);
void mod_build_adaptive_sync_infopacket_v1(struct dc_info_packet *info_packet);
#endif
@@ -0,0 +1,37 @@
/*
* 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
*
*/
#ifndef MOD_INFO_PACKET_TYPES_H_
#define MOD_INFO_PACKET_TYPES_H_
enum adaptive_sync_type {
ADAPTIVE_SYNC_TYPE_NONE = 0,
ADAPTIVE_SYNC_TYPE_DP = 1,
FREESYNC_TYPE_PCON_IN_WHITELIST = 2,
FREESYNC_TYPE_PCON_NOT_IN_WHITELIST = 3,
ADAPTIVE_SYNC_TYPE_EDP = 4,
};
#endif /* MOD_INFO_PACKET_TYPES_H_ */
@@ -0,0 +1,417 @@
/* Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved. */
#ifndef MODULES_INC_MOD_POWER_H_
#define MODULES_INC_MOD_POWER_H_
#include "dm_services.h"
struct core_power;
struct mod_power_init_params {
bool disable_fractional_pwm;
/* Use nits based brightness instead of brightness percentage
*/
bool use_nits_based_brightness;
unsigned int panel_min_millinits;
unsigned int panel_max_millinits;
unsigned int min_backlight_pwm;
unsigned int max_backlight_pwm;
unsigned int min_abm_backlight;
unsigned int num_backlight_levels;
bool backlight_ramping_override;
unsigned int backlight_ramping_reduction;
unsigned int backlight_ramping_start;
bool def_varibright_enable;
unsigned int def_varibright_level;
unsigned int varibright_level;
unsigned int abm_config_setting;
bool allow_psr_smu_optimizations;
bool allow_psr_multi_disp_optimizations;
bool use_custom_backlight_caps;
unsigned int custom_backlight_caps_config_no;
bool use_linear_backlight_curve;
};
struct mod_power {
int dummy;
};
/* VariBright settings structure */
struct varibright_info {
unsigned int level;
bool enable;
bool activate;
};
struct mod_power_psr_context {
/* ddc line */
unsigned int channel;
/* Transmitter id */
unsigned int transmitter_id;
/* Engine Id is used for Dig Be source select */
unsigned int engine_id;
/* Controller Id used for Dig Fe source select */
unsigned int controller_id;
/* Pcie or Uniphy */
unsigned int phy_type;
/* Physical PHY Id used by SMU interpretation */
unsigned int smu_phy_id;
/* Vertical total pixels from crtc timing.
* This is used for static screen detection.
* ie. If we want to detect half a frame,
* we use this to determine the hyst lines.
*/
unsigned int crtc_timing_vertical_total;
/* PSR supported from panel capabilities and
* current display configuration
*/
bool psr_supported_display_config;
/* Whether fast link training is supported by the panel */
bool psr_exit_link_training_required;
/* If RFB setup time is greater than the total VBLANK time,
* it is not possible for the sink to capture the video frame
* in the same frame the SDP is sent. In this case,
* the frame capture indication bit should be set and an extra
* static frame should be transmitted to the sink.
*/
bool psr_frame_capture_indication_req;
/* Set the last possible line SDP may be transmitted without violating
* the RFB setup time or entering the active video frame.
*/
unsigned int sdp_transmit_line_num_deadline;
/* The VSync rate in Hz used to calculate the
* step size for smooth brightness feature
*/
unsigned int vsync_rate_hz;
unsigned int skip_psr_wait_for_pll_lock;
unsigned int number_of_controllers;
/* Unused, for future use. To indicate that first changed frame from
* state3 shouldn't result in psr_inactive, but rather to perform
* an automatic single frame rfb_update.
*/
bool rfb_update_auto_en;
/* Number of frame before entering static screen */
unsigned int timehyst_frames;
/* Partial frames before entering static screen */
unsigned int hyst_lines;
/* # of repeated AUX transaction attempts to make before
* indicating failure to the driver
*/
unsigned int aux_repeats;
/* Controls hw blocks to power down during PSR active state */
unsigned int psr_level;
/* Controls additional delay after remote frame capture before
* continuing powerd own
*/
unsigned int frame_delay;
bool allow_smu_optimizations;
bool allow_multi_disp_optimizations;
unsigned int line_time_in_us;
/* Panel self refresh 2 selective update granularity required */
bool su_granularity_required;
/* psr2 selective update y granularity capability */
uint8_t su_y_granularity;
uint8_t rate_control_caps;
bool os_request_force_ffu;
};
enum psr_event {
psr_event_invalid = 0x0,
psr_event_vsync = 0x1,
psr_event_full_screen = 0x2,
psr_event_defer_enable = 0x4,
psr_event_hw_programming = 0x8,
psr_event_test_harness_enable_psr = 0x10,
psr_event_test_harness_disable_psr = 0x20,
psr_event_mpo_video_selective_update = 0x40,
psr_event_edp_panel_off_disable_psr = 0x80,
psr_event_dynamic_display_switch = 0x100,
psr_event_big_screen_video = 0x200,
psr_event_dds_defer_stream_enable = 0x800,
psr_event_dynamic_link_rate_control = 0x1000,
psr_event_vrr_transition = 0x2000,
psr_event_pause = 0x4000,
psr_event_immediate_flip = 0x8000,
psr_event_os_request_disable = 0x10000,
psr_event_os_request_force_ffu = 0x20000,
psr_event_os_override_hold = 0x40000,
psr_event_crc_window_active = 0x80000,
};
enum replay_event {
replay_event_invalid = 0x0,
replay_event_vsync = 0x1,
replay_event_full_screen = 0x2,
replay_event_mpo_video_selective_update = 0x4,
replay_event_big_screen_video = 0x8,
replay_event_hw_programming = 0x10,
replay_event_edp_panel_off_disable_psr = 0x20,
replay_event_general_ui = 0x40,
replay_event_vrr = 0x80,
replay_event_prepare_vtotal = 0x100,
replay_event_test_harness_enable_replay = 0x200,
replay_event_test_harness_disable_replay = 0x400,
replay_event_test_harness_ultra_sleep = 0x800,
replay_event_immediate_flip = 0x1000,
replay_event_vrr_transition = 0x2000,
replay_event_pause = 0x4000,
replay_event_disable_replay_while_DPMS = 0x8000,
replay_event_test_harness_mode = 0x10000,
replay_event_cursor_updating = 0x20000,
replay_event_sleep_resume = 0x40000,
replay_event_disable_in_AC = 0x80000,
replay_event_disable_replay_while_detect_display = 0x100000,
replay_event_disable_replay_while_switching_mux = 0x400000,
replay_event_infopacket = 0x800000,
replay_event_os_request_disable = 0x1000000,
replay_event_os_request_force_ffu = 0x2000000,
replay_event_os_override_hold = 0x4000000,
replay_event_crc_window_active = 0x8000000,
};
enum replay_enable_option {
pr_enable_option_static_screen = 0x1,
pr_enable_option_mpo_video = 0x2,
pr_enable_option_full_screen_video = 0x4,
pr_enable_option_general_ui = 0x8,
pr_enable_option_full_screen = 0x10,
pr_enable_option_static_screen_coasting = 0x10000,
pr_enable_option_mpo_video_coasting = 0x20000,
pr_enable_option_full_screen_video_coasting = 0x40000,
pr_enable_option_full_screen_coasting = 0x100000,
};
struct mod_power *mod_power_create(struct dc *dc,
struct mod_power_init_params *init_params,
unsigned int edp_num);
void mod_power_destroy(struct mod_power *mod_power);
bool mod_power_hw_init(struct mod_power *mod_power);
bool mod_power_add_stream(struct mod_power *mod_power,
struct dc_stream_state *stream, struct psr_caps *caps);
bool mod_power_remove_stream(struct mod_power *mod_power,
const struct dc_stream_state *stream);
bool mod_power_replace_stream(struct mod_power *mod_power,
const struct dc_stream_state *current_stream,
struct dc_stream_state *new_stream,
struct psr_caps *new_caps);
bool mod_power_set_backlight_nits(struct mod_power *mod_power,
struct dc_stream_state *streams,
unsigned int backlight_millinit,
unsigned int transition_time_millisec,
bool skip_aux,
bool is_hdr);
bool mod_power_set_backlight_percent(struct mod_power *mod_power,
struct dc_stream_state *stream,
unsigned int backlight_millipercent,
unsigned int transition_time_millisec,
bool is_hdr);
void mod_power_update_backlight(struct mod_power *mod_power,
struct dc_stream_state *stream,
unsigned int backlight_millipercent);
void mod_power_update_backlight_nits(struct mod_power *mod_power,
struct dc_stream_state *stream,
unsigned int backlight_millinit);
bool mod_power_get_backlight_pwm(struct mod_power *mod_power,
unsigned int *backlight_pwm,
unsigned int inst);
bool mod_power_get_backlight_nits(struct mod_power *mod_power,
unsigned int *backlight_millinit,
unsigned int inst);
bool mod_power_get_backlight_percent(struct mod_power *mod_power,
unsigned int *backlight_millipercent,
unsigned int inst);
bool mod_power_get_hw_target_backlight_pwm_nits(
struct mod_power *mod_power,
const struct dc_link *link,
unsigned int *backlight_millinit,
unsigned int inst);
bool mod_power_get_hw_target_backlight_pwm_percent(
struct mod_power *mod_power,
const struct dc_link *link,
unsigned int *backlight_millipercent,
unsigned int inst);
bool mod_power_get_hw_target_backlight_pwm(
struct mod_power *mod_power,
const struct dc_link *link,
unsigned int *backlight_u16_16);
bool mod_power_get_hw_backlight_pwm(
struct mod_power *mod_power,
const struct dc_link *link,
unsigned int *backlight);
bool mod_power_get_hw_backlight_pwm_nits(
struct mod_power *mod_power,
const struct dc_link *link,
unsigned int *backlight_millinit,
unsigned int inst);
bool mod_power_get_hw_backlight_aux_nits(
struct mod_power *mod_power,
struct dc_stream_state **streams, int num_streams,
unsigned int *backlight_millinit_avg,
unsigned int *backlight_millinit_peak);
bool mod_power_get_hw_backlight_pwm_percent(
struct mod_power *mod_power,
const struct dc_link *link,
unsigned int *backlight_millipercent,
unsigned int inst);
void mod_power_initialize_backlight_caps
(struct mod_power *mod_power);
bool mod_power_get_panel_backlight_boundaries
(struct mod_power *mod_power,
unsigned int *out_min_backlight,
unsigned int *out_max_backlight,
unsigned int *out_ac_backlight_percent,
unsigned int *out_dc_backlight_percent,
unsigned int inst);
bool mod_power_set_smooth_brightness(struct mod_power *mod_power,
bool enable_brightness,
unsigned int inst);
bool mod_power_notify_mode_change(struct mod_power *mod_power,
const struct dc_stream_state *stream,
bool is_hdr);
bool mod_power_get_varibright_level(struct mod_power *mod_power,
unsigned int *varibright_level);
bool mod_power_get_varibright_hw_level(struct mod_power *mod_power,
unsigned int *varibright_level);
bool mod_power_get_varibright_default_level(struct mod_power *mod_power,
unsigned int *varibright_level);
bool mod_power_get_varibright_enable(struct mod_power *mod_power,
bool *varibright_enable);
bool mod_power_varibright_activate(struct mod_power *mod_power,
bool activate, struct dc_stream_update *stream_update);
bool mod_power_varibright_feature_enable(struct mod_power *mod_power,
bool enable, struct dc_stream_update *stream_update);
bool mod_power_varibright_set_level(struct mod_power *mod_power,
unsigned int level, struct dc_stream_update *stream_update);
bool mod_power_varibright_set_hw_level(struct mod_power *mod_power,
unsigned int level, struct dc_stream_update *stream_update);
bool mod_power_is_abm_active(struct mod_power *mod_power,
const struct dc_link *link,
unsigned int inst);
bool mod_power_set_psr_event(struct mod_power *mod_power,
struct dc_stream_state *stream, bool set_event,
enum psr_event event, bool wait);
bool mod_power_get_psr_event(struct mod_power *mod_power,
struct dc_stream_state *stream,
unsigned int *active_psr_events);
bool mod_power_get_psr_state(struct mod_power *mod_power,
const struct dc_stream_state *stream,
enum dc_psr_state *state);
bool mod_power_get_psr_enabled_status(struct mod_power *mod_power,
const struct dc_stream_state *stream,
bool *psr_enabled);
bool mod_power_set_replay_event(struct mod_power *mod_power,
struct dc_stream_state *stream, bool set_event,
enum replay_event event, bool wait_for_disable);
bool mod_power_get_replay_event(struct mod_power *mod_power,
struct dc_stream_state *stream,
unsigned int *active_replay_events);
bool mod_power_get_replay_active_status(const struct dc_stream_state *stream,
bool *replay_active);
bool mod_power_replay_set_coasting_vtotal(struct mod_power *mod_power,
const struct dc_stream_state *stream,
uint32_t coasting_vtotal, uint16_t frame_skip_number);
void mod_power_replay_residency(const struct dc_stream_state *stream,
unsigned int *residency, const bool is_start, const bool is_alpm);
bool mod_power_replay_set_power_opt_and_coasting_vtotal(struct mod_power *mod_power,
const struct dc_stream_state *stream, unsigned int active_replay_events, uint32_t coasting_vtotal,
bool is_ultra_sleep_mode, uint16_t frame_skip_number);
void mod_power_replay_set_timing_sync_supported(struct mod_power *mod_power,
const struct dc_stream_state *stream);
void mod_power_replay_disabled_adaptive_sync_sdp(struct mod_power *mod_power,
const struct dc_stream_state *stream, bool force_disabled);
void mod_power_replay_disabled_desync_error_detection(struct mod_power *mod_power,
const struct dc_stream_state *stream, bool force_disabled);
void mod_power_set_low_rr_activate(struct mod_power *mod_power,
const struct dc_stream_state *stream, bool low_rr_supported);
void mod_power_set_video_conferencing_activate(struct mod_power *mod_power,
const struct dc_stream_state *stream, bool video_conferencing_activate);
void mod_power_set_live_capture_with_cvt_activate(struct mod_power *mod_power,
const struct dc_stream_state *stream, bool live_capture_with_cvt_activate);
void mod_power_set_replay_continuously_resync(struct mod_power *mod_power,
const struct dc_stream_state *stream, bool enable);
void mod_power_set_coasting_vtotal_without_frame_update(struct mod_power *mod_power,
const struct dc_stream_state *stream, uint32_t coasting_vtotal);
void mod_power_psr_residency(struct mod_power *mod_power,
const struct dc_stream_state *stream,
unsigned int *residency,
const uint8_t mode);
bool mod_power_psr_get_active_psr_events(struct mod_power *mod_power,
const struct dc_stream_state *stream, unsigned int *active_psr_events);
bool mod_power_psr_set_sink_vtotal_in_psr_active(struct mod_power *mod_power,
const struct dc_stream_state *stream,
uint16_t psr_vtotal_idle,
uint16_t psr_vtotal_su);
bool mod_power_backlight_percent_to_nits(struct mod_power *mod_power,
struct dc_stream_state *stream,
unsigned int backlight_millipercent,
unsigned int *backlight_millinit);
bool mod_power_backlight_nits_to_percent(struct mod_power *mod_power,
struct dc_stream_state *stream,
unsigned int backlight_millinit,
unsigned int *backlight_millipercent);
#endif /* MODULES_INC_MOD_POWER_H_ */
@@ -0,0 +1,108 @@
/*
* Copyright 2016 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
*
*/
#ifndef MOD_SHARED_H_
#define MOD_SHARED_H_
enum color_transfer_func {
TRANSFER_FUNC_UNKNOWN,
TRANSFER_FUNC_SRGB,
TRANSFER_FUNC_BT709,
TRANSFER_FUNC_PQ2084,
TRANSFER_FUNC_PQ2084_INTERIM,
TRANSFER_FUNC_LINEAR_0_1,
TRANSFER_FUNC_LINEAR_0_125,
TRANSFER_FUNC_GAMMA_22,
TRANSFER_FUNC_GAMMA_26
};
enum vrr_packet_type {
PACKET_TYPE_VRR,
PACKET_TYPE_FS_V1,
PACKET_TYPE_FS_V2,
PACKET_TYPE_FS_V3,
PACKET_TYPE_VTEM
};
union lut3d_control_flags {
unsigned int raw;
struct {
unsigned int do_chroma_scale :1;
unsigned int spec_version :3;
unsigned int use_zero_display_black :1;
unsigned int use_zero_source_black :1;
unsigned int force_display_black :6;
unsigned int apply_display_gamma :1;
unsigned int exp_shaper_max :6;
unsigned int unity_3dlut :1;
unsigned int bypass_3dlut :1;
unsigned int use_3dlut :1;
unsigned int less_than_dcip3 :1;
unsigned int override_lum :1;
unsigned int use_gamut_map_lib :1;
unsigned int chromatic_adaptation_src :1;
unsigned int chromatic_adaptation_dst :1;
unsigned int do_blender_lut_degamma :1;
unsigned int reseved :4;
} bits;
};
enum tm_show_option_internal {
tm_show_option_internal_single_file = 0,/*flags2 not in use*/
tm_show_option_internal_duplicate_file, /*use flags2*/
tm_show_option_internal_duplicate_sidebyside/*use flags2*/
};
enum lut3d_control_gamut_map {
lut3d_control_gamut_map_none = 0,
lut3d_control_gamut_map_tonemap,
lut3d_control_gamut_map_chto,
lut3d_control_gamut_map_chso,
lut3d_control_gamut_map_chci
};
enum lut3d_control_rotation_mode {
lut3d_control_rotation_mode_none = 0,
lut3d_control_rotation_mode_hue,
lut3d_control_rotation_mode_cc,
lut3d_control_rotation_mode_hue_cc
};
struct lut3d_settings {
unsigned char version;
union lut3d_control_flags flags;
union lut3d_control_flags flags2;
enum tm_show_option_internal option;
unsigned int min_lum;/*multiplied by 100*/
unsigned int max_lum;
unsigned int min_lum2;
unsigned int max_lum2;
enum lut3d_control_gamut_map map;
enum lut3d_control_rotation_mode rotation;
enum lut3d_control_gamut_map map2;
enum lut3d_control_rotation_mode rotation2;
};
#endif /* MOD_SHARED_H_ */
@@ -0,0 +1,75 @@
/*
* Copyright 2016 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
*
*/
#ifndef MODULES_INC_MOD_STATS_H_
#define MODULES_INC_MOD_STATS_H_
#include "dm_services.h"
struct mod_stats {
int dummy;
};
struct mod_stats_caps {
bool dummy;
};
struct mod_stats_init_params {
unsigned int stats_enable;
unsigned int stats_entries;
};
struct mod_stats *mod_stats_create(struct dc *dc,
struct mod_stats_init_params *init_params);
void mod_stats_destroy(struct mod_stats *mod_stats);
bool mod_stats_init(struct mod_stats *mod_stats);
void mod_stats_dump(struct mod_stats *mod_stats);
void mod_stats_reset_data(struct mod_stats *mod_stats);
void mod_stats_update_event(struct mod_stats *mod_stats,
const char *event_string,
unsigned int length);
void mod_stats_update_flip(struct mod_stats *mod_stats,
unsigned long long timestamp_in_ns);
void mod_stats_update_vupdate(struct mod_stats *mod_stats,
unsigned long long timestamp_in_ns);
void mod_stats_update_freesync(struct mod_stats *mod_stats,
unsigned int v_total_min,
unsigned int v_total_max,
unsigned int event_triggers,
unsigned int window_min,
unsigned int window_max,
unsigned int lfc_mid_point_in_us,
unsigned int inserted_frames,
unsigned int inserted_frame_duration_in_us);
#endif /* MODULES_INC_MOD_STATS_H_ */
@@ -0,0 +1,46 @@
/*
* Copyright 2019 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
*
*/
#ifndef MOD_VMID_H_
#define MOD_VMID_H_
#define MAX_VMID 16
#include "dc.h"
struct mod_vmid {
int dummy;
};
uint8_t mod_vmid_get_for_ptb(struct mod_vmid *mod_vmid, uint64_t ptb);
void mod_vmid_reset(struct mod_vmid *mod_vmid);
struct mod_vmid *mod_vmid_create(
struct dc *dc,
unsigned int num_vmid,
struct dc_virtual_addr_space_config *va_config);
void mod_vmid_destroy(struct mod_vmid *mod_vmid);
#endif /* MOD_VMID_H_ */