summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/imagination/pvr_stream.h
blob: d92acb3a61d7f78ece36fd709be3ecb3795eae13 (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
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/* Copyright (c) 2023 Imagination Technologies Ltd. */

#ifndef PVR_STREAM_H
#define PVR_STREAM_H

#include <linux/bits.h>
#include <linux/limits.h>
#include <linux/types.h>

struct pvr_device;

struct pvr_job;

enum pvr_stream_type {
	PVR_STREAM_TYPE_GEOM = 0,
	PVR_STREAM_TYPE_FRAG,
	PVR_STREAM_TYPE_COMPUTE,
	PVR_STREAM_TYPE_TRANSFER,
	PVR_STREAM_TYPE_STATIC_RENDER_CONTEXT,
	PVR_STREAM_TYPE_STATIC_COMPUTE_CONTEXT,

	PVR_STREAM_TYPE_MAX
};

enum pvr_stream_size {
	PVR_STREAM_SIZE_8 = 0,
	PVR_STREAM_SIZE_16,
	PVR_STREAM_SIZE_32,
	PVR_STREAM_SIZE_64,
	PVR_STREAM_SIZE_ARRAY,
};

#define PVR_FEATURE_NOT  BIT(31)
#define PVR_FEATURE_NONE U32_MAX

struct pvr_stream_def {
	u32 offset;
	enum pvr_stream_size size;
	u32 array_size;
	u32 feature;
};

struct pvr_stream_ext_def {
	const struct pvr_stream_def *stream;
	u32 stream_len;
	u32 header_mask;
	u32 quirk;
};

struct pvr_stream_ext_header {
	const struct pvr_stream_ext_def *ext_streams;
	u32 ext_streams_num;
	u32 valid_mask;
};

struct pvr_stream_cmd_defs {
	enum pvr_stream_type type;

	const struct pvr_stream_def *main_stream;
	u32 main_stream_len;

	u32 ext_nr_headers;
	const struct pvr_stream_ext_header *ext_headers;

	size_t dest_size;
};

int
pvr_stream_process(struct pvr_device *pvr_dev, const struct pvr_stream_cmd_defs *cmd_defs,
		   void *stream, u32 stream_size, void *dest_out);
void
pvr_stream_create_musthave_masks(struct pvr_device *pvr_dev);

#endif /* PVR_STREAM_H */