i915_drm.h 69 KB

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