amdgpu_drm.h revision 41687f09
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
837cdc0497Smrg * pages of system memory, allows GPU access system memory in a linezrized
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 create shadow bo(GTT) while allocating vram bo */
120d8807b2fSmrg#define AMDGPU_GEM_CREATE_SHADOW		(1 << 4)
121d8807b2fSmrg/* Flag that allocating the BO should use linear VRAM */
122d8807b2fSmrg#define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS	(1 << 5)
12300a23bdaSmrg/* Flag that BO is always valid in this VM */
12400a23bdaSmrg#define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID	(1 << 6)
12500a23bdaSmrg/* Flag that BO sharing will be explicitly synchronized */
12600a23bdaSmrg#define AMDGPU_GEM_CREATE_EXPLICIT_SYNC		(1 << 7)
1277cdc0497Smrg/* Flag that indicates allocating MQD gart on GFX9, where the mtype
12841687f09Smrg * for the second page onward should be set to NC. It should never
12941687f09Smrg * be used by user space applications.
1307cdc0497Smrg */
13141687f09Smrg#define AMDGPU_GEM_CREATE_CP_MQD_GFX9		(1 << 8)
13288f8a8d2Smrg/* Flag that BO may contain sensitive data that must be wiped before
13388f8a8d2Smrg * releasing the memory
13488f8a8d2Smrg */
13588f8a8d2Smrg#define AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE	(1 << 9)
13641687f09Smrg/* Flag that BO will be encrypted and that the TMZ bit should be
13741687f09Smrg * set in the PTEs when mapping this buffer via GPUVM or
13841687f09Smrg * accessing it with various hw blocks
13941687f09Smrg */
14041687f09Smrg#define AMDGPU_GEM_CREATE_ENCRYPTED		(1 << 10)
1413f012e29Smrg
1423f012e29Smrgstruct drm_amdgpu_gem_create_in  {
1433f012e29Smrg	/** the requested memory size */
144d8807b2fSmrg	__u64 bo_size;
1453f012e29Smrg	/** physical start_addr alignment in bytes for some HW requirements */
146d8807b2fSmrg	__u64 alignment;
1473f012e29Smrg	/** the requested memory domains */
148d8807b2fSmrg	__u64 domains;
1493f012e29Smrg	/** allocation flags */
150d8807b2fSmrg	__u64 domain_flags;
1513f012e29Smrg};
1523f012e29Smrg
1533f012e29Smrgstruct drm_amdgpu_gem_create_out  {
1543f012e29Smrg	/** returned GEM object handle */
155d8807b2fSmrg	__u32 handle;
156d8807b2fSmrg	__u32 _pad;
1573f012e29Smrg};
1583f012e29Smrg
1593f012e29Smrgunion drm_amdgpu_gem_create {
1603f012e29Smrg	struct drm_amdgpu_gem_create_in		in;
1613f012e29Smrg	struct drm_amdgpu_gem_create_out	out;
1623f012e29Smrg};
1633f012e29Smrg
1643f012e29Smrg/** Opcode to create new residency list.  */
1653f012e29Smrg#define AMDGPU_BO_LIST_OP_CREATE	0
1663f012e29Smrg/** Opcode to destroy previously created residency list */
1673f012e29Smrg#define AMDGPU_BO_LIST_OP_DESTROY	1
1683f012e29Smrg/** Opcode to update resource information in the list */
1693f012e29Smrg#define AMDGPU_BO_LIST_OP_UPDATE	2
1703f012e29Smrg
1713f012e29Smrgstruct drm_amdgpu_bo_list_in {
1723f012e29Smrg	/** Type of operation */
173d8807b2fSmrg	__u32 operation;
1743f012e29Smrg	/** Handle of list or 0 if we want to create one */
175d8807b2fSmrg	__u32 list_handle;
1763f012e29Smrg	/** Number of BOs in list  */
177d8807b2fSmrg	__u32 bo_number;
1783f012e29Smrg	/** Size of each element describing BO */
179d8807b2fSmrg	__u32 bo_info_size;
1803f012e29Smrg	/** Pointer to array describing BOs */
181d8807b2fSmrg	__u64 bo_info_ptr;
1823f012e29Smrg};
1833f012e29Smrg
1843f012e29Smrgstruct drm_amdgpu_bo_list_entry {
1853f012e29Smrg	/** Handle of BO */
186d8807b2fSmrg	__u32 bo_handle;
1873f012e29Smrg	/** New (if specified) BO priority to be used during migration */
188d8807b2fSmrg	__u32 bo_priority;
1893f012e29Smrg};
1903f012e29Smrg
1913f012e29Smrgstruct drm_amdgpu_bo_list_out {
1923f012e29Smrg	/** Handle of resource list  */
193d8807b2fSmrg	__u32 list_handle;
194d8807b2fSmrg	__u32 _pad;
1953f012e29Smrg};
1963f012e29Smrg
1973f012e29Smrgunion drm_amdgpu_bo_list {
1983f012e29Smrg	struct drm_amdgpu_bo_list_in in;
1993f012e29Smrg	struct drm_amdgpu_bo_list_out out;
2003f012e29Smrg};
2013f012e29Smrg
2023f012e29Smrg/* context related */
2033f012e29Smrg#define AMDGPU_CTX_OP_ALLOC_CTX	1
2043f012e29Smrg#define AMDGPU_CTX_OP_FREE_CTX	2
2053f012e29Smrg#define AMDGPU_CTX_OP_QUERY_STATE	3
2067cdc0497Smrg#define AMDGPU_CTX_OP_QUERY_STATE2	4
2073f012e29Smrg
2083f012e29Smrg/* GPU reset status */
2093f012e29Smrg#define AMDGPU_CTX_NO_RESET		0
2103f012e29Smrg/* this the context caused it */
2113f012e29Smrg#define AMDGPU_CTX_GUILTY_RESET		1
2123f012e29Smrg/* some other context caused it */
2133f012e29Smrg#define AMDGPU_CTX_INNOCENT_RESET	2
2143f012e29Smrg/* unknown cause */
2153f012e29Smrg#define AMDGPU_CTX_UNKNOWN_RESET	3
2163f012e29Smrg
21788f8a8d2Smrg/* indicate gpu reset occured after ctx created */
2187cdc0497Smrg#define AMDGPU_CTX_QUERY2_FLAGS_RESET    (1<<0)
21988f8a8d2Smrg/* indicate vram lost occured after ctx created */
2207cdc0497Smrg#define AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST (1<<1)
2217cdc0497Smrg/* indicate some job from this context once cause gpu hang */
2227cdc0497Smrg#define AMDGPU_CTX_QUERY2_FLAGS_GUILTY   (1<<2)
2235324fb0dSmrg/* indicate some errors are detected by RAS */
2245324fb0dSmrg#define AMDGPU_CTX_QUERY2_FLAGS_RAS_CE   (1<<3)
2255324fb0dSmrg#define AMDGPU_CTX_QUERY2_FLAGS_RAS_UE   (1<<4)
2267cdc0497Smrg
22700a23bdaSmrg/* Context priority level */
22800a23bdaSmrg#define AMDGPU_CTX_PRIORITY_UNSET       -2048
22900a23bdaSmrg#define AMDGPU_CTX_PRIORITY_VERY_LOW    -1023
23000a23bdaSmrg#define AMDGPU_CTX_PRIORITY_LOW         -512
23100a23bdaSmrg#define AMDGPU_CTX_PRIORITY_NORMAL      0
23288f8a8d2Smrg/*
23388f8a8d2Smrg * When used in struct drm_amdgpu_ctx_in, a priority above NORMAL requires
23488f8a8d2Smrg * CAP_SYS_NICE or DRM_MASTER
23588f8a8d2Smrg*/
23600a23bdaSmrg#define AMDGPU_CTX_PRIORITY_HIGH        512
23700a23bdaSmrg#define AMDGPU_CTX_PRIORITY_VERY_HIGH   1023
23800a23bdaSmrg
2393f012e29Smrgstruct drm_amdgpu_ctx_in {
2403f012e29Smrg	/** AMDGPU_CTX_OP_* */
241d8807b2fSmrg	__u32	op;
2423f012e29Smrg	/** For future use, no flags defined so far */
243d8807b2fSmrg	__u32	flags;
244d8807b2fSmrg	__u32	ctx_id;
24588f8a8d2Smrg	/** AMDGPU_CTX_PRIORITY_* */
24600a23bdaSmrg	__s32	priority;
2473f012e29Smrg};
2483f012e29Smrg
2493f012e29Smrgunion drm_amdgpu_ctx_out {
2503f012e29Smrg		struct {
251d8807b2fSmrg			__u32	ctx_id;
252d8807b2fSmrg			__u32	_pad;
2533f012e29Smrg		} alloc;
2543f012e29Smrg
2553f012e29Smrg		struct {
2563f012e29Smrg			/** For future use, no flags defined so far */
257d8807b2fSmrg			__u64	flags;
2583f012e29Smrg			/** Number of resets caused by this context so far. */
259d8807b2fSmrg			__u32	hangs;
2603f012e29Smrg			/** Reset status since the last call of the ioctl. */
261d8807b2fSmrg			__u32	reset_status;
2623f012e29Smrg		} state;
2633f012e29Smrg};
2643f012e29Smrg
2653f012e29Smrgunion drm_amdgpu_ctx {
2663f012e29Smrg	struct drm_amdgpu_ctx_in in;
2673f012e29Smrg	union drm_amdgpu_ctx_out out;
2683f012e29Smrg};
2693f012e29Smrg
270d8807b2fSmrg/* vm ioctl */
271d8807b2fSmrg#define AMDGPU_VM_OP_RESERVE_VMID	1
272d8807b2fSmrg#define AMDGPU_VM_OP_UNRESERVE_VMID	2
273d8807b2fSmrg
274d8807b2fSmrgstruct drm_amdgpu_vm_in {
275d8807b2fSmrg	/** AMDGPU_VM_OP_* */
276d8807b2fSmrg	__u32	op;
277d8807b2fSmrg	__u32	flags;
278d8807b2fSmrg};
279d8807b2fSmrg
280d8807b2fSmrgstruct drm_amdgpu_vm_out {
281d8807b2fSmrg	/** For future use, no flags defined so far */
282d8807b2fSmrg	__u64	flags;
283d8807b2fSmrg};
284d8807b2fSmrg
285d8807b2fSmrgunion drm_amdgpu_vm {
286d8807b2fSmrg	struct drm_amdgpu_vm_in in;
287d8807b2fSmrg	struct drm_amdgpu_vm_out out;
288d8807b2fSmrg};
289d8807b2fSmrg
29000a23bdaSmrg/* sched ioctl */
29100a23bdaSmrg#define AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE	1
2925324fb0dSmrg#define AMDGPU_SCHED_OP_CONTEXT_PRIORITY_OVERRIDE	2
29300a23bdaSmrg
29400a23bdaSmrgstruct drm_amdgpu_sched_in {
29500a23bdaSmrg	/* AMDGPU_SCHED_OP_* */
29600a23bdaSmrg	__u32	op;
29700a23bdaSmrg	__u32	fd;
29888f8a8d2Smrg	/** AMDGPU_CTX_PRIORITY_* */
29900a23bdaSmrg	__s32	priority;
3005324fb0dSmrg	__u32   ctx_id;
30100a23bdaSmrg};
30200a23bdaSmrg
30300a23bdaSmrgunion drm_amdgpu_sched {
30400a23bdaSmrg	struct drm_amdgpu_sched_in in;
30500a23bdaSmrg};
30600a23bdaSmrg
3073f012e29Smrg/*
3083f012e29Smrg * This is not a reliable API and you should expect it to fail for any
3093f012e29Smrg * number of reasons and have fallback path that do not use userptr to
3103f012e29Smrg * perform any operation.
3113f012e29Smrg */
3123f012e29Smrg#define AMDGPU_GEM_USERPTR_READONLY	(1 << 0)
3133f012e29Smrg#define AMDGPU_GEM_USERPTR_ANONONLY	(1 << 1)
3143f012e29Smrg#define AMDGPU_GEM_USERPTR_VALIDATE	(1 << 2)
3153f012e29Smrg#define AMDGPU_GEM_USERPTR_REGISTER	(1 << 3)
3163f012e29Smrg
3173f012e29Smrgstruct drm_amdgpu_gem_userptr {
318d8807b2fSmrg	__u64		addr;
319d8807b2fSmrg	__u64		size;
3203f012e29Smrg	/* AMDGPU_GEM_USERPTR_* */
321d8807b2fSmrg	__u32		flags;
3223f012e29Smrg	/* Resulting GEM handle */
323d8807b2fSmrg	__u32		handle;
3243f012e29Smrg};
3253f012e29Smrg
326d8807b2fSmrg/* SI-CI-VI: */
3273f012e29Smrg/* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */
3283f012e29Smrg#define AMDGPU_TILING_ARRAY_MODE_SHIFT			0
3293f012e29Smrg#define AMDGPU_TILING_ARRAY_MODE_MASK			0xf
3303f012e29Smrg#define AMDGPU_TILING_PIPE_CONFIG_SHIFT			4
3313f012e29Smrg#define AMDGPU_TILING_PIPE_CONFIG_MASK			0x1f
3323f012e29Smrg#define AMDGPU_TILING_TILE_SPLIT_SHIFT			9
3333f012e29Smrg#define AMDGPU_TILING_TILE_SPLIT_MASK			0x7
3343f012e29Smrg#define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT		12
3353f012e29Smrg#define AMDGPU_TILING_MICRO_TILE_MODE_MASK		0x7
3363f012e29Smrg#define AMDGPU_TILING_BANK_WIDTH_SHIFT			15
3373f012e29Smrg#define AMDGPU_TILING_BANK_WIDTH_MASK			0x3
3383f012e29Smrg#define AMDGPU_TILING_BANK_HEIGHT_SHIFT			17
3393f012e29Smrg#define AMDGPU_TILING_BANK_HEIGHT_MASK			0x3
3403f012e29Smrg#define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT		19
3413f012e29Smrg#define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK		0x3
3423f012e29Smrg#define AMDGPU_TILING_NUM_BANKS_SHIFT			21
3433f012e29Smrg#define AMDGPU_TILING_NUM_BANKS_MASK			0x3
3443f012e29Smrg
345d8807b2fSmrg/* GFX9 and later: */
346d8807b2fSmrg#define AMDGPU_TILING_SWIZZLE_MODE_SHIFT		0
347d8807b2fSmrg#define AMDGPU_TILING_SWIZZLE_MODE_MASK			0x1f
3486532f28eSmrg#define AMDGPU_TILING_DCC_OFFSET_256B_SHIFT		5
3496532f28eSmrg#define AMDGPU_TILING_DCC_OFFSET_256B_MASK		0xFFFFFF
3506532f28eSmrg#define AMDGPU_TILING_DCC_PITCH_MAX_SHIFT		29
3516532f28eSmrg#define AMDGPU_TILING_DCC_PITCH_MAX_MASK		0x3FFF
3526532f28eSmrg#define AMDGPU_TILING_DCC_INDEPENDENT_64B_SHIFT		43
3536532f28eSmrg#define AMDGPU_TILING_DCC_INDEPENDENT_64B_MASK		0x1
35441687f09Smrg#define AMDGPU_TILING_DCC_INDEPENDENT_128B_SHIFT	44
35541687f09Smrg#define AMDGPU_TILING_DCC_INDEPENDENT_128B_MASK		0x1
35641687f09Smrg#define AMDGPU_TILING_SCANOUT_SHIFT			63
35741687f09Smrg#define AMDGPU_TILING_SCANOUT_MASK			0x1
358d8807b2fSmrg
359d8807b2fSmrg/* Set/Get helpers for tiling flags. */
3603f012e29Smrg#define AMDGPU_TILING_SET(field, value) \
361d8807b2fSmrg	(((__u64)(value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT)
3623f012e29Smrg#define AMDGPU_TILING_GET(value, field) \
363d8807b2fSmrg	(((__u64)(value) >> AMDGPU_TILING_##field##_SHIFT) & AMDGPU_TILING_##field##_MASK)
3643f012e29Smrg
3653f012e29Smrg#define AMDGPU_GEM_METADATA_OP_SET_METADATA                  1
3663f012e29Smrg#define AMDGPU_GEM_METADATA_OP_GET_METADATA                  2
3673f012e29Smrg
3683f012e29Smrg/** The same structure is shared for input/output */
3693f012e29Smrgstruct drm_amdgpu_gem_metadata {
3703f012e29Smrg	/** GEM Object handle */
371d8807b2fSmrg	__u32	handle;
3723f012e29Smrg	/** Do we want get or set metadata */
373d8807b2fSmrg	__u32	op;
3743f012e29Smrg	struct {
3753f012e29Smrg		/** For future use, no flags defined so far */
376d8807b2fSmrg		__u64	flags;
3773f012e29Smrg		/** family specific tiling info */
378d8807b2fSmrg		__u64	tiling_info;
379d8807b2fSmrg		__u32	data_size_bytes;
380d8807b2fSmrg		__u32	data[64];
3813f012e29Smrg	} data;
3823f012e29Smrg};
3833f012e29Smrg
3843f012e29Smrgstruct drm_amdgpu_gem_mmap_in {
3853f012e29Smrg	/** the GEM object handle */
386d8807b2fSmrg	__u32 handle;
387d8807b2fSmrg	__u32 _pad;
3883f012e29Smrg};
3893f012e29Smrg
3903f012e29Smrgstruct drm_amdgpu_gem_mmap_out {
3913f012e29Smrg	/** mmap offset from the vma offset manager */
392d8807b2fSmrg	__u64 addr_ptr;
3933f012e29Smrg};
3943f012e29Smrg
3953f012e29Smrgunion drm_amdgpu_gem_mmap {
3963f012e29Smrg	struct drm_amdgpu_gem_mmap_in   in;
3973f012e29Smrg	struct drm_amdgpu_gem_mmap_out out;
3983f012e29Smrg};
3993f012e29Smrg
4003f012e29Smrgstruct drm_amdgpu_gem_wait_idle_in {
4013f012e29Smrg	/** GEM object handle */
402d8807b2fSmrg	__u32 handle;
4033f012e29Smrg	/** For future use, no flags defined so far */
404d8807b2fSmrg	__u32 flags;
4053f012e29Smrg	/** Absolute timeout to wait */
406d8807b2fSmrg	__u64 timeout;
4073f012e29Smrg};
4083f012e29Smrg
4093f012e29Smrgstruct drm_amdgpu_gem_wait_idle_out {
4103f012e29Smrg	/** BO status:  0 - BO is idle, 1 - BO is busy */
411d8807b2fSmrg	__u32 status;
4123f012e29Smrg	/** Returned current memory domain */
413d8807b2fSmrg	__u32 domain;
4143f012e29Smrg};
4153f012e29Smrg
4163f012e29Smrgunion drm_amdgpu_gem_wait_idle {
4173f012e29Smrg	struct drm_amdgpu_gem_wait_idle_in  in;
4183f012e29Smrg	struct drm_amdgpu_gem_wait_idle_out out;
4193f012e29Smrg};
4203f012e29Smrg
4213f012e29Smrgstruct drm_amdgpu_wait_cs_in {
422d8807b2fSmrg	/* Command submission handle
423d8807b2fSmrg         * handle equals 0 means none to wait for
424d8807b2fSmrg         * handle equals ~0ull means wait for the latest sequence number
425d8807b2fSmrg         */
426d8807b2fSmrg	__u64 handle;
4273f012e29Smrg	/** Absolute timeout to wait */
428d8807b2fSmrg	__u64 timeout;
429d8807b2fSmrg	__u32 ip_type;
430d8807b2fSmrg	__u32 ip_instance;
431d8807b2fSmrg	__u32 ring;
432d8807b2fSmrg	__u32 ctx_id;
4333f012e29Smrg};
4343f012e29Smrg
4353f012e29Smrgstruct drm_amdgpu_wait_cs_out {
4363f012e29Smrg	/** CS status:  0 - CS completed, 1 - CS still busy */
437d8807b2fSmrg	__u64 status;
4383f012e29Smrg};
4393f012e29Smrg
4403f012e29Smrgunion drm_amdgpu_wait_cs {
4413f012e29Smrg	struct drm_amdgpu_wait_cs_in in;
4423f012e29Smrg	struct drm_amdgpu_wait_cs_out out;
4433f012e29Smrg};
4443f012e29Smrg
445d8807b2fSmrgstruct drm_amdgpu_fence {
446d8807b2fSmrg	__u32 ctx_id;
447d8807b2fSmrg	__u32 ip_type;
448d8807b2fSmrg	__u32 ip_instance;
449d8807b2fSmrg	__u32 ring;
450d8807b2fSmrg	__u64 seq_no;
451d8807b2fSmrg};
452d8807b2fSmrg
453d8807b2fSmrgstruct drm_amdgpu_wait_fences_in {
454d8807b2fSmrg	/** This points to uint64_t * which points to fences */
455d8807b2fSmrg	__u64 fences;
456d8807b2fSmrg	__u32 fence_count;
457d8807b2fSmrg	__u32 wait_all;
458d8807b2fSmrg	__u64 timeout_ns;
459d8807b2fSmrg};
460d8807b2fSmrg
461d8807b2fSmrgstruct drm_amdgpu_wait_fences_out {
462d8807b2fSmrg	__u32 status;
463d8807b2fSmrg	__u32 first_signaled;
464d8807b2fSmrg};
465d8807b2fSmrg
466d8807b2fSmrgunion drm_amdgpu_wait_fences {
467d8807b2fSmrg	struct drm_amdgpu_wait_fences_in in;
468d8807b2fSmrg	struct drm_amdgpu_wait_fences_out out;
469d8807b2fSmrg};
470d8807b2fSmrg
4713f012e29Smrg#define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO	0
4723f012e29Smrg#define AMDGPU_GEM_OP_SET_PLACEMENT		1
4733f012e29Smrg
4743f012e29Smrg/* Sets or returns a value associated with a buffer. */
4753f012e29Smrgstruct drm_amdgpu_gem_op {
4763f012e29Smrg	/** GEM object handle */
477d8807b2fSmrg	__u32	handle;
4783f012e29Smrg	/** AMDGPU_GEM_OP_* */
479d8807b2fSmrg	__u32	op;
4803f012e29Smrg	/** Input or return value */
481d8807b2fSmrg	__u64	value;
4823f012e29Smrg};
4833f012e29Smrg
4843f012e29Smrg#define AMDGPU_VA_OP_MAP			1
4853f012e29Smrg#define AMDGPU_VA_OP_UNMAP			2
486d8807b2fSmrg#define AMDGPU_VA_OP_CLEAR			3
487d8807b2fSmrg#define AMDGPU_VA_OP_REPLACE			4
4883f012e29Smrg
4893f012e29Smrg/* Delay the page table update till the next CS */
4903f012e29Smrg#define AMDGPU_VM_DELAY_UPDATE		(1 << 0)
4913f012e29Smrg
4923f012e29Smrg/* Mapping flags */
4933f012e29Smrg/* readable mapping */
4943f012e29Smrg#define AMDGPU_VM_PAGE_READABLE		(1 << 1)
4953f012e29Smrg/* writable mapping */
4963f012e29Smrg#define AMDGPU_VM_PAGE_WRITEABLE	(1 << 2)
4973f012e29Smrg/* executable mapping, new for VI */
4983f012e29Smrg#define AMDGPU_VM_PAGE_EXECUTABLE	(1 << 3)
499d8807b2fSmrg/* partially resident texture */
500d8807b2fSmrg#define AMDGPU_VM_PAGE_PRT		(1 << 4)
501d8807b2fSmrg/* MTYPE flags use bit 5 to 8 */
502d8807b2fSmrg#define AMDGPU_VM_MTYPE_MASK		(0xf << 5)
503d8807b2fSmrg/* Default MTYPE. Pre-AI must use this.  Recommended for newer ASICs. */
504d8807b2fSmrg#define AMDGPU_VM_MTYPE_DEFAULT		(0 << 5)
50541687f09Smrg/* Use Non Coherent MTYPE instead of default MTYPE */
506d8807b2fSmrg#define AMDGPU_VM_MTYPE_NC		(1 << 5)
50741687f09Smrg/* Use Write Combine MTYPE instead of default MTYPE */
508d8807b2fSmrg#define AMDGPU_VM_MTYPE_WC		(2 << 5)
50941687f09Smrg/* Use Cache Coherent MTYPE instead of default MTYPE */
510d8807b2fSmrg#define AMDGPU_VM_MTYPE_CC		(3 << 5)
51141687f09Smrg/* Use UnCached MTYPE instead of default MTYPE */
512d8807b2fSmrg#define AMDGPU_VM_MTYPE_UC		(4 << 5)
51341687f09Smrg/* Use Read Write MTYPE instead of default MTYPE */
51441687f09Smrg#define AMDGPU_VM_MTYPE_RW		(5 << 5)
5153f012e29Smrg
5163f012e29Smrgstruct drm_amdgpu_gem_va {
5173f012e29Smrg	/** GEM object handle */
518d8807b2fSmrg	__u32 handle;
519d8807b2fSmrg	__u32 _pad;
5203f012e29Smrg	/** AMDGPU_VA_OP_* */
521d8807b2fSmrg	__u32 operation;
5223f012e29Smrg	/** AMDGPU_VM_PAGE_* */
523d8807b2fSmrg	__u32 flags;
5243f012e29Smrg	/** va address to assign . Must be correctly aligned.*/
525d8807b2fSmrg	__u64 va_address;
5263f012e29Smrg	/** Specify offset inside of BO to assign. Must be correctly aligned.*/
527d8807b2fSmrg	__u64 offset_in_bo;
5283f012e29Smrg	/** Specify mapping size. Must be correctly aligned. */
529d8807b2fSmrg	__u64 map_size;
5303f012e29Smrg};
5313f012e29Smrg
5323f012e29Smrg#define AMDGPU_HW_IP_GFX          0
5333f012e29Smrg#define AMDGPU_HW_IP_COMPUTE      1
5343f012e29Smrg#define AMDGPU_HW_IP_DMA          2
5353f012e29Smrg#define AMDGPU_HW_IP_UVD          3
5363f012e29Smrg#define AMDGPU_HW_IP_VCE          4
537d8807b2fSmrg#define AMDGPU_HW_IP_UVD_ENC      5
538d8807b2fSmrg#define AMDGPU_HW_IP_VCN_DEC      6
539d8807b2fSmrg#define AMDGPU_HW_IP_VCN_ENC      7
5407cdc0497Smrg#define AMDGPU_HW_IP_VCN_JPEG     8
5417cdc0497Smrg#define AMDGPU_HW_IP_NUM          9
5423f012e29Smrg
5433f012e29Smrg#define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1
5443f012e29Smrg
5453f012e29Smrg#define AMDGPU_CHUNK_ID_IB		0x01
5463f012e29Smrg#define AMDGPU_CHUNK_ID_FENCE		0x02
5473f012e29Smrg#define AMDGPU_CHUNK_ID_DEPENDENCIES	0x03
548d8807b2fSmrg#define AMDGPU_CHUNK_ID_SYNCOBJ_IN      0x04
549d8807b2fSmrg#define AMDGPU_CHUNK_ID_SYNCOBJ_OUT     0x05
5507cdc0497Smrg#define AMDGPU_CHUNK_ID_BO_HANDLES      0x06
5515324fb0dSmrg#define AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES	0x07
5525324fb0dSmrg#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT    0x08
5535324fb0dSmrg#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL  0x09
5543f012e29Smrg
5553f012e29Smrgstruct drm_amdgpu_cs_chunk {
556d8807b2fSmrg	__u32		chunk_id;
557d8807b2fSmrg	__u32		length_dw;
558d8807b2fSmrg	__u64		chunk_data;
5593f012e29Smrg};
5603f012e29Smrg
5613f012e29Smrgstruct drm_amdgpu_cs_in {
5623f012e29Smrg	/** Rendering context id */
563d8807b2fSmrg	__u32		ctx_id;
5643f012e29Smrg	/**  Handle of resource list associated with CS */
565d8807b2fSmrg	__u32		bo_list_handle;
566d8807b2fSmrg	__u32		num_chunks;
56741687f09Smrg	__u32		flags;
568d8807b2fSmrg	/** this points to __u64 * which point to cs chunks */
569d8807b2fSmrg	__u64		chunks;
5703f012e29Smrg};
5713f012e29Smrg
5723f012e29Smrgstruct drm_amdgpu_cs_out {
573d8807b2fSmrg	__u64 handle;
5743f012e29Smrg};
5753f012e29Smrg
5763f012e29Smrgunion drm_amdgpu_cs {
5773f012e29Smrg	struct drm_amdgpu_cs_in in;
5783f012e29Smrg	struct drm_amdgpu_cs_out out;
5793f012e29Smrg};
5803f012e29Smrg
5813f012e29Smrg/* Specify flags to be used for IB */
5823f012e29Smrg
5833f012e29Smrg/* This IB should be submitted to CE */
5843f012e29Smrg#define AMDGPU_IB_FLAG_CE	(1<<0)
5853f012e29Smrg
586d8807b2fSmrg/* Preamble flag, which means the IB could be dropped if no context switch */
5873f012e29Smrg#define AMDGPU_IB_FLAG_PREAMBLE (1<<1)
5883f012e29Smrg
589d8807b2fSmrg/* Preempt flag, IB should set Pre_enb bit if PREEMPT flag detected */
590d8807b2fSmrg#define AMDGPU_IB_FLAG_PREEMPT (1<<2)
591d8807b2fSmrg
5927cdc0497Smrg/* The IB fence should do the L2 writeback but not invalidate any shader
5937cdc0497Smrg * caches (L2/vL1/sL1/I$). */
5947cdc0497Smrg#define AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE (1 << 3)
5957cdc0497Smrg
5965324fb0dSmrg/* Set GDS_COMPUTE_MAX_WAVE_ID = DEFAULT before PACKET3_INDIRECT_BUFFER.
5975324fb0dSmrg * This will reset wave ID counters for the IB.
5985324fb0dSmrg */
5995324fb0dSmrg#define AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID (1 << 4)
6005324fb0dSmrg
60141687f09Smrg/* Flag the IB as secure (TMZ)
60241687f09Smrg */
60341687f09Smrg#define AMDGPU_IB_FLAGS_SECURE  (1 << 5)
60441687f09Smrg
60541687f09Smrg/* Tell KMD to flush and invalidate caches
60641687f09Smrg */
60741687f09Smrg#define AMDGPU_IB_FLAG_EMIT_MEM_SYNC  (1 << 6)
60841687f09Smrg
6093f012e29Smrgstruct drm_amdgpu_cs_chunk_ib {
610d8807b2fSmrg	__u32 _pad;
6113f012e29Smrg	/** AMDGPU_IB_FLAG_* */
612d8807b2fSmrg	__u32 flags;
6133f012e29Smrg	/** Virtual address to begin IB execution */
614d8807b2fSmrg	__u64 va_start;
6153f012e29Smrg	/** Size of submission */
616d8807b2fSmrg	__u32 ib_bytes;
6173f012e29Smrg	/** HW IP to submit to */
618d8807b2fSmrg	__u32 ip_type;
6193f012e29Smrg	/** HW IP index of the same type to submit to  */
620d8807b2fSmrg	__u32 ip_instance;
6213f012e29Smrg	/** Ring index to submit to */
622d8807b2fSmrg	__u32 ring;
6233f012e29Smrg};
6243f012e29Smrg
6253f012e29Smrgstruct drm_amdgpu_cs_chunk_dep {
626d8807b2fSmrg	__u32 ip_type;
627d8807b2fSmrg	__u32 ip_instance;
628d8807b2fSmrg	__u32 ring;
629d8807b2fSmrg	__u32 ctx_id;
630d8807b2fSmrg	__u64 handle;
6313f012e29Smrg};
6323f012e29Smrg
6333f012e29Smrgstruct drm_amdgpu_cs_chunk_fence {
634d8807b2fSmrg	__u32 handle;
635d8807b2fSmrg	__u32 offset;
636d8807b2fSmrg};
637d8807b2fSmrg
638d8807b2fSmrgstruct drm_amdgpu_cs_chunk_sem {
639d8807b2fSmrg	__u32 handle;
6403f012e29Smrg};
6413f012e29Smrg
6425324fb0dSmrgstruct drm_amdgpu_cs_chunk_syncobj {
64388f8a8d2Smrg       __u32 handle;
64488f8a8d2Smrg       __u32 flags;
64588f8a8d2Smrg       __u64 point;
6465324fb0dSmrg};
6475324fb0dSmrg
64800a23bdaSmrg#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ	0
64900a23bdaSmrg#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD	1
65000a23bdaSmrg#define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD	2
65100a23bdaSmrg
65200a23bdaSmrgunion drm_amdgpu_fence_to_handle {
65300a23bdaSmrg	struct {
65400a23bdaSmrg		struct drm_amdgpu_fence fence;
65500a23bdaSmrg		__u32 what;
65600a23bdaSmrg		__u32 pad;
65700a23bdaSmrg	} in;
65800a23bdaSmrg	struct {
65900a23bdaSmrg		__u32 handle;
66000a23bdaSmrg	} out;
66100a23bdaSmrg};
66200a23bdaSmrg
6633f012e29Smrgstruct drm_amdgpu_cs_chunk_data {
6643f012e29Smrg	union {
6653f012e29Smrg		struct drm_amdgpu_cs_chunk_ib		ib_data;
6663f012e29Smrg		struct drm_amdgpu_cs_chunk_fence	fence_data;
6673f012e29Smrg	};
6683f012e29Smrg};
6693f012e29Smrg
67041687f09Smrg/*
6713f012e29Smrg *  Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU
6723f012e29Smrg *
6733f012e29Smrg */
6743f012e29Smrg#define AMDGPU_IDS_FLAGS_FUSION         0x1
675d8807b2fSmrg#define AMDGPU_IDS_FLAGS_PREEMPTION     0x2
67641687f09Smrg#define AMDGPU_IDS_FLAGS_TMZ            0x4
6773f012e29Smrg
6783f012e29Smrg/* indicate if acceleration can be working */
6793f012e29Smrg#define AMDGPU_INFO_ACCEL_WORKING		0x00
6803f012e29Smrg/* get the crtc_id from the mode object id? */
6813f012e29Smrg#define AMDGPU_INFO_CRTC_FROM_ID		0x01
6823f012e29Smrg/* query hw IP info */
6833f012e29Smrg#define AMDGPU_INFO_HW_IP_INFO			0x02
6843f012e29Smrg/* query hw IP instance count for the specified type */
6853f012e29Smrg#define AMDGPU_INFO_HW_IP_COUNT			0x03
6863f012e29Smrg/* timestamp for GL_ARB_timer_query */
6873f012e29Smrg#define AMDGPU_INFO_TIMESTAMP			0x05
6883f012e29Smrg/* Query the firmware version */
6893f012e29Smrg#define AMDGPU_INFO_FW_VERSION			0x0e
6903f012e29Smrg	/* Subquery id: Query VCE firmware version */
6913f012e29Smrg	#define AMDGPU_INFO_FW_VCE		0x1
6923f012e29Smrg	/* Subquery id: Query UVD firmware version */
6933f012e29Smrg	#define AMDGPU_INFO_FW_UVD		0x2
6943f012e29Smrg	/* Subquery id: Query GMC firmware version */
6953f012e29Smrg	#define AMDGPU_INFO_FW_GMC		0x03
6963f012e29Smrg	/* Subquery id: Query GFX ME firmware version */
6973f012e29Smrg	#define AMDGPU_INFO_FW_GFX_ME		0x04
6983f012e29Smrg	/* Subquery id: Query GFX PFP firmware version */
6993f012e29Smrg	#define AMDGPU_INFO_FW_GFX_PFP		0x05
7003f012e29Smrg	/* Subquery id: Query GFX CE firmware version */
7013f012e29Smrg	#define AMDGPU_INFO_FW_GFX_CE		0x06
7023f012e29Smrg	/* Subquery id: Query GFX RLC firmware version */
7033f012e29Smrg	#define AMDGPU_INFO_FW_GFX_RLC		0x07
7043f012e29Smrg	/* Subquery id: Query GFX MEC firmware version */
7053f012e29Smrg	#define AMDGPU_INFO_FW_GFX_MEC		0x08
7063f012e29Smrg	/* Subquery id: Query SMC firmware version */
7073f012e29Smrg	#define AMDGPU_INFO_FW_SMC		0x0a
7083f012e29Smrg	/* Subquery id: Query SDMA firmware version */
7093f012e29Smrg	#define AMDGPU_INFO_FW_SDMA		0x0b
710d8807b2fSmrg	/* Subquery id: Query PSP SOS firmware version */
711d8807b2fSmrg	#define AMDGPU_INFO_FW_SOS		0x0c
712d8807b2fSmrg	/* Subquery id: Query PSP ASD firmware version */
713d8807b2fSmrg	#define AMDGPU_INFO_FW_ASD		0x0d
7147cdc0497Smrg	/* Subquery id: Query VCN firmware version */
7157cdc0497Smrg	#define AMDGPU_INFO_FW_VCN		0x0e
7167cdc0497Smrg	/* Subquery id: Query GFX RLC SRLC firmware version */
7177cdc0497Smrg	#define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_CNTL 0x0f
7187cdc0497Smrg	/* Subquery id: Query GFX RLC SRLG firmware version */
7197cdc0497Smrg	#define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM 0x10
7207cdc0497Smrg	/* Subquery id: Query GFX RLC SRLS firmware version */
7217cdc0497Smrg	#define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11
7226532f28eSmrg	/* Subquery id: Query DMCU firmware version */
7236532f28eSmrg	#define AMDGPU_INFO_FW_DMCU		0x12
7245324fb0dSmrg	#define AMDGPU_INFO_FW_TA		0x13
72541687f09Smrg	/* Subquery id: Query DMCUB firmware version */
72641687f09Smrg	#define AMDGPU_INFO_FW_DMCUB		0x14
72741687f09Smrg	/* Subquery id: Query TOC firmware version */
72841687f09Smrg	#define AMDGPU_INFO_FW_TOC		0x15
72941687f09Smrg
7303f012e29Smrg/* number of bytes moved for TTM migration */
7313f012e29Smrg#define AMDGPU_INFO_NUM_BYTES_MOVED		0x0f
7323f012e29Smrg/* the used VRAM size */
7333f012e29Smrg#define AMDGPU_INFO_VRAM_USAGE			0x10
7343f012e29Smrg/* the used GTT size */
7353f012e29Smrg#define AMDGPU_INFO_GTT_USAGE			0x11
7363f012e29Smrg/* Information about GDS, etc. resource configuration */
7373f012e29Smrg#define AMDGPU_INFO_GDS_CONFIG			0x13
7383f012e29Smrg/* Query information about VRAM and GTT domains */
7393f012e29Smrg#define AMDGPU_INFO_VRAM_GTT			0x14
7403f012e29Smrg/* Query information about register in MMR address space*/
7413f012e29Smrg#define AMDGPU_INFO_READ_MMR_REG		0x15
7423f012e29Smrg/* Query information about device: rev id, family, etc. */
7433f012e29Smrg#define AMDGPU_INFO_DEV_INFO			0x16
7443f012e29Smrg/* visible vram usage */
7453f012e29Smrg#define AMDGPU_INFO_VIS_VRAM_USAGE		0x17
746d8807b2fSmrg/* number of TTM buffer evictions */
747d8807b2fSmrg#define AMDGPU_INFO_NUM_EVICTIONS		0x18
748d8807b2fSmrg/* Query memory about VRAM and GTT domains */
749d8807b2fSmrg#define AMDGPU_INFO_MEMORY			0x19
750d8807b2fSmrg/* Query vce clock table */
751d8807b2fSmrg#define AMDGPU_INFO_VCE_CLOCK_TABLE		0x1A
752d8807b2fSmrg/* Query vbios related information */
753d8807b2fSmrg#define AMDGPU_INFO_VBIOS			0x1B
754d8807b2fSmrg	/* Subquery id: Query vbios size */
755d8807b2fSmrg	#define AMDGPU_INFO_VBIOS_SIZE		0x1
756d8807b2fSmrg	/* Subquery id: Query vbios image */
757d8807b2fSmrg	#define AMDGPU_INFO_VBIOS_IMAGE		0x2
758d8807b2fSmrg/* Query UVD handles */
759d8807b2fSmrg#define AMDGPU_INFO_NUM_HANDLES			0x1C
760d8807b2fSmrg/* Query sensor related information */
761d8807b2fSmrg#define AMDGPU_INFO_SENSOR			0x1D
762d8807b2fSmrg	/* Subquery id: Query GPU shader clock */
763d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_GFX_SCLK		0x1
764d8807b2fSmrg	/* Subquery id: Query GPU memory clock */
765d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_GFX_MCLK		0x2
766d8807b2fSmrg	/* Subquery id: Query GPU temperature */
767d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_GPU_TEMP		0x3
768d8807b2fSmrg	/* Subquery id: Query GPU load */
769d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_GPU_LOAD		0x4
770d8807b2fSmrg	/* Subquery id: Query average GPU power	*/
771d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_GPU_AVG_POWER	0x5
772d8807b2fSmrg	/* Subquery id: Query northbridge voltage */
773d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_VDDNB		0x6
774d8807b2fSmrg	/* Subquery id: Query graphics voltage */
775d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_VDDGFX		0x7
7767cdc0497Smrg	/* Subquery id: Query GPU stable pstate shader clock */
7777cdc0497Smrg	#define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK		0x8
7787cdc0497Smrg	/* Subquery id: Query GPU stable pstate memory clock */
7797cdc0497Smrg	#define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK		0x9
780d8807b2fSmrg/* Number of VRAM page faults on CPU access. */
781d8807b2fSmrg#define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS	0x1E
78200a23bdaSmrg#define AMDGPU_INFO_VRAM_LOST_COUNTER		0x1F
7835324fb0dSmrg/* query ras mask of enabled features*/
7845324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_FEATURES	0x20
78541687f09Smrg/* query video encode/decode caps */
78641687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS			0x21
78741687f09Smrg	/* Subquery id: Decode */
78841687f09Smrg	#define AMDGPU_INFO_VIDEO_CAPS_DECODE		0
78941687f09Smrg	/* Subquery id: Encode */
79041687f09Smrg	#define AMDGPU_INFO_VIDEO_CAPS_ENCODE		1
7915324fb0dSmrg
7925324fb0dSmrg/* RAS MASK: UMC (VRAM) */
7935324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_UMC			(1 << 0)
7945324fb0dSmrg/* RAS MASK: SDMA */
7955324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_SDMA			(1 << 1)
7965324fb0dSmrg/* RAS MASK: GFX */
7975324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_GFX			(1 << 2)
7985324fb0dSmrg/* RAS MASK: MMHUB */
7995324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_MMHUB			(1 << 3)
8005324fb0dSmrg/* RAS MASK: ATHUB */
8015324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_ATHUB			(1 << 4)
8025324fb0dSmrg/* RAS MASK: PCIE */
8035324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_PCIE			(1 << 5)
8045324fb0dSmrg/* RAS MASK: HDP */
8055324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_HDP			(1 << 6)
8065324fb0dSmrg/* RAS MASK: XGMI */
8075324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_XGMI			(1 << 7)
8085324fb0dSmrg/* RAS MASK: DF */
8095324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_DF			(1 << 8)
8105324fb0dSmrg/* RAS MASK: SMN */
8115324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_SMN			(1 << 9)
8125324fb0dSmrg/* RAS MASK: SEM */
8135324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_SEM			(1 << 10)
8145324fb0dSmrg/* RAS MASK: MP0 */
8155324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_MP0			(1 << 11)
8165324fb0dSmrg/* RAS MASK: MP1 */
8175324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_MP1			(1 << 12)
8185324fb0dSmrg/* RAS MASK: FUSE */
8195324fb0dSmrg#define AMDGPU_INFO_RAS_ENABLED_FUSE			(1 << 13)
8203f012e29Smrg
8213f012e29Smrg#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT	0
8223f012e29Smrg#define AMDGPU_INFO_MMR_SE_INDEX_MASK	0xff
8233f012e29Smrg#define AMDGPU_INFO_MMR_SH_INDEX_SHIFT	8
8243f012e29Smrg#define AMDGPU_INFO_MMR_SH_INDEX_MASK	0xff
8253f012e29Smrg
826037b3c26Smrgstruct drm_amdgpu_query_fw {
827037b3c26Smrg	/** AMDGPU_INFO_FW_* */
828d8807b2fSmrg	__u32 fw_type;
829037b3c26Smrg	/**
830037b3c26Smrg	 * Index of the IP if there are more IPs of
831037b3c26Smrg	 * the same type.
832037b3c26Smrg	 */
833d8807b2fSmrg	__u32 ip_instance;
834037b3c26Smrg	/**
835037b3c26Smrg	 * Index of the engine. Whether this is used depends
836037b3c26Smrg	 * on the firmware type. (e.g. MEC, SDMA)
837037b3c26Smrg	 */
838d8807b2fSmrg	__u32 index;
839d8807b2fSmrg	__u32 _pad;
840037b3c26Smrg};
841037b3c26Smrg
8423f012e29Smrg/* Input structure for the INFO ioctl */
8433f012e29Smrgstruct drm_amdgpu_info {
8443f012e29Smrg	/* Where the return value will be stored */
845d8807b2fSmrg	__u64 return_pointer;
8463f012e29Smrg	/* The size of the return value. Just like "size" in "snprintf",
8473f012e29Smrg	 * it limits how many bytes the kernel can write. */
848d8807b2fSmrg	__u32 return_size;
8493f012e29Smrg	/* The query request id. */
850d8807b2fSmrg	__u32 query;
8513f012e29Smrg
8523f012e29Smrg	union {
8533f012e29Smrg		struct {
854d8807b2fSmrg			__u32 id;
855d8807b2fSmrg			__u32 _pad;
8563f012e29Smrg		} mode_crtc;
8573f012e29Smrg
8583f012e29Smrg		struct {
8593f012e29Smrg			/** AMDGPU_HW_IP_* */
860d8807b2fSmrg			__u32 type;
8613f012e29Smrg			/**
8623f012e29Smrg			 * Index of the IP if there are more IPs of the same
8633f012e29Smrg			 * type. Ignored by AMDGPU_INFO_HW_IP_COUNT.
8643f012e29Smrg			 */
865d8807b2fSmrg			__u32 ip_instance;
8663f012e29Smrg		} query_hw_ip;
8673f012e29Smrg
8683f012e29Smrg		struct {
869d8807b2fSmrg			__u32 dword_offset;
8703f012e29Smrg			/** number of registers to read */
871d8807b2fSmrg			__u32 count;
872d8807b2fSmrg			__u32 instance;
8733f012e29Smrg			/** For future use, no flags defined so far */
874d8807b2fSmrg			__u32 flags;
8753f012e29Smrg		} read_mmr_reg;
8763f012e29Smrg
877037b3c26Smrg		struct drm_amdgpu_query_fw query_fw;
878d8807b2fSmrg
879d8807b2fSmrg		struct {
880d8807b2fSmrg			__u32 type;
881d8807b2fSmrg			__u32 offset;
882d8807b2fSmrg		} vbios_info;
883d8807b2fSmrg
884d8807b2fSmrg		struct {
885d8807b2fSmrg			__u32 type;
886d8807b2fSmrg		} sensor_info;
88741687f09Smrg
88841687f09Smrg		struct {
88941687f09Smrg			__u32 type;
89041687f09Smrg		} video_cap;
8913f012e29Smrg	};
8923f012e29Smrg};
8933f012e29Smrg
8943f012e29Smrgstruct drm_amdgpu_info_gds {
8953f012e29Smrg	/** GDS GFX partition size */
896d8807b2fSmrg	__u32 gds_gfx_partition_size;
8973f012e29Smrg	/** GDS compute partition size */
898d8807b2fSmrg	__u32 compute_partition_size;
8993f012e29Smrg	/** total GDS memory size */
900d8807b2fSmrg	__u32 gds_total_size;
9013f012e29Smrg	/** GWS size per GFX partition */
902d8807b2fSmrg	__u32 gws_per_gfx_partition;
9033f012e29Smrg	/** GSW size per compute partition */
904d8807b2fSmrg	__u32 gws_per_compute_partition;
9053f012e29Smrg	/** OA size per GFX partition */
906d8807b2fSmrg	__u32 oa_per_gfx_partition;
9073f012e29Smrg	/** OA size per compute partition */
908d8807b2fSmrg	__u32 oa_per_compute_partition;
909d8807b2fSmrg	__u32 _pad;
9103f012e29Smrg};
9113f012e29Smrg
9123f012e29Smrgstruct drm_amdgpu_info_vram_gtt {
913d8807b2fSmrg	__u64 vram_size;
914d8807b2fSmrg	__u64 vram_cpu_accessible_size;
915d8807b2fSmrg	__u64 gtt_size;
916d8807b2fSmrg};
917d8807b2fSmrg
918d8807b2fSmrgstruct drm_amdgpu_heap_info {
919d8807b2fSmrg	/** max. physical memory */
920d8807b2fSmrg	__u64 total_heap_size;
921d8807b2fSmrg
922d8807b2fSmrg	/** Theoretical max. available memory in the given heap */
923d8807b2fSmrg	__u64 usable_heap_size;
924d8807b2fSmrg
925d8807b2fSmrg	/**
926d8807b2fSmrg	 * Number of bytes allocated in the heap. This includes all processes
927d8807b2fSmrg	 * and private allocations in the kernel. It changes when new buffers
928d8807b2fSmrg	 * are allocated, freed, and moved. It cannot be larger than
929d8807b2fSmrg	 * heap_size.
930d8807b2fSmrg	 */
931d8807b2fSmrg	__u64 heap_usage;
932d8807b2fSmrg
933d8807b2fSmrg	/**
934d8807b2fSmrg	 * Theoretical possible max. size of buffer which
935d8807b2fSmrg	 * could be allocated in the given heap
936d8807b2fSmrg	 */
937d8807b2fSmrg	__u64 max_allocation;
938d8807b2fSmrg};
939d8807b2fSmrg
940d8807b2fSmrgstruct drm_amdgpu_memory_info {
941d8807b2fSmrg	struct drm_amdgpu_heap_info vram;
942d8807b2fSmrg	struct drm_amdgpu_heap_info cpu_accessible_vram;
943d8807b2fSmrg	struct drm_amdgpu_heap_info gtt;
9443f012e29Smrg};
9453f012e29Smrg
9463f012e29Smrgstruct drm_amdgpu_info_firmware {
947d8807b2fSmrg	__u32 ver;
948d8807b2fSmrg	__u32 feature;
9493f012e29Smrg};
9503f012e29Smrg
9513f012e29Smrg#define AMDGPU_VRAM_TYPE_UNKNOWN 0
9523f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR1 1
9533f012e29Smrg#define AMDGPU_VRAM_TYPE_DDR2  2
9543f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR3 3
9553f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR4 4
9563f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR5 5
9573f012e29Smrg#define AMDGPU_VRAM_TYPE_HBM   6
9583f012e29Smrg#define AMDGPU_VRAM_TYPE_DDR3  7
9597cdc0497Smrg#define AMDGPU_VRAM_TYPE_DDR4  8
9605324fb0dSmrg#define AMDGPU_VRAM_TYPE_GDDR6 9
96141687f09Smrg#define AMDGPU_VRAM_TYPE_DDR5  10
9623f012e29Smrg
9633f012e29Smrgstruct drm_amdgpu_info_device {
9643f012e29Smrg	/** PCI Device ID */
965d8807b2fSmrg	__u32 device_id;
9663f012e29Smrg	/** Internal chip revision: A0, A1, etc.) */
967d8807b2fSmrg	__u32 chip_rev;
968d8807b2fSmrg	__u32 external_rev;
9693f012e29Smrg	/** Revision id in PCI Config space */
970d8807b2fSmrg	__u32 pci_rev;
971d8807b2fSmrg	__u32 family;
972d8807b2fSmrg	__u32 num_shader_engines;
973d8807b2fSmrg	__u32 num_shader_arrays_per_engine;
9743f012e29Smrg	/* in KHz */
975d8807b2fSmrg	__u32 gpu_counter_freq;
976d8807b2fSmrg	__u64 max_engine_clock;
977d8807b2fSmrg	__u64 max_memory_clock;
9783f012e29Smrg	/* cu information */
979d8807b2fSmrg	__u32 cu_active_number;
98000a23bdaSmrg	/* NOTE: cu_ao_mask is INVALID, DON'T use it */
981d8807b2fSmrg	__u32 cu_ao_mask;
982d8807b2fSmrg	__u32 cu_bitmap[4][4];
9833f012e29Smrg	/** Render backend pipe mask. One render backend is CB+DB. */
984d8807b2fSmrg	__u32 enabled_rb_pipes_mask;
985d8807b2fSmrg	__u32 num_rb_pipes;
986d8807b2fSmrg	__u32 num_hw_gfx_contexts;
987d8807b2fSmrg	__u32 _pad;
988d8807b2fSmrg	__u64 ids_flags;
9893f012e29Smrg	/** Starting virtual address for UMDs. */
990d8807b2fSmrg	__u64 virtual_address_offset;
9913f012e29Smrg	/** The maximum virtual address */
992d8807b2fSmrg	__u64 virtual_address_max;
9933f012e29Smrg	/** Required alignment of virtual addresses. */
994d8807b2fSmrg	__u32 virtual_address_alignment;
9953f012e29Smrg	/** Page table entry - fragment size */
996d8807b2fSmrg	__u32 pte_fragment_size;
997d8807b2fSmrg	__u32 gart_page_size;
9983f012e29Smrg	/** constant engine ram size*/
999d8807b2fSmrg	__u32 ce_ram_size;
10003f012e29Smrg	/** video memory type info*/
1001d8807b2fSmrg	__u32 vram_type;
10023f012e29Smrg	/** video memory bit width*/
1003d8807b2fSmrg	__u32 vram_bit_width;
10043f012e29Smrg	/* vce harvesting instance */
1005d8807b2fSmrg	__u32 vce_harvest_config;
1006d8807b2fSmrg	/* gfx double offchip LDS buffers */
1007d8807b2fSmrg	__u32 gc_double_offchip_lds_buf;
1008d8807b2fSmrg	/* NGG Primitive Buffer */
1009d8807b2fSmrg	__u64 prim_buf_gpu_addr;
1010d8807b2fSmrg	/* NGG Position Buffer */
1011d8807b2fSmrg	__u64 pos_buf_gpu_addr;
1012d8807b2fSmrg	/* NGG Control Sideband */
1013d8807b2fSmrg	__u64 cntl_sb_buf_gpu_addr;
1014d8807b2fSmrg	/* NGG Parameter Cache */
1015d8807b2fSmrg	__u64 param_buf_gpu_addr;
1016d8807b2fSmrg	__u32 prim_buf_size;
1017d8807b2fSmrg	__u32 pos_buf_size;
1018d8807b2fSmrg	__u32 cntl_sb_buf_size;
1019d8807b2fSmrg	__u32 param_buf_size;
1020d8807b2fSmrg	/* wavefront size*/
1021d8807b2fSmrg	__u32 wave_front_size;
1022d8807b2fSmrg	/* shader visible vgprs*/
1023d8807b2fSmrg	__u32 num_shader_visible_vgprs;
1024d8807b2fSmrg	/* CU per shader array*/
1025d8807b2fSmrg	__u32 num_cu_per_sh;
1026d8807b2fSmrg	/* number of tcc blocks*/
1027d8807b2fSmrg	__u32 num_tcc_blocks;
1028d8807b2fSmrg	/* gs vgt table depth*/
1029d8807b2fSmrg	__u32 gs_vgt_table_depth;
1030d8807b2fSmrg	/* gs primitive buffer depth*/
1031d8807b2fSmrg	__u32 gs_prim_buffer_depth;
1032d8807b2fSmrg	/* max gs wavefront per vgt*/
1033d8807b2fSmrg	__u32 max_gs_waves_per_vgt;
1034d8807b2fSmrg	__u32 _pad1;
103500a23bdaSmrg	/* always on cu bitmap */
103600a23bdaSmrg	__u32 cu_ao_bitmap[4][4];
103700a23bdaSmrg	/** Starting high virtual address for UMDs. */
103800a23bdaSmrg	__u64 high_va_offset;
103900a23bdaSmrg	/** The maximum high virtual address */
104000a23bdaSmrg	__u64 high_va_max;
10415324fb0dSmrg	/* gfx10 pa_sc_tile_steering_override */
10425324fb0dSmrg	__u32 pa_sc_tile_steering_override;
104388f8a8d2Smrg	/* disabled TCCs */
104488f8a8d2Smrg	__u64 tcc_disabled_mask;
10453f012e29Smrg};
10463f012e29Smrg
10473f012e29Smrgstruct drm_amdgpu_info_hw_ip {
10483f012e29Smrg	/** Version of h/w IP */
1049d8807b2fSmrg	__u32  hw_ip_version_major;
1050d8807b2fSmrg	__u32  hw_ip_version_minor;
10513f012e29Smrg	/** Capabilities */
1052d8807b2fSmrg	__u64  capabilities_flags;
10533f012e29Smrg	/** command buffer address start alignment*/
1054d8807b2fSmrg	__u32  ib_start_alignment;
10553f012e29Smrg	/** command buffer size alignment*/
1056d8807b2fSmrg	__u32  ib_size_alignment;
10573f012e29Smrg	/** Bitmask of available rings. Bit 0 means ring 0, etc. */
1058d8807b2fSmrg	__u32  available_rings;
1059d8807b2fSmrg	__u32  _pad;
1060d8807b2fSmrg};
1061d8807b2fSmrg
1062d8807b2fSmrgstruct drm_amdgpu_info_num_handles {
1063d8807b2fSmrg	/** Max handles as supported by firmware for UVD */
1064d8807b2fSmrg	__u32  uvd_max_handles;
1065d8807b2fSmrg	/** Handles currently in use for UVD */
1066d8807b2fSmrg	__u32  uvd_used_handles;
1067d8807b2fSmrg};
1068d8807b2fSmrg
1069d8807b2fSmrg#define AMDGPU_VCE_CLOCK_TABLE_ENTRIES		6
1070d8807b2fSmrg
1071d8807b2fSmrgstruct drm_amdgpu_info_vce_clock_table_entry {
1072d8807b2fSmrg	/** System clock */
1073d8807b2fSmrg	__u32 sclk;
1074d8807b2fSmrg	/** Memory clock */
1075d8807b2fSmrg	__u32 mclk;
1076d8807b2fSmrg	/** VCE clock */
1077d8807b2fSmrg	__u32 eclk;
1078d8807b2fSmrg	__u32 pad;
1079d8807b2fSmrg};
1080d8807b2fSmrg
1081d8807b2fSmrgstruct drm_amdgpu_info_vce_clock_table {
1082d8807b2fSmrg	struct drm_amdgpu_info_vce_clock_table_entry entries[AMDGPU_VCE_CLOCK_TABLE_ENTRIES];
1083d8807b2fSmrg	__u32 num_valid_entries;
1084d8807b2fSmrg	__u32 pad;
10853f012e29Smrg};
10863f012e29Smrg
108741687f09Smrg/* query video encode/decode caps */
108841687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2			0
108941687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4			1
109041687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1			2
109141687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC		3
109241687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC			4
109341687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG			5
109441687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9			6
109541687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1			7
109641687f09Smrg#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT			8
109741687f09Smrg
109841687f09Smrgstruct drm_amdgpu_info_video_codec_info {
109941687f09Smrg	__u32 valid;
110041687f09Smrg	__u32 max_width;
110141687f09Smrg	__u32 max_height;
110241687f09Smrg	__u32 max_pixels_per_frame;
110341687f09Smrg	__u32 max_level;
110441687f09Smrg	__u32 pad;
110541687f09Smrg};
110641687f09Smrg
110741687f09Smrgstruct drm_amdgpu_info_video_caps {
110841687f09Smrg	struct drm_amdgpu_info_video_codec_info codec_info[AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT];
110941687f09Smrg};
111041687f09Smrg
11113f012e29Smrg/*
11123f012e29Smrg * Supported GPU families
11133f012e29Smrg */
11143f012e29Smrg#define AMDGPU_FAMILY_UNKNOWN			0
1115d8807b2fSmrg#define AMDGPU_FAMILY_SI			110 /* Hainan, Oland, Verde, Pitcairn, Tahiti */
11163f012e29Smrg#define AMDGPU_FAMILY_CI			120 /* Bonaire, Hawaii */
11173f012e29Smrg#define AMDGPU_FAMILY_KV			125 /* Kaveri, Kabini, Mullins */
11183f012e29Smrg#define AMDGPU_FAMILY_VI			130 /* Iceland, Tonga */
1119037b3c26Smrg#define AMDGPU_FAMILY_CZ			135 /* Carrizo, Stoney */
1120d8807b2fSmrg#define AMDGPU_FAMILY_AI			141 /* Vega10 */
1121d8807b2fSmrg#define AMDGPU_FAMILY_RV			142 /* Raven */
11225324fb0dSmrg#define AMDGPU_FAMILY_NV			143 /* Navi10 */
112341687f09Smrg#define AMDGPU_FAMILY_VGH			144 /* Van Gogh */
1124037b3c26Smrg
1125037b3c26Smrg#if defined(__cplusplus)
1126037b3c26Smrg}
1127037b3c26Smrg#endif
11283f012e29Smrg
11293f012e29Smrg#endif
1130