]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/gpu/drm/amd/display/dc/dc.h
drm/amd/display: Refactor to move color helper into module
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / amd / display / dc / dc.h
CommitLineData
4562236b
HW
1/*
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"
30#include "dpcd_defs.h"
31#include "grph_object_defs.h"
32#include "logger_types.h"
33#include "gpio_types.h"
34#include "link_service_types.h"
35
36#define MAX_TARGETS 6
091a97e5 37#define MAX_SURFACES 3
4562236b
HW
38#define MAX_SINKS_PER_LINK 4
39
40/*******************************************************************************
41 * Display Core Interfaces
42 ******************************************************************************/
43
44struct dc_caps {
45 uint32_t max_targets;
46 uint32_t max_links;
47 uint32_t max_audios;
48 uint32_t max_slave_planes;
49 uint32_t max_downscale_ratio;
50 uint32_t i2c_speed_in_khz;
51};
52
53
54struct dc_dcc_surface_param {
55 enum surface_pixel_format format;
56 struct dc_size surface_size;
57 enum dc_scan_direction scan;
58};
59
60struct dc_dcc_setting {
61 unsigned int max_compressed_blk_size;
62 unsigned int max_uncompressed_blk_size;
63 bool independent_64b_blks;
64};
65
66struct dc_surface_dcc_cap {
67 bool capable;
68 bool const_color_support;
69
70 union {
71 struct {
72 struct dc_dcc_setting rgb;
73 } grph;
74
75 struct {
76 struct dc_dcc_setting luma;
77 struct dc_dcc_setting chroma;
78 } video;
79 };
80};
81
82/* Forward declaration*/
83struct dc;
84struct dc_surface;
85struct validate_context;
86
87struct dc_cap_funcs {
88 int i;
89};
90
91struct dc_stream_funcs {
92 bool (*adjust_vmin_vmax)(struct dc *dc,
93 const struct dc_stream **stream,
94 int num_streams,
95 int vmin,
96 int vmax);
97
98 void (*stream_update_scaling)(const struct dc *dc,
99 const struct dc_stream *dc_stream,
100 const struct rect *src,
101 const struct rect *dst);
102 bool (*set_gamut_remap)(struct dc *dc,
103 const struct dc_stream **stream, int num_streams);
104 bool (*set_backlight)(struct dc *dc, unsigned int backlight_level,
105 unsigned int frame_ramp, const struct dc_stream *stream);
106 bool (*init_dmcu_backlight_settings)(struct dc *dc);
107 bool (*set_abm_level)(struct dc *dc, unsigned int abm_level);
108 bool (*set_psr_enable)(struct dc *dc, bool enable);
109 bool (*setup_psr)(struct dc *dc, const struct dc_stream *stream);
110};
111
112struct link_training_settings;
113
114struct dc_link_funcs {
115 void (*set_drive_settings)(struct dc *dc,
116 struct link_training_settings *lt_settings);
117 void (*perform_link_training)(struct dc *dc,
118 struct dc_link_settings *link_setting,
119 bool skip_video_pattern);
120 void (*set_preferred_link_settings)(struct dc *dc,
121 struct dc_link_settings *link_setting);
122 void (*enable_hpd)(const struct dc_link *link);
123 void (*disable_hpd)(const struct dc_link *link);
124 void (*set_test_pattern)(
125 const struct dc_link *link,
126 enum dp_test_pattern test_pattern,
127 const struct link_training_settings *p_link_settings,
128 const unsigned char *p_custom_pattern,
129 unsigned int cust_pattern_size);
130};
131
132/* Structure to hold configuration flags set by dm at dc creation. */
133struct dc_config {
134 bool gpu_vm_support;
135 bool disable_disp_pll_sharing;
136};
137
138struct dc_debug {
139 bool surface_visual_confirm;
140 bool max_disp_clk;
141 bool target_trace;
142 bool surface_trace;
9474980a 143 bool timing_trace;
4562236b
HW
144 bool validation_trace;
145 bool disable_stutter;
146 bool disable_dcc;
147 bool disable_dfs_bypass;
148 bool disable_power_gate;
149 bool disable_clock_gate;
150};
151
152struct dc {
153 struct dc_caps caps;
154 struct dc_cap_funcs cap_funcs;
155 struct dc_stream_funcs stream_funcs;
156 struct dc_link_funcs link_funcs;
157 struct dc_config config;
158 struct dc_debug debug;
159};
160
161enum frame_buffer_mode {
162 FRAME_BUFFER_MODE_LOCAL_ONLY = 0,
163 FRAME_BUFFER_MODE_ZFB_ONLY,
164 FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL,
165} ;
166
167struct dchub_init_data {
168 bool dchub_initialzied;
169 bool dchub_info_valid;
170 int64_t zfb_phys_addr_base;
171 int64_t zfb_mc_base_addr;
172 uint64_t zfb_size_in_byte;
173 enum frame_buffer_mode fb_mode;
174};
175
176struct dc_init_data {
177 struct hw_asic_id asic_id;
178 void *driver; /* ctx */
179 struct cgs_device *cgs_device;
180
181 int num_virtual_links;
182 /*
183 * If 'vbios_override' not NULL, it will be called instead
184 * of the real VBIOS. Intended use is Diagnostics on FPGA.
185 */
186 struct dc_bios *vbios_override;
187 enum dce_environment dce_environment;
188
189 struct dc_config flags;
190};
191
192struct dc *dc_create(const struct dc_init_data *init_params);
193
194void dc_destroy(struct dc **dc);
195
196bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data);
197
198/*******************************************************************************
199 * Surface Interfaces
200 ******************************************************************************/
201
202enum {
203 RGB_256X3X16 = 256,
fb735a9f
AK
204 FLOAT_GAMMA_RAMP_MAX = 1025,
205 TRANSFER_FUNC_POINTS = 1025
4562236b
HW
206};
207
208enum dc_gamma_ramp_type {
209 GAMMA_RAMP_RBG256X3X16,
210 GAMMA_RAMP_FLOAT,
211};
212
213struct float_rgb {
214 struct fixed32_32 red;
215 struct fixed32_32 green;
216 struct fixed32_32 blue;
217};
218
219struct dc_gamma_ramp_float {
220 struct float_rgb scale;
221 struct float_rgb offset;
222 struct float_rgb gamma_curve[FLOAT_GAMMA_RAMP_MAX];
223};
224
225struct dc_gamma_ramp_rgb256x3x16 {
226 uint16_t red[RGB_256X3X16];
227 uint16_t green[RGB_256X3X16];
228 uint16_t blue[RGB_256X3X16];
229};
230
231struct dc_gamma {
232 enum dc_gamma_ramp_type type;
233 union {
234 struct dc_gamma_ramp_rgb256x3x16 gamma_ramp_rgb256x3x16;
235 struct dc_gamma_ramp_float gamma_ramp_float;
236 };
237 uint32_t size;
238};
239
fb735a9f
AK
240enum dc_transfer_func_type {
241 TF_TYPE_PREDEFINED,
242 TF_TYPE_DISTRIBUTED_POINTS,
243};
244
245struct dc_transfer_func_distributed_points {
246 uint16_t red[TRANSFER_FUNC_POINTS];
247 uint16_t green[TRANSFER_FUNC_POINTS];
248 uint16_t blue[TRANSFER_FUNC_POINTS];
249 uint16_t end_exponent;
250 uint16_t x_point_at_y1;
251};
252
253enum dc_transfer_func_predefined {
254 TRANSFER_FUNCTION_SRGB,
255 TRANSFER_FUNCTION_BT709,
256 TRANSFER_FUNCTION_LINEAR,
257};
258
259struct dc_transfer_func {
260 enum dc_transfer_func_type type;
261 enum dc_transfer_func_predefined tf;
262 struct dc_transfer_func_distributed_points tf_pts;
263};
264
4562236b
HW
265struct dc_surface {
266 bool visible;
267 bool flip_immediate;
268 struct dc_plane_address address;
269
270 struct scaling_taps scaling_quality;
271 struct rect src_rect;
272 struct rect dst_rect;
273 struct rect clip_rect;
274
275 union plane_size plane_size;
276 union dc_tiling_info tiling_info;
277 struct dc_plane_dcc_param dcc;
278 enum dc_color_space color_space;
279
280 enum surface_pixel_format format;
281 enum dc_rotation_angle rotation;
282 bool horizontal_mirror;
283 enum plane_stereo_format stereo_format;
284
fb735a9f 285 /* TO BE REMOVED AFTER BELOW TRANSFER FUNCTIONS IMPLEMENTED */
4562236b 286 const struct dc_gamma *gamma_correction;
fb735a9f
AK
287
288 const struct dc_transfer_func *in_transfer_func;
289 const struct dc_transfer_func *out_transfer_func;
4562236b
HW
290};
291
292struct dc_plane_info {
293 union plane_size plane_size;
294 union dc_tiling_info tiling_info;
295 enum surface_pixel_format format;
296 enum dc_rotation_angle rotation;
297 bool horizontal_mirror;
298 enum plane_stereo_format stereo_format;
299 enum dc_color_space color_space; /*todo: wrong place, fits in scaling info*/
300 bool visible;
301};
302
303struct dc_scaling_info {
304 struct rect src_rect;
305 struct rect dst_rect;
306 struct rect clip_rect;
307 struct scaling_taps scaling_quality;
308};
309
310struct dc_surface_update {
311 const struct dc_surface *surface;
312
313 /* isr safe update parameters. null means no updates */
314 struct dc_flip_addrs *flip_addr;
315 struct dc_plane_info *plane_info;
316 struct dc_scaling_info *scaling_info;
317 /* following updates require alloc/sleep/spin that is not isr safe,
318 * null means no updates
319 */
fb735a9f 320 /* gamma TO BE REMOVED */
4562236b
HW
321 struct dc_gamma *gamma;
322
fb735a9f
AK
323 struct dc_transfer_func *in_transfer_func;
324 struct dc_transfer_func *out_transfer_func;
325
4562236b
HW
326
327};
328/*
329 * This structure is filled in by dc_surface_get_status and contains
330 * the last requested address and the currently active address so the called
331 * can determine if there are any outstanding flips
332 */
333struct dc_surface_status {
334 struct dc_plane_address requested_address;
335 struct dc_plane_address current_address;
336 bool is_flip_pending;
337};
338
339/*
340 * Create a new surface with default parameters;
341 */
342struct dc_surface *dc_create_surface(const struct dc *dc);
343const struct dc_surface_status *dc_surface_get_status(
344 const struct dc_surface *dc_surface);
345
346void dc_surface_retain(const struct dc_surface *dc_surface);
347void dc_surface_release(const struct dc_surface *dc_surface);
348
89e89630 349void dc_gamma_retain(const struct dc_gamma *dc_gamma);
4562236b
HW
350void dc_gamma_release(const struct dc_gamma *dc_gamma);
351struct dc_gamma *dc_create_gamma(void);
352
fb735a9f
AK
353void dc_transfer_func_retain(const struct dc_transfer_func *dc_tf);
354void dc_transfer_func_release(const struct dc_transfer_func *dc_tf);
355struct dc_transfer_func *dc_create_transfer_func(const struct dc *dc);
356
4562236b
HW
357/*
358 * This structure holds a surface address. There could be multiple addresses
359 * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such
360 * as frame durations and DCC format can also be set.
361 */
362struct dc_flip_addrs {
363 struct dc_plane_address address;
364 bool flip_immediate;
365 /* TODO: DCC format info */
366 /* TODO: add flip duration for FreeSync */
367};
368
369/*
370 * Optimized flip address update function.
371 *
372 * After this call:
373 * Surface addresses and flip attributes are programmed.
374 * Surface flip occur at next configured time (h_sync or v_sync flip)
375 */
376void dc_flip_surface_addrs(struct dc *dc,
377 const struct dc_surface *const surfaces[],
378 struct dc_flip_addrs flip_addrs[],
379 uint32_t count);
380
381/*
382 * Set up surface attributes and associate to a target
383 * The surfaces parameter is an absolute set of all surface active for the target.
384 * If no surfaces are provided, the target will be blanked; no memory read.
385 * Any flip related attribute changes must be done through this interface.
386 *
387 * After this call:
388 * Surfaces attributes are programmed and configured to be composed into target.
389 * This does not trigger a flip. No surface address is programmed.
390 */
391
392bool dc_commit_surfaces_to_target(
393 struct dc *dc,
394 const struct dc_surface **dc_surfaces,
395 uint8_t surface_count,
396 struct dc_target *dc_target);
397
398bool dc_pre_update_surfaces_to_target(
399 struct dc *dc,
400 const struct dc_surface *const *new_surfaces,
401 uint8_t new_surface_count,
402 struct dc_target *dc_target);
403
404bool dc_post_update_surfaces_to_target(
405 struct dc *dc);
406
407void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *updates,
408 int surface_count, struct dc_target *dc_target);
409
410/*******************************************************************************
411 * Target Interfaces
412 ******************************************************************************/
413#define MAX_STREAM_NUM 1
414
415struct dc_target {
416 uint8_t stream_count;
417 const struct dc_stream *streams[MAX_STREAM_NUM];
418};
419
420/*
421 * Target status is returned from dc_target_get_status in order to get the
422 * the IRQ source, current frame counter and currently attached surfaces.
423 */
424struct dc_target_status {
425 int primary_otg_inst;
426 int cur_frame_count;
427 int surface_count;
428 const struct dc_surface *surfaces[MAX_SURFACE_NUM];
429};
430
431struct dc_target *dc_create_target_for_streams(
432 struct dc_stream *dc_streams[],
433 uint8_t stream_count);
434
435/*
436 * Get the current target status.
437 */
438const struct dc_target_status *dc_target_get_status(
439 const struct dc_target* dc_target);
440
441void dc_target_retain(const struct dc_target *dc_target);
442void dc_target_release(const struct dc_target *dc_target);
443void dc_target_log(
444 const struct dc_target *dc_target,
445 struct dal_logger *dc_logger,
446 enum dc_log_type log_type);
447
448uint8_t dc_get_current_target_count(const struct dc *dc);
449struct dc_target *dc_get_target_at_index(const struct dc *dc, uint8_t i);
450
451bool dc_target_is_connected_to_sink(
452 const struct dc_target *dc_target,
453 const struct dc_sink *dc_sink);
454
455uint32_t dc_target_get_vblank_counter(const struct dc_target *dc_target);
456
457/* TODO: Return parsed values rather than direct register read
458 * This has a dependency on the caller (amdgpu_get_crtc_scanoutpos)
459 * being refactored properly to be dce-specific
460 */
461uint32_t dc_target_get_scanoutpos(
462 const struct dc_target *dc_target,
463 uint32_t *vbl,
464 uint32_t *position);
465
466/*
467 * Structure to store surface/target associations for validation
468 */
469struct dc_validation_set {
470 const struct dc_target *target;
471 const struct dc_surface *surfaces[MAX_SURFACES];
472 uint8_t surface_count;
473};
474
475/*
476 * This function takes a set of resources and checks that they are cofunctional.
477 *
478 * After this call:
479 * No hardware is programmed for call. Only validation is done.
480 */
481bool dc_validate_resources(
482 const struct dc *dc,
483 const struct dc_validation_set set[],
484 uint8_t set_count);
485
486/*
487 * This function takes a target and checks if it is guaranteed to be supported.
488 * Guaranteed means that MAX_COFUNC*target is supported.
489 *
490 * After this call:
491 * No hardware is programmed for call. Only validation is done.
492 */
493
494bool dc_validate_guaranteed(
495 const struct dc *dc,
496 const struct dc_target *dc_target);
497
498/*
499 * Set up streams and links associated to targets to drive sinks
500 * The targets parameter is an absolute set of all active targets.
501 *
502 * After this call:
503 * Phy, Encoder, Timing Generator are programmed and enabled.
504 * New targets are enabled with blank stream; no memory read.
505 */
506bool dc_commit_targets(
507 struct dc *dc,
508 struct dc_target *targets[],
509 uint8_t target_count);
510
511/*******************************************************************************
512 * Stream Interfaces
513 ******************************************************************************/
514struct dc_stream {
515 const struct dc_sink *sink;
516 struct dc_crtc_timing timing;
517
518 enum dc_color_space output_color_space;
519
520 struct rect src; /* viewport in target space*/
521 struct rect dst; /* stream addressable area */
522
523 struct audio_info audio_info;
524
525 bool ignore_msa_timing_param;
526
527 struct freesync_context freesync_ctx;
528
529 /* TODO: dithering */
530 /* TODO: transfer function (CSC/regamma/gamut remap) */
531 struct colorspace_transform gamut_remap_matrix;
532 struct csc_transform csc_color_matrix;
533 /* TODO: custom INFO packets */
534 /* TODO: ABM info (DMCU) */
535 /* TODO: PSR info */
536 /* TODO: CEA VIC */
537};
538
539/**
540 * Create a new default stream for the requested sink
541 */
542struct dc_stream *dc_create_stream_for_sink(const struct dc_sink *dc_sink);
543
544void dc_stream_retain(const struct dc_stream *dc_stream);
545void dc_stream_release(const struct dc_stream *dc_stream);
546
547struct dc_stream_status {
548 /*
549 * link this stream passes through
550 */
551 const struct dc_link *link;
552};
553
554const struct dc_stream_status *dc_stream_get_status(
555 const struct dc_stream *dc_stream);
556
557/*******************************************************************************
558 * Link Interfaces
559 ******************************************************************************/
560
561/*
562 * A link contains one or more sinks and their connected status.
563 * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
564 */
565struct dc_link {
566 const struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
567 unsigned int sink_count;
568 const struct dc_sink *local_sink;
569 unsigned int link_index;
570 enum dc_connection_type type;
571 enum signal_type connector_signal;
572 enum dc_irq_source irq_source_hpd;
573 enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse */
574 /* caps is the same as reported_link_cap. link_traing use
575 * reported_link_cap. Will clean up. TODO
576 */
577 struct dc_link_settings reported_link_cap;
578 struct dc_link_settings verified_link_cap;
579 struct dc_link_settings max_link_setting;
580 struct dc_link_settings cur_link_settings;
581 struct dc_lane_settings cur_lane_setting;
582
583 uint8_t ddc_hw_inst;
584 uint8_t link_enc_hw_inst;
585
586 struct psr_caps psr_caps;
587 bool test_pattern_enabled;
588 union compliance_test_state compliance_test_state;
589};
590
591struct dpcd_caps {
592 union dpcd_rev dpcd_rev;
593 union max_lane_count max_ln_count;
594 union max_down_spread max_down_spread;
595
596 /* dongle type (DP converter, CV smart dongle) */
597 enum display_dongle_type dongle_type;
598 /* Dongle's downstream count. */
599 union sink_count sink_count;
600 /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
601 indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
602 bool is_dp_hdmi_s3d_converter;
603
604 bool allow_invalid_MSA_timing_param;
605 bool panel_mode_edp;
606 uint32_t sink_dev_id;
607 uint32_t branch_dev_id;
608 int8_t branch_dev_name[6];
609 int8_t branch_hw_revision;
610};
611
612struct dc_link_status {
613 struct dpcd_caps *dpcd_caps;
614};
615
616const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link);
617
618/*
619 * Return an enumerated dc_link. dc_link order is constant and determined at
620 * boot time. They cannot be created or destroyed.
621 * Use dc_get_caps() to get number of links.
622 */
623const struct dc_link *dc_get_link_at_index(const struct dc *dc, uint32_t link_index);
624
625/* Return id of physical connector represented by a dc_link at link_index.*/
626const struct graphics_object_id dc_get_link_id_at_index(
627 struct dc *dc, uint32_t link_index);
628
629/* Set backlight level of an embedded panel (eDP, LVDS). */
630bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
631 uint32_t frame_ramp, const struct dc_stream *stream);
632
633bool dc_link_init_dmcu_backlight_settings(const struct dc_link *dc_link);
634
635bool dc_link_set_abm_level(const struct dc_link *dc_link, uint32_t level);
636
637bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable);
638
639bool dc_link_setup_psr(const struct dc_link *dc_link,
640 const struct dc_stream *stream);
641
642/* Request DC to detect if there is a Panel connected.
643 * boot - If this call is during initial boot.
644 * Return false for any type of detection failure or MST detection
645 * true otherwise. True meaning further action is required (status update
646 * and OS notification).
647 */
648bool dc_link_detect(const struct dc_link *dc_link, bool boot);
649
650/* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt).
651 * Return:
652 * true - Downstream port status changed. DM should call DC to do the
653 * detection.
654 * false - no change in Downstream port status. No further action required
655 * from DM. */
656bool dc_link_handle_hpd_rx_irq(const struct dc_link *dc_link);
657
658struct dc_sink_init_data;
659
660struct dc_sink *dc_link_add_remote_sink(
661 const struct dc_link *dc_link,
662 const uint8_t *edid,
663 int len,
664 struct dc_sink_init_data *init_data);
665
666void dc_link_remove_remote_sink(
667 const struct dc_link *link,
668 const struct dc_sink *sink);
669
670/* Used by diagnostics for virtual link at the moment */
671void dc_link_set_sink(const struct dc_link *link, struct dc_sink *sink);
672
673void dc_link_dp_set_drive_settings(
674 struct dc_link *link,
675 struct link_training_settings *lt_settings);
676
677bool dc_link_dp_perform_link_training(
678 struct dc_link *link,
679 const struct dc_link_settings *link_setting,
680 bool skip_video_pattern);
681
682void dc_link_dp_enable_hpd(const struct dc_link *link);
683
684void dc_link_dp_disable_hpd(const struct dc_link *link);
685
686bool dc_link_dp_set_test_pattern(
687 const struct dc_link *link,
688 enum dp_test_pattern test_pattern,
689 const struct link_training_settings *p_link_settings,
690 const unsigned char *p_custom_pattern,
691 unsigned int cust_pattern_size);
692
693/*******************************************************************************
694 * Sink Interfaces - A sink corresponds to a display output device
695 ******************************************************************************/
696
697/*
698 * The sink structure contains EDID and other display device properties
699 */
700struct dc_sink {
701 enum signal_type sink_signal;
702 struct dc_edid dc_edid; /* raw edid */
703 struct dc_edid_caps edid_caps; /* parse display caps */
704};
705
706void dc_sink_retain(const struct dc_sink *sink);
707void dc_sink_release(const struct dc_sink *sink);
708
709const struct audio **dc_get_audios(struct dc *dc);
710
711struct dc_sink_init_data {
712 enum signal_type sink_signal;
713 const struct dc_link *link;
714 uint32_t dongle_max_pix_clk;
715 bool converter_disable_audio;
716};
717
718struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);
719
720/*******************************************************************************
721 * Cursor interfaces - To manages the cursor within a target
722 ******************************************************************************/
723/* TODO: Deprecated once we switch to dc_set_cursor_position */
724bool dc_target_set_cursor_attributes(
725 struct dc_target *dc_target,
726 const struct dc_cursor_attributes *attributes);
727
728bool dc_target_set_cursor_position(
729 struct dc_target *dc_target,
730 const struct dc_cursor_position *position);
731
732/* Newer interfaces */
733struct dc_cursor {
734 struct dc_plane_address address;
735 struct dc_cursor_attributes attributes;
736};
737
738/*
739 * Create a new cursor with default values for a given target.
740 */
741struct dc_cursor *dc_create_cursor_for_target(
742 const struct dc *dc,
743 struct dc_target *dc_target);
744
745/**
746 * Commit cursor attribute changes such as pixel format and dimensions and
747 * surface address.
748 *
749 * After this call:
750 * Cursor address and format is programmed to the new values.
751 * Cursor position is unmodified.
752 */
753bool dc_commit_cursor(
754 const struct dc *dc,
755 struct dc_cursor *cursor);
756
757/*
758 * Optimized cursor position update
759 *
760 * After this call:
761 * Cursor position will be programmed as well as enable/disable bit.
762 */
763bool dc_set_cursor_position(
764 const struct dc *dc,
765 struct dc_cursor *cursor,
766 struct dc_cursor_position *pos);
767
768/*******************************************************************************
769 * Interrupt interfaces
770 ******************************************************************************/
771enum dc_irq_source dc_interrupt_to_irq_source(
772 struct dc *dc,
773 uint32_t src_id,
774 uint32_t ext_id);
775void dc_interrupt_set(const struct dc *dc, enum dc_irq_source src, bool enable);
776void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src);
777enum dc_irq_source dc_get_hpd_irq_source_at_index(
778 struct dc *dc, uint32_t link_index);
779
780/*******************************************************************************
781 * Power Interfaces
782 ******************************************************************************/
783
784void dc_set_power_state(
785 struct dc *dc,
786 enum dc_acpi_cm_power_state power_state,
787 enum dc_video_power_state video_power_state);
788void dc_resume(const struct dc *dc);
789
790/*******************************************************************************
791 * DDC Interfaces
792 ******************************************************************************/
793
794const struct ddc_service *dc_get_ddc_at_index(
795 struct dc *dc, uint32_t link_index);
796
797/*
798 * DPCD access interfaces
799 */
800
801bool dc_read_dpcd(
802 struct dc *dc,
803 uint32_t link_index,
804 uint32_t address,
805 uint8_t *data,
806 uint32_t size);
807
808bool dc_write_dpcd(
809 struct dc *dc,
810 uint32_t link_index,
811 uint32_t address,
812 const uint8_t *data,
813 uint32_t size);
814
815bool dc_submit_i2c(
816 struct dc *dc,
817 uint32_t link_index,
818 struct i2c_command *cmd);
819
820#endif /* DC_INTERFACE_H_ */