amdgpu: sync amdgpu_drm.h with the kernel
PATCH 1/2 amdgpu: sync amdgpu_drm.h with the kernel
From: Marek Olšák <[email protected]>
--- include/drm/amdgpu_drm.h | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-)
include/drm/amdgpu_drm.h +26 -16
@@ -27,20 +27,24 @@* Kevin E. Martin <[email protected]> * Gareth Hughes <[email protected]> * Keith Whitwell <[email protected]> */ #ifndef __AMDGPU_DRM_H__ #define __AMDGPU_DRM_H__ #include "drm.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define DRM_AMDGPU_GEM_CREATE 0x00 #define DRM_AMDGPU_GEM_MMAP 0x01 #define DRM_AMDGPU_CTX 0x02 #define DRM_AMDGPU_BO_LIST 0x03 #define DRM_AMDGPU_CS 0x04 #define DRM_AMDGPU_INFO 0x05 #define DRM_AMDGPU_GEM_METADATA 0x06 #define DRM_AMDGPU_GEM_WAIT_IDLE 0x07 #define DRM_AMDGPU_GEM_VA 0x08 #define DRM_AMDGPU_WAIT_CS 0x09
@@ -476,20 +480,36 @@ struct drm_amdgpu_cs_chunk_data {/* Query information about device: rev id, family, etc. */ #define AMDGPU_INFO_DEV_INFO 0x16/* visible vram usage */ #define AMDGPU_INFO_VIS_VRAM_USAGE 0x17#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff#define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8#define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff +struct drm_amdgpu_query_fw { +/** AMDGPU_INFO_FW_* */ +uint32_t fw_type; +/** +* Index of the IP if there are more IPs of +* the same type. +*/ +uint32_t ip_instance; +/** +* Index of the engine. Whether this is used depends +* on the firmware type. (e.g. MEC, SDMA) +*/ +uint32_t index; +uint32_t _pad; +}; +/* Input structure for the INFO ioctl */ struct drm_amdgpu_info {/* Where the return value will be stored */ uint64_t return_pointer;/* The size of the return value. Just like "size" in "snprintf", * it limits how many bytes the kernel can write. */ uint32_t return_size;/* The query request id. */ uint32_t query;
@@ -511,35 +531,21 @@ struct drm_amdgpu_info {struct {uint32_t dword_offset;/** number of registers to read */ uint32_t count;uint32_t instance;/** For future use, no flags defined so far */ uint32_t flags; } read_mmr_reg; -struct { -/** AMDGPU_INFO_FW_* */ -uint32_t fw_type; -/** -* Index of the IP if there are more IPs of -* the same type. -*/ -uint32_t ip_instance; -/** -* Index of the engine. Whether this is used depends -* on the firmware type. (e.g. MEC, SDMA) -*/ -uint32_t index; -uint32_t _pad; - } query_fw; +struct drm_amdgpu_query_fw query_fw; }; };struct drm_amdgpu_info_gds {/** GDS GFX partition size */ uint32_t gds_gfx_partition_size;/** GDS compute partition size */ uint32_t compute_partition_size;/** total GDS memory size */ uint32_t gds_total_size;
@@ -634,13 +640,17 @@ struct drm_amdgpu_info_hw_ip { };/* * Supported GPU families */ #define AMDGPU_FAMILY_UNKNOWN 0#define AMDGPU_FAMILY_SI 110/* Hainan, Oland, Verde, Pitcairn, Tahiti */ #define AMDGPU_FAMILY_CI 120/* Bonaire, Hawaii */ #define AMDGPU_FAMILY_KV 125/* Kaveri, Kabini, Mullins */ #define AMDGPU_FAMILY_VI 130/* Iceland, Tonga */ -#define AMDGPU_FAMILY_CZ 135/* Carrizo */ +#define AMDGPU_FAMILY_CZ 135/* Carrizo, Stoney */ + +#if defined(__cplusplus) +} +#endif #endif
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1471616102-4889-1-git-send-email-maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 2/2 radeon: sync radeon_drm.h with the kernel
From: Marek Olšák <[email protected]>
the CIK tile mode definitions are moved out,
userspace doesn't use them
--- include/drm/radeon_drm.h | 51 +++++++++++++++++++++++++++++++++++++++--------- radeon/radeon_surface.c | 8 ++++++++ 2 files changed, 50 insertions(+), 9 deletions(-)
include/drm/radeon_drm.h +42 -9
@@ -28,20 +28,24 @@* Kevin E. Martin <[email protected]> * Gareth Hughes <[email protected]> * Keith Whitwell <[email protected]> */ #ifndef __RADEON_DRM_H__ #define __RADEON_DRM_H__ #include "drm.h" +#if defined(__cplusplus) +extern "C" { +#endif + /* WARNING: If you change any of these defines, make sure to change the * defines in the X server file (radeon_sarea.h) */ #ifndef __RADEON_SAREA_DEFINES__ #define __RADEON_SAREA_DEFINES__ /* Old style state flags, required for sarea interface (1.1 and 1.2 * clears) and 1.2 drm_vertex2 ioctl. */ #define RADEON_UPLOAD_CONTEXT 0x00000001
@@ -504,20 +508,21 @@ typedef struct {#define DRM_RADEON_GEM_PWRITE 0x22#define DRM_RADEON_GEM_SET_DOMAIN 0x23#define DRM_RADEON_GEM_WAIT_IDLE 0x24#define DRM_RADEON_CS 0x26#define DRM_RADEON_INFO 0x27#define DRM_RADEON_GEM_SET_TILING 0x28#define DRM_RADEON_GEM_GET_TILING 0x29#define DRM_RADEON_GEM_BUSY 0x2a#define DRM_RADEON_GEM_VA 0x2b#define DRM_RADEON_GEM_OP 0x2c +#define DRM_RADEON_GEM_USERPTR 0x2d#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)#define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t)#define DRM_IOCTL_RADEON_CP_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESET)#define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_IDLE)#define DRM_IOCTL_RADEON_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_RESET)#define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FULLSCREEN, drm_radeon_fullscreen_t)#define DRM_IOCTL_RADEON_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_SWAP)#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CLEAR, drm_radeon_clear_t)
@@ -547,20 +552,21 @@ typedef struct {#define DRM_IOCTL_RADEON_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PWRITE, struct drm_radeon_gem_pwrite)#define DRM_IOCTL_RADEON_GEM_SET_DOMAIN DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_DOMAIN, struct drm_radeon_gem_set_domain)#define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle)#define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs)#define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info)#define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling)#define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling)#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy)#define DRM_IOCTL_RADEON_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va)#define DRM_IOCTL_RADEON_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_OP, struct drm_radeon_gem_op) +#define DRM_IOCTL_RADEON_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_USERPTR, struct drm_radeon_gem_userptr) typedef struct drm_radeon_init { enum { RADEON_INIT_CP = 0x01, RADEON_CLEANUP_CP = 0x02, RADEON_INIT_R200_CP = 0x03, RADEON_INIT_R300_CP = 0x04, RADEON_INIT_R600_CP = 0x05 } func; unsigned long sarea_priv_offset;
@@ -789,30 +795,53 @@ typedef struct drm_radeon_surface_free {#define RADEON_GEM_DOMAIN_CPU 0x1#define RADEON_GEM_DOMAIN_GTT 0x2#define RADEON_GEM_DOMAIN_VRAM 0x4struct drm_radeon_gem_info {uint64_t gart_size;uint64_t vram_size;uint64_t vram_visible; }; -#define RADEON_GEM_NO_BACKING_STORE 1 +#define RADEON_GEM_NO_BACKING_STORE (1 << 0) +#define RADEON_GEM_GTT_UC (1 << 1) +#define RADEON_GEM_GTT_WC (1 << 2) +/* BO is expected to be accessed by the CPU */ +#define RADEON_GEM_CPU_ACCESS (1 << 3) +/* CPU access is not expected to work for this BO */ +#define RADEON_GEM_NO_CPU_ACCESS (1 << 4)struct drm_radeon_gem_create {uint64_t size;uint64_t alignment;uint32_t handle;uint32_t initial_domain;uint32_t flags; }; +/* +* This is not a reliable API and you should expect it to fail for any +* number of reasons and have fallback path that do not use userptr to +* perform any operation. +*/ +#define RADEON_GEM_USERPTR_READONLY (1 << 0) +#define RADEON_GEM_USERPTR_ANONONLY (1 << 1) +#define RADEON_GEM_USERPTR_VALIDATE (1 << 2) +#define RADEON_GEM_USERPTR_REGISTER (1 << 3) + +struct drm_radeon_gem_userptr { +uint64_t addr; +uint64_t size; +uint32_t flags; +uint32_t handle; +}; +#define RADEON_TILING_MACRO 0x1#define RADEON_TILING_MICRO 0x2#define RADEON_TILING_SWAP_16BIT 0x4#define RADEON_TILING_R600_NO_SCANOUT RADEON_TILING_SWAP_16BIT#define RADEON_TILING_SWAP_32BIT 0x8/* this object requires a surface when mapped - i.e. front buffer */ #define RADEON_TILING_SURFACE 0x10#define RADEON_TILING_MICRO_SQUARE 0x20#define RADEON_TILING_EG_BANKW_SHIFT 8#define RADEON_TILING_EG_BANKW_MASK 0xf
@@ -936,20 +965,21 @@ struct drm_radeon_gem_va {/* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */ /* 0 = normal, + = higher priority, - = lower priority */ struct drm_radeon_cs_chunk {uint32_t chunk_id;uint32_t length_dw;uint64_t chunk_data; };/* drm_radeon_cs_reloc.flags */ +#define RADEON_RELOC_PRIO_MASK (0xf << 0)struct drm_radeon_cs_reloc {uint32_t handle;uint32_t read_domains;uint32_t write_domain;uint32_t flags; };struct drm_radeon_cs {uint32_t num_chunks;
@@ -1001,21 +1031,27 @@ struct drm_radeon_cs {#define RADEON_INFO_SI_BACKEND_ENABLED_MASK 0x19/* max engine clock - needed for OpenCL */ #define RADEON_INFO_MAX_SCLK 0x1a/* version of VCE firmware */ #define RADEON_INFO_VCE_FW_VERSION 0x1b/* version of VCE feedback */ #define RADEON_INFO_VCE_FB_VERSION 0x1c#define RADEON_INFO_NUM_BYTES_MOVED 0x1d#define RADEON_INFO_VRAM_USAGE 0x1e#define RADEON_INFO_GTT_USAGE 0x1f - +#define RADEON_INFO_ACTIVE_CU_COUNT 0x20 +#define RADEON_INFO_CURRENT_GPU_TEMP 0x21 +#define RADEON_INFO_CURRENT_GPU_SCLK 0x22 +#define RADEON_INFO_CURRENT_GPU_MCLK 0x23 +#define RADEON_INFO_READ_REG 0x24 +#define RADEON_INFO_VA_UNMAP_WORKING 0x25 +#define RADEON_INFO_GPU_RESET_COUNTER 0x26struct drm_radeon_info {uint32_t request;uint32_t pad;uint64_t value; };/* Those correspond to the tile index to use, this is to explicitly state * the API that is implicitly defined by the tile mode array. */
@@ -1027,20 +1063,17 @@ struct drm_radeon_info {#define SI_TILE_MODE_COLOR_2D_32BPP 16#define SI_TILE_MODE_COLOR_2D_64BPP 17#define SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP 11#define SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP 12#define SI_TILE_MODE_DEPTH_STENCIL_1D 4#define SI_TILE_MODE_DEPTH_STENCIL_2D 0#define SI_TILE_MODE_DEPTH_STENCIL_2D_2AA 3#define SI_TILE_MODE_DEPTH_STENCIL_2D_4AA 3#define SI_TILE_MODE_DEPTH_STENCIL_2D_8AA 2 -#define CIK_TILE_MODE_COLOR_2D 14 -#define CIK_TILE_MODE_COLOR_2D_SCANOUT 10 -#define CIK_TILE_MODE_DEPTH_STENCIL_2D_TILESPLIT_64 0 -#define CIK_TILE_MODE_DEPTH_STENCIL_2D_TILESPLIT_128 1 -#define CIK_TILE_MODE_DEPTH_STENCIL_2D_TILESPLIT_256 2 -#define CIK_TILE_MODE_DEPTH_STENCIL_2D_TILESPLIT_512 3 -#define CIK_TILE_MODE_DEPTH_STENCIL_2D_TILESPLIT_ROW_SIZE 4#define CIK_TILE_MODE_DEPTH_STENCIL_1D 5 +#if defined(__cplusplus) +} +#endif +#endif
radeon/radeon_surface.c +8 -0
@@ -35,20 +35,28 @@#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> #include "drm.h" #include "libdrm_macros.h" #include "xf86drm.h" #include "radeon_drm.h" #include "radeon_surface.h" +#define CIK_TILE_MODE_COLOR_2D 14 +#define CIK_TILE_MODE_COLOR_2D_SCANOUT 10 +#define CIK_TILE_MODE_DEPTH_STENCIL_2D_TILESPLIT_64 0 +#define CIK_TILE_MODE_DEPTH_STENCIL_2D_TILESPLIT_128 1 +#define CIK_TILE_MODE_DEPTH_STENCIL_2D_TILESPLIT_256 2 +#define CIK_TILE_MODE_DEPTH_STENCIL_2D_TILESPLIT_512 3 +#define CIK_TILE_MODE_DEPTH_STENCIL_2D_TILESPLIT_ROW_SIZE 4 +#define ALIGN (value, alignment) (((value) + alignment - 1) & ~(alignment - 1))#define MAX2 (A ,B ) ((A) > (B) ? (A) : (B))#define MIN2 (A ,B ) ((A) < (B) ? (A) : (B))/* keep this private */ enum radeon_family {CHIP_UNKNOWN ,CHIP_R600 ,CHIP_RV610 ,CHIP_RV630 ,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Edward O'Callaghan
Reviewed-byThis series is,
Reviewed-by Edward O'Callaghan <[email protected]>
Quoted 119 lines · Marek Olšák
From: Marek Olšák <[email protected]>
--- include/drm/amdgpu_drm.h | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-)include/drm/amdgpu_drm.h +21
-15@@ -27,20 +27,24 @@* Kevin E. Martin <[email protected]> * Gareth Hughes <[email protected]> * Keith Whitwell <keith-CdwZJljFklH+2FeEXyspIVaTQe2KTcn/@public.gmane.org> */ #ifndef __AMDGPU_DRM_H__ #define __AMDGPU_DRM_H__ #include "drm.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define DRM_AMDGPU_GEM_CREATE 0x00 #define DRM_AMDGPU_GEM_MMAP 0x01 #define DRM_AMDGPU_CTX 0x02 #define DRM_AMDGPU_BO_LIST 0x03 #define DRM_AMDGPU_CS 0x04 #define DRM_AMDGPU_INFO 0x05 #define DRM_AMDGPU_GEM_METADATA 0x06 #define DRM_AMDGPU_GEM_WAIT_IDLE 0x07 #define DRM_AMDGPU_GEM_VA 0x08 #define DRM_AMDGPU_WAIT_CS 0x09@@ -476,20 +480,36 @@ struct drm_amdgpu_cs_chunk_data {/* Query information about device: rev id, family, etc. */ #define AMDGPU_INFO_DEV_INFO 0x16/* visible vram usage */ #define AMDGPU_INFO_VIS_VRAM_USAGE 0x17#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff#define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8#define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff +struct drm_amdgpu_query_fw { +/** AMDGPU_INFO_FW_* */ +uint32_t fw_type; +/** +* Index of the IP if there are more IPs of +* the same type. +*/ +uint32_t ip_instance; +/** +* Index of the engine. Whether this is used depends +* on the firmware type. (e.g. MEC, SDMA) +*/ +uint32_t index; +uint32_t _pad; +}; +/* Input structure for the INFO ioctl */ struct drm_amdgpu_info {/* Where the return value will be stored */ uint64_t return_pointer;/* The size of the return value. Just like "size" in "snprintf", * it limits how many bytes the kernel can write. */ uint32_t return_size;/* The query request id. */ uint32_t query;@@ -511,35 +531,21 @@ struct drm_amdgpu_info {struct {uint32_t dword_offset;/** number of registers to read */ uint32_t count;uint32_t instance;/** For future use, no flags defined so far */ uint32_t flags; } read_mmr_reg; -struct { -/** AMDGPU_INFO_FW_* */ -uint32_t fw_type; -/** -* Index of the IP if there are more IPs of -* the same type. -*/ -uint32_t ip_instance; -/** -* Index of the engine. Whether this is used depends -* on the firmware type. (e.g. MEC, SDMA) -*/ -uint32_t index; -uint32_t _pad; - } query_fw; +struct drm_amdgpu_query_fw query_fw; }; };struct drm_amdgpu_info_gds {/** GDS GFX partition size */ uint32_t gds_gfx_partition_size;/** GDS compute partition size */ uint32_t compute_partition_size;/** total GDS memory size */ uint32_t gds_total_size;@@ -634,13 +640,17 @@ struct drm_amdgpu_info_hw_ip { };/* * Supported GPU families */ #define AMDGPU_FAMILY_UNKNOWN 0#define AMDGPU_FAMILY_SI 110/* Hainan, Oland, Verde, Pitcairn, Tahiti */ #define AMDGPU_FAMILY_CI 120/* Bonaire, Hawaii */
include/drm/amdgpu_drm.h struct drm_amdgpu_info_hw_ip { · line 656
Quoted 10 lines
include/drm/amdgpu_drm.h +5
-1#define AMDGPU_FAMILY_KV 125/* Kaveri, Kabini, Mullins */ #define AMDGPU_FAMILY_VI 130/* Iceland, Tonga */ -#define AMDGPU_FAMILY_CZ 135/* Carrizo */ +#define AMDGPU_FAMILY_CZ 135/* Carrizo, Stoney */ + +#if defined(__cplusplus) +} +#endif #endif
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx