1d38ceaf9SAlex Deucher /* 2d38ceaf9SAlex Deucher * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and 3d38ceaf9SAlex Deucher * VA Linux Systems Inc., Fremont, California. 4d38ceaf9SAlex Deucher * Copyright 2008 Red Hat Inc. 5d38ceaf9SAlex Deucher * 6d38ceaf9SAlex Deucher * Permission is hereby granted, free of charge, to any person obtaining a 7d38ceaf9SAlex Deucher * copy of this software and associated documentation files (the "Software"), 8d38ceaf9SAlex Deucher * to deal in the Software without restriction, including without limitation 9d38ceaf9SAlex Deucher * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10d38ceaf9SAlex Deucher * and/or sell copies of the Software, and to permit persons to whom the 11d38ceaf9SAlex Deucher * Software is furnished to do so, subject to the following conditions: 12d38ceaf9SAlex Deucher * 13d38ceaf9SAlex Deucher * The above copyright notice and this permission notice shall be included in 14d38ceaf9SAlex Deucher * all copies or substantial portions of the Software. 15d38ceaf9SAlex Deucher * 16d38ceaf9SAlex Deucher * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17d38ceaf9SAlex Deucher * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18d38ceaf9SAlex Deucher * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19d38ceaf9SAlex Deucher * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20d38ceaf9SAlex Deucher * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21d38ceaf9SAlex Deucher * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22d38ceaf9SAlex Deucher * OTHER DEALINGS IN THE SOFTWARE. 23d38ceaf9SAlex Deucher * 24d38ceaf9SAlex Deucher * Original Authors: 25d38ceaf9SAlex Deucher * Kevin E. Martin, Rickard E. Faith, Alan Hourihane 26d38ceaf9SAlex Deucher * 27d38ceaf9SAlex Deucher * Kernel port Author: Dave Airlie 28d38ceaf9SAlex Deucher */ 29d38ceaf9SAlex Deucher 30d38ceaf9SAlex Deucher #ifndef AMDGPU_MODE_H 31d38ceaf9SAlex Deucher #define AMDGPU_MODE_H 32d38ceaf9SAlex Deucher 33da68386dSThomas Zimmermann #include <drm/display/drm_dp_helper.h> 34d38ceaf9SAlex Deucher #include <drm/drm_crtc.h> 359338203cSLaurent Pinchart #include <drm/drm_encoder.h> 36d38ceaf9SAlex Deucher #include <drm/drm_fixed.h> 37720cf96dSVille Syrjälä #include <drm/drm_framebuffer.h> 38fcd70cd3SDaniel Vetter #include <drm/drm_probe_helper.h> 39d38ceaf9SAlex Deucher #include <linux/i2c.h> 40d38ceaf9SAlex Deucher #include <linux/i2c-algo-bit.h> 4146ac3622SEmily Deng #include <linux/hrtimer.h> 4246ac3622SEmily Deng #include "amdgpu_irq.h" 43d38ceaf9SAlex Deucher 44da68386dSThomas Zimmermann #include <drm/display/drm_dp_mst_helper.h> 454562236bSHarry Wentland #include "modules/inc/mod_freesync.h" 465d1c59c4SAurabindo Pillai #include "amdgpu_dm_irq_params.h" 474562236bSHarry Wentland 48d38ceaf9SAlex Deucher struct amdgpu_bo; 49d38ceaf9SAlex Deucher struct amdgpu_device; 50d38ceaf9SAlex Deucher struct amdgpu_encoder; 51d38ceaf9SAlex Deucher struct amdgpu_router; 52d38ceaf9SAlex Deucher struct amdgpu_hpd; 53d9501844SJani Nikula struct edid; 54aeb81b62SThomas Weißschuh struct drm_edid; 55d38ceaf9SAlex Deucher 56d38ceaf9SAlex Deucher #define to_amdgpu_crtc(x) container_of(x, struct amdgpu_crtc, base) 57d38ceaf9SAlex Deucher #define to_amdgpu_connector(x) container_of(x, struct amdgpu_connector, base) 58d38ceaf9SAlex Deucher #define to_amdgpu_encoder(x) container_of(x, struct amdgpu_encoder, base) 59d38ceaf9SAlex Deucher #define to_amdgpu_framebuffer(x) container_of(x, struct amdgpu_framebuffer, base) 60d38ceaf9SAlex Deucher 613d12beb3SNicholas Kazlauskas #define to_dm_plane_state(x) container_of(x, struct dm_plane_state, base) 620604b36cSAndrey Grodzovsky 63d38ceaf9SAlex Deucher #define AMDGPU_MAX_HPD_PINS 6 64d38ceaf9SAlex Deucher #define AMDGPU_MAX_CRTCS 6 65d4e13b0dSAlex Deucher #define AMDGPU_MAX_PLANES 6 6622384459SAlex Deucher #define AMDGPU_MAX_AFMT_BLOCKS 9 67d38ceaf9SAlex Deucher 68d38ceaf9SAlex Deucher enum amdgpu_rmx_type { 69d38ceaf9SAlex Deucher RMX_OFF, 70d38ceaf9SAlex Deucher RMX_FULL, 71d38ceaf9SAlex Deucher RMX_CENTER, 72d38ceaf9SAlex Deucher RMX_ASPECT 73d38ceaf9SAlex Deucher }; 74d38ceaf9SAlex Deucher 75d38ceaf9SAlex Deucher enum amdgpu_underscan_type { 76d38ceaf9SAlex Deucher UNDERSCAN_OFF, 77d38ceaf9SAlex Deucher UNDERSCAN_ON, 78d38ceaf9SAlex Deucher UNDERSCAN_AUTO, 79d38ceaf9SAlex Deucher }; 80d38ceaf9SAlex Deucher 81d38ceaf9SAlex Deucher #define AMDGPU_HPD_CONNECT_INT_DELAY_IN_MS 50 82d38ceaf9SAlex Deucher #define AMDGPU_HPD_DISCONNECT_INT_DELAY_IN_MS 10 83d38ceaf9SAlex Deucher 84d38ceaf9SAlex Deucher enum amdgpu_hpd_id { 85d38ceaf9SAlex Deucher AMDGPU_HPD_1 = 0, 86d38ceaf9SAlex Deucher AMDGPU_HPD_2, 87d38ceaf9SAlex Deucher AMDGPU_HPD_3, 88d38ceaf9SAlex Deucher AMDGPU_HPD_4, 89d38ceaf9SAlex Deucher AMDGPU_HPD_5, 90d38ceaf9SAlex Deucher AMDGPU_HPD_6, 91d38ceaf9SAlex Deucher AMDGPU_HPD_NONE = 0xff, 92d38ceaf9SAlex Deucher }; 93d38ceaf9SAlex Deucher 94d38ceaf9SAlex Deucher enum amdgpu_crtc_irq { 95d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VBLANK1 = 0, 96d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VBLANK2, 97d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VBLANK3, 98d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VBLANK4, 99d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VBLANK5, 100d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VBLANK6, 101d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VLINE1, 102d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VLINE2, 103d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VLINE3, 104d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VLINE4, 105d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VLINE5, 106d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_VLINE6, 107d38ceaf9SAlex Deucher AMDGPU_CRTC_IRQ_NONE = 0xff 108d38ceaf9SAlex Deucher }; 109d38ceaf9SAlex Deucher 110d38ceaf9SAlex Deucher enum amdgpu_pageflip_irq { 111d38ceaf9SAlex Deucher AMDGPU_PAGEFLIP_IRQ_D1 = 0, 112d38ceaf9SAlex Deucher AMDGPU_PAGEFLIP_IRQ_D2, 113d38ceaf9SAlex Deucher AMDGPU_PAGEFLIP_IRQ_D3, 114d38ceaf9SAlex Deucher AMDGPU_PAGEFLIP_IRQ_D4, 115d38ceaf9SAlex Deucher AMDGPU_PAGEFLIP_IRQ_D5, 116d38ceaf9SAlex Deucher AMDGPU_PAGEFLIP_IRQ_D6, 117d38ceaf9SAlex Deucher AMDGPU_PAGEFLIP_IRQ_NONE = 0xff 118d38ceaf9SAlex Deucher }; 119d38ceaf9SAlex Deucher 120d38ceaf9SAlex Deucher enum amdgpu_flip_status { 121d38ceaf9SAlex Deucher AMDGPU_FLIP_NONE, 122d38ceaf9SAlex Deucher AMDGPU_FLIP_PENDING, 123d38ceaf9SAlex Deucher AMDGPU_FLIP_SUBMITTED 124d38ceaf9SAlex Deucher }; 125d38ceaf9SAlex Deucher 126d38ceaf9SAlex Deucher #define AMDGPU_MAX_I2C_BUS 16 127d38ceaf9SAlex Deucher 128d38ceaf9SAlex Deucher /* amdgpu gpio-based i2c 129d38ceaf9SAlex Deucher * 1. "mask" reg and bits 130d38ceaf9SAlex Deucher * grabs the gpio pins for software use 131d38ceaf9SAlex Deucher * 0=not held 1=held 132d38ceaf9SAlex Deucher * 2. "a" reg and bits 133d38ceaf9SAlex Deucher * output pin value 134d38ceaf9SAlex Deucher * 0=low 1=high 135d38ceaf9SAlex Deucher * 3. "en" reg and bits 136d38ceaf9SAlex Deucher * sets the pin direction 137d38ceaf9SAlex Deucher * 0=input 1=output 138d38ceaf9SAlex Deucher * 4. "y" reg and bits 139d38ceaf9SAlex Deucher * input pin value 140d38ceaf9SAlex Deucher * 0=low 1=high 141d38ceaf9SAlex Deucher */ 142d38ceaf9SAlex Deucher struct amdgpu_i2c_bus_rec { 143d38ceaf9SAlex Deucher bool valid; 144d38ceaf9SAlex Deucher /* id used by atom */ 145d38ceaf9SAlex Deucher uint8_t i2c_id; 146d38ceaf9SAlex Deucher /* id used by atom */ 147d38ceaf9SAlex Deucher enum amdgpu_hpd_id hpd; 148d38ceaf9SAlex Deucher /* can be used with hw i2c engine */ 149d38ceaf9SAlex Deucher bool hw_capable; 150d38ceaf9SAlex Deucher /* uses multi-media i2c engine */ 151d38ceaf9SAlex Deucher bool mm_i2c; 152d38ceaf9SAlex Deucher /* regs and bits */ 153d38ceaf9SAlex Deucher uint32_t mask_clk_reg; 154d38ceaf9SAlex Deucher uint32_t mask_data_reg; 155d38ceaf9SAlex Deucher uint32_t a_clk_reg; 156d38ceaf9SAlex Deucher uint32_t a_data_reg; 157d38ceaf9SAlex Deucher uint32_t en_clk_reg; 158d38ceaf9SAlex Deucher uint32_t en_data_reg; 159d38ceaf9SAlex Deucher uint32_t y_clk_reg; 160d38ceaf9SAlex Deucher uint32_t y_data_reg; 161d38ceaf9SAlex Deucher uint32_t mask_clk_mask; 162d38ceaf9SAlex Deucher uint32_t mask_data_mask; 163d38ceaf9SAlex Deucher uint32_t a_clk_mask; 164d38ceaf9SAlex Deucher uint32_t a_data_mask; 165d38ceaf9SAlex Deucher uint32_t en_clk_mask; 166d38ceaf9SAlex Deucher uint32_t en_data_mask; 167d38ceaf9SAlex Deucher uint32_t y_clk_mask; 168d38ceaf9SAlex Deucher uint32_t y_data_mask; 169d38ceaf9SAlex Deucher }; 170d38ceaf9SAlex Deucher 171d38ceaf9SAlex Deucher #define AMDGPU_MAX_BIOS_CONNECTOR 16 172d38ceaf9SAlex Deucher 173d38ceaf9SAlex Deucher /* pll flags */ 174d38ceaf9SAlex Deucher #define AMDGPU_PLL_USE_BIOS_DIVS (1 << 0) 175d38ceaf9SAlex Deucher #define AMDGPU_PLL_NO_ODD_POST_DIV (1 << 1) 176d38ceaf9SAlex Deucher #define AMDGPU_PLL_USE_REF_DIV (1 << 2) 177d38ceaf9SAlex Deucher #define AMDGPU_PLL_LEGACY (1 << 3) 178d38ceaf9SAlex Deucher #define AMDGPU_PLL_PREFER_LOW_REF_DIV (1 << 4) 179d38ceaf9SAlex Deucher #define AMDGPU_PLL_PREFER_HIGH_REF_DIV (1 << 5) 180d38ceaf9SAlex Deucher #define AMDGPU_PLL_PREFER_LOW_FB_DIV (1 << 6) 181d38ceaf9SAlex Deucher #define AMDGPU_PLL_PREFER_HIGH_FB_DIV (1 << 7) 182d38ceaf9SAlex Deucher #define AMDGPU_PLL_PREFER_LOW_POST_DIV (1 << 8) 183d38ceaf9SAlex Deucher #define AMDGPU_PLL_PREFER_HIGH_POST_DIV (1 << 9) 184d38ceaf9SAlex Deucher #define AMDGPU_PLL_USE_FRAC_FB_DIV (1 << 10) 185d38ceaf9SAlex Deucher #define AMDGPU_PLL_PREFER_CLOSEST_LOWER (1 << 11) 186d38ceaf9SAlex Deucher #define AMDGPU_PLL_USE_POST_DIV (1 << 12) 187d38ceaf9SAlex Deucher #define AMDGPU_PLL_IS_LCD (1 << 13) 188d38ceaf9SAlex Deucher #define AMDGPU_PLL_PREFER_MINM_OVER_MAXP (1 << 14) 189d38ceaf9SAlex Deucher 190d38ceaf9SAlex Deucher struct amdgpu_pll { 191d38ceaf9SAlex Deucher /* reference frequency */ 192d38ceaf9SAlex Deucher uint32_t reference_freq; 193d38ceaf9SAlex Deucher 194d38ceaf9SAlex Deucher /* fixed dividers */ 195d38ceaf9SAlex Deucher uint32_t reference_div; 196d38ceaf9SAlex Deucher uint32_t post_div; 197d38ceaf9SAlex Deucher 198d38ceaf9SAlex Deucher /* pll in/out limits */ 199d38ceaf9SAlex Deucher uint32_t pll_in_min; 200d38ceaf9SAlex Deucher uint32_t pll_in_max; 201d38ceaf9SAlex Deucher uint32_t pll_out_min; 202d38ceaf9SAlex Deucher uint32_t pll_out_max; 203d38ceaf9SAlex Deucher uint32_t lcd_pll_out_min; 204d38ceaf9SAlex Deucher uint32_t lcd_pll_out_max; 205d38ceaf9SAlex Deucher uint32_t best_vco; 206d38ceaf9SAlex Deucher 207d38ceaf9SAlex Deucher /* divider limits */ 208d38ceaf9SAlex Deucher uint32_t min_ref_div; 209d38ceaf9SAlex Deucher uint32_t max_ref_div; 210d38ceaf9SAlex Deucher uint32_t min_post_div; 211d38ceaf9SAlex Deucher uint32_t max_post_div; 212d38ceaf9SAlex Deucher uint32_t min_feedback_div; 213d38ceaf9SAlex Deucher uint32_t max_feedback_div; 214d38ceaf9SAlex Deucher uint32_t min_frac_feedback_div; 215d38ceaf9SAlex Deucher uint32_t max_frac_feedback_div; 216d38ceaf9SAlex Deucher 217d38ceaf9SAlex Deucher /* flags for the current clock */ 218d38ceaf9SAlex Deucher uint32_t flags; 219d38ceaf9SAlex Deucher 220d38ceaf9SAlex Deucher /* pll id */ 221d38ceaf9SAlex Deucher uint32_t id; 222d38ceaf9SAlex Deucher }; 223d38ceaf9SAlex Deucher 224d38ceaf9SAlex Deucher struct amdgpu_i2c_chan { 225d38ceaf9SAlex Deucher struct i2c_adapter adapter; 226d38ceaf9SAlex Deucher struct drm_device *dev; 227d38ceaf9SAlex Deucher struct i2c_algo_bit_data bit; 228d38ceaf9SAlex Deucher struct amdgpu_i2c_bus_rec rec; 229d38ceaf9SAlex Deucher struct drm_dp_aux aux; 230d38ceaf9SAlex Deucher bool has_aux; 231d38ceaf9SAlex Deucher struct mutex mutex; 232d38ceaf9SAlex Deucher }; 233d38ceaf9SAlex Deucher 234d38ceaf9SAlex Deucher struct amdgpu_afmt { 235d38ceaf9SAlex Deucher bool enabled; 236d38ceaf9SAlex Deucher int offset; 237d38ceaf9SAlex Deucher bool last_buffer_filled_status; 238d38ceaf9SAlex Deucher int id; 239d38ceaf9SAlex Deucher struct amdgpu_audio_pin *pin; 240d38ceaf9SAlex Deucher }; 241d38ceaf9SAlex Deucher 242d38ceaf9SAlex Deucher /* 243d38ceaf9SAlex Deucher * Audio 244d38ceaf9SAlex Deucher */ 245d38ceaf9SAlex Deucher struct amdgpu_audio_pin { 246d38ceaf9SAlex Deucher int channels; 247d38ceaf9SAlex Deucher int rate; 248d38ceaf9SAlex Deucher int bits_per_sample; 249d38ceaf9SAlex Deucher u8 status_bits; 250d38ceaf9SAlex Deucher u8 category_code; 251d38ceaf9SAlex Deucher u32 offset; 252d38ceaf9SAlex Deucher bool connected; 253d38ceaf9SAlex Deucher u32 id; 254d38ceaf9SAlex Deucher }; 255d38ceaf9SAlex Deucher 256d38ceaf9SAlex Deucher struct amdgpu_audio { 257d38ceaf9SAlex Deucher bool enabled; 258d38ceaf9SAlex Deucher struct amdgpu_audio_pin pin[AMDGPU_MAX_AFMT_BLOCKS]; 259d38ceaf9SAlex Deucher int num_pins; 260d38ceaf9SAlex Deucher }; 261d38ceaf9SAlex Deucher 262d38ceaf9SAlex Deucher struct amdgpu_display_funcs { 263d38ceaf9SAlex Deucher /* display watermarks */ 264d38ceaf9SAlex Deucher void (*bandwidth_update)(struct amdgpu_device *adev); 265d38ceaf9SAlex Deucher /* get frame count */ 266d38ceaf9SAlex Deucher u32 (*vblank_get_counter)(struct amdgpu_device *adev, int crtc); 267d38ceaf9SAlex Deucher /* set backlight level */ 268d38ceaf9SAlex Deucher void (*backlight_set_level)(struct amdgpu_encoder *amdgpu_encoder, 269d38ceaf9SAlex Deucher u8 level); 270d38ceaf9SAlex Deucher /* get backlight level */ 271d38ceaf9SAlex Deucher u8 (*backlight_get_level)(struct amdgpu_encoder *amdgpu_encoder); 272d38ceaf9SAlex Deucher /* hotplug detect */ 273d38ceaf9SAlex Deucher bool (*hpd_sense)(struct amdgpu_device *adev, enum amdgpu_hpd_id hpd); 274d38ceaf9SAlex Deucher void (*hpd_set_polarity)(struct amdgpu_device *adev, 275d38ceaf9SAlex Deucher enum amdgpu_hpd_id hpd); 276d38ceaf9SAlex Deucher u32 (*hpd_get_gpio_reg)(struct amdgpu_device *adev); 277d38ceaf9SAlex Deucher /* pageflipping */ 278d38ceaf9SAlex Deucher void (*page_flip)(struct amdgpu_device *adev, 279cb9e59d7SAlex Deucher int crtc_id, u64 crtc_base, bool async); 280d38ceaf9SAlex Deucher int (*page_flip_get_scanoutpos)(struct amdgpu_device *adev, int crtc, 281d38ceaf9SAlex Deucher u32 *vbl, u32 *position); 282d38ceaf9SAlex Deucher /* display topology setup */ 283d38ceaf9SAlex Deucher void (*add_encoder)(struct amdgpu_device *adev, 284d38ceaf9SAlex Deucher uint32_t encoder_enum, 285d38ceaf9SAlex Deucher uint32_t supported_device, 286d38ceaf9SAlex Deucher u16 caps); 287d38ceaf9SAlex Deucher void (*add_connector)(struct amdgpu_device *adev, 288d38ceaf9SAlex Deucher uint32_t connector_id, 289d38ceaf9SAlex Deucher uint32_t supported_device, 290d38ceaf9SAlex Deucher int connector_type, 291d38ceaf9SAlex Deucher struct amdgpu_i2c_bus_rec *i2c_bus, 292d38ceaf9SAlex Deucher uint16_t connector_object_id, 293d38ceaf9SAlex Deucher struct amdgpu_hpd *hpd, 294d38ceaf9SAlex Deucher struct amdgpu_router *router); 2954562236bSHarry Wentland 2964562236bSHarry Wentland 2974562236bSHarry Wentland }; 2984562236bSHarry Wentland 2994562236bSHarry Wentland struct amdgpu_framebuffer { 3004562236bSHarry Wentland struct drm_framebuffer base; 301dd55d12cSAndrey Grodzovsky 3026eed95b0SBas Nieuwenhuizen uint64_t tiling_flags; 3036eed95b0SBas Nieuwenhuizen bool tmz_surface; 3040d3157d0SMarek Olšák bool gfx12_dcc; 3056eed95b0SBas Nieuwenhuizen 306dd55d12cSAndrey Grodzovsky /* caching for later use */ 307dd55d12cSAndrey Grodzovsky uint64_t address; 3084562236bSHarry Wentland }; 3094562236bSHarry Wentland 310d38ceaf9SAlex Deucher struct amdgpu_mode_info { 311d38ceaf9SAlex Deucher struct atom_context *atom_context; 312d38ceaf9SAlex Deucher struct card_info *atom_card_info; 313d38ceaf9SAlex Deucher bool mode_config_initialized; 314f195038cSAlex Deucher struct amdgpu_crtc *crtcs[AMDGPU_MAX_CRTCS]; 315f180b4bcSHarry Wentland struct drm_plane *planes[AMDGPU_MAX_PLANES]; 316f195038cSAlex Deucher struct amdgpu_afmt *afmt[AMDGPU_MAX_AFMT_BLOCKS]; 317d38ceaf9SAlex Deucher /* DVI-I properties */ 318d38ceaf9SAlex Deucher struct drm_property *coherent_mode_property; 319d38ceaf9SAlex Deucher /* DAC enable load detect */ 320d38ceaf9SAlex Deucher struct drm_property *load_detect_property; 321d38ceaf9SAlex Deucher /* underscan */ 322d38ceaf9SAlex Deucher struct drm_property *underscan_property; 323d38ceaf9SAlex Deucher struct drm_property *underscan_hborder_property; 324d38ceaf9SAlex Deucher struct drm_property *underscan_vborder_property; 325d38ceaf9SAlex Deucher /* audio */ 326d38ceaf9SAlex Deucher struct drm_property *audio_property; 327d38ceaf9SAlex Deucher /* FMT dithering */ 328d38ceaf9SAlex Deucher struct drm_property *dither_property; 329d38ceaf9SAlex Deucher /* hardcoded DFP edid from BIOS */ 330aeb81b62SThomas Weißschuh const struct drm_edid *bios_hardcoded_edid; 331d38ceaf9SAlex Deucher 332d38ceaf9SAlex Deucher /* firmware flags */ 3335968c6a2SHawking Zhang u32 firmware_flags; 334d38ceaf9SAlex Deucher /* pointer to backlight encoder */ 335d38ceaf9SAlex Deucher struct amdgpu_encoder *bl_encoder; 336a59b3c80SAlex Deucher u8 bl_level; /* saved backlight level */ 337d38ceaf9SAlex Deucher struct amdgpu_audio audio; /* audio stuff */ 338d38ceaf9SAlex Deucher int num_crtc; /* number of crtcs */ 339d38ceaf9SAlex Deucher int num_hpd; /* number of hpd pins */ 340d38ceaf9SAlex Deucher int num_dig; /* number of dig blocks */ 341a7f520bfSAlex Deucher bool gpu_vm_support; /* supports display from GTT */ 342d38ceaf9SAlex Deucher int disp_priority; 343d38ceaf9SAlex Deucher const struct amdgpu_display_funcs *funcs; 344e04a6123SDave Airlie const enum drm_plane_type *plane_type; 3459342a9aeSMelissa Wen 3469342a9aeSMelissa Wen /* Driver-private color mgmt props */ 3479342a9aeSMelissa Wen 3489342a9aeSMelissa Wen /* @plane_degamma_lut_property: Plane property to set a degamma LUT to 3499342a9aeSMelissa Wen * convert encoded values to light linear values before sampling or 3509342a9aeSMelissa Wen * blending. 3519342a9aeSMelissa Wen */ 3529342a9aeSMelissa Wen struct drm_property *plane_degamma_lut_property; 3539342a9aeSMelissa Wen /* @plane_degamma_lut_size_property: Plane property to define the max 3549342a9aeSMelissa Wen * size of degamma LUT as supported by the driver (read-only). 3559342a9aeSMelissa Wen */ 3569342a9aeSMelissa Wen struct drm_property *plane_degamma_lut_size_property; 357d5a348d9SJoshua Ashton /** 358d5a348d9SJoshua Ashton * @plane_degamma_tf_property: Plane pre-defined transfer function to 359d5a348d9SJoshua Ashton * to go from scanout/encoded values to linear values. 360d5a348d9SJoshua Ashton */ 361d5a348d9SJoshua Ashton struct drm_property *plane_degamma_tf_property; 362ec7b2a55SJoshua Ashton /** 363ec7b2a55SJoshua Ashton * @plane_hdr_mult_property: 364ec7b2a55SJoshua Ashton */ 365ec7b2a55SJoshua Ashton struct drm_property *plane_hdr_mult_property; 366b8b92c1bSMelissa Wen 367b8b92c1bSMelissa Wen struct drm_property *plane_ctm_property; 368671994e3SMelissa Wen /** 369f545d824SMelissa Wen * @shaper_lut_property: Plane property to set pre-blending shaper LUT 370f545d824SMelissa Wen * that converts color content before 3D LUT. If 371f545d824SMelissa Wen * plane_shaper_tf_property != Identity TF, AMD color module will 372f545d824SMelissa Wen * combine the user LUT values with pre-defined TF into the LUT 373f545d824SMelissa Wen * parameters to be programmed. 374f545d824SMelissa Wen */ 375f545d824SMelissa Wen struct drm_property *plane_shaper_lut_property; 376f545d824SMelissa Wen /** 377f545d824SMelissa Wen * @shaper_lut_size_property: Plane property for the size of 378f545d824SMelissa Wen * pre-blending shaper LUT as supported by the driver (read-only). 379f545d824SMelissa Wen */ 380f545d824SMelissa Wen struct drm_property *plane_shaper_lut_size_property; 381f545d824SMelissa Wen /** 382f545d824SMelissa Wen * @plane_shaper_tf_property: Plane property to set a predefined 383f545d824SMelissa Wen * transfer function for pre-blending shaper (before applying 3D LUT) 384f545d824SMelissa Wen * with or without LUT. There is no shaper ROM, but we can use AMD 385f545d824SMelissa Wen * color modules to program LUT parameters from predefined TF (or 386f545d824SMelissa Wen * from a combination of pre-defined TF and the custom 1D LUT). 387f545d824SMelissa Wen */ 388f545d824SMelissa Wen struct drm_property *plane_shaper_tf_property; 389f545d824SMelissa Wen /** 390671994e3SMelissa Wen * @plane_lut3d_property: Plane property for color transformation using 391671994e3SMelissa Wen * a 3D LUT (pre-blending), a three-dimensional array where each 392671994e3SMelissa Wen * element is an RGB triplet. Each dimension has the size of 393671994e3SMelissa Wen * lut3d_size. The array contains samples from the approximated 394671994e3SMelissa Wen * function. On AMD, values between samples are estimated by 395671994e3SMelissa Wen * tetrahedral interpolation. The array is accessed with three indices, 396671994e3SMelissa Wen * one for each input dimension (color channel), blue being the 397671994e3SMelissa Wen * outermost dimension, red the innermost. 398671994e3SMelissa Wen */ 399671994e3SMelissa Wen struct drm_property *plane_lut3d_property; 400671994e3SMelissa Wen /** 401671994e3SMelissa Wen * @plane_degamma_lut_size_property: Plane property to define the max 402671994e3SMelissa Wen * size of 3D LUT as supported by the driver (read-only). The max size 403671994e3SMelissa Wen * is the max size of one dimension and, therefore, the max number of 404671994e3SMelissa Wen * entries for 3D LUT array is the 3D LUT size cubed; 405671994e3SMelissa Wen */ 406671994e3SMelissa Wen struct drm_property *plane_lut3d_size_property; 4070ef47454SJoshua Ashton /** 4080ef47454SJoshua Ashton * @plane_blend_lut_property: Plane property for output gamma before 4090ef47454SJoshua Ashton * blending. Userspace set a blend LUT to convert colors after 3D LUT 4100ef47454SJoshua Ashton * conversion. It works as a post-3DLUT 1D LUT. With shaper LUT, they 4110ef47454SJoshua Ashton * are sandwiching 3D LUT with two 1D LUT. If plane_blend_tf_property 4120ef47454SJoshua Ashton * != Identity TF, AMD color module will combine the user LUT values 4130ef47454SJoshua Ashton * with pre-defined TF into the LUT parameters to be programmed. 4140ef47454SJoshua Ashton */ 4150ef47454SJoshua Ashton struct drm_property *plane_blend_lut_property; 4160ef47454SJoshua Ashton /** 4170ef47454SJoshua Ashton * @plane_blend_lut_size_property: Plane property to define the max 4180ef47454SJoshua Ashton * size of blend LUT as supported by the driver (read-only). 4190ef47454SJoshua Ashton */ 4200ef47454SJoshua Ashton struct drm_property *plane_blend_lut_size_property; 4210ef47454SJoshua Ashton /** 4220ef47454SJoshua Ashton * @plane_blend_tf_property: Plane property to set a predefined 4230ef47454SJoshua Ashton * transfer function for pre-blending blend/out_gamma (after applying 4240ef47454SJoshua Ashton * 3D LUT) with or without LUT. There is no blend ROM, but we can use 4250ef47454SJoshua Ashton * AMD color modules to program LUT parameters from predefined TF (or 4260ef47454SJoshua Ashton * from a combination of pre-defined TF and the custom 1D LUT). 4270ef47454SJoshua Ashton */ 4280ef47454SJoshua Ashton struct drm_property *plane_blend_tf_property; 4290f5afa19SMelissa Wen /* @regamma_tf_property: Transfer function for CRTC regamma 4300f5afa19SMelissa Wen * (post-blending). Possible values are defined by `enum 4310f5afa19SMelissa Wen * amdgpu_transfer_function`. There is no regamma ROM, but we can use 4320f5afa19SMelissa Wen * AMD color modules to program LUT parameters from predefined TF (or 4330f5afa19SMelissa Wen * from a combination of pre-defined TF and the custom 1D LUT). 4340f5afa19SMelissa Wen */ 4350f5afa19SMelissa Wen struct drm_property *regamma_tf_property; 436d38ceaf9SAlex Deucher }; 437d38ceaf9SAlex Deucher 438d38ceaf9SAlex Deucher #define AMDGPU_MAX_BL_LEVEL 0xFF 439d38ceaf9SAlex Deucher 440d38ceaf9SAlex Deucher struct amdgpu_backlight_privdata { 441d38ceaf9SAlex Deucher struct amdgpu_encoder *encoder; 442d38ceaf9SAlex Deucher uint8_t negative; 443d38ceaf9SAlex Deucher }; 444d38ceaf9SAlex Deucher 445d38ceaf9SAlex Deucher struct amdgpu_atom_ss { 446d38ceaf9SAlex Deucher uint16_t percentage; 447d38ceaf9SAlex Deucher uint16_t percentage_divider; 448d38ceaf9SAlex Deucher uint8_t type; 449d38ceaf9SAlex Deucher uint16_t step; 450d38ceaf9SAlex Deucher uint8_t delay; 451d38ceaf9SAlex Deucher uint8_t range; 452d38ceaf9SAlex Deucher uint8_t refdiv; 453d38ceaf9SAlex Deucher /* asic_ss */ 454d38ceaf9SAlex Deucher uint16_t rate; 455d38ceaf9SAlex Deucher uint16_t amount; 456d38ceaf9SAlex Deucher }; 457d38ceaf9SAlex Deucher 458d38ceaf9SAlex Deucher struct amdgpu_crtc { 459d38ceaf9SAlex Deucher struct drm_crtc base; 460d38ceaf9SAlex Deucher int crtc_id; 461d38ceaf9SAlex Deucher bool enabled; 462d38ceaf9SAlex Deucher bool can_tile; 463d38ceaf9SAlex Deucher uint32_t crtc_offset; 464d38ceaf9SAlex Deucher struct drm_gem_object *cursor_bo; 465d38ceaf9SAlex Deucher uint64_t cursor_addr; 46629275a9bSAlex Deucher int cursor_x; 46729275a9bSAlex Deucher int cursor_y; 46829275a9bSAlex Deucher int cursor_hot_x; 46929275a9bSAlex Deucher int cursor_hot_y; 470d38ceaf9SAlex Deucher int cursor_width; 471d38ceaf9SAlex Deucher int cursor_height; 472d38ceaf9SAlex Deucher int max_cursor_width; 473d38ceaf9SAlex Deucher int max_cursor_height; 474d38ceaf9SAlex Deucher enum amdgpu_rmx_type rmx_type; 475d38ceaf9SAlex Deucher u8 h_border; 476d38ceaf9SAlex Deucher u8 v_border; 477d38ceaf9SAlex Deucher fixed20_12 vsc; 478d38ceaf9SAlex Deucher fixed20_12 hsc; 479d38ceaf9SAlex Deucher struct drm_display_mode native_mode; 480d38ceaf9SAlex Deucher u32 pll_id; 481d38ceaf9SAlex Deucher /* page flipping */ 482d38ceaf9SAlex Deucher struct amdgpu_flip_work *pflip_works; 483d38ceaf9SAlex Deucher enum amdgpu_flip_status pflip_status; 484d38ceaf9SAlex Deucher int deferred_flip_completion; 4855d1c59c4SAurabindo Pillai /* parameters access from DM IRQ handler */ 4865d1c59c4SAurabindo Pillai struct dm_irq_params dm_irq_params; 487d38ceaf9SAlex Deucher /* pll sharing */ 488d38ceaf9SAlex Deucher struct amdgpu_atom_ss ss; 489d38ceaf9SAlex Deucher bool ss_enabled; 490d38ceaf9SAlex Deucher u32 adjusted_clock; 491d38ceaf9SAlex Deucher int bpc; 492d38ceaf9SAlex Deucher u32 pll_reference_div; 493d38ceaf9SAlex Deucher u32 pll_post_div; 494d38ceaf9SAlex Deucher u32 pll_flags; 495d38ceaf9SAlex Deucher struct drm_encoder *encoder; 496d38ceaf9SAlex Deucher struct drm_connector *connector; 497d38ceaf9SAlex Deucher /* for dpm */ 498d38ceaf9SAlex Deucher u32 line_time; 499d38ceaf9SAlex Deucher u32 wm_low; 500d38ceaf9SAlex Deucher u32 wm_high; 5018e36f9d3SAlex Deucher u32 lb_vblank_lead_lines; 502d38ceaf9SAlex Deucher struct drm_display_mode hw_mode; 5030f66356dSEmily Deng /* for virtual dce */ 5040f66356dSEmily Deng struct hrtimer vblank_timer; 5050f66356dSEmily Deng enum amdgpu_interrupt_state vsync_timer_enabled; 5064562236bSHarry Wentland 5074562236bSHarry Wentland int otg_inst; 508dd55d12cSAndrey Grodzovsky struct drm_pending_vblank_event *event; 509c81e13b9SAlex Hung 510c81e13b9SAlex Hung bool wb_pending; 511f872e2f5SAlex Hung bool wb_enabled; 512c81e13b9SAlex Hung struct drm_writeback_connector *wb_conn; 513d38ceaf9SAlex Deucher }; 514d38ceaf9SAlex Deucher 515d38ceaf9SAlex Deucher struct amdgpu_encoder_atom_dig { 516d38ceaf9SAlex Deucher bool linkb; 517d38ceaf9SAlex Deucher /* atom dig */ 518d38ceaf9SAlex Deucher bool coherent_mode; 519d38ceaf9SAlex Deucher int dig_encoder; /* -1 disabled, 0 DIGA, 1 DIGB, etc. */ 520d38ceaf9SAlex Deucher /* atom lvds/edp */ 521d38ceaf9SAlex Deucher uint32_t lcd_misc; 522d38ceaf9SAlex Deucher uint16_t panel_pwr_delay; 523d38ceaf9SAlex Deucher uint32_t lcd_ss_id; 524d38ceaf9SAlex Deucher /* panel mode */ 525d38ceaf9SAlex Deucher struct drm_display_mode native_mode; 526d38ceaf9SAlex Deucher struct backlight_device *bl_dev; 527d38ceaf9SAlex Deucher int dpms_mode; 528d38ceaf9SAlex Deucher uint8_t backlight_level; 529d38ceaf9SAlex Deucher int panel_mode; 530d38ceaf9SAlex Deucher struct amdgpu_afmt *afmt; 531d38ceaf9SAlex Deucher }; 532d38ceaf9SAlex Deucher 533d38ceaf9SAlex Deucher struct amdgpu_encoder { 534d38ceaf9SAlex Deucher struct drm_encoder base; 535d38ceaf9SAlex Deucher uint32_t encoder_enum; 536d38ceaf9SAlex Deucher uint32_t encoder_id; 537d38ceaf9SAlex Deucher uint32_t devices; 538d38ceaf9SAlex Deucher uint32_t active_device; 539d38ceaf9SAlex Deucher uint32_t flags; 540d38ceaf9SAlex Deucher uint32_t pixel_clock; 541d38ceaf9SAlex Deucher enum amdgpu_rmx_type rmx_type; 542d38ceaf9SAlex Deucher enum amdgpu_underscan_type underscan_type; 543d38ceaf9SAlex Deucher uint32_t underscan_hborder; 544d38ceaf9SAlex Deucher uint32_t underscan_vborder; 545d38ceaf9SAlex Deucher struct drm_display_mode native_mode; 546d38ceaf9SAlex Deucher void *enc_priv; 547d38ceaf9SAlex Deucher int audio_polling_active; 548d38ceaf9SAlex Deucher bool is_ext_encoder; 549d38ceaf9SAlex Deucher u16 caps; 550d38ceaf9SAlex Deucher }; 551d38ceaf9SAlex Deucher 552d38ceaf9SAlex Deucher struct amdgpu_connector_atom_dig { 553d38ceaf9SAlex Deucher /* displayport */ 554d38ceaf9SAlex Deucher u8 dpcd[DP_RECEIVER_CAP_SIZE]; 55565bf2cf9SOleg Vasilev u8 downstream_ports[DP_MAX_DOWNSTREAM_PORTS]; 556d38ceaf9SAlex Deucher u8 dp_sink_type; 557d38ceaf9SAlex Deucher int dp_clock; 558d38ceaf9SAlex Deucher int dp_lane_count; 559d38ceaf9SAlex Deucher bool edp_on; 560d38ceaf9SAlex Deucher }; 561d38ceaf9SAlex Deucher 562d38ceaf9SAlex Deucher struct amdgpu_gpio_rec { 563d38ceaf9SAlex Deucher bool valid; 564d38ceaf9SAlex Deucher u8 id; 565d38ceaf9SAlex Deucher u32 reg; 566d38ceaf9SAlex Deucher u32 mask; 567d38ceaf9SAlex Deucher u32 shift; 568d38ceaf9SAlex Deucher }; 569d38ceaf9SAlex Deucher 570d38ceaf9SAlex Deucher struct amdgpu_hpd { 571d38ceaf9SAlex Deucher enum amdgpu_hpd_id hpd; 572d38ceaf9SAlex Deucher u8 plugged_state; 573d38ceaf9SAlex Deucher struct amdgpu_gpio_rec gpio; 574d38ceaf9SAlex Deucher }; 575d38ceaf9SAlex Deucher 576d38ceaf9SAlex Deucher struct amdgpu_router { 577d38ceaf9SAlex Deucher u32 router_id; 578d38ceaf9SAlex Deucher struct amdgpu_i2c_bus_rec i2c_info; 579d38ceaf9SAlex Deucher u8 i2c_addr; 580d38ceaf9SAlex Deucher /* i2c mux */ 581d38ceaf9SAlex Deucher bool ddc_valid; 582d38ceaf9SAlex Deucher u8 ddc_mux_type; 583d38ceaf9SAlex Deucher u8 ddc_mux_control_pin; 584d38ceaf9SAlex Deucher u8 ddc_mux_state; 585d38ceaf9SAlex Deucher /* clock/data mux */ 586d38ceaf9SAlex Deucher bool cd_valid; 587d38ceaf9SAlex Deucher u8 cd_mux_type; 588d38ceaf9SAlex Deucher u8 cd_mux_control_pin; 589d38ceaf9SAlex Deucher u8 cd_mux_state; 590d38ceaf9SAlex Deucher }; 591d38ceaf9SAlex Deucher 592d38ceaf9SAlex Deucher enum amdgpu_connector_audio { 593d38ceaf9SAlex Deucher AMDGPU_AUDIO_DISABLE = 0, 594d38ceaf9SAlex Deucher AMDGPU_AUDIO_ENABLE = 1, 595d38ceaf9SAlex Deucher AMDGPU_AUDIO_AUTO = 2 596d38ceaf9SAlex Deucher }; 597d38ceaf9SAlex Deucher 598d38ceaf9SAlex Deucher enum amdgpu_connector_dither { 599d38ceaf9SAlex Deucher AMDGPU_FMT_DITHER_DISABLE = 0, 600d38ceaf9SAlex Deucher AMDGPU_FMT_DITHER_ENABLE = 1, 601d38ceaf9SAlex Deucher }; 602d38ceaf9SAlex Deucher 6034562236bSHarry Wentland struct amdgpu_dm_dp_aux { 6044562236bSHarry Wentland struct drm_dp_aux aux; 60546df790cSAndrey Grodzovsky struct ddc_service *ddc_service; 6064562236bSHarry Wentland }; 6074562236bSHarry Wentland 6084562236bSHarry Wentland struct amdgpu_i2c_adapter { 6094562236bSHarry Wentland struct i2c_adapter base; 61046df790cSAndrey Grodzovsky 61146df790cSAndrey Grodzovsky struct ddc_service *ddc_service; 612*b217105aSAlex Deucher bool oem; 6134562236bSHarry Wentland }; 6144562236bSHarry Wentland 6154562236bSHarry Wentland #define TO_DM_AUX(x) container_of((x), struct amdgpu_dm_dp_aux, aux) 6164562236bSHarry Wentland 617d38ceaf9SAlex Deucher struct amdgpu_connector { 618d38ceaf9SAlex Deucher struct drm_connector base; 619d38ceaf9SAlex Deucher uint32_t connector_id; 620d38ceaf9SAlex Deucher uint32_t devices; 621d38ceaf9SAlex Deucher struct amdgpu_i2c_chan *ddc_bus; 622d38ceaf9SAlex Deucher /* some systems have an hdmi and vga port with a shared ddc line */ 623d38ceaf9SAlex Deucher bool shared_ddc; 624d38ceaf9SAlex Deucher bool use_digital; 625d38ceaf9SAlex Deucher /* we need to mind the EDID between detect 626d38ceaf9SAlex Deucher and get modes due to analog/digital/tvencoder */ 627d38ceaf9SAlex Deucher struct edid *edid; 628d38ceaf9SAlex Deucher void *con_priv; 629d38ceaf9SAlex Deucher bool dac_load_detect; 630d38ceaf9SAlex Deucher bool detected_by_load; /* if the connection status was determined by load */ 63190f56611Sxurui bool detected_hpd_without_ddc; /* if an HPD signal was detected on DVI, but ddc probing failed */ 632d38ceaf9SAlex Deucher uint16_t connector_object_id; 633d38ceaf9SAlex Deucher struct amdgpu_hpd hpd; 634d38ceaf9SAlex Deucher struct amdgpu_router router; 635d38ceaf9SAlex Deucher struct amdgpu_i2c_chan *router_bus; 636d38ceaf9SAlex Deucher enum amdgpu_connector_audio audio; 637d38ceaf9SAlex Deucher enum amdgpu_connector_dither dither; 638d38ceaf9SAlex Deucher unsigned pixelclock_for_modeset; 639d38ceaf9SAlex Deucher }; 640d38ceaf9SAlex Deucher 6414562236bSHarry Wentland /* TODO: start to use this struct and remove same field from base one */ 6424562236bSHarry Wentland struct amdgpu_mst_connector { 6434562236bSHarry Wentland struct amdgpu_connector base; 6444562236bSHarry Wentland 6454562236bSHarry Wentland struct drm_dp_mst_topology_mgr mst_mgr; 6464562236bSHarry Wentland struct amdgpu_dm_dp_aux dm_dp_aux; 647f0127cb1SWayne Lin struct drm_dp_mst_port *mst_output_port; 648f0127cb1SWayne Lin struct amdgpu_connector *mst_root; 6494562236bSHarry Wentland bool is_mst_connector; 6504562236bSHarry Wentland struct amdgpu_encoder *mst_encoder; 651d38ceaf9SAlex Deucher }; 652d38ceaf9SAlex Deucher 653d38ceaf9SAlex Deucher #define ENCODER_MODE_IS_DP(em) (((em) == ATOM_ENCODER_MODE_DP) || \ 654d38ceaf9SAlex Deucher ((em) == ATOM_ENCODER_MODE_DP_MST)) 655d38ceaf9SAlex Deucher 656aa8e286aSSamuel Li /* Driver internal use only flags of amdgpu_display_get_crtc_scanoutpos() */ 6571bf6ad62SDaniel Vetter #define DRM_SCANOUTPOS_VALID (1 << 0) 6581bf6ad62SDaniel Vetter #define DRM_SCANOUTPOS_IN_VBLANK (1 << 1) 6591bf6ad62SDaniel Vetter #define DRM_SCANOUTPOS_ACCURATE (1 << 2) 6608e36f9d3SAlex Deucher #define USE_REAL_VBLANKSTART (1 << 30) 6618e36f9d3SAlex Deucher #define GET_DISTANCE_TO_VBLANKSTART (1 << 31) 6628e36f9d3SAlex Deucher 663d38ceaf9SAlex Deucher void amdgpu_link_encoder_connector(struct drm_device *dev); 664d38ceaf9SAlex Deucher 665d38ceaf9SAlex Deucher struct drm_connector * 666d38ceaf9SAlex Deucher amdgpu_get_connector_for_encoder(struct drm_encoder *encoder); 667d38ceaf9SAlex Deucher struct drm_connector * 668d38ceaf9SAlex Deucher amdgpu_get_connector_for_encoder_init(struct drm_encoder *encoder); 669d38ceaf9SAlex Deucher bool amdgpu_dig_monitor_is_duallink(struct drm_encoder *encoder, 670d38ceaf9SAlex Deucher u32 pixel_clock); 671d38ceaf9SAlex Deucher 672d38ceaf9SAlex Deucher u16 amdgpu_encoder_get_dp_bridge_encoder_id(struct drm_encoder *encoder); 673d38ceaf9SAlex Deucher struct drm_encoder *amdgpu_get_external_encoder(struct drm_encoder *encoder); 674d38ceaf9SAlex Deucher 675e0b5b5ecSSamuel Li bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector, 676e0b5b5ecSSamuel Li bool use_aux); 677d38ceaf9SAlex Deucher 678d38ceaf9SAlex Deucher void amdgpu_encoder_set_active_device(struct drm_encoder *encoder); 679d38ceaf9SAlex Deucher 680aa8e286aSSamuel Li int amdgpu_display_get_crtc_scanoutpos(struct drm_device *dev, 681aa8e286aSSamuel Li unsigned int pipe, unsigned int flags, int *vpos, 682aa8e286aSSamuel Li int *hpos, ktime_t *stime, ktime_t *etime, 6833bb403bfSVille Syrjälä const struct drm_display_mode *mode); 684d38ceaf9SAlex Deucher 685d38ceaf9SAlex Deucher int amdgpufb_remove(struct drm_device *dev, struct drm_framebuffer *fb); 686d38ceaf9SAlex Deucher 687d38ceaf9SAlex Deucher void amdgpu_enc_destroy(struct drm_encoder *encoder); 688d38ceaf9SAlex Deucher void amdgpu_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj); 6890c16443aSSamuel Li bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc, 690d38ceaf9SAlex Deucher const struct drm_display_mode *mode, 691d38ceaf9SAlex Deucher struct drm_display_mode *adjusted_mode); 692d38ceaf9SAlex Deucher void amdgpu_panel_mode_fixup(struct drm_encoder *encoder, 693d38ceaf9SAlex Deucher struct drm_display_mode *adjusted_mode); 694734dd01dSSamuel Li int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc); 695d38ceaf9SAlex Deucher 696ea702333SThomas Zimmermann bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc, 697ea702333SThomas Zimmermann bool in_vblank_irq, int *vpos, 698ea702333SThomas Zimmermann int *hpos, ktime_t *stime, ktime_t *etime, 699ea702333SThomas Zimmermann const struct drm_display_mode *mode); 700ea702333SThomas Zimmermann 701d38ceaf9SAlex Deucher /* amdgpu_display.c */ 70250af9193SSamuel Li void amdgpu_display_print_display_setup(struct drm_device *dev); 7033dc9b1ceSSamuel Li int amdgpu_display_modeset_create_props(struct amdgpu_device *adev); 704775a8364SSamuel Li int amdgpu_display_crtc_set_config(struct drm_mode_set *set, 705a4eff9aaSDaniel Vetter struct drm_modeset_acquire_ctx *ctx); 7060cd11932SSamuel Li int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, 707d38ceaf9SAlex Deucher struct drm_framebuffer *fb, 708d38ceaf9SAlex Deucher struct drm_pending_vblank_event *event, 70941292b1fSDaniel Vetter uint32_t page_flip_flags, uint32_t target, 71041292b1fSDaniel Vetter struct drm_modeset_acquire_ctx *ctx); 711d38ceaf9SAlex Deucher extern const struct drm_mode_config_funcs amdgpu_mode_funcs; 712d38ceaf9SAlex Deucher 713d38ceaf9SAlex Deucher #endif 714