mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 15:58:05 +02:00
broadcom: use Mesa logging functions
Replace printf and nir_print_shaders by proper mesa_logX and nir_log_shaderX functions, that provides better features (like logging to a file, setting the logging verbosity, etc) and works better with Android. Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40434>
This commit is contained in:
parent
1e82e72039
commit
d4646cd444
44 changed files with 435 additions and 479 deletions
|
|
@ -36,6 +36,7 @@
|
|||
#include <inttypes.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#include <util/log.h>
|
||||
#include <util/macros.h>
|
||||
#include <util/ralloc.h>
|
||||
#include <util/u_debug.h>
|
||||
|
|
@ -67,6 +68,7 @@ struct location {
|
|||
struct parser_context {
|
||||
XML_Parser parser;
|
||||
const struct v3d_device_info *devinfo;
|
||||
struct log_stream *stream;
|
||||
int foo;
|
||||
struct location loc;
|
||||
|
||||
|
|
@ -139,25 +141,11 @@ v3d_spec_find_enum(struct v3d_spec *spec, const char *name)
|
|||
|
||||
#ifdef WITH_LIBEXPAT
|
||||
|
||||
static void __attribute__((noreturn))
|
||||
fail(struct location *loc, const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, msg);
|
||||
fprintf(stderr, "%s:%d: error: ",
|
||||
loc->filename, loc->line_number);
|
||||
vfprintf(stderr, msg, ap);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(ap);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static void *
|
||||
fail_on_null(void *p)
|
||||
{
|
||||
if (p == NULL) {
|
||||
fprintf(stderr, "aubinator: out of memory\n");
|
||||
mesa_loge("aubinator: out of memory");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
@ -301,8 +289,14 @@ string_to_type(struct parser_context *ctx, const char *s)
|
|||
return (struct v3d_type) { .kind = V3D_TYPE_ENUM, .v3d_enum = e };
|
||||
else if (strcmp(s, "mbo") == 0)
|
||||
return (struct v3d_type) { .kind = V3D_TYPE_MBO };
|
||||
else
|
||||
fail(&ctx->loc, "invalid type: %s", s);
|
||||
else {
|
||||
mesa_log_stream_printf(ctx->stream,
|
||||
"%s:%d: error: %s",
|
||||
ctx->loc.filename,
|
||||
ctx->loc.line_number,
|
||||
s);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
static struct v3d_field *
|
||||
|
|
@ -443,8 +437,13 @@ start_element(void *data, const char *element_name, const char **atts)
|
|||
goto skip;
|
||||
|
||||
if (strcmp(element_name, "vcxml") == 0) {
|
||||
if (ver == NULL)
|
||||
fail(&ctx->loc, "no ver given");
|
||||
if (ver == NULL) {
|
||||
mesa_log_stream_printf(ctx->stream,
|
||||
"%s:%d: error: no ver given",
|
||||
ctx->loc.filename,
|
||||
ctx->loc.line_number);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Make sure that we picked an XML that matched our version.
|
||||
*/
|
||||
|
|
@ -452,8 +451,14 @@ start_element(void *data, const char *element_name, const char **atts)
|
|||
|
||||
int major, minor;
|
||||
int n = sscanf(ver, "%d.%d", &major, &minor);
|
||||
if (n == 0)
|
||||
fail(&ctx->loc, "invalid ver given: %s", ver);
|
||||
if (n == 0) {
|
||||
mesa_log_stream_printf(ctx->stream,
|
||||
"%s:%d: error: invalid ver given: %s",
|
||||
ctx->loc.filename,
|
||||
ctx->loc.line_number,
|
||||
ver);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (n == 1)
|
||||
minor = 0;
|
||||
|
||||
|
|
@ -648,7 +653,7 @@ v3d_spec_load(const struct v3d_device_info *devinfo)
|
|||
}
|
||||
|
||||
if (text_length == 0) {
|
||||
fprintf(stderr, "unable to find gen (%u) data\n", devinfo->ver);
|
||||
mesa_loge("Unable to find gen (%u) data", devinfo->ver);
|
||||
free(spec);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -658,7 +663,7 @@ v3d_spec_load(const struct v3d_device_info *devinfo)
|
|||
ctx.devinfo = devinfo;
|
||||
XML_SetUserData(ctx.parser, &ctx);
|
||||
if (ctx.parser == NULL) {
|
||||
fprintf(stderr, "failed to create parser\n");
|
||||
mesa_loge("Failed to create parser");
|
||||
free(spec);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -678,12 +683,11 @@ v3d_spec_load(const struct v3d_device_info *devinfo)
|
|||
memcpy(buf, &text_data[text_offset], text_length);
|
||||
|
||||
if (XML_ParseBuffer(ctx.parser, text_length, true) == 0) {
|
||||
fprintf(stderr,
|
||||
"Error parsing XML at line %ld col %ld byte %ld/%u: %s\n",
|
||||
XML_GetCurrentLineNumber(ctx.parser),
|
||||
XML_GetCurrentColumnNumber(ctx.parser),
|
||||
XML_GetCurrentByteIndex(ctx.parser), text_length,
|
||||
XML_ErrorString(XML_GetErrorCode(ctx.parser)));
|
||||
mesa_loge("Error parsing XML at line %ld col %ld byte %ld/%u: %s",
|
||||
XML_GetCurrentLineNumber(ctx.parser),
|
||||
XML_GetCurrentColumnNumber(ctx.parser),
|
||||
XML_GetCurrentByteIndex(ctx.parser), text_length,
|
||||
XML_ErrorString(XML_GetErrorCode(ctx.parser)));
|
||||
XML_ParserFree(ctx.parser);
|
||||
free(text_data);
|
||||
free(spec);
|
||||
|
|
@ -978,11 +982,11 @@ v3d_print_group(struct clif_dump *clif, struct v3d_group *group,
|
|||
continue;
|
||||
|
||||
if (clif->pretty) {
|
||||
fprintf(clif->out, " %s: %s\n",
|
||||
iter.name, iter.value);
|
||||
mesa_log_stream_printf(clif->stream, " %s: %s\n",
|
||||
iter.name, iter.value);
|
||||
} else {
|
||||
fprintf(clif->out, " /* %30s: */ %s\n",
|
||||
iter.name, iter.value);
|
||||
mesa_log_stream_printf(clif->stream, " /* %30s: */ %s\n",
|
||||
iter.name, iter.value);
|
||||
}
|
||||
if (iter.struct_desc) {
|
||||
uint64_t struct_offset = offset + iter.offset;
|
||||
|
|
|
|||
|
|
@ -52,12 +52,12 @@ clif_dump_add_address_to_worklist(struct clif_dump *clif,
|
|||
|
||||
struct clif_dump *
|
||||
clif_dump_init(const struct v3d_device_info *devinfo,
|
||||
FILE *out, bool pretty, bool nobin)
|
||||
struct log_stream *stream, bool pretty, bool nobin)
|
||||
{
|
||||
struct clif_dump *clif = rzalloc(NULL, struct clif_dump);
|
||||
|
||||
clif->devinfo = devinfo;
|
||||
clif->out = out;
|
||||
clif->stream = stream;
|
||||
clif->spec = v3d_spec_load(devinfo);
|
||||
clif->pretty = pretty;
|
||||
clif->nobin = nobin;
|
||||
|
|
@ -124,8 +124,9 @@ clif_dump_cl(struct clif_dump *clif, uint32_t start, uint32_t end,
|
|||
{
|
||||
struct clif_bo *bo = clif_lookup_bo(clif, start);
|
||||
if (!bo) {
|
||||
out(clif, "Failed to look up address 0x%08x\n",
|
||||
start);
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"Failed to look up address 0x%08x\n",
|
||||
start);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -136,14 +137,17 @@ clif_dump_cl(struct clif_dump *clif, uint32_t start, uint32_t end,
|
|||
*/
|
||||
void *end_vaddr = NULL;
|
||||
if (end && !clif_lookup_vaddr(clif, end, &end_vaddr)) {
|
||||
out(clif, "Failed to look up address 0x%08x\n",
|
||||
end);
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"Failed to look up address 0x%08x\n",
|
||||
end);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!reloc_mode)
|
||||
out(clif, "@format ctrllist /* [%s+0x%08x] */\n",
|
||||
bo->name, start - bo->offset);
|
||||
if (!reloc_mode) {
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"@format ctrllist /* [%s+0x%08x] */\n",
|
||||
bo->name, start - bo->offset);
|
||||
}
|
||||
|
||||
uint32_t size;
|
||||
uint8_t *cl = start_vaddr;
|
||||
|
|
@ -179,18 +183,18 @@ clif_dump_gl_shader_state_record(struct clif_dump *clif,
|
|||
struct v3d_group *gs_state = v3d_spec_find_struct(clif->spec,
|
||||
"Geometry Shader State Record");
|
||||
assert(gs_state);
|
||||
out(clif, "@format shadrec_gl_geom\n");
|
||||
mesa_log_stream_printf(clif->stream, "@format shadrec_gl_geom\n");
|
||||
v3d_print_group(clif, gs_state, 0, vaddr + offset);
|
||||
offset += v3d_group_get_length(gs_state);
|
||||
/* Extra pad when geometry/tessellation shader is present */
|
||||
offset += 20;
|
||||
}
|
||||
out(clif, "@format shadrec_gl_main\n");
|
||||
mesa_log_stream_printf(clif->stream, "@format shadrec_gl_main\n");
|
||||
v3d_print_group(clif, state, 0, vaddr + offset);
|
||||
offset += v3d_group_get_length(state);
|
||||
|
||||
for (int i = 0; i < reloc->shader_state.num_attrs; i++) {
|
||||
out(clif, "@format shadrec_gl_attr /* %d */\n", i);
|
||||
mesa_log_stream_printf(clif->stream, "@format shadrec_gl_attr /* %d */\n", i);
|
||||
v3d_print_group(clif, attr, 0, vaddr + offset);
|
||||
offset += v3d_group_get_length(attr);
|
||||
}
|
||||
|
|
@ -205,8 +209,9 @@ clif_process_worklist(struct clif_dump *clif)
|
|||
&clif->worklist, link) {
|
||||
void *vaddr;
|
||||
if (!clif_lookup_vaddr(clif, reloc->addr, &vaddr)) {
|
||||
out(clif, "Failed to look up address 0x%08x\n",
|
||||
reloc->addr);
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"Failed to look up address 0x%08x\n",
|
||||
reloc->addr);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -242,9 +247,10 @@ clif_dump_if_blank(struct clif_dump *clif, struct clif_bo *bo,
|
|||
return false;
|
||||
}
|
||||
|
||||
out(clif, "\n");
|
||||
out(clif, "@format blank %d /* [%s+0x%08x..0x%08x] */\n", end - start,
|
||||
bo->name, start, end - 1);
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"\n@format blank %d /* [%s+0x%08x..0x%08x] */\n",
|
||||
end - start,
|
||||
bo->name, start, end - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -264,8 +270,9 @@ clif_dump_binary(struct clif_dump *clif, struct clif_bo *bo,
|
|||
if (clif_dump_if_blank(clif, bo, start, end))
|
||||
return;
|
||||
|
||||
out(clif, "@format binary /* [%s+0x%08x] */\n",
|
||||
bo->name, start);
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"@format binary /* [%s+0x%08x] */\n",
|
||||
bo->name, start);
|
||||
|
||||
uint32_t offset = start;
|
||||
int dumped_in_line = 0;
|
||||
|
|
@ -274,20 +281,22 @@ clif_dump_binary(struct clif_dump *clif, struct clif_bo *bo,
|
|||
return;
|
||||
|
||||
if (end - offset >= 4) {
|
||||
out(clif, "0x%08x ", *(uint32_t *)(bo->vaddr + offset));
|
||||
mesa_log_stream_printf(clif->stream, "0x%08x ",
|
||||
*(uint32_t *)(bo->vaddr + offset));
|
||||
offset += 4;
|
||||
} else {
|
||||
out(clif, "0x%02x ", *(uint8_t *)(bo->vaddr + offset));
|
||||
mesa_log_stream_printf(clif->stream, "0x%02x ",
|
||||
*(uint8_t *)(bo->vaddr + offset));
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (++dumped_in_line == 8) {
|
||||
out(clif, "\n");
|
||||
mesa_log_stream_printf(clif->stream, "\n");
|
||||
dumped_in_line = 0;
|
||||
}
|
||||
}
|
||||
if (dumped_in_line)
|
||||
out(clif, "\n");
|
||||
mesa_log_stream_printf(clif->stream, "\n");
|
||||
}
|
||||
|
||||
/* Walks the list of relocations, dumping each buffer's contents (using our
|
||||
|
|
@ -319,8 +328,9 @@ clif_dump_buffers(struct clif_dump *clif)
|
|||
struct clif_bo *new_bo = clif_lookup_bo(clif, reloc->addr);
|
||||
|
||||
if (!new_bo) {
|
||||
out(clif, "Failed to look up address 0x%08x\n",
|
||||
reloc->addr);
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"Failed to look up address 0x%08x\n",
|
||||
reloc->addr);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -332,8 +342,9 @@ clif_dump_buffers(struct clif_dump *clif)
|
|||
bo->size);
|
||||
}
|
||||
|
||||
out(clif, "\n");
|
||||
out(clif, "@buffer %s\n", new_bo->name);
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"\n@buffer %s\n",
|
||||
new_bo->name);
|
||||
bo = new_bo;
|
||||
offset = 0;
|
||||
bo->dumped = true;
|
||||
|
|
@ -348,7 +359,7 @@ clif_dump_buffers(struct clif_dump *clif)
|
|||
case reloc_cl:
|
||||
offset = clif_dump_cl(clif, reloc->addr, reloc->cl.end,
|
||||
false);
|
||||
out(clif, "\n");
|
||||
mesa_log_stream_printf(clif->stream, "\n");
|
||||
break;
|
||||
|
||||
case reloc_gl_shader_state:
|
||||
|
|
@ -365,7 +376,7 @@ clif_dump_buffers(struct clif_dump *clif)
|
|||
false);
|
||||
break;
|
||||
}
|
||||
out(clif, "\n");
|
||||
mesa_log_stream_printf(clif->stream, "\n");
|
||||
}
|
||||
|
||||
if (bo) {
|
||||
|
|
@ -377,9 +388,9 @@ clif_dump_buffers(struct clif_dump *clif)
|
|||
bo = &clif->bo[i];
|
||||
if (bo->dumped)
|
||||
continue;
|
||||
out(clif, "@buffer %s\n", bo->name);
|
||||
mesa_log_stream_printf(clif->stream, "@buffer %s\n", bo->name);
|
||||
clif_dump_binary(clif, bo, 0, bo->size);
|
||||
out(clif, "\n");
|
||||
mesa_log_stream_printf(clif->stream, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -411,7 +422,9 @@ clif_dump(struct clif_dump *clif, const struct drm_v3d_submit_cl *submit)
|
|||
* referencing it, so emit them all now.
|
||||
*/
|
||||
for (int i = 0; i < clif->bo_count; i++) {
|
||||
out(clif, "@createbuf_aligned 4096 %s\n", clif->bo[i].name);
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"@createbuf_aligned 4096 %s\n",
|
||||
clif->bo[i].name);
|
||||
}
|
||||
|
||||
/* Walk the worklist figuring out the locations of structs based on
|
||||
|
|
@ -424,25 +437,25 @@ clif_dump(struct clif_dump *clif, const struct drm_v3d_submit_cl *submit)
|
|||
*/
|
||||
clif_dump_buffers(clif);
|
||||
|
||||
out(clif, "@add_bin 0\n ");
|
||||
mesa_log_stream_printf(clif->stream, "@add_bin 0\n ");
|
||||
out_address(clif, submit->bcl_start);
|
||||
out(clif, "\n ");
|
||||
mesa_log_stream_printf(clif->stream, "\n ");
|
||||
out_address(clif, submit->bcl_end);
|
||||
out(clif, "\n ");
|
||||
mesa_log_stream_printf(clif->stream, "\n ");
|
||||
out_address(clif, submit->qma);
|
||||
out(clif, "\n %d\n ", submit->qms);
|
||||
mesa_log_stream_printf(clif->stream, "\n %d\n ", submit->qms);
|
||||
out_address(clif, submit->qts);
|
||||
out(clif, "\n");
|
||||
out(clif, "@wait_bin_all_cores\n");
|
||||
mesa_log_stream_printf(clif->stream, "\n");
|
||||
mesa_log_stream_printf(clif->stream, "@wait_bin_all_cores\n");
|
||||
|
||||
out(clif, "@add_render 0\n ");
|
||||
mesa_log_stream_printf(clif->stream, "@add_render 0\n ");
|
||||
out_address(clif, submit->rcl_start);
|
||||
out(clif, "\n ");
|
||||
mesa_log_stream_printf(clif->stream, "\n ");
|
||||
out_address(clif, submit->rcl_end);
|
||||
out(clif, "\n ");
|
||||
mesa_log_stream_printf(clif->stream, "\n ");
|
||||
out_address(clif, submit->qma);
|
||||
out(clif, "\n");
|
||||
out(clif, "@wait_render_all_cores\n");
|
||||
mesa_log_stream_printf(clif->stream, "\n");
|
||||
mesa_log_stream_printf(clif->stream, "@wait_render_all_cores\n");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -30,9 +30,10 @@
|
|||
struct v3d_device_info;
|
||||
struct clif_dump;
|
||||
struct drm_v3d_submit_cl;
|
||||
struct log_stream;
|
||||
|
||||
struct clif_dump *clif_dump_init(const struct v3d_device_info *devinfo,
|
||||
FILE *output, bool pretty, bool nobin);
|
||||
struct log_stream *stream, bool pretty, bool nobin);
|
||||
void clif_dump(struct clif_dump *clif, const struct drm_v3d_submit_cl *submit);
|
||||
void clif_dump_destroy(struct clif_dump *clif);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include "util/list.h"
|
||||
#include "util/log.h"
|
||||
|
||||
struct clif_bo {
|
||||
const char *name;
|
||||
|
|
@ -38,7 +39,7 @@ struct clif_bo {
|
|||
|
||||
struct clif_dump {
|
||||
const struct v3d_device_info *devinfo;
|
||||
FILE *out;
|
||||
struct log_stream *stream;
|
||||
|
||||
struct v3d_spec *spec;
|
||||
|
||||
|
|
@ -100,27 +101,19 @@ bool v3d42_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
|
|||
bool v3d71_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
|
||||
const uint8_t *cl, uint32_t *size, bool reloc_mode);
|
||||
|
||||
static inline void
|
||||
out(struct clif_dump *clif, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
vfprintf(clif->out, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
static inline void
|
||||
out_address(struct clif_dump *clif, uint32_t addr)
|
||||
{
|
||||
struct clif_bo *bo = clif_lookup_bo(clif, addr);
|
||||
if (bo) {
|
||||
out(clif, "[%s+0x%08x] /* 0x%08x */",
|
||||
bo->name, addr - bo->offset, addr);
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"[%s+0x%08x] /* 0x%08x */",
|
||||
bo->name, addr - bo->offset, addr);
|
||||
} else if (addr) {
|
||||
out(clif, "/* XXX: BO unknown */ 0x%08x", addr);
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"/* XXX: BO unknown */ 0x%08x", addr);
|
||||
} else {
|
||||
out(clif, "[null]");
|
||||
mesa_log_stream_printf(clif->stream, "[null]");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,9 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
|
|||
{
|
||||
struct v3d_group *inst = v3d_spec_find_instruction(clif->spec, cl);
|
||||
if (!inst) {
|
||||
out(clif, "0x%08x: Unknown packet %d!\n", offset, *cl);
|
||||
mesa_log_stream_printf(clif->stream,
|
||||
"0x%08x: Unknown packet %d!\n",
|
||||
offset, *cl);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +73,7 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
|
|||
|
||||
if (!reloc_mode) {
|
||||
char *name = clif_name(v3d_group_get_name(inst));
|
||||
out(clif, "%s\n", name);
|
||||
mesa_log_stream_printf(clif->stream, "%s\n", name);
|
||||
free(name);
|
||||
v3d_print_group(clif, inst, 0, cl);
|
||||
}
|
||||
|
|
@ -141,7 +143,7 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
|
|||
*size += v3d_group_get_length(spec);
|
||||
}
|
||||
if (!reloc_mode)
|
||||
out(clif, "@format ctrllist\n");
|
||||
mesa_log_stream_printf(clif->stream, "@format ctrllist\n");
|
||||
break;
|
||||
}
|
||||
#else /* V3D_VERSION < 40 */
|
||||
|
|
|
|||
|
|
@ -88,9 +88,6 @@ extern uint32_t v3d_mesa_debug;
|
|||
#ifndef ALOGW
|
||||
#define ALOGW LOGW
|
||||
#endif
|
||||
#define dbg_printf(...) ALOGW(__VA_ARGS__)
|
||||
#else
|
||||
#define dbg_printf(...) fprintf(stderr, __VA_ARGS__)
|
||||
#endif /* HAVE_ANDROID_PLATFORM */
|
||||
|
||||
extern bool v3d_debug_flag_for_shader_stage(mesa_shader_stage stage);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "common/v3d_device_info.h"
|
||||
#include "drm-uapi/v3d_drm.h"
|
||||
#include "util/log.h"
|
||||
#include "util/os_misc.h"
|
||||
|
||||
bool
|
||||
|
|
@ -51,14 +52,12 @@ v3d_get_device_info(int fd, struct v3d_device_info* devinfo, v3d_ioctl_fun drm_i
|
|||
|
||||
ret = drm_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &ident0);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Couldn't get V3D core IDENT0: %s\n",
|
||||
strerror(errno));
|
||||
mesa_loge("Couldn't get V3D core IDENT0: %s", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
ret = drm_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &ident1);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Couldn't get V3D core IDENT1: %s\n",
|
||||
strerror(errno));
|
||||
mesa_loge("Couldn't get V3D core IDENT1: %s", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -90,17 +89,14 @@ v3d_get_device_info(int fd, struct v3d_device_info* devinfo, v3d_ioctl_fun drm_i
|
|||
devinfo->cle_readahead = 1024u;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"V3D %d.%d not supported by this version of Mesa.\n",
|
||||
devinfo->ver / 10,
|
||||
devinfo->ver % 10);
|
||||
mesa_loge("V3D %d.%d not supported by this version of Mesa",
|
||||
devinfo->ver / 10, devinfo->ver % 10);
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = drm_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &hub_ident3);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Couldn't get V3D core HUB IDENT3: %s\n",
|
||||
strerror(errno));
|
||||
mesa_loge("Couldn't get V3D core HUB IDENT3: %s", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include "util/box.h"
|
||||
#include "util/log.h"
|
||||
#include "v3d_tiling.h"
|
||||
#include "broadcom/common/v3d_cpu_tiling.h"
|
||||
|
||||
|
|
@ -233,9 +234,9 @@ v3d_move_pixels_unaligned(void *gpu, uint32_t gpu_stride,
|
|||
box->y + y);
|
||||
|
||||
if (false) {
|
||||
fprintf(stderr, "%3d,%3d -> %d\n",
|
||||
box->x + x, box->y + y,
|
||||
pixel_offset);
|
||||
mesa_logd("%3d,%3d -> %d\n",
|
||||
box->x + x, box->y + y,
|
||||
pixel_offset);
|
||||
}
|
||||
|
||||
if (is_load) {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ resize_qreg_array(struct v3d_compile *c,
|
|||
*size = MAX2(*size * 2, decl_size);
|
||||
*regs = reralloc(c, *regs, struct qreg, *size);
|
||||
if (!*regs) {
|
||||
fprintf(stderr, "Malloc failure\n");
|
||||
mesa_loge("Malloc failure");
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ resize_interp_array(struct v3d_compile *c,
|
|||
*size = MAX2(*size * 2, decl_size);
|
||||
*regs = reralloc(c, *regs, struct v3d_interp_input, *size);
|
||||
if (!*regs) {
|
||||
fprintf(stderr, "Malloc failure\n");
|
||||
mesa_loge("Malloc failure");
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -1830,9 +1830,8 @@ ntq_emit_alu(struct v3d_compile *c, nir_alu_instr *instr)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "unknown NIR ALU inst: ");
|
||||
nir_print_instr(&instr->instr, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_loge("Unknown NIR ALU inst: %s",
|
||||
nir_instr_as_str(&instr->instr, NULL));
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -4137,9 +4136,8 @@ ntq_emit_intrinsic(struct v3d_compile *c, nir_intrinsic_instr *instr)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unknown intrinsic: ");
|
||||
nir_print_instr(&instr->instr, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_loge("Unknown intrinsic: %s",
|
||||
nir_instr_as_str(&instr->instr, NULL));
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -4505,9 +4503,8 @@ ntq_emit_instr(struct v3d_compile *c, nir_instr *instr)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unknown NIR instr type: ");
|
||||
nir_print_instr(instr, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_loge("Unknown NIR instr type: %s",
|
||||
nir_instr_as_str(instr, NULL));
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -4640,7 +4637,7 @@ ntq_emit_loop(struct v3d_compile *c, nir_loop *loop)
|
|||
static void
|
||||
ntq_emit_function(struct v3d_compile *c, nir_function_impl *func)
|
||||
{
|
||||
fprintf(stderr, "FUNCTIONS not handled.\n");
|
||||
mesa_loge("FUNCTIONS not handled.");
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -4666,7 +4663,7 @@ ntq_emit_cf_list(struct v3d_compile *c, struct exec_list *list)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unknown NIR node type\n");
|
||||
mesa_loge("Unknown NIR node type");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -4974,10 +4971,10 @@ v3d_nir_to_vir(struct v3d_compile *c)
|
|||
{
|
||||
if (V3D_DBG(NIR) ||
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage)) {
|
||||
fprintf(stderr, "%s prog %d/%d NIR:\n",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
nir_print_shader(c->s, stderr);
|
||||
mesa_logi("%s prog %d/%d NIR:",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
nir_log_shaderi(c->s);
|
||||
}
|
||||
|
||||
nir_to_vir(c);
|
||||
|
|
@ -5009,11 +5006,10 @@ v3d_nir_to_vir(struct v3d_compile *c)
|
|||
|
||||
if (V3D_DBG(VIR) ||
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage)) {
|
||||
fprintf(stderr, "%s prog %d/%d pre-opt VIR:\n",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
vir_dump(c);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi("%s prog %d/%d pre-opt VIR:",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
vir_dumpi(c);
|
||||
}
|
||||
|
||||
vir_optimize(c);
|
||||
|
|
@ -5032,11 +5028,10 @@ v3d_nir_to_vir(struct v3d_compile *c)
|
|||
|
||||
if (V3D_DBG(VIR) ||
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage)) {
|
||||
fprintf(stderr, "%s prog %d/%d VIR:\n",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
vir_dump(c);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi("%s prog %d/%d VIR:",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
vir_dumpi(c);
|
||||
}
|
||||
|
||||
/* Attempt to allocate registers for the temporaries. If we fail,
|
||||
|
|
@ -5053,19 +5048,18 @@ v3d_nir_to_vir(struct v3d_compile *c)
|
|||
|
||||
if (c->threads <= MAX2(c->min_threads_for_reg_alloc, min_threads)) {
|
||||
if (V3D_DBG(PERF) || V3D_DBG(RA)) {
|
||||
fprintf(stderr,
|
||||
"Failed to register allocate %s "
|
||||
"prog %d/%d at %d threads.\n",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id, c->threads);
|
||||
mesa_logi("Failed to register allocate %s "
|
||||
"prog %d/%d at %d threads.",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id, c->threads);
|
||||
}
|
||||
if (V3D_DBG(RA)) {
|
||||
vir_dump(c);
|
||||
vir_dumpi(c);
|
||||
|
||||
char *shaderdb;
|
||||
int ret = v3d_shaderdb_dump(c, &shaderdb);
|
||||
if (ret > 0) {
|
||||
fprintf(stderr, "%s\n", shaderdb);
|
||||
mesa_logi("%s", shaderdb);
|
||||
free(shaderdb);
|
||||
}
|
||||
|
||||
|
|
@ -5092,11 +5086,10 @@ v3d_nir_to_vir(struct v3d_compile *c)
|
|||
if (c->spills &&
|
||||
(V3D_DBG(VIR) ||
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage))) {
|
||||
fprintf(stderr, "%s prog %d/%d spilled VIR:\n",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
vir_dump(c);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi("%s prog %d/%d spilled VIR:",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
vir_dumpi(c);
|
||||
}
|
||||
|
||||
v3d_vir_to_qpu(c, temp_registers);
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ process_waddr_deps(struct schedule_state *state, struct schedule_node *n,
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unknown waddr %d\n", waddr);
|
||||
mesa_loge("Unknown waddr %d", waddr);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -1779,9 +1779,9 @@ static void
|
|||
dump_state(const struct v3d_device_info *devinfo, struct dag *dag)
|
||||
{
|
||||
list_for_each_entry(struct schedule_node, n, &dag->heads, dag.link) {
|
||||
fprintf(stderr, " t=%4d: ", n->unblocked_time);
|
||||
v3d_qpu_dump(devinfo, &n->inst->qpu);
|
||||
fprintf(stderr, "\n");
|
||||
const char *str = v3d_qpu_decode(devinfo, &n->inst->qpu);
|
||||
mesa_logd(" t=%4d: %s", n->unblocked_time, str);
|
||||
ralloc_free((void *)str);
|
||||
|
||||
util_dynarray_foreach(&n->dag.edges, struct dag_edge, edge) {
|
||||
struct schedule_node *child =
|
||||
|
|
@ -1789,11 +1789,12 @@ dump_state(const struct v3d_device_info *devinfo, struct dag *dag)
|
|||
if (!child)
|
||||
continue;
|
||||
|
||||
fprintf(stderr, " - ");
|
||||
v3d_qpu_dump(devinfo, &child->inst->qpu);
|
||||
fprintf(stderr, " (%d parents, %c)\n",
|
||||
child->dag.parent_count,
|
||||
edge->data ? 'w' : 'r');
|
||||
const char *str = v3d_qpu_decode(devinfo, &child->inst->qpu);
|
||||
mesa_logd(" - %s (%d parents, %c)",
|
||||
str,
|
||||
child->dag.parent_count,
|
||||
edge->data ? 'w' : 'r');
|
||||
ralloc_free((void *)str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2734,12 +2735,12 @@ schedule_instructions(struct v3d_compile *c,
|
|||
struct v3d_qpu_instr *inst = &qinst->qpu;
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "t=%4d: current list:\n",
|
||||
time);
|
||||
mesa_logd("t=%4d: current list:",
|
||||
time);
|
||||
dump_state(devinfo, scoreboard->dag);
|
||||
fprintf(stderr, "t=%4d: chose: ", time);
|
||||
v3d_qpu_dump(devinfo, inst);
|
||||
fprintf(stderr, "\n");
|
||||
const char *str = v3d_qpu_decode(devinfo, inst);
|
||||
mesa_logd("t=%4d: chose: %s", time, str);
|
||||
ralloc_free((void *)str);
|
||||
}
|
||||
|
||||
/* We can't mark_instruction_scheduled() the chosen inst until
|
||||
|
|
@ -2773,13 +2774,14 @@ schedule_instructions(struct v3d_compile *c,
|
|||
merge->inst->ldtmu_count;
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "t=%4d: merging: ",
|
||||
time);
|
||||
v3d_qpu_dump(devinfo, &merge->inst->qpu);
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, " result: ");
|
||||
v3d_qpu_dump(devinfo, inst);
|
||||
fprintf(stderr, "\n");
|
||||
const char *strmerge = v3d_qpu_decode(devinfo, &merge->inst->qpu);
|
||||
const char *strinst = v3d_qpu_decode(devinfo, inst);
|
||||
mesa_logd("t=%4d: merging \"%s\" result to \"%s\"",
|
||||
time,
|
||||
strmerge,
|
||||
strinst);
|
||||
ralloc_free((void *)strmerge);
|
||||
ralloc_free((void *)strinst);
|
||||
}
|
||||
|
||||
if (scoreboard->fixup_ldvary) {
|
||||
|
|
@ -2818,7 +2820,7 @@ schedule_instructions(struct v3d_compile *c,
|
|||
}
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logd("\n");
|
||||
}
|
||||
|
||||
/* Now that we've scheduled a new instruction, some of its
|
||||
|
|
@ -3025,16 +3027,16 @@ v3d_qpu_schedule_instructions(struct v3d_compile *c)
|
|||
scoreboard.last_implicit_rf0_write_tick = - 10;
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "Pre-schedule instructions\n");
|
||||
mesa_logd("Pre-schedule instructions");
|
||||
vir_for_each_block(block, c) {
|
||||
fprintf(stderr, "BLOCK %d\n", block->index);
|
||||
mesa_logd("BLOCK %d\n", block->index);
|
||||
list_for_each_entry(struct qinst, qinst,
|
||||
&block->instructions, link) {
|
||||
v3d_qpu_dump(devinfo, &qinst->qpu);
|
||||
fprintf(stderr, "\n");
|
||||
const char *str = v3d_qpu_decode(devinfo, &qinst->qpu);
|
||||
mesa_logd("%s", str);
|
||||
ralloc_free((void *)str);
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
uint32_t cycles = 0;
|
||||
|
|
|
|||
|
|
@ -62,19 +62,17 @@ fail_instr(struct v3d_qpu_validate_state *state, const char *msg)
|
|||
{
|
||||
struct v3d_compile *c = state->c;
|
||||
|
||||
fprintf(stderr, "v3d_qpu_validate at ip %d: %s:\n", state->ip, msg);
|
||||
mesa_loge("v3d_qpu_validate at ip %d: %s:\n", state->ip, msg);
|
||||
|
||||
int dump_ip = 0;
|
||||
vir_for_each_inst_inorder(inst, c) {
|
||||
v3d_qpu_dump(c->devinfo, &inst->qpu);
|
||||
|
||||
if (dump_ip++ == state->ip)
|
||||
fprintf(stderr, " *** ERROR ***");
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
const char *str = v3d_qpu_decode(c->devinfo, &inst->qpu);
|
||||
mesa_loge("%s%s",
|
||||
str,
|
||||
dump_ip++ == state->ip ? " *** ERROR ***" : "");
|
||||
ralloc_free((void *)str);
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1204,7 +1204,8 @@ void ntq_add_pending_tmu_flush(struct v3d_compile *c, nir_def *def,
|
|||
void ntq_flush_tmu(struct v3d_compile *c);
|
||||
void vir_emit_thrsw(struct v3d_compile *c);
|
||||
|
||||
void vir_dump(struct v3d_compile *c);
|
||||
void vir_dumpi(struct v3d_compile *c);
|
||||
void vir_dumpe(struct v3d_compile *c);
|
||||
char *vir_dump_inst(struct v3d_compile *c, struct qinst *inst);
|
||||
char *vir_dump_uniform(enum quniform_contents contents, uint32_t data);
|
||||
|
||||
|
|
@ -1636,4 +1637,13 @@ v3d_double_buffer_score_ok(struct v3d_double_buffer_score *score)
|
|||
vir_for_each_block(_block, c) \
|
||||
vir_for_each_inst_safe(inst, _block)
|
||||
|
||||
#define LOG_INST_OPT(_message, _c, _inst) \
|
||||
for (char *before_inst = debug ? vir_dump_inst(_c, _inst) : NULL, \
|
||||
*_once = (char *)1; \
|
||||
_once; \
|
||||
_once = debug ? (mesa_logd(_message ": \"%s\" to \"%s\"", \
|
||||
before_inst, \
|
||||
vir_dump_inst(_c, _inst)), NULL) \
|
||||
: NULL)
|
||||
|
||||
#endif /* V3D_COMPILER_H */
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ v3d_logicop(nir_builder *b, int logicop_func,
|
|||
case PIPE_LOGICOP_SET:
|
||||
return nir_imm_int(b, ~0);
|
||||
default:
|
||||
fprintf(stderr, "Unknown logic op %d\n", logicop_func);
|
||||
mesa_loge("Unknown logic op %d", logicop_func);
|
||||
FALLTHROUGH;
|
||||
case PIPE_LOGICOP_COPY:
|
||||
return src;
|
||||
|
|
@ -102,7 +102,7 @@ v3d_nir_get_swizzled_channel(nir_builder *b, nir_def **srcs, int swiz)
|
|||
switch (swiz) {
|
||||
default:
|
||||
case PIPE_SWIZZLE_NONE:
|
||||
fprintf(stderr, "warning: unknown swizzle\n");
|
||||
mesa_loge("Unknown swizzle");
|
||||
FALLTHROUGH;
|
||||
case PIPE_SWIZZLE_0:
|
||||
return nir_imm_float(b, 0.0);
|
||||
|
|
|
|||
|
|
@ -2216,7 +2216,7 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler,
|
|||
|
||||
if (ret >= 0) {
|
||||
if (V3D_DBG(PERF))
|
||||
fprintf(stderr, "%s\n", debug_msg);
|
||||
mesa_logi("%s", debug_msg);
|
||||
|
||||
c->debug_output(debug_msg, c->debug_output_data);
|
||||
free(debug_msg);
|
||||
|
|
@ -2267,7 +2267,7 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler,
|
|||
c->program_id, c->variant_id,
|
||||
c->spills, c->fills);
|
||||
if (ret >= 0) {
|
||||
fprintf(stderr, "%s\n", debug_msg);
|
||||
mesa_logi("%s", debug_msg);
|
||||
c->debug_output(debug_msg, c->debug_output_data);
|
||||
free(debug_msg);
|
||||
}
|
||||
|
|
@ -2297,7 +2297,7 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler,
|
|||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id,
|
||||
c->spills, c->fills);
|
||||
fprintf(stderr, "%s\n", debug_msg);
|
||||
mesa_logi("%s", debug_msg);
|
||||
|
||||
if (ret >= 0) {
|
||||
c->debug_output(debug_msg, c->debug_output_data);
|
||||
|
|
@ -2306,9 +2306,8 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler,
|
|||
}
|
||||
|
||||
if (c->compilation_result != V3D_COMPILATION_SUCCEEDED) {
|
||||
fprintf(stderr, "Failed to compile %s prog %d/%d "
|
||||
"with any strategy.\n",
|
||||
vir_get_stage_name(c), c->program_id, c->variant_id);
|
||||
mesa_loge("Failed to compile %s prog %d/%d with any strategy",
|
||||
vir_get_stage_name(c), c->program_id, c->variant_id);
|
||||
|
||||
vir_compile_destroy(c);
|
||||
return NULL;
|
||||
|
|
@ -2326,7 +2325,7 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler,
|
|||
int ret = v3d_shaderdb_dump(c, &shaderdb);
|
||||
if (ret >= 0) {
|
||||
if (V3D_DBG(SHADERDB))
|
||||
fprintf(stderr, "SHADER-DB-%s - %s\n", s->info.name, shaderdb);
|
||||
mesa_logi("SHADER-DB-%s - %s", s->info.name, shaderdb);
|
||||
|
||||
c->debug_output(shaderdb, c->debug_output_data);
|
||||
free(shaderdb);
|
||||
|
|
@ -2514,9 +2513,8 @@ vir_uniform(struct v3d_compile *c,
|
|||
if (stage_progress) { \
|
||||
progress = true; \
|
||||
if (print_opt_debug) { \
|
||||
fprintf(stderr, \
|
||||
"VIR opt pass %2d: %s progress\n", \
|
||||
pass, #func); \
|
||||
mesa_logd("VIR opt pass %2d: %s progress\n", \
|
||||
pass, #func); \
|
||||
} \
|
||||
/*XXX vir_validate(c);*/ \
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -382,14 +382,14 @@ vir_dump_inst(struct v3d_compile *c, struct qinst *inst)
|
|||
return dump_inst;
|
||||
}
|
||||
|
||||
void
|
||||
vir_dump(struct v3d_compile *c)
|
||||
static void
|
||||
vir_dump(struct log_stream *stream, struct v3d_compile *c)
|
||||
{
|
||||
int ip = 0;
|
||||
int pressure = 0;
|
||||
|
||||
vir_for_each_block(block, c) {
|
||||
fprintf(stderr, "BLOCK %d:\n", block->index);
|
||||
mesa_log_stream_printf(stream, "BLOCK %d:\n", block->index);
|
||||
vir_for_each_inst(inst, block) {
|
||||
if (c->live_intervals_valid) {
|
||||
for (int i = 0; i < c->num_temps; i++) {
|
||||
|
|
@ -397,7 +397,7 @@ vir_dump(struct v3d_compile *c)
|
|||
pressure++;
|
||||
}
|
||||
|
||||
fprintf(stderr, "P%4d ", pressure);
|
||||
mesa_log_stream_printf(stream, "P%4d ", pressure);
|
||||
|
||||
bool first = true;
|
||||
|
||||
|
|
@ -408,18 +408,18 @@ vir_dump(struct v3d_compile *c)
|
|||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
fprintf(stderr, ", ");
|
||||
mesa_log_stream_printf(stream, ", ");
|
||||
}
|
||||
if (BITSET_TEST(c->spillable, i))
|
||||
fprintf(stderr, "S%4d", i);
|
||||
mesa_log_stream_printf(stream, "S%4d", i);
|
||||
else
|
||||
fprintf(stderr, "U%4d", i);
|
||||
mesa_log_stream_printf(stream, "U%4d", i);
|
||||
}
|
||||
|
||||
if (first)
|
||||
fprintf(stderr, " ");
|
||||
mesa_log_stream_printf(stream, " ");
|
||||
else
|
||||
fprintf(stderr, " ");
|
||||
mesa_log_stream_printf(stream, " ");
|
||||
}
|
||||
|
||||
if (c->live_intervals_valid) {
|
||||
|
|
@ -432,29 +432,46 @@ vir_dump(struct v3d_compile *c)
|
|||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
fprintf(stderr, ", ");
|
||||
mesa_log_stream_printf(stream, ", ");
|
||||
}
|
||||
fprintf(stderr, "E%4d", i);
|
||||
mesa_log_stream_printf(stream, "E%4d", i);
|
||||
pressure--;
|
||||
}
|
||||
|
||||
if (first)
|
||||
fprintf(stderr, " ");
|
||||
mesa_log_stream_printf(stream, " ");
|
||||
else
|
||||
fprintf(stderr, " ");
|
||||
mesa_log_stream_printf(stream, " ");
|
||||
}
|
||||
|
||||
char *dump_inst = vir_dump_inst(c, inst);
|
||||
fprintf(stderr, "%s\n", dump_inst);
|
||||
mesa_log_stream_printf(stream, "%s\n", dump_inst);
|
||||
ip++;
|
||||
}
|
||||
if (block->successors[1]) {
|
||||
fprintf(stderr, "-> BLOCK %d, %d\n",
|
||||
block->successors[0]->index,
|
||||
block->successors[1]->index);
|
||||
mesa_log_stream_printf(stream, "-> BLOCK %d, %d\n",
|
||||
block->successors[0]->index,
|
||||
block->successors[1]->index);
|
||||
} else if (block->successors[0]) {
|
||||
fprintf(stderr, "-> BLOCK %d\n",
|
||||
block->successors[0]->index);
|
||||
mesa_log_stream_printf(stream, "-> BLOCK %d\n",
|
||||
block->successors[0]->index);
|
||||
}
|
||||
}
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
vir_dumpi(struct v3d_compile *c)
|
||||
{
|
||||
struct log_stream *stream = mesa_log_streami();
|
||||
vir_dump(stream, c);
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
||||
void
|
||||
vir_dumpe(struct v3d_compile *c)
|
||||
{
|
||||
struct log_stream *stream = mesa_log_streame();
|
||||
vir_dump(stream, c);
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,23 +218,14 @@ try_copy_prop(struct v3d_compile *c, struct qinst *inst, struct qinst **movs)
|
|||
}
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
char *dump_inst = vir_dump_inst(c, inst);
|
||||
fprintf(stderr, "Copy propagate: %s\n", dump_inst);
|
||||
LOG_INST_OPT("Copy propagate", c, inst) {
|
||||
inst->src[i] = mov->src[0];
|
||||
if (vir_has_unpack(mov, 0)) {
|
||||
enum v3d_qpu_input_unpack unpack = mov->qpu.alu.mul.a.unpack;
|
||||
|
||||
vir_set_unpack(inst, i, unpack);
|
||||
}
|
||||
}
|
||||
|
||||
inst->src[i] = mov->src[0];
|
||||
if (vir_has_unpack(mov, 0)) {
|
||||
enum v3d_qpu_input_unpack unpack = mov->qpu.alu.mul.a.unpack;
|
||||
|
||||
vir_set_unpack(inst, i, unpack);
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
char *dump_inst = vir_dump_inst(c, inst);
|
||||
fprintf(stderr, "to: %s\n", dump_inst);
|
||||
}
|
||||
|
||||
progress = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ dce(struct v3d_compile *c, struct qinst *inst)
|
|||
{
|
||||
if (debug) {
|
||||
char *dump_inst = vir_dump_inst(c, inst);
|
||||
fprintf(stderr, "Removing: %s\n", dump_inst);
|
||||
mesa_logd("Removing: \"%s\"", dump_inst);
|
||||
}
|
||||
assert(!v3d_qpu_writes_flags(&inst->qpu));
|
||||
vir_remove_instruction(c, inst);
|
||||
|
|
@ -65,9 +65,7 @@ vir_dce_flags(struct v3d_compile *c, struct qinst *inst)
|
|||
{
|
||||
if (debug) {
|
||||
char *dump_inst = vir_dump_inst(c, inst);
|
||||
fprintf(stderr,
|
||||
"Removing flags write from: %s\n",
|
||||
dump_inst);
|
||||
mesa_logd("Removing flags write from: \"%s\"", dump_inst);
|
||||
}
|
||||
|
||||
assert(inst->qpu.type == V3D_QPU_INSTR_TYPE_ALU);
|
||||
|
|
@ -248,9 +246,7 @@ vir_opt_dead_code(struct v3d_compile *c)
|
|||
can_write_to_null(c, inst)) {
|
||||
if (debug) {
|
||||
char *dump_inst = vir_dump_inst(c, inst);
|
||||
fprintf(stderr,
|
||||
"Removing dst from: %s\n",
|
||||
dump_inst);
|
||||
mesa_logd("Removing dst from: \"%s\"", dump_inst);
|
||||
}
|
||||
c->defs[inst->dst.index] = NULL;
|
||||
inst->dst.file = QFILE_NULL;
|
||||
|
|
|
|||
|
|
@ -37,9 +37,8 @@ vir_dce_pf(struct v3d_compile *c, struct qinst *inst)
|
|||
{
|
||||
if (debug) {
|
||||
char *dump_inst = vir_dump_inst(c, inst);
|
||||
fprintf(stderr,
|
||||
"Removing flags write from: %s\n",
|
||||
dump_inst);
|
||||
mesa_logd("Removing flags write from: \"%s\"",
|
||||
dump_inst);
|
||||
}
|
||||
|
||||
assert(inst->qpu.type == V3D_QPU_INSTR_TYPE_ALU);
|
||||
|
|
|
|||
|
|
@ -115,24 +115,15 @@ vir_opt_small_immediates(struct v3d_compile *c)
|
|||
if (!v3d_qpu_sig_pack(c->devinfo, &new_sig, &sig_packed))
|
||||
continue;
|
||||
|
||||
if (debug) {
|
||||
char *dump_inst = vir_dump_inst(c, inst);
|
||||
fprintf(stderr, "opt_small_immediate() from: %s\n",
|
||||
dump_inst);
|
||||
ralloc_free(dump_inst);
|
||||
}
|
||||
inst->qpu.sig.small_imm_a = new_sig.small_imm_a;
|
||||
inst->qpu.sig.small_imm_b = new_sig.small_imm_b;
|
||||
inst->qpu.sig.small_imm_c = new_sig.small_imm_c;
|
||||
inst->qpu.sig.small_imm_d = new_sig.small_imm_d;
|
||||
inst->qpu.raddr_b = packed;
|
||||
LOG_INST_OPT("opt_small_immediate()", c, inst) {
|
||||
inst->qpu.sig.small_imm_a = new_sig.small_imm_a;
|
||||
inst->qpu.sig.small_imm_b = new_sig.small_imm_b;
|
||||
inst->qpu.sig.small_imm_c = new_sig.small_imm_c;
|
||||
inst->qpu.sig.small_imm_d = new_sig.small_imm_d;
|
||||
inst->qpu.raddr_b = packed;
|
||||
|
||||
inst->src[i].file = QFILE_SMALL_IMM;
|
||||
inst->src[i].index = imm;
|
||||
if (debug) {
|
||||
char *dump_inst = vir_dump_inst(c, inst);
|
||||
fprintf(stderr, "to: %s\n", dump_inst);
|
||||
ralloc_free(dump_inst);
|
||||
inst->src[i].file = QFILE_SMALL_IMM;
|
||||
inst->src[i].index = imm;
|
||||
}
|
||||
progress = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ v3d_generate_code_block(struct v3d_compile *c,
|
|||
vir_for_each_inst_safe(qinst, block) {
|
||||
#if 0
|
||||
char *dump_inst = vir_dump_inst(c, qinst);
|
||||
fprintf(stderr, "translating qinst to qpu: %s\n");
|
||||
mesa_logi("Translating qinst to qpu: %s\n");
|
||||
#endif
|
||||
|
||||
if (vir_has_uniform(qinst))
|
||||
|
|
@ -437,30 +437,33 @@ reads_uniform(const struct v3d_device_info *devinfo, uint64_t instruction)
|
|||
static void
|
||||
v3d_dump_qpu(struct v3d_compile *c)
|
||||
{
|
||||
fprintf(stderr, "%s prog %d/%d QPU:\n",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
struct log_stream *stream = mesa_log_streami();
|
||||
|
||||
mesa_log_stream_printf(stream, "%s prog %d/%d QPU:\n",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
|
||||
int next_uniform = 0;
|
||||
for (int i = 0; i < c->qpu_inst_count; i++) {
|
||||
const char *str = v3d_qpu_disasm(c->devinfo, c->qpu_insts[i]);
|
||||
fprintf(stderr, "0x%016"PRIx64" %s", c->qpu_insts[i], str);
|
||||
mesa_log_stream_printf(stream, "0x%016"PRIx64" %s", c->qpu_insts[i], str);
|
||||
|
||||
if (reads_uniform(c->devinfo, c->qpu_insts[i])) {
|
||||
char *str = vir_dump_uniform(c->uniform_contents[next_uniform],
|
||||
c->uniform_data[next_uniform]);
|
||||
fprintf(stderr, " (%s)", str);
|
||||
mesa_log_stream_printf(stream, " (%s)", str);
|
||||
ralloc_free(str);
|
||||
next_uniform++;
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
ralloc_free((void *)str);
|
||||
}
|
||||
|
||||
/* Make sure our dumping lined up. */
|
||||
assert(next_uniform == c->num_uniforms);
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -483,8 +486,8 @@ v3d_vir_to_qpu(struct v3d_compile *c, struct qpu_reg *temp_registers)
|
|||
&c->qpu_insts[i++]);
|
||||
if (!ok) {
|
||||
char *dump_inst = vir_dump_inst(c, inst);
|
||||
fprintf(stderr, "Failed to pack instruction %d:\n%s\n", i,
|
||||
dump_inst);
|
||||
mesa_loge("Failed to pack instruction %d: %s", i,
|
||||
dump_inst);
|
||||
c->compilation_result = V3D_COMPILATION_FAILED;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include "drm-uapi/v3d_drm.h"
|
||||
#include "drm-shim/drm_shim.h"
|
||||
#include "util/log.h"
|
||||
|
||||
bool drm_shim_driver_prefers_first_render_node = true;
|
||||
|
||||
|
|
@ -143,7 +144,7 @@ v3d_ioctl_get_param(int fd, unsigned long request, void *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Unknown DRM_IOCTL_V3D_GET_PARAM %d\n", gp->param);
|
||||
mesa_loge("Unknown DRM_IOCTL_V3D_GET_PARAM %d", gp->param);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <assert.h>
|
||||
#include "common/v3d_device_info.h"
|
||||
#include "common/v3d_util.h"
|
||||
#include "util/log.h"
|
||||
#include "util/ralloc.h"
|
||||
#include "v3d_perfcntrs.h"
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ v3d_perfcntrs_init(const struct v3d_device_info *devinfo, int fd)
|
|||
|
||||
perfcounters->perfcnt = rzalloc_array(perfcounters, struct v3d_perfcntr_desc *, perfcounters->max_perfcnt);
|
||||
if (!perfcounters->perfcnt) {
|
||||
fprintf(stderr, "Error allocating performance counters names");
|
||||
mesa_loge("Error allocating performance counters names");
|
||||
v3d_perfcntrs_fini(perfcounters);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,12 +409,3 @@ v3d_qpu_disasm(const struct v3d_device_info *devinfo, uint64_t inst)
|
|||
|
||||
return v3d_qpu_decode(devinfo, &instr);
|
||||
}
|
||||
|
||||
void
|
||||
v3d_qpu_dump(const struct v3d_device_info *devinfo,
|
||||
const struct v3d_qpu_instr *instr)
|
||||
{
|
||||
const char *decoded = v3d_qpu_decode(devinfo, instr);
|
||||
fprintf(stderr, "%s", decoded);
|
||||
ralloc_free((char *)decoded);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,4 @@ const char *v3d_qpu_decode(const struct v3d_device_info *devinfo, const
|
|||
|
||||
const char *v3d_qpu_disasm(const struct v3d_device_info *devinfo, uint64_t inst);
|
||||
|
||||
void v3d_qpu_dump(const struct v3d_device_info *devinfo, const
|
||||
struct v3d_qpu_instr *instr);
|
||||
|
||||
#endif /* QPU_DISASM_H */
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
#include "util/u_dynarray.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_mm.h"
|
||||
#include "util/log.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include <xf86drm.h>
|
||||
|
|
@ -301,7 +302,7 @@ v3d_create_simulator_bo_for_gem(int fd, int handle, unsigned size)
|
|||
}
|
||||
}
|
||||
if (ret) {
|
||||
fprintf(stderr, "Failed to get MMAP offset: %d\n", ret);
|
||||
mesa_loge("Failed to get MMAP offset: %d", ret);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -309,8 +310,8 @@ v3d_create_simulator_bo_for_gem(int fd, int handle, unsigned size)
|
|||
PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||
fd, sim_bo->mmap_offset);
|
||||
if (sim_bo->gem_vaddr == MAP_FAILED) {
|
||||
fprintf(stderr, "mmap of bo %d (offset 0x%016llx, size %d) failed\n",
|
||||
handle, (long long)sim_bo->mmap_offset, sim_bo->size);
|
||||
mesa_loge("mmap of bo %d (offset 0x%016llx, size %d) failed",
|
||||
handle, (long long)sim_bo->mmap_offset, sim_bo->size);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -398,8 +399,7 @@ v3d_simulator_copy_out_handle(struct v3d_simulator_file *file, int handle)
|
|||
uint32_t sentinel;
|
||||
v3d_hw_read_mem(sim_state.v3d, &sentinel, sim_bo->sim_addr + sim_bo->size, sizeof(sentinel));
|
||||
if (sentinel != BO_SENTINEL) {
|
||||
fprintf(stderr, "Buffer overflow in handle %d\n",
|
||||
handle);
|
||||
mesa_loge("Buffer overflow in handle %d", handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -994,7 +994,7 @@ v3d_simulator_submit_cpu_ioctl(int fd, struct drm_v3d_submit_cpu *args)
|
|||
v3d_copy_performance_query(fd, ext, args);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown CPU job 0x%08x\n", (int)ext->id);
|
||||
mesa_loge("Unknown CPU job 0x%08x", (int)ext->id);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1143,7 +1143,7 @@ v3d_simulator_ioctl(int fd, unsigned long request, void *args)
|
|||
case DRM_IOCTL_GEM_FLINK:
|
||||
return drmIoctl(fd, request, args);
|
||||
default:
|
||||
fprintf(stderr, "Unknown ioctl 0x%08x\n", (int)request);
|
||||
mesa_loge("Unknown ioctl 0x%08x", (int)request);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "common/v3d_performance_counters.h"
|
||||
|
||||
#include "util/log.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/bitscan.h"
|
||||
#include "drm-uapi/v3d_drm.h"
|
||||
|
|
@ -301,8 +302,7 @@ v3dX(simulator_get_param_ioctl)(struct v3d_hw *v3d,
|
|||
return 0;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Unknown DRM_IOCTL_V3D_GET_PARAM(%lld)\n",
|
||||
(long long)args->value);
|
||||
mesa_loge("Unknown DRM_IOCTL_V3D_GET_PARAM(%lld)", (long long)args->value);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -358,12 +358,9 @@ v3d_isr_core(struct v3d_hw *v3d,
|
|||
|
||||
#if V3D_VERSION <= 42
|
||||
if (core_status & V3D_CTL_0_INT_STS_INT_GMPV_SET) {
|
||||
fprintf(stderr, "GMP violation at 0x%08x\n",
|
||||
V3D_READ(V3D_GMP_VIO_ADDR));
|
||||
mesa_loge("GMP violation at 0x%08x", V3D_READ(V3D_GMP_VIO_ADDR));
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"Unexpected ISR with core status 0x%08x\n",
|
||||
core_status);
|
||||
mesa_loge("Unexpected ISR with core status 0x%08x", core_status);
|
||||
}
|
||||
abort();
|
||||
#endif
|
||||
|
|
@ -415,11 +412,11 @@ handle_mmu_interruptions(struct v3d_hw *v3d,
|
|||
* like restoring the MMU ctrl bits
|
||||
*/
|
||||
|
||||
fprintf(stderr, "MMU error from client %s (%d) at 0x%llx%s%s%s\n",
|
||||
client, axi_id, (long long) vio_addr,
|
||||
wrv ? ", write violation" : "",
|
||||
pti ? ", pte invalid" : "",
|
||||
cap ? ", cap exceeded" : "");
|
||||
mesa_loge("MMU error from client %s (%d) at 0x%llx%s%s%s",
|
||||
client, axi_id, (long long) vio_addr,
|
||||
wrv ? ", write violation" : "",
|
||||
pti ? ", pte invalid" : "",
|
||||
cap ? ", cap exceeded" : "");
|
||||
|
||||
abort();
|
||||
}
|
||||
|
|
@ -445,12 +442,9 @@ v3d_isr_hub(struct v3d_hw *v3d)
|
|||
|
||||
#if V3D_VERSION == 71
|
||||
if (hub_status & V3D_HUB_CTL_INT_STS_INT_GMPV_SET) {
|
||||
fprintf(stderr, "GMP violation at 0x%08x\n",
|
||||
V3D_READ(V3D_GMP_VIO_ADDR));
|
||||
mesa_loge("GMP violation at 0x%08x", V3D_READ(V3D_GMP_VIO_ADDR));
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"Unexpected ISR with status 0x%08x\n",
|
||||
hub_status);
|
||||
mesa_loge("Unexpected ISR with status 0x%08x", hub_status);
|
||||
}
|
||||
abort();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -412,11 +412,10 @@ shader_module_compile_to_nir(struct v3dv_device *device,
|
|||
}
|
||||
|
||||
if (V3D_DBG(NIR) || v3d_debug_flag_for_shader_stage(gl_stage)) {
|
||||
fprintf(stderr, "NIR after vk_pipeline_shader_stage_to_nir: %s prog %d NIR:\n",
|
||||
broadcom_shader_stage_name(stage->stage),
|
||||
stage->program_id);
|
||||
nir_print_shader(nir, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi("NIR after vk_pipeline_shader_stage_to_nir: %s prog %d NIR:",
|
||||
broadcom_shader_stage_name(stage->stage),
|
||||
stage->program_id);
|
||||
nir_log_shaderi(nir);
|
||||
}
|
||||
|
||||
preprocess_nir(nir);
|
||||
|
|
@ -1483,13 +1482,13 @@ upload_assembly(struct v3dv_pipeline *pipeline)
|
|||
struct v3dv_bo *bo = v3dv_bo_alloc(pipeline->device, total_size,
|
||||
"pipeline shader assembly", true);
|
||||
if (!bo) {
|
||||
mesa_loge("failed to allocate memory for shader\n");
|
||||
mesa_loge("Failed to allocate memory for shader");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ok = v3dv_bo_map(pipeline->device, bo, total_size);
|
||||
if (!ok) {
|
||||
mesa_loge("failed to map source shader buffer\n");
|
||||
mesa_loge("Failed to map source shader buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1685,11 +1684,10 @@ pipeline_compile_shader_variant(struct v3dv_pipeline_stage *p_stage,
|
|||
mesa_shader_stage gl_stage = broadcom_shader_stage_to_gl(p_stage->stage);
|
||||
|
||||
if (V3D_DBG(NIR) || v3d_debug_flag_for_shader_stage(gl_stage)) {
|
||||
fprintf(stderr, "Just before v3d_compile: %s prog %d NIR:\n",
|
||||
broadcom_shader_stage_name(p_stage->stage),
|
||||
p_stage->program_id);
|
||||
nir_print_shader(p_stage->nir, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi("Just before v3d_compile: %s prog %d NIR:",
|
||||
broadcom_shader_stage_name(p_stage->stage),
|
||||
p_stage->program_id);
|
||||
nir_log_shaderi(p_stage->nir);
|
||||
}
|
||||
|
||||
uint64_t *qpu_insts;
|
||||
|
|
@ -1707,7 +1705,7 @@ pipeline_compile_shader_variant(struct v3dv_pipeline_stage *p_stage,
|
|||
struct v3dv_shader_variant *variant = NULL;
|
||||
|
||||
if (!qpu_insts) {
|
||||
mesa_loge("Failed to compile %s prog %d NIR to VIR\n",
|
||||
mesa_loge("Failed to compile %s prog %d NIR to VIR",
|
||||
broadcom_shader_stage_name(p_stage->stage),
|
||||
p_stage->program_id);
|
||||
*out_vk_result = VK_ERROR_UNKNOWN;
|
||||
|
|
|
|||
|
|
@ -47,8 +47,9 @@ v3dv_clif_dump(struct v3dv_device *device,
|
|||
V3D_DBG(CLIF)))
|
||||
return;
|
||||
|
||||
struct log_stream *stream = mesa_log_streami();
|
||||
struct clif_dump *clif = clif_dump_init(&device->devinfo,
|
||||
stderr,
|
||||
stream,
|
||||
V3D_DBG(CL) ||
|
||||
V3D_DBG(CL_NO_BIN),
|
||||
V3D_DBG(CL_NO_BIN));
|
||||
|
|
@ -73,6 +74,7 @@ v3dv_clif_dump(struct v3dv_device *device,
|
|||
|
||||
free_clif:
|
||||
clif_dump_destroy(clif);
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ v3d_render_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
|||
};
|
||||
tiled = ctx->screen->resource_create(ctx->screen, &tmpl);
|
||||
if (!tiled) {
|
||||
fprintf(stderr, "Failed to create tiled blit temp\n");
|
||||
mesa_loge("Failed to create tiled blit temp");
|
||||
return;
|
||||
}
|
||||
ctx->resource_copy_region(ctx,
|
||||
|
|
@ -126,9 +126,9 @@ v3d_render_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
|||
}
|
||||
|
||||
if (!util_blitter_is_blit_supported(v3d->blitter, info)) {
|
||||
fprintf(stderr, "blit unsupported %s -> %s\n",
|
||||
util_format_short_name(info->src.format),
|
||||
util_format_short_name(info->dst.format));
|
||||
mesa_loge("Blit unsupported %s -> %s",
|
||||
util_format_short_name(info->src.format),
|
||||
util_format_short_name(info->dst.format));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ v3d_bo_dump_stats(struct v3d_screen *screen)
|
|||
cache_size += bo->size;
|
||||
}
|
||||
|
||||
fprintf(stderr, " BOs allocated: %d\n", screen->bo_count);
|
||||
fprintf(stderr, " BOs size: %dkb\n", screen->bo_size / 1024);
|
||||
fprintf(stderr, " BOs cached: %d\n", cache_count);
|
||||
fprintf(stderr, " BOs cached size: %dkb\n", cache_size / 1024);
|
||||
mesa_logd(" BOs allocated: %d", screen->bo_count);
|
||||
mesa_logd(" BOs size: %dkb", screen->bo_size / 1024);
|
||||
mesa_logd(" BOs cached: %d", cache_count);
|
||||
mesa_logd(" BOs cached size: %dkb", cache_size / 1024);
|
||||
|
||||
if (!list_is_empty(&cache->time_list)) {
|
||||
struct v3d_bo *first = list_first_entry(&cache->time_list,
|
||||
|
|
@ -66,15 +66,12 @@ v3d_bo_dump_stats(struct v3d_screen *screen)
|
|||
struct v3d_bo,
|
||||
time_list);
|
||||
|
||||
fprintf(stderr, " oldest cache time: %ld\n",
|
||||
(long)first->free_time);
|
||||
fprintf(stderr, " newest cache time: %ld\n",
|
||||
(long)last->free_time);
|
||||
mesa_logd(" oldest cache time: %ld", (long)first->free_time);
|
||||
mesa_logd(" newest cache time: %ld", (long)last->free_time);
|
||||
|
||||
struct timespec time;
|
||||
clock_gettime(CLOCK_MONOTONIC, &time);
|
||||
fprintf(stderr, " now: %jd\n",
|
||||
(intmax_t)time.tv_sec);
|
||||
mesa_logd(" now: %jd", (intmax_t)time.tv_sec);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,8 +130,7 @@ v3d_bo_alloc(struct v3d_screen *screen, uint32_t size, const char *name)
|
|||
bo = v3d_bo_from_cache(screen, size, name);
|
||||
if (bo) {
|
||||
if (dump_stats) {
|
||||
fprintf(stderr, "Allocated %s %dkb from cache:\n",
|
||||
name, size / 1024);
|
||||
mesa_logd("Allocated %s %dkb from cache:", name, size / 1024);
|
||||
v3d_bo_dump_stats(screen);
|
||||
}
|
||||
return bo;
|
||||
|
|
@ -164,7 +160,7 @@ v3d_bo_alloc(struct v3d_screen *screen, uint32_t size, const char *name)
|
|||
goto retry;
|
||||
}
|
||||
|
||||
mesa_loge("Failed to allocate device memory for BO\n");
|
||||
mesa_loge("Failed to allocate device memory for BO");
|
||||
free(bo);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -175,7 +171,7 @@ v3d_bo_alloc(struct v3d_screen *screen, uint32_t size, const char *name)
|
|||
screen->bo_count++;
|
||||
screen->bo_size += bo->size;
|
||||
if (dump_stats) {
|
||||
fprintf(stderr, "Allocated %s %dkb:\n", name, size / 1024);
|
||||
mesa_logd("Allocated %s %dkb:", name, size / 1024);
|
||||
v3d_bo_dump_stats(screen);
|
||||
}
|
||||
|
||||
|
|
@ -217,16 +213,16 @@ v3d_bo_free(struct v3d_bo *bo)
|
|||
c.handle = bo->handle;
|
||||
int ret = v3d_ioctl(screen->fd, DRM_IOCTL_GEM_CLOSE, &c);
|
||||
if (ret != 0)
|
||||
fprintf(stderr, "close object %d: %s\n", bo->handle, strerror(errno));
|
||||
mesa_loge("close object %d: %s", bo->handle, strerror(errno));
|
||||
|
||||
screen->bo_count--;
|
||||
screen->bo_size -= bo->size;
|
||||
|
||||
if (dump_stats) {
|
||||
fprintf(stderr, "Freed %s%s%dkb:\n",
|
||||
bo->name ? bo->name : "",
|
||||
bo->name ? " " : "",
|
||||
bo->size / 1024);
|
||||
mesa_logd("Freed %s%s%dkb:",
|
||||
bo->name ? bo->name : "",
|
||||
bo->name ? " " : "",
|
||||
bo->size / 1024);
|
||||
v3d_bo_dump_stats(screen);
|
||||
}
|
||||
|
||||
|
|
@ -244,7 +240,7 @@ free_stale_bos(struct v3d_screen *screen, time_t time)
|
|||
/* If it's more than a second old, free it. */
|
||||
if (time - bo->free_time > 2) {
|
||||
if (dump_stats && !freed_any) {
|
||||
fprintf(stderr, "Freeing stale BOs:\n");
|
||||
mesa_logd("Freeing stale BOs:");
|
||||
v3d_bo_dump_stats(screen);
|
||||
freed_any = true;
|
||||
}
|
||||
|
|
@ -256,7 +252,7 @@ free_stale_bos(struct v3d_screen *screen, time_t time)
|
|||
}
|
||||
|
||||
if (dump_stats && freed_any) {
|
||||
fprintf(stderr, "Freed stale BOs:\n");
|
||||
mesa_logd("Freed stale BOs:");
|
||||
v3d_bo_dump_stats(screen);
|
||||
}
|
||||
}
|
||||
|
|
@ -315,8 +311,7 @@ v3d_bo_last_unreference_locked_timed(struct v3d_bo *bo, time_t time)
|
|||
list_addtail(&bo->size_list, &cache->size_list[page_index]);
|
||||
list_addtail(&bo->time_list, &cache->time_list);
|
||||
if (dump_stats) {
|
||||
fprintf(stderr, "Freed %s %dkb to cache:\n",
|
||||
bo->name, bo->size / 1024);
|
||||
mesa_logd("Freed %s %dkb to cache:", bo->name, bo->size / 1024);
|
||||
v3d_bo_dump_stats(screen);
|
||||
}
|
||||
bo->name = NULL;
|
||||
|
|
@ -360,8 +355,7 @@ v3d_bo_open_handle(struct v3d_screen *screen,
|
|||
};
|
||||
int ret = v3d_ioctl(screen->fd, DRM_IOCTL_V3D_GET_BO_OFFSET, &get);
|
||||
if (ret) {
|
||||
fprintf(stderr, "Failed to get BO offset: %s\n",
|
||||
strerror(errno));
|
||||
mesa_loge("Failed to get BO offset: %s", strerror(errno));
|
||||
free(bo->map);
|
||||
free(bo);
|
||||
bo = NULL;
|
||||
|
|
@ -390,8 +384,7 @@ v3d_bo_open_name(struct v3d_screen *screen, uint32_t name)
|
|||
|
||||
int ret = v3d_ioctl(screen->fd, DRM_IOCTL_GEM_OPEN, &o);
|
||||
if (ret) {
|
||||
fprintf(stderr, "Failed to open bo %d: %s\n",
|
||||
name, strerror(errno));
|
||||
mesa_loge("Failed to open bo %d: %s", name, strerror(errno));
|
||||
mtx_unlock(&screen->bo_handles_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -409,7 +402,7 @@ v3d_bo_open_dmabuf(struct v3d_screen *screen, int fd)
|
|||
int ret = drmPrimeFDToHandle(screen->fd, fd, &handle);
|
||||
int size;
|
||||
if (ret) {
|
||||
fprintf(stderr, "Failed to get v3d handle for dmabuf %d\n", fd);
|
||||
mesa_loge("Failed to get v3d handle for dmabuf %d", fd);
|
||||
mtx_unlock(&screen->bo_handles_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -417,7 +410,7 @@ v3d_bo_open_dmabuf(struct v3d_screen *screen, int fd)
|
|||
/* Determine the size of the bo we were handed. */
|
||||
size = lseek(fd, 0, SEEK_END);
|
||||
if (size == -1) {
|
||||
fprintf(stderr, "Couldn't get size of dmabuf fd %d.\n", fd);
|
||||
mesa_loge("Couldn't get size of dmabuf fd %d.", fd);
|
||||
mtx_unlock(&screen->bo_handles_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -432,8 +425,7 @@ v3d_bo_get_dmabuf(struct v3d_bo *bo)
|
|||
int ret = drmPrimeHandleToFD(bo->screen->fd, bo->handle,
|
||||
DRM_CLOEXEC | DRM_RDWR, &fd);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Failed to export gem bo %d to dmabuf\n",
|
||||
bo->handle);
|
||||
mesa_loge("Failed to export gem bo %d to dmabuf", bo->handle);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -453,8 +445,7 @@ v3d_bo_flink(struct v3d_bo *bo, uint32_t *name)
|
|||
};
|
||||
int ret = v3d_ioctl(bo->screen->fd, DRM_IOCTL_GEM_FLINK, &flink);
|
||||
if (ret) {
|
||||
fprintf(stderr, "Failed to flink bo %d: %s\n",
|
||||
bo->handle, strerror(errno));
|
||||
mesa_loge("Failed to flink bo %d: %s", bo->handle, strerror(errno));
|
||||
free(bo);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -488,15 +479,14 @@ v3d_bo_wait(struct v3d_bo *bo, uint64_t timeout_ns, const char *reason)
|
|||
|
||||
if (V3D_DBG(PERF) && timeout_ns && reason) {
|
||||
if (v3d_wait_bo_ioctl(screen->fd, bo->handle, 0) == -ETIME) {
|
||||
fprintf(stderr, "Blocking on %s BO for %s\n",
|
||||
bo->name, reason);
|
||||
mesa_logw("Blocking on %s BO for %s", bo->name, reason);
|
||||
}
|
||||
}
|
||||
|
||||
int ret = v3d_wait_bo_ioctl(screen->fd, bo->handle, timeout_ns);
|
||||
if (ret) {
|
||||
if (ret != -ETIME) {
|
||||
fprintf(stderr, "wait failed: %d\n", ret);
|
||||
mesa_loge("wait failed: %d", ret);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -521,15 +511,15 @@ v3d_bo_map_unsynchronized(struct v3d_bo *bo)
|
|||
ret = v3d_ioctl(bo->screen->fd, DRM_IOCTL_V3D_MMAP_BO, &map);
|
||||
offset = map.offset;
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "map ioctl failure\n");
|
||||
mesa_loge("map ioctl failure");
|
||||
abort();
|
||||
}
|
||||
|
||||
bo->map = mmap(NULL, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||
bo->screen->fd, offset);
|
||||
if (bo->map == MAP_FAILED) {
|
||||
fprintf(stderr, "mmap of bo %d (offset 0x%016llx, size %d) failed\n",
|
||||
bo->handle, (long long)offset, bo->size);
|
||||
mesa_loge("mmap of bo %d (offset 0x%016llx, size %d) failed",
|
||||
bo->handle, (long long)offset, bo->size);
|
||||
abort();
|
||||
}
|
||||
VG(VALGRIND_MALLOCLIKE_BLOCK(bo->map, bo->size, 0, false));
|
||||
|
|
@ -544,7 +534,7 @@ v3d_bo_map(struct v3d_bo *bo)
|
|||
|
||||
bool ok = v3d_bo_wait(bo, OS_TIMEOUT_INFINITE, "bo map");
|
||||
if (!ok) {
|
||||
fprintf(stderr, "BO wait for map failed\n");
|
||||
mesa_loge("BO wait for map failed");
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -560,7 +550,7 @@ v3d_bufmgr_destroy(struct pipe_screen *pscreen)
|
|||
v3d_bo_cache_free_all(cache);
|
||||
|
||||
if (dump_stats) {
|
||||
fprintf(stderr, "BO stats after screen destroy:\n");
|
||||
mesa_logd("BO stats after screen destroy:");
|
||||
v3d_bo_dump_stats(screen);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ v3d_pipe_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
|
|||
*/
|
||||
drmSyncobjExportSyncFile(v3d->fd, v3d->out_sync, &fd);
|
||||
if (fd == -1) {
|
||||
fprintf(stderr, "export failed\n");
|
||||
mesa_loge("Export failed");
|
||||
*fence = NULL;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -752,7 +752,7 @@ struct v3d_blend_state {
|
|||
|
||||
#define perf_debug(...) do { \
|
||||
if (V3D_DBG(PERF)) \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
mesa_logw(__VA_ARGS__); \
|
||||
if (unlikely(v3d->base.debug.debug_message)) \
|
||||
util_debug_message(&v3d->base.debug, PERF_INFO, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
|
|
|||
|
|
@ -116,9 +116,9 @@ v3d_disk_cache_retrieve(struct v3d_context *v3d,
|
|||
if (V3D_DBG(CACHE)) {
|
||||
char blake3[BLAKE3_HEX_LEN];
|
||||
_mesa_blake3_format(blake3, cache_key);
|
||||
fprintf(stderr, "[v3d on-disk cache] %s %s\n",
|
||||
buffer ? "hit" : "miss",
|
||||
blake3);
|
||||
mesa_logd("[v3d on-disk cache] %s %s",
|
||||
buffer ? "hit" : "miss",
|
||||
blake3);
|
||||
}
|
||||
|
||||
if (!buffer)
|
||||
|
|
@ -199,7 +199,7 @@ v3d_disk_cache_store(struct v3d_context *v3d,
|
|||
if (V3D_DBG(CACHE)) {
|
||||
char blake3[BLAKE3_HEX_LEN];
|
||||
_mesa_blake3_format(blake3, cache_key);
|
||||
fprintf(stderr, "[v3d on-disk cache] storing %s\n", blake3);
|
||||
mesa_logd("[v3d on-disk cache] storing %s", blake3);
|
||||
}
|
||||
|
||||
struct blob blob;
|
||||
|
|
|
|||
|
|
@ -88,14 +88,13 @@ v3d_fence_wait(struct v3d_screen *screen,
|
|||
|
||||
ret = drmSyncobjCreate(screen->fd, 0, &syncobj);
|
||||
if (ret) {
|
||||
fprintf(stderr, "Failed to create syncobj to wait on: %d\n",
|
||||
ret);
|
||||
mesa_loge("Failed to create syncobj to wait on: %d", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = drmSyncobjImportSyncFile(screen->fd, syncobj, fence->fd);
|
||||
if (ret) {
|
||||
fprintf(stderr, "Failed to import fence to syncobj: %d\n", ret);
|
||||
mesa_loge("Failed to import fence to syncobj: %d", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -496,9 +496,9 @@ v3d_clif_dump(struct v3d_context *v3d, struct v3d_job *job)
|
|||
V3D_DBG(CL_NO_BIN) ||
|
||||
V3D_DBG(CLIF)))
|
||||
return;
|
||||
|
||||
struct log_stream *stream = mesa_log_streami();
|
||||
struct clif_dump *clif = clif_dump_init(&v3d->screen->devinfo,
|
||||
stderr,
|
||||
stream,
|
||||
V3D_DBG(CL) ||
|
||||
V3D_DBG(CL_NO_BIN),
|
||||
V3D_DBG(CL_NO_BIN));
|
||||
|
|
@ -517,6 +517,7 @@ v3d_clif_dump(struct v3d_context *v3d, struct v3d_job *job)
|
|||
clif_dump(clif, &job->submit);
|
||||
|
||||
clif_dump_destroy(clif);
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -673,7 +674,7 @@ v3d_job_submit(struct v3d_context *v3d, struct v3d_job *job)
|
|||
/* pipe_caps.native_fence */
|
||||
if (drmSyncobjImportSyncFile(v3d->fd, v3d->in_syncobj,
|
||||
v3d->in_fence_fd)) {
|
||||
fprintf(stderr, "Failed to import native fence.\n");
|
||||
mesa_loge("Failed to import native fence.");
|
||||
} else {
|
||||
job->submit.in_sync_bcl = v3d->in_syncobj;
|
||||
}
|
||||
|
|
@ -728,12 +729,10 @@ v3d_job_submit(struct v3d_context *v3d, struct v3d_job *job)
|
|||
if (!V3D_DBG(NORAST)) {
|
||||
int ret;
|
||||
ret = v3d_ioctl(v3d->fd, DRM_IOCTL_V3D_SUBMIT_CL, &job->submit);
|
||||
static bool warned = false;
|
||||
if (ret && !warned) {
|
||||
fprintf(stderr, "Draw call returned %s. "
|
||||
"Expect corruption.\n", strerror(errno));
|
||||
warned = true;
|
||||
} else if (!ret) {
|
||||
if (ret) {
|
||||
mesa_loge_once("Draw call returned %s. Expect corruption.",
|
||||
strerror(errno));
|
||||
} else {
|
||||
if (v3d->active_perfmon)
|
||||
v3d->active_perfmon->job_submitted = true;
|
||||
if (V3D_DBG(SYNC)) {
|
||||
|
|
|
|||
|
|
@ -347,10 +347,8 @@ v3d_uncompiled_shader_create(struct pipe_context *pctx,
|
|||
assert(type == PIPE_SHADER_IR_TGSI);
|
||||
|
||||
if (V3D_DBG(TGSI)) {
|
||||
fprintf(stderr, "prog %d TGSI:\n",
|
||||
so->program_id);
|
||||
mesa_logd("prog %d TGSI:", so->program_id);
|
||||
tgsi_dump(ir, 0);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
s = tgsi_to_nir(ir, pctx->screen, false);
|
||||
}
|
||||
|
|
@ -420,11 +418,10 @@ v3d_uncompiled_shader_create(struct pipe_context *pctx,
|
|||
blob_finish(&blob);
|
||||
|
||||
if (V3D_DBG(NIR) || v3d_debug_flag_for_shader_stage(s->info.stage)) {
|
||||
fprintf(stderr, "%s prog %d NIR:\n",
|
||||
mesa_shader_stage_name(s->info.stage),
|
||||
so->program_id);
|
||||
nir_print_shader(s, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi("%s prog %d NIR:",
|
||||
mesa_shader_stage_name(s->info.stage),
|
||||
so->program_id);
|
||||
nir_log_shaderi(s);
|
||||
}
|
||||
|
||||
if (V3D_DBG(PRECOMPILE))
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ multisync_set(struct v3d_context *v3d, struct drm_v3d_multi_sync *ms,
|
|||
return;
|
||||
|
||||
out:
|
||||
fprintf(stderr, "Multisync Set Failed\n");
|
||||
mesa_loge("Multisync Set Failed");
|
||||
free(in_syncs);
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ v3d_submit_timestamp_query(struct pipe_context *pctx, struct v3d_bo *bo,
|
|||
|
||||
ret = v3d_ioctl(screen->fd, DRM_IOCTL_V3D_SUBMIT_CPU, &submit);
|
||||
if (ret)
|
||||
fprintf(stderr, "Failed to submit cpu job: %s\n", strerror(errno));
|
||||
mesa_loge("Failed to submit cpu job: %s", strerror(errno));
|
||||
|
||||
multisync_free(&ms);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ kperfmon_destroy(struct v3d_context *v3d, struct v3d_perfmon_state *perfmon)
|
|||
destroyreq.id = perfmon->kperfmon_id;
|
||||
int ret = v3d_ioctl(v3d->fd, DRM_IOCTL_V3D_PERFMON_DESTROY, &destroyreq);
|
||||
if (ret != 0)
|
||||
fprintf(stderr, "failed to destroy perfmon %d: %s\n",
|
||||
perfmon->kperfmon_id, strerror(errno));
|
||||
mesa_loge("Failed to destroy perfmon %d: %s",
|
||||
perfmon->kperfmon_id, strerror(errno));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -58,7 +58,7 @@ v3d_destroy_query_perfcnt(struct v3d_context *v3d, struct v3d_query *query)
|
|||
assert(pquery->perfmon);
|
||||
|
||||
if (v3d->active_perfmon == pquery->perfmon) {
|
||||
fprintf(stderr, "Query is active; end query before destroying\n");
|
||||
mesa_loge("Query is active; end query before destroying");
|
||||
return;
|
||||
}
|
||||
if (pquery->perfmon->kperfmon_id)
|
||||
|
|
@ -78,9 +78,8 @@ v3d_begin_query_perfcnt(struct v3d_context *v3d, struct v3d_query *query)
|
|||
|
||||
/* Only one perfmon can be activated per context */
|
||||
if (v3d->active_perfmon) {
|
||||
fprintf(stderr,
|
||||
"Another query is already active; "
|
||||
"finish it before starting a new one\n");
|
||||
mesa_loge("Another query is already active; "
|
||||
"finish it before starting a new one");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +118,7 @@ v3d_end_query_perfcnt(struct v3d_context *v3d, struct v3d_query *query)
|
|||
assert(pquery->perfmon);
|
||||
|
||||
if (v3d->active_perfmon != pquery->perfmon) {
|
||||
fprintf(stderr, "This query is not active\n");
|
||||
mesa_loge("This query is not active");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +134,7 @@ v3d_end_query_perfcnt(struct v3d_context *v3d, struct v3d_query *query)
|
|||
int fd = -1;
|
||||
drmSyncobjExportSyncFile(v3d->fd, v3d->out_sync, &fd);
|
||||
if (fd == -1) {
|
||||
fprintf(stderr, "export failed\n");
|
||||
mesa_loge("Export failed");
|
||||
v3d->active_perfmon->last_job_fence = NULL;
|
||||
} else {
|
||||
v3d->active_perfmon->last_job_fence =
|
||||
|
|
@ -168,7 +167,7 @@ v3d_get_query_result_perfcnt(struct v3d_context *v3d, struct v3d_query *query,
|
|||
req.values_ptr = (uintptr_t)pquery->perfmon->values;
|
||||
ret = v3d_ioctl(v3d->fd, DRM_IOCTL_V3D_PERFMON_GET_VALUES, &req);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Can't request perfmon counters values\n");
|
||||
mesa_loge("Can't request perfmon counters values");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -201,7 +200,7 @@ v3d_create_batch_query_pipe(struct v3d_context *v3d, unsigned num_queries,
|
|||
for (i = 0; i < num_queries; i++) {
|
||||
if (query_types[i] < PIPE_QUERY_DRIVER_SPECIFIC ||
|
||||
query_types[i] >= PIPE_QUERY_DRIVER_SPECIFIC + max_perfcnt) {
|
||||
fprintf(stderr, "Invalid query type\n");
|
||||
mesa_loge("Invalid query type");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,13 +50,12 @@ v3d_debug_resource_layout(struct v3d_resource *rsc, const char *caller)
|
|||
struct pipe_resource *prsc = &rsc->base;
|
||||
|
||||
if (prsc->target == PIPE_BUFFER) {
|
||||
fprintf(stderr,
|
||||
"rsc %s %p (format %s), %dx%d buffer @0x%08x-0x%08x\n",
|
||||
caller, rsc,
|
||||
util_format_short_name(prsc->format),
|
||||
prsc->width0, prsc->height0,
|
||||
rsc->bo->offset,
|
||||
rsc->bo->offset + rsc->bo->size - 1);
|
||||
mesa_logd("rsc %s %p (format %s), %dx%d buffer @0x%08x-0x%08x",
|
||||
caller, rsc,
|
||||
util_format_short_name(prsc->format),
|
||||
prsc->width0, prsc->height0,
|
||||
rsc->bo->offset,
|
||||
rsc->bo->offset + rsc->bo->size - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -77,21 +76,20 @@ v3d_debug_resource_layout(struct v3d_resource *rsc, const char *caller)
|
|||
int level_depth =
|
||||
u_minify(util_next_power_of_two(prsc->depth0), i);
|
||||
|
||||
fprintf(stderr,
|
||||
"rsc %s %p (format %s), %dx%d: "
|
||||
"level %d (%s) %dx%dx%d -> %dx%dx%d, stride %d@0x%08x\n",
|
||||
caller, rsc,
|
||||
util_format_short_name(prsc->format),
|
||||
prsc->width0, prsc->height0,
|
||||
i, tiling_descriptions[slice->tiling],
|
||||
u_minify(prsc->width0, i),
|
||||
u_minify(prsc->height0, i),
|
||||
u_minify(prsc->depth0, i),
|
||||
level_width,
|
||||
level_height,
|
||||
level_depth,
|
||||
slice->stride,
|
||||
rsc->bo->offset + slice->offset);
|
||||
mesa_logd("rsc %s %p (format %s), %dx%d: "
|
||||
"level %d (%s) %dx%dx%d -> %dx%dx%d, stride %d@0x%08x",
|
||||
caller, rsc,
|
||||
util_format_short_name(prsc->format),
|
||||
prsc->width0, prsc->height0,
|
||||
i, tiling_descriptions[slice->tiling],
|
||||
u_minify(prsc->width0, i),
|
||||
u_minify(prsc->height0, i),
|
||||
u_minify(prsc->depth0, i),
|
||||
level_width,
|
||||
level_height,
|
||||
level_depth,
|
||||
slice->stride,
|
||||
rsc->bo->offset + slice->offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +312,7 @@ v3d_resource_transfer_map(struct pipe_context *pctx,
|
|||
else
|
||||
buf = v3d_bo_map(rsc->bo);
|
||||
if (!buf) {
|
||||
fprintf(stderr, "Failed to map bo\n");
|
||||
mesa_loge("Failed to map bo");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -859,7 +857,7 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen,
|
|||
} else if (drm_find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count)) {
|
||||
rsc->tiled = false;
|
||||
} else {
|
||||
fprintf(stderr, "Unsupported modifier requested\n");
|
||||
mesa_loge("Unsupported modifier requested");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -887,7 +885,7 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen,
|
|||
&handle);
|
||||
|
||||
if (!rsc->scanout) {
|
||||
fprintf(stderr, "Failed to create scanout resource\n");
|
||||
mesa_loge("Failed to create scanout resource");
|
||||
goto fail;
|
||||
}
|
||||
assert(handle.type == WINSYS_HANDLE_TYPE_FD);
|
||||
|
|
@ -955,9 +953,8 @@ v3d_resource_from_handle(struct pipe_screen *pscreen,
|
|||
fourcc_mod_broadcom_param(whandle->modifier);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"Attempt to import unsupported modifier 0x%llx\n",
|
||||
(long long)whandle->modifier);
|
||||
mesa_loge("Attempt to import unsupported modifier 0x%llx",
|
||||
(long long)whandle->modifier);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
|
@ -970,9 +967,8 @@ v3d_resource_from_handle(struct pipe_screen *pscreen,
|
|||
rsc->bo = v3d_bo_open_dmabuf(screen, whandle->handle);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"Attempt to import unsupported handle type %d\n",
|
||||
whandle->type);
|
||||
mesa_loge("Attempt to import unsupported handle type %d",
|
||||
whandle->type);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -986,20 +982,19 @@ v3d_resource_from_handle(struct pipe_screen *pscreen,
|
|||
|
||||
if (whandle->offset != 0) {
|
||||
if (rsc->tiled) {
|
||||
fprintf(stderr,
|
||||
"Attempt to import unsupported winsys offset %u\n",
|
||||
whandle->offset);
|
||||
mesa_loge("Attempt to import unsupported winsys offset %u",
|
||||
whandle->offset);
|
||||
goto fail;
|
||||
}
|
||||
rsc->slices[0].offset += whandle->offset;
|
||||
|
||||
if (rsc->slices[0].offset + rsc->slices[0].size >
|
||||
rsc->bo->size) {
|
||||
fprintf(stderr, "Attempt to import "
|
||||
"with overflowing offset (%d + %d > %d)\n",
|
||||
whandle->offset,
|
||||
rsc->slices[0].size,
|
||||
rsc->bo->size);
|
||||
mesa_loge("Attempt to import with overflowing offset "
|
||||
"(%d + %d > %d)",
|
||||
whandle->offset,
|
||||
rsc->slices[0].size,
|
||||
rsc->bo->size);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
|
@ -1019,13 +1014,12 @@ v3d_resource_from_handle(struct pipe_screen *pscreen,
|
|||
static bool warned = false;
|
||||
if (!warned) {
|
||||
warned = true;
|
||||
fprintf(stderr,
|
||||
"Attempting to import %dx%d %s with "
|
||||
"unsupported stride %d instead of %d\n",
|
||||
prsc->width0, prsc->height0,
|
||||
util_format_short_name(prsc->format),
|
||||
whandle->stride,
|
||||
slice->stride);
|
||||
mesa_loge("Attempting to import %dx%d %s with "
|
||||
"unsupported stride %d instead of %d",
|
||||
prsc->width0, prsc->height0,
|
||||
util_format_short_name(prsc->format),
|
||||
whandle->stride,
|
||||
slice->stride);
|
||||
}
|
||||
goto fail;
|
||||
} else if (!rsc->tiled) {
|
||||
|
|
|
|||
|
|
@ -418,10 +418,9 @@ v3d_write_uniforms(struct v3d_context *v3d, struct v3d_job *job,
|
|||
#if 0
|
||||
uint32_t written_val = *((uint32_t *)uniforms - 1);
|
||||
char *str = vir_dump_uniform(uinfo->contents[i], data);
|
||||
fprintf(stderr, "shader %p[%d]: 0x%08x / 0x%08x (%f) %s\n",
|
||||
shader, i, __gen_address_offset(&uniform_stream) + i * 4,
|
||||
written_val, uif(written_val),
|
||||
str);
|
||||
mesa_logd("shader %p[%d]: 0x%08x / 0x%08x (%f) %s",
|
||||
shader, i, __gen_address_offset(&uniform_stream) + i * 4,
|
||||
written_val, uif(written_val), str);
|
||||
ralloc_free(str);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1023,9 +1023,8 @@ v3d_check_compiled_shaders(struct v3d_context *v3d)
|
|||
return true;
|
||||
|
||||
if (!warned[failed_stage]) {
|
||||
fprintf(stderr,
|
||||
"%s shader failed to compile. Expect corruption.\n",
|
||||
_mesa_shader_stage_to_string(failed_stage));
|
||||
mesa_loge("%s shader failed to compile. Expect corruption.",
|
||||
_mesa_shader_stage_to_string(failed_stage));
|
||||
warned[failed_stage] = true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -1426,13 +1425,8 @@ v3d_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
|
|||
v3d_update_compiled_cs(v3d);
|
||||
|
||||
if (!v3d->prog.compute->resource) {
|
||||
static bool warned = false;
|
||||
if (!warned) {
|
||||
fprintf(stderr,
|
||||
"Compute shader failed to compile. "
|
||||
"Expect corruption.\n");
|
||||
warned = true;
|
||||
}
|
||||
mesa_loge_once("Compute shader failed to compile. "
|
||||
"Expect corruption.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1577,12 +1571,10 @@ v3d_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
|
|||
if (!V3D_DBG(NORAST)) {
|
||||
int ret = v3d_ioctl(screen->fd, DRM_IOCTL_V3D_SUBMIT_CSD,
|
||||
&submit);
|
||||
static bool warned = false;
|
||||
if (ret && !warned) {
|
||||
fprintf(stderr, "CSD submit call returned %s. "
|
||||
"Expect corruption.\n", strerror(errno));
|
||||
warned = true;
|
||||
} else if (!ret) {
|
||||
if (ret) {
|
||||
mesa_loge_once("CSD submit call returned %s. Expect corruption.",
|
||||
strerror(errno));
|
||||
} else {
|
||||
if (v3d->active_perfmon)
|
||||
v3d->active_perfmon->job_submitted = true;
|
||||
if (V3D_DBG(SYNC)) {
|
||||
|
|
|
|||
|
|
@ -418,18 +418,16 @@ v3d_vertex_state_create(struct pipe_context *pctx, unsigned num_elements,
|
|||
attr.type = ATTRIBUTE_BYTE;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"format %s unsupported\n",
|
||||
desc->name);
|
||||
mesa_loge("format %s unsupported",
|
||||
desc->name);
|
||||
attr.type = ATTRIBUTE_BYTE;
|
||||
abort();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"format %s unsupported\n",
|
||||
desc->name);
|
||||
mesa_loge("format %s unsupported",
|
||||
desc->name);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ v3dX(tfu)(struct pipe_context *pctx,
|
|||
|
||||
int ret = v3d_ioctl(screen->fd, DRM_IOCTL_V3D_SUBMIT_TFU, &tfu);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Failed to submit TFU job: %d\n", ret);
|
||||
mesa_loge("Failed to submit TFU job: %d", ret);
|
||||
return false;
|
||||
}
|
||||
if (V3D_DBG(SYNC)) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ vc4_dump_cl(struct log_stream *stream, void *cl, uint32_t size, bool is_render)
|
|||
};
|
||||
struct v3d_spec *spec = v3d_spec_load(&devinfo);
|
||||
|
||||
struct clif_dump *clif = clif_dump_init(&devinfo, stderr, true, false);
|
||||
struct clif_dump *clif = clif_dump_init(&devinfo, stream, true, false);
|
||||
|
||||
uint32_t offset = 0, hw_offset = 0;
|
||||
uint8_t *p = cl;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue