blob: 63fd5b3de738b5e56a92453b6dbbab369a8a4060 [file] [log] [blame]
Harry Wentland45622362017-09-12 15:58:20 -04001/*
2 * Copyright 2012-14 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: AMD
23 *
24 */
25
26#ifndef DC_INTERFACE_H_
27#define DC_INTERFACE_H_
28
29#include "dc_types.h"
Harry Wentland45622362017-09-12 15:58:20 -040030#include "grph_object_defs.h"
31#include "logger_types.h"
32#include "gpio_types.h"
33#include "link_service_types.h"
Harry Wentlandd0778eb2017-07-22 20:05:20 -040034#include "grph_object_ctrl_defs.h"
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -040035#include <inc/hw/opp.h>
Harry Wentland45622362017-09-12 15:58:20 -040036
Harry Wentland091a97e2016-12-06 12:25:52 -050037#define MAX_SURFACES 3
Aric Cyrab2541b2016-12-29 15:27:12 -050038#define MAX_STREAMS 6
Harry Wentland45622362017-09-12 15:58:20 -040039#define MAX_SINKS_PER_LINK 4
40
41/*******************************************************************************
42 * Display Core Interfaces
43 ******************************************************************************/
44
45struct dc_caps {
Aric Cyrab2541b2016-12-29 15:27:12 -050046 uint32_t max_streams;
Harry Wentland45622362017-09-12 15:58:20 -040047 uint32_t max_links;
48 uint32_t max_audios;
49 uint32_t max_slave_planes;
Alex Deucherd4e13b02017-06-15 16:24:01 -040050 uint32_t max_surfaces;
Harry Wentland45622362017-09-12 15:58:20 -040051 uint32_t max_downscale_ratio;
52 uint32_t i2c_speed_in_khz;
Tony Chenga37656b2017-02-08 22:13:52 -050053
54 unsigned int max_cursor_size;
Harry Wentland45622362017-09-12 15:58:20 -040055};
56
57
58struct dc_dcc_surface_param {
Harry Wentland45622362017-09-12 15:58:20 -040059 struct dc_size surface_size;
Anthony Kooebf055f2017-06-14 10:19:57 -040060 enum surface_pixel_format format;
Alex Deucher2c8ad2d2017-06-15 16:20:24 -040061 enum swizzle_mode_values swizzle_mode;
Harry Wentland45622362017-09-12 15:58:20 -040062 enum dc_scan_direction scan;
63};
64
65struct dc_dcc_setting {
66 unsigned int max_compressed_blk_size;
67 unsigned int max_uncompressed_blk_size;
68 bool independent_64b_blks;
69};
70
71struct dc_surface_dcc_cap {
Harry Wentland45622362017-09-12 15:58:20 -040072 union {
73 struct {
74 struct dc_dcc_setting rgb;
75 } grph;
76
77 struct {
78 struct dc_dcc_setting luma;
79 struct dc_dcc_setting chroma;
80 } video;
81 };
Anthony Kooebf055f2017-06-14 10:19:57 -040082
83 bool capable;
84 bool const_color_support;
Harry Wentland45622362017-09-12 15:58:20 -040085};
86
Sylvia Tsai94267b32017-04-21 15:29:55 -040087struct dc_static_screen_events {
88 bool cursor_update;
89 bool surface_update;
90 bool overlay_update;
91};
92
Harry Wentland45622362017-09-12 15:58:20 -040093/* Forward declaration*/
94struct dc;
95struct dc_surface;
96struct validate_context;
97
98struct dc_cap_funcs {
Alex Deucherff5ef992017-06-15 16:27:42 -040099#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
100 bool (*get_dcc_compression_cap)(const struct dc *dc,
101 const struct dc_dcc_surface_param *input,
102 struct dc_surface_dcc_cap *output);
103#else
Harry Wentland45622362017-09-12 15:58:20 -0400104 int i;
Alex Deucherff5ef992017-06-15 16:27:42 -0400105#endif
Harry Wentland45622362017-09-12 15:58:20 -0400106};
107
108struct dc_stream_funcs {
109 bool (*adjust_vmin_vmax)(struct dc *dc,
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400110 struct dc_stream **stream,
Harry Wentland45622362017-09-12 15:58:20 -0400111 int num_streams,
112 int vmin,
113 int vmax);
Eric Cook72ada5f2017-04-18 15:24:50 -0400114 bool (*get_crtc_position)(struct dc *dc,
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400115 struct dc_stream **stream,
Eric Cook72ada5f2017-04-18 15:24:50 -0400116 int num_streams,
117 unsigned int *v_pos,
118 unsigned int *nom_v_pos);
119
Harry Wentland45622362017-09-12 15:58:20 -0400120 bool (*set_gamut_remap)(struct dc *dc,
Amy Zhangf46661d2017-05-09 14:45:54 -0400121 const struct dc_stream *stream);
Sylvia Tsai94267b32017-04-21 15:29:55 -0400122
Yue Hin Lauabe07e82017-06-28 17:21:42 -0400123 bool (*program_csc_matrix)(struct dc *dc,
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400124 struct dc_stream *stream);
Yue Hin Lauabe07e82017-06-28 17:21:42 -0400125
Sylvia Tsai94267b32017-04-21 15:29:55 -0400126 void (*set_static_screen_events)(struct dc *dc,
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400127 struct dc_stream **stream,
Sylvia Tsai94267b32017-04-21 15:29:55 -0400128 int num_streams,
129 const struct dc_static_screen_events *events);
Ding Wang529cad02017-04-25 10:03:27 -0400130
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400131 void (*set_dither_option)(struct dc_stream *stream,
Ding Wang529cad02017-04-25 10:03:27 -0400132 enum dc_dither_option option);
Harry Wentland45622362017-09-12 15:58:20 -0400133};
134
135struct link_training_settings;
136
137struct dc_link_funcs {
138 void (*set_drive_settings)(struct dc *dc,
Hersen Wubf5cda32017-01-04 10:22:35 -0500139 struct link_training_settings *lt_settings,
140 const struct dc_link *link);
Harry Wentland45622362017-09-12 15:58:20 -0400141 void (*perform_link_training)(struct dc *dc,
142 struct dc_link_settings *link_setting,
143 bool skip_video_pattern);
144 void (*set_preferred_link_settings)(struct dc *dc,
Zeyu Fan88639162016-12-23 16:53:12 -0500145 struct dc_link_settings *link_setting,
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400146 struct dc_link *link);
Harry Wentland45622362017-09-12 15:58:20 -0400147 void (*enable_hpd)(const struct dc_link *link);
148 void (*disable_hpd)(const struct dc_link *link);
149 void (*set_test_pattern)(
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400150 struct dc_link *link,
Harry Wentland45622362017-09-12 15:58:20 -0400151 enum dp_test_pattern test_pattern,
152 const struct link_training_settings *p_link_settings,
153 const unsigned char *p_custom_pattern,
154 unsigned int cust_pattern_size);
155};
156
157/* Structure to hold configuration flags set by dm at dc creation. */
158struct dc_config {
159 bool gpu_vm_support;
160 bool disable_disp_pll_sharing;
161};
162
163struct dc_debug {
164 bool surface_visual_confirm;
Tony Cheng2b13d7d2017-07-14 14:07:16 -0400165 bool sanity_checks;
Harry Wentland45622362017-09-12 15:58:20 -0400166 bool max_disp_clk;
Harry Wentland45622362017-09-12 15:58:20 -0400167 bool surface_trace;
Yongqiang Sun94749802016-12-08 09:47:11 -0500168 bool timing_trace;
Dmytro Laktyushkinc9742682017-06-07 13:53:30 -0400169 bool clock_trace;
Harry Wentland45622362017-09-12 15:58:20 -0400170 bool validation_trace;
171 bool disable_stutter;
172 bool disable_dcc;
173 bool disable_dfs_bypass;
Alex Deucherff5ef992017-06-15 16:27:42 -0400174#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
175 bool disable_dpp_power_gate;
176 bool disable_hubp_power_gate;
177 bool disable_pplib_wm_range;
178 bool use_dml_wm;
Dmytro Laktyushkin90f095c2017-06-16 11:27:59 -0400179 bool disable_pipe_split;
Dmytro Laktyushkin139cb652017-06-21 09:35:35 -0400180 int sr_exit_time_dpm0_ns;
181 int sr_enter_plus_exit_time_dpm0_ns;
Alex Deucherff5ef992017-06-15 16:27:42 -0400182 int sr_exit_time_ns;
183 int sr_enter_plus_exit_time_ns;
184 int urgent_latency_ns;
185 int percent_of_ideal_drambw;
186 int dram_clock_change_latency_ns;
Dmytro Laktyushkine73b59b2017-05-19 13:01:35 -0400187 int always_scale;
Alex Deucherff5ef992017-06-15 16:27:42 -0400188#endif
Alex Deucher2c8ad2d2017-06-15 16:20:24 -0400189 bool disable_pplib_clock_request;
Harry Wentland45622362017-09-12 15:58:20 -0400190 bool disable_clock_gate;
Yongqiang Sunaa66df52016-12-15 10:50:48 -0500191 bool disable_dmcu;
Charlene Liu29eba8e2017-05-23 17:15:54 -0400192 bool disable_psr;
Anthony Koo70814f62017-01-27 17:50:03 -0500193 bool force_abm_enable;
Harry Wentland45622362017-09-12 15:58:20 -0400194};
195
196struct dc {
197 struct dc_caps caps;
198 struct dc_cap_funcs cap_funcs;
199 struct dc_stream_funcs stream_funcs;
200 struct dc_link_funcs link_funcs;
201 struct dc_config config;
202 struct dc_debug debug;
203};
204
Alex Deucher2c8ad2d2017-06-15 16:20:24 -0400205enum frame_buffer_mode {
206 FRAME_BUFFER_MODE_LOCAL_ONLY = 0,
207 FRAME_BUFFER_MODE_ZFB_ONLY,
208 FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL,
209} ;
210
211struct dchub_init_data {
Alex Deucher2c8ad2d2017-06-15 16:20:24 -0400212 int64_t zfb_phys_addr_base;
213 int64_t zfb_mc_base_addr;
214 uint64_t zfb_size_in_byte;
215 enum frame_buffer_mode fb_mode;
Anthony Kooebf055f2017-06-14 10:19:57 -0400216 bool dchub_initialzied;
217 bool dchub_info_valid;
Alex Deucher2c8ad2d2017-06-15 16:20:24 -0400218};
Alex Deucher2c8ad2d2017-06-15 16:20:24 -0400219
Harry Wentland45622362017-09-12 15:58:20 -0400220struct dc_init_data {
221 struct hw_asic_id asic_id;
222 void *driver; /* ctx */
223 struct cgs_device *cgs_device;
224
225 int num_virtual_links;
226 /*
227 * If 'vbios_override' not NULL, it will be called instead
228 * of the real VBIOS. Intended use is Diagnostics on FPGA.
229 */
230 struct dc_bios *vbios_override;
231 enum dce_environment dce_environment;
232
233 struct dc_config flags;
Roman Li690b5e32017-07-27 20:00:06 -0400234#ifdef ENABLE_FBC
235 uint64_t fbc_gpu_addr;
236#endif
Harry Wentland45622362017-09-12 15:58:20 -0400237};
238
239struct dc *dc_create(const struct dc_init_data *init_params);
240
241void dc_destroy(struct dc **dc);
242
Alex Deucher2c8ad2d2017-06-15 16:20:24 -0400243bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data);
Alex Deucher2c8ad2d2017-06-15 16:20:24 -0400244
Tony Cheng6d244be2017-07-20 00:12:20 -0400245void dc_log_hw_state(struct dc *dc);
246
Harry Wentland45622362017-09-12 15:58:20 -0400247/*******************************************************************************
248 * Surface Interfaces
249 ******************************************************************************/
250
251enum {
Anthony Koofb735a92016-12-13 13:59:41 -0500252 TRANSFER_FUNC_POINTS = 1025
Harry Wentland45622362017-09-12 15:58:20 -0400253};
254
Andrew Wong1646a6fe2016-12-22 15:41:30 -0500255struct dc_hdr_static_metadata {
Andrew Wong1646a6fe2016-12-22 15:41:30 -0500256 /* display chromaticities and white point in units of 0.00001 */
257 unsigned int chromaticity_green_x;
258 unsigned int chromaticity_green_y;
259 unsigned int chromaticity_blue_x;
260 unsigned int chromaticity_blue_y;
261 unsigned int chromaticity_red_x;
262 unsigned int chromaticity_red_y;
263 unsigned int chromaticity_white_point_x;
264 unsigned int chromaticity_white_point_y;
265
266 uint32_t min_luminance;
267 uint32_t max_luminance;
268 uint32_t maximum_content_light_level;
269 uint32_t maximum_frame_average_light_level;
Anthony Kooebf055f2017-06-14 10:19:57 -0400270
271 bool hdr_supported;
272 bool is_hdr;
Andrew Wong1646a6fe2016-12-22 15:41:30 -0500273};
274
Anthony Koofb735a92016-12-13 13:59:41 -0500275enum dc_transfer_func_type {
276 TF_TYPE_PREDEFINED,
277 TF_TYPE_DISTRIBUTED_POINTS,
Dmytro Laktyushkin7950f0f2017-06-13 17:08:22 -0400278 TF_TYPE_BYPASS
Anthony Koofb735a92016-12-13 13:59:41 -0500279};
280
281struct dc_transfer_func_distributed_points {
Amy Zhangfcd2f4b2017-01-05 17:12:20 -0500282 struct fixed31_32 red[TRANSFER_FUNC_POINTS];
283 struct fixed31_32 green[TRANSFER_FUNC_POINTS];
284 struct fixed31_32 blue[TRANSFER_FUNC_POINTS];
285
Anthony Koofb735a92016-12-13 13:59:41 -0500286 uint16_t end_exponent;
Amy Zhangfcd2f4b2017-01-05 17:12:20 -0500287 uint16_t x_point_at_y1_red;
288 uint16_t x_point_at_y1_green;
289 uint16_t x_point_at_y1_blue;
Anthony Koofb735a92016-12-13 13:59:41 -0500290};
291
292enum dc_transfer_func_predefined {
293 TRANSFER_FUNCTION_SRGB,
294 TRANSFER_FUNCTION_BT709,
Anthony Koo90e508b2016-12-15 12:09:46 -0500295 TRANSFER_FUNCTION_PQ,
Anthony Koofb735a92016-12-13 13:59:41 -0500296 TRANSFER_FUNCTION_LINEAR,
297};
298
299struct dc_transfer_func {
Anthony Kooebf055f2017-06-14 10:19:57 -0400300 struct dc_transfer_func_distributed_points tf_pts;
Anthony Koofb735a92016-12-13 13:59:41 -0500301 enum dc_transfer_func_type type;
302 enum dc_transfer_func_predefined tf;
Leo (Sunpeng) Li7b0c4702017-07-10 14:04:21 -0400303 struct dc_context *ctx;
304 int ref_count;
Anthony Koofb735a92016-12-13 13:59:41 -0500305};
306
Harry Wentlande12cfcb2017-07-20 11:43:32 -0400307/*
308 * This structure is filled in by dc_surface_get_status and contains
309 * the last requested address and the currently active address so the called
310 * can determine if there are any outstanding flips
311 */
312struct dc_surface_status {
313 struct dc_plane_address requested_address;
314 struct dc_plane_address current_address;
315 bool is_flip_pending;
316 bool is_right_eye;
317};
318
Harry Wentland45622362017-09-12 15:58:20 -0400319struct dc_surface {
Harry Wentland45622362017-09-12 15:58:20 -0400320 struct dc_plane_address address;
321
322 struct scaling_taps scaling_quality;
323 struct rect src_rect;
324 struct rect dst_rect;
325 struct rect clip_rect;
326
327 union plane_size plane_size;
328 union dc_tiling_info tiling_info;
Anthony Kooebf055f2017-06-14 10:19:57 -0400329
Harry Wentland45622362017-09-12 15:58:20 -0400330 struct dc_plane_dcc_param dcc;
Andrew Wong1646a6fe2016-12-22 15:41:30 -0500331 struct dc_hdr_static_metadata hdr_static_ctx;
332
Harry Wentland7a6c4af62017-07-24 15:30:17 -0400333 struct dc_gamma *gamma_correction;
Leo (Sunpeng) Li7b0c4702017-07-10 14:04:21 -0400334 struct dc_transfer_func *in_transfer_func;
Anthony Kooebf055f2017-06-14 10:19:57 -0400335
336 enum dc_color_space color_space;
337 enum surface_pixel_format format;
338 enum dc_rotation_angle rotation;
339 enum plane_stereo_format stereo_format;
340
341 bool per_pixel_alpha;
342 bool visible;
343 bool flip_immediate;
344 bool horizontal_mirror;
Harry Wentlande12cfcb2017-07-20 11:43:32 -0400345
346 /* private to DC core */
347 struct dc_surface_status status;
348 struct dc_context *ctx;
349
350 /* private to dc_surface.c */
351 enum dc_irq_source irq_source;
352 int ref_count;
Harry Wentland45622362017-09-12 15:58:20 -0400353};
354
355struct dc_plane_info {
356 union plane_size plane_size;
357 union dc_tiling_info tiling_info;
Leon Elazar9cd09bf2016-12-19 12:00:05 -0500358 struct dc_plane_dcc_param dcc;
Harry Wentland45622362017-09-12 15:58:20 -0400359 enum surface_pixel_format format;
360 enum dc_rotation_angle rotation;
Harry Wentland45622362017-09-12 15:58:20 -0400361 enum plane_stereo_format stereo_format;
362 enum dc_color_space color_space; /*todo: wrong place, fits in scaling info*/
Anthony Kooebf055f2017-06-14 10:19:57 -0400363 bool horizontal_mirror;
Harry Wentland45622362017-09-12 15:58:20 -0400364 bool visible;
Anthony Kooebf055f2017-06-14 10:19:57 -0400365 bool per_pixel_alpha;
Harry Wentland45622362017-09-12 15:58:20 -0400366};
367
368struct dc_scaling_info {
Anthony Kooebf055f2017-06-14 10:19:57 -0400369 struct rect src_rect;
370 struct rect dst_rect;
371 struct rect clip_rect;
372 struct scaling_taps scaling_quality;
Harry Wentland45622362017-09-12 15:58:20 -0400373};
374
375struct dc_surface_update {
Harry Wentlande12cfcb2017-07-20 11:43:32 -0400376 struct dc_surface *surface;
Harry Wentland45622362017-09-12 15:58:20 -0400377
378 /* isr safe update parameters. null means no updates */
379 struct dc_flip_addrs *flip_addr;
380 struct dc_plane_info *plane_info;
381 struct dc_scaling_info *scaling_info;
382 /* following updates require alloc/sleep/spin that is not isr safe,
383 * null means no updates
384 */
Anthony Koofb735a92016-12-13 13:59:41 -0500385 /* gamma TO BE REMOVED */
Harry Wentland45622362017-09-12 15:58:20 -0400386 struct dc_gamma *gamma;
Anthony Koofb735a92016-12-13 13:59:41 -0500387 struct dc_transfer_func *in_transfer_func;
Amy Zhangf46661d2017-05-09 14:45:54 -0400388 struct dc_hdr_static_metadata *hdr_static_metadata;
Harry Wentland45622362017-09-12 15:58:20 -0400389};
Harry Wentland45622362017-09-12 15:58:20 -0400390
391/*
392 * Create a new surface with default parameters;
393 */
394struct dc_surface *dc_create_surface(const struct dc *dc);
395const struct dc_surface_status *dc_surface_get_status(
396 const struct dc_surface *dc_surface);
397
Harry Wentlande12cfcb2017-07-20 11:43:32 -0400398void dc_surface_retain(struct dc_surface *dc_surface);
399void dc_surface_release(struct dc_surface *dc_surface);
Harry Wentland45622362017-09-12 15:58:20 -0400400
Harry Wentland7a6c4af62017-07-24 15:30:17 -0400401void dc_gamma_retain(struct dc_gamma *dc_gamma);
402void dc_gamma_release(struct dc_gamma **dc_gamma);
Harry Wentland45622362017-09-12 15:58:20 -0400403struct dc_gamma *dc_create_gamma(void);
404
Leo (Sunpeng) Li7b0c4702017-07-10 14:04:21 -0400405void dc_transfer_func_retain(struct dc_transfer_func *dc_tf);
406void dc_transfer_func_release(struct dc_transfer_func *dc_tf);
Anthony Koo90e508b2016-12-15 12:09:46 -0500407struct dc_transfer_func *dc_create_transfer_func(void);
Anthony Koofb735a92016-12-13 13:59:41 -0500408
Harry Wentland45622362017-09-12 15:58:20 -0400409/*
410 * This structure holds a surface address. There could be multiple addresses
411 * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such
412 * as frame durations and DCC format can also be set.
413 */
414struct dc_flip_addrs {
415 struct dc_plane_address address;
416 bool flip_immediate;
Harry Wentland45622362017-09-12 15:58:20 -0400417 /* TODO: add flip duration for FreeSync */
418};
419
420/*
Aric Cyrab2541b2016-12-29 15:27:12 -0500421 * Set up surface attributes and associate to a stream
422 * The surfaces parameter is an absolute set of all surface active for the stream.
423 * If no surfaces are provided, the stream will be blanked; no memory read.
Harry Wentland45622362017-09-12 15:58:20 -0400424 * Any flip related attribute changes must be done through this interface.
425 *
426 * After this call:
Aric Cyrab2541b2016-12-29 15:27:12 -0500427 * Surfaces attributes are programmed and configured to be composed into stream.
Harry Wentland45622362017-09-12 15:58:20 -0400428 * This does not trigger a flip. No surface address is programmed.
429 */
430
Aric Cyrab2541b2016-12-29 15:27:12 -0500431bool dc_commit_surfaces_to_stream(
Harry Wentland45622362017-09-12 15:58:20 -0400432 struct dc *dc,
Harry Wentlande12cfcb2017-07-20 11:43:32 -0400433 struct dc_surface **dc_surfaces,
Harry Wentland45622362017-09-12 15:58:20 -0400434 uint8_t surface_count,
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400435 struct dc_stream *stream);
Harry Wentland45622362017-09-12 15:58:20 -0400436
Aric Cyrab2541b2016-12-29 15:27:12 -0500437bool dc_post_update_surfaces_to_stream(
Harry Wentland45622362017-09-12 15:58:20 -0400438 struct dc *dc);
439
Dmytro Laktyushkin81e2b2d2017-05-10 18:24:24 -0400440/* Surface update type is used by dc_update_surfaces_and_stream
441 * The update type is determined at the very beginning of the function based
442 * on parameters passed in and decides how much programming (or updating) is
443 * going to be done during the call.
444 *
445 * UPDATE_TYPE_FAST is used for really fast updates that do not require much
446 * logical calculations or hardware register programming. This update MUST be
447 * ISR safe on windows. Currently fast update will only be used to flip surface
448 * address.
449 *
450 * UPDATE_TYPE_MED is used for slower updates which require significant hw
451 * re-programming however do not affect bandwidth consumption or clock
452 * requirements. At present, this is the level at which front end updates
453 * that do not require us to run bw_calcs happen. These are in/out transfer func
454 * updates, viewport offset changes, recout size changes and pixel depth changes.
455 * This update can be done at ISR, but we want to minimize how often this happens.
456 *
457 * UPDATE_TYPE_FULL is slow. Really slow. This requires us to recalculate our
458 * bandwidth and clocks, possibly rearrange some pipes and reprogram anything front
459 * end related. Any time viewport dimensions, recout dimensions, scaling ratios or
460 * gamma need to be adjusted or pipe needs to be turned on (or disconnected) we do
461 * a full update. This cannot be done at ISR level and should be a rare event.
462 * Unless someone is stress testing mpo enter/exit, playing with colour or adjusting
463 * underscan we don't expect to see this call at all.
464 */
465
Leon Elazar5869b0f2017-03-01 12:30:11 -0500466enum surface_update_type {
467 UPDATE_TYPE_FAST, /* super fast, safe to execute in isr */
Dmytro Laktyushkin81e2b2d2017-05-10 18:24:24 -0400468 UPDATE_TYPE_MED, /* ISR safe, most of programming needed, no bw/clk change*/
Leon Elazar5869b0f2017-03-01 12:30:11 -0500469 UPDATE_TYPE_FULL, /* may need to shuffle resources */
470};
471
Harry Wentland45622362017-09-12 15:58:20 -0400472/*******************************************************************************
473 * Stream Interfaces
474 ******************************************************************************/
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400475
476struct dc_stream_status {
477 int primary_otg_inst;
478 int surface_count;
479 struct dc_surface *surfaces[MAX_SURFACE_NUM];
480
481 /*
482 * link this stream passes through
483 */
484 struct dc_link *link;
485};
486
Harry Wentland45622362017-09-12 15:58:20 -0400487struct dc_stream {
Harry Wentlandb3d6c3f2017-07-24 14:04:27 -0400488 struct dc_sink *sink;
Harry Wentland45622362017-09-12 15:58:20 -0400489 struct dc_crtc_timing timing;
Harry Wentland45622362017-09-12 15:58:20 -0400490
Aric Cyrab2541b2016-12-29 15:27:12 -0500491 struct rect src; /* composition area */
Harry Wentland45622362017-09-12 15:58:20 -0400492 struct rect dst; /* stream addressable area */
493
494 struct audio_info audio_info;
495
Harry Wentland45622362017-09-12 15:58:20 -0400496 struct freesync_context freesync_ctx;
497
Leo (Sunpeng) Li7b0c4702017-07-10 14:04:21 -0400498 struct dc_transfer_func *out_transfer_func;
Harry Wentland45622362017-09-12 15:58:20 -0400499 struct colorspace_transform gamut_remap_matrix;
500 struct csc_transform csc_color_matrix;
Anthony Kooebf055f2017-06-14 10:19:57 -0400501
502 enum signal_type output_signal;
503
504 enum dc_color_space output_color_space;
505 enum dc_dither_option dither_option;
506
Vitaly Prosyak9edba552017-06-07 12:23:59 -0500507 enum view_3d_format view_format;
Anthony Kooebf055f2017-06-14 10:19:57 -0400508
509 bool ignore_msa_timing_param;
Harry Wentland45622362017-09-12 15:58:20 -0400510 /* TODO: custom INFO packets */
511 /* TODO: ABM info (DMCU) */
512 /* TODO: PSR info */
513 /* TODO: CEA VIC */
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400514
515 /* from core_stream struct */
516 struct dc_context *ctx;
517
518 /* used by DCP and FMT */
519 struct bit_depth_reduction_params bit_depth_params;
520 struct clamping_and_pixel_encoding_params clamping;
521
522 int phy_pix_clk;
523 enum signal_type signal;
524
525 struct dc_stream_status status;
526
527 /* from stream struct */
528 int ref_count;
Harry Wentland45622362017-09-12 15:58:20 -0400529};
530
Leon Elazara783e7b2017-03-09 14:38:15 -0500531struct dc_stream_update {
Leon Elazara783e7b2017-03-09 14:38:15 -0500532 struct rect src;
Leon Elazara783e7b2017-03-09 14:38:15 -0500533 struct rect dst;
Amy Zhangf46661d2017-05-09 14:45:54 -0400534 struct dc_transfer_func *out_transfer_func;
Leon Elazara783e7b2017-03-09 14:38:15 -0500535};
536
537
538/*
539 * Setup stream attributes if no stream updates are provided
540 * there will be no impact on the stream parameters
541 *
542 * Set up surface attributes and associate to a stream
543 * The surfaces parameter is an absolute set of all surface active for the stream.
544 * If no surfaces are provided, the stream will be blanked; no memory read.
545 * Any flip related attribute changes must be done through this interface.
546 *
547 * After this call:
548 * Surfaces attributes are programmed and configured to be composed into stream.
549 * This does not trigger a flip. No surface address is programmed.
550 *
551 */
552
553void dc_update_surfaces_and_stream(struct dc *dc,
554 struct dc_surface_update *surface_updates, int surface_count,
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400555 struct dc_stream *dc_stream,
Leon Elazara783e7b2017-03-09 14:38:15 -0500556 struct dc_stream_update *stream_update);
557
Aric Cyrab2541b2016-12-29 15:27:12 -0500558/*
559 * Log the current stream state.
560 */
561void dc_stream_log(
562 const struct dc_stream *stream,
563 struct dal_logger *dc_logger,
564 enum dc_log_type log_type);
565
566uint8_t dc_get_current_stream_count(const struct dc *dc);
567struct dc_stream *dc_get_stream_at_index(const struct dc *dc, uint8_t i);
568
569/*
570 * Return the current frame counter.
571 */
572uint32_t dc_stream_get_vblank_counter(const struct dc_stream *stream);
573
574/* TODO: Return parsed values rather than direct register read
575 * This has a dependency on the caller (amdgpu_get_crtc_scanoutpos)
576 * being refactored properly to be dce-specific
577 */
Sylvia Tsai81c50962017-04-11 15:15:28 -0400578bool dc_stream_get_scanoutpos(const struct dc_stream *stream,
579 uint32_t *v_blank_start,
580 uint32_t *v_blank_end,
581 uint32_t *h_position,
582 uint32_t *v_position);
Aric Cyrab2541b2016-12-29 15:27:12 -0500583
584/*
585 * Structure to store surface/stream associations for validation
586 */
587struct dc_validation_set {
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400588 struct dc_stream *stream;
Harry Wentlande12cfcb2017-07-20 11:43:32 -0400589 struct dc_surface *surfaces[MAX_SURFACES];
Aric Cyrab2541b2016-12-29 15:27:12 -0500590 uint8_t surface_count;
591};
592
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400593bool dc_validate_stream(const struct dc *dc, struct dc_stream *stream);
Andrey Grodzovsky9345d982017-07-21 16:34:36 -0400594
Andrey Grodzovsky792671d2017-07-26 15:51:31 -0400595bool dc_validate_surface(const struct dc *dc, const struct dc_surface *surface);
Aric Cyrab2541b2016-12-29 15:27:12 -0500596/*
597 * This function takes a set of resources and checks that they are cofunctional.
598 *
599 * After this call:
600 * No hardware is programmed for call. Only validation is done.
601 */
Harry Wentland07d72b32017-03-29 11:22:05 -0400602struct validate_context *dc_get_validate_context(
603 const struct dc *dc,
604 const struct dc_validation_set set[],
605 uint8_t set_count);
606
Aric Cyrab2541b2016-12-29 15:27:12 -0500607bool dc_validate_resources(
608 const struct dc *dc,
609 const struct dc_validation_set set[],
610 uint8_t set_count);
611
612/*
613 * This function takes a stream and checks if it is guaranteed to be supported.
614 * Guaranteed means that MAX_COFUNC similar streams are supported.
615 *
616 * After this call:
617 * No hardware is programmed for call. Only validation is done.
618 */
619
620bool dc_validate_guaranteed(
621 const struct dc *dc,
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400622 struct dc_stream *stream);
Aric Cyrab2541b2016-12-29 15:27:12 -0500623
Harry Wentland8122a252017-03-29 11:15:14 -0400624void dc_resource_validate_ctx_copy_construct(
625 const struct validate_context *src_ctx,
626 struct validate_context *dst_ctx);
627
628void dc_resource_validate_ctx_destruct(struct validate_context *context);
629
Aric Cyrab2541b2016-12-29 15:27:12 -0500630/*
Harry Wentland7cf2c842017-03-06 09:43:30 -0500631 * TODO update to make it about validation sets
632 * Set up streams and links associated to drive sinks
633 * The streams parameter is an absolute set of all active streams.
634 *
635 * After this call:
636 * Phy, Encoder, Timing Generator are programmed and enabled.
637 * New streams are enabled with blank stream; no memory read.
638 */
Harry Wentlande2c7bb12017-06-28 13:23:04 -0400639bool dc_commit_context(struct dc *dc, struct validate_context *context);
Harry Wentland7cf2c842017-03-06 09:43:30 -0500640
641/*
Aric Cyrab2541b2016-12-29 15:27:12 -0500642 * Set up streams and links associated to drive sinks
643 * The streams parameter is an absolute set of all active streams.
644 *
645 * After this call:
646 * Phy, Encoder, Timing Generator are programmed and enabled.
647 * New streams are enabled with blank stream; no memory read.
648 */
649bool dc_commit_streams(
650 struct dc *dc,
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400651 struct dc_stream *streams[],
Aric Cyrab2541b2016-12-29 15:27:12 -0500652 uint8_t stream_count);
Vitaly Prosyak9edba552017-06-07 12:23:59 -0500653/*
654 * Enable stereo when commit_streams is not required,
655 * for example, frame alternate.
656 */
657bool dc_enable_stereo(
658 struct dc *dc,
659 struct validate_context *context,
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400660 struct dc_stream *streams[],
Vitaly Prosyak9edba552017-06-07 12:23:59 -0500661 uint8_t stream_count);
Aric Cyrab2541b2016-12-29 15:27:12 -0500662
Harry Wentland45622362017-09-12 15:58:20 -0400663/**
664 * Create a new default stream for the requested sink
665 */
Harry Wentlandb73a22d2017-07-24 14:04:27 -0400666struct dc_stream *dc_create_stream_for_sink(struct dc_sink *dc_sink);
Harry Wentland45622362017-09-12 15:58:20 -0400667
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400668void dc_stream_retain(struct dc_stream *dc_stream);
669void dc_stream_release(struct dc_stream *dc_stream);
Harry Wentland45622362017-09-12 15:58:20 -0400670
Harry Wentlande12cfcb2017-07-20 11:43:32 -0400671struct dc_stream_status *dc_stream_get_status(
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400672 struct dc_stream *dc_stream);
Harry Wentland45622362017-09-12 15:58:20 -0400673
Leon Elazar5869b0f2017-03-01 12:30:11 -0500674enum surface_update_type dc_check_update_surfaces_for_stream(
675 struct dc *dc,
676 struct dc_surface_update *updates,
677 int surface_count,
Leon Elazaree8f63e2017-03-14 11:54:31 -0400678 struct dc_stream_update *stream_update,
Leon Elazar5869b0f2017-03-01 12:30:11 -0500679 const struct dc_stream_status *stream_status);
680
Andrey Grodzovsky8a767082017-07-11 14:41:51 -0400681
682void dc_retain_validate_context(struct validate_context *context);
683void dc_release_validate_context(struct validate_context *context);
684
Harry Wentland45622362017-09-12 15:58:20 -0400685/*******************************************************************************
686 * Link Interfaces
687 ******************************************************************************/
688
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400689struct dpcd_caps {
690 union dpcd_rev dpcd_rev;
691 union max_lane_count max_ln_count;
692 union max_down_spread max_down_spread;
693
694 /* dongle type (DP converter, CV smart dongle) */
695 enum display_dongle_type dongle_type;
696 /* Dongle's downstream count. */
697 union sink_count sink_count;
698 /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
699 indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
700 struct dc_dongle_caps dongle_caps;
701
702 uint32_t sink_dev_id;
703 uint32_t branch_dev_id;
704 int8_t branch_dev_name[6];
705 int8_t branch_hw_revision;
706
707 bool allow_invalid_MSA_timing_param;
708 bool panel_mode_edp;
709};
710
711struct dc_link_status {
712 struct dpcd_caps *dpcd_caps;
713};
714
715/* DP MST stream allocation (payload bandwidth number) */
716struct link_mst_stream_allocation {
717 /* DIG front */
718 const struct stream_encoder *stream_enc;
719 /* associate DRM payload table with DC stream encoder */
720 uint8_t vcp_id;
721 /* number of slots required for the DP stream in transport packet */
722 uint8_t slot_count;
723};
724
725/* DP MST stream allocation table */
726struct link_mst_stream_allocation_table {
727 /* number of DP video streams */
728 int stream_count;
729 /* array of stream allocations */
730 struct link_mst_stream_allocation stream_allocations[MAX_CONTROLLER_NUM];
731};
732
Harry Wentland45622362017-09-12 15:58:20 -0400733/*
734 * A link contains one or more sinks and their connected status.
735 * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
736 */
737struct dc_link {
Harry Wentlandb73a22d2017-07-24 14:04:27 -0400738 struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
Harry Wentland45622362017-09-12 15:58:20 -0400739 unsigned int sink_count;
Harry Wentlandb73a22d2017-07-24 14:04:27 -0400740 struct dc_sink *local_sink;
Harry Wentland45622362017-09-12 15:58:20 -0400741 unsigned int link_index;
742 enum dc_connection_type type;
743 enum signal_type connector_signal;
744 enum dc_irq_source irq_source_hpd;
745 enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse */
746 /* caps is the same as reported_link_cap. link_traing use
747 * reported_link_cap. Will clean up. TODO
748 */
749 struct dc_link_settings reported_link_cap;
750 struct dc_link_settings verified_link_cap;
Harry Wentland45622362017-09-12 15:58:20 -0400751 struct dc_link_settings cur_link_settings;
752 struct dc_lane_settings cur_lane_setting;
Ding Wang8c4abe02017-07-18 17:18:11 -0400753 struct dc_link_settings preferred_link_setting;
Harry Wentland45622362017-09-12 15:58:20 -0400754
755 uint8_t ddc_hw_inst;
Zeyu Fan7a096332017-06-13 11:54:10 -0400756
757 uint8_t hpd_src;
758
Harry Wentland45622362017-09-12 15:58:20 -0400759 uint8_t link_enc_hw_inst;
760
Harry Wentland45622362017-09-12 15:58:20 -0400761 bool test_pattern_enabled;
762 union compliance_test_state compliance_test_state;
Andrey Grodzovsky9fb8de72017-02-14 13:50:17 -0500763
764 void *priv;
Andrey Grodzovsky46df7902017-04-30 09:20:55 -0400765
766 struct ddc_service *ddc;
Anthony Kooebf055f2017-06-14 10:19:57 -0400767
768 bool aux_mode;
Harry Wentland45622362017-09-12 15:58:20 -0400769
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400770 /* Private to DC core */
Harry Wentland45622362017-09-12 15:58:20 -0400771
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400772 const struct core_dc *dc;
Harry Wentland45622362017-09-12 15:58:20 -0400773
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400774 struct dc_context *ctx;
Anthony Kooebf055f2017-06-14 10:19:57 -0400775
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400776 struct link_encoder *link_enc;
777 struct graphics_object_id link_id;
778 union ddi_channel_mapping ddi_channel_mapping;
779 struct connector_device_tag_info device_tag;
780 struct dpcd_caps dpcd_caps;
781 unsigned int dpcd_sink_count;
Harry Wentland45622362017-09-12 15:58:20 -0400782
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400783 enum edp_revision edp_revision;
784 bool psr_enabled;
785
786 /* MST record stream using this link */
787 struct link_flags {
788 bool dp_keep_receiver_powered;
789 } wa_flags;
790 struct link_mst_stream_allocation_table mst_stream_alloc_table;
791
792 struct dc_link_status link_status;
793
Harry Wentland45622362017-09-12 15:58:20 -0400794};
795
796const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link);
797
798/*
799 * Return an enumerated dc_link. dc_link order is constant and determined at
800 * boot time. They cannot be created or destroyed.
801 * Use dc_get_caps() to get number of links.
802 */
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400803struct dc_link *dc_get_link_at_index(const struct dc *dc, uint32_t link_index);
Harry Wentland45622362017-09-12 15:58:20 -0400804
805/* Return id of physical connector represented by a dc_link at link_index.*/
806const struct graphics_object_id dc_get_link_id_at_index(
807 struct dc *dc, uint32_t link_index);
808
809/* Set backlight level of an embedded panel (eDP, LVDS). */
810bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
811 uint32_t frame_ramp, const struct dc_stream *stream);
812
Amy Zhangaa7397d2017-05-12 15:54:29 -0400813bool dc_link_set_abm_disable(const struct dc_link *dc_link);
814
Harry Wentland45622362017-09-12 15:58:20 -0400815bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable);
816
Amy Zhang7db4ded2017-05-30 16:16:57 -0400817bool dc_link_get_psr_state(const struct dc_link *dc_link, uint32_t *psr_state);
818
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400819bool dc_link_setup_psr(struct dc_link *dc_link,
Amy Zhang9f72f512017-05-31 16:53:01 -0400820 const struct dc_stream *stream, struct psr_config *psr_config,
821 struct psr_context *psr_context);
Harry Wentland45622362017-09-12 15:58:20 -0400822
823/* Request DC to detect if there is a Panel connected.
824 * boot - If this call is during initial boot.
825 * Return false for any type of detection failure or MST detection
826 * true otherwise. True meaning further action is required (status update
827 * and OS notification).
828 */
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400829bool dc_link_detect(struct dc_link *dc_link, bool boot);
Harry Wentland45622362017-09-12 15:58:20 -0400830
831/* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt).
832 * Return:
833 * true - Downstream port status changed. DM should call DC to do the
834 * detection.
835 * false - no change in Downstream port status. No further action required
836 * from DM. */
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400837bool dc_link_handle_hpd_rx_irq(struct dc_link *dc_link,
Wenjing Liu8ee65d72017-07-19 13:18:26 -0400838 union hpd_irq_data *hpd_irq_dpcd_data);
Harry Wentland45622362017-09-12 15:58:20 -0400839
840struct dc_sink_init_data;
841
842struct dc_sink *dc_link_add_remote_sink(
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400843 struct dc_link *dc_link,
Harry Wentland45622362017-09-12 15:58:20 -0400844 const uint8_t *edid,
845 int len,
846 struct dc_sink_init_data *init_data);
847
848void dc_link_remove_remote_sink(
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400849 struct dc_link *link,
Harry Wentlandb73a22d2017-07-24 14:04:27 -0400850 struct dc_sink *sink);
Harry Wentland45622362017-09-12 15:58:20 -0400851
852/* Used by diagnostics for virtual link at the moment */
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400853void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink);
Harry Wentland45622362017-09-12 15:58:20 -0400854
855void dc_link_dp_set_drive_settings(
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400856 struct dc_link *link,
Harry Wentland45622362017-09-12 15:58:20 -0400857 struct link_training_settings *lt_settings);
858
Ding Wang820e3932017-07-13 12:09:57 -0400859enum link_training_result dc_link_dp_perform_link_training(
Harry Wentland45622362017-09-12 15:58:20 -0400860 struct dc_link *link,
861 const struct dc_link_settings *link_setting,
862 bool skip_video_pattern);
863
864void dc_link_dp_enable_hpd(const struct dc_link *link);
865
866void dc_link_dp_disable_hpd(const struct dc_link *link);
867
868bool dc_link_dp_set_test_pattern(
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400869 struct dc_link *link,
Harry Wentland45622362017-09-12 15:58:20 -0400870 enum dp_test_pattern test_pattern,
871 const struct link_training_settings *p_link_settings,
872 const unsigned char *p_custom_pattern,
873 unsigned int cust_pattern_size);
874
875/*******************************************************************************
876 * Sink Interfaces - A sink corresponds to a display output device
877 ******************************************************************************/
878
xhdu8c895312017-03-21 11:05:32 -0400879struct dc_container_id {
880 // 128bit GUID in binary form
881 unsigned char guid[16];
882 // 8 byte port ID -> ELD.PortID
883 unsigned int portId[2];
884 // 128bit GUID in binary formufacturer name -> ELD.ManufacturerName
885 unsigned short manufacturerName;
886 // 2 byte product code -> ELD.ProductCode
887 unsigned short productCode;
888};
889
Vitaly Prosyakb6d61032017-06-12 11:03:26 -0500890
Vitaly Prosyak9edba552017-06-07 12:23:59 -0500891
Harry Wentland45622362017-09-12 15:58:20 -0400892/*
893 * The sink structure contains EDID and other display device properties
894 */
895struct dc_sink {
896 enum signal_type sink_signal;
897 struct dc_edid dc_edid; /* raw edid */
898 struct dc_edid_caps edid_caps; /* parse display caps */
xhdu8c895312017-03-21 11:05:32 -0400899 struct dc_container_id *dc_container_id;
Zeyu Fan4a9a5d62017-03-07 11:48:50 -0500900 uint32_t dongle_max_pix_clk;
Andrey Grodzovsky5c4e980642017-02-14 15:47:24 -0500901 void *priv;
Vitaly Prosyak9edba552017-06-07 12:23:59 -0500902 struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX];
Anthony Kooebf055f2017-06-14 10:19:57 -0400903 bool converter_disable_audio;
Harry Wentlandb73a22d2017-07-24 14:04:27 -0400904
905 /* private to DC core */
906 struct dc_link *link;
907 struct dc_context *ctx;
908
909 /* private to dc_sink.c */
910 int ref_count;
Harry Wentland45622362017-09-12 15:58:20 -0400911};
912
Harry Wentlandb73a22d2017-07-24 14:04:27 -0400913void dc_sink_retain(struct dc_sink *sink);
914void dc_sink_release(struct dc_sink *sink);
Harry Wentland45622362017-09-12 15:58:20 -0400915
916const struct audio **dc_get_audios(struct dc *dc);
917
918struct dc_sink_init_data {
919 enum signal_type sink_signal;
Harry Wentlandd0778eb2017-07-22 20:05:20 -0400920 struct dc_link *link;
Harry Wentland45622362017-09-12 15:58:20 -0400921 uint32_t dongle_max_pix_clk;
922 bool converter_disable_audio;
923};
924
925struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);
xhdu8c895312017-03-21 11:05:32 -0400926bool dc_sink_get_container_id(struct dc_sink *dc_sink, struct dc_container_id *container_id);
927bool dc_sink_set_container_id(struct dc_sink *dc_sink, const struct dc_container_id *container_id);
Harry Wentland45622362017-09-12 15:58:20 -0400928
929/*******************************************************************************
Aric Cyrab2541b2016-12-29 15:27:12 -0500930 * Cursor interfaces - To manages the cursor within a stream
Harry Wentland45622362017-09-12 15:58:20 -0400931 ******************************************************************************/
932/* TODO: Deprecated once we switch to dc_set_cursor_position */
Aric Cyrab2541b2016-12-29 15:27:12 -0500933bool dc_stream_set_cursor_attributes(
934 const struct dc_stream *stream,
Harry Wentland45622362017-09-12 15:58:20 -0400935 const struct dc_cursor_attributes *attributes);
936
Aric Cyrab2541b2016-12-29 15:27:12 -0500937bool dc_stream_set_cursor_position(
Leo (Sunpeng) Li4fa086b92017-07-25 20:51:26 -0400938 struct dc_stream *stream,
Dmytro Laktyushkinbeb16b62017-04-21 09:34:09 -0400939 const struct dc_cursor_position *position);
Harry Wentland45622362017-09-12 15:58:20 -0400940
941/* Newer interfaces */
942struct dc_cursor {
943 struct dc_plane_address address;
944 struct dc_cursor_attributes attributes;
945};
946
Harry Wentland45622362017-09-12 15:58:20 -0400947/*******************************************************************************
948 * Interrupt interfaces
949 ******************************************************************************/
950enum dc_irq_source dc_interrupt_to_irq_source(
951 struct dc *dc,
952 uint32_t src_id,
953 uint32_t ext_id);
954void dc_interrupt_set(const struct dc *dc, enum dc_irq_source src, bool enable);
955void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src);
956enum dc_irq_source dc_get_hpd_irq_source_at_index(
957 struct dc *dc, uint32_t link_index);
958
959/*******************************************************************************
960 * Power Interfaces
961 ******************************************************************************/
962
963void dc_set_power_state(
964 struct dc *dc,
Andrey Grodzovskya3621482017-04-20 15:59:25 -0400965 enum dc_acpi_cm_power_state power_state);
Harry Wentland45622362017-09-12 15:58:20 -0400966void dc_resume(const struct dc *dc);
967
Harry Wentland45622362017-09-12 15:58:20 -0400968/*
969 * DPCD access interfaces
970 */
971
Andrey Grodzovsky7c7f5b12017-03-28 16:57:52 -0400972bool dc_read_aux_dpcd(
Harry Wentland45622362017-09-12 15:58:20 -0400973 struct dc *dc,
974 uint32_t link_index,
975 uint32_t address,
976 uint8_t *data,
977 uint32_t size);
978
Andrey Grodzovsky7c7f5b12017-03-28 16:57:52 -0400979bool dc_write_aux_dpcd(
Harry Wentland45622362017-09-12 15:58:20 -0400980 struct dc *dc,
981 uint32_t link_index,
982 uint32_t address,
983 const uint8_t *data,
Zeyu Fan2b230ea2017-02-16 16:15:30 -0500984 uint32_t size);
985
Andrey Grodzovsky7c7f5b12017-03-28 16:57:52 -0400986bool dc_read_aux_i2c(
987 struct dc *dc,
988 uint32_t link_index,
989 enum i2c_mot_mode mot,
990 uint32_t address,
991 uint8_t *data,
992 uint32_t size);
993
994bool dc_write_aux_i2c(
995 struct dc *dc,
996 uint32_t link_index,
997 enum i2c_mot_mode mot,
998 uint32_t address,
999 const uint8_t *data,
1000 uint32_t size);
1001
Zeyu Fan2b230ea2017-02-16 16:15:30 -05001002bool dc_query_ddc_data(
1003 struct dc *dc,
1004 uint32_t link_index,
1005 uint32_t address,
1006 uint8_t *write_buf,
1007 uint32_t write_size,
1008 uint8_t *read_buf,
1009 uint32_t read_size);
Harry Wentland45622362017-09-12 15:58:20 -04001010
1011bool dc_submit_i2c(
1012 struct dc *dc,
1013 uint32_t link_index,
1014 struct i2c_command *cmd);
1015
Anthony Koo5e7773a2017-01-23 16:55:20 -05001016
Harry Wentland45622362017-09-12 15:58:20 -04001017#endif /* DC_INTERFACE_H_ */