From 4c196ed7a8e06933d11b96ac520afa39252fc5c7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 5 Nov 2009 22:43:36 +0000 Subject: 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. --- src/gallium/winsys/drm/i965/xlib/xlib_i965.c | 31 ++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'src/gallium/winsys/drm/i965') diff --git a/src/gallium/winsys/drm/i965/xlib/xlib_i965.c b/src/gallium/winsys/drm/i965/xlib/xlib_i965.c index ab5df56bc0..ce6d85976d 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; } -- cgit v1.2.3