1 /* SPDX-License-Identifier: GPL-2.0-only OR MIT */
2 /* Copyright (c) 2023 Imagination Technologies Ltd. */
4 #ifndef PVR_ROGUE_FWIF_STREAM_H
5 #define PVR_ROGUE_FWIF_STREAM_H
10 * Commands are submitted to the kernel driver in the form of streams.
12 * A command stream has the following layout :
13 * - A 64-bit header containing:
14 * * A u32 containing the length of the main stream inclusive of the length of the header.
15 * * A u32 for padding.
16 * - The main stream data.
17 * - The extension stream (optional), which is composed of:
18 * * One or more headers.
19 * * The extension stream data, corresponding to the extension headers.
21 * The main stream provides the base command data. This has a fixed layout based on the features
22 * supported by a given GPU.
24 * The extension stream provides the command parameters that are required for BRNs & ERNs for the
25 * current GPU. This stream is comprised of one or more headers, followed by data for each given
28 * Each header is a u32 containing a bitmask of quirks & enhancements in the extension stream, a
29 * "type" field determining the set of quirks & enhancements the bitmask represents, and a
30 * continuation bit determining whether any more headers are present. The headers are then followed
31 * by command data; this is specific to each quirk/enhancement. All unused / reserved bits in the
32 * header must be set to 0.
34 * All parameters and headers in the main and extension streams must be naturally aligned.
36 * If a parameter appears in both the main and extension streams, then the extension parameter is
41 * Stream extension header definition
43 #define PVR_STREAM_EXTHDR_TYPE_SHIFT 29U
44 #define PVR_STREAM_EXTHDR_TYPE_MASK (7U << PVR_STREAM_EXTHDR_TYPE_SHIFT)
45 #define PVR_STREAM_EXTHDR_TYPE_MAX 8U
46 #define PVR_STREAM_EXTHDR_CONTINUATION BIT(28U)
48 #define PVR_STREAM_EXTHDR_DATA_MASK ~(PVR_STREAM_EXTHDR_TYPE_MASK | PVR_STREAM_EXTHDR_CONTINUATION)
51 * Stream extension header - Geometry 0
53 #define PVR_STREAM_EXTHDR_TYPE_GEOM0 0U
55 #define PVR_STREAM_EXTHDR_GEOM0_BRN49927 BIT(0U)
57 #define PVR_STREAM_EXTHDR_GEOM0_VALID PVR_STREAM_EXTHDR_GEOM0_BRN49927
60 * Stream extension header - Fragment 0
62 #define PVR_STREAM_EXTHDR_TYPE_FRAG0 0U
64 #define PVR_STREAM_EXTHDR_FRAG0_BRN47217 BIT(0U)
65 #define PVR_STREAM_EXTHDR_FRAG0_BRN49927 BIT(1U)
67 #define PVR_STREAM_EXTHDR_FRAG0_VALID PVR_STREAM_EXTHDR_FRAG0_BRN49927
70 * Stream extension header - Compute 0
72 #define PVR_STREAM_EXTHDR_TYPE_COMPUTE0 0U
74 #define PVR_STREAM_EXTHDR_COMPUTE0_BRN49927 BIT(0U)
76 #define PVR_STREAM_EXTHDR_COMPUTE0_VALID PVR_STREAM_EXTHDR_COMPUTE0_BRN49927
78 #endif /* PVR_ROGUE_FWIF_STREAM_H */