xref: /linux/drivers/gpu/drm/imagination/pvr_stream.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1*d2d79d29SSarah Walker /* SPDX-License-Identifier: GPL-2.0-only OR MIT */
2*d2d79d29SSarah Walker /* Copyright (c) 2023 Imagination Technologies Ltd. */
3*d2d79d29SSarah Walker 
4*d2d79d29SSarah Walker #ifndef PVR_STREAM_H
5*d2d79d29SSarah Walker #define PVR_STREAM_H
6*d2d79d29SSarah Walker 
7*d2d79d29SSarah Walker #include <linux/bits.h>
8*d2d79d29SSarah Walker #include <linux/limits.h>
9*d2d79d29SSarah Walker #include <linux/types.h>
10*d2d79d29SSarah Walker 
11*d2d79d29SSarah Walker struct pvr_device;
12*d2d79d29SSarah Walker 
13*d2d79d29SSarah Walker struct pvr_job;
14*d2d79d29SSarah Walker 
15*d2d79d29SSarah Walker enum pvr_stream_type {
16*d2d79d29SSarah Walker 	PVR_STREAM_TYPE_GEOM = 0,
17*d2d79d29SSarah Walker 	PVR_STREAM_TYPE_FRAG,
18*d2d79d29SSarah Walker 	PVR_STREAM_TYPE_COMPUTE,
19*d2d79d29SSarah Walker 	PVR_STREAM_TYPE_TRANSFER,
20*d2d79d29SSarah Walker 	PVR_STREAM_TYPE_STATIC_RENDER_CONTEXT,
21*d2d79d29SSarah Walker 	PVR_STREAM_TYPE_STATIC_COMPUTE_CONTEXT,
22*d2d79d29SSarah Walker 
23*d2d79d29SSarah Walker 	PVR_STREAM_TYPE_MAX
24*d2d79d29SSarah Walker };
25*d2d79d29SSarah Walker 
26*d2d79d29SSarah Walker enum pvr_stream_size {
27*d2d79d29SSarah Walker 	PVR_STREAM_SIZE_8 = 0,
28*d2d79d29SSarah Walker 	PVR_STREAM_SIZE_16,
29*d2d79d29SSarah Walker 	PVR_STREAM_SIZE_32,
30*d2d79d29SSarah Walker 	PVR_STREAM_SIZE_64,
31*d2d79d29SSarah Walker 	PVR_STREAM_SIZE_ARRAY,
32*d2d79d29SSarah Walker };
33*d2d79d29SSarah Walker 
34*d2d79d29SSarah Walker #define PVR_FEATURE_NOT  BIT(31)
35*d2d79d29SSarah Walker #define PVR_FEATURE_NONE U32_MAX
36*d2d79d29SSarah Walker 
37*d2d79d29SSarah Walker struct pvr_stream_def {
38*d2d79d29SSarah Walker 	u32 offset;
39*d2d79d29SSarah Walker 	enum pvr_stream_size size;
40*d2d79d29SSarah Walker 	u32 array_size;
41*d2d79d29SSarah Walker 	u32 feature;
42*d2d79d29SSarah Walker };
43*d2d79d29SSarah Walker 
44*d2d79d29SSarah Walker struct pvr_stream_ext_def {
45*d2d79d29SSarah Walker 	const struct pvr_stream_def *stream;
46*d2d79d29SSarah Walker 	u32 stream_len;
47*d2d79d29SSarah Walker 	u32 header_mask;
48*d2d79d29SSarah Walker 	u32 quirk;
49*d2d79d29SSarah Walker };
50*d2d79d29SSarah Walker 
51*d2d79d29SSarah Walker struct pvr_stream_ext_header {
52*d2d79d29SSarah Walker 	const struct pvr_stream_ext_def *ext_streams;
53*d2d79d29SSarah Walker 	u32 ext_streams_num;
54*d2d79d29SSarah Walker 	u32 valid_mask;
55*d2d79d29SSarah Walker };
56*d2d79d29SSarah Walker 
57*d2d79d29SSarah Walker struct pvr_stream_cmd_defs {
58*d2d79d29SSarah Walker 	enum pvr_stream_type type;
59*d2d79d29SSarah Walker 
60*d2d79d29SSarah Walker 	const struct pvr_stream_def *main_stream;
61*d2d79d29SSarah Walker 	u32 main_stream_len;
62*d2d79d29SSarah Walker 
63*d2d79d29SSarah Walker 	u32 ext_nr_headers;
64*d2d79d29SSarah Walker 	const struct pvr_stream_ext_header *ext_headers;
65*d2d79d29SSarah Walker 
66*d2d79d29SSarah Walker 	size_t dest_size;
67*d2d79d29SSarah Walker };
68*d2d79d29SSarah Walker 
69*d2d79d29SSarah Walker int
70*d2d79d29SSarah Walker pvr_stream_process(struct pvr_device *pvr_dev, const struct pvr_stream_cmd_defs *cmd_defs,
71*d2d79d29SSarah Walker 		   void *stream, u32 stream_size, void *dest_out);
72*d2d79d29SSarah Walker void
73*d2d79d29SSarah Walker pvr_stream_create_musthave_masks(struct pvr_device *pvr_dev);
74*d2d79d29SSarah Walker 
75*d2d79d29SSarah Walker #endif /* PVR_STREAM_H */
76