Home | History | Annotate | Download | only in core
      1 /*
      2  * Mesa 3-D graphics library
      3  *
      4  * Copyright (C) 2015 LunarG, Inc.
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the "Software"),
      8  * to deal in the Software without restriction, including without limitation
      9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  * and/or sell copies of the Software, and to permit persons to whom the
     11  * Software is furnished to do so, subject to the following conditions:
     12  *
     13  * The above copyright notice and this permission notice shall be included
     14  * in all copies or substantial portions of the Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     22  * DEALINGS IN THE SOFTWARE.
     23  *
     24  * Authors:
     25  *    Chia-I Wu <olv (at) lunarg.com>
     26  */
     27 
     28 #ifndef ILO_STATE_URB_H
     29 #define ILO_STATE_URB_H
     30 
     31 #include "genhw/genhw.h"
     32 
     33 #include "ilo_core.h"
     34 #include "ilo_dev.h"
     35 
     36 enum ilo_state_urb_dirty_bits {
     37    ILO_STATE_URB_3DSTATE_PUSH_CONSTANT_ALLOC_VS = (1 << 0),
     38    ILO_STATE_URB_3DSTATE_PUSH_CONSTANT_ALLOC_HS = (1 << 1),
     39    ILO_STATE_URB_3DSTATE_PUSH_CONSTANT_ALLOC_DS = (1 << 2),
     40    ILO_STATE_URB_3DSTATE_PUSH_CONSTANT_ALLOC_GS = (1 << 3),
     41    ILO_STATE_URB_3DSTATE_PUSH_CONSTANT_ALLOC_PS = (1 << 4),
     42    ILO_STATE_URB_3DSTATE_URB_VS                 = (1 << 5),
     43    ILO_STATE_URB_3DSTATE_URB_HS                 = (1 << 6),
     44    ILO_STATE_URB_3DSTATE_URB_DS                 = (1 << 7),
     45    ILO_STATE_URB_3DSTATE_URB_GS                 = (1 << 8),
     46 };
     47 
     48 /**
     49  * URB entry allocation sizes and sizes of constant data extracted from PCBs
     50  * to threads.
     51  */
     52 struct ilo_state_urb_info {
     53    bool gs_enable;
     54 
     55    bool vs_const_data;
     56    bool hs_const_data;
     57    bool ds_const_data;
     58    bool gs_const_data;
     59    bool ps_const_data;
     60 
     61    uint16_t ve_entry_size;
     62    uint16_t vs_entry_size;
     63    uint16_t hs_entry_size;
     64    uint16_t ds_entry_size;
     65    uint16_t gs_entry_size;
     66 };
     67 
     68 struct ilo_state_urb {
     69    uint32_t pcb[5];
     70    uint32_t urb[4];
     71 };
     72 
     73 struct ilo_state_urb_delta {
     74    uint32_t dirty;
     75 };
     76 
     77 bool
     78 ilo_state_urb_init(struct ilo_state_urb *urb,
     79                    const struct ilo_dev *dev,
     80                    const struct ilo_state_urb_info *info);
     81 
     82 bool
     83 ilo_state_urb_init_for_rectlist(struct ilo_state_urb *urb,
     84                                 const struct ilo_dev *dev,
     85                                 uint8_t vf_attr_count);
     86 
     87 bool
     88 ilo_state_urb_set_info(struct ilo_state_urb *urb,
     89                        const struct ilo_dev *dev,
     90                        const struct ilo_state_urb_info *info);
     91 
     92 void
     93 ilo_state_urb_full_delta(const struct ilo_state_urb *urb,
     94                          const struct ilo_dev *dev,
     95                          struct ilo_state_urb_delta *delta);
     96 
     97 void
     98 ilo_state_urb_get_delta(const struct ilo_state_urb *urb,
     99                         const struct ilo_dev *dev,
    100                         const struct ilo_state_urb *old,
    101                         struct ilo_state_urb_delta *delta);
    102 
    103 #endif /* ILO_STATE_URB_H */
    104