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