aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/i965/brw_batchbuffer.c17
-rw-r--r--src/gallium/drivers/i965/brw_context.h40
-rw-r--r--src/gallium/drivers/i965/brw_curbe.c1
-rw-r--r--src/gallium/drivers/i965/brw_pipe_query.c2
-rw-r--r--src/gallium/drivers/i965/brw_screen_buffers.c13
-rw-r--r--src/gallium/drivers/i965/brw_screen_texture.c18
-rw-r--r--src/gallium/drivers/i965/brw_state_cache.c23
-rw-r--r--src/gallium/drivers/i965/brw_state_dump.c14
-rw-r--r--src/gallium/drivers/i965/brw_winsys.h69
9 files changed, 120 insertions, 77 deletions
diff --git a/src/gallium/drivers/i965/brw_batchbuffer.c b/src/gallium/drivers/i965/brw_batchbuffer.c
index 673bd1ed44d..ca612e5ed0b 100644
--- a/src/gallium/drivers/i965/brw_batchbuffer.c
+++ b/src/gallium/drivers/i965/brw_batchbuffer.c
@@ -53,7 +53,9 @@ brw_batchbuffer_reset(struct brw_batchbuffer *batch)
if (batch->malloc_buffer)
batch->map = batch->malloc_buffer;
else
- batch->map = batch->sws->bo_map(batch->buf, GL_TRUE);
+ batch->map = batch->sws->bo_map(batch->buf,
+ BRW_DATA_OTHER,
+ GL_TRUE);
batch->size = BRW_BATCH_SIZE;
batch->ptr = batch->map;
@@ -132,7 +134,10 @@ _brw_batchbuffer_flush(struct brw_batchbuffer *batch,
used = batch->ptr - batch->map;
if (batch->use_malloc_buffer) {
- batch->sws->bo_subdata(batch->buf, 0, used, batch->map );
+ batch->sws->bo_subdata(batch->buf,
+ BRW_DATA_OTHER,
+ 0, used,
+ batch->map );
batch->map = NULL;
}
else {
@@ -145,7 +150,9 @@ _brw_batchbuffer_flush(struct brw_batchbuffer *batch,
batch->sws->bo_exec(batch->buf, used );
if (1 /*BRW_DEBUG & DEBUG_BATCH*/) {
- void *ptr = batch->sws->bo_map(batch->buf, GL_FALSE);
+ void *ptr = batch->sws->bo_map(batch->buf,
+ BRW_DATA_OTHER,
+ GL_FALSE);
intel_decode(ptr,
used / 4,
@@ -162,7 +169,9 @@ _brw_batchbuffer_flush(struct brw_batchbuffer *batch,
* interface.
*/
debug_printf("waiting for idle\n");
- batch->sws->bo_map(batch->buf, GL_TRUE);
+ batch->sws->bo_map(batch->buf,
+ BRW_DATA_OTHER,
+ GL_TRUE);
batch->sws->bo_unmap(batch->buf);
}
diff --git a/src/gallium/drivers/i965/brw_context.h b/src/gallium/drivers/i965/brw_context.h
index 0c1dcf8a147..09d34615c74 100644
--- a/src/gallium/drivers/i965/brw_context.h
+++ b/src/gallium/drivers/i965/brw_context.h
@@ -347,25 +347,27 @@ struct brw_vs_ouput_sizes {
#define SURF_INDEX_VERT_CONST_BUFFER 0
+/* Bit of a hack to align these with the winsys buffer_data_type enum.
+ */
enum brw_cache_id {
- BRW_CC_VP,
- BRW_CC_UNIT,
- BRW_WM_PROG,
- BRW_SAMPLER_DEFAULT_COLOR,
- BRW_SAMPLER,
- BRW_WM_UNIT,
- BRW_SF_PROG,
- BRW_SF_VP,
- BRW_SF_UNIT,
- BRW_VS_UNIT,
- BRW_VS_PROG,
- BRW_GS_UNIT,
- BRW_GS_PROG,
- BRW_CLIP_VP,
- BRW_CLIP_UNIT,
- BRW_CLIP_PROG,
- BRW_SS_SURFACE,
- BRW_SS_SURF_BIND,
+ BRW_CC_VP = BRW_DATA_GS_CC_VP,
+ BRW_CC_UNIT = BRW_DATA_GS_CC_UNIT,
+ BRW_WM_PROG = BRW_DATA_GS_WM_PROG,
+ BRW_SAMPLER_DEFAULT_COLOR = BRW_DATA_GS_SAMPLER_DEFAULT_COLOR,
+ BRW_SAMPLER = BRW_DATA_GS_SAMPLER,
+ BRW_WM_UNIT = BRW_DATA_GS_WM_UNIT,
+ BRW_SF_PROG = BRW_DATA_GS_SF_PROG,
+ BRW_SF_VP = BRW_DATA_GS_SF_VP,
+ BRW_SF_UNIT = BRW_DATA_GS_SF_UNIT,
+ BRW_VS_UNIT = BRW_DATA_GS_VS_UNIT,
+ BRW_VS_PROG = BRW_DATA_GS_VS_PROG,
+ BRW_GS_UNIT = BRW_DATA_GS_GS_UNIT,
+ BRW_GS_PROG = BRW_DATA_GS_GS_PROG,
+ BRW_CLIP_VP = BRW_DATA_GS_CLIP_VP,
+ BRW_CLIP_UNIT = BRW_DATA_GS_CLIP_UNIT,
+ BRW_CLIP_PROG = BRW_DATA_GS_CLIP_PROG,
+ BRW_SS_SURFACE = BRW_DATA_SS_SURFACE,
+ BRW_SS_SURF_BIND = BRW_DATA_SS_SURF_BIND,
BRW_MAX_CACHE
};
@@ -399,6 +401,8 @@ struct brw_cache {
struct brw_cache_item **items;
GLuint size, n_items;
+ enum brw_buffer_type buffer_type;
+
GLuint key_size[BRW_MAX_CACHE]; /* for fixed-size keys */
GLuint aux_size[BRW_MAX_CACHE];
char *name[BRW_MAX_CACHE];
diff --git a/src/gallium/drivers/i965/brw_curbe.c b/src/gallium/drivers/i965/brw_curbe.c
index f62b0b0d5e2..1e2e232204e 100644
--- a/src/gallium/drivers/i965/brw_curbe.c
+++ b/src/gallium/drivers/i965/brw_curbe.c
@@ -289,6 +289,7 @@ static int prepare_curbe_buffer(struct brw_context *brw)
*/
brw->sws->bo_subdata(brw->curbe.curbe_bo,
brw->curbe.curbe_offset,
+ BRW_DATA_OTHER,
bufsz,
buf);
}
diff --git a/src/gallium/drivers/i965/brw_pipe_query.c b/src/gallium/drivers/i965/brw_pipe_query.c
index d3e173f5ecf..3370ebd2626 100644
--- a/src/gallium/drivers/i965/brw_pipe_query.c
+++ b/src/gallium/drivers/i965/brw_pipe_query.c
@@ -63,7 +63,7 @@ brw_query_get_result(struct pipe_context *pipe,
if (brw->sws->bo_is_busy(query->bo) && !wait)
return FALSE;
- map = brw->sws->bo_map(query->bo, GL_FALSE);
+ map = brw->sws->bo_map(query->bo, BRW_DATA_OTHER, GL_FALSE);
if (map == NULL)
return FALSE;
diff --git a/src/gallium/drivers/i965/brw_screen_buffers.c b/src/gallium/drivers/i965/brw_screen_buffers.c
index c0f19d64aad..ba54740225c 100644
--- a/src/gallium/drivers/i965/brw_screen_buffers.c
+++ b/src/gallium/drivers/i965/brw_screen_buffers.c
@@ -24,6 +24,7 @@ brw_buffer_map( struct pipe_screen *screen,
return buf->user_buffer;
return sws->bo_map( buf->bo,
+ BRW_DATA_OTHER,
(usage & PIPE_BUFFER_USAGE_CPU_WRITE) ? TRUE : FALSE );
}
@@ -64,7 +65,7 @@ brw_buffer_create(struct pipe_screen *screen,
struct brw_screen *bscreen = brw_screen(screen);
struct brw_winsys_screen *sws = bscreen->sws;
struct brw_buffer *buf;
- unsigned usage_type;
+ unsigned buffer_type;
buf = CALLOC_STRUCT(brw_buffer);
if (!buf)
@@ -84,24 +85,24 @@ brw_buffer_create(struct pipe_screen *screen,
case PIPE_BUFFER_USAGE_VERTEX:
case PIPE_BUFFER_USAGE_INDEX:
case (PIPE_BUFFER_USAGE_VERTEX|PIPE_BUFFER_USAGE_INDEX):
- usage_type = BRW_BUFFER_TYPE_VERTEX;
+ buffer_type = BRW_BUFFER_TYPE_VERTEX;
break;
case PIPE_BUFFER_USAGE_PIXEL:
- usage_type = BRW_BUFFER_TYPE_PIXEL;
+ buffer_type = BRW_BUFFER_TYPE_PIXEL;
break;
case PIPE_BUFFER_USAGE_CONSTANT:
- usage_type = BRW_BUFFER_TYPE_SHADER_CONSTANTS;
+ buffer_type = BRW_BUFFER_TYPE_SHADER_CONSTANTS;
break;
default:
- usage_type = BRW_BUFFER_TYPE_GENERIC;
+ buffer_type = BRW_BUFFER_TYPE_GENERIC;
break;
}
buf->bo = sws->bo_alloc( sws,
- usage_type,
+ buffer_type,
size,
alignment );
diff --git a/src/gallium/drivers/i965/brw_screen_texture.c b/src/gallium/drivers/i965/brw_screen_texture.c
index c318b07f97a..ba6dc7dfdee 100644
--- a/src/gallium/drivers/i965/brw_screen_texture.c
+++ b/src/gallium/drivers/i965/brw_screen_texture.c
@@ -186,6 +186,7 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen,
{
struct brw_screen *bscreen = brw_screen(screen);
struct brw_texture *tex;
+ enum brw_buffer_type buffer_type;
tex = CALLOC_STRUCT(brw_texture);
if (tex == NULL)
@@ -226,21 +227,16 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen,
goto fail;
- if (templ->tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
- }
- else if (templ->tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_PRIMARY)) {
- }
- else if (templ->tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) {
- }
- else if (templ->tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) {
+ if (templ->tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_PRIMARY)) {
+ buffer_type = BRW_BUFFER_TYPE_SCANOUT;
}
-
- if (templ->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC) {
+ else {
+ buffer_type = BRW_BUFFER_TYPE_TEXTURE;
}
tex->bo = bscreen->sws->bo_alloc( bscreen->sws,
- BRW_USAGE_SAMPLER,
+ buffer_type,
tex->pitch * tex->total_height * tex->cpp,
64 );
diff --git a/src/gallium/drivers/i965/brw_state_cache.c b/src/gallium/drivers/i965/brw_state_cache.c
index 071a942e5ca..cbd1f02d77d 100644
--- a/src/gallium/drivers/i965/brw_state_cache.c
+++ b/src/gallium/drivers/i965/brw_state_cache.c
@@ -228,7 +228,7 @@ brw_upload_cache( struct brw_cache *cache,
* these various entities.
*/
bo = cache->sws->bo_alloc(cache->sws,
- BRW_BUFFER_TYPE_STATE_CACHE,
+ cache->buffer_type,
data_size, 1 << 6);
@@ -273,7 +273,9 @@ brw_upload_cache( struct brw_cache *cache,
data_size, cache_id);
/* Copy data to the buffer */
- cache->sws->bo_subdata(bo, 0, data_size, data);
+ cache->sws->bo_subdata(bo,
+ cache_id,
+ 0, data_size, data);
update_cache_last(cache, cache_id, bo);
@@ -332,11 +334,6 @@ brw_cache_data(struct brw_cache *cache,
reloc_bufs, nr_reloc_bufs);
}
-enum pool_type {
- DW_SURFACE_STATE,
- DW_GENERAL_STATE
-};
-
static void
brw_init_cache_id(struct brw_cache *cache,
@@ -352,13 +349,15 @@ brw_init_cache_id(struct brw_cache *cache,
static void
-brw_init_non_surface_cache(struct brw_context *brw)
+brw_init_general_state_cache(struct brw_context *brw)
{
struct brw_cache *cache = &brw->cache;
cache->brw = brw;
cache->sws = brw->sws;
+ cache->buffer_type = BRW_BUFFER_TYPE_GENERAL_STATE;
+
cache->size = 7;
cache->n_items = 0;
cache->items = (struct brw_cache_item **)
@@ -457,13 +456,15 @@ brw_init_non_surface_cache(struct brw_context *brw)
static void
-brw_init_surface_cache(struct brw_context *brw)
+brw_init_surface_state_cache(struct brw_context *brw)
{
struct brw_cache *cache = &brw->surface_cache;
cache->brw = brw;
cache->sws = brw->sws;
+ cache->buffer_type = BRW_BUFFER_TYPE_SURFACE_STATE;
+
cache->size = 7;
cache->n_items = 0;
cache->items = (struct brw_cache_item **)
@@ -486,8 +487,8 @@ brw_init_surface_cache(struct brw_context *brw)
void
brw_init_caches(struct brw_context *brw)
{
- brw_init_non_surface_cache(brw);
- brw_init_surface_cache(brw);
+ brw_init_general_state_cache(brw);
+ brw_init_surface_state_cache(brw);
}
diff --git a/src/gallium/drivers/i965/brw_state_dump.c b/src/gallium/drivers/i965/brw_state_dump.c
index 345e42a6b20..388331ee626 100644
--- a/src/gallium/drivers/i965/brw_state_dump.c
+++ b/src/gallium/drivers/i965/brw_state_dump.c
@@ -65,7 +65,7 @@ state_struct_out(struct brw_winsys_screen *sws,
if (buffer == NULL)
return;
- data = sws->bo_map(buffer, GL_FALSE);
+ data = sws->bo_map(buffer, BRW_DATA_OTHER, GL_FALSE);
for (i = 0; i < state_size / 4; i++) {
state_out(name, data, buffer->offset[0], i,
"dword %d\n", i);
@@ -114,7 +114,9 @@ static void dump_wm_surface_state(struct brw_context *brw)
debug_printf(" WM SS%d: NULL\n", i);
continue;
}
- surf = (struct brw_surface_state *)brw->sws->bo_map(surf_bo, GL_FALSE);
+ surf = (struct brw_surface_state *)brw->sws->bo_map(surf_bo,
+ BRW_DATA_OTHER,
+ GL_FALSE);
surfoff = surf_bo->offset[0];
sprintf(name, "WM SS%d", i);
@@ -144,7 +146,9 @@ static void dump_sf_viewport_state(struct brw_context *brw)
if (brw->sf.vp_bo == NULL)
return;
- vp = (struct brw_sf_viewport *)brw->sws->bo_map(brw->sf.vp_bo, GL_FALSE);
+ vp = (struct brw_sf_viewport *)brw->sws->bo_map(brw->sf.vp_bo,
+ BRW_DATA_OTHER,
+ GL_FALSE);
vp_off = brw->sf.vp_bo->offset[0];
state_out(name, vp, vp_off, 0, "m00 = %f\n", vp->viewport.m00);
@@ -172,7 +176,9 @@ static void brw_debug_prog(struct brw_winsys_screen *sws,
if (prog == NULL)
return;
- data = (uint32_t *)sws->bo_map(prog, GL_FALSE);
+ data = (uint32_t *)sws->bo_map(prog,
+ BRW_DATA_OTHER,
+ GL_FALSE);
for (i = 0; i < prog->size / 4 / 4; i++) {
debug_printf("%8s: 0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
diff --git a/src/gallium/drivers/i965/brw_winsys.h b/src/gallium/drivers/i965/brw_winsys.h
index f5ce9d13d73..d941fbcebee 100644
--- a/src/gallium/drivers/i965/brw_winsys.h
+++ b/src/gallium/drivers/i965/brw_winsys.h
@@ -44,21 +44,6 @@ struct brw_winsys_buffer {
unsigned size;
};
-/* Describe the usage of a particular buffer in a relocation. The DRM
- * winsys will translate these back to GEM read/write domain flags.
- */
-enum brw_buffer_usage {
- BRW_USAGE_STATE, /* INSTRUCTION, 0 */
- BRW_USAGE_QUERY_RESULT, /* INSTRUCTION, INSTRUCTION */
- BRW_USAGE_RENDER_TARGET, /* RENDER, 0 */
- BRW_USAGE_DEPTH_BUFFER, /* RENDER, RENDER */
- BRW_USAGE_BLIT_SOURCE, /* RENDER, 0 */
- BRW_USAGE_BLIT_DEST, /* RENDER, RENDER */
- BRW_USAGE_SAMPLER, /* SAMPLER, 0 */
- BRW_USAGE_VERTEX, /* VERTEX, 0 */
- BRW_USAGE_SCRATCH, /* 0, 0 */
- BRW_USAGE_MAX
-};
/* Should be possible to validate usages above against buffer creation
* types, below:
@@ -73,12 +58,53 @@ enum brw_buffer_type
BRW_BUFFER_TYPE_SHADER_CONSTANTS,
BRW_BUFFER_TYPE_SHADER_SCRATCH,
BRW_BUFFER_TYPE_BATCH,
- BRW_BUFFER_TYPE_STATE_CACHE,
+ BRW_BUFFER_TYPE_GENERAL_STATE,
+ BRW_BUFFER_TYPE_SURFACE_STATE,
BRW_BUFFER_TYPE_PIXEL, /* image uploads, pbo's, etc */
BRW_BUFFER_TYPE_GENERIC, /* unknown */
BRW_BUFFER_TYPE_MAX /* Count of possible values */
};
+
+/* Describe the usage of a particular buffer in a relocation. The DRM
+ * winsys will translate these back to GEM read/write domain flags.
+ */
+enum brw_buffer_usage {
+ BRW_USAGE_STATE, /* INSTRUCTION, 0 */
+ BRW_USAGE_QUERY_RESULT, /* INSTRUCTION, INSTRUCTION */
+ BRW_USAGE_RENDER_TARGET, /* RENDER, 0 */
+ BRW_USAGE_DEPTH_BUFFER, /* RENDER, RENDER */
+ BRW_USAGE_BLIT_SOURCE, /* RENDER, 0 */
+ BRW_USAGE_BLIT_DEST, /* RENDER, RENDER */
+ BRW_USAGE_SAMPLER, /* SAMPLER, 0 */
+ BRW_USAGE_VERTEX, /* VERTEX, 0 */
+ BRW_USAGE_SCRATCH, /* 0, 0 */
+ BRW_USAGE_MAX
+};
+
+enum brw_buffer_data_type {
+ BRW_DATA_GS_CC_VP,
+ BRW_DATA_GS_CC_UNIT,
+ BRW_DATA_GS_WM_PROG,
+ BRW_DATA_GS_SAMPLER_DEFAULT_COLOR,
+ BRW_DATA_GS_SAMPLER,
+ BRW_DATA_GS_WM_UNIT,
+ BRW_DATA_GS_SF_PROG,
+ BRW_DATA_GS_SF_VP,
+ BRW_DATA_GS_SF_UNIT,
+ BRW_DATA_GS_VS_UNIT,
+ BRW_DATA_GS_VS_PROG,
+ BRW_DATA_GS_GS_UNIT,
+ BRW_DATA_GS_GS_PROG,
+ BRW_DATA_GS_CLIP_VP,
+ BRW_DATA_GS_CLIP_UNIT,
+ BRW_DATA_GS_CLIP_PROG,
+ BRW_DATA_SS_SURFACE,
+ BRW_DATA_SS_SURF_BIND,
+ BRW_DATA_OTHER,
+ BRW_DATA_MAX
+};
+
struct brw_winsys_screen {
@@ -113,9 +139,10 @@ struct brw_winsys_screen {
unsigned bytes_used );
int (*bo_subdata)(struct brw_winsys_buffer *buffer,
- size_t offset,
- size_t size,
- const void *data);
+ enum brw_buffer_data_type data_type,
+ size_t offset,
+ size_t size,
+ const void *data);
boolean (*bo_is_busy)(struct brw_winsys_buffer *buffer);
boolean (*bo_references)(struct brw_winsys_buffer *a,
@@ -132,6 +159,7 @@ struct brw_winsys_screen {
* Map a buffer.
*/
void *(*bo_map)(struct brw_winsys_buffer *buffer,
+ enum brw_buffer_data_type data_type,
boolean write);
/**
@@ -140,9 +168,6 @@ struct brw_winsys_screen {
void (*bo_unmap)(struct brw_winsys_buffer *buffer);
/*@}*/
-
-
-
/**
* Destroy the winsys.
*/