xref: /linux/drivers/gpu/drm/amd/display/dc/inc/compressor.h (revision ef40b2346563aa11575446c8e3b04af44c31abb5)
1 /*
2  * Copyright 2012-15 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 __DAL_COMPRESSOR_H__
27 #define __DAL_COMPRESSOR_H__
28 
29 #include "include/grph_object_id.h"
30 #include "bios_parser_interface.h"
31 
32 enum fbc_compress_ratio {
33 	FBC_COMPRESS_RATIO_INVALID = 0,
34 	FBC_COMPRESS_RATIO_1TO1 = 1,
35 	FBC_COMPRESS_RATIO_2TO1 = 2,
36 	FBC_COMPRESS_RATIO_4TO1 = 4,
37 	FBC_COMPRESS_RATIO_8TO1 = 8,
38 };
39 
40 union fbc_physical_address {
41 	struct {
42 		uint32_t low_part;
43 		int32_t high_part;
44 	} addr;
45 };
46 
47 struct compr_addr_and_pitch_params {
48 	uint32_t inst;
49 	uint32_t source_view_width;
50 	uint32_t source_view_height;
51 };
52 
53 enum fbc_hw_max_resolution_supported {
54 	FBC_MAX_X = 3840,
55 	FBC_MAX_Y = 2400
56 };
57 
58 struct compressor {
59 	struct dc_context *ctx;
60 	uint32_t attached_inst;
61 	bool is_enabled;
62 
63 	union {
64 		uint32_t raw;
65 		struct {
66 			uint32_t FBC_SUPPORT:1;
67 			uint32_t FB_POOL:1;
68 			uint32_t DYNAMIC_ALLOC:1;
69 			uint32_t LPT_SUPPORT:1;
70 			uint32_t LPT_MC_CONFIG:1;
71 			uint32_t DUMMY_BACKEND:1;
72 			uint32_t CLK_GATING_DISABLED:1;
73 
74 		} bits;
75 	} options;
76 
77 	union fbc_physical_address compr_surface_address;
78 
79 	uint32_t embedded_panel_h_size;
80 	uint32_t embedded_panel_v_size;
81 	uint32_t memory_bus_width;
82 	uint32_t banks_num;
83 	uint32_t raw_size;
84 	uint32_t channel_interleave_size;
85 	uint32_t dram_channels_num;
86 
87 	uint32_t allocated_size;
88 	uint32_t preferred_requested_size;
89 	uint32_t lpt_channels_num;
90 	enum fbc_compress_ratio min_compress_ratio;
91 };
92 
93 #endif
94