Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dri_interface.h 76KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204
  1. /*
  2. * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
  3. * Copyright 2007-2008 Red Hat, Inc.
  4. * (C) Copyright IBM Corporation 2004
  5. * All Rights Reserved.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a
  8. * copy of this software and associated documentation files (the "Software"),
  9. * to deal in the Software without restriction, including without limitation
  10. * on the rights to use, copy, modify, merge, publish, distribute, sub
  11. * license, and/or sell copies of the Software, and to permit persons to whom
  12. * the Software is furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice (including the next
  15. * paragraph) shall be included in all copies or substantial portions of the
  16. * Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  21. * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  22. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  24. * USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. */
  26. /**
  27. * \file dri_interface.h
  28. *
  29. * This file contains all the types and functions that define the interface
  30. * between a DRI driver and driver loader. Currently, the most common driver
  31. * loader is the XFree86 libGL.so. However, other loaders do exist, and in
  32. * the future the server-side libglx.a will also be a loader.
  33. *
  34. * \author Kevin E. Martin <kevin@precisioninsight.com>
  35. * \author Ian Romanick <idr@us.ibm.com>
  36. * \author Kristian Høgsberg <krh@redhat.com>
  37. */
  38. #ifndef DRI_INTERFACE_H
  39. #define DRI_INTERFACE_H
  40. #ifdef HAVE_LIBDRM
  41. #include <drm.h>
  42. #else
  43. typedef unsigned int drm_context_t;
  44. typedef unsigned int drm_drawable_t;
  45. typedef struct drm_clip_rect drm_clip_rect_t;
  46. #endif
  47. #include <GL/gl.h>
  48. #include <stdint.h>
  49. /**
  50. * \name DRI interface structures
  51. *
  52. * The following structures define the interface between the GLX client
  53. * side library and the DRI (direct rendering infrastructure).
  54. */
  55. /*@{*/
  56. typedef struct __DRIdisplayRec __DRIdisplay;
  57. typedef struct __DRIscreenRec __DRIscreen;
  58. typedef struct __DRIcontextRec __DRIcontext;
  59. typedef struct __DRIdrawableRec __DRIdrawable;
  60. typedef struct __DRIconfigRec __DRIconfig;
  61. typedef struct __DRIframebufferRec __DRIframebuffer;
  62. typedef struct __DRIversionRec __DRIversion;
  63. typedef struct __DRIcoreExtensionRec __DRIcoreExtension;
  64. typedef struct __DRIextensionRec __DRIextension;
  65. typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension;
  66. typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension;
  67. typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension;
  68. typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension;
  69. typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension;
  70. typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension;
  71. typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension;
  72. typedef struct __DRIswrastExtensionRec __DRIswrastExtension;
  73. typedef struct __DRIbufferRec __DRIbuffer;
  74. typedef struct __DRIdri2ExtensionRec __DRIdri2Extension;
  75. typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension;
  76. typedef struct __DRI2flushExtensionRec __DRI2flushExtension;
  77. typedef struct __DRI2throttleExtensionRec __DRI2throttleExtension;
  78. typedef struct __DRI2fenceExtensionRec __DRI2fenceExtension;
  79. typedef struct __DRI2interopExtensionRec __DRI2interopExtension;
  80. typedef struct __DRI2blobExtensionRec __DRI2blobExtension;
  81. typedef struct __DRI2bufferDamageExtensionRec __DRI2bufferDamageExtension;
  82. typedef struct __DRIimageLoaderExtensionRec __DRIimageLoaderExtension;
  83. typedef struct __DRIimageDriverExtensionRec __DRIimageDriverExtension;
  84. /*@}*/
  85. /**
  86. * Extension struct. Drivers 'inherit' from this struct by embedding
  87. * it as the first element in the extension struct.
  88. *
  89. * We never break API in for a DRI extension. If we need to change
  90. * the way things work in a non-backwards compatible manner, we
  91. * introduce a new extension. During a transition period, we can
  92. * leave both the old and the new extension in the driver, which
  93. * allows us to move to the new interface without having to update the
  94. * loader(s) in lock step.
  95. *
  96. * However, we can add entry points to an extension over time as long
  97. * as we don't break the old ones. As we add entry points to an
  98. * extension, we increase the version number. The corresponding
  99. * #define can be used to guard code that accesses the new entry
  100. * points at compile time and the version field in the extension
  101. * struct can be used at run-time to determine how to use the
  102. * extension.
  103. */
  104. struct __DRIextensionRec {
  105. const char *name;
  106. int version;
  107. };
  108. /**
  109. * The first set of extension are the screen extensions, returned by
  110. * __DRIcore::getExtensions(). This entry point will return a list of
  111. * extensions and the loader can use the ones it knows about by
  112. * casting them to more specific extensions and advertising any GLX
  113. * extensions the DRI extensions enables.
  114. */
  115. /**
  116. * Used by drivers to indicate support for setting the read drawable.
  117. */
  118. #define __DRI_READ_DRAWABLE "DRI_ReadDrawable"
  119. #define __DRI_READ_DRAWABLE_VERSION 1
  120. /**
  121. * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
  122. */
  123. #define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer"
  124. #define __DRI_COPY_SUB_BUFFER_VERSION 1
  125. struct __DRIcopySubBufferExtensionRec {
  126. __DRIextension base;
  127. void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h);
  128. };
  129. /**
  130. * Used by drivers that implement the GLX_SGI_swap_control or
  131. * GLX_MESA_swap_control extension.
  132. */
  133. #define __DRI_SWAP_CONTROL "DRI_SwapControl"
  134. #define __DRI_SWAP_CONTROL_VERSION 1
  135. struct __DRIswapControlExtensionRec {
  136. __DRIextension base;
  137. void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval);
  138. unsigned int (*getSwapInterval)(__DRIdrawable *drawable);
  139. };
  140. /**
  141. * Used by drivers that implement the GLX_MESA_swap_frame_usage extension.
  142. */
  143. #define __DRI_FRAME_TRACKING "DRI_FrameTracking"
  144. #define __DRI_FRAME_TRACKING_VERSION 1
  145. struct __DRIframeTrackingExtensionRec {
  146. __DRIextension base;
  147. /**
  148. * Enable or disable frame usage tracking.
  149. *
  150. * \since Internal API version 20030317.
  151. */
  152. int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable);
  153. /**
  154. * Retrieve frame usage information.
  155. *
  156. * \since Internal API version 20030317.
  157. */
  158. int (*queryFrameTracking)(__DRIdrawable *drawable,
  159. int64_t * sbc, int64_t * missedFrames,
  160. float * lastMissedUsage, float * usage);
  161. };
  162. /**
  163. * Used by drivers that implement the GLX_SGI_video_sync extension.
  164. */
  165. #define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter"
  166. #define __DRI_MEDIA_STREAM_COUNTER_VERSION 1
  167. struct __DRImediaStreamCounterExtensionRec {
  168. __DRIextension base;
  169. /**
  170. * Wait for the MSC to equal target_msc, or, if that has already passed,
  171. * the next time (MSC % divisor) is equal to remainder. If divisor is
  172. * zero, the function will return as soon as MSC is greater than or equal
  173. * to target_msc.
  174. */
  175. int (*waitForMSC)(__DRIdrawable *drawable,
  176. int64_t target_msc, int64_t divisor, int64_t remainder,
  177. int64_t * msc, int64_t * sbc);
  178. /**
  179. * Get the number of vertical refreshes since some point in time before
  180. * this function was first called (i.e., system start up).
  181. */
  182. int (*getDrawableMSC)(__DRIscreen *screen, __DRIdrawable *drawable,
  183. int64_t *msc);
  184. };
  185. #define __DRI_TEX_OFFSET "DRI_TexOffset"
  186. #define __DRI_TEX_OFFSET_VERSION 1
  187. struct __DRItexOffsetExtensionRec {
  188. __DRIextension base;
  189. /**
  190. * Method to override base texture image with a driver specific 'offset'.
  191. * The depth passed in allows e.g. to ignore the alpha channel of texture
  192. * images where the non-alpha components don't occupy a whole texel.
  193. *
  194. * For GLX_EXT_texture_from_pixmap with AIGLX.
  195. */
  196. void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
  197. unsigned long long offset, GLint depth, GLuint pitch);
  198. };
  199. /* Valid values for format in the setTexBuffer2 function below. These
  200. * values match the GLX tokens for compatibility reasons, but we
  201. * define them here since the DRI interface can't depend on GLX. */
  202. #define __DRI_TEXTURE_FORMAT_NONE 0x20D8
  203. #define __DRI_TEXTURE_FORMAT_RGB 0x20D9
  204. #define __DRI_TEXTURE_FORMAT_RGBA 0x20DA
  205. #define __DRI_TEX_BUFFER "DRI_TexBuffer"
  206. #define __DRI_TEX_BUFFER_VERSION 3
  207. struct __DRItexBufferExtensionRec {
  208. __DRIextension base;
  209. /**
  210. * Method to override base texture image with the contents of a
  211. * __DRIdrawable.
  212. *
  213. * For GLX_EXT_texture_from_pixmap with AIGLX. Deprecated in favor of
  214. * setTexBuffer2 in version 2 of this interface
  215. */
  216. void (*setTexBuffer)(__DRIcontext *pDRICtx,
  217. GLint target,
  218. __DRIdrawable *pDraw);
  219. /**
  220. * Method to override base texture image with the contents of a
  221. * __DRIdrawable, including the required texture format attribute.
  222. *
  223. * For GLX_EXT_texture_from_pixmap with AIGLX.
  224. *
  225. * \since 2
  226. */
  227. void (*setTexBuffer2)(__DRIcontext *pDRICtx,
  228. GLint target,
  229. GLint format,
  230. __DRIdrawable *pDraw);
  231. /**
  232. * Method to release texture buffer in case some special platform
  233. * need this.
  234. *
  235. * For GLX_EXT_texture_from_pixmap with AIGLX.
  236. *
  237. * \since 3
  238. */
  239. void (*releaseTexBuffer)(__DRIcontext *pDRICtx,
  240. GLint target,
  241. __DRIdrawable *pDraw);
  242. };
  243. /**
  244. * Used by drivers that implement DRI2
  245. */
  246. #define __DRI2_FLUSH "DRI2_Flush"
  247. #define __DRI2_FLUSH_VERSION 4
  248. #define __DRI2_FLUSH_DRAWABLE (1 << 0) /* the drawable should be flushed. */
  249. #define __DRI2_FLUSH_CONTEXT (1 << 1) /* glFlush should be called */
  250. #define __DRI2_FLUSH_INVALIDATE_ANCILLARY (1 << 2)
  251. enum __DRI2throttleReason {
  252. __DRI2_THROTTLE_SWAPBUFFER,
  253. __DRI2_THROTTLE_COPYSUBBUFFER,
  254. __DRI2_THROTTLE_FLUSHFRONT
  255. };
  256. struct __DRI2flushExtensionRec {
  257. __DRIextension base;
  258. void (*flush)(__DRIdrawable *drawable);
  259. /**
  260. * Ask the driver to call getBuffers/getBuffersWithFormat before
  261. * it starts rendering again.
  262. *
  263. * \param drawable the drawable to invalidate
  264. *
  265. * \since 3
  266. */
  267. void (*invalidate)(__DRIdrawable *drawable);
  268. /**
  269. * This function reduces the number of flushes in the driver by combining
  270. * several operations into one call.
  271. *
  272. * It can:
  273. * - throttle
  274. * - flush a drawable
  275. * - flush a context
  276. *
  277. * \param context the context
  278. * \param drawable the drawable to flush
  279. * \param flags a combination of _DRI2_FLUSH_xxx flags
  280. * \param throttle_reason the reason for throttling, 0 = no throttling
  281. *
  282. * \since 4
  283. */
  284. void (*flush_with_flags)(__DRIcontext *ctx,
  285. __DRIdrawable *drawable,
  286. unsigned flags,
  287. enum __DRI2throttleReason throttle_reason);
  288. };
  289. /**
  290. * Extension that the driver uses to request
  291. * throttle callbacks.
  292. */
  293. #define __DRI2_THROTTLE "DRI2_Throttle"
  294. #define __DRI2_THROTTLE_VERSION 1
  295. struct __DRI2throttleExtensionRec {
  296. __DRIextension base;
  297. void (*throttle)(__DRIcontext *ctx,
  298. __DRIdrawable *drawable,
  299. enum __DRI2throttleReason reason);
  300. };
  301. /**
  302. * Extension for EGL_ANDROID_blob_cache
  303. */
  304. #define __DRI2_BLOB "DRI2_Blob"
  305. #define __DRI2_BLOB_VERSION 1
  306. typedef void
  307. (*__DRIblobCacheSet) (const void *key, signed long keySize,
  308. const void *value, signed long valueSize);
  309. typedef signed long
  310. (*__DRIblobCacheGet) (const void *key, signed long keySize,
  311. void *value, signed long valueSize);
  312. struct __DRI2blobExtensionRec {
  313. __DRIextension base;
  314. /**
  315. * Set cache functions for setting and getting cache entries.
  316. */
  317. void (*set_cache_funcs) (__DRIscreen *screen,
  318. __DRIblobCacheSet set, __DRIblobCacheGet get);
  319. };
  320. /**
  321. * Extension for fences / synchronization objects.
  322. */
  323. #define __DRI2_FENCE "DRI2_Fence"
  324. #define __DRI2_FENCE_VERSION 2
  325. #define __DRI2_FENCE_TIMEOUT_INFINITE 0xffffffffffffffffull
  326. #define __DRI2_FENCE_FLAG_FLUSH_COMMANDS (1 << 0)
  327. /**
  328. * \name Capabilities that might be returned by __DRI2fenceExtensionRec::get_capabilities
  329. */
  330. /*@{*/
  331. #define __DRI_FENCE_CAP_NATIVE_FD 1
  332. /*@}*/
  333. struct __DRI2fenceExtensionRec {
  334. __DRIextension base;
  335. /**
  336. * Create and insert a fence into the command stream of the context.
  337. */
  338. void *(*create_fence)(__DRIcontext *ctx);
  339. /**
  340. * Get a fence associated with the OpenCL event object.
  341. * This can be NULL, meaning that OpenCL interoperability is not supported.
  342. */
  343. void *(*get_fence_from_cl_event)(__DRIscreen *screen, intptr_t cl_event);
  344. /**
  345. * Destroy a fence.
  346. */
  347. void (*destroy_fence)(__DRIscreen *screen, void *fence);
  348. /**
  349. * This function waits and doesn't return until the fence is signalled
  350. * or the timeout expires. It returns true if the fence has been signaled.
  351. *
  352. * \param ctx the context where commands are flushed
  353. * \param fence the fence
  354. * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags
  355. * \param timeout the timeout in ns or __DRI2_FENCE_TIMEOUT_INFINITE
  356. */
  357. GLboolean (*client_wait_sync)(__DRIcontext *ctx, void *fence,
  358. unsigned flags, uint64_t timeout);
  359. /**
  360. * This function enqueues a wait command into the command stream of
  361. * the context and then returns. When the execution reaches the wait
  362. * command, no further execution will be done in the context until
  363. * the fence is signaled. This is a no-op if the device doesn't support
  364. * parallel execution of contexts.
  365. *
  366. * \param ctx the context where the waiting is done
  367. * \param fence the fence
  368. * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags that make
  369. * sense with this function (right now there are none)
  370. */
  371. void (*server_wait_sync)(__DRIcontext *ctx, void *fence, unsigned flags);
  372. /**
  373. * Query for general capabilities of the driver that concern fences.
  374. * Returns a bitmask of __DRI_FENCE_CAP_x
  375. *
  376. * \since 2
  377. */
  378. unsigned (*get_capabilities)(__DRIscreen *screen);
  379. /**
  380. * Create an fd (file descriptor) associated fence. If the fence fd
  381. * is -1, this behaves similarly to create_fence() except that when
  382. * rendering is flushed the driver creates a fence fd. Otherwise,
  383. * the driver wraps an existing fence fd.
  384. *
  385. * This is used to implement the EGL_ANDROID_native_fence_sync extension.
  386. *
  387. * \since 2
  388. *
  389. * \param ctx the context associated with the fence
  390. * \param fd the fence fd or -1
  391. */
  392. void *(*create_fence_fd)(__DRIcontext *ctx, int fd);
  393. /**
  394. * For fences created with create_fence_fd(), after rendering is flushed,
  395. * this retrieves the native fence fd. Caller takes ownership of the
  396. * fd and will close() it when it is no longer needed.
  397. *
  398. * \since 2
  399. *
  400. * \param screen the screen associated with the fence
  401. * \param fence the fence
  402. */
  403. int (*get_fence_fd)(__DRIscreen *screen, void *fence);
  404. };
  405. /**
  406. * Extension for API interop.
  407. * See GL/mesa_glinterop.h.
  408. */
  409. #define __DRI2_INTEROP "DRI2_Interop"
  410. #define __DRI2_INTEROP_VERSION 1
  411. struct mesa_glinterop_device_info;
  412. struct mesa_glinterop_export_in;
  413. struct mesa_glinterop_export_out;
  414. struct __DRI2interopExtensionRec {
  415. __DRIextension base;
  416. /** Same as MesaGLInterop*QueryDeviceInfo. */
  417. int (*query_device_info)(__DRIcontext *ctx,
  418. struct mesa_glinterop_device_info *out);
  419. /** Same as MesaGLInterop*ExportObject. */
  420. int (*export_object)(__DRIcontext *ctx,
  421. struct mesa_glinterop_export_in *in,
  422. struct mesa_glinterop_export_out *out);
  423. };
  424. /**
  425. * Extension for limiting window system back buffer rendering to user-defined
  426. * scissor region.
  427. */
  428. #define __DRI2_BUFFER_DAMAGE "DRI2_BufferDamage"
  429. #define __DRI2_BUFFER_DAMAGE_VERSION 1
  430. struct __DRI2bufferDamageExtensionRec {
  431. __DRIextension base;
  432. /**
  433. * Provides an array of rectangles representing an overriding scissor region
  434. * for rendering operations performed to the specified drawable. These
  435. * rectangles do not replace client API scissor regions or draw
  436. * co-ordinates, but instead inform the driver of the overall bounds of all
  437. * operations which will be issued before the next flush.
  438. *
  439. * Any rendering operations writing pixels outside this region to the
  440. * drawable will have an undefined effect on the entire drawable.
  441. *
  442. * This entrypoint may only be called after the drawable has either been
  443. * newly created or flushed, and before any rendering operations which write
  444. * pixels to the drawable. Calling this entrypoint at any other time will
  445. * have an undefined effect on the entire drawable.
  446. *
  447. * Calling this entrypoint with @nrects 0 and @rects NULL will reset the
  448. * region to the buffer's full size. This entrypoint may be called once to
  449. * reset the region, followed by a second call with a populated region,
  450. * before a rendering call is made.
  451. *
  452. * Used to implement EGL_KHR_partial_update.
  453. *
  454. * \param drawable affected drawable
  455. * \param nrects number of rectangles provided
  456. * \param rects the array of rectangles, lower-left origin
  457. */
  458. void (*set_damage_region)(__DRIdrawable *drawable, unsigned int nrects,
  459. int *rects);
  460. };
  461. /*@}*/
  462. /**
  463. * The following extensions describe loader features that the DRI
  464. * driver can make use of. Some of these are mandatory, such as the
  465. * getDrawableInfo extension for DRI and the DRI Loader extensions for
  466. * DRI2, while others are optional, and if present allow the driver to
  467. * expose certain features. The loader pass in a NULL terminated
  468. * array of these extensions to the driver in the createNewScreen
  469. * constructor.
  470. */
  471. typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension;
  472. typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension;
  473. typedef struct __DRIdamageExtensionRec __DRIdamageExtension;
  474. typedef struct __DRIloaderExtensionRec __DRIloaderExtension;
  475. typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension;
  476. /**
  477. * Callback to getDrawableInfo protocol
  478. */
  479. #define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo"
  480. #define __DRI_GET_DRAWABLE_INFO_VERSION 1
  481. struct __DRIgetDrawableInfoExtensionRec {
  482. __DRIextension base;
  483. /**
  484. * This function is used to get information about the position, size, and
  485. * clip rects of a drawable.
  486. */
  487. GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable,
  488. unsigned int * index, unsigned int * stamp,
  489. int * x, int * y, int * width, int * height,
  490. int * numClipRects, drm_clip_rect_t ** pClipRects,
  491. int * backX, int * backY,
  492. int * numBackClipRects, drm_clip_rect_t ** pBackClipRects,
  493. void *loaderPrivate);
  494. };
  495. /**
  496. * Callback to get system time for media stream counter extensions.
  497. */
  498. #define __DRI_SYSTEM_TIME "DRI_SystemTime"
  499. #define __DRI_SYSTEM_TIME_VERSION 1
  500. struct __DRIsystemTimeExtensionRec {
  501. __DRIextension base;
  502. /**
  503. * Get the 64-bit unadjusted system time (UST).
  504. */
  505. int (*getUST)(int64_t * ust);
  506. /**
  507. * Get the media stream counter (MSC) rate.
  508. *
  509. * Matching the definition in GLX_OML_sync_control, this function returns
  510. * the rate of the "media stream counter". In practical terms, this is
  511. * the frame refresh rate of the display.
  512. */
  513. GLboolean (*getMSCRate)(__DRIdrawable *draw,
  514. int32_t * numerator, int32_t * denominator,
  515. void *loaderPrivate);
  516. };
  517. /**
  518. * Damage reporting
  519. */
  520. #define __DRI_DAMAGE "DRI_Damage"
  521. #define __DRI_DAMAGE_VERSION 1
  522. struct __DRIdamageExtensionRec {
  523. __DRIextension base;
  524. /**
  525. * Reports areas of the given drawable which have been modified by the
  526. * driver.
  527. *
  528. * \param drawable which the drawing was done to.
  529. * \param rects rectangles affected, with the drawable origin as the
  530. * origin.
  531. * \param x X offset of the drawable within the screen (used in the
  532. * front_buffer case)
  533. * \param y Y offset of the drawable within the screen.
  534. * \param front_buffer boolean flag for whether the drawing to the
  535. * drawable was actually done directly to the front buffer (instead
  536. * of backing storage, for example)
  537. * \param loaderPrivate the data passed in at createNewDrawable time
  538. */
  539. void (*reportDamage)(__DRIdrawable *draw,
  540. int x, int y,
  541. drm_clip_rect_t *rects, int num_rects,
  542. GLboolean front_buffer,
  543. void *loaderPrivate);
  544. };
  545. #define __DRI_SWRAST_IMAGE_OP_DRAW 1
  546. #define __DRI_SWRAST_IMAGE_OP_CLEAR 2
  547. #define __DRI_SWRAST_IMAGE_OP_SWAP 3
  548. /**
  549. * SWRast Loader extension.
  550. */
  551. #define __DRI_SWRAST_LOADER "DRI_SWRastLoader"
  552. #define __DRI_SWRAST_LOADER_VERSION 5
  553. struct __DRIswrastLoaderExtensionRec {
  554. __DRIextension base;
  555. /*
  556. * Drawable position and size
  557. */
  558. void (*getDrawableInfo)(__DRIdrawable *drawable,
  559. int *x, int *y, int *width, int *height,
  560. void *loaderPrivate);
  561. /**
  562. * Put image to drawable
  563. */
  564. void (*putImage)(__DRIdrawable *drawable, int op,
  565. int x, int y, int width, int height,
  566. char *data, void *loaderPrivate);
  567. /**
  568. * Get image from readable
  569. */
  570. void (*getImage)(__DRIdrawable *readable,
  571. int x, int y, int width, int height,
  572. char *data, void *loaderPrivate);
  573. /**
  574. * Put image to drawable
  575. *
  576. * \since 2
  577. */
  578. void (*putImage2)(__DRIdrawable *drawable, int op,
  579. int x, int y, int width, int height, int stride,
  580. char *data, void *loaderPrivate);
  581. /**
  582. * Put image to drawable
  583. *
  584. * \since 3
  585. */
  586. void (*getImage2)(__DRIdrawable *readable,
  587. int x, int y, int width, int height, int stride,
  588. char *data, void *loaderPrivate);
  589. /**
  590. * Put shm image to drawable
  591. *
  592. * \since 4
  593. */
  594. void (*putImageShm)(__DRIdrawable *drawable, int op,
  595. int x, int y, int width, int height, int stride,
  596. int shmid, char *shmaddr, unsigned offset,
  597. void *loaderPrivate);
  598. /**
  599. * Get shm image from readable
  600. *
  601. * \since 4
  602. */
  603. void (*getImageShm)(__DRIdrawable *readable,
  604. int x, int y, int width, int height,
  605. int shmid, void *loaderPrivate);
  606. /**
  607. * Put shm image to drawable (v2)
  608. *
  609. * The original version fixes srcx/y to 0, and expected
  610. * the offset to be adjusted. This version allows src x,y
  611. * to not be included in the offset. This is needed to
  612. * avoid certain overflow checks in the X server, that
  613. * result in lost rendering.
  614. *
  615. * \since 5
  616. */
  617. void (*putImageShm2)(__DRIdrawable *drawable, int op,
  618. int x, int y,
  619. int width, int height, int stride,
  620. int shmid, char *shmaddr, unsigned offset,
  621. void *loaderPrivate);
  622. };
  623. /**
  624. * Invalidate loader extension. The presence of this extension
  625. * indicates to the DRI driver that the loader will call invalidate in
  626. * the __DRI2_FLUSH extension, whenever the needs to query for new
  627. * buffers. This means that the DRI driver can drop the polling in
  628. * glViewport().
  629. *
  630. * The extension doesn't provide any functionality, it's only use to
  631. * indicate to the driver that it can use the new semantics. A DRI
  632. * driver can use this to switch between the different semantics or
  633. * just refuse to initialize if this extension isn't present.
  634. */
  635. #define __DRI_USE_INVALIDATE "DRI_UseInvalidate"
  636. #define __DRI_USE_INVALIDATE_VERSION 1
  637. typedef struct __DRIuseInvalidateExtensionRec __DRIuseInvalidateExtension;
  638. struct __DRIuseInvalidateExtensionRec {
  639. __DRIextension base;
  640. };
  641. /**
  642. * The remaining extensions describe driver extensions, immediately
  643. * available interfaces provided by the driver. To start using the
  644. * driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for
  645. * the extension you need in the array.
  646. */
  647. #define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions"
  648. /**
  649. * This symbol replaces the __DRI_DRIVER_EXTENSIONS symbol, and will be
  650. * suffixed by "_drivername", allowing multiple drivers to be built into one
  651. * library, and also giving the driver the chance to return a variable driver
  652. * extensions struct depending on the driver name being loaded or any other
  653. * system state.
  654. *
  655. * The function prototype is:
  656. *
  657. * const __DRIextension **__driDriverGetExtensions_drivername(void);
  658. */
  659. #define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions"
  660. /**
  661. * Tokens for __DRIconfig attribs. A number of attributes defined by
  662. * GLX or EGL standards are not in the table, as they must be provided
  663. * by the loader. For example, FBConfig ID or visual ID, drawable type.
  664. */
  665. #define __DRI_ATTRIB_BUFFER_SIZE 1
  666. #define __DRI_ATTRIB_LEVEL 2
  667. #define __DRI_ATTRIB_RED_SIZE 3
  668. #define __DRI_ATTRIB_GREEN_SIZE 4
  669. #define __DRI_ATTRIB_BLUE_SIZE 5
  670. #define __DRI_ATTRIB_LUMINANCE_SIZE 6
  671. #define __DRI_ATTRIB_ALPHA_SIZE 7
  672. #define __DRI_ATTRIB_ALPHA_MASK_SIZE 8
  673. #define __DRI_ATTRIB_DEPTH_SIZE 9
  674. #define __DRI_ATTRIB_STENCIL_SIZE 10
  675. #define __DRI_ATTRIB_ACCUM_RED_SIZE 11
  676. #define __DRI_ATTRIB_ACCUM_GREEN_SIZE 12
  677. #define __DRI_ATTRIB_ACCUM_BLUE_SIZE 13
  678. #define __DRI_ATTRIB_ACCUM_ALPHA_SIZE 14
  679. #define __DRI_ATTRIB_SAMPLE_BUFFERS 15
  680. #define __DRI_ATTRIB_SAMPLES 16
  681. #define __DRI_ATTRIB_RENDER_TYPE 17
  682. #define __DRI_ATTRIB_CONFIG_CAVEAT 18
  683. #define __DRI_ATTRIB_CONFORMANT 19
  684. #define __DRI_ATTRIB_DOUBLE_BUFFER 20
  685. #define __DRI_ATTRIB_STEREO 21
  686. #define __DRI_ATTRIB_AUX_BUFFERS 22
  687. #define __DRI_ATTRIB_TRANSPARENT_TYPE 23
  688. #define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE 24
  689. #define __DRI_ATTRIB_TRANSPARENT_RED_VALUE 25
  690. #define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE 26
  691. #define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE 27
  692. #define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE 28
  693. #define __DRI_ATTRIB_FLOAT_MODE 29
  694. #define __DRI_ATTRIB_RED_MASK 30
  695. #define __DRI_ATTRIB_GREEN_MASK 31
  696. #define __DRI_ATTRIB_BLUE_MASK 32
  697. #define __DRI_ATTRIB_ALPHA_MASK 33
  698. #define __DRI_ATTRIB_MAX_PBUFFER_WIDTH 34
  699. #define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT 35
  700. #define __DRI_ATTRIB_MAX_PBUFFER_PIXELS 36
  701. #define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH 37
  702. #define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT 38
  703. #define __DRI_ATTRIB_VISUAL_SELECT_GROUP 39
  704. #define __DRI_ATTRIB_SWAP_METHOD 40
  705. #define __DRI_ATTRIB_MAX_SWAP_INTERVAL 41
  706. #define __DRI_ATTRIB_MIN_SWAP_INTERVAL 42
  707. #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB 43
  708. #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA 44
  709. #define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE 45
  710. #define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS 46
  711. #define __DRI_ATTRIB_YINVERTED 47
  712. #define __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE 48
  713. #define __DRI_ATTRIB_MUTABLE_RENDER_BUFFER 49 /* EGL_MUTABLE_RENDER_BUFFER_BIT_KHR */
  714. #define __DRI_ATTRIB_RED_SHIFT 50
  715. #define __DRI_ATTRIB_GREEN_SHIFT 51
  716. #define __DRI_ATTRIB_BLUE_SHIFT 52
  717. #define __DRI_ATTRIB_ALPHA_SHIFT 53
  718. #define __DRI_ATTRIB_MAX 54
  719. /* __DRI_ATTRIB_RENDER_TYPE */
  720. #define __DRI_ATTRIB_RGBA_BIT 0x01
  721. #define __DRI_ATTRIB_COLOR_INDEX_BIT 0x02
  722. #define __DRI_ATTRIB_LUMINANCE_BIT 0x04
  723. #define __DRI_ATTRIB_FLOAT_BIT 0x08
  724. #define __DRI_ATTRIB_UNSIGNED_FLOAT_BIT 0x10
  725. /* __DRI_ATTRIB_CONFIG_CAVEAT */
  726. #define __DRI_ATTRIB_SLOW_BIT 0x01
  727. #define __DRI_ATTRIB_NON_CONFORMANT_CONFIG 0x02
  728. /* __DRI_ATTRIB_TRANSPARENT_TYPE */
  729. #define __DRI_ATTRIB_TRANSPARENT_RGB 0x00
  730. #define __DRI_ATTRIB_TRANSPARENT_INDEX 0x01
  731. /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
  732. #define __DRI_ATTRIB_TEXTURE_1D_BIT 0x01
  733. #define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02
  734. #define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04
  735. /* __DRI_ATTRIB_SWAP_METHOD */
  736. /* Note that with the exception of __DRI_ATTRIB_SWAP_NONE, we need to define
  737. * the same tokens as GLX. This is because old and current X servers will
  738. * transmit the driconf value grabbed from the AIGLX driver untranslated as
  739. * the GLX fbconfig value. __DRI_ATTRIB_SWAP_NONE is only used by dri drivers
  740. * to signal to the dri core that the driconfig is single-buffer.
  741. */
  742. #define __DRI_ATTRIB_SWAP_NONE 0x0000
  743. #define __DRI_ATTRIB_SWAP_EXCHANGE 0x8061
  744. #define __DRI_ATTRIB_SWAP_COPY 0x8062
  745. #define __DRI_ATTRIB_SWAP_UNDEFINED 0x8063
  746. /**
  747. * This extension defines the core DRI functionality.
  748. *
  749. * Version >= 2 indicates that getConfigAttrib with __DRI_ATTRIB_SWAP_METHOD
  750. * returns a reliable value.
  751. */
  752. #define __DRI_CORE "DRI_Core"
  753. #define __DRI_CORE_VERSION 2
  754. struct __DRIcoreExtensionRec {
  755. __DRIextension base;
  756. __DRIscreen *(*createNewScreen)(int screen, int fd,
  757. unsigned int sarea_handle,
  758. const __DRIextension **extensions,
  759. const __DRIconfig ***driverConfigs,
  760. void *loaderPrivate);
  761. void (*destroyScreen)(__DRIscreen *screen);
  762. const __DRIextension **(*getExtensions)(__DRIscreen *screen);
  763. int (*getConfigAttrib)(const __DRIconfig *config,
  764. unsigned int attrib,
  765. unsigned int *value);
  766. int (*indexConfigAttrib)(const __DRIconfig *config, int index,
  767. unsigned int *attrib, unsigned int *value);
  768. __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
  769. const __DRIconfig *config,
  770. unsigned int drawable_id,
  771. unsigned int head,
  772. void *loaderPrivate);
  773. void (*destroyDrawable)(__DRIdrawable *drawable);
  774. void (*swapBuffers)(__DRIdrawable *drawable);
  775. __DRIcontext *(*createNewContext)(__DRIscreen *screen,
  776. const __DRIconfig *config,
  777. __DRIcontext *shared,
  778. void *loaderPrivate);
  779. int (*copyContext)(__DRIcontext *dest,
  780. __DRIcontext *src,
  781. unsigned long mask);
  782. void (*destroyContext)(__DRIcontext *context);
  783. int (*bindContext)(__DRIcontext *ctx,
  784. __DRIdrawable *pdraw,
  785. __DRIdrawable *pread);
  786. int (*unbindContext)(__DRIcontext *ctx);
  787. };
  788. /**
  789. * Stored version of some component (i.e., server-side DRI module, kernel-side
  790. * DRM, etc.).
  791. *
  792. * \todo
  793. * There are several data structures that explicitly store a major version,
  794. * minor version, and patch level. These structures should be modified to
  795. * have a \c __DRIversionRec instead.
  796. */
  797. struct __DRIversionRec {
  798. int major; /**< Major version number. */
  799. int minor; /**< Minor version number. */
  800. int patch; /**< Patch-level. */
  801. };
  802. /**
  803. * Framebuffer information record. Used by libGL to communicate information
  804. * about the framebuffer to the driver's \c __driCreateNewScreen function.
  805. *
  806. * In XFree86, most of this information is derrived from data returned by
  807. * calling \c XF86DRIGetDeviceInfo.
  808. *
  809. * \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen
  810. * __driUtilCreateNewScreen CallCreateNewScreen
  811. *
  812. * \bug This structure could be better named.
  813. */
  814. struct __DRIframebufferRec {
  815. unsigned char *base; /**< Framebuffer base address in the CPU's
  816. * address space. This value is calculated by
  817. * calling \c drmMap on the framebuffer handle
  818. * returned by \c XF86DRIGetDeviceInfo (or a
  819. * similar function).
  820. */
  821. int size; /**< Framebuffer size, in bytes. */
  822. int stride; /**< Number of bytes from one line to the next. */
  823. int width; /**< Pixel width of the framebuffer. */
  824. int height; /**< Pixel height of the framebuffer. */
  825. int dev_priv_size; /**< Size of the driver's dev-priv structure. */
  826. void *dev_priv; /**< Pointer to the driver's dev-priv structure. */
  827. };
  828. /**
  829. * This extension provides alternative screen, drawable and context
  830. * constructors for legacy DRI functionality. This is used in
  831. * conjunction with the core extension.
  832. */
  833. #define __DRI_LEGACY "DRI_Legacy"
  834. #define __DRI_LEGACY_VERSION 1
  835. struct __DRIlegacyExtensionRec {
  836. __DRIextension base;
  837. __DRIscreen *(*createNewScreen)(int screen,
  838. const __DRIversion *ddx_version,
  839. const __DRIversion *dri_version,
  840. const __DRIversion *drm_version,
  841. const __DRIframebuffer *frame_buffer,
  842. void *pSAREA, int fd,
  843. const __DRIextension **extensions,
  844. const __DRIconfig ***driver_configs,
  845. void *loaderPrivate);
  846. __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
  847. const __DRIconfig *config,
  848. drm_drawable_t hwDrawable,
  849. int renderType, const int *attrs,
  850. void *loaderPrivate);
  851. __DRIcontext *(*createNewContext)(__DRIscreen *screen,
  852. const __DRIconfig *config,
  853. int render_type,
  854. __DRIcontext *shared,
  855. drm_context_t hwContext,
  856. void *loaderPrivate);
  857. };
  858. /**
  859. * This extension provides alternative screen, drawable and context
  860. * constructors for swrast DRI functionality. This is used in
  861. * conjunction with the core extension.
  862. */
  863. #define __DRI_SWRAST "DRI_SWRast"
  864. #define __DRI_SWRAST_VERSION 4
  865. struct __DRIswrastExtensionRec {
  866. __DRIextension base;
  867. __DRIscreen *(*createNewScreen)(int screen,
  868. const __DRIextension **extensions,
  869. const __DRIconfig ***driver_configs,
  870. void *loaderPrivate);
  871. __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
  872. const __DRIconfig *config,
  873. void *loaderPrivate);
  874. /* Since version 2 */
  875. __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
  876. int api,
  877. const __DRIconfig *config,
  878. __DRIcontext *shared,
  879. void *data);
  880. /**
  881. * Create a context for a particular API with a set of attributes
  882. *
  883. * \since version 3
  884. *
  885. * \sa __DRIdri2ExtensionRec::createContextAttribs
  886. */
  887. __DRIcontext *(*createContextAttribs)(__DRIscreen *screen,
  888. int api,
  889. const __DRIconfig *config,
  890. __DRIcontext *shared,
  891. unsigned num_attribs,
  892. const uint32_t *attribs,
  893. unsigned *error,
  894. void *loaderPrivate);
  895. /**
  896. * createNewScreen() with the driver extensions passed in.
  897. *
  898. * \since version 4
  899. */
  900. __DRIscreen *(*createNewScreen2)(int screen,
  901. const __DRIextension **loader_extensions,
  902. const __DRIextension **driver_extensions,
  903. const __DRIconfig ***driver_configs,
  904. void *loaderPrivate);
  905. };
  906. /** Common DRI function definitions, shared among DRI2 and Image extensions
  907. */
  908. typedef __DRIscreen *
  909. (*__DRIcreateNewScreen2Func)(int screen, int fd,
  910. const __DRIextension **extensions,
  911. const __DRIextension **driver_extensions,
  912. const __DRIconfig ***driver_configs,
  913. void *loaderPrivate);
  914. typedef __DRIdrawable *
  915. (*__DRIcreateNewDrawableFunc)(__DRIscreen *screen,
  916. const __DRIconfig *config,
  917. void *loaderPrivate);
  918. typedef __DRIcontext *
  919. (*__DRIcreateContextAttribsFunc)(__DRIscreen *screen,
  920. int api,
  921. const __DRIconfig *config,
  922. __DRIcontext *shared,
  923. unsigned num_attribs,
  924. const uint32_t *attribs,
  925. unsigned *error,
  926. void *loaderPrivate);
  927. typedef unsigned int
  928. (*__DRIgetAPIMaskFunc)(__DRIscreen *screen);
  929. /**
  930. * DRI2 Loader extension.
  931. */
  932. #define __DRI_BUFFER_FRONT_LEFT 0
  933. #define __DRI_BUFFER_BACK_LEFT 1
  934. #define __DRI_BUFFER_FRONT_RIGHT 2
  935. #define __DRI_BUFFER_BACK_RIGHT 3
  936. #define __DRI_BUFFER_DEPTH 4
  937. #define __DRI_BUFFER_STENCIL 5
  938. #define __DRI_BUFFER_ACCUM 6
  939. #define __DRI_BUFFER_FAKE_FRONT_LEFT 7
  940. #define __DRI_BUFFER_FAKE_FRONT_RIGHT 8
  941. #define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */
  942. #define __DRI_BUFFER_HIZ 10
  943. /* Inofficial and for internal use. Increase when adding a new buffer token. */
  944. #define __DRI_BUFFER_COUNT 11
  945. struct __DRIbufferRec {
  946. unsigned int attachment;
  947. unsigned int name;
  948. unsigned int pitch;
  949. unsigned int cpp;
  950. unsigned int flags;
  951. };
  952. #define __DRI_DRI2_LOADER "DRI_DRI2Loader"
  953. #define __DRI_DRI2_LOADER_VERSION 4
  954. enum dri_loader_cap {
  955. /* Whether the loader handles RGBA channel ordering correctly. If not,
  956. * only BGRA ordering can be exposed.
  957. */
  958. DRI_LOADER_CAP_RGBA_ORDERING,
  959. DRI_LOADER_CAP_FP16,
  960. };
  961. struct __DRIdri2LoaderExtensionRec {
  962. __DRIextension base;
  963. __DRIbuffer *(*getBuffers)(__DRIdrawable *driDrawable,
  964. int *width, int *height,
  965. unsigned int *attachments, int count,
  966. int *out_count, void *loaderPrivate);
  967. /**
  968. * Flush pending front-buffer rendering
  969. *
  970. * Any rendering that has been performed to the
  971. * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the
  972. * \c __DRI_BUFFER_FRONT_LEFT.
  973. *
  974. * \param driDrawable Drawable whose front-buffer is to be flushed
  975. * \param loaderPrivate Loader's private data that was previously passed
  976. * into __DRIdri2ExtensionRec::createNewDrawable
  977. *
  978. * \since 2
  979. */
  980. void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
  981. /**
  982. * Get list of buffers from the server
  983. *
  984. * Gets a list of buffer for the specified set of attachments. Unlike
  985. * \c ::getBuffers, this function takes a list of attachments paired with
  986. * opaque \c unsigned \c int value describing the format of the buffer.
  987. * It is the responsibility of the caller to know what the service that
  988. * allocates the buffers will expect to receive for the format.
  989. *
  990. * \param driDrawable Drawable whose buffers are being queried.
  991. * \param width Output where the width of the buffers is stored.
  992. * \param height Output where the height of the buffers is stored.
  993. * \param attachments List of pairs of attachment ID and opaque format
  994. * requested for the drawable.
  995. * \param count Number of attachment / format pairs stored in
  996. * \c attachments.
  997. * \param loaderPrivate Loader's private data that was previously passed
  998. * into __DRIdri2ExtensionRec::createNewDrawable.
  999. *
  1000. * \since 3
  1001. */
  1002. __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable,
  1003. int *width, int *height,
  1004. unsigned int *attachments, int count,
  1005. int *out_count, void *loaderPrivate);
  1006. /**
  1007. * Return a loader capability value. If the loader doesn't know the enum,
  1008. * it will return 0.
  1009. *
  1010. * \param loaderPrivate The last parameter of createNewScreen or
  1011. * createNewScreen2.
  1012. * \param cap See the enum.
  1013. *
  1014. * \since 4
  1015. */
  1016. unsigned (*getCapability)(void *loaderPrivate, enum dri_loader_cap cap);
  1017. };
  1018. /**
  1019. * This extension provides alternative screen, drawable and context
  1020. * constructors for DRI2.
  1021. */
  1022. #define __DRI_DRI2 "DRI_DRI2"
  1023. #define __DRI_DRI2_VERSION 4
  1024. #define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */
  1025. #define __DRI_API_GLES 1 /**< OpenGL ES 1.x */
  1026. #define __DRI_API_GLES2 2 /**< OpenGL ES 2.x */
  1027. #define __DRI_API_OPENGL_CORE 3 /**< OpenGL 3.2+ core profile */
  1028. #define __DRI_API_GLES3 4 /**< OpenGL ES 3.x */
  1029. #define __DRI_CTX_ATTRIB_MAJOR_VERSION 0
  1030. #define __DRI_CTX_ATTRIB_MINOR_VERSION 1
  1031. #define __DRI_CTX_ATTRIB_FLAGS 2
  1032. /**
  1033. * \requires __DRI2_ROBUSTNESS.
  1034. */
  1035. #define __DRI_CTX_ATTRIB_RESET_STRATEGY 3
  1036. #define __DRI_CTX_FLAG_DEBUG 0x00000001
  1037. #define __DRI_CTX_FLAG_FORWARD_COMPATIBLE 0x00000002
  1038. /**
  1039. * \requires __DRI2_ROBUSTNESS.
  1040. */
  1041. #define __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS 0x00000004
  1042. /**
  1043. * \requires __DRI2_NO_ERROR.
  1044. *
  1045. */
  1046. #define __DRI_CTX_FLAG_NO_ERROR 0x00000008
  1047. /**
  1048. * \name Context reset strategies.
  1049. */
  1050. /*@{*/
  1051. #define __DRI_CTX_RESET_NO_NOTIFICATION 0
  1052. #define __DRI_CTX_RESET_LOSE_CONTEXT 1
  1053. /*@}*/
  1054. #define __DRI_CTX_ATTRIB_PRIORITY 4
  1055. #define __DRI_CTX_PRIORITY_LOW 0
  1056. #define __DRI_CTX_PRIORITY_MEDIUM 1
  1057. #define __DRI_CTX_PRIORITY_HIGH 2
  1058. /**
  1059. * \name Context release behaviors.
  1060. */
  1061. /*@{*/
  1062. #define __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR 5
  1063. #define __DRI_CTX_RELEASE_BEHAVIOR_NONE 0
  1064. #define __DRI_CTX_RELEASE_BEHAVIOR_FLUSH 1
  1065. /*@}*/
  1066. /**
  1067. * \name Reasons that __DRIdri2Extension::createContextAttribs might fail
  1068. */
  1069. /*@{*/
  1070. /** Success! */
  1071. #define __DRI_CTX_ERROR_SUCCESS 0
  1072. /** Memory allocation failure */
  1073. #define __DRI_CTX_ERROR_NO_MEMORY 1
  1074. /** Client requested an API (e.g., OpenGL ES 2.0) that the driver can't do. */
  1075. #define __DRI_CTX_ERROR_BAD_API 2
  1076. /** Client requested an API version that the driver can't do. */
  1077. #define __DRI_CTX_ERROR_BAD_VERSION 3
  1078. /** Client requested a flag or combination of flags the driver can't do. */
  1079. #define __DRI_CTX_ERROR_BAD_FLAG 4
  1080. /** Client requested an attribute the driver doesn't understand. */
  1081. #define __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE 5
  1082. /** Client requested a flag the driver doesn't understand. */
  1083. #define __DRI_CTX_ERROR_UNKNOWN_FLAG 6
  1084. /*@}*/
  1085. struct __DRIdri2ExtensionRec {
  1086. __DRIextension base;
  1087. __DRIscreen *(*createNewScreen)(int screen, int fd,
  1088. const __DRIextension **extensions,
  1089. const __DRIconfig ***driver_configs,
  1090. void *loaderPrivate);
  1091. __DRIcreateNewDrawableFunc createNewDrawable;
  1092. __DRIcontext *(*createNewContext)(__DRIscreen *screen,
  1093. const __DRIconfig *config,
  1094. __DRIcontext *shared,
  1095. void *loaderPrivate);
  1096. /* Since version 2 */
  1097. __DRIgetAPIMaskFunc getAPIMask;
  1098. __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
  1099. int api,
  1100. const __DRIconfig *config,
  1101. __DRIcontext *shared,
  1102. void *data);
  1103. __DRIbuffer *(*allocateBuffer)(__DRIscreen *screen,
  1104. unsigned int attachment,
  1105. unsigned int format,
  1106. int width,
  1107. int height);
  1108. void (*releaseBuffer)(__DRIscreen *screen,
  1109. __DRIbuffer *buffer);
  1110. /**
  1111. * Create a context for a particular API with a set of attributes
  1112. *
  1113. * \since version 3
  1114. *
  1115. * \sa __DRIswrastExtensionRec::createContextAttribs
  1116. */
  1117. __DRIcreateContextAttribsFunc createContextAttribs;
  1118. /**
  1119. * createNewScreen with the driver's extension list passed in.
  1120. *
  1121. * \since version 4
  1122. */
  1123. __DRIcreateNewScreen2Func createNewScreen2;
  1124. };
  1125. /**
  1126. * This extension provides functionality to enable various EGLImage
  1127. * extensions.
  1128. */
  1129. #define __DRI_IMAGE "DRI_IMAGE"
  1130. #define __DRI_IMAGE_VERSION 17
  1131. /**
  1132. * These formats correspond to the similarly named MESA_FORMAT_*
  1133. * tokens, except in the native endian of the CPU. For example, on
  1134. * little endian __DRI_IMAGE_FORMAT_XRGB8888 corresponds to
  1135. * MESA_FORMAT_XRGB8888, but MESA_FORMAT_XRGB8888_REV on big endian.
  1136. *
  1137. * __DRI_IMAGE_FORMAT_NONE is for images that aren't directly usable
  1138. * by the driver (YUV planar formats) but serve as a base image for
  1139. * creating sub-images for the different planes within the image.
  1140. *
  1141. * R8, GR88 and NONE should not be used with createImageFromName or
  1142. * createImage, and are returned by query from sub images created with
  1143. * createImageFromNames (NONE, see above) and fromPlane (R8 & GR88).
  1144. */
  1145. #define __DRI_IMAGE_FORMAT_RGB565 0x1001
  1146. #define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
  1147. #define __DRI_IMAGE_FORMAT_ARGB8888 0x1003
  1148. #define __DRI_IMAGE_FORMAT_ABGR8888 0x1004
  1149. #define __DRI_IMAGE_FORMAT_XBGR8888 0x1005
  1150. #define __DRI_IMAGE_FORMAT_R8 0x1006 /* Since version 5 */
  1151. #define __DRI_IMAGE_FORMAT_GR88 0x1007
  1152. #define __DRI_IMAGE_FORMAT_NONE 0x1008
  1153. #define __DRI_IMAGE_FORMAT_XRGB2101010 0x1009
  1154. #define __DRI_IMAGE_FORMAT_ARGB2101010 0x100a
  1155. #define __DRI_IMAGE_FORMAT_SARGB8 0x100b
  1156. #define __DRI_IMAGE_FORMAT_ARGB1555 0x100c
  1157. #define __DRI_IMAGE_FORMAT_R16 0x100d
  1158. #define __DRI_IMAGE_FORMAT_GR1616 0x100e
  1159. #define __DRI_IMAGE_FORMAT_YUYV 0x100f
  1160. #define __DRI_IMAGE_FORMAT_XBGR2101010 0x1010
  1161. #define __DRI_IMAGE_FORMAT_ABGR2101010 0x1011
  1162. #define __DRI_IMAGE_FORMAT_SABGR8 0x1012
  1163. #define __DRI_IMAGE_FORMAT_UYVY 0x1013
  1164. #define __DRI_IMAGE_FORMAT_XBGR16161616F 0x1014
  1165. #define __DRI_IMAGE_FORMAT_ABGR16161616F 0x1015
  1166. #define __DRI_IMAGE_FORMAT_SXRGB8 0x1016
  1167. #define __DRI_IMAGE_USE_SHARE 0x0001
  1168. #define __DRI_IMAGE_USE_SCANOUT 0x0002
  1169. #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Deprecated */
  1170. #define __DRI_IMAGE_USE_LINEAR 0x0008
  1171. /* The buffer will only be read by an external process after SwapBuffers,
  1172. * in contrary to gbm buffers, front buffers and fake front buffers, which
  1173. * could be read after a flush."
  1174. */
  1175. #define __DRI_IMAGE_USE_BACKBUFFER 0x0010
  1176. #define __DRI_IMAGE_TRANSFER_READ 0x1
  1177. #define __DRI_IMAGE_TRANSFER_WRITE 0x2
  1178. #define __DRI_IMAGE_TRANSFER_READ_WRITE \
  1179. (__DRI_IMAGE_TRANSFER_READ | __DRI_IMAGE_TRANSFER_WRITE)
  1180. /**
  1181. * Extra fourcc formats used internally to Mesa with createImageFromNames.
  1182. * The externally-available fourccs are defined by drm_fourcc.h (DRM_FORMAT_*)
  1183. * and WL_DRM_FORMAT_* from wayland_drm.h.
  1184. *
  1185. * \since 5
  1186. */
  1187. #define __DRI_IMAGE_FOURCC_SARGB8888 0x83324258
  1188. #define __DRI_IMAGE_FOURCC_SABGR8888 0x84324258
  1189. #define __DRI_IMAGE_FOURCC_SXRGB8888 0x85324258
  1190. /**
  1191. * Queryable on images created by createImageFromNames.
  1192. *
  1193. * RGB and RGBA are may be usable directly as images but its still
  1194. * recommended to call fromPlanar with plane == 0.
  1195. *
  1196. * Y_U_V, Y_UV,Y_XUXV and Y_UXVX all requires call to fromPlanar to create
  1197. * usable sub-images, sampling from images return raw YUV data and
  1198. * color conversion needs to be done in the shader.
  1199. *
  1200. * \since 5
  1201. */
  1202. #define __DRI_IMAGE_COMPONENTS_RGB 0x3001
  1203. #define __DRI_IMAGE_COMPONENTS_RGBA 0x3002
  1204. #define __DRI_IMAGE_COMPONENTS_Y_U_V 0x3003
  1205. #define __DRI_IMAGE_COMPONENTS_Y_UV 0x3004
  1206. #define __DRI_IMAGE_COMPONENTS_Y_XUXV 0x3005
  1207. #define __DRI_IMAGE_COMPONENTS_Y_UXVX 0x3008
  1208. #define __DRI_IMAGE_COMPONENTS_AYUV 0x3009
  1209. #define __DRI_IMAGE_COMPONENTS_XYUV 0x300A
  1210. #define __DRI_IMAGE_COMPONENTS_R 0x3006
  1211. #define __DRI_IMAGE_COMPONENTS_RG 0x3007
  1212. /**
  1213. * queryImage attributes
  1214. */
  1215. #define __DRI_IMAGE_ATTRIB_STRIDE 0x2000
  1216. #define __DRI_IMAGE_ATTRIB_HANDLE 0x2001
  1217. #define __DRI_IMAGE_ATTRIB_NAME 0x2002
  1218. #define __DRI_IMAGE_ATTRIB_FORMAT 0x2003 /* available in versions 3+ */
  1219. #define __DRI_IMAGE_ATTRIB_WIDTH 0x2004 /* available in versions 4+ */
  1220. #define __DRI_IMAGE_ATTRIB_HEIGHT 0x2005
  1221. #define __DRI_IMAGE_ATTRIB_COMPONENTS 0x2006 /* available in versions 5+ */
  1222. #define __DRI_IMAGE_ATTRIB_FD 0x2007 /* available in versions
  1223. * 7+. Each query will return a
  1224. * new fd. */
  1225. #define __DRI_IMAGE_ATTRIB_FOURCC 0x2008 /* available in versions 11 */
  1226. #define __DRI_IMAGE_ATTRIB_NUM_PLANES 0x2009 /* available in versions 11 */
  1227. #define __DRI_IMAGE_ATTRIB_OFFSET 0x200A /* available in versions 13 */
  1228. #define __DRI_IMAGE_ATTRIB_MODIFIER_LOWER 0x200B /* available in versions 14 */
  1229. #define __DRI_IMAGE_ATTRIB_MODIFIER_UPPER 0x200C /* available in versions 14 */
  1230. enum __DRIYUVColorSpace {
  1231. __DRI_YUV_COLOR_SPACE_UNDEFINED = 0,
  1232. __DRI_YUV_COLOR_SPACE_ITU_REC601 = 0x327F,
  1233. __DRI_YUV_COLOR_SPACE_ITU_REC709 = 0x3280,
  1234. __DRI_YUV_COLOR_SPACE_ITU_REC2020 = 0x3281
  1235. };
  1236. enum __DRISampleRange {
  1237. __DRI_YUV_RANGE_UNDEFINED = 0,
  1238. __DRI_YUV_FULL_RANGE = 0x3282,
  1239. __DRI_YUV_NARROW_RANGE = 0x3283
  1240. };
  1241. enum __DRIChromaSiting {
  1242. __DRI_YUV_CHROMA_SITING_UNDEFINED = 0,
  1243. __DRI_YUV_CHROMA_SITING_0 = 0x3284,
  1244. __DRI_YUV_CHROMA_SITING_0_5 = 0x3285
  1245. };
  1246. /**
  1247. * \name Reasons that __DRIimageExtensionRec::createImageFromTexture or
  1248. * __DRIimageExtensionRec::createImageFromDmaBufs might fail
  1249. */
  1250. /*@{*/
  1251. /** Success! */
  1252. #define __DRI_IMAGE_ERROR_SUCCESS 0
  1253. /** Memory allocation failure */
  1254. #define __DRI_IMAGE_ERROR_BAD_ALLOC 1
  1255. /** Client requested an invalid attribute */
  1256. #define __DRI_IMAGE_ERROR_BAD_MATCH 2
  1257. /** Client requested an invalid texture object */
  1258. #define __DRI_IMAGE_ERROR_BAD_PARAMETER 3
  1259. /** Client requested an invalid pitch and/or offset */
  1260. #define __DRI_IMAGE_ERROR_BAD_ACCESS 4
  1261. /*@}*/
  1262. /**
  1263. * \name Capabilities that might be returned by __DRIimageExtensionRec::getCapabilities
  1264. */
  1265. /*@{*/
  1266. #define __DRI_IMAGE_CAP_GLOBAL_NAMES 1
  1267. /*@}*/
  1268. /**
  1269. * blitImage flags
  1270. */
  1271. #define __BLIT_FLAG_FLUSH 0x0001
  1272. #define __BLIT_FLAG_FINISH 0x0002
  1273. /**
  1274. * queryDmaBufFormatModifierAttribs attributes
  1275. */
  1276. /* Available in version 16 */
  1277. #define __DRI_IMAGE_FORMAT_MODIFIER_ATTRIB_PLANE_COUNT 0x0001
  1278. typedef struct __DRIimageRec __DRIimage;
  1279. typedef struct __DRIimageExtensionRec __DRIimageExtension;
  1280. struct __DRIimageExtensionRec {
  1281. __DRIextension base;
  1282. __DRIimage *(*createImageFromName)(__DRIscreen *screen,
  1283. int width, int height, int format,
  1284. int name, int pitch,
  1285. void *loaderPrivate);
  1286. /* Deprecated since version 17; see createImageFromRenderbuffer2 */
  1287. __DRIimage *(*createImageFromRenderbuffer)(__DRIcontext *context,
  1288. int renderbuffer,
  1289. void *loaderPrivate);
  1290. void (*destroyImage)(__DRIimage *image);
  1291. __DRIimage *(*createImage)(__DRIscreen *screen,
  1292. int width, int height, int format,
  1293. unsigned int use,
  1294. void *loaderPrivate);
  1295. GLboolean (*queryImage)(__DRIimage *image, int attrib, int *value);
  1296. /**
  1297. * The new __DRIimage will share the content with the old one, see dup(2).
  1298. */
  1299. __DRIimage *(*dupImage)(__DRIimage *image, void *loaderPrivate);
  1300. /**
  1301. * Validate that a __DRIimage can be used a certain way.
  1302. *
  1303. * \since 2
  1304. */
  1305. GLboolean (*validateUsage)(__DRIimage *image, unsigned int use);
  1306. /**
  1307. * Unlike createImageFromName __DRI_IMAGE_FORMAT is not used but instead
  1308. * DRM_FORMAT_*, and strides are in bytes not pixels. Stride is
  1309. * also per block and not per pixel (for non-RGB, see gallium blocks).
  1310. *
  1311. * \since 5
  1312. */
  1313. __DRIimage *(*createImageFromNames)(__DRIscreen *screen,
  1314. int width, int height, int fourcc,
  1315. int *names, int num_names,
  1316. int *strides, int *offsets,
  1317. void *loaderPrivate);
  1318. /**
  1319. * Create an image out of a sub-region of a parent image. This
  1320. * entry point lets us create individual __DRIimages for different
  1321. * planes in a planar buffer (typically yuv), for example. While a
  1322. * sub-image shares the underlying buffer object with the parent
  1323. * image and other sibling sub-images, the life times of parent and
  1324. * sub-images are not dependent. Destroying the parent or a
  1325. * sub-image doesn't affect other images. The underlying buffer
  1326. * object is free when no __DRIimage remains that references it.
  1327. *
  1328. * Sub-images may overlap, but rendering to overlapping sub-images
  1329. * is undefined.
  1330. *
  1331. * \since 5
  1332. */
  1333. __DRIimage *(*fromPlanar)(__DRIimage *image, int plane,
  1334. void *loaderPrivate);
  1335. /**
  1336. * Create image from texture.
  1337. *
  1338. * \since 6
  1339. */
  1340. __DRIimage *(*createImageFromTexture)(__DRIcontext *context,
  1341. int target,
  1342. unsigned texture,
  1343. int depth,
  1344. int level,
  1345. unsigned *error,
  1346. void *loaderPrivate);
  1347. /**
  1348. * Like createImageFromNames, but takes a prime fd instead.
  1349. *
  1350. * \since 7
  1351. */
  1352. __DRIimage *(*createImageFromFds)(__DRIscreen *screen,
  1353. int width, int height, int fourcc,
  1354. int *fds, int num_fds,
  1355. int *strides, int *offsets,
  1356. void *loaderPrivate);
  1357. /**
  1358. * Like createImageFromFds, but takes additional attributes.
  1359. *
  1360. * For EGL_EXT_image_dma_buf_import.
  1361. *
  1362. * \since 8
  1363. */
  1364. __DRIimage *(*createImageFromDmaBufs)(__DRIscreen *screen,
  1365. int width, int height, int fourcc,
  1366. int *fds, int num_fds,
  1367. int *strides, int *offsets,
  1368. enum __DRIYUVColorSpace color_space,
  1369. enum __DRISampleRange sample_range,
  1370. enum __DRIChromaSiting horiz_siting,
  1371. enum __DRIChromaSiting vert_siting,
  1372. unsigned *error,
  1373. void *loaderPrivate);
  1374. /**
  1375. * Blit a part of a __DRIimage to another and flushes
  1376. *
  1377. * flush_flag:
  1378. * 0: no flush
  1379. * __BLIT_FLAG_FLUSH: flush after the blit operation
  1380. * __BLIT_FLAG_FINISH: flush and wait the blit finished
  1381. *
  1382. * \since 9
  1383. */
  1384. void (*blitImage)(__DRIcontext *context, __DRIimage *dst, __DRIimage *src,
  1385. int dstx0, int dsty0, int dstwidth, int dstheight,
  1386. int srcx0, int srcy0, int srcwidth, int srcheight,
  1387. int flush_flag);
  1388. /**
  1389. * Query for general capabilities of the driver that concern
  1390. * buffer sharing and image importing.
  1391. *
  1392. * \since 10
  1393. */
  1394. int (*getCapabilities)(__DRIscreen *screen);
  1395. /**
  1396. * Returns a map of the specified region of a __DRIimage for the specified usage.
  1397. *
  1398. * flags may include __DRI_IMAGE_TRANSFER_READ, which will populate the
  1399. * mapping with the current buffer content. If __DRI_IMAGE_TRANSFER_READ
  1400. * is not included in the flags, the buffer content at map time is
  1401. * undefined. Users wanting to modify the mapping must include
  1402. * __DRI_IMAGE_TRANSFER_WRITE; if __DRI_IMAGE_TRANSFER_WRITE is not
  1403. * included, behaviour when writing the mapping is undefined.
  1404. *
  1405. * Returns the byte stride in *stride, and an opaque pointer to data
  1406. * tracking the mapping in **data, which must be passed to unmapImage().
  1407. *
  1408. * \since 12
  1409. */
  1410. void *(*mapImage)(__DRIcontext *context, __DRIimage *image,
  1411. int x0, int y0, int width, int height,
  1412. unsigned int flags, int *stride, void **data);
  1413. /**
  1414. * Unmap a previously mapped __DRIimage
  1415. *
  1416. * \since 12
  1417. */
  1418. void (*unmapImage)(__DRIcontext *context, __DRIimage *image, void *data);
  1419. /**
  1420. * Creates an image with implementation's favorite modifiers.
  1421. *
  1422. * This acts like createImage except there is a list of modifiers passed in
  1423. * which the implementation may selectively use to create the DRIimage. The
  1424. * result should be the implementation selects one modifier (perhaps it would
  1425. * hold on to a few and later pick).
  1426. *
  1427. * The created image should be destroyed with destroyImage().
  1428. *
  1429. * Returns the new DRIimage. The chosen modifier can be obtained later on
  1430. * and passed back to things like the kernel's AddFB2 interface.
  1431. *
  1432. * \sa __DRIimageRec::createImage
  1433. *
  1434. * \since 14
  1435. */
  1436. __DRIimage *(*createImageWithModifiers)(__DRIscreen *screen,
  1437. int width, int height, int format,
  1438. const uint64_t *modifiers,
  1439. const unsigned int modifier_count,
  1440. void *loaderPrivate);
  1441. /*
  1442. * Like createImageFromDmaBufs, but takes also format modifiers.
  1443. *
  1444. * For EGL_EXT_image_dma_buf_import_modifiers.
  1445. *
  1446. * \since 15
  1447. */
  1448. __DRIimage *(*createImageFromDmaBufs2)(__DRIscreen *screen,
  1449. int width, int height, int fourcc,
  1450. uint64_t modifier,
  1451. int *fds, int num_fds,
  1452. int *strides, int *offsets,
  1453. enum __DRIYUVColorSpace color_space,
  1454. enum __DRISampleRange sample_range,
  1455. enum __DRIChromaSiting horiz_siting,
  1456. enum __DRIChromaSiting vert_siting,
  1457. unsigned *error,
  1458. void *loaderPrivate);
  1459. /*
  1460. * dmabuf format query to support EGL_EXT_image_dma_buf_import_modifiers.
  1461. *
  1462. * \param max Maximum number of formats that can be accomodated into
  1463. * \param formats. If zero, no formats are returned -
  1464. * instead, the driver returns the total number of
  1465. * supported dmabuf formats in \param count.
  1466. * \param formats Buffer to fill formats into.
  1467. * \param count Count of formats returned, or, total number of
  1468. * supported formats in case \param max is zero.
  1469. *
  1470. * Returns true on success.
  1471. *
  1472. * \since 15
  1473. */
  1474. GLboolean (*queryDmaBufFormats)(__DRIscreen *screen, int max,
  1475. int *formats, int *count);
  1476. /*
  1477. * dmabuf format modifier query for a given format to support
  1478. * EGL_EXT_image_dma_buf_import_modifiers.
  1479. *
  1480. * \param fourcc The format to query modifiers for. If this format
  1481. * is not supported by the driver, return false.
  1482. * \param max Maximum number of modifiers that can be accomodated in
  1483. * \param modifiers. If zero, no modifiers are returned -
  1484. * instead, the driver returns the total number of
  1485. * modifiers for \param format in \param count.
  1486. * \param modifiers Buffer to fill modifiers into.
  1487. * \param count Count of the modifiers returned, or, total number of
  1488. * supported modifiers for \param fourcc in case
  1489. * \param max is zero.
  1490. *
  1491. * Returns true upon success.
  1492. *
  1493. * \since 15
  1494. */
  1495. GLboolean (*queryDmaBufModifiers)(__DRIscreen *screen, int fourcc,
  1496. int max, uint64_t *modifiers,
  1497. unsigned int *external_only,
  1498. int *count);
  1499. /**
  1500. * dmabuf format modifier attribute query for a given format and modifier.
  1501. *
  1502. * \param fourcc The format to query. If this format is not supported by
  1503. * the driver, return false.
  1504. * \param modifier The modifier to query. If this format+modifier is not
  1505. * supported by the driver, return false.
  1506. * \param attrib The __DRI_IMAGE_FORMAT_MODIFIER_ATTRIB to query.
  1507. * \param value A pointer to where to store the result of the query.
  1508. *
  1509. * Returns true upon success.
  1510. *
  1511. * \since 16
  1512. */
  1513. GLboolean (*queryDmaBufFormatModifierAttribs)(__DRIscreen *screen,
  1514. uint32_t fourcc, uint64_t modifier,
  1515. int attrib, uint64_t *value);
  1516. /**
  1517. * Create a DRI image from the given renderbuffer.
  1518. *
  1519. * \param context the current DRI context
  1520. * \param renderbuffer the GL name of the renderbuffer
  1521. * \param loaderPrivate for callbacks into the loader related to the image
  1522. * \param error will be set to one of __DRI_IMAGE_ERROR_xxx
  1523. * \return the newly created image on success, or NULL otherwise
  1524. *
  1525. * \since 17
  1526. */
  1527. __DRIimage *(*createImageFromRenderbuffer2)(__DRIcontext *context,
  1528. int renderbuffer,
  1529. void *loaderPrivate,
  1530. unsigned *error);
  1531. };
  1532. /**
  1533. * This extension must be implemented by the loader and passed to the
  1534. * driver at screen creation time. The EGLImage entry points in the
  1535. * various client APIs take opaque EGLImage handles and use this
  1536. * extension to map them to a __DRIimage. At version 1, this
  1537. * extensions allows mapping EGLImage pointers to __DRIimage pointers,
  1538. * but future versions could support other EGLImage-like, opaque types
  1539. * with new lookup functions.
  1540. */
  1541. #define __DRI_IMAGE_LOOKUP "DRI_IMAGE_LOOKUP"
  1542. #define __DRI_IMAGE_LOOKUP_VERSION 1
  1543. typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension;
  1544. struct __DRIimageLookupExtensionRec {
  1545. __DRIextension base;
  1546. __DRIimage *(*lookupEGLImage)(__DRIscreen *screen, void *image,
  1547. void *loaderPrivate);
  1548. };
  1549. /**
  1550. * This extension allows for common DRI2 options
  1551. */
  1552. #define __DRI2_CONFIG_QUERY "DRI_CONFIG_QUERY"
  1553. #define __DRI2_CONFIG_QUERY_VERSION 1
  1554. typedef struct __DRI2configQueryExtensionRec __DRI2configQueryExtension;
  1555. struct __DRI2configQueryExtensionRec {
  1556. __DRIextension base;
  1557. int (*configQueryb)(__DRIscreen *screen, const char *var, unsigned char *val);
  1558. int (*configQueryi)(__DRIscreen *screen, const char *var, int *val);
  1559. int (*configQueryf)(__DRIscreen *screen, const char *var, float *val);
  1560. };
  1561. /**
  1562. * Robust context driver extension.
  1563. *
  1564. * Existence of this extension means the driver can accept the
  1565. * \c __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag and the
  1566. * \c __DRI_CTX_ATTRIB_RESET_STRATEGY attribute in
  1567. * \c __DRIdri2ExtensionRec::createContextAttribs.
  1568. */
  1569. #define __DRI2_ROBUSTNESS "DRI_Robustness"
  1570. #define __DRI2_ROBUSTNESS_VERSION 1
  1571. typedef struct __DRIrobustnessExtensionRec __DRIrobustnessExtension;
  1572. struct __DRIrobustnessExtensionRec {
  1573. __DRIextension base;
  1574. };
  1575. /**
  1576. * No-error context driver extension.
  1577. *
  1578. * Existence of this extension means the driver can accept the
  1579. * __DRI_CTX_FLAG_NO_ERROR flag.
  1580. */
  1581. #define __DRI2_NO_ERROR "DRI_NoError"
  1582. #define __DRI2_NO_ERROR_VERSION 1
  1583. typedef struct __DRInoErrorExtensionRec {
  1584. __DRIextension base;
  1585. } __DRInoErrorExtension;
  1586. /*
  1587. * Flush control driver extension.
  1588. *
  1589. * Existence of this extension means the driver can accept the
  1590. * \c __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR attribute in
  1591. * \c __DRIdri2ExtensionRec::createContextAttribs.
  1592. */
  1593. #define __DRI2_FLUSH_CONTROL "DRI_FlushControl"
  1594. #define __DRI2_FLUSH_CONTROL_VERSION 1
  1595. typedef struct __DRI2flushControlExtensionRec __DRI2flushControlExtension;
  1596. struct __DRI2flushControlExtensionRec {
  1597. __DRIextension base;
  1598. };
  1599. /**
  1600. * DRI config options extension.
  1601. *
  1602. * This extension provides the XML string containing driver options for use by
  1603. * the loader in supporting the driconf application.
  1604. *
  1605. * v2:
  1606. * - Add the getXml getter function which allows the driver more flexibility in
  1607. * how the XML is provided.
  1608. * - Deprecate the direct xml pointer. It is only provided as a fallback for
  1609. * older versions of libGL and must not be used by clients that are aware of
  1610. * the newer version. Future driver versions may set it to NULL.
  1611. */
  1612. #define __DRI_CONFIG_OPTIONS "DRI_ConfigOptions"
  1613. #define __DRI_CONFIG_OPTIONS_VERSION 2
  1614. typedef struct __DRIconfigOptionsExtensionRec {
  1615. __DRIextension base;
  1616. const char *xml; /**< deprecated since v2, use getXml instead */
  1617. /**
  1618. * Get an XML string that describes available driver options for use by a
  1619. * config application.
  1620. *
  1621. * The returned string must be heap-allocated. The caller is responsible for
  1622. * freeing it.
  1623. */
  1624. char *(*getXml)(const char *driver_name);
  1625. } __DRIconfigOptionsExtension;
  1626. /**
  1627. * This extension provides a driver vtable to a set of common driver helper
  1628. * functions (driCoreExtension, driDRI2Extension) within the driver
  1629. * implementation, as opposed to having to pass them through a global
  1630. * variable.
  1631. *
  1632. * It is not intended to be public API to the actual loader, and the vtable
  1633. * layout may change at any time.
  1634. */
  1635. #define __DRI_DRIVER_VTABLE "DRI_DriverVtable"
  1636. #define __DRI_DRIVER_VTABLE_VERSION 1
  1637. typedef struct __DRIDriverVtableExtensionRec {
  1638. __DRIextension base;
  1639. const struct __DriverAPIRec *vtable;
  1640. } __DRIDriverVtableExtension;
  1641. /**
  1642. * Query renderer driver extension
  1643. *
  1644. * This allows the window system layer (either EGL or GLX) to query aspects of
  1645. * hardware and driver support without creating a context.
  1646. */
  1647. #define __DRI2_RENDERER_QUERY "DRI_RENDERER_QUERY"
  1648. #define __DRI2_RENDERER_QUERY_VERSION 1
  1649. #define __DRI2_RENDERER_VENDOR_ID 0x0000
  1650. #define __DRI2_RENDERER_DEVICE_ID 0x0001
  1651. #define __DRI2_RENDERER_VERSION 0x0002
  1652. #define __DRI2_RENDERER_ACCELERATED 0x0003
  1653. #define __DRI2_RENDERER_VIDEO_MEMORY 0x0004
  1654. #define __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE 0x0005
  1655. #define __DRI2_RENDERER_PREFERRED_PROFILE 0x0006
  1656. #define __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION 0x0007
  1657. #define __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION 0x0008
  1658. #define __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION 0x0009
  1659. #define __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION 0x000a
  1660. #define __DRI2_RENDERER_HAS_TEXTURE_3D 0x000b
  1661. /* Whether there is an sRGB format support for every supported 32-bit UNORM
  1662. * color format.
  1663. */
  1664. #define __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB 0x000c
  1665. /* Bitmaks of supported/available context priorities - must match
  1666. * __EGL_CONTEXT_PRIORITY_LOW_BIT et al
  1667. */
  1668. #define __DRI2_RENDERER_HAS_CONTEXT_PRIORITY 0x000d
  1669. #define __DRI2_RENDERER_HAS_CONTEXT_PRIORITY_LOW (1 << 0)
  1670. #define __DRI2_RENDERER_HAS_CONTEXT_PRIORITY_MEDIUM (1 << 1)
  1671. #define __DRI2_RENDERER_HAS_CONTEXT_PRIORITY_HIGH (1 << 2)
  1672. typedef struct __DRI2rendererQueryExtensionRec __DRI2rendererQueryExtension;
  1673. struct __DRI2rendererQueryExtensionRec {
  1674. __DRIextension base;
  1675. int (*queryInteger)(__DRIscreen *screen, int attribute, unsigned int *val);
  1676. int (*queryString)(__DRIscreen *screen, int attribute, const char **val);
  1677. };
  1678. /**
  1679. * Image Loader extension. Drivers use this to allocate color buffers
  1680. */
  1681. /**
  1682. * See __DRIimageLoaderExtensionRec::getBuffers::buffer_mask.
  1683. */
  1684. enum __DRIimageBufferMask {
  1685. __DRI_IMAGE_BUFFER_BACK = (1 << 0),
  1686. __DRI_IMAGE_BUFFER_FRONT = (1 << 1),
  1687. /**
  1688. * A buffer shared between application and compositor. The buffer may be
  1689. * simultaneously accessed by each.
  1690. *
  1691. * A shared buffer is equivalent to an EGLSurface whose EGLConfig contains
  1692. * EGL_MUTABLE_RENDER_BUFFER_BIT_KHR and whose active EGL_RENDER_BUFFER (as
  1693. * opposed to any pending, requested change to EGL_RENDER_BUFFER) is
  1694. * EGL_SINGLE_BUFFER.
  1695. *
  1696. * If buffer_mask contains __DRI_IMAGE_BUFFER_SHARED, then must contains no
  1697. * other bits. As a corollary, a __DRIdrawable that has a "shared" buffer
  1698. * has no front nor back buffer.
  1699. *
  1700. * The loader returns __DRI_IMAGE_BUFFER_SHARED in buffer_mask if and only
  1701. * if:
  1702. * - The loader supports __DRI_MUTABLE_RENDER_BUFFER_LOADER.
  1703. * - The driver supports __DRI_MUTABLE_RENDER_BUFFER_DRIVER.
  1704. * - The EGLConfig of the drawable EGLSurface contains
  1705. * EGL_MUTABLE_RENDER_BUFFER_BIT_KHR.
  1706. * - The EGLContext's EGL_RENDER_BUFFER is EGL_SINGLE_BUFFER.
  1707. * Equivalently, the EGLSurface's active EGL_RENDER_BUFFER (as
  1708. * opposed to any pending, requested change to EGL_RENDER_BUFFER) is
  1709. * EGL_SINGLE_BUFFER. (See the EGL 1.5 and
  1710. * EGL_KHR_mutable_render_buffer spec for details about "pending" vs
  1711. * "active" EGL_RENDER_BUFFER state).
  1712. *
  1713. * A shared buffer is similar to a front buffer in that all rendering to the
  1714. * buffer should appear promptly on the screen. It is different from
  1715. * a front buffer in that its behavior is independent from the
  1716. * GL_DRAW_BUFFER state. Specifically, if GL_DRAW_FRAMEBUFFER is 0 and the
  1717. * __DRIdrawable's buffer_mask is __DRI_IMAGE_BUFFER_SHARED, then all
  1718. * rendering should appear promptly on the screen if GL_DRAW_BUFFER is not
  1719. * GL_NONE.
  1720. *
  1721. * The difference between a shared buffer and a front buffer is motivated
  1722. * by the constraints of Android and OpenGL ES. OpenGL ES does not support
  1723. * front-buffer rendering. Android's SurfaceFlinger protocol provides the
  1724. * EGL driver only a back buffer and no front buffer. The shared buffer
  1725. * mode introduced by EGL_KHR_mutable_render_buffer is a backdoor though
  1726. * EGL that allows Android OpenGL ES applications to render to what is
  1727. * effectively the front buffer, a backdoor that required no change to the
  1728. * OpenGL ES API and little change to the SurfaceFlinger API.
  1729. */
  1730. __DRI_IMAGE_BUFFER_SHARED = (1 << 2),
  1731. };
  1732. struct __DRIimageList {
  1733. uint32_t image_mask;
  1734. __DRIimage *back;
  1735. __DRIimage *front;
  1736. };
  1737. #define __DRI_IMAGE_LOADER "DRI_IMAGE_LOADER"
  1738. #define __DRI_IMAGE_LOADER_VERSION 3
  1739. struct __DRIimageLoaderExtensionRec {
  1740. __DRIextension base;
  1741. /**
  1742. * Allocate color buffers.
  1743. *
  1744. * \param driDrawable
  1745. * \param width Width of allocated buffers
  1746. * \param height Height of allocated buffers
  1747. * \param format one of __DRI_IMAGE_FORMAT_*
  1748. * \param stamp Address of variable to be updated when
  1749. * getBuffers must be called again
  1750. * \param loaderPrivate The loaderPrivate for driDrawable
  1751. * \param buffer_mask Set of buffers to allocate. A bitmask of
  1752. * __DRIimageBufferMask.
  1753. * \param buffers Returned buffers
  1754. */
  1755. int (*getBuffers)(__DRIdrawable *driDrawable,
  1756. unsigned int format,
  1757. uint32_t *stamp,
  1758. void *loaderPrivate,
  1759. uint32_t buffer_mask,
  1760. struct __DRIimageList *buffers);
  1761. /**
  1762. * Flush pending front-buffer rendering
  1763. *
  1764. * Any rendering that has been performed to the
  1765. * fake front will be flushed to the front
  1766. *
  1767. * \param driDrawable Drawable whose front-buffer is to be flushed
  1768. * \param loaderPrivate Loader's private data that was previously passed
  1769. * into __DRIdri2ExtensionRec::createNewDrawable
  1770. */
  1771. void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
  1772. /**
  1773. * Return a loader capability value. If the loader doesn't know the enum,
  1774. * it will return 0.
  1775. *
  1776. * \since 2
  1777. */
  1778. unsigned (*getCapability)(void *loaderPrivate, enum dri_loader_cap cap);
  1779. /**
  1780. * Flush swap buffers
  1781. *
  1782. * Make sure any outstanding swap buffers have been submitted to the
  1783. * device.
  1784. *
  1785. * \param driDrawable Drawable whose swaps need to be flushed
  1786. * \param loaderPrivate Loader's private data that was previously passed
  1787. * into __DRIdri2ExtensionRec::createNewDrawable
  1788. *
  1789. * \since 3
  1790. */
  1791. void (*flushSwapBuffers)(__DRIdrawable *driDrawable, void *loaderPrivate);
  1792. };
  1793. /**
  1794. * DRI extension.
  1795. */
  1796. #define __DRI_IMAGE_DRIVER "DRI_IMAGE_DRIVER"
  1797. #define __DRI_IMAGE_DRIVER_VERSION 1
  1798. struct __DRIimageDriverExtensionRec {
  1799. __DRIextension base;
  1800. /* Common DRI functions, shared with DRI2 */
  1801. __DRIcreateNewScreen2Func createNewScreen2;
  1802. __DRIcreateNewDrawableFunc createNewDrawable;
  1803. __DRIcreateContextAttribsFunc createContextAttribs;
  1804. __DRIgetAPIMaskFunc getAPIMask;
  1805. };
  1806. /**
  1807. * Background callable loader extension.
  1808. *
  1809. * Loaders expose this extension to indicate to drivers that they are capable
  1810. * of handling callbacks from the driver's background drawing threads.
  1811. */
  1812. #define __DRI_BACKGROUND_CALLABLE "DRI_BackgroundCallable"
  1813. #define __DRI_BACKGROUND_CALLABLE_VERSION 1
  1814. typedef struct __DRIbackgroundCallableExtensionRec __DRIbackgroundCallableExtension;
  1815. struct __DRIbackgroundCallableExtensionRec {
  1816. __DRIextension base;
  1817. /**
  1818. * Indicate that this thread is being used by the driver as a background
  1819. * drawing thread which may make callbacks to the loader.
  1820. *
  1821. * \param loaderPrivate is the value that was passed to to the driver when
  1822. * the context was created. This can be used by the loader to identify
  1823. * which context any callbacks are associated with.
  1824. *
  1825. * If this function is called more than once from any given thread, each
  1826. * subsequent call overrides the loaderPrivate data that was passed in the
  1827. * previous call. The driver can take advantage of this to re-use a
  1828. * background thread to perform drawing on behalf of multiple contexts.
  1829. *
  1830. * It is permissible for the driver to call this function from a
  1831. * non-background thread (i.e. a thread that has already been bound to a
  1832. * context using __DRIcoreExtensionRec::bindContext()); when this happens,
  1833. * the \c loaderPrivate pointer must be equal to the pointer that was
  1834. * passed to the driver when the currently bound context was created.
  1835. *
  1836. * This call should execute quickly enough that the driver can call it with
  1837. * impunity whenever a background thread starts performing drawing
  1838. * operations (e.g. it should just set a thread-local variable).
  1839. */
  1840. void (*setBackgroundContext)(void *loaderPrivate);
  1841. /**
  1842. * Indicate that it is multithread safe to use glthread. For GLX/EGL
  1843. * platforms using Xlib, that involves calling XInitThreads, before
  1844. * opening an X display.
  1845. *
  1846. * Note: only supported if extension version is at least 2.
  1847. *
  1848. * \param loaderPrivate is the value that was passed to to the driver when
  1849. * the context was created. This can be used by the loader to identify
  1850. * which context any callbacks are associated with.
  1851. */
  1852. GLboolean (*isThreadSafe)(void *loaderPrivate);
  1853. };
  1854. /**
  1855. * The driver portion of EGL_KHR_mutable_render_buffer.
  1856. *
  1857. * If the driver creates a __DRIconfig with
  1858. * __DRI_ATTRIB_MUTABLE_RENDER_BUFFER, then it must support this extension.
  1859. *
  1860. * To support this extension:
  1861. *
  1862. * - The driver should create at least one __DRIconfig with
  1863. * __DRI_ATTRIB_MUTABLE_RENDER_BUFFER. This is strongly recommended but
  1864. * not required.
  1865. *
  1866. * - The driver must be able to handle __DRI_IMAGE_BUFFER_SHARED if
  1867. * returned by __DRIimageLoaderExtension:getBuffers().
  1868. *
  1869. * - When rendering to __DRI_IMAGE_BUFFER_SHARED, it must call
  1870. * __DRImutableRenderBufferLoaderExtension::displaySharedBuffer() in
  1871. * response to glFlush and glFinish. (This requirement is not documented
  1872. * in EGL_KHR_mutable_render_buffer, but is a de-facto requirement in the
  1873. * Android ecosystem. Android applications expect that glFlush will
  1874. * immediately display the buffer when in shared buffer mode, and Android
  1875. * drivers comply with this expectation). It :may: call
  1876. * displaySharedBuffer() more often than required.
  1877. *
  1878. * - When rendering to __DRI_IMAGE_BUFFER_SHARED, it must ensure that the
  1879. * buffer is always in a format compatible for display because the
  1880. * display engine (usually SurfaceFlinger or hwcomposer) may display the
  1881. * image at any time, even concurrently with 3D rendering. For example,
  1882. * display hardware and the GL hardware may be able to access the buffer
  1883. * simultaneously. In particular, if the buffer is compressed then take
  1884. * care that SurfaceFlinger and hwcomposer can consume the compression
  1885. * format.
  1886. *
  1887. * \see __DRI_IMAGE_BUFFER_SHARED
  1888. * \see __DRI_ATTRIB_MUTABLE_RENDER_BUFFER
  1889. * \see __DRI_MUTABLE_RENDER_BUFFER_LOADER
  1890. */
  1891. #define __DRI_MUTABLE_RENDER_BUFFER_DRIVER "DRI_MutableRenderBufferDriver"
  1892. #define __DRI_MUTABLE_RENDER_BUFFER_DRIVER_VERSION 1
  1893. typedef struct __DRImutableRenderBufferDriverExtensionRec __DRImutableRenderBufferDriverExtension;
  1894. struct __DRImutableRenderBufferDriverExtensionRec {
  1895. __DRIextension base;
  1896. };
  1897. /**
  1898. * The loader portion of EGL_KHR_mutable_render_buffer.
  1899. *
  1900. * Requires loader extension DRI_IMAGE_LOADER, through which the loader sends
  1901. * __DRI_IMAGE_BUFFER_SHARED to the driver.
  1902. *
  1903. * \see __DRI_MUTABLE_RENDER_BUFFER_DRIVER
  1904. */
  1905. #define __DRI_MUTABLE_RENDER_BUFFER_LOADER "DRI_MutableRenderBufferLoader"
  1906. #define __DRI_MUTABLE_RENDER_BUFFER_LOADER_VERSION 1
  1907. typedef struct __DRImutableRenderBufferLoaderExtensionRec __DRImutableRenderBufferLoaderExtension;
  1908. struct __DRImutableRenderBufferLoaderExtensionRec {
  1909. __DRIextension base;
  1910. /**
  1911. * Inform the display engine (that is, SurfaceFlinger and/or hwcomposer)
  1912. * that the __DRIdrawable has new content.
  1913. *
  1914. * The display engine may ignore this call, for example, if it continually
  1915. * refreshes and displays the buffer on every frame, as in
  1916. * EGL_ANDROID_front_buffer_auto_refresh. On the other extreme, the display
  1917. * engine may refresh and display the buffer only in frames in which the
  1918. * driver calls this.
  1919. *
  1920. * If the fence_fd is not -1, then the display engine will display the
  1921. * buffer only after the fence signals.
  1922. *
  1923. * The drawable's current __DRIimageBufferMask, as returned by
  1924. * __DRIimageLoaderExtension::getBuffers(), must be
  1925. * __DRI_IMAGE_BUFFER_SHARED.
  1926. */
  1927. void (*displaySharedBuffer)(__DRIdrawable *drawable, int fence_fd,
  1928. void *loaderPrivate);
  1929. };
  1930. #endif