freedreno: Make the slice pitch be bytes, not pixels.
[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->cpp_shift = 0;
40 layout->size = size;
41 layout->format = PIPE_FORMAT_R8_UINT;
42 layout->nr_samples = 1;
43 }
44
45 void
46 fdl_dump_layout(struct fdl_layout *layout)
47 {
48 for (uint32_t level = 0; level < layout->slices[level].size0; level++) {
49 struct fdl_slice *slice = &layout->slices[level];
50 struct fdl_slice *ubwc_slice = &layout->ubwc_slices[level];
51
52 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",
53 util_format_name(layout->format),
54 u_minify(layout->width0, level),
55 u_minify(layout->height0, level),
56 u_minify(layout->depth0, level),
57 layout->cpp, layout->nr_samples,
58 level,
59 slice->pitch,
60 slice->size0, ubwc_slice->size0,
61 slice->size0 / slice->pitch,
62 slice->offset, ubwc_slice->offset,
63 layout->layer_size, layout->ubwc_layer_size,
64 fdl_tile_mode(layout, level));
65 }
66 }