summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_context.h')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h240
1 files changed, 123 insertions, 117 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 08fdc54520..330d5714da 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -135,13 +135,25 @@ struct brw_context;
#define BRW_NEW_METAOPS 0x1000
#define BRW_NEW_FENCE 0x2000
#define BRW_NEW_LOCK 0x4000
-
-
+#define BRW_NEW_INDICES 0x8000
+#define BRW_NEW_VERTICES 0x10000
+/**
+ * Used for any batch entry with a relocated pointer that will be used
+ * by any 3D rendering.
+ */
+#define BRW_NEW_BATCH 0x8000
+/** brw->depth_region updated */
+#define BRW_NEW_DEPTH_BUFFER 0x10000
struct brw_state_flags {
+ /** State update flags signalled by mesa internals */
GLuint mesa;
- GLuint cache;
+ /**
+ * State update flags signalled as the result of brw_tracked_state updates
+ */
GLuint brw;
+ /** State update flags signalled by brw_state_cache.c searches */
+ GLuint cache;
};
struct brw_vertex_program {
@@ -230,32 +242,46 @@ struct brw_vs_ouput_sizes {
#define BRW_MAX_TEX_UNIT 8
-#define BRW_WM_MAX_SURF BRW_MAX_TEX_UNIT + 1
-
-/* Create a fixed sized struct for caching binding tables:
- */
-struct brw_surface_binding_table {
- GLuint surf_ss_offset[BRW_WM_MAX_SURF];
-};
-
-
-struct brw_cache;
+#define BRW_WM_MAX_SURF BRW_MAX_TEX_UNIT + MAX_DRAW_BUFFERS
-struct brw_mem_pool {
- struct buffer *buffer;
-
- GLuint size;
- GLuint offset; /* offset of first free byte */
+enum brw_cache_id {
+ BRW_CC_VP,
+ BRW_CC_UNIT,
+ BRW_WM_PROG,
+ BRW_SAMPLER_DEFAULT_COLOR,
+ BRW_SAMPLER,
+ BRW_WM_UNIT,
+ BRW_SF_PROG,
+ BRW_SF_VP,
+ BRW_SF_UNIT,
+ BRW_VS_UNIT,
+ BRW_VS_PROG,
+ BRW_GS_UNIT,
+ BRW_GS_PROG,
+ BRW_CLIP_VP,
+ BRW_CLIP_UNIT,
+ BRW_CLIP_PROG,
+ BRW_SS_SURFACE,
+ BRW_SS_SURF_BIND,
- struct brw_context *brw;
+ 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.
+ */
+ enum brw_cache_id cache_id;
+ /** 32-bit hash of the key data */
GLuint hash;
GLuint key_size; /* for variable-sized keys */
const void *key;
+ dri_bo **reloc_bufs;
+ GLuint nr_reloc_bufs;
- GLuint offset; /* offset within pool's buffer */
+ dri_bo *bo;
GLuint data_size;
struct brw_cache_item *next;
@@ -264,23 +290,19 @@ struct brw_cache_item {
struct brw_cache {
- GLuint id;
-
- const char *name;
-
struct brw_context *brw;
- struct brw_mem_pool *pool;
struct brw_cache_item **items;
GLuint size, n_items;
-
- GLuint key_size; /* for fixed-size keys */
- GLuint aux_size;
- GLuint aub_type;
- GLuint aub_sub_type;
-
- GLuint last_addr; /* offset of active item */
+ GLuint key_size[BRW_MAX_CACHE]; /* for fixed-size keys */
+ GLuint aux_size[BRW_MAX_CACHE];
+ char *name[BRW_MAX_CACHE];
+
+ /* Record of the last BOs chosen for each cache_id. Used to set
+ * brw->state.dirty.cache when a new cache item is chosen.
+ */
+ dri_bo *last_bo[BRW_MAX_CACHE];
};
@@ -312,34 +334,8 @@ struct brw_state_pointers {
*/
struct brw_tracked_state {
struct brw_state_flags dirty;
- void (*update)( struct brw_context *brw );
-};
-
-
-enum brw_cache_id {
- BRW_CC_VP,
- BRW_CC_UNIT,
- BRW_WM_PROG,
- BRW_SAMPLER_DEFAULT_COLOR,
- BRW_SAMPLER,
- BRW_WM_UNIT,
- BRW_SF_PROG,
- BRW_SF_VP,
- BRW_SF_UNIT,
- BRW_VS_UNIT,
- BRW_VS_PROG,
- BRW_GS_UNIT,
- BRW_GS_PROG,
- BRW_CLIP_VP,
- BRW_CLIP_UNIT,
- BRW_CLIP_PROG,
-
- /* These two are in the SS pool:
- */
- BRW_SS_SURFACE,
- BRW_SS_SURF_BIND,
-
- BRW_MAX_CACHE
+ void (*prepare)( struct brw_context *brw );
+ void (*emit)( struct brw_context *brw );
};
/* Flags for brw->state.cache.
@@ -363,16 +359,6 @@ enum brw_cache_id {
#define CACHE_NEW_SURFACE (1<<BRW_SS_SURFACE)
#define CACHE_NEW_SURF_BIND (1<<BRW_SS_SURF_BIND)
-
-
-
-enum brw_mempool_id {
- BRW_GS_POOL,
- BRW_SS_POOL,
- BRW_MAX_POOL
-};
-
-
struct brw_cached_batch_item {
struct header *header;
GLuint sz;
@@ -389,12 +375,16 @@ struct brw_cached_batch_item {
struct brw_vertex_element {
const struct gl_client_array *glarray;
- struct brw_vertex_element_state *vep;
-
- GLuint index;
+ /** Size of a complete element */
GLuint element_size;
+ /** Number of uploaded elements for this input. */
GLuint count;
- GLuint vbo_rebase_offset;
+ /** Byte stride between elements in the uploaded array */
+ GLuint stride;
+ /** Offset of the first element within the buffer object */
+ unsigned int offset;
+ /** Buffer object containing the uploaded vertex data */
+ dri_bo *bo;
};
@@ -431,49 +421,53 @@ struct brw_context
GLboolean emit_state_always;
GLboolean wrap;
GLboolean tmp_fallback;
+ GLboolean no_batch_wrap;
struct {
struct brw_state_flags dirty;
struct brw_tracked_state **atoms;
GLuint nr_atoms;
-
- struct intel_region *draw_region;
+ GLuint nr_draw_regions;
+ struct intel_region *draw_regions[MAX_DRAW_BUFFERS];
struct intel_region *depth_region;
} state;
struct brw_state_pointers attribs;
- struct brw_mem_pool pool[BRW_MAX_POOL];
- struct brw_cache cache[BRW_MAX_CACHE];
+ struct brw_cache cache;
struct brw_cached_batch_item *cached_batch_items;
struct {
-
- /* Arrays with buffer objects to copy non-bufferobj arrays into
- * for upload:
- */
- struct gl_client_array vbo_array[VERT_ATTRIB_MAX];
-
struct brw_vertex_element inputs[VERT_ATTRIB_MAX];
#define BRW_NR_UPLOAD_BUFS 17
#define BRW_UPLOAD_INIT_SIZE (128*1024)
struct {
- struct gl_buffer_object *vbo[BRW_NR_UPLOAD_BUFS];
- GLuint buf;
+ dri_bo *bo;
GLuint offset;
- GLuint size;
- GLuint wrap;
} upload;
/* Summary of size and varying of active arrays, so we can check
* for changes to this state:
*/
struct brw_vertex_info info;
+ unsigned int min_index, max_index;
} vb;
struct {
+ /**
+ * Index buffer for this draw_prims call.
+ *
+ * Updates are signaled by BRW_NEW_INDICES.
+ */
+ const struct _mesa_index_buffer *ib;
+
+ dri_bo *bo;
+ unsigned int offset;
+ } ib;
+
+ struct {
/* Will be allocated on demand if needed.
*/
struct brw_state_pointers attribs;
@@ -483,9 +477,12 @@ struct brw_context
struct gl_buffer_object *vbo;
struct intel_region *saved_draw_region;
+ GLuint saved_nr_draw_regions;
struct intel_region *saved_depth_region;
- GLuint restore_draw_mask;
+ GLuint restore_draw_buffers[MAX_DRAW_BUFFERS];
+ GLuint restore_num_draw_buffers;
+
struct gl_fragment_program *restore_fp;
GLboolean active;
@@ -552,7 +549,11 @@ struct brw_context
*/
struct brw_tracked_state tracked_state;
- GLuint gs_offset;
+ dri_bo *curbe_bo;
+ /** Offset within curbe_bo of space for current curbe entry */
+ GLuint curbe_offset;
+ /** Offset within curbe_bo of space for next curbe entry */
+ GLuint curbe_next_offset;
GLfloat *last_buf;
GLuint last_bufsz;
@@ -561,33 +562,33 @@ struct brw_context
struct {
struct brw_vs_prog_data *prog_data;
- GLuint prog_gs_offset;
- GLuint state_gs_offset;
+ dri_bo *prog_bo;
+ dri_bo *state_bo;
} vs;
struct {
struct brw_gs_prog_data *prog_data;
GLboolean prog_active;
- GLuint prog_gs_offset;
- GLuint state_gs_offset;
+ dri_bo *prog_bo;
+ dri_bo *state_bo;
} gs;
struct {
struct brw_clip_prog_data *prog_data;
- GLuint prog_gs_offset;
- GLuint vp_gs_offset;
- GLuint state_gs_offset;
+ dri_bo *prog_bo;
+ dri_bo *state_bo;
+ dri_bo *vp_bo;
} clip;
struct {
struct brw_sf_prog_data *prog_data;
- GLuint prog_gs_offset;
- GLuint vp_gs_offset;
- GLuint state_gs_offset;
+ dri_bo *prog_bo;
+ dri_bo *state_bo;
+ dri_bo *vp_bo;
} sf;
struct {
@@ -598,33 +599,31 @@ struct brw_context
*/
GLuint input_size_masks[4];
-
- /* State structs
- */
- struct brw_sampler_default_color sdc[BRW_MAX_TEX_UNIT];
- struct brw_sampler_state sampler[BRW_MAX_TEX_UNIT];
+ /** Array of surface default colors (texture border color) */
+ dri_bo *sdc_bo[BRW_MAX_TEX_UNIT];
GLuint render_surf;
GLuint nr_surfaces;
GLuint max_threads;
- struct buffer *scratch_buffer;
- GLuint scratch_buffer_size;
+ dri_bo *scratch_buffer;
GLuint sampler_count;
- GLuint sampler_gs_offset;
+ dri_bo *sampler_bo;
- struct brw_surface_binding_table bind;
- GLuint bind_ss_offset;
+ /** Binding table of pointers to surf_bo entries */
+ dri_bo *bind_bo;
+ dri_bo *surf_bo[BRW_WM_MAX_SURF];
- GLuint prog_gs_offset;
- GLuint state_gs_offset;
+ dri_bo *prog_bo;
+ dri_bo *state_bo;
} wm;
struct {
- GLuint vp_gs_offset;
- GLuint state_gs_offset;
+ dri_bo *prog_bo;
+ dri_bo *state_bo;
+ dri_bo *vp_bo;
} cc;
@@ -662,14 +661,19 @@ void brw_init_state( struct brw_context *brw );
void brw_destroy_state( struct brw_context *brw );
+/*======================================================================
+ * brw_state_dump.c
+ */
+void brw_debug_batch(struct intel_context *intel);
/*======================================================================
* brw_tex.c
*/
void brwUpdateTextureState( struct intel_context *intel );
-void brwInitTextureFuncs( struct dd_function_table *functions );
-void brw_FrameBufferTexInit( struct brw_context *brw );
+void brw_FrameBufferTexInit( struct brw_context *brw,
+ struct intel_region *region );
void brw_FrameBufferTexDestroy( struct brw_context *brw );
+void brw_validate_textures( struct brw_context *brw );
/*======================================================================
* brw_metaops.c
@@ -696,11 +700,13 @@ void brw_upload_constant_buffer_state(struct brw_context *brw);
* Inline conversion functions. These are better-typed than the
* macros used previously:
*/
-static inline struct brw_context *
+static INLINE struct brw_context *
brw_context( GLcontext *ctx )
{
return (struct brw_context *)ctx;
}
+#define DO_SETUP_BITS ((1<<(FRAG_ATTRIB_MAX)) - 1)
+
#endif