summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-11-05 22:43:36 +0000
committerKeith Whitwell <[email protected]>2009-11-05 22:43:36 +0000
commit4c196ed7a8e06933d11b96ac520afa39252fc5c7 (patch)
treed32fea2784830e7695c071104a461eb853da638f /src/gallium/winsys
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/winsys')
-rw-r--r--src/gallium/winsys/drm/i965/xlib/xlib_i965.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/gallium/winsys/drm/i965/xlib/xlib_i965.c b/src/gallium/winsys/drm/i965/xlib/xlib_i965.c
index ab5df56bc05..ce6d85976dc 100644
--- a/src/gallium/winsys/drm/i965/xlib/xlib_i965.c
+++ b/src/gallium/winsys/drm/i965/xlib/xlib_i965.c
@@ -47,6 +47,10 @@
#define MAX_VRAM (128*1024*1024)
+#define MAX_DUMPS 128
+
+
+
extern int brw_disasm (FILE *file,
const struct brw_instruction *inst,
unsigned count );
@@ -294,21 +298,36 @@ xlib_brw_bo_subdata(struct brw_winsys_buffer *buffer,
enum brw_buffer_data_type data_type,
size_t offset,
size_t size,
- const void *data)
+ const void *data,
+ const struct brw_winsys_reloc *reloc,
+ unsigned nr_relocs)
{
struct xlib_brw_buffer *buf = xlib_brw_buffer(buffer);
struct xlib_brw_winsys *xbw = xlib_brw_winsys(buffer->sws);
+ unsigned i;
- debug_printf("%s buf %p off %d sz %d %s\n",
+ debug_printf("%s buf %p off %d sz %d %s relocs: %d\n",
__FUNCTION__,
- (void *)buffer, offset, size, data_types[data_type]);
-
- if (1)
- dump_data( xbw, data_type, data, size );
+ (void *)buffer, offset, size,
+ data_types[data_type],
+ nr_relocs);
assert(buf->base.size >= offset + size);
memcpy(buf->virtual + offset, data, size);
+ /* Apply the relocations:
+ */
+ for (i = 0; i < nr_relocs; i++) {
+ debug_printf("\treloc[%d] usage %s off %d value %x+%x\n",
+ i, usages[reloc[i].usage], reloc[i].offset,
+ xlib_brw_buffer(reloc[i].bo)->offset, reloc[i].delta);
+
+ *(unsigned *)(buf->virtual + offset + reloc[i].offset) =
+ xlib_brw_buffer(reloc[i].bo)->offset + reloc[i].delta;
+ }
+
+ if (1)
+ dump_data( xbw, data_type, buf->virtual + offset, size );
return 0;
}