"Fossies" - the Fresh Open Source Software Archive

Member "mesa-20.1.8/src/gallium/drivers/freedreno/a2xx/ir2.h" (16 Sep 2020, 2686 Bytes) of package /linux/misc/mesa-20.1.8.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ir2.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) 2018 Jonathan Marek <jonathan@marek.ca>
    3  *
    4  * Permission is hereby granted, free of charge, to any person obtaining a
    5  * copy of this software and associated documentation files (the "Software"),
    6  * to deal in the Software without restriction, including without limitation
    7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    8  * and/or sell copies of the Software, and to permit persons to whom the
    9  * Software is furnished to do so, subject to the following conditions:
   10  *
   11  * The above copyright notice and this permission notice (including the next
   12  * paragraph) shall be included in all copies or substantial portions of the
   13  * Software.
   14  *
   15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   21  * SOFTWARE.
   22  *
   23  * Authors:
   24  *    Jonathan Marek <jonathan@marek.ca>
   25  */
   26 
   27 #ifndef IR2_H_
   28 #define IR2_H_
   29 
   30 #include "compiler/nir/nir.h"
   31 #include "pipe/p_context.h"
   32 
   33 struct ir2_fetch_info {
   34     /* dword offset of the fetch instruction */
   35     uint16_t offset;
   36     union {
   37         /* swizzle to merge with tgsi swizzle */
   38         struct {
   39             uint16_t dst_swiz;
   40         } vtx;
   41         /* sampler id to patch const_idx */
   42         struct {
   43             uint16_t samp_id;
   44             uint8_t src_swiz;
   45         } tex;
   46     };
   47 };
   48 
   49 struct ir2_shader_info {
   50     /* compiler shader */
   51     uint32_t *dwords;
   52 
   53     /* size of the compiled shader in dwords */
   54     uint16_t sizedwords;
   55 
   56     /* highest GPR # used by shader */
   57     int8_t max_reg;
   58 
   59     /* offset in dwords of first MEMORY export CF (for a20x hw binning) */
   60     int16_t mem_export_ptr;
   61 
   62     /* fetch instruction info for patching */
   63     uint16_t num_fetch_instrs;
   64     struct ir2_fetch_info fetch_info[64];
   65 };
   66 
   67 struct ir2_frag_linkage {
   68     unsigned inputs_count;
   69     struct {
   70         uint8_t slot;
   71         uint8_t ncomp;
   72     } inputs[16];
   73 
   74     /* driver_location of fragcoord.zw, -1 if not used */
   75     int fragcoord;
   76 };
   77 
   78 struct ir2_shader_variant {
   79     struct ir2_shader_info info;
   80     struct ir2_frag_linkage f;
   81 };
   82 
   83 struct fd2_shader_stateobj;
   84 struct tgsi_token;
   85 
   86 void ir2_compile(struct fd2_shader_stateobj *so, unsigned variant,
   87         struct fd2_shader_stateobj *fp);
   88 
   89 struct nir_shader *ir2_tgsi_to_nir(const struct tgsi_token *tokens,
   90                    struct pipe_screen *screen);
   91 
   92 const nir_shader_compiler_options *ir2_get_compiler_options(void);
   93 
   94 int ir2_optimize_nir(nir_shader *s, bool lower);
   95 
   96 #endif                          /* IR2_H_ */