From e440d4b48c421721977fc1271fc27d63adc670f8 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Mar 2015 17:43:25 +1000 Subject: [PATCH] gallium: drop some debug code --- src/gallium/auxiliary/Makefile.am | 1 - src/gallium/auxiliary/util/u_debug.c | 112 ------------------ src/gallium/auxiliary/util/u_tile.h | 165 --------------------------- 3 files changed, 278 deletions(-) delete mode 100644 src/gallium/auxiliary/util/u_tile.h diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am index 1869888..537924e 100644 --- a/src/gallium/auxiliary/Makefile.am +++ b/src/gallium/auxiliary/Makefile.am @@ -39,7 +39,6 @@ libgallium_la_SOURCES = \ util/u_string.h \ util/u_surface.h \ util/u_texture.h \ - util/u_tile.h \ cso_cache/cso_cache.h \ cso_cache/cso_hash.h \ tgsi/tgsi_build.h \ diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 38d87d0..590ee14 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -38,7 +38,6 @@ #include "util/u_memory.h" #include "util/u_string.h" #include "util/u_math.h" -#include "util/u_tile.h" #include "util/u_prim.h" #include "util/u_surface.h" @@ -468,117 +467,6 @@ void debug_funclog_enter_exit(const char* f, const int line, const char* file) #ifdef DEBUG -/** - * Dump an image to .ppm file. - * \param format PIPE_FORMAT_x - * \param cpp bytes per pixel - * \param width width in pixels - * \param height height in pixels - * \param stride row stride in bytes - */ -void debug_dump_image(const char *prefix, - enum pipe_format format, unsigned cpp, - unsigned width, unsigned height, - unsigned stride, - const void *data) -{ - /* write a ppm file */ - char filename[256]; - unsigned char *rgb8; - FILE *f; - - util_snprintf(filename, sizeof(filename), "%s.ppm", prefix); - - rgb8 = MALLOC(height * width * 3); - if (!rgb8) { - return; - } - - util_format_translate( - PIPE_FORMAT_R8G8B8_UNORM, - rgb8, width * 3, - 0, 0, - format, - data, stride, - 0, 0, width, height); - - /* Must be opened in binary mode or DOS line ending causes data - * to be read with one byte offset. - */ - f = fopen(filename, "wb"); - if (f) { - fprintf(f, "P6\n"); - fprintf(f, "# ppm-file created by gallium\n"); - fprintf(f, "%i %i\n", width, height); - fprintf(f, "255\n"); - fwrite(rgb8, 1, height * width * 3, f); - fclose(f); - } - else { - fprintf(stderr, "Can't open %s for writing\n", filename); - } - - FREE(rgb8); -} - -/* FIXME: dump resources, not surfaces... */ -void debug_dump_surface(struct pipe_context *pipe, - const char *prefix, - struct pipe_surface *surface) -{ - struct pipe_resource *texture; - struct pipe_transfer *transfer; - void *data; - - if (!surface) - return; - - /* XXX: this doesn't necessarily work, as the driver may be using - * temporary storage for the surface which hasn't been propagated - * back into the texture. Need to nail down the semantics of views - * and transfers a bit better before we can say if extra work needs - * to be done here: - */ - texture = surface->texture; - - data = pipe_transfer_map(pipe, texture, surface->u.tex.level, - surface->u.tex.first_layer, - PIPE_TRANSFER_READ, - 0, 0, surface->width, surface->height, &transfer); - if(!data) - return; - - debug_dump_image(prefix, - texture->format, - util_format_get_blocksize(texture->format), - util_format_get_nblocksx(texture->format, surface->width), - util_format_get_nblocksy(texture->format, surface->height), - transfer->stride, - data); - - pipe->transfer_unmap(pipe, transfer); -} - - -void debug_dump_texture(struct pipe_context *pipe, - const char *prefix, - struct pipe_resource *texture) -{ - struct pipe_surface *surface, surf_tmpl; - - if (!texture) - return; - - /* XXX for now, just dump image for layer=0, level=0 */ - u_surface_default_template(&surf_tmpl, texture); - surface = pipe->create_surface(pipe, texture, &surf_tmpl); - if (surface) { - debug_dump_surface(pipe, prefix, surface); - pipe->surface_destroy(pipe, surface); - } -} - - /** * Print PIPE_TRANSFER_x flags with a message. */ diff --git a/src/gallium/auxiliary/util/u_tile.h b/src/gallium/auxiliary/util/u_tile.h deleted file mode 100644 index a33d7f7..0000000 --- a/src/gallium/auxiliary/util/u_tile.h +++ /dev/null @@ -1,165 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef P_TILE_H -#define P_TILE_H - -#include "pipe/p_compiler.h" -#include "pipe/p_format.h" -#include "pipe/p_state.h" - -struct pipe_context; -struct pipe_transfer; - -/** - * Clip tile against transfer dims. - * - * XXX: this only clips width and height! - * - * \return TRUE if tile is totally clipped, FALSE otherwise - */ -static INLINE boolean -u_clip_tile(uint x, uint y, uint *w, uint *h, const struct pipe_box *box) -{ - if ((int) x >= box->width) - return TRUE; - if ((int) y >= box->height) - return TRUE; - if ((int) (x + *w) > box->width) - *w = box->width - x; - if ((int) (y + *h) > box->height) - *h = box->height - y; - return FALSE; -} - -#ifdef __cplusplus -extern "C" { -#endif - -void -pipe_get_tile_raw(struct pipe_transfer *pt, - const void *src, - uint x, uint y, uint w, uint h, - void *p, int dst_stride); - -void -pipe_put_tile_raw(struct pipe_transfer *pt, - void *dst, - uint x, uint y, uint w, uint h, - const void *p, int src_stride); - - -void -pipe_get_tile_rgba(struct pipe_transfer *pt, - const void *src, - uint x, uint y, uint w, uint h, - float *p); - -void -pipe_get_tile_rgba_format(struct pipe_transfer *pt, - const void *src, - uint x, uint y, uint w, uint h, - enum pipe_format format, - float *p); - -void -pipe_put_tile_rgba(struct pipe_transfer *pt, - void *dst, - uint x, uint y, uint w, uint h, - const float *p); - -void -pipe_put_tile_rgba_format(struct pipe_transfer *pt, - void *dst, - uint x, uint y, uint w, uint h, - enum pipe_format format, - const float *p); - - -void -pipe_get_tile_z(struct pipe_transfer *pt, - const void *src, - uint x, uint y, uint w, uint h, - uint *z); - -void -pipe_put_tile_z(struct pipe_transfer *pt, - void *dst, - uint x, uint y, uint w, uint h, - const uint *z); - -void -pipe_tile_raw_to_rgba(enum pipe_format format, - const void *src, - uint w, uint h, - float *dst, unsigned dst_stride); - -void -pipe_tile_raw_to_unsigned(enum pipe_format format, - const void *src, - uint w, uint h, - unsigned *dst, unsigned dst_stride); - -void -pipe_tile_raw_to_signed(enum pipe_format format, - void *src, - uint w, uint h, - int *dst, unsigned dst_stride); - -void -pipe_get_tile_ui_format(struct pipe_transfer *pt, - const void *src, - uint x, uint y, uint w, uint h, - enum pipe_format format, - unsigned int *p); - -void -pipe_get_tile_i_format(struct pipe_transfer *pt, - const void *src, - uint x, uint y, uint w, uint h, - enum pipe_format format, - int *p); - -void -pipe_put_tile_ui_format(struct pipe_transfer *pt, - void *dst, - uint x, uint y, uint w, uint h, - enum pipe_format format, - const unsigned *p); - -void -pipe_put_tile_i_format(struct pipe_transfer *pt, - void *dst, - uint x, uint y, uint w, uint h, - enum pipe_format format, - const int *p); - -#ifdef __cplusplus -} -#endif - -#endif