summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/i965/Makefile73
-rw-r--r--src/gallium/drivers/i965/brw_cc.c18
-rw-r--r--src/gallium/drivers/i965/brw_clip.c4
-rw-r--r--src/gallium/drivers/i965/brw_clip_state.c7
-rw-r--r--src/gallium/drivers/i965/brw_context.c64
-rw-r--r--src/gallium/drivers/i965/brw_context.h199
-rw-r--r--src/gallium/drivers/i965/brw_curbe.c5
-rw-r--r--src/gallium/drivers/i965/brw_draw.c25
-rw-r--r--src/gallium/drivers/i965/brw_draw.h7
-rw-r--r--src/gallium/drivers/i965/brw_draw_upload.c39
-rw-r--r--src/gallium/drivers/i965/brw_eu_debug.c2
-rw-r--r--src/gallium/drivers/i965/brw_gs.c8
-rw-r--r--src/gallium/drivers/i965/brw_gs_emit.c5
-rw-r--r--src/gallium/drivers/i965/brw_gs_state.c7
-rw-r--r--src/gallium/drivers/i965/brw_misc_state.c22
-rw-r--r--src/gallium/drivers/i965/brw_pipe_depth.c18
-rw-r--r--src/gallium/drivers/i965/brw_pipe_fb.c4
-rw-r--r--src/gallium/drivers/i965/brw_pipe_flush.c8
-rw-r--r--src/gallium/drivers/i965/brw_pipe_query.c (renamed from src/gallium/drivers/i965/brw_queryobj.c)74
-rw-r--r--src/gallium/drivers/i965/brw_program.c166
-rw-r--r--src/gallium/drivers/i965/brw_sf.c12
-rw-r--r--src/gallium/drivers/i965/brw_sf.h12
-rw-r--r--src/gallium/drivers/i965/brw_sf_emit.c26
-rw-r--r--src/gallium/drivers/i965/brw_sf_state.c16
-rw-r--r--src/gallium/drivers/i965/brw_state.h30
-rw-r--r--src/gallium/drivers/i965/brw_state_batch.c1
-rw-r--r--src/gallium/drivers/i965/brw_state_cache.c59
-rw-r--r--src/gallium/drivers/i965/brw_state_dump.c12
-rw-r--r--src/gallium/drivers/i965/brw_state_upload.c4
-rw-r--r--src/gallium/drivers/i965/brw_structs.h1
-rw-r--r--src/gallium/drivers/i965/brw_swtnl.c1
-rw-r--r--src/gallium/drivers/i965/brw_tex.c7
-rw-r--r--src/gallium/drivers/i965/brw_tex_layout.c12
-rw-r--r--src/gallium/drivers/i965/brw_types.h15
-rw-r--r--src/gallium/drivers/i965/brw_util.c2
-rw-r--r--src/gallium/drivers/i965/brw_util.h2
-rw-r--r--src/gallium/drivers/i965/brw_vs.c5
-rw-r--r--src/gallium/drivers/i965/brw_vs_emit.c3
-rw-r--r--src/gallium/drivers/i965/brw_vs_state.c9
-rw-r--r--src/gallium/drivers/i965/brw_vs_surface_state.c20
-rw-r--r--src/gallium/drivers/i965/brw_wm.c6
-rw-r--r--src/gallium/drivers/i965/brw_wm_emit.c1
-rw-r--r--src/gallium/drivers/i965/brw_wm_glsl.c4
-rw-r--r--src/gallium/drivers/i965/brw_wm_iz.c1
-rw-r--r--src/gallium/drivers/i965/brw_wm_sampler_state.c15
-rw-r--r--src/gallium/drivers/i965/brw_wm_state.c19
-rw-r--r--src/gallium/drivers/i965/brw_wm_surface_state.c181
-rw-r--r--src/gallium/drivers/i965/intel_batchbuffer.h7
-rw-r--r--src/gallium/drivers/i965/intel_tex_format.c197
-rw-r--r--src/gallium/drivers/i965/intel_tex_layout.c7
50 files changed, 421 insertions, 1021 deletions
diff --git a/src/gallium/drivers/i965/Makefile b/src/gallium/drivers/i965/Makefile
index 7a55333e89..480d2efbc5 100644
--- a/src/gallium/drivers/i965/Makefile
+++ b/src/gallium/drivers/i965/Makefile
@@ -1,38 +1,9 @@
-
-TOP = ../../../../..
+TOP = ../../../..
include $(TOP)/configs/current
-LIBNAME = i965_dri.so
+LIBNAME = i965
-DRIVER_SOURCES = \
- intel_batchbuffer.c \
- intel_blit.c \
- intel_buffer_objects.c \
- intel_buffers.c \
- intel_clear.c \
- intel_context.c \
- intel_decode.c \
- intel_extensions.c \
- intel_fbo.c \
- intel_mipmap_tree.c \
- intel_regions.c \
- intel_screen.c \
- intel_span.c \
- intel_pixel.c \
- intel_pixel_bitmap.c \
- intel_pixel_copy.c \
- intel_pixel_draw.c \
- intel_pixel_read.c \
- intel_state.c \
- intel_swapbuffers.c \
- intel_syncobj.c \
- intel_tex.c \
- intel_tex_copy.c \
- intel_tex_format.c \
- intel_tex_image.c \
- intel_tex_layout.c \
- intel_tex_subimage.c \
- intel_tex_validate.c \
+C_SOURCES = \
brw_cc.c \
brw_clip.c \
brw_clip_line.c \
@@ -50,13 +21,18 @@ DRIVER_SOURCES = \
brw_eu_debug.c \
brw_eu_emit.c \
brw_eu_util.c \
- brw_fallback.c \
brw_gs.c \
brw_gs_emit.c \
brw_gs_state.c \
brw_misc_state.c \
- brw_program.c \
- brw_queryobj.c \
+ brw_pipe_blend.c \
+ brw_pipe_debug.c \
+ brw_pipe_depth.c \
+ brw_pipe_fb.c \
+ brw_pipe_flush.c \
+ brw_pipe_query.c \
+ brw_pipe_shader.c \
+ brw_screen_surface.c \
brw_sf.c \
brw_sf_emit.c \
brw_sf_state.c \
@@ -64,41 +40,30 @@ DRIVER_SOURCES = \
brw_state_cache.c \
brw_state_dump.c \
brw_state_upload.c \
+ brw_swtnl.c \
brw_tex.c \
brw_tex_layout.c \
brw_urb.c \
brw_util.c \
brw_vs.c \
- brw_vs_constval.c \
brw_vs_emit.c \
brw_vs_state.c \
brw_vs_surface_state.c \
- brw_vtbl.c \
brw_wm.c \
brw_wm_debug.c \
brw_wm_emit.c \
brw_wm_fp.c \
- brw_wm_iz.c \
brw_wm_glsl.c \
+ brw_wm_iz.c \
brw_wm_pass0.c \
brw_wm_pass1.c \
brw_wm_pass2.c \
brw_wm_sampler_state.c \
brw_wm_state.c \
- brw_wm_surface_state.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(MINIGLX_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-DRIVER_DEFINES = -I../intel -I../intel/server
-
-DRI_LIB_DEPS += -ldrm_intel
-
-include ../Makefile.template
+ brw_wm_surface_state.c \
+ brw_bo.c \
+ intel_batchbuffer.c \
+ intel_tex_format.c \
+ intel_tex_layout.c
-intel_decode.o: ../intel/intel_decode.c
-intel_tex_layout.o: ../intel/intel_tex_layout.c
+include ../../Makefile.template
diff --git a/src/gallium/drivers/i965/brw_cc.c b/src/gallium/drivers/i965/brw_cc.c
index 9ab5638137..af432b1f52 100644
--- a/src/gallium/drivers/i965/brw_cc.c
+++ b/src/gallium/drivers/i965/brw_cc.c
@@ -33,13 +33,9 @@
#include "brw_context.h"
#include "brw_state.h"
#include "brw_defines.h"
-#include "brw_util.h"
-#include "main/macros.h"
-#include "main/enums.h"
static void prepare_cc_vp( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
struct brw_cc_viewport ccv;
memset(&ccv, 0, sizeof(ccv));
@@ -48,13 +44,13 @@ static void prepare_cc_vp( struct brw_context *brw )
ccv.min_depth = ctx->Viewport.Near;
ccv.max_depth = ctx->Viewport.Far;
- dri_bo_unreference(brw->cc.vp_bo);
+ brw->sws->bo_unreference(brw->cc.vp_bo);
brw->cc.vp_bo = brw_cache_data( &brw->cache, BRW_CC_VP, &ccv, NULL, 0 );
}
const struct brw_tracked_state brw_cc_vp = {
.dirty = {
- .mesa = _NEW_VIEWPORT,
+ .mesa = PIPE_NEW_VIEWPORT,
.brw = BRW_NEW_CONTEXT,
.cache = 0
},
@@ -71,8 +67,8 @@ cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key)
{
memset(key, 0, sizeof(*key));
- key->dsa = brw->curr.dsa.base;
- key->blend = brw->curr.blend.base;
+ key->dsa = brw->dsa;
+ key->blend = brw->blend;
/* Clear non-respected values:
*/
@@ -82,11 +78,11 @@ cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key)
/**
* Creates the state cache entry for the given CC unit key.
*/
-static dri_bo *
+static struct brw_winsys_buffer *
cc_unit_create_from_key(struct brw_context *brw, struct brw_cc_unit_key *key)
{
struct brw_cc_unit_state cc;
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
memset(&cc, 0, sizeof(cc));
@@ -124,7 +120,7 @@ static void prepare_cc_unit( struct brw_context *brw )
cc_unit_populate_key(brw, &key);
- dri_bo_unreference(brw->cc.state_bo);
+ brw->sws->bo_unreference(brw->cc.state_bo);
brw->cc.state_bo = brw_search_cache(&brw->cache, BRW_CC_UNIT,
&key, sizeof(key),
&brw->cc.vp_bo, 1,
diff --git a/src/gallium/drivers/i965/brw_clip.c b/src/gallium/drivers/i965/brw_clip.c
index df1b3718d0..d82ebeb9a9 100644
--- a/src/gallium/drivers/i965/brw_clip.c
+++ b/src/gallium/drivers/i965/brw_clip.c
@@ -129,7 +129,7 @@ static void compile_clip_prog( struct brw_context *brw,
/* Upload
*/
- dri_bo_unreference(brw->clip.prog_bo);
+ brw->sws->bo_unreference(brw->clip.prog_bo);
brw->clip.prog_bo = brw_upload_cache( &brw->cache,
BRW_CLIP_PROG,
&c.key, sizeof(c.key),
@@ -199,7 +199,7 @@ static void upload_clip_prog(struct brw_context *brw)
}
}
- dri_bo_unreference(brw->clip.prog_bo);
+ brw->sws->bo_unreference(brw->clip.prog_bo);
brw->clip.prog_bo = brw_search_cache(&brw->cache, BRW_CLIP_PROG,
&key, sizeof(key),
NULL, 0,
diff --git a/src/gallium/drivers/i965/brw_clip_state.c b/src/gallium/drivers/i965/brw_clip_state.c
index 72e27205e2..0ea7ce5734 100644
--- a/src/gallium/drivers/i965/brw_clip_state.c
+++ b/src/gallium/drivers/i965/brw_clip_state.c
@@ -49,7 +49,6 @@ struct brw_clip_unit_key {
static void
clip_unit_populate_key(struct brw_context *brw, struct brw_clip_unit_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
memset(key, 0, sizeof(*key));
/* CACHE_NEW_CLIP_PROG */
@@ -69,12 +68,12 @@ clip_unit_populate_key(struct brw_context *brw, struct brw_clip_unit_key *key)
key->depth_clamp = 0; // XXX: add this to gallium: ctx->Transform.DepthClamp;
}
-static dri_bo *
+static struct brw_winsys_buffer *
clip_unit_create_from_key(struct brw_context *brw,
struct brw_clip_unit_key *key)
{
struct brw_clip_unit_state clip;
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
memset(&clip, 0, sizeof(clip));
@@ -162,7 +161,7 @@ static void upload_clip_unit( struct brw_context *brw )
clip_unit_populate_key(brw, &key);
- dri_bo_unreference(brw->clip.state_bo);
+ brw->sws->bo_unreference(brw->clip.state_bo);
brw->clip.state_bo = brw_search_cache(&brw->cache, BRW_CLIP_UNIT,
&key, sizeof(key),
&brw->clip.prog_bo, 1,
diff --git a/src/gallium/drivers/i965/brw_context.c b/src/gallium/drivers/i965/brw_context.c
index bf0ec89e13..063ada5772 100644
--- a/src/gallium/drivers/i965/brw_context.c
+++ b/src/gallium/drivers/i965/brw_context.c
@@ -30,32 +30,21 @@
*/
-#include "main/imports.h"
-#include "main/api_noop.h"
-#include "main/macros.h"
-#include "main/vtxfmt.h"
-#include "main/simple_list.h"
-#include "shader/shader_api.h"
+#include "pipe/p_context.h"
#include "brw_context.h"
#include "brw_defines.h"
#include "brw_draw.h"
#include "brw_state.h"
#include "brw_vs.h"
-#include "intel_tex.h"
-#include "intel_blit.h"
+#include "brw_screen_tex.h"
#include "intel_batchbuffer.h"
-#include "intel_pixel.h"
-#include "intel_span.h"
-#include "tnl/t_pipeline.h"
-#include "utils.h"
-GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
+struct pipe_context *brw_create_context( struct pipe_screen *screen,
+ void *priv )
{
struct brw_context *brw = (struct brw_context *) CALLOC_STRUCT(brw_context);
@@ -87,9 +76,8 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
/**
* called from intelDestroyContext()
*/
-static void brw_destroy_context( struct intel_context *intel )
+static void brw_destroy_context( struct brw_context *brw )
{
- struct brw_context *brw = brw_context(&intel->ctx);
int i;
brw_destroy_state(brw);
@@ -102,27 +90,27 @@ static void brw_destroy_context( struct intel_context *intel )
brw->state.nr_color_regions = 0;
intel_region_release(&brw->state.depth_region);
- dri_bo_unreference(brw->curbe.curbe_bo);
- dri_bo_unreference(brw->vs.prog_bo);
- dri_bo_unreference(brw->vs.state_bo);
- dri_bo_unreference(brw->vs.bind_bo);
- dri_bo_unreference(brw->gs.prog_bo);
- dri_bo_unreference(brw->gs.state_bo);
- dri_bo_unreference(brw->clip.prog_bo);
- dri_bo_unreference(brw->clip.state_bo);
- dri_bo_unreference(brw->clip.vp_bo);
- dri_bo_unreference(brw->sf.prog_bo);
- dri_bo_unreference(brw->sf.state_bo);
- dri_bo_unreference(brw->sf.vp_bo);
+ brw->sws->bo_unreference(brw->curbe.curbe_bo);
+ brw->sws->bo_unreference(brw->vs.prog_bo);
+ brw->sws->bo_unreference(brw->vs.state_bo);
+ brw->sws->bo_unreference(brw->vs.bind_bo);
+ brw->sws->bo_unreference(brw->gs.prog_bo);
+ brw->sws->bo_unreference(brw->gs.state_bo);
+ brw->sws->bo_unreference(brw->clip.prog_bo);
+ brw->sws->bo_unreference(brw->clip.state_bo);
+ brw->sws->bo_unreference(brw->clip.vp_bo);
+ brw->sws->bo_unreference(brw->sf.prog_bo);
+ brw->sws->bo_unreference(brw->sf.state_bo);
+ brw->sws->bo_unreference(brw->sf.vp_bo);
for (i = 0; i < BRW_MAX_TEX_UNIT; i++)
- dri_bo_unreference(brw->wm.sdc_bo[i]);
- dri_bo_unreference(brw->wm.bind_bo);
+ brw->sws->bo_unreference(brw->wm.sdc_bo[i]);
+ brw->sws->bo_unreference(brw->wm.bind_bo);
for (i = 0; i < BRW_WM_MAX_SURF; i++)
- dri_bo_unreference(brw->wm.surf_bo[i]);
- dri_bo_unreference(brw->wm.sampler_bo);
- dri_bo_unreference(brw->wm.prog_bo);
- dri_bo_unreference(brw->wm.state_bo);
- dri_bo_unreference(brw->cc.prog_bo);
- dri_bo_unreference(brw->cc.state_bo);
- dri_bo_unreference(brw->cc.vp_bo);
+ brw->sws->bo_unreference(brw->wm.surf_bo[i]);
+ brw->sws->bo_unreference(brw->wm.sampler_bo);
+ brw->sws->bo_unreference(brw->wm.prog_bo);
+ brw->sws->bo_unreference(brw->wm.state_bo);
+ brw->sws->bo_unreference(brw->cc.prog_bo);
+ brw->sws->bo_unreference(brw->cc.state_bo);
+ brw->sws->bo_unreference(brw->cc.vp_bo);
}
diff --git a/src/gallium/drivers/i965/brw_context.h b/src/gallium/drivers/i965/brw_context.h
index 009e28b227..0fcb75a440 100644
--- a/src/gallium/drivers/i965/brw_context.h
+++ b/src/gallium/drivers/i965/brw_context.h
@@ -33,9 +33,9 @@
#ifndef BRWCONTEXT_INC
#define BRWCONTEXT_INC
-#include "intel_context.h"
#include "brw_structs.h"
-#include "main/imports.h"
+#include "brw_winsys.h"
+#include "pipe/p_state.h"
/* Glossary:
@@ -119,6 +119,19 @@
struct brw_context;
+#define PIPE_NEW_DEPTH_STENCIL_ALPHA 0x1
+#define PIPE_NEW_RAST 0x2
+#define PIPE_NEW_BLEND 0x2
+#define PIPE_NEW_VIEWPORT 0x2
+#define PIPE_NEW_FRAMEBUFFER 0x2
+#define PIPE_NEW_VERTEX_BUFFER 0x2
+#define PIPE_NEW_VERTEX_ELEMENT 0x2
+#define PIPE_NEW_FRAGMENT_SHADER 0x2
+#define PIPE_NEW_VERTEX_SHADER 0x2
+#define PIPE_NEW_FRAGMENT_CONSTS 0x2
+#define PIPE_NEW_VERTEX_CONSTS 0x2
+
+
#define BRW_NEW_URB_FENCE 0x1
#define BRW_NEW_FRAGMENT_PROGRAM 0x2
#define BRW_NEW_VERTEX_PROGRAM 0x4
@@ -156,26 +169,23 @@ struct brw_state_flags {
};
-/** Subclass of Mesa vertex program */
struct brw_vertex_program {
- struct gl_vertex_program program;
+ const struct tgsi_token *tokens;
GLuint id;
- dri_bo *const_buffer; /** Program constant buffer/surface */
+ struct brw_winsys_buffer *const_buffer; /** Program constant buffer/surface */
GLboolean use_const_buffer;
};
/** Subclass of Mesa fragment program */
struct brw_fragment_program {
- struct gl_fragment_program program;
+ const struct tgsi_token *tokens;
+
GLuint id; /**< serial no. to identify frag progs, never re-used */
- GLboolean isGLSL; /**< really, any IF/LOOP/CONT/BREAK instructions */
+ GLboolean isGLSL; /**< any IF/LOOP/CONT/BREAK instructions */
- dri_bo *const_buffer; /** Program constant buffer/surface */
+ struct brw_winsys_buffer *const_buffer; /** Program constant buffer/surface */
GLboolean use_const_buffer;
-
- /** for debugging, which texture units are referenced */
- GLbitfield tex_units_used;
};
@@ -244,7 +254,7 @@ struct brw_vs_prog_data {
/* Size == 0 if output either not written, or always [0,0,0,1]
*/
struct brw_vs_ouput_sizes {
- GLubyte output_size[VERT_RESULT_MAX];
+ GLubyte output_size[PIPE_MAX_SHADER_OUTPUTS];
};
@@ -312,10 +322,10 @@ struct brw_cache_item {
GLuint hash;
GLuint key_size; /* for variable-sized keys */
const void *key;
- dri_bo **reloc_bufs;
+ struct brw_winsys_buffer **reloc_bufs;
GLuint nr_reloc_bufs;
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
GLuint data_size;
struct brw_cache_item *next;
@@ -336,7 +346,7 @@ struct brw_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];
+ struct brw_winsys_buffer *last_bo[BRW_MAX_CACHE];
};
@@ -384,56 +394,22 @@ struct brw_cached_batch_item {
/* Protect against a future where VERT_ATTRIB_MAX > 32. Wouldn't life
* be easier if C allowed arrays of packed elements?
*/
-#define ATTRIB_BIT_DWORDS ((VERT_ATTRIB_MAX+31)/32)
-
-struct brw_vertex_element {
- const struct gl_client_array *glarray;
-
- /** The corresponding Mesa vertex attribute */
- gl_vert_attrib attrib;
- /** Size of a complete element */
- GLuint element_size;
- /** Number of uploaded elements for this input. */
- GLuint count;
- /** 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;
-};
-
-
-
-struct brw_vertex_info {
- GLuint sizes[ATTRIB_BIT_DWORDS * 2]; /* sizes:2[VERT_ATTRIB_MAX] */
-};
+#define VS_INPUT_BITMASK_DWORDS ((PIPE_MAX_SHADER_INPUTS+31)/32)
-/* Cache for TNL programs.
- */
-struct brw_tnl_cache_item {
- GLuint hash;
- void *key;
- void *data;
- struct brw_tnl_cache_item *next;
+struct brw_vertex_info {
+ GLuint sizes[VS_INPUT_BITMASK_DWORDS * 2]; /* sizes:2[VERT_ATTRIB_MAX] */
};
-struct brw_tnl_cache {
- struct brw_tnl_cache_item **items;
- GLuint size, n_items;
-};
struct brw_query_object {
- struct gl_query_object Base;
-
/** Doubly linked list of active query objects in the context. */
struct brw_query_object *prev, *next;
/** Last query BO associated with this query. */
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
/** First index in bo with query data for this object. */
int first_index;
/** Last index in bo with query data for this object. */
@@ -445,22 +421,29 @@ struct brw_query_object {
/**
- * brw_context is derived from intel_context.
+ * brw_context is derived from pipe_context
*/
struct brw_context
{
+ struct pipe_context *pipe;
+ struct pipe_screen *screen;
+
+ struct brw_winsys_screen *sws;
+
GLuint primitive;
GLboolean emit_state_always;
GLboolean no_batch_wrap;
+ /* Active vertex program:
+ */
+ const struct gl_vertex_program *vertex_program;
+ const struct gl_fragment_program *fragment_program;
+ struct pipe_framebuffer_state fb;
+
struct {
struct brw_state_flags dirty;
- GLuint nr_color_regions;
- struct intel_region *color_regions[MAX_DRAW_BUFFERS];
- struct intel_region *depth_region;
-
/**
* List of buffers accumulated in brw_validate_state to receive
* dri_bo_check_aperture treatment before exec, so we can know if we
@@ -471,7 +454,7 @@ struct brw_context
* consisting of the vertex buffers, pipelined state pointers,
* the CURBE, the depth buffer, and a query BO.
*/
- dri_bo *validated_bos[VERT_ATTRIB_MAX + 16];
+ struct brw_winsys_buffer *validated_bos[PIPE_MAX_SHADER_INPUTS + 16];
int validated_bo_count;
} state;
@@ -480,18 +463,14 @@ struct brw_context
struct brw_cached_batch_item *cached_batch_items;
struct {
- struct brw_vertex_element inputs[VERT_ATTRIB_MAX];
+ struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
+ struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
+ unsigned num_vertex_element;
+ unsigned num_vertex_buffer;
- struct brw_vertex_element *enabled[VERT_ATTRIB_MAX];
- GLuint nr_enabled;
-
-#define BRW_NR_UPLOAD_BUFS 17
-#define BRW_UPLOAD_INIT_SIZE (128*1024)
-
- struct {
- dri_bo *bo;
- GLuint offset;
- } upload;
+ struct u_upload_mgr *upload_vertex;
+ struct u_upload_mgr *upload_index;
+
/* Summary of size and varying of active arrays, so we can check
* for changes to this state:
@@ -509,7 +488,7 @@ struct brw_context
const struct _mesa_index_buffer *ib;
/* Updates to these fields are signaled by BRW_NEW_INDEX_BUFFER. */
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
unsigned int offset;
unsigned int size;
/* Offset to index buffer index to use in CMD_3D_PRIM so that we can
@@ -519,16 +498,6 @@ struct brw_context
unsigned int start_vertex_offset;
} ib;
- /* Active vertex program:
- */
- const struct gl_vertex_program *vertex_program;
- const struct gl_fragment_program *fragment_program;
-
-
- /* For populating the gtt:
- */
- GLuint next_free_page;
-
/* BRW_NEW_URB_ALLOCATIONS:
*/
@@ -545,12 +514,6 @@ struct brw_context
GLuint nr_sf_entries;
GLuint nr_cs_entries;
-/* GLuint vs_size; */
-/* GLuint gs_size; */
-/* GLuint clip_size; */
-/* GLuint sf_size; */
-/* GLuint cs_size; */
-
GLuint vs_start;
GLuint gs_start;
GLuint clip_start;
@@ -570,7 +533,7 @@ struct brw_context
GLuint vs_size;
GLuint total_size;
- dri_bo *curbe_bo;
+ struct brw_winsys_buffer *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 */
@@ -588,12 +551,12 @@ struct brw_context
struct {
struct brw_vs_prog_data *prog_data;
- dri_bo *prog_bo;
- dri_bo *state_bo;
+ struct brw_winsys_buffer *prog_bo;
+ struct brw_winsys_buffer *state_bo;
/** Binding table of pointers to surf_bo entries */
- dri_bo *bind_bo;
- dri_bo *surf_bo[BRW_VS_MAX_SURF];
+ struct brw_winsys_buffer *bind_bo;
+ struct brw_winsys_buffer *surf_bo[BRW_VS_MAX_SURF];
GLuint nr_surfaces;
} vs;
@@ -601,25 +564,25 @@ struct brw_context
struct brw_gs_prog_data *prog_data;
GLboolean prog_active;
- dri_bo *prog_bo;
- dri_bo *state_bo;
+ struct brw_winsys_buffer *prog_bo;
+ struct brw_winsys_buffer *state_bo;
} gs;
struct {
struct brw_clip_prog_data *prog_data;
- dri_bo *prog_bo;
- dri_bo *state_bo;
- dri_bo *vp_bo;
+ struct brw_winsys_buffer *prog_bo;
+ struct brw_winsys_buffer *state_bo;
+ struct brw_winsys_buffer *vp_bo;
} clip;
struct {
struct brw_sf_prog_data *prog_data;
- dri_bo *prog_bo;
- dri_bo *state_bo;
- dri_bo *vp_bo;
+ struct brw_winsys_buffer *prog_bo;
+ struct brw_winsys_buffer *state_bo;
+ struct brw_winsys_buffer *vp_bo;
} sf;
struct {
@@ -629,38 +592,38 @@ struct brw_context
/** Input sizes, calculated from active vertex program.
* One bit per fragment program input attribute.
*/
- GLbitfield input_size_masks[4];
+ //GLbitfield input_size_masks[4];
/** Array of surface default colors (texture border color) */
- dri_bo *sdc_bo[BRW_MAX_TEX_UNIT];
+ struct brw_winsys_buffer *sdc_bo[BRW_MAX_TEX_UNIT];
GLuint render_surf;
GLuint nr_surfaces;
GLuint max_threads;
- dri_bo *scratch_bo;
+ struct brw_winsys_buffer *scratch_bo;
GLuint sampler_count;
- dri_bo *sampler_bo;
+ struct brw_winsys_buffer *sampler_bo;
/** Binding table of pointers to surf_bo entries */
- dri_bo *bind_bo;
- dri_bo *surf_bo[BRW_WM_MAX_SURF];
+ struct brw_winsys_buffer *bind_bo;
+ struct brw_winsys_buffer *surf_bo[PIPE_MAX_COLOR_BUFS];
- dri_bo *prog_bo;
- dri_bo *state_bo;
+ struct brw_winsys_buffer *prog_bo;
+ struct brw_winsys_buffer *state_bo;
} wm;
struct {
- dri_bo *prog_bo;
- dri_bo *state_bo;
- dri_bo *vp_bo;
+ struct brw_winsys_buffer *prog_bo;
+ struct brw_winsys_buffer *state_bo;
+ struct brw_winsys_buffer *vp_bo;
} cc;
struct {
struct brw_query_object active_head;
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
int index;
GLboolean active;
} query;
@@ -679,12 +642,6 @@ struct brw_context
*/
void brwInitVtbl( struct brw_context *brw );
-/*======================================================================
- * brw_context.c
- */
-GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
/*======================================================================
* brw_queryobj.c
@@ -697,7 +654,7 @@ void brw_emit_query_end(struct brw_context *brw);
/*======================================================================
* brw_state_dump.c
*/
-void brw_debug_batch(struct intel_context *intel);
+void brw_debug_batch(struct brw_context *intel);
/*======================================================================
* brw_tex.c
@@ -706,9 +663,9 @@ void brw_validate_textures( struct brw_context *brw );
/*======================================================================
- * brw_program.c
+ * brw_pipe_shader.c
*/
-void brwInitFragProgFuncs( struct dd_function_table *functions );
+void brw_init_shader_funcs( struct brw_context *brw );
/* brw_urb.c
diff --git a/src/gallium/drivers/i965/brw_curbe.c b/src/gallium/drivers/i965/brw_curbe.c
index 3e32c4983d..33ea9a00f7 100644
--- a/src/gallium/drivers/i965/brw_curbe.c
+++ b/src/gallium/drivers/i965/brw_curbe.c
@@ -47,7 +47,6 @@
*/
static void calculate_curbe_offsets( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
/* CACHE_NEW_WM_PROG */
const GLuint nr_fp_regs = (brw->wm.prog_data->nr_params + 15) / 16;
@@ -157,7 +156,6 @@ static GLfloat fixed_plane[6][4] = {
*/
static void prepare_constant_buffer(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
const struct brw_vertex_program *vp =
brw_vertex_program_const(brw->vertex_program);
const struct brw_fragment_program *fp =
@@ -269,7 +267,7 @@ static void prepare_constant_buffer(struct brw_context *brw)
(brw->curbe.need_new_bo ||
brw->curbe.curbe_next_offset + bufsz > brw->curbe.curbe_bo->size))
{
- dri_bo_unreference(brw->curbe.curbe_bo);
+ brw->sws->bo_unreference(brw->curbe.curbe_bo);
brw->curbe.curbe_bo = NULL;
}
@@ -310,7 +308,6 @@ static void prepare_constant_buffer(struct brw_context *brw)
static void emit_constant_buffer(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
GLuint sz = brw->curbe.total_size;
BEGIN_BATCH(2, IGNORE_CLIPRECTS);
diff --git a/src/gallium/drivers/i965/brw_draw.c b/src/gallium/drivers/i965/brw_draw.c
index 8cd117c24f..856999f3ef 100644
--- a/src/gallium/drivers/i965/brw_draw.c
+++ b/src/gallium/drivers/i965/brw_draw.c
@@ -26,15 +26,6 @@
**************************************************************************/
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/state.h"
-#include "main/enums.h"
-#include "tnl/tnl.h"
-#include "vbo/vbo_context.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-
#include "brw_draw.h"
#include "brw_defines.h"
#include "brw_context.h"
@@ -67,7 +58,6 @@ static uint32_t prim_to_hw_prim[PIPE_PRIM_POLYGON+1] = {
*/
static GLuint brw_set_prim(struct brw_context *brw, GLenum prim)
{
- GLcontext *ctx = &brw->intel.ctx;
if (INTEL_DEBUG & DEBUG_PRIMS)
_mesa_printf("PRIM: %s\n", _mesa_lookup_enum_by_nr(prim));
@@ -110,7 +100,6 @@ static void brw_emit_prim(struct brw_context *brw,
uint32_t hw_prim)
{
struct brw_3d_primitive prim_packet;
- struct intel_context *intel = &brw->intel;
if (INTEL_DEBUG & DEBUG_PRIMS)
_mesa_printf("PRIM: %s %d %d\n", _mesa_lookup_enum_by_nr(prim->mode),
@@ -163,7 +152,7 @@ static void brw_merge_inputs( struct brw_context *brw,
GLuint i;
for (i = 0; i < VERT_ATTRIB_MAX; i++)
- dri_bo_unreference(brw->vb.inputs[i].bo);
+ brw->sws->bo_unreference(brw->vb.inputs[i].bo);
memset(&brw->vb.inputs, 0, sizeof(brw->vb.inputs));
memset(&brw->vb.info, 0, sizeof(brw->vb.info));
@@ -185,7 +174,7 @@ static void brw_merge_inputs( struct brw_context *brw,
/* May fail if out of video memory for texture or vbo upload, or on
* fallback conditions.
*/
-static GLboolean brw_try_draw_prims( GLcontext *ctx,
+static GLboolean brw_try_draw_prims( struct brw_context *brw,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
@@ -193,7 +182,6 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
GLuint min_index,
GLuint max_index )
{
- struct intel_context *intel = intel_context(ctx);
struct brw_context *brw = brw_context(ctx);
GLboolean retval = GL_FALSE;
GLboolean warn = GL_FALSE;
@@ -241,7 +229,7 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
return 0;
}
-void brw_draw_prims( GLcontext *ctx,
+void brw_draw_prims( struct brw_context *brw,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
@@ -274,7 +262,6 @@ void brw_draw_prims( GLcontext *ctx,
void brw_draw_init( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
struct vbo_context *vbo = vbo_context(ctx);
/* Register our drawing function:
@@ -287,15 +274,15 @@ void brw_draw_destroy( struct brw_context *brw )
int i;
if (brw->vb.upload.bo != NULL) {
- dri_bo_unreference(brw->vb.upload.bo);
+ brw->sws->bo_unreference(brw->vb.upload.bo);
brw->vb.upload.bo = NULL;
}
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
- dri_bo_unreference(brw->vb.inputs[i].bo);
+ brw->sws->bo_unreference(brw->vb.inputs[i].bo);
brw->vb.inputs[i].bo = NULL;
}
- dri_bo_unreference(brw->ib.bo);
+ brw->sws->bo_unreference(brw->ib.bo);
brw->ib.bo = NULL;
}
diff --git a/src/gallium/drivers/i965/brw_draw.h b/src/gallium/drivers/i965/brw_draw.h
index 2a14db217f..dc7ca8731d 100644
--- a/src/gallium/drivers/i965/brw_draw.h
+++ b/src/gallium/drivers/i965/brw_draw.h
@@ -28,13 +28,12 @@
#ifndef BRW_DRAW_H
#define BRW_DRAW_H
-#include "main/mtypes.h" /* for GLcontext... */
-#include "vbo/vbo.h"
+#include "brw_types.h"
struct brw_context;
-void brw_draw_prims( GLcontext *ctx,
+void brw_draw_prims( struct brw_context *brw,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prims,
GLuint nr_prims,
@@ -48,7 +47,7 @@ void brw_draw_destroy( struct brw_context *brw );
/* brw_draw_current.c
*/
-void brw_init_current_values(GLcontext *ctx,
+void brw_init_current_values(struct brw_context *brw,
struct gl_client_array *arrays);
#endif
diff --git a/src/gallium/drivers/i965/brw_draw_upload.c b/src/gallium/drivers/i965/brw_draw_upload.c
index ad3ef6b7dd..dce015d79f 100644
--- a/src/gallium/drivers/i965/brw_draw_upload.c
+++ b/src/gallium/drivers/i965/brw_draw_upload.c
@@ -191,8 +191,6 @@ static unsigned get_index_type(int type)
static boolean brw_prepare_vertices(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
- struct intel_context *intel = intel_context(ctx);
GLbitfield vs_inputs = brw->vs.prog_data->inputs_read;
GLuint i;
const unsigned char *ptr = NULL;
@@ -210,15 +208,17 @@ static boolean brw_prepare_vertices(struct brw_context *brw)
- for (i = 0; i < brw->vb.nr_enabled; i++) {
- struct brw_vertex_element *input = brw->vb.enabled[i];
+ for (i = 0; i < brw->vb.num_vertex_buffer; i++) {
+ struct brw_vertex_buffer *vb = brw->vb.vertex_buffer[i];
+ unsigned size = (vb->stride == 0 ?
+ vb->size :
+ vb->stride * (max_index + 1 - min_index));
- input->element_size = get_size(input->glarray->Type) * input->glarray->Size;
if (brw_is_user_buffer(vb)) {
- u_upload_buffer( brw->upload,
+ u_upload_buffer( brw->upload_vertex,
min_index * vb->stride,
- (max_index + 1 - min_index) * vb->stride,
+ size,
&offset,
&buffer );
}
@@ -226,20 +226,20 @@ static boolean brw_prepare_vertices(struct brw_context *brw)
{
offset = 0;
buffer = vb->buffer;
- count = stride == 0 ? 1 : max_index + 1 - min_index;
}
-
- /* Named buffer object: Just reference its contents directly. */
- dri_bo_unreference(input->bo);
- input->bo = intel_bufferobj_buffer(intel, intel_buffer,
- INTEL_READ);
- dri_bo_reference(input->bo);
-
+
+ /* Set up post-upload info about this vertex buffer:
+ */
input->offset = (unsigned long)offset;
input->stride = vb->stride;
input->count = count;
+ brw->sws->bo_unreference(input->bo);
+ input->bo = intel_bufferobj_buffer(intel, intel_buffer,
+ INTEL_READ);
+ brw->sws->bo_reference(input->bo);
assert(input->offset < input->bo->size);
+ assert(input->offset + size <= input->bo->size);
}
brw_prepare_query_begin(brw);
@@ -253,8 +253,6 @@ static boolean brw_prepare_vertices(struct brw_context *brw)
static void brw_emit_vertices(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
- struct intel_context *intel = intel_context(ctx);
GLuint i;
brw_emit_query_begin(brw);
@@ -370,11 +368,9 @@ const struct brw_tracked_state brw_vertices = {
static void brw_prepare_indices(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
- struct intel_context *intel = &brw->intel;
const struct _mesa_index_buffer *index_buffer = brw->ib.ib;
GLuint ib_size;
- dri_bo *bo = NULL;
+ struct brw_winsys_buffer *bo = NULL;
struct gl_buffer_object *bufferobj;
GLuint offset;
GLuint ib_type_size;
@@ -421,7 +417,7 @@ static void brw_prepare_indices(struct brw_context *brw)
} else {
bo = intel_bufferobj_buffer(intel, intel_buffer_object(bufferobj),
INTEL_READ);
- dri_bo_reference(bo);
+ brw->sws->bo_reference(bo);
/* Use CMD_3D_PRIM's start_vertex_offset to avoid re-uploading
* the index buffer state when we're just moving the start index
@@ -461,7 +457,6 @@ const struct brw_tracked_state brw_indices = {
static void brw_emit_index_buffer(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
const struct _mesa_index_buffer *index_buffer = brw->ib.ib;
if (index_buffer == NULL)
diff --git a/src/gallium/drivers/i965/brw_eu_debug.c b/src/gallium/drivers/i965/brw_eu_debug.c
index 29f3f6d02f..ad7ec36e86 100644
--- a/src/gallium/drivers/i965/brw_eu_debug.c
+++ b/src/gallium/drivers/i965/brw_eu_debug.c
@@ -30,8 +30,6 @@
*/
-#include "main/mtypes.h"
-#include "main/imports.h"
#include "brw_eu.h"
void brw_print_reg( struct brw_reg hwreg )
diff --git a/src/gallium/drivers/i965/brw_gs.c b/src/gallium/drivers/i965/brw_gs.c
index 5ec0c585fe..58930e7964 100644
--- a/src/gallium/drivers/i965/brw_gs.c
+++ b/src/gallium/drivers/i965/brw_gs.c
@@ -29,10 +29,6 @@
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "main/glheader.h"
-#include "main/macros.h"
-#include "main/enums.h"
-
#include "intel_batchbuffer.h"
#include "brw_defines.h"
@@ -124,7 +120,7 @@ static void compile_gs_prog( struct brw_context *brw,
/* Upload
*/
- dri_bo_unreference(brw->gs.prog_bo);
+ brw->sws->bo_unreference(brw->gs.prog_bo);
brw->gs.prog_bo = brw_upload_cache( &brw->cache, BRW_GS_PROG,
&c.key, sizeof(c.key),
NULL, 0,
@@ -180,7 +176,7 @@ static void prepare_gs_prog(struct brw_context *brw)
}
if (brw->gs.prog_active) {
- dri_bo_unreference(brw->gs.prog_bo);
+ brw->sws->bo_unreference(brw->gs.prog_bo);
brw->gs.prog_bo = brw_search_cache(&brw->cache, BRW_GS_PROG,
&key, sizeof(key),
NULL, 0,
diff --git a/src/gallium/drivers/i965/brw_gs_emit.c b/src/gallium/drivers/i965/brw_gs_emit.c
index a9b2aa2eac..9ec206d7e8 100644
--- a/src/gallium/drivers/i965/brw_gs_emit.c
+++ b/src/gallium/drivers/i965/brw_gs_emit.c
@@ -30,11 +30,6 @@
*/
-#include "main/glheader.h"
-#include "main/macros.h"
-#include "main/enums.h"
-
-#include "shader/program.h"
#include "intel_batchbuffer.h"
#include "brw_defines.h"
diff --git a/src/gallium/drivers/i965/brw_gs_state.c b/src/gallium/drivers/i965/brw_gs_state.c
index ed9d2ffe60..6d03d72d96 100644
--- a/src/gallium/drivers/i965/brw_gs_state.c
+++ b/src/gallium/drivers/i965/brw_gs_state.c
@@ -34,7 +34,6 @@
#include "brw_context.h"
#include "brw_state.h"
#include "brw_defines.h"
-#include "main/macros.h"
struct brw_gs_unit_key {
unsigned int total_grf;
@@ -69,11 +68,11 @@ gs_unit_populate_key(struct brw_context *brw, struct brw_gs_unit_key *key)
key->urb_size = brw->urb.vsize;
}
-static dri_bo *
+static struct brw_winsys_buffer *
gs_unit_create_from_key(struct brw_context *brw, struct brw_gs_unit_key *key)
{
struct brw_gs_unit_state gs;
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
memset(&gs, 0, sizeof(gs));
@@ -128,7 +127,7 @@ static void prepare_gs_unit(struct brw_context *brw)
gs_unit_populate_key(brw, &key);
- dri_bo_unreference(brw->gs.state_bo);
+ brw->sws->bo_unreference(brw->gs.state_bo);
brw->gs.state_bo = brw_search_cache(&brw->cache, BRW_GS_UNIT,
&key, sizeof(key),
&brw->gs.prog_bo, 1,
diff --git a/src/gallium/drivers/i965/brw_misc_state.c b/src/gallium/drivers/i965/brw_misc_state.c
index ea71857548..d33bf40a01 100644
--- a/src/gallium/drivers/i965/brw_misc_state.c
+++ b/src/gallium/drivers/i965/brw_misc_state.c
@@ -48,7 +48,6 @@
static void upload_blend_constant_color(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
struct brw_blend_constant_color bcc;
memset(&bcc, 0, sizeof(bcc));
@@ -75,17 +74,11 @@ const struct brw_tracked_state brw_blend_constant_color = {
/* Constant single cliprect for framebuffer object or DRI2 drawing */
static void upload_drawing_rect(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
-
- if (!intel->constant_cliprect)
- return;
-
BEGIN_BATCH(4, NO_LOOP_CLIPRECTS);
OUT_BATCH(_3DSTATE_DRAWRECT_INFO_I965);
- OUT_BATCH(0); /* xmin, ymin */
- OUT_BATCH(((ctx->DrawBuffer->Width - 1) & 0xffff) |
- ((ctx->DrawBuffer->Height - 1) << 16));
+ OUT_BATCH(0);
+ OUT_BATCH(((brw->fb.width - 1) & 0xffff) |
+ ((brw->fb.height - 1) << 16));
OUT_BATCH(0);
ADVANCE_BATCH();
}
@@ -114,8 +107,6 @@ static void prepare_binding_table_pointers(struct brw_context *brw)
*/
static void upload_binding_table_pointers(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
-
BEGIN_BATCH(6, IGNORE_CLIPRECTS);
OUT_BATCH(CMD_BINDING_TABLE_PTRS << 16 | (6 - 2));
if (brw->vs.bind_bo != NULL)
@@ -148,8 +139,6 @@ const struct brw_tracked_state brw_binding_table_pointers = {
*/
static void upload_pipelined_state_pointers(struct brw_context *brw )
{
- struct intel_context *intel = &brw->intel;
-
BEGIN_BATCH(7, IGNORE_CLIPRECTS);
OUT_BATCH(CMD_PIPELINED_STATE_POINTERS << 16 | (7 - 2));
OUT_RELOC(brw->vs.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
@@ -210,7 +199,6 @@ static void prepare_depthbuffer(struct brw_context *brw)
static void emit_depthbuffer(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
struct intel_region *region = brw->state.depth_region;
unsigned int len = (BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw)) ? 6 : 5;
@@ -287,7 +275,6 @@ const struct brw_tracked_state brw_depthbuffer = {
static void upload_polygon_stipple(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
struct brw_polygon_stipple bps;
GLuint i;
@@ -401,7 +388,6 @@ const struct brw_tracked_state brw_aa_line_parameters = {
static void upload_line_stipple(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
struct brw_line_stipple bls;
GLfloat tmp;
GLint tmpi;
@@ -507,8 +493,6 @@ const struct brw_tracked_state brw_invarient_state = {
*/
static void upload_state_base_address( struct brw_context *brw )
{
- struct intel_context *intel = &brw->intel;
-
/* Output the structure (brw_state_base_address) directly to the
* batchbuffer, so we can emit relocations inline.
*/
diff --git a/src/gallium/drivers/i965/brw_pipe_depth.c b/src/gallium/drivers/i965/brw_pipe_depth.c
index da29bc8bcb..29f135d37a 100644
--- a/src/gallium/drivers/i965/brw_pipe_depth.c
+++ b/src/gallium/drivers/i965/brw_pipe_depth.c
@@ -1,5 +1,9 @@
- /* _NEW_STENCIL */
- if (key->dsa.stencil[0].enable) {
+
+static void *
+brw_create_depth_stencil( struct pipe_context *pipe,
+ const struct pipe_depth_stencil_alpha_state *tmpl )
+{
+ if (tmpl->stencil[0].enable) {
cc.cc0.stencil_enable = 1;
cc.cc0.stencil_func =
intel_translate_compare_func(key->stencil_func[0]);
@@ -13,7 +17,7 @@
cc.cc1.stencil_write_mask = key->stencil_write_mask[0];
cc.cc1.stencil_test_mask = key->stencil_test_mask[0];
- if (key->stencil_two_side) {
+ if (tmpl->stencil[1].enable) {
cc.cc0.bf_stencil_enable = 1;
cc.cc0.bf_stencil_func =
intel_translate_compare_func(key->stencil_func[1]);
@@ -30,9 +34,8 @@
/* Not really sure about this:
*/
- if (key->stencil_write_mask[0] ||
- (key->stencil_two_side && key->stencil_write_mask[1]))
- cc.cc0.stencil_write_enable = 1;
+ cc.cc0.stencil_write_enable = (cc.cc1.stencil_write_mask ||
+ cc.cc2.bf_stencil_write_mask);
}
@@ -50,3 +53,6 @@
cc.cc2.depth_test_function = intel_translate_compare_func(key->depth_func);
cc.cc2.depth_write_enable = key->depth_write;
}
+
+
+}
diff --git a/src/gallium/drivers/i965/brw_pipe_fb.c b/src/gallium/drivers/i965/brw_pipe_fb.c
index d4ae332f46..dbf97a0544 100644
--- a/src/gallium/drivers/i965/brw_pipe_fb.c
+++ b/src/gallium/drivers/i965/brw_pipe_fb.c
@@ -2,12 +2,12 @@
/**
* called from intelDrawBuffer()
*/
-static void brw_set_draw_region( struct intel_context *intel,
+static void brw_set_draw_region( struct pipe_context *pipe,
struct intel_region *color_regions[],
struct intel_region *depth_region,
GLuint num_color_regions)
{
- struct brw_context *brw = brw_context(&intel->ctx);
+ struct brw_context *brw = brw_context(pipe);
GLuint i;
/* release old color/depth regions */
diff --git a/src/gallium/drivers/i965/brw_pipe_flush.c b/src/gallium/drivers/i965/brw_pipe_flush.c
index 008f623151..d5b7bd3b83 100644
--- a/src/gallium/drivers/i965/brw_pipe_flush.c
+++ b/src/gallium/drivers/i965/brw_pipe_flush.c
@@ -13,10 +13,8 @@ static void brw_finish_batch(struct intel_context *intel)
/**
* called from intelFlushBatchLocked
*/
-static void brw_new_batch( struct intel_context *intel )
+static void brw_new_batch( struct brw_context *brw )
{
- struct brw_context *brw = brw_context(&intel->ctx);
-
/* Check that we didn't just wrap our batchbuffer at a bad time. */
assert(!brw->no_batch_wrap);
@@ -36,14 +34,14 @@ static void brw_new_batch( struct intel_context *intel )
* a new buffer next time.
*/
if (brw->vb.upload.bo != NULL) {
- dri_bo_unreference(brw->vb.upload.bo);
+ brw->sws->bo_unreference(brw->vb.upload.bo);
brw->vb.upload.bo = NULL;
brw->vb.upload.offset = 0;
}
}
-static void brw_note_fence( struct intel_context *intel, GLuint fence )
+static void brw_note_fence( struct brw_context *brw, GLuint fence )
{
brw_context(&intel->ctx)->state.dirty.brw |= BRW_NEW_FENCE;
}
diff --git a/src/gallium/drivers/i965/brw_queryobj.c b/src/gallium/drivers/i965/brw_pipe_query.c
index a195bc32b0..0b9ba0c0ed 100644
--- a/src/gallium/drivers/i965/brw_queryobj.c
+++ b/src/gallium/drivers/i965/brw_pipe_query.c
@@ -38,8 +38,7 @@
* required for handling queries, so that we can be sure that we won't
* have to emit a batchbuffer without getting the ending PS_DEPTH_COUNT.
*/
-#include "main/simple_list.h"
-#include "main/imports.h"
+#include "util/u_simple_list.h"
#include "brw_context.h"
#include "brw_state.h"
@@ -64,59 +63,57 @@ brw_queryobj_get_results(struct brw_query_object *query)
}
dri_bo_unmap(query->bo);
- dri_bo_unreference(query->bo);
+ brw->sws->bo_unreference(query->bo);
query->bo = NULL;
}
-static struct gl_query_object *
-brw_new_query_object(GLcontext *ctx, GLuint id)
+static struct pipe_query *
+brw_query_create(struct pipe_context *pipe, unsigned type )
{
struct brw_query_object *query;
- query = _mesa_calloc(sizeof(struct brw_query_object));
-
- query->Base.Id = id;
- query->Base.Result = 0;
- query->Base.Active = GL_FALSE;
- query->Base.Ready = GL_TRUE;
-
- return &query->Base;
+ switch (query->type) {
+ case PIPE_QUERY_OCCLUSION_COUNTER:
+ query = CALLOC_STRUCT( brw_query_object );
+ if (query == NULL)
+ return NULL;
+ return &query->Base;
+
+ default:
+ return NULL;
+ }
}
static void
-brw_delete_query(GLcontext *ctx, struct gl_query_object *q)
+brw_query_destroy(struct pipe_context *pipe, struct pipe_query *q)
{
struct brw_query_object *query = (struct brw_query_object *)q;
- dri_bo_unreference(query->bo);
- _mesa_free(query);
+ brw->sws->bo_unreference(query->bo);
+ FREE(query);
}
static void
-brw_begin_query(GLcontext *ctx, struct gl_query_object *q)
+brw_begin_query(struct pipe_context *pipe, struct pipe_query *q)
{
- struct brw_context *brw = brw_context(ctx);
- struct intel_context *intel = intel_context(ctx);
+ struct brw_context *brw = brw_context(pipe);
struct brw_query_object *query = (struct brw_query_object *)q;
/* Reset our driver's tracking of query state. */
- dri_bo_unreference(query->bo);
+ brw->sws->bo_unreference(query->bo);
query->bo = NULL;
query->first_index = -1;
query->last_index = -1;
insert_at_head(&brw->query.active_head, query);
- intel->stats_wm++;
+ brw->stats_wm++;
+ brw->dirty.mesa |= PIPE_NEW_QUERY;
}
-/**
- * Begin the ARB_occlusion_query query on a query object.
- */
static void
-brw_end_query(GLcontext *ctx, struct gl_query_object *q)
+brw_end_query(struct pipe_context *pipe, struct pipe_query *q)
{
- struct brw_context *brw = brw_context(ctx);
- struct intel_context *intel = intel_context(ctx);
+ struct brw_context *brw = brw_context(pipe);
struct brw_query_object *query = (struct brw_query_object *)q;
/* Flush the batchbuffer in case it has writes to our query BO.
@@ -125,18 +122,18 @@ brw_end_query(GLcontext *ctx, struct gl_query_object *q)
*/
if (query->bo) {
brw_emit_query_end(brw);
- intel_batchbuffer_flush(intel->batch);
+ intel_batchbuffer_flush(brw->batch);
- dri_bo_unreference(brw->query.bo);
+ brw->sws->bo_unreference(brw->query.bo);
brw->query.bo = NULL;
}
remove_from_list(query);
-
- intel->stats_wm--;
+ brw->stats_wm--;
+ brw->dirty.mesa |= PIPE_NEW_QUERY;
}
-static void brw_wait_query(GLcontext *ctx, struct gl_query_object *q)
+static void brw_wait_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct brw_query_object *query = (struct brw_query_object *)q;
@@ -144,7 +141,7 @@ static void brw_wait_query(GLcontext *ctx, struct gl_query_object *q)
query->Base.Ready = GL_TRUE;
}
-static void brw_check_query(GLcontext *ctx, struct gl_query_object *q)
+static void brw_check_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct brw_query_object *query = (struct brw_query_object *)q;
@@ -158,8 +155,6 @@ static void brw_check_query(GLcontext *ctx, struct gl_query_object *q)
void
brw_prepare_query_begin(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
-
/* Skip if we're not doing any queries. */
if (is_empty_list(&brw->query.active_head))
return;
@@ -167,10 +162,10 @@ brw_prepare_query_begin(struct brw_context *brw)
/* Get a new query BO if we're going to need it. */
if (brw->query.bo == NULL ||
brw->query.index * 2 + 1 >= 4096 / sizeof(uint64_t)) {
- dri_bo_unreference(brw->query.bo);
+ brw->sws->bo_unreference(brw->query.bo);
brw->query.bo = NULL;
- brw->query.bo = dri_bo_alloc(intel->bufmgr, "query", 4096, 1);
+ brw->query.bo = dri_bo_alloc(brw->bufmgr, "query", 4096, 1);
brw->query.index = 0;
}
@@ -181,7 +176,6 @@ brw_prepare_query_begin(struct brw_context *brw)
void
brw_emit_query_begin(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
struct brw_query_object *query;
/* Skip if we're not doing any queries, or we've emitted the start. */
@@ -209,7 +203,7 @@ brw_emit_query_begin(struct brw_context *brw)
if (query->bo != brw->query.bo) {
if (query->bo != NULL)
brw_queryobj_get_results(query);
- dri_bo_reference(brw->query.bo);
+ brw->sws->bo_reference(brw->query.bo);
query->bo = brw->query.bo;
query->first_index = brw->query.index;
}
@@ -222,8 +216,6 @@ brw_emit_query_begin(struct brw_context *brw)
void
brw_emit_query_end(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
-
if (!brw->query.active)
return;
diff --git a/src/gallium/drivers/i965/brw_program.c b/src/gallium/drivers/i965/brw_program.c
deleted file mode 100644
index bac69187c1..0000000000
--- a/src/gallium/drivers/i965/brw_program.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- Copyright (C) Intel Corp. 2006. All Rights Reserved.
- Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
- develop this 3D driver.
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice (including the
- next paragraph) shall be included in all copies or substantial
- portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- **********************************************************************/
- /*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "main/imports.h"
-#include "main/enums.h"
-#include "shader/prog_parameter.h"
-#include "shader/program.h"
-#include "shader/programopt.h"
-#include "tnl/tnl.h"
-
-#include "brw_context.h"
-#include "brw_util.h"
-#include "brw_wm.h"
-
-static void brwBindProgram( GLcontext *ctx,
- GLenum target,
- struct gl_program *prog )
-{
- struct brw_context *brw = brw_context(ctx);
-
- switch (target) {
- case GL_VERTEX_PROGRAM_ARB:
- brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM;
- break;
- case GL_FRAGMENT_PROGRAM_ARB:
- brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
- break;
- }
-}
-
-static struct gl_program *brwNewProgram( GLcontext *ctx,
- GLenum target,
- GLuint id )
-{
- struct brw_context *brw = brw_context(ctx);
-
- switch (target) {
- case GL_VERTEX_PROGRAM_ARB: {
- struct brw_vertex_program *prog = CALLOC_STRUCT(brw_vertex_program);
- if (prog) {
- prog->id = brw->program_id++;
-
- return _mesa_init_vertex_program( ctx, &prog->program,
- target, id );
- }
- else
- return NULL;
- }
-
- case GL_FRAGMENT_PROGRAM_ARB: {
- struct brw_fragment_program *prog = CALLOC_STRUCT(brw_fragment_program);
- if (prog) {
- prog->id = brw->program_id++;
-
- return _mesa_init_fragment_program( ctx, &prog->program,
- target, id );
- }
- else
- return NULL;
- }
-
- default:
- return _mesa_new_program(ctx, target, id);
- }
-}
-
-static void brwDeleteProgram( GLcontext *ctx,
- struct gl_program *prog )
-{
- if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) {
- struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
- struct brw_fragment_program *brw_fprog = brw_fragment_program(fprog);
- dri_bo_unreference(brw_fprog->const_buffer);
- }
-
- _mesa_delete_program( ctx, prog );
-}
-
-
-static GLboolean brwIsProgramNative( GLcontext *ctx,
- GLenum target,
- struct gl_program *prog )
-{
- return GL_TRUE;
-}
-
-static void brwProgramStringNotify( GLcontext *ctx,
- GLenum target,
- struct gl_program *prog )
-{
- struct brw_context *brw = brw_context(ctx);
-
- if (target == GL_FRAGMENT_PROGRAM_ARB) {
- struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
- struct brw_fragment_program *newFP = brw_fragment_program(fprog);
- const struct brw_fragment_program *curFP =
- brw_fragment_program_const(brw->fragment_program);
-
- if (fprog->FogOption) {
- _mesa_append_fog_code(ctx, fprog);
- fprog->FogOption = GL_NONE;
- }
-
- if (newFP == curFP)
- brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
- newFP->id = brw->program_id++;
- newFP->isGLSL = brw_wm_is_glsl(fprog);
- }
- else if (target == GL_VERTEX_PROGRAM_ARB) {
- struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog;
- struct brw_vertex_program *newVP = brw_vertex_program(vprog);
- const struct brw_vertex_program *curVP =
- brw_vertex_program_const(brw->vertex_program);
-
- if (newVP == curVP)
- brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM;
- if (newVP->program.IsPositionInvariant) {
- _mesa_insert_mvp_code(ctx, &newVP->program);
- }
- newVP->id = brw->program_id++;
-
- /* Also tell tnl about it:
- */
- _tnl_program_string(ctx, target, prog);
- }
-}
-
-void brwInitFragProgFuncs( struct dd_function_table *functions )
-{
- assert(functions->ProgramStringNotify == _tnl_program_string);
-
- functions->BindProgram = brwBindProgram;
- functions->NewProgram = brwNewProgram;
- functions->DeleteProgram = brwDeleteProgram;
- functions->IsProgramNative = brwIsProgramNative;
- functions->ProgramStringNotify = brwProgramStringNotify;
-}
-
diff --git a/src/gallium/drivers/i965/brw_sf.c b/src/gallium/drivers/i965/brw_sf.c
index 90513245ee..0115f77c08 100644
--- a/src/gallium/drivers/i965/brw_sf.c
+++ b/src/gallium/drivers/i965/brw_sf.c
@@ -30,10 +30,6 @@
*/
-#include "main/glheader.h"
-#include "main/macros.h"
-#include "main/enums.h"
-
#include "intel_batchbuffer.h"
#include "brw_defines.h"
@@ -46,7 +42,6 @@
static void compile_sf_prog( struct brw_context *brw,
struct brw_sf_prog_key *key )
{
- GLcontext *ctx = &brw->intel.ctx;
struct brw_sf_compile c;
const GLuint *program;
GLuint program_size;
@@ -116,7 +111,7 @@ static void compile_sf_prog( struct brw_context *brw,
/* Upload
*/
- dri_bo_unreference(brw->sf.prog_bo);
+ brw->sws->bo_unreference(brw->sf.prog_bo);
brw->sf.prog_bo = brw_upload_cache( &brw->cache, BRW_SF_PROG,
&c.key, sizeof(c.key),
NULL, 0,
@@ -129,7 +124,6 @@ static void compile_sf_prog( struct brw_context *brw,
*/
static void upload_sf_prog(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
struct brw_sf_prog_key key;
memset(&key, 0, sizeof(key));
@@ -167,7 +161,7 @@ static void upload_sf_prog(struct brw_context *brw)
key.do_twoside_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide);
/* _NEW_HINT */
- key.linear_color = (ctx->Hint.PerspectiveCorrection == GL_FASTEST);
+ key.linear_color = 0;
/* _NEW_POLYGON */
if (key.do_twoside_color) {
@@ -179,7 +173,7 @@ static void upload_sf_prog(struct brw_context *brw)
key.frontface_ccw = (ctx->Polygon.FrontFace == GL_CCW) ^ (ctx->DrawBuffer->Name != 0);
}
- dri_bo_unreference(brw->sf.prog_bo);
+ brw->sws->bo_unreference(brw->sf.prog_bo);
brw->sf.prog_bo = brw_search_cache(&brw->cache, BRW_SF_PROG,
&key, sizeof(key),
NULL, 0,
diff --git a/src/gallium/drivers/i965/brw_sf.h b/src/gallium/drivers/i965/brw_sf.h
index 6426b6df9f..26c2e8891a 100644
--- a/src/gallium/drivers/i965/brw_sf.h
+++ b/src/gallium/drivers/i965/brw_sf.h
@@ -45,19 +45,23 @@
#define SF_UNFILLED_TRIS 3
struct brw_sf_prog_key {
- GLuint attrs:32;
+
+ /* Bitmask of linear and perspective interpolated inputs, 0..nr
+ */
+ GLuint persp_attrs:32;
+ GLuint linear_attrs:32;
+
GLuint primitive:2;
GLuint do_twoside_color:1;
GLuint do_flat_shading:1;
GLuint frontface_ccw:1;
GLuint do_point_sprite:1;
- GLuint linear_color:1; /**< linear interp vs. perspective interp */
+ GLuint sprite_origin_lower_left:1;
GLuint pad:25;
- GLenum SpriteOrigin;
};
struct brw_sf_point_tex {
- GLboolean CoordReplace;
+ GLboolean CoordReplace;
};
struct brw_sf_compile {
diff --git a/src/gallium/drivers/i965/brw_sf_emit.c b/src/gallium/drivers/i965/brw_sf_emit.c
index 4cc427a935..c98d7ec13a 100644
--- a/src/gallium/drivers/i965/brw_sf_emit.c
+++ b/src/gallium/drivers/i965/brw_sf_emit.c
@@ -30,10 +30,6 @@
*/
-#include "main/glheader.h"
-#include "main/macros.h"
-#include "main/enums.h"
-
#include "intel_batchbuffer.h"
#include "brw_defines.h"
@@ -305,6 +301,10 @@ static void invert_det( struct brw_sf_compile *c)
}
+/* Two attributes packed into a wide register. Figure out if either
+ * or both of them need linear/perspective interpolation. Constant
+ * regs are left as-is.
+ */
static GLboolean calculate_masks( struct brw_sf_compile *c,
GLuint reg,
GLushort *pc,
@@ -312,20 +312,8 @@ static GLboolean calculate_masks( struct brw_sf_compile *c,
GLushort *pc_linear)
{
GLboolean is_last_attr = (reg == c->nr_setup_regs - 1);
- GLuint persp_mask;
- GLuint linear_mask;
-
- if (c->key.do_flat_shading || c->key.linear_color)
- persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS |
- FRAG_BIT_COL0 |
- FRAG_BIT_COL1);
- else
- persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS);
-
- if (c->key.do_flat_shading)
- linear_mask = c->key.attrs & ~(FRAG_BIT_COL0|FRAG_BIT_COL1);
- else
- linear_mask = c->key.attrs;
+ GLuint persp_mask = c->key.persp_attrs;
+ GLuint linear_mask = c->key.linear_attrs;
*pc_persp = 0;
*pc_linear = 0;
@@ -570,7 +558,7 @@ void brw_emit_point_sprite_setup( struct brw_sf_compile *c, GLboolean allocate)
{
brw_set_predicate_control_flag_value(p, pc);
if (tex->CoordReplace) {
- if (c->key.SpriteOrigin == GL_LOWER_LEFT) {
+ if (c->key.sprite_origin_lower_left) {
brw_MUL(p, c->m3C0, c->inv_w[0], brw_imm_f(1.0));
brw_MOV(p, vec1(suboffset(c->m3C0, 0)), brw_imm_f(0.0));
}
diff --git a/src/gallium/drivers/i965/brw_sf_state.c b/src/gallium/drivers/i965/brw_sf_state.c
index bc0f076073..5e1229d22f 100644
--- a/src/gallium/drivers/i965/brw_sf_state.c
+++ b/src/gallium/drivers/i965/brw_sf_state.c
@@ -34,12 +34,9 @@
#include "brw_context.h"
#include "brw_state.h"
#include "brw_defines.h"
-#include "main/macros.h"
-#include "intel_fbo.h"
static void upload_sf_vp(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
struct brw_sf_viewport sfv;
GLfloat y_scale, y_bias;
@@ -92,7 +89,7 @@ static void upload_sf_vp(struct brw_context *brw)
sfv.scissor.ymax = ctx->DrawBuffer->Height - ctx->DrawBuffer->_Ymin - 1;
}
- dri_bo_unreference(brw->sf.vp_bo);
+ brw->sws->bo_unreference(brw->sf.vp_bo);
brw->sf.vp_bo = brw_cache_data( &brw->cache, BRW_SF_VP, &sfv, NULL, 0 );
}
@@ -126,7 +123,6 @@ struct brw_sf_unit_key {
static void
sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
memset(key, 0, sizeof(*key));
/* CACHE_NEW_SF_PROG */
@@ -159,12 +155,12 @@ sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key)
key->render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
}
-static dri_bo *
+static struct brw_winsys_buffer *
sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key,
- dri_bo **reloc_bufs)
+ struct brw_winsys_buffer **reloc_bufs)
{
struct brw_sf_unit_state sf;
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
int chipset_max_threads;
memset(&sf, 0, sizeof(sf));
@@ -332,14 +328,14 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key,
static void upload_sf_unit( struct brw_context *brw )
{
struct brw_sf_unit_key key;
- dri_bo *reloc_bufs[2];
+ struct brw_winsys_buffer *reloc_bufs[2];
sf_unit_populate_key(brw, &key);
reloc_bufs[0] = brw->sf.prog_bo;
reloc_bufs[1] = brw->sf.vp_bo;
- dri_bo_unreference(brw->sf.state_bo);
+ brw->sws->bo_unreference(brw->sf.state_bo);
brw->sf.state_bo = brw_search_cache(&brw->cache, BRW_SF_UNIT,
&key, sizeof(key),
reloc_bufs, 2,
diff --git a/src/gallium/drivers/i965/brw_state.h b/src/gallium/drivers/i965/brw_state.h
index d639656b9d..a007d542d0 100644
--- a/src/gallium/drivers/i965/brw_state.h
+++ b/src/gallium/drivers/i965/brw_state.h
@@ -36,12 +36,12 @@
#include "brw_context.h"
static inline void
-brw_add_validated_bo(struct brw_context *brw, dri_bo *bo)
+brw_add_validated_bo(struct brw_context *brw, struct brw_winsys_buffer *bo)
{
assert(brw->state.validated_bo_count < ARRAY_SIZE(brw->state.validated_bos));
if (bo != NULL) {
- dri_bo_reference(bo);
+ brw->sws->bo_reference(bo);
brw->state.validated_bos[brw->state.validated_bo_count++] = bo;
}
};
@@ -95,9 +95,9 @@ const struct brw_tracked_state brw_index_buffer;
* Use same key for WM and VS surfaces.
*/
struct brw_surface_key {
- GLenum target, depthmode;
- dri_bo *bo;
- GLint format, internal_format;
+ unsigned target;
+ struct brw_winsys_buffer *bo;
+ GLint format;
GLint first_level, last_level;
GLint width, height, depth;
GLint pitch, cpp;
@@ -116,42 +116,42 @@ void brw_destroy_state(struct brw_context *brw);
/***********************************************************************
* brw_state_cache.c
*/
-dri_bo *brw_cache_data(struct brw_cache *cache,
+struct brw_winsys_buffer *brw_cache_data(struct brw_cache *cache,
enum brw_cache_id cache_id,
const void *data,
- dri_bo **reloc_bufs,
+ struct brw_winsys_buffer **reloc_bufs,
GLuint nr_reloc_bufs);
-dri_bo *brw_cache_data_sz(struct brw_cache *cache,
+struct brw_winsys_buffer *brw_cache_data_sz(struct brw_cache *cache,
enum brw_cache_id cache_id,
const void *data,
GLuint data_size,
- dri_bo **reloc_bufs,
+ struct brw_winsys_buffer **reloc_bufs,
GLuint nr_reloc_bufs);
-dri_bo *brw_upload_cache( struct brw_cache *cache,
+struct brw_winsys_buffer *brw_upload_cache( struct brw_cache *cache,
enum brw_cache_id cache_id,
const void *key,
GLuint key_sz,
- dri_bo **reloc_bufs,
+ struct brw_winsys_buffer **reloc_bufs,
GLuint nr_reloc_bufs,
const void *data,
GLuint data_sz,
const void *aux,
void *aux_return );
-dri_bo *brw_search_cache( struct brw_cache *cache,
+struct brw_winsys_buffer *brw_search_cache( struct brw_cache *cache,
enum brw_cache_id cache_id,
const void *key,
GLuint key_size,
- dri_bo **reloc_bufs,
+ struct brw_winsys_buffer **reloc_bufs,
GLuint nr_reloc_bufs,
void *aux_return);
void brw_state_cache_check_size( struct brw_context *brw );
void brw_init_caches( struct brw_context *brw );
void brw_destroy_caches( struct brw_context *brw );
-void brw_state_cache_bo_delete(struct brw_cache *cache, dri_bo *bo);
+void brw_state_cache_bo_delete(struct brw_cache *cache, struct brw_winsys_buffer *bo);
/***********************************************************************
* brw_state_batch.c
@@ -166,7 +166,7 @@ void brw_destroy_batch_cache( struct brw_context *brw );
void brw_clear_batch_cache( struct brw_context *brw );
/* brw_wm_surface_state.c */
-dri_bo *
+struct brw_winsys_buffer *
brw_create_constant_surface( struct brw_context *brw,
struct brw_surface_key *key );
diff --git a/src/gallium/drivers/i965/brw_state_batch.c b/src/gallium/drivers/i965/brw_state_batch.c
index 7821898cf9..9568794625 100644
--- a/src/gallium/drivers/i965/brw_state_batch.c
+++ b/src/gallium/drivers/i965/brw_state_batch.c
@@ -33,7 +33,6 @@
#include "brw_state.h"
#include "intel_batchbuffer.h"
-#include "main/imports.h"
diff --git a/src/gallium/drivers/i965/brw_state_cache.c b/src/gallium/drivers/i965/brw_state_cache.c
index c262e1db8b..91d0f80297 100644
--- a/src/gallium/drivers/i965/brw_state_cache.c
+++ b/src/gallium/drivers/i965/brw_state_cache.c
@@ -56,7 +56,6 @@
* incorrect program is run for the other instance.
*/
-#include "main/imports.h"
#include "brw_state.h"
#include "intel_batchbuffer.h"
@@ -72,7 +71,7 @@
static GLuint
hash_key(const void *key, GLuint key_size,
- dri_bo **reloc_bufs, GLuint nr_reloc_bufs)
+ struct brw_winsys_buffer **reloc_bufs, GLuint nr_reloc_bufs)
{
GLuint *ikey = (GLuint *)key;
GLuint hash = 0, i;
@@ -88,7 +87,7 @@ hash_key(const void *key, GLuint key_size,
/* Include the BO pointers as key data as well */
ikey = (GLuint *)reloc_bufs;
- key_size = nr_reloc_bufs * sizeof(dri_bo *);
+ key_size = nr_reloc_bufs * sizeof(struct brw_winsys_buffer *);
for (i = 0; i < key_size/4; i++) {
hash ^= ikey[i];
hash = (hash << 5) | (hash >> 27);
@@ -103,14 +102,14 @@ hash_key(const void *key, GLuint key_size,
*/
static void
update_cache_last(struct brw_cache *cache, enum brw_cache_id cache_id,
- dri_bo *bo)
+ struct brw_winsys_buffer *bo)
{
if (bo == cache->last_bo[cache_id])
return; /* no change */
- dri_bo_unreference(cache->last_bo[cache_id]);
+ brw->sws->bo_unreference(cache->last_bo[cache_id]);
cache->last_bo[cache_id] = bo;
- dri_bo_reference(cache->last_bo[cache_id]);
+ brw->sws->bo_reference(cache->last_bo[cache_id]);
cache->brw->state.dirty.cache |= 1 << cache_id;
}
@@ -118,7 +117,7 @@ update_cache_last(struct brw_cache *cache, enum brw_cache_id cache_id,
static struct brw_cache_item *
search_cache(struct brw_cache *cache, enum brw_cache_id cache_id,
GLuint hash, const void *key, GLuint key_size,
- dri_bo **reloc_bufs, GLuint nr_reloc_bufs)
+ struct brw_winsys_buffer **reloc_bufs, GLuint nr_reloc_bufs)
{
struct brw_cache_item *c;
@@ -139,7 +138,7 @@ search_cache(struct brw_cache *cache, enum brw_cache_id cache_id,
memcmp(c->key, key, key_size) == 0 &&
c->nr_reloc_bufs == nr_reloc_bufs &&
memcmp(c->reloc_bufs, reloc_bufs,
- nr_reloc_bufs * sizeof(dri_bo *)) == 0)
+ nr_reloc_bufs * sizeof(struct brw_winsys_buffer *)) == 0)
return c;
}
@@ -173,12 +172,12 @@ rehash(struct brw_cache *cache)
/**
* Returns the buffer object matching cache_id and key, or NULL.
*/
-dri_bo *
+struct brw_winsys_buffer *
brw_search_cache(struct brw_cache *cache,
enum brw_cache_id cache_id,
const void *key,
GLuint key_size,
- dri_bo **reloc_bufs, GLuint nr_reloc_bufs,
+ struct brw_winsys_buffer **reloc_bufs, GLuint nr_reloc_bufs,
void *aux_return)
{
struct brw_cache_item *item;
@@ -195,17 +194,17 @@ brw_search_cache(struct brw_cache *cache,
update_cache_last(cache, cache_id, item->bo);
- dri_bo_reference(item->bo);
+ brw->sws->bo_reference(item->bo);
return item->bo;
}
-dri_bo *
+struct brw_winsys_buffer *
brw_upload_cache( struct brw_cache *cache,
enum brw_cache_id cache_id,
const void *key,
GLuint key_size,
- dri_bo **reloc_bufs,
+ struct brw_winsys_buffer **reloc_bufs,
GLuint nr_reloc_bufs,
const void *data,
GLuint data_size,
@@ -214,10 +213,10 @@ brw_upload_cache( struct brw_cache *cache,
{
struct brw_cache_item *item = CALLOC_STRUCT(brw_cache_item);
GLuint hash = hash_key(key, key_size, reloc_bufs, nr_reloc_bufs);
- GLuint relocs_size = nr_reloc_bufs * sizeof(dri_bo *);
+ GLuint relocs_size = nr_reloc_bufs * sizeof(struct brw_winsys_buffer *);
GLuint aux_size = cache->aux_size[cache_id];
void *tmp;
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
int i;
/* Create the buffer object to contain the data */
@@ -233,7 +232,7 @@ brw_upload_cache( struct brw_cache *cache,
memcpy(tmp + key_size + aux_size, reloc_bufs, relocs_size);
for (i = 0; i < nr_reloc_bufs; i++) {
if (reloc_bufs[i] != NULL)
- dri_bo_reference(reloc_bufs[i]);
+ brw->sws->bo_reference(reloc_bufs[i]);
}
item->cache_id = cache_id;
@@ -244,7 +243,7 @@ brw_upload_cache( struct brw_cache *cache,
item->nr_reloc_bufs = nr_reloc_bufs;
item->bo = bo;
- dri_bo_reference(bo);
+ brw->sws->bo_reference(bo);
item->data_size = data_size;
if (cache->n_items > cache->size * 1.5)
@@ -277,15 +276,15 @@ brw_upload_cache( struct brw_cache *cache,
/**
* This doesn't really work with aux data. Use search/upload instead
*/
-dri_bo *
+struct brw_winsys_buffer *
brw_cache_data_sz(struct brw_cache *cache,
enum brw_cache_id cache_id,
const void *data,
GLuint data_size,
- dri_bo **reloc_bufs,
+ struct brw_winsys_buffer **reloc_bufs,
GLuint nr_reloc_bufs)
{
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
struct brw_cache_item *item;
GLuint hash = hash_key(data, data_size, reloc_bufs, nr_reloc_bufs);
@@ -293,7 +292,7 @@ brw_cache_data_sz(struct brw_cache *cache,
reloc_bufs, nr_reloc_bufs);
if (item) {
update_cache_last(cache, cache_id, item->bo);
- dri_bo_reference(item->bo);
+ brw->sws->bo_reference(item->bo);
return item->bo;
}
@@ -314,11 +313,11 @@ brw_cache_data_sz(struct brw_cache *cache,
* better to use, as the potentially changing offsets in the data-used-as-key
* will result in excessive cache misses.
*/
-dri_bo *
+struct brw_winsys_buffer *
brw_cache_data(struct brw_cache *cache,
enum brw_cache_id cache_id,
const void *data,
- dri_bo **reloc_bufs,
+ struct brw_winsys_buffer **reloc_bufs,
GLuint nr_reloc_bufs)
{
return brw_cache_data_sz(cache, cache_id, data, cache->key_size[cache_id],
@@ -497,8 +496,8 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache *cache)
next = c->next;
for (j = 0; j < c->nr_reloc_bufs; j++)
- dri_bo_unreference(c->reloc_bufs[j]);
- dri_bo_unreference(c->bo);
+ brw->sws->bo_unreference(c->reloc_bufs[j]);
+ brw->sws->bo_unreference(c->bo);
free((void *)c->key);
free(c);
}
@@ -523,7 +522,7 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache *cache)
* at the cost of walking the entire hash table.
*/
void
-brw_state_cache_bo_delete(struct brw_cache *cache, dri_bo *bo)
+brw_state_cache_bo_delete(struct brw_cache *cache, struct brw_winsys_buffer *bo)
{
struct brw_cache_item **prev;
GLuint i;
@@ -535,14 +534,14 @@ brw_state_cache_bo_delete(struct brw_cache *cache, dri_bo *bo)
for (prev = &cache->items[i]; *prev;) {
struct brw_cache_item *c = *prev;
- if (drm_intel_bo_references(c->bo, bo)) {
+ if (cache->sws->bo_references(c->bo, bo)) {
int j;
*prev = c->next;
for (j = 0; j < c->nr_reloc_bufs; j++)
- dri_bo_unreference(c->reloc_bufs[j]);
- dri_bo_unreference(c->bo);
+ brw->sws->bo_unreference(c->reloc_bufs[j]);
+ brw->sws->bo_unreference(c->bo);
free((void *)c->key);
free(c);
cache->n_items--;
@@ -580,7 +579,7 @@ brw_destroy_cache(struct brw_context *brw, struct brw_cache *cache)
brw_clear_cache(brw, cache);
for (i = 0; i < BRW_MAX_CACHE; i++) {
- dri_bo_unreference(cache->last_bo[i]);
+ brw->sws->bo_unreference(cache->last_bo[i]);
free(cache->name[i]);
}
free(cache->items);
diff --git a/src/gallium/drivers/i965/brw_state_dump.c b/src/gallium/drivers/i965/brw_state_dump.c
index e94fa7d2b4..1bc83fb9c1 100644
--- a/src/gallium/drivers/i965/brw_state_dump.c
+++ b/src/gallium/drivers/i965/brw_state_dump.c
@@ -25,8 +25,6 @@
*
*/
-#include "main/mtypes.h"
-
#include "brw_context.h"
#include "brw_state.h"
#include "brw_defines.h"
@@ -55,7 +53,7 @@ state_out(const char *name, void *data, uint32_t hw_offset, int index,
/** Generic, undecoded state buffer debug printout */
static void
-state_struct_out(const char *name, dri_bo *buffer, unsigned int state_size)
+state_struct_out(const char *name, struct brw_winsys_buffer *buffer, unsigned int state_size)
{
int i;
@@ -102,7 +100,7 @@ static void dump_wm_surface_state(struct brw_context *brw)
int i;
for (i = 0; i < brw->wm.nr_surfaces; i++) {
- dri_bo *surf_bo = brw->wm.surf_bo[i];
+ struct brw_winsys_buffer *surf_bo = brw->wm.surf_bo[i];
unsigned int surfoff;
struct brw_surface_state *surf;
char name[20];
@@ -162,7 +160,7 @@ static void dump_sf_viewport_state(struct brw_context *brw)
dri_bo_unmap(brw->sf.vp_bo);
}
-static void brw_debug_prog(const char *name, dri_bo *prog)
+static void brw_debug_prog(const char *name, struct brw_winsys_buffer *prog)
{
unsigned int i;
uint32_t *data;
@@ -202,10 +200,8 @@ static void brw_debug_prog(const char *name, dri_bo *prog)
* The buffer offsets printed rely on the buffer containing the last offset
* it was validated at.
*/
-void brw_debug_batch(struct intel_context *intel)
+void brw_debug_batch(struct brw_context *brw)
{
- struct brw_context *brw = brw_context(&intel->ctx);
-
state_struct_out("WM bind", brw->wm.bind_bo, 4 * brw->wm.nr_surfaces);
dump_wm_surface_state(brw);
diff --git a/src/gallium/drivers/i965/brw_state_upload.c b/src/gallium/drivers/i965/brw_state_upload.c
index 6801084616..b68b6cb21a 100644
--- a/src/gallium/drivers/i965/brw_state_upload.c
+++ b/src/gallium/drivers/i965/brw_state_upload.c
@@ -149,7 +149,7 @@ brw_clear_validated_bos(struct brw_context *brw)
/* Clear the last round of validated bos */
for (i = 0; i < brw->state.validated_bo_count; i++) {
- dri_bo_unreference(brw->state.validated_bos[i]);
+ brw->sws->bo_unreference(brw->state.validated_bos[i]);
brw->state.validated_bos[i] = NULL;
}
brw->state.validated_bo_count = 0;
@@ -272,8 +272,6 @@ brw_print_dirty_count(struct dirty_bit_map *bit_map, int32_t bits)
*/
enum pipe_error brw_validate_state( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
- struct intel_context *intel = &brw->intel;
struct brw_state_flags *state = &brw->state.dirty;
GLuint i;
diff --git a/src/gallium/drivers/i965/brw_structs.h b/src/gallium/drivers/i965/brw_structs.h
index 66d4127271..27d264c3de 100644
--- a/src/gallium/drivers/i965/brw_structs.h
+++ b/src/gallium/drivers/i965/brw_structs.h
@@ -33,6 +33,7 @@
#ifndef BRW_STRUCTS_H
#define BRW_STRUCTS_H
+#include "brw_types.h"
/** Number of general purpose registers (VS, WM, etc) */
#define BRW_MAX_GRF 128
diff --git a/src/gallium/drivers/i965/brw_swtnl.c b/src/gallium/drivers/i965/brw_swtnl.c
index 6684f442d5..83f138f67a 100644
--- a/src/gallium/drivers/i965/brw_swtnl.c
+++ b/src/gallium/drivers/i965/brw_swtnl.c
@@ -6,7 +6,6 @@ static GLboolean check_fallbacks( struct brw_context *brw,
const struct _mesa_prim *prim,
GLuint nr_prims )
{
- GLcontext *ctx = &brw->intel.ctx;
GLuint i;
/* If we don't require strict OpenGL conformance, never
diff --git a/src/gallium/drivers/i965/brw_tex.c b/src/gallium/drivers/i965/brw_tex.c
index e911b105b2..c33c19ee51 100644
--- a/src/gallium/drivers/i965/brw_tex.c
+++ b/src/gallium/drivers/i965/brw_tex.c
@@ -30,11 +30,6 @@
*/
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/teximage.h"
-
-#include "intel_context.h"
#include "intel_regions.h"
#include "intel_tex.h"
#include "brw_context.h"
@@ -45,8 +40,6 @@
*/
void brw_validate_textures( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
- struct intel_context *intel = &brw->intel;
int i;
for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
diff --git a/src/gallium/drivers/i965/brw_tex_layout.c b/src/gallium/drivers/i965/brw_tex_layout.c
index 5986cbffad..75cdc18912 100644
--- a/src/gallium/drivers/i965/brw_tex_layout.c
+++ b/src/gallium/drivers/i965/brw_tex_layout.c
@@ -34,13 +34,11 @@
#include "intel_mipmap_tree.h"
#include "intel_tex_layout.h"
-#include "intel_context.h"
-#include "main/macros.h"
#include "intel_chipset.h"
#define FILE_DEBUG_FLAG DEBUG_MIPTREE
-GLboolean brw_miptree_layout(struct intel_context *intel,
+GLboolean brw_miptree_layout(struct brw_context *brw,
struct intel_mipmap_tree *mt,
uint32_t tiling)
{
@@ -67,7 +65,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
mt->pitch = ALIGN(mt->width0, align_w);
}
- if (mt->first_level != mt->last_level) {
+ if (mt->last_level != 0) {
GLuint mip1_width;
if (mt->compressed) {
@@ -93,7 +91,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
mt->total_height = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) * 6;
}
- for (level = mt->first_level; level <= mt->last_level; level++) {
+ for (level = 0; level <= mt->last_level; level++) {
GLuint img_height;
GLuint nr_images = 6;
GLuint q = 0;
@@ -109,7 +107,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
else
img_height = ALIGN(height, align_h);
- if (level == mt->first_level + 1) {
+ if (level == 1) {
x += ALIGN(width, align_w);
}
else {
@@ -147,7 +145,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
pack_x_pitch = width;
pack_x_nr = 1;
- for (level = mt->first_level ; level <= mt->last_level ; level++) {
+ for (level = 0 ; level <= mt->last_level ; level++) {
GLuint nr_images = mt->target == GL_TEXTURE_3D ? depth : 6;
GLint x = 0;
GLint y = 0;
diff --git a/src/gallium/drivers/i965/brw_types.h b/src/gallium/drivers/i965/brw_types.h
index 32b62848da..87dae13d94 100644
--- a/src/gallium/drivers/i965/brw_types.h
+++ b/src/gallium/drivers/i965/brw_types.h
@@ -1,11 +1,18 @@
#ifndef BRW_TYPES_H
#define BRW_TYPES_H
-typedef GLuint uint32_t;
-typedef GLubyte uint8_t;
-typedef GLushort uint16_t;
+#include "pipe/p_compiler.h"
+
+typedef uint32_t GLuint;
+typedef uint8_t GLubyte;
+typedef uint16_t GLushort;
+typedef int32_t GLint;
+typedef int8_t GLbyte;
+typedef int16_t GLshort;
+typedef float GLfloat;
+
/* no GLenum, translate all away */
-typedef GLboolean uint8_t;
+typedef uint8_t GLboolean;
#endif
diff --git a/src/gallium/drivers/i965/brw_util.c b/src/gallium/drivers/i965/brw_util.c
index 17f671a8fa..c5244e58ab 100644
--- a/src/gallium/drivers/i965/brw_util.c
+++ b/src/gallium/drivers/i965/brw_util.c
@@ -30,8 +30,6 @@
*/
-#include "main/mtypes.h"
-#include "shader/prog_parameter.h"
#include "brw_util.h"
#include "brw_defines.h"
diff --git a/src/gallium/drivers/i965/brw_util.h b/src/gallium/drivers/i965/brw_util.h
index 33e7cd87e4..37c3acbc11 100644
--- a/src/gallium/drivers/i965/brw_util.h
+++ b/src/gallium/drivers/i965/brw_util.h
@@ -33,7 +33,7 @@
#ifndef BRW_UTIL_H
#define BRW_UTIL_H
-#include "main/mtypes.h"
+#include "brw_types.h"
extern GLuint brw_count_bits( GLuint val );
extern GLuint brw_parameter_list_state_flags(struct gl_program_parameter_list *paramList);
diff --git a/src/gallium/drivers/i965/brw_vs.c b/src/gallium/drivers/i965/brw_vs.c
index 53a5560105..97e523c3ee 100644
--- a/src/gallium/drivers/i965/brw_vs.c
+++ b/src/gallium/drivers/i965/brw_vs.c
@@ -71,7 +71,7 @@ static void do_vs_prog( struct brw_context *brw,
*/
program = brw_get_program(&c.func, &program_size);
- dri_bo_unreference(brw->vs.prog_bo);
+ brw->sws->bo_unreference(brw->vs.prog_bo);
brw->vs.prog_bo = brw_upload_cache( &brw->cache, BRW_VS_PROG,
&c.key, sizeof(c.key),
NULL, 0,
@@ -83,7 +83,6 @@ static void do_vs_prog( struct brw_context *brw,
static void brw_upload_vs_prog(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
struct brw_vs_prog_key key;
struct brw_vertex_program *vp =
(struct brw_vertex_program *)brw->vertex_program;
@@ -100,7 +99,7 @@ static void brw_upload_vs_prog(struct brw_context *brw)
/* Make an early check for the key.
*/
- dri_bo_unreference(brw->vs.prog_bo);
+ brw->sws->bo_unreference(brw->vs.prog_bo);
brw->vs.prog_bo = brw_search_cache(&brw->cache, BRW_VS_PROG,
&key, sizeof(key),
NULL, 0,
diff --git a/src/gallium/drivers/i965/brw_vs_emit.c b/src/gallium/drivers/i965/brw_vs_emit.c
index 7f20c4baca..6adb743017 100644
--- a/src/gallium/drivers/i965/brw_vs_emit.c
+++ b/src/gallium/drivers/i965/brw_vs_emit.c
@@ -30,9 +30,6 @@
*/
-#include "main/macros.h"
-#include "shader/program.h"
-#include "shader/prog_parameter.h"
#include "pipe/p_shader_tokens.h"
#include "brw_context.h"
#include "brw_vs.h"
diff --git a/src/gallium/drivers/i965/brw_vs_state.c b/src/gallium/drivers/i965/brw_vs_state.c
index d790ab6555..1717223e49 100644
--- a/src/gallium/drivers/i965/brw_vs_state.c
+++ b/src/gallium/drivers/i965/brw_vs_state.c
@@ -34,7 +34,6 @@
#include "brw_context.h"
#include "brw_state.h"
#include "brw_defines.h"
-#include "main/macros.h"
struct brw_vs_unit_key {
unsigned int total_grf;
@@ -51,8 +50,6 @@ struct brw_vs_unit_key {
static void
vs_unit_populate_key(struct brw_context *brw, struct brw_vs_unit_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
-
memset(key, 0, sizeof(*key));
/* CACHE_NEW_VS_PROG */
@@ -79,11 +76,11 @@ vs_unit_populate_key(struct brw_context *brw, struct brw_vs_unit_key *key)
}
}
-static dri_bo *
+static struct brw_winsys_buffer *
vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key)
{
struct brw_vs_unit_state vs;
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
int chipset_max_threads;
memset(&vs, 0, sizeof(vs));
@@ -163,7 +160,7 @@ static void prepare_vs_unit(struct brw_context *brw)
vs_unit_populate_key(brw, &key);
- dri_bo_unreference(brw->vs.state_bo);
+ brw->sws->bo_unreference(brw->vs.state_bo);
brw->vs.state_bo = brw_search_cache(&brw->cache, BRW_VS_UNIT,
&key, sizeof(key),
&brw->vs.prog_bo, 1,
diff --git a/src/gallium/drivers/i965/brw_vs_surface_state.c b/src/gallium/drivers/i965/brw_vs_surface_state.c
index 89f47522a1..6446e8e761 100644
--- a/src/gallium/drivers/i965/brw_vs_surface_state.c
+++ b/src/gallium/drivers/i965/brw_vs_surface_state.c
@@ -29,11 +29,6 @@
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "main/mtypes.h"
-#include "main/texformat.h"
-#include "main/texstore.h"
-#include "shader/prog_parameter.h"
-
#include "brw_context.h"
#include "brw_state.h"
#include "brw_defines.h"
@@ -47,7 +42,6 @@
static drm_intel_bo *
brw_vs_update_constant_buffer(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
struct brw_vertex_program *vp =
(struct brw_vertex_program *) brw->vertex_program;
const struct gl_program_parameter_list *params = vp->program.Base.Parameters;
@@ -73,7 +67,7 @@ brw_vs_update_constant_buffer(struct brw_context *brw)
* Sets brw->vs.surf_bo[surf] and brw->vp->const_buffer.
*/
static void
-brw_update_vs_constant_surface( GLcontext *ctx,
+brw_update_vs_constant_surface( struct brw_context *brw,
GLuint surf)
{
struct brw_context *brw = brw_context(ctx);
@@ -87,7 +81,7 @@ brw_update_vs_constant_surface( GLcontext *ctx,
/* If we're in this state update atom, we need to update VS constants, so
* free the old buffer and create a new one for the new contents.
*/
- dri_bo_unreference(vp->const_buffer);
+ brw->sws->bo_unreference(vp->const_buffer);
vp->const_buffer = brw_vs_update_constant_buffer(brw);
/* If there's no constant buffer, then no surface BO is needed to point at
@@ -101,8 +95,7 @@ brw_update_vs_constant_surface( GLcontext *ctx,
memset(&key, 0, sizeof(key));
- key.format = MESA_FORMAT_RGBA_FLOAT32;
- key.internal_format = GL_RGBA;
+ key.format = PIPE_FORMAT_R32G32B32A32_FLOAT;
key.bo = vp->const_buffer;
key.depthmode = GL_NONE;
key.pitch = params->NumParameters;
@@ -132,10 +125,10 @@ brw_update_vs_constant_surface( GLcontext *ctx,
/**
* Constructs the binding table for the VS surface state.
*/
-static dri_bo *
+static struct brw_winsys_buffer *
brw_vs_get_binding_table(struct brw_context *brw)
{
- dri_bo *bind_bo;
+ struct brw_winsys_buffer *bind_bo;
bind_bo = brw_search_cache(&brw->surface_cache, BRW_SS_SURF_BIND,
NULL, 0,
@@ -186,7 +179,6 @@ brw_vs_get_binding_table(struct brw_context *brw)
*/
static void prepare_vs_surfaces(struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
int i;
int nr_surfaces = 0;
@@ -208,7 +200,7 @@ static void prepare_vs_surfaces(struct brw_context *brw )
* just slightly increases our working set size.
*/
if (brw->vs.nr_surfaces != 0) {
- dri_bo_unreference(brw->vs.bind_bo);
+ brw->sws->bo_unreference(brw->vs.bind_bo);
brw->vs.bind_bo = brw_vs_get_binding_table(brw);
}
}
diff --git a/src/gallium/drivers/i965/brw_wm.c b/src/gallium/drivers/i965/brw_wm.c
index 20d31880b4..32b8900bac 100644
--- a/src/gallium/drivers/i965/brw_wm.c
+++ b/src/gallium/drivers/i965/brw_wm.c
@@ -29,7 +29,6 @@
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "main/texformat.h"
#include "brw_context.h"
#include "brw_util.h"
#include "brw_wm.h"
@@ -186,7 +185,7 @@ static void do_wm_prog( struct brw_context *brw,
*/
program = brw_get_program(&c->func, &program_size);
- dri_bo_unreference(brw->wm.prog_bo);
+ brw->sws->bo_unreference(brw->wm.prog_bo);
brw->wm.prog_bo = brw_upload_cache( &brw->cache, BRW_WM_PROG,
&c->key, sizeof(c->key),
NULL, 0,
@@ -200,7 +199,6 @@ static void do_wm_prog( struct brw_context *brw,
static void brw_wm_populate_key( struct brw_context *brw,
struct brw_wm_prog_key *key )
{
- GLcontext *ctx = &brw->intel.ctx;
/* BRW_NEW_FRAGMENT_PROGRAM */
const struct brw_fragment_program *fp =
(struct brw_fragment_program *)brw->fragment_program;
@@ -329,7 +327,7 @@ static void brw_prepare_wm_prog(struct brw_context *brw)
/* Make an early check for the key.
*/
- dri_bo_unreference(brw->wm.prog_bo);
+ brw->sws->bo_unreference(brw->wm.prog_bo);
brw->wm.prog_bo = brw_search_cache(&brw->cache, BRW_WM_PROG,
&key, sizeof(key),
NULL, 0,
diff --git a/src/gallium/drivers/i965/brw_wm_emit.c b/src/gallium/drivers/i965/brw_wm_emit.c
index 9c47c46a3d..fec33f74eb 100644
--- a/src/gallium/drivers/i965/brw_wm_emit.c
+++ b/src/gallium/drivers/i965/brw_wm_emit.c
@@ -30,7 +30,6 @@
*/
-#include "main/macros.h"
#include "brw_context.h"
#include "brw_wm.h"
diff --git a/src/gallium/drivers/i965/brw_wm_glsl.c b/src/gallium/drivers/i965/brw_wm_glsl.c
index d836e2fb34..c4f0711793 100644
--- a/src/gallium/drivers/i965/brw_wm_glsl.c
+++ b/src/gallium/drivers/i965/brw_wm_glsl.c
@@ -1,7 +1,3 @@
-#include "main/macros.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
-#include "shader/prog_optimize.h"
#include "brw_context.h"
#include "brw_eu.h"
#include "brw_wm.h"
diff --git a/src/gallium/drivers/i965/brw_wm_iz.c b/src/gallium/drivers/i965/brw_wm_iz.c
index 5e399ac62a..6f1e9fcc3c 100644
--- a/src/gallium/drivers/i965/brw_wm_iz.c
+++ b/src/gallium/drivers/i965/brw_wm_iz.c
@@ -30,7 +30,6 @@
*/
-#include "main/mtypes.h"
#include "brw_wm.h"
diff --git a/src/gallium/drivers/i965/brw_wm_sampler_state.c b/src/gallium/drivers/i965/brw_wm_sampler_state.c
index dff466587a..a8993f9312 100644
--- a/src/gallium/drivers/i965/brw_wm_sampler_state.c
+++ b/src/gallium/drivers/i965/brw_wm_sampler_state.c
@@ -34,9 +34,6 @@
#include "brw_state.h"
#include "brw_defines.h"
-#include "main/macros.h"
-
-
/* Samplers aren't strictly wm state from the hardware's perspective,
* but that is the only situation in which we use them in this driver.
@@ -79,7 +76,7 @@ static GLint S_FIXED(GLfloat value, GLuint frac_bits)
}
-static dri_bo *upload_default_color( struct brw_context *brw,
+static struct brw_winsys_buffer *upload_default_color( struct brw_context *brw,
const GLfloat *color )
{
struct brw_sampler_default_color sdc;
@@ -102,7 +99,7 @@ struct wm_sampler_key {
float max_aniso;
GLenum minfilter, magfilter;
GLenum comparemode, comparefunc;
- dri_bo *sdc_bo;
+ struct brw_winsys_buffer *sdc_bo;
/** If target is cubemap, take context setting.
*/
@@ -115,7 +112,7 @@ struct wm_sampler_key {
* entry.
*/
static void brw_update_sampler_state(struct wm_sampler_entry *key,
- dri_bo *sdc_bo,
+ struct brw_winsys_buffer *sdc_bo,
struct brw_sampler_state *sampler)
{
_mesa_memset(sampler, 0, sizeof(*sampler));
@@ -240,7 +237,6 @@ static void
brw_wm_sampler_populate_key(struct brw_context *brw,
struct wm_sampler_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
int unit;
memset(key, 0, sizeof(*key));
@@ -272,7 +268,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
entry->comparemode = texObj->CompareMode;
entry->comparefunc = texObj->CompareFunc;
- dri_bo_unreference(brw->wm.sdc_bo[unit]);
+ brw->sws->bo_unreference(brw->wm.sdc_bo[unit]);
if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
float bordercolor[4] = {
texObj->BorderColor[0],
@@ -300,7 +296,6 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
*/
static void upload_wm_samplers( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
struct wm_sampler_key key;
int i;
@@ -311,7 +306,7 @@ static void upload_wm_samplers( struct brw_context *brw )
brw->state.dirty.cache |= CACHE_NEW_SAMPLER;
}
- dri_bo_unreference(brw->wm.sampler_bo);
+ brw->sws->bo_unreference(brw->wm.sampler_bo);
brw->wm.sampler_bo = NULL;
if (brw->wm.sampler_count == 0)
return;
diff --git a/src/gallium/drivers/i965/brw_wm_state.c b/src/gallium/drivers/i965/brw_wm_state.c
index 361f91292b..958c00d3e0 100644
--- a/src/gallium/drivers/i965/brw_wm_state.c
+++ b/src/gallium/drivers/i965/brw_wm_state.c
@@ -60,10 +60,8 @@ struct brw_wm_unit_key {
static void
wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
const struct gl_fragment_program *fp = brw->fragment_program;
const struct brw_fragment_program *bfp = (struct brw_fragment_program *) fp;
- struct intel_context *intel = &brw->intel;
memset(key, 0, sizeof(*key));
@@ -121,7 +119,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
/* temporary sanity check assertion */
ASSERT(bfp->isGLSL == brw_wm_is_glsl(fp));
- /* _NEW_DEPTH */
+ /* _NEW_QUERY */
key->stats_wm = intel->stats_wm;
/* _NEW_LINE */
@@ -136,12 +134,12 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
/**
* Setup wm hardware state. See page 225 of Volume 2
*/
-static dri_bo *
+static struct brw_winsys_buffer *
wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
- dri_bo **reloc_bufs)
+ struct brw_winsys_buffer **reloc_bufs)
{
struct brw_wm_unit_state wm;
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
memset(&wm, 0, sizeof(wm));
@@ -257,9 +255,8 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
static void upload_wm_unit( struct brw_context *brw )
{
- struct intel_context *intel = &brw->intel;
struct brw_wm_unit_key key;
- dri_bo *reloc_bufs[3];
+ struct brw_winsys_buffer *reloc_bufs[3];
wm_unit_populate_key(brw, &key);
/* Allocate the necessary scratch space if we haven't already. Don't
@@ -271,7 +268,7 @@ static void upload_wm_unit( struct brw_context *brw )
GLuint total = key.total_scratch * key.max_threads;
if (brw->wm.scratch_bo && total > brw->wm.scratch_bo->size) {
- dri_bo_unreference(brw->wm.scratch_bo);
+ brw->sws->bo_unreference(brw->wm.scratch_bo);
brw->wm.scratch_bo = NULL;
}
if (brw->wm.scratch_bo == NULL) {
@@ -286,7 +283,7 @@ static void upload_wm_unit( struct brw_context *brw )
reloc_bufs[1] = brw->wm.scratch_bo;
reloc_bufs[2] = brw->wm.sampler_bo;
- dri_bo_unreference(brw->wm.state_bo);
+ brw->sws->bo_unreference(brw->wm.state_bo);
brw->wm.state_bo = brw_search_cache(&brw->cache, BRW_WM_UNIT,
&key, sizeof(key),
reloc_bufs, 3,
@@ -302,7 +299,7 @@ const struct brw_tracked_state brw_wm_unit = {
_NEW_POLYGONSTIPPLE |
_NEW_LINE |
_NEW_COLOR |
- _NEW_DEPTH),
+ _NEW_QUERY),
.brw = (BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_CURBE_OFFSETS |
diff --git a/src/gallium/drivers/i965/brw_wm_surface_state.c b/src/gallium/drivers/i965/brw_wm_surface_state.c
index f7cc5153a8..86dcb74b5b 100644
--- a/src/gallium/drivers/i965/brw_wm_surface_state.c
+++ b/src/gallium/drivers/i965/brw_wm_surface_state.c
@@ -30,11 +30,6 @@
*/
-#include "main/mtypes.h"
-#include "main/texformat.h"
-#include "main/texstore.h"
-#include "shader/prog_parameter.h"
-
#include "intel_mipmap_tree.h"
#include "intel_batchbuffer.h"
#include "intel_tex.h"
@@ -70,90 +65,87 @@ static GLuint translate_tex_target( GLenum target )
}
-static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format,
+static GLuint translate_tex_format( GLuint mesa_format,
GLenum depth_mode )
{
- switch( mesa_format ) {
- case MESA_FORMAT_L8:
+ switch( pipe_format ) {
+ case PIPE_FORMAT_L8_UNORM:
return BRW_SURFACEFORMAT_L8_UNORM;
- case MESA_FORMAT_I8:
+ case PIPE_FORMAT_I8_UNORM:
return BRW_SURFACEFORMAT_I8_UNORM;
- case MESA_FORMAT_A8:
+ case PIPE_FORMAT_A8_UNORM:
return BRW_SURFACEFORMAT_A8_UNORM;
- case MESA_FORMAT_AL88:
+ case PIPE_FORMAT_A8L8_UNORM:
return BRW_SURFACEFORMAT_L8A8_UNORM;
- case MESA_FORMAT_RGB888:
- assert(0); /* not supported for sampling */
- return BRW_SURFACEFORMAT_R8G8B8_UNORM;
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ case PIPE_FORMAT_R8G8B8A8_UNORM:
+ return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
- case MESA_FORMAT_ARGB8888:
- if (internal_format == GL_RGB)
- return BRW_SURFACEFORMAT_B8G8R8X8_UNORM;
- else
- return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
+ case PIPE_FORMAT_R8G8B8X8_UNORM:
+ return BRW_SURFACEFORMAT_R8G8B8X8_UNORM;
- case MESA_FORMAT_RGBA8888_REV:
- if (internal_format == GL_RGB)
- return BRW_SURFACEFORMAT_R8G8B8X8_UNORM;
- else
- return BRW_SURFACEFORMAT_R8G8B8A8_UNORM;
+ case PIPE_FORMAT_:
+ return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
- case MESA_FORMAT_RGB565:
+ case PIPE_FORMAT_RGB565:
return BRW_SURFACEFORMAT_B5G6R5_UNORM;
- case MESA_FORMAT_ARGB1555:
+ case PIPE_FORMAT_ARGB1555:
return BRW_SURFACEFORMAT_B5G5R5A1_UNORM;
- case MESA_FORMAT_ARGB4444:
+ case PIPE_FORMAT_ARGB4444:
return BRW_SURFACEFORMAT_B4G4R4A4_UNORM;
- case MESA_FORMAT_YCBCR_REV:
+
+ case PIPE_FORMAT_L16_UNORM:
+ return BRW_SURFACEFORMAT_L16_UNORM;
+
+ case PIPE_FORMAT_I16_UNORM:
+ return BRW_SURFACEFORMAT_I16_UNORM;
+
+ case PIPE_FORMAT_A16_UNORM:
+ return BRW_SURFACEFORMAT_A16_UNORM;
+
+ case PIPE_FORMAT_YCBCR_REV:
return BRW_SURFACEFORMAT_YCRCB_NORMAL;
- case MESA_FORMAT_YCBCR:
+ case PIPE_FORMAT_YCBCR:
return BRW_SURFACEFORMAT_YCRCB_SWAPUVY;
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
+ case PIPE_FORMAT_RGB_FXT1:
+ case PIPE_FORMAT_RGBA_FXT1:
return BRW_SURFACEFORMAT_FXT1;
- case MESA_FORMAT_Z16:
- if (depth_mode == GL_INTENSITY)
- return BRW_SURFACEFORMAT_I16_UNORM;
- else if (depth_mode == GL_ALPHA)
- return BRW_SURFACEFORMAT_A16_UNORM;
- else
- return BRW_SURFACEFORMAT_L16_UNORM;
-
- case MESA_FORMAT_RGB_DXT1:
+ case PIPE_FORMAT_RGB_DXT1:
return BRW_SURFACEFORMAT_DXT1_RGB;
- case MESA_FORMAT_RGBA_DXT1:
+ case PIPE_FORMAT_RGBA_DXT1:
return BRW_SURFACEFORMAT_BC1_UNORM;
- case MESA_FORMAT_RGBA_DXT3:
+ case PIPE_FORMAT_RGBA_DXT3:
return BRW_SURFACEFORMAT_BC2_UNORM;
- case MESA_FORMAT_RGBA_DXT5:
+ case PIPE_FORMAT_RGBA_DXT5:
return BRW_SURFACEFORMAT_BC3_UNORM;
- case MESA_FORMAT_SARGB8:
+ case PIPE_FORMAT_R8G8B8A8_SRGB:
return BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB;
- case MESA_FORMAT_SLA8:
+ case PIPE_FORMAT_A8L8_SRGB:
return BRW_SURFACEFORMAT_L8A8_UNORM_SRGB;
- case MESA_FORMAT_SL8:
+ case PIPE_FORMAT_L8_SRGB:
return BRW_SURFACEFORMAT_L8_UNORM_SRGB;
- case MESA_FORMAT_SRGB_DXT1:
+ case PIPE_FORMAT_SRGB_DXT1:
return BRW_SURFACEFORMAT_BC1_UNORM_SRGB;
- case MESA_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8_Z24:
/* XXX: these different surface formats don't seem to
* make any difference for shadow sampler/compares.
*/
@@ -164,10 +156,10 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format,
else
return BRW_SURFACEFORMAT_L24X8_UNORM;
- case MESA_FORMAT_DUDV8:
+ case PIPE_FORMAT_DUDV8:
return BRW_SURFACEFORMAT_R8G8_SNORM;
- case MESA_FORMAT_SIGNED_RGBA8888_REV:
+ case PIPE_FORMAT_SIGNED_RGBA8888_REV:
return BRW_SURFACEFORMAT_R8G8B8A8_SNORM;
default:
@@ -195,12 +187,12 @@ brw_set_surface_tiling(struct brw_surface_state *surf, uint32_t tiling)
}
}
-static dri_bo *
+static struct brw_winsys_buffer *
brw_create_texture_surface( struct brw_context *brw,
struct brw_surface_key *key )
{
struct brw_surface_state surf;
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
memset(&surf, 0, sizeof(surf));
@@ -234,7 +226,7 @@ brw_create_texture_surface( struct brw_context *brw,
else
surf.ss1.base_addr = key->offset;
- surf.ss2.mip_count = key->last_level - key->first_level;
+ surf.ss2.mip_count = key->last_level;
surf.ss2.width = key->width - 1;
surf.ss2.height = key->height - 1;
brw_set_surface_tiling(&surf, key->tiling);
@@ -270,41 +262,30 @@ brw_create_texture_surface( struct brw_context *brw,
}
static void
-brw_update_texture_surface( GLcontext *ctx, GLuint unit )
+brw_update_texture_surface( struct brw_context *brw, GLuint unit )
{
- struct brw_context *brw = brw_context(ctx);
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
- struct intel_texture_object *intelObj = intel_texture_object(tObj);
- struct gl_texture_image *firstImage = tObj->Image[0][intelObj->firstLevel];
+ struct pipe_texture *tex = brw->texture[unit];
struct brw_surface_key key;
const GLuint surf = SURF_INDEX_TEXTURE(unit);
memset(&key, 0, sizeof(key));
- if (intelObj->imageOverride) {
- key.pitch = intelObj->pitchOverride / intelObj->mt->cpp;
- key.depth = intelObj->depthOverride;
- key.bo = NULL;
- key.offset = intelObj->textureOffset;
- } else {
- key.format = firstImage->TexFormat->MesaFormat;
- key.internal_format = firstImage->InternalFormat;
- key.pitch = intelObj->mt->pitch;
- key.depth = firstImage->Depth;
- key.bo = intelObj->mt->region->buffer;
- key.offset = 0;
- }
-
- key.target = tObj->Target;
- key.depthmode = tObj->DepthMode;
- key.first_level = intelObj->firstLevel;
- key.last_level = intelObj->lastLevel;
- key.width = firstImage->Width;
- key.height = firstImage->Height;
- key.cpp = intelObj->mt->cpp;
- key.tiling = intelObj->mt->region->tiling;
-
- dri_bo_unreference(brw->wm.surf_bo[surf]);
+ key.format = tex->base.format;
+ key.pitch = tex->pitch;
+ key.depth = tex->base.depth[0];
+ key.bo = tex->buffer;
+ key.offset = 0;
+
+ key.target = tObj->target; /* translated to BRW enum */
+ /* key.depthmode = tObj->DepthMode; */ /* XXX: add this to gallium? or the state tracker? */
+ key.first_level = 0;
+ key.last_level = tex->base.last_level;
+ key.width = tex->base.depth[0];
+ key.height = tex->base.height[0];
+ key.cpp = tex->cpp;
+ key.tiling = tex->tiling;
+
+ brw->sws->bo_unreference(brw->wm.surf_bo[surf]);
brw->wm.surf_bo[surf] = brw_search_cache(&brw->surface_cache,
BRW_SS_SURFACE,
&key, sizeof(key),
@@ -321,13 +302,13 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit )
* Create the constant buffer surface. Vertex/fragment shader constants will be
* read from this buffer with Data Port Read instructions/messages.
*/
-dri_bo *
+struct brw_winsys_buffer *
brw_create_constant_surface( struct brw_context *brw,
struct brw_surface_key *key )
{
const GLint w = key->width - 1;
struct brw_surface_state surf;
- dri_bo *bo;
+ struct brw_winsys_buffer *bo;
memset(&surf, 0, sizeof(surf));
@@ -374,7 +355,6 @@ brw_create_constant_surface( struct brw_context *brw,
static drm_intel_bo *
brw_wm_update_constant_buffer(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
struct brw_fragment_program *fp =
(struct brw_fragment_program *) brw->fragment_program;
const struct gl_program_parameter_list *params = fp->program.Base.Parameters;
@@ -399,7 +379,7 @@ brw_wm_update_constant_buffer(struct brw_context *brw)
* The constant buffer will be (re)allocated here if needed.
*/
static void
-brw_update_wm_constant_surface( GLcontext *ctx,
+brw_update_wm_constant_surface( struct brw_context *brw,
GLuint surf)
{
struct brw_context *brw = brw_context(ctx);
@@ -412,7 +392,7 @@ brw_update_wm_constant_surface( GLcontext *ctx,
/* If we're in this state update atom, we need to update WM constants, so
* free the old buffer and create a new one for the new contents.
*/
- dri_bo_unreference(fp->const_buffer);
+ brw->sws->bo_unreference(fp->const_buffer);
fp->const_buffer = brw_wm_update_constant_buffer(brw);
/* If there's no constant buffer, then no surface BO is needed to point at
@@ -426,7 +406,7 @@ brw_update_wm_constant_surface( GLcontext *ctx,
memset(&key, 0, sizeof(key));
- key.format = MESA_FORMAT_RGBA_FLOAT32;
+ key.format = PIPE_FORMAT_RGBA_FLOAT32;
key.internal_format = GL_RGBA;
key.bo = fp->const_buffer;
key.depthmode = GL_NONE;
@@ -442,7 +422,7 @@ brw_update_wm_constant_surface( GLcontext *ctx,
key.width, key.height, key.depth, key.cpp, key.pitch);
*/
- dri_bo_unreference(brw->wm.surf_bo[surf]);
+ brw->sws->bo_unreference(brw->wm.surf_bo[surf]);
brw->wm.surf_bo[surf] = brw_search_cache(&brw->surface_cache,
BRW_SS_SURFACE,
&key, sizeof(key),
@@ -464,7 +444,6 @@ brw_update_wm_constant_surface( GLcontext *ctx,
*/
static void prepare_wm_constant_surface(struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
struct brw_fragment_program *fp =
(struct brw_fragment_program *) brw->fragment_program;
GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER;
@@ -507,8 +486,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
struct gl_renderbuffer *rb,
unsigned int unit)
{
- GLcontext *ctx = &brw->intel.ctx;
- dri_bo *region_bo = NULL;
+ struct brw_winsys_buffer *region_bo = NULL;
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
struct intel_region *region = irb ? irb->region : NULL;
struct {
@@ -528,16 +506,16 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
key.surface_type = BRW_SURFACE_2D;
switch (irb->texformat->MesaFormat) {
- case MESA_FORMAT_ARGB8888:
+ case PIPE_FORMAT_ARGB8888:
key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
break;
- case MESA_FORMAT_RGB565:
+ case PIPE_FORMAT_RGB565:
key.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM;
break;
- case MESA_FORMAT_ARGB1555:
+ case PIPE_FORMAT_ARGB1555:
key.surface_format = BRW_SURFACEFORMAT_B5G5R5A1_UNORM;
break;
- case MESA_FORMAT_ARGB4444:
+ case PIPE_FORMAT_ARGB4444:
key.surface_format = BRW_SURFACEFORMAT_B4G4R4A4_UNORM;
break;
default:
@@ -569,7 +547,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
key.color_blend = (!ctx->Color._LogicOpEnabled &&
ctx->Color.BlendEnabled);
- dri_bo_unreference(brw->wm.surf_bo[unit]);
+ brw->sws->bo_unreference(brw->wm.surf_bo[unit]);
brw->wm.surf_bo[unit] = brw_search_cache(&brw->surface_cache,
BRW_SS_SURFACE,
&key, sizeof(key),
@@ -646,10 +624,10 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
* Constructs the binding table for the WM surface state, which maps unit
* numbers to surface state objects.
*/
-static dri_bo *
+static struct brw_winsys_buffer *
brw_wm_get_binding_table(struct brw_context *brw)
{
- dri_bo *bind_bo;
+ struct brw_winsys_buffer *bind_bo;
assert(brw->wm.nr_surfaces <= BRW_WM_MAX_SURF);
@@ -692,7 +670,6 @@ brw_wm_get_binding_table(struct brw_context *brw)
static void prepare_wm_surfaces(struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
GLuint i;
int old_nr_surfaces;
@@ -724,12 +701,12 @@ static void prepare_wm_surfaces(struct brw_context *brw )
brw_update_texture_surface(ctx, i);
brw->wm.nr_surfaces = surf + 1;
} else {
- dri_bo_unreference(brw->wm.surf_bo[surf]);
+ brw->sws->bo_unreference(brw->wm.surf_bo[surf]);
brw->wm.surf_bo[surf] = NULL;
}
}
- dri_bo_unreference(brw->wm.bind_bo);
+ brw->sws->bo_unreference(brw->wm.bind_bo);
brw->wm.bind_bo = brw_wm_get_binding_table(brw);
if (brw->wm.nr_surfaces != old_nr_surfaces)
diff --git a/src/gallium/drivers/i965/intel_batchbuffer.h b/src/gallium/drivers/i965/intel_batchbuffer.h
index a595d2e0c5..be04656aec 100644
--- a/src/gallium/drivers/i965/intel_batchbuffer.h
+++ b/src/gallium/drivers/i965/intel_batchbuffer.h
@@ -1,9 +1,6 @@
#ifndef INTEL_BATCHBUFFER_H
#define INTEL_BATCHBUFFER_H
-#include "main/mtypes.h"
-
-#include "intel_context.h"
#include "intel_bufmgr.h"
#include "intel_reg.h"
@@ -44,7 +41,7 @@ struct intel_batchbuffer
{
struct intel_context *intel;
- dri_bo *buf;
+ struct brw_winsys_buffer *buf;
GLubyte *buffer;
@@ -89,7 +86,7 @@ void intel_batchbuffer_release_space(struct intel_batchbuffer *batch,
GLuint bytes);
GLboolean intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
- dri_bo *buffer,
+ struct brw_winsys_buffer *buffer,
uint32_t read_domains,
uint32_t write_domain,
uint32_t offset);
diff --git a/src/gallium/drivers/i965/intel_tex_format.c b/src/gallium/drivers/i965/intel_tex_format.c
index 3322a71130..c62ecdadf0 100644
--- a/src/gallium/drivers/i965/intel_tex_format.c
+++ b/src/gallium/drivers/i965/intel_tex_format.c
@@ -1,206 +1,9 @@
#include "intel_context.h"
#include "intel_tex.h"
#include "intel_chipset.h"
-#include "main/texformat.h"
-#include "main/enums.h"
-/**
- * Choose hardware texture format given the user's glTexImage parameters.
- *
- * It works out that this function is fine for all the supported
- * hardware. However, there is still a need to map the formats onto
- * hardware descriptors.
- *
- * Note that the i915 can actually support many more formats than
- * these if we take the step of simply swizzling the colors
- * immediately after sampling...
- */
-const struct gl_texture_format *
-intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
- GLenum format, GLenum type)
-{
- struct intel_context *intel = intel_context(ctx);
- const GLboolean do32bpt = (intel->ctx.Visual.rgbBits >= 24);
-
-#if 0
- printf("%s intFmt=0x%x format=0x%x type=0x%x\n",
- __FUNCTION__, internalFormat, format, type);
-#endif
-
- switch (internalFormat) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- if (format == GL_BGRA) {
- if (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) {
- return &_mesa_texformat_argb8888;
- }
- else if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
- return &_mesa_texformat_argb4444;
- }
- else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
- return &_mesa_texformat_argb1555;
- }
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) {
- return &_mesa_texformat_rgb565;
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_argb8888;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_a8;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- return &_mesa_texformat_al88;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
-
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
-
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
-
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32:
-#if 0
- return &_mesa_texformat_z16;
-#else
- /* fall-through.
- * 16bpp depth texture can't be paired with a stencil buffer so
- * always used combined depth/stencil format.
- */
-#endif
- case GL_DEPTH_STENCIL_EXT:
- case GL_DEPTH24_STENCIL8_EXT:
- return &_mesa_texformat_s8_z24;
-
-#ifndef I915
- case GL_SRGB_EXT:
- case GL_SRGB8_EXT:
- case GL_SRGB_ALPHA_EXT:
- case GL_SRGB8_ALPHA8_EXT:
- case GL_COMPRESSED_SRGB_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_EXT:
- case GL_COMPRESSED_SLUMINANCE_EXT:
- case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
- return &_mesa_texformat_sargb8;
- case GL_SLUMINANCE_EXT:
- case GL_SLUMINANCE8_EXT:
- if (IS_G4X(intel->intelScreen->deviceID))
- return &_mesa_texformat_sl8;
- else
- return &_mesa_texformat_sargb8;
- case GL_SLUMINANCE_ALPHA_EXT:
- case GL_SLUMINANCE8_ALPHA8_EXT:
- if (IS_G4X(intel->intelScreen->deviceID))
- return &_mesa_texformat_sla8;
- else
- return &_mesa_texformat_sargb8;
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- return &_mesa_texformat_srgb_dxt1;
-
- /* i915 could also do this */
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- return &_mesa_texformat_dudv8;
- case GL_RGBA_SNORM:
- case GL_RGBA8_SNORM:
- return &_mesa_texformat_signed_rgba8888_rev;
-#endif
-
- default:
- fprintf(stderr, "unexpected texture format %s in %s\n",
- _mesa_lookup_enum_by_nr(internalFormat), __FUNCTION__);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
int intel_compressed_num_bytes(GLuint mesaFormat)
{
diff --git a/src/gallium/drivers/i965/intel_tex_layout.c b/src/gallium/drivers/i965/intel_tex_layout.c
index 7d69ea4484..1cdab49e5e 100644
--- a/src/gallium/drivers/i965/intel_tex_layout.c
+++ b/src/gallium/drivers/i965/intel_tex_layout.c
@@ -33,7 +33,6 @@
#include "intel_mipmap_tree.h"
#include "intel_tex_layout.h"
#include "intel_context.h"
-#include "main/macros.h"
void intel_get_texture_alignment_unit(GLenum internalFormat, GLuint *w, GLuint *h)
{
@@ -86,7 +85,7 @@ void i945_miptree_layout_2d( struct intel_context *intel,
* constraints of mipmap placement push the right edge of the
* 2nd mipmap out past the width of its parent.
*/
- if (mt->first_level != mt->last_level) {
+ if (mt->last_level) {
GLuint mip1_width;
if (mt->compressed) {
@@ -108,7 +107,7 @@ void i945_miptree_layout_2d( struct intel_context *intel,
mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->pitch);
mt->total_height = 0;
- for ( level = mt->first_level ; level <= mt->last_level ; level++ ) {
+ for ( level = 0 ; level <= mt->last_level ; level++ ) {
GLuint img_height;
intel_miptree_set_level_info(mt, level, 1, x, y, width,
@@ -127,7 +126,7 @@ void i945_miptree_layout_2d( struct intel_context *intel,
/* Layout_below: step right after second mipmap.
*/
- if (level == mt->first_level + 1) {
+ if (level == 1) {
x += ALIGN(width, align_w);
}
else {