1 /* Copyright 2012-16 Advanced Micro Devices, Inc.
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a
4  * copy of this software and associated documentation files (the "Software"),
5  * to deal in the Software without restriction, including without limitation
6  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7  * and/or sell copies of the Software, and to permit persons to whom the
8  * Software is furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
16  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
17  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19  * OTHER DEALINGS IN THE SOFTWARE.
20  *
21  * Authors: AMD
22  *
23  */
24 
25 #ifndef __DC_MEM_INPUT_V_DCE110_H__
26 #define __DC_MEM_INPUT_V_DCE110_H__
27 
28 #include "mem_input.h"
29 #include "dce110_mem_input.h"
30 
31 bool dce110_mem_input_v_construct(
32 	struct dce110_mem_input *mem_input110,
33 	struct dc_context *ctx);
34 
35 /*
36  * This function will program nbp stutter and urgency watermarks to minimum
37  * allowable values
38  */
39 void dce110_mem_input_v_program_display_marks(
40 	struct mem_input *mem_input,
41 	struct dce_watermarks nbp,
42 	struct dce_watermarks stutter,
43 	struct dce_watermarks urgent,
44 	uint32_t total_dest_line_time_ns);
45 
46 /*
47  * This function will allocate a dmif buffer and program required
48  * pixel duration for pipe
49  */
50 void dce110_allocate_mem_v_input(
51 	struct mem_input *mem_input,
52 	uint32_t h_total,/* for current stream */
53 	uint32_t v_total,/* for current stream */
54 	uint32_t pix_clk_khz,/* for current stream */
55 	uint32_t total_stream_num);
56 
57 /*
58  * This function will deallocate a dmif buffer from pipe
59  */
60 void dce110_free_mem_v_input(
61 	struct mem_input *mem_input,
62 	uint32_t total_stream_num);
63 
64 /*
65  * This function programs hsync/vsync mode and surface address
66  */
67 bool dce110_mem_input_v_program_surface_flip_and_addr(
68 	struct mem_input *mem_input,
69 	const struct dc_plane_address *address,
70 	bool flip_immediate);
71 
72 /*
73  * dce110_mem_input_v_program_scatter_gather
74  *
75  * This function will program scatter gather registers.
76  */
77 bool  dce110_mem_input_v_program_pte_vm(
78 	struct mem_input *mem_input,
79 	enum surface_pixel_format format,
80 	union dc_tiling_info *tiling_info,
81 	enum dc_rotation_angle rotation);
82 
83 /*
84  * This function will program surface tiling, size, rotation and pixel format
85  * to corresponding dcp registers.
86  */
87 bool  dce110_mem_input_v_program_surface_config(
88 	struct mem_input *mem_input,
89 	enum surface_pixel_format format,
90 	union dc_tiling_info *tiling_info,
91 	union plane_size *plane_size,
92 	enum dc_rotation_angle rotation,
93 	bool visible);
94 
95 #endif
96