summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/logicvc/logicvc_layer.h
blob: 4a4b02e9b81919a78e458cdd575f66f0cc57ffde (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
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Copyright (C) 2019-2022 Bootlin
 * Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
 */

#ifndef _LOGICVC_LAYER_H_
#define _LOGICVC_LAYER_H_

#include <linux/of.h>
#include <linux/types.h>
#include <drm/drm_plane.h>

#define LOGICVC_LAYER_COLORSPACE_RGB		0
#define LOGICVC_LAYER_COLORSPACE_YUV		1

#define LOGICVC_LAYER_ALPHA_LAYER		0
#define LOGICVC_LAYER_ALPHA_PIXEL		1

struct logicvc_layer_buffer_setup {
	u8 buffer_sel;
	u16 voffset;
	u16 hoffset;
};

struct logicvc_layer_config {
	u32 colorspace;
	u32 depth;
	u32 alpha_mode;
	u32 base_offset;
	u32 buffer_offset;
	bool primary;
};

struct logicvc_layer_formats {
	u32 colorspace;
	u32 depth;
	bool alpha;
	uint32_t *formats;
};

struct logicvc_layer {
	struct logicvc_layer_config config;
	struct logicvc_layer_formats *formats;
	struct device_node *of_node;

	struct drm_plane drm_plane;
	struct list_head list;
	u32 index;
};

int logicvc_layer_buffer_find_setup(struct logicvc_drm *logicvc,
				    struct logicvc_layer *layer,
				    struct drm_plane_state *state,
				    struct logicvc_layer_buffer_setup *setup);
struct logicvc_layer *logicvc_layer_get_from_index(struct logicvc_drm *logicvc,
						   u32 index);
struct logicvc_layer *logicvc_layer_get_from_type(struct logicvc_drm *logicvc,
						  enum drm_plane_type type);
struct logicvc_layer *logicvc_layer_get_primary(struct logicvc_drm *logicvc);
void logicvc_layers_attach_crtc(struct logicvc_drm *logicvc);
int logicvc_layers_init(struct logicvc_drm *logicvc);

#endif