freedreno: Include the layer size in layout debug.
[mesa.git] / src / freedreno / fdl / freedreno_layout.c
1 /*
2 * Copyright (C) 2018 Rob Clark <robclark@freedesktop.org>
3 * Copyright © 2018 Google, Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 *
24 * Authors:
25 * Rob Clark <robclark@freedesktop.org>
26 */
27
28 #include <stdio.h>
29
30 #include "freedreno_layout.h"
31
32 void
33 fdl_layout_buffer(struct fdl_layout *layout, uint32_t size)
34 {
35 layout->width0 = size;
36 layout->height0 = 1;
37 layout->depth0 = 1;
38 layout->cpp = 1;
39 layout->size = size;
40 layout->format = PIPE_FORMAT_R8_UINT;
41 layout->nr_samples = 1;
42 }
43
44 void
45 fdl_dump_layout(struct fdl_layout *layout)
46 {
47 for (uint32_t level = 0; level < layout->slices[level].size0; level++) {
48 struct fdl_slice *slice = &layout->slices[level];
49 struct fdl_slice *ubwc_slice = &layout->ubwc_slices[level];
50 uint32_t tile_mode = (layout->ubwc_size ?
51 layout->tile_mode : fdl_tile_mode(layout, level));
52
53 fprintf(stderr, "%s: %ux%ux%u@%ux%u:\t%2u: stride=%4u, size=%6u,%6u, aligned_height=%3u, offset=0x%x,0x%x, layersz %5u,%5u tiling=%d\n",
54 util_format_name(layout->format),
55 u_minify(layout->width0, level),
56 u_minify(layout->height0, level),
57 u_minify(layout->depth0, level),
58 layout->cpp, layout->nr_samples,
59 level,
60 slice->pitch * layout->cpp,
61 slice->size0, ubwc_slice->size0,
62 slice->size0 / (slice->pitch * layout->cpp),
63 slice->offset, ubwc_slice->offset,
64 layout->layer_size, layout->ubwc_size,
65 tile_mode);
66 }
67 }