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 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  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. /* For archs with no drm.h */
  41. #if !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(__GNU__)
  42. #include <drm.h>
  43. #else
  44. typedef unsigned int drm_context_t;
  45. typedef unsigned int drm_drawable_t;
  46. typedef struct drm_clip_rect drm_clip_rect_t;
  47. #endif
  48. /**
  49. * \name DRI interface structures
  50. *
  51. * The following structures define the interface between the GLX client
  52. * side library and the DRI (direct rendering infrastructure).
  53. */
  54. /*@{*/
  55. typedef struct __DRIdisplayRec __DRIdisplay;
  56. typedef struct __DRIscreenRec __DRIscreen;
  57. typedef struct __DRIcontextRec __DRIcontext;
  58. typedef struct __DRIdrawableRec __DRIdrawable;
  59. typedef struct __DRIconfigRec __DRIconfig;
  60. typedef struct __DRIframebufferRec __DRIframebuffer;
  61. typedef struct __DRIversionRec __DRIversion;
  62. typedef struct __DRIcoreExtensionRec __DRIcoreExtension;
  63. typedef struct __DRIextensionRec __DRIextension;
  64. typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension;
  65. typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension;
  66. typedef struct __DRIallocateExtensionRec __DRIallocateExtension;
  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. /*@}*/
  78. /**
  79. * Extension struct. Drivers 'inherit' from this struct by embedding
  80. * it as the first element in the extension struct.
  81. *
  82. * We never break API in for a DRI extension. If we need to change
  83. * the way things work in a non-backwards compatible manner, we
  84. * introduce a new extension. During a transition period, we can
  85. * leave both the old and the new extension in the driver, which
  86. * allows us to move to the new interface without having to update the
  87. * loader(s) in lock step.
  88. *
  89. * However, we can add entry points to an extension over time as long
  90. * as we don't break the old ones. As we add entry points to an
  91. * extension, we increase the version number. The corresponding
  92. * #define can be used to guard code that accesses the new entry
  93. * points at compile time and the version field in the extension
  94. * struct can be used at run-time to determine how to use the
  95. * extension.
  96. */
  97. struct __DRIextensionRec {
  98. const char *name;
  99. int version;
  100. };
  101. /**
  102. * The first set of extension are the screen extensions, returned by
  103. * __DRIcore::getExtensions(). This entry point will return a list of
  104. * extensions and the loader can use the ones it knows about by
  105. * casting them to more specific extensions and advertising any GLX
  106. * extensions the DRI extensions enables.
  107. */
  108. /**
  109. * Used by drivers to indicate support for setting the read drawable.
  110. */
  111. #define __DRI_READ_DRAWABLE "DRI_ReadDrawable"
  112. #define __DRI_READ_DRAWABLE_VERSION 1
  113. /**
  114. * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
  115. */
  116. #define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer"
  117. #define __DRI_COPY_SUB_BUFFER_VERSION 1
  118. struct __DRIcopySubBufferExtensionRec {
  119. __DRIextension base;
  120. void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h);
  121. };
  122. /**
  123. * Used by drivers that implement the GLX_SGI_swap_control or
  124. * GLX_MESA_swap_control extension.
  125. */
  126. #define __DRI_SWAP_CONTROL "DRI_SwapControl"
  127. #define __DRI_SWAP_CONTROL_VERSION 1
  128. struct __DRIswapControlExtensionRec {
  129. __DRIextension base;
  130. void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval);
  131. unsigned int (*getSwapInterval)(__DRIdrawable *drawable);
  132. };
  133. /**
  134. * Used by drivers that implement the GLX_MESA_allocate_memory.
  135. */
  136. #define __DRI_ALLOCATE "DRI_Allocate"
  137. #define __DRI_ALLOCATE_VERSION 1
  138. struct __DRIallocateExtensionRec {
  139. __DRIextension base;
  140. void *(*allocateMemory)(__DRIscreen *screen, GLsizei size,
  141. GLfloat readfreq, GLfloat writefreq,
  142. GLfloat priority);
  143. void (*freeMemory)(__DRIscreen *screen, GLvoid *pointer);
  144. GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer);
  145. };
  146. /**
  147. * Used by drivers that implement the GLX_MESA_swap_frame_usage extension.
  148. */
  149. #define __DRI_FRAME_TRACKING "DRI_FrameTracking"
  150. #define __DRI_FRAME_TRACKING_VERSION 1
  151. struct __DRIframeTrackingExtensionRec {
  152. __DRIextension base;
  153. /**
  154. * Enable or disable frame usage tracking.
  155. *
  156. * \since Internal API version 20030317.
  157. */
  158. int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable);
  159. /**
  160. * Retrieve frame usage information.
  161. *
  162. * \since Internal API version 20030317.
  163. */
  164. int (*queryFrameTracking)(__DRIdrawable *drawable,
  165. int64_t * sbc, int64_t * missedFrames,
  166. float * lastMissedUsage, float * usage);
  167. };
  168. /**
  169. * Used by drivers that implement the GLX_SGI_video_sync extension.
  170. */
  171. #define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter"
  172. #define __DRI_MEDIA_STREAM_COUNTER_VERSION 1
  173. struct __DRImediaStreamCounterExtensionRec {
  174. __DRIextension base;
  175. /**
  176. * Wait for the MSC to equal target_msc, or, if that has already passed,
  177. * the next time (MSC % divisor) is equal to remainder. If divisor is
  178. * zero, the function will return as soon as MSC is greater than or equal
  179. * to target_msc.
  180. */
  181. int (*waitForMSC)(__DRIdrawable *drawable,
  182. int64_t target_msc, int64_t divisor, int64_t remainder,
  183. int64_t * msc, int64_t * sbc);
  184. /**
  185. * Get the number of vertical refreshes since some point in time before
  186. * this function was first called (i.e., system start up).
  187. */
  188. int (*getDrawableMSC)(__DRIscreen *screen, __DRIdrawable *drawable,
  189. int64_t *msc);
  190. };
  191. #define __DRI_TEX_OFFSET "DRI_TexOffset"
  192. #define __DRI_TEX_OFFSET_VERSION 1
  193. struct __DRItexOffsetExtensionRec {
  194. __DRIextension base;
  195. /**
  196. * Method to override base texture image with a driver specific 'offset'.
  197. * The depth passed in allows e.g. to ignore the alpha channel of texture
  198. * images where the non-alpha components don't occupy a whole texel.
  199. *
  200. * For GLX_EXT_texture_from_pixmap with AIGLX.
  201. */
  202. void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
  203. unsigned long long offset, GLint depth, GLuint pitch);
  204. };
  205. /* Valid values for format in the setTexBuffer2 function below. These
  206. * values match the GLX tokens for compatibility reasons, but we
  207. * define them here since the DRI interface can't depend on GLX. */
  208. #define __DRI_TEXTURE_FORMAT_NONE 0x20D8
  209. #define __DRI_TEXTURE_FORMAT_RGB 0x20D9
  210. #define __DRI_TEXTURE_FORMAT_RGBA 0x20DA
  211. #define __DRI_TEX_BUFFER "DRI_TexBuffer"
  212. #define __DRI_TEX_BUFFER_VERSION 2
  213. struct __DRItexBufferExtensionRec {
  214. __DRIextension base;
  215. /**
  216. * Method to override base texture image with the contents of a
  217. * __DRIdrawable.
  218. *
  219. * For GLX_EXT_texture_from_pixmap with AIGLX. Deprecated in favor of
  220. * setTexBuffer2 in version 2 of this interface
  221. */
  222. void (*setTexBuffer)(__DRIcontext *pDRICtx,
  223. GLint target,
  224. __DRIdrawable *pDraw);
  225. /**
  226. * Method to override base texture image with the contents of a
  227. * __DRIdrawable, including the required texture format attribute.
  228. *
  229. * For GLX_EXT_texture_from_pixmap with AIGLX.
  230. */
  231. void (*setTexBuffer2)(__DRIcontext *pDRICtx,
  232. GLint target,
  233. GLint format,
  234. __DRIdrawable *pDraw);
  235. };
  236. /**
  237. * Used by drivers that implement DRI2
  238. */
  239. #define __DRI2_FLUSH "DRI2_Flush"
  240. #define __DRI2_FLUSH_VERSION 2
  241. struct __DRI2flushExtensionRec {
  242. __DRIextension base;
  243. void (*flush)(__DRIdrawable *drawable);
  244. /**
  245. * Flush all rendering queue in the driver to the drm and
  246. * invalidate all buffers. The driver will call out to
  247. * getBuffers/getBuffersWithFormat before it starts rendering
  248. * again.
  249. *
  250. * \param drawable the drawable to flush and invalidate
  251. *
  252. * \since 2
  253. */
  254. void (*flushInvalidate)(__DRIdrawable *drawable);
  255. };
  256. /**
  257. * XML document describing the configuration options supported by the
  258. * driver.
  259. */
  260. extern const char __driConfigOptions[];
  261. /*@}*/
  262. /**
  263. * The following extensions describe loader features that the DRI
  264. * driver can make use of. Some of these are mandatory, such as the
  265. * getDrawableInfo extension for DRI and the DRI Loader extensions for
  266. * DRI2, while others are optional, and if present allow the driver to
  267. * expose certain features. The loader pass in a NULL terminated
  268. * array of these extensions to the driver in the createNewScreen
  269. * constructor.
  270. */
  271. typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension;
  272. typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension;
  273. typedef struct __DRIdamageExtensionRec __DRIdamageExtension;
  274. typedef struct __DRIloaderExtensionRec __DRIloaderExtension;
  275. typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension;
  276. /**
  277. * Callback to getDrawableInfo protocol
  278. */
  279. #define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo"
  280. #define __DRI_GET_DRAWABLE_INFO_VERSION 1
  281. struct __DRIgetDrawableInfoExtensionRec {
  282. __DRIextension base;
  283. /**
  284. * This function is used to get information about the position, size, and
  285. * clip rects of a drawable.
  286. */
  287. GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable,
  288. unsigned int * index, unsigned int * stamp,
  289. int * x, int * y, int * width, int * height,
  290. int * numClipRects, drm_clip_rect_t ** pClipRects,
  291. int * backX, int * backY,
  292. int * numBackClipRects, drm_clip_rect_t ** pBackClipRects,
  293. void *loaderPrivate);
  294. };
  295. /**
  296. * Callback to get system time for media stream counter extensions.
  297. */
  298. #define __DRI_SYSTEM_TIME "DRI_SystemTime"
  299. #define __DRI_SYSTEM_TIME_VERSION 1
  300. struct __DRIsystemTimeExtensionRec {
  301. __DRIextension base;
  302. /**
  303. * Get the 64-bit unadjusted system time (UST).
  304. */
  305. int (*getUST)(int64_t * ust);
  306. /**
  307. * Get the media stream counter (MSC) rate.
  308. *
  309. * Matching the definition in GLX_OML_sync_control, this function returns
  310. * the rate of the "media stream counter". In practical terms, this is
  311. * the frame refresh rate of the display.
  312. */
  313. GLboolean (*getMSCRate)(__DRIdrawable *draw,
  314. int32_t * numerator, int32_t * denominator,
  315. void *loaderPrivate);
  316. };
  317. /**
  318. * Damage reporting
  319. */
  320. #define __DRI_DAMAGE "DRI_Damage"
  321. #define __DRI_DAMAGE_VERSION 1
  322. struct __DRIdamageExtensionRec {
  323. __DRIextension base;
  324. /**
  325. * Reports areas of the given drawable which have been modified by the
  326. * driver.
  327. *
  328. * \param drawable which the drawing was done to.
  329. * \param rects rectangles affected, with the drawable origin as the
  330. * origin.
  331. * \param x X offset of the drawable within the screen (used in the
  332. * front_buffer case)
  333. * \param y Y offset of the drawable within the screen.
  334. * \param front_buffer boolean flag for whether the drawing to the
  335. * drawable was actually done directly to the front buffer (instead
  336. * of backing storage, for example)
  337. * \param loaderPrivate the data passed in at createNewDrawable time
  338. */
  339. void (*reportDamage)(__DRIdrawable *draw,
  340. int x, int y,
  341. drm_clip_rect_t *rects, int num_rects,
  342. GLboolean front_buffer,
  343. void *loaderPrivate);
  344. };
  345. #define __DRI_SWRAST_IMAGE_OP_DRAW 1
  346. #define __DRI_SWRAST_IMAGE_OP_CLEAR 2
  347. #define __DRI_SWRAST_IMAGE_OP_SWAP 3
  348. /**
  349. * SWRast Loader extension.
  350. */
  351. #define __DRI_SWRAST_LOADER "DRI_SWRastLoader"
  352. #define __DRI_SWRAST_LOADER_VERSION 1
  353. struct __DRIswrastLoaderExtensionRec {
  354. __DRIextension base;
  355. /*
  356. * Drawable position and size
  357. */
  358. void (*getDrawableInfo)(__DRIdrawable *drawable,
  359. int *x, int *y, int *width, int *height,
  360. void *loaderPrivate);
  361. /**
  362. * Put image to drawable
  363. */
  364. void (*putImage)(__DRIdrawable *drawable, int op,
  365. int x, int y, int width, int height, char *data,
  366. void *loaderPrivate);
  367. /**
  368. * Get image from drawable
  369. */
  370. void (*getImage)(__DRIdrawable *drawable,
  371. int x, int y, int width, int height, char *data,
  372. void *loaderPrivate);
  373. };
  374. /**
  375. * The remaining extensions describe driver extensions, immediately
  376. * available interfaces provided by the driver. To start using the
  377. * driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for
  378. * the extension you need in the array.
  379. */
  380. #define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions"
  381. /**
  382. * Tokens for __DRIconfig attribs. A number of attributes defined by
  383. * GLX or EGL standards are not in the table, as they must be provided
  384. * by the loader. For example, FBConfig ID or visual ID, drawable type.
  385. */
  386. #define __DRI_ATTRIB_BUFFER_SIZE 1
  387. #define __DRI_ATTRIB_LEVEL 2
  388. #define __DRI_ATTRIB_RED_SIZE 3
  389. #define __DRI_ATTRIB_GREEN_SIZE 4
  390. #define __DRI_ATTRIB_BLUE_SIZE 5
  391. #define __DRI_ATTRIB_LUMINANCE_SIZE 6
  392. #define __DRI_ATTRIB_ALPHA_SIZE 7
  393. #define __DRI_ATTRIB_ALPHA_MASK_SIZE 8
  394. #define __DRI_ATTRIB_DEPTH_SIZE 9
  395. #define __DRI_ATTRIB_STENCIL_SIZE 10
  396. #define __DRI_ATTRIB_ACCUM_RED_SIZE 11
  397. #define __DRI_ATTRIB_ACCUM_GREEN_SIZE 12
  398. #define __DRI_ATTRIB_ACCUM_BLUE_SIZE 13
  399. #define __DRI_ATTRIB_ACCUM_ALPHA_SIZE 14
  400. #define __DRI_ATTRIB_SAMPLE_BUFFERS 15
  401. #define __DRI_ATTRIB_SAMPLES 16
  402. #define __DRI_ATTRIB_RENDER_TYPE 17
  403. #define __DRI_ATTRIB_CONFIG_CAVEAT 18
  404. #define __DRI_ATTRIB_CONFORMANT 19
  405. #define __DRI_ATTRIB_DOUBLE_BUFFER 20
  406. #define __DRI_ATTRIB_STEREO 21
  407. #define __DRI_ATTRIB_AUX_BUFFERS 22
  408. #define __DRI_ATTRIB_TRANSPARENT_TYPE 23
  409. #define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE 24
  410. #define __DRI_ATTRIB_TRANSPARENT_RED_VALUE 25
  411. #define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE 26
  412. #define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE 27
  413. #define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE 28
  414. #define __DRI_ATTRIB_FLOAT_MODE 29
  415. #define __DRI_ATTRIB_RED_MASK 30
  416. #define __DRI_ATTRIB_GREEN_MASK 31
  417. #define __DRI_ATTRIB_BLUE_MASK 32
  418. #define __DRI_ATTRIB_ALPHA_MASK 33
  419. #define __DRI_ATTRIB_MAX_PBUFFER_WIDTH 34
  420. #define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT 35
  421. #define __DRI_ATTRIB_MAX_PBUFFER_PIXELS 36
  422. #define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH 37
  423. #define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT 38
  424. #define __DRI_ATTRIB_VISUAL_SELECT_GROUP 39
  425. #define __DRI_ATTRIB_SWAP_METHOD 40
  426. #define __DRI_ATTRIB_MAX_SWAP_INTERVAL 41
  427. #define __DRI_ATTRIB_MIN_SWAP_INTERVAL 42
  428. #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB 43
  429. #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA 44
  430. #define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE 45
  431. #define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS 46
  432. #define __DRI_ATTRIB_YINVERTED 47
  433. /* __DRI_ATTRIB_RENDER_TYPE */
  434. #define __DRI_ATTRIB_RGBA_BIT 0x01
  435. #define __DRI_ATTRIB_COLOR_INDEX_BIT 0x02
  436. #define __DRI_ATTRIB_LUMINANCE_BIT 0x04
  437. /* __DRI_ATTRIB_CONFIG_CAVEAT */
  438. #define __DRI_ATTRIB_SLOW_BIT 0x01
  439. #define __DRI_ATTRIB_NON_CONFORMANT_CONFIG 0x02
  440. /* __DRI_ATTRIB_TRANSPARENT_TYPE */
  441. #define __DRI_ATTRIB_TRANSPARENT_RGB 0x00
  442. #define __DRI_ATTRIB_TRANSPARENT_INDEX 0x01
  443. /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
  444. #define __DRI_ATTRIB_TEXTURE_1D_BIT 0x01
  445. #define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02
  446. #define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04
  447. /**
  448. * This extension defines the core DRI functionality.
  449. */
  450. #define __DRI_CORE "DRI_Core"
  451. #define __DRI_CORE_VERSION 1
  452. struct __DRIcoreExtensionRec {
  453. __DRIextension base;
  454. __DRIscreen *(*createNewScreen)(int screen, int fd,
  455. unsigned int sarea_handle,
  456. const __DRIextension **extensions,
  457. const __DRIconfig ***driverConfigs,
  458. void *loaderPrivate);
  459. void (*destroyScreen)(__DRIscreen *screen);
  460. const __DRIextension **(*getExtensions)(__DRIscreen *screen);
  461. int (*getConfigAttrib)(const __DRIconfig *config,
  462. unsigned int attrib,
  463. unsigned int *value);
  464. int (*indexConfigAttrib)(const __DRIconfig *config, int index,
  465. unsigned int *attrib, unsigned int *value);
  466. __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
  467. const __DRIconfig *config,
  468. unsigned int drawable_id,
  469. unsigned int head,
  470. void *loaderPrivate);
  471. void (*destroyDrawable)(__DRIdrawable *drawable);
  472. void (*swapBuffers)(__DRIdrawable *drawable);
  473. __DRIcontext *(*createNewContext)(__DRIscreen *screen,
  474. const __DRIconfig *config,
  475. __DRIcontext *shared,
  476. void *loaderPrivate);
  477. int (*copyContext)(__DRIcontext *dest,
  478. __DRIcontext *src,
  479. unsigned long mask);
  480. void (*destroyContext)(__DRIcontext *context);
  481. int (*bindContext)(__DRIcontext *ctx,
  482. __DRIdrawable *pdraw,
  483. __DRIdrawable *pread);
  484. int (*unbindContext)(__DRIcontext *ctx);
  485. };
  486. /**
  487. * Stored version of some component (i.e., server-side DRI module, kernel-side
  488. * DRM, etc.).
  489. *
  490. * \todo
  491. * There are several data structures that explicitly store a major version,
  492. * minor version, and patch level. These structures should be modified to
  493. * have a \c __DRIversionRec instead.
  494. */
  495. struct __DRIversionRec {
  496. int major; /**< Major version number. */
  497. int minor; /**< Minor version number. */
  498. int patch; /**< Patch-level. */
  499. };
  500. /**
  501. * Framebuffer information record. Used by libGL to communicate information
  502. * about the framebuffer to the driver's \c __driCreateNewScreen function.
  503. *
  504. * In XFree86, most of this information is derrived from data returned by
  505. * calling \c XF86DRIGetDeviceInfo.
  506. *
  507. * \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen
  508. * __driUtilCreateNewScreen CallCreateNewScreen
  509. *
  510. * \bug This structure could be better named.
  511. */
  512. struct __DRIframebufferRec {
  513. unsigned char *base; /**< Framebuffer base address in the CPU's
  514. * address space. This value is calculated by
  515. * calling \c drmMap on the framebuffer handle
  516. * returned by \c XF86DRIGetDeviceInfo (or a
  517. * similar function).
  518. */
  519. int size; /**< Framebuffer size, in bytes. */
  520. int stride; /**< Number of bytes from one line to the next. */
  521. int width; /**< Pixel width of the framebuffer. */
  522. int height; /**< Pixel height of the framebuffer. */
  523. int dev_priv_size; /**< Size of the driver's dev-priv structure. */
  524. void *dev_priv; /**< Pointer to the driver's dev-priv structure. */
  525. };
  526. /**
  527. * This extension provides alternative screen, drawable and context
  528. * constructors for legacy DRI functionality. This is used in
  529. * conjunction with the core extension.
  530. */
  531. #define __DRI_LEGACY "DRI_Legacy"
  532. #define __DRI_LEGACY_VERSION 1
  533. struct __DRIlegacyExtensionRec {
  534. __DRIextension base;
  535. __DRIscreen *(*createNewScreen)(int screen,
  536. const __DRIversion *ddx_version,
  537. const __DRIversion *dri_version,
  538. const __DRIversion *drm_version,
  539. const __DRIframebuffer *frame_buffer,
  540. void *pSAREA, int fd,
  541. const __DRIextension **extensions,
  542. const __DRIconfig ***driver_configs,
  543. void *loaderPrivate);
  544. __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
  545. const __DRIconfig *config,
  546. drm_drawable_t hwDrawable,
  547. int renderType, const int *attrs,
  548. void *loaderPrivate);
  549. __DRIcontext *(*createNewContext)(__DRIscreen *screen,
  550. const __DRIconfig *config,
  551. int render_type,
  552. __DRIcontext *shared,
  553. drm_context_t hwContext,
  554. void *loaderPrivate);
  555. };
  556. /**
  557. * This extension provides alternative screen, drawable and context
  558. * constructors for swrast DRI functionality. This is used in
  559. * conjunction with the core extension.
  560. */
  561. #define __DRI_SWRAST "DRI_SWRast"
  562. #define __DRI_SWRAST_VERSION 1
  563. struct __DRIswrastExtensionRec {
  564. __DRIextension base;
  565. __DRIscreen *(*createNewScreen)(int screen,
  566. const __DRIextension **extensions,
  567. const __DRIconfig ***driver_configs,
  568. void *loaderPrivate);
  569. __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
  570. const __DRIconfig *config,
  571. void *loaderPrivate);
  572. };
  573. /**
  574. * DRI2 Loader extension.
  575. */
  576. #define __DRI_BUFFER_FRONT_LEFT 0
  577. #define __DRI_BUFFER_BACK_LEFT 1
  578. #define __DRI_BUFFER_FRONT_RIGHT 2
  579. #define __DRI_BUFFER_BACK_RIGHT 3
  580. #define __DRI_BUFFER_DEPTH 4
  581. #define __DRI_BUFFER_STENCIL 5
  582. #define __DRI_BUFFER_ACCUM 6
  583. #define __DRI_BUFFER_FAKE_FRONT_LEFT 7
  584. #define __DRI_BUFFER_FAKE_FRONT_RIGHT 8
  585. #define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */
  586. struct __DRIbufferRec {
  587. unsigned int attachment;
  588. unsigned int name;
  589. unsigned int pitch;
  590. unsigned int cpp;
  591. unsigned int flags;
  592. };
  593. #define __DRI_DRI2_LOADER "DRI_DRI2Loader"
  594. #define __DRI_DRI2_LOADER_VERSION 3
  595. struct __DRIdri2LoaderExtensionRec {
  596. __DRIextension base;
  597. __DRIbuffer *(*getBuffers)(__DRIdrawable *driDrawable,
  598. int *width, int *height,
  599. unsigned int *attachments, int count,
  600. int *out_count, void *loaderPrivate);
  601. /**
  602. * Flush pending front-buffer rendering
  603. *
  604. * Any rendering that has been performed to the
  605. * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the
  606. * \c __DRI_BUFFER_FRONT_LEFT.
  607. *
  608. * \param driDrawable Drawable whose front-buffer is to be flushed
  609. * \param loaderPrivate Loader's private data that was previously passed
  610. * into __DRIdri2ExtensionRec::createNewDrawable
  611. */
  612. void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
  613. /**
  614. * Get list of buffers from the server
  615. *
  616. * Gets a list of buffer for the specified set of attachments. Unlike
  617. * \c ::getBuffers, this function takes a list of attachments paired with
  618. * opaque \c unsigned \c int value describing the format of the buffer.
  619. * It is the responsibility of the caller to know what the service that
  620. * allocates the buffers will expect to receive for the format.
  621. *
  622. * \param driDrawable Drawable whose buffers are being queried.
  623. * \param width Output where the width of the buffers is stored.
  624. * \param height Output where the height of the buffers is stored.
  625. * \param attachments List of pairs of attachment ID and opaque format
  626. * requested for the drawable.
  627. * \param count Number of attachment / format pairs stored in
  628. * \c attachments.
  629. * \param loaderPrivate Loader's private data that was previously passed
  630. * into __DRIdri2ExtensionRec::createNewDrawable.
  631. */
  632. __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable,
  633. int *width, int *height,
  634. unsigned int *attachments, int count,
  635. int *out_count, void *loaderPrivate);
  636. };
  637. /**
  638. * This extension provides alternative screen, drawable and context
  639. * constructors for DRI2.
  640. */
  641. #define __DRI_DRI2 "DRI_DRI2"
  642. #define __DRI_DRI2_VERSION 1
  643. struct __DRIdri2ExtensionRec {
  644. __DRIextension base;
  645. __DRIscreen *(*createNewScreen)(int screen, int fd,
  646. const __DRIextension **extensions,
  647. const __DRIconfig ***driver_configs,
  648. void *loaderPrivate);
  649. __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
  650. const __DRIconfig *config,
  651. void *loaderPrivate);
  652. __DRIcontext *(*createNewContext)(__DRIscreen *screen,
  653. const __DRIconfig *config,
  654. __DRIcontext *shared,
  655. void *loaderPrivate);
  656. };
  657. #endif