i965: Move device info initialization to common code
[mesa.git] / src / intel / dev / gen_device_info.h
index 4d08f0dfeddd9f450a0632d9d97d3c2ede4e307f..d1c7230b0ffb514ffa4cf20a898adf94828af0be 100644 (file)
@@ -46,6 +46,7 @@ struct drm_i915_query_topology_info;
 struct gen_device_info
 {
    int gen; /**< Generation number: 4, 5, 6, 7, ... */
+   int revision;
    int gt;
 
    bool is_g4x;
@@ -73,6 +74,7 @@ struct gen_device_info
    bool has_surface_tile_offset;
    bool supports_simd16_3src;
    bool has_resource_streamer;
+   bool disable_ccs_repack;
 
    /**
     * \name Intel hardware quirks
@@ -241,19 +243,41 @@ struct gen_device_info
     */
    uint64_t timestamp_frequency;
 
+   /**
+    * ID to put into the .aub files.
+    */
+   int simulator_id;
+
+   /**
+    * holds the pci device id
+    */
+   uint32_t chipset_id;
+
+   /**
+    * no_hw is true when the chipset_id pci device id has been overridden
+    */
+   bool no_hw;
    /** @} */
 };
 
 #define gen_device_info_is_9lp(devinfo) \
    ((devinfo)->is_broxton || (devinfo)->is_geminilake)
 
+static inline bool
+gen_device_info_subslice_available(const struct gen_device_info *devinfo,
+                                   int slice, int subslice)
+{
+   return (devinfo->subslice_masks[slice * devinfo->subslice_slice_stride +
+                                   subslice / 8] & (1U << (subslice % 8))) != 0;
+}
+
 int gen_get_pci_device_id_override(void);
 int gen_device_name_to_pci_device_id(const char *name);
 bool gen_get_device_info(int devid, struct gen_device_info *devinfo);
 const char *gen_get_device_name(int devid);
 
 /* Used with SLICE_MASK/SUBSLICE_MASK values from DRM_I915_GETPARAM. */
-void gen_device_info_update_from_masks(struct gen_device_info *devinfo,
+bool gen_device_info_update_from_masks(struct gen_device_info *devinfo,
                                        uint32_t slice_mask,
                                        uint32_t subslice_mask,
                                        uint32_t n_eus);
@@ -261,6 +285,15 @@ void gen_device_info_update_from_masks(struct gen_device_info *devinfo,
 void gen_device_info_update_from_topology(struct gen_device_info *devinfo,
                                           const struct drm_i915_query_topology_info *topology);
 
+static inline uint64_t
+gen_device_info_timebase_scale(const struct gen_device_info *devinfo,
+                               uint64_t gpu_timestamp)
+{
+   return (1000000000ull * gpu_timestamp) / devinfo->timestamp_frequency;
+}
+
+bool gen_get_device_info_from_fd(int fh, struct gen_device_info *devinfo);
+
 #ifdef __cplusplus
 }
 #endif