17ec681f3Smrg/* 27ec681f3Smrg * Copyright © 2021 Advanced Micro Devices, Inc. 37ec681f3Smrg * 47ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining 57ec681f3Smrg * a copy of this software and associated documentation files (the 67ec681f3Smrg * "Software"), to deal in the Software without restriction, including 77ec681f3Smrg * without limitation the rights to use, copy, modify, merge, publish, 87ec681f3Smrg * distribute, sub license, and/or sell copies of the Software, and to 97ec681f3Smrg * permit persons to whom the Software is furnished to do so, subject to 107ec681f3Smrg * the following conditions: 117ec681f3Smrg * 127ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 137ec681f3Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 147ec681f3Smrg * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 157ec681f3Smrg * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS 167ec681f3Smrg * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 177ec681f3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 187ec681f3Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 197ec681f3Smrg * USE OR OTHER DEALINGS IN THE SOFTWARE. 207ec681f3Smrg * 217ec681f3Smrg * The above copyright notice and this permission notice (including the 227ec681f3Smrg * next paragraph) shall be included in all copies or substantial portions 237ec681f3Smrg * of the Software. 247ec681f3Smrg */ 257ec681f3Smrg 267ec681f3Smrg#ifndef AC_DRM_FOURCC_H 277ec681f3Smrg#define AC_DRM_FOURCC_H 287ec681f3Smrg 297ec681f3Smrg#ifdef _WIN32 307ec681f3Smrg#include <stdint.h> 317ec681f3Smrgtypedef uint64_t __u64; 327ec681f3Smrg#define DRM_FORMAT_MOD_VENDOR_NONE 0 337ec681f3Smrg#define DRM_FORMAT_MOD_VENDOR_AMD 0x02 347ec681f3Smrg#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) 357ec681f3Smrg#define fourcc_mod_code(vendor, val) \ 367ec681f3Smrg ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL)) 377ec681f3Smrg#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) 387ec681f3Smrg#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) 397ec681f3Smrg#define AMD_FMT_MOD fourcc_mod_code(AMD, 0) 407ec681f3Smrg#define IS_AMD_FMT_MOD(val) (((val) >> 56) == DRM_FORMAT_MOD_VENDOR_AMD) 417ec681f3Smrg#define AMD_FMT_MOD_TILE_VER_GFX9 1 427ec681f3Smrg#define AMD_FMT_MOD_TILE_VER_GFX10 2 437ec681f3Smrg#define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3 447ec681f3Smrg#define AMD_FMT_MOD_TILE_GFX9_64K_S 9 457ec681f3Smrg#define AMD_FMT_MOD_TILE_GFX9_64K_D 10 467ec681f3Smrg#define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25 477ec681f3Smrg#define AMD_FMT_MOD_TILE_GFX9_64K_D_X 26 487ec681f3Smrg#define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27 497ec681f3Smrg#define AMD_FMT_MOD_DCC_BLOCK_64B 0 507ec681f3Smrg#define AMD_FMT_MOD_DCC_BLOCK_128B 1 517ec681f3Smrg#define AMD_FMT_MOD_TILE_VERSION_SHIFT 0 527ec681f3Smrg#define AMD_FMT_MOD_TILE_VERSION_MASK 0xFF 537ec681f3Smrg#define AMD_FMT_MOD_TILE_SHIFT 8 547ec681f3Smrg#define AMD_FMT_MOD_TILE_MASK 0x1F 557ec681f3Smrg#define AMD_FMT_MOD_DCC_SHIFT 13 567ec681f3Smrg#define AMD_FMT_MOD_DCC_MASK 0x1 577ec681f3Smrg#define AMD_FMT_MOD_DCC_RETILE_SHIFT 14 587ec681f3Smrg#define AMD_FMT_MOD_DCC_RETILE_MASK 0x1 597ec681f3Smrg#define AMD_FMT_MOD_DCC_PIPE_ALIGN_SHIFT 15 607ec681f3Smrg#define AMD_FMT_MOD_DCC_PIPE_ALIGN_MASK 0x1 617ec681f3Smrg#define AMD_FMT_MOD_DCC_INDEPENDENT_64B_SHIFT 16 627ec681f3Smrg#define AMD_FMT_MOD_DCC_INDEPENDENT_64B_MASK 0x1 637ec681f3Smrg#define AMD_FMT_MOD_DCC_INDEPENDENT_128B_SHIFT 17 647ec681f3Smrg#define AMD_FMT_MOD_DCC_INDEPENDENT_128B_MASK 0x1 657ec681f3Smrg#define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_SHIFT 18 667ec681f3Smrg#define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_MASK 0x3 677ec681f3Smrg#define AMD_FMT_MOD_DCC_CONSTANT_ENCODE_SHIFT 20 687ec681f3Smrg#define AMD_FMT_MOD_PIPE_XOR_BITS_SHIFT 21 697ec681f3Smrg#define AMD_FMT_MOD_BANK_XOR_BITS_SHIFT 24 707ec681f3Smrg#define AMD_FMT_MOD_PACKERS_SHIFT 27 /* aliases with BANK_XOR_BITS */ 717ec681f3Smrg#define AMD_FMT_MOD_RB_SHIFT 30 727ec681f3Smrg#define AMD_FMT_MOD_RB_MASK 0x7 737ec681f3Smrg#define AMD_FMT_MOD_PIPE_SHIFT 33 747ec681f3Smrg#define AMD_FMT_MOD_SET(field, value) \ 757ec681f3Smrg ((uint64_t)(value) << AMD_FMT_MOD_##field##_SHIFT) 767ec681f3Smrg#define AMD_FMT_MOD_GET(field, value) \ 777ec681f3Smrg (((value) >> AMD_FMT_MOD_##field##_SHIFT) & AMD_FMT_MOD_##field##_MASK) 787ec681f3Smrg#else 797ec681f3Smrg#include "drm-uapi/drm_fourcc.h" 807ec681f3Smrg#endif 817ec681f3Smrg 827ec681f3Smrg#endif /* AC_DRM_FOURCC_H */ 83