/*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2007-2008 Red Hat, Inc.
* (C) Copyright IBM Corporation 2004
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file dri_interface.h
*
* This file contains all the types and functions that define the interface
* between a DRI driver and driver loader. Currently, the most common driver
* loader is the XFree86 libGL.so. However, other loaders do exist, and in
* the future the server-side libglx.a will also be a loader.
*
* \author Kevin E. Martin <kevin@precisioninsight.com>
* \author Ian Romanick <idr@us.ibm.com>
* \author Kristian Høgsberg <krh@redhat.com>
*/
#ifndef DRI_INTERFACE_H
#define DRI_INTERFACE_H
/* Make this something other than __APPLE__ for other arcs with no drm.h */
#ifndef __APPLE__
#include <drm.h>
#else
typedef unsigned int drm_context_t;
typedef unsigned int drm_drawable_t;
#endif
/**
* \name DRI interface structures
*
* The following structures define the interface between the GLX client
* side library and the DRI (direct rendering infrastructure).
*/
/*@{*/
/*@}*/
/**
* Extension struct. Drivers 'inherit' from this struct by embedding
* it as the first element in the extension struct.
*
* We never break API in for a DRI extension. If we need to change
* the way things work in a non-backwards compatible manner, we
* introduce a new extension. During a transition period, we can
* leave both the old and the new extension in the driver, which
* allows us to move to the new interface without having to update the
* loader(s) in lock step.
*
* However, we can add entry points to an extension over time as long
* as we don't break the old ones. As we add entry points to an
* extension, we increase the version number. The corresponding
* #define can be used to guard code that accesses the new entry
* points at compile time and the version field in the extension
* struct can be used at run-time to determine how to use the
* extension.
*/
struct __DRIextensionRec {
const char *name;
int version;
};
/**
* The first set of extension are the screen extensions, returned by
* __DRIcore::getExtensions(). This entry point will return a list of
* extensions and the loader can use the ones it knows about by
* casting them to more specific extensions and advertising any GLX
* extensions the DRI extensions enables.
*/
/**
* Used by drivers to indicate support for setting the read drawable.
*/
/**
* Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
*/
struct __DRIcopySubBufferExtensionRec {
};
/**
* Used by drivers that implement the GLX_SGI_swap_control or
* GLX_MESA_swap_control extension.
*/
struct __DRIswapControlExtensionRec {
};
/**
* Used by drivers that implement the GLX_MESA_allocate_memory.
*/
struct __DRIallocateExtensionRec {
};
/**
* Used by drivers that implement the GLX_MESA_swap_frame_usage extension.
*/
struct __DRIframeTrackingExtensionRec {
/**
* Enable or disable frame usage tracking.
*
* \since Internal API version 20030317.
*/
/**
* Retrieve frame usage information.
*
* \since Internal API version 20030317.
*/
float * lastMissedUsage, float * usage);
};
/**
* Used by drivers that implement the GLX_SGI_video_sync extension.
*/
struct __DRImediaStreamCounterExtensionRec {
/**
* Wait for the MSC to equal target_msc, or, if that has already passed,
* the next time (MSC % divisor) is equal to remainder. If divisor is
* zero, the function will return as soon as MSC is greater than or equal
* to target_msc.
*/
/**
* Get the number of vertical refreshes since some point in time before
* this function was first called (i.e., system start up).
*/
};
struct __DRItexOffsetExtensionRec {
/**
* Method to override base texture image with a driver specific 'offset'.
* The depth passed in allows e.g. to ignore the alpha channel of texture
* images where the non-alpha components don't occupy a whole texel.
*
* For GLX_EXT_texture_from_pixmap with AIGLX.
*/
};
struct __DRItexBufferExtensionRec {
/**
* Method to override base texture image with the contents of a
* __DRIdrawable.
*
* For GLX_EXT_texture_from_pixmap with AIGLX.
*/
};
/**
* XML document describing the configuration options supported by the
* driver.
*/
extern const char __driConfigOptions[];
/*@}*/
/**
* The following extensions describe loader features that the DRI
* driver can make use of. Some of these are mandatory, such as the
* getDrawableInfo extension for DRI and the DRI Loader extensions for
* DRI2, while others are optional, and if present allow the driver to
* expose certain features. The loader pass in a NULL terminated
* array of these extensions to the driver in the createNewScreen
* constructor.
*/
/**
* Callback to getDrawableInfo protocol
*/
struct __DRIgetDrawableInfoExtensionRec {
/**
* This function is used to get information about the position, size, and
* clip rects of a drawable.
*/
void *loaderPrivate);
};
/**
* Callback to get system time for media stream counter extensions.
*/
struct __DRIsystemTimeExtensionRec {
/**
* Get the 64-bit unadjusted system time (UST).
*/
/**
* Get the media stream counter (MSC) rate.
*
* Matching the definition in GLX_OML_sync_control, this function returns
* the rate of the "media stream counter". In practical terms, this is
* the frame refresh rate of the display.
*/
void *loaderPrivate);
};
/**
* Damage reporting
*/
struct __DRIdamageExtensionRec {
/**
* Reports areas of the given drawable which have been modified by the
* driver.
*
* \param drawable which the drawing was done to.
* \param rects rectangles affected, with the drawable origin as the
* origin.
* \param x X offset of the drawable within the screen (used in the
* front_buffer case)
* \param y Y offset of the drawable within the screen.
* \param front_buffer boolean flag for whether the drawing to the
* drawable was actually done directly to the front buffer (instead
* of backing storage, for example)
* \param loaderPrivate the data passed in at createNewDrawable time
*/
int x, int y,
void *loaderPrivate);
};
/**
* DRI2 Loader extension. This extension describes the basic
* functionality the loader needs to provide for the DRI driver.
*/
struct __DRIloaderExtensionRec {
/**
* Ping the windowing system to get it to reemit info for the
* specified drawable in the DRI2 event buffer.
*
* \param draw the drawable for which to request info
* \param tail the new event buffer tail pointer
*/
void *loaderPrivate);
int num_rects, void *loaderPrivate);
};
/**
* SWRast Loader extension.
*/
struct __DRIswrastLoaderExtensionRec {
/*
* Drawable position and size
*/
void *loaderPrivate);
/**
* Put image to drawable
*/
void *loaderPrivate);
/**
* Get image from drawable
*/
void *loaderPrivate);
};
/**
* The remaining extensions describe driver extensions, immediately
* available interfaces provided by the driver. To start using the
* driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for
* the extension you need in the array.
*/
/**
* Tokens for __DRIconfig attribs. A number of attributes defined by
* GLX or EGL standards are not in the table, as they must be provided
* by the loader. For example, FBConfig ID or visual ID, drawable type.
*/
/* __DRI_ATTRIB_RENDER_TYPE */
/* __DRI_ATTRIB_CONFIG_CAVEAT */
/* __DRI_ATTRIB_TRANSPARENT_TYPE */
/* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
/**
* This extension defines the core DRI functionality.
*/
struct __DRIcoreExtensionRec {
unsigned int sarea_handle,
const __DRIextension **extensions,
const __DRIconfig ***driverConfigs,
void *loaderPrivate);
unsigned int attrib,
unsigned int *value);
const __DRIconfig *config,
unsigned int drawable_id,
unsigned int head,
void *loaderPrivate);
const __DRIconfig *config,
void *loaderPrivate);
unsigned long mask);
};
/**
* Stored version of some component (i.e., server-side DRI module, kernel-side
* DRM, etc.).
*
* \todo
* There are several data structures that explicitly store a major version,
* minor version, and patch level. These structures should be modified to
* have a \c __DRIversionRec instead.
*/
struct __DRIversionRec {
};
/**
* Framebuffer information record. Used by libGL to communicate information
* about the framebuffer to the driver's \c __driCreateNewScreen function.
*
* In XFree86, most of this information is derrived from data returned by
* calling \c XF86DRIGetDeviceInfo.
*
* \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen
* __driUtilCreateNewScreen CallCreateNewScreen
*
* \bug This structure could be better named.
*/
struct __DRIframebufferRec {
* address space. This value is calculated by
* calling \c drmMap on the framebuffer handle
* returned by \c XF86DRIGetDeviceInfo (or a
* similar function).
*/
};
/**
* This extension provides alternative screen, drawable and context
* constructors for legacy DRI functionality. This is used in
* conjunction with the core extension.
*/
struct __DRIlegacyExtensionRec {
const __DRIversion *ddx_version,
const __DRIversion *dri_version,
const __DRIversion *drm_version,
const __DRIframebuffer *frame_buffer,
const __DRIextension **extensions,
const __DRIconfig ***driver_configs,
void *loaderPrivate);
const __DRIconfig *config,
int renderType, const int *attrs,
void *loaderPrivate);
const __DRIconfig *config,
int render_type,
void *loaderPrivate);
};
/**
* This extension provides alternative screen, drawable and context
* constructors for swrast DRI functionality. This is used in
* conjunction with the core extension.
*/
struct __DRIswrastExtensionRec {
const __DRIextension **extensions,
const __DRIconfig ***driver_configs,
void *loaderPrivate);
const __DRIconfig *config,
void *loaderPrivate);
};
#endif