Skip to content

Commit 5578005

Browse files
laanwjlynxeye-dev
authored andcommitted
drm/etnaviv: Allow DRAW_INSTANCED commands
Vivante GPUs with HALTI0 feature support a DRAW_INSTANCED command in the command stream to draw a number of instances of the same geometry. The information that has been figured out about the command can be found here: https://github.com/etnaviv/etna_viv/blob/master/rnndb/cmdstream.xml#L270 This command is not allowed currently by the DRM driver because it was not known before. This patch enables parsing it in command streams and allows using it by userspace drivers. Signed-off-by: Wladimir J. van der Laan <laanwj@gmail.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
1 parent 5688e57 commit 5578005

File tree

2 files changed

+57
-4
lines changed

2 files changed

+57
-4
lines changed

drivers/gpu/drm/etnaviv/cmdstream.xml.h

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,34 @@ This file was generated by the rules-ng-ng headergen tool in this git repository
88
git clone git://0x04.net/rules-ng-ng
99
1010
The rules-ng-ng source files this header was generated from are:
11-
- cmdstream.xml ( 12589 bytes, from 2014-02-17 14:57:56)
12-
- common.xml ( 18437 bytes, from 2015-03-25 11:27:41)
13-
14-
Copyright (C) 2014
11+
- cmdstream.xml ( 14094 bytes, from 2016-11-11 06:55:14)
12+
- copyright.xml ( 1597 bytes, from 2016-10-29 07:29:22)
13+
- common.xml ( 23344 bytes, from 2016-11-10 15:14:07)
14+
15+
Copyright (C) 2012-2016 by the following authors:
16+
- Wladimir J. van der Laan <laanwj@gmail.com>
17+
- Christian Gmeiner <christian.gmeiner@gmail.com>
18+
- Lucas Stach <l.stach@pengutronix.de>
19+
- Russell King <rmk@arm.linux.org.uk>
20+
21+
Permission is hereby granted, free of charge, to any person obtaining a
22+
copy of this software and associated documentation files (the "Software"),
23+
to deal in the Software without restriction, including without limitation
24+
the rights to use, copy, modify, merge, publish, distribute, sub license,
25+
and/or sell copies of the Software, and to permit persons to whom the
26+
Software is furnished to do so, subject to the following conditions:
27+
28+
The above copyright notice and this permission notice (including the
29+
next paragraph) shall be included in all copies or substantial portions
30+
of the Software.
31+
32+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
35+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
37+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
38+
DEALINGS IN THE SOFTWARE.
1539
*/
1640

1741

@@ -26,6 +50,7 @@ Copyright (C) 2014
2650
#define FE_OPCODE_STALL 0x00000009
2751
#define FE_OPCODE_CALL 0x0000000a
2852
#define FE_OPCODE_RETURN 0x0000000b
53+
#define FE_OPCODE_DRAW_INSTANCED 0x0000000c
2954
#define FE_OPCODE_CHIP_SELECT 0x0000000d
3055
#define PRIMITIVE_TYPE_POINTS 0x00000001
3156
#define PRIMITIVE_TYPE_LINES 0x00000002
@@ -214,5 +239,32 @@ Copyright (C) 2014
214239
#define VIV_FE_CHIP_SELECT_HEADER_ENABLE_CHIP1 0x00000002
215240
#define VIV_FE_CHIP_SELECT_HEADER_ENABLE_CHIP0 0x00000001
216241

242+
#define VIV_FE_DRAW_INSTANCED 0x00000000
243+
244+
#define VIV_FE_DRAW_INSTANCED_HEADER 0x00000000
245+
#define VIV_FE_DRAW_INSTANCED_HEADER_OP__MASK 0xf8000000
246+
#define VIV_FE_DRAW_INSTANCED_HEADER_OP__SHIFT 27
247+
#define VIV_FE_DRAW_INSTANCED_HEADER_OP_DRAW_INSTANCED 0x60000000
248+
#define VIV_FE_DRAW_INSTANCED_HEADER_INDEXED 0x00100000
249+
#define VIV_FE_DRAW_INSTANCED_HEADER_TYPE__MASK 0x000f0000
250+
#define VIV_FE_DRAW_INSTANCED_HEADER_TYPE__SHIFT 16
251+
#define VIV_FE_DRAW_INSTANCED_HEADER_TYPE(x) (((x) << VIV_FE_DRAW_INSTANCED_HEADER_TYPE__SHIFT) & VIV_FE_DRAW_INSTANCED_HEADER_TYPE__MASK)
252+
#define VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO__MASK 0x0000ffff
253+
#define VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO__SHIFT 0
254+
#define VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO(x) (((x) << VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO__SHIFT) & VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO__MASK)
255+
256+
#define VIV_FE_DRAW_INSTANCED_COUNT 0x00000004
257+
#define VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI__MASK 0xff000000
258+
#define VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI__SHIFT 24
259+
#define VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI(x) (((x) << VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI__SHIFT) & VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI__MASK)
260+
#define VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT__MASK 0x00ffffff
261+
#define VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT__SHIFT 0
262+
#define VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT(x) (((x) << VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT__SHIFT) & VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT__MASK)
263+
264+
#define VIV_FE_DRAW_INSTANCED_START 0x00000008
265+
#define VIV_FE_DRAW_INSTANCED_START_INDEX__MASK 0xffffffff
266+
#define VIV_FE_DRAW_INSTANCED_START_INDEX__SHIFT 0
267+
#define VIV_FE_DRAW_INSTANCED_START_INDEX(x) (((x) << VIV_FE_DRAW_INSTANCED_START_INDEX__SHIFT) & VIV_FE_DRAW_INSTANCED_START_INDEX__MASK)
268+
217269

218270
#endif /* CMDSTREAM_XML */

drivers/gpu/drm/etnaviv/etnaviv_cmd_parser.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ static bool etnaviv_validate_load_state(struct etna_validation_state *state,
143143
static uint8_t cmd_length[32] = {
144144
[FE_OPCODE_DRAW_PRIMITIVES] = 4,
145145
[FE_OPCODE_DRAW_INDEXED_PRIMITIVES] = 6,
146+
[FE_OPCODE_DRAW_INSTANCED] = 4,
146147
[FE_OPCODE_NOP] = 2,
147148
[FE_OPCODE_STALL] = 2,
148149
};

0 commit comments

Comments
 (0)