aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/xlnx/xlnx_crtc.h
blob: 9ab57594aba804b0ec6791d5ba0ddd56e13c780b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// SPDX-License-Identifier: GPL-2.0
/*
 * Xilinx DRM crtc header
 *
 *  Copyright (C) 2017 - 2018 Xilinx, Inc.
 *
 *  Author: Hyun Woo Kwon <hyun.kwon@xilinx.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef _XLNX_CRTC_H_
#define _XLNX_CRTC_H_

/**
 * struct xlnx_crtc - Xilinx CRTC device
 * @crtc: DRM CRTC device
 * @list: list node for Xilinx CRTC device list
 * @get_align: Get the alignment requirement of CRTC device
 * @get_dma_mask: Get the dma mask of CRTC device
 * @get_max_width: Get the maximum supported width
 * @get_max_height: Get the maximum supported height
 * @get_format: Get the current format of CRTC device
 * @get_cursor_width: Get the cursor width
 * @get_cursor_height: Get the cursor height
 */
struct xlnx_crtc {
	struct drm_crtc crtc;
	struct list_head list;
	unsigned int (*get_align)(struct xlnx_crtc *crtc);
	u64 (*get_dma_mask)(struct xlnx_crtc *crtc);
	int (*get_max_width)(struct xlnx_crtc *crtc);
	int (*get_max_height)(struct xlnx_crtc *crtc);
	uint32_t (*get_format)(struct xlnx_crtc *crtc);
	uint32_t (*get_cursor_width)(struct xlnx_crtc *crtc);
	uint32_t (*get_cursor_height)(struct xlnx_crtc *crtc);
};

/*
 * Helper functions: used within Xlnx DRM
 */

struct xlnx_crtc_helper;

unsigned int xlnx_crtc_helper_get_align(struct xlnx_crtc_helper *helper);
u64 xlnx_crtc_helper_get_dma_mask(struct xlnx_crtc_helper *helper);
int xlnx_crtc_helper_get_max_width(struct xlnx_crtc_helper *helper);
int xlnx_crtc_helper_get_max_height(struct xlnx_crtc_helper *helper);
uint32_t xlnx_crtc_helper_get_format(struct xlnx_crtc_helper *helper);
u32 xlnx_crtc_helper_get_cursor_width(struct xlnx_crtc_helper *helper);
u32 xlnx_crtc_helper_get_cursor_height(struct xlnx_crtc_helper *helper);

struct xlnx_crtc_helper *xlnx_crtc_helper_init(struct drm_device *drm);
void xlnx_crtc_helper_fini(struct drm_device *drm,
			   struct xlnx_crtc_helper *helper);

/*
 * CRTC registration: used by other sub-driver modules
 */

static inline struct xlnx_crtc *to_xlnx_crtc(struct drm_crtc *crtc)
{
	return container_of(crtc, struct xlnx_crtc, crtc);
}

void xlnx_crtc_register(struct drm_device *drm, struct xlnx_crtc *crtc);
void xlnx_crtc_unregister(struct drm_device *drm, struct xlnx_crtc *crtc);

#endif /* _XLNX_CRTC_H_ */