1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2021 Advanced Micro Devices, Inc. 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining 5bf215546Sopenharmony_ci * a copy of this software and associated documentation files (the 6bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 7bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 8bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to 9bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 10bf215546Sopenharmony_ci * the following conditions: 11bf215546Sopenharmony_ci * 12bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 13bf215546Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 14bf215546Sopenharmony_ci * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 15bf215546Sopenharmony_ci * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS 16bf215546Sopenharmony_ci * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 18bf215546Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 19bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE. 20bf215546Sopenharmony_ci * 21bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the 22bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions 23bf215546Sopenharmony_ci * of the Software. 24bf215546Sopenharmony_ci */ 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci#ifndef AC_DRM_FOURCC_H 27bf215546Sopenharmony_ci#define AC_DRM_FOURCC_H 28bf215546Sopenharmony_ci 29bf215546Sopenharmony_ci#ifdef _WIN32 30bf215546Sopenharmony_ci#include <stdint.h> 31bf215546Sopenharmony_citypedef uint64_t __u64; 32bf215546Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_NONE 0 33bf215546Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_AMD 0x02 34bf215546Sopenharmony_ci#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) 35bf215546Sopenharmony_ci#define fourcc_mod_code(vendor, val) \ 36bf215546Sopenharmony_ci ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL)) 37bf215546Sopenharmony_ci#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) 38bf215546Sopenharmony_ci#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) 39bf215546Sopenharmony_ci#define AMD_FMT_MOD fourcc_mod_code(AMD, 0) 40bf215546Sopenharmony_ci#define IS_AMD_FMT_MOD(val) (((val) >> 56) == DRM_FORMAT_MOD_VENDOR_AMD) 41bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_VER_GFX9 1 42bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_VER_GFX10 2 43bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3 44bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_VER_GFX11 4 45bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_GFX9_64K_S 9 46bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_GFX9_64K_D 10 47bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25 48bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_GFX9_64K_D_X 26 49bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27 50bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_GFX11_256K_R_X 31 51bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_BLOCK_64B 0 52bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_BLOCK_128B 1 53bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_VERSION_SHIFT 0 54bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_VERSION_MASK 0xFF 55bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_SHIFT 8 56bf215546Sopenharmony_ci#define AMD_FMT_MOD_TILE_MASK 0x1F 57bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_SHIFT 13 58bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_MASK 0x1 59bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_RETILE_SHIFT 14 60bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_RETILE_MASK 0x1 61bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_PIPE_ALIGN_SHIFT 15 62bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_PIPE_ALIGN_MASK 0x1 63bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_INDEPENDENT_64B_SHIFT 16 64bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_INDEPENDENT_64B_MASK 0x1 65bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_INDEPENDENT_128B_SHIFT 17 66bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_INDEPENDENT_128B_MASK 0x1 67bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_SHIFT 18 68bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_MASK 0x3 69bf215546Sopenharmony_ci#define AMD_FMT_MOD_DCC_CONSTANT_ENCODE_SHIFT 20 70bf215546Sopenharmony_ci#define AMD_FMT_MOD_PIPE_XOR_BITS_SHIFT 21 71bf215546Sopenharmony_ci#define AMD_FMT_MOD_BANK_XOR_BITS_SHIFT 24 72bf215546Sopenharmony_ci#define AMD_FMT_MOD_PACKERS_SHIFT 27 /* aliases with BANK_XOR_BITS */ 73bf215546Sopenharmony_ci#define AMD_FMT_MOD_RB_SHIFT 30 74bf215546Sopenharmony_ci#define AMD_FMT_MOD_RB_MASK 0x7 75bf215546Sopenharmony_ci#define AMD_FMT_MOD_PIPE_SHIFT 33 76bf215546Sopenharmony_ci#define AMD_FMT_MOD_SET(field, value) \ 77bf215546Sopenharmony_ci ((uint64_t)(value) << AMD_FMT_MOD_##field##_SHIFT) 78bf215546Sopenharmony_ci#define AMD_FMT_MOD_GET(field, value) \ 79bf215546Sopenharmony_ci (((value) >> AMD_FMT_MOD_##field##_SHIFT) & AMD_FMT_MOD_##field##_MASK) 80bf215546Sopenharmony_ci#else 81bf215546Sopenharmony_ci#include "drm-uapi/drm_fourcc.h" 82bf215546Sopenharmony_ci#endif 83bf215546Sopenharmony_ci 84bf215546Sopenharmony_ci#endif /* AC_DRM_FOURCC_H */ 85