1/*
2 * Copyright © 2021 Raspberry Pi
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23#ifndef V3DV_META_COMMON_H
24#define V3DV_META_COMMON_H
25
26/* Disable level 0 write, just write following mipmaps */
27#define V3D_TFU_IOA_DIMTW (1 << 0)
28#define V3D_TFU_IOA_FORMAT_SHIFT 3
29#define V3D_TFU_IOA_FORMAT_LINEARTILE 3
30#define V3D_TFU_IOA_FORMAT_UBLINEAR_1_COLUMN 4
31#define V3D_TFU_IOA_FORMAT_UBLINEAR_2_COLUMN 5
32#define V3D_TFU_IOA_FORMAT_UIF_NO_XOR 6
33#define V3D_TFU_IOA_FORMAT_UIF_XOR 7
34
35#define V3D_TFU_ICFG_NUMMM_SHIFT 5
36#define V3D_TFU_ICFG_TTYPE_SHIFT 9
37
38#define V3D_TFU_ICFG_OPAD_SHIFT 22
39
40#define V3D_TFU_ICFG_FORMAT_SHIFT 18
41#define V3D_TFU_ICFG_FORMAT_RASTER 0
42#define V3D_TFU_ICFG_FORMAT_SAND_128 1
43#define V3D_TFU_ICFG_FORMAT_SAND_256 2
44#define V3D_TFU_ICFG_FORMAT_LINEARTILE 11
45#define V3D_TFU_ICFG_FORMAT_UBLINEAR_1_COLUMN 12
46#define V3D_TFU_ICFG_FORMAT_UBLINEAR_2_COLUMN 13
47#define V3D_TFU_ICFG_FORMAT_UIF_NO_XOR 14
48#define V3D_TFU_ICFG_FORMAT_UIF_XOR 15
49
50/**
51 * Copy/Clear operations implemented in v3dv_meta_*.c that use the TLB hardware
52 * need to figure out TLB programming from the target image data instead of an
53 * actual Vulkan framebuffer object. For the most part, the job's frame tiling
54 * information is enough for this, however we still need additional information
55 * such us the internal type of our single render target, so we use this
56 * auxiliary struct to pass that information around.
57 */
58struct v3dv_meta_framebuffer {
59   /* The internal type of the single render target */
60   uint32_t internal_type;
61
62   /* Supertile coverage */
63   uint32_t min_x_supertile;
64   uint32_t min_y_supertile;
65   uint32_t max_x_supertile;
66   uint32_t max_y_supertile;
67
68   /* Format info */
69   VkFormat vk_format;
70   const struct v3dv_format *format;
71   uint8_t internal_depth_type;
72};
73
74#endif
75