struct brw_context;
struct brw_inst;
struct brw_vs_prog_key;
-struct brw_vec4_prog_key;
+struct brw_vue_prog_key;
struct brw_wm_prog_key;
struct brw_wm_prog_data;
+enum brw_cache_id {
+ BRW_CACHE_FS_PROG,
+ BRW_CACHE_BLORP_BLIT_PROG,
+ BRW_CACHE_SF_PROG,
+ BRW_CACHE_VS_PROG,
+ BRW_CACHE_FF_GS_PROG,
+ BRW_CACHE_GS_PROG,
+ BRW_CACHE_CLIP_PROG,
+
+ BRW_MAX_CACHE
+};
+
enum brw_state_id {
- BRW_STATE_URB_FENCE,
+ /* brw_cache_ids must come first - see brw_state_cache.c */
+ BRW_STATE_URB_FENCE = BRW_MAX_CACHE,
BRW_STATE_FRAGMENT_PROGRAM,
BRW_STATE_GEOMETRY_PROGRAM,
BRW_STATE_VERTEX_PROGRAM,
BRW_STATE_INTERPOLATION_MAP,
BRW_STATE_PUSH_CONSTANT_ALLOCATION,
BRW_STATE_NUM_SAMPLES,
+ BRW_STATE_TEXTURE_BUFFER,
+ BRW_STATE_GEN4_UNIT_STATE,
+ BRW_STATE_CC_VP,
+ BRW_STATE_SF_VP,
+ BRW_STATE_CLIP_VP,
+ BRW_STATE_SAMPLER_STATE_TABLE,
+ BRW_STATE_VS_ATTRIB_WORKAROUNDS,
BRW_NUM_STATE_BITS
};
-#define BRW_NEW_URB_FENCE (1 << BRW_STATE_URB_FENCE)
-#define BRW_NEW_FRAGMENT_PROGRAM (1 << BRW_STATE_FRAGMENT_PROGRAM)
-#define BRW_NEW_GEOMETRY_PROGRAM (1 << BRW_STATE_GEOMETRY_PROGRAM)
-#define BRW_NEW_VERTEX_PROGRAM (1 << BRW_STATE_VERTEX_PROGRAM)
-#define BRW_NEW_CURBE_OFFSETS (1 << BRW_STATE_CURBE_OFFSETS)
-#define BRW_NEW_REDUCED_PRIMITIVE (1 << BRW_STATE_REDUCED_PRIMITIVE)
-#define BRW_NEW_PRIMITIVE (1 << BRW_STATE_PRIMITIVE)
-#define BRW_NEW_CONTEXT (1 << BRW_STATE_CONTEXT)
-#define BRW_NEW_PSP (1 << BRW_STATE_PSP)
-#define BRW_NEW_SURFACES (1 << BRW_STATE_SURFACES)
-#define BRW_NEW_VS_BINDING_TABLE (1 << BRW_STATE_VS_BINDING_TABLE)
-#define BRW_NEW_GS_BINDING_TABLE (1 << BRW_STATE_GS_BINDING_TABLE)
-#define BRW_NEW_PS_BINDING_TABLE (1 << BRW_STATE_PS_BINDING_TABLE)
-#define BRW_NEW_INDICES (1 << BRW_STATE_INDICES)
-#define BRW_NEW_VERTICES (1 << BRW_STATE_VERTICES)
+/**
+ * BRW_NEW_*_PROG_DATA and BRW_NEW_*_PROGRAM are similar, but distinct.
+ *
+ * BRW_NEW_*_PROGRAM relates to the gl_shader_program/gl_program structures.
+ * When the currently bound shader program differs from the previous draw
+ * call, these will be flagged. They cover brw->{stage}_program and
+ * ctx->{Stage}Program->_Current.
+ *
+ * BRW_NEW_*_PROG_DATA is flagged when the effective shaders change, from a
+ * driver perspective. Even if the same shader is bound at the API level,
+ * we may need to switch between multiple versions of that shader to handle
+ * changes in non-orthagonal state.
+ *
+ * Additionally, multiple shader programs may have identical vertex shaders
+ * (for example), or compile down to the same code in the backend. We combine
+ * those into a single program cache entry.
+ *
+ * BRW_NEW_*_PROG_DATA occurs when switching program cache entries, which
+ * covers the brw_*_prog_data structures, and brw->*.prog_offset.
+ */
+#define BRW_NEW_FS_PROG_DATA (1ull << BRW_CACHE_FS_PROG)
+/* XXX: The BRW_NEW_BLORP_BLIT_PROG_DATA dirty bit is unused (as BLORP doesn't
+ * use the normal state upload paths), but the cache is still used. To avoid
+ * polluting the brw_state_cache code with special cases, we retain the dirty
+ * bit for now. It should eventually be removed.
+ */
+#define BRW_NEW_BLORP_BLIT_PROG_DATA (1ull << BRW_CACHE_BLORP_BLIT_PROG)
+#define BRW_NEW_SF_PROG_DATA (1ull << BRW_CACHE_SF_PROG)
+#define BRW_NEW_VS_PROG_DATA (1ull << BRW_CACHE_VS_PROG)
+#define BRW_NEW_FF_GS_PROG_DATA (1ull << BRW_CACHE_FF_GS_PROG)
+#define BRW_NEW_GS_PROG_DATA (1ull << BRW_CACHE_GS_PROG)
+#define BRW_NEW_CLIP_PROG_DATA (1ull << BRW_CACHE_CLIP_PROG)
+#define BRW_NEW_URB_FENCE (1ull << BRW_STATE_URB_FENCE)
+#define BRW_NEW_FRAGMENT_PROGRAM (1ull << BRW_STATE_FRAGMENT_PROGRAM)
+#define BRW_NEW_GEOMETRY_PROGRAM (1ull << BRW_STATE_GEOMETRY_PROGRAM)
+#define BRW_NEW_VERTEX_PROGRAM (1ull << BRW_STATE_VERTEX_PROGRAM)
+#define BRW_NEW_CURBE_OFFSETS (1ull << BRW_STATE_CURBE_OFFSETS)
+#define BRW_NEW_REDUCED_PRIMITIVE (1ull << BRW_STATE_REDUCED_PRIMITIVE)
+#define BRW_NEW_PRIMITIVE (1ull << BRW_STATE_PRIMITIVE)
+#define BRW_NEW_CONTEXT (1ull << BRW_STATE_CONTEXT)
+#define BRW_NEW_PSP (1ull << BRW_STATE_PSP)
+#define BRW_NEW_SURFACES (1ull << BRW_STATE_SURFACES)
+#define BRW_NEW_VS_BINDING_TABLE (1ull << BRW_STATE_VS_BINDING_TABLE)
+#define BRW_NEW_GS_BINDING_TABLE (1ull << BRW_STATE_GS_BINDING_TABLE)
+#define BRW_NEW_PS_BINDING_TABLE (1ull << BRW_STATE_PS_BINDING_TABLE)
+#define BRW_NEW_INDICES (1ull << BRW_STATE_INDICES)
+#define BRW_NEW_VERTICES (1ull << BRW_STATE_VERTICES)
/**
* Used for any batch entry with a relocated pointer that will be used
* by any 3D rendering.
*/
-#define BRW_NEW_BATCH (1 << BRW_STATE_BATCH)
+#define BRW_NEW_BATCH (1ull << BRW_STATE_BATCH)
/** \see brw.state.depth_region */
-#define BRW_NEW_INDEX_BUFFER (1 << BRW_STATE_INDEX_BUFFER)
-#define BRW_NEW_VS_CONSTBUF (1 << BRW_STATE_VS_CONSTBUF)
-#define BRW_NEW_GS_CONSTBUF (1 << BRW_STATE_GS_CONSTBUF)
-#define BRW_NEW_PROGRAM_CACHE (1 << BRW_STATE_PROGRAM_CACHE)
-#define BRW_NEW_STATE_BASE_ADDRESS (1 << BRW_STATE_STATE_BASE_ADDRESS)
-#define BRW_NEW_VUE_MAP_VS (1 << BRW_STATE_VUE_MAP_VS)
-#define BRW_NEW_VUE_MAP_GEOM_OUT (1 << BRW_STATE_VUE_MAP_GEOM_OUT)
-#define BRW_NEW_TRANSFORM_FEEDBACK (1 << BRW_STATE_TRANSFORM_FEEDBACK)
-#define BRW_NEW_RASTERIZER_DISCARD (1 << BRW_STATE_RASTERIZER_DISCARD)
-#define BRW_NEW_STATS_WM (1 << BRW_STATE_STATS_WM)
-#define BRW_NEW_UNIFORM_BUFFER (1 << BRW_STATE_UNIFORM_BUFFER)
-#define BRW_NEW_ATOMIC_BUFFER (1 << BRW_STATE_ATOMIC_BUFFER)
-#define BRW_NEW_META_IN_PROGRESS (1 << BRW_STATE_META_IN_PROGRESS)
-#define BRW_NEW_INTERPOLATION_MAP (1 << BRW_STATE_INTERPOLATION_MAP)
-#define BRW_NEW_PUSH_CONSTANT_ALLOCATION (1 << BRW_STATE_PUSH_CONSTANT_ALLOCATION)
-#define BRW_NEW_NUM_SAMPLES (1 << BRW_STATE_NUM_SAMPLES)
+#define BRW_NEW_INDEX_BUFFER (1ull << BRW_STATE_INDEX_BUFFER)
+#define BRW_NEW_VS_CONSTBUF (1ull << BRW_STATE_VS_CONSTBUF)
+#define BRW_NEW_GS_CONSTBUF (1ull << BRW_STATE_GS_CONSTBUF)
+#define BRW_NEW_PROGRAM_CACHE (1ull << BRW_STATE_PROGRAM_CACHE)
+#define BRW_NEW_STATE_BASE_ADDRESS (1ull << BRW_STATE_STATE_BASE_ADDRESS)
+#define BRW_NEW_VUE_MAP_VS (1ull << BRW_STATE_VUE_MAP_VS)
+#define BRW_NEW_VUE_MAP_GEOM_OUT (1ull << BRW_STATE_VUE_MAP_GEOM_OUT)
+#define BRW_NEW_TRANSFORM_FEEDBACK (1ull << BRW_STATE_TRANSFORM_FEEDBACK)
+#define BRW_NEW_RASTERIZER_DISCARD (1ull << BRW_STATE_RASTERIZER_DISCARD)
+#define BRW_NEW_STATS_WM (1ull << BRW_STATE_STATS_WM)
+#define BRW_NEW_UNIFORM_BUFFER (1ull << BRW_STATE_UNIFORM_BUFFER)
+#define BRW_NEW_ATOMIC_BUFFER (1ull << BRW_STATE_ATOMIC_BUFFER)
+#define BRW_NEW_META_IN_PROGRESS (1ull << BRW_STATE_META_IN_PROGRESS)
+#define BRW_NEW_INTERPOLATION_MAP (1ull << BRW_STATE_INTERPOLATION_MAP)
+#define BRW_NEW_PUSH_CONSTANT_ALLOCATION (1ull << BRW_STATE_PUSH_CONSTANT_ALLOCATION)
+#define BRW_NEW_NUM_SAMPLES (1ull << BRW_STATE_NUM_SAMPLES)
+#define BRW_NEW_TEXTURE_BUFFER (1ull << BRW_STATE_TEXTURE_BUFFER)
+#define BRW_NEW_GEN4_UNIT_STATE (1ull << BRW_STATE_GEN4_UNIT_STATE)
+#define BRW_NEW_CC_VP (1ull << BRW_STATE_CC_VP)
+#define BRW_NEW_SF_VP (1ull << BRW_STATE_SF_VP)
+#define BRW_NEW_CLIP_VP (1ull << BRW_STATE_CLIP_VP)
+#define BRW_NEW_SAMPLER_STATE_TABLE (1ull << BRW_STATE_SAMPLER_STATE_TABLE)
+#define BRW_NEW_VS_ATTRIB_WORKAROUNDS (1ull << BRW_STATE_VS_ATTRIB_WORKAROUNDS)
struct brw_state_flags {
/** State update flags signalled by mesa internals */
/**
* State update flags signalled as the result of brw_tracked_state updates
*/
- GLuint brw;
- /**
- * State update flags that used to be signalled by brw_state_cache.c
- * searches.
- *
- * Now almost all of that state is just streamed out on demand, but the
- * flags for those state blobs updating have stayed in the same bitfield.
- * brw_state_cache.c still flags CACHE_NEW_*_PROG.
- */
- GLuint cache;
+ uint64_t brw;
};
/** Subclass of Mesa vertex program */
uint32_t gather_texture_start;
uint32_t ubo_start;
uint32_t abo_start;
+ uint32_t image_start;
uint32_t shader_time_start;
/** @} */
} binding_table;
GLuint nr_params; /**< number of float params/constants */
GLuint nr_pull_params;
+ unsigned curb_read_length;
+ unsigned total_scratch;
+
/**
* Register where the thread expects to find input data from the URB
* (typically uniforms, followed by vertex or fragment attributes).
*/
unsigned dispatch_grf_start_reg;
+ bool use_alt_mode; /**< Use ALT floating point mode? Otherwise, IEEE. */
+
/* Pointers to tracked values (only valid once
* _mesa_load_state_parameters has been called at runtime).
*
struct brw_wm_prog_data {
struct brw_stage_prog_data base;
- GLuint curb_read_length;
GLuint num_varying_inputs;
GLuint dispatch_grf_start_reg_16;
GLuint reg_blocks;
GLuint reg_blocks_16;
- GLuint total_scratch;
struct {
/** @{
/** @} */
} binding_table;
+ uint8_t computed_depth_mode;
+
bool no_8;
bool dual_src_blend;
bool uses_pos_offset;
bool uses_omask;
+ bool uses_kill;
uint32_t prog_offset_16;
/**
};
-/* Note: brw_vec4_prog_data_compare() must be updated when adding fields to
+/* Note: brw_vue_prog_data_compare() must be updated when adding fields to
* this struct!
*/
-struct brw_vec4_prog_data {
+struct brw_vue_prog_data {
struct brw_stage_prog_data base;
struct brw_vue_map vue_map;
- GLuint curb_read_length;
GLuint urb_read_length;
GLuint total_grf;
- GLuint total_scratch;
/* Used for calculating urb partitions. In the VS, this is the size of the
* URB entry used for both input and output to the thread. In the GS, this
* is the size of the URB entry used for output.
*/
GLuint urb_entry_size;
+
+ bool simd8;
};
* struct!
*/
struct brw_vs_prog_data {
- struct brw_vec4_prog_data base;
+ struct brw_vue_prog_data base;
GLbitfield64 inputs_read;
bool uses_vertexid;
-};
-
-
-/* Note: brw_gs_prog_data_compare() must be updated when adding fields to
- * this struct!
- */
-struct brw_gs_prog_data
-{
- struct brw_vec4_prog_data base;
-
- /**
- * Size of an output vertex, measured in HWORDS (32 bytes).
- */
- unsigned output_vertex_size_hwords;
-
- unsigned output_topology;
-
- /**
- * Size of the control data (cut bits or StreamID bits), in hwords (32
- * bytes). 0 if there is no control data.
- */
- unsigned control_data_header_size_hwords;
-
- /**
- * Format of the control data (either GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID
- * if the control data is StreamID bits, or
- * GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT if the control data is cut bits).
- * Ignored if control_data_header_size is 0.
- */
- unsigned control_data_format;
-
- bool include_primitive_id;
-
- int invocations;
-
- /**
- * True if the thread should be dispatched in DUAL_INSTANCE mode, false if
- * it should be dispatched in DUAL_OBJECT mode.
- */
- bool dual_instanced_dispatch;
+ bool uses_instanceid;
};
/** Number of texture sampler units */
/** Max number of atomic counter buffer objects in a shader */
#define BRW_MAX_ABO 16
+/** Max number of image uniforms in a shader */
+#define BRW_MAX_IMAGES 32
+
/**
* Max number of binding table entries used for stream output.
*
BRW_MAX_TEX_UNIT * 2 + /* normal, gather */ \
12 + /* ubo */ \
BRW_MAX_ABO + \
+ BRW_MAX_IMAGES + \
2 /* shader time, pull constants */)
#define SURF_INDEX_GEN6_SOL_BINDING(t) (t)
-#define BRW_MAX_GEN6_GS_SURFACES SURF_INDEX_GEN6_SOL_BINDING(BRW_MAX_SOL_BINDINGS)
+
+/* Note: brw_gs_prog_data_compare() must be updated when adding fields to
+ * this struct!
+ */
+struct brw_gs_prog_data
+{
+ struct brw_vue_prog_data base;
+
+ /**
+ * Size of an output vertex, measured in HWORDS (32 bytes).
+ */
+ unsigned output_vertex_size_hwords;
+
+ unsigned output_topology;
+
+ /**
+ * Size of the control data (cut bits or StreamID bits), in hwords (32
+ * bytes). 0 if there is no control data.
+ */
+ unsigned control_data_header_size_hwords;
+
+ /**
+ * Format of the control data (either GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID
+ * if the control data is StreamID bits, or
+ * GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT if the control data is cut bits).
+ * Ignored if control_data_header_size is 0.
+ */
+ unsigned control_data_format;
+
+ bool include_primitive_id;
+
+ int invocations;
+
+ /**
+ * Dispatch mode, can be any of:
+ * GEN7_GS_DISPATCH_MODE_DUAL_OBJECT
+ * GEN7_GS_DISPATCH_MODE_DUAL_INSTANCE
+ * GEN7_GS_DISPATCH_MODE_SINGLE
+ */
+ int dispatch_mode;
+
+ /**
+ * Gen6 transform feedback enabled flag.
+ */
+ bool gen6_xfb_enabled;
+
+ /**
+ * Gen6: Provoking vertex convention for odd-numbered triangles
+ * in tristrips.
+ */
+ GLuint pv_first:1;
+
+ /**
+ * Gen6: Number of varyings that are output to transform feedback.
+ */
+ GLuint num_transform_feedback_bindings:7; /* 0-BRW_MAX_SOL_BINDINGS */
+
+ /**
+ * Gen6: Map from the index of a transform feedback binding table entry to the
+ * gl_varying_slot that should be streamed out through that binding table
+ * entry.
+ */
+ unsigned char transform_feedback_bindings[BRW_MAX_SOL_BINDINGS];
+
+ /**
+ * Gen6: Map from the index of a transform feedback binding table entry to the
+ * swizzles that should be used when streaming out data through that
+ * binding table entry.
+ */
+ unsigned char transform_feedback_swizzles[BRW_MAX_SOL_BINDINGS];
+};
/**
* Stride in bytes between shader_time entries.
*/
#define SHADER_TIME_STRIDE 64
-enum brw_cache_id {
- BRW_CC_VP,
- BRW_CC_UNIT,
- BRW_WM_PROG,
- BRW_BLORP_BLIT_PROG,
- BRW_BLORP_CONST_COLOR_PROG,
- BRW_SAMPLER,
- BRW_WM_UNIT,
- BRW_SF_PROG,
- BRW_SF_VP,
- BRW_SF_UNIT, /* scissor state on gen6 */
- BRW_VS_UNIT,
- BRW_VS_PROG,
- BRW_FF_GS_UNIT,
- BRW_FF_GS_PROG,
- BRW_GS_PROG,
- BRW_CLIP_VP,
- BRW_CLIP_UNIT,
- BRW_CLIP_PROG,
-
- BRW_MAX_CACHE
-};
-
struct brw_cache_item {
/**
* Effectively part of the key, cache_id identifies what kind of state
- * buffer is involved, and also which brw->state.dirty.cache flag should
- * be set when this cache item is chosen.
+ * buffer is involved, and also which dirty flag should set.
*/
enum brw_cache_id cache_id;
/** 32-bit hash of the key data */
ST_FS16_RESET,
};
-/* Flags for brw->state.cache.
- */
-#define CACHE_NEW_CC_VP (1<<BRW_CC_VP)
-#define CACHE_NEW_CC_UNIT (1<<BRW_CC_UNIT)
-#define CACHE_NEW_WM_PROG (1<<BRW_WM_PROG)
-#define CACHE_NEW_BLORP_BLIT_PROG (1<<BRW_BLORP_BLIT_PROG)
-#define CACHE_NEW_BLORP_CONST_COLOR_PROG (1<<BRW_BLORP_CONST_COLOR_PROG)
-#define CACHE_NEW_SAMPLER (1<<BRW_SAMPLER)
-#define CACHE_NEW_WM_UNIT (1<<BRW_WM_UNIT)
-#define CACHE_NEW_SF_PROG (1<<BRW_SF_PROG)
-#define CACHE_NEW_SF_VP (1<<BRW_SF_VP)
-#define CACHE_NEW_SF_UNIT (1<<BRW_SF_UNIT)
-#define CACHE_NEW_VS_UNIT (1<<BRW_VS_UNIT)
-#define CACHE_NEW_VS_PROG (1<<BRW_VS_PROG)
-#define CACHE_NEW_FF_GS_UNIT (1<<BRW_FF_GS_UNIT)
-#define CACHE_NEW_FF_GS_PROG (1<<BRW_FF_GS_PROG)
-#define CACHE_NEW_GS_PROG (1<<BRW_GS_PROG)
-#define CACHE_NEW_CLIP_VP (1<<BRW_CLIP_VP)
-#define CACHE_NEW_CLIP_UNIT (1<<BRW_CLIP_UNIT)
-#define CACHE_NEW_CLIP_PROG (1<<BRW_CLIP_PROG)
-
struct brw_vertex_buffer {
/** Buffer object containing the uploaded vertex data */
drm_intel_bo *bo;
/** Last index in bo with query data for this object. */
int last_index;
+
+ /** True if we know the batch has been flushed since we ended the query. */
+ bool flushed;
};
struct intel_sync_object {
drm_intel_bo *last_bo;
/** BO for post-sync nonzero writes for gen6 workaround. */
drm_intel_bo *workaround_bo;
- bool need_workaround_flush;
uint16_t emit, total;
uint16_t used, reserved_space;
enum brw_gpu_ring ring;
bool needs_sol_reset;
+ uint8_t pipe_controls_since_last_cs_stall;
+
struct {
uint16_t used;
int reloc_count;
struct gl_renderbuffer *rb,
bool layered,
unsigned unit);
- void (*update_null_renderbuffer_surface)(struct brw_context *brw,
- unsigned unit);
- void (*create_raw_surface)(struct brw_context *brw,
- drm_intel_bo *bo,
- uint32_t offset,
- uint32_t size,
- uint32_t *out_offset,
- bool rw);
void (*emit_buffer_surface_state)(struct brw_context *brw,
uint32_t *out_offset,
drm_intel_bo *bo,
unsigned surface_format,
unsigned buffer_size,
unsigned pitch,
- unsigned mocs,
bool rw);
+ void (*emit_null_surface_state)(struct brw_context *brw,
+ unsigned width,
+ unsigned height,
+ unsigned samples,
+ uint32_t *out_offset);
/**
* Send the appropriate state packets to configure depth, stencil, and
bool front_buffer_dirty;
/** Framerate throttling: @{ */
- drm_intel_bo *first_post_swapbuffers_batch;
- bool need_throttle;
+ drm_intel_bo *throttle_batch[2];
+
+ /* Limit the number of outstanding SwapBuffers by waiting for an earlier
+ * frame of rendering to complete. This gives a very precise cap to the
+ * latency between input and output such that rendering never gets more
+ * than a frame behind the user. (With the caveat that we technically are
+ * not using the SwapBuffers itself as a barrier but the first batch
+ * submitted afterwards, which may be immediately prior to the next
+ * SwapBuffers.)
+ */
+ bool need_swap_throttle;
+
+ /** General throttling, not caught by throttling between SwapBuffers */
+ bool need_flush_throttle;
/** @} */
GLuint stats_wm;
bool always_flush_cache;
bool disable_throttling;
bool precompile;
- bool disable_derivative_optimization;
driOptionCache optionCache;
/** @} */
int gen;
int gt;
+ /* GT revision. This will be -1 if the revision couldn't be determined (eg,
+ * if the kernel doesn't support the query).
+ */
+ int revision;
bool is_g4x;
bool is_baytrail;
bool has_negative_rhw_bug;
bool has_pln;
bool no_simd8;
+ bool use_rep_send;
+ bool scalar_vs;
/**
* Some versions of Gen hardware don't do centroid interpolation correctly
/* Whether the last depth/stencil packets were both NULL. */
bool no_depth_or_stencil;
+ /* The last PMA stall bits programmed. */
+ uint32_t pma_stall_bits;
+
+ struct {
+ /** The value of gl_BaseVertex for the current _mesa_prim. */
+ int gl_basevertex;
+
+ /**
+ * Buffer and offset used for GL_ARB_shader_draw_parameters
+ * (for now, only gl_BaseVertex).
+ */
+ drm_intel_bo *draw_params_bo;
+ uint32_t draw_params_offset;
+ } draw;
+
struct {
struct brw_vertex_element inputs[VERT_ATTRIB_MAX];
struct brw_vertex_buffer buffers[VERT_ATTRIB_MAX];
* the same VB packed over and over again.
*/
unsigned int start_vertex_bias;
+
+ /**
+ * Certain vertex attribute formats aren't natively handled by the
+ * hardware and require special VS code to fix up their values.
+ *
+ * These bitfields indicate which workarounds are needed.
+ */
+ uint8_t attrib_wa_flags[VERT_ATTRIB_MAX];
} vb;
struct {
* for each pipeline stage.
*/
int max_vs_threads;
+ int max_hs_threads;
+ int max_ds_threads;
int max_gs_threads;
int max_wm_threads;
*/
struct {
GLuint vsize; /* vertex size plus header in urb registers */
+ GLuint gsize; /* GS output size in urb registers */
GLuint csize; /* constant buffer size in urb registers */
GLuint sfsize; /* setup data size in urb registers */
GLuint min_vs_entries; /* Minimum number of VS entries */
GLuint max_vs_entries; /* Maximum number of VS entries */
+ GLuint max_hs_entries; /* Maximum number of HS entries */
+ GLuint max_ds_entries; /* Maximum number of DS entries */
GLuint max_gs_entries; /* Maximum number of GS entries */
GLuint nr_vs_entries;
GLuint cs_start;
GLuint size; /* Hardware URB size, in KB. */
- /* gen6: True if the most recently sent _3DSTATE_URB message allocated
+ /* True if the most recently sent _3DSTATE_URB message allocated
* URB space for the GS.
*/
- bool gen6_gs_previously_active;
+ bool gs_present;
} urb;
uint32_t state_offset;
uint32_t bind_bo_offset;
- uint32_t surf_offset[BRW_MAX_GEN6_GS_SURFACES];
+ /**
+ * Surface offsets for the binding table. We only need surfaces to
+ * implement transform feedback so BRW_MAX_SOL_BINDINGS is all that we
+ * need in this case.
+ */
+ uint32_t surf_offset[BRW_MAX_SOL_BINDINGS];
} ff_gs;
struct {
/**
* Buffer object used in place of multisampled null render targets on
- * Gen6. See brw_update_null_renderbuffer_surface().
+ * Gen6. See brw_emit_null_surface_state().
*/
drm_intel_bo *multisampled_null_render_target_bo;
+ uint32_t fast_clear_op;
} wm;
} perfmon;
int num_atoms;
- const struct brw_tracked_state **atoms;
+ const struct brw_tracked_state atoms[57];
/* If (INTEL_DEBUG & DEBUG_BATCH) */
struct {
double report_time;
} shader_time;
+ struct brw_fast_clear_state *fast_clear_state;
+
__DRIcontext *driContext;
struct intel_screen *intelScreen;
};
struct intel_mipmap_tree *dst);
void brw_meta_fbo_stencil_blit(struct brw_context *brw,
+ struct gl_framebuffer *read_fb,
+ struct gl_framebuffer *draw_fb,
GLfloat srcX0, GLfloat srcY0,
GLfloat srcX1, GLfloat srcY1,
GLfloat dstX0, GLfloat dstY0,
void brw_meta_stencil_updownsample(struct brw_context *brw,
struct intel_mipmap_tree *src,
struct intel_mipmap_tree *dst);
+
+bool brw_meta_fast_clear(struct brw_context *brw,
+ struct gl_framebuffer *fb,
+ GLbitfield mask,
+ bool partial_clear);
+
+void
+brw_meta_resolve_color(struct brw_context *brw,
+ struct intel_mipmap_tree *mt);
+void
+brw_meta_fast_clear_free(struct brw_context *brw);
+
+
/*======================================================================
* brw_misc_state.c
*/
/* brw_draw_upload.c */
unsigned brw_get_vertex_surface_type(struct brw_context *brw,
const struct gl_client_array *glarray);
-unsigned brw_get_index_type(GLenum type);
+
+static inline unsigned
+brw_get_index_type(GLenum type)
+{
+ assert((type == GL_UNSIGNED_BYTE)
+ || (type == GL_UNSIGNED_SHORT)
+ || (type == GL_UNSIGNED_INT));
+
+ /* The possible values for type are GL_UNSIGNED_BYTE (0x1401),
+ * GL_UNSIGNED_SHORT (0x1403), and GL_UNSIGNED_INT (0x1405) which we want
+ * to map to scale factors of 0, 1, and 2, respectively. These scale
+ * factors are then left-shfited by 8 to be in the correct position in the
+ * CMD_INDEX_BUFFER packet.
+ *
+ * Subtracting 0x1401 gives 0, 2, and 4. Shifting left by 7 afterwards
+ * gives 0x00000000, 0x00000100, and 0x00000200. These just happen to be
+ * the values the need to be written in the CMD_INDEX_BUFFER packet.
+ */
+ return (type - 0x1401) << 7;
+}
+
void brw_prepare_vertices(struct brw_context *brw);
/* brw_wm_surface_state.c */
void brw_upload_ubo_surfaces(struct brw_context *brw,
struct gl_shader *shader,
struct brw_stage_state *stage_state,
- struct brw_stage_prog_data *prog_data);
+ struct brw_stage_prog_data *prog_data,
+ bool dword_pitch);
void brw_upload_abo_surfaces(struct brw_context *brw,
struct gl_shader_program *prog,
struct brw_stage_state *stage_state,
/* brw_blorp_blit.cpp */
GLbitfield
brw_blorp_framebuffer(struct brw_context *brw,
+ struct gl_framebuffer *readFb,
+ struct gl_framebuffer *drawFb,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
struct gl_framebuffer *fb,
GLuint index,
GLfloat *result);
+void
+gen6_set_sample_maps(struct gl_context *ctx);
/* gen8_multisample_state.c */
void gen8_emit_3dstate_multisample(struct brw_context *brw, unsigned num_samp);
uint32_t width, uint32_t height,
uint32_t tile_x, uint32_t tile_y);
+void
+gen6_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);
+
void
gen7_emit_depth_stencil_hiz(struct brw_context *brw,
struct intel_mipmap_tree *depth_mt,
void gen8_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt,
unsigned int level, unsigned int layer, enum gen6_hiz_op op);
-extern const GLuint prim_to_hw_prim[GL_TRIANGLE_STRIP_ADJACENCY+1];
+uint32_t get_hw_prim_for_gl_prim(int mode);
void
-brw_setup_vec4_key_clip_info(struct brw_context *brw,
- struct brw_vec4_prog_key *key,
- bool program_uses_clip_distance);
+brw_setup_vue_key_clip_info(struct brw_context *brw,
+ struct brw_vue_prog_key *key,
+ bool program_uses_clip_distance);
void
gen6_upload_push_constants(struct brw_context *brw,
struct brw_stage_state *stage_state,
enum aub_state_struct_type type);
-/* ================================================================
- * From linux kernel i386 header files, copes with odd sizes better
- * than COPY_DWORDS would:
- * XXX Put this in src/mesa/main/imports.h ???
- */
-#if defined(i386) || defined(__i386__)
-static inline void * __memcpy(void * to, const void * from, size_t n)
-{
- int d0, d1, d2;
- __asm__ __volatile__(
- "rep ; movsl\n\t"
- "testb $2,%b4\n\t"
- "je 1f\n\t"
- "movsw\n"
- "1:\ttestb $1,%b4\n\t"
- "je 2f\n\t"
- "movsb\n"
- "2:"
- : "=&c" (d0), "=&D" (d1), "=&S" (d2)
- :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from)
- : "memory");
- return (to);
-}
-#else
-#define __memcpy(a,b,c) memcpy(a,b,c)
-#endif
-
#ifdef __cplusplus
}
#endif