Path: blob/21.2-virgl/src/broadcom/common/v3d_tiling.h
4560 views
/*1* Copyright © 2014 Broadcom2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#ifndef V3D_TILING_H24#define V3D_TILING_H2526#include "util/u_box.h"2728/* A UIFblock is a 256-byte region of memory that's 256-byte aligned. These29* will be grouped in 4x4 blocks (left-to-right, then top-to-bottom) in a 4KB30* page. Those pages are then arranged left-to-right, top-to-bottom, to cover31* an image.32*33* The inside of a UIFblock, for packed pixels, will be split into 4 64-byte34* utiles. Utiles may be 8x8 (8bpp), 8x4(16bpp) or 4x4 (32bpp).35*/3637/**38* Tiling mode enum used for v3d_resource.c, which maps directly to the Memory39* Format field of render target and Z/Stencil config.40*/41enum v3d_tiling_mode {42/* Untiled resources. Not valid as texture inputs. */43V3D_TILING_RASTER,4445/* Single line of u-tiles. */46V3D_TILING_LINEARTILE,4748/* Departure from standard 4-UIF block column format. */49V3D_TILING_UBLINEAR_1_COLUMN,5051/* Departure from standard 4-UIF block column format. */52V3D_TILING_UBLINEAR_2_COLUMN,5354/* Normal tiling format: grouped in 4x4 UIFblocks, each of which is55* split 2x2 into utiles.56*/57V3D_TILING_UIF_NO_XOR,5859/* Normal tiling format: grouped in 4x4 UIFblocks, each of which is60* split 2x2 into utiles.61*/62V3D_TILING_UIF_XOR,63};6465uint32_t v3d_utile_width(int cpp) ATTRIBUTE_CONST;66uint32_t v3d_utile_height(int cpp) ATTRIBUTE_CONST;67bool v3d_size_is_lt(uint32_t width, uint32_t height, int cpp) ATTRIBUTE_CONST;68void v3d_load_tiled_image(void *dst, uint32_t dst_stride,69void *src, uint32_t src_stride,70enum v3d_tiling_mode tiling_format, int cpp,71uint32_t image_h,72const struct pipe_box *box);73void v3d_store_tiled_image(void *dst, uint32_t dst_stride,74void *src, uint32_t src_stride,75enum v3d_tiling_mode tiling_format, int cpp,76uint32_t image_h,77const struct pipe_box *box);7879#endif /* V3D_TILING_H */808182