1/*	$NetBSD: dce110_compressor.h,v 1.2 2021/12/18 23:45:02 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_DCE110_H__
28#define __DC_COMPRESSOR_DCE110_H__
29
30#include "../inc/compressor.h"
31
32#define TO_DCE110_COMPRESSOR(compressor)\
33	container_of(compressor, struct dce110_compressor, base)
34
35struct dce110_compressor_reg_offsets {
36	uint32_t dcp_offset;
37	uint32_t dmif_offset;
38};
39
40struct dce110_compressor {
41	struct compressor base;
42	struct dce110_compressor_reg_offsets offsets;
43};
44
45struct compressor *dce110_compressor_create(struct dc_context *ctx);
46
47void dce110_compressor_construct(struct dce110_compressor *cp110,
48	struct dc_context *ctx);
49
50void dce110_compressor_destroy(struct compressor **cp);
51
52/* FBC RELATED */
53void dce110_compressor_power_up_fbc(struct compressor *cp);
54
55void dce110_compressor_enable_fbc(struct compressor *cp,
56	struct compr_addr_and_pitch_params *params);
57
58void dce110_compressor_disable_fbc(struct compressor *cp);
59
60void dce110_compressor_set_fbc_invalidation_triggers(struct compressor *cp,
61	uint32_t fbc_trigger);
62
63void dce110_compressor_program_compressed_surface_address_and_pitch(
64	struct compressor *cp,
65	struct compr_addr_and_pitch_params *params);
66
67bool dce110_compressor_is_fbc_enabled_in_hw(struct compressor *cp,
68	uint32_t *fbc_mapped_crtc_id);
69
70/* LPT RELATED */
71void dce110_compressor_enable_lpt(struct compressor *cp);
72
73void dce110_compressor_disable_lpt(struct compressor *cp);
74
75void dce110_compressor_program_lpt_control(struct compressor *cp,
76	struct compr_addr_and_pitch_params *params);
77
78bool dce110_compressor_is_lpt_enabled_in_hw(struct compressor *cp);
79
80void get_max_support_fbc_buffersize(unsigned int *max_x, unsigned int *max_y);
81
82#endif
83
84