Home | History | Annotate | Download | only in core
      1 /*
      2  * Mesa 3-D graphics library
      3  *
      4  * Copyright (C) 2012-2013 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_DEV_H
     29 #define ILO_DEV_H
     30 
     31 #include "ilo_core.h"
     32 
     33 #define ILO_GEN(gen) ((int) (gen * 100))
     34 
     35 #define ILO_DEV_ASSERT(dev, min_gen, max_gen) \
     36    ilo_dev_assert(dev, ILO_GEN(min_gen), ILO_GEN(max_gen))
     37 
     38 struct intel_winsys;
     39 
     40 struct ilo_dev {
     41    struct intel_winsys *winsys;
     42 
     43    /* these mirror intel_winsys_info */
     44    int devid;
     45    size_t aperture_total;
     46    size_t aperture_mappable;
     47    bool has_llc;
     48    bool has_address_swizzling;
     49    bool has_logical_context;
     50    bool has_ppgtt;
     51    bool has_timestamp;
     52    bool has_gen7_sol_reset;
     53 
     54    /* use ilo_dev_gen() to access */
     55    int gen_opaque;
     56 
     57    int gt;
     58    int eu_count;
     59    int thread_count;
     60    int urb_size;
     61 };
     62 
     63 bool
     64 ilo_dev_init(struct ilo_dev *dev, struct intel_winsys *winsys);
     65 
     66 static inline int
     67 ilo_dev_gen(const struct ilo_dev *dev)
     68 {
     69    return dev->gen_opaque;
     70 }
     71 
     72 static inline void
     73 ilo_dev_assert(const struct ilo_dev *dev, int min_opqaue, int max_opqaue)
     74 {
     75    assert(dev->gen_opaque >= min_opqaue && dev->gen_opaque <= max_opqaue);
     76 }
     77 
     78 #endif /* ILO_DEV_H */
     79