aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarry Wentland <harry.wentland@amd.com>2017-11-08 14:34:14 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-12-06 12:47:44 -0500
commit7c0c967209591433f31e4992fc58f5e30a16febb (patch)
tree277edbccc9ab90d73c96a632a895da5602079f9c
parenta4e6d14ebe80ee53e295540c51dfb1352d7069a8 (diff)
drm/amd/display: Move dc_stream interface to separate header
Signed-off-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/display/dc/dc.h223
-rw-r--r--drivers/gpu/drm/amd/display/dc/dc_stream.h271
2 files changed, 273 insertions, 221 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 5fe86fab6995..170cdcb5a027 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -137,6 +137,7 @@ struct dc;
137struct dc_plane_state; 137struct dc_plane_state;
138struct dc_state; 138struct dc_state;
139 139
140
140struct dc_cap_funcs { 141struct dc_cap_funcs {
141 bool (*get_dcc_compression_cap)(const struct dc *dc, 142 bool (*get_dcc_compression_cap)(const struct dc *dc,
142 const struct dc_dcc_surface_param *input, 143 const struct dc_dcc_surface_param *input,
@@ -577,168 +578,7 @@ struct dc_flip_addrs {
577bool dc_post_update_surfaces_to_stream( 578bool dc_post_update_surfaces_to_stream(
578 struct dc *dc); 579 struct dc *dc);
579 580
580/******************************************************************************* 581#include "dc_stream.h"
581 * Stream Interfaces
582 ******************************************************************************/
583
584struct dc_stream_status {
585 int primary_otg_inst;
586 int stream_enc_inst;
587 int plane_count;
588 struct dc_plane_state *plane_states[MAX_SURFACE_NUM];
589
590 /*
591 * link this stream passes through
592 */
593 struct dc_link *link;
594};
595
596struct dc_stream_state {
597 struct dc_sink *sink;
598 struct dc_crtc_timing timing;
599
600 struct rect src; /* composition area */
601 struct rect dst; /* stream addressable area */
602
603 struct audio_info audio_info;
604
605 struct freesync_context freesync_ctx;
606
607 struct dc_hdr_static_metadata hdr_static_metadata;
608 struct dc_transfer_func *out_transfer_func;
609 struct colorspace_transform gamut_remap_matrix;
610 struct csc_transform csc_color_matrix;
611
612 enum dc_color_space output_color_space;
613 enum dc_dither_option dither_option;
614
615 enum view_3d_format view_format;
616
617 bool ignore_msa_timing_param;
618 /* TODO: custom INFO packets */
619 /* TODO: ABM info (DMCU) */
620 /* TODO: PSR info */
621 /* TODO: CEA VIC */
622
623 /* from core_stream struct */
624 struct dc_context *ctx;
625
626 /* used by DCP and FMT */
627 struct bit_depth_reduction_params bit_depth_params;
628 struct clamping_and_pixel_encoding_params clamping;
629
630 int phy_pix_clk;
631 enum signal_type signal;
632 bool dpms_off;
633
634 struct dc_stream_status status;
635
636 struct dc_cursor_attributes cursor_attributes;
637
638 /* from stream struct */
639 struct kref refcount;
640
641 struct crtc_trigger_info triggered_crtc_reset;
642
643};
644
645struct dc_stream_update {
646 struct rect src;
647 struct rect dst;
648 struct dc_transfer_func *out_transfer_func;
649 struct dc_hdr_static_metadata *hdr_static_metadata;
650};
651
652bool dc_is_stream_unchanged(
653 struct dc_stream_state *old_stream, struct dc_stream_state *stream);
654bool dc_is_stream_scaling_unchanged(
655 struct dc_stream_state *old_stream, struct dc_stream_state *stream);
656
657/*
658 * Set up surface attributes and associate to a stream
659 * The surfaces parameter is an absolute set of all surface active for the stream.
660 * If no surfaces are provided, the stream will be blanked; no memory read.
661 * Any flip related attribute changes must be done through this interface.
662 *
663 * After this call:
664 * Surfaces attributes are programmed and configured to be composed into stream.
665 * This does not trigger a flip. No surface address is programmed.
666 */
667
668bool dc_commit_planes_to_stream(
669 struct dc *dc,
670 struct dc_plane_state **plane_states,
671 uint8_t new_plane_count,
672 struct dc_stream_state *dc_stream,
673 struct dc_state *state);
674
675void dc_commit_updates_for_stream(struct dc *dc,
676 struct dc_surface_update *srf_updates,
677 int surface_count,
678 struct dc_stream_state *stream,
679 struct dc_stream_update *stream_update,
680 struct dc_plane_state **plane_states,
681 struct dc_state *state);
682/*
683 * Log the current stream state.
684 */
685void dc_stream_log(
686 const struct dc_stream_state *stream,
687 struct dal_logger *dc_logger,
688 enum dc_log_type log_type);
689
690uint8_t dc_get_current_stream_count(struct dc *dc);
691struct dc_stream_state *dc_get_stream_at_index(struct dc *dc, uint8_t i);
692
693/*
694 * Return the current frame counter.
695 */
696uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream);
697
698/* TODO: Return parsed values rather than direct register read
699 * This has a dependency on the caller (amdgpu_get_crtc_scanoutpos)
700 * being refactored properly to be dce-specific
701 */
702bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream,
703 uint32_t *v_blank_start,
704 uint32_t *v_blank_end,
705 uint32_t *h_position,
706 uint32_t *v_position);
707
708enum dc_status dc_add_stream_to_ctx(
709 struct dc *dc,
710 struct dc_state *new_ctx,
711 struct dc_stream_state *stream);
712
713enum dc_status dc_remove_stream_from_ctx(
714 struct dc *dc,
715 struct dc_state *new_ctx,
716 struct dc_stream_state *stream);
717
718
719bool dc_add_plane_to_context(
720 const struct dc *dc,
721 struct dc_stream_state *stream,
722 struct dc_plane_state *plane_state,
723 struct dc_state *context);
724
725bool dc_remove_plane_from_context(
726 const struct dc *dc,
727 struct dc_stream_state *stream,
728 struct dc_plane_state *plane_state,
729 struct dc_state *context);
730
731bool dc_rem_all_planes_for_stream(
732 const struct dc *dc,
733 struct dc_stream_state *stream,
734 struct dc_state *context);
735
736bool dc_add_all_planes_for_stream(
737 const struct dc *dc,
738 struct dc_stream_state *stream,
739 struct dc_plane_state * const *plane_states,
740 int plane_count,
741 struct dc_state *context);
742 582
743/* 583/*
744 * Structure to store surface/stream associations for validation 584 * Structure to store surface/stream associations for validation
@@ -749,22 +589,12 @@ struct dc_validation_set {
749 uint8_t plane_count; 589 uint8_t plane_count;
750}; 590};
751 591
752enum dc_status dc_validate_stream(struct dc *dc, struct dc_stream_state *stream);
753
754enum dc_status dc_validate_plane(struct dc *dc, const struct dc_plane_state *plane_state); 592enum dc_status dc_validate_plane(struct dc *dc, const struct dc_plane_state *plane_state);
755 593
756enum dc_status dc_validate_global_state( 594enum dc_status dc_validate_global_state(
757 struct dc *dc, 595 struct dc *dc,
758 struct dc_state *new_ctx); 596 struct dc_state *new_ctx);
759 597
760/*
761 * This function takes a stream and checks if it is guaranteed to be supported.
762 * Guaranteed means that MAX_COFUNC similar streams are supported.
763 *
764 * After this call:
765 * No hardware is programmed for call. Only validation is done.
766 */
767
768 598
769void dc_resource_state_construct( 599void dc_resource_state_construct(
770 const struct dc *dc, 600 const struct dc *dc,
@@ -791,42 +621,6 @@ void dc_resource_state_destruct(struct dc_state *context);
791 */ 621 */
792bool dc_commit_state(struct dc *dc, struct dc_state *context); 622bool dc_commit_state(struct dc *dc, struct dc_state *context);
793 623
794/*
795 * Set up streams and links associated to drive sinks
796 * The streams parameter is an absolute set of all active streams.
797 *
798 * After this call:
799 * Phy, Encoder, Timing Generator are programmed and enabled.
800 * New streams are enabled with blank stream; no memory read.
801 */
802/*
803 * Enable stereo when commit_streams is not required,
804 * for example, frame alternate.
805 */
806bool dc_enable_stereo(
807 struct dc *dc,
808 struct dc_state *context,
809 struct dc_stream_state *streams[],
810 uint8_t stream_count);
811
812/**
813 * Create a new default stream for the requested sink
814 */
815struct dc_stream_state *dc_create_stream_for_sink(struct dc_sink *dc_sink);
816
817void dc_stream_retain(struct dc_stream_state *dc_stream);
818void dc_stream_release(struct dc_stream_state *dc_stream);
819
820struct dc_stream_status *dc_stream_get_status(
821 struct dc_stream_state *dc_stream);
822
823enum surface_update_type dc_check_update_surfaces_for_stream(
824 struct dc *dc,
825 struct dc_surface_update *updates,
826 int surface_count,
827 struct dc_stream_update *stream_update,
828 const struct dc_stream_status *stream_status);
829
830 624
831struct dc_state *dc_create_state(void); 625struct dc_state *dc_create_state(void);
832void dc_retain_state(struct dc_state *context); 626void dc_retain_state(struct dc_state *context);
@@ -1076,18 +870,6 @@ struct dc_sink_init_data {
1076 870
1077struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params); 871struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);
1078 872
1079/*******************************************************************************
1080 * Cursor interfaces - To manages the cursor within a stream
1081 ******************************************************************************/
1082/* TODO: Deprecated once we switch to dc_set_cursor_position */
1083bool dc_stream_set_cursor_attributes(
1084 struct dc_stream_state *stream,
1085 const struct dc_cursor_attributes *attributes);
1086
1087bool dc_stream_set_cursor_position(
1088 struct dc_stream_state *stream,
1089 const struct dc_cursor_position *position);
1090
1091/* Newer interfaces */ 873/* Newer interfaces */
1092struct dc_cursor { 874struct dc_cursor {
1093 struct dc_plane_address address; 875 struct dc_plane_address address;
@@ -1124,5 +906,4 @@ bool dc_submit_i2c(
1124 uint32_t link_index, 906 uint32_t link_index,
1125 struct i2c_command *cmd); 907 struct i2c_command *cmd);
1126 908
1127
1128#endif /* DC_INTERFACE_H_ */ 909#endif /* DC_INTERFACE_H_ */
diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h b/drivers/gpu/drm/amd/display/dc/dc_stream.h
new file mode 100644
index 000000000000..bed2a937de71
--- /dev/null
+++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h
@@ -0,0 +1,271 @@
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_STREAM_H_
27#define DC_STREAM_H_
28
29#include "dc_types.h"
30#include "grph_object_defs.h"
31
32/*******************************************************************************
33 * Stream Interfaces
34 ******************************************************************************/
35
36struct dc_stream_status {
37 int primary_otg_inst;
38 int stream_enc_inst;
39 int plane_count;
40 struct dc_plane_state *plane_states[MAX_SURFACE_NUM];
41
42 /*
43 * link this stream passes through
44 */
45 struct dc_link *link;
46};
47
48struct dc_stream_state {
49 struct dc_sink *sink;
50 struct dc_crtc_timing timing;
51
52 struct rect src; /* composition area */
53 struct rect dst; /* stream addressable area */
54
55 struct audio_info audio_info;
56
57 struct freesync_context freesync_ctx;
58
59 struct dc_hdr_static_metadata hdr_static_metadata;
60 struct dc_transfer_func *out_transfer_func;
61 struct colorspace_transform gamut_remap_matrix;
62 struct csc_transform csc_color_matrix;
63
64 enum dc_color_space output_color_space;
65 enum dc_dither_option dither_option;
66
67 enum view_3d_format view_format;
68
69 bool ignore_msa_timing_param;
70 /* TODO: custom INFO packets */
71 /* TODO: ABM info (DMCU) */
72 /* TODO: PSR info */
73 /* TODO: CEA VIC */
74
75 /* from core_stream struct */
76 struct dc_context *ctx;
77
78 /* used by DCP and FMT */
79 struct bit_depth_reduction_params bit_depth_params;
80 struct clamping_and_pixel_encoding_params clamping;
81
82 int phy_pix_clk;
83 enum signal_type signal;
84 bool dpms_off;
85
86 struct dc_stream_status status;
87
88 struct dc_cursor_attributes cursor_attributes;
89
90 /* from stream struct */
91 struct kref refcount;
92
93 struct crtc_trigger_info triggered_crtc_reset;
94
95};
96
97struct dc_stream_update {
98 struct rect src;
99 struct rect dst;
100 struct dc_transfer_func *out_transfer_func;
101 struct dc_hdr_static_metadata *hdr_static_metadata;
102};
103
104bool dc_is_stream_unchanged(
105 struct dc_stream_state *old_stream, struct dc_stream_state *stream);
106bool dc_is_stream_scaling_unchanged(
107 struct dc_stream_state *old_stream, struct dc_stream_state *stream);
108
109/*
110 * Set up surface attributes and associate to a stream
111 * The surfaces parameter is an absolute set of all surface active for the stream.
112 * If no surfaces are provided, the stream will be blanked; no memory read.
113 * Any flip related attribute changes must be done through this interface.
114 *
115 * After this call:
116 * Surfaces attributes are programmed and configured to be composed into stream.
117 * This does not trigger a flip. No surface address is programmed.
118 */
119
120bool dc_commit_planes_to_stream(
121 struct dc *dc,
122 struct dc_plane_state **plane_states,
123 uint8_t new_plane_count,
124 struct dc_stream_state *dc_stream,
125 struct dc_state *state);
126
127void dc_commit_updates_for_stream(struct dc *dc,
128 struct dc_surface_update *srf_updates,
129 int surface_count,
130 struct dc_stream_state *stream,
131 struct dc_stream_update *stream_update,
132 struct dc_plane_state **plane_states,
133 struct dc_state *state);
134/*
135 * Log the current stream state.
136 */
137void dc_stream_log(
138 const struct dc_stream_state *stream,
139 struct dal_logger *dc_logger,
140 enum dc_log_type log_type);
141
142uint8_t dc_get_current_stream_count(struct dc *dc);
143struct dc_stream_state *dc_get_stream_at_index(struct dc *dc, uint8_t i);
144
145/*
146 * Return the current frame counter.
147 */
148uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream);
149
150/* TODO: Return parsed values rather than direct register read
151 * This has a dependency on the caller (amdgpu_get_crtc_scanoutpos)
152 * being refactored properly to be dce-specific
153 */
154bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream,
155 uint32_t *v_blank_start,
156 uint32_t *v_blank_end,
157 uint32_t *h_position,
158 uint32_t *v_position);
159
160enum dc_status dc_add_stream_to_ctx(
161 struct dc *dc,
162 struct dc_state *new_ctx,
163 struct dc_stream_state *stream);
164
165enum dc_status dc_remove_stream_from_ctx(
166 struct dc *dc,
167 struct dc_state *new_ctx,
168 struct dc_stream_state *stream);
169
170
171bool dc_add_plane_to_context(
172 const struct dc *dc,
173 struct dc_stream_state *stream,
174 struct dc_plane_state *plane_state,
175 struct dc_state *context);
176
177bool dc_remove_plane_from_context(
178 const struct dc *dc,
179 struct dc_stream_state *stream,
180 struct dc_plane_state *plane_state,
181 struct dc_state *context);
182
183bool dc_rem_all_planes_for_stream(
184 const struct dc *dc,
185 struct dc_stream_state *stream,
186 struct dc_state *context);
187
188bool dc_add_all_planes_for_stream(
189 const struct dc *dc,
190 struct dc_stream_state *stream,
191 struct dc_plane_state * const *plane_states,
192 int plane_count,
193 struct dc_state *context);
194
195enum dc_status dc_validate_stream(struct dc *dc, struct dc_stream_state *stream);
196
197/*
198 * This function takes a stream and checks if it is guaranteed to be supported.
199 * Guaranteed means that MAX_COFUNC similar streams are supported.
200 *
201 * After this call:
202 * No hardware is programmed for call. Only validation is done.
203 */
204
205/*
206 * Set up streams and links associated to drive sinks
207 * The streams parameter is an absolute set of all active streams.
208 *
209 * After this call:
210 * Phy, Encoder, Timing Generator are programmed and enabled.
211 * New streams are enabled with blank stream; no memory read.
212 */
213/*
214 * Enable stereo when commit_streams is not required,
215 * for example, frame alternate.
216 */
217bool dc_enable_stereo(
218 struct dc *dc,
219 struct dc_state *context,
220 struct dc_stream_state *streams[],
221 uint8_t stream_count);
222
223
224enum surface_update_type dc_check_update_surfaces_for_stream(
225 struct dc *dc,
226 struct dc_surface_update *updates,
227 int surface_count,
228 struct dc_stream_update *stream_update,
229 const struct dc_stream_status *stream_status);
230
231/**
232 * Create a new default stream for the requested sink
233 */
234struct dc_stream_state *dc_create_stream_for_sink(struct dc_sink *dc_sink);
235
236void dc_stream_retain(struct dc_stream_state *dc_stream);
237void dc_stream_release(struct dc_stream_state *dc_stream);
238
239struct dc_stream_status *dc_stream_get_status(
240 struct dc_stream_state *dc_stream);
241
242/*******************************************************************************
243 * Cursor interfaces - To manages the cursor within a stream
244 ******************************************************************************/
245/* TODO: Deprecated once we switch to dc_set_cursor_position */
246bool dc_stream_set_cursor_attributes(
247 struct dc_stream_state *stream,
248 const struct dc_cursor_attributes *attributes);
249
250bool dc_stream_set_cursor_position(
251 struct dc_stream_state *stream,
252 const struct dc_cursor_position *position);
253
254bool dc_stream_adjust_vmin_vmax(struct dc *dc,
255 struct dc_stream_state **stream,
256 int num_streams,
257 int vmin,
258 int vmax);
259
260bool dc_stream_get_crtc_position(struct dc *dc,
261 struct dc_stream_state **stream,
262 int num_streams,
263 unsigned int *v_pos,
264 unsigned int *nom_v_pos);
265
266void dc_stream_set_static_screen_events(struct dc *dc,
267 struct dc_stream_state **stream,
268 int num_streams,
269 const struct dc_static_screen_events *events);
270
271#endif /* DC_STREAM_H_ */