17ec681f3Smrg/*
27ec681f3Smrg * Copyright © 2021 Raspberry Pi
37ec681f3Smrg *
47ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a
57ec681f3Smrg * copy of this software and associated documentation files (the "Software"),
67ec681f3Smrg * to deal in the Software without restriction, including without limitation
77ec681f3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
87ec681f3Smrg * and/or sell copies of the Software, and to permit persons to whom the
97ec681f3Smrg * Software is furnished to do so, subject to the following conditions:
107ec681f3Smrg *
117ec681f3Smrg * The above copyright notice and this permission notice (including the next
127ec681f3Smrg * paragraph) shall be included in all copies or substantial portions of the
137ec681f3Smrg * Software.
147ec681f3Smrg *
157ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
167ec681f3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
177ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
187ec681f3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
197ec681f3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
207ec681f3Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
217ec681f3Smrg * IN THE SOFTWARE.
227ec681f3Smrg */
237ec681f3Smrg#ifndef V3DV_META_COMMON_H
247ec681f3Smrg#define V3DV_META_COMMON_H
257ec681f3Smrg
267ec681f3Smrg/* Disable level 0 write, just write following mipmaps */
277ec681f3Smrg#define V3D_TFU_IOA_DIMTW (1 << 0)
287ec681f3Smrg#define V3D_TFU_IOA_FORMAT_SHIFT 3
297ec681f3Smrg#define V3D_TFU_IOA_FORMAT_LINEARTILE 3
307ec681f3Smrg#define V3D_TFU_IOA_FORMAT_UBLINEAR_1_COLUMN 4
317ec681f3Smrg#define V3D_TFU_IOA_FORMAT_UBLINEAR_2_COLUMN 5
327ec681f3Smrg#define V3D_TFU_IOA_FORMAT_UIF_NO_XOR 6
337ec681f3Smrg#define V3D_TFU_IOA_FORMAT_UIF_XOR 7
347ec681f3Smrg
357ec681f3Smrg#define V3D_TFU_ICFG_NUMMM_SHIFT 5
367ec681f3Smrg#define V3D_TFU_ICFG_TTYPE_SHIFT 9
377ec681f3Smrg
387ec681f3Smrg#define V3D_TFU_ICFG_OPAD_SHIFT 22
397ec681f3Smrg
407ec681f3Smrg#define V3D_TFU_ICFG_FORMAT_SHIFT 18
417ec681f3Smrg#define V3D_TFU_ICFG_FORMAT_RASTER 0
427ec681f3Smrg#define V3D_TFU_ICFG_FORMAT_SAND_128 1
437ec681f3Smrg#define V3D_TFU_ICFG_FORMAT_SAND_256 2
447ec681f3Smrg#define V3D_TFU_ICFG_FORMAT_LINEARTILE 11
457ec681f3Smrg#define V3D_TFU_ICFG_FORMAT_UBLINEAR_1_COLUMN 12
467ec681f3Smrg#define V3D_TFU_ICFG_FORMAT_UBLINEAR_2_COLUMN 13
477ec681f3Smrg#define V3D_TFU_ICFG_FORMAT_UIF_NO_XOR 14
487ec681f3Smrg#define V3D_TFU_ICFG_FORMAT_UIF_XOR 15
497ec681f3Smrg
507ec681f3Smrg/**
517ec681f3Smrg * Copy/Clear operations implemented in v3dv_meta_*.c that use the TLB hardware
527ec681f3Smrg * need to figure out TLB programming from the target image data instead of an
537ec681f3Smrg * actual Vulkan framebuffer object. For the most part, the job's frame tiling
547ec681f3Smrg * information is enough for this, however we still need additional information
557ec681f3Smrg * such us the internal type of our single render target, so we use this
567ec681f3Smrg * auxiliary struct to pass that information around.
577ec681f3Smrg */
587ec681f3Smrgstruct v3dv_meta_framebuffer {
597ec681f3Smrg   /* The internal type of the single render target */
607ec681f3Smrg   uint32_t internal_type;
617ec681f3Smrg
627ec681f3Smrg   /* Supertile coverage */
637ec681f3Smrg   uint32_t min_x_supertile;
647ec681f3Smrg   uint32_t min_y_supertile;
657ec681f3Smrg   uint32_t max_x_supertile;
667ec681f3Smrg   uint32_t max_y_supertile;
677ec681f3Smrg
687ec681f3Smrg   /* Format info */
697ec681f3Smrg   VkFormat vk_format;
707ec681f3Smrg   const struct v3dv_format *format;
717ec681f3Smrg   uint8_t internal_depth_type;
727ec681f3Smrg};
737ec681f3Smrg
747ec681f3Smrg#endif
75