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