amdgpu_drm.h revision b0ab5608
13f012e29Smrg/* amdgpu_drm.h -- Public header for the amdgpu driver -*- linux-c -*- 23f012e29Smrg * 33f012e29Smrg * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. 43f012e29Smrg * Copyright 2000 VA Linux Systems, Inc., Fremont, California. 53f012e29Smrg * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. 63f012e29Smrg * Copyright 2014 Advanced Micro Devices, Inc. 73f012e29Smrg * 83f012e29Smrg * Permission is hereby granted, free of charge, to any person obtaining a 93f012e29Smrg * copy of this software and associated documentation files (the "Software"), 103f012e29Smrg * to deal in the Software without restriction, including without limitation 113f012e29Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 123f012e29Smrg * and/or sell copies of the Software, and to permit persons to whom the 133f012e29Smrg * Software is furnished to do so, subject to the following conditions: 143f012e29Smrg * 153f012e29Smrg * The above copyright notice and this permission notice shall be included in 163f012e29Smrg * all copies or substantial portions of the Software. 173f012e29Smrg * 183f012e29Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 193f012e29Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 203f012e29Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 213f012e29Smrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 223f012e29Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 233f012e29Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 243f012e29Smrg * OTHER DEALINGS IN THE SOFTWARE. 253f012e29Smrg * 263f012e29Smrg * Authors: 273f012e29Smrg * Kevin E. Martin <martin@valinux.com> 283f012e29Smrg * Gareth Hughes <gareth@valinux.com> 293f012e29Smrg * Keith Whitwell <keith@tungstengraphics.com> 303f012e29Smrg */ 313f012e29Smrg 323f012e29Smrg#ifndef __AMDGPU_DRM_H__ 333f012e29Smrg#define __AMDGPU_DRM_H__ 343f012e29Smrg 353f012e29Smrg#include "drm.h" 363f012e29Smrg 37037b3c26Smrg#if defined(__cplusplus) 38037b3c26Smrgextern "C" { 39037b3c26Smrg#endif 40037b3c26Smrg 413f012e29Smrg#define DRM_AMDGPU_GEM_CREATE 0x00 423f012e29Smrg#define DRM_AMDGPU_GEM_MMAP 0x01 433f012e29Smrg#define DRM_AMDGPU_CTX 0x02 443f012e29Smrg#define DRM_AMDGPU_BO_LIST 0x03 453f012e29Smrg#define DRM_AMDGPU_CS 0x04 463f012e29Smrg#define DRM_AMDGPU_INFO 0x05 473f012e29Smrg#define DRM_AMDGPU_GEM_METADATA 0x06 483f012e29Smrg#define DRM_AMDGPU_GEM_WAIT_IDLE 0x07 493f012e29Smrg#define DRM_AMDGPU_GEM_VA 0x08 503f012e29Smrg#define DRM_AMDGPU_WAIT_CS 0x09 513f012e29Smrg#define DRM_AMDGPU_GEM_OP 0x10 523f012e29Smrg#define DRM_AMDGPU_GEM_USERPTR 0x11 53d8807b2fSmrg#define DRM_AMDGPU_WAIT_FENCES 0x12 54d8807b2fSmrg#define DRM_AMDGPU_VM 0x13 5500a23bdaSmrg#define DRM_AMDGPU_FENCE_TO_HANDLE 0x14 5600a23bdaSmrg#define DRM_AMDGPU_SCHED 0x15 573f012e29Smrg 583f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create) 593f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap) 603f012e29Smrg#define DRM_IOCTL_AMDGPU_CTX DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx) 613f012e29Smrg#define DRM_IOCTL_AMDGPU_BO_LIST DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list) 623f012e29Smrg#define DRM_IOCTL_AMDGPU_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs) 633f012e29Smrg#define DRM_IOCTL_AMDGPU_INFO DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info) 643f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_METADATA DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_METADATA, struct drm_amdgpu_gem_metadata) 653f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle) 663f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_VA DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_VA, struct drm_amdgpu_gem_va) 673f012e29Smrg#define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs) 683f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op) 693f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr) 70d8807b2fSmrg#define DRM_IOCTL_AMDGPU_WAIT_FENCES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences) 71d8807b2fSmrg#define DRM_IOCTL_AMDGPU_VM DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_VM, union drm_amdgpu_vm) 7200a23bdaSmrg#define DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_FENCE_TO_HANDLE, union drm_amdgpu_fence_to_handle) 7300a23bdaSmrg#define DRM_IOCTL_AMDGPU_SCHED DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_SCHED, union drm_amdgpu_sched) 743f012e29Smrg 757cdc0497Smrg/** 767cdc0497Smrg * DOC: memory domains 777cdc0497Smrg * 787cdc0497Smrg * %AMDGPU_GEM_DOMAIN_CPU System memory that is not GPU accessible. 797cdc0497Smrg * Memory in this pool could be swapped out to disk if there is pressure. 807cdc0497Smrg * 817cdc0497Smrg * %AMDGPU_GEM_DOMAIN_GTT GPU accessible system memory, mapped into the 827cdc0497Smrg * GPU's virtual address space via gart. Gart memory linearizes non-contiguous 830ed5401bSmrg * pages of system memory, allows GPU access system memory in a linearized 847cdc0497Smrg * fashion. 857cdc0497Smrg * 867cdc0497Smrg * %AMDGPU_GEM_DOMAIN_VRAM Local video memory. For APUs, it is memory 877cdc0497Smrg * carved out by the BIOS. 887cdc0497Smrg * 897cdc0497Smrg * %AMDGPU_GEM_DOMAIN_GDS Global on-chip data storage used to share data 907cdc0497Smrg * across shader threads. 917cdc0497Smrg * 927cdc0497Smrg * %AMDGPU_GEM_DOMAIN_GWS Global wave sync, used to synchronize the 937cdc0497Smrg * execution of all the waves on a device. 947cdc0497Smrg * 957cdc0497Smrg * %AMDGPU_GEM_DOMAIN_OA Ordered append, used by 3D or Compute engines 967cdc0497Smrg * for appending data. 977cdc0497Smrg */ 983f012e29Smrg#define AMDGPU_GEM_DOMAIN_CPU 0x1 993f012e29Smrg#define AMDGPU_GEM_DOMAIN_GTT 0x2 1003f012e29Smrg#define AMDGPU_GEM_DOMAIN_VRAM 0x4 1013f012e29Smrg#define AMDGPU_GEM_DOMAIN_GDS 0x8 1023f012e29Smrg#define AMDGPU_GEM_DOMAIN_GWS 0x10 1033f012e29Smrg#define AMDGPU_GEM_DOMAIN_OA 0x20 1047cdc0497Smrg#define AMDGPU_GEM_DOMAIN_MASK (AMDGPU_GEM_DOMAIN_CPU | \ 1057cdc0497Smrg AMDGPU_GEM_DOMAIN_GTT | \ 1067cdc0497Smrg AMDGPU_GEM_DOMAIN_VRAM | \ 1077cdc0497Smrg AMDGPU_GEM_DOMAIN_GDS | \ 1087cdc0497Smrg AMDGPU_GEM_DOMAIN_GWS | \ 1097cdc0497Smrg AMDGPU_GEM_DOMAIN_OA) 1103f012e29Smrg 1113f012e29Smrg/* Flag that CPU access will be required for the case of VRAM domain */ 1123f012e29Smrg#define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0) 1133f012e29Smrg/* Flag that CPU access will not work, this VRAM domain is invisible */ 1143f012e29Smrg#define AMDGPU_GEM_CREATE_NO_CPU_ACCESS (1 << 1) 1153f012e29Smrg/* Flag that USWC attributes should be used for GTT */ 1163f012e29Smrg#define AMDGPU_GEM_CREATE_CPU_GTT_USWC (1 << 2) 117037b3c26Smrg/* Flag that the memory should be in VRAM and cleared */ 118037b3c26Smrg#define AMDGPU_GEM_CREATE_VRAM_CLEARED (1 << 3) 119d8807b2fSmrg/* Flag that allocating the BO should use linear VRAM */ 120d8807b2fSmrg#define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS (1 << 5) 12100a23bdaSmrg/* Flag that BO is always valid in this VM */ 12200a23bdaSmrg#define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6) 12300a23bdaSmrg/* Flag that BO sharing will be explicitly synchronized */ 12400a23bdaSmrg#define AMDGPU_GEM_CREATE_EXPLICIT_SYNC (1 << 7) 1257cdc0497Smrg/* Flag that indicates allocating MQD gart on GFX9, where the mtype 12641687f09Smrg * for the second page onward should be set to NC. It should never 12741687f09Smrg * be used by user space applications. 1287cdc0497Smrg */ 12941687f09Smrg#define AMDGPU_GEM_CREATE_CP_MQD_GFX9 (1 << 8) 13088f8a8d2Smrg/* Flag that BO may contain sensitive data that must be wiped before 13188f8a8d2Smrg * releasing the memory 13288f8a8d2Smrg */ 13388f8a8d2Smrg#define AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE (1 << 9) 13441687f09Smrg/* Flag that BO will be encrypted and that the TMZ bit should be 13541687f09Smrg * set in the PTEs when mapping this buffer via GPUVM or 13641687f09Smrg * accessing it with various hw blocks 13741687f09Smrg */ 13841687f09Smrg#define AMDGPU_GEM_CREATE_ENCRYPTED (1 << 10) 13949ef06a4Smrg/* Flag that BO will be used only in preemptible context, which does 14049ef06a4Smrg * not require GTT memory accounting 14149ef06a4Smrg */ 14249ef06a4Smrg#define AMDGPU_GEM_CREATE_PREEMPTIBLE (1 << 11) 1433f012e29Smrg 1443f012e29Smrgstruct drm_amdgpu_gem_create_in { 1453f012e29Smrg /** the requested memory size */ 146d8807b2fSmrg __u64 bo_size; 1473f012e29Smrg /** physical start_addr alignment in bytes for some HW requirements */ 148d8807b2fSmrg __u64 alignment; 1493f012e29Smrg /** the requested memory domains */ 150d8807b2fSmrg __u64 domains; 1513f012e29Smrg /** allocation flags */ 152d8807b2fSmrg __u64 domain_flags; 1533f012e29Smrg}; 1543f012e29Smrg 1553f012e29Smrgstruct drm_amdgpu_gem_create_out { 1563f012e29Smrg /** returned GEM object handle */ 157d8807b2fSmrg __u32 handle; 158d8807b2fSmrg __u32 _pad; 1593f012e29Smrg}; 1603f012e29Smrg 1613f012e29Smrgunion drm_amdgpu_gem_create { 1623f012e29Smrg struct drm_amdgpu_gem_create_in in; 1633f012e29Smrg struct drm_amdgpu_gem_create_out out; 1643f012e29Smrg}; 1653f012e29Smrg 1663f012e29Smrg/** Opcode to create new residency list. */ 1673f012e29Smrg#define AMDGPU_BO_LIST_OP_CREATE 0 1683f012e29Smrg/** Opcode to destroy previously created residency list */ 1693f012e29Smrg#define AMDGPU_BO_LIST_OP_DESTROY 1 1703f012e29Smrg/** Opcode to update resource information in the list */ 1713f012e29Smrg#define AMDGPU_BO_LIST_OP_UPDATE 2 1723f012e29Smrg 1733f012e29Smrgstruct drm_amdgpu_bo_list_in { 1743f012e29Smrg /** Type of operation */ 175d8807b2fSmrg __u32 operation; 1763f012e29Smrg /** Handle of list or 0 if we want to create one */ 177d8807b2fSmrg __u32 list_handle; 1783f012e29Smrg /** Number of BOs in list */ 179d8807b2fSmrg __u32 bo_number; 1803f012e29Smrg /** Size of each element describing BO */ 181d8807b2fSmrg __u32 bo_info_size; 1823f012e29Smrg /** Pointer to array describing BOs */ 183d8807b2fSmrg __u64 bo_info_ptr; 1843f012e29Smrg}; 1853f012e29Smrg 1863f012e29Smrgstruct drm_amdgpu_bo_list_entry { 1873f012e29Smrg /** Handle of BO */ 188d8807b2fSmrg __u32 bo_handle; 1893f012e29Smrg /** New (if specified) BO priority to be used during migration */ 190d8807b2fSmrg __u32 bo_priority; 1913f012e29Smrg}; 1923f012e29Smrg 1933f012e29Smrgstruct drm_amdgpu_bo_list_out { 1943f012e29Smrg /** Handle of resource list */ 195d8807b2fSmrg __u32 list_handle; 196d8807b2fSmrg __u32 _pad; 1973f012e29Smrg}; 1983f012e29Smrg 1993f012e29Smrgunion drm_amdgpu_bo_list { 2003f012e29Smrg struct drm_amdgpu_bo_list_in in; 2013f012e29Smrg struct drm_amdgpu_bo_list_out out; 2023f012e29Smrg}; 2033f012e29Smrg 2043f012e29Smrg/* context related */ 2053f012e29Smrg#define AMDGPU_CTX_OP_ALLOC_CTX 1 2063f012e29Smrg#define AMDGPU_CTX_OP_FREE_CTX 2 2073f012e29Smrg#define AMDGPU_CTX_OP_QUERY_STATE 3 2087cdc0497Smrg#define AMDGPU_CTX_OP_QUERY_STATE2 4 2090ed5401bSmrg#define AMDGPU_CTX_OP_GET_STABLE_PSTATE 5 2100ed5401bSmrg#define AMDGPU_CTX_OP_SET_STABLE_PSTATE 6 2113f012e29Smrg 2123f012e29Smrg/* GPU reset status */ 2133f012e29Smrg#define AMDGPU_CTX_NO_RESET 0 2143f012e29Smrg/* this the context caused it */ 2153f012e29Smrg#define AMDGPU_CTX_GUILTY_RESET 1 2163f012e29Smrg/* some other context caused it */ 2173f012e29Smrg#define AMDGPU_CTX_INNOCENT_RESET 2 2183f012e29Smrg/* unknown cause */ 2193f012e29Smrg#define AMDGPU_CTX_UNKNOWN_RESET 3 2203f012e29Smrg 22188f8a8d2Smrg/* indicate gpu reset occured after ctx created */ 2227cdc0497Smrg#define AMDGPU_CTX_QUERY2_FLAGS_RESET (1<<0) 22388f8a8d2Smrg/* indicate vram lost occured after ctx created */ 2247cdc0497Smrg#define AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST (1<<1) 2257cdc0497Smrg/* indicate some job from this context once cause gpu hang */ 2267cdc0497Smrg#define AMDGPU_CTX_QUERY2_FLAGS_GUILTY (1<<2) 2275324fb0dSmrg/* indicate some errors are detected by RAS */ 2285324fb0dSmrg#define AMDGPU_CTX_QUERY2_FLAGS_RAS_CE (1<<3) 2295324fb0dSmrg#define AMDGPU_CTX_QUERY2_FLAGS_RAS_UE (1<<4) 2307cdc0497Smrg 23100a23bdaSmrg/* Context priority level */ 23200a23bdaSmrg#define AMDGPU_CTX_PRIORITY_UNSET -2048 23300a23bdaSmrg#define AMDGPU_CTX_PRIORITY_VERY_LOW -1023 23400a23bdaSmrg#define AMDGPU_CTX_PRIORITY_LOW -512 23500a23bdaSmrg#define AMDGPU_CTX_PRIORITY_NORMAL 0 23688f8a8d2Smrg/* 23788f8a8d2Smrg * When used in struct drm_amdgpu_ctx_in, a priority above NORMAL requires 23888f8a8d2Smrg * CAP_SYS_NICE or DRM_MASTER 23988f8a8d2Smrg*/ 24000a23bdaSmrg#define AMDGPU_CTX_PRIORITY_HIGH 512 24100a23bdaSmrg#define AMDGPU_CTX_PRIORITY_VERY_HIGH 1023 24200a23bdaSmrg 2430ed5401bSmrg/* select a stable profiling pstate for perfmon tools */ 2440ed5401bSmrg#define AMDGPU_CTX_STABLE_PSTATE_FLAGS_MASK 0xf 2450ed5401bSmrg#define AMDGPU_CTX_STABLE_PSTATE_NONE 0 2460ed5401bSmrg#define AMDGPU_CTX_STABLE_PSTATE_STANDARD 1 2470ed5401bSmrg#define AMDGPU_CTX_STABLE_PSTATE_MIN_SCLK 2 2480ed5401bSmrg#define AMDGPU_CTX_STABLE_PSTATE_MIN_MCLK 3 2490ed5401bSmrg#define AMDGPU_CTX_STABLE_PSTATE_PEAK 4 2500ed5401bSmrg 2513f012e29Smrgstruct drm_amdgpu_ctx_in { 2523f012e29Smrg /** AMDGPU_CTX_OP_* */ 253d8807b2fSmrg __u32 op; 2540ed5401bSmrg /** Flags */ 255d8807b2fSmrg __u32 flags; 256d8807b2fSmrg __u32 ctx_id; 25788f8a8d2Smrg /** AMDGPU_CTX_PRIORITY_* */ 25800a23bdaSmrg __s32 priority; 2593f012e29Smrg}; 2603f012e29Smrg 2613f012e29Smrgunion drm_amdgpu_ctx_out { 2623f012e29Smrg struct { 263d8807b2fSmrg __u32 ctx_id; 264d8807b2fSmrg __u32 _pad; 2653f012e29Smrg } alloc; 2663f012e29Smrg 2673f012e29Smrg struct { 2683f012e29Smrg /** For future use, no flags defined so far */ 269d8807b2fSmrg __u64 flags; 2703f012e29Smrg /** Number of resets caused by this context so far. */ 271d8807b2fSmrg __u32 hangs; 2723f012e29Smrg /** Reset status since the last call of the ioctl. */ 273d8807b2fSmrg __u32 reset_status; 2743f012e29Smrg } state; 2750ed5401bSmrg 2760ed5401bSmrg struct { 2770ed5401bSmrg __u32 flags; 2780ed5401bSmrg __u32 _pad; 2790ed5401bSmrg } pstate; 2803f012e29Smrg}; 2813f012e29Smrg 2823f012e29Smrgunion drm_amdgpu_ctx { 2833f012e29Smrg struct drm_amdgpu_ctx_in in; 2843f012e29Smrg union drm_amdgpu_ctx_out out; 2853f012e29Smrg}; 2863f012e29Smrg 287d8807b2fSmrg/* vm ioctl */ 288d8807b2fSmrg#define AMDGPU_VM_OP_RESERVE_VMID 1 289d8807b2fSmrg#define AMDGPU_VM_OP_UNRESERVE_VMID 2 290d8807b2fSmrg 291d8807b2fSmrgstruct drm_amdgpu_vm_in { 292d8807b2fSmrg /** AMDGPU_VM_OP_* */ 293d8807b2fSmrg __u32 op; 294d8807b2fSmrg __u32 flags; 295d8807b2fSmrg}; 296d8807b2fSmrg 297d8807b2fSmrgstruct drm_amdgpu_vm_out { 298d8807b2fSmrg /** For future use, no flags defined so far */ 299d8807b2fSmrg __u64 flags; 300d8807b2fSmrg}; 301d8807b2fSmrg 302d8807b2fSmrgunion drm_amdgpu_vm { 303d8807b2fSmrg struct drm_amdgpu_vm_in in; 304d8807b2fSmrg struct drm_amdgpu_vm_out out; 305d8807b2fSmrg}; 306d8807b2fSmrg 30700a23bdaSmrg/* sched ioctl */ 30800a23bdaSmrg#define AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE 1 3095324fb0dSmrg#define AMDGPU_SCHED_OP_CONTEXT_PRIORITY_OVERRIDE 2 31000a23bdaSmrg 31100a23bdaSmrgstruct drm_amdgpu_sched_in { 31200a23bdaSmrg /* AMDGPU_SCHED_OP_* */ 31300a23bdaSmrg __u32 op; 31400a23bdaSmrg __u32 fd; 31588f8a8d2Smrg /** AMDGPU_CTX_PRIORITY_* */ 31600a23bdaSmrg __s32 priority; 3175324fb0dSmrg __u32 ctx_id; 31800a23bdaSmrg}; 31900a23bdaSmrg 32000a23bdaSmrgunion drm_amdgpu_sched { 32100a23bdaSmrg struct drm_amdgpu_sched_in in; 32200a23bdaSmrg}; 32300a23bdaSmrg 3243f012e29Smrg/* 3253f012e29Smrg * This is not a reliable API and you should expect it to fail for any 3263f012e29Smrg * number of reasons and have fallback path that do not use userptr to 3273f012e29Smrg * perform any operation. 3283f012e29Smrg */ 3293f012e29Smrg#define AMDGPU_GEM_USERPTR_READONLY (1 << 0) 3303f012e29Smrg#define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1) 3313f012e29Smrg#define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2) 3323f012e29Smrg#define AMDGPU_GEM_USERPTR_REGISTER (1 << 3) 3333f012e29Smrg 3343f012e29Smrgstruct drm_amdgpu_gem_userptr { 335d8807b2fSmrg __u64 addr; 336d8807b2fSmrg __u64 size; 3373f012e29Smrg /* AMDGPU_GEM_USERPTR_* */ 338d8807b2fSmrg __u32 flags; 3393f012e29Smrg /* Resulting GEM handle */ 340d8807b2fSmrg __u32 handle; 3413f012e29Smrg}; 3423f012e29Smrg 343d8807b2fSmrg/* SI-CI-VI: */ 3443f012e29Smrg/* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */ 3453f012e29Smrg#define AMDGPU_TILING_ARRAY_MODE_SHIFT 0 3463f012e29Smrg#define AMDGPU_TILING_ARRAY_MODE_MASK 0xf 3473f012e29Smrg#define AMDGPU_TILING_PIPE_CONFIG_SHIFT 4 3483f012e29Smrg#define AMDGPU_TILING_PIPE_CONFIG_MASK 0x1f 3493f012e29Smrg#define AMDGPU_TILING_TILE_SPLIT_SHIFT 9 3503f012e29Smrg#define AMDGPU_TILING_TILE_SPLIT_MASK 0x7 3513f012e29Smrg#define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT 12 3523f012e29Smrg#define AMDGPU_TILING_MICRO_TILE_MODE_MASK 0x7 3533f012e29Smrg#define AMDGPU_TILING_BANK_WIDTH_SHIFT 15 3543f012e29Smrg#define AMDGPU_TILING_BANK_WIDTH_MASK 0x3 3553f012e29Smrg#define AMDGPU_TILING_BANK_HEIGHT_SHIFT 17 3563f012e29Smrg#define AMDGPU_TILING_BANK_HEIGHT_MASK 0x3 3573f012e29Smrg#define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT 19 3583f012e29Smrg#define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK 0x3 3593f012e29Smrg#define AMDGPU_TILING_NUM_BANKS_SHIFT 21 3603f012e29Smrg#define AMDGPU_TILING_NUM_BANKS_MASK 0x3 3613f012e29Smrg 362d8807b2fSmrg/* GFX9 and later: */ 363d8807b2fSmrg#define AMDGPU_TILING_SWIZZLE_MODE_SHIFT 0 364d8807b2fSmrg#define AMDGPU_TILING_SWIZZLE_MODE_MASK 0x1f 3656532f28eSmrg#define AMDGPU_TILING_DCC_OFFSET_256B_SHIFT 5 3666532f28eSmrg#define AMDGPU_TILING_DCC_OFFSET_256B_MASK 0xFFFFFF 3676532f28eSmrg#define AMDGPU_TILING_DCC_PITCH_MAX_SHIFT 29 3686532f28eSmrg#define AMDGPU_TILING_DCC_PITCH_MAX_MASK 0x3FFF 3696532f28eSmrg#define AMDGPU_TILING_DCC_INDEPENDENT_64B_SHIFT 43 3706532f28eSmrg#define AMDGPU_TILING_DCC_INDEPENDENT_64B_MASK 0x1 37141687f09Smrg#define AMDGPU_TILING_DCC_INDEPENDENT_128B_SHIFT 44 37241687f09Smrg#define AMDGPU_TILING_DCC_INDEPENDENT_128B_MASK 0x1 37341687f09Smrg#define AMDGPU_TILING_SCANOUT_SHIFT 63 37441687f09Smrg#define AMDGPU_TILING_SCANOUT_MASK 0x1 375d8807b2fSmrg 376d8807b2fSmrg/* Set/Get helpers for tiling flags. */ 3773f012e29Smrg#define AMDGPU_TILING_SET(field, value) \ 378d8807b2fSmrg (((__u64)(value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT) 3793f012e29Smrg#define AMDGPU_TILING_GET(value, field) \ 380d8807b2fSmrg (((__u64)(value) >> AMDGPU_TILING_##field##_SHIFT) & AMDGPU_TILING_##field##_MASK) 3813f012e29Smrg 3823f012e29Smrg#define AMDGPU_GEM_METADATA_OP_SET_METADATA 1 3833f012e29Smrg#define AMDGPU_GEM_METADATA_OP_GET_METADATA 2 3843f012e29Smrg 3853f012e29Smrg/** The same structure is shared for input/output */ 3863f012e29Smrgstruct drm_amdgpu_gem_metadata { 3873f012e29Smrg /** GEM Object handle */ 388d8807b2fSmrg __u32 handle; 3893f012e29Smrg /** Do we want get or set metadata */ 390d8807b2fSmrg __u32 op; 3913f012e29Smrg struct { 3923f012e29Smrg /** For future use, no flags defined so far */ 393d8807b2fSmrg __u64 flags; 3943f012e29Smrg /** family specific tiling info */ 395d8807b2fSmrg __u64 tiling_info; 396d8807b2fSmrg __u32 data_size_bytes; 397d8807b2fSmrg __u32 data[64]; 3983f012e29Smrg } data; 3993f012e29Smrg}; 4003f012e29Smrg 4013f012e29Smrgstruct drm_amdgpu_gem_mmap_in { 4023f012e29Smrg /** the GEM object handle */ 403d8807b2fSmrg __u32 handle; 404d8807b2fSmrg __u32 _pad; 4053f012e29Smrg}; 4063f012e29Smrg 4073f012e29Smrgstruct drm_amdgpu_gem_mmap_out { 4083f012e29Smrg /** mmap offset from the vma offset manager */ 409d8807b2fSmrg __u64 addr_ptr; 4103f012e29Smrg}; 4113f012e29Smrg 4123f012e29Smrgunion drm_amdgpu_gem_mmap { 4133f012e29Smrg struct drm_amdgpu_gem_mmap_in in; 4143f012e29Smrg struct drm_amdgpu_gem_mmap_out out; 4153f012e29Smrg}; 4163f012e29Smrg 4173f012e29Smrgstruct drm_amdgpu_gem_wait_idle_in { 4183f012e29Smrg /** GEM object handle */ 419d8807b2fSmrg __u32 handle; 4203f012e29Smrg /** For future use, no flags defined so far */ 421d8807b2fSmrg __u32 flags; 4223f012e29Smrg /** Absolute timeout to wait */ 423d8807b2fSmrg __u64 timeout; 4243f012e29Smrg}; 4253f012e29Smrg 4263f012e29Smrgstruct drm_amdgpu_gem_wait_idle_out { 4273f012e29Smrg /** BO status: 0 - BO is idle, 1 - BO is busy */ 428d8807b2fSmrg __u32 status; 4293f012e29Smrg /** Returned current memory domain */ 430d8807b2fSmrg __u32 domain; 4313f012e29Smrg}; 4323f012e29Smrg 4333f012e29Smrgunion drm_amdgpu_gem_wait_idle { 4343f012e29Smrg struct drm_amdgpu_gem_wait_idle_in in; 4353f012e29Smrg struct drm_amdgpu_gem_wait_idle_out out; 4363f012e29Smrg}; 4373f012e29Smrg 4383f012e29Smrgstruct drm_amdgpu_wait_cs_in { 439d8807b2fSmrg /* Command submission handle 440d8807b2fSmrg * handle equals 0 means none to wait for 441d8807b2fSmrg * handle equals ~0ull means wait for the latest sequence number 442d8807b2fSmrg */ 443d8807b2fSmrg __u64 handle; 4443f012e29Smrg /** Absolute timeout to wait */ 445d8807b2fSmrg __u64 timeout; 446d8807b2fSmrg __u32 ip_type; 447d8807b2fSmrg __u32 ip_instance; 448d8807b2fSmrg __u32 ring; 449d8807b2fSmrg __u32 ctx_id; 4503f012e29Smrg}; 4513f012e29Smrg 4523f012e29Smrgstruct drm_amdgpu_wait_cs_out { 4533f012e29Smrg /** CS status: 0 - CS completed, 1 - CS still busy */ 454d8807b2fSmrg __u64 status; 4553f012e29Smrg}; 4563f012e29Smrg 4573f012e29Smrgunion drm_amdgpu_wait_cs { 4583f012e29Smrg struct drm_amdgpu_wait_cs_in in; 4593f012e29Smrg struct drm_amdgpu_wait_cs_out out; 4603f012e29Smrg}; 4613f012e29Smrg 462d8807b2fSmrgstruct drm_amdgpu_fence { 463d8807b2fSmrg __u32 ctx_id; 464d8807b2fSmrg __u32 ip_type; 465d8807b2fSmrg __u32 ip_instance; 466d8807b2fSmrg __u32 ring; 467d8807b2fSmrg __u64 seq_no; 468d8807b2fSmrg}; 469d8807b2fSmrg 470d8807b2fSmrgstruct drm_amdgpu_wait_fences_in { 471d8807b2fSmrg /** This points to uint64_t * which points to fences */ 472d8807b2fSmrg __u64 fences; 473d8807b2fSmrg __u32 fence_count; 474d8807b2fSmrg __u32 wait_all; 475d8807b2fSmrg __u64 timeout_ns; 476d8807b2fSmrg}; 477d8807b2fSmrg 478d8807b2fSmrgstruct drm_amdgpu_wait_fences_out { 479d8807b2fSmrg __u32 status; 480d8807b2fSmrg __u32 first_signaled; 481d8807b2fSmrg}; 482d8807b2fSmrg 483d8807b2fSmrgunion drm_amdgpu_wait_fences { 484d8807b2fSmrg struct drm_amdgpu_wait_fences_in in; 485d8807b2fSmrg struct drm_amdgpu_wait_fences_out out; 486d8807b2fSmrg}; 487d8807b2fSmrg 4883f012e29Smrg#define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0 4893f012e29Smrg#define AMDGPU_GEM_OP_SET_PLACEMENT 1 4903f012e29Smrg 4913f012e29Smrg/* Sets or returns a value associated with a buffer. */ 4923f012e29Smrgstruct drm_amdgpu_gem_op { 4933f012e29Smrg /** GEM object handle */ 494d8807b2fSmrg __u32 handle; 4953f012e29Smrg /** AMDGPU_GEM_OP_* */ 496d8807b2fSmrg __u32 op; 4973f012e29Smrg /** Input or return value */ 498d8807b2fSmrg __u64 value; 4993f012e29Smrg}; 5003f012e29Smrg 5013f012e29Smrg#define AMDGPU_VA_OP_MAP 1 5023f012e29Smrg#define AMDGPU_VA_OP_UNMAP 2 503d8807b2fSmrg#define AMDGPU_VA_OP_CLEAR 3 504d8807b2fSmrg#define AMDGPU_VA_OP_REPLACE 4 5053f012e29Smrg 5063f012e29Smrg/* Delay the page table update till the next CS */ 5073f012e29Smrg#define AMDGPU_VM_DELAY_UPDATE (1 << 0) 5083f012e29Smrg 5093f012e29Smrg/* Mapping flags */ 5103f012e29Smrg/* readable mapping */ 5113f012e29Smrg#define AMDGPU_VM_PAGE_READABLE (1 << 1) 5123f012e29Smrg/* writable mapping */ 5133f012e29Smrg#define AMDGPU_VM_PAGE_WRITEABLE (1 << 2) 5143f012e29Smrg/* executable mapping, new for VI */ 5153f012e29Smrg#define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3) 516d8807b2fSmrg/* partially resident texture */ 517d8807b2fSmrg#define AMDGPU_VM_PAGE_PRT (1 << 4) 518d8807b2fSmrg/* MTYPE flags use bit 5 to 8 */ 519d8807b2fSmrg#define AMDGPU_VM_MTYPE_MASK (0xf << 5) 520d8807b2fSmrg/* Default MTYPE. Pre-AI must use this. Recommended for newer ASICs. */ 521d8807b2fSmrg#define AMDGPU_VM_MTYPE_DEFAULT (0 << 5) 52241687f09Smrg/* Use Non Coherent MTYPE instead of default MTYPE */ 523d8807b2fSmrg#define AMDGPU_VM_MTYPE_NC (1 << 5) 52441687f09Smrg/* Use Write Combine MTYPE instead of default MTYPE */ 525d8807b2fSmrg#define AMDGPU_VM_MTYPE_WC (2 << 5) 52641687f09Smrg/* Use Cache Coherent MTYPE instead of default MTYPE */ 527d8807b2fSmrg#define AMDGPU_VM_MTYPE_CC (3 << 5) 52841687f09Smrg/* Use UnCached MTYPE instead of default MTYPE */ 529d8807b2fSmrg#define AMDGPU_VM_MTYPE_UC (4 << 5) 53041687f09Smrg/* Use Read Write MTYPE instead of default MTYPE */ 53141687f09Smrg#define AMDGPU_VM_MTYPE_RW (5 << 5) 5323f012e29Smrg 5333f012e29Smrgstruct drm_amdgpu_gem_va { 5343f012e29Smrg /** GEM object handle */ 535d8807b2fSmrg __u32 handle; 536d8807b2fSmrg __u32 _pad; 5373f012e29Smrg /** AMDGPU_VA_OP_* */ 538d8807b2fSmrg __u32 operation; 5393f012e29Smrg /** AMDGPU_VM_PAGE_* */ 540d8807b2fSmrg __u32 flags; 5413f012e29Smrg /** va address to assign . Must be correctly aligned.*/ 542d8807b2fSmrg __u64 va_address; 5433f012e29Smrg /** Specify offset inside of BO to assign. Must be correctly aligned.*/ 544d8807b2fSmrg __u64 offset_in_bo; 5453f012e29Smrg /** Specify mapping size. Must be correctly aligned. */ 546d8807b2fSmrg __u64 map_size; 5473f012e29Smrg}; 5483f012e29Smrg 5493f012e29Smrg#define AMDGPU_HW_IP_GFX 0 5503f012e29Smrg#define AMDGPU_HW_IP_COMPUTE 1 5513f012e29Smrg#define AMDGPU_HW_IP_DMA 2 5523f012e29Smrg#define AMDGPU_HW_IP_UVD 3 5533f012e29Smrg#define AMDGPU_HW_IP_VCE 4 554d8807b2fSmrg#define AMDGPU_HW_IP_UVD_ENC 5 555d8807b2fSmrg#define AMDGPU_HW_IP_VCN_DEC 6 556b0ab5608Smrg/* 557b0ab5608Smrg * From VCN4, AMDGPU_HW_IP_VCN_ENC is re-used to support 558b0ab5608Smrg * both encoding and decoding jobs. 559b0ab5608Smrg */ 560d8807b2fSmrg#define AMDGPU_HW_IP_VCN_ENC 7 5617cdc0497Smrg#define AMDGPU_HW_IP_VCN_JPEG 8 5627cdc0497Smrg#define AMDGPU_HW_IP_NUM 9 5633f012e29Smrg 5643f012e29Smrg#define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1 5653f012e29Smrg 5663f012e29Smrg#define AMDGPU_CHUNK_ID_IB 0x01 5673f012e29Smrg#define AMDGPU_CHUNK_ID_FENCE 0x02 5683f012e29Smrg#define AMDGPU_CHUNK_ID_DEPENDENCIES 0x03 569d8807b2fSmrg#define AMDGPU_CHUNK_ID_SYNCOBJ_IN 0x04 570d8807b2fSmrg#define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05 5717cdc0497Smrg#define AMDGPU_CHUNK_ID_BO_HANDLES 0x06 5725324fb0dSmrg#define AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES 0x07 5735324fb0dSmrg#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT 0x08 5745324fb0dSmrg#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL 0x09 5753f012e29Smrg 5763f012e29Smrgstruct drm_amdgpu_cs_chunk { 577d8807b2fSmrg __u32 chunk_id; 578d8807b2fSmrg __u32 length_dw; 579d8807b2fSmrg __u64 chunk_data; 5803f012e29Smrg}; 5813f012e29Smrg 5823f012e29Smrgstruct drm_amdgpu_cs_in { 5833f012e29Smrg /** Rendering context id */ 584d8807b2fSmrg __u32 ctx_id; 5853f012e29Smrg /** Handle of resource list associated with CS */ 586d8807b2fSmrg __u32 bo_list_handle; 587d8807b2fSmrg __u32 num_chunks; 58841687f09Smrg __u32 flags; 589d8807b2fSmrg /** this points to __u64 * which point to cs chunks */ 590d8807b2fSmrg __u64 chunks; 5913f012e29Smrg}; 5923f012e29Smrg 5933f012e29Smrgstruct drm_amdgpu_cs_out { 594d8807b2fSmrg __u64 handle; 5953f012e29Smrg}; 5963f012e29Smrg 5973f012e29Smrgunion drm_amdgpu_cs { 5983f012e29Smrg struct drm_amdgpu_cs_in in; 5993f012e29Smrg struct drm_amdgpu_cs_out out; 6003f012e29Smrg}; 6013f012e29Smrg 6023f012e29Smrg/* Specify flags to be used for IB */ 6033f012e29Smrg 6043f012e29Smrg/* This IB should be submitted to CE */ 6053f012e29Smrg#define AMDGPU_IB_FLAG_CE (1<<0) 6063f012e29Smrg 607d8807b2fSmrg/* Preamble flag, which means the IB could be dropped if no context switch */ 6083f012e29Smrg#define AMDGPU_IB_FLAG_PREAMBLE (1<<1) 6093f012e29Smrg 610d8807b2fSmrg/* Preempt flag, IB should set Pre_enb bit if PREEMPT flag detected */ 611d8807b2fSmrg#define AMDGPU_IB_FLAG_PREEMPT (1<<2) 612d8807b2fSmrg 6137cdc0497Smrg/* The IB fence should do the L2 writeback but not invalidate any shader 6147cdc0497Smrg * caches (L2/vL1/sL1/I$). */ 6157cdc0497Smrg#define AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE (1 << 3) 6167cdc0497Smrg 6175324fb0dSmrg/* Set GDS_COMPUTE_MAX_WAVE_ID = DEFAULT before PACKET3_INDIRECT_BUFFER. 6185324fb0dSmrg * This will reset wave ID counters for the IB. 6195324fb0dSmrg */ 6205324fb0dSmrg#define AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID (1 << 4) 6215324fb0dSmrg 62241687f09Smrg/* Flag the IB as secure (TMZ) 62341687f09Smrg */ 62441687f09Smrg#define AMDGPU_IB_FLAGS_SECURE (1 << 5) 62541687f09Smrg 62641687f09Smrg/* Tell KMD to flush and invalidate caches 62741687f09Smrg */ 62841687f09Smrg#define AMDGPU_IB_FLAG_EMIT_MEM_SYNC (1 << 6) 62941687f09Smrg 6303f012e29Smrgstruct drm_amdgpu_cs_chunk_ib { 631d8807b2fSmrg __u32 _pad; 6323f012e29Smrg /** AMDGPU_IB_FLAG_* */ 633d8807b2fSmrg __u32 flags; 6343f012e29Smrg /** Virtual address to begin IB execution */ 635d8807b2fSmrg __u64 va_start; 6363f012e29Smrg /** Size of submission */ 637d8807b2fSmrg __u32 ib_bytes; 6383f012e29Smrg /** HW IP to submit to */ 639d8807b2fSmrg __u32 ip_type; 6403f012e29Smrg /** HW IP index of the same type to submit to */ 641d8807b2fSmrg __u32 ip_instance; 6423f012e29Smrg /** Ring index to submit to */ 643d8807b2fSmrg __u32 ring; 6443f012e29Smrg}; 6453f012e29Smrg 6463f012e29Smrgstruct drm_amdgpu_cs_chunk_dep { 647d8807b2fSmrg __u32 ip_type; 648d8807b2fSmrg __u32 ip_instance; 649d8807b2fSmrg __u32 ring; 650d8807b2fSmrg __u32 ctx_id; 651d8807b2fSmrg __u64 handle; 6523f012e29Smrg}; 6533f012e29Smrg 6543f012e29Smrgstruct drm_amdgpu_cs_chunk_fence { 655d8807b2fSmrg __u32 handle; 656d8807b2fSmrg __u32 offset; 657d8807b2fSmrg}; 658d8807b2fSmrg 659d8807b2fSmrgstruct drm_amdgpu_cs_chunk_sem { 660d8807b2fSmrg __u32 handle; 6613f012e29Smrg}; 6623f012e29Smrg 6635324fb0dSmrgstruct drm_amdgpu_cs_chunk_syncobj { 66488f8a8d2Smrg __u32 handle; 66588f8a8d2Smrg __u32 flags; 66688f8a8d2Smrg __u64 point; 6675324fb0dSmrg}; 6685324fb0dSmrg 66900a23bdaSmrg#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ 0 67000a23bdaSmrg#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD 1 67100a23bdaSmrg#define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD 2 67200a23bdaSmrg 67300a23bdaSmrgunion drm_amdgpu_fence_to_handle { 67400a23bdaSmrg struct { 67500a23bdaSmrg struct drm_amdgpu_fence fence; 67600a23bdaSmrg __u32 what; 67700a23bdaSmrg __u32 pad; 67800a23bdaSmrg } in; 67900a23bdaSmrg struct { 68000a23bdaSmrg __u32 handle; 68100a23bdaSmrg } out; 68200a23bdaSmrg}; 68300a23bdaSmrg 6843f012e29Smrgstruct drm_amdgpu_cs_chunk_data { 6853f012e29Smrg union { 6863f012e29Smrg struct drm_amdgpu_cs_chunk_ib ib_data; 6873f012e29Smrg struct drm_amdgpu_cs_chunk_fence fence_data; 6883f012e29Smrg }; 6893f012e29Smrg}; 6903f012e29Smrg 69141687f09Smrg/* 6923f012e29Smrg * Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU 6933f012e29Smrg * 6943f012e29Smrg */ 6953f012e29Smrg#define AMDGPU_IDS_FLAGS_FUSION 0x1 696d8807b2fSmrg#define AMDGPU_IDS_FLAGS_PREEMPTION 0x2 69741687f09Smrg#define AMDGPU_IDS_FLAGS_TMZ 0x4 6983f012e29Smrg 6993f012e29Smrg/* indicate if acceleration can be working */ 7003f012e29Smrg#define AMDGPU_INFO_ACCEL_WORKING 0x00 7013f012e29Smrg/* get the crtc_id from the mode object id? */ 7023f012e29Smrg#define AMDGPU_INFO_CRTC_FROM_ID 0x01 7033f012e29Smrg/* query hw IP info */ 7043f012e29Smrg#define AMDGPU_INFO_HW_IP_INFO 0x02 7053f012e29Smrg/* query hw IP instance count for the specified type */ 7063f012e29Smrg#define AMDGPU_INFO_HW_IP_COUNT 0x03 7073f012e29Smrg/* timestamp for GL_ARB_timer_query */ 7083f012e29Smrg#define AMDGPU_INFO_TIMESTAMP 0x05 7093f012e29Smrg/* Query the firmware version */ 7103f012e29Smrg#define AMDGPU_INFO_FW_VERSION 0x0e 7113f012e29Smrg /* Subquery id: Query VCE firmware version */ 7123f012e29Smrg #define AMDGPU_INFO_FW_VCE 0x1 7133f012e29Smrg /* Subquery id: Query UVD firmware version */ 7143f012e29Smrg #define AMDGPU_INFO_FW_UVD 0x2 7153f012e29Smrg /* Subquery id: Query GMC firmware version */ 7163f012e29Smrg #define AMDGPU_INFO_FW_GMC 0x03 7173f012e29Smrg /* Subquery id: Query GFX ME firmware version */ 7183f012e29Smrg #define AMDGPU_INFO_FW_GFX_ME 0x04 7193f012e29Smrg /* Subquery id: Query GFX PFP firmware version */ 7203f012e29Smrg #define AMDGPU_INFO_FW_GFX_PFP 0x05 7213f012e29Smrg /* Subquery id: Query GFX CE firmware version */ 7223f012e29Smrg #define AMDGPU_INFO_FW_GFX_CE 0x06 7233f012e29Smrg /* Subquery id: Query GFX RLC firmware version */ 7243f012e29Smrg #define AMDGPU_INFO_FW_GFX_RLC 0x07 7253f012e29Smrg /* Subquery id: Query GFX MEC firmware version */ 7263f012e29Smrg #define AMDGPU_INFO_FW_GFX_MEC 0x08 7273f012e29Smrg /* Subquery id: Query SMC firmware version */ 7283f012e29Smrg #define AMDGPU_INFO_FW_SMC 0x0a 7293f012e29Smrg /* Subquery id: Query SDMA firmware version */ 7303f012e29Smrg #define AMDGPU_INFO_FW_SDMA 0x0b 731d8807b2fSmrg /* Subquery id: Query PSP SOS firmware version */ 732d8807b2fSmrg #define AMDGPU_INFO_FW_SOS 0x0c 733d8807b2fSmrg /* Subquery id: Query PSP ASD firmware version */ 734d8807b2fSmrg #define AMDGPU_INFO_FW_ASD 0x0d 7357cdc0497Smrg /* Subquery id: Query VCN firmware version */ 7367cdc0497Smrg #define AMDGPU_INFO_FW_VCN 0x0e 7377cdc0497Smrg /* Subquery id: Query GFX RLC SRLC firmware version */ 7387cdc0497Smrg #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_CNTL 0x0f 7397cdc0497Smrg /* Subquery id: Query GFX RLC SRLG firmware version */ 7407cdc0497Smrg #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM 0x10 7417cdc0497Smrg /* Subquery id: Query GFX RLC SRLS firmware version */ 7427cdc0497Smrg #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11 7436532f28eSmrg /* Subquery id: Query DMCU firmware version */ 7446532f28eSmrg #define AMDGPU_INFO_FW_DMCU 0x12 7455324fb0dSmrg #define AMDGPU_INFO_FW_TA 0x13 74641687f09Smrg /* Subquery id: Query DMCUB firmware version */ 74741687f09Smrg #define AMDGPU_INFO_FW_DMCUB 0x14 74841687f09Smrg /* Subquery id: Query TOC firmware version */ 74941687f09Smrg #define AMDGPU_INFO_FW_TOC 0x15 75041687f09Smrg 7513f012e29Smrg/* number of bytes moved for TTM migration */ 7523f012e29Smrg#define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f 7533f012e29Smrg/* the used VRAM size */ 7543f012e29Smrg#define AMDGPU_INFO_VRAM_USAGE 0x10 7553f012e29Smrg/* the used GTT size */ 7563f012e29Smrg#define AMDGPU_INFO_GTT_USAGE 0x11 7573f012e29Smrg/* Information about GDS, etc. resource configuration */ 7583f012e29Smrg#define AMDGPU_INFO_GDS_CONFIG 0x13 7593f012e29Smrg/* Query information about VRAM and GTT domains */ 7603f012e29Smrg#define AMDGPU_INFO_VRAM_GTT 0x14 7613f012e29Smrg/* Query information about register in MMR address space*/ 7623f012e29Smrg#define AMDGPU_INFO_READ_MMR_REG 0x15 7633f012e29Smrg/* Query information about device: rev id, family, etc. */ 7643f012e29Smrg#define AMDGPU_INFO_DEV_INFO 0x16 7653f012e29Smrg/* visible vram usage */ 7663f012e29Smrg#define AMDGPU_INFO_VIS_VRAM_USAGE 0x17 767d8807b2fSmrg/* number of TTM buffer evictions */ 768d8807b2fSmrg#define AMDGPU_INFO_NUM_EVICTIONS 0x18 769d8807b2fSmrg/* Query memory about VRAM and GTT domains */ 770d8807b2fSmrg#define AMDGPU_INFO_MEMORY 0x19 771d8807b2fSmrg/* Query vce clock table */ 772d8807b2fSmrg#define AMDGPU_INFO_VCE_CLOCK_TABLE 0x1A 773d8807b2fSmrg/* Query vbios related information */ 774d8807b2fSmrg#define AMDGPU_INFO_VBIOS 0x1B 775d8807b2fSmrg /* Subquery id: Query vbios size */ 776d8807b2fSmrg #define AMDGPU_INFO_VBIOS_SIZE 0x1 777d8807b2fSmrg /* Subquery id: Query vbios image */ 778d8807b2fSmrg #define AMDGPU_INFO_VBIOS_IMAGE 0x2 77949ef06a4Smrg /* Subquery id: Query vbios info */ 78049ef06a4Smrg #define AMDGPU_INFO_VBIOS_INFO 0x3 781d8807b2fSmrg/* Query UVD handles */ 782d8807b2fSmrg#define AMDGPU_INFO_NUM_HANDLES 0x1C 783d8807b2fSmrg/* Query sensor related information */ 784d8807b2fSmrg#define AMDGPU_INFO_SENSOR 0x1D 785d8807b2fSmrg /* Subquery id: Query GPU shader clock */ 786d8807b2fSmrg #define AMDGPU_INFO_SENSOR_GFX_SCLK 0x1 787d8807b2fSmrg /* Subquery id: Query GPU memory clock */ 788d8807b2fSmrg #define AMDGPU_INFO_SENSOR_GFX_MCLK 0x2 789d8807b2fSmrg /* Subquery id: Query GPU temperature */ 790d8807b2fSmrg #define AMDGPU_INFO_SENSOR_GPU_TEMP 0x3 791d8807b2fSmrg /* Subquery id: Query GPU load */ 792d8807b2fSmrg #define AMDGPU_INFO_SENSOR_GPU_LOAD 0x4 793d8807b2fSmrg /* Subquery id: Query average GPU power */ 794d8807b2fSmrg #define AMDGPU_INFO_SENSOR_GPU_AVG_POWER 0x5 795d8807b2fSmrg /* Subquery id: Query northbridge voltage */ 796d8807b2fSmrg #define AMDGPU_INFO_SENSOR_VDDNB 0x6 797d8807b2fSmrg /* Subquery id: Query graphics voltage */ 798d8807b2fSmrg #define AMDGPU_INFO_SENSOR_VDDGFX 0x7 7997cdc0497Smrg /* Subquery id: Query GPU stable pstate shader clock */ 8007cdc0497Smrg #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK 0x8 8017cdc0497Smrg /* Subquery id: Query GPU stable pstate memory clock */ 8027cdc0497Smrg #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK 0x9 803d8807b2fSmrg/* Number of VRAM page faults on CPU access. */ 804d8807b2fSmrg#define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E 80500a23bdaSmrg#define AMDGPU_INFO_VRAM_LOST_COUNTER 0x1F 8065324fb0dSmrg/* query ras mask of enabled features*/ 8075324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_FEATURES 0x20 8085324fb0dSmrg/* RAS MASK: UMC (VRAM) */ 8095324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_UMC (1 << 0) 8105324fb0dSmrg/* RAS MASK: SDMA */ 8115324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_SDMA (1 << 1) 8125324fb0dSmrg/* RAS MASK: GFX */ 8135324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_GFX (1 << 2) 8145324fb0dSmrg/* RAS MASK: MMHUB */ 8155324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_MMHUB (1 << 3) 8165324fb0dSmrg/* RAS MASK: ATHUB */ 8175324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_ATHUB (1 << 4) 8185324fb0dSmrg/* RAS MASK: PCIE */ 8195324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_PCIE (1 << 5) 8205324fb0dSmrg/* RAS MASK: HDP */ 8215324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_HDP (1 << 6) 8225324fb0dSmrg/* RAS MASK: XGMI */ 8235324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_XGMI (1 << 7) 8245324fb0dSmrg/* RAS MASK: DF */ 8255324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_DF (1 << 8) 8265324fb0dSmrg/* RAS MASK: SMN */ 8275324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_SMN (1 << 9) 8285324fb0dSmrg/* RAS MASK: SEM */ 8295324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_SEM (1 << 10) 8305324fb0dSmrg/* RAS MASK: MP0 */ 8315324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_MP0 (1 << 11) 8325324fb0dSmrg/* RAS MASK: MP1 */ 8335324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_MP1 (1 << 12) 8345324fb0dSmrg/* RAS MASK: FUSE */ 8355324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_FUSE (1 << 13) 8360ed5401bSmrg/* query video encode/decode caps */ 8370ed5401bSmrg#define AMDGPU_INFO_VIDEO_CAPS 0x21 8380ed5401bSmrg /* Subquery id: Decode */ 8390ed5401bSmrg #define AMDGPU_INFO_VIDEO_CAPS_DECODE 0 8400ed5401bSmrg /* Subquery id: Encode */ 8410ed5401bSmrg #define AMDGPU_INFO_VIDEO_CAPS_ENCODE 1 8423f012e29Smrg 8433f012e29Smrg#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0 8443f012e29Smrg#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff 8453f012e29Smrg#define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8 8463f012e29Smrg#define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff 8473f012e29Smrg 848037b3c26Smrgstruct drm_amdgpu_query_fw { 849037b3c26Smrg /** AMDGPU_INFO_FW_* */ 850d8807b2fSmrg __u32 fw_type; 851037b3c26Smrg /** 852037b3c26Smrg * Index of the IP if there are more IPs of 853037b3c26Smrg * the same type. 854037b3c26Smrg */ 855d8807b2fSmrg __u32 ip_instance; 856037b3c26Smrg /** 857037b3c26Smrg * Index of the engine. Whether this is used depends 858037b3c26Smrg * on the firmware type. (e.g. MEC, SDMA) 859037b3c26Smrg */ 860d8807b2fSmrg __u32 index; 861d8807b2fSmrg __u32 _pad; 862037b3c26Smrg}; 863037b3c26Smrg 8643f012e29Smrg/* Input structure for the INFO ioctl */ 8653f012e29Smrgstruct drm_amdgpu_info { 8663f012e29Smrg /* Where the return value will be stored */ 867d8807b2fSmrg __u64 return_pointer; 8683f012e29Smrg /* The size of the return value. Just like "size" in "snprintf", 8693f012e29Smrg * it limits how many bytes the kernel can write. */ 870d8807b2fSmrg __u32 return_size; 8713f012e29Smrg /* The query request id. */ 872d8807b2fSmrg __u32 query; 8733f012e29Smrg 8743f012e29Smrg union { 8753f012e29Smrg struct { 876d8807b2fSmrg __u32 id; 877d8807b2fSmrg __u32 _pad; 8783f012e29Smrg } mode_crtc; 8793f012e29Smrg 8803f012e29Smrg struct { 8813f012e29Smrg /** AMDGPU_HW_IP_* */ 882d8807b2fSmrg __u32 type; 8833f012e29Smrg /** 8843f012e29Smrg * Index of the IP if there are more IPs of the same 8853f012e29Smrg * type. Ignored by AMDGPU_INFO_HW_IP_COUNT. 8863f012e29Smrg */ 887d8807b2fSmrg __u32 ip_instance; 8883f012e29Smrg } query_hw_ip; 8893f012e29Smrg 8903f012e29Smrg struct { 891d8807b2fSmrg __u32 dword_offset; 8923f012e29Smrg /** number of registers to read */ 893d8807b2fSmrg __u32 count; 894d8807b2fSmrg __u32 instance; 8953f012e29Smrg /** For future use, no flags defined so far */ 896d8807b2fSmrg __u32 flags; 8973f012e29Smrg } read_mmr_reg; 8983f012e29Smrg 899037b3c26Smrg struct drm_amdgpu_query_fw query_fw; 900d8807b2fSmrg 901d8807b2fSmrg struct { 902d8807b2fSmrg __u32 type; 903d8807b2fSmrg __u32 offset; 904d8807b2fSmrg } vbios_info; 905d8807b2fSmrg 906d8807b2fSmrg struct { 907d8807b2fSmrg __u32 type; 908d8807b2fSmrg } sensor_info; 90941687f09Smrg 91041687f09Smrg struct { 91141687f09Smrg __u32 type; 91241687f09Smrg } video_cap; 9133f012e29Smrg }; 9143f012e29Smrg}; 9153f012e29Smrg 9163f012e29Smrgstruct drm_amdgpu_info_gds { 9173f012e29Smrg /** GDS GFX partition size */ 918d8807b2fSmrg __u32 gds_gfx_partition_size; 9193f012e29Smrg /** GDS compute partition size */ 920d8807b2fSmrg __u32 compute_partition_size; 9213f012e29Smrg /** total GDS memory size */ 922d8807b2fSmrg __u32 gds_total_size; 9233f012e29Smrg /** GWS size per GFX partition */ 924d8807b2fSmrg __u32 gws_per_gfx_partition; 9253f012e29Smrg /** GSW size per compute partition */ 926d8807b2fSmrg __u32 gws_per_compute_partition; 9273f012e29Smrg /** OA size per GFX partition */ 928d8807b2fSmrg __u32 oa_per_gfx_partition; 9293f012e29Smrg /** OA size per compute partition */ 930d8807b2fSmrg __u32 oa_per_compute_partition; 931d8807b2fSmrg __u32 _pad; 9323f012e29Smrg}; 9333f012e29Smrg 9343f012e29Smrgstruct drm_amdgpu_info_vram_gtt { 935d8807b2fSmrg __u64 vram_size; 936d8807b2fSmrg __u64 vram_cpu_accessible_size; 937d8807b2fSmrg __u64 gtt_size; 938d8807b2fSmrg}; 939d8807b2fSmrg 940d8807b2fSmrgstruct drm_amdgpu_heap_info { 941d8807b2fSmrg /** max. physical memory */ 942d8807b2fSmrg __u64 total_heap_size; 943d8807b2fSmrg 944d8807b2fSmrg /** Theoretical max. available memory in the given heap */ 945d8807b2fSmrg __u64 usable_heap_size; 946d8807b2fSmrg 947d8807b2fSmrg /** 948d8807b2fSmrg * Number of bytes allocated in the heap. This includes all processes 949d8807b2fSmrg * and private allocations in the kernel. It changes when new buffers 950d8807b2fSmrg * are allocated, freed, and moved. It cannot be larger than 951d8807b2fSmrg * heap_size. 952d8807b2fSmrg */ 953d8807b2fSmrg __u64 heap_usage; 954d8807b2fSmrg 955d8807b2fSmrg /** 956d8807b2fSmrg * Theoretical possible max. size of buffer which 957d8807b2fSmrg * could be allocated in the given heap 958d8807b2fSmrg */ 959d8807b2fSmrg __u64 max_allocation; 960d8807b2fSmrg}; 961d8807b2fSmrg 962d8807b2fSmrgstruct drm_amdgpu_memory_info { 963d8807b2fSmrg struct drm_amdgpu_heap_info vram; 964d8807b2fSmrg struct drm_amdgpu_heap_info cpu_accessible_vram; 965d8807b2fSmrg struct drm_amdgpu_heap_info gtt; 9663f012e29Smrg}; 9673f012e29Smrg 9683f012e29Smrgstruct drm_amdgpu_info_firmware { 969d8807b2fSmrg __u32 ver; 970d8807b2fSmrg __u32 feature; 9713f012e29Smrg}; 9723f012e29Smrg 97349ef06a4Smrgstruct drm_amdgpu_info_vbios { 97449ef06a4Smrg __u8 name[64]; 97549ef06a4Smrg __u8 vbios_pn[64]; 97649ef06a4Smrg __u32 version; 97749ef06a4Smrg __u32 pad; 97849ef06a4Smrg __u8 vbios_ver_str[32]; 97949ef06a4Smrg __u8 date[32]; 98049ef06a4Smrg}; 98149ef06a4Smrg 9823f012e29Smrg#define AMDGPU_VRAM_TYPE_UNKNOWN 0 9833f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR1 1 9843f012e29Smrg#define AMDGPU_VRAM_TYPE_DDR2 2 9853f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR3 3 9863f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR4 4 9873f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR5 5 9883f012e29Smrg#define AMDGPU_VRAM_TYPE_HBM 6 9893f012e29Smrg#define AMDGPU_VRAM_TYPE_DDR3 7 9907cdc0497Smrg#define AMDGPU_VRAM_TYPE_DDR4 8 9915324fb0dSmrg#define AMDGPU_VRAM_TYPE_GDDR6 9 99241687f09Smrg#define AMDGPU_VRAM_TYPE_DDR5 10 9933f012e29Smrg 9943f012e29Smrgstruct drm_amdgpu_info_device { 9953f012e29Smrg /** PCI Device ID */ 996d8807b2fSmrg __u32 device_id; 9973f012e29Smrg /** Internal chip revision: A0, A1, etc.) */ 998d8807b2fSmrg __u32 chip_rev; 999d8807b2fSmrg __u32 external_rev; 10003f012e29Smrg /** Revision id in PCI Config space */ 1001d8807b2fSmrg __u32 pci_rev; 1002d8807b2fSmrg __u32 family; 1003d8807b2fSmrg __u32 num_shader_engines; 1004d8807b2fSmrg __u32 num_shader_arrays_per_engine; 10053f012e29Smrg /* in KHz */ 1006d8807b2fSmrg __u32 gpu_counter_freq; 1007d8807b2fSmrg __u64 max_engine_clock; 1008d8807b2fSmrg __u64 max_memory_clock; 10093f012e29Smrg /* cu information */ 1010d8807b2fSmrg __u32 cu_active_number; 101100a23bdaSmrg /* NOTE: cu_ao_mask is INVALID, DON'T use it */ 1012d8807b2fSmrg __u32 cu_ao_mask; 1013d8807b2fSmrg __u32 cu_bitmap[4][4]; 10143f012e29Smrg /** Render backend pipe mask. One render backend is CB+DB. */ 1015d8807b2fSmrg __u32 enabled_rb_pipes_mask; 1016d8807b2fSmrg __u32 num_rb_pipes; 1017d8807b2fSmrg __u32 num_hw_gfx_contexts; 1018d8807b2fSmrg __u32 _pad; 1019d8807b2fSmrg __u64 ids_flags; 10203f012e29Smrg /** Starting virtual address for UMDs. */ 1021d8807b2fSmrg __u64 virtual_address_offset; 10223f012e29Smrg /** The maximum virtual address */ 1023d8807b2fSmrg __u64 virtual_address_max; 10243f012e29Smrg /** Required alignment of virtual addresses. */ 1025d8807b2fSmrg __u32 virtual_address_alignment; 10263f012e29Smrg /** Page table entry - fragment size */ 1027d8807b2fSmrg __u32 pte_fragment_size; 1028d8807b2fSmrg __u32 gart_page_size; 10293f012e29Smrg /** constant engine ram size*/ 1030d8807b2fSmrg __u32 ce_ram_size; 10313f012e29Smrg /** video memory type info*/ 1032d8807b2fSmrg __u32 vram_type; 10333f012e29Smrg /** video memory bit width*/ 1034d8807b2fSmrg __u32 vram_bit_width; 10353f012e29Smrg /* vce harvesting instance */ 1036d8807b2fSmrg __u32 vce_harvest_config; 1037d8807b2fSmrg /* gfx double offchip LDS buffers */ 1038d8807b2fSmrg __u32 gc_double_offchip_lds_buf; 1039d8807b2fSmrg /* NGG Primitive Buffer */ 1040d8807b2fSmrg __u64 prim_buf_gpu_addr; 1041d8807b2fSmrg /* NGG Position Buffer */ 1042d8807b2fSmrg __u64 pos_buf_gpu_addr; 1043d8807b2fSmrg /* NGG Control Sideband */ 1044d8807b2fSmrg __u64 cntl_sb_buf_gpu_addr; 1045d8807b2fSmrg /* NGG Parameter Cache */ 1046d8807b2fSmrg __u64 param_buf_gpu_addr; 1047d8807b2fSmrg __u32 prim_buf_size; 1048d8807b2fSmrg __u32 pos_buf_size; 1049d8807b2fSmrg __u32 cntl_sb_buf_size; 1050d8807b2fSmrg __u32 param_buf_size; 1051d8807b2fSmrg /* wavefront size*/ 1052d8807b2fSmrg __u32 wave_front_size; 1053d8807b2fSmrg /* shader visible vgprs*/ 1054d8807b2fSmrg __u32 num_shader_visible_vgprs; 1055d8807b2fSmrg /* CU per shader array*/ 1056d8807b2fSmrg __u32 num_cu_per_sh; 1057d8807b2fSmrg /* number of tcc blocks*/ 1058d8807b2fSmrg __u32 num_tcc_blocks; 1059d8807b2fSmrg /* gs vgt table depth*/ 1060d8807b2fSmrg __u32 gs_vgt_table_depth; 1061d8807b2fSmrg /* gs primitive buffer depth*/ 1062d8807b2fSmrg __u32 gs_prim_buffer_depth; 1063d8807b2fSmrg /* max gs wavefront per vgt*/ 1064d8807b2fSmrg __u32 max_gs_waves_per_vgt; 1065d8807b2fSmrg __u32 _pad1; 106600a23bdaSmrg /* always on cu bitmap */ 106700a23bdaSmrg __u32 cu_ao_bitmap[4][4]; 106800a23bdaSmrg /** Starting high virtual address for UMDs. */ 106900a23bdaSmrg __u64 high_va_offset; 107000a23bdaSmrg /** The maximum high virtual address */ 107100a23bdaSmrg __u64 high_va_max; 10725324fb0dSmrg /* gfx10 pa_sc_tile_steering_override */ 10735324fb0dSmrg __u32 pa_sc_tile_steering_override; 107488f8a8d2Smrg /* disabled TCCs */ 107588f8a8d2Smrg __u64 tcc_disabled_mask; 10763f012e29Smrg}; 10773f012e29Smrg 10783f012e29Smrgstruct drm_amdgpu_info_hw_ip { 10793f012e29Smrg /** Version of h/w IP */ 1080d8807b2fSmrg __u32 hw_ip_version_major; 1081d8807b2fSmrg __u32 hw_ip_version_minor; 10823f012e29Smrg /** Capabilities */ 1083d8807b2fSmrg __u64 capabilities_flags; 10843f012e29Smrg /** command buffer address start alignment*/ 1085d8807b2fSmrg __u32 ib_start_alignment; 10863f012e29Smrg /** command buffer size alignment*/ 1087d8807b2fSmrg __u32 ib_size_alignment; 10883f012e29Smrg /** Bitmask of available rings. Bit 0 means ring 0, etc. */ 1089d8807b2fSmrg __u32 available_rings; 1090d8807b2fSmrg __u32 _pad; 1091d8807b2fSmrg}; 1092d8807b2fSmrg 1093d8807b2fSmrgstruct drm_amdgpu_info_num_handles { 1094d8807b2fSmrg /** Max handles as supported by firmware for UVD */ 1095d8807b2fSmrg __u32 uvd_max_handles; 1096d8807b2fSmrg /** Handles currently in use for UVD */ 1097d8807b2fSmrg __u32 uvd_used_handles; 1098d8807b2fSmrg}; 1099d8807b2fSmrg 1100d8807b2fSmrg#define AMDGPU_VCE_CLOCK_TABLE_ENTRIES 6 1101d8807b2fSmrg 1102d8807b2fSmrgstruct drm_amdgpu_info_vce_clock_table_entry { 1103d8807b2fSmrg /** System clock */ 1104d8807b2fSmrg __u32 sclk; 1105d8807b2fSmrg /** Memory clock */ 1106d8807b2fSmrg __u32 mclk; 1107d8807b2fSmrg /** VCE clock */ 1108d8807b2fSmrg __u32 eclk; 1109d8807b2fSmrg __u32 pad; 1110d8807b2fSmrg}; 1111d8807b2fSmrg 1112d8807b2fSmrgstruct drm_amdgpu_info_vce_clock_table { 1113d8807b2fSmrg struct drm_amdgpu_info_vce_clock_table_entry entries[AMDGPU_VCE_CLOCK_TABLE_ENTRIES]; 1114d8807b2fSmrg __u32 num_valid_entries; 1115d8807b2fSmrg __u32 pad; 11163f012e29Smrg}; 11173f012e29Smrg 111841687f09Smrg/* query video encode/decode caps */ 111941687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 0 112041687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 1 112141687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 2 112241687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC 3 112341687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC 4 112441687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG 5 112541687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 6 112641687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1 7 112741687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT 8 112841687f09Smrg 112941687f09Smrgstruct drm_amdgpu_info_video_codec_info { 113041687f09Smrg __u32 valid; 113141687f09Smrg __u32 max_width; 113241687f09Smrg __u32 max_height; 113341687f09Smrg __u32 max_pixels_per_frame; 113441687f09Smrg __u32 max_level; 113541687f09Smrg __u32 pad; 113641687f09Smrg}; 113741687f09Smrg 113841687f09Smrgstruct drm_amdgpu_info_video_caps { 113941687f09Smrg struct drm_amdgpu_info_video_codec_info codec_info[AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT]; 114041687f09Smrg}; 114141687f09Smrg 11423f012e29Smrg/* 11433f012e29Smrg * Supported GPU families 11443f012e29Smrg */ 11453f012e29Smrg#define AMDGPU_FAMILY_UNKNOWN 0 1146d8807b2fSmrg#define AMDGPU_FAMILY_SI 110 /* Hainan, Oland, Verde, Pitcairn, Tahiti */ 11473f012e29Smrg#define AMDGPU_FAMILY_CI 120 /* Bonaire, Hawaii */ 11483f012e29Smrg#define AMDGPU_FAMILY_KV 125 /* Kaveri, Kabini, Mullins */ 11493f012e29Smrg#define AMDGPU_FAMILY_VI 130 /* Iceland, Tonga */ 1150037b3c26Smrg#define AMDGPU_FAMILY_CZ 135 /* Carrizo, Stoney */ 1151d8807b2fSmrg#define AMDGPU_FAMILY_AI 141 /* Vega10 */ 1152d8807b2fSmrg#define AMDGPU_FAMILY_RV 142 /* Raven */ 11535324fb0dSmrg#define AMDGPU_FAMILY_NV 143 /* Navi10 */ 115441687f09Smrg#define AMDGPU_FAMILY_VGH 144 /* Van Gogh */ 115549ef06a4Smrg#define AMDGPU_FAMILY_YC 146 /* Yellow Carp */ 1156037b3c26Smrg 1157037b3c26Smrg#if defined(__cplusplus) 1158037b3c26Smrg} 1159037b3c26Smrg#endif 11603f012e29Smrg 11613f012e29Smrg#endif 1162