Linux-libre 5.4.47-gnu
[librecmc/linux-libre.git] / drivers / gpu / drm / amd / display / dc / dce110 / dce110_compressor.h
1 /* Copyright 2012-15 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_COMPRESSOR_DCE110_H__
26 #define __DC_COMPRESSOR_DCE110_H__
27
28 #include "../inc/compressor.h"
29
30 #define TO_DCE110_COMPRESSOR(compressor)\
31         container_of(compressor, struct dce110_compressor, base)
32
33 struct dce110_compressor_reg_offsets {
34         uint32_t dcp_offset;
35         uint32_t dmif_offset;
36 };
37
38 struct dce110_compressor {
39         struct compressor base;
40         struct dce110_compressor_reg_offsets offsets;
41 };
42
43 struct compressor *dce110_compressor_create(struct dc_context *ctx);
44
45 void dce110_compressor_construct(struct dce110_compressor *cp110,
46         struct dc_context *ctx);
47
48 void dce110_compressor_destroy(struct compressor **cp);
49
50 /* FBC RELATED */
51 void dce110_compressor_power_up_fbc(struct compressor *cp);
52
53 void dce110_compressor_enable_fbc(struct compressor *cp,
54         struct compr_addr_and_pitch_params *params);
55
56 void dce110_compressor_disable_fbc(struct compressor *cp);
57
58 void dce110_compressor_set_fbc_invalidation_triggers(struct compressor *cp,
59         uint32_t fbc_trigger);
60
61 void dce110_compressor_program_compressed_surface_address_and_pitch(
62         struct compressor *cp,
63         struct compr_addr_and_pitch_params *params);
64
65 bool dce110_compressor_is_fbc_enabled_in_hw(struct compressor *cp,
66         uint32_t *fbc_mapped_crtc_id);
67
68 /* LPT RELATED */
69 void dce110_compressor_enable_lpt(struct compressor *cp);
70
71 void dce110_compressor_disable_lpt(struct compressor *cp);
72
73 void dce110_compressor_program_lpt_control(struct compressor *cp,
74         struct compr_addr_and_pitch_params *params);
75
76 bool dce110_compressor_is_lpt_enabled_in_hw(struct compressor *cp);
77
78 void get_max_support_fbc_buffersize(unsigned int *max_x, unsigned int *max_y);
79
80 #endif
81