[Mesa-dev] [PATCH 5/5] anv/dump: Add support for dumping framebuffers

Chad Versace chad.versace at intel.com
Thu Jul 7 23:05:24 UTC 2016


On Fri 17 Jun 2016, Jason Ekstrand wrote:
> ---
>  src/intel/vulkan/anv_dump.c        | 127 +++++++++++++++++++++++++++++++++++++
>  src/intel/vulkan/anv_private.h     |  10 +++
>  src/intel/vulkan/genX_cmd_buffer.c |   4 ++
>  3 files changed, 141 insertions(+)

This patch looks very helpful.

> diff --git a/src/intel/vulkan/anv_dump.c b/src/intel/vulkan/anv_dump.c
> index 59a6f2a..1dc5079 100644
> --- a/src/intel/vulkan/anv_dump.c
> +++ b/src/intel/vulkan/anv_dump.c
> @@ -23,11 +23,16 @@
>  
>  #include "anv_private.h"
>  
> +#include "util/list.h"
> +#include "util/ralloc.h"
> +
>  /* This file contains utility functions for help debugging.  They can be
>   * called from GDB or similar to help inspect images and buffers.
>   */

I'd like to see the instructions from your cover letter here at the top
of the file.

>  
>  struct dump_image {
> +   struct list_head link;
> +
>     const char *filename;
>  
>     VkExtent2D extent;



> +      uint32_t b;
> +      for_each_bit(b, iview->image->aspects) {
> +         VkImageAspectFlagBits aspect = (1 << b);
> +         char suffix;
> +         switch (aspect) {
> +         case VK_IMAGE_ASPECT_COLOR_BIT:     suffix = 'c'; break;
> +         case VK_IMAGE_ASPECT_DEPTH_BIT:     suffix = 'd'; break;
> +         case VK_IMAGE_ASPECT_STENCIL_BIT:   suffix = 's'; break;
> +         default:
> +            unreachable("Invalid aspect");
> +         }
> +
> +         char *filename = ralloc_asprintf(dump_ctx, "framebuffer%04d-%d%c.ppm",
> +                                          dump_idx, i, suffix);
> +
> +         dump_add_image(cmd_buffer, (struct anv_image *)iview->image, aspect,
> +                        iview->base_mip, iview->base_layer, filename);

The cast is unneeded. The type is already (struct anv_image *).

Drop the cast and this is
Reviewed-by: Chad Versace <chad.versace at intel.com>


More information about the mesa-dev mailing list