mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 13:38:06 +02:00
vc4: 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
260e051187
commit
d22ab89805
33 changed files with 457 additions and 517 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include "drm-uapi/vc4_drm.h"
|
||||
#include "drm-shim/drm_shim.h"
|
||||
#include "util/log.h"
|
||||
|
||||
bool drm_shim_driver_prefers_first_render_node = true;
|
||||
|
||||
|
|
@ -109,7 +110,7 @@ vc4_ioctl_get_param(int fd, unsigned long request, void *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Unknown DRM_IOCTL_VC4_GET_PARAM %d\n", gp->param);
|
||||
mesa_loge("Unknown DRM_IOCTL_VC4_GET_PARAM %d", gp->param);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,13 +129,13 @@ vc4_tile_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
return;
|
||||
|
||||
if (false) {
|
||||
fprintf(stderr, "RCL blit from %d,%d to %d,%d (%d,%d)\n",
|
||||
info->src.box.x,
|
||||
info->src.box.y,
|
||||
info->dst.box.x,
|
||||
info->dst.box.y,
|
||||
info->dst.box.width,
|
||||
info->dst.box.height);
|
||||
mesa_logd("RCL blit from %d,%d to %d,%d (%d,%d)",
|
||||
info->src.box.x,
|
||||
info->src.box.y,
|
||||
info->dst.box.x,
|
||||
info->dst.box.y,
|
||||
info->dst.box.width,
|
||||
info->dst.box.height);
|
||||
}
|
||||
|
||||
struct pipe_surface dst_surf;
|
||||
|
|
@ -434,9 +434,9 @@ vc4_render_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
|||
return;
|
||||
|
||||
if (!util_blitter_is_blit_supported(vc4->blitter, info)) {
|
||||
fprintf(stderr, "blit unsupported %s -> %s\n",
|
||||
util_format_short_name(info->src.resource->format),
|
||||
util_format_short_name(info->dst.resource->format));
|
||||
mesa_logw("blit unsupported %s -> %s",
|
||||
util_format_short_name(info->src.resource->format),
|
||||
util_format_short_name(info->dst.resource->format));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -544,5 +544,5 @@ vc4_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info)
|
|||
vc4_render_blit(pctx, &info);
|
||||
|
||||
if (info.mask)
|
||||
fprintf(stderr, "Unsupported blit\n");
|
||||
mesa_loge("Unsupported blit");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,10 +80,10 @@ vc4_bo_dump_stats(struct vc4_screen *screen)
|
|||
{
|
||||
struct vc4_bo_cache *cache = &screen->bo_cache;
|
||||
|
||||
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->bo_count);
|
||||
fprintf(stderr, " BOs cached size: %dkb\n", cache->bo_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->bo_count);
|
||||
mesa_logd(" BOs cached size: %dkb", cache->bo_size / 1024);
|
||||
|
||||
if (!list_is_empty(&cache->time_list)) {
|
||||
struct vc4_bo *first = list_entry(cache->time_list.next,
|
||||
|
|
@ -93,15 +93,12 @@ vc4_bo_dump_stats(struct vc4_screen *screen)
|
|||
struct vc4_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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,16 +161,16 @@ vc4_bo_free(struct vc4_bo *bo)
|
|||
c.handle = bo->handle;
|
||||
int ret = vc4_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);
|
||||
vc4_bo_dump_stats(screen);
|
||||
}
|
||||
|
||||
|
|
@ -234,8 +231,8 @@ vc4_bo_alloc(struct vc4_screen *screen, uint32_t size, const char *name)
|
|||
bo = vc4_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);
|
||||
vc4_bo_dump_stats(screen);
|
||||
}
|
||||
return bo;
|
||||
|
|
@ -273,7 +270,7 @@ vc4_bo_alloc(struct vc4_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);
|
||||
vc4_bo_dump_stats(screen);
|
||||
}
|
||||
|
||||
|
|
@ -303,7 +300,7 @@ free_stale_bos(struct vc4_screen *screen, time_t time)
|
|||
list_for_each_entry_safe(struct vc4_bo, bo, &cache->time_list,
|
||||
time_list) {
|
||||
if (dump_stats && !freed_any) {
|
||||
fprintf(stderr, "Freeing stale BOs:\n");
|
||||
mesa_logd("Freeing stale BOs:");
|
||||
vc4_bo_dump_stats(screen);
|
||||
freed_any = true;
|
||||
}
|
||||
|
|
@ -318,7 +315,7 @@ free_stale_bos(struct vc4_screen *screen, time_t time)
|
|||
}
|
||||
|
||||
if (dump_stats && freed_any) {
|
||||
fprintf(stderr, "Freed stale BOs:\n");
|
||||
mesa_logd("Freed stale BOs:");
|
||||
vc4_bo_dump_stats(screen);
|
||||
}
|
||||
}
|
||||
|
|
@ -370,7 +367,7 @@ vc4_bo_last_unreference_locked_timed(struct vc4_bo *bo, time_t time)
|
|||
cache->bo_count++;
|
||||
cache->bo_size += bo->size;
|
||||
if (dump_stats) {
|
||||
fprintf(stderr, "Freed %s %dkb to cache:\n",
|
||||
mesa_logd("Freed %s %dkb to cache:",
|
||||
bo->name, bo->size / 1024);
|
||||
vc4_bo_dump_stats(screen);
|
||||
}
|
||||
|
|
@ -429,8 +426,8 @@ vc4_bo_open_name(struct vc4_screen *screen, uint32_t name)
|
|||
|
||||
int ret = vc4_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;
|
||||
}
|
||||
|
|
@ -448,7 +445,7 @@ vc4_bo_open_dmabuf(struct vc4_screen *screen, int fd)
|
|||
int ret = drmPrimeFDToHandle(screen->fd, fd, &handle);
|
||||
int size;
|
||||
if (ret) {
|
||||
fprintf(stderr, "Failed to get vc4 handle for dmabuf %d\n", fd);
|
||||
mesa_loge("Failed to get vc4 handle for dmabuf %d", fd);
|
||||
mtx_unlock(&screen->bo_handles_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -456,7 +453,7 @@ vc4_bo_open_dmabuf(struct vc4_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;
|
||||
}
|
||||
|
|
@ -471,8 +468,8 @@ vc4_bo_get_dmabuf(struct vc4_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;
|
||||
}
|
||||
|
||||
|
|
@ -510,14 +507,14 @@ vc4_bo_alloc_shader(struct vc4_screen *screen, const void *data, uint32_t size)
|
|||
bo->handle = create.handle;
|
||||
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "create shader ioctl failure\n");
|
||||
mesa_loge("Create shader ioctl failure");
|
||||
abort();
|
||||
}
|
||||
|
||||
screen->bo_count++;
|
||||
screen->bo_size += bo->size;
|
||||
if (dump_stats) {
|
||||
fprintf(stderr, "Allocated shader %dkb:\n", bo->size / 1024);
|
||||
mesa_logd("Allocated shader %dkb:", bo->size / 1024);
|
||||
vc4_bo_dump_stats(screen);
|
||||
}
|
||||
|
||||
|
|
@ -532,8 +529,8 @@ vc4_bo_flink(struct vc4_bo *bo, uint32_t *name)
|
|||
};
|
||||
int ret = vc4_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;
|
||||
}
|
||||
|
|
@ -567,15 +564,15 @@ vc4_wait_seqno(struct vc4_screen *screen, uint64_t seqno, uint64_t timeout_ns,
|
|||
|
||||
if (VC4_DBG(PERF) && timeout_ns && reason) {
|
||||
if (vc4_wait_seqno_ioctl(screen->fd, seqno, 0) == -ETIME) {
|
||||
fprintf(stderr, "Blocking on seqno %lld for %s\n",
|
||||
(long long)seqno, reason);
|
||||
mesa_logd("Blocking on seqno %lld for %s",
|
||||
(long long)seqno, reason);
|
||||
}
|
||||
}
|
||||
|
||||
int ret = vc4_wait_seqno_ioctl(screen->fd, seqno, timeout_ns);
|
||||
if (ret) {
|
||||
if (ret != -ETIME) {
|
||||
fprintf(stderr, "wait failed: %d\n", ret);
|
||||
mesa_loge("wait failed: %d", ret);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -609,15 +606,15 @@ vc4_bo_wait(struct vc4_bo *bo, uint64_t timeout_ns, const char *reason)
|
|||
|
||||
if (VC4_DBG(PERF) && timeout_ns && reason) {
|
||||
if (vc4_wait_bo_ioctl(screen->fd, bo->handle, 0) == -ETIME) {
|
||||
fprintf(stderr, "Blocking on %s BO for %s\n",
|
||||
bo->name, reason);
|
||||
mesa_logd("Blocking on %s BO for %s",
|
||||
bo->name, reason);
|
||||
}
|
||||
}
|
||||
|
||||
int ret = vc4_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();
|
||||
}
|
||||
|
||||
|
|
@ -642,15 +639,15 @@ vc4_bo_map_unsynchronized(struct vc4_bo *bo)
|
|||
ret = vc4_ioctl(bo->screen->fd, DRM_IOCTL_VC4_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));
|
||||
|
|
@ -665,7 +662,7 @@ vc4_bo_map(struct vc4_bo *bo)
|
|||
|
||||
bool ok = vc4_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();
|
||||
}
|
||||
|
||||
|
|
@ -681,7 +678,7 @@ vc4_bufmgr_destroy(struct pipe_screen *pscreen)
|
|||
vc4_bo_cache_free_all(cache);
|
||||
|
||||
if (dump_stats) {
|
||||
fprintf(stderr, "BO stats after screen destroy:\n");
|
||||
mesa_logd("BO stats after screen destroy:");
|
||||
vc4_bo_dump_stats(screen);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "util/log.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_prim.h"
|
||||
#include "util/macros.h"
|
||||
|
|
@ -30,8 +31,8 @@
|
|||
#include "broadcom/cle/v3d_decoder.h"
|
||||
#include "broadcom/clif/clif_dump.h"
|
||||
|
||||
void
|
||||
vc4_dump_cl(void *cl, uint32_t size, bool is_render)
|
||||
static void
|
||||
vc4_dump_cl(struct log_stream *stream, void *cl, uint32_t size, bool is_render)
|
||||
{
|
||||
struct v3d_device_info devinfo = {
|
||||
/* While the driver supports V3D 2.1 and 2.6, we haven't split
|
||||
|
|
@ -53,15 +54,15 @@ vc4_dump_cl(void *cl, uint32_t size, bool is_render)
|
|||
uint32_t length;
|
||||
|
||||
if (inst == NULL) {
|
||||
fprintf(stderr, "0x%08x 0x%08x: Unknown packet 0x%02x (%d)!\n",
|
||||
offset, hw_offset, header, header);
|
||||
mesa_log_stream_printf(stream, "0x%08x 0x%08x: Unknown packet 0x%02x (%d)!\n",
|
||||
offset, hw_offset, header, header);
|
||||
return;
|
||||
}
|
||||
|
||||
length = v3d_group_get_length(inst);
|
||||
|
||||
fprintf(stderr, "0x%08x 0x%08x: 0x%02x %s\n",
|
||||
offset, hw_offset, header, v3d_group_get_name(inst));
|
||||
mesa_log_stream_printf(stream, "0x%08x 0x%08x: 0x%02x %s\n",
|
||||
offset, hw_offset, header, v3d_group_get_name(inst));
|
||||
|
||||
v3d_print_group(clif, inst, offset, p);
|
||||
|
||||
|
|
@ -82,3 +83,18 @@ vc4_dump_cl(void *cl, uint32_t size, bool is_render)
|
|||
clif_dump_destroy(clif);
|
||||
}
|
||||
|
||||
void
|
||||
vc4_dump_cli(void *cl, uint32_t size, bool is_render)
|
||||
{
|
||||
struct log_stream *stream = mesa_log_streami();
|
||||
vc4_dump_cl(stream, cl, size, is_render);
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
||||
void
|
||||
vc4_dump_cle(void *cl, uint32_t size, bool is_render)
|
||||
{
|
||||
struct log_stream *stream = mesa_log_streame();
|
||||
vc4_dump_cl(stream, cl, size, is_render);
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@
|
|||
#define VC4_CL_DUMP_H
|
||||
|
||||
#include <stdbool.h>
|
||||
void vc4_dump_cl(void *cl, uint32_t size, bool is_render);
|
||||
|
||||
void vc4_dump_cli(void *cl, uint32_t size, bool is_render);
|
||||
|
||||
void vc4_dump_cle(void *cl, uint32_t size, bool is_render);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ struct vc4_depth_stencil_alpha_state {
|
|||
|
||||
#define perf_debug(...) do { \
|
||||
if (VC4_DBG(PERF)) \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
mesa_logd(__VA_ARGS__); \
|
||||
if (unlikely(vc4->base.debug.debug_message)) \
|
||||
util_debug_message(&vc4->base.debug, PERF_INFO, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
|
|
|||
|
|
@ -411,8 +411,8 @@ vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job)
|
|||
}
|
||||
|
||||
if (VC4_DBG(CL)) {
|
||||
fprintf(stderr, "BCL:\n");
|
||||
vc4_dump_cl(job->bcl.base, cl_offset(&job->bcl), false);
|
||||
mesa_logi("BCL:");
|
||||
vc4_dump_cli(job->bcl.base, cl_offset(&job->bcl), false);
|
||||
}
|
||||
|
||||
if (cl_offset(&job->bcl) > 0) {
|
||||
|
|
@ -520,12 +520,10 @@ vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job)
|
|||
int ret;
|
||||
|
||||
ret = vc4_ioctl(vc4->fd, DRM_IOCTL_VC4_SUBMIT_CL, &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_logw_once("Draw call returned %s. "
|
||||
"Expect corruption.", strerror(errno));
|
||||
} else {
|
||||
vc4->last_emit_seqno = submit.seqno;
|
||||
if (job->perfmon)
|
||||
job->perfmon->last_seqno = submit.seqno;
|
||||
|
|
@ -537,14 +535,14 @@ vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job)
|
|||
vc4->last_emit_seqno - 5,
|
||||
OS_TIMEOUT_INFINITE,
|
||||
"job throttling")) {
|
||||
fprintf(stderr, "Job throttling failed\n");
|
||||
mesa_loge("Job throttling failed");
|
||||
}
|
||||
}
|
||||
|
||||
if (VC4_DBG(ALWAYS_SYNC)) {
|
||||
if (!vc4_wait_seqno(vc4->screen, vc4->last_emit_seqno,
|
||||
OS_TIMEOUT_INFINITE, "sync")) {
|
||||
fprintf(stderr, "Wait failed.\n");
|
||||
mesa_loge("Wait failed");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ vc4_blend_channel_f(nir_builder *b,
|
|||
case PIPE_BLENDFACTOR_INV_SRC1_COLOR:
|
||||
case PIPE_BLENDFACTOR_INV_SRC1_ALPHA:
|
||||
/* Unsupported. */
|
||||
fprintf(stderr, "Unknown blend factor %d\n", factor);
|
||||
mesa_loge("Unknown blend factor %d", factor);
|
||||
return nir_imm_float(b, 1.0);
|
||||
}
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ vc4_blend_channel_i(nir_builder *b,
|
|||
case PIPE_BLENDFACTOR_INV_SRC1_COLOR:
|
||||
case PIPE_BLENDFACTOR_INV_SRC1_ALPHA:
|
||||
/* Unsupported. */
|
||||
fprintf(stderr, "Unknown blend factor %d\n", factor);
|
||||
mesa_loge("Unknown blend factor %d", factor);
|
||||
return nir_imm_int(b, ~0);
|
||||
}
|
||||
}
|
||||
|
|
@ -213,7 +213,7 @@ vc4_blend_func_f(nir_builder *b, nir_def *src, nir_def *dst,
|
|||
|
||||
default:
|
||||
/* Unsupported. */
|
||||
fprintf(stderr, "Unknown blend func %d\n", func);
|
||||
mesa_loge("Unknown blend func %d", func);
|
||||
return src;
|
||||
|
||||
}
|
||||
|
|
@ -237,7 +237,7 @@ vc4_blend_func_i(nir_builder *b, nir_def *src, nir_def *dst,
|
|||
|
||||
default:
|
||||
/* Unsupported. */
|
||||
fprintf(stderr, "Unknown blend func %d\n", func);
|
||||
mesa_loge("Unknown blend func %d", func);
|
||||
return src;
|
||||
|
||||
}
|
||||
|
|
@ -403,7 +403,7 @@ vc4_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;
|
||||
|
|
|
|||
|
|
@ -190,7 +190,6 @@ vc4_nir_lower_vertex_attr(struct vc4_compile *c, nir_builder *b,
|
|||
.base = nir_intrinsic_base(intr),
|
||||
.component = i);
|
||||
|
||||
bool format_warned = false;
|
||||
const struct util_format_description *desc =
|
||||
util_format_description(format);
|
||||
|
||||
|
|
@ -201,12 +200,8 @@ vc4_nir_lower_vertex_attr(struct vc4_compile *c, nir_builder *b,
|
|||
desc);
|
||||
|
||||
if (!dests[i]) {
|
||||
if (!format_warned) {
|
||||
fprintf(stderr,
|
||||
"vtx element %d unsupported type: %s\n",
|
||||
attr, util_format_name(format));
|
||||
format_warned = true;
|
||||
}
|
||||
mesa_logw_once("vtx element %d unsupported type: %s",
|
||||
attr, util_format_name(format));
|
||||
dests[i] = nir_imm_float(b, 0.0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,26 +37,6 @@
|
|||
|
||||
static bool debug;
|
||||
|
||||
static void
|
||||
dump_from(struct vc4_compile *c, struct qinst *inst)
|
||||
{
|
||||
if (!debug)
|
||||
return;
|
||||
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "optimizing: %s\n", dump_inst);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_to(struct vc4_compile *c, struct qinst *inst)
|
||||
{
|
||||
if (!debug)
|
||||
return;
|
||||
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "to: %s", dump_inst);
|
||||
}
|
||||
|
||||
static bool
|
||||
is_constant_value(struct vc4_compile *c, struct qreg reg,
|
||||
uint32_t val)
|
||||
|
|
@ -91,19 +71,18 @@ is_1f(struct vc4_compile *c, struct qreg reg)
|
|||
static void
|
||||
replace_with_mov(struct vc4_compile *c, struct qinst *inst, struct qreg arg)
|
||||
{
|
||||
dump_from(c, inst);
|
||||
LOG_INST_OPT("Optimizing", c, inst) {
|
||||
inst->src[0] = arg;
|
||||
if (qir_has_implicit_tex_uniform(inst))
|
||||
inst->src[1] = inst->src[qir_get_tex_uniform_src(inst)];
|
||||
|
||||
inst->src[0] = arg;
|
||||
if (qir_has_implicit_tex_uniform(inst))
|
||||
inst->src[1] = inst->src[qir_get_tex_uniform_src(inst)];
|
||||
|
||||
if (qir_is_mul(inst))
|
||||
inst->op = QOP_MMOV;
|
||||
else if (qir_is_float_input(inst))
|
||||
inst->op = QOP_FMOV;
|
||||
else
|
||||
inst->op = QOP_MOV;
|
||||
dump_to(c, inst);
|
||||
if (qir_is_mul(inst))
|
||||
inst->op = QOP_MMOV;
|
||||
else if (qir_is_float_input(inst))
|
||||
inst->op = QOP_FMOV;
|
||||
else
|
||||
inst->op = QOP_MOV;
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -197,11 +176,11 @@ qir_opt_algebraic(struct vc4_compile *c)
|
|||
c->defs[inst->src[1].index]->op == QOP_FSUB) {
|
||||
struct qinst *fsub = c->defs[inst->src[1].index];
|
||||
if (is_zero(c, fsub->src[0])) {
|
||||
dump_from(c, inst);
|
||||
inst->op = QOP_FSUB;
|
||||
inst->src[1] = fsub->src[1];
|
||||
LOG_INST_OPT("Optimizing", c, inst) {
|
||||
inst->op = QOP_FSUB;
|
||||
inst->src[1] = fsub->src[1];
|
||||
}
|
||||
progress = true;
|
||||
dump_to(c, inst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -212,11 +191,11 @@ qir_opt_algebraic(struct vc4_compile *c)
|
|||
c->defs[inst->src[0].index]->op == QOP_FSUB) {
|
||||
struct qinst *fsub = c->defs[inst->src[0].index];
|
||||
if (is_zero(c, fsub->src[0])) {
|
||||
dump_from(c, inst);
|
||||
inst->op = QOP_FSUB;
|
||||
inst->src[0] = inst->src[1];
|
||||
inst->src[1] = fsub->src[1];
|
||||
dump_to(c, inst);
|
||||
LOG_INST_OPT("Optimizing", c, inst) {
|
||||
inst->op = QOP_FSUB;
|
||||
inst->src[0] = inst->src[1];
|
||||
inst->src[1] = fsub->src[1];
|
||||
}
|
||||
progress = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,26 +33,6 @@
|
|||
|
||||
static bool debug;
|
||||
|
||||
static void
|
||||
dump_from(struct vc4_compile *c, struct qinst *inst)
|
||||
{
|
||||
if (!debug)
|
||||
return;
|
||||
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "optimizing: %s\n", dump_inst);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_to(struct vc4_compile *c, struct qinst *inst)
|
||||
{
|
||||
if (!debug)
|
||||
return;
|
||||
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "to: %s\n", dump_inst);
|
||||
}
|
||||
|
||||
static bool
|
||||
constant_fold(struct vc4_compile *c, struct qinst *inst)
|
||||
{
|
||||
|
|
@ -86,14 +66,13 @@ constant_fold(struct vc4_compile *c, struct qinst *inst)
|
|||
return false;
|
||||
}
|
||||
|
||||
dump_from(c, inst);
|
||||
LOG_INST_OPT("Optimizing", c, inst) {
|
||||
inst->src[0] = qir_uniform_ui(c, result);
|
||||
for (int i = 1; i < nsrc; i++)
|
||||
inst->src[i] = c->undef;
|
||||
inst->op = QOP_MOV;
|
||||
}
|
||||
|
||||
inst->src[0] = qir_uniform_ui(c, result);
|
||||
for (int i = 1; i < nsrc; i++)
|
||||
inst->src[i] = c->undef;
|
||||
inst->op = QOP_MOV;
|
||||
|
||||
dump_to(c, inst);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,19 +132,10 @@ try_copy_prop(struct vc4_compile *c, struct qinst *inst, struct qinst **movs)
|
|||
unpack = inst->src[i].pack;
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
char *dump_inst = qir_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];
|
||||
inst->src[i].pack = unpack;
|
||||
}
|
||||
|
||||
inst->src[i] = mov->src[0];
|
||||
inst->src[i].pack = unpack;
|
||||
|
||||
if (debug) {
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "to: %s\n", dump_inst);
|
||||
}
|
||||
|
||||
progress = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ dce(struct vc4_compile *c, struct qinst *inst)
|
|||
{
|
||||
if (debug) {
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "Removing: %s\n", dump_inst);
|
||||
mesa_logd("Removing: \"%s\"", dump_inst);
|
||||
}
|
||||
assert(!inst->sf);
|
||||
qir_remove_instruction(c, inst);
|
||||
|
|
@ -117,9 +117,8 @@ qir_opt_dead_code(struct vc4_compile *c)
|
|||
if (inst->dst.file == QFILE_TEMP) {
|
||||
if (debug) {
|
||||
char *dump_inst = qir_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;
|
||||
|
|
|
|||
|
|
@ -32,26 +32,6 @@
|
|||
|
||||
static bool debug;
|
||||
|
||||
static void
|
||||
dump_from(struct vc4_compile *c, struct qinst *inst, const char *type)
|
||||
{
|
||||
if (!debug)
|
||||
return;
|
||||
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "optimizing %s: %s\n", type, dump_inst);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_to(struct vc4_compile *c, struct qinst *inst)
|
||||
{
|
||||
if (!debug)
|
||||
return;
|
||||
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "to: %s\n", dump_inst);
|
||||
}
|
||||
|
||||
static bool
|
||||
inst_srcs_updated(struct qinst *inst, struct qinst *writer)
|
||||
{
|
||||
|
|
@ -123,18 +103,18 @@ qir_opt_peephole_sf_block(struct vc4_compile *c, struct qblock *block)
|
|||
if (!sf_live) {
|
||||
/* Our instruction's SF isn't read, so drop it.
|
||||
*/
|
||||
dump_from(c, inst, "dead SF");
|
||||
inst->sf = false;
|
||||
dump_to(c, inst);
|
||||
LOG_INST_OPT("Optimizing dead SF", c, inst) {
|
||||
inst->sf = false;
|
||||
}
|
||||
progress = true;
|
||||
} else if (last_sf &&
|
||||
inst_result_equals(last_sf, inst)) {
|
||||
/* The last_sf sets up same value as inst, so
|
||||
* just drop the later one.
|
||||
*/
|
||||
dump_from(c, last_sf, "repeated SF");
|
||||
last_sf->sf = false;
|
||||
dump_to(c, last_sf);
|
||||
LOG_INST_OPT("Optimizing repeated SF", c, last_sf) {
|
||||
last_sf->sf = false;
|
||||
}
|
||||
progress = true;
|
||||
last_sf = inst;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -86,15 +86,9 @@ qir_opt_small_immediates(struct vc4_compile *c)
|
|||
if (small_imm == ~0)
|
||||
continue;
|
||||
|
||||
if (debug) {
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "opt_small_immediate() from: %s\n", dump_inst);
|
||||
}
|
||||
inst->src[i].file = QFILE_SMALL_IMM;
|
||||
inst->src[i].index = imm;
|
||||
if (debug) {
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "to: %s\n", dump_inst);
|
||||
LOG_INST_OPT("opt_small_immediate()", c, inst) {
|
||||
inst->src[i].file = QFILE_SMALL_IMM;
|
||||
inst->src[i].index = imm;
|
||||
}
|
||||
progress = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ resize_qreg_array(struct vc4_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();
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ vc4_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_logw("unknown swizzle");
|
||||
FALLTHROUGH;
|
||||
case PIPE_SWIZZLE_0:
|
||||
return nir_imm_float(b, 0.0);
|
||||
|
|
@ -1193,7 +1193,7 @@ ntq_emit_alu(struct vc4_compile *c, nir_alu_instr *instr)
|
|||
case nir_op_ilt32:
|
||||
case nir_op_ult32:
|
||||
if (!ntq_emit_comparison(c, &result, instr, instr)) {
|
||||
fprintf(stderr, "Bad comparison instruction\n");
|
||||
mesa_loge("Bad comparison instruction");
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -1289,9 +1289,8 @@ ntq_emit_alu(struct vc4_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();
|
||||
}
|
||||
|
||||
|
|
@ -1842,9 +1841,8 @@ ntq_emit_intrinsic(struct vc4_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));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1865,8 +1863,7 @@ static void
|
|||
ntq_emit_if(struct vc4_compile *c, nir_if *if_stmt)
|
||||
{
|
||||
if (!c->vc4->screen->has_control_flow) {
|
||||
fprintf(stderr,
|
||||
"IF statement support requires updated kernel.\n");
|
||||
mesa_loge("IF statement support requires updated kernel.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1999,9 +1996,8 @@ ntq_emit_instr(struct vc4_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();
|
||||
}
|
||||
}
|
||||
|
|
@ -2021,8 +2017,7 @@ ntq_emit_loop(struct vc4_compile *c, nir_loop *loop)
|
|||
{
|
||||
assert(!nir_loop_has_continue_construct(loop));
|
||||
if (!c->vc4->screen->has_control_flow) {
|
||||
fprintf(stderr,
|
||||
"loop support requires updated kernel.\n");
|
||||
mesa_loge("loop support requires updated kernel.");
|
||||
ntq_emit_cf_list(c, &loop->body);
|
||||
return;
|
||||
}
|
||||
|
|
@ -2078,7 +2073,7 @@ ntq_emit_loop(struct vc4_compile *c, nir_loop *loop)
|
|||
static void
|
||||
ntq_emit_function(struct vc4_compile *c, nir_function_impl *func)
|
||||
{
|
||||
fprintf(stderr, "FUNCTIONS not handled.\n");
|
||||
mesa_loge("FUNCTIONS not handled.");
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -2104,7 +2099,7 @@ ntq_emit_cf_list(struct vc4_compile *c, struct exec_list *list)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unknown NIR node type\n");
|
||||
mesa_loge("Unknown NIR node type");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2302,10 +2297,10 @@ vc4_shader_ntq(struct vc4_context *vc4, enum qstage stage,
|
|||
NIR_PASS(_, c->s, nir_trivialize_registers);
|
||||
|
||||
if (VC4_DBG(NIR)) {
|
||||
fprintf(stderr, "%s prog %d/%d NIR:\n",
|
||||
qir_get_stage_name(c->stage),
|
||||
c->program_id, c->variant_id);
|
||||
nir_print_shader(c->s, stderr);
|
||||
mesa_logi("%s prog %d/%d NIR:",
|
||||
qir_get_stage_name(c->stage),
|
||||
c->program_id, c->variant_id);
|
||||
nir_log_shaderi(c->s);
|
||||
}
|
||||
|
||||
nir_to_qir(c);
|
||||
|
|
@ -2336,11 +2331,10 @@ vc4_shader_ntq(struct vc4_context *vc4, enum qstage stage,
|
|||
}
|
||||
|
||||
if (VC4_DBG(QIR)) {
|
||||
fprintf(stderr, "%s prog %d/%d pre-opt QIR:\n",
|
||||
qir_get_stage_name(c->stage),
|
||||
c->program_id, c->variant_id);
|
||||
qir_dump(c);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi("%s prog %d/%d pre-opt QIR:",
|
||||
qir_get_stage_name(c->stage),
|
||||
c->program_id, c->variant_id);
|
||||
qir_dumpi(c);
|
||||
}
|
||||
|
||||
qir_optimize(c);
|
||||
|
|
@ -2350,11 +2344,10 @@ vc4_shader_ntq(struct vc4_context *vc4, enum qstage stage,
|
|||
qir_emit_uniform_stream_resets(c);
|
||||
|
||||
if (VC4_DBG(QIR)) {
|
||||
fprintf(stderr, "%s prog %d/%d QIR:\n",
|
||||
qir_get_stage_name(c->stage),
|
||||
c->program_id, c->variant_id);
|
||||
qir_dump(c);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi("%s prog %d/%d QIR:",
|
||||
qir_get_stage_name(c->stage),
|
||||
c->program_id, c->variant_id);
|
||||
qir_dumpi(c);
|
||||
}
|
||||
|
||||
qir_reorder_uniforms(c);
|
||||
|
|
@ -2497,10 +2490,8 @@ vc4_shader_state_create(struct pipe_context *pctx,
|
|||
assert(cso->type == PIPE_SHADER_IR_TGSI);
|
||||
|
||||
if (VC4_DBG(TGSI)) {
|
||||
fprintf(stderr, "prog %d TGSI:\n",
|
||||
so->program_id);
|
||||
mesa_logd("prog %d TGSI:", so->program_id);
|
||||
tgsi_dump(cso->tokens, 0);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
s = tgsi_to_nir(cso->tokens, pctx->screen, false);
|
||||
}
|
||||
|
|
@ -2548,11 +2539,10 @@ vc4_shader_state_create(struct pipe_context *pctx,
|
|||
so->base.ir.nir = s;
|
||||
|
||||
if (VC4_DBG(NIR)) {
|
||||
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 (VC4_DBG(SHADERDB)) {
|
||||
|
|
|
|||
|
|
@ -490,19 +490,19 @@ qir_dump_inst(struct vc4_compile *c, struct qinst *inst)
|
|||
return dump_inst;
|
||||
}
|
||||
|
||||
void
|
||||
qir_dump(struct vc4_compile *c)
|
||||
static void
|
||||
qir_dump(struct log_stream *stream, struct vc4_compile *c)
|
||||
{
|
||||
int ip = 0;
|
||||
int pressure = 0;
|
||||
|
||||
qir_for_each_block(block, c) {
|
||||
fprintf(stderr, "BLOCK %d:\n", block->index);
|
||||
mesa_log_stream_printf(stream, "BLOCK %d:\n", block->index);
|
||||
qir_for_each_inst(inst, block) {
|
||||
if (c->temp_start) {
|
||||
bool first = true;
|
||||
|
||||
fprintf(stderr, "%3d ", pressure);
|
||||
mesa_log_stream_printf(stream, "%3d ", pressure);
|
||||
|
||||
for (int i = 0; i < c->num_temps; i++) {
|
||||
if (c->temp_start[i] != ip)
|
||||
|
|
@ -511,16 +511,16 @@ qir_dump(struct vc4_compile *c)
|
|||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
fprintf(stderr, ", ");
|
||||
mesa_log_stream_printf(stream,", ");
|
||||
}
|
||||
fprintf(stderr, "S%4d", i);
|
||||
mesa_log_stream_printf(stream, "S%4d", i);
|
||||
pressure++;
|
||||
}
|
||||
|
||||
if (first)
|
||||
fprintf(stderr, " ");
|
||||
mesa_log_stream_printf(stream, " ");
|
||||
else
|
||||
fprintf(stderr, " ");
|
||||
mesa_log_stream_printf(stream, " ");
|
||||
}
|
||||
|
||||
if (c->temp_end) {
|
||||
|
|
@ -533,31 +533,46 @@ qir_dump(struct vc4_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 = qir_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
|
||||
qir_dumpi(struct vc4_compile *c) {
|
||||
struct log_stream *stream = mesa_log_streami();
|
||||
qir_dump(stream, c);
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
||||
void
|
||||
qir_dumpe(struct vc4_compile *c) {
|
||||
struct log_stream *stream = mesa_log_streame();
|
||||
qir_dump(stream, c);
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
||||
struct qreg
|
||||
|
|
@ -814,9 +829,8 @@ qir_SF(struct vc4_compile *c, struct qreg src)
|
|||
if (stage_progress) { \
|
||||
progress = true; \
|
||||
if (print_opt_debug) { \
|
||||
fprintf(stderr, \
|
||||
"QIR opt pass %2d: %s progress\n", \
|
||||
pass, #func); \
|
||||
mesa_logi("QIR opt pass %2d: %s progress\n", \
|
||||
pass, #func); \
|
||||
} \
|
||||
qir_validate(c); \
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -553,7 +553,8 @@ bool qir_writes_r4(struct qinst *inst);
|
|||
struct qreg qir_follow_movs(struct vc4_compile *c, struct qreg reg);
|
||||
uint8_t qir_channels_written(struct qinst *inst);
|
||||
|
||||
void qir_dump(struct vc4_compile *c);
|
||||
void qir_dumpi(struct vc4_compile *c);
|
||||
void qir_dumpe(struct vc4_compile *c);
|
||||
char *qir_dump_inst(struct vc4_compile *c, struct qinst *inst);
|
||||
char *qir_describe_uniform(enum quniform_contents contents, uint32_t data,
|
||||
const uint32_t *uniforms);
|
||||
|
|
@ -850,4 +851,13 @@ qir_BRANCH(struct vc4_compile *c, uint8_t cond)
|
|||
qir_for_each_block(_block, c) \
|
||||
qir_for_each_inst_safe(inst, _block)
|
||||
|
||||
#define LOG_INST_OPT(_message, _c, _inst) \
|
||||
for (char *before_inst = debug ? qir_dump_inst(_c, _inst) : NULL, \
|
||||
*_once = (char *)1; \
|
||||
_once; \
|
||||
_once = debug ? (mesa_logd(_message ": \"%s\" to \"%s\"", \
|
||||
before_inst, \
|
||||
qir_dump_inst(_c, _inst)), NULL) \
|
||||
: NULL)
|
||||
|
||||
#endif /* VC4_QIR_H */
|
||||
|
|
|
|||
|
|
@ -530,15 +530,14 @@ dump_state(struct vc4_compile *c, struct schedule_state *state)
|
|||
list_for_each_entry(struct schedule_node, n, &state->dag->heads,
|
||||
dag.link) {
|
||||
char *dump_inst = qir_dump_inst(c, n->inst);
|
||||
fprintf(stderr, "%3d: %s (%d cost)\n", i++, dump_inst,
|
||||
get_register_pressure_cost(state, n->inst));
|
||||
mesa_logi("%3d: %s (%d cost)", i++, dump_inst,
|
||||
get_register_pressure_cost(state, n->inst));
|
||||
|
||||
util_dynarray_foreach(&n->dag.edges, struct dag_edge, edge) {
|
||||
struct schedule_node *child =
|
||||
(struct schedule_node *)edge->child;
|
||||
char *dump_inst = qir_dump_inst(c, child->inst);
|
||||
fprintf(stderr, " - %s (%d parents)\n", dump_inst,
|
||||
child->dag.parent_count);
|
||||
dump_inst = qir_dump_inst(c, child->inst);
|
||||
mesa_logi(" - %s (%d parents)", dump_inst, child->dag.parent_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -613,7 +612,7 @@ schedule_instructions(struct vc4_compile *c,
|
|||
struct qblock *block, struct schedule_state *state)
|
||||
{
|
||||
if (debug) {
|
||||
fprintf(stderr, "initial deps:\n");
|
||||
mesa_logi("initial deps:");
|
||||
dump_state(c, state);
|
||||
}
|
||||
|
||||
|
|
@ -623,12 +622,11 @@ schedule_instructions(struct vc4_compile *c,
|
|||
struct qinst *inst = chosen->inst;
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "current list:\n");
|
||||
mesa_logi("current list:");
|
||||
dump_state(c, state);
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "chose: %s (%d cost)\n",
|
||||
dump_inst,
|
||||
get_register_pressure_cost(state, inst));
|
||||
mesa_logi("chose: %s (%d cost)", dump_inst,
|
||||
get_register_pressure_cost(state, inst));
|
||||
}
|
||||
|
||||
state->time = MAX2(state->time, chosen->unblocked_time);
|
||||
|
|
@ -712,15 +710,15 @@ qir_schedule_instructions(struct vc4_compile *c)
|
|||
{
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "Pre-schedule instructions\n");
|
||||
qir_dump(c);
|
||||
mesa_logi("Pre-schedule instructions");
|
||||
qir_dumpi(c);
|
||||
}
|
||||
|
||||
qir_for_each_block(block, c)
|
||||
qir_schedule_instructions_block(c, block);
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "Post-schedule instructions\n");
|
||||
qir_dump(c);
|
||||
mesa_logi("Post-schedule instructions");
|
||||
qir_dumpi(c);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
static void
|
||||
fail_instr(struct vc4_compile *c, struct qinst *inst, const char *msg)
|
||||
{
|
||||
char *dump_inst = qir_dump_inst(c, inst);
|
||||
fprintf(stderr, "qir_validate: %s: %s\n", msg, dump_inst);
|
||||
char *dump = qir_dump_inst(c, inst);
|
||||
mesa_loge("qir_validate: %s: %s", msg, dump);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "util/log.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include "vc4_qpu_defines.h"
|
||||
|
|
@ -225,7 +226,13 @@ M_ALU2(V8ADDS)
|
|||
M_ALU2(V8SUBS)
|
||||
|
||||
void
|
||||
vc4_qpu_disasm(const uint64_t *instructions, int num_instructions);
|
||||
vc4_qpu_disasm(struct log_stream *stream, const uint64_t *instructions, int num_instructions);
|
||||
|
||||
void
|
||||
vc4_qpu_disasmi(const uint64_t *instructions, int num_instructions);
|
||||
|
||||
void
|
||||
vc4_qpu_disasme(const uint64_t *instructions, int num_instructions);
|
||||
|
||||
const char *
|
||||
vc4_qpu_disasm_pack_mul(uint32_t pack);
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ vc4_qpu_disasm_cond_branch(uint32_t cond)
|
|||
}
|
||||
|
||||
static void
|
||||
print_alu_dst(uint64_t inst, bool is_mul)
|
||||
print_alu_dst(struct log_stream *stream, uint64_t inst, bool is_mul)
|
||||
{
|
||||
bool is_a = is_mul == ((inst & QPU_WS) != 0);
|
||||
uint32_t waddr = (is_mul ?
|
||||
|
|
@ -302,21 +302,21 @@ print_alu_dst(uint64_t inst, bool is_mul)
|
|||
uint32_t pack = QPU_GET_FIELD(inst, QPU_PACK);
|
||||
|
||||
if (waddr <= 31)
|
||||
fprintf(stderr, "r%s%d", file, waddr);
|
||||
mesa_log_stream_printf(stream, "r%s%d", file, waddr);
|
||||
else if (get_special_write_desc(waddr, is_a))
|
||||
fprintf(stderr, "%s", get_special_write_desc(waddr, is_a));
|
||||
mesa_log_stream_printf(stream, "%s", get_special_write_desc(waddr, is_a));
|
||||
else
|
||||
fprintf(stderr, "%s%d?", file, waddr);
|
||||
mesa_log_stream_printf(stream, "%s%d?", file, waddr);
|
||||
|
||||
if (is_mul && (inst & QPU_PM)) {
|
||||
fprintf(stderr, "%s", vc4_qpu_disasm_pack_mul(pack));
|
||||
mesa_log_stream_printf(stream, "%s", vc4_qpu_disasm_pack_mul(pack));
|
||||
} else if (is_a && !(inst & QPU_PM)) {
|
||||
fprintf(stderr, "%s", vc4_qpu_disasm_pack_a(pack));
|
||||
mesa_log_stream_printf(stream, "%s", vc4_qpu_disasm_pack_a(pack));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_alu_src(uint64_t inst, uint32_t mux, bool is_mul)
|
||||
print_alu_src(struct log_stream *stream, uint64_t inst, uint32_t mux, bool is_mul)
|
||||
{
|
||||
bool is_a = mux != QPU_MUX_B;
|
||||
const char *file = is_a ? "a" : "b";
|
||||
|
|
@ -328,37 +328,36 @@ print_alu_src(uint64_t inst, uint32_t mux, bool is_mul)
|
|||
uint32_t si = QPU_GET_FIELD(inst, QPU_SMALL_IMM);
|
||||
|
||||
if (mux <= QPU_MUX_R5) {
|
||||
fprintf(stderr, "r%d", mux);
|
||||
mesa_log_stream_printf(stream, "r%d", mux);
|
||||
if (has_si && is_mul && si >= QPU_SMALL_IMM_MUL_ROT + 1)
|
||||
fprintf(stderr, "+%d", si - QPU_SMALL_IMM_MUL_ROT);
|
||||
mesa_log_stream_printf(stream, "+%d", si - QPU_SMALL_IMM_MUL_ROT);
|
||||
} else if (!is_a && has_si) {
|
||||
if (si <= 15)
|
||||
fprintf(stderr, "%d", si);
|
||||
mesa_log_stream_printf(stream, "%d", si);
|
||||
else if (si <= 31)
|
||||
fprintf(stderr, "%d", -16 + (si - 16));
|
||||
mesa_log_stream_printf(stream, "%d", -16 + (si - 16));
|
||||
else if (si <= 39)
|
||||
fprintf(stderr, "%.1f", (float)(1 << (si - 32)));
|
||||
mesa_log_stream_printf(stream, "%.1f", (float)(1 << (si - 32)));
|
||||
else if (si <= 47)
|
||||
fprintf(stderr, "%f", 1.0f / (1 << (48 - si)));
|
||||
mesa_log_stream_printf(stream, "%f", 1.0f / (1 << (48 - si)));
|
||||
else
|
||||
fprintf(stderr, "<bad imm %d>", si);
|
||||
mesa_log_stream_printf(stream, "<bad imm %d>", si);
|
||||
} else if (raddr <= 31)
|
||||
fprintf(stderr, "r%s%d", file, raddr);
|
||||
mesa_log_stream_printf(stream, "r%s%d", file, raddr);
|
||||
else {
|
||||
if (is_a)
|
||||
fprintf(stderr, "%s", DESC(special_read_a, raddr - 32));
|
||||
else
|
||||
fprintf(stderr, "%s", DESC(special_read_b, raddr - 32));
|
||||
mesa_log_stream_printf(stream, "%s",
|
||||
is_a ? DESC(special_read_a, raddr - 32) :
|
||||
DESC(special_read_b, raddr - 32));
|
||||
}
|
||||
|
||||
if (((mux == QPU_MUX_A && !(inst & QPU_PM)) ||
|
||||
(mux == QPU_MUX_R4 && (inst & QPU_PM)))) {
|
||||
fprintf(stderr, "%s", vc4_qpu_disasm_unpack(unpack));
|
||||
mesa_log_stream_printf(stream, "%s", vc4_qpu_disasm_unpack(unpack));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_add_op(uint64_t inst)
|
||||
print_add_op(struct log_stream *stream, uint64_t inst)
|
||||
{
|
||||
uint32_t op_add = QPU_GET_FIELD(inst, QPU_OP_ADD);
|
||||
uint32_t cond = QPU_GET_FIELD(inst, QPU_COND_ADD);
|
||||
|
|
@ -366,32 +365,28 @@ print_add_op(uint64_t inst)
|
|||
QPU_GET_FIELD(inst, QPU_ADD_A) ==
|
||||
QPU_GET_FIELD(inst, QPU_ADD_B));
|
||||
|
||||
if (is_mov)
|
||||
fprintf(stderr, "mov");
|
||||
else
|
||||
fprintf(stderr, "%s", DESC(qpu_add_opcodes, op_add));
|
||||
mesa_log_stream_printf(stream, "%s", is_mov ? "mov" : DESC(qpu_add_opcodes, op_add));
|
||||
|
||||
if ((inst & QPU_SF) && op_add != QPU_A_NOP)
|
||||
fprintf(stderr, ".sf");
|
||||
mesa_log_stream_printf(stream, ".sf");
|
||||
|
||||
if (op_add != QPU_A_NOP)
|
||||
fprintf(stderr, "%s", vc4_qpu_disasm_cond(cond));
|
||||
mesa_log_stream_printf(stream, "%s", vc4_qpu_disasm_cond(cond));
|
||||
|
||||
fprintf(stderr, " ");
|
||||
print_alu_dst(inst, false);
|
||||
fprintf(stderr, ", ");
|
||||
mesa_log_stream_printf(stream, " ");
|
||||
print_alu_dst(stream, inst, false);
|
||||
mesa_log_stream_printf(stream, ", ");
|
||||
|
||||
print_alu_src(inst, QPU_GET_FIELD(inst, QPU_ADD_A), false);
|
||||
print_alu_src(stream, inst, QPU_GET_FIELD(inst, QPU_ADD_A), false);
|
||||
|
||||
if (!is_mov) {
|
||||
fprintf(stderr, ", ");
|
||||
|
||||
print_alu_src(inst, QPU_GET_FIELD(inst, QPU_ADD_B), false);
|
||||
mesa_log_stream_printf(stream, ", ");
|
||||
print_alu_src(stream, inst, QPU_GET_FIELD(inst, QPU_ADD_B), false);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_mul_op(uint64_t inst)
|
||||
print_mul_op(struct log_stream *stream, uint64_t inst)
|
||||
{
|
||||
uint32_t op_add = QPU_GET_FIELD(inst, QPU_OP_ADD);
|
||||
uint32_t op_mul = QPU_GET_FIELD(inst, QPU_OP_MUL);
|
||||
|
|
@ -400,31 +395,28 @@ print_mul_op(uint64_t inst)
|
|||
QPU_GET_FIELD(inst, QPU_MUL_A) ==
|
||||
QPU_GET_FIELD(inst, QPU_MUL_B));
|
||||
|
||||
if (is_mov)
|
||||
fprintf(stderr, "mov");
|
||||
else
|
||||
fprintf(stderr, "%s", DESC(qpu_mul_opcodes, op_mul));
|
||||
mesa_log_stream_printf(stream, "%s", is_mov ? "mov" : DESC(qpu_mul_opcodes, op_mul));
|
||||
|
||||
if ((inst & QPU_SF) && op_add == QPU_A_NOP)
|
||||
fprintf(stderr, ".sf");
|
||||
mesa_log_stream_printf(stream, ".sf");
|
||||
|
||||
if (op_mul != QPU_M_NOP)
|
||||
fprintf(stderr, "%s", vc4_qpu_disasm_cond(cond));
|
||||
mesa_log_stream_printf(stream, "%s", vc4_qpu_disasm_cond(cond));
|
||||
|
||||
fprintf(stderr, " ");
|
||||
print_alu_dst(inst, true);
|
||||
fprintf(stderr, ", ");
|
||||
mesa_log_stream_printf(stream, " ");
|
||||
print_alu_dst(stream, inst, true);
|
||||
mesa_log_stream_printf(stream, ", ");
|
||||
|
||||
print_alu_src(inst, QPU_GET_FIELD(inst, QPU_MUL_A), true);
|
||||
print_alu_src(stream, inst, QPU_GET_FIELD(inst, QPU_MUL_A), true);
|
||||
|
||||
if (!is_mov) {
|
||||
fprintf(stderr, ", ");
|
||||
print_alu_src(inst, QPU_GET_FIELD(inst, QPU_MUL_B), true);
|
||||
mesa_log_stream_printf(stream, ", ");
|
||||
print_alu_src(stream, inst, QPU_GET_FIELD(inst, QPU_MUL_B), true);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_load_imm(uint64_t inst)
|
||||
print_load_imm(struct log_stream *stream, uint64_t inst)
|
||||
{
|
||||
uint32_t imm = inst;
|
||||
uint32_t waddr_add = QPU_GET_FIELD(inst, QPU_WADDR_ADD);
|
||||
|
|
@ -432,23 +424,22 @@ print_load_imm(uint64_t inst)
|
|||
uint32_t cond_add = QPU_GET_FIELD(inst, QPU_COND_ADD);
|
||||
uint32_t cond_mul = QPU_GET_FIELD(inst, QPU_COND_MUL);
|
||||
|
||||
fprintf(stderr, "load_imm ");
|
||||
mesa_log_stream_printf(stream, "load_imm ");
|
||||
|
||||
print_alu_dst(inst, false);
|
||||
print_alu_dst(stream, inst, false);
|
||||
if (waddr_add != QPU_W_NOP)
|
||||
fprintf(stderr, "%s", vc4_qpu_disasm_cond(cond_add));
|
||||
fprintf(stderr, ", ");
|
||||
mesa_log_stream_printf(stream, "%s", vc4_qpu_disasm_cond(cond_add));
|
||||
mesa_log_stream_printf(stream, ", ");
|
||||
|
||||
print_alu_dst(inst, true);
|
||||
print_alu_dst(stream, inst, true);
|
||||
if (waddr_mul != QPU_W_NOP)
|
||||
fprintf(stderr, "%s", vc4_qpu_disasm_cond(cond_mul));;
|
||||
fprintf(stderr, ", ");
|
||||
mesa_log_stream_printf(stream, "%s", vc4_qpu_disasm_cond(cond_mul));
|
||||
|
||||
fprintf(stderr, "0x%08x (%f)", imm, uif(imm));
|
||||
mesa_log_stream_printf(stream, ", 0x%08x (%f)", imm, uif(imm));
|
||||
}
|
||||
|
||||
void
|
||||
vc4_qpu_disasm(const uint64_t *instructions, int num_instructions)
|
||||
vc4_qpu_disasm(struct log_stream *stream, const uint64_t *instructions, int num_instructions)
|
||||
{
|
||||
for (int i = 0; i < num_instructions; i++) {
|
||||
uint64_t inst = instructions[i];
|
||||
|
|
@ -456,26 +447,41 @@ vc4_qpu_disasm(const uint64_t *instructions, int num_instructions)
|
|||
|
||||
switch (sig) {
|
||||
case QPU_SIG_BRANCH:
|
||||
fprintf(stderr, "branch%s",
|
||||
vc4_qpu_disasm_cond_branch(QPU_GET_FIELD(inst,
|
||||
QPU_BRANCH_COND)));
|
||||
|
||||
fprintf(stderr, " %d", (uint32_t)inst);
|
||||
mesa_log_stream_printf(stream, "branch%s %d",
|
||||
vc4_qpu_disasm_cond_branch(QPU_GET_FIELD(inst,
|
||||
QPU_BRANCH_COND)),
|
||||
(uint32_t)inst);
|
||||
break;
|
||||
|
||||
case QPU_SIG_LOAD_IMM:
|
||||
print_load_imm(inst);
|
||||
print_load_imm(stream, inst);
|
||||
break;
|
||||
default:
|
||||
if (sig != QPU_SIG_NONE)
|
||||
fprintf(stderr, "%s ", DESC(qpu_sig, sig));
|
||||
print_add_op(inst);
|
||||
fprintf(stderr, " ; ");
|
||||
print_mul_op(inst);
|
||||
mesa_log_stream_printf(stream, "%s ", DESC(qpu_sig, sig));
|
||||
print_add_op(stream, inst);
|
||||
mesa_log_stream_printf(stream, " ; ");
|
||||
print_mul_op(stream, inst);
|
||||
break;
|
||||
}
|
||||
|
||||
if (num_instructions != 1)
|
||||
fprintf(stderr, "\n");
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vc4_qpu_disasmi(const uint64_t *instructions, int num_instructions)
|
||||
{
|
||||
struct log_stream *stream = mesa_log_streami();
|
||||
vc4_qpu_disasm(stream, instructions, num_instructions);
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
||||
void
|
||||
vc4_qpu_disasme(const uint64_t *instructions, int num_instructions)
|
||||
{
|
||||
struct log_stream *stream = mesa_log_streame();
|
||||
vc4_qpu_disasm(stream, instructions, num_instructions);
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,16 +32,19 @@
|
|||
static void
|
||||
vc4_dump_program(struct vc4_compile *c)
|
||||
{
|
||||
fprintf(stderr, "%s prog %d/%d QPU:\n",
|
||||
qir_get_stage_name(c->stage),
|
||||
c->program_id, c->variant_id);
|
||||
struct log_stream *stream = mesa_log_streami();
|
||||
|
||||
mesa_log_stream_printf(stream, "%s prog %d/%d QPU:\n",
|
||||
qir_get_stage_name(c->stage),
|
||||
c->program_id, c->variant_id);
|
||||
|
||||
for (int i = 0; i < c->qpu_inst_count; i++) {
|
||||
fprintf(stderr, "0x%016"PRIx64" ", c->qpu_insts[i]);
|
||||
vc4_qpu_disasm(&c->qpu_insts[i], 1);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_log_stream_printf(stream, "0x%016"PRIx64" ", c->qpu_insts[i]);
|
||||
vc4_qpu_disasm(stream, &c->qpu_insts[i], 1);
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -247,7 +250,7 @@ vc4_generate_code_block(struct vc4_compile *c,
|
|||
qir_for_each_inst(qinst, block) {
|
||||
#if 0
|
||||
char *dump_inst = qir_dump_inst(qinst);
|
||||
fprintf(stderr, "translating qinst to qpu: %s\n", dump_inst);
|
||||
mesa_logi(, "Translating qinst to qpu: %s", dump_inst);
|
||||
#endif
|
||||
|
||||
static const struct {
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ process_raddr_deps(struct schedule_state *state, struct schedule_node *n,
|
|||
else
|
||||
add_read_dep(state, state->last_rb[raddr], n);
|
||||
} else {
|
||||
fprintf(stderr, "unknown raddr %d\n", raddr);
|
||||
mesa_loge("unknown raddr %d", raddr);
|
||||
abort();
|
||||
}
|
||||
break;
|
||||
|
|
@ -292,7 +292,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();
|
||||
}
|
||||
}
|
||||
|
|
@ -405,7 +405,7 @@ calculate_deps(struct schedule_state *state, struct schedule_node *n)
|
|||
case QPU_SIG_COVERAGE_LOAD:
|
||||
case QPU_SIG_COLOR_LOAD_END:
|
||||
case QPU_SIG_ALPHA_MASK_LOAD:
|
||||
fprintf(stderr, "Unhandled signal bits %d\n", sig);
|
||||
mesa_loge("Unhandled signal bits %d", sig);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -690,9 +690,8 @@ static void
|
|||
dump_state(struct dag *dag)
|
||||
{
|
||||
list_for_each_entry(struct schedule_node, n, &dag->heads, dag.link) {
|
||||
fprintf(stderr, " t=%4d: ", n->unblocked_time);
|
||||
vc4_qpu_disasm(&n->inst->inst, 1);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi(" t=%4d: ", n->unblocked_time);
|
||||
vc4_qpu_disasmi(&n->inst->inst, 1);
|
||||
|
||||
util_dynarray_foreach(&n->dag.edges, struct dag_edge, edge) {
|
||||
struct schedule_node *child =
|
||||
|
|
@ -700,11 +699,11 @@ dump_state(struct dag *dag)
|
|||
if (!child)
|
||||
continue;
|
||||
|
||||
fprintf(stderr, " - ");
|
||||
vc4_qpu_disasm(&child->inst->inst, 1);
|
||||
fprintf(stderr, " (%d parents, %c)\n",
|
||||
child->dag.parent_count,
|
||||
edge->data ? 'w' : 'r');
|
||||
mesa_logi(" - ");
|
||||
vc4_qpu_disasmi(&child->inst->inst, 1);
|
||||
mesa_logi(" (%d parents, %c)\n",
|
||||
child->dag.parent_count,
|
||||
edge->data ? 'w' : 'r');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -891,12 +890,11 @@ schedule_instructions(struct vc4_compile *c,
|
|||
uint64_t inst = chosen ? chosen->inst->inst : qpu_NOP();
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "t=%4d: current list:\n",
|
||||
time);
|
||||
mesa_logi("t=%4d: current list:\n",
|
||||
time);
|
||||
dump_state(scoreboard->dag);
|
||||
fprintf(stderr, "t=%4d: chose: ", time);
|
||||
vc4_qpu_disasm(&inst, 1);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi("t=%4d: chose: ", time);
|
||||
vc4_qpu_disasmi(&inst, 1);
|
||||
}
|
||||
|
||||
/* Schedule this instruction onto the QPU list. Also try to
|
||||
|
|
@ -929,21 +927,15 @@ schedule_instructions(struct vc4_compile *c,
|
|||
}
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "t=%4d: merging: ",
|
||||
time);
|
||||
vc4_qpu_disasm(&merge->inst->inst, 1);
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, " resulting in: ");
|
||||
vc4_qpu_disasm(&inst, 1);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi("t=%4d: merging: ",
|
||||
time);
|
||||
vc4_qpu_disasmi(&merge->inst->inst, 1);
|
||||
mesa_logi(" resulting in: ");
|
||||
vc4_qpu_disasmi(&inst, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
/* Now that we've scheduled a new instruction, some of its
|
||||
* children can be promoted to the list of instructions ready to
|
||||
* be scheduled. Update the children's unblocked time for this
|
||||
|
|
@ -1096,16 +1088,14 @@ qpu_schedule_instructions(struct vc4_compile *c)
|
|||
scoreboard.last_uniforms_reset_tick = -10;
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "Pre-schedule instructions\n");
|
||||
mesa_logi("Pre-schedule instructions\n");
|
||||
qir_for_each_block(block, c) {
|
||||
fprintf(stderr, "BLOCK %d\n", block->index);
|
||||
mesa_logi("BLOCK %d\n", block->index);
|
||||
list_for_each_entry(struct queued_qpu_inst, q,
|
||||
&block->qpu_inst_list, link) {
|
||||
vc4_qpu_disasm(&q->inst, 1);
|
||||
fprintf(stderr, "\n");
|
||||
vc4_qpu_disasmi(&q->inst, 1);
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
uint32_t cycles = 0;
|
||||
|
|
@ -1128,9 +1118,8 @@ qpu_schedule_instructions(struct vc4_compile *c)
|
|||
assert(next_uniform == c->num_uniforms);
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "Post-schedule instructions\n");
|
||||
vc4_qpu_disasm(c->qpu_insts, c->qpu_inst_count);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_logi("Post-schedule instructions\n");
|
||||
vc4_qpu_disasmi(c->qpu_insts, c->qpu_inst_count);
|
||||
}
|
||||
|
||||
return cycles;
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util/log.h"
|
||||
#include "vc4_qpu.h"
|
||||
|
||||
static void
|
||||
fail_instr(uint64_t inst, const char *msg)
|
||||
{
|
||||
fprintf(stderr, "vc4_qpu_validate: %s: ", msg);
|
||||
vc4_qpu_disasm(&inst, 1);
|
||||
fprintf(stderr, "\n");
|
||||
mesa_loge("vc4_qpu_validate: %s: ", msg);
|
||||
vc4_qpu_disasme(&inst, 1);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -416,8 +416,8 @@ vc4_register_allocate(struct vc4_context *vc4, struct vc4_compile *c)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
fprintf(stderr, "temp %d: bad class bits: 0x%x\n",
|
||||
i, class_bits[i]);
|
||||
mesa_loge("temp %d: bad class bits: 0x%x",
|
||||
i, class_bits[i]);
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
|
|
@ -437,8 +437,8 @@ vc4_register_allocate(struct vc4_context *vc4, struct vc4_compile *c)
|
|||
bool ok = ra_allocate(g);
|
||||
if (!ok) {
|
||||
if (!c->fs_threaded) {
|
||||
fprintf(stderr, "Failed to register allocate:\n");
|
||||
qir_dump(c);
|
||||
mesa_loge("Failed to register allocate:");
|
||||
qir_dumpe(c);
|
||||
}
|
||||
|
||||
c->failed = true;
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ vc4_resource_bo_alloc(struct vc4_resource *rsc)
|
|||
struct vc4_bo *bo;
|
||||
|
||||
if (VC4_DBG(SURFACE)) {
|
||||
fprintf(stderr, "alloc %p: size %d + offset %d -> %d\n",
|
||||
rsc,
|
||||
rsc->slices[0].size,
|
||||
rsc->slices[0].offset,
|
||||
rsc->slices[0].offset +
|
||||
rsc->slices[0].size +
|
||||
rsc->cube_map_stride * (prsc->array_size - 1));
|
||||
mesa_logd("alloc %p: size %d + offset %d -> %d",
|
||||
rsc,
|
||||
rsc->slices[0].size,
|
||||
rsc->slices[0].offset,
|
||||
rsc->slices[0].offset +
|
||||
rsc->slices[0].size +
|
||||
rsc->cube_map_stride * (prsc->array_size - 1));
|
||||
}
|
||||
|
||||
bo = vc4_bo_alloc(vc4_screen(pscreen),
|
||||
|
|
@ -195,7 +195,7 @@ vc4_resource_transfer_map(struct pipe_context *pctx,
|
|||
else
|
||||
buf = vc4_bo_map(rsc->bo);
|
||||
if (!buf) {
|
||||
fprintf(stderr, "Failed to map bo\n");
|
||||
mesa_loge("Failed to map bo");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ vc4_resource_get_handle(struct pipe_screen *pscreen,
|
|||
/* This could probably be supported, assuming that a
|
||||
* control node was used for pl111.
|
||||
*/
|
||||
fprintf(stderr, "flink unsupported with pl111\n");
|
||||
mesa_loge("flink unsupported with pl111");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -465,16 +465,15 @@ vc4_setup_slices(struct vc4_screen *screen, struct vc4_resource *rsc,
|
|||
[VC4_TILING_FORMAT_LT] = 'L',
|
||||
[VC4_TILING_FORMAT_T] = 'T'
|
||||
};
|
||||
fprintf(stderr,
|
||||
"rsc %s %p (format %s: vc4 %d), %dx%d: "
|
||||
"level %d (%c) -> %dx%d, stride %d@0x%08x\n",
|
||||
caller, rsc,
|
||||
util_format_short_name(prsc->format),
|
||||
rsc->vc4_format,
|
||||
prsc->width0, prsc->height0,
|
||||
i, tiling_chars[slice->tiling],
|
||||
level_width, level_height,
|
||||
slice->stride, slice->offset);
|
||||
mesa_logd("rsc %s %p (format %s: vc4 %d), %dx%d: "
|
||||
"level %d (%c) -> %dx%d, stride %d@0x%08x",
|
||||
caller, rsc,
|
||||
util_format_short_name(prsc->format),
|
||||
rsc->vc4_format,
|
||||
prsc->width0, prsc->height0,
|
||||
i, tiling_chars[slice->tiling],
|
||||
level_width, level_height,
|
||||
slice->stride, slice->offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -596,7 +595,7 @@ vc4_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");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -679,9 +678,8 @@ vc4_resource_from_handle(struct pipe_screen *pscreen,
|
|||
rsc->bo = vc4_bo_open_dmabuf(screen, whandle->handle);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"Attempt to import unsupported handle type %d\n",
|
||||
whandle->type);
|
||||
mesa_logw("Attempt to import unsupported handle type %d",
|
||||
whandle->type);
|
||||
}
|
||||
|
||||
if (!rsc->bo)
|
||||
|
|
@ -697,9 +695,8 @@ vc4_resource_from_handle(struct pipe_screen *pscreen,
|
|||
} else if (whandle->modifier == DRM_FORMAT_MOD_INVALID) {
|
||||
whandle->modifier = get_tiling.modifier;
|
||||
} else if (whandle->modifier != get_tiling.modifier) {
|
||||
fprintf(stderr,
|
||||
"Modifier 0x%llx vs. tiling (0x%llx) mismatch\n",
|
||||
(long long)whandle->modifier, (long long)get_tiling.modifier);
|
||||
mesa_loge("Modifier 0x%llx vs. tiling (0x%llx) mismatch",
|
||||
(long long)whandle->modifier, (long long)get_tiling.modifier);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -711,9 +708,8 @@ vc4_resource_from_handle(struct pipe_screen *pscreen,
|
|||
rsc->tiled = true;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"Attempt to import unsupported modifier 0x%llx\n",
|
||||
(long long)whandle->modifier);
|
||||
mesa_logw("Attempt to import unsupported modifier 0x%llx",
|
||||
(long long)whandle->modifier);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -722,10 +718,9 @@ vc4_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;
|
||||
}
|
||||
|
||||
|
|
@ -733,11 +728,11 @@ vc4_resource_from_handle(struct pipe_screen *pscreen,
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -754,17 +749,12 @@ vc4_resource_from_handle(struct pipe_screen *pscreen,
|
|||
}
|
||||
|
||||
if (rsc->tiled && whandle->stride != slice->stride) {
|
||||
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_once("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) {
|
||||
slice->stride = whandle->stride;
|
||||
|
|
@ -778,7 +768,7 @@ fail:
|
|||
}
|
||||
|
||||
static void
|
||||
vc4_dump_surface_non_msaa(struct pipe_surface *psurf)
|
||||
vc4_dump_surface_non_msaa(struct log_stream *stream, struct pipe_surface *psurf)
|
||||
{
|
||||
struct pipe_resource *prsc = psurf->texture;
|
||||
struct vc4_resource *rsc = vc4_resource(prsc);
|
||||
|
|
@ -792,8 +782,8 @@ vc4_dump_surface_non_msaa(struct pipe_surface *psurf)
|
|||
uint32_t num_found_colors = 0;
|
||||
|
||||
if (rsc->vc4_format != VC4_TEXTURE_TYPE_RGBA32R) {
|
||||
fprintf(stderr, "%s: Unsupported format %s\n",
|
||||
__func__, util_format_short_name(psurf->format));
|
||||
mesa_loge("%s: Unsupported format %s",
|
||||
__func__, util_format_short_name(psurf->format));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -846,8 +836,8 @@ vc4_dump_surface_non_msaa(struct pipe_surface *psurf)
|
|||
for (i = 0; i < ARRAY_SIZE(named_colors); i++) {
|
||||
if (named_colors[i].val ==
|
||||
found_colors[all_found_color]) {
|
||||
fprintf(stderr, "%s",
|
||||
named_colors[i].c);
|
||||
mesa_log_stream_printf(stream, "%s",
|
||||
named_colors[i].c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -856,20 +846,20 @@ vc4_dump_surface_non_msaa(struct pipe_surface *psurf)
|
|||
* end.
|
||||
*/
|
||||
if (i == ARRAY_SIZE(named_colors)) {
|
||||
fprintf(stderr, "%c",
|
||||
'0' + all_found_color);
|
||||
mesa_log_stream_printf(stream, "%c",
|
||||
'0' + all_found_color);
|
||||
}
|
||||
} else {
|
||||
/* If there's no consistent color, print this.
|
||||
*/
|
||||
fprintf(stderr, ".");
|
||||
mesa_log_stream_printf(stream, ".");
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_found_colors; i++) {
|
||||
fprintf(stderr, "color %d: 0x%08x\n", i, found_colors[i]);
|
||||
mesa_log_stream_printf(stream, "color %d: 0x%08x\n", i, found_colors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -903,7 +893,8 @@ vc4_surface_msaa_get_sample(struct pipe_surface *psurf,
|
|||
}
|
||||
|
||||
static void
|
||||
vc4_dump_surface_msaa_char(struct pipe_surface *psurf,
|
||||
vc4_dump_surface_msaa_char(struct log_stream *stream,
|
||||
struct pipe_surface *psurf,
|
||||
uint32_t start_x, uint32_t start_y,
|
||||
uint32_t w, uint32_t h)
|
||||
{
|
||||
|
|
@ -938,19 +929,19 @@ vc4_dump_surface_msaa_char(struct pipe_surface *psurf,
|
|||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(named_colors); i++) {
|
||||
if (named_colors[i].val == all_pix) {
|
||||
fprintf(stderr, "%s",
|
||||
named_colors[i].c);
|
||||
mesa_log_stream_printf(stream, "%s",
|
||||
named_colors[i].c);
|
||||
return;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "x");
|
||||
mesa_log_stream_printf(stream, "x");
|
||||
} else {
|
||||
fprintf(stderr, ".");
|
||||
mesa_log_stream_printf(stream, ".");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vc4_dump_surface_msaa(struct pipe_surface *psurf)
|
||||
vc4_dump_surface_msaa(struct log_stream *stream, struct pipe_surface *psurf)
|
||||
{
|
||||
uint32_t tile_w = 32, tile_h = 32;
|
||||
unsigned width, height;
|
||||
|
|
@ -961,12 +952,12 @@ vc4_dump_surface_msaa(struct pipe_surface *psurf)
|
|||
uint32_t char_w_per_tile = char_w / tiles_w - 1;
|
||||
uint32_t char_h_per_tile = char_h / tiles_h - 1;
|
||||
|
||||
fprintf(stderr, "Surface: %dx%d (%dx MSAA)\n",
|
||||
width, height, psurf->texture->nr_samples);
|
||||
mesa_log_stream_printf(stream, "Surface: %dx%d (%dx MSAA)\n",
|
||||
width, height, psurf->texture->nr_samples);
|
||||
|
||||
for (int x = 0; x < (char_w_per_tile + 1) * tiles_w; x++)
|
||||
fprintf(stderr, "-");
|
||||
fprintf(stderr, "\n");
|
||||
mesa_log_stream_printf(stream, "-");
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
|
||||
for (int ty = 0; ty < height; ty += tile_h) {
|
||||
for (int y = 0; y < char_h_per_tile; y++) {
|
||||
|
|
@ -982,20 +973,21 @@ vc4_dump_surface_msaa(struct pipe_surface *psurf)
|
|||
uint32_t by2 = ((y + 1) * tile_h /
|
||||
char_h_per_tile);
|
||||
|
||||
vc4_dump_surface_msaa_char(psurf,
|
||||
vc4_dump_surface_msaa_char(stream,
|
||||
psurf,
|
||||
tx + bx1,
|
||||
ty + by1,
|
||||
bx2 - bx1,
|
||||
by2 - by1);
|
||||
}
|
||||
fprintf(stderr, "|");
|
||||
mesa_log_stream_printf(stream, "|");
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
}
|
||||
|
||||
for (int x = 0; x < (char_w_per_tile + 1) * tiles_w; x++)
|
||||
fprintf(stderr, "-");
|
||||
fprintf(stderr, "\n");
|
||||
mesa_log_stream_printf(stream, "-");
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1006,10 +998,14 @@ vc4_dump_surface(struct pipe_surface *psurf)
|
|||
if (!psurf)
|
||||
return;
|
||||
|
||||
struct log_stream *stream = mesa_log_streami();
|
||||
|
||||
if (psurf->texture->nr_samples > 1)
|
||||
vc4_dump_surface_msaa(psurf);
|
||||
vc4_dump_surface_msaa(stream, psurf);
|
||||
else
|
||||
vc4_dump_surface_non_msaa(psurf);
|
||||
vc4_dump_surface_non_msaa(stream, psurf);
|
||||
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -422,15 +422,15 @@ vc4_get_chip_info(struct vc4_screen *screen)
|
|||
screen->v3d_ver = 21;
|
||||
return true;
|
||||
} else {
|
||||
fprintf(stderr, "Couldn't get V3D IDENT0: %s\n",
|
||||
strerror(errno));
|
||||
mesa_loge("Couldn't get V3D IDENT0: %s",
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ret = vc4_ioctl(screen->fd, DRM_IOCTL_VC4_GET_PARAM, &ident1);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Couldn't get V3D IDENT1: %s\n",
|
||||
strerror(errno));
|
||||
mesa_loge("Couldn't get V3D IDENT1: %s",
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -439,10 +439,9 @@ vc4_get_chip_info(struct vc4_screen *screen)
|
|||
screen->v3d_ver = major * 10 + minor;
|
||||
|
||||
if (screen->v3d_ver != 21 && screen->v3d_ver != 26) {
|
||||
fprintf(stderr,
|
||||
"V3D %d.%d not supported by this version of Mesa.\n",
|
||||
screen->v3d_ver / 10,
|
||||
screen->v3d_ver % 10);
|
||||
mesa_loge("V3D %d.%d not supported by this version of Mesa.",
|
||||
screen->v3d_ver / 10,
|
||||
screen->v3d_ver % 10);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -273,16 +273,15 @@ vc4_create_simulator_bo(int fd, int handle, unsigned size)
|
|||
int ret = vc4_gem_mmap(fd, handle, &mmap_offset);
|
||||
|
||||
if (ret) {
|
||||
fprintf(stderr, "Failed to get MMAP offset: %d\n",
|
||||
errno);
|
||||
mesa_loge("Failed to get MMAP offset: %d", errno);
|
||||
abort();
|
||||
}
|
||||
sim_bo->gem_vaddr = mmap(NULL, obj->base.size,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||
fd, 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)mmap_offset, (int)obj->base.size);
|
||||
mesa_loge("mmap of bo %d (offset 0x%016llx, size %d) failed",
|
||||
handle, (long long)mmap_offset, (int)obj->base.size);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -404,8 +403,7 @@ vc4_dump_to_file(struct vc4_exec_info *exec)
|
|||
asprintf(&filename, "vc4-dri-%d.dump", dumpno++);
|
||||
FILE *f = fopen(filename, "w+");
|
||||
if (!f) {
|
||||
fprintf(stderr, "Couldn't open %s: %s", filename,
|
||||
strerror(errno));
|
||||
mesa_loge("Couldn't open %s: %s", filename, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -486,9 +484,9 @@ vc4_simulator_submit_cl_ioctl(int fd, struct drm_vc4_submit_cl *args)
|
|||
return ret;
|
||||
|
||||
if (VC4_DBG(CL)) {
|
||||
fprintf(stderr, "RCL:\n");
|
||||
vc4_dump_cl(sim_state.mem + exec.ct1ca,
|
||||
exec.ct1ea - exec.ct1ca, true);
|
||||
mesa_logi("RCL:");
|
||||
vc4_dump_cli(sim_state.mem + exec.ct1ca,
|
||||
exec.ct1ea - exec.ct1ca, true);
|
||||
}
|
||||
|
||||
vc4_dump_to_file(&exec);
|
||||
|
|
@ -496,21 +494,19 @@ vc4_simulator_submit_cl_ioctl(int fd, struct drm_vc4_submit_cl *args)
|
|||
if (exec.ct0ca != exec.ct0ea) {
|
||||
int bfc = simpenrose_do_binning(exec.ct0ca, exec.ct0ea);
|
||||
if (bfc != 1) {
|
||||
fprintf(stderr, "Binning returned %d flushes, should be 1.\n",
|
||||
bfc);
|
||||
fprintf(stderr, "Relocated binning command list:\n");
|
||||
vc4_dump_cl(sim_state.mem + exec.ct0ca,
|
||||
exec.ct0ea - exec.ct0ca, false);
|
||||
mesa_loge("Binning returned %d flushes, should be 1.", bfc);
|
||||
mesa_loge("Relocated binning command list:");
|
||||
vc4_dump_cle(sim_state.mem + exec.ct0ca,
|
||||
exec.ct0ea - exec.ct0ca, false);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
int rfc = simpenrose_do_rendering(exec.ct1ca, exec.ct1ea);
|
||||
if (rfc != 1) {
|
||||
fprintf(stderr, "Rendering returned %d frames, should be 1.\n",
|
||||
rfc);
|
||||
fprintf(stderr, "Relocated render command list:\n");
|
||||
vc4_dump_cl(sim_state.mem + exec.ct1ca,
|
||||
exec.ct1ea - exec.ct1ca, true);
|
||||
mesa_loge("Rendering returned %d frames, should be 1.", rfc);
|
||||
mesa_loge("Relocated render command list:");
|
||||
vc4_dump_cle(sim_state.mem + exec.ct1ca,
|
||||
exec.ct1ea - exec.ct1ca, true);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
@ -658,8 +654,8 @@ vc4_simulator_get_param_ioctl(int fd, struct drm_vc4_get_param *args)
|
|||
return 0;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unknown DRM_IOCTL_VC4_GET_PARAM(%lld)\n",
|
||||
(long long)args->param);
|
||||
mesa_loge("Unknown DRM_IOCTL_VC4_GET_PARAM(%lld)",
|
||||
(long long)args->param);
|
||||
abort();
|
||||
};
|
||||
}
|
||||
|
|
@ -708,7 +704,7 @@ vc4_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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@
|
|||
|
||||
struct vc4_exec_info;
|
||||
|
||||
#define DRM_INFO(...) fprintf(stderr, __VA_ARGS__)
|
||||
#define DRM_ERROR(...) fprintf(stderr, __VA_ARGS__)
|
||||
#define DRM_INFO(...) mesa_logi(__VA_ARGS__)
|
||||
#define DRM_ERROR(...) mesa_loge(__VA_ARGS__)
|
||||
#define kmalloc(size, arg) malloc(size)
|
||||
#define kcalloc(size, count, arg) calloc(size, count)
|
||||
#define kfree(ptr) free(ptr)
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ vc4_get_stage_tex(struct vc4_context *vc4, mesa_shader_stage shader)
|
|||
return &vc4->verttex;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown shader target %d\n", shader);
|
||||
mesa_loge("Unknown shader target %d", shader);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -463,7 +463,7 @@ static uint32_t translate_wrap(uint32_t p_wrap, bool using_nearest)
|
|||
case PIPE_TEX_WRAP_CLAMP:
|
||||
return (using_nearest ? 1 : 3);
|
||||
default:
|
||||
fprintf(stderr, "Unknown wrap mode %d\n", p_wrap);
|
||||
mesa_loge("Unknown wrap mode %d", p_wrap);
|
||||
assert(!"not reached");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,11 +103,11 @@ t_utile_address(uint32_t utile_x, uint32_t utile_y,
|
|||
assert(!(utile_x & 3) && !(utile_y & 3));
|
||||
|
||||
#if 0
|
||||
fprintf(stderr, "utile %d,%d -> %d + %d + %d (stride %d,%d) = %d\n",
|
||||
utile_x, utile_y,
|
||||
tile_offset, stile_offset, utile_offset,
|
||||
utile_stride, tile_stride,
|
||||
tile_offset + stile_offset + utile_offset);
|
||||
mesa_logd("utile %d,%d -> %d + %d + %d (stride %d,%d) = %d",
|
||||
utile_x, utile_y,
|
||||
tile_offset, stile_offset, utile_offset,
|
||||
utile_stride, tile_stride,
|
||||
tile_offset + stile_offset + utile_offset);
|
||||
#endif
|
||||
|
||||
return tile_offset + stile_offset;
|
||||
|
|
|
|||
|
|
@ -351,8 +351,8 @@ vc4_write_uniforms(struct vc4_context *vc4, struct vc4_compiled_shader *shader,
|
|||
uinfo->data[i],
|
||||
gallium_uniforms);
|
||||
|
||||
fprintf(stderr, "%p/%d: 0x%08x %s\n",
|
||||
shader, i, written_val, desc);
|
||||
mesa_logd("%p/%d: 0x%08x %s",
|
||||
shader, i, written_val, desc);
|
||||
|
||||
ralloc_free(desc);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue