xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/amd/display/dc/dce112/dce112_compressor.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: dce112_compressor.h,v 1.2 2021/12/18 23:45:03 riastradh Exp $	*/
2 
3 /* Copyright 2012-15 Advanced Micro Devices, Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21  * OTHER DEALINGS IN THE SOFTWARE.
22  *
23  * Authors: AMD
24  *
25  */
26 
27 #ifndef __DC_COMPRESSOR_DCE112_H__
28 #define __DC_COMPRESSOR_DCE112_H__
29 
30 #include "../inc/compressor.h"
31 
32 #define TO_DCE112_COMPRESSOR(compressor)\
33 	container_of(compressor, struct dce112_compressor, base)
34 
35 struct dce112_compressor_reg_offsets {
36 	uint32_t dcp_offset;
37 	uint32_t dmif_offset;
38 };
39 
40 struct dce112_compressor {
41 	struct compressor base;
42 	struct dce112_compressor_reg_offsets offsets;
43 };
44 
45 struct compressor *dce112_compressor_create(struct dc_context *ctx);
46 
47 void dce112_compressor_construct(struct dce112_compressor *cp110,
48 	struct dc_context *ctx);
49 
50 void dce112_compressor_destroy(struct compressor **cp);
51 
52 /* FBC RELATED */
53 void dce112_compressor_power_up_fbc(struct compressor *cp);
54 
55 void dce112_compressor_enable_fbc(struct compressor *cp, uint32_t paths_num,
56 	struct compr_addr_and_pitch_params *params);
57 
58 void dce112_compressor_disable_fbc(struct compressor *cp);
59 
60 void dce112_compressor_set_fbc_invalidation_triggers(struct compressor *cp,
61 	uint32_t fbc_trigger);
62 
63 void dce112_compressor_program_compressed_surface_address_and_pitch(
64 	struct compressor *cp,
65 	struct compr_addr_and_pitch_params *params);
66 
67 bool dce112_compressor_is_fbc_enabled_in_hw(struct compressor *cp,
68 	uint32_t *fbc_mapped_crtc_id);
69 
70 /* LPT RELATED */
71 void dce112_compressor_enable_lpt(struct compressor *cp);
72 
73 void dce112_compressor_disable_lpt(struct compressor *cp);
74 
75 void dce112_compressor_program_lpt_control(struct compressor *cp,
76 	struct compr_addr_and_pitch_params *params);
77 
78 bool dce112_compressor_is_lpt_enabled_in_hw(struct compressor *cp);
79 
80 #endif
81