1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2009 VMware, Inc.
4bf215546Sopenharmony_ci * All Rights Reserved.
5bf215546Sopenharmony_ci *
6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
12bf215546Sopenharmony_ci * the following conditions:
13bf215546Sopenharmony_ci *
14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
16bf215546Sopenharmony_ci * of the Software.
17bf215546Sopenharmony_ci *
18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25bf215546Sopenharmony_ci *
26bf215546Sopenharmony_ci **************************************************************************/
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci/**
29bf215546Sopenharmony_ci * The rast code is concerned with rasterization of command bins.
30bf215546Sopenharmony_ci * Each screen tile has a bin associated with it.  To render the
31bf215546Sopenharmony_ci * scene we iterate over the tile bins and execute the commands
32bf215546Sopenharmony_ci * in each bin.
33bf215546Sopenharmony_ci * We'll do that with multiple threads...
34bf215546Sopenharmony_ci */
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ci#ifndef LP_RAST_H
38bf215546Sopenharmony_ci#define LP_RAST_H
39bf215546Sopenharmony_ci
40bf215546Sopenharmony_ci#include "pipe/p_compiler.h"
41bf215546Sopenharmony_ci#include "util/u_pack_color.h"
42bf215546Sopenharmony_ci#include "util/u_rect.h"
43bf215546Sopenharmony_ci#include "lp_jit.h"
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_ci
46bf215546Sopenharmony_cistruct lp_rasterizer;
47bf215546Sopenharmony_cistruct lp_scene;
48bf215546Sopenharmony_cistruct lp_fence;
49bf215546Sopenharmony_cistruct cmd_bin;
50bf215546Sopenharmony_ci
51bf215546Sopenharmony_ci#define FIXED_TYPE_WIDTH 64
52bf215546Sopenharmony_ci/** For sub-pixel positioning */
53bf215546Sopenharmony_ci#define FIXED_ORDER 8
54bf215546Sopenharmony_ci#define FIXED_ONE (1<<FIXED_ORDER)
55bf215546Sopenharmony_ci#define FIXED_SHIFT (FIXED_TYPE_WIDTH - 1)
56bf215546Sopenharmony_ci/** Maximum length of an edge in a primitive in pixels.
57bf215546Sopenharmony_ci *  If the framebuffer is large we have to think about fixed-point
58bf215546Sopenharmony_ci *  integer overflow. Coordinates need ((FIXED_TYPE_WIDTH/2) - 1) bits
59bf215546Sopenharmony_ci *  to be able to fit product of two such coordinates inside
60bf215546Sopenharmony_ci *  FIXED_TYPE_WIDTH, any larger and we could overflow a
61bf215546Sopenharmony_ci *  FIXED_TYPE_WIDTH_-bit int.
62bf215546Sopenharmony_ci */
63bf215546Sopenharmony_ci#define MAX_FIXED_LENGTH (1 << (((FIXED_TYPE_WIDTH/2) - 1) - FIXED_ORDER))
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ci#define MAX_FIXED_LENGTH32 (1 << (((32/2) - 1) - FIXED_ORDER))
66bf215546Sopenharmony_ci
67bf215546Sopenharmony_ci/* Rasterizer output size going to jit fs, width/height */
68bf215546Sopenharmony_ci#define LP_RASTER_BLOCK_SIZE 4
69bf215546Sopenharmony_ci
70bf215546Sopenharmony_ci#define LP_MAX_ACTIVE_BINNED_QUERIES 64
71bf215546Sopenharmony_ci
72bf215546Sopenharmony_ci#define IMUL64(a, b) (((int64_t)(a)) * ((int64_t)(b)))
73bf215546Sopenharmony_ci
74bf215546Sopenharmony_cistruct lp_rasterizer_task;
75bf215546Sopenharmony_ci
76bf215546Sopenharmony_ciextern const float lp_sample_pos_4x[4][2];
77bf215546Sopenharmony_ci
78bf215546Sopenharmony_ci/**
79bf215546Sopenharmony_ci * Rasterization state.
80bf215546Sopenharmony_ci * Objects of this type are put into the shared data bin and pointed
81bf215546Sopenharmony_ci * to by commands in the per-tile bins.
82bf215546Sopenharmony_ci */
83bf215546Sopenharmony_cistruct lp_rast_state {
84bf215546Sopenharmony_ci   /* State for the shader.  This also contains state which feeds into
85bf215546Sopenharmony_ci    * the fragment shader, such as blend color and alpha ref value.
86bf215546Sopenharmony_ci    */
87bf215546Sopenharmony_ci   struct lp_jit_context jit_context;
88bf215546Sopenharmony_ci
89bf215546Sopenharmony_ci   /* The shader itself.  Probably we also need to pass a pointer to
90bf215546Sopenharmony_ci    * the tile color/z/stencil data somehow
91bf215546Sopenharmony_ci     */
92bf215546Sopenharmony_ci   struct lp_fragment_shader_variant *variant;
93bf215546Sopenharmony_ci};
94bf215546Sopenharmony_ci
95bf215546Sopenharmony_ci
96bf215546Sopenharmony_ci/**
97bf215546Sopenharmony_ci * Texture blit offsets.
98bf215546Sopenharmony_ci */
99bf215546Sopenharmony_cistruct lp_rast_blit {
100bf215546Sopenharmony_ci   int16_t x0;
101bf215546Sopenharmony_ci   int16_t y0;
102bf215546Sopenharmony_ci};
103bf215546Sopenharmony_ci
104bf215546Sopenharmony_ci
105bf215546Sopenharmony_ci/**
106bf215546Sopenharmony_ci * Coefficients necessary to run the shader at a given location.
107bf215546Sopenharmony_ci * First coefficient is position.
108bf215546Sopenharmony_ci * These pointers point into the bin data buffer.
109bf215546Sopenharmony_ci */
110bf215546Sopenharmony_cistruct lp_rast_shader_inputs {
111bf215546Sopenharmony_ci   unsigned frontfacing:1;      /** True for front-facing */
112bf215546Sopenharmony_ci   unsigned disable:1;          /** Partially binned, disable this command */
113bf215546Sopenharmony_ci   unsigned is_blit:1;          /* blit */
114bf215546Sopenharmony_ci   unsigned viewport_index:4;  /* viewport index */
115bf215546Sopenharmony_ci   unsigned layer:11;
116bf215546Sopenharmony_ci   unsigned view_index:14;
117bf215546Sopenharmony_ci   unsigned stride;             /* how much to advance data between a0, dadx, dady */
118bf215546Sopenharmony_ci   unsigned pad[2];
119bf215546Sopenharmony_ci   /* followed by a0, dadx, dady and planes[] */
120bf215546Sopenharmony_ci};
121bf215546Sopenharmony_ci
122bf215546Sopenharmony_ci
123bf215546Sopenharmony_cistruct lp_rast_plane {
124bf215546Sopenharmony_ci   /* edge function values at minx,miny ?? */
125bf215546Sopenharmony_ci   int64_t c;
126bf215546Sopenharmony_ci
127bf215546Sopenharmony_ci   int32_t dcdx;
128bf215546Sopenharmony_ci   int32_t dcdy;
129bf215546Sopenharmony_ci
130bf215546Sopenharmony_ci   /* one-pixel sized trivial reject offsets for each plane */
131bf215546Sopenharmony_ci   uint32_t eo;
132bf215546Sopenharmony_ci   /*
133bf215546Sopenharmony_ci    * We rely on this struct being 64bit aligned (ideally it would be 128bit
134bf215546Sopenharmony_ci    * but that's quite the waste) and therefore on 32bit we need padding
135bf215546Sopenharmony_ci    * since otherwise (even with the 64bit number in there) it wouldn't be.
136bf215546Sopenharmony_ci    */
137bf215546Sopenharmony_ci   uint32_t pad;
138bf215546Sopenharmony_ci};
139bf215546Sopenharmony_ci
140bf215546Sopenharmony_ci
141bf215546Sopenharmony_ci/**
142bf215546Sopenharmony_ci * Rasterization information for a triangle known to be in this bin,
143bf215546Sopenharmony_ci * plus inputs to run the shader:
144bf215546Sopenharmony_ci * These fields are tile- and bin-independent.
145bf215546Sopenharmony_ci * Objects of this type are put into the lp_setup_context::data buffer.
146bf215546Sopenharmony_ci */
147bf215546Sopenharmony_cistruct lp_rast_triangle {
148bf215546Sopenharmony_ci#ifdef DEBUG
149bf215546Sopenharmony_ci   float v[3][2];
150bf215546Sopenharmony_ci   float pad0;
151bf215546Sopenharmony_ci   float pad1;
152bf215546Sopenharmony_ci#endif
153bf215546Sopenharmony_ci
154bf215546Sopenharmony_ci   /* inputs for the shader */
155bf215546Sopenharmony_ci   struct lp_rast_shader_inputs inputs;
156bf215546Sopenharmony_ci   /* planes are also allocated here */
157bf215546Sopenharmony_ci};
158bf215546Sopenharmony_ci
159bf215546Sopenharmony_ci
160bf215546Sopenharmony_ci#define RECT_PLANE_LEFT   0x1
161bf215546Sopenharmony_ci#define RECT_PLANE_RIGHT  0x2
162bf215546Sopenharmony_ci#define RECT_PLANE_TOP    0x4
163bf215546Sopenharmony_ci#define RECT_PLANE_BOTTOM 0x8
164bf215546Sopenharmony_ci
165bf215546Sopenharmony_ci/**
166bf215546Sopenharmony_ci * Rasterization information for a screen-aligned rectangle known to
167bf215546Sopenharmony_ci * be in this bin, plus inputs to run the shader:
168bf215546Sopenharmony_ci * These fields are tile- and bin-independent.
169bf215546Sopenharmony_ci * Objects of this type are put into the lp_setup_context::data buffer.
170bf215546Sopenharmony_ci */
171bf215546Sopenharmony_cistruct lp_rast_rectangle {
172bf215546Sopenharmony_ci#ifdef DEBUG
173bf215546Sopenharmony_ci   float v[2][2]; /**< diagonal corners */
174bf215546Sopenharmony_ci#endif
175bf215546Sopenharmony_ci
176bf215546Sopenharmony_ci   /* Rectangle boundaries in integer pixels:
177bf215546Sopenharmony_ci    */
178bf215546Sopenharmony_ci   struct u_rect box;
179bf215546Sopenharmony_ci
180bf215546Sopenharmony_ci   /* inputs for the shader */
181bf215546Sopenharmony_ci   struct lp_rast_shader_inputs inputs;
182bf215546Sopenharmony_ci};
183bf215546Sopenharmony_ci
184bf215546Sopenharmony_ci
185bf215546Sopenharmony_cistruct lp_rast_clear_rb {
186bf215546Sopenharmony_ci   union util_color color_val;
187bf215546Sopenharmony_ci   unsigned cbuf;
188bf215546Sopenharmony_ci};
189bf215546Sopenharmony_ci
190bf215546Sopenharmony_ci
191bf215546Sopenharmony_ci/*
192bf215546Sopenharmony_ci * Return the address (as float[][4]) of the FS input values which
193bf215546Sopenharmony_ci * are immediately after the 'inputs' object.
194bf215546Sopenharmony_ci */
195bf215546Sopenharmony_cistatic inline float(*
196bf215546Sopenharmony_ciGET_A0(const struct lp_rast_shader_inputs *inputs))[4]
197bf215546Sopenharmony_ci{
198bf215546Sopenharmony_ci   return (float (*)[4]) (inputs + 1);
199bf215546Sopenharmony_ci}
200bf215546Sopenharmony_ci
201bf215546Sopenharmony_ci/*
202bf215546Sopenharmony_ci * Return the address (as float[][4]) of the FS input partial derivatives
203bf215546Sopenharmony_ci * (w.r.t. X) which are after the 'inputs' object.
204bf215546Sopenharmony_ci */
205bf215546Sopenharmony_cistatic inline float(*
206bf215546Sopenharmony_ciGET_DADX(const struct lp_rast_shader_inputs *inputs))[4]
207bf215546Sopenharmony_ci{
208bf215546Sopenharmony_ci   const uint8_t *p = (const uint8_t *) (inputs + 1);
209bf215546Sopenharmony_ci   return (float (*)[4]) (p + 1 * inputs->stride);
210bf215546Sopenharmony_ci}
211bf215546Sopenharmony_ci
212bf215546Sopenharmony_ci/*
213bf215546Sopenharmony_ci * Return the address (as float[][4]) of the FS input partial derivatives
214bf215546Sopenharmony_ci * (w.r.t. Y) which are after the 'inputs' object.
215bf215546Sopenharmony_ci */
216bf215546Sopenharmony_cistatic inline float(*
217bf215546Sopenharmony_ciGET_DADY(const struct lp_rast_shader_inputs *inputs))[4]
218bf215546Sopenharmony_ci{
219bf215546Sopenharmony_ci   const uint8_t *p = (const uint8_t *) (inputs + 1);
220bf215546Sopenharmony_ci   return (float (*)[4]) (p + 2 * inputs->stride);
221bf215546Sopenharmony_ci}
222bf215546Sopenharmony_ci
223bf215546Sopenharmony_cistatic inline struct lp_rast_plane *
224bf215546Sopenharmony_ciGET_PLANES(const struct lp_rast_triangle *tri)
225bf215546Sopenharmony_ci{
226bf215546Sopenharmony_ci   const uint8_t *p = (const uint8_t *) (&tri->inputs + 1);
227bf215546Sopenharmony_ci   return (struct lp_rast_plane *) (p + 3 * tri->inputs.stride);
228bf215546Sopenharmony_ci}
229bf215546Sopenharmony_ci
230bf215546Sopenharmony_ci
231bf215546Sopenharmony_cistruct lp_rasterizer *
232bf215546Sopenharmony_cilp_rast_create( unsigned num_threads );
233bf215546Sopenharmony_ci
234bf215546Sopenharmony_civoid
235bf215546Sopenharmony_cilp_rast_destroy( struct lp_rasterizer * );
236bf215546Sopenharmony_ci
237bf215546Sopenharmony_civoid
238bf215546Sopenharmony_cilp_rast_queue_scene( struct lp_rasterizer *rast,
239bf215546Sopenharmony_ci                     struct lp_scene *scene );
240bf215546Sopenharmony_ci
241bf215546Sopenharmony_civoid
242bf215546Sopenharmony_cilp_rast_finish( struct lp_rasterizer *rast );
243bf215546Sopenharmony_ci
244bf215546Sopenharmony_ci
245bf215546Sopenharmony_ciunion lp_rast_cmd_arg {
246bf215546Sopenharmony_ci   const struct lp_rast_shader_inputs *shade_tile;
247bf215546Sopenharmony_ci   struct {
248bf215546Sopenharmony_ci      const struct lp_rast_triangle *tri;
249bf215546Sopenharmony_ci      unsigned plane_mask;
250bf215546Sopenharmony_ci   } triangle;
251bf215546Sopenharmony_ci   const struct lp_rast_rectangle *rectangle;
252bf215546Sopenharmony_ci   const struct lp_rast_state *set_state;
253bf215546Sopenharmony_ci   const struct lp_rast_clear_rb *clear_rb;
254bf215546Sopenharmony_ci   struct {
255bf215546Sopenharmony_ci      uint64_t value;
256bf215546Sopenharmony_ci      uint64_t mask;
257bf215546Sopenharmony_ci   } clear_zstencil;
258bf215546Sopenharmony_ci   struct lp_fence *fence;
259bf215546Sopenharmony_ci   struct llvmpipe_query *query_obj;
260bf215546Sopenharmony_ci};
261bf215546Sopenharmony_ci
262bf215546Sopenharmony_ci
263bf215546Sopenharmony_ci/* Cast wrappers.  Hopefully these compile to noops!
264bf215546Sopenharmony_ci */
265bf215546Sopenharmony_cistatic inline union lp_rast_cmd_arg
266bf215546Sopenharmony_cilp_rast_arg_inputs( const struct lp_rast_shader_inputs *shade_tile )
267bf215546Sopenharmony_ci{
268bf215546Sopenharmony_ci   union lp_rast_cmd_arg arg;
269bf215546Sopenharmony_ci   arg.shade_tile = shade_tile;
270bf215546Sopenharmony_ci   return arg;
271bf215546Sopenharmony_ci}
272bf215546Sopenharmony_ci
273bf215546Sopenharmony_ci
274bf215546Sopenharmony_cistatic inline union lp_rast_cmd_arg
275bf215546Sopenharmony_cilp_rast_arg_triangle( const struct lp_rast_triangle *triangle,
276bf215546Sopenharmony_ci                      unsigned plane_mask)
277bf215546Sopenharmony_ci{
278bf215546Sopenharmony_ci   union lp_rast_cmd_arg arg;
279bf215546Sopenharmony_ci   arg.triangle.tri = triangle;
280bf215546Sopenharmony_ci   arg.triangle.plane_mask = plane_mask;
281bf215546Sopenharmony_ci   return arg;
282bf215546Sopenharmony_ci}
283bf215546Sopenharmony_ci
284bf215546Sopenharmony_ci
285bf215546Sopenharmony_ci/**
286bf215546Sopenharmony_ci * Build argument for a contained triangle.
287bf215546Sopenharmony_ci *
288bf215546Sopenharmony_ci * All planes are enabled, so instead of the plane mask we pass the upper
289bf215546Sopenharmony_ci * left coordinates of the a block that fully encloses the triangle.
290bf215546Sopenharmony_ci */
291bf215546Sopenharmony_cistatic inline union lp_rast_cmd_arg
292bf215546Sopenharmony_cilp_rast_arg_triangle_contained( const struct lp_rast_triangle *triangle,
293bf215546Sopenharmony_ci                                unsigned x, unsigned y)
294bf215546Sopenharmony_ci{
295bf215546Sopenharmony_ci   union lp_rast_cmd_arg arg;
296bf215546Sopenharmony_ci   arg.triangle.tri = triangle;
297bf215546Sopenharmony_ci   arg.triangle.plane_mask = x | (y << 8);
298bf215546Sopenharmony_ci   return arg;
299bf215546Sopenharmony_ci}
300bf215546Sopenharmony_ci
301bf215546Sopenharmony_ci
302bf215546Sopenharmony_cistatic inline union lp_rast_cmd_arg
303bf215546Sopenharmony_cilp_rast_arg_rectangle( const struct lp_rast_rectangle *rectangle )
304bf215546Sopenharmony_ci{
305bf215546Sopenharmony_ci   union lp_rast_cmd_arg arg;
306bf215546Sopenharmony_ci   arg.rectangle = rectangle;
307bf215546Sopenharmony_ci   return arg;
308bf215546Sopenharmony_ci}
309bf215546Sopenharmony_ci
310bf215546Sopenharmony_ci
311bf215546Sopenharmony_cistatic inline union lp_rast_cmd_arg
312bf215546Sopenharmony_cilp_rast_arg_state( const struct lp_rast_state *state )
313bf215546Sopenharmony_ci{
314bf215546Sopenharmony_ci   union lp_rast_cmd_arg arg;
315bf215546Sopenharmony_ci   arg.set_state = state;
316bf215546Sopenharmony_ci   return arg;
317bf215546Sopenharmony_ci}
318bf215546Sopenharmony_ci
319bf215546Sopenharmony_ci
320bf215546Sopenharmony_cistatic inline union lp_rast_cmd_arg
321bf215546Sopenharmony_cilp_rast_arg_fence( struct lp_fence *fence )
322bf215546Sopenharmony_ci{
323bf215546Sopenharmony_ci   union lp_rast_cmd_arg arg;
324bf215546Sopenharmony_ci   arg.fence = fence;
325bf215546Sopenharmony_ci   return arg;
326bf215546Sopenharmony_ci}
327bf215546Sopenharmony_ci
328bf215546Sopenharmony_ci
329bf215546Sopenharmony_cistatic inline union lp_rast_cmd_arg
330bf215546Sopenharmony_cilp_rast_arg_clearzs( uint64_t value, uint64_t mask )
331bf215546Sopenharmony_ci{
332bf215546Sopenharmony_ci   union lp_rast_cmd_arg arg;
333bf215546Sopenharmony_ci   arg.clear_zstencil.value = value;
334bf215546Sopenharmony_ci   arg.clear_zstencil.mask = mask;
335bf215546Sopenharmony_ci   return arg;
336bf215546Sopenharmony_ci}
337bf215546Sopenharmony_ci
338bf215546Sopenharmony_ci
339bf215546Sopenharmony_cistatic inline union lp_rast_cmd_arg
340bf215546Sopenharmony_cilp_rast_arg_query( struct llvmpipe_query *pq )
341bf215546Sopenharmony_ci{
342bf215546Sopenharmony_ci   union lp_rast_cmd_arg arg;
343bf215546Sopenharmony_ci   arg.query_obj = pq;
344bf215546Sopenharmony_ci   return arg;
345bf215546Sopenharmony_ci}
346bf215546Sopenharmony_ci
347bf215546Sopenharmony_ci
348bf215546Sopenharmony_cistatic inline union lp_rast_cmd_arg
349bf215546Sopenharmony_cilp_rast_arg_null( void )
350bf215546Sopenharmony_ci{
351bf215546Sopenharmony_ci   union lp_rast_cmd_arg arg;
352bf215546Sopenharmony_ci   arg.set_state = NULL;
353bf215546Sopenharmony_ci   return arg;
354bf215546Sopenharmony_ci}
355bf215546Sopenharmony_ci
356bf215546Sopenharmony_ci
357bf215546Sopenharmony_ci/**
358bf215546Sopenharmony_ci * Binnable Commands.
359bf215546Sopenharmony_ci * These get put into bins by the setup code and are called when
360bf215546Sopenharmony_ci * the bins are executed.
361bf215546Sopenharmony_ci */
362bf215546Sopenharmony_cienum lp_rast_op {
363bf215546Sopenharmony_ci  LP_RAST_OP_CLEAR_COLOR =       0x0,
364bf215546Sopenharmony_ci  LP_RAST_OP_CLEAR_ZSTENCIL =    0x1,
365bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_1 =        0x2,
366bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_2 =        0x3,
367bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_3 =        0x4,
368bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_4 =        0x5,
369bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_5 =        0x6,
370bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_6 =        0x7,
371bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_7 =        0x8,
372bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_8 =        0x9,
373bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_3_4 =      0xa,
374bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_3_16 =     0xb,
375bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_4_16 =     0xc,
376bf215546Sopenharmony_ci  LP_RAST_OP_SHADE_TILE =        0xd,
377bf215546Sopenharmony_ci  LP_RAST_OP_SHADE_TILE_OPAQUE = 0xe,
378bf215546Sopenharmony_ci  LP_RAST_OP_BEGIN_QUERY =       0xf,
379bf215546Sopenharmony_ci  LP_RAST_OP_END_QUERY =         0x10,
380bf215546Sopenharmony_ci  LP_RAST_OP_SET_STATE =         0x11,
381bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_32_1 =     0x12,
382bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_32_2 =     0x13,
383bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_32_3 =     0x14,
384bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_32_4 =     0x15,
385bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_32_5 =     0x16,
386bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_32_6 =     0x17,
387bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_32_7 =     0x18,
388bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_32_8 =     0x19,
389bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_32_3_4 =   0x1a,
390bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_32_3_16 =  0x1b,
391bf215546Sopenharmony_ci  LP_RAST_OP_TRIANGLE_32_4_16 =  0x1c,
392bf215546Sopenharmony_ci  LP_RAST_OP_MS_TRIANGLE_1 =     0x1d,
393bf215546Sopenharmony_ci  LP_RAST_OP_MS_TRIANGLE_2 =     0x1e,
394bf215546Sopenharmony_ci  LP_RAST_OP_MS_TRIANGLE_3 =     0x1f,
395bf215546Sopenharmony_ci  LP_RAST_OP_MS_TRIANGLE_4 =     0x20,
396bf215546Sopenharmony_ci  LP_RAST_OP_MS_TRIANGLE_5 =     0x21,
397bf215546Sopenharmony_ci  LP_RAST_OP_MS_TRIANGLE_6 =     0x22,
398bf215546Sopenharmony_ci  LP_RAST_OP_MS_TRIANGLE_7 =     0x23,
399bf215546Sopenharmony_ci  LP_RAST_OP_MS_TRIANGLE_8 =     0x24,
400bf215546Sopenharmony_ci  LP_RAST_OP_MS_TRIANGLE_3_4 =   0x25,
401bf215546Sopenharmony_ci  LP_RAST_OP_MS_TRIANGLE_3_16 =  0x26,
402bf215546Sopenharmony_ci  LP_RAST_OP_MS_TRIANGLE_4_16 =  0x27,
403bf215546Sopenharmony_ci  LP_RAST_OP_RECTANGLE =         0x28,  /* Keep at end */
404bf215546Sopenharmony_ci  LP_RAST_OP_BLIT =              0x29,  /* Keep at end */
405bf215546Sopenharmony_ci  LP_RAST_OP_MAX =               0x2a,
406bf215546Sopenharmony_ci  LP_RAST_OP_MASK =              0xff
407bf215546Sopenharmony_ci};
408bf215546Sopenharmony_ci
409bf215546Sopenharmony_ci
410bf215546Sopenharmony_ci/* Returned by characterize_bin:
411bf215546Sopenharmony_ci */
412bf215546Sopenharmony_ci#define LP_RAST_FLAGS_TRI            (0x1)
413bf215546Sopenharmony_ci#define LP_RAST_FLAGS_RECT           (0x2)
414bf215546Sopenharmony_ci#define LP_RAST_FLAGS_TILE           (0x4)
415bf215546Sopenharmony_ci#define LP_RAST_FLAGS_BLIT           (0x8)
416bf215546Sopenharmony_ci
417bf215546Sopenharmony_cistruct lp_bin_info {
418bf215546Sopenharmony_ci   unsigned type:8;    // bitmask of LP_RAST_FLAGS_x
419bf215546Sopenharmony_ci   unsigned count:24;
420bf215546Sopenharmony_ci};
421bf215546Sopenharmony_ci
422bf215546Sopenharmony_cistruct lp_bin_info
423bf215546Sopenharmony_cilp_characterize_bin(const struct cmd_bin *bin);
424bf215546Sopenharmony_ci
425bf215546Sopenharmony_civoid
426bf215546Sopenharmony_cilp_debug_bins( struct lp_scene *scene );
427bf215546Sopenharmony_ci
428bf215546Sopenharmony_civoid
429bf215546Sopenharmony_cilp_debug_draw_bins_by_cmd_length( struct lp_scene *scene );
430bf215546Sopenharmony_ci
431bf215546Sopenharmony_civoid
432bf215546Sopenharmony_cilp_debug_draw_bins_by_coverage( struct lp_scene *scene );
433bf215546Sopenharmony_ci
434bf215546Sopenharmony_civoid lp_rast_fence(struct lp_rasterizer *rast,
435bf215546Sopenharmony_ci                   struct lp_fence **fence);
436bf215546Sopenharmony_ci#endif
437