summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i965/brw_wm_constant_buffer.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-11-05 22:43:36 +0000
committerKeith Whitwell <keithw@vmware.com>2009-11-05 22:43:36 +0000
commit4c196ed7a8e06933d11b96ac520afa39252fc5c7 (patch)
treed32fea2784830e7695c071104a461eb853da638f /src/gallium/drivers/i965/brw_wm_constant_buffer.c
parent3763457892c2d0c654c0eca7585e4d3a863f7714 (diff)
i965g: pass relocation information in an array with bo_subdata
Makes it easier to dump as we get all of the information about the upload in a single hit. Opens the window to simplification in the driver if these relocation arrays can be maintained statically rather than being recreated whenever we check for a new upload. Still needs some cleanup to avoid uglyness introduced with the delta values.
Diffstat (limited to 'src/gallium/drivers/i965/brw_wm_constant_buffer.c')
-rw-r--r--src/gallium/drivers/i965/brw_wm_constant_buffer.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/gallium/drivers/i965/brw_wm_constant_buffer.c b/src/gallium/drivers/i965/brw_wm_constant_buffer.c
index 14568265dd..6434c6acf7 100644
--- a/src/gallium/drivers/i965/brw_wm_constant_buffer.c
+++ b/src/gallium/drivers/i965/brw_wm_constant_buffer.c
@@ -13,16 +13,24 @@ brw_create_constant_surface( struct brw_context *brw,
{
const GLint w = key->width - 1;
struct brw_winsys_buffer *bo;
+ struct brw_winsys_reloc reloc[1];
enum pipe_error ret;
+ /* Emit relocation to surface contents */
+ make_reloc(&reloc[0],
+ BRW_USAGE_SAMPLER,
+ 0,
+ offsetof(struct brw_surface_state, ss1),
+ key->bo);
+
+
memset(&surf, 0, sizeof(surf));
surf.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
surf.ss0.surface_type = BRW_SURFACE_BUFFER;
surf.ss0.surface_format = BRW_SURFACEFORMAT_R32G32B32A32_FLOAT;
- assert(key->bo);
- surf.ss1.base_addr = key->bo->offset; /* reloc */
+ surf.ss1.base_addr = 0; /* reloc */
surf.ss2.width = w & 0x7f; /* bits 6:0 of size or width */
surf.ss2.height = (w >> 7) & 0x1fff; /* bits 19:7 of size or width */
@@ -32,24 +40,13 @@ brw_create_constant_surface( struct brw_context *brw,
ret = brw_upload_cache(&brw->surface_cache, BRW_SS_SURFACE,
key, sizeof(*key),
- &key->bo, key->bo ? 1 : 0,
+ reloc, Elements(reloc),
&surf, sizeof(surf),
NULL, NULL,
&bo_out);
if (ret)
return ret;
- if (key->bo) {
- /* Emit relocation to surface contents */
- ret = brw->sws->bo_emit_reloc(*bo_out,
- BRW_USAGE_SAMPLER,
- 0,
- offsetof(struct brw_surface_state, ss1),
- key->bo);
- if (ret)
- return ret;
- }
-
return PIPE_OK;
}