From: Eric Anholt Date: Fri, 16 Dec 2016 19:00:46 +0000 (-0800) Subject: vc4: Start using XML unpack functions in CL dump. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d623040dd5dc14f07ba41ef6e822ce57e083fe7c;p=mesa.git vc4: Start using XML unpack functions in CL dump. For now this is a no-op on the output, but it makes it clear that we've had weird things going on with things like V3D21_CLIPPER_Z_SCALE_AND_OFFSET. --- diff --git a/src/gallium/drivers/vc4/vc4_cl.h b/src/gallium/drivers/vc4/vc4_cl.h index ec3713c8a4a..036132697a9 100644 --- a/src/gallium/drivers/vc4/vc4_cl.h +++ b/src/gallium/drivers/vc4/vc4_cl.h @@ -68,7 +68,6 @@ struct vc4_cl { void vc4_init_cl(struct vc4_job *job, struct vc4_cl *cl); void vc4_reset_cl(struct vc4_cl *cl); -void vc4_dump_cl(void *cl, uint32_t size, bool is_render); uint32_t vc4_gem_hindex(struct vc4_job *job, struct vc4_bo *bo); struct PACKED unaligned_16 { uint16_t x; }; diff --git a/src/gallium/drivers/vc4/vc4_cl_dump.c b/src/gallium/drivers/vc4/vc4_cl_dump.c index a719f276b2e..cbe35b0208e 100644 --- a/src/gallium/drivers/vc4/vc4_cl_dump.c +++ b/src/gallium/drivers/vc4/vc4_cl_dump.c @@ -24,7 +24,16 @@ #include "util/u_math.h" #include "util/u_prim.h" #include "util/macros.h" -#include "vc4_context.h" +#include "vc4_cl_dump.h" +#include "vc4_packet.h" + +#define __gen_user_data void +#define __gen_address_type uint32_t +#define __gen_address_offset(reloc) (*reloc) +#define __gen_emit_reloc(cl, reloc) +#define __gen_unpack_address __gen_unpack_uint + +#include "broadcom/cle/v3d_packet_v21_pack.h" #define dump_VC4_PACKET_LINE_WIDTH dump_float #define dump_VC4_PACKET_POINT_SIZE dump_float @@ -187,15 +196,16 @@ static void dump_VC4_PACKET_GL_ARRAY_PRIMITIVE(void *cl, uint32_t offset, uint32_t hw_offset) { uint8_t *b = cl + offset; - uint32_t *count = cl + offset + 1; - uint32_t *start = cl + offset + 5; + + struct V3D21_VERTEX_ARRAY_PRIMITIVES values; + V3D21_VERTEX_ARRAY_PRIMITIVES_unpack(cl + offset - 1, &values); fprintf(stderr, "0x%08x 0x%08x: 0x%02x %s\n", - offset, hw_offset, b[0], u_prim_name(b[0] & 0x7)); + offset, hw_offset, b[0], u_prim_name(values.primitive_mode)); fprintf(stderr, "0x%08x 0x%08x: %d verts\n", - offset + 1, hw_offset + 1, *count); + offset + 1, hw_offset + 1, values.length); fprintf(stderr, "0x%08x 0x%08x: 0x%08x start\n", - offset + 5, hw_offset + 5, *start); + offset + 5, hw_offset + 5, values.index_of_first_vertex); } static void @@ -223,10 +233,15 @@ dump_VC4_PACKET_CLIPPER_XY_SCALING(void *cl, uint32_t offset, uint32_t hw_offset { uint32_t *scale = cl + offset; + struct V3D21_CLIPPER_XY_SCALING values; + V3D21_CLIPPER_XY_SCALING_unpack(cl + offset - 1, &values); + fprintf(stderr, "0x%08x 0x%08x: %f, %f (%f, %f, 0x%08x, 0x%08x)\n", offset, hw_offset, - uif(scale[0]) / 16.0, uif(scale[1]) / 16.0, - uif(scale[0]), uif(scale[1]), + values.viewport_half_width_in_1_16th_of_pixel / 16.0, + values.viewport_half_height_in_1_16th_of_pixel / 16.0, + values.viewport_half_width_in_1_16th_of_pixel, + values.viewport_half_height_in_1_16th_of_pixel, scale[0], scale[1]); } @@ -236,9 +251,13 @@ dump_VC4_PACKET_CLIPPER_Z_SCALING(void *cl, uint32_t offset, uint32_t hw_offset) uint32_t *translate = cl + offset; uint32_t *scale = cl + offset + 8; + struct V3D21_CLIPPER_Z_SCALE_AND_OFFSET values; + V3D21_CLIPPER_Z_SCALE_AND_OFFSET_unpack(cl + offset - 1, &values); + fprintf(stderr, "0x%08x 0x%08x: %f, %f (0x%08x, 0x%08x)\n", offset, hw_offset, - uif(translate[0]), uif(translate[1]), + values.viewport_z_scale_zc_to_zs, + values.viewport_z_offset_zc_to_zs, translate[0], translate[1]); fprintf(stderr, "0x%08x 0x%08x: %f, %f (0x%08x, 0x%08x)\n", @@ -250,28 +269,26 @@ dump_VC4_PACKET_CLIPPER_Z_SCALING(void *cl, uint32_t offset, uint32_t hw_offset) static void dump_VC4_PACKET_TILE_BINNING_MODE_CONFIG(void *cl, uint32_t offset, uint32_t hw_offset) { - uint32_t *tile_alloc_addr = cl + offset; - uint32_t *tile_alloc_size = cl + offset + 4; - uint32_t *tile_state_addr = cl + offset + 8; - uint8_t *bin_x = cl + offset + 12; - uint8_t *bin_y = cl + offset + 13; uint8_t *flags = cl + offset + 14; + struct V3D21_TILE_BINNING_MODE_CONFIGURATION values; + V3D21_TILE_BINNING_MODE_CONFIGURATION_unpack(cl + offset - 1, &values); + fprintf(stderr, "0x%08x 0x%08x: tile alloc addr 0x%08x\n", offset, hw_offset, - *tile_alloc_addr); + values.tile_allocation_memory_address); fprintf(stderr, "0x%08x 0x%08x: tile alloc size %db\n", offset + 4, hw_offset + 4, - *tile_alloc_size); + values.tile_allocation_memory_size); fprintf(stderr, "0x%08x 0x%08x: tile state addr 0x%08x\n", offset + 8, hw_offset + 8, - *tile_state_addr); + values.tile_state_data_array_address); fprintf(stderr, "0x%08x 0x%08x: tiles (%d, %d)\n", offset + 12, hw_offset + 12, - *bin_x, *bin_y); + values.width_in_tiles, values.height_in_tiles); fprintf(stderr, "0x%08x 0x%08x: flags 0x%02x\n", offset + 14, hw_offset + 14, diff --git a/src/gallium/drivers/vc4/vc4_cl_dump.h b/src/gallium/drivers/vc4/vc4_cl_dump.h new file mode 100644 index 00000000000..760ab8da7e3 --- /dev/null +++ b/src/gallium/drivers/vc4/vc4_cl_dump.h @@ -0,0 +1,30 @@ +/* + * Copyright © 2016 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef VC4_CL_DUMP_H +#define VC4_CL_DUMP_H + +#include +void vc4_dump_cl(void *cl, uint32_t size, bool is_render); + +#endif diff --git a/src/gallium/drivers/vc4/vc4_job.c b/src/gallium/drivers/vc4/vc4_job.c index ed6c86c3e6c..1dab4bedd32 100644 --- a/src/gallium/drivers/vc4/vc4_job.c +++ b/src/gallium/drivers/vc4/vc4_job.c @@ -27,6 +27,7 @@ */ #include +#include "vc4_cl_dump.h" #include "vc4_context.h" #include "util/hash_table.h" diff --git a/src/gallium/drivers/vc4/vc4_simulator.c b/src/gallium/drivers/vc4/vc4_simulator.c index ab701ab5609..6d99e9f2eea 100644 --- a/src/gallium/drivers/vc4/vc4_simulator.c +++ b/src/gallium/drivers/vc4/vc4_simulator.c @@ -55,6 +55,7 @@ #include "util/ralloc.h" #include "vc4_screen.h" +#include "vc4_cl_dump.h" #include "vc4_context.h" #include "kernel/vc4_drv.h" #include "vc4_simulator_validate.h"