i965: Move intel_context::perf_debug to brw_context.
[mesa.git] / src / mesa / drivers / dri / i965 / intel_context.h
index 60fcfe3c9db0d64275bbf73402f550ea9cde5536..2713eb852a6855cc7347b45dc4224f2aa5ee5a33 100644 (file)
@@ -113,68 +113,13 @@ struct intel_context
 {
    struct gl_context ctx;  /**< base class, must be first field */
 
-   struct
-   {
-      void (*destroy) (struct intel_context * intel);
-      void (*finish_batch) (struct intel_context * intel);
-      void (*new_batch) (struct intel_context * intel);
-
-      void (*invalidate_state) (struct intel_context *intel,
-                               GLuint new_state);
-
-      void (*debug_batch)(struct intel_context *intel);
-      void (*annotate_aub)(struct intel_context *intel);
-      bool (*render_target_supported)(struct intel_context *intel,
-                                     struct gl_renderbuffer *rb);
-
-      /** Can HiZ be enabled on a depthbuffer of the given format? */
-      bool (*is_hiz_depth_format)(struct intel_context *intel,
-                                 gl_format format);
-
-      void (*update_texture_surface)(struct gl_context *ctx,
-                                     unsigned unit,
-                                     uint32_t *binding_table,
-                                     unsigned surf_index);
-      void (*update_renderbuffer_surface)(struct brw_context *brw,
-                                         struct gl_renderbuffer *rb,
-                                         bool layered,
-                                         unsigned unit);
-      void (*update_null_renderbuffer_surface)(struct brw_context *brw,
-                                              unsigned unit);
-      void (*create_constant_surface)(struct brw_context *brw,
-                                     drm_intel_bo *bo,
-                                     uint32_t offset,
-                                     uint32_t size,
-                                     uint32_t *out_offset,
-                                      bool dword_pitch);
-
-      /**
-       * Send the appropriate state packets to configure depth, stencil, and
-       * HiZ buffers (i965+ only)
-       */
-      void (*emit_depth_stencil_hiz)(struct brw_context *brw,
-                                     struct intel_mipmap_tree *depth_mt,
-                                     uint32_t depth_offset,
-                                     uint32_t depthbuffer_format,
-                                     uint32_t depth_surface_type,
-                                     struct intel_mipmap_tree *stencil_mt,
-                                     bool hiz, bool separate_stencil,
-                                     uint32_t width, uint32_t height,
-                                     uint32_t tile_x, uint32_t tile_y);
-
-   } vtbl;
-
    GLuint NewGLState;
  
-   dri_bufmgr *bufmgr;
-   unsigned int maxBatchSize;
-
    /**
     * Generation number of the hardware: 2 is 8xx, 3 is 9xx pre-965, 4 is 965.
     */
    int gen;
    int gt;
-   bool needs_ff_sync;
    bool is_haswell;
    bool is_baytrail;
    bool is_g4x;
@@ -184,21 +129,6 @@ struct intel_context
    bool has_llc;
    bool has_swizzling;
 
-   drm_intel_context *hw_ctx;
-
-   struct intel_batchbuffer batch;
-
-   drm_intel_bo *first_post_swapbuffers_batch;
-   bool need_throttle;
-   bool no_batch_wrap;
-
-   /**
-    * Set if we're either a debug context or the INTEL_DEBUG=perf environment
-    * variable is set, this is the flag indicating to do expensive work that
-    * might lead to a perf_debug() call.
-    */
-   bool perf_debug;
-
    struct {
       drm_intel_bo *bo;
       GLuint offset;
@@ -209,50 +139,10 @@ struct intel_context
 
    uint32_t max_gtt_map_object_size;
 
-   GLuint stats_wm;
-
-   bool no_rast;
-   bool always_flush_batch;
-   bool always_flush_cache;
-   bool disable_throttling;
-
-   GLenum reduced_primitive;
-
-   /**
-    * Set if rendering has occured to the drawable's front buffer.
-    *
-    * This is used in the DRI2 case to detect that glFlush should also copy
-    * the contents of the fake front buffer to the real front buffer.
-    */
-   bool front_buffer_dirty;
-
-   /**
-    * Track whether front-buffer rendering is currently enabled
-    *
-    * A separate flag is used to track this in order to support MRT more
-    * easily.
-    */
-   bool is_front_buffer_rendering;
-   /**
-    * Track whether front-buffer is the current read target.
-    *
-    * This is closely associated with is_front_buffer_rendering, but may
-    * be set separately.  The DRI2 fake front buffer must be referenced
-    * either way.
-    */
-   bool is_front_buffer_reading;
-
    int driFd;
 
    __DRIcontext *driContext;
    struct intel_screen *intelScreen;
-   void (*saved_viewport)(struct gl_context * ctx,
-                         GLint x, GLint y, GLsizei width, GLsizei height);
-
-   /**
-    * Configuration cache
-    */
-   driOptionCache optionCache;
 };
 
 /**
@@ -361,8 +251,8 @@ extern int INTEL_DEBUG;
    static GLuint msg_id = 0;                                    \
    if (unlikely(INTEL_DEBUG & DEBUG_PERF))                      \
       dbg_printf(__VA_ARGS__);                                  \
-   if (intel->perf_debug)                                       \
-      _mesa_gl_debug(&intel->ctx, &msg_id,                      \
+   if (brw->perf_debug)                                         \
+      _mesa_gl_debug(&brw->intel.ctx, &msg_id,                  \
                      MESA_DEBUG_TYPE_PERFORMANCE,               \
                      MESA_DEBUG_SEVERITY_MEDIUM,                \
                      __VA_ARGS__);                              \
@@ -388,7 +278,7 @@ extern int INTEL_DEBUG;
  * intel_context.c:
  */
 
-extern bool intelInitContext(struct intel_context *intel,
+extern bool intelInitContext(struct brw_context *brw,
                              int api,
                              unsigned major_version,
                              unsigned minor_version,
@@ -407,63 +297,6 @@ extern void intelInitDriverFunctions(struct dd_function_table *functions);
 
 void intel_init_syncobj_functions(struct dd_function_table *functions);
 
-
-/* ================================================================
- * intel_state.c:
- */
-
-#define COMPAREFUNC_ALWAYS             0
-#define COMPAREFUNC_NEVER              0x1
-#define COMPAREFUNC_LESS               0x2
-#define COMPAREFUNC_EQUAL              0x3
-#define COMPAREFUNC_LEQUAL             0x4
-#define COMPAREFUNC_GREATER            0x5
-#define COMPAREFUNC_NOTEQUAL           0x6
-#define COMPAREFUNC_GEQUAL             0x7
-
-#define STENCILOP_KEEP                 0
-#define STENCILOP_ZERO                 0x1
-#define STENCILOP_REPLACE              0x2
-#define STENCILOP_INCRSAT              0x3
-#define STENCILOP_DECRSAT              0x4
-#define STENCILOP_INCR                 0x5
-#define STENCILOP_DECR                 0x6
-#define STENCILOP_INVERT               0x7
-
-#define LOGICOP_CLEAR                  0
-#define LOGICOP_NOR                    0x1
-#define LOGICOP_AND_INV                0x2
-#define LOGICOP_COPY_INV               0x3
-#define LOGICOP_AND_RVRSE              0x4
-#define LOGICOP_INV                    0x5
-#define LOGICOP_XOR                    0x6
-#define LOGICOP_NAND                   0x7
-#define LOGICOP_AND                    0x8
-#define LOGICOP_EQUIV                  0x9
-#define LOGICOP_NOOP                   0xa
-#define LOGICOP_OR_INV                 0xb
-#define LOGICOP_COPY                   0xc
-#define LOGICOP_OR_RVRSE               0xd
-#define LOGICOP_OR                     0xe
-#define LOGICOP_SET                    0xf
-
-#define BLENDFACT_ZERO                 0x01
-#define BLENDFACT_ONE                  0x02
-#define BLENDFACT_SRC_COLR             0x03
-#define BLENDFACT_INV_SRC_COLR                 0x04
-#define BLENDFACT_SRC_ALPHA            0x05
-#define BLENDFACT_INV_SRC_ALPHA        0x06
-#define BLENDFACT_DST_ALPHA            0x07
-#define BLENDFACT_INV_DST_ALPHA        0x08
-#define BLENDFACT_DST_COLR             0x09
-#define BLENDFACT_INV_DST_COLR         0x0a
-#define BLENDFACT_SRC_ALPHA_SATURATE   0x0b
-#define BLENDFACT_CONST_COLOR          0x0c
-#define BLENDFACT_INV_CONST_COLOR      0x0d
-#define BLENDFACT_CONST_ALPHA          0x0e
-#define BLENDFACT_INV_CONST_ALPHA      0x0f
-#define BLENDFACT_MASK                 0x0f
-
 enum {
    DRI_CONF_BO_REUSE_DISABLED,
    DRI_CONF_BO_REUSE_ALL
@@ -476,14 +309,16 @@ extern int intel_translate_logic_op(GLenum opcode);
 
 void intel_update_renderbuffers(__DRIcontext *context,
                                __DRIdrawable *drawable);
-void intel_prepare_render(struct intel_context *intel);
+void intel_prepare_render(struct brw_context *brw);
 
 void
-intel_resolve_for_dri2_flush(struct intel_context *intel,
+intel_resolve_for_dri2_flush(struct brw_context *brw,
                              __DRIdrawable *drawable);
 
 extern void
 intelInitExtensions(struct gl_context *ctx);
+extern void
+intelInitClearFuncs(struct dd_function_table *functions);
 
 /*======================================================================
  * Inline conversion functions.