18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 38c2ecf20Sopenharmony_ci * All Rights Reserved. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 68c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the 78c2ecf20Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 88c2ecf20Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 98c2ecf20Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to 108c2ecf20Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 118c2ecf20Sopenharmony_ci * the following conditions: 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the 148c2ecf20Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions 158c2ecf20Sopenharmony_ci * of the Software. 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 188c2ecf20Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 198c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 208c2ecf20Sopenharmony_ci * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 218c2ecf20Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 228c2ecf20Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 238c2ecf20Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 248c2ecf20Sopenharmony_ci * 258c2ecf20Sopenharmony_ci */ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#ifndef _UAPI_I915_DRM_H_ 288c2ecf20Sopenharmony_ci#define _UAPI_I915_DRM_H_ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#include "drm.h" 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#if defined(__cplusplus) 338c2ecf20Sopenharmony_ciextern "C" { 348c2ecf20Sopenharmony_ci#endif 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci/* Please note that modifications to all structs defined here are 378c2ecf20Sopenharmony_ci * subject to backwards-compatibility constraints. 388c2ecf20Sopenharmony_ci */ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci/** 418c2ecf20Sopenharmony_ci * DOC: uevents generated by i915 on it's device node 428c2ecf20Sopenharmony_ci * 438c2ecf20Sopenharmony_ci * I915_L3_PARITY_UEVENT - Generated when the driver receives a parity mismatch 448c2ecf20Sopenharmony_ci * event from the gpu l3 cache. Additional information supplied is ROW, 458c2ecf20Sopenharmony_ci * BANK, SUBBANK, SLICE of the affected cacheline. Userspace should keep 468c2ecf20Sopenharmony_ci * track of these events and if a specific cache-line seems to have a 478c2ecf20Sopenharmony_ci * persistent error remap it with the l3 remapping tool supplied in 488c2ecf20Sopenharmony_ci * intel-gpu-tools. The value supplied with the event is always 1. 498c2ecf20Sopenharmony_ci * 508c2ecf20Sopenharmony_ci * I915_ERROR_UEVENT - Generated upon error detection, currently only via 518c2ecf20Sopenharmony_ci * hangcheck. The error detection event is a good indicator of when things 528c2ecf20Sopenharmony_ci * began to go badly. The value supplied with the event is a 1 upon error 538c2ecf20Sopenharmony_ci * detection, and a 0 upon reset completion, signifying no more error 548c2ecf20Sopenharmony_ci * exists. NOTE: Disabling hangcheck or reset via module parameter will 558c2ecf20Sopenharmony_ci * cause the related events to not be seen. 568c2ecf20Sopenharmony_ci * 578c2ecf20Sopenharmony_ci * I915_RESET_UEVENT - Event is generated just before an attempt to reset the 588c2ecf20Sopenharmony_ci * GPU. The value supplied with the event is always 1. NOTE: Disable 598c2ecf20Sopenharmony_ci * reset via module parameter will cause this event to not be seen. 608c2ecf20Sopenharmony_ci */ 618c2ecf20Sopenharmony_ci#define I915_L3_PARITY_UEVENT "L3_PARITY_ERROR" 628c2ecf20Sopenharmony_ci#define I915_ERROR_UEVENT "ERROR" 638c2ecf20Sopenharmony_ci#define I915_RESET_UEVENT "RESET" 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci/* 668c2ecf20Sopenharmony_ci * i915_user_extension: Base class for defining a chain of extensions 678c2ecf20Sopenharmony_ci * 688c2ecf20Sopenharmony_ci * Many interfaces need to grow over time. In most cases we can simply 698c2ecf20Sopenharmony_ci * extend the struct and have userspace pass in more data. Another option, 708c2ecf20Sopenharmony_ci * as demonstrated by Vulkan's approach to providing extensions for forward 718c2ecf20Sopenharmony_ci * and backward compatibility, is to use a list of optional structs to 728c2ecf20Sopenharmony_ci * provide those extra details. 738c2ecf20Sopenharmony_ci * 748c2ecf20Sopenharmony_ci * The key advantage to using an extension chain is that it allows us to 758c2ecf20Sopenharmony_ci * redefine the interface more easily than an ever growing struct of 768c2ecf20Sopenharmony_ci * increasing complexity, and for large parts of that interface to be 778c2ecf20Sopenharmony_ci * entirely optional. The downside is more pointer chasing; chasing across 788c2ecf20Sopenharmony_ci * the __user boundary with pointers encapsulated inside u64. 798c2ecf20Sopenharmony_ci */ 808c2ecf20Sopenharmony_cistruct i915_user_extension { 818c2ecf20Sopenharmony_ci __u64 next_extension; 828c2ecf20Sopenharmony_ci __u32 name; 838c2ecf20Sopenharmony_ci __u32 flags; /* All undefined bits must be zero. */ 848c2ecf20Sopenharmony_ci __u32 rsvd[4]; /* Reserved for future use; must be zero. */ 858c2ecf20Sopenharmony_ci}; 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci/* 888c2ecf20Sopenharmony_ci * MOCS indexes used for GPU surfaces, defining the cacheability of the 898c2ecf20Sopenharmony_ci * surface data and the coherency for this data wrt. CPU vs. GPU accesses. 908c2ecf20Sopenharmony_ci */ 918c2ecf20Sopenharmony_cienum i915_mocs_table_index { 928c2ecf20Sopenharmony_ci /* 938c2ecf20Sopenharmony_ci * Not cached anywhere, coherency between CPU and GPU accesses is 948c2ecf20Sopenharmony_ci * guaranteed. 958c2ecf20Sopenharmony_ci */ 968c2ecf20Sopenharmony_ci I915_MOCS_UNCACHED, 978c2ecf20Sopenharmony_ci /* 988c2ecf20Sopenharmony_ci * Cacheability and coherency controlled by the kernel automatically 998c2ecf20Sopenharmony_ci * based on the DRM_I915_GEM_SET_CACHING IOCTL setting and the current 1008c2ecf20Sopenharmony_ci * usage of the surface (used for display scanout or not). 1018c2ecf20Sopenharmony_ci */ 1028c2ecf20Sopenharmony_ci I915_MOCS_PTE, 1038c2ecf20Sopenharmony_ci /* 1048c2ecf20Sopenharmony_ci * Cached in all GPU caches available on the platform. 1058c2ecf20Sopenharmony_ci * Coherency between CPU and GPU accesses to the surface is not 1068c2ecf20Sopenharmony_ci * guaranteed without extra synchronization. 1078c2ecf20Sopenharmony_ci */ 1088c2ecf20Sopenharmony_ci I915_MOCS_CACHED, 1098c2ecf20Sopenharmony_ci}; 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci/* 1128c2ecf20Sopenharmony_ci * Different engines serve different roles, and there may be more than one 1138c2ecf20Sopenharmony_ci * engine serving each role. enum drm_i915_gem_engine_class provides a 1148c2ecf20Sopenharmony_ci * classification of the role of the engine, which may be used when requesting 1158c2ecf20Sopenharmony_ci * operations to be performed on a certain subset of engines, or for providing 1168c2ecf20Sopenharmony_ci * information about that group. 1178c2ecf20Sopenharmony_ci */ 1188c2ecf20Sopenharmony_cienum drm_i915_gem_engine_class { 1198c2ecf20Sopenharmony_ci I915_ENGINE_CLASS_RENDER = 0, 1208c2ecf20Sopenharmony_ci I915_ENGINE_CLASS_COPY = 1, 1218c2ecf20Sopenharmony_ci I915_ENGINE_CLASS_VIDEO = 2, 1228c2ecf20Sopenharmony_ci I915_ENGINE_CLASS_VIDEO_ENHANCE = 3, 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci /* should be kept compact */ 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci I915_ENGINE_CLASS_INVALID = -1 1278c2ecf20Sopenharmony_ci}; 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci/* 1308c2ecf20Sopenharmony_ci * There may be more than one engine fulfilling any role within the system. 1318c2ecf20Sopenharmony_ci * Each engine of a class is given a unique instance number and therefore 1328c2ecf20Sopenharmony_ci * any engine can be specified by its class:instance tuplet. APIs that allow 1338c2ecf20Sopenharmony_ci * access to any engine in the system will use struct i915_engine_class_instance 1348c2ecf20Sopenharmony_ci * for this identification. 1358c2ecf20Sopenharmony_ci */ 1368c2ecf20Sopenharmony_cistruct i915_engine_class_instance { 1378c2ecf20Sopenharmony_ci __u16 engine_class; /* see enum drm_i915_gem_engine_class */ 1388c2ecf20Sopenharmony_ci __u16 engine_instance; 1398c2ecf20Sopenharmony_ci#define I915_ENGINE_CLASS_INVALID_NONE -1 1408c2ecf20Sopenharmony_ci#define I915_ENGINE_CLASS_INVALID_VIRTUAL -2 1418c2ecf20Sopenharmony_ci}; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci/** 1448c2ecf20Sopenharmony_ci * DOC: perf_events exposed by i915 through /sys/bus/event_sources/drivers/i915 1458c2ecf20Sopenharmony_ci * 1468c2ecf20Sopenharmony_ci */ 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_cienum drm_i915_pmu_engine_sample { 1498c2ecf20Sopenharmony_ci I915_SAMPLE_BUSY = 0, 1508c2ecf20Sopenharmony_ci I915_SAMPLE_WAIT = 1, 1518c2ecf20Sopenharmony_ci I915_SAMPLE_SEMA = 2 1528c2ecf20Sopenharmony_ci}; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#define I915_PMU_SAMPLE_BITS (4) 1558c2ecf20Sopenharmony_ci#define I915_PMU_SAMPLE_MASK (0xf) 1568c2ecf20Sopenharmony_ci#define I915_PMU_SAMPLE_INSTANCE_BITS (8) 1578c2ecf20Sopenharmony_ci#define I915_PMU_CLASS_SHIFT \ 1588c2ecf20Sopenharmony_ci (I915_PMU_SAMPLE_BITS + I915_PMU_SAMPLE_INSTANCE_BITS) 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci#define __I915_PMU_ENGINE(class, instance, sample) \ 1618c2ecf20Sopenharmony_ci ((class) << I915_PMU_CLASS_SHIFT | \ 1628c2ecf20Sopenharmony_ci (instance) << I915_PMU_SAMPLE_BITS | \ 1638c2ecf20Sopenharmony_ci (sample)) 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci#define I915_PMU_ENGINE_BUSY(class, instance) \ 1668c2ecf20Sopenharmony_ci __I915_PMU_ENGINE(class, instance, I915_SAMPLE_BUSY) 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci#define I915_PMU_ENGINE_WAIT(class, instance) \ 1698c2ecf20Sopenharmony_ci __I915_PMU_ENGINE(class, instance, I915_SAMPLE_WAIT) 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci#define I915_PMU_ENGINE_SEMA(class, instance) \ 1728c2ecf20Sopenharmony_ci __I915_PMU_ENGINE(class, instance, I915_SAMPLE_SEMA) 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci#define __I915_PMU_OTHER(x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x)) 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci#define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0) 1778c2ecf20Sopenharmony_ci#define I915_PMU_REQUESTED_FREQUENCY __I915_PMU_OTHER(1) 1788c2ecf20Sopenharmony_ci#define I915_PMU_INTERRUPTS __I915_PMU_OTHER(2) 1798c2ecf20Sopenharmony_ci#define I915_PMU_RC6_RESIDENCY __I915_PMU_OTHER(3) 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci#define I915_PMU_LAST I915_PMU_RC6_RESIDENCY 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci/* Each region is a minimum of 16k, and there are at most 255 of them. 1848c2ecf20Sopenharmony_ci */ 1858c2ecf20Sopenharmony_ci#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use 1868c2ecf20Sopenharmony_ci * of chars for next/prev indices */ 1878c2ecf20Sopenharmony_ci#define I915_LOG_MIN_TEX_REGION_SIZE 14 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_citypedef struct _drm_i915_init { 1908c2ecf20Sopenharmony_ci enum { 1918c2ecf20Sopenharmony_ci I915_INIT_DMA = 0x01, 1928c2ecf20Sopenharmony_ci I915_CLEANUP_DMA = 0x02, 1938c2ecf20Sopenharmony_ci I915_RESUME_DMA = 0x03 1948c2ecf20Sopenharmony_ci } func; 1958c2ecf20Sopenharmony_ci unsigned int mmio_offset; 1968c2ecf20Sopenharmony_ci int sarea_priv_offset; 1978c2ecf20Sopenharmony_ci unsigned int ring_start; 1988c2ecf20Sopenharmony_ci unsigned int ring_end; 1998c2ecf20Sopenharmony_ci unsigned int ring_size; 2008c2ecf20Sopenharmony_ci unsigned int front_offset; 2018c2ecf20Sopenharmony_ci unsigned int back_offset; 2028c2ecf20Sopenharmony_ci unsigned int depth_offset; 2038c2ecf20Sopenharmony_ci unsigned int w; 2048c2ecf20Sopenharmony_ci unsigned int h; 2058c2ecf20Sopenharmony_ci unsigned int pitch; 2068c2ecf20Sopenharmony_ci unsigned int pitch_bits; 2078c2ecf20Sopenharmony_ci unsigned int back_pitch; 2088c2ecf20Sopenharmony_ci unsigned int depth_pitch; 2098c2ecf20Sopenharmony_ci unsigned int cpp; 2108c2ecf20Sopenharmony_ci unsigned int chipset; 2118c2ecf20Sopenharmony_ci} drm_i915_init_t; 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_citypedef struct _drm_i915_sarea { 2148c2ecf20Sopenharmony_ci struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1]; 2158c2ecf20Sopenharmony_ci int last_upload; /* last time texture was uploaded */ 2168c2ecf20Sopenharmony_ci int last_enqueue; /* last time a buffer was enqueued */ 2178c2ecf20Sopenharmony_ci int last_dispatch; /* age of the most recently dispatched buffer */ 2188c2ecf20Sopenharmony_ci int ctxOwner; /* last context to upload state */ 2198c2ecf20Sopenharmony_ci int texAge; 2208c2ecf20Sopenharmony_ci int pf_enabled; /* is pageflipping allowed? */ 2218c2ecf20Sopenharmony_ci int pf_active; 2228c2ecf20Sopenharmony_ci int pf_current_page; /* which buffer is being displayed? */ 2238c2ecf20Sopenharmony_ci int perf_boxes; /* performance boxes to be displayed */ 2248c2ecf20Sopenharmony_ci int width, height; /* screen size in pixels */ 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci drm_handle_t front_handle; 2278c2ecf20Sopenharmony_ci int front_offset; 2288c2ecf20Sopenharmony_ci int front_size; 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci drm_handle_t back_handle; 2318c2ecf20Sopenharmony_ci int back_offset; 2328c2ecf20Sopenharmony_ci int back_size; 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci drm_handle_t depth_handle; 2358c2ecf20Sopenharmony_ci int depth_offset; 2368c2ecf20Sopenharmony_ci int depth_size; 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci drm_handle_t tex_handle; 2398c2ecf20Sopenharmony_ci int tex_offset; 2408c2ecf20Sopenharmony_ci int tex_size; 2418c2ecf20Sopenharmony_ci int log_tex_granularity; 2428c2ecf20Sopenharmony_ci int pitch; 2438c2ecf20Sopenharmony_ci int rotation; /* 0, 90, 180 or 270 */ 2448c2ecf20Sopenharmony_ci int rotated_offset; 2458c2ecf20Sopenharmony_ci int rotated_size; 2468c2ecf20Sopenharmony_ci int rotated_pitch; 2478c2ecf20Sopenharmony_ci int virtualX, virtualY; 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci unsigned int front_tiled; 2508c2ecf20Sopenharmony_ci unsigned int back_tiled; 2518c2ecf20Sopenharmony_ci unsigned int depth_tiled; 2528c2ecf20Sopenharmony_ci unsigned int rotated_tiled; 2538c2ecf20Sopenharmony_ci unsigned int rotated2_tiled; 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci int pipeA_x; 2568c2ecf20Sopenharmony_ci int pipeA_y; 2578c2ecf20Sopenharmony_ci int pipeA_w; 2588c2ecf20Sopenharmony_ci int pipeA_h; 2598c2ecf20Sopenharmony_ci int pipeB_x; 2608c2ecf20Sopenharmony_ci int pipeB_y; 2618c2ecf20Sopenharmony_ci int pipeB_w; 2628c2ecf20Sopenharmony_ci int pipeB_h; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci /* fill out some space for old userspace triple buffer */ 2658c2ecf20Sopenharmony_ci drm_handle_t unused_handle; 2668c2ecf20Sopenharmony_ci __u32 unused1, unused2, unused3; 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci /* buffer object handles for static buffers. May change 2698c2ecf20Sopenharmony_ci * over the lifetime of the client. 2708c2ecf20Sopenharmony_ci */ 2718c2ecf20Sopenharmony_ci __u32 front_bo_handle; 2728c2ecf20Sopenharmony_ci __u32 back_bo_handle; 2738c2ecf20Sopenharmony_ci __u32 unused_bo_handle; 2748c2ecf20Sopenharmony_ci __u32 depth_bo_handle; 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci} drm_i915_sarea_t; 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci/* due to userspace building against these headers we need some compat here */ 2798c2ecf20Sopenharmony_ci#define planeA_x pipeA_x 2808c2ecf20Sopenharmony_ci#define planeA_y pipeA_y 2818c2ecf20Sopenharmony_ci#define planeA_w pipeA_w 2828c2ecf20Sopenharmony_ci#define planeA_h pipeA_h 2838c2ecf20Sopenharmony_ci#define planeB_x pipeB_x 2848c2ecf20Sopenharmony_ci#define planeB_y pipeB_y 2858c2ecf20Sopenharmony_ci#define planeB_w pipeB_w 2868c2ecf20Sopenharmony_ci#define planeB_h pipeB_h 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci/* Flags for perf_boxes 2898c2ecf20Sopenharmony_ci */ 2908c2ecf20Sopenharmony_ci#define I915_BOX_RING_EMPTY 0x1 2918c2ecf20Sopenharmony_ci#define I915_BOX_FLIP 0x2 2928c2ecf20Sopenharmony_ci#define I915_BOX_WAIT 0x4 2938c2ecf20Sopenharmony_ci#define I915_BOX_TEXTURE_LOAD 0x8 2948c2ecf20Sopenharmony_ci#define I915_BOX_LOST_CONTEXT 0x10 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci/* 2978c2ecf20Sopenharmony_ci * i915 specific ioctls. 2988c2ecf20Sopenharmony_ci * 2998c2ecf20Sopenharmony_ci * The device specific ioctl range is [DRM_COMMAND_BASE, DRM_COMMAND_END) ie 3008c2ecf20Sopenharmony_ci * [0x40, 0xa0) (a0 is excluded). The numbers below are defined as offset 3018c2ecf20Sopenharmony_ci * against DRM_COMMAND_BASE and should be between [0x0, 0x60). 3028c2ecf20Sopenharmony_ci */ 3038c2ecf20Sopenharmony_ci#define DRM_I915_INIT 0x00 3048c2ecf20Sopenharmony_ci#define DRM_I915_FLUSH 0x01 3058c2ecf20Sopenharmony_ci#define DRM_I915_FLIP 0x02 3068c2ecf20Sopenharmony_ci#define DRM_I915_BATCHBUFFER 0x03 3078c2ecf20Sopenharmony_ci#define DRM_I915_IRQ_EMIT 0x04 3088c2ecf20Sopenharmony_ci#define DRM_I915_IRQ_WAIT 0x05 3098c2ecf20Sopenharmony_ci#define DRM_I915_GETPARAM 0x06 3108c2ecf20Sopenharmony_ci#define DRM_I915_SETPARAM 0x07 3118c2ecf20Sopenharmony_ci#define DRM_I915_ALLOC 0x08 3128c2ecf20Sopenharmony_ci#define DRM_I915_FREE 0x09 3138c2ecf20Sopenharmony_ci#define DRM_I915_INIT_HEAP 0x0a 3148c2ecf20Sopenharmony_ci#define DRM_I915_CMDBUFFER 0x0b 3158c2ecf20Sopenharmony_ci#define DRM_I915_DESTROY_HEAP 0x0c 3168c2ecf20Sopenharmony_ci#define DRM_I915_SET_VBLANK_PIPE 0x0d 3178c2ecf20Sopenharmony_ci#define DRM_I915_GET_VBLANK_PIPE 0x0e 3188c2ecf20Sopenharmony_ci#define DRM_I915_VBLANK_SWAP 0x0f 3198c2ecf20Sopenharmony_ci#define DRM_I915_HWS_ADDR 0x11 3208c2ecf20Sopenharmony_ci#define DRM_I915_GEM_INIT 0x13 3218c2ecf20Sopenharmony_ci#define DRM_I915_GEM_EXECBUFFER 0x14 3228c2ecf20Sopenharmony_ci#define DRM_I915_GEM_PIN 0x15 3238c2ecf20Sopenharmony_ci#define DRM_I915_GEM_UNPIN 0x16 3248c2ecf20Sopenharmony_ci#define DRM_I915_GEM_BUSY 0x17 3258c2ecf20Sopenharmony_ci#define DRM_I915_GEM_THROTTLE 0x18 3268c2ecf20Sopenharmony_ci#define DRM_I915_GEM_ENTERVT 0x19 3278c2ecf20Sopenharmony_ci#define DRM_I915_GEM_LEAVEVT 0x1a 3288c2ecf20Sopenharmony_ci#define DRM_I915_GEM_CREATE 0x1b 3298c2ecf20Sopenharmony_ci#define DRM_I915_GEM_PREAD 0x1c 3308c2ecf20Sopenharmony_ci#define DRM_I915_GEM_PWRITE 0x1d 3318c2ecf20Sopenharmony_ci#define DRM_I915_GEM_MMAP 0x1e 3328c2ecf20Sopenharmony_ci#define DRM_I915_GEM_SET_DOMAIN 0x1f 3338c2ecf20Sopenharmony_ci#define DRM_I915_GEM_SW_FINISH 0x20 3348c2ecf20Sopenharmony_ci#define DRM_I915_GEM_SET_TILING 0x21 3358c2ecf20Sopenharmony_ci#define DRM_I915_GEM_GET_TILING 0x22 3368c2ecf20Sopenharmony_ci#define DRM_I915_GEM_GET_APERTURE 0x23 3378c2ecf20Sopenharmony_ci#define DRM_I915_GEM_MMAP_GTT 0x24 3388c2ecf20Sopenharmony_ci#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 3398c2ecf20Sopenharmony_ci#define DRM_I915_GEM_MADVISE 0x26 3408c2ecf20Sopenharmony_ci#define DRM_I915_OVERLAY_PUT_IMAGE 0x27 3418c2ecf20Sopenharmony_ci#define DRM_I915_OVERLAY_ATTRS 0x28 3428c2ecf20Sopenharmony_ci#define DRM_I915_GEM_EXECBUFFER2 0x29 3438c2ecf20Sopenharmony_ci#define DRM_I915_GEM_EXECBUFFER2_WR DRM_I915_GEM_EXECBUFFER2 3448c2ecf20Sopenharmony_ci#define DRM_I915_GET_SPRITE_COLORKEY 0x2a 3458c2ecf20Sopenharmony_ci#define DRM_I915_SET_SPRITE_COLORKEY 0x2b 3468c2ecf20Sopenharmony_ci#define DRM_I915_GEM_WAIT 0x2c 3478c2ecf20Sopenharmony_ci#define DRM_I915_GEM_CONTEXT_CREATE 0x2d 3488c2ecf20Sopenharmony_ci#define DRM_I915_GEM_CONTEXT_DESTROY 0x2e 3498c2ecf20Sopenharmony_ci#define DRM_I915_GEM_SET_CACHING 0x2f 3508c2ecf20Sopenharmony_ci#define DRM_I915_GEM_GET_CACHING 0x30 3518c2ecf20Sopenharmony_ci#define DRM_I915_REG_READ 0x31 3528c2ecf20Sopenharmony_ci#define DRM_I915_GET_RESET_STATS 0x32 3538c2ecf20Sopenharmony_ci#define DRM_I915_GEM_USERPTR 0x33 3548c2ecf20Sopenharmony_ci#define DRM_I915_GEM_CONTEXT_GETPARAM 0x34 3558c2ecf20Sopenharmony_ci#define DRM_I915_GEM_CONTEXT_SETPARAM 0x35 3568c2ecf20Sopenharmony_ci#define DRM_I915_PERF_OPEN 0x36 3578c2ecf20Sopenharmony_ci#define DRM_I915_PERF_ADD_CONFIG 0x37 3588c2ecf20Sopenharmony_ci#define DRM_I915_PERF_REMOVE_CONFIG 0x38 3598c2ecf20Sopenharmony_ci#define DRM_I915_QUERY 0x39 3608c2ecf20Sopenharmony_ci#define DRM_I915_GEM_VM_CREATE 0x3a 3618c2ecf20Sopenharmony_ci#define DRM_I915_GEM_VM_DESTROY 0x3b 3628c2ecf20Sopenharmony_ci/* Must be kept compact -- no holes */ 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 3658c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 3668c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) 3678c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) 3688c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) 3698c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) 3708c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t) 3718c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t) 3728c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t) 3738c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) 3748c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) 3758c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) 3768c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) 3778c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 3788c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 3798c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 3808c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init) 3818c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) 3828c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) 3838c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) 3848c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_EXECBUFFER2_WR DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2_WR, struct drm_i915_gem_execbuffer2) 3858c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) 3868c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) 3878c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) 3888c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_SET_CACHING DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching) 3898c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_GET_CACHING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching) 3908c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE) 3918c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT) 3928c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT) 3938c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create) 3948c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread) 3958c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite) 3968c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap) 3978c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt) 3988c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_offset) 3998c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain) 4008c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish) 4018c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) 4028c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) 4038c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) 4048c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id) 4058c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) 4068c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) 4078c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) 4088c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) 4098c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) 4108c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait) 4118c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create) 4128c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create_ext) 4138c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy) 4148c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read) 4158c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats) 4168c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_USERPTR DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr) 4178c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param) 4188c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param) 4198c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_PERF_OPEN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_OPEN, struct drm_i915_perf_open_param) 4208c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config) 4218c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64) 4228c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query) 4238c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_VM_CREATE, struct drm_i915_gem_vm_control) 4248c2ecf20Sopenharmony_ci#define DRM_IOCTL_I915_GEM_VM_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_VM_DESTROY, struct drm_i915_gem_vm_control) 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_ci/* Allow drivers to submit batchbuffers directly to hardware, relying 4278c2ecf20Sopenharmony_ci * on the security mechanisms provided by hardware. 4288c2ecf20Sopenharmony_ci */ 4298c2ecf20Sopenharmony_citypedef struct drm_i915_batchbuffer { 4308c2ecf20Sopenharmony_ci int start; /* agp offset */ 4318c2ecf20Sopenharmony_ci int used; /* nr bytes in use */ 4328c2ecf20Sopenharmony_ci int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 4338c2ecf20Sopenharmony_ci int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 4348c2ecf20Sopenharmony_ci int num_cliprects; /* mulitpass with multiple cliprects? */ 4358c2ecf20Sopenharmony_ci struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */ 4368c2ecf20Sopenharmony_ci} drm_i915_batchbuffer_t; 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ci/* As above, but pass a pointer to userspace buffer which can be 4398c2ecf20Sopenharmony_ci * validated by the kernel prior to sending to hardware. 4408c2ecf20Sopenharmony_ci */ 4418c2ecf20Sopenharmony_citypedef struct _drm_i915_cmdbuffer { 4428c2ecf20Sopenharmony_ci char __user *buf; /* pointer to userspace command buffer */ 4438c2ecf20Sopenharmony_ci int sz; /* nr bytes in buf */ 4448c2ecf20Sopenharmony_ci int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 4458c2ecf20Sopenharmony_ci int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 4468c2ecf20Sopenharmony_ci int num_cliprects; /* mulitpass with multiple cliprects? */ 4478c2ecf20Sopenharmony_ci struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */ 4488c2ecf20Sopenharmony_ci} drm_i915_cmdbuffer_t; 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_ci/* Userspace can request & wait on irq's: 4518c2ecf20Sopenharmony_ci */ 4528c2ecf20Sopenharmony_citypedef struct drm_i915_irq_emit { 4538c2ecf20Sopenharmony_ci int __user *irq_seq; 4548c2ecf20Sopenharmony_ci} drm_i915_irq_emit_t; 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_citypedef struct drm_i915_irq_wait { 4578c2ecf20Sopenharmony_ci int irq_seq; 4588c2ecf20Sopenharmony_ci} drm_i915_irq_wait_t; 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_ci/* 4618c2ecf20Sopenharmony_ci * Different modes of per-process Graphics Translation Table, 4628c2ecf20Sopenharmony_ci * see I915_PARAM_HAS_ALIASING_PPGTT 4638c2ecf20Sopenharmony_ci */ 4648c2ecf20Sopenharmony_ci#define I915_GEM_PPGTT_NONE 0 4658c2ecf20Sopenharmony_ci#define I915_GEM_PPGTT_ALIASING 1 4668c2ecf20Sopenharmony_ci#define I915_GEM_PPGTT_FULL 2 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_ci/* Ioctl to query kernel params: 4698c2ecf20Sopenharmony_ci */ 4708c2ecf20Sopenharmony_ci#define I915_PARAM_IRQ_ACTIVE 1 4718c2ecf20Sopenharmony_ci#define I915_PARAM_ALLOW_BATCHBUFFER 2 4728c2ecf20Sopenharmony_ci#define I915_PARAM_LAST_DISPATCH 3 4738c2ecf20Sopenharmony_ci#define I915_PARAM_CHIPSET_ID 4 4748c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_GEM 5 4758c2ecf20Sopenharmony_ci#define I915_PARAM_NUM_FENCES_AVAIL 6 4768c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_OVERLAY 7 4778c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_PAGEFLIPPING 8 4788c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXECBUF2 9 4798c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_BSD 10 4808c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_BLT 11 4818c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_RELAXED_FENCING 12 4828c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_COHERENT_RINGS 13 4838c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXEC_CONSTANTS 14 4848c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_RELAXED_DELTA 15 4858c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_GEN7_SOL_RESET 16 4868c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_LLC 17 4878c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_ALIASING_PPGTT 18 4888c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_WAIT_TIMEOUT 19 4898c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_SEMAPHORES 20 4908c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 4918c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_VEBOX 22 4928c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_SECURE_BATCHES 23 4938c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_PINNED_BATCHES 24 4948c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXEC_NO_RELOC 25 4958c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 4968c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_WT 27 4978c2ecf20Sopenharmony_ci#define I915_PARAM_CMD_PARSER_VERSION 28 4988c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_COHERENT_PHYS_GTT 29 4998c2ecf20Sopenharmony_ci#define I915_PARAM_MMAP_VERSION 30 5008c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_BSD2 31 5018c2ecf20Sopenharmony_ci#define I915_PARAM_REVISION 32 5028c2ecf20Sopenharmony_ci#define I915_PARAM_SUBSLICE_TOTAL 33 5038c2ecf20Sopenharmony_ci#define I915_PARAM_EU_TOTAL 34 5048c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_GPU_RESET 35 5058c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_RESOURCE_STREAMER 36 5068c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXEC_SOFTPIN 37 5078c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_POOLED_EU 38 5088c2ecf20Sopenharmony_ci#define I915_PARAM_MIN_EU_IN_POOL 39 5098c2ecf20Sopenharmony_ci#define I915_PARAM_MMAP_GTT_VERSION 40 5108c2ecf20Sopenharmony_ci 5118c2ecf20Sopenharmony_ci/* 5128c2ecf20Sopenharmony_ci * Query whether DRM_I915_GEM_EXECBUFFER2 supports user defined execution 5138c2ecf20Sopenharmony_ci * priorities and the driver will attempt to execute batches in priority order. 5148c2ecf20Sopenharmony_ci * The param returns a capability bitmask, nonzero implies that the scheduler 5158c2ecf20Sopenharmony_ci * is enabled, with different features present according to the mask. 5168c2ecf20Sopenharmony_ci * 5178c2ecf20Sopenharmony_ci * The initial priority for each batch is supplied by the context and is 5188c2ecf20Sopenharmony_ci * controlled via I915_CONTEXT_PARAM_PRIORITY. 5198c2ecf20Sopenharmony_ci */ 5208c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_SCHEDULER 41 5218c2ecf20Sopenharmony_ci#define I915_SCHEDULER_CAP_ENABLED (1ul << 0) 5228c2ecf20Sopenharmony_ci#define I915_SCHEDULER_CAP_PRIORITY (1ul << 1) 5238c2ecf20Sopenharmony_ci#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2) 5248c2ecf20Sopenharmony_ci#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3) 5258c2ecf20Sopenharmony_ci#define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4) 5268c2ecf20Sopenharmony_ci 5278c2ecf20Sopenharmony_ci#define I915_PARAM_HUC_STATUS 42 5288c2ecf20Sopenharmony_ci 5298c2ecf20Sopenharmony_ci/* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to opt-out of 5308c2ecf20Sopenharmony_ci * synchronisation with implicit fencing on individual objects. 5318c2ecf20Sopenharmony_ci * See EXEC_OBJECT_ASYNC. 5328c2ecf20Sopenharmony_ci */ 5338c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXEC_ASYNC 43 5348c2ecf20Sopenharmony_ci 5358c2ecf20Sopenharmony_ci/* Query whether DRM_I915_GEM_EXECBUFFER2 supports explicit fence support - 5368c2ecf20Sopenharmony_ci * both being able to pass in a sync_file fd to wait upon before executing, 5378c2ecf20Sopenharmony_ci * and being able to return a new sync_file fd that is signaled when the 5388c2ecf20Sopenharmony_ci * current request is complete. See I915_EXEC_FENCE_IN and I915_EXEC_FENCE_OUT. 5398c2ecf20Sopenharmony_ci */ 5408c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXEC_FENCE 44 5418c2ecf20Sopenharmony_ci 5428c2ecf20Sopenharmony_ci/* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to capture 5438c2ecf20Sopenharmony_ci * user specified bufffers for post-mortem debugging of GPU hangs. See 5448c2ecf20Sopenharmony_ci * EXEC_OBJECT_CAPTURE. 5458c2ecf20Sopenharmony_ci */ 5468c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXEC_CAPTURE 45 5478c2ecf20Sopenharmony_ci 5488c2ecf20Sopenharmony_ci#define I915_PARAM_SLICE_MASK 46 5498c2ecf20Sopenharmony_ci 5508c2ecf20Sopenharmony_ci/* Assuming it's uniform for each slice, this queries the mask of subslices 5518c2ecf20Sopenharmony_ci * per-slice for this system. 5528c2ecf20Sopenharmony_ci */ 5538c2ecf20Sopenharmony_ci#define I915_PARAM_SUBSLICE_MASK 47 5548c2ecf20Sopenharmony_ci 5558c2ecf20Sopenharmony_ci/* 5568c2ecf20Sopenharmony_ci * Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying the batch buffer 5578c2ecf20Sopenharmony_ci * as the first execobject as opposed to the last. See I915_EXEC_BATCH_FIRST. 5588c2ecf20Sopenharmony_ci */ 5598c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXEC_BATCH_FIRST 48 5608c2ecf20Sopenharmony_ci 5618c2ecf20Sopenharmony_ci/* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of 5628c2ecf20Sopenharmony_ci * drm_i915_gem_exec_fence structures. See I915_EXEC_FENCE_ARRAY. 5638c2ecf20Sopenharmony_ci */ 5648c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXEC_FENCE_ARRAY 49 5658c2ecf20Sopenharmony_ci 5668c2ecf20Sopenharmony_ci/* 5678c2ecf20Sopenharmony_ci * Query whether every context (both per-file default and user created) is 5688c2ecf20Sopenharmony_ci * isolated (insofar as HW supports). If this parameter is not true, then 5698c2ecf20Sopenharmony_ci * freshly created contexts may inherit values from an existing context, 5708c2ecf20Sopenharmony_ci * rather than default HW values. If true, it also ensures (insofar as HW 5718c2ecf20Sopenharmony_ci * supports) that all state set by this context will not leak to any other 5728c2ecf20Sopenharmony_ci * context. 5738c2ecf20Sopenharmony_ci * 5748c2ecf20Sopenharmony_ci * As not every engine across every gen support contexts, the returned 5758c2ecf20Sopenharmony_ci * value reports the support of context isolation for individual engines by 5768c2ecf20Sopenharmony_ci * returning a bitmask of each engine class set to true if that class supports 5778c2ecf20Sopenharmony_ci * isolation. 5788c2ecf20Sopenharmony_ci */ 5798c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_CONTEXT_ISOLATION 50 5808c2ecf20Sopenharmony_ci 5818c2ecf20Sopenharmony_ci/* Frequency of the command streamer timestamps given by the *_TIMESTAMP 5828c2ecf20Sopenharmony_ci * registers. This used to be fixed per platform but from CNL onwards, this 5838c2ecf20Sopenharmony_ci * might vary depending on the parts. 5848c2ecf20Sopenharmony_ci */ 5858c2ecf20Sopenharmony_ci#define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51 5868c2ecf20Sopenharmony_ci 5878c2ecf20Sopenharmony_ci/* 5888c2ecf20Sopenharmony_ci * Once upon a time we supposed that writes through the GGTT would be 5898c2ecf20Sopenharmony_ci * immediately in physical memory (once flushed out of the CPU path). However, 5908c2ecf20Sopenharmony_ci * on a few different processors and chipsets, this is not necessarily the case 5918c2ecf20Sopenharmony_ci * as the writes appear to be buffered internally. Thus a read of the backing 5928c2ecf20Sopenharmony_ci * storage (physical memory) via a different path (with different physical tags 5938c2ecf20Sopenharmony_ci * to the indirect write via the GGTT) will see stale values from before 5948c2ecf20Sopenharmony_ci * the GGTT write. Inside the kernel, we can for the most part keep track of 5958c2ecf20Sopenharmony_ci * the different read/write domains in use (e.g. set-domain), but the assumption 5968c2ecf20Sopenharmony_ci * of coherency is baked into the ABI, hence reporting its true state in this 5978c2ecf20Sopenharmony_ci * parameter. 5988c2ecf20Sopenharmony_ci * 5998c2ecf20Sopenharmony_ci * Reports true when writes via mmap_gtt are immediately visible following an 6008c2ecf20Sopenharmony_ci * lfence to flush the WCB. 6018c2ecf20Sopenharmony_ci * 6028c2ecf20Sopenharmony_ci * Reports false when writes via mmap_gtt are indeterminately delayed in an in 6038c2ecf20Sopenharmony_ci * internal buffer and are _not_ immediately visible to third parties accessing 6048c2ecf20Sopenharmony_ci * directly via mmap_cpu/mmap_wc. Use of mmap_gtt as part of an IPC 6058c2ecf20Sopenharmony_ci * communications channel when reporting false is strongly disadvised. 6068c2ecf20Sopenharmony_ci */ 6078c2ecf20Sopenharmony_ci#define I915_PARAM_MMAP_GTT_COHERENT 52 6088c2ecf20Sopenharmony_ci 6098c2ecf20Sopenharmony_ci/* 6108c2ecf20Sopenharmony_ci * Query whether DRM_I915_GEM_EXECBUFFER2 supports coordination of parallel 6118c2ecf20Sopenharmony_ci * execution through use of explicit fence support. 6128c2ecf20Sopenharmony_ci * See I915_EXEC_FENCE_OUT and I915_EXEC_FENCE_SUBMIT. 6138c2ecf20Sopenharmony_ci */ 6148c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXEC_SUBMIT_FENCE 53 6158c2ecf20Sopenharmony_ci 6168c2ecf20Sopenharmony_ci/* 6178c2ecf20Sopenharmony_ci * Revision of the i915-perf uAPI. The value returned helps determine what 6188c2ecf20Sopenharmony_ci * i915-perf features are available. See drm_i915_perf_property_id. 6198c2ecf20Sopenharmony_ci */ 6208c2ecf20Sopenharmony_ci#define I915_PARAM_PERF_REVISION 54 6218c2ecf20Sopenharmony_ci 6228c2ecf20Sopenharmony_ci/* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of 6238c2ecf20Sopenharmony_ci * timeline syncobj through drm_i915_gem_execbuffer_ext_timeline_fences. See 6248c2ecf20Sopenharmony_ci * I915_EXEC_USE_EXTENSIONS. 6258c2ecf20Sopenharmony_ci */ 6268c2ecf20Sopenharmony_ci#define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55 6278c2ecf20Sopenharmony_ci 6288c2ecf20Sopenharmony_ci/* Must be kept compact -- no holes and well documented */ 6298c2ecf20Sopenharmony_ci 6308c2ecf20Sopenharmony_citypedef struct drm_i915_getparam { 6318c2ecf20Sopenharmony_ci __s32 param; 6328c2ecf20Sopenharmony_ci /* 6338c2ecf20Sopenharmony_ci * WARNING: Using pointers instead of fixed-size u64 means we need to write 6348c2ecf20Sopenharmony_ci * compat32 code. Don't repeat this mistake. 6358c2ecf20Sopenharmony_ci */ 6368c2ecf20Sopenharmony_ci int __user *value; 6378c2ecf20Sopenharmony_ci} drm_i915_getparam_t; 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_ci/* Ioctl to set kernel params: 6408c2ecf20Sopenharmony_ci */ 6418c2ecf20Sopenharmony_ci#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1 6428c2ecf20Sopenharmony_ci#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 6438c2ecf20Sopenharmony_ci#define I915_SETPARAM_ALLOW_BATCHBUFFER 3 6448c2ecf20Sopenharmony_ci#define I915_SETPARAM_NUM_USED_FENCES 4 6458c2ecf20Sopenharmony_ci/* Must be kept compact -- no holes */ 6468c2ecf20Sopenharmony_ci 6478c2ecf20Sopenharmony_citypedef struct drm_i915_setparam { 6488c2ecf20Sopenharmony_ci int param; 6498c2ecf20Sopenharmony_ci int value; 6508c2ecf20Sopenharmony_ci} drm_i915_setparam_t; 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_ci/* A memory manager for regions of shared memory: 6538c2ecf20Sopenharmony_ci */ 6548c2ecf20Sopenharmony_ci#define I915_MEM_REGION_AGP 1 6558c2ecf20Sopenharmony_ci 6568c2ecf20Sopenharmony_citypedef struct drm_i915_mem_alloc { 6578c2ecf20Sopenharmony_ci int region; 6588c2ecf20Sopenharmony_ci int alignment; 6598c2ecf20Sopenharmony_ci int size; 6608c2ecf20Sopenharmony_ci int __user *region_offset; /* offset from start of fb or agp */ 6618c2ecf20Sopenharmony_ci} drm_i915_mem_alloc_t; 6628c2ecf20Sopenharmony_ci 6638c2ecf20Sopenharmony_citypedef struct drm_i915_mem_free { 6648c2ecf20Sopenharmony_ci int region; 6658c2ecf20Sopenharmony_ci int region_offset; 6668c2ecf20Sopenharmony_ci} drm_i915_mem_free_t; 6678c2ecf20Sopenharmony_ci 6688c2ecf20Sopenharmony_citypedef struct drm_i915_mem_init_heap { 6698c2ecf20Sopenharmony_ci int region; 6708c2ecf20Sopenharmony_ci int size; 6718c2ecf20Sopenharmony_ci int start; 6728c2ecf20Sopenharmony_ci} drm_i915_mem_init_heap_t; 6738c2ecf20Sopenharmony_ci 6748c2ecf20Sopenharmony_ci/* Allow memory manager to be torn down and re-initialized (eg on 6758c2ecf20Sopenharmony_ci * rotate): 6768c2ecf20Sopenharmony_ci */ 6778c2ecf20Sopenharmony_citypedef struct drm_i915_mem_destroy_heap { 6788c2ecf20Sopenharmony_ci int region; 6798c2ecf20Sopenharmony_ci} drm_i915_mem_destroy_heap_t; 6808c2ecf20Sopenharmony_ci 6818c2ecf20Sopenharmony_ci/* Allow X server to configure which pipes to monitor for vblank signals 6828c2ecf20Sopenharmony_ci */ 6838c2ecf20Sopenharmony_ci#define DRM_I915_VBLANK_PIPE_A 1 6848c2ecf20Sopenharmony_ci#define DRM_I915_VBLANK_PIPE_B 2 6858c2ecf20Sopenharmony_ci 6868c2ecf20Sopenharmony_citypedef struct drm_i915_vblank_pipe { 6878c2ecf20Sopenharmony_ci int pipe; 6888c2ecf20Sopenharmony_ci} drm_i915_vblank_pipe_t; 6898c2ecf20Sopenharmony_ci 6908c2ecf20Sopenharmony_ci/* Schedule buffer swap at given vertical blank: 6918c2ecf20Sopenharmony_ci */ 6928c2ecf20Sopenharmony_citypedef struct drm_i915_vblank_swap { 6938c2ecf20Sopenharmony_ci drm_drawable_t drawable; 6948c2ecf20Sopenharmony_ci enum drm_vblank_seq_type seqtype; 6958c2ecf20Sopenharmony_ci unsigned int sequence; 6968c2ecf20Sopenharmony_ci} drm_i915_vblank_swap_t; 6978c2ecf20Sopenharmony_ci 6988c2ecf20Sopenharmony_citypedef struct drm_i915_hws_addr { 6998c2ecf20Sopenharmony_ci __u64 addr; 7008c2ecf20Sopenharmony_ci} drm_i915_hws_addr_t; 7018c2ecf20Sopenharmony_ci 7028c2ecf20Sopenharmony_cistruct drm_i915_gem_init { 7038c2ecf20Sopenharmony_ci /** 7048c2ecf20Sopenharmony_ci * Beginning offset in the GTT to be managed by the DRM memory 7058c2ecf20Sopenharmony_ci * manager. 7068c2ecf20Sopenharmony_ci */ 7078c2ecf20Sopenharmony_ci __u64 gtt_start; 7088c2ecf20Sopenharmony_ci /** 7098c2ecf20Sopenharmony_ci * Ending offset in the GTT to be managed by the DRM memory 7108c2ecf20Sopenharmony_ci * manager. 7118c2ecf20Sopenharmony_ci */ 7128c2ecf20Sopenharmony_ci __u64 gtt_end; 7138c2ecf20Sopenharmony_ci}; 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_cistruct drm_i915_gem_create { 7168c2ecf20Sopenharmony_ci /** 7178c2ecf20Sopenharmony_ci * Requested size for the object. 7188c2ecf20Sopenharmony_ci * 7198c2ecf20Sopenharmony_ci * The (page-aligned) allocated size for the object will be returned. 7208c2ecf20Sopenharmony_ci */ 7218c2ecf20Sopenharmony_ci __u64 size; 7228c2ecf20Sopenharmony_ci /** 7238c2ecf20Sopenharmony_ci * Returned handle for the object. 7248c2ecf20Sopenharmony_ci * 7258c2ecf20Sopenharmony_ci * Object handles are nonzero. 7268c2ecf20Sopenharmony_ci */ 7278c2ecf20Sopenharmony_ci __u32 handle; 7288c2ecf20Sopenharmony_ci __u32 pad; 7298c2ecf20Sopenharmony_ci}; 7308c2ecf20Sopenharmony_ci 7318c2ecf20Sopenharmony_cistruct drm_i915_gem_pread { 7328c2ecf20Sopenharmony_ci /** Handle for the object being read. */ 7338c2ecf20Sopenharmony_ci __u32 handle; 7348c2ecf20Sopenharmony_ci __u32 pad; 7358c2ecf20Sopenharmony_ci /** Offset into the object to read from */ 7368c2ecf20Sopenharmony_ci __u64 offset; 7378c2ecf20Sopenharmony_ci /** Length of data to read */ 7388c2ecf20Sopenharmony_ci __u64 size; 7398c2ecf20Sopenharmony_ci /** 7408c2ecf20Sopenharmony_ci * Pointer to write the data into. 7418c2ecf20Sopenharmony_ci * 7428c2ecf20Sopenharmony_ci * This is a fixed-size type for 32/64 compatibility. 7438c2ecf20Sopenharmony_ci */ 7448c2ecf20Sopenharmony_ci __u64 data_ptr; 7458c2ecf20Sopenharmony_ci}; 7468c2ecf20Sopenharmony_ci 7478c2ecf20Sopenharmony_cistruct drm_i915_gem_pwrite { 7488c2ecf20Sopenharmony_ci /** Handle for the object being written to. */ 7498c2ecf20Sopenharmony_ci __u32 handle; 7508c2ecf20Sopenharmony_ci __u32 pad; 7518c2ecf20Sopenharmony_ci /** Offset into the object to write to */ 7528c2ecf20Sopenharmony_ci __u64 offset; 7538c2ecf20Sopenharmony_ci /** Length of data to write */ 7548c2ecf20Sopenharmony_ci __u64 size; 7558c2ecf20Sopenharmony_ci /** 7568c2ecf20Sopenharmony_ci * Pointer to read the data from. 7578c2ecf20Sopenharmony_ci * 7588c2ecf20Sopenharmony_ci * This is a fixed-size type for 32/64 compatibility. 7598c2ecf20Sopenharmony_ci */ 7608c2ecf20Sopenharmony_ci __u64 data_ptr; 7618c2ecf20Sopenharmony_ci}; 7628c2ecf20Sopenharmony_ci 7638c2ecf20Sopenharmony_cistruct drm_i915_gem_mmap { 7648c2ecf20Sopenharmony_ci /** Handle for the object being mapped. */ 7658c2ecf20Sopenharmony_ci __u32 handle; 7668c2ecf20Sopenharmony_ci __u32 pad; 7678c2ecf20Sopenharmony_ci /** Offset in the object to map. */ 7688c2ecf20Sopenharmony_ci __u64 offset; 7698c2ecf20Sopenharmony_ci /** 7708c2ecf20Sopenharmony_ci * Length of data to map. 7718c2ecf20Sopenharmony_ci * 7728c2ecf20Sopenharmony_ci * The value will be page-aligned. 7738c2ecf20Sopenharmony_ci */ 7748c2ecf20Sopenharmony_ci __u64 size; 7758c2ecf20Sopenharmony_ci /** 7768c2ecf20Sopenharmony_ci * Returned pointer the data was mapped at. 7778c2ecf20Sopenharmony_ci * 7788c2ecf20Sopenharmony_ci * This is a fixed-size type for 32/64 compatibility. 7798c2ecf20Sopenharmony_ci */ 7808c2ecf20Sopenharmony_ci __u64 addr_ptr; 7818c2ecf20Sopenharmony_ci 7828c2ecf20Sopenharmony_ci /** 7838c2ecf20Sopenharmony_ci * Flags for extended behaviour. 7848c2ecf20Sopenharmony_ci * 7858c2ecf20Sopenharmony_ci * Added in version 2. 7868c2ecf20Sopenharmony_ci */ 7878c2ecf20Sopenharmony_ci __u64 flags; 7888c2ecf20Sopenharmony_ci#define I915_MMAP_WC 0x1 7898c2ecf20Sopenharmony_ci}; 7908c2ecf20Sopenharmony_ci 7918c2ecf20Sopenharmony_cistruct drm_i915_gem_mmap_gtt { 7928c2ecf20Sopenharmony_ci /** Handle for the object being mapped. */ 7938c2ecf20Sopenharmony_ci __u32 handle; 7948c2ecf20Sopenharmony_ci __u32 pad; 7958c2ecf20Sopenharmony_ci /** 7968c2ecf20Sopenharmony_ci * Fake offset to use for subsequent mmap call 7978c2ecf20Sopenharmony_ci * 7988c2ecf20Sopenharmony_ci * This is a fixed-size type for 32/64 compatibility. 7998c2ecf20Sopenharmony_ci */ 8008c2ecf20Sopenharmony_ci __u64 offset; 8018c2ecf20Sopenharmony_ci}; 8028c2ecf20Sopenharmony_ci 8038c2ecf20Sopenharmony_cistruct drm_i915_gem_mmap_offset { 8048c2ecf20Sopenharmony_ci /** Handle for the object being mapped. */ 8058c2ecf20Sopenharmony_ci __u32 handle; 8068c2ecf20Sopenharmony_ci __u32 pad; 8078c2ecf20Sopenharmony_ci /** 8088c2ecf20Sopenharmony_ci * Fake offset to use for subsequent mmap call 8098c2ecf20Sopenharmony_ci * 8108c2ecf20Sopenharmony_ci * This is a fixed-size type for 32/64 compatibility. 8118c2ecf20Sopenharmony_ci */ 8128c2ecf20Sopenharmony_ci __u64 offset; 8138c2ecf20Sopenharmony_ci 8148c2ecf20Sopenharmony_ci /** 8158c2ecf20Sopenharmony_ci * Flags for extended behaviour. 8168c2ecf20Sopenharmony_ci * 8178c2ecf20Sopenharmony_ci * It is mandatory that one of the MMAP_OFFSET types 8188c2ecf20Sopenharmony_ci * (GTT, WC, WB, UC, etc) should be included. 8198c2ecf20Sopenharmony_ci */ 8208c2ecf20Sopenharmony_ci __u64 flags; 8218c2ecf20Sopenharmony_ci#define I915_MMAP_OFFSET_GTT 0 8228c2ecf20Sopenharmony_ci#define I915_MMAP_OFFSET_WC 1 8238c2ecf20Sopenharmony_ci#define I915_MMAP_OFFSET_WB 2 8248c2ecf20Sopenharmony_ci#define I915_MMAP_OFFSET_UC 3 8258c2ecf20Sopenharmony_ci 8268c2ecf20Sopenharmony_ci /* 8278c2ecf20Sopenharmony_ci * Zero-terminated chain of extensions. 8288c2ecf20Sopenharmony_ci * 8298c2ecf20Sopenharmony_ci * No current extensions defined; mbz. 8308c2ecf20Sopenharmony_ci */ 8318c2ecf20Sopenharmony_ci __u64 extensions; 8328c2ecf20Sopenharmony_ci}; 8338c2ecf20Sopenharmony_ci 8348c2ecf20Sopenharmony_cistruct drm_i915_gem_set_domain { 8358c2ecf20Sopenharmony_ci /** Handle for the object */ 8368c2ecf20Sopenharmony_ci __u32 handle; 8378c2ecf20Sopenharmony_ci 8388c2ecf20Sopenharmony_ci /** New read domains */ 8398c2ecf20Sopenharmony_ci __u32 read_domains; 8408c2ecf20Sopenharmony_ci 8418c2ecf20Sopenharmony_ci /** New write domain */ 8428c2ecf20Sopenharmony_ci __u32 write_domain; 8438c2ecf20Sopenharmony_ci}; 8448c2ecf20Sopenharmony_ci 8458c2ecf20Sopenharmony_cistruct drm_i915_gem_sw_finish { 8468c2ecf20Sopenharmony_ci /** Handle for the object */ 8478c2ecf20Sopenharmony_ci __u32 handle; 8488c2ecf20Sopenharmony_ci}; 8498c2ecf20Sopenharmony_ci 8508c2ecf20Sopenharmony_cistruct drm_i915_gem_relocation_entry { 8518c2ecf20Sopenharmony_ci /** 8528c2ecf20Sopenharmony_ci * Handle of the buffer being pointed to by this relocation entry. 8538c2ecf20Sopenharmony_ci * 8548c2ecf20Sopenharmony_ci * It's appealing to make this be an index into the mm_validate_entry 8558c2ecf20Sopenharmony_ci * list to refer to the buffer, but this allows the driver to create 8568c2ecf20Sopenharmony_ci * a relocation list for state buffers and not re-write it per 8578c2ecf20Sopenharmony_ci * exec using the buffer. 8588c2ecf20Sopenharmony_ci */ 8598c2ecf20Sopenharmony_ci __u32 target_handle; 8608c2ecf20Sopenharmony_ci 8618c2ecf20Sopenharmony_ci /** 8628c2ecf20Sopenharmony_ci * Value to be added to the offset of the target buffer to make up 8638c2ecf20Sopenharmony_ci * the relocation entry. 8648c2ecf20Sopenharmony_ci */ 8658c2ecf20Sopenharmony_ci __u32 delta; 8668c2ecf20Sopenharmony_ci 8678c2ecf20Sopenharmony_ci /** Offset in the buffer the relocation entry will be written into */ 8688c2ecf20Sopenharmony_ci __u64 offset; 8698c2ecf20Sopenharmony_ci 8708c2ecf20Sopenharmony_ci /** 8718c2ecf20Sopenharmony_ci * Offset value of the target buffer that the relocation entry was last 8728c2ecf20Sopenharmony_ci * written as. 8738c2ecf20Sopenharmony_ci * 8748c2ecf20Sopenharmony_ci * If the buffer has the same offset as last time, we can skip syncing 8758c2ecf20Sopenharmony_ci * and writing the relocation. This value is written back out by 8768c2ecf20Sopenharmony_ci * the execbuffer ioctl when the relocation is written. 8778c2ecf20Sopenharmony_ci */ 8788c2ecf20Sopenharmony_ci __u64 presumed_offset; 8798c2ecf20Sopenharmony_ci 8808c2ecf20Sopenharmony_ci /** 8818c2ecf20Sopenharmony_ci * Target memory domains read by this operation. 8828c2ecf20Sopenharmony_ci */ 8838c2ecf20Sopenharmony_ci __u32 read_domains; 8848c2ecf20Sopenharmony_ci 8858c2ecf20Sopenharmony_ci /** 8868c2ecf20Sopenharmony_ci * Target memory domains written by this operation. 8878c2ecf20Sopenharmony_ci * 8888c2ecf20Sopenharmony_ci * Note that only one domain may be written by the whole 8898c2ecf20Sopenharmony_ci * execbuffer operation, so that where there are conflicts, 8908c2ecf20Sopenharmony_ci * the application will get -EINVAL back. 8918c2ecf20Sopenharmony_ci */ 8928c2ecf20Sopenharmony_ci __u32 write_domain; 8938c2ecf20Sopenharmony_ci}; 8948c2ecf20Sopenharmony_ci 8958c2ecf20Sopenharmony_ci/** @{ 8968c2ecf20Sopenharmony_ci * Intel memory domains 8978c2ecf20Sopenharmony_ci * 8988c2ecf20Sopenharmony_ci * Most of these just align with the various caches in 8998c2ecf20Sopenharmony_ci * the system and are used to flush and invalidate as 9008c2ecf20Sopenharmony_ci * objects end up cached in different domains. 9018c2ecf20Sopenharmony_ci */ 9028c2ecf20Sopenharmony_ci/** CPU cache */ 9038c2ecf20Sopenharmony_ci#define I915_GEM_DOMAIN_CPU 0x00000001 9048c2ecf20Sopenharmony_ci/** Render cache, used by 2D and 3D drawing */ 9058c2ecf20Sopenharmony_ci#define I915_GEM_DOMAIN_RENDER 0x00000002 9068c2ecf20Sopenharmony_ci/** Sampler cache, used by texture engine */ 9078c2ecf20Sopenharmony_ci#define I915_GEM_DOMAIN_SAMPLER 0x00000004 9088c2ecf20Sopenharmony_ci/** Command queue, used to load batch buffers */ 9098c2ecf20Sopenharmony_ci#define I915_GEM_DOMAIN_COMMAND 0x00000008 9108c2ecf20Sopenharmony_ci/** Instruction cache, used by shader programs */ 9118c2ecf20Sopenharmony_ci#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010 9128c2ecf20Sopenharmony_ci/** Vertex address cache */ 9138c2ecf20Sopenharmony_ci#define I915_GEM_DOMAIN_VERTEX 0x00000020 9148c2ecf20Sopenharmony_ci/** GTT domain - aperture and scanout */ 9158c2ecf20Sopenharmony_ci#define I915_GEM_DOMAIN_GTT 0x00000040 9168c2ecf20Sopenharmony_ci/** WC domain - uncached access */ 9178c2ecf20Sopenharmony_ci#define I915_GEM_DOMAIN_WC 0x00000080 9188c2ecf20Sopenharmony_ci/** @} */ 9198c2ecf20Sopenharmony_ci 9208c2ecf20Sopenharmony_cistruct drm_i915_gem_exec_object { 9218c2ecf20Sopenharmony_ci /** 9228c2ecf20Sopenharmony_ci * User's handle for a buffer to be bound into the GTT for this 9238c2ecf20Sopenharmony_ci * operation. 9248c2ecf20Sopenharmony_ci */ 9258c2ecf20Sopenharmony_ci __u32 handle; 9268c2ecf20Sopenharmony_ci 9278c2ecf20Sopenharmony_ci /** Number of relocations to be performed on this buffer */ 9288c2ecf20Sopenharmony_ci __u32 relocation_count; 9298c2ecf20Sopenharmony_ci /** 9308c2ecf20Sopenharmony_ci * Pointer to array of struct drm_i915_gem_relocation_entry containing 9318c2ecf20Sopenharmony_ci * the relocations to be performed in this buffer. 9328c2ecf20Sopenharmony_ci */ 9338c2ecf20Sopenharmony_ci __u64 relocs_ptr; 9348c2ecf20Sopenharmony_ci 9358c2ecf20Sopenharmony_ci /** Required alignment in graphics aperture */ 9368c2ecf20Sopenharmony_ci __u64 alignment; 9378c2ecf20Sopenharmony_ci 9388c2ecf20Sopenharmony_ci /** 9398c2ecf20Sopenharmony_ci * Returned value of the updated offset of the object, for future 9408c2ecf20Sopenharmony_ci * presumed_offset writes. 9418c2ecf20Sopenharmony_ci */ 9428c2ecf20Sopenharmony_ci __u64 offset; 9438c2ecf20Sopenharmony_ci}; 9448c2ecf20Sopenharmony_ci 9458c2ecf20Sopenharmony_cistruct drm_i915_gem_execbuffer { 9468c2ecf20Sopenharmony_ci /** 9478c2ecf20Sopenharmony_ci * List of buffers to be validated with their relocations to be 9488c2ecf20Sopenharmony_ci * performend on them. 9498c2ecf20Sopenharmony_ci * 9508c2ecf20Sopenharmony_ci * This is a pointer to an array of struct drm_i915_gem_validate_entry. 9518c2ecf20Sopenharmony_ci * 9528c2ecf20Sopenharmony_ci * These buffers must be listed in an order such that all relocations 9538c2ecf20Sopenharmony_ci * a buffer is performing refer to buffers that have already appeared 9548c2ecf20Sopenharmony_ci * in the validate list. 9558c2ecf20Sopenharmony_ci */ 9568c2ecf20Sopenharmony_ci __u64 buffers_ptr; 9578c2ecf20Sopenharmony_ci __u32 buffer_count; 9588c2ecf20Sopenharmony_ci 9598c2ecf20Sopenharmony_ci /** Offset in the batchbuffer to start execution from. */ 9608c2ecf20Sopenharmony_ci __u32 batch_start_offset; 9618c2ecf20Sopenharmony_ci /** Bytes used in batchbuffer from batch_start_offset */ 9628c2ecf20Sopenharmony_ci __u32 batch_len; 9638c2ecf20Sopenharmony_ci __u32 DR1; 9648c2ecf20Sopenharmony_ci __u32 DR4; 9658c2ecf20Sopenharmony_ci __u32 num_cliprects; 9668c2ecf20Sopenharmony_ci /** This is a struct drm_clip_rect *cliprects */ 9678c2ecf20Sopenharmony_ci __u64 cliprects_ptr; 9688c2ecf20Sopenharmony_ci}; 9698c2ecf20Sopenharmony_ci 9708c2ecf20Sopenharmony_cistruct drm_i915_gem_exec_object2 { 9718c2ecf20Sopenharmony_ci /** 9728c2ecf20Sopenharmony_ci * User's handle for a buffer to be bound into the GTT for this 9738c2ecf20Sopenharmony_ci * operation. 9748c2ecf20Sopenharmony_ci */ 9758c2ecf20Sopenharmony_ci __u32 handle; 9768c2ecf20Sopenharmony_ci 9778c2ecf20Sopenharmony_ci /** Number of relocations to be performed on this buffer */ 9788c2ecf20Sopenharmony_ci __u32 relocation_count; 9798c2ecf20Sopenharmony_ci /** 9808c2ecf20Sopenharmony_ci * Pointer to array of struct drm_i915_gem_relocation_entry containing 9818c2ecf20Sopenharmony_ci * the relocations to be performed in this buffer. 9828c2ecf20Sopenharmony_ci */ 9838c2ecf20Sopenharmony_ci __u64 relocs_ptr; 9848c2ecf20Sopenharmony_ci 9858c2ecf20Sopenharmony_ci /** Required alignment in graphics aperture */ 9868c2ecf20Sopenharmony_ci __u64 alignment; 9878c2ecf20Sopenharmony_ci 9888c2ecf20Sopenharmony_ci /** 9898c2ecf20Sopenharmony_ci * When the EXEC_OBJECT_PINNED flag is specified this is populated by 9908c2ecf20Sopenharmony_ci * the user with the GTT offset at which this object will be pinned. 9918c2ecf20Sopenharmony_ci * When the I915_EXEC_NO_RELOC flag is specified this must contain the 9928c2ecf20Sopenharmony_ci * presumed_offset of the object. 9938c2ecf20Sopenharmony_ci * During execbuffer2 the kernel populates it with the value of the 9948c2ecf20Sopenharmony_ci * current GTT offset of the object, for future presumed_offset writes. 9958c2ecf20Sopenharmony_ci */ 9968c2ecf20Sopenharmony_ci __u64 offset; 9978c2ecf20Sopenharmony_ci 9988c2ecf20Sopenharmony_ci#define EXEC_OBJECT_NEEDS_FENCE (1<<0) 9998c2ecf20Sopenharmony_ci#define EXEC_OBJECT_NEEDS_GTT (1<<1) 10008c2ecf20Sopenharmony_ci#define EXEC_OBJECT_WRITE (1<<2) 10018c2ecf20Sopenharmony_ci#define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3) 10028c2ecf20Sopenharmony_ci#define EXEC_OBJECT_PINNED (1<<4) 10038c2ecf20Sopenharmony_ci#define EXEC_OBJECT_PAD_TO_SIZE (1<<5) 10048c2ecf20Sopenharmony_ci/* The kernel implicitly tracks GPU activity on all GEM objects, and 10058c2ecf20Sopenharmony_ci * synchronises operations with outstanding rendering. This includes 10068c2ecf20Sopenharmony_ci * rendering on other devices if exported via dma-buf. However, sometimes 10078c2ecf20Sopenharmony_ci * this tracking is too coarse and the user knows better. For example, 10088c2ecf20Sopenharmony_ci * if the object is split into non-overlapping ranges shared between different 10098c2ecf20Sopenharmony_ci * clients or engines (i.e. suballocating objects), the implicit tracking 10108c2ecf20Sopenharmony_ci * by kernel assumes that each operation affects the whole object rather 10118c2ecf20Sopenharmony_ci * than an individual range, causing needless synchronisation between clients. 10128c2ecf20Sopenharmony_ci * The kernel will also forgo any CPU cache flushes prior to rendering from 10138c2ecf20Sopenharmony_ci * the object as the client is expected to be also handling such domain 10148c2ecf20Sopenharmony_ci * tracking. 10158c2ecf20Sopenharmony_ci * 10168c2ecf20Sopenharmony_ci * The kernel maintains the implicit tracking in order to manage resources 10178c2ecf20Sopenharmony_ci * used by the GPU - this flag only disables the synchronisation prior to 10188c2ecf20Sopenharmony_ci * rendering with this object in this execbuf. 10198c2ecf20Sopenharmony_ci * 10208c2ecf20Sopenharmony_ci * Opting out of implicit synhronisation requires the user to do its own 10218c2ecf20Sopenharmony_ci * explicit tracking to avoid rendering corruption. See, for example, 10228c2ecf20Sopenharmony_ci * I915_PARAM_HAS_EXEC_FENCE to order execbufs and execute them asynchronously. 10238c2ecf20Sopenharmony_ci */ 10248c2ecf20Sopenharmony_ci#define EXEC_OBJECT_ASYNC (1<<6) 10258c2ecf20Sopenharmony_ci/* Request that the contents of this execobject be copied into the error 10268c2ecf20Sopenharmony_ci * state upon a GPU hang involving this batch for post-mortem debugging. 10278c2ecf20Sopenharmony_ci * These buffers are recorded in no particular order as "user" in 10288c2ecf20Sopenharmony_ci * /sys/class/drm/cardN/error. Query I915_PARAM_HAS_EXEC_CAPTURE to see 10298c2ecf20Sopenharmony_ci * if the kernel supports this flag. 10308c2ecf20Sopenharmony_ci */ 10318c2ecf20Sopenharmony_ci#define EXEC_OBJECT_CAPTURE (1<<7) 10328c2ecf20Sopenharmony_ci/* All remaining bits are MBZ and RESERVED FOR FUTURE USE */ 10338c2ecf20Sopenharmony_ci#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_CAPTURE<<1) 10348c2ecf20Sopenharmony_ci __u64 flags; 10358c2ecf20Sopenharmony_ci 10368c2ecf20Sopenharmony_ci union { 10378c2ecf20Sopenharmony_ci __u64 rsvd1; 10388c2ecf20Sopenharmony_ci __u64 pad_to_size; 10398c2ecf20Sopenharmony_ci }; 10408c2ecf20Sopenharmony_ci __u64 rsvd2; 10418c2ecf20Sopenharmony_ci}; 10428c2ecf20Sopenharmony_ci 10438c2ecf20Sopenharmony_cistruct drm_i915_gem_exec_fence { 10448c2ecf20Sopenharmony_ci /** 10458c2ecf20Sopenharmony_ci * User's handle for a drm_syncobj to wait on or signal. 10468c2ecf20Sopenharmony_ci */ 10478c2ecf20Sopenharmony_ci __u32 handle; 10488c2ecf20Sopenharmony_ci 10498c2ecf20Sopenharmony_ci#define I915_EXEC_FENCE_WAIT (1<<0) 10508c2ecf20Sopenharmony_ci#define I915_EXEC_FENCE_SIGNAL (1<<1) 10518c2ecf20Sopenharmony_ci#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1)) 10528c2ecf20Sopenharmony_ci __u32 flags; 10538c2ecf20Sopenharmony_ci}; 10548c2ecf20Sopenharmony_ci 10558c2ecf20Sopenharmony_ci/** 10568c2ecf20Sopenharmony_ci * See drm_i915_gem_execbuffer_ext_timeline_fences. 10578c2ecf20Sopenharmony_ci */ 10588c2ecf20Sopenharmony_ci#define DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES 0 10598c2ecf20Sopenharmony_ci 10608c2ecf20Sopenharmony_ci/** 10618c2ecf20Sopenharmony_ci * This structure describes an array of drm_syncobj and associated points for 10628c2ecf20Sopenharmony_ci * timeline variants of drm_syncobj. It is invalid to append this structure to 10638c2ecf20Sopenharmony_ci * the execbuf if I915_EXEC_FENCE_ARRAY is set. 10648c2ecf20Sopenharmony_ci */ 10658c2ecf20Sopenharmony_cistruct drm_i915_gem_execbuffer_ext_timeline_fences { 10668c2ecf20Sopenharmony_ci struct i915_user_extension base; 10678c2ecf20Sopenharmony_ci 10688c2ecf20Sopenharmony_ci /** 10698c2ecf20Sopenharmony_ci * Number of element in the handles_ptr & value_ptr arrays. 10708c2ecf20Sopenharmony_ci */ 10718c2ecf20Sopenharmony_ci __u64 fence_count; 10728c2ecf20Sopenharmony_ci 10738c2ecf20Sopenharmony_ci /** 10748c2ecf20Sopenharmony_ci * Pointer to an array of struct drm_i915_gem_exec_fence of length 10758c2ecf20Sopenharmony_ci * fence_count. 10768c2ecf20Sopenharmony_ci */ 10778c2ecf20Sopenharmony_ci __u64 handles_ptr; 10788c2ecf20Sopenharmony_ci 10798c2ecf20Sopenharmony_ci /** 10808c2ecf20Sopenharmony_ci * Pointer to an array of u64 values of length fence_count. Values 10818c2ecf20Sopenharmony_ci * must be 0 for a binary drm_syncobj. A Value of 0 for a timeline 10828c2ecf20Sopenharmony_ci * drm_syncobj is invalid as it turns a drm_syncobj into a binary one. 10838c2ecf20Sopenharmony_ci */ 10848c2ecf20Sopenharmony_ci __u64 values_ptr; 10858c2ecf20Sopenharmony_ci}; 10868c2ecf20Sopenharmony_ci 10878c2ecf20Sopenharmony_cistruct drm_i915_gem_execbuffer2 { 10888c2ecf20Sopenharmony_ci /** 10898c2ecf20Sopenharmony_ci * List of gem_exec_object2 structs 10908c2ecf20Sopenharmony_ci */ 10918c2ecf20Sopenharmony_ci __u64 buffers_ptr; 10928c2ecf20Sopenharmony_ci __u32 buffer_count; 10938c2ecf20Sopenharmony_ci 10948c2ecf20Sopenharmony_ci /** Offset in the batchbuffer to start execution from. */ 10958c2ecf20Sopenharmony_ci __u32 batch_start_offset; 10968c2ecf20Sopenharmony_ci /** Bytes used in batchbuffer from batch_start_offset */ 10978c2ecf20Sopenharmony_ci __u32 batch_len; 10988c2ecf20Sopenharmony_ci __u32 DR1; 10998c2ecf20Sopenharmony_ci __u32 DR4; 11008c2ecf20Sopenharmony_ci __u32 num_cliprects; 11018c2ecf20Sopenharmony_ci /** 11028c2ecf20Sopenharmony_ci * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY 11038c2ecf20Sopenharmony_ci * & I915_EXEC_USE_EXTENSIONS are not set. 11048c2ecf20Sopenharmony_ci * 11058c2ecf20Sopenharmony_ci * If I915_EXEC_FENCE_ARRAY is set, then this is a pointer to an array 11068c2ecf20Sopenharmony_ci * of struct drm_i915_gem_exec_fence and num_cliprects is the length 11078c2ecf20Sopenharmony_ci * of the array. 11088c2ecf20Sopenharmony_ci * 11098c2ecf20Sopenharmony_ci * If I915_EXEC_USE_EXTENSIONS is set, then this is a pointer to a 11108c2ecf20Sopenharmony_ci * single struct i915_user_extension and num_cliprects is 0. 11118c2ecf20Sopenharmony_ci */ 11128c2ecf20Sopenharmony_ci __u64 cliprects_ptr; 11138c2ecf20Sopenharmony_ci#define I915_EXEC_RING_MASK (0x3f) 11148c2ecf20Sopenharmony_ci#define I915_EXEC_DEFAULT (0<<0) 11158c2ecf20Sopenharmony_ci#define I915_EXEC_RENDER (1<<0) 11168c2ecf20Sopenharmony_ci#define I915_EXEC_BSD (2<<0) 11178c2ecf20Sopenharmony_ci#define I915_EXEC_BLT (3<<0) 11188c2ecf20Sopenharmony_ci#define I915_EXEC_VEBOX (4<<0) 11198c2ecf20Sopenharmony_ci 11208c2ecf20Sopenharmony_ci/* Used for switching the constants addressing mode on gen4+ RENDER ring. 11218c2ecf20Sopenharmony_ci * Gen6+ only supports relative addressing to dynamic state (default) and 11228c2ecf20Sopenharmony_ci * absolute addressing. 11238c2ecf20Sopenharmony_ci * 11248c2ecf20Sopenharmony_ci * These flags are ignored for the BSD and BLT rings. 11258c2ecf20Sopenharmony_ci */ 11268c2ecf20Sopenharmony_ci#define I915_EXEC_CONSTANTS_MASK (3<<6) 11278c2ecf20Sopenharmony_ci#define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */ 11288c2ecf20Sopenharmony_ci#define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6) 11298c2ecf20Sopenharmony_ci#define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */ 11308c2ecf20Sopenharmony_ci __u64 flags; 11318c2ecf20Sopenharmony_ci __u64 rsvd1; /* now used for context info */ 11328c2ecf20Sopenharmony_ci __u64 rsvd2; 11338c2ecf20Sopenharmony_ci}; 11348c2ecf20Sopenharmony_ci 11358c2ecf20Sopenharmony_ci/** Resets the SO write offset registers for transform feedback on gen7. */ 11368c2ecf20Sopenharmony_ci#define I915_EXEC_GEN7_SOL_RESET (1<<8) 11378c2ecf20Sopenharmony_ci 11388c2ecf20Sopenharmony_ci/** Request a privileged ("secure") batch buffer. Note only available for 11398c2ecf20Sopenharmony_ci * DRM_ROOT_ONLY | DRM_MASTER processes. 11408c2ecf20Sopenharmony_ci */ 11418c2ecf20Sopenharmony_ci#define I915_EXEC_SECURE (1<<9) 11428c2ecf20Sopenharmony_ci 11438c2ecf20Sopenharmony_ci/** Inform the kernel that the batch is and will always be pinned. This 11448c2ecf20Sopenharmony_ci * negates the requirement for a workaround to be performed to avoid 11458c2ecf20Sopenharmony_ci * an incoherent CS (such as can be found on 830/845). If this flag is 11468c2ecf20Sopenharmony_ci * not passed, the kernel will endeavour to make sure the batch is 11478c2ecf20Sopenharmony_ci * coherent with the CS before execution. If this flag is passed, 11488c2ecf20Sopenharmony_ci * userspace assumes the responsibility for ensuring the same. 11498c2ecf20Sopenharmony_ci */ 11508c2ecf20Sopenharmony_ci#define I915_EXEC_IS_PINNED (1<<10) 11518c2ecf20Sopenharmony_ci 11528c2ecf20Sopenharmony_ci/** Provide a hint to the kernel that the command stream and auxiliary 11538c2ecf20Sopenharmony_ci * state buffers already holds the correct presumed addresses and so the 11548c2ecf20Sopenharmony_ci * relocation process may be skipped if no buffers need to be moved in 11558c2ecf20Sopenharmony_ci * preparation for the execbuffer. 11568c2ecf20Sopenharmony_ci */ 11578c2ecf20Sopenharmony_ci#define I915_EXEC_NO_RELOC (1<<11) 11588c2ecf20Sopenharmony_ci 11598c2ecf20Sopenharmony_ci/** Use the reloc.handle as an index into the exec object array rather 11608c2ecf20Sopenharmony_ci * than as the per-file handle. 11618c2ecf20Sopenharmony_ci */ 11628c2ecf20Sopenharmony_ci#define I915_EXEC_HANDLE_LUT (1<<12) 11638c2ecf20Sopenharmony_ci 11648c2ecf20Sopenharmony_ci/** Used for switching BSD rings on the platforms with two BSD rings */ 11658c2ecf20Sopenharmony_ci#define I915_EXEC_BSD_SHIFT (13) 11668c2ecf20Sopenharmony_ci#define I915_EXEC_BSD_MASK (3 << I915_EXEC_BSD_SHIFT) 11678c2ecf20Sopenharmony_ci/* default ping-pong mode */ 11688c2ecf20Sopenharmony_ci#define I915_EXEC_BSD_DEFAULT (0 << I915_EXEC_BSD_SHIFT) 11698c2ecf20Sopenharmony_ci#define I915_EXEC_BSD_RING1 (1 << I915_EXEC_BSD_SHIFT) 11708c2ecf20Sopenharmony_ci#define I915_EXEC_BSD_RING2 (2 << I915_EXEC_BSD_SHIFT) 11718c2ecf20Sopenharmony_ci 11728c2ecf20Sopenharmony_ci/** Tell the kernel that the batchbuffer is processed by 11738c2ecf20Sopenharmony_ci * the resource streamer. 11748c2ecf20Sopenharmony_ci */ 11758c2ecf20Sopenharmony_ci#define I915_EXEC_RESOURCE_STREAMER (1<<15) 11768c2ecf20Sopenharmony_ci 11778c2ecf20Sopenharmony_ci/* Setting I915_EXEC_FENCE_IN implies that lower_32_bits(rsvd2) represent 11788c2ecf20Sopenharmony_ci * a sync_file fd to wait upon (in a nonblocking manner) prior to executing 11798c2ecf20Sopenharmony_ci * the batch. 11808c2ecf20Sopenharmony_ci * 11818c2ecf20Sopenharmony_ci * Returns -EINVAL if the sync_file fd cannot be found. 11828c2ecf20Sopenharmony_ci */ 11838c2ecf20Sopenharmony_ci#define I915_EXEC_FENCE_IN (1<<16) 11848c2ecf20Sopenharmony_ci 11858c2ecf20Sopenharmony_ci/* Setting I915_EXEC_FENCE_OUT causes the ioctl to return a sync_file fd 11868c2ecf20Sopenharmony_ci * in the upper_32_bits(rsvd2) upon success. Ownership of the fd is given 11878c2ecf20Sopenharmony_ci * to the caller, and it should be close() after use. (The fd is a regular 11888c2ecf20Sopenharmony_ci * file descriptor and will be cleaned up on process termination. It holds 11898c2ecf20Sopenharmony_ci * a reference to the request, but nothing else.) 11908c2ecf20Sopenharmony_ci * 11918c2ecf20Sopenharmony_ci * The sync_file fd can be combined with other sync_file and passed either 11928c2ecf20Sopenharmony_ci * to execbuf using I915_EXEC_FENCE_IN, to atomic KMS ioctls (so that a flip 11938c2ecf20Sopenharmony_ci * will only occur after this request completes), or to other devices. 11948c2ecf20Sopenharmony_ci * 11958c2ecf20Sopenharmony_ci * Using I915_EXEC_FENCE_OUT requires use of 11968c2ecf20Sopenharmony_ci * DRM_IOCTL_I915_GEM_EXECBUFFER2_WR ioctl so that the result is written 11978c2ecf20Sopenharmony_ci * back to userspace. Failure to do so will cause the out-fence to always 11988c2ecf20Sopenharmony_ci * be reported as zero, and the real fence fd to be leaked. 11998c2ecf20Sopenharmony_ci */ 12008c2ecf20Sopenharmony_ci#define I915_EXEC_FENCE_OUT (1<<17) 12018c2ecf20Sopenharmony_ci 12028c2ecf20Sopenharmony_ci/* 12038c2ecf20Sopenharmony_ci * Traditionally the execbuf ioctl has only considered the final element in 12048c2ecf20Sopenharmony_ci * the execobject[] to be the executable batch. Often though, the client 12058c2ecf20Sopenharmony_ci * will known the batch object prior to construction and being able to place 12068c2ecf20Sopenharmony_ci * it into the execobject[] array first can simplify the relocation tracking. 12078c2ecf20Sopenharmony_ci * Setting I915_EXEC_BATCH_FIRST tells execbuf to use element 0 of the 12088c2ecf20Sopenharmony_ci * execobject[] as the * batch instead (the default is to use the last 12098c2ecf20Sopenharmony_ci * element). 12108c2ecf20Sopenharmony_ci */ 12118c2ecf20Sopenharmony_ci#define I915_EXEC_BATCH_FIRST (1<<18) 12128c2ecf20Sopenharmony_ci 12138c2ecf20Sopenharmony_ci/* Setting I915_FENCE_ARRAY implies that num_cliprects and cliprects_ptr 12148c2ecf20Sopenharmony_ci * define an array of i915_gem_exec_fence structures which specify a set of 12158c2ecf20Sopenharmony_ci * dma fences to wait upon or signal. 12168c2ecf20Sopenharmony_ci */ 12178c2ecf20Sopenharmony_ci#define I915_EXEC_FENCE_ARRAY (1<<19) 12188c2ecf20Sopenharmony_ci 12198c2ecf20Sopenharmony_ci/* 12208c2ecf20Sopenharmony_ci * Setting I915_EXEC_FENCE_SUBMIT implies that lower_32_bits(rsvd2) represent 12218c2ecf20Sopenharmony_ci * a sync_file fd to wait upon (in a nonblocking manner) prior to executing 12228c2ecf20Sopenharmony_ci * the batch. 12238c2ecf20Sopenharmony_ci * 12248c2ecf20Sopenharmony_ci * Returns -EINVAL if the sync_file fd cannot be found. 12258c2ecf20Sopenharmony_ci */ 12268c2ecf20Sopenharmony_ci#define I915_EXEC_FENCE_SUBMIT (1 << 20) 12278c2ecf20Sopenharmony_ci 12288c2ecf20Sopenharmony_ci/* 12298c2ecf20Sopenharmony_ci * Setting I915_EXEC_USE_EXTENSIONS implies that 12308c2ecf20Sopenharmony_ci * drm_i915_gem_execbuffer2.cliprects_ptr is treated as a pointer to an linked 12318c2ecf20Sopenharmony_ci * list of i915_user_extension. Each i915_user_extension node is the base of a 12328c2ecf20Sopenharmony_ci * larger structure. The list of supported structures are listed in the 12338c2ecf20Sopenharmony_ci * drm_i915_gem_execbuffer_ext enum. 12348c2ecf20Sopenharmony_ci */ 12358c2ecf20Sopenharmony_ci#define I915_EXEC_USE_EXTENSIONS (1 << 21) 12368c2ecf20Sopenharmony_ci 12378c2ecf20Sopenharmony_ci#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_USE_EXTENSIONS << 1)) 12388c2ecf20Sopenharmony_ci 12398c2ecf20Sopenharmony_ci#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) 12408c2ecf20Sopenharmony_ci#define i915_execbuffer2_set_context_id(eb2, context) \ 12418c2ecf20Sopenharmony_ci (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK 12428c2ecf20Sopenharmony_ci#define i915_execbuffer2_get_context_id(eb2) \ 12438c2ecf20Sopenharmony_ci ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK) 12448c2ecf20Sopenharmony_ci 12458c2ecf20Sopenharmony_cistruct drm_i915_gem_pin { 12468c2ecf20Sopenharmony_ci /** Handle of the buffer to be pinned. */ 12478c2ecf20Sopenharmony_ci __u32 handle; 12488c2ecf20Sopenharmony_ci __u32 pad; 12498c2ecf20Sopenharmony_ci 12508c2ecf20Sopenharmony_ci /** alignment required within the aperture */ 12518c2ecf20Sopenharmony_ci __u64 alignment; 12528c2ecf20Sopenharmony_ci 12538c2ecf20Sopenharmony_ci /** Returned GTT offset of the buffer. */ 12548c2ecf20Sopenharmony_ci __u64 offset; 12558c2ecf20Sopenharmony_ci}; 12568c2ecf20Sopenharmony_ci 12578c2ecf20Sopenharmony_cistruct drm_i915_gem_unpin { 12588c2ecf20Sopenharmony_ci /** Handle of the buffer to be unpinned. */ 12598c2ecf20Sopenharmony_ci __u32 handle; 12608c2ecf20Sopenharmony_ci __u32 pad; 12618c2ecf20Sopenharmony_ci}; 12628c2ecf20Sopenharmony_ci 12638c2ecf20Sopenharmony_cistruct drm_i915_gem_busy { 12648c2ecf20Sopenharmony_ci /** Handle of the buffer to check for busy */ 12658c2ecf20Sopenharmony_ci __u32 handle; 12668c2ecf20Sopenharmony_ci 12678c2ecf20Sopenharmony_ci /** Return busy status 12688c2ecf20Sopenharmony_ci * 12698c2ecf20Sopenharmony_ci * A return of 0 implies that the object is idle (after 12708c2ecf20Sopenharmony_ci * having flushed any pending activity), and a non-zero return that 12718c2ecf20Sopenharmony_ci * the object is still in-flight on the GPU. (The GPU has not yet 12728c2ecf20Sopenharmony_ci * signaled completion for all pending requests that reference the 12738c2ecf20Sopenharmony_ci * object.) An object is guaranteed to become idle eventually (so 12748c2ecf20Sopenharmony_ci * long as no new GPU commands are executed upon it). Due to the 12758c2ecf20Sopenharmony_ci * asynchronous nature of the hardware, an object reported 12768c2ecf20Sopenharmony_ci * as busy may become idle before the ioctl is completed. 12778c2ecf20Sopenharmony_ci * 12788c2ecf20Sopenharmony_ci * Furthermore, if the object is busy, which engine is busy is only 12798c2ecf20Sopenharmony_ci * provided as a guide and only indirectly by reporting its class 12808c2ecf20Sopenharmony_ci * (there may be more than one engine in each class). There are race 12818c2ecf20Sopenharmony_ci * conditions which prevent the report of which engines are busy from 12828c2ecf20Sopenharmony_ci * being always accurate. However, the converse is not true. If the 12838c2ecf20Sopenharmony_ci * object is idle, the result of the ioctl, that all engines are idle, 12848c2ecf20Sopenharmony_ci * is accurate. 12858c2ecf20Sopenharmony_ci * 12868c2ecf20Sopenharmony_ci * The returned dword is split into two fields to indicate both 12878c2ecf20Sopenharmony_ci * the engine classess on which the object is being read, and the 12888c2ecf20Sopenharmony_ci * engine class on which it is currently being written (if any). 12898c2ecf20Sopenharmony_ci * 12908c2ecf20Sopenharmony_ci * The low word (bits 0:15) indicate if the object is being written 12918c2ecf20Sopenharmony_ci * to by any engine (there can only be one, as the GEM implicit 12928c2ecf20Sopenharmony_ci * synchronisation rules force writes to be serialised). Only the 12938c2ecf20Sopenharmony_ci * engine class (offset by 1, I915_ENGINE_CLASS_RENDER is reported as 12948c2ecf20Sopenharmony_ci * 1 not 0 etc) for the last write is reported. 12958c2ecf20Sopenharmony_ci * 12968c2ecf20Sopenharmony_ci * The high word (bits 16:31) are a bitmask of which engines classes 12978c2ecf20Sopenharmony_ci * are currently reading from the object. Multiple engines may be 12988c2ecf20Sopenharmony_ci * reading from the object simultaneously. 12998c2ecf20Sopenharmony_ci * 13008c2ecf20Sopenharmony_ci * The value of each engine class is the same as specified in the 13018c2ecf20Sopenharmony_ci * I915_CONTEXT_SET_ENGINES parameter and via perf, i.e. 13028c2ecf20Sopenharmony_ci * I915_ENGINE_CLASS_RENDER, I915_ENGINE_CLASS_COPY, etc. 13038c2ecf20Sopenharmony_ci * reported as active itself. Some hardware may have parallel 13048c2ecf20Sopenharmony_ci * execution engines, e.g. multiple media engines, which are 13058c2ecf20Sopenharmony_ci * mapped to the same class identifier and so are not separately 13068c2ecf20Sopenharmony_ci * reported for busyness. 13078c2ecf20Sopenharmony_ci * 13088c2ecf20Sopenharmony_ci * Caveat emptor: 13098c2ecf20Sopenharmony_ci * Only the boolean result of this query is reliable; that is whether 13108c2ecf20Sopenharmony_ci * the object is idle or busy. The report of which engines are busy 13118c2ecf20Sopenharmony_ci * should be only used as a heuristic. 13128c2ecf20Sopenharmony_ci */ 13138c2ecf20Sopenharmony_ci __u32 busy; 13148c2ecf20Sopenharmony_ci}; 13158c2ecf20Sopenharmony_ci 13168c2ecf20Sopenharmony_ci/** 13178c2ecf20Sopenharmony_ci * I915_CACHING_NONE 13188c2ecf20Sopenharmony_ci * 13198c2ecf20Sopenharmony_ci * GPU access is not coherent with cpu caches. Default for machines without an 13208c2ecf20Sopenharmony_ci * LLC. 13218c2ecf20Sopenharmony_ci */ 13228c2ecf20Sopenharmony_ci#define I915_CACHING_NONE 0 13238c2ecf20Sopenharmony_ci/** 13248c2ecf20Sopenharmony_ci * I915_CACHING_CACHED 13258c2ecf20Sopenharmony_ci * 13268c2ecf20Sopenharmony_ci * GPU access is coherent with cpu caches and furthermore the data is cached in 13278c2ecf20Sopenharmony_ci * last-level caches shared between cpu cores and the gpu GT. Default on 13288c2ecf20Sopenharmony_ci * machines with HAS_LLC. 13298c2ecf20Sopenharmony_ci */ 13308c2ecf20Sopenharmony_ci#define I915_CACHING_CACHED 1 13318c2ecf20Sopenharmony_ci/** 13328c2ecf20Sopenharmony_ci * I915_CACHING_DISPLAY 13338c2ecf20Sopenharmony_ci * 13348c2ecf20Sopenharmony_ci * Special GPU caching mode which is coherent with the scanout engines. 13358c2ecf20Sopenharmony_ci * Transparently falls back to I915_CACHING_NONE on platforms where no special 13368c2ecf20Sopenharmony_ci * cache mode (like write-through or gfdt flushing) is available. The kernel 13378c2ecf20Sopenharmony_ci * automatically sets this mode when using a buffer as a scanout target. 13388c2ecf20Sopenharmony_ci * Userspace can manually set this mode to avoid a costly stall and clflush in 13398c2ecf20Sopenharmony_ci * the hotpath of drawing the first frame. 13408c2ecf20Sopenharmony_ci */ 13418c2ecf20Sopenharmony_ci#define I915_CACHING_DISPLAY 2 13428c2ecf20Sopenharmony_ci 13438c2ecf20Sopenharmony_cistruct drm_i915_gem_caching { 13448c2ecf20Sopenharmony_ci /** 13458c2ecf20Sopenharmony_ci * Handle of the buffer to set/get the caching level of. */ 13468c2ecf20Sopenharmony_ci __u32 handle; 13478c2ecf20Sopenharmony_ci 13488c2ecf20Sopenharmony_ci /** 13498c2ecf20Sopenharmony_ci * Cacheing level to apply or return value 13508c2ecf20Sopenharmony_ci * 13518c2ecf20Sopenharmony_ci * bits0-15 are for generic caching control (i.e. the above defined 13528c2ecf20Sopenharmony_ci * values). bits16-31 are reserved for platform-specific variations 13538c2ecf20Sopenharmony_ci * (e.g. l3$ caching on gen7). */ 13548c2ecf20Sopenharmony_ci __u32 caching; 13558c2ecf20Sopenharmony_ci}; 13568c2ecf20Sopenharmony_ci 13578c2ecf20Sopenharmony_ci#define I915_TILING_NONE 0 13588c2ecf20Sopenharmony_ci#define I915_TILING_X 1 13598c2ecf20Sopenharmony_ci#define I915_TILING_Y 2 13608c2ecf20Sopenharmony_ci#define I915_TILING_LAST I915_TILING_Y 13618c2ecf20Sopenharmony_ci 13628c2ecf20Sopenharmony_ci#define I915_BIT_6_SWIZZLE_NONE 0 13638c2ecf20Sopenharmony_ci#define I915_BIT_6_SWIZZLE_9 1 13648c2ecf20Sopenharmony_ci#define I915_BIT_6_SWIZZLE_9_10 2 13658c2ecf20Sopenharmony_ci#define I915_BIT_6_SWIZZLE_9_11 3 13668c2ecf20Sopenharmony_ci#define I915_BIT_6_SWIZZLE_9_10_11 4 13678c2ecf20Sopenharmony_ci/* Not seen by userland */ 13688c2ecf20Sopenharmony_ci#define I915_BIT_6_SWIZZLE_UNKNOWN 5 13698c2ecf20Sopenharmony_ci/* Seen by userland. */ 13708c2ecf20Sopenharmony_ci#define I915_BIT_6_SWIZZLE_9_17 6 13718c2ecf20Sopenharmony_ci#define I915_BIT_6_SWIZZLE_9_10_17 7 13728c2ecf20Sopenharmony_ci 13738c2ecf20Sopenharmony_cistruct drm_i915_gem_set_tiling { 13748c2ecf20Sopenharmony_ci /** Handle of the buffer to have its tiling state updated */ 13758c2ecf20Sopenharmony_ci __u32 handle; 13768c2ecf20Sopenharmony_ci 13778c2ecf20Sopenharmony_ci /** 13788c2ecf20Sopenharmony_ci * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 13798c2ecf20Sopenharmony_ci * I915_TILING_Y). 13808c2ecf20Sopenharmony_ci * 13818c2ecf20Sopenharmony_ci * This value is to be set on request, and will be updated by the 13828c2ecf20Sopenharmony_ci * kernel on successful return with the actual chosen tiling layout. 13838c2ecf20Sopenharmony_ci * 13848c2ecf20Sopenharmony_ci * The tiling mode may be demoted to I915_TILING_NONE when the system 13858c2ecf20Sopenharmony_ci * has bit 6 swizzling that can't be managed correctly by GEM. 13868c2ecf20Sopenharmony_ci * 13878c2ecf20Sopenharmony_ci * Buffer contents become undefined when changing tiling_mode. 13888c2ecf20Sopenharmony_ci */ 13898c2ecf20Sopenharmony_ci __u32 tiling_mode; 13908c2ecf20Sopenharmony_ci 13918c2ecf20Sopenharmony_ci /** 13928c2ecf20Sopenharmony_ci * Stride in bytes for the object when in I915_TILING_X or 13938c2ecf20Sopenharmony_ci * I915_TILING_Y. 13948c2ecf20Sopenharmony_ci */ 13958c2ecf20Sopenharmony_ci __u32 stride; 13968c2ecf20Sopenharmony_ci 13978c2ecf20Sopenharmony_ci /** 13988c2ecf20Sopenharmony_ci * Returned address bit 6 swizzling required for CPU access through 13998c2ecf20Sopenharmony_ci * mmap mapping. 14008c2ecf20Sopenharmony_ci */ 14018c2ecf20Sopenharmony_ci __u32 swizzle_mode; 14028c2ecf20Sopenharmony_ci}; 14038c2ecf20Sopenharmony_ci 14048c2ecf20Sopenharmony_cistruct drm_i915_gem_get_tiling { 14058c2ecf20Sopenharmony_ci /** Handle of the buffer to get tiling state for. */ 14068c2ecf20Sopenharmony_ci __u32 handle; 14078c2ecf20Sopenharmony_ci 14088c2ecf20Sopenharmony_ci /** 14098c2ecf20Sopenharmony_ci * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 14108c2ecf20Sopenharmony_ci * I915_TILING_Y). 14118c2ecf20Sopenharmony_ci */ 14128c2ecf20Sopenharmony_ci __u32 tiling_mode; 14138c2ecf20Sopenharmony_ci 14148c2ecf20Sopenharmony_ci /** 14158c2ecf20Sopenharmony_ci * Returned address bit 6 swizzling required for CPU access through 14168c2ecf20Sopenharmony_ci * mmap mapping. 14178c2ecf20Sopenharmony_ci */ 14188c2ecf20Sopenharmony_ci __u32 swizzle_mode; 14198c2ecf20Sopenharmony_ci 14208c2ecf20Sopenharmony_ci /** 14218c2ecf20Sopenharmony_ci * Returned address bit 6 swizzling required for CPU access through 14228c2ecf20Sopenharmony_ci * mmap mapping whilst bound. 14238c2ecf20Sopenharmony_ci */ 14248c2ecf20Sopenharmony_ci __u32 phys_swizzle_mode; 14258c2ecf20Sopenharmony_ci}; 14268c2ecf20Sopenharmony_ci 14278c2ecf20Sopenharmony_cistruct drm_i915_gem_get_aperture { 14288c2ecf20Sopenharmony_ci /** Total size of the aperture used by i915_gem_execbuffer, in bytes */ 14298c2ecf20Sopenharmony_ci __u64 aper_size; 14308c2ecf20Sopenharmony_ci 14318c2ecf20Sopenharmony_ci /** 14328c2ecf20Sopenharmony_ci * Available space in the aperture used by i915_gem_execbuffer, in 14338c2ecf20Sopenharmony_ci * bytes 14348c2ecf20Sopenharmony_ci */ 14358c2ecf20Sopenharmony_ci __u64 aper_available_size; 14368c2ecf20Sopenharmony_ci}; 14378c2ecf20Sopenharmony_ci 14388c2ecf20Sopenharmony_cistruct drm_i915_get_pipe_from_crtc_id { 14398c2ecf20Sopenharmony_ci /** ID of CRTC being requested **/ 14408c2ecf20Sopenharmony_ci __u32 crtc_id; 14418c2ecf20Sopenharmony_ci 14428c2ecf20Sopenharmony_ci /** pipe of requested CRTC **/ 14438c2ecf20Sopenharmony_ci __u32 pipe; 14448c2ecf20Sopenharmony_ci}; 14458c2ecf20Sopenharmony_ci 14468c2ecf20Sopenharmony_ci#define I915_MADV_WILLNEED 0 14478c2ecf20Sopenharmony_ci#define I915_MADV_DONTNEED 1 14488c2ecf20Sopenharmony_ci#define __I915_MADV_PURGED 2 /* internal state */ 14498c2ecf20Sopenharmony_ci 14508c2ecf20Sopenharmony_cistruct drm_i915_gem_madvise { 14518c2ecf20Sopenharmony_ci /** Handle of the buffer to change the backing store advice */ 14528c2ecf20Sopenharmony_ci __u32 handle; 14538c2ecf20Sopenharmony_ci 14548c2ecf20Sopenharmony_ci /* Advice: either the buffer will be needed again in the near future, 14558c2ecf20Sopenharmony_ci * or wont be and could be discarded under memory pressure. 14568c2ecf20Sopenharmony_ci */ 14578c2ecf20Sopenharmony_ci __u32 madv; 14588c2ecf20Sopenharmony_ci 14598c2ecf20Sopenharmony_ci /** Whether the backing store still exists. */ 14608c2ecf20Sopenharmony_ci __u32 retained; 14618c2ecf20Sopenharmony_ci}; 14628c2ecf20Sopenharmony_ci 14638c2ecf20Sopenharmony_ci/* flags */ 14648c2ecf20Sopenharmony_ci#define I915_OVERLAY_TYPE_MASK 0xff 14658c2ecf20Sopenharmony_ci#define I915_OVERLAY_YUV_PLANAR 0x01 14668c2ecf20Sopenharmony_ci#define I915_OVERLAY_YUV_PACKED 0x02 14678c2ecf20Sopenharmony_ci#define I915_OVERLAY_RGB 0x03 14688c2ecf20Sopenharmony_ci 14698c2ecf20Sopenharmony_ci#define I915_OVERLAY_DEPTH_MASK 0xff00 14708c2ecf20Sopenharmony_ci#define I915_OVERLAY_RGB24 0x1000 14718c2ecf20Sopenharmony_ci#define I915_OVERLAY_RGB16 0x2000 14728c2ecf20Sopenharmony_ci#define I915_OVERLAY_RGB15 0x3000 14738c2ecf20Sopenharmony_ci#define I915_OVERLAY_YUV422 0x0100 14748c2ecf20Sopenharmony_ci#define I915_OVERLAY_YUV411 0x0200 14758c2ecf20Sopenharmony_ci#define I915_OVERLAY_YUV420 0x0300 14768c2ecf20Sopenharmony_ci#define I915_OVERLAY_YUV410 0x0400 14778c2ecf20Sopenharmony_ci 14788c2ecf20Sopenharmony_ci#define I915_OVERLAY_SWAP_MASK 0xff0000 14798c2ecf20Sopenharmony_ci#define I915_OVERLAY_NO_SWAP 0x000000 14808c2ecf20Sopenharmony_ci#define I915_OVERLAY_UV_SWAP 0x010000 14818c2ecf20Sopenharmony_ci#define I915_OVERLAY_Y_SWAP 0x020000 14828c2ecf20Sopenharmony_ci#define I915_OVERLAY_Y_AND_UV_SWAP 0x030000 14838c2ecf20Sopenharmony_ci 14848c2ecf20Sopenharmony_ci#define I915_OVERLAY_FLAGS_MASK 0xff000000 14858c2ecf20Sopenharmony_ci#define I915_OVERLAY_ENABLE 0x01000000 14868c2ecf20Sopenharmony_ci 14878c2ecf20Sopenharmony_cistruct drm_intel_overlay_put_image { 14888c2ecf20Sopenharmony_ci /* various flags and src format description */ 14898c2ecf20Sopenharmony_ci __u32 flags; 14908c2ecf20Sopenharmony_ci /* source picture description */ 14918c2ecf20Sopenharmony_ci __u32 bo_handle; 14928c2ecf20Sopenharmony_ci /* stride values and offsets are in bytes, buffer relative */ 14938c2ecf20Sopenharmony_ci __u16 stride_Y; /* stride for packed formats */ 14948c2ecf20Sopenharmony_ci __u16 stride_UV; 14958c2ecf20Sopenharmony_ci __u32 offset_Y; /* offset for packet formats */ 14968c2ecf20Sopenharmony_ci __u32 offset_U; 14978c2ecf20Sopenharmony_ci __u32 offset_V; 14988c2ecf20Sopenharmony_ci /* in pixels */ 14998c2ecf20Sopenharmony_ci __u16 src_width; 15008c2ecf20Sopenharmony_ci __u16 src_height; 15018c2ecf20Sopenharmony_ci /* to compensate the scaling factors for partially covered surfaces */ 15028c2ecf20Sopenharmony_ci __u16 src_scan_width; 15038c2ecf20Sopenharmony_ci __u16 src_scan_height; 15048c2ecf20Sopenharmony_ci /* output crtc description */ 15058c2ecf20Sopenharmony_ci __u32 crtc_id; 15068c2ecf20Sopenharmony_ci __u16 dst_x; 15078c2ecf20Sopenharmony_ci __u16 dst_y; 15088c2ecf20Sopenharmony_ci __u16 dst_width; 15098c2ecf20Sopenharmony_ci __u16 dst_height; 15108c2ecf20Sopenharmony_ci}; 15118c2ecf20Sopenharmony_ci 15128c2ecf20Sopenharmony_ci/* flags */ 15138c2ecf20Sopenharmony_ci#define I915_OVERLAY_UPDATE_ATTRS (1<<0) 15148c2ecf20Sopenharmony_ci#define I915_OVERLAY_UPDATE_GAMMA (1<<1) 15158c2ecf20Sopenharmony_ci#define I915_OVERLAY_DISABLE_DEST_COLORKEY (1<<2) 15168c2ecf20Sopenharmony_cistruct drm_intel_overlay_attrs { 15178c2ecf20Sopenharmony_ci __u32 flags; 15188c2ecf20Sopenharmony_ci __u32 color_key; 15198c2ecf20Sopenharmony_ci __s32 brightness; 15208c2ecf20Sopenharmony_ci __u32 contrast; 15218c2ecf20Sopenharmony_ci __u32 saturation; 15228c2ecf20Sopenharmony_ci __u32 gamma0; 15238c2ecf20Sopenharmony_ci __u32 gamma1; 15248c2ecf20Sopenharmony_ci __u32 gamma2; 15258c2ecf20Sopenharmony_ci __u32 gamma3; 15268c2ecf20Sopenharmony_ci __u32 gamma4; 15278c2ecf20Sopenharmony_ci __u32 gamma5; 15288c2ecf20Sopenharmony_ci}; 15298c2ecf20Sopenharmony_ci 15308c2ecf20Sopenharmony_ci/* 15318c2ecf20Sopenharmony_ci * Intel sprite handling 15328c2ecf20Sopenharmony_ci * 15338c2ecf20Sopenharmony_ci * Color keying works with a min/mask/max tuple. Both source and destination 15348c2ecf20Sopenharmony_ci * color keying is allowed. 15358c2ecf20Sopenharmony_ci * 15368c2ecf20Sopenharmony_ci * Source keying: 15378c2ecf20Sopenharmony_ci * Sprite pixels within the min & max values, masked against the color channels 15388c2ecf20Sopenharmony_ci * specified in the mask field, will be transparent. All other pixels will 15398c2ecf20Sopenharmony_ci * be displayed on top of the primary plane. For RGB surfaces, only the min 15408c2ecf20Sopenharmony_ci * and mask fields will be used; ranged compares are not allowed. 15418c2ecf20Sopenharmony_ci * 15428c2ecf20Sopenharmony_ci * Destination keying: 15438c2ecf20Sopenharmony_ci * Primary plane pixels that match the min value, masked against the color 15448c2ecf20Sopenharmony_ci * channels specified in the mask field, will be replaced by corresponding 15458c2ecf20Sopenharmony_ci * pixels from the sprite plane. 15468c2ecf20Sopenharmony_ci * 15478c2ecf20Sopenharmony_ci * Note that source & destination keying are exclusive; only one can be 15488c2ecf20Sopenharmony_ci * active on a given plane. 15498c2ecf20Sopenharmony_ci */ 15508c2ecf20Sopenharmony_ci 15518c2ecf20Sopenharmony_ci#define I915_SET_COLORKEY_NONE (1<<0) /* Deprecated. Instead set 15528c2ecf20Sopenharmony_ci * flags==0 to disable colorkeying. 15538c2ecf20Sopenharmony_ci */ 15548c2ecf20Sopenharmony_ci#define I915_SET_COLORKEY_DESTINATION (1<<1) 15558c2ecf20Sopenharmony_ci#define I915_SET_COLORKEY_SOURCE (1<<2) 15568c2ecf20Sopenharmony_cistruct drm_intel_sprite_colorkey { 15578c2ecf20Sopenharmony_ci __u32 plane_id; 15588c2ecf20Sopenharmony_ci __u32 min_value; 15598c2ecf20Sopenharmony_ci __u32 channel_mask; 15608c2ecf20Sopenharmony_ci __u32 max_value; 15618c2ecf20Sopenharmony_ci __u32 flags; 15628c2ecf20Sopenharmony_ci}; 15638c2ecf20Sopenharmony_ci 15648c2ecf20Sopenharmony_cistruct drm_i915_gem_wait { 15658c2ecf20Sopenharmony_ci /** Handle of BO we shall wait on */ 15668c2ecf20Sopenharmony_ci __u32 bo_handle; 15678c2ecf20Sopenharmony_ci __u32 flags; 15688c2ecf20Sopenharmony_ci /** Number of nanoseconds to wait, Returns time remaining. */ 15698c2ecf20Sopenharmony_ci __s64 timeout_ns; 15708c2ecf20Sopenharmony_ci}; 15718c2ecf20Sopenharmony_ci 15728c2ecf20Sopenharmony_cistruct drm_i915_gem_context_create { 15738c2ecf20Sopenharmony_ci __u32 ctx_id; /* output: id of new context*/ 15748c2ecf20Sopenharmony_ci __u32 pad; 15758c2ecf20Sopenharmony_ci}; 15768c2ecf20Sopenharmony_ci 15778c2ecf20Sopenharmony_cistruct drm_i915_gem_context_create_ext { 15788c2ecf20Sopenharmony_ci __u32 ctx_id; /* output: id of new context*/ 15798c2ecf20Sopenharmony_ci __u32 flags; 15808c2ecf20Sopenharmony_ci#define I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS (1u << 0) 15818c2ecf20Sopenharmony_ci#define I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE (1u << 1) 15828c2ecf20Sopenharmony_ci#define I915_CONTEXT_CREATE_FLAGS_UNKNOWN \ 15838c2ecf20Sopenharmony_ci (-(I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE << 1)) 15848c2ecf20Sopenharmony_ci __u64 extensions; 15858c2ecf20Sopenharmony_ci}; 15868c2ecf20Sopenharmony_ci 15878c2ecf20Sopenharmony_cistruct drm_i915_gem_context_param { 15888c2ecf20Sopenharmony_ci __u32 ctx_id; 15898c2ecf20Sopenharmony_ci __u32 size; 15908c2ecf20Sopenharmony_ci __u64 param; 15918c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1 15928c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2 15938c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_GTT_SIZE 0x3 15948c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4 15958c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_BANNABLE 0x5 15968c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_PRIORITY 0x6 15978c2ecf20Sopenharmony_ci#define I915_CONTEXT_MAX_USER_PRIORITY 1023 /* inclusive */ 15988c2ecf20Sopenharmony_ci#define I915_CONTEXT_DEFAULT_PRIORITY 0 15998c2ecf20Sopenharmony_ci#define I915_CONTEXT_MIN_USER_PRIORITY -1023 /* inclusive */ 16008c2ecf20Sopenharmony_ci /* 16018c2ecf20Sopenharmony_ci * When using the following param, value should be a pointer to 16028c2ecf20Sopenharmony_ci * drm_i915_gem_context_param_sseu. 16038c2ecf20Sopenharmony_ci */ 16048c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_SSEU 0x7 16058c2ecf20Sopenharmony_ci 16068c2ecf20Sopenharmony_ci/* 16078c2ecf20Sopenharmony_ci * Not all clients may want to attempt automatic recover of a context after 16088c2ecf20Sopenharmony_ci * a hang (for example, some clients may only submit very small incremental 16098c2ecf20Sopenharmony_ci * batches relying on known logical state of previous batches which will never 16108c2ecf20Sopenharmony_ci * recover correctly and each attempt will hang), and so would prefer that 16118c2ecf20Sopenharmony_ci * the context is forever banned instead. 16128c2ecf20Sopenharmony_ci * 16138c2ecf20Sopenharmony_ci * If set to false (0), after a reset, subsequent (and in flight) rendering 16148c2ecf20Sopenharmony_ci * from this context is discarded, and the client will need to create a new 16158c2ecf20Sopenharmony_ci * context to use instead. 16168c2ecf20Sopenharmony_ci * 16178c2ecf20Sopenharmony_ci * If set to true (1), the kernel will automatically attempt to recover the 16188c2ecf20Sopenharmony_ci * context by skipping the hanging batch and executing the next batch starting 16198c2ecf20Sopenharmony_ci * from the default context state (discarding the incomplete logical context 16208c2ecf20Sopenharmony_ci * state lost due to the reset). 16218c2ecf20Sopenharmony_ci * 16228c2ecf20Sopenharmony_ci * On creation, all new contexts are marked as recoverable. 16238c2ecf20Sopenharmony_ci */ 16248c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_RECOVERABLE 0x8 16258c2ecf20Sopenharmony_ci 16268c2ecf20Sopenharmony_ci /* 16278c2ecf20Sopenharmony_ci * The id of the associated virtual memory address space (ppGTT) of 16288c2ecf20Sopenharmony_ci * this context. Can be retrieved and passed to another context 16298c2ecf20Sopenharmony_ci * (on the same fd) for both to use the same ppGTT and so share 16308c2ecf20Sopenharmony_ci * address layouts, and avoid reloading the page tables on context 16318c2ecf20Sopenharmony_ci * switches between themselves. 16328c2ecf20Sopenharmony_ci * 16338c2ecf20Sopenharmony_ci * See DRM_I915_GEM_VM_CREATE and DRM_I915_GEM_VM_DESTROY. 16348c2ecf20Sopenharmony_ci */ 16358c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_VM 0x9 16368c2ecf20Sopenharmony_ci 16378c2ecf20Sopenharmony_ci/* 16388c2ecf20Sopenharmony_ci * I915_CONTEXT_PARAM_ENGINES: 16398c2ecf20Sopenharmony_ci * 16408c2ecf20Sopenharmony_ci * Bind this context to operate on this subset of available engines. Henceforth, 16418c2ecf20Sopenharmony_ci * the I915_EXEC_RING selector for DRM_IOCTL_I915_GEM_EXECBUFFER2 operates as 16428c2ecf20Sopenharmony_ci * an index into this array of engines; I915_EXEC_DEFAULT selecting engine[0] 16438c2ecf20Sopenharmony_ci * and upwards. Slots 0...N are filled in using the specified (class, instance). 16448c2ecf20Sopenharmony_ci * Use 16458c2ecf20Sopenharmony_ci * engine_class: I915_ENGINE_CLASS_INVALID, 16468c2ecf20Sopenharmony_ci * engine_instance: I915_ENGINE_CLASS_INVALID_NONE 16478c2ecf20Sopenharmony_ci * to specify a gap in the array that can be filled in later, e.g. by a 16488c2ecf20Sopenharmony_ci * virtual engine used for load balancing. 16498c2ecf20Sopenharmony_ci * 16508c2ecf20Sopenharmony_ci * Setting the number of engines bound to the context to 0, by passing a zero 16518c2ecf20Sopenharmony_ci * sized argument, will revert back to default settings. 16528c2ecf20Sopenharmony_ci * 16538c2ecf20Sopenharmony_ci * See struct i915_context_param_engines. 16548c2ecf20Sopenharmony_ci * 16558c2ecf20Sopenharmony_ci * Extensions: 16568c2ecf20Sopenharmony_ci * i915_context_engines_load_balance (I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE) 16578c2ecf20Sopenharmony_ci * i915_context_engines_bond (I915_CONTEXT_ENGINES_EXT_BOND) 16588c2ecf20Sopenharmony_ci */ 16598c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_ENGINES 0xa 16608c2ecf20Sopenharmony_ci 16618c2ecf20Sopenharmony_ci/* 16628c2ecf20Sopenharmony_ci * I915_CONTEXT_PARAM_PERSISTENCE: 16638c2ecf20Sopenharmony_ci * 16648c2ecf20Sopenharmony_ci * Allow the context and active rendering to survive the process until 16658c2ecf20Sopenharmony_ci * completion. Persistence allows fire-and-forget clients to queue up a 16668c2ecf20Sopenharmony_ci * bunch of work, hand the output over to a display server and then quit. 16678c2ecf20Sopenharmony_ci * If the context is marked as not persistent, upon closing (either via 16688c2ecf20Sopenharmony_ci * an explicit DRM_I915_GEM_CONTEXT_DESTROY or implicitly from file closure 16698c2ecf20Sopenharmony_ci * or process termination), the context and any outstanding requests will be 16708c2ecf20Sopenharmony_ci * cancelled (and exported fences for cancelled requests marked as -EIO). 16718c2ecf20Sopenharmony_ci * 16728c2ecf20Sopenharmony_ci * By default, new contexts allow persistence. 16738c2ecf20Sopenharmony_ci */ 16748c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_PERSISTENCE 0xb 16758c2ecf20Sopenharmony_ci 16768c2ecf20Sopenharmony_ci/* 16778c2ecf20Sopenharmony_ci * I915_CONTEXT_PARAM_RINGSIZE: 16788c2ecf20Sopenharmony_ci * 16798c2ecf20Sopenharmony_ci * Sets the size of the CS ringbuffer to use for logical ring contexts. This 16808c2ecf20Sopenharmony_ci * applies a limit of how many batches can be queued to HW before the caller 16818c2ecf20Sopenharmony_ci * is blocked due to lack of space for more commands. 16828c2ecf20Sopenharmony_ci * 16838c2ecf20Sopenharmony_ci * Only reliably possible to be set prior to first use, i.e. during 16848c2ecf20Sopenharmony_ci * construction. At any later point, the current execution must be flushed as 16858c2ecf20Sopenharmony_ci * the ring can only be changed while the context is idle. Note, the ringsize 16868c2ecf20Sopenharmony_ci * can be specified as a constructor property, see 16878c2ecf20Sopenharmony_ci * I915_CONTEXT_CREATE_EXT_SETPARAM, but can also be set later if required. 16888c2ecf20Sopenharmony_ci * 16898c2ecf20Sopenharmony_ci * Only applies to the current set of engine and lost when those engines 16908c2ecf20Sopenharmony_ci * are replaced by a new mapping (see I915_CONTEXT_PARAM_ENGINES). 16918c2ecf20Sopenharmony_ci * 16928c2ecf20Sopenharmony_ci * Must be between 4 - 512 KiB, in intervals of page size [4 KiB]. 16938c2ecf20Sopenharmony_ci * Default is 16 KiB. 16948c2ecf20Sopenharmony_ci */ 16958c2ecf20Sopenharmony_ci#define I915_CONTEXT_PARAM_RINGSIZE 0xc 16968c2ecf20Sopenharmony_ci/* Must be kept compact -- no holes and well documented */ 16978c2ecf20Sopenharmony_ci 16988c2ecf20Sopenharmony_ci __u64 value; 16998c2ecf20Sopenharmony_ci}; 17008c2ecf20Sopenharmony_ci 17018c2ecf20Sopenharmony_ci/** 17028c2ecf20Sopenharmony_ci * Context SSEU programming 17038c2ecf20Sopenharmony_ci * 17048c2ecf20Sopenharmony_ci * It may be necessary for either functional or performance reason to configure 17058c2ecf20Sopenharmony_ci * a context to run with a reduced number of SSEU (where SSEU stands for Slice/ 17068c2ecf20Sopenharmony_ci * Sub-slice/EU). 17078c2ecf20Sopenharmony_ci * 17088c2ecf20Sopenharmony_ci * This is done by configuring SSEU configuration using the below 17098c2ecf20Sopenharmony_ci * @struct drm_i915_gem_context_param_sseu for every supported engine which 17108c2ecf20Sopenharmony_ci * userspace intends to use. 17118c2ecf20Sopenharmony_ci * 17128c2ecf20Sopenharmony_ci * Not all GPUs or engines support this functionality in which case an error 17138c2ecf20Sopenharmony_ci * code -ENODEV will be returned. 17148c2ecf20Sopenharmony_ci * 17158c2ecf20Sopenharmony_ci * Also, flexibility of possible SSEU configuration permutations varies between 17168c2ecf20Sopenharmony_ci * GPU generations and software imposed limitations. Requesting such a 17178c2ecf20Sopenharmony_ci * combination will return an error code of -EINVAL. 17188c2ecf20Sopenharmony_ci * 17198c2ecf20Sopenharmony_ci * NOTE: When perf/OA is active the context's SSEU configuration is ignored in 17208c2ecf20Sopenharmony_ci * favour of a single global setting. 17218c2ecf20Sopenharmony_ci */ 17228c2ecf20Sopenharmony_cistruct drm_i915_gem_context_param_sseu { 17238c2ecf20Sopenharmony_ci /* 17248c2ecf20Sopenharmony_ci * Engine class & instance to be configured or queried. 17258c2ecf20Sopenharmony_ci */ 17268c2ecf20Sopenharmony_ci struct i915_engine_class_instance engine; 17278c2ecf20Sopenharmony_ci 17288c2ecf20Sopenharmony_ci /* 17298c2ecf20Sopenharmony_ci * Unknown flags must be cleared to zero. 17308c2ecf20Sopenharmony_ci */ 17318c2ecf20Sopenharmony_ci __u32 flags; 17328c2ecf20Sopenharmony_ci#define I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX (1u << 0) 17338c2ecf20Sopenharmony_ci 17348c2ecf20Sopenharmony_ci /* 17358c2ecf20Sopenharmony_ci * Mask of slices to enable for the context. Valid values are a subset 17368c2ecf20Sopenharmony_ci * of the bitmask value returned for I915_PARAM_SLICE_MASK. 17378c2ecf20Sopenharmony_ci */ 17388c2ecf20Sopenharmony_ci __u64 slice_mask; 17398c2ecf20Sopenharmony_ci 17408c2ecf20Sopenharmony_ci /* 17418c2ecf20Sopenharmony_ci * Mask of subslices to enable for the context. Valid values are a 17428c2ecf20Sopenharmony_ci * subset of the bitmask value return by I915_PARAM_SUBSLICE_MASK. 17438c2ecf20Sopenharmony_ci */ 17448c2ecf20Sopenharmony_ci __u64 subslice_mask; 17458c2ecf20Sopenharmony_ci 17468c2ecf20Sopenharmony_ci /* 17478c2ecf20Sopenharmony_ci * Minimum/Maximum number of EUs to enable per subslice for the 17488c2ecf20Sopenharmony_ci * context. min_eus_per_subslice must be inferior or equal to 17498c2ecf20Sopenharmony_ci * max_eus_per_subslice. 17508c2ecf20Sopenharmony_ci */ 17518c2ecf20Sopenharmony_ci __u16 min_eus_per_subslice; 17528c2ecf20Sopenharmony_ci __u16 max_eus_per_subslice; 17538c2ecf20Sopenharmony_ci 17548c2ecf20Sopenharmony_ci /* 17558c2ecf20Sopenharmony_ci * Unused for now. Must be cleared to zero. 17568c2ecf20Sopenharmony_ci */ 17578c2ecf20Sopenharmony_ci __u32 rsvd; 17588c2ecf20Sopenharmony_ci}; 17598c2ecf20Sopenharmony_ci 17608c2ecf20Sopenharmony_ci/* 17618c2ecf20Sopenharmony_ci * i915_context_engines_load_balance: 17628c2ecf20Sopenharmony_ci * 17638c2ecf20Sopenharmony_ci * Enable load balancing across this set of engines. 17648c2ecf20Sopenharmony_ci * 17658c2ecf20Sopenharmony_ci * Into the I915_EXEC_DEFAULT slot [0], a virtual engine is created that when 17668c2ecf20Sopenharmony_ci * used will proxy the execbuffer request onto one of the set of engines 17678c2ecf20Sopenharmony_ci * in such a way as to distribute the load evenly across the set. 17688c2ecf20Sopenharmony_ci * 17698c2ecf20Sopenharmony_ci * The set of engines must be compatible (e.g. the same HW class) as they 17708c2ecf20Sopenharmony_ci * will share the same logical GPU context and ring. 17718c2ecf20Sopenharmony_ci * 17728c2ecf20Sopenharmony_ci * To intermix rendering with the virtual engine and direct rendering onto 17738c2ecf20Sopenharmony_ci * the backing engines (bypassing the load balancing proxy), the context must 17748c2ecf20Sopenharmony_ci * be defined to use a single timeline for all engines. 17758c2ecf20Sopenharmony_ci */ 17768c2ecf20Sopenharmony_cistruct i915_context_engines_load_balance { 17778c2ecf20Sopenharmony_ci struct i915_user_extension base; 17788c2ecf20Sopenharmony_ci 17798c2ecf20Sopenharmony_ci __u16 engine_index; 17808c2ecf20Sopenharmony_ci __u16 num_siblings; 17818c2ecf20Sopenharmony_ci __u32 flags; /* all undefined flags must be zero */ 17828c2ecf20Sopenharmony_ci 17838c2ecf20Sopenharmony_ci __u64 mbz64; /* reserved for future use; must be zero */ 17848c2ecf20Sopenharmony_ci 17858c2ecf20Sopenharmony_ci struct i915_engine_class_instance engines[0]; 17868c2ecf20Sopenharmony_ci} __attribute__((packed)); 17878c2ecf20Sopenharmony_ci 17888c2ecf20Sopenharmony_ci#define I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(name__, N__) struct { \ 17898c2ecf20Sopenharmony_ci struct i915_user_extension base; \ 17908c2ecf20Sopenharmony_ci __u16 engine_index; \ 17918c2ecf20Sopenharmony_ci __u16 num_siblings; \ 17928c2ecf20Sopenharmony_ci __u32 flags; \ 17938c2ecf20Sopenharmony_ci __u64 mbz64; \ 17948c2ecf20Sopenharmony_ci struct i915_engine_class_instance engines[N__]; \ 17958c2ecf20Sopenharmony_ci} __attribute__((packed)) name__ 17968c2ecf20Sopenharmony_ci 17978c2ecf20Sopenharmony_ci/* 17988c2ecf20Sopenharmony_ci * i915_context_engines_bond: 17998c2ecf20Sopenharmony_ci * 18008c2ecf20Sopenharmony_ci * Constructed bonded pairs for execution within a virtual engine. 18018c2ecf20Sopenharmony_ci * 18028c2ecf20Sopenharmony_ci * All engines are equal, but some are more equal than others. Given 18038c2ecf20Sopenharmony_ci * the distribution of resources in the HW, it may be preferable to run 18048c2ecf20Sopenharmony_ci * a request on a given subset of engines in parallel to a request on a 18058c2ecf20Sopenharmony_ci * specific engine. We enable this selection of engines within a virtual 18068c2ecf20Sopenharmony_ci * engine by specifying bonding pairs, for any given master engine we will 18078c2ecf20Sopenharmony_ci * only execute on one of the corresponding siblings within the virtual engine. 18088c2ecf20Sopenharmony_ci * 18098c2ecf20Sopenharmony_ci * To execute a request in parallel on the master engine and a sibling requires 18108c2ecf20Sopenharmony_ci * coordination with a I915_EXEC_FENCE_SUBMIT. 18118c2ecf20Sopenharmony_ci */ 18128c2ecf20Sopenharmony_cistruct i915_context_engines_bond { 18138c2ecf20Sopenharmony_ci struct i915_user_extension base; 18148c2ecf20Sopenharmony_ci 18158c2ecf20Sopenharmony_ci struct i915_engine_class_instance master; 18168c2ecf20Sopenharmony_ci 18178c2ecf20Sopenharmony_ci __u16 virtual_index; /* index of virtual engine in ctx->engines[] */ 18188c2ecf20Sopenharmony_ci __u16 num_bonds; 18198c2ecf20Sopenharmony_ci 18208c2ecf20Sopenharmony_ci __u64 flags; /* all undefined flags must be zero */ 18218c2ecf20Sopenharmony_ci __u64 mbz64[4]; /* reserved for future use; must be zero */ 18228c2ecf20Sopenharmony_ci 18238c2ecf20Sopenharmony_ci struct i915_engine_class_instance engines[0]; 18248c2ecf20Sopenharmony_ci} __attribute__((packed)); 18258c2ecf20Sopenharmony_ci 18268c2ecf20Sopenharmony_ci#define I915_DEFINE_CONTEXT_ENGINES_BOND(name__, N__) struct { \ 18278c2ecf20Sopenharmony_ci struct i915_user_extension base; \ 18288c2ecf20Sopenharmony_ci struct i915_engine_class_instance master; \ 18298c2ecf20Sopenharmony_ci __u16 virtual_index; \ 18308c2ecf20Sopenharmony_ci __u16 num_bonds; \ 18318c2ecf20Sopenharmony_ci __u64 flags; \ 18328c2ecf20Sopenharmony_ci __u64 mbz64[4]; \ 18338c2ecf20Sopenharmony_ci struct i915_engine_class_instance engines[N__]; \ 18348c2ecf20Sopenharmony_ci} __attribute__((packed)) name__ 18358c2ecf20Sopenharmony_ci 18368c2ecf20Sopenharmony_cistruct i915_context_param_engines { 18378c2ecf20Sopenharmony_ci __u64 extensions; /* linked chain of extension blocks, 0 terminates */ 18388c2ecf20Sopenharmony_ci#define I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE 0 /* see i915_context_engines_load_balance */ 18398c2ecf20Sopenharmony_ci#define I915_CONTEXT_ENGINES_EXT_BOND 1 /* see i915_context_engines_bond */ 18408c2ecf20Sopenharmony_ci struct i915_engine_class_instance engines[0]; 18418c2ecf20Sopenharmony_ci} __attribute__((packed)); 18428c2ecf20Sopenharmony_ci 18438c2ecf20Sopenharmony_ci#define I915_DEFINE_CONTEXT_PARAM_ENGINES(name__, N__) struct { \ 18448c2ecf20Sopenharmony_ci __u64 extensions; \ 18458c2ecf20Sopenharmony_ci struct i915_engine_class_instance engines[N__]; \ 18468c2ecf20Sopenharmony_ci} __attribute__((packed)) name__ 18478c2ecf20Sopenharmony_ci 18488c2ecf20Sopenharmony_cistruct drm_i915_gem_context_create_ext_setparam { 18498c2ecf20Sopenharmony_ci#define I915_CONTEXT_CREATE_EXT_SETPARAM 0 18508c2ecf20Sopenharmony_ci struct i915_user_extension base; 18518c2ecf20Sopenharmony_ci struct drm_i915_gem_context_param param; 18528c2ecf20Sopenharmony_ci}; 18538c2ecf20Sopenharmony_ci 18548c2ecf20Sopenharmony_cistruct drm_i915_gem_context_create_ext_clone { 18558c2ecf20Sopenharmony_ci#define I915_CONTEXT_CREATE_EXT_CLONE 1 18568c2ecf20Sopenharmony_ci struct i915_user_extension base; 18578c2ecf20Sopenharmony_ci __u32 clone_id; 18588c2ecf20Sopenharmony_ci __u32 flags; 18598c2ecf20Sopenharmony_ci#define I915_CONTEXT_CLONE_ENGINES (1u << 0) 18608c2ecf20Sopenharmony_ci#define I915_CONTEXT_CLONE_FLAGS (1u << 1) 18618c2ecf20Sopenharmony_ci#define I915_CONTEXT_CLONE_SCHEDATTR (1u << 2) 18628c2ecf20Sopenharmony_ci#define I915_CONTEXT_CLONE_SSEU (1u << 3) 18638c2ecf20Sopenharmony_ci#define I915_CONTEXT_CLONE_TIMELINE (1u << 4) 18648c2ecf20Sopenharmony_ci#define I915_CONTEXT_CLONE_VM (1u << 5) 18658c2ecf20Sopenharmony_ci#define I915_CONTEXT_CLONE_UNKNOWN -(I915_CONTEXT_CLONE_VM << 1) 18668c2ecf20Sopenharmony_ci __u64 rsvd; 18678c2ecf20Sopenharmony_ci}; 18688c2ecf20Sopenharmony_ci 18698c2ecf20Sopenharmony_cistruct drm_i915_gem_context_destroy { 18708c2ecf20Sopenharmony_ci __u32 ctx_id; 18718c2ecf20Sopenharmony_ci __u32 pad; 18728c2ecf20Sopenharmony_ci}; 18738c2ecf20Sopenharmony_ci 18748c2ecf20Sopenharmony_ci/* 18758c2ecf20Sopenharmony_ci * DRM_I915_GEM_VM_CREATE - 18768c2ecf20Sopenharmony_ci * 18778c2ecf20Sopenharmony_ci * Create a new virtual memory address space (ppGTT) for use within a context 18788c2ecf20Sopenharmony_ci * on the same file. Extensions can be provided to configure exactly how the 18798c2ecf20Sopenharmony_ci * address space is setup upon creation. 18808c2ecf20Sopenharmony_ci * 18818c2ecf20Sopenharmony_ci * The id of new VM (bound to the fd) for use with I915_CONTEXT_PARAM_VM is 18828c2ecf20Sopenharmony_ci * returned in the outparam @id. 18838c2ecf20Sopenharmony_ci * 18848c2ecf20Sopenharmony_ci * No flags are defined, with all bits reserved and must be zero. 18858c2ecf20Sopenharmony_ci * 18868c2ecf20Sopenharmony_ci * An extension chain maybe provided, starting with @extensions, and terminated 18878c2ecf20Sopenharmony_ci * by the @next_extension being 0. Currently, no extensions are defined. 18888c2ecf20Sopenharmony_ci * 18898c2ecf20Sopenharmony_ci * DRM_I915_GEM_VM_DESTROY - 18908c2ecf20Sopenharmony_ci * 18918c2ecf20Sopenharmony_ci * Destroys a previously created VM id, specified in @id. 18928c2ecf20Sopenharmony_ci * 18938c2ecf20Sopenharmony_ci * No extensions or flags are allowed currently, and so must be zero. 18948c2ecf20Sopenharmony_ci */ 18958c2ecf20Sopenharmony_cistruct drm_i915_gem_vm_control { 18968c2ecf20Sopenharmony_ci __u64 extensions; 18978c2ecf20Sopenharmony_ci __u32 flags; 18988c2ecf20Sopenharmony_ci __u32 vm_id; 18998c2ecf20Sopenharmony_ci}; 19008c2ecf20Sopenharmony_ci 19018c2ecf20Sopenharmony_cistruct drm_i915_reg_read { 19028c2ecf20Sopenharmony_ci /* 19038c2ecf20Sopenharmony_ci * Register offset. 19048c2ecf20Sopenharmony_ci * For 64bit wide registers where the upper 32bits don't immediately 19058c2ecf20Sopenharmony_ci * follow the lower 32bits, the offset of the lower 32bits must 19068c2ecf20Sopenharmony_ci * be specified 19078c2ecf20Sopenharmony_ci */ 19088c2ecf20Sopenharmony_ci __u64 offset; 19098c2ecf20Sopenharmony_ci#define I915_REG_READ_8B_WA (1ul << 0) 19108c2ecf20Sopenharmony_ci 19118c2ecf20Sopenharmony_ci __u64 val; /* Return value */ 19128c2ecf20Sopenharmony_ci}; 19138c2ecf20Sopenharmony_ci 19148c2ecf20Sopenharmony_ci/* Known registers: 19158c2ecf20Sopenharmony_ci * 19168c2ecf20Sopenharmony_ci * Render engine timestamp - 0x2358 + 64bit - gen7+ 19178c2ecf20Sopenharmony_ci * - Note this register returns an invalid value if using the default 19188c2ecf20Sopenharmony_ci * single instruction 8byte read, in order to workaround that pass 19198c2ecf20Sopenharmony_ci * flag I915_REG_READ_8B_WA in offset field. 19208c2ecf20Sopenharmony_ci * 19218c2ecf20Sopenharmony_ci */ 19228c2ecf20Sopenharmony_ci 19238c2ecf20Sopenharmony_cistruct drm_i915_reset_stats { 19248c2ecf20Sopenharmony_ci __u32 ctx_id; 19258c2ecf20Sopenharmony_ci __u32 flags; 19268c2ecf20Sopenharmony_ci 19278c2ecf20Sopenharmony_ci /* All resets since boot/module reload, for all contexts */ 19288c2ecf20Sopenharmony_ci __u32 reset_count; 19298c2ecf20Sopenharmony_ci 19308c2ecf20Sopenharmony_ci /* Number of batches lost when active in GPU, for this context */ 19318c2ecf20Sopenharmony_ci __u32 batch_active; 19328c2ecf20Sopenharmony_ci 19338c2ecf20Sopenharmony_ci /* Number of batches lost pending for execution, for this context */ 19348c2ecf20Sopenharmony_ci __u32 batch_pending; 19358c2ecf20Sopenharmony_ci 19368c2ecf20Sopenharmony_ci __u32 pad; 19378c2ecf20Sopenharmony_ci}; 19388c2ecf20Sopenharmony_ci 19398c2ecf20Sopenharmony_cistruct drm_i915_gem_userptr { 19408c2ecf20Sopenharmony_ci __u64 user_ptr; 19418c2ecf20Sopenharmony_ci __u64 user_size; 19428c2ecf20Sopenharmony_ci __u32 flags; 19438c2ecf20Sopenharmony_ci#define I915_USERPTR_READ_ONLY 0x1 19448c2ecf20Sopenharmony_ci#define I915_USERPTR_UNSYNCHRONIZED 0x80000000 19458c2ecf20Sopenharmony_ci /** 19468c2ecf20Sopenharmony_ci * Returned handle for the object. 19478c2ecf20Sopenharmony_ci * 19488c2ecf20Sopenharmony_ci * Object handles are nonzero. 19498c2ecf20Sopenharmony_ci */ 19508c2ecf20Sopenharmony_ci __u32 handle; 19518c2ecf20Sopenharmony_ci}; 19528c2ecf20Sopenharmony_ci 19538c2ecf20Sopenharmony_cienum drm_i915_oa_format { 19548c2ecf20Sopenharmony_ci I915_OA_FORMAT_A13 = 1, /* HSW only */ 19558c2ecf20Sopenharmony_ci I915_OA_FORMAT_A29, /* HSW only */ 19568c2ecf20Sopenharmony_ci I915_OA_FORMAT_A13_B8_C8, /* HSW only */ 19578c2ecf20Sopenharmony_ci I915_OA_FORMAT_B4_C8, /* HSW only */ 19588c2ecf20Sopenharmony_ci I915_OA_FORMAT_A45_B8_C8, /* HSW only */ 19598c2ecf20Sopenharmony_ci I915_OA_FORMAT_B4_C8_A16, /* HSW only */ 19608c2ecf20Sopenharmony_ci I915_OA_FORMAT_C4_B8, /* HSW+ */ 19618c2ecf20Sopenharmony_ci 19628c2ecf20Sopenharmony_ci /* Gen8+ */ 19638c2ecf20Sopenharmony_ci I915_OA_FORMAT_A12, 19648c2ecf20Sopenharmony_ci I915_OA_FORMAT_A12_B8_C8, 19658c2ecf20Sopenharmony_ci I915_OA_FORMAT_A32u40_A4u32_B8_C8, 19668c2ecf20Sopenharmony_ci 19678c2ecf20Sopenharmony_ci I915_OA_FORMAT_MAX /* non-ABI */ 19688c2ecf20Sopenharmony_ci}; 19698c2ecf20Sopenharmony_ci 19708c2ecf20Sopenharmony_cienum drm_i915_perf_property_id { 19718c2ecf20Sopenharmony_ci /** 19728c2ecf20Sopenharmony_ci * Open the stream for a specific context handle (as used with 19738c2ecf20Sopenharmony_ci * execbuffer2). A stream opened for a specific context this way 19748c2ecf20Sopenharmony_ci * won't typically require root privileges. 19758c2ecf20Sopenharmony_ci * 19768c2ecf20Sopenharmony_ci * This property is available in perf revision 1. 19778c2ecf20Sopenharmony_ci */ 19788c2ecf20Sopenharmony_ci DRM_I915_PERF_PROP_CTX_HANDLE = 1, 19798c2ecf20Sopenharmony_ci 19808c2ecf20Sopenharmony_ci /** 19818c2ecf20Sopenharmony_ci * A value of 1 requests the inclusion of raw OA unit reports as 19828c2ecf20Sopenharmony_ci * part of stream samples. 19838c2ecf20Sopenharmony_ci * 19848c2ecf20Sopenharmony_ci * This property is available in perf revision 1. 19858c2ecf20Sopenharmony_ci */ 19868c2ecf20Sopenharmony_ci DRM_I915_PERF_PROP_SAMPLE_OA, 19878c2ecf20Sopenharmony_ci 19888c2ecf20Sopenharmony_ci /** 19898c2ecf20Sopenharmony_ci * The value specifies which set of OA unit metrics should be 19908c2ecf20Sopenharmony_ci * configured, defining the contents of any OA unit reports. 19918c2ecf20Sopenharmony_ci * 19928c2ecf20Sopenharmony_ci * This property is available in perf revision 1. 19938c2ecf20Sopenharmony_ci */ 19948c2ecf20Sopenharmony_ci DRM_I915_PERF_PROP_OA_METRICS_SET, 19958c2ecf20Sopenharmony_ci 19968c2ecf20Sopenharmony_ci /** 19978c2ecf20Sopenharmony_ci * The value specifies the size and layout of OA unit reports. 19988c2ecf20Sopenharmony_ci * 19998c2ecf20Sopenharmony_ci * This property is available in perf revision 1. 20008c2ecf20Sopenharmony_ci */ 20018c2ecf20Sopenharmony_ci DRM_I915_PERF_PROP_OA_FORMAT, 20028c2ecf20Sopenharmony_ci 20038c2ecf20Sopenharmony_ci /** 20048c2ecf20Sopenharmony_ci * Specifying this property implicitly requests periodic OA unit 20058c2ecf20Sopenharmony_ci * sampling and (at least on Haswell) the sampling frequency is derived 20068c2ecf20Sopenharmony_ci * from this exponent as follows: 20078c2ecf20Sopenharmony_ci * 20088c2ecf20Sopenharmony_ci * 80ns * 2^(period_exponent + 1) 20098c2ecf20Sopenharmony_ci * 20108c2ecf20Sopenharmony_ci * This property is available in perf revision 1. 20118c2ecf20Sopenharmony_ci */ 20128c2ecf20Sopenharmony_ci DRM_I915_PERF_PROP_OA_EXPONENT, 20138c2ecf20Sopenharmony_ci 20148c2ecf20Sopenharmony_ci /** 20158c2ecf20Sopenharmony_ci * Specifying this property is only valid when specify a context to 20168c2ecf20Sopenharmony_ci * filter with DRM_I915_PERF_PROP_CTX_HANDLE. Specifying this property 20178c2ecf20Sopenharmony_ci * will hold preemption of the particular context we want to gather 20188c2ecf20Sopenharmony_ci * performance data about. The execbuf2 submissions must include a 20198c2ecf20Sopenharmony_ci * drm_i915_gem_execbuffer_ext_perf parameter for this to apply. 20208c2ecf20Sopenharmony_ci * 20218c2ecf20Sopenharmony_ci * This property is available in perf revision 3. 20228c2ecf20Sopenharmony_ci */ 20238c2ecf20Sopenharmony_ci DRM_I915_PERF_PROP_HOLD_PREEMPTION, 20248c2ecf20Sopenharmony_ci 20258c2ecf20Sopenharmony_ci /** 20268c2ecf20Sopenharmony_ci * Specifying this pins all contexts to the specified SSEU power 20278c2ecf20Sopenharmony_ci * configuration for the duration of the recording. 20288c2ecf20Sopenharmony_ci * 20298c2ecf20Sopenharmony_ci * This parameter's value is a pointer to a struct 20308c2ecf20Sopenharmony_ci * drm_i915_gem_context_param_sseu. 20318c2ecf20Sopenharmony_ci * 20328c2ecf20Sopenharmony_ci * This property is available in perf revision 4. 20338c2ecf20Sopenharmony_ci */ 20348c2ecf20Sopenharmony_ci DRM_I915_PERF_PROP_GLOBAL_SSEU, 20358c2ecf20Sopenharmony_ci 20368c2ecf20Sopenharmony_ci /** 20378c2ecf20Sopenharmony_ci * This optional parameter specifies the timer interval in nanoseconds 20388c2ecf20Sopenharmony_ci * at which the i915 driver will check the OA buffer for available data. 20398c2ecf20Sopenharmony_ci * Minimum allowed value is 100 microseconds. A default value is used by 20408c2ecf20Sopenharmony_ci * the driver if this parameter is not specified. Note that larger timer 20418c2ecf20Sopenharmony_ci * values will reduce cpu consumption during OA perf captures. However, 20428c2ecf20Sopenharmony_ci * excessively large values would potentially result in OA buffer 20438c2ecf20Sopenharmony_ci * overwrites as captures reach end of the OA buffer. 20448c2ecf20Sopenharmony_ci * 20458c2ecf20Sopenharmony_ci * This property is available in perf revision 5. 20468c2ecf20Sopenharmony_ci */ 20478c2ecf20Sopenharmony_ci DRM_I915_PERF_PROP_POLL_OA_PERIOD, 20488c2ecf20Sopenharmony_ci 20498c2ecf20Sopenharmony_ci DRM_I915_PERF_PROP_MAX /* non-ABI */ 20508c2ecf20Sopenharmony_ci}; 20518c2ecf20Sopenharmony_ci 20528c2ecf20Sopenharmony_cistruct drm_i915_perf_open_param { 20538c2ecf20Sopenharmony_ci __u32 flags; 20548c2ecf20Sopenharmony_ci#define I915_PERF_FLAG_FD_CLOEXEC (1<<0) 20558c2ecf20Sopenharmony_ci#define I915_PERF_FLAG_FD_NONBLOCK (1<<1) 20568c2ecf20Sopenharmony_ci#define I915_PERF_FLAG_DISABLED (1<<2) 20578c2ecf20Sopenharmony_ci 20588c2ecf20Sopenharmony_ci /** The number of u64 (id, value) pairs */ 20598c2ecf20Sopenharmony_ci __u32 num_properties; 20608c2ecf20Sopenharmony_ci 20618c2ecf20Sopenharmony_ci /** 20628c2ecf20Sopenharmony_ci * Pointer to array of u64 (id, value) pairs configuring the stream 20638c2ecf20Sopenharmony_ci * to open. 20648c2ecf20Sopenharmony_ci */ 20658c2ecf20Sopenharmony_ci __u64 properties_ptr; 20668c2ecf20Sopenharmony_ci}; 20678c2ecf20Sopenharmony_ci 20688c2ecf20Sopenharmony_ci/** 20698c2ecf20Sopenharmony_ci * Enable data capture for a stream that was either opened in a disabled state 20708c2ecf20Sopenharmony_ci * via I915_PERF_FLAG_DISABLED or was later disabled via 20718c2ecf20Sopenharmony_ci * I915_PERF_IOCTL_DISABLE. 20728c2ecf20Sopenharmony_ci * 20738c2ecf20Sopenharmony_ci * It is intended to be cheaper to disable and enable a stream than it may be 20748c2ecf20Sopenharmony_ci * to close and re-open a stream with the same configuration. 20758c2ecf20Sopenharmony_ci * 20768c2ecf20Sopenharmony_ci * It's undefined whether any pending data for the stream will be lost. 20778c2ecf20Sopenharmony_ci * 20788c2ecf20Sopenharmony_ci * This ioctl is available in perf revision 1. 20798c2ecf20Sopenharmony_ci */ 20808c2ecf20Sopenharmony_ci#define I915_PERF_IOCTL_ENABLE _IO('i', 0x0) 20818c2ecf20Sopenharmony_ci 20828c2ecf20Sopenharmony_ci/** 20838c2ecf20Sopenharmony_ci * Disable data capture for a stream. 20848c2ecf20Sopenharmony_ci * 20858c2ecf20Sopenharmony_ci * It is an error to try and read a stream that is disabled. 20868c2ecf20Sopenharmony_ci * 20878c2ecf20Sopenharmony_ci * This ioctl is available in perf revision 1. 20888c2ecf20Sopenharmony_ci */ 20898c2ecf20Sopenharmony_ci#define I915_PERF_IOCTL_DISABLE _IO('i', 0x1) 20908c2ecf20Sopenharmony_ci 20918c2ecf20Sopenharmony_ci/** 20928c2ecf20Sopenharmony_ci * Change metrics_set captured by a stream. 20938c2ecf20Sopenharmony_ci * 20948c2ecf20Sopenharmony_ci * If the stream is bound to a specific context, the configuration change 20958c2ecf20Sopenharmony_ci * will performed inline with that context such that it takes effect before 20968c2ecf20Sopenharmony_ci * the next execbuf submission. 20978c2ecf20Sopenharmony_ci * 20988c2ecf20Sopenharmony_ci * Returns the previously bound metrics set id, or a negative error code. 20998c2ecf20Sopenharmony_ci * 21008c2ecf20Sopenharmony_ci * This ioctl is available in perf revision 2. 21018c2ecf20Sopenharmony_ci */ 21028c2ecf20Sopenharmony_ci#define I915_PERF_IOCTL_CONFIG _IO('i', 0x2) 21038c2ecf20Sopenharmony_ci 21048c2ecf20Sopenharmony_ci/** 21058c2ecf20Sopenharmony_ci * Common to all i915 perf records 21068c2ecf20Sopenharmony_ci */ 21078c2ecf20Sopenharmony_cistruct drm_i915_perf_record_header { 21088c2ecf20Sopenharmony_ci __u32 type; 21098c2ecf20Sopenharmony_ci __u16 pad; 21108c2ecf20Sopenharmony_ci __u16 size; 21118c2ecf20Sopenharmony_ci}; 21128c2ecf20Sopenharmony_ci 21138c2ecf20Sopenharmony_cienum drm_i915_perf_record_type { 21148c2ecf20Sopenharmony_ci 21158c2ecf20Sopenharmony_ci /** 21168c2ecf20Sopenharmony_ci * Samples are the work horse record type whose contents are extensible 21178c2ecf20Sopenharmony_ci * and defined when opening an i915 perf stream based on the given 21188c2ecf20Sopenharmony_ci * properties. 21198c2ecf20Sopenharmony_ci * 21208c2ecf20Sopenharmony_ci * Boolean properties following the naming convention 21218c2ecf20Sopenharmony_ci * DRM_I915_PERF_SAMPLE_xyz_PROP request the inclusion of 'xyz' data in 21228c2ecf20Sopenharmony_ci * every sample. 21238c2ecf20Sopenharmony_ci * 21248c2ecf20Sopenharmony_ci * The order of these sample properties given by userspace has no 21258c2ecf20Sopenharmony_ci * affect on the ordering of data within a sample. The order is 21268c2ecf20Sopenharmony_ci * documented here. 21278c2ecf20Sopenharmony_ci * 21288c2ecf20Sopenharmony_ci * struct { 21298c2ecf20Sopenharmony_ci * struct drm_i915_perf_record_header header; 21308c2ecf20Sopenharmony_ci * 21318c2ecf20Sopenharmony_ci * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA 21328c2ecf20Sopenharmony_ci * }; 21338c2ecf20Sopenharmony_ci */ 21348c2ecf20Sopenharmony_ci DRM_I915_PERF_RECORD_SAMPLE = 1, 21358c2ecf20Sopenharmony_ci 21368c2ecf20Sopenharmony_ci /* 21378c2ecf20Sopenharmony_ci * Indicates that one or more OA reports were not written by the 21388c2ecf20Sopenharmony_ci * hardware. This can happen for example if an MI_REPORT_PERF_COUNT 21398c2ecf20Sopenharmony_ci * command collides with periodic sampling - which would be more likely 21408c2ecf20Sopenharmony_ci * at higher sampling frequencies. 21418c2ecf20Sopenharmony_ci */ 21428c2ecf20Sopenharmony_ci DRM_I915_PERF_RECORD_OA_REPORT_LOST = 2, 21438c2ecf20Sopenharmony_ci 21448c2ecf20Sopenharmony_ci /** 21458c2ecf20Sopenharmony_ci * An error occurred that resulted in all pending OA reports being lost. 21468c2ecf20Sopenharmony_ci */ 21478c2ecf20Sopenharmony_ci DRM_I915_PERF_RECORD_OA_BUFFER_LOST = 3, 21488c2ecf20Sopenharmony_ci 21498c2ecf20Sopenharmony_ci DRM_I915_PERF_RECORD_MAX /* non-ABI */ 21508c2ecf20Sopenharmony_ci}; 21518c2ecf20Sopenharmony_ci 21528c2ecf20Sopenharmony_ci/** 21538c2ecf20Sopenharmony_ci * Structure to upload perf dynamic configuration into the kernel. 21548c2ecf20Sopenharmony_ci */ 21558c2ecf20Sopenharmony_cistruct drm_i915_perf_oa_config { 21568c2ecf20Sopenharmony_ci /** String formatted like "%08x-%04x-%04x-%04x-%012x" */ 21578c2ecf20Sopenharmony_ci char uuid[36]; 21588c2ecf20Sopenharmony_ci 21598c2ecf20Sopenharmony_ci __u32 n_mux_regs; 21608c2ecf20Sopenharmony_ci __u32 n_boolean_regs; 21618c2ecf20Sopenharmony_ci __u32 n_flex_regs; 21628c2ecf20Sopenharmony_ci 21638c2ecf20Sopenharmony_ci /* 21648c2ecf20Sopenharmony_ci * These fields are pointers to tuples of u32 values (register address, 21658c2ecf20Sopenharmony_ci * value). For example the expected length of the buffer pointed by 21668c2ecf20Sopenharmony_ci * mux_regs_ptr is (2 * sizeof(u32) * n_mux_regs). 21678c2ecf20Sopenharmony_ci */ 21688c2ecf20Sopenharmony_ci __u64 mux_regs_ptr; 21698c2ecf20Sopenharmony_ci __u64 boolean_regs_ptr; 21708c2ecf20Sopenharmony_ci __u64 flex_regs_ptr; 21718c2ecf20Sopenharmony_ci}; 21728c2ecf20Sopenharmony_ci 21738c2ecf20Sopenharmony_cistruct drm_i915_query_item { 21748c2ecf20Sopenharmony_ci __u64 query_id; 21758c2ecf20Sopenharmony_ci#define DRM_I915_QUERY_TOPOLOGY_INFO 1 21768c2ecf20Sopenharmony_ci#define DRM_I915_QUERY_ENGINE_INFO 2 21778c2ecf20Sopenharmony_ci#define DRM_I915_QUERY_PERF_CONFIG 3 21788c2ecf20Sopenharmony_ci/* Must be kept compact -- no holes and well documented */ 21798c2ecf20Sopenharmony_ci 21808c2ecf20Sopenharmony_ci /* 21818c2ecf20Sopenharmony_ci * When set to zero by userspace, this is filled with the size of the 21828c2ecf20Sopenharmony_ci * data to be written at the data_ptr pointer. The kernel sets this 21838c2ecf20Sopenharmony_ci * value to a negative value to signal an error on a particular query 21848c2ecf20Sopenharmony_ci * item. 21858c2ecf20Sopenharmony_ci */ 21868c2ecf20Sopenharmony_ci __s32 length; 21878c2ecf20Sopenharmony_ci 21888c2ecf20Sopenharmony_ci /* 21898c2ecf20Sopenharmony_ci * When query_id == DRM_I915_QUERY_TOPOLOGY_INFO, must be 0. 21908c2ecf20Sopenharmony_ci * 21918c2ecf20Sopenharmony_ci * When query_id == DRM_I915_QUERY_PERF_CONFIG, must be one of the 21928c2ecf20Sopenharmony_ci * following : 21938c2ecf20Sopenharmony_ci * - DRM_I915_QUERY_PERF_CONFIG_LIST 21948c2ecf20Sopenharmony_ci * - DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_UUID 21958c2ecf20Sopenharmony_ci * - DRM_I915_QUERY_PERF_CONFIG_FOR_UUID 21968c2ecf20Sopenharmony_ci */ 21978c2ecf20Sopenharmony_ci __u32 flags; 21988c2ecf20Sopenharmony_ci#define DRM_I915_QUERY_PERF_CONFIG_LIST 1 21998c2ecf20Sopenharmony_ci#define DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_UUID 2 22008c2ecf20Sopenharmony_ci#define DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_ID 3 22018c2ecf20Sopenharmony_ci 22028c2ecf20Sopenharmony_ci /* 22038c2ecf20Sopenharmony_ci * Data will be written at the location pointed by data_ptr when the 22048c2ecf20Sopenharmony_ci * value of length matches the length of the data to be written by the 22058c2ecf20Sopenharmony_ci * kernel. 22068c2ecf20Sopenharmony_ci */ 22078c2ecf20Sopenharmony_ci __u64 data_ptr; 22088c2ecf20Sopenharmony_ci}; 22098c2ecf20Sopenharmony_ci 22108c2ecf20Sopenharmony_cistruct drm_i915_query { 22118c2ecf20Sopenharmony_ci __u32 num_items; 22128c2ecf20Sopenharmony_ci 22138c2ecf20Sopenharmony_ci /* 22148c2ecf20Sopenharmony_ci * Unused for now. Must be cleared to zero. 22158c2ecf20Sopenharmony_ci */ 22168c2ecf20Sopenharmony_ci __u32 flags; 22178c2ecf20Sopenharmony_ci 22188c2ecf20Sopenharmony_ci /* 22198c2ecf20Sopenharmony_ci * This points to an array of num_items drm_i915_query_item structures. 22208c2ecf20Sopenharmony_ci */ 22218c2ecf20Sopenharmony_ci __u64 items_ptr; 22228c2ecf20Sopenharmony_ci}; 22238c2ecf20Sopenharmony_ci 22248c2ecf20Sopenharmony_ci/* 22258c2ecf20Sopenharmony_ci * Data written by the kernel with query DRM_I915_QUERY_TOPOLOGY_INFO : 22268c2ecf20Sopenharmony_ci * 22278c2ecf20Sopenharmony_ci * data: contains the 3 pieces of information : 22288c2ecf20Sopenharmony_ci * 22298c2ecf20Sopenharmony_ci * - the slice mask with one bit per slice telling whether a slice is 22308c2ecf20Sopenharmony_ci * available. The availability of slice X can be queried with the following 22318c2ecf20Sopenharmony_ci * formula : 22328c2ecf20Sopenharmony_ci * 22338c2ecf20Sopenharmony_ci * (data[X / 8] >> (X % 8)) & 1 22348c2ecf20Sopenharmony_ci * 22358c2ecf20Sopenharmony_ci * - the subslice mask for each slice with one bit per subslice telling 22368c2ecf20Sopenharmony_ci * whether a subslice is available. Gen12 has dual-subslices, which are 22378c2ecf20Sopenharmony_ci * similar to two gen11 subslices. For gen12, this array represents dual- 22388c2ecf20Sopenharmony_ci * subslices. The availability of subslice Y in slice X can be queried 22398c2ecf20Sopenharmony_ci * with the following formula : 22408c2ecf20Sopenharmony_ci * 22418c2ecf20Sopenharmony_ci * (data[subslice_offset + 22428c2ecf20Sopenharmony_ci * X * subslice_stride + 22438c2ecf20Sopenharmony_ci * Y / 8] >> (Y % 8)) & 1 22448c2ecf20Sopenharmony_ci * 22458c2ecf20Sopenharmony_ci * - the EU mask for each subslice in each slice with one bit per EU telling 22468c2ecf20Sopenharmony_ci * whether an EU is available. The availability of EU Z in subslice Y in 22478c2ecf20Sopenharmony_ci * slice X can be queried with the following formula : 22488c2ecf20Sopenharmony_ci * 22498c2ecf20Sopenharmony_ci * (data[eu_offset + 22508c2ecf20Sopenharmony_ci * (X * max_subslices + Y) * eu_stride + 22518c2ecf20Sopenharmony_ci * Z / 8] >> (Z % 8)) & 1 22528c2ecf20Sopenharmony_ci */ 22538c2ecf20Sopenharmony_cistruct drm_i915_query_topology_info { 22548c2ecf20Sopenharmony_ci /* 22558c2ecf20Sopenharmony_ci * Unused for now. Must be cleared to zero. 22568c2ecf20Sopenharmony_ci */ 22578c2ecf20Sopenharmony_ci __u16 flags; 22588c2ecf20Sopenharmony_ci 22598c2ecf20Sopenharmony_ci __u16 max_slices; 22608c2ecf20Sopenharmony_ci __u16 max_subslices; 22618c2ecf20Sopenharmony_ci __u16 max_eus_per_subslice; 22628c2ecf20Sopenharmony_ci 22638c2ecf20Sopenharmony_ci /* 22648c2ecf20Sopenharmony_ci * Offset in data[] at which the subslice masks are stored. 22658c2ecf20Sopenharmony_ci */ 22668c2ecf20Sopenharmony_ci __u16 subslice_offset; 22678c2ecf20Sopenharmony_ci 22688c2ecf20Sopenharmony_ci /* 22698c2ecf20Sopenharmony_ci * Stride at which each of the subslice masks for each slice are 22708c2ecf20Sopenharmony_ci * stored. 22718c2ecf20Sopenharmony_ci */ 22728c2ecf20Sopenharmony_ci __u16 subslice_stride; 22738c2ecf20Sopenharmony_ci 22748c2ecf20Sopenharmony_ci /* 22758c2ecf20Sopenharmony_ci * Offset in data[] at which the EU masks are stored. 22768c2ecf20Sopenharmony_ci */ 22778c2ecf20Sopenharmony_ci __u16 eu_offset; 22788c2ecf20Sopenharmony_ci 22798c2ecf20Sopenharmony_ci /* 22808c2ecf20Sopenharmony_ci * Stride at which each of the EU masks for each subslice are stored. 22818c2ecf20Sopenharmony_ci */ 22828c2ecf20Sopenharmony_ci __u16 eu_stride; 22838c2ecf20Sopenharmony_ci 22848c2ecf20Sopenharmony_ci __u8 data[]; 22858c2ecf20Sopenharmony_ci}; 22868c2ecf20Sopenharmony_ci 22878c2ecf20Sopenharmony_ci/** 22888c2ecf20Sopenharmony_ci * struct drm_i915_engine_info 22898c2ecf20Sopenharmony_ci * 22908c2ecf20Sopenharmony_ci * Describes one engine and it's capabilities as known to the driver. 22918c2ecf20Sopenharmony_ci */ 22928c2ecf20Sopenharmony_cistruct drm_i915_engine_info { 22938c2ecf20Sopenharmony_ci /** Engine class and instance. */ 22948c2ecf20Sopenharmony_ci struct i915_engine_class_instance engine; 22958c2ecf20Sopenharmony_ci 22968c2ecf20Sopenharmony_ci /** Reserved field. */ 22978c2ecf20Sopenharmony_ci __u32 rsvd0; 22988c2ecf20Sopenharmony_ci 22998c2ecf20Sopenharmony_ci /** Engine flags. */ 23008c2ecf20Sopenharmony_ci __u64 flags; 23018c2ecf20Sopenharmony_ci 23028c2ecf20Sopenharmony_ci /** Capabilities of this engine. */ 23038c2ecf20Sopenharmony_ci __u64 capabilities; 23048c2ecf20Sopenharmony_ci#define I915_VIDEO_CLASS_CAPABILITY_HEVC (1 << 0) 23058c2ecf20Sopenharmony_ci#define I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC (1 << 1) 23068c2ecf20Sopenharmony_ci 23078c2ecf20Sopenharmony_ci /** Reserved fields. */ 23088c2ecf20Sopenharmony_ci __u64 rsvd1[4]; 23098c2ecf20Sopenharmony_ci}; 23108c2ecf20Sopenharmony_ci 23118c2ecf20Sopenharmony_ci/** 23128c2ecf20Sopenharmony_ci * struct drm_i915_query_engine_info 23138c2ecf20Sopenharmony_ci * 23148c2ecf20Sopenharmony_ci * Engine info query enumerates all engines known to the driver by filling in 23158c2ecf20Sopenharmony_ci * an array of struct drm_i915_engine_info structures. 23168c2ecf20Sopenharmony_ci */ 23178c2ecf20Sopenharmony_cistruct drm_i915_query_engine_info { 23188c2ecf20Sopenharmony_ci /** Number of struct drm_i915_engine_info structs following. */ 23198c2ecf20Sopenharmony_ci __u32 num_engines; 23208c2ecf20Sopenharmony_ci 23218c2ecf20Sopenharmony_ci /** MBZ */ 23228c2ecf20Sopenharmony_ci __u32 rsvd[3]; 23238c2ecf20Sopenharmony_ci 23248c2ecf20Sopenharmony_ci /** Marker for drm_i915_engine_info structures. */ 23258c2ecf20Sopenharmony_ci struct drm_i915_engine_info engines[]; 23268c2ecf20Sopenharmony_ci}; 23278c2ecf20Sopenharmony_ci 23288c2ecf20Sopenharmony_ci/* 23298c2ecf20Sopenharmony_ci * Data written by the kernel with query DRM_I915_QUERY_PERF_CONFIG. 23308c2ecf20Sopenharmony_ci */ 23318c2ecf20Sopenharmony_cistruct drm_i915_query_perf_config { 23328c2ecf20Sopenharmony_ci union { 23338c2ecf20Sopenharmony_ci /* 23348c2ecf20Sopenharmony_ci * When query_item.flags == DRM_I915_QUERY_PERF_CONFIG_LIST, i915 sets 23358c2ecf20Sopenharmony_ci * this fields to the number of configurations available. 23368c2ecf20Sopenharmony_ci */ 23378c2ecf20Sopenharmony_ci __u64 n_configs; 23388c2ecf20Sopenharmony_ci 23398c2ecf20Sopenharmony_ci /* 23408c2ecf20Sopenharmony_ci * When query_id == DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_ID, 23418c2ecf20Sopenharmony_ci * i915 will use the value in this field as configuration 23428c2ecf20Sopenharmony_ci * identifier to decide what data to write into config_ptr. 23438c2ecf20Sopenharmony_ci */ 23448c2ecf20Sopenharmony_ci __u64 config; 23458c2ecf20Sopenharmony_ci 23468c2ecf20Sopenharmony_ci /* 23478c2ecf20Sopenharmony_ci * When query_id == DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_UUID, 23488c2ecf20Sopenharmony_ci * i915 will use the value in this field as configuration 23498c2ecf20Sopenharmony_ci * identifier to decide what data to write into config_ptr. 23508c2ecf20Sopenharmony_ci * 23518c2ecf20Sopenharmony_ci * String formatted like "%08x-%04x-%04x-%04x-%012x" 23528c2ecf20Sopenharmony_ci */ 23538c2ecf20Sopenharmony_ci char uuid[36]; 23548c2ecf20Sopenharmony_ci }; 23558c2ecf20Sopenharmony_ci 23568c2ecf20Sopenharmony_ci /* 23578c2ecf20Sopenharmony_ci * Unused for now. Must be cleared to zero. 23588c2ecf20Sopenharmony_ci */ 23598c2ecf20Sopenharmony_ci __u32 flags; 23608c2ecf20Sopenharmony_ci 23618c2ecf20Sopenharmony_ci /* 23628c2ecf20Sopenharmony_ci * When query_item.flags == DRM_I915_QUERY_PERF_CONFIG_LIST, i915 will 23638c2ecf20Sopenharmony_ci * write an array of __u64 of configuration identifiers. 23648c2ecf20Sopenharmony_ci * 23658c2ecf20Sopenharmony_ci * When query_item.flags == DRM_I915_QUERY_PERF_CONFIG_DATA, i915 will 23668c2ecf20Sopenharmony_ci * write a struct drm_i915_perf_oa_config. If the following fields of 23678c2ecf20Sopenharmony_ci * drm_i915_perf_oa_config are set not set to 0, i915 will write into 23688c2ecf20Sopenharmony_ci * the associated pointers the values of submitted when the 23698c2ecf20Sopenharmony_ci * configuration was created : 23708c2ecf20Sopenharmony_ci * 23718c2ecf20Sopenharmony_ci * - n_mux_regs 23728c2ecf20Sopenharmony_ci * - n_boolean_regs 23738c2ecf20Sopenharmony_ci * - n_flex_regs 23748c2ecf20Sopenharmony_ci */ 23758c2ecf20Sopenharmony_ci __u8 data[]; 23768c2ecf20Sopenharmony_ci}; 23778c2ecf20Sopenharmony_ci 23788c2ecf20Sopenharmony_ci#if defined(__cplusplus) 23798c2ecf20Sopenharmony_ci} 23808c2ecf20Sopenharmony_ci#endif 23818c2ecf20Sopenharmony_ci 23828c2ecf20Sopenharmony_ci#endif /* _UAPI_I915_DRM_H_ */ 2383