Path: blob/21.2-virgl/src/gallium/drivers/vc4/vc4_cl_dump.c
4570 views
/*1* Copyright © 2014 Broadcom2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#include "util/u_math.h"24#include "util/u_prim.h"25#include "util/macros.h"26#include "vc4_cl_dump.h"27#include "kernel/vc4_packet.h"2829#include "broadcom/cle/v3d_decoder.h"30#include "broadcom/clif/clif_dump.h"3132void33vc4_dump_cl(void *cl, uint32_t size, bool is_render)34{35struct v3d_device_info devinfo = {36/* While the driver supports V3D 2.1 and 2.6, we haven't split37* off a 2.6 XML yet (there are a couple of fields different38* in render target formatting)39*/40.ver = 21,41};42struct v3d_spec *spec = v3d_spec_load(&devinfo);4344struct clif_dump *clif = clif_dump_init(&devinfo, stderr, true);4546uint32_t offset = 0, hw_offset = 0;47uint8_t *p = cl;4849while (offset < size) {50struct v3d_group *inst = v3d_spec_find_instruction(spec, p);51uint8_t header = *p;52uint32_t length;5354if (inst == NULL) {55fprintf(stderr, "0x%08x 0x%08x: Unknown packet 0x%02x (%d)!\n",56offset, hw_offset, header, header);57return;58}5960length = v3d_group_get_length(inst);6162fprintf(stderr, "0x%08x 0x%08x: 0x%02x %s\n",63offset, hw_offset, header, v3d_group_get_name(inst));6465v3d_print_group(clif, inst, offset, p);6667switch (header) {68case VC4_PACKET_HALT:69case VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF:70return;71default:72break;73}7475offset += length;76if (header != VC4_PACKET_GEM_HANDLES)77hw_offset += length;78p += length;79}8081clif_dump_destroy(clif);82}83848586