Exemple #1
0
def dump_context_map(f, mem, addr, end_addr, depth, state_map):
    '''
    Dump Vivante context map.
    '''
    indent = '    ' * len(depth)
    f.write('{\n')
    state_base = 0
    state_count = 0
    state_format = 0
    next_cmd = 0
    payload_start_ptr = 0
    payload_end_ptr = 0
    op = 0
    size = (end_addr - addr) // 4
    ptr = 0
    while ptr < size:
        hide = False
        (value, ) = WORD_SPEC.unpack(mem[addr + ptr * 4:addr + ptr * 4 + 4])
        if value != 0:
            f.write(indent + '    {0x%x, 0x%05X}' % (value, ptr * 4))
            try:
                path = state_map.lookup_address(ptr * 4)
                desc = format_path(path)
            except KeyError:
                desc = ''
            if ptr != (size - 1):
                f.write(", /* %s */\n" % desc)
            else:
                f.write("  /* %s */\n" % desc)
        ptr += 1
    f.write(indent + '}')
Exemple #2
0
def dump_texture_descriptor(f, mem, depth, gpu_addr, tracking, txdesc_map):
    '''
    Print contents of a texture descriptor.
    '''
    indent = '    ' * len(depth)
    logical = tracking.meminfo_gpu_to_cpu(gpu_addr)
    if logical is None:  # No CPU address known, can't dump
        return
    try:
        descriptor = bytes_to_words(mem[logical:logical + 0xa0])
    except IndexError:
        return  # Address not in fdr, well, forget it
    f.write(indent + '/*\n')
    describe = ValueDumper(tracking)
    for i, value in enumerate(descriptor):
        try:
            path = txdesc_map.lookup_address(i * 4)
            pathstring = format_path(path)
            register = path[-1][0]
            desc = describe(register, value)
        except KeyError:
            pathstring = ''
            desc = ''
        f.write('%s  [%02x] %s: 0x%08x %s\n' %
                (indent, i * 4, pathstring, value, desc))
    f.write(indent + '*/\n')
Exemple #3
0
def format_state(pos, value, fixp, state_map):
    try:
        path = state_map.lookup_address(pos)
        path_str = format_path(path)
    except KeyError:
        path = None
        path_str = '(UNKNOWN)'
    desc = ('  [%05X]' % pos) + ' ' + path_str
    if fixp:
        desc += ' = %f' % fixp_as_float(value)
    else:
        # For uniforms, show float value
        if (pos >= 0x05000 and pos < 0x06000) or (
                pos >= 0x07000 and pos < 0x08000) or (pos >= 0x30000
                                                      and pos < 0x32000):
            num = pos & 0xFFF
            spec = 'u%i.%s' % (num // 16, COMPS[(num // 4) % 4])
            desc += ' := %f (%s)' % (int_as_float(value), spec)
        elif path is not None:
            register = path[-1][0]
            desc += ' := '
            if isinstance(register.type, Domain):
                desc += format_addr(value)
            else:
                desc += register.describe(value)
    return desc
Exemple #4
0
def dump_context_map(f, mem, addr, end_addr, depth, state_map):
    '''
    Dump Vivante context map.
    '''
    indent = '    ' * len(depth)
    f.write('{\n')
    state_base = 0
    state_count = 0
    state_format = 0
    next_cmd = 0
    payload_start_ptr = 0
    payload_end_ptr = 0
    op = 0
    size = (end_addr - addr)//4
    ptr = 0
    while ptr < size:
        hide = False
        (value,) = WORD_SPEC.unpack(mem[addr+ptr*4:addr+ptr*4+4])
        if value != 0:
            f.write(indent + '    {0x%x, 0x%05X}' % (value, ptr*4))
            try:
                path = state_map.lookup_address(ptr*4)
                desc = format_path(path)
            except KeyError:
                desc = ''
            if ptr != (size-1):
                f.write(", /* %s */\n" % desc)
            else:
                f.write("  /* %s */\n" % desc)
        ptr += 1
    f.write(indent + '}')
Exemple #5
0
def dump_texture_descriptor(f, mem, depth, gpu_addr, tracking, txdesc_map):
    '''
    Print contents of a texture descriptor.
    '''
    indent = '    ' * len(depth)
    logical = tracking.meminfo_gpu_to_cpu(gpu_addr)
    if logical is None: # No CPU address known, can't dump
        return
    try:
        descriptor = bytes_to_words(mem[logical:logical+0xa0])
    except IndexError:
        return # Address not in fdr, well, forget it
    f.write(indent + '/*\n')
    describe = ValueDumper(tracking)
    for i,value in enumerate(descriptor):
        try:
            path = txdesc_map.lookup_address(i*4)
            pathstring = format_path(path)
            register = path[-1][0]
            desc = describe(register, value)
        except KeyError:
            pathstring = ''
            desc = ''
        f.write('%s  [%02x] %s: 0x%08x %s\n' % (indent, i*4, pathstring, value, desc))
    f.write(indent + '*/\n')
Exemple #6
0
 def format_state(self, pos, value, fixp):
     try:
         path = self.state_map.lookup_address(pos)
         path_str = format_path(path)
     except KeyError:
         path = None
         path_str = '0x%05X' % pos
     desc = '  ' + path_str 
     if fixp:
         desc += ' = %f' % fixp_as_float(value)
     else:
         # For uniforms, show float value
         if (pos >= 0x05000 and pos < 0x06000) or (pos >= 0x07000 and pos < 0x08000):
             num = pos & 0xFFF
             desc += ' := %f (%s)' % (int_as_float(value), offset_to_uniform(num))
         elif path is not None:
             register = path[-1][0]
             desc += ' := ' + register.describe(value)
     return desc
Exemple #7
0
 def format_state(self, pos, value, fixp):
     try:
         path = self.state_map.lookup_address(pos)
         path_str = format_path(path)
     except KeyError:
         path = None
         path_str = '0x%05X' % pos
     desc = '  ' + path_str 
     if fixp:
         desc += ' = %f' % fixp_as_float(value)
     else:
         # For uniforms, show float value
         if (pos >= 0x05000 and pos < 0x06000) or (pos >= 0x07000 and pos < 0x08000):
             num = pos & 0xFFF
             desc += ' := %f (%s)' % (int_as_float(value), offset_to_uniform(num))
         elif path is not None:
             register = path[-1][0]
             desc += ' := ' + register.describe(value)
     return desc
Exemple #8
0
def format_state(pos, value, fixp, state_map, describe):
    try:
        path = state_map.lookup_address(pos)
        path_str = format_path(path)
    except KeyError:
        path = None
        path_str = '(UNKNOWN)'
    desc = ('  [%05X]' % pos) + ' ' + path_str 
    if fixp:
        desc += ' = %f' % fixp_as_float(value)
    else:
        # For uniforms, show float value
        if (pos >= 0x05000 and pos < 0x06000) or (pos >= 0x07000 and pos < 0x08000) or (pos >= 0x30000 and pos < 0x32000):
            num = pos & 0xFFF
            spec = 'u%i.%s' % (num//16, COMPS[(num//4)%4])
            desc += ' := %f (%s)' % (int_as_float(value), spec)
        elif path is not None:
            register = path[-1][0]
            desc += ' := ' + describe(register, value)
    return desc
def format_state(pos, value, fixp, state_map):
    try:
        path = state_map.lookup_address(pos)
        path_str = format_path(path) #+ ('(0x%05X)' % pos)
    except KeyError:
        path = None
        path_str = '0x%05X' % pos
    desc = '  ' + path_str 
    if fixp:
        desc += ' = %f' % fixp_as_float(value)
    else:
        # For uniforms, show float value
        if (pos >= 0x05000 and pos < 0x06000) or (pos >= 0x07000 and pos < 0x08000):
            num = pos & 0xFFF
            spec = 'u%i.%s' % (num//16, COMPS[(num//4)%4])
            desc += ' := %f (%s)' % (int_as_float(value), spec)
        elif path is not None:
            register = path[-1][0]
            desc += ' := '
            desc += register.describe(value)
    return desc
Exemple #10
0
def format_state(pos, value, fixp, state_map):
    try:
        path = state_map.lookup_address(pos)
        path_str = format_path(path) #+ ('(0x%05X)' % pos)
    except KeyError:
        path = None
        path_str = '0x%05X' % pos
    desc = '  ' + path_str 
    if fixp:
        desc += ' = %f' % fixp_as_float(value)
    else:
        # For uniforms, show float value
        if (pos >= 0x05000 and pos < 0x06000) or (pos >= 0x07000 and pos < 0x08000):
            num = pos & 0xFFF
            spec = 'u%i.%s' % (num//16, COMPS[(num//4)%4])
            desc += ' := %f (%s)' % (int_as_float(value), spec)
        elif path is not None:
            register = path[-1][0]
            desc += ' := '
            if isinstance(register.type, Domain):
                desc += format_addr(value)
            else:
                desc += register.describe(value)
    return desc