Home | History | Annotate | Line # | Download | only in drm
      1  1.1  riastrad /*	$NetBSD: i915_drm.h,v 1.2 2021/12/18 23:45:46 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
      5  1.1  riastrad  * All Rights Reserved.
      6  1.1  riastrad  *
      7  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      8  1.1  riastrad  * copy of this software and associated documentation files (the
      9  1.1  riastrad  * "Software"), to deal in the Software without restriction, including
     10  1.1  riastrad  * without limitation the rights to use, copy, modify, merge, publish,
     11  1.1  riastrad  * distribute, sub license, and/or sell copies of the Software, and to
     12  1.1  riastrad  * permit persons to whom the Software is furnished to do so, subject to
     13  1.1  riastrad  * the following conditions:
     14  1.1  riastrad  *
     15  1.1  riastrad  * The above copyright notice and this permission notice (including the
     16  1.1  riastrad  * next paragraph) shall be included in all copies or substantial portions
     17  1.1  riastrad  * of the Software.
     18  1.1  riastrad  *
     19  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     20  1.1  riastrad  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     21  1.1  riastrad  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
     22  1.1  riastrad  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
     23  1.1  riastrad  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
     24  1.1  riastrad  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
     25  1.1  riastrad  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     26  1.1  riastrad  *
     27  1.1  riastrad  */
     28  1.1  riastrad 
     29  1.1  riastrad #ifndef _UAPI_I915_DRM_H_
     30  1.1  riastrad #define _UAPI_I915_DRM_H_
     31  1.1  riastrad 
     32  1.1  riastrad #include "drm.h"
     33  1.1  riastrad 
     34  1.1  riastrad #if defined(__cplusplus)
     35  1.1  riastrad extern "C" {
     36  1.1  riastrad #endif
     37  1.1  riastrad 
     38  1.1  riastrad /* Please note that modifications to all structs defined here are
     39  1.1  riastrad  * subject to backwards-compatibility constraints.
     40  1.1  riastrad  */
     41  1.1  riastrad 
     42  1.1  riastrad /**
     43  1.1  riastrad  * DOC: uevents generated by i915 on it's device node
     44  1.1  riastrad  *
     45  1.1  riastrad  * I915_L3_PARITY_UEVENT - Generated when the driver receives a parity mismatch
     46  1.1  riastrad  *	event from the gpu l3 cache. Additional information supplied is ROW,
     47  1.1  riastrad  *	BANK, SUBBANK, SLICE of the affected cacheline. Userspace should keep
     48  1.1  riastrad  *	track of these events and if a specific cache-line seems to have a
     49  1.1  riastrad  *	persistent error remap it with the l3 remapping tool supplied in
     50  1.1  riastrad  *	intel-gpu-tools.  The value supplied with the event is always 1.
     51  1.1  riastrad  *
     52  1.1  riastrad  * I915_ERROR_UEVENT - Generated upon error detection, currently only via
     53  1.1  riastrad  *	hangcheck. The error detection event is a good indicator of when things
     54  1.1  riastrad  *	began to go badly. The value supplied with the event is a 1 upon error
     55  1.1  riastrad  *	detection, and a 0 upon reset completion, signifying no more error
     56  1.1  riastrad  *	exists. NOTE: Disabling hangcheck or reset via module parameter will
     57  1.1  riastrad  *	cause the related events to not be seen.
     58  1.1  riastrad  *
     59  1.1  riastrad  * I915_RESET_UEVENT - Event is generated just before an attempt to reset the
     60  1.1  riastrad  *	the GPU. The value supplied with the event is always 1. NOTE: Disable
     61  1.1  riastrad  *	reset via module parameter will cause this event to not be seen.
     62  1.1  riastrad  */
     63  1.1  riastrad #define I915_L3_PARITY_UEVENT		"L3_PARITY_ERROR"
     64  1.1  riastrad #define I915_ERROR_UEVENT		"ERROR"
     65  1.1  riastrad #define I915_RESET_UEVENT		"RESET"
     66  1.1  riastrad 
     67  1.1  riastrad /*
     68  1.1  riastrad  * i915_user_extension: Base class for defining a chain of extensions
     69  1.1  riastrad  *
     70  1.1  riastrad  * Many interfaces need to grow over time. In most cases we can simply
     71  1.1  riastrad  * extend the struct and have userspace pass in more data. Another option,
     72  1.1  riastrad  * as demonstrated by Vulkan's approach to providing extensions for forward
     73  1.1  riastrad  * and backward compatibility, is to use a list of optional structs to
     74  1.1  riastrad  * provide those extra details.
     75  1.1  riastrad  *
     76  1.1  riastrad  * The key advantage to using an extension chain is that it allows us to
     77  1.1  riastrad  * redefine the interface more easily than an ever growing struct of
     78  1.1  riastrad  * increasing complexity, and for large parts of that interface to be
     79  1.1  riastrad  * entirely optional. The downside is more pointer chasing; chasing across
     80  1.1  riastrad  * the __user boundary with pointers encapsulated inside u64.
     81  1.1  riastrad  */
     82  1.1  riastrad struct i915_user_extension {
     83  1.1  riastrad 	__u64 next_extension;
     84  1.1  riastrad 	__u32 name;
     85  1.1  riastrad 	__u32 flags; /* All undefined bits must be zero. */
     86  1.1  riastrad 	__u32 rsvd[4]; /* Reserved for future use; must be zero. */
     87  1.1  riastrad };
     88  1.1  riastrad 
     89  1.1  riastrad /*
     90  1.1  riastrad  * MOCS indexes used for GPU surfaces, defining the cacheability of the
     91  1.1  riastrad  * surface data and the coherency for this data wrt. CPU vs. GPU accesses.
     92  1.1  riastrad  */
     93  1.1  riastrad enum i915_mocs_table_index {
     94  1.1  riastrad 	/*
     95  1.1  riastrad 	 * Not cached anywhere, coherency between CPU and GPU accesses is
     96  1.1  riastrad 	 * guaranteed.
     97  1.1  riastrad 	 */
     98  1.1  riastrad 	I915_MOCS_UNCACHED,
     99  1.1  riastrad 	/*
    100  1.1  riastrad 	 * Cacheability and coherency controlled by the kernel automatically
    101  1.1  riastrad 	 * based on the DRM_I915_GEM_SET_CACHING IOCTL setting and the current
    102  1.1  riastrad 	 * usage of the surface (used for display scanout or not).
    103  1.1  riastrad 	 */
    104  1.1  riastrad 	I915_MOCS_PTE,
    105  1.1  riastrad 	/*
    106  1.1  riastrad 	 * Cached in all GPU caches available on the platform.
    107  1.1  riastrad 	 * Coherency between CPU and GPU accesses to the surface is not
    108  1.1  riastrad 	 * guaranteed without extra synchronization.
    109  1.1  riastrad 	 */
    110  1.1  riastrad 	I915_MOCS_CACHED,
    111  1.1  riastrad };
    112  1.1  riastrad 
    113  1.1  riastrad /*
    114  1.1  riastrad  * Different engines serve different roles, and there may be more than one
    115  1.1  riastrad  * engine serving each role. enum drm_i915_gem_engine_class provides a
    116  1.1  riastrad  * classification of the role of the engine, which may be used when requesting
    117  1.1  riastrad  * operations to be performed on a certain subset of engines, or for providing
    118  1.1  riastrad  * information about that group.
    119  1.1  riastrad  */
    120  1.1  riastrad enum drm_i915_gem_engine_class {
    121  1.1  riastrad 	I915_ENGINE_CLASS_RENDER	= 0,
    122  1.1  riastrad 	I915_ENGINE_CLASS_COPY		= 1,
    123  1.1  riastrad 	I915_ENGINE_CLASS_VIDEO		= 2,
    124  1.1  riastrad 	I915_ENGINE_CLASS_VIDEO_ENHANCE	= 3,
    125  1.1  riastrad 
    126  1.1  riastrad 	/* should be kept compact */
    127  1.1  riastrad 
    128  1.1  riastrad 	I915_ENGINE_CLASS_INVALID	= -1
    129  1.1  riastrad };
    130  1.1  riastrad 
    131  1.1  riastrad /*
    132  1.1  riastrad  * There may be more than one engine fulfilling any role within the system.
    133  1.1  riastrad  * Each engine of a class is given a unique instance number and therefore
    134  1.1  riastrad  * any engine can be specified by its class:instance tuplet. APIs that allow
    135  1.1  riastrad  * access to any engine in the system will use struct i915_engine_class_instance
    136  1.1  riastrad  * for this identification.
    137  1.1  riastrad  */
    138  1.1  riastrad struct i915_engine_class_instance {
    139  1.1  riastrad 	__u16 engine_class; /* see enum drm_i915_gem_engine_class */
    140  1.1  riastrad 	__u16 engine_instance;
    141  1.1  riastrad #define I915_ENGINE_CLASS_INVALID_NONE -1
    142  1.1  riastrad #define I915_ENGINE_CLASS_INVALID_VIRTUAL -2
    143  1.1  riastrad };
    144  1.1  riastrad 
    145  1.1  riastrad /**
    146  1.1  riastrad  * DOC: perf_events exposed by i915 through /sys/bus/event_sources/drivers/i915
    147  1.1  riastrad  *
    148  1.1  riastrad  */
    149  1.1  riastrad 
    150  1.1  riastrad enum drm_i915_pmu_engine_sample {
    151  1.1  riastrad 	I915_SAMPLE_BUSY = 0,
    152  1.1  riastrad 	I915_SAMPLE_WAIT = 1,
    153  1.1  riastrad 	I915_SAMPLE_SEMA = 2
    154  1.1  riastrad };
    155  1.1  riastrad 
    156  1.1  riastrad #define I915_PMU_SAMPLE_BITS (4)
    157  1.1  riastrad #define I915_PMU_SAMPLE_MASK (0xf)
    158  1.1  riastrad #define I915_PMU_SAMPLE_INSTANCE_BITS (8)
    159  1.1  riastrad #define I915_PMU_CLASS_SHIFT \
    160  1.1  riastrad 	(I915_PMU_SAMPLE_BITS + I915_PMU_SAMPLE_INSTANCE_BITS)
    161  1.1  riastrad 
    162  1.1  riastrad #define __I915_PMU_ENGINE(class, instance, sample) \
    163  1.1  riastrad 	((class) << I915_PMU_CLASS_SHIFT | \
    164  1.1  riastrad 	(instance) << I915_PMU_SAMPLE_BITS | \
    165  1.1  riastrad 	(sample))
    166  1.1  riastrad 
    167  1.1  riastrad #define I915_PMU_ENGINE_BUSY(class, instance) \
    168  1.1  riastrad 	__I915_PMU_ENGINE(class, instance, I915_SAMPLE_BUSY)
    169  1.1  riastrad 
    170  1.1  riastrad #define I915_PMU_ENGINE_WAIT(class, instance) \
    171  1.1  riastrad 	__I915_PMU_ENGINE(class, instance, I915_SAMPLE_WAIT)
    172  1.1  riastrad 
    173  1.1  riastrad #define I915_PMU_ENGINE_SEMA(class, instance) \
    174  1.1  riastrad 	__I915_PMU_ENGINE(class, instance, I915_SAMPLE_SEMA)
    175  1.1  riastrad 
    176  1.1  riastrad #define __I915_PMU_OTHER(x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x))
    177  1.1  riastrad 
    178  1.1  riastrad #define I915_PMU_ACTUAL_FREQUENCY	__I915_PMU_OTHER(0)
    179  1.1  riastrad #define I915_PMU_REQUESTED_FREQUENCY	__I915_PMU_OTHER(1)
    180  1.1  riastrad #define I915_PMU_INTERRUPTS		__I915_PMU_OTHER(2)
    181  1.1  riastrad #define I915_PMU_RC6_RESIDENCY		__I915_PMU_OTHER(3)
    182  1.1  riastrad 
    183  1.1  riastrad #define I915_PMU_LAST I915_PMU_RC6_RESIDENCY
    184  1.1  riastrad 
    185  1.1  riastrad /* Each region is a minimum of 16k, and there are at most 255 of them.
    186  1.1  riastrad  */
    187  1.1  riastrad #define I915_NR_TEX_REGIONS 255	/* table size 2k - maximum due to use
    188  1.1  riastrad 				 * of chars for next/prev indices */
    189  1.1  riastrad #define I915_LOG_MIN_TEX_REGION_SIZE 14
    190  1.1  riastrad 
    191  1.1  riastrad typedef struct _drm_i915_init {
    192  1.1  riastrad 	enum {
    193  1.1  riastrad 		I915_INIT_DMA = 0x01,
    194  1.1  riastrad 		I915_CLEANUP_DMA = 0x02,
    195  1.1  riastrad 		I915_RESUME_DMA = 0x03
    196  1.1  riastrad 	} func;
    197  1.1  riastrad 	unsigned int mmio_offset;
    198  1.1  riastrad 	int sarea_priv_offset;
    199  1.1  riastrad 	unsigned int ring_start;
    200  1.1  riastrad 	unsigned int ring_end;
    201  1.1  riastrad 	unsigned int ring_size;
    202  1.1  riastrad 	unsigned int front_offset;
    203  1.1  riastrad 	unsigned int back_offset;
    204  1.1  riastrad 	unsigned int depth_offset;
    205  1.1  riastrad 	unsigned int w;
    206  1.1  riastrad 	unsigned int h;
    207  1.1  riastrad 	unsigned int pitch;
    208  1.1  riastrad 	unsigned int pitch_bits;
    209  1.1  riastrad 	unsigned int back_pitch;
    210  1.1  riastrad 	unsigned int depth_pitch;
    211  1.1  riastrad 	unsigned int cpp;
    212  1.1  riastrad 	unsigned int chipset;
    213  1.1  riastrad } drm_i915_init_t;
    214  1.1  riastrad 
    215  1.1  riastrad typedef struct _drm_i915_sarea {
    216  1.1  riastrad 	struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1];
    217  1.1  riastrad 	int last_upload;	/* last time texture was uploaded */
    218  1.1  riastrad 	int last_enqueue;	/* last time a buffer was enqueued */
    219  1.1  riastrad 	int last_dispatch;	/* age of the most recently dispatched buffer */
    220  1.1  riastrad 	int ctxOwner;		/* last context to upload state */
    221  1.1  riastrad 	int texAge;
    222  1.1  riastrad 	int pf_enabled;		/* is pageflipping allowed? */
    223  1.1  riastrad 	int pf_active;
    224  1.1  riastrad 	int pf_current_page;	/* which buffer is being displayed? */
    225  1.1  riastrad 	int perf_boxes;		/* performance boxes to be displayed */
    226  1.1  riastrad 	int width, height;      /* screen size in pixels */
    227  1.1  riastrad 
    228  1.1  riastrad 	drm_handle_t front_handle;
    229  1.1  riastrad 	int front_offset;
    230  1.1  riastrad 	int front_size;
    231  1.1  riastrad 
    232  1.1  riastrad 	drm_handle_t back_handle;
    233  1.1  riastrad 	int back_offset;
    234  1.1  riastrad 	int back_size;
    235  1.1  riastrad 
    236  1.1  riastrad 	drm_handle_t depth_handle;
    237  1.1  riastrad 	int depth_offset;
    238  1.1  riastrad 	int depth_size;
    239  1.1  riastrad 
    240  1.1  riastrad 	drm_handle_t tex_handle;
    241  1.1  riastrad 	int tex_offset;
    242  1.1  riastrad 	int tex_size;
    243  1.1  riastrad 	int log_tex_granularity;
    244  1.1  riastrad 	int pitch;
    245  1.1  riastrad 	int rotation;           /* 0, 90, 180 or 270 */
    246  1.1  riastrad 	int rotated_offset;
    247  1.1  riastrad 	int rotated_size;
    248  1.1  riastrad 	int rotated_pitch;
    249  1.1  riastrad 	int virtualX, virtualY;
    250  1.1  riastrad 
    251  1.1  riastrad 	unsigned int front_tiled;
    252  1.1  riastrad 	unsigned int back_tiled;
    253  1.1  riastrad 	unsigned int depth_tiled;
    254  1.1  riastrad 	unsigned int rotated_tiled;
    255  1.1  riastrad 	unsigned int rotated2_tiled;
    256  1.1  riastrad 
    257  1.1  riastrad 	int pipeA_x;
    258  1.1  riastrad 	int pipeA_y;
    259  1.1  riastrad 	int pipeA_w;
    260  1.1  riastrad 	int pipeA_h;
    261  1.1  riastrad 	int pipeB_x;
    262  1.1  riastrad 	int pipeB_y;
    263  1.1  riastrad 	int pipeB_w;
    264  1.1  riastrad 	int pipeB_h;
    265  1.1  riastrad 
    266  1.1  riastrad 	/* fill out some space for old userspace triple buffer */
    267  1.1  riastrad 	drm_handle_t unused_handle;
    268  1.1  riastrad 	__u32 unused1, unused2, unused3;
    269  1.1  riastrad 
    270  1.1  riastrad 	/* buffer object handles for static buffers. May change
    271  1.1  riastrad 	 * over the lifetime of the client.
    272  1.1  riastrad 	 */
    273  1.1  riastrad 	__u32 front_bo_handle;
    274  1.1  riastrad 	__u32 back_bo_handle;
    275  1.1  riastrad 	__u32 unused_bo_handle;
    276  1.1  riastrad 	__u32 depth_bo_handle;
    277  1.1  riastrad 
    278  1.1  riastrad } drm_i915_sarea_t;
    279  1.1  riastrad 
    280  1.1  riastrad /* due to userspace building against these headers we need some compat here */
    281  1.1  riastrad #define planeA_x pipeA_x
    282  1.1  riastrad #define planeA_y pipeA_y
    283  1.1  riastrad #define planeA_w pipeA_w
    284  1.1  riastrad #define planeA_h pipeA_h
    285  1.1  riastrad #define planeB_x pipeB_x
    286  1.1  riastrad #define planeB_y pipeB_y
    287  1.1  riastrad #define planeB_w pipeB_w
    288  1.1  riastrad #define planeB_h pipeB_h
    289  1.1  riastrad 
    290  1.1  riastrad /* Flags for perf_boxes
    291  1.1  riastrad  */
    292  1.1  riastrad #define I915_BOX_RING_EMPTY    0x1
    293  1.1  riastrad #define I915_BOX_FLIP          0x2
    294  1.1  riastrad #define I915_BOX_WAIT          0x4
    295  1.1  riastrad #define I915_BOX_TEXTURE_LOAD  0x8
    296  1.1  riastrad #define I915_BOX_LOST_CONTEXT  0x10
    297  1.1  riastrad 
    298  1.1  riastrad /*
    299  1.1  riastrad  * i915 specific ioctls.
    300  1.1  riastrad  *
    301  1.1  riastrad  * The device specific ioctl range is [DRM_COMMAND_BASE, DRM_COMMAND_END) ie
    302  1.1  riastrad  * [0x40, 0xa0) (a0 is excluded). The numbers below are defined as offset
    303  1.1  riastrad  * against DRM_COMMAND_BASE and should be between [0x0, 0x60).
    304  1.1  riastrad  */
    305  1.1  riastrad #define DRM_I915_INIT		0x00
    306  1.1  riastrad #define DRM_I915_FLUSH		0x01
    307  1.1  riastrad #define DRM_I915_FLIP		0x02
    308  1.1  riastrad #define DRM_I915_BATCHBUFFER	0x03
    309  1.1  riastrad #define DRM_I915_IRQ_EMIT	0x04
    310  1.1  riastrad #define DRM_I915_IRQ_WAIT	0x05
    311  1.1  riastrad #define DRM_I915_GETPARAM	0x06
    312  1.1  riastrad #define DRM_I915_SETPARAM	0x07
    313  1.1  riastrad #define DRM_I915_ALLOC		0x08
    314  1.1  riastrad #define DRM_I915_FREE		0x09
    315  1.1  riastrad #define DRM_I915_INIT_HEAP	0x0a
    316  1.1  riastrad #define DRM_I915_CMDBUFFER	0x0b
    317  1.1  riastrad #define DRM_I915_DESTROY_HEAP	0x0c
    318  1.1  riastrad #define DRM_I915_SET_VBLANK_PIPE	0x0d
    319  1.1  riastrad #define DRM_I915_GET_VBLANK_PIPE	0x0e
    320  1.1  riastrad #define DRM_I915_VBLANK_SWAP	0x0f
    321  1.1  riastrad #define DRM_I915_HWS_ADDR	0x11
    322  1.1  riastrad #define DRM_I915_GEM_INIT	0x13
    323  1.1  riastrad #define DRM_I915_GEM_EXECBUFFER	0x14
    324  1.1  riastrad #define DRM_I915_GEM_PIN	0x15
    325  1.1  riastrad #define DRM_I915_GEM_UNPIN	0x16
    326  1.1  riastrad #define DRM_I915_GEM_BUSY	0x17
    327  1.1  riastrad #define DRM_I915_GEM_THROTTLE	0x18
    328  1.1  riastrad #define DRM_I915_GEM_ENTERVT	0x19
    329  1.1  riastrad #define DRM_I915_GEM_LEAVEVT	0x1a
    330  1.1  riastrad #define DRM_I915_GEM_CREATE	0x1b
    331  1.1  riastrad #define DRM_I915_GEM_PREAD	0x1c
    332  1.1  riastrad #define DRM_I915_GEM_PWRITE	0x1d
    333  1.1  riastrad #define DRM_I915_GEM_MMAP	0x1e
    334  1.1  riastrad #define DRM_I915_GEM_SET_DOMAIN	0x1f
    335  1.1  riastrad #define DRM_I915_GEM_SW_FINISH	0x20
    336  1.1  riastrad #define DRM_I915_GEM_SET_TILING	0x21
    337  1.1  riastrad #define DRM_I915_GEM_GET_TILING	0x22
    338  1.1  riastrad #define DRM_I915_GEM_GET_APERTURE 0x23
    339  1.1  riastrad #define DRM_I915_GEM_MMAP_GTT	0x24
    340  1.1  riastrad #define DRM_I915_GET_PIPE_FROM_CRTC_ID	0x25
    341  1.1  riastrad #define DRM_I915_GEM_MADVISE	0x26
    342  1.1  riastrad #define DRM_I915_OVERLAY_PUT_IMAGE	0x27
    343  1.1  riastrad #define DRM_I915_OVERLAY_ATTRS	0x28
    344  1.1  riastrad #define DRM_I915_GEM_EXECBUFFER2	0x29
    345  1.1  riastrad #define DRM_I915_GEM_EXECBUFFER2_WR	DRM_I915_GEM_EXECBUFFER2
    346  1.1  riastrad #define DRM_I915_GET_SPRITE_COLORKEY	0x2a
    347  1.1  riastrad #define DRM_I915_SET_SPRITE_COLORKEY	0x2b
    348  1.1  riastrad #define DRM_I915_GEM_WAIT	0x2c
    349  1.1  riastrad #define DRM_I915_GEM_CONTEXT_CREATE	0x2d
    350  1.1  riastrad #define DRM_I915_GEM_CONTEXT_DESTROY	0x2e
    351  1.1  riastrad #define DRM_I915_GEM_SET_CACHING	0x2f
    352  1.1  riastrad #define DRM_I915_GEM_GET_CACHING	0x30
    353  1.1  riastrad #define DRM_I915_REG_READ		0x31
    354  1.1  riastrad #define DRM_I915_GET_RESET_STATS	0x32
    355  1.1  riastrad #define DRM_I915_GEM_USERPTR		0x33
    356  1.1  riastrad #define DRM_I915_GEM_CONTEXT_GETPARAM	0x34
    357  1.1  riastrad #define DRM_I915_GEM_CONTEXT_SETPARAM	0x35
    358  1.1  riastrad #define DRM_I915_PERF_OPEN		0x36
    359  1.1  riastrad #define DRM_I915_PERF_ADD_CONFIG	0x37
    360  1.1  riastrad #define DRM_I915_PERF_REMOVE_CONFIG	0x38
    361  1.1  riastrad #define DRM_I915_QUERY			0x39
    362  1.1  riastrad #define DRM_I915_GEM_VM_CREATE		0x3a
    363  1.1  riastrad #define DRM_I915_GEM_VM_DESTROY		0x3b
    364  1.1  riastrad /* Must be kept compact -- no holes */
    365  1.1  riastrad 
    366  1.1  riastrad #define DRM_IOCTL_I915_INIT		DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
    367  1.1  riastrad #define DRM_IOCTL_I915_FLUSH		DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
    368  1.1  riastrad #define DRM_IOCTL_I915_FLIP		DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP)
    369  1.1  riastrad #define DRM_IOCTL_I915_BATCHBUFFER	DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
    370  1.1  riastrad #define DRM_IOCTL_I915_IRQ_EMIT         DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t)
    371  1.1  riastrad #define DRM_IOCTL_I915_IRQ_WAIT         DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t)
    372  1.1  riastrad #define DRM_IOCTL_I915_GETPARAM         DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t)
    373  1.1  riastrad #define DRM_IOCTL_I915_SETPARAM         DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t)
    374  1.1  riastrad #define DRM_IOCTL_I915_ALLOC            DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t)
    375  1.1  riastrad #define DRM_IOCTL_I915_FREE             DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t)
    376  1.1  riastrad #define DRM_IOCTL_I915_INIT_HEAP        DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t)
    377  1.1  riastrad #define DRM_IOCTL_I915_CMDBUFFER	DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t)
    378  1.1  riastrad #define DRM_IOCTL_I915_DESTROY_HEAP	DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t)
    379  1.1  riastrad #define DRM_IOCTL_I915_SET_VBLANK_PIPE	DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
    380  1.1  riastrad #define DRM_IOCTL_I915_GET_VBLANK_PIPE	DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
    381  1.1  riastrad #define DRM_IOCTL_I915_VBLANK_SWAP	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
    382  1.1  riastrad #define DRM_IOCTL_I915_HWS_ADDR		DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
    383  1.1  riastrad #define DRM_IOCTL_I915_GEM_INIT		DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
    384  1.1  riastrad #define DRM_IOCTL_I915_GEM_EXECBUFFER	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
    385  1.1  riastrad #define DRM_IOCTL_I915_GEM_EXECBUFFER2	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
    386  1.1  riastrad #define DRM_IOCTL_I915_GEM_EXECBUFFER2_WR	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2_WR, struct drm_i915_gem_execbuffer2)
    387  1.1  riastrad #define DRM_IOCTL_I915_GEM_PIN		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
    388  1.1  riastrad #define DRM_IOCTL_I915_GEM_UNPIN	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
    389  1.1  riastrad #define DRM_IOCTL_I915_GEM_BUSY		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
    390  1.1  riastrad #define DRM_IOCTL_I915_GEM_SET_CACHING		DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching)
    391  1.1  riastrad #define DRM_IOCTL_I915_GEM_GET_CACHING		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching)
    392  1.1  riastrad #define DRM_IOCTL_I915_GEM_THROTTLE	DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
    393  1.1  riastrad #define DRM_IOCTL_I915_GEM_ENTERVT	DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)
    394  1.1  riastrad #define DRM_IOCTL_I915_GEM_LEAVEVT	DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)
    395  1.1  riastrad #define DRM_IOCTL_I915_GEM_CREATE	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
    396  1.1  riastrad #define DRM_IOCTL_I915_GEM_PREAD	DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
    397  1.1  riastrad #define DRM_IOCTL_I915_GEM_PWRITE	DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
    398  1.1  riastrad #define DRM_IOCTL_I915_GEM_MMAP		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
    399  1.1  riastrad #define DRM_IOCTL_I915_GEM_MMAP_GTT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
    400  1.1  riastrad #define DRM_IOCTL_I915_GEM_MMAP_OFFSET	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_offset)
    401  1.1  riastrad #define DRM_IOCTL_I915_GEM_SET_DOMAIN	DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
    402  1.1  riastrad #define DRM_IOCTL_I915_GEM_SW_FINISH	DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
    403  1.1  riastrad #define DRM_IOCTL_I915_GEM_SET_TILING	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
    404  1.1  riastrad #define DRM_IOCTL_I915_GEM_GET_TILING	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
    405  1.1  riastrad #define DRM_IOCTL_I915_GEM_GET_APERTURE	DRM_IOR  (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
    406  1.1  riastrad #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)
    407  1.1  riastrad #define DRM_IOCTL_I915_GEM_MADVISE	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
    408  1.1  riastrad #define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
    409  1.1  riastrad #define DRM_IOCTL_I915_OVERLAY_ATTRS	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
    410  1.1  riastrad #define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
    411  1.1  riastrad #define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
    412  1.1  riastrad #define DRM_IOCTL_I915_GEM_WAIT		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)
    413  1.1  riastrad #define DRM_IOCTL_I915_GEM_CONTEXT_CREATE	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
    414  1.1  riastrad #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)
    415  1.1  riastrad #define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY	DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
    416  1.1  riastrad #define DRM_IOCTL_I915_REG_READ			DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
    417  1.1  riastrad #define DRM_IOCTL_I915_GET_RESET_STATS		DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats)
    418  1.1  riastrad #define DRM_IOCTL_I915_GEM_USERPTR			DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr)
    419  1.1  riastrad #define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param)
    420  1.1  riastrad #define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param)
    421  1.1  riastrad #define DRM_IOCTL_I915_PERF_OPEN	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_OPEN, struct drm_i915_perf_open_param)
    422  1.1  riastrad #define DRM_IOCTL_I915_PERF_ADD_CONFIG	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config)
    423  1.1  riastrad #define DRM_IOCTL_I915_PERF_REMOVE_CONFIG	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64)
    424  1.1  riastrad #define DRM_IOCTL_I915_QUERY			DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)
    425  1.1  riastrad #define DRM_IOCTL_I915_GEM_VM_CREATE	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_VM_CREATE, struct drm_i915_gem_vm_control)
    426  1.1  riastrad #define DRM_IOCTL_I915_GEM_VM_DESTROY	DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_VM_DESTROY, struct drm_i915_gem_vm_control)
    427  1.1  riastrad 
    428  1.1  riastrad /* Allow drivers to submit batchbuffers directly to hardware, relying
    429  1.1  riastrad  * on the security mechanisms provided by hardware.
    430  1.1  riastrad  */
    431  1.1  riastrad typedef struct drm_i915_batchbuffer {
    432  1.1  riastrad 	int start;		/* agp offset */
    433  1.1  riastrad 	int used;		/* nr bytes in use */
    434  1.1  riastrad 	int DR1;		/* hw flags for GFX_OP_DRAWRECT_INFO */
    435  1.1  riastrad 	int DR4;		/* window origin for GFX_OP_DRAWRECT_INFO */
    436  1.1  riastrad 	int num_cliprects;	/* mulitpass with multiple cliprects? */
    437  1.1  riastrad 	struct drm_clip_rect __user *cliprects;	/* pointer to userspace cliprects */
    438  1.1  riastrad } drm_i915_batchbuffer_t;
    439  1.1  riastrad 
    440  1.1  riastrad /* As above, but pass a pointer to userspace buffer which can be
    441  1.1  riastrad  * validated by the kernel prior to sending to hardware.
    442  1.1  riastrad  */
    443  1.1  riastrad typedef struct _drm_i915_cmdbuffer {
    444  1.1  riastrad 	char __user *buf;	/* pointer to userspace command buffer */
    445  1.1  riastrad 	int sz;			/* nr bytes in buf */
    446  1.1  riastrad 	int DR1;		/* hw flags for GFX_OP_DRAWRECT_INFO */
    447  1.1  riastrad 	int DR4;		/* window origin for GFX_OP_DRAWRECT_INFO */
    448  1.1  riastrad 	int num_cliprects;	/* mulitpass with multiple cliprects? */
    449  1.1  riastrad 	struct drm_clip_rect __user *cliprects;	/* pointer to userspace cliprects */
    450  1.1  riastrad } drm_i915_cmdbuffer_t;
    451  1.1  riastrad 
    452  1.1  riastrad /* Userspace can request & wait on irq's:
    453  1.1  riastrad  */
    454  1.1  riastrad typedef struct drm_i915_irq_emit {
    455  1.1  riastrad 	int __user *irq_seq;
    456  1.1  riastrad } drm_i915_irq_emit_t;
    457  1.1  riastrad 
    458  1.1  riastrad typedef struct drm_i915_irq_wait {
    459  1.1  riastrad 	int irq_seq;
    460  1.1  riastrad } drm_i915_irq_wait_t;
    461  1.1  riastrad 
    462  1.1  riastrad /*
    463  1.1  riastrad  * Different modes of per-process Graphics Translation Table,
    464  1.1  riastrad  * see I915_PARAM_HAS_ALIASING_PPGTT
    465  1.1  riastrad  */
    466  1.1  riastrad #define I915_GEM_PPGTT_NONE	0
    467  1.1  riastrad #define I915_GEM_PPGTT_ALIASING	1
    468  1.1  riastrad #define I915_GEM_PPGTT_FULL	2
    469  1.1  riastrad 
    470  1.1  riastrad /* Ioctl to query kernel params:
    471  1.1  riastrad  */
    472  1.1  riastrad #define I915_PARAM_IRQ_ACTIVE            1
    473  1.1  riastrad #define I915_PARAM_ALLOW_BATCHBUFFER     2
    474  1.1  riastrad #define I915_PARAM_LAST_DISPATCH         3
    475  1.1  riastrad #define I915_PARAM_CHIPSET_ID            4
    476  1.1  riastrad #define I915_PARAM_HAS_GEM               5
    477  1.1  riastrad #define I915_PARAM_NUM_FENCES_AVAIL      6
    478  1.1  riastrad #define I915_PARAM_HAS_OVERLAY           7
    479  1.1  riastrad #define I915_PARAM_HAS_PAGEFLIPPING	 8
    480  1.1  riastrad #define I915_PARAM_HAS_EXECBUF2          9
    481  1.1  riastrad #define I915_PARAM_HAS_BSD		 10
    482  1.1  riastrad #define I915_PARAM_HAS_BLT		 11
    483  1.1  riastrad #define I915_PARAM_HAS_RELAXED_FENCING	 12
    484  1.1  riastrad #define I915_PARAM_HAS_COHERENT_RINGS	 13
    485  1.1  riastrad #define I915_PARAM_HAS_EXEC_CONSTANTS	 14
    486  1.1  riastrad #define I915_PARAM_HAS_RELAXED_DELTA	 15
    487  1.1  riastrad #define I915_PARAM_HAS_GEN7_SOL_RESET	 16
    488  1.1  riastrad #define I915_PARAM_HAS_LLC     	 	 17
    489  1.1  riastrad #define I915_PARAM_HAS_ALIASING_PPGTT	 18
    490  1.1  riastrad #define I915_PARAM_HAS_WAIT_TIMEOUT	 19
    491  1.1  riastrad #define I915_PARAM_HAS_SEMAPHORES	 20
    492  1.1  riastrad #define I915_PARAM_HAS_PRIME_VMAP_FLUSH	 21
    493  1.1  riastrad #define I915_PARAM_HAS_VEBOX		 22
    494  1.1  riastrad #define I915_PARAM_HAS_SECURE_BATCHES	 23
    495  1.1  riastrad #define I915_PARAM_HAS_PINNED_BATCHES	 24
    496  1.1  riastrad #define I915_PARAM_HAS_EXEC_NO_RELOC	 25
    497  1.1  riastrad #define I915_PARAM_HAS_EXEC_HANDLE_LUT   26
    498  1.1  riastrad #define I915_PARAM_HAS_WT     	 	 27
    499  1.1  riastrad #define I915_PARAM_CMD_PARSER_VERSION	 28
    500  1.1  riastrad #define I915_PARAM_HAS_COHERENT_PHYS_GTT 29
    501  1.1  riastrad #define I915_PARAM_MMAP_VERSION          30
    502  1.1  riastrad #define I915_PARAM_HAS_BSD2		 31
    503  1.1  riastrad #define I915_PARAM_REVISION              32
    504  1.1  riastrad #define I915_PARAM_SUBSLICE_TOTAL	 33
    505  1.1  riastrad #define I915_PARAM_EU_TOTAL		 34
    506  1.1  riastrad #define I915_PARAM_HAS_GPU_RESET	 35
    507  1.1  riastrad #define I915_PARAM_HAS_RESOURCE_STREAMER 36
    508  1.1  riastrad #define I915_PARAM_HAS_EXEC_SOFTPIN	 37
    509  1.1  riastrad #define I915_PARAM_HAS_POOLED_EU	 38
    510  1.1  riastrad #define I915_PARAM_MIN_EU_IN_POOL	 39
    511  1.1  riastrad #define I915_PARAM_MMAP_GTT_VERSION	 40
    512  1.1  riastrad 
    513  1.1  riastrad /*
    514  1.1  riastrad  * Query whether DRM_I915_GEM_EXECBUFFER2 supports user defined execution
    515  1.1  riastrad  * priorities and the driver will attempt to execute batches in priority order.
    516  1.1  riastrad  * The param returns a capability bitmask, nonzero implies that the scheduler
    517  1.1  riastrad  * is enabled, with different features present according to the mask.
    518  1.1  riastrad  *
    519  1.1  riastrad  * The initial priority for each batch is supplied by the context and is
    520  1.1  riastrad  * controlled via I915_CONTEXT_PARAM_PRIORITY.
    521  1.1  riastrad  */
    522  1.1  riastrad #define I915_PARAM_HAS_SCHEDULER	 41
    523  1.1  riastrad #define   I915_SCHEDULER_CAP_ENABLED	(1ul << 0)
    524  1.1  riastrad #define   I915_SCHEDULER_CAP_PRIORITY	(1ul << 1)
    525  1.1  riastrad #define   I915_SCHEDULER_CAP_PREEMPTION	(1ul << 2)
    526  1.1  riastrad #define   I915_SCHEDULER_CAP_SEMAPHORES	(1ul << 3)
    527  1.1  riastrad #define   I915_SCHEDULER_CAP_ENGINE_BUSY_STATS	(1ul << 4)
    528  1.1  riastrad 
    529  1.1  riastrad #define I915_PARAM_HUC_STATUS		 42
    530  1.1  riastrad 
    531  1.1  riastrad /* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to opt-out of
    532  1.1  riastrad  * synchronisation with implicit fencing on individual objects.
    533  1.1  riastrad  * See EXEC_OBJECT_ASYNC.
    534  1.1  riastrad  */
    535  1.1  riastrad #define I915_PARAM_HAS_EXEC_ASYNC	 43
    536  1.1  riastrad 
    537  1.1  riastrad /* Query whether DRM_I915_GEM_EXECBUFFER2 supports explicit fence support -
    538  1.1  riastrad  * both being able to pass in a sync_file fd to wait upon before executing,
    539  1.1  riastrad  * and being able to return a new sync_file fd that is signaled when the
    540  1.1  riastrad  * current request is complete. See I915_EXEC_FENCE_IN and I915_EXEC_FENCE_OUT.
    541  1.1  riastrad  */
    542  1.1  riastrad #define I915_PARAM_HAS_EXEC_FENCE	 44
    543  1.1  riastrad 
    544  1.1  riastrad /* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to capture
    545  1.1  riastrad  * user specified bufffers for post-mortem debugging of GPU hangs. See
    546  1.1  riastrad  * EXEC_OBJECT_CAPTURE.
    547  1.1  riastrad  */
    548  1.1  riastrad #define I915_PARAM_HAS_EXEC_CAPTURE	 45
    549  1.1  riastrad 
    550  1.1  riastrad #define I915_PARAM_SLICE_MASK		 46
    551  1.1  riastrad 
    552  1.1  riastrad /* Assuming it's uniform for each slice, this queries the mask of subslices
    553  1.1  riastrad  * per-slice for this system.
    554  1.1  riastrad  */
    555  1.1  riastrad #define I915_PARAM_SUBSLICE_MASK	 47
    556  1.1  riastrad 
    557  1.1  riastrad /*
    558  1.1  riastrad  * Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying the batch buffer
    559  1.1  riastrad  * as the first execobject as opposed to the last. See I915_EXEC_BATCH_FIRST.
    560  1.1  riastrad  */
    561  1.1  riastrad #define I915_PARAM_HAS_EXEC_BATCH_FIRST	 48
    562  1.1  riastrad 
    563  1.1  riastrad /* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of
    564  1.1  riastrad  * drm_i915_gem_exec_fence structures.  See I915_EXEC_FENCE_ARRAY.
    565  1.1  riastrad  */
    566  1.1  riastrad #define I915_PARAM_HAS_EXEC_FENCE_ARRAY  49
    567  1.1  riastrad 
    568  1.1  riastrad /*
    569  1.1  riastrad  * Query whether every context (both per-file default and user created) is
    570  1.1  riastrad  * isolated (insofar as HW supports). If this parameter is not true, then
    571  1.1  riastrad  * freshly created contexts may inherit values from an existing context,
    572  1.1  riastrad  * rather than default HW values. If true, it also ensures (insofar as HW
    573  1.1  riastrad  * supports) that all state set by this context will not leak to any other
    574  1.1  riastrad  * context.
    575  1.1  riastrad  *
    576  1.1  riastrad  * As not every engine across every gen support contexts, the returned
    577  1.1  riastrad  * value reports the support of context isolation for individual engines by
    578  1.1  riastrad  * returning a bitmask of each engine class set to true if that class supports
    579  1.1  riastrad  * isolation.
    580  1.1  riastrad  */
    581  1.1  riastrad #define I915_PARAM_HAS_CONTEXT_ISOLATION 50
    582  1.1  riastrad 
    583  1.1  riastrad /* Frequency of the command streamer timestamps given by the *_TIMESTAMP
    584  1.1  riastrad  * registers. This used to be fixed per platform but from CNL onwards, this
    585  1.1  riastrad  * might vary depending on the parts.
    586  1.1  riastrad  */
    587  1.1  riastrad #define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51
    588  1.1  riastrad 
    589  1.1  riastrad /*
    590  1.1  riastrad  * Once upon a time we supposed that writes through the GGTT would be
    591  1.1  riastrad  * immediately in physical memory (once flushed out of the CPU path). However,
    592  1.1  riastrad  * on a few different processors and chipsets, this is not necessarily the case
    593  1.1  riastrad  * as the writes appear to be buffered internally. Thus a read of the backing
    594  1.1  riastrad  * storage (physical memory) via a different path (with different physical tags
    595  1.1  riastrad  * to the indirect write via the GGTT) will see stale values from before
    596  1.1  riastrad  * the GGTT write. Inside the kernel, we can for the most part keep track of
    597  1.1  riastrad  * the different read/write domains in use (e.g. set-domain), but the assumption
    598  1.1  riastrad  * of coherency is baked into the ABI, hence reporting its true state in this
    599  1.1  riastrad  * parameter.
    600  1.1  riastrad  *
    601  1.1  riastrad  * Reports true when writes via mmap_gtt are immediately visible following an
    602  1.1  riastrad  * lfence to flush the WCB.
    603  1.1  riastrad  *
    604  1.1  riastrad  * Reports false when writes via mmap_gtt are indeterminately delayed in an in
    605  1.1  riastrad  * internal buffer and are _not_ immediately visible to third parties accessing
    606  1.1  riastrad  * directly via mmap_cpu/mmap_wc. Use of mmap_gtt as part of an IPC
    607  1.1  riastrad  * communications channel when reporting false is strongly disadvised.
    608  1.1  riastrad  */
    609  1.1  riastrad #define I915_PARAM_MMAP_GTT_COHERENT	52
    610  1.1  riastrad 
    611  1.1  riastrad /*
    612  1.1  riastrad  * Query whether DRM_I915_GEM_EXECBUFFER2 supports coordination of parallel
    613  1.1  riastrad  * execution through use of explicit fence support.
    614  1.1  riastrad  * See I915_EXEC_FENCE_OUT and I915_EXEC_FENCE_SUBMIT.
    615  1.1  riastrad  */
    616  1.1  riastrad #define I915_PARAM_HAS_EXEC_SUBMIT_FENCE 53
    617  1.1  riastrad 
    618  1.1  riastrad /*
    619  1.1  riastrad  * Revision of the i915-perf uAPI. The value returned helps determine what
    620  1.1  riastrad  * i915-perf features are available. See drm_i915_perf_property_id.
    621  1.1  riastrad  */
    622  1.1  riastrad #define I915_PARAM_PERF_REVISION	54
    623  1.1  riastrad 
    624  1.1  riastrad /* Must be kept compact -- no holes and well documented */
    625  1.1  riastrad 
    626  1.1  riastrad typedef struct drm_i915_getparam {
    627  1.1  riastrad 	__s32 param;
    628  1.1  riastrad 	/*
    629  1.1  riastrad 	 * WARNING: Using pointers instead of fixed-size u64 means we need to write
    630  1.1  riastrad 	 * compat32 code. Don't repeat this mistake.
    631  1.1  riastrad 	 */
    632  1.1  riastrad 	int __user *value;
    633  1.1  riastrad } drm_i915_getparam_t;
    634  1.1  riastrad 
    635  1.1  riastrad /* Ioctl to set kernel params:
    636  1.1  riastrad  */
    637  1.1  riastrad #define I915_SETPARAM_USE_MI_BATCHBUFFER_START            1
    638  1.1  riastrad #define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY             2
    639  1.1  riastrad #define I915_SETPARAM_ALLOW_BATCHBUFFER                   3
    640  1.1  riastrad #define I915_SETPARAM_NUM_USED_FENCES                     4
    641  1.1  riastrad /* Must be kept compact -- no holes */
    642  1.1  riastrad 
    643  1.1  riastrad typedef struct drm_i915_setparam {
    644  1.1  riastrad 	int param;
    645  1.1  riastrad 	int value;
    646  1.1  riastrad } drm_i915_setparam_t;
    647  1.1  riastrad 
    648  1.1  riastrad /* A memory manager for regions of shared memory:
    649  1.1  riastrad  */
    650  1.1  riastrad #define I915_MEM_REGION_AGP 1
    651  1.1  riastrad 
    652  1.1  riastrad typedef struct drm_i915_mem_alloc {
    653  1.1  riastrad 	int region;
    654  1.1  riastrad 	int alignment;
    655  1.1  riastrad 	int size;
    656  1.1  riastrad 	int __user *region_offset;	/* offset from start of fb or agp */
    657  1.1  riastrad } drm_i915_mem_alloc_t;
    658  1.1  riastrad 
    659  1.1  riastrad typedef struct drm_i915_mem_free {
    660  1.1  riastrad 	int region;
    661  1.1  riastrad 	int region_offset;
    662  1.1  riastrad } drm_i915_mem_free_t;
    663  1.1  riastrad 
    664  1.1  riastrad typedef struct drm_i915_mem_init_heap {
    665  1.1  riastrad 	int region;
    666  1.1  riastrad 	int size;
    667  1.1  riastrad 	int start;
    668  1.1  riastrad } drm_i915_mem_init_heap_t;
    669  1.1  riastrad 
    670  1.1  riastrad /* Allow memory manager to be torn down and re-initialized (eg on
    671  1.1  riastrad  * rotate):
    672  1.1  riastrad  */
    673  1.1  riastrad typedef struct drm_i915_mem_destroy_heap {
    674  1.1  riastrad 	int region;
    675  1.1  riastrad } drm_i915_mem_destroy_heap_t;
    676  1.1  riastrad 
    677  1.1  riastrad /* Allow X server to configure which pipes to monitor for vblank signals
    678  1.1  riastrad  */
    679  1.1  riastrad #define	DRM_I915_VBLANK_PIPE_A	1
    680  1.1  riastrad #define	DRM_I915_VBLANK_PIPE_B	2
    681  1.1  riastrad 
    682  1.1  riastrad typedef struct drm_i915_vblank_pipe {
    683  1.1  riastrad 	int pipe;
    684  1.1  riastrad } drm_i915_vblank_pipe_t;
    685  1.1  riastrad 
    686  1.1  riastrad /* Schedule buffer swap at given vertical blank:
    687  1.1  riastrad  */
    688  1.1  riastrad typedef struct drm_i915_vblank_swap {
    689  1.1  riastrad 	drm_drawable_t drawable;
    690  1.1  riastrad 	enum drm_vblank_seq_type seqtype;
    691  1.1  riastrad 	unsigned int sequence;
    692  1.1  riastrad } drm_i915_vblank_swap_t;
    693  1.1  riastrad 
    694  1.1  riastrad typedef struct drm_i915_hws_addr {
    695  1.1  riastrad 	__u64 addr;
    696  1.1  riastrad } drm_i915_hws_addr_t;
    697  1.1  riastrad 
    698  1.1  riastrad struct drm_i915_gem_init {
    699  1.1  riastrad 	/**
    700  1.1  riastrad 	 * Beginning offset in the GTT to be managed by the DRM memory
    701  1.1  riastrad 	 * manager.
    702  1.1  riastrad 	 */
    703  1.1  riastrad 	__u64 gtt_start;
    704  1.1  riastrad 	/**
    705  1.1  riastrad 	 * Ending offset in the GTT to be managed by the DRM memory
    706  1.1  riastrad 	 * manager.
    707  1.1  riastrad 	 */
    708  1.1  riastrad 	__u64 gtt_end;
    709  1.1  riastrad };
    710  1.1  riastrad 
    711  1.1  riastrad struct drm_i915_gem_create {
    712  1.1  riastrad 	/**
    713  1.1  riastrad 	 * Requested size for the object.
    714  1.1  riastrad 	 *
    715  1.1  riastrad 	 * The (page-aligned) allocated size for the object will be returned.
    716  1.1  riastrad 	 */
    717  1.1  riastrad 	__u64 size;
    718  1.1  riastrad 	/**
    719  1.1  riastrad 	 * Returned handle for the object.
    720  1.1  riastrad 	 *
    721  1.1  riastrad 	 * Object handles are nonzero.
    722  1.1  riastrad 	 */
    723  1.1  riastrad 	__u32 handle;
    724  1.1  riastrad 	__u32 pad;
    725  1.1  riastrad };
    726  1.1  riastrad 
    727  1.1  riastrad struct drm_i915_gem_pread {
    728  1.1  riastrad 	/** Handle for the object being read. */
    729  1.1  riastrad 	__u32 handle;
    730  1.1  riastrad 	__u32 pad;
    731  1.1  riastrad 	/** Offset into the object to read from */
    732  1.1  riastrad 	__u64 offset;
    733  1.1  riastrad 	/** Length of data to read */
    734  1.1  riastrad 	__u64 size;
    735  1.1  riastrad 	/**
    736  1.1  riastrad 	 * Pointer to write the data into.
    737  1.1  riastrad 	 *
    738  1.1  riastrad 	 * This is a fixed-size type for 32/64 compatibility.
    739  1.1  riastrad 	 */
    740  1.1  riastrad 	__u64 data_ptr;
    741  1.1  riastrad };
    742  1.1  riastrad 
    743  1.1  riastrad struct drm_i915_gem_pwrite {
    744  1.1  riastrad 	/** Handle for the object being written to. */
    745  1.1  riastrad 	__u32 handle;
    746  1.1  riastrad 	__u32 pad;
    747  1.1  riastrad 	/** Offset into the object to write to */
    748  1.1  riastrad 	__u64 offset;
    749  1.1  riastrad 	/** Length of data to write */
    750  1.1  riastrad 	__u64 size;
    751  1.1  riastrad 	/**
    752  1.1  riastrad 	 * Pointer to read the data from.
    753  1.1  riastrad 	 *
    754  1.1  riastrad 	 * This is a fixed-size type for 32/64 compatibility.
    755  1.1  riastrad 	 */
    756  1.1  riastrad 	__u64 data_ptr;
    757  1.1  riastrad };
    758  1.1  riastrad 
    759  1.1  riastrad struct drm_i915_gem_mmap {
    760  1.1  riastrad 	/** Handle for the object being mapped. */
    761  1.1  riastrad 	__u32 handle;
    762  1.1  riastrad 	__u32 pad;
    763  1.1  riastrad 	/** Offset in the object to map. */
    764  1.1  riastrad 	__u64 offset;
    765  1.1  riastrad 	/**
    766  1.1  riastrad 	 * Length of data to map.
    767  1.1  riastrad 	 *
    768  1.1  riastrad 	 * The value will be page-aligned.
    769  1.1  riastrad 	 */
    770  1.1  riastrad 	__u64 size;
    771  1.1  riastrad 	/**
    772  1.1  riastrad 	 * Returned pointer the data was mapped at.
    773  1.1  riastrad 	 *
    774  1.1  riastrad 	 * This is a fixed-size type for 32/64 compatibility.
    775  1.1  riastrad 	 */
    776  1.1  riastrad 	__u64 addr_ptr;
    777  1.1  riastrad 
    778  1.1  riastrad 	/**
    779  1.1  riastrad 	 * Flags for extended behaviour.
    780  1.1  riastrad 	 *
    781  1.1  riastrad 	 * Added in version 2.
    782  1.1  riastrad 	 */
    783  1.1  riastrad 	__u64 flags;
    784  1.1  riastrad #define I915_MMAP_WC 0x1
    785  1.1  riastrad };
    786  1.1  riastrad 
    787  1.1  riastrad struct drm_i915_gem_mmap_gtt {
    788  1.1  riastrad 	/** Handle for the object being mapped. */
    789  1.1  riastrad 	__u32 handle;
    790  1.1  riastrad 	__u32 pad;
    791  1.1  riastrad 	/**
    792  1.1  riastrad 	 * Fake offset to use for subsequent mmap call
    793  1.1  riastrad 	 *
    794  1.1  riastrad 	 * This is a fixed-size type for 32/64 compatibility.
    795  1.1  riastrad 	 */
    796  1.1  riastrad 	__u64 offset;
    797  1.1  riastrad };
    798  1.1  riastrad 
    799  1.1  riastrad struct drm_i915_gem_mmap_offset {
    800  1.1  riastrad 	/** Handle for the object being mapped. */
    801  1.1  riastrad 	__u32 handle;
    802  1.1  riastrad 	__u32 pad;
    803  1.1  riastrad 	/**
    804  1.1  riastrad 	 * Fake offset to use for subsequent mmap call
    805  1.1  riastrad 	 *
    806  1.1  riastrad 	 * This is a fixed-size type for 32/64 compatibility.
    807  1.1  riastrad 	 */
    808  1.1  riastrad 	__u64 offset;
    809  1.1  riastrad 
    810  1.1  riastrad 	/**
    811  1.1  riastrad 	 * Flags for extended behaviour.
    812  1.1  riastrad 	 *
    813  1.1  riastrad 	 * It is mandatory that one of the MMAP_OFFSET types
    814  1.1  riastrad 	 * (GTT, WC, WB, UC, etc) should be included.
    815  1.1  riastrad 	 */
    816  1.1  riastrad 	__u64 flags;
    817  1.1  riastrad #define I915_MMAP_OFFSET_GTT 0
    818  1.1  riastrad #define I915_MMAP_OFFSET_WC  1
    819  1.1  riastrad #define I915_MMAP_OFFSET_WB  2
    820  1.1  riastrad #define I915_MMAP_OFFSET_UC  3
    821  1.1  riastrad 
    822  1.1  riastrad 	/*
    823  1.1  riastrad 	 * Zero-terminated chain of extensions.
    824  1.1  riastrad 	 *
    825  1.1  riastrad 	 * No current extensions defined; mbz.
    826  1.1  riastrad 	 */
    827  1.1  riastrad 	__u64 extensions;
    828  1.1  riastrad };
    829  1.1  riastrad 
    830  1.1  riastrad struct drm_i915_gem_set_domain {
    831  1.1  riastrad 	/** Handle for the object */
    832  1.1  riastrad 	__u32 handle;
    833  1.1  riastrad 
    834  1.1  riastrad 	/** New read domains */
    835  1.1  riastrad 	__u32 read_domains;
    836  1.1  riastrad 
    837  1.1  riastrad 	/** New write domain */
    838  1.1  riastrad 	__u32 write_domain;
    839  1.1  riastrad };
    840  1.1  riastrad 
    841  1.1  riastrad struct drm_i915_gem_sw_finish {
    842  1.1  riastrad 	/** Handle for the object */
    843  1.1  riastrad 	__u32 handle;
    844  1.1  riastrad };
    845  1.1  riastrad 
    846  1.1  riastrad struct drm_i915_gem_relocation_entry {
    847  1.1  riastrad 	/**
    848  1.1  riastrad 	 * Handle of the buffer being pointed to by this relocation entry.
    849  1.1  riastrad 	 *
    850  1.1  riastrad 	 * It's appealing to make this be an index into the mm_validate_entry
    851  1.1  riastrad 	 * list to refer to the buffer, but this allows the driver to create
    852  1.1  riastrad 	 * a relocation list for state buffers and not re-write it per
    853  1.1  riastrad 	 * exec using the buffer.
    854  1.1  riastrad 	 */
    855  1.1  riastrad 	__u32 target_handle;
    856  1.1  riastrad 
    857  1.1  riastrad 	/**
    858  1.1  riastrad 	 * Value to be added to the offset of the target buffer to make up
    859  1.1  riastrad 	 * the relocation entry.
    860  1.1  riastrad 	 */
    861  1.1  riastrad 	__u32 delta;
    862  1.1  riastrad 
    863  1.1  riastrad 	/** Offset in the buffer the relocation entry will be written into */
    864  1.1  riastrad 	__u64 offset;
    865  1.1  riastrad 
    866  1.1  riastrad 	/**
    867  1.1  riastrad 	 * Offset value of the target buffer that the relocation entry was last
    868  1.1  riastrad 	 * written as.
    869  1.1  riastrad 	 *
    870  1.1  riastrad 	 * If the buffer has the same offset as last time, we can skip syncing
    871  1.1  riastrad 	 * and writing the relocation.  This value is written back out by
    872  1.1  riastrad 	 * the execbuffer ioctl when the relocation is written.
    873  1.1  riastrad 	 */
    874  1.1  riastrad 	__u64 presumed_offset;
    875  1.1  riastrad 
    876  1.1  riastrad 	/**
    877  1.1  riastrad 	 * Target memory domains read by this operation.
    878  1.1  riastrad 	 */
    879  1.1  riastrad 	__u32 read_domains;
    880  1.1  riastrad 
    881  1.1  riastrad 	/**
    882  1.1  riastrad 	 * Target memory domains written by this operation.
    883  1.1  riastrad 	 *
    884  1.1  riastrad 	 * Note that only one domain may be written by the whole
    885  1.1  riastrad 	 * execbuffer operation, so that where there are conflicts,
    886  1.1  riastrad 	 * the application will get -EINVAL back.
    887  1.1  riastrad 	 */
    888  1.1  riastrad 	__u32 write_domain;
    889  1.1  riastrad };
    890  1.1  riastrad 
    891  1.1  riastrad /** @{
    892  1.1  riastrad  * Intel memory domains
    893  1.1  riastrad  *
    894  1.1  riastrad  * Most of these just align with the various caches in
    895  1.1  riastrad  * the system and are used to flush and invalidate as
    896  1.1  riastrad  * objects end up cached in different domains.
    897  1.1  riastrad  */
    898  1.1  riastrad /** CPU cache */
    899  1.1  riastrad #define I915_GEM_DOMAIN_CPU		0x00000001
    900  1.1  riastrad /** Render cache, used by 2D and 3D drawing */
    901  1.1  riastrad #define I915_GEM_DOMAIN_RENDER		0x00000002
    902  1.1  riastrad /** Sampler cache, used by texture engine */
    903  1.1  riastrad #define I915_GEM_DOMAIN_SAMPLER		0x00000004
    904  1.1  riastrad /** Command queue, used to load batch buffers */
    905  1.1  riastrad #define I915_GEM_DOMAIN_COMMAND		0x00000008
    906  1.1  riastrad /** Instruction cache, used by shader programs */
    907  1.1  riastrad #define I915_GEM_DOMAIN_INSTRUCTION	0x00000010
    908  1.1  riastrad /** Vertex address cache */
    909  1.1  riastrad #define I915_GEM_DOMAIN_VERTEX		0x00000020
    910  1.1  riastrad /** GTT domain - aperture and scanout */
    911  1.1  riastrad #define I915_GEM_DOMAIN_GTT		0x00000040
    912  1.1  riastrad /** WC domain - uncached access */
    913  1.1  riastrad #define I915_GEM_DOMAIN_WC		0x00000080
    914  1.1  riastrad /** @} */
    915  1.1  riastrad 
    916  1.1  riastrad struct drm_i915_gem_exec_object {
    917  1.1  riastrad 	/**
    918  1.1  riastrad 	 * User's handle for a buffer to be bound into the GTT for this
    919  1.1  riastrad 	 * operation.
    920  1.1  riastrad 	 */
    921  1.1  riastrad 	__u32 handle;
    922  1.1  riastrad 
    923  1.1  riastrad 	/** Number of relocations to be performed on this buffer */
    924  1.1  riastrad 	__u32 relocation_count;
    925  1.1  riastrad 	/**
    926  1.1  riastrad 	 * Pointer to array of struct drm_i915_gem_relocation_entry containing
    927  1.1  riastrad 	 * the relocations to be performed in this buffer.
    928  1.1  riastrad 	 */
    929  1.1  riastrad 	__u64 relocs_ptr;
    930  1.1  riastrad 
    931  1.1  riastrad 	/** Required alignment in graphics aperture */
    932  1.1  riastrad 	__u64 alignment;
    933  1.1  riastrad 
    934  1.1  riastrad 	/**
    935  1.1  riastrad 	 * Returned value of the updated offset of the object, for future
    936  1.1  riastrad 	 * presumed_offset writes.
    937  1.1  riastrad 	 */
    938  1.1  riastrad 	__u64 offset;
    939  1.1  riastrad };
    940  1.1  riastrad 
    941  1.1  riastrad struct drm_i915_gem_execbuffer {
    942  1.1  riastrad 	/**
    943  1.1  riastrad 	 * List of buffers to be validated with their relocations to be
    944  1.1  riastrad 	 * performend on them.
    945  1.1  riastrad 	 *
    946  1.1  riastrad 	 * This is a pointer to an array of struct drm_i915_gem_validate_entry.
    947  1.1  riastrad 	 *
    948  1.1  riastrad 	 * These buffers must be listed in an order such that all relocations
    949  1.1  riastrad 	 * a buffer is performing refer to buffers that have already appeared
    950  1.1  riastrad 	 * in the validate list.
    951  1.1  riastrad 	 */
    952  1.1  riastrad 	__u64 buffers_ptr;
    953  1.1  riastrad 	__u32 buffer_count;
    954  1.1  riastrad 
    955  1.1  riastrad 	/** Offset in the batchbuffer to start execution from. */
    956  1.1  riastrad 	__u32 batch_start_offset;
    957  1.1  riastrad 	/** Bytes used in batchbuffer from batch_start_offset */
    958  1.1  riastrad 	__u32 batch_len;
    959  1.1  riastrad 	__u32 DR1;
    960  1.1  riastrad 	__u32 DR4;
    961  1.1  riastrad 	__u32 num_cliprects;
    962  1.1  riastrad 	/** This is a struct drm_clip_rect *cliprects */
    963  1.1  riastrad 	__u64 cliprects_ptr;
    964  1.1  riastrad };
    965  1.1  riastrad 
    966  1.1  riastrad struct drm_i915_gem_exec_object2 {
    967  1.1  riastrad 	/**
    968  1.1  riastrad 	 * User's handle for a buffer to be bound into the GTT for this
    969  1.1  riastrad 	 * operation.
    970  1.1  riastrad 	 */
    971  1.1  riastrad 	__u32 handle;
    972  1.1  riastrad 
    973  1.1  riastrad 	/** Number of relocations to be performed on this buffer */
    974  1.1  riastrad 	__u32 relocation_count;
    975  1.1  riastrad 	/**
    976  1.1  riastrad 	 * Pointer to array of struct drm_i915_gem_relocation_entry containing
    977  1.1  riastrad 	 * the relocations to be performed in this buffer.
    978  1.1  riastrad 	 */
    979  1.1  riastrad 	__u64 relocs_ptr;
    980  1.1  riastrad 
    981  1.1  riastrad 	/** Required alignment in graphics aperture */
    982  1.1  riastrad 	__u64 alignment;
    983  1.1  riastrad 
    984  1.1  riastrad 	/**
    985  1.1  riastrad 	 * When the EXEC_OBJECT_PINNED flag is specified this is populated by
    986  1.1  riastrad 	 * the user with the GTT offset at which this object will be pinned.
    987  1.1  riastrad 	 * When the I915_EXEC_NO_RELOC flag is specified this must contain the
    988  1.1  riastrad 	 * presumed_offset of the object.
    989  1.1  riastrad 	 * During execbuffer2 the kernel populates it with the value of the
    990  1.1  riastrad 	 * current GTT offset of the object, for future presumed_offset writes.
    991  1.1  riastrad 	 */
    992  1.1  riastrad 	__u64 offset;
    993  1.1  riastrad 
    994  1.1  riastrad #define EXEC_OBJECT_NEEDS_FENCE		 (1<<0)
    995  1.1  riastrad #define EXEC_OBJECT_NEEDS_GTT		 (1<<1)
    996  1.1  riastrad #define EXEC_OBJECT_WRITE		 (1<<2)
    997  1.1  riastrad #define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3)
    998  1.1  riastrad #define EXEC_OBJECT_PINNED		 (1<<4)
    999  1.1  riastrad #define EXEC_OBJECT_PAD_TO_SIZE		 (1<<5)
   1000  1.1  riastrad /* The kernel implicitly tracks GPU activity on all GEM objects, and
   1001  1.1  riastrad  * synchronises operations with outstanding rendering. This includes
   1002  1.1  riastrad  * rendering on other devices if exported via dma-buf. However, sometimes
   1003  1.1  riastrad  * this tracking is too coarse and the user knows better. For example,
   1004  1.1  riastrad  * if the object is split into non-overlapping ranges shared between different
   1005  1.1  riastrad  * clients or engines (i.e. suballocating objects), the implicit tracking
   1006  1.1  riastrad  * by kernel assumes that each operation affects the whole object rather
   1007  1.1  riastrad  * than an individual range, causing needless synchronisation between clients.
   1008  1.1  riastrad  * The kernel will also forgo any CPU cache flushes prior to rendering from
   1009  1.1  riastrad  * the object as the client is expected to be also handling such domain
   1010  1.1  riastrad  * tracking.
   1011  1.1  riastrad  *
   1012  1.1  riastrad  * The kernel maintains the implicit tracking in order to manage resources
   1013  1.1  riastrad  * used by the GPU - this flag only disables the synchronisation prior to
   1014  1.1  riastrad  * rendering with this object in this execbuf.
   1015  1.1  riastrad  *
   1016  1.1  riastrad  * Opting out of implicit synhronisation requires the user to do its own
   1017  1.1  riastrad  * explicit tracking to avoid rendering corruption. See, for example,
   1018  1.1  riastrad  * I915_PARAM_HAS_EXEC_FENCE to order execbufs and execute them asynchronously.
   1019  1.1  riastrad  */
   1020  1.1  riastrad #define EXEC_OBJECT_ASYNC		(1<<6)
   1021  1.1  riastrad /* Request that the contents of this execobject be copied into the error
   1022  1.1  riastrad  * state upon a GPU hang involving this batch for post-mortem debugging.
   1023  1.1  riastrad  * These buffers are recorded in no particular order as "user" in
   1024  1.1  riastrad  * /sys/class/drm/cardN/error. Query I915_PARAM_HAS_EXEC_CAPTURE to see
   1025  1.1  riastrad  * if the kernel supports this flag.
   1026  1.1  riastrad  */
   1027  1.1  riastrad #define EXEC_OBJECT_CAPTURE		(1<<7)
   1028  1.1  riastrad /* All remaining bits are MBZ and RESERVED FOR FUTURE USE */
   1029  1.1  riastrad #define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_CAPTURE<<1)
   1030  1.1  riastrad 	__u64 flags;
   1031  1.1  riastrad 
   1032  1.1  riastrad 	union {
   1033  1.1  riastrad 		__u64 rsvd1;
   1034  1.1  riastrad 		__u64 pad_to_size;
   1035  1.1  riastrad 	};
   1036  1.1  riastrad 	__u64 rsvd2;
   1037  1.1  riastrad };
   1038  1.1  riastrad 
   1039  1.1  riastrad struct drm_i915_gem_exec_fence {
   1040  1.1  riastrad 	/**
   1041  1.1  riastrad 	 * User's handle for a drm_syncobj to wait on or signal.
   1042  1.1  riastrad 	 */
   1043  1.1  riastrad 	__u32 handle;
   1044  1.1  riastrad 
   1045  1.1  riastrad #define I915_EXEC_FENCE_WAIT            (1<<0)
   1046  1.1  riastrad #define I915_EXEC_FENCE_SIGNAL          (1<<1)
   1047  1.1  riastrad #define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1))
   1048  1.1  riastrad 	__u32 flags;
   1049  1.1  riastrad };
   1050  1.1  riastrad 
   1051  1.1  riastrad struct drm_i915_gem_execbuffer2 {
   1052  1.1  riastrad 	/**
   1053  1.1  riastrad 	 * List of gem_exec_object2 structs
   1054  1.1  riastrad 	 */
   1055  1.1  riastrad 	__u64 buffers_ptr;
   1056  1.1  riastrad 	__u32 buffer_count;
   1057  1.1  riastrad 
   1058  1.1  riastrad 	/** Offset in the batchbuffer to start execution from. */
   1059  1.1  riastrad 	__u32 batch_start_offset;
   1060  1.1  riastrad 	/** Bytes used in batchbuffer from batch_start_offset */
   1061  1.1  riastrad 	__u32 batch_len;
   1062  1.1  riastrad 	__u32 DR1;
   1063  1.1  riastrad 	__u32 DR4;
   1064  1.1  riastrad 	__u32 num_cliprects;
   1065  1.1  riastrad 	/**
   1066  1.1  riastrad 	 * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY
   1067  1.1  riastrad 	 * is not set.  If I915_EXEC_FENCE_ARRAY is set, then this is a
   1068  1.1  riastrad 	 * struct drm_i915_gem_exec_fence *fences.
   1069  1.1  riastrad 	 */
   1070  1.1  riastrad 	__u64 cliprects_ptr;
   1071  1.1  riastrad #define I915_EXEC_RING_MASK              (0x3f)
   1072  1.1  riastrad #define I915_EXEC_DEFAULT                (0<<0)
   1073  1.1  riastrad #define I915_EXEC_RENDER                 (1<<0)
   1074  1.1  riastrad #define I915_EXEC_BSD                    (2<<0)
   1075  1.1  riastrad #define I915_EXEC_BLT                    (3<<0)
   1076  1.1  riastrad #define I915_EXEC_VEBOX                  (4<<0)
   1077  1.1  riastrad 
   1078  1.1  riastrad /* Used for switching the constants addressing mode on gen4+ RENDER ring.
   1079  1.1  riastrad  * Gen6+ only supports relative addressing to dynamic state (default) and
   1080  1.1  riastrad  * absolute addressing.
   1081  1.1  riastrad  *
   1082  1.1  riastrad  * These flags are ignored for the BSD and BLT rings.
   1083  1.1  riastrad  */
   1084  1.1  riastrad #define I915_EXEC_CONSTANTS_MASK 	(3<<6)
   1085  1.1  riastrad #define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */
   1086  1.1  riastrad #define I915_EXEC_CONSTANTS_ABSOLUTE 	(1<<6)
   1087  1.1  riastrad #define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */
   1088  1.1  riastrad 	__u64 flags;
   1089  1.1  riastrad 	__u64 rsvd1; /* now used for context info */
   1090  1.1  riastrad 	__u64 rsvd2;
   1091  1.1  riastrad };
   1092  1.1  riastrad 
   1093  1.1  riastrad /** Resets the SO write offset registers for transform feedback on gen7. */
   1094  1.1  riastrad #define I915_EXEC_GEN7_SOL_RESET	(1<<8)
   1095  1.1  riastrad 
   1096  1.1  riastrad /** Request a privileged ("secure") batch buffer. Note only available for
   1097  1.1  riastrad  * DRM_ROOT_ONLY | DRM_MASTER processes.
   1098  1.1  riastrad  */
   1099  1.1  riastrad #define I915_EXEC_SECURE		(1<<9)
   1100  1.1  riastrad 
   1101  1.1  riastrad /** Inform the kernel that the batch is and will always be pinned. This
   1102  1.1  riastrad  * negates the requirement for a workaround to be performed to avoid
   1103  1.1  riastrad  * an incoherent CS (such as can be found on 830/845). If this flag is
   1104  1.1  riastrad  * not passed, the kernel will endeavour to make sure the batch is
   1105  1.1  riastrad  * coherent with the CS before execution. If this flag is passed,
   1106  1.1  riastrad  * userspace assumes the responsibility for ensuring the same.
   1107  1.1  riastrad  */
   1108  1.1  riastrad #define I915_EXEC_IS_PINNED		(1<<10)
   1109  1.1  riastrad 
   1110  1.1  riastrad /** Provide a hint to the kernel that the command stream and auxiliary
   1111  1.1  riastrad  * state buffers already holds the correct presumed addresses and so the
   1112  1.1  riastrad  * relocation process may be skipped if no buffers need to be moved in
   1113  1.1  riastrad  * preparation for the execbuffer.
   1114  1.1  riastrad  */
   1115  1.1  riastrad #define I915_EXEC_NO_RELOC		(1<<11)
   1116  1.1  riastrad 
   1117  1.1  riastrad /** Use the reloc.handle as an index into the exec object array rather
   1118  1.1  riastrad  * than as the per-file handle.
   1119  1.1  riastrad  */
   1120  1.1  riastrad #define I915_EXEC_HANDLE_LUT		(1<<12)
   1121  1.1  riastrad 
   1122  1.1  riastrad /** Used for switching BSD rings on the platforms with two BSD rings */
   1123  1.1  riastrad #define I915_EXEC_BSD_SHIFT	 (13)
   1124  1.1  riastrad #define I915_EXEC_BSD_MASK	 (3 << I915_EXEC_BSD_SHIFT)
   1125  1.1  riastrad /* default ping-pong mode */
   1126  1.1  riastrad #define I915_EXEC_BSD_DEFAULT	 (0 << I915_EXEC_BSD_SHIFT)
   1127  1.1  riastrad #define I915_EXEC_BSD_RING1	 (1 << I915_EXEC_BSD_SHIFT)
   1128  1.1  riastrad #define I915_EXEC_BSD_RING2	 (2 << I915_EXEC_BSD_SHIFT)
   1129  1.1  riastrad 
   1130  1.1  riastrad /** Tell the kernel that the batchbuffer is processed by
   1131  1.1  riastrad  *  the resource streamer.
   1132  1.1  riastrad  */
   1133  1.1  riastrad #define I915_EXEC_RESOURCE_STREAMER     (1<<15)
   1134  1.1  riastrad 
   1135  1.1  riastrad /* Setting I915_EXEC_FENCE_IN implies that lower_32_bits(rsvd2) represent
   1136  1.1  riastrad  * a sync_file fd to wait upon (in a nonblocking manner) prior to executing
   1137  1.1  riastrad  * the batch.
   1138  1.1  riastrad  *
   1139  1.1  riastrad  * Returns -EINVAL if the sync_file fd cannot be found.
   1140  1.1  riastrad  */
   1141  1.1  riastrad #define I915_EXEC_FENCE_IN		(1<<16)
   1142  1.1  riastrad 
   1143  1.1  riastrad /* Setting I915_EXEC_FENCE_OUT causes the ioctl to return a sync_file fd
   1144  1.1  riastrad  * in the upper_32_bits(rsvd2) upon success. Ownership of the fd is given
   1145  1.1  riastrad  * to the caller, and it should be close() after use. (The fd is a regular
   1146  1.1  riastrad  * file descriptor and will be cleaned up on process termination. It holds
   1147  1.1  riastrad  * a reference to the request, but nothing else.)
   1148  1.1  riastrad  *
   1149  1.1  riastrad  * The sync_file fd can be combined with other sync_file and passed either
   1150  1.1  riastrad  * to execbuf using I915_EXEC_FENCE_IN, to atomic KMS ioctls (so that a flip
   1151  1.1  riastrad  * will only occur after this request completes), or to other devices.
   1152  1.1  riastrad  *
   1153  1.1  riastrad  * Using I915_EXEC_FENCE_OUT requires use of
   1154  1.1  riastrad  * DRM_IOCTL_I915_GEM_EXECBUFFER2_WR ioctl so that the result is written
   1155  1.1  riastrad  * back to userspace. Failure to do so will cause the out-fence to always
   1156  1.1  riastrad  * be reported as zero, and the real fence fd to be leaked.
   1157  1.1  riastrad  */
   1158  1.1  riastrad #define I915_EXEC_FENCE_OUT		(1<<17)
   1159  1.1  riastrad 
   1160  1.1  riastrad /*
   1161  1.1  riastrad  * Traditionally the execbuf ioctl has only considered the final element in
   1162  1.1  riastrad  * the execobject[] to be the executable batch. Often though, the client
   1163  1.1  riastrad  * will known the batch object prior to construction and being able to place
   1164  1.1  riastrad  * it into the execobject[] array first can simplify the relocation tracking.
   1165  1.1  riastrad  * Setting I915_EXEC_BATCH_FIRST tells execbuf to use element 0 of the
   1166  1.1  riastrad  * execobject[] as the * batch instead (the default is to use the last
   1167  1.1  riastrad  * element).
   1168  1.1  riastrad  */
   1169  1.1  riastrad #define I915_EXEC_BATCH_FIRST		(1<<18)
   1170  1.1  riastrad 
   1171  1.1  riastrad /* Setting I915_FENCE_ARRAY implies that num_cliprects and cliprects_ptr
   1172  1.1  riastrad  * define an array of i915_gem_exec_fence structures which specify a set of
   1173  1.1  riastrad  * dma fences to wait upon or signal.
   1174  1.1  riastrad  */
   1175  1.1  riastrad #define I915_EXEC_FENCE_ARRAY   (1<<19)
   1176  1.1  riastrad 
   1177  1.1  riastrad /*
   1178  1.1  riastrad  * Setting I915_EXEC_FENCE_SUBMIT implies that lower_32_bits(rsvd2) represent
   1179  1.1  riastrad  * a sync_file fd to wait upon (in a nonblocking manner) prior to executing
   1180  1.1  riastrad  * the batch.
   1181  1.1  riastrad  *
   1182  1.1  riastrad  * Returns -EINVAL if the sync_file fd cannot be found.
   1183  1.1  riastrad  */
   1184  1.1  riastrad #define I915_EXEC_FENCE_SUBMIT		(1 << 20)
   1185  1.1  riastrad 
   1186  1.1  riastrad #define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SUBMIT << 1))
   1187  1.1  riastrad 
   1188  1.1  riastrad #define I915_EXEC_CONTEXT_ID_MASK	(0xffffffff)
   1189  1.1  riastrad #define i915_execbuffer2_set_context_id(eb2, context) \
   1190  1.1  riastrad 	(eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
   1191  1.1  riastrad #define i915_execbuffer2_get_context_id(eb2) \
   1192  1.1  riastrad 	((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
   1193  1.1  riastrad 
   1194  1.1  riastrad struct drm_i915_gem_pin {
   1195  1.1  riastrad 	/** Handle of the buffer to be pinned. */
   1196  1.1  riastrad 	__u32 handle;
   1197  1.1  riastrad 	__u32 pad;
   1198  1.1  riastrad 
   1199  1.1  riastrad 	/** alignment required within the aperture */
   1200  1.1  riastrad 	__u64 alignment;
   1201  1.1  riastrad 
   1202  1.1  riastrad 	/** Returned GTT offset of the buffer. */
   1203  1.1  riastrad 	__u64 offset;
   1204  1.1  riastrad };
   1205  1.1  riastrad 
   1206  1.1  riastrad struct drm_i915_gem_unpin {
   1207  1.1  riastrad 	/** Handle of the buffer to be unpinned. */
   1208  1.1  riastrad 	__u32 handle;
   1209  1.1  riastrad 	__u32 pad;
   1210  1.1  riastrad };
   1211  1.1  riastrad 
   1212  1.1  riastrad struct drm_i915_gem_busy {
   1213  1.1  riastrad 	/** Handle of the buffer to check for busy */
   1214  1.1  riastrad 	__u32 handle;
   1215  1.1  riastrad 
   1216  1.1  riastrad 	/** Return busy status
   1217  1.1  riastrad 	 *
   1218  1.1  riastrad 	 * A return of 0 implies that the object is idle (after
   1219  1.1  riastrad 	 * having flushed any pending activity), and a non-zero return that
   1220  1.1  riastrad 	 * the object is still in-flight on the GPU. (The GPU has not yet
   1221  1.1  riastrad 	 * signaled completion for all pending requests that reference the
   1222  1.1  riastrad 	 * object.) An object is guaranteed to become idle eventually (so
   1223  1.1  riastrad 	 * long as no new GPU commands are executed upon it). Due to the
   1224  1.1  riastrad 	 * asynchronous nature of the hardware, an object reported
   1225  1.1  riastrad 	 * as busy may become idle before the ioctl is completed.
   1226  1.1  riastrad 	 *
   1227  1.1  riastrad 	 * Furthermore, if the object is busy, which engine is busy is only
   1228  1.1  riastrad 	 * provided as a guide and only indirectly by reporting its class
   1229  1.1  riastrad 	 * (there may be more than one engine in each class). There are race
   1230  1.1  riastrad 	 * conditions which prevent the report of which engines are busy from
   1231  1.1  riastrad 	 * being always accurate.  However, the converse is not true. If the
   1232  1.1  riastrad 	 * object is idle, the result of the ioctl, that all engines are idle,
   1233  1.1  riastrad 	 * is accurate.
   1234  1.1  riastrad 	 *
   1235  1.1  riastrad 	 * The returned dword is split into two fields to indicate both
   1236  1.1  riastrad 	 * the engine classess on which the object is being read, and the
   1237  1.1  riastrad 	 * engine class on which it is currently being written (if any).
   1238  1.1  riastrad 	 *
   1239  1.1  riastrad 	 * The low word (bits 0:15) indicate if the object is being written
   1240  1.1  riastrad 	 * to by any engine (there can only be one, as the GEM implicit
   1241  1.1  riastrad 	 * synchronisation rules force writes to be serialised). Only the
   1242  1.1  riastrad 	 * engine class (offset by 1, I915_ENGINE_CLASS_RENDER is reported as
   1243  1.1  riastrad 	 * 1 not 0 etc) for the last write is reported.
   1244  1.1  riastrad 	 *
   1245  1.1  riastrad 	 * The high word (bits 16:31) are a bitmask of which engines classes
   1246  1.1  riastrad 	 * are currently reading from the object. Multiple engines may be
   1247  1.1  riastrad 	 * reading from the object simultaneously.
   1248  1.1  riastrad 	 *
   1249  1.1  riastrad 	 * The value of each engine class is the same as specified in the
   1250  1.1  riastrad 	 * I915_CONTEXT_SET_ENGINES parameter and via perf, i.e.
   1251  1.1  riastrad 	 * I915_ENGINE_CLASS_RENDER, I915_ENGINE_CLASS_COPY, etc.
   1252  1.1  riastrad 	 * reported as active itself. Some hardware may have parallel
   1253  1.1  riastrad 	 * execution engines, e.g. multiple media engines, which are
   1254  1.1  riastrad 	 * mapped to the same class identifier and so are not separately
   1255  1.1  riastrad 	 * reported for busyness.
   1256  1.1  riastrad 	 *
   1257  1.1  riastrad 	 * Caveat emptor:
   1258  1.1  riastrad 	 * Only the boolean result of this query is reliable; that is whether
   1259  1.1  riastrad 	 * the object is idle or busy. The report of which engines are busy
   1260  1.1  riastrad 	 * should be only used as a heuristic.
   1261  1.1  riastrad 	 */
   1262  1.1  riastrad 	__u32 busy;
   1263  1.1  riastrad };
   1264  1.1  riastrad 
   1265  1.1  riastrad /**
   1266  1.1  riastrad  * I915_CACHING_NONE
   1267  1.1  riastrad  *
   1268  1.1  riastrad  * GPU access is not coherent with cpu caches. Default for machines without an
   1269  1.1  riastrad  * LLC.
   1270  1.1  riastrad  */
   1271  1.1  riastrad #define I915_CACHING_NONE		0
   1272  1.1  riastrad /**
   1273  1.1  riastrad  * I915_CACHING_CACHED
   1274  1.1  riastrad  *
   1275  1.1  riastrad  * GPU access is coherent with cpu caches and furthermore the data is cached in
   1276  1.1  riastrad  * last-level caches shared between cpu cores and the gpu GT. Default on
   1277  1.1  riastrad  * machines with HAS_LLC.
   1278  1.1  riastrad  */
   1279  1.1  riastrad #define I915_CACHING_CACHED		1
   1280  1.1  riastrad /**
   1281  1.1  riastrad  * I915_CACHING_DISPLAY
   1282  1.1  riastrad  *
   1283  1.1  riastrad  * Special GPU caching mode which is coherent with the scanout engines.
   1284  1.1  riastrad  * Transparently falls back to I915_CACHING_NONE on platforms where no special
   1285  1.1  riastrad  * cache mode (like write-through or gfdt flushing) is available. The kernel
   1286  1.1  riastrad  * automatically sets this mode when using a buffer as a scanout target.
   1287  1.1  riastrad  * Userspace can manually set this mode to avoid a costly stall and clflush in
   1288  1.1  riastrad  * the hotpath of drawing the first frame.
   1289  1.1  riastrad  */
   1290  1.1  riastrad #define I915_CACHING_DISPLAY		2
   1291  1.1  riastrad 
   1292  1.1  riastrad struct drm_i915_gem_caching {
   1293  1.1  riastrad 	/**
   1294  1.1  riastrad 	 * Handle of the buffer to set/get the caching level of. */
   1295  1.1  riastrad 	__u32 handle;
   1296  1.1  riastrad 
   1297  1.1  riastrad 	/**
   1298  1.1  riastrad 	 * Cacheing level to apply or return value
   1299  1.1  riastrad 	 *
   1300  1.1  riastrad 	 * bits0-15 are for generic caching control (i.e. the above defined
   1301  1.1  riastrad 	 * values). bits16-31 are reserved for platform-specific variations
   1302  1.1  riastrad 	 * (e.g. l3$ caching on gen7). */
   1303  1.1  riastrad 	__u32 caching;
   1304  1.1  riastrad };
   1305  1.1  riastrad 
   1306  1.1  riastrad #define I915_TILING_NONE	0
   1307  1.1  riastrad #define I915_TILING_X		1
   1308  1.1  riastrad #define I915_TILING_Y		2
   1309  1.1  riastrad #define I915_TILING_LAST	I915_TILING_Y
   1310  1.1  riastrad 
   1311  1.1  riastrad #define I915_BIT_6_SWIZZLE_NONE		0
   1312  1.1  riastrad #define I915_BIT_6_SWIZZLE_9		1
   1313  1.1  riastrad #define I915_BIT_6_SWIZZLE_9_10		2
   1314  1.1  riastrad #define I915_BIT_6_SWIZZLE_9_11		3
   1315  1.1  riastrad #define I915_BIT_6_SWIZZLE_9_10_11	4
   1316  1.1  riastrad /* Not seen by userland */
   1317  1.1  riastrad #define I915_BIT_6_SWIZZLE_UNKNOWN	5
   1318  1.1  riastrad /* Seen by userland. */
   1319  1.1  riastrad #define I915_BIT_6_SWIZZLE_9_17		6
   1320  1.1  riastrad #define I915_BIT_6_SWIZZLE_9_10_17	7
   1321  1.1  riastrad 
   1322  1.1  riastrad struct drm_i915_gem_set_tiling {
   1323  1.1  riastrad 	/** Handle of the buffer to have its tiling state updated */
   1324  1.1  riastrad 	__u32 handle;
   1325  1.1  riastrad 
   1326  1.1  riastrad 	/**
   1327  1.1  riastrad 	 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
   1328  1.1  riastrad 	 * I915_TILING_Y).
   1329  1.1  riastrad 	 *
   1330  1.1  riastrad 	 * This value is to be set on request, and will be updated by the
   1331  1.1  riastrad 	 * kernel on successful return with the actual chosen tiling layout.
   1332  1.1  riastrad 	 *
   1333  1.1  riastrad 	 * The tiling mode may be demoted to I915_TILING_NONE when the system
   1334  1.1  riastrad 	 * has bit 6 swizzling that can't be managed correctly by GEM.
   1335  1.1  riastrad 	 *
   1336  1.1  riastrad 	 * Buffer contents become undefined when changing tiling_mode.
   1337  1.1  riastrad 	 */
   1338  1.1  riastrad 	__u32 tiling_mode;
   1339  1.1  riastrad 
   1340  1.1  riastrad 	/**
   1341  1.1  riastrad 	 * Stride in bytes for the object when in I915_TILING_X or
   1342  1.1  riastrad 	 * I915_TILING_Y.
   1343  1.1  riastrad 	 */
   1344  1.1  riastrad 	__u32 stride;
   1345  1.1  riastrad 
   1346  1.1  riastrad 	/**
   1347  1.1  riastrad 	 * Returned address bit 6 swizzling required for CPU access through
   1348  1.1  riastrad 	 * mmap mapping.
   1349  1.1  riastrad 	 */
   1350  1.1  riastrad 	__u32 swizzle_mode;
   1351  1.1  riastrad };
   1352  1.1  riastrad 
   1353  1.1  riastrad struct drm_i915_gem_get_tiling {
   1354  1.1  riastrad 	/** Handle of the buffer to get tiling state for. */
   1355  1.1  riastrad 	__u32 handle;
   1356  1.1  riastrad 
   1357  1.1  riastrad 	/**
   1358  1.1  riastrad 	 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
   1359  1.1  riastrad 	 * I915_TILING_Y).
   1360  1.1  riastrad 	 */
   1361  1.1  riastrad 	__u32 tiling_mode;
   1362  1.1  riastrad 
   1363  1.1  riastrad 	/**
   1364  1.1  riastrad 	 * Returned address bit 6 swizzling required for CPU access through
   1365  1.1  riastrad 	 * mmap mapping.
   1366  1.1  riastrad 	 */
   1367  1.1  riastrad 	__u32 swizzle_mode;
   1368  1.1  riastrad 
   1369  1.1  riastrad 	/**
   1370  1.1  riastrad 	 * Returned address bit 6 swizzling required for CPU access through
   1371  1.1  riastrad 	 * mmap mapping whilst bound.
   1372  1.1  riastrad 	 */
   1373  1.1  riastrad 	__u32 phys_swizzle_mode;
   1374  1.1  riastrad };
   1375  1.1  riastrad 
   1376  1.1  riastrad struct drm_i915_gem_get_aperture {
   1377  1.1  riastrad 	/** Total size of the aperture used by i915_gem_execbuffer, in bytes */
   1378  1.1  riastrad 	__u64 aper_size;
   1379  1.1  riastrad 
   1380  1.1  riastrad 	/**
   1381  1.1  riastrad 	 * Available space in the aperture used by i915_gem_execbuffer, in
   1382  1.1  riastrad 	 * bytes
   1383  1.1  riastrad 	 */
   1384  1.1  riastrad 	__u64 aper_available_size;
   1385  1.1  riastrad };
   1386  1.1  riastrad 
   1387  1.1  riastrad struct drm_i915_get_pipe_from_crtc_id {
   1388  1.1  riastrad 	/** ID of CRTC being requested **/
   1389  1.1  riastrad 	__u32 crtc_id;
   1390  1.1  riastrad 
   1391  1.1  riastrad 	/** pipe of requested CRTC **/
   1392  1.1  riastrad 	__u32 pipe;
   1393  1.1  riastrad };
   1394  1.1  riastrad 
   1395  1.1  riastrad #define I915_MADV_WILLNEED 0
   1396  1.1  riastrad #define I915_MADV_DONTNEED 1
   1397  1.1  riastrad #define __I915_MADV_PURGED 2 /* internal state */
   1398  1.1  riastrad 
   1399  1.1  riastrad struct drm_i915_gem_madvise {
   1400  1.1  riastrad 	/** Handle of the buffer to change the backing store advice */
   1401  1.1  riastrad 	__u32 handle;
   1402  1.1  riastrad 
   1403  1.1  riastrad 	/* Advice: either the buffer will be needed again in the near future,
   1404  1.1  riastrad 	 *         or wont be and could be discarded under memory pressure.
   1405  1.1  riastrad 	 */
   1406  1.1  riastrad 	__u32 madv;
   1407  1.1  riastrad 
   1408  1.1  riastrad 	/** Whether the backing store still exists. */
   1409  1.1  riastrad 	__u32 retained;
   1410  1.1  riastrad };
   1411  1.1  riastrad 
   1412  1.1  riastrad /* flags */
   1413  1.1  riastrad #define I915_OVERLAY_TYPE_MASK 		0xff
   1414  1.1  riastrad #define I915_OVERLAY_YUV_PLANAR 	0x01
   1415  1.1  riastrad #define I915_OVERLAY_YUV_PACKED 	0x02
   1416  1.1  riastrad #define I915_OVERLAY_RGB		0x03
   1417  1.1  riastrad 
   1418  1.1  riastrad #define I915_OVERLAY_DEPTH_MASK		0xff00
   1419  1.1  riastrad #define I915_OVERLAY_RGB24		0x1000
   1420  1.1  riastrad #define I915_OVERLAY_RGB16		0x2000
   1421  1.1  riastrad #define I915_OVERLAY_RGB15		0x3000
   1422  1.1  riastrad #define I915_OVERLAY_YUV422		0x0100
   1423  1.1  riastrad #define I915_OVERLAY_YUV411		0x0200
   1424  1.1  riastrad #define I915_OVERLAY_YUV420		0x0300
   1425  1.1  riastrad #define I915_OVERLAY_YUV410		0x0400
   1426  1.1  riastrad 
   1427  1.1  riastrad #define I915_OVERLAY_SWAP_MASK		0xff0000
   1428  1.1  riastrad #define I915_OVERLAY_NO_SWAP		0x000000
   1429  1.1  riastrad #define I915_OVERLAY_UV_SWAP		0x010000
   1430  1.1  riastrad #define I915_OVERLAY_Y_SWAP		0x020000
   1431  1.1  riastrad #define I915_OVERLAY_Y_AND_UV_SWAP	0x030000
   1432  1.1  riastrad 
   1433  1.1  riastrad #define I915_OVERLAY_FLAGS_MASK		0xff000000
   1434  1.1  riastrad #define I915_OVERLAY_ENABLE		0x01000000
   1435  1.1  riastrad 
   1436  1.1  riastrad struct drm_intel_overlay_put_image {
   1437  1.1  riastrad 	/* various flags and src format description */
   1438  1.1  riastrad 	__u32 flags;
   1439  1.1  riastrad 	/* source picture description */
   1440  1.1  riastrad 	__u32 bo_handle;
   1441  1.1  riastrad 	/* stride values and offsets are in bytes, buffer relative */
   1442  1.1  riastrad 	__u16 stride_Y; /* stride for packed formats */
   1443  1.1  riastrad 	__u16 stride_UV;
   1444  1.1  riastrad 	__u32 offset_Y; /* offset for packet formats */
   1445  1.1  riastrad 	__u32 offset_U;
   1446  1.1  riastrad 	__u32 offset_V;
   1447  1.1  riastrad 	/* in pixels */
   1448  1.1  riastrad 	__u16 src_width;
   1449  1.1  riastrad 	__u16 src_height;
   1450  1.1  riastrad 	/* to compensate the scaling factors for partially covered surfaces */
   1451  1.1  riastrad 	__u16 src_scan_width;
   1452  1.1  riastrad 	__u16 src_scan_height;
   1453  1.1  riastrad 	/* output crtc description */
   1454  1.1  riastrad 	__u32 crtc_id;
   1455  1.1  riastrad 	__u16 dst_x;
   1456  1.1  riastrad 	__u16 dst_y;
   1457  1.1  riastrad 	__u16 dst_width;
   1458  1.1  riastrad 	__u16 dst_height;
   1459  1.1  riastrad };
   1460  1.1  riastrad 
   1461  1.1  riastrad /* flags */
   1462  1.1  riastrad #define I915_OVERLAY_UPDATE_ATTRS	(1<<0)
   1463  1.1  riastrad #define I915_OVERLAY_UPDATE_GAMMA	(1<<1)
   1464  1.1  riastrad #define I915_OVERLAY_DISABLE_DEST_COLORKEY	(1<<2)
   1465  1.1  riastrad struct drm_intel_overlay_attrs {
   1466  1.1  riastrad 	__u32 flags;
   1467  1.1  riastrad 	__u32 color_key;
   1468  1.1  riastrad 	__s32 brightness;
   1469  1.1  riastrad 	__u32 contrast;
   1470  1.1  riastrad 	__u32 saturation;
   1471  1.1  riastrad 	__u32 gamma0;
   1472  1.1  riastrad 	__u32 gamma1;
   1473  1.1  riastrad 	__u32 gamma2;
   1474  1.1  riastrad 	__u32 gamma3;
   1475  1.1  riastrad 	__u32 gamma4;
   1476  1.1  riastrad 	__u32 gamma5;
   1477  1.1  riastrad };
   1478  1.1  riastrad 
   1479  1.1  riastrad /*
   1480  1.1  riastrad  * Intel sprite handling
   1481  1.1  riastrad  *
   1482  1.1  riastrad  * Color keying works with a min/mask/max tuple.  Both source and destination
   1483  1.1  riastrad  * color keying is allowed.
   1484  1.1  riastrad  *
   1485  1.1  riastrad  * Source keying:
   1486  1.1  riastrad  * Sprite pixels within the min & max values, masked against the color channels
   1487  1.1  riastrad  * specified in the mask field, will be transparent.  All other pixels will
   1488  1.1  riastrad  * be displayed on top of the primary plane.  For RGB surfaces, only the min
   1489  1.1  riastrad  * and mask fields will be used; ranged compares are not allowed.
   1490  1.1  riastrad  *
   1491  1.1  riastrad  * Destination keying:
   1492  1.1  riastrad  * Primary plane pixels that match the min value, masked against the color
   1493  1.1  riastrad  * channels specified in the mask field, will be replaced by corresponding
   1494  1.1  riastrad  * pixels from the sprite plane.
   1495  1.1  riastrad  *
   1496  1.1  riastrad  * Note that source & destination keying are exclusive; only one can be
   1497  1.1  riastrad  * active on a given plane.
   1498  1.1  riastrad  */
   1499  1.1  riastrad 
   1500  1.1  riastrad #define I915_SET_COLORKEY_NONE		(1<<0) /* Deprecated. Instead set
   1501  1.1  riastrad 						* flags==0 to disable colorkeying.
   1502  1.1  riastrad 						*/
   1503  1.1  riastrad #define I915_SET_COLORKEY_DESTINATION	(1<<1)
   1504  1.1  riastrad #define I915_SET_COLORKEY_SOURCE	(1<<2)
   1505  1.1  riastrad struct drm_intel_sprite_colorkey {
   1506  1.1  riastrad 	__u32 plane_id;
   1507  1.1  riastrad 	__u32 min_value;
   1508  1.1  riastrad 	__u32 channel_mask;
   1509  1.1  riastrad 	__u32 max_value;
   1510  1.1  riastrad 	__u32 flags;
   1511  1.1  riastrad };
   1512  1.1  riastrad 
   1513  1.1  riastrad struct drm_i915_gem_wait {
   1514  1.1  riastrad 	/** Handle of BO we shall wait on */
   1515  1.1  riastrad 	__u32 bo_handle;
   1516  1.1  riastrad 	__u32 flags;
   1517  1.1  riastrad 	/** Number of nanoseconds to wait, Returns time remaining. */
   1518  1.1  riastrad 	__s64 timeout_ns;
   1519  1.1  riastrad };
   1520  1.1  riastrad 
   1521  1.1  riastrad struct drm_i915_gem_context_create {
   1522  1.1  riastrad 	__u32 ctx_id; /* output: id of new context*/
   1523  1.1  riastrad 	__u32 pad;
   1524  1.1  riastrad };
   1525  1.1  riastrad 
   1526  1.1  riastrad struct drm_i915_gem_context_create_ext {
   1527  1.1  riastrad 	__u32 ctx_id; /* output: id of new context*/
   1528  1.1  riastrad 	__u32 flags;
   1529  1.1  riastrad #define I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS	(1u << 0)
   1530  1.1  riastrad #define I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE	(1u << 1)
   1531  1.1  riastrad #define I915_CONTEXT_CREATE_FLAGS_UNKNOWN \
   1532  1.1  riastrad 	(-(I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE << 1))
   1533  1.1  riastrad 	__u64 extensions;
   1534  1.1  riastrad };
   1535  1.1  riastrad 
   1536  1.1  riastrad struct drm_i915_gem_context_param {
   1537  1.1  riastrad 	__u32 ctx_id;
   1538  1.1  riastrad 	__u32 size;
   1539  1.1  riastrad 	__u64 param;
   1540  1.1  riastrad #define I915_CONTEXT_PARAM_BAN_PERIOD	0x1
   1541  1.1  riastrad #define I915_CONTEXT_PARAM_NO_ZEROMAP	0x2
   1542  1.1  riastrad #define I915_CONTEXT_PARAM_GTT_SIZE	0x3
   1543  1.1  riastrad #define I915_CONTEXT_PARAM_NO_ERROR_CAPTURE	0x4
   1544  1.1  riastrad #define I915_CONTEXT_PARAM_BANNABLE	0x5
   1545  1.1  riastrad #define I915_CONTEXT_PARAM_PRIORITY	0x6
   1546  1.1  riastrad #define   I915_CONTEXT_MAX_USER_PRIORITY	1023 /* inclusive */
   1547  1.1  riastrad #define   I915_CONTEXT_DEFAULT_PRIORITY		0
   1548  1.1  riastrad #define   I915_CONTEXT_MIN_USER_PRIORITY	-1023 /* inclusive */
   1549  1.1  riastrad 	/*
   1550  1.1  riastrad 	 * When using the following param, value should be a pointer to
   1551  1.1  riastrad 	 * drm_i915_gem_context_param_sseu.
   1552  1.1  riastrad 	 */
   1553  1.1  riastrad #define I915_CONTEXT_PARAM_SSEU		0x7
   1554  1.1  riastrad 
   1555  1.1  riastrad /*
   1556  1.1  riastrad  * Not all clients may want to attempt automatic recover of a context after
   1557  1.1  riastrad  * a hang (for example, some clients may only submit very small incremental
   1558  1.1  riastrad  * batches relying on known logical state of previous batches which will never
   1559  1.1  riastrad  * recover correctly and each attempt will hang), and so would prefer that
   1560  1.1  riastrad  * the context is forever banned instead.
   1561  1.1  riastrad  *
   1562  1.1  riastrad  * If set to false (0), after a reset, subsequent (and in flight) rendering
   1563  1.1  riastrad  * from this context is discarded, and the client will need to create a new
   1564  1.1  riastrad  * context to use instead.
   1565  1.1  riastrad  *
   1566  1.1  riastrad  * If set to true (1), the kernel will automatically attempt to recover the
   1567  1.1  riastrad  * context by skipping the hanging batch and executing the next batch starting
   1568  1.1  riastrad  * from the default context state (discarding the incomplete logical context
   1569  1.1  riastrad  * state lost due to the reset).
   1570  1.1  riastrad  *
   1571  1.1  riastrad  * On creation, all new contexts are marked as recoverable.
   1572  1.1  riastrad  */
   1573  1.1  riastrad #define I915_CONTEXT_PARAM_RECOVERABLE	0x8
   1574  1.1  riastrad 
   1575  1.1  riastrad 	/*
   1576  1.1  riastrad 	 * The id of the associated virtual memory address space (ppGTT) of
   1577  1.1  riastrad 	 * this context. Can be retrieved and passed to another context
   1578  1.1  riastrad 	 * (on the same fd) for both to use the same ppGTT and so share
   1579  1.1  riastrad 	 * address layouts, and avoid reloading the page tables on context
   1580  1.1  riastrad 	 * switches between themselves.
   1581  1.1  riastrad 	 *
   1582  1.1  riastrad 	 * See DRM_I915_GEM_VM_CREATE and DRM_I915_GEM_VM_DESTROY.
   1583  1.1  riastrad 	 */
   1584  1.1  riastrad #define I915_CONTEXT_PARAM_VM		0x9
   1585  1.1  riastrad 
   1586  1.1  riastrad /*
   1587  1.1  riastrad  * I915_CONTEXT_PARAM_ENGINES:
   1588  1.1  riastrad  *
   1589  1.1  riastrad  * Bind this context to operate on this subset of available engines. Henceforth,
   1590  1.1  riastrad  * the I915_EXEC_RING selector for DRM_IOCTL_I915_GEM_EXECBUFFER2 operates as
   1591  1.1  riastrad  * an index into this array of engines; I915_EXEC_DEFAULT selecting engine[0]
   1592  1.1  riastrad  * and upwards. Slots 0...N are filled in using the specified (class, instance).
   1593  1.1  riastrad  * Use
   1594  1.1  riastrad  *	engine_class: I915_ENGINE_CLASS_INVALID,
   1595  1.1  riastrad  *	engine_instance: I915_ENGINE_CLASS_INVALID_NONE
   1596  1.1  riastrad  * to specify a gap in the array that can be filled in later, e.g. by a
   1597  1.1  riastrad  * virtual engine used for load balancing.
   1598  1.1  riastrad  *
   1599  1.1  riastrad  * Setting the number of engines bound to the context to 0, by passing a zero
   1600  1.1  riastrad  * sized argument, will revert back to default settings.
   1601  1.1  riastrad  *
   1602  1.1  riastrad  * See struct i915_context_param_engines.
   1603  1.1  riastrad  *
   1604  1.1  riastrad  * Extensions:
   1605  1.1  riastrad  *   i915_context_engines_load_balance (I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE)
   1606  1.1  riastrad  *   i915_context_engines_bond (I915_CONTEXT_ENGINES_EXT_BOND)
   1607  1.1  riastrad  */
   1608  1.1  riastrad #define I915_CONTEXT_PARAM_ENGINES	0xa
   1609  1.1  riastrad 
   1610  1.1  riastrad /*
   1611  1.1  riastrad  * I915_CONTEXT_PARAM_PERSISTENCE:
   1612  1.1  riastrad  *
   1613  1.1  riastrad  * Allow the context and active rendering to survive the process until
   1614  1.1  riastrad  * completion. Persistence allows fire-and-forget clients to queue up a
   1615  1.1  riastrad  * bunch of work, hand the output over to a display server and then quit.
   1616  1.1  riastrad  * If the context is marked as not persistent, upon closing (either via
   1617  1.1  riastrad  * an explicit DRM_I915_GEM_CONTEXT_DESTROY or implicitly from file closure
   1618  1.1  riastrad  * or process termination), the context and any outstanding requests will be
   1619  1.1  riastrad  * cancelled (and exported fences for cancelled requests marked as -EIO).
   1620  1.1  riastrad  *
   1621  1.1  riastrad  * By default, new contexts allow persistence.
   1622  1.1  riastrad  */
   1623  1.1  riastrad #define I915_CONTEXT_PARAM_PERSISTENCE	0xb
   1624  1.1  riastrad /* Must be kept compact -- no holes and well documented */
   1625  1.1  riastrad 
   1626  1.1  riastrad 	__u64 value;
   1627  1.1  riastrad };
   1628  1.1  riastrad 
   1629  1.1  riastrad /**
   1630  1.1  riastrad  * Context SSEU programming
   1631  1.1  riastrad  *
   1632  1.1  riastrad  * It may be necessary for either functional or performance reason to configure
   1633  1.1  riastrad  * a context to run with a reduced number of SSEU (where SSEU stands for Slice/
   1634  1.1  riastrad  * Sub-slice/EU).
   1635  1.1  riastrad  *
   1636  1.1  riastrad  * This is done by configuring SSEU configuration using the below
   1637  1.1  riastrad  * @struct drm_i915_gem_context_param_sseu for every supported engine which
   1638  1.1  riastrad  * userspace intends to use.
   1639  1.1  riastrad  *
   1640  1.1  riastrad  * Not all GPUs or engines support this functionality in which case an error
   1641  1.1  riastrad  * code -ENODEV will be returned.
   1642  1.1  riastrad  *
   1643  1.1  riastrad  * Also, flexibility of possible SSEU configuration permutations varies between
   1644  1.1  riastrad  * GPU generations and software imposed limitations. Requesting such a
   1645  1.1  riastrad  * combination will return an error code of -EINVAL.
   1646  1.1  riastrad  *
   1647  1.1  riastrad  * NOTE: When perf/OA is active the context's SSEU configuration is ignored in
   1648  1.1  riastrad  * favour of a single global setting.
   1649  1.1  riastrad  */
   1650  1.1  riastrad struct drm_i915_gem_context_param_sseu {
   1651  1.1  riastrad 	/*
   1652  1.1  riastrad 	 * Engine class & instance to be configured or queried.
   1653  1.1  riastrad 	 */
   1654  1.1  riastrad 	struct i915_engine_class_instance engine;
   1655  1.1  riastrad 
   1656  1.1  riastrad 	/*
   1657  1.1  riastrad 	 * Unknown flags must be cleared to zero.
   1658  1.1  riastrad 	 */
   1659  1.1  riastrad 	__u32 flags;
   1660  1.1  riastrad #define I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX (1u << 0)
   1661  1.1  riastrad 
   1662  1.1  riastrad 	/*
   1663  1.1  riastrad 	 * Mask of slices to enable for the context. Valid values are a subset
   1664  1.1  riastrad 	 * of the bitmask value returned for I915_PARAM_SLICE_MASK.
   1665  1.1  riastrad 	 */
   1666  1.1  riastrad 	__u64 slice_mask;
   1667  1.1  riastrad 
   1668  1.1  riastrad 	/*
   1669  1.1  riastrad 	 * Mask of subslices to enable for the context. Valid values are a
   1670  1.1  riastrad 	 * subset of the bitmask value return by I915_PARAM_SUBSLICE_MASK.
   1671  1.1  riastrad 	 */
   1672  1.1  riastrad 	__u64 subslice_mask;
   1673  1.1  riastrad 
   1674  1.1  riastrad 	/*
   1675  1.1  riastrad 	 * Minimum/Maximum number of EUs to enable per subslice for the
   1676  1.1  riastrad 	 * context. min_eus_per_subslice must be inferior or equal to
   1677  1.1  riastrad 	 * max_eus_per_subslice.
   1678  1.1  riastrad 	 */
   1679  1.1  riastrad 	__u16 min_eus_per_subslice;
   1680  1.1  riastrad 	__u16 max_eus_per_subslice;
   1681  1.1  riastrad 
   1682  1.1  riastrad 	/*
   1683  1.1  riastrad 	 * Unused for now. Must be cleared to zero.
   1684  1.1  riastrad 	 */
   1685  1.1  riastrad 	__u32 rsvd;
   1686  1.1  riastrad };
   1687  1.1  riastrad 
   1688  1.1  riastrad /*
   1689  1.1  riastrad  * i915_context_engines_load_balance:
   1690  1.1  riastrad  *
   1691  1.1  riastrad  * Enable load balancing across this set of engines.
   1692  1.1  riastrad  *
   1693  1.1  riastrad  * Into the I915_EXEC_DEFAULT slot [0], a virtual engine is created that when
   1694  1.1  riastrad  * used will proxy the execbuffer request onto one of the set of engines
   1695  1.1  riastrad  * in such a way as to distribute the load evenly across the set.
   1696  1.1  riastrad  *
   1697  1.1  riastrad  * The set of engines must be compatible (e.g. the same HW class) as they
   1698  1.1  riastrad  * will share the same logical GPU context and ring.
   1699  1.1  riastrad  *
   1700  1.1  riastrad  * To intermix rendering with the virtual engine and direct rendering onto
   1701  1.1  riastrad  * the backing engines (bypassing the load balancing proxy), the context must
   1702  1.1  riastrad  * be defined to use a single timeline for all engines.
   1703  1.1  riastrad  */
   1704  1.1  riastrad struct i915_context_engines_load_balance {
   1705  1.1  riastrad 	struct i915_user_extension base;
   1706  1.1  riastrad 
   1707  1.1  riastrad 	__u16 engine_index;
   1708  1.1  riastrad 	__u16 num_siblings;
   1709  1.1  riastrad 	__u32 flags; /* all undefined flags must be zero */
   1710  1.1  riastrad 
   1711  1.1  riastrad 	__u64 mbz64; /* reserved for future use; must be zero */
   1712  1.1  riastrad 
   1713  1.1  riastrad 	struct i915_engine_class_instance engines[0];
   1714  1.1  riastrad } __attribute__((packed));
   1715  1.1  riastrad 
   1716  1.1  riastrad #define I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(name__, N__) struct { \
   1717  1.1  riastrad 	struct i915_user_extension base; \
   1718  1.1  riastrad 	__u16 engine_index; \
   1719  1.1  riastrad 	__u16 num_siblings; \
   1720  1.1  riastrad 	__u32 flags; \
   1721  1.1  riastrad 	__u64 mbz64; \
   1722  1.1  riastrad 	struct i915_engine_class_instance engines[N__]; \
   1723  1.1  riastrad } __attribute__((packed)) name__
   1724  1.1  riastrad 
   1725  1.1  riastrad /*
   1726  1.1  riastrad  * i915_context_engines_bond:
   1727  1.1  riastrad  *
   1728  1.1  riastrad  * Constructed bonded pairs for execution within a virtual engine.
   1729  1.1  riastrad  *
   1730  1.1  riastrad  * All engines are equal, but some are more equal than others. Given
   1731  1.1  riastrad  * the distribution of resources in the HW, it may be preferable to run
   1732  1.1  riastrad  * a request on a given subset of engines in parallel to a request on a
   1733  1.1  riastrad  * specific engine. We enable this selection of engines within a virtual
   1734  1.1  riastrad  * engine by specifying bonding pairs, for any given master engine we will
   1735  1.1  riastrad  * only execute on one of the corresponding siblings within the virtual engine.
   1736  1.1  riastrad  *
   1737  1.1  riastrad  * To execute a request in parallel on the master engine and a sibling requires
   1738  1.1  riastrad  * coordination with a I915_EXEC_FENCE_SUBMIT.
   1739  1.1  riastrad  */
   1740  1.1  riastrad struct i915_context_engines_bond {
   1741  1.1  riastrad 	struct i915_user_extension base;
   1742  1.1  riastrad 
   1743  1.1  riastrad 	struct i915_engine_class_instance master;
   1744  1.1  riastrad 
   1745  1.1  riastrad 	__u16 virtual_index; /* index of virtual engine in ctx->engines[] */
   1746  1.1  riastrad 	__u16 num_bonds;
   1747  1.1  riastrad 
   1748  1.1  riastrad 	__u64 flags; /* all undefined flags must be zero */
   1749  1.1  riastrad 	__u64 mbz64[4]; /* reserved for future use; must be zero */
   1750  1.1  riastrad 
   1751  1.1  riastrad 	struct i915_engine_class_instance engines[0];
   1752  1.1  riastrad } __attribute__((packed));
   1753  1.1  riastrad 
   1754  1.1  riastrad #define I915_DEFINE_CONTEXT_ENGINES_BOND(name__, N__) struct { \
   1755  1.1  riastrad 	struct i915_user_extension base; \
   1756  1.1  riastrad 	struct i915_engine_class_instance master; \
   1757  1.1  riastrad 	__u16 virtual_index; \
   1758  1.1  riastrad 	__u16 num_bonds; \
   1759  1.1  riastrad 	__u64 flags; \
   1760  1.1  riastrad 	__u64 mbz64[4]; \
   1761  1.1  riastrad 	struct i915_engine_class_instance engines[N__]; \
   1762  1.1  riastrad } __attribute__((packed)) name__
   1763  1.1  riastrad 
   1764  1.1  riastrad struct i915_context_param_engines {
   1765  1.1  riastrad 	__u64 extensions; /* linked chain of extension blocks, 0 terminates */
   1766  1.1  riastrad #define I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE 0 /* see i915_context_engines_load_balance */
   1767  1.1  riastrad #define I915_CONTEXT_ENGINES_EXT_BOND 1 /* see i915_context_engines_bond */
   1768  1.1  riastrad 	struct i915_engine_class_instance engines[0];
   1769  1.1  riastrad } __attribute__((packed));
   1770  1.1  riastrad 
   1771  1.1  riastrad #define I915_DEFINE_CONTEXT_PARAM_ENGINES(name__, N__) struct { \
   1772  1.1  riastrad 	__u64 extensions; \
   1773  1.1  riastrad 	struct i915_engine_class_instance engines[N__]; \
   1774  1.1  riastrad } __attribute__((packed)) name__
   1775  1.1  riastrad 
   1776  1.1  riastrad struct drm_i915_gem_context_create_ext_setparam {
   1777  1.1  riastrad #define I915_CONTEXT_CREATE_EXT_SETPARAM 0
   1778  1.1  riastrad 	struct i915_user_extension base;
   1779  1.1  riastrad 	struct drm_i915_gem_context_param param;
   1780  1.1  riastrad };
   1781  1.1  riastrad 
   1782  1.1  riastrad struct drm_i915_gem_context_create_ext_clone {
   1783  1.1  riastrad #define I915_CONTEXT_CREATE_EXT_CLONE 1
   1784  1.1  riastrad 	struct i915_user_extension base;
   1785  1.1  riastrad 	__u32 clone_id;
   1786  1.1  riastrad 	__u32 flags;
   1787  1.1  riastrad #define I915_CONTEXT_CLONE_ENGINES	(1u << 0)
   1788  1.1  riastrad #define I915_CONTEXT_CLONE_FLAGS	(1u << 1)
   1789  1.1  riastrad #define I915_CONTEXT_CLONE_SCHEDATTR	(1u << 2)
   1790  1.1  riastrad #define I915_CONTEXT_CLONE_SSEU		(1u << 3)
   1791  1.1  riastrad #define I915_CONTEXT_CLONE_TIMELINE	(1u << 4)
   1792  1.1  riastrad #define I915_CONTEXT_CLONE_VM		(1u << 5)
   1793  1.1  riastrad #define I915_CONTEXT_CLONE_UNKNOWN -(I915_CONTEXT_CLONE_VM << 1)
   1794  1.1  riastrad 	__u64 rsvd;
   1795  1.1  riastrad };
   1796  1.1  riastrad 
   1797  1.1  riastrad struct drm_i915_gem_context_destroy {
   1798  1.1  riastrad 	__u32 ctx_id;
   1799  1.1  riastrad 	__u32 pad;
   1800  1.1  riastrad };
   1801  1.1  riastrad 
   1802  1.1  riastrad /*
   1803  1.1  riastrad  * DRM_I915_GEM_VM_CREATE -
   1804  1.1  riastrad  *
   1805  1.1  riastrad  * Create a new virtual memory address space (ppGTT) for use within a context
   1806  1.1  riastrad  * on the same file. Extensions can be provided to configure exactly how the
   1807  1.1  riastrad  * address space is setup upon creation.
   1808  1.1  riastrad  *
   1809  1.1  riastrad  * The id of new VM (bound to the fd) for use with I915_CONTEXT_PARAM_VM is
   1810  1.1  riastrad  * returned in the outparam @id.
   1811  1.1  riastrad  *
   1812  1.1  riastrad  * No flags are defined, with all bits reserved and must be zero.
   1813  1.1  riastrad  *
   1814  1.1  riastrad  * An extension chain maybe provided, starting with @extensions, and terminated
   1815  1.1  riastrad  * by the @next_extension being 0. Currently, no extensions are defined.
   1816  1.1  riastrad  *
   1817  1.1  riastrad  * DRM_I915_GEM_VM_DESTROY -
   1818  1.1  riastrad  *
   1819  1.1  riastrad  * Destroys a previously created VM id, specified in @id.
   1820  1.1  riastrad  *
   1821  1.1  riastrad  * No extensions or flags are allowed currently, and so must be zero.
   1822  1.1  riastrad  */
   1823  1.1  riastrad struct drm_i915_gem_vm_control {
   1824  1.1  riastrad 	__u64 extensions;
   1825  1.1  riastrad 	__u32 flags;
   1826  1.1  riastrad 	__u32 vm_id;
   1827  1.1  riastrad };
   1828  1.1  riastrad 
   1829  1.1  riastrad struct drm_i915_reg_read {
   1830  1.1  riastrad 	/*
   1831  1.1  riastrad 	 * Register offset.
   1832  1.1  riastrad 	 * For 64bit wide registers where the upper 32bits don't immediately
   1833  1.1  riastrad 	 * follow the lower 32bits, the offset of the lower 32bits must
   1834  1.1  riastrad 	 * be specified
   1835  1.1  riastrad 	 */
   1836  1.1  riastrad 	__u64 offset;
   1837  1.1  riastrad #define I915_REG_READ_8B_WA (1ul << 0)
   1838  1.1  riastrad 
   1839  1.1  riastrad 	__u64 val; /* Return value */
   1840  1.1  riastrad };
   1841  1.1  riastrad 
   1842  1.1  riastrad /* Known registers:
   1843  1.1  riastrad  *
   1844  1.1  riastrad  * Render engine timestamp - 0x2358 + 64bit - gen7+
   1845  1.1  riastrad  * - Note this register returns an invalid value if using the default
   1846  1.1  riastrad  *   single instruction 8byte read, in order to workaround that pass
   1847  1.1  riastrad  *   flag I915_REG_READ_8B_WA in offset field.
   1848  1.1  riastrad  *
   1849  1.1  riastrad  */
   1850  1.1  riastrad 
   1851  1.1  riastrad struct drm_i915_reset_stats {
   1852  1.1  riastrad 	__u32 ctx_id;
   1853  1.1  riastrad 	__u32 flags;
   1854  1.1  riastrad 
   1855  1.1  riastrad 	/* All resets since boot/module reload, for all contexts */
   1856  1.1  riastrad 	__u32 reset_count;
   1857  1.1  riastrad 
   1858  1.1  riastrad 	/* Number of batches lost when active in GPU, for this context */
   1859  1.1  riastrad 	__u32 batch_active;
   1860  1.1  riastrad 
   1861  1.1  riastrad 	/* Number of batches lost pending for execution, for this context */
   1862  1.1  riastrad 	__u32 batch_pending;
   1863  1.1  riastrad 
   1864  1.1  riastrad 	__u32 pad;
   1865  1.1  riastrad };
   1866  1.1  riastrad 
   1867  1.1  riastrad struct drm_i915_gem_userptr {
   1868  1.1  riastrad 	__u64 user_ptr;
   1869  1.1  riastrad 	__u64 user_size;
   1870  1.1  riastrad 	__u32 flags;
   1871  1.1  riastrad #define I915_USERPTR_READ_ONLY 0x1
   1872  1.1  riastrad #define I915_USERPTR_UNSYNCHRONIZED 0x80000000
   1873  1.1  riastrad 	/**
   1874  1.1  riastrad 	 * Returned handle for the object.
   1875  1.1  riastrad 	 *
   1876  1.1  riastrad 	 * Object handles are nonzero.
   1877  1.1  riastrad 	 */
   1878  1.1  riastrad 	__u32 handle;
   1879  1.1  riastrad };
   1880  1.1  riastrad 
   1881  1.1  riastrad enum drm_i915_oa_format {
   1882  1.1  riastrad 	I915_OA_FORMAT_A13 = 1,	    /* HSW only */
   1883  1.1  riastrad 	I915_OA_FORMAT_A29,	    /* HSW only */
   1884  1.1  riastrad 	I915_OA_FORMAT_A13_B8_C8,   /* HSW only */
   1885  1.1  riastrad 	I915_OA_FORMAT_B4_C8,	    /* HSW only */
   1886  1.1  riastrad 	I915_OA_FORMAT_A45_B8_C8,   /* HSW only */
   1887  1.1  riastrad 	I915_OA_FORMAT_B4_C8_A16,   /* HSW only */
   1888  1.1  riastrad 	I915_OA_FORMAT_C4_B8,	    /* HSW+ */
   1889  1.1  riastrad 
   1890  1.1  riastrad 	/* Gen8+ */
   1891  1.1  riastrad 	I915_OA_FORMAT_A12,
   1892  1.1  riastrad 	I915_OA_FORMAT_A12_B8_C8,
   1893  1.1  riastrad 	I915_OA_FORMAT_A32u40_A4u32_B8_C8,
   1894  1.1  riastrad 
   1895  1.1  riastrad 	I915_OA_FORMAT_MAX	    /* non-ABI */
   1896  1.1  riastrad };
   1897  1.1  riastrad 
   1898  1.1  riastrad enum drm_i915_perf_property_id {
   1899  1.1  riastrad 	/**
   1900  1.1  riastrad 	 * Open the stream for a specific context handle (as used with
   1901  1.1  riastrad 	 * execbuffer2). A stream opened for a specific context this way
   1902  1.1  riastrad 	 * won't typically require root privileges.
   1903  1.1  riastrad 	 *
   1904  1.1  riastrad 	 * This property is available in perf revision 1.
   1905  1.1  riastrad 	 */
   1906  1.1  riastrad 	DRM_I915_PERF_PROP_CTX_HANDLE = 1,
   1907  1.1  riastrad 
   1908  1.1  riastrad 	/**
   1909  1.1  riastrad 	 * A value of 1 requests the inclusion of raw OA unit reports as
   1910  1.1  riastrad 	 * part of stream samples.
   1911  1.1  riastrad 	 *
   1912  1.1  riastrad 	 * This property is available in perf revision 1.
   1913  1.1  riastrad 	 */
   1914  1.1  riastrad 	DRM_I915_PERF_PROP_SAMPLE_OA,
   1915  1.1  riastrad 
   1916  1.1  riastrad 	/**
   1917  1.1  riastrad 	 * The value specifies which set of OA unit metrics should be
   1918  1.1  riastrad 	 * be configured, defining the contents of any OA unit reports.
   1919  1.1  riastrad 	 *
   1920  1.1  riastrad 	 * This property is available in perf revision 1.
   1921  1.1  riastrad 	 */
   1922  1.1  riastrad 	DRM_I915_PERF_PROP_OA_METRICS_SET,
   1923  1.1  riastrad 
   1924  1.1  riastrad 	/**
   1925  1.1  riastrad 	 * The value specifies the size and layout of OA unit reports.
   1926  1.1  riastrad 	 *
   1927  1.1  riastrad 	 * This property is available in perf revision 1.
   1928  1.1  riastrad 	 */
   1929  1.1  riastrad 	DRM_I915_PERF_PROP_OA_FORMAT,
   1930  1.1  riastrad 
   1931  1.1  riastrad 	/**
   1932  1.1  riastrad 	 * Specifying this property implicitly requests periodic OA unit
   1933  1.1  riastrad 	 * sampling and (at least on Haswell) the sampling frequency is derived
   1934  1.1  riastrad 	 * from this exponent as follows:
   1935  1.1  riastrad 	 *
   1936  1.1  riastrad 	 *   80ns * 2^(period_exponent + 1)
   1937  1.1  riastrad 	 *
   1938  1.1  riastrad 	 * This property is available in perf revision 1.
   1939  1.1  riastrad 	 */
   1940  1.1  riastrad 	DRM_I915_PERF_PROP_OA_EXPONENT,
   1941  1.1  riastrad 
   1942  1.1  riastrad 	/**
   1943  1.1  riastrad 	 * Specifying this property is only valid when specify a context to
   1944  1.1  riastrad 	 * filter with DRM_I915_PERF_PROP_CTX_HANDLE. Specifying this property
   1945  1.1  riastrad 	 * will hold preemption of the particular context we want to gather
   1946  1.1  riastrad 	 * performance data about. The execbuf2 submissions must include a
   1947  1.1  riastrad 	 * drm_i915_gem_execbuffer_ext_perf parameter for this to apply.
   1948  1.1  riastrad 	 *
   1949  1.1  riastrad 	 * This property is available in perf revision 3.
   1950  1.1  riastrad 	 */
   1951  1.1  riastrad 	DRM_I915_PERF_PROP_HOLD_PREEMPTION,
   1952  1.1  riastrad 
   1953  1.1  riastrad 	DRM_I915_PERF_PROP_MAX /* non-ABI */
   1954  1.1  riastrad };
   1955  1.1  riastrad 
   1956  1.1  riastrad struct drm_i915_perf_open_param {
   1957  1.1  riastrad 	__u32 flags;
   1958  1.1  riastrad #define I915_PERF_FLAG_FD_CLOEXEC	(1<<0)
   1959  1.1  riastrad #define I915_PERF_FLAG_FD_NONBLOCK	(1<<1)
   1960  1.1  riastrad #define I915_PERF_FLAG_DISABLED		(1<<2)
   1961  1.1  riastrad 
   1962  1.1  riastrad 	/** The number of u64 (id, value) pairs */
   1963  1.1  riastrad 	__u32 num_properties;
   1964  1.1  riastrad 
   1965  1.1  riastrad 	/**
   1966  1.1  riastrad 	 * Pointer to array of u64 (id, value) pairs configuring the stream
   1967  1.1  riastrad 	 * to open.
   1968  1.1  riastrad 	 */
   1969  1.1  riastrad 	__u64 properties_ptr;
   1970  1.1  riastrad };
   1971  1.1  riastrad 
   1972  1.1  riastrad /**
   1973  1.1  riastrad  * Enable data capture for a stream that was either opened in a disabled state
   1974  1.1  riastrad  * via I915_PERF_FLAG_DISABLED or was later disabled via
   1975  1.1  riastrad  * I915_PERF_IOCTL_DISABLE.
   1976  1.1  riastrad  *
   1977  1.1  riastrad  * It is intended to be cheaper to disable and enable a stream than it may be
   1978  1.1  riastrad  * to close and re-open a stream with the same configuration.
   1979  1.1  riastrad  *
   1980  1.1  riastrad  * It's undefined whether any pending data for the stream will be lost.
   1981  1.1  riastrad  *
   1982  1.1  riastrad  * This ioctl is available in perf revision 1.
   1983  1.1  riastrad  */
   1984  1.1  riastrad #define I915_PERF_IOCTL_ENABLE	_IO('i', 0x0)
   1985  1.1  riastrad 
   1986  1.1  riastrad /**
   1987  1.1  riastrad  * Disable data capture for a stream.
   1988  1.1  riastrad  *
   1989  1.1  riastrad  * It is an error to try and read a stream that is disabled.
   1990  1.1  riastrad  *
   1991  1.1  riastrad  * This ioctl is available in perf revision 1.
   1992  1.1  riastrad  */
   1993  1.1  riastrad #define I915_PERF_IOCTL_DISABLE	_IO('i', 0x1)
   1994  1.1  riastrad 
   1995  1.1  riastrad /**
   1996  1.1  riastrad  * Change metrics_set captured by a stream.
   1997  1.1  riastrad  *
   1998  1.1  riastrad  * If the stream is bound to a specific context, the configuration change
   1999  1.1  riastrad  * will performed inline with that context such that it takes effect before
   2000  1.1  riastrad  * the next execbuf submission.
   2001  1.1  riastrad  *
   2002  1.1  riastrad  * Returns the previously bound metrics set id, or a negative error code.
   2003  1.1  riastrad  *
   2004  1.1  riastrad  * This ioctl is available in perf revision 2.
   2005  1.1  riastrad  */
   2006  1.1  riastrad #define I915_PERF_IOCTL_CONFIG	_IO('i', 0x2)
   2007  1.1  riastrad 
   2008  1.1  riastrad /**
   2009  1.1  riastrad  * Common to all i915 perf records
   2010  1.1  riastrad  */
   2011  1.1  riastrad struct drm_i915_perf_record_header {
   2012  1.1  riastrad 	__u32 type;
   2013  1.1  riastrad 	__u16 pad;
   2014  1.1  riastrad 	__u16 size;
   2015  1.1  riastrad };
   2016  1.1  riastrad 
   2017  1.1  riastrad enum drm_i915_perf_record_type {
   2018  1.1  riastrad 
   2019  1.1  riastrad 	/**
   2020  1.1  riastrad 	 * Samples are the work horse record type whose contents are extensible
   2021  1.1  riastrad 	 * and defined when opening an i915 perf stream based on the given
   2022  1.1  riastrad 	 * properties.
   2023  1.1  riastrad 	 *
   2024  1.1  riastrad 	 * Boolean properties following the naming convention
   2025  1.1  riastrad 	 * DRM_I915_PERF_SAMPLE_xyz_PROP request the inclusion of 'xyz' data in
   2026  1.1  riastrad 	 * every sample.
   2027  1.1  riastrad 	 *
   2028  1.1  riastrad 	 * The order of these sample properties given by userspace has no
   2029  1.1  riastrad 	 * affect on the ordering of data within a sample. The order is
   2030  1.1  riastrad 	 * documented here.
   2031  1.1  riastrad 	 *
   2032  1.1  riastrad 	 * struct {
   2033  1.1  riastrad 	 *     struct drm_i915_perf_record_header header;
   2034  1.1  riastrad 	 *
   2035  1.1  riastrad 	 *     { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA
   2036  1.1  riastrad 	 * };
   2037  1.1  riastrad 	 */
   2038  1.1  riastrad 	DRM_I915_PERF_RECORD_SAMPLE = 1,
   2039  1.1  riastrad 
   2040  1.1  riastrad 	/*
   2041  1.1  riastrad 	 * Indicates that one or more OA reports were not written by the
   2042  1.1  riastrad 	 * hardware. This can happen for example if an MI_REPORT_PERF_COUNT
   2043  1.1  riastrad 	 * command collides with periodic sampling - which would be more likely
   2044  1.1  riastrad 	 * at higher sampling frequencies.
   2045  1.1  riastrad 	 */
   2046  1.1  riastrad 	DRM_I915_PERF_RECORD_OA_REPORT_LOST = 2,
   2047  1.1  riastrad 
   2048  1.1  riastrad 	/**
   2049  1.1  riastrad 	 * An error occurred that resulted in all pending OA reports being lost.
   2050  1.1  riastrad 	 */
   2051  1.1  riastrad 	DRM_I915_PERF_RECORD_OA_BUFFER_LOST = 3,
   2052  1.1  riastrad 
   2053  1.1  riastrad 	DRM_I915_PERF_RECORD_MAX /* non-ABI */
   2054  1.1  riastrad };
   2055  1.1  riastrad 
   2056  1.1  riastrad /**
   2057  1.1  riastrad  * Structure to upload perf dynamic configuration into the kernel.
   2058  1.1  riastrad  */
   2059  1.1  riastrad struct drm_i915_perf_oa_config {
   2060  1.1  riastrad 	/** String formatted like "%08x-%04x-%04x-%04x-%012x" */
   2061  1.1  riastrad 	char uuid[36];
   2062  1.1  riastrad 
   2063  1.1  riastrad 	__u32 n_mux_regs;
   2064  1.1  riastrad 	__u32 n_boolean_regs;
   2065  1.1  riastrad 	__u32 n_flex_regs;
   2066  1.1  riastrad 
   2067  1.1  riastrad 	/*
   2068  1.1  riastrad 	 * These fields are pointers to tuples of u32 values (register address,
   2069  1.1  riastrad 	 * value). For example the expected length of the buffer pointed by
   2070  1.1  riastrad 	 * mux_regs_ptr is (2 * sizeof(u32) * n_mux_regs).
   2071  1.1  riastrad 	 */
   2072  1.1  riastrad 	__u64 mux_regs_ptr;
   2073  1.1  riastrad 	__u64 boolean_regs_ptr;
   2074  1.1  riastrad 	__u64 flex_regs_ptr;
   2075  1.1  riastrad };
   2076  1.1  riastrad 
   2077  1.1  riastrad struct drm_i915_query_item {
   2078  1.1  riastrad 	__u64 query_id;
   2079  1.1  riastrad #define DRM_I915_QUERY_TOPOLOGY_INFO    1
   2080  1.1  riastrad #define DRM_I915_QUERY_ENGINE_INFO	2
   2081  1.1  riastrad #define DRM_I915_QUERY_PERF_CONFIG      3
   2082  1.1  riastrad /* Must be kept compact -- no holes and well documented */
   2083  1.1  riastrad 
   2084  1.1  riastrad 	/*
   2085  1.1  riastrad 	 * When set to zero by userspace, this is filled with the size of the
   2086  1.1  riastrad 	 * data to be written at the data_ptr pointer. The kernel sets this
   2087  1.1  riastrad 	 * value to a negative value to signal an error on a particular query
   2088  1.1  riastrad 	 * item.
   2089  1.1  riastrad 	 */
   2090  1.1  riastrad 	__s32 length;
   2091  1.1  riastrad 
   2092  1.1  riastrad 	/*
   2093  1.1  riastrad 	 * When query_id == DRM_I915_QUERY_TOPOLOGY_INFO, must be 0.
   2094  1.1  riastrad 	 *
   2095  1.1  riastrad 	 * When query_id == DRM_I915_QUERY_PERF_CONFIG, must be one of the
   2096  1.1  riastrad 	 * following :
   2097  1.1  riastrad 	 *         - DRM_I915_QUERY_PERF_CONFIG_LIST
   2098  1.1  riastrad 	 *         - DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_UUID
   2099  1.1  riastrad 	 *         - DRM_I915_QUERY_PERF_CONFIG_FOR_UUID
   2100  1.1  riastrad 	 */
   2101  1.1  riastrad 	__u32 flags;
   2102  1.1  riastrad #define DRM_I915_QUERY_PERF_CONFIG_LIST          1
   2103  1.1  riastrad #define DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_UUID 2
   2104  1.1  riastrad #define DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_ID   3
   2105  1.1  riastrad 
   2106  1.1  riastrad 	/*
   2107  1.1  riastrad 	 * Data will be written at the location pointed by data_ptr when the
   2108  1.1  riastrad 	 * value of length matches the length of the data to be written by the
   2109  1.1  riastrad 	 * kernel.
   2110  1.1  riastrad 	 */
   2111  1.1  riastrad 	__u64 data_ptr;
   2112  1.1  riastrad };
   2113  1.1  riastrad 
   2114  1.1  riastrad struct drm_i915_query {
   2115  1.1  riastrad 	__u32 num_items;
   2116  1.1  riastrad 
   2117  1.1  riastrad 	/*
   2118  1.1  riastrad 	 * Unused for now. Must be cleared to zero.
   2119  1.1  riastrad 	 */
   2120  1.1  riastrad 	__u32 flags;
   2121  1.1  riastrad 
   2122  1.1  riastrad 	/*
   2123  1.1  riastrad 	 * This points to an array of num_items drm_i915_query_item structures.
   2124  1.1  riastrad 	 */
   2125  1.1  riastrad 	__u64 items_ptr;
   2126  1.1  riastrad };
   2127  1.1  riastrad 
   2128  1.1  riastrad /*
   2129  1.1  riastrad  * Data written by the kernel with query DRM_I915_QUERY_TOPOLOGY_INFO :
   2130  1.1  riastrad  *
   2131  1.1  riastrad  * data: contains the 3 pieces of information :
   2132  1.1  riastrad  *
   2133  1.1  riastrad  * - the slice mask with one bit per slice telling whether a slice is
   2134  1.1  riastrad  *   available. The availability of slice X can be queried with the following
   2135  1.1  riastrad  *   formula :
   2136  1.1  riastrad  *
   2137  1.1  riastrad  *           (data[X / 8] >> (X % 8)) & 1
   2138  1.1  riastrad  *
   2139  1.1  riastrad  * - the subslice mask for each slice with one bit per subslice telling
   2140  1.1  riastrad  *   whether a subslice is available. Gen12 has dual-subslices, which are
   2141  1.1  riastrad  *   similar to two gen11 subslices. For gen12, this array represents dual-
   2142  1.1  riastrad  *   subslices. The availability of subslice Y in slice X can be queried
   2143  1.1  riastrad  *   with the following formula :
   2144  1.1  riastrad  *
   2145  1.1  riastrad  *           (data[subslice_offset +
   2146  1.1  riastrad  *                 X * subslice_stride +
   2147  1.1  riastrad  *                 Y / 8] >> (Y % 8)) & 1
   2148  1.1  riastrad  *
   2149  1.1  riastrad  * - the EU mask for each subslice in each slice with one bit per EU telling
   2150  1.1  riastrad  *   whether an EU is available. The availability of EU Z in subslice Y in
   2151  1.1  riastrad  *   slice X can be queried with the following formula :
   2152  1.1  riastrad  *
   2153  1.1  riastrad  *           (data[eu_offset +
   2154  1.1  riastrad  *                 (X * max_subslices + Y) * eu_stride +
   2155  1.1  riastrad  *                 Z / 8] >> (Z % 8)) & 1
   2156  1.1  riastrad  */
   2157  1.1  riastrad struct drm_i915_query_topology_info {
   2158  1.1  riastrad 	/*
   2159  1.1  riastrad 	 * Unused for now. Must be cleared to zero.
   2160  1.1  riastrad 	 */
   2161  1.1  riastrad 	__u16 flags;
   2162  1.1  riastrad 
   2163  1.1  riastrad 	__u16 max_slices;
   2164  1.1  riastrad 	__u16 max_subslices;
   2165  1.1  riastrad 	__u16 max_eus_per_subslice;
   2166  1.1  riastrad 
   2167  1.1  riastrad 	/*
   2168  1.1  riastrad 	 * Offset in data[] at which the subslice masks are stored.
   2169  1.1  riastrad 	 */
   2170  1.1  riastrad 	__u16 subslice_offset;
   2171  1.1  riastrad 
   2172  1.1  riastrad 	/*
   2173  1.1  riastrad 	 * Stride at which each of the subslice masks for each slice are
   2174  1.1  riastrad 	 * stored.
   2175  1.1  riastrad 	 */
   2176  1.1  riastrad 	__u16 subslice_stride;
   2177  1.1  riastrad 
   2178  1.1  riastrad 	/*
   2179  1.1  riastrad 	 * Offset in data[] at which the EU masks are stored.
   2180  1.1  riastrad 	 */
   2181  1.1  riastrad 	__u16 eu_offset;
   2182  1.1  riastrad 
   2183  1.1  riastrad 	/*
   2184  1.1  riastrad 	 * Stride at which each of the EU masks for each subslice are stored.
   2185  1.1  riastrad 	 */
   2186  1.1  riastrad 	__u16 eu_stride;
   2187  1.1  riastrad 
   2188  1.1  riastrad 	__u8 data[];
   2189  1.1  riastrad };
   2190  1.1  riastrad 
   2191  1.1  riastrad /**
   2192  1.1  riastrad  * struct drm_i915_engine_info
   2193  1.1  riastrad  *
   2194  1.1  riastrad  * Describes one engine and it's capabilities as known to the driver.
   2195  1.1  riastrad  */
   2196  1.1  riastrad struct drm_i915_engine_info {
   2197  1.1  riastrad 	/** Engine class and instance. */
   2198  1.1  riastrad 	struct i915_engine_class_instance engine;
   2199  1.1  riastrad 
   2200  1.1  riastrad 	/** Reserved field. */
   2201  1.1  riastrad 	__u32 rsvd0;
   2202  1.1  riastrad 
   2203  1.1  riastrad 	/** Engine flags. */
   2204  1.1  riastrad 	__u64 flags;
   2205  1.1  riastrad 
   2206  1.1  riastrad 	/** Capabilities of this engine. */
   2207  1.1  riastrad 	__u64 capabilities;
   2208  1.1  riastrad #define I915_VIDEO_CLASS_CAPABILITY_HEVC		(1 << 0)
   2209  1.1  riastrad #define I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC	(1 << 1)
   2210  1.1  riastrad 
   2211  1.1  riastrad 	/** Reserved fields. */
   2212  1.1  riastrad 	__u64 rsvd1[4];
   2213  1.1  riastrad };
   2214  1.1  riastrad 
   2215  1.1  riastrad /**
   2216  1.1  riastrad  * struct drm_i915_query_engine_info
   2217  1.1  riastrad  *
   2218  1.1  riastrad  * Engine info query enumerates all engines known to the driver by filling in
   2219  1.1  riastrad  * an array of struct drm_i915_engine_info structures.
   2220  1.1  riastrad  */
   2221  1.1  riastrad struct drm_i915_query_engine_info {
   2222  1.1  riastrad 	/** Number of struct drm_i915_engine_info structs following. */
   2223  1.1  riastrad 	__u32 num_engines;
   2224  1.1  riastrad 
   2225  1.1  riastrad 	/** MBZ */
   2226  1.1  riastrad 	__u32 rsvd[3];
   2227  1.1  riastrad 
   2228  1.1  riastrad 	/** Marker for drm_i915_engine_info structures. */
   2229  1.1  riastrad 	struct drm_i915_engine_info engines[];
   2230  1.1  riastrad };
   2231  1.1  riastrad 
   2232  1.1  riastrad /*
   2233  1.1  riastrad  * Data written by the kernel with query DRM_I915_QUERY_PERF_CONFIG.
   2234  1.1  riastrad  */
   2235  1.1  riastrad struct drm_i915_query_perf_config {
   2236  1.1  riastrad 	union {
   2237  1.1  riastrad 		/*
   2238  1.1  riastrad 		 * When query_item.flags == DRM_I915_QUERY_PERF_CONFIG_LIST, i915 sets
   2239  1.1  riastrad 		 * this fields to the number of configurations available.
   2240  1.1  riastrad 		 */
   2241  1.1  riastrad 		__u64 n_configs;
   2242  1.1  riastrad 
   2243  1.1  riastrad 		/*
   2244  1.1  riastrad 		 * When query_id == DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_ID,
   2245  1.1  riastrad 		 * i915 will use the value in this field as configuration
   2246  1.1  riastrad 		 * identifier to decide what data to write into config_ptr.
   2247  1.1  riastrad 		 */
   2248  1.1  riastrad 		__u64 config;
   2249  1.1  riastrad 
   2250  1.1  riastrad 		/*
   2251  1.1  riastrad 		 * When query_id == DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_UUID,
   2252  1.1  riastrad 		 * i915 will use the value in this field as configuration
   2253  1.1  riastrad 		 * identifier to decide what data to write into config_ptr.
   2254  1.1  riastrad 		 *
   2255  1.1  riastrad 		 * String formatted like "%08x-%04x-%04x-%04x-%012x"
   2256  1.1  riastrad 		 */
   2257  1.1  riastrad 		char uuid[36];
   2258  1.1  riastrad 	};
   2259  1.1  riastrad 
   2260  1.1  riastrad 	/*
   2261  1.1  riastrad 	 * Unused for now. Must be cleared to zero.
   2262  1.1  riastrad 	 */
   2263  1.1  riastrad 	__u32 flags;
   2264  1.1  riastrad 
   2265  1.1  riastrad 	/*
   2266  1.1  riastrad 	 * When query_item.flags == DRM_I915_QUERY_PERF_CONFIG_LIST, i915 will
   2267  1.1  riastrad 	 * write an array of __u64 of configuration identifiers.
   2268  1.1  riastrad 	 *
   2269  1.1  riastrad 	 * When query_item.flags == DRM_I915_QUERY_PERF_CONFIG_DATA, i915 will
   2270  1.1  riastrad 	 * write a struct drm_i915_perf_oa_config. If the following fields of
   2271  1.1  riastrad 	 * drm_i915_perf_oa_config are set not set to 0, i915 will write into
   2272  1.1  riastrad 	 * the associated pointers the values of submitted when the
   2273  1.1  riastrad 	 * configuration was created :
   2274  1.1  riastrad 	 *
   2275  1.1  riastrad 	 *         - n_mux_regs
   2276  1.1  riastrad 	 *         - n_boolean_regs
   2277  1.1  riastrad 	 *         - n_flex_regs
   2278  1.1  riastrad 	 */
   2279  1.1  riastrad 	__u8 data[];
   2280  1.1  riastrad };
   2281  1.1  riastrad 
   2282  1.1  riastrad #if defined(__cplusplus)
   2283  1.1  riastrad }
   2284  1.1  riastrad #endif
   2285  1.1  riastrad 
   2286  1.1  riastrad #endif /* _UAPI_I915_DRM_H_ */
   2287