X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fcommon%2Fdri_util.h;h=e43a5b752e89b37272c68e2668ea843b52b0605b;hb=106a6f29bbdc71982afd629bdf89369cefd1459e;hp=eb88102a9d1e5171a8159806c8e14e0490c41bbe;hpb=6632a751be851699eebc85082ebb83a2c3a9da79;p=mesa.git diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index eb88102a9d1..e43a5b752e8 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -49,23 +49,37 @@ #ifndef _DRI_UTIL_H_ #define _DRI_UTIL_H_ -#ifdef GLX_DIRECT_RENDERING - -#define CAPI /* XXX this should be globally defined somewhere */ - -#include -#include "glxclient.h" /* for GLXDrawable */ -#include "drm.h" /* for drm_clip_rect_t */ -#include "sarea.h" /* for XF86DRISAREAPtr */ -#include "GL/internal/glcore.h" /* for __GLcontextModes */ +#include +#include "drm.h" +#include "drm_sarea.h" +#include "xf86drm.h" +#include "GL/internal/glcore.h" +#include "GL/internal/dri_interface.h" +#define GLX_BAD_CONTEXT 5 typedef struct __DRIdisplayPrivateRec __DRIdisplayPrivate; typedef struct __DRIscreenPrivateRec __DRIscreenPrivate; typedef struct __DRIcontextPrivateRec __DRIcontextPrivate; typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate; typedef struct __DRIswapInfoRec __DRIswapInfo; +typedef struct __DRIutilversionRec2 __DRIutilversion2; + + +/** + * Driver specific entry point. Implemented by the driver. Called + * from the top level createNewScreen entry point to initialize the + * __DRIscreenPrivate struct. + */ +extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); +/** + * Extensions. + */ +extern const __DRIcopySubBufferExtension driCopySubBufferExtension; +extern const __DRIswapControlExtension driSwapControlExtension; +extern const __DRIframeTrackingExtension driFrameTrackingExtension; +extern const __DRImediaStreamCounterExtension driMediaStreamCounterExtension; /** * Used by DRI_VALIDATE_DRAWABLE_INFO @@ -86,15 +100,15 @@ typedef struct __DRIswapInfoRec __DRIswapInfo; #define DRI_VALIDATE_DRAWABLE_INFO(psp, pdp) \ do { \ while (*(pdp->pStamp) != pdp->lastStamp) { \ - DRM_UNLOCK(psp->fd, &psp->pSAREA->lock, \ - pdp->driContextPriv->hHWContext); \ + register unsigned int hwContext = psp->pSAREA->lock.lock & \ + ~(DRM_LOCK_HELD | DRM_LOCK_CONT); \ + DRM_UNLOCK(psp->fd, &psp->pSAREA->lock, hwContext); \ \ DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \ DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp); \ DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \ \ - DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock, \ - pdp->driContextPriv->hHWContext); \ + DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock, hwContext); \ } \ } while (0) @@ -110,11 +124,6 @@ do { \ * this structure. */ struct __DriverAPIRec { - /** - * Driver initialization callback - */ - GLboolean (*InitDriver)(__DRIscreenPrivate *driScrnPriv); - /** * Screen destruction callback */ @@ -162,36 +171,6 @@ struct __DriverAPIRec { */ GLboolean (*UnbindContext)(__DRIcontextPrivate *driContextPriv); - /** - * Full screen mode opening callback. - * - * \deprecated - * Full screen functionality is no longer used by DRI. Drivers should - * simply install a function returning \c GL_TRUE for backwards - * compatability. - * - * \todo - * Nothing calls this function anymore. Since this data structure is only - * accessed with in the driver (i.e., libGL never sees it), we need to - * remove the other cases that set this field and remove the field. - */ - GLboolean (*OpenFullScreen)(__DRIcontextPrivate *driContextPriv); - - /** - * Full screen mode closing callback. - * - * \deprecated - * Full screen functionality is no longer used by DRI. Drivers should - * simply install a function returning \c GL_TRUE for backwards - * compatability. - * - * \todo - * Nothing calls this function anymore. Since this data structure is only - * accessed with in the driver (i.e., libGL never sees it), we need to - * remove the other cases that set this field and remove the field. - */ - GLboolean (*CloseFullScreen)(__DRIcontextPrivate *driContextPriv); - /** * Retrieves statistics about buffer swap operations. Required if * GLX_OML_sync_control or GLX_MESA_swap_frame_usage is supported. @@ -218,6 +197,14 @@ struct __DriverAPIRec { int64_t (*SwapBuffersMSC)( __DRIdrawablePrivate *priv, int64_t target_msc, int64_t divisor, int64_t remainder ); /*@}*/ + void (*CopySubBuffer)(__DRIdrawablePrivate *driDrawPriv, + int x, int y, int w, int h); + + /** + * See corresponding field in \c __DRIscreenRec. + */ + void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname, + unsigned long long offset, GLint depth, GLuint pitch); }; @@ -225,7 +212,7 @@ struct __DRIswapInfoRec { /** * Number of swapBuffers operations that have been *completed*. */ - uint64_t swap_count; + u_int64_t swap_count; /** * Unadjusted system time of the last buffer swap. This is the time @@ -239,7 +226,7 @@ struct __DRIswapInfoRec { * swap, it has missed its deadline. If swap_interval is 0, then the * swap deadline is 1 frame after the previous swap. */ - uint64_t swap_missed_count; + u_int64_t swap_missed_count; /** * Amount of time used by the last swap that missed its deadline. This @@ -271,7 +258,6 @@ struct __DRIdrawablePrivateRec { /** * X's drawable ID associated with this private drawable. */ - __DRIid draw; __DRIdrawable *pdraw; /** @@ -340,38 +326,22 @@ struct __DRIdrawablePrivateRec { */ __DRIscreenPrivate *driScreenPriv; - /** - * \name Display and screen information. - * - * Basically just need these for when the locking code needs to call - * __driUtilUpdateDrawableInfo() which calls XF86DRIGetDrawableInfo(). - */ - /*@{*/ - __DRInativeDisplay *display; - int screen; - /*@}*/ - /** * Called via glXSwapBuffers(). */ void (*swapBuffers)( __DRIdrawablePrivate *dPriv ); /** - * Get information about the location, size, and clip rects of the - * drawable within the display. + * Controls swap interval as used by GLX_SGI_swap_control and + * GLX_MESA_swap_control. */ - PFNGLXGETDRAWABLEINFOPROC getInfo; + unsigned int swap_interval; }; /** * Per-context private driver information. */ struct __DRIcontextPrivateRec { - /** - * Kernel context handle used to access the device lock. - */ - __DRIid contextID; - /** * Kernel context handle used to access the device lock. */ @@ -383,15 +353,20 @@ struct __DRIcontextPrivateRec { void *driverPrivate; /** - * This context's display pointer. + * Pointer back to the \c __DRIcontext that contains this structure. */ - __DRInativeDisplay *display; + __DRIcontext *pctx; /** - * Pointer to drawable currently bound to this context. + * Pointer to drawable currently bound to this context for drawing. */ __DRIdrawablePrivate *driDrawablePriv; + /** + * Pointer to drawable currently bound to this context for reading. + */ + __DRIdrawablePrivate *driReadablePriv; + /** * Pointer to screen on which this context was created. */ @@ -402,11 +377,6 @@ struct __DRIcontextPrivateRec { * Per-screen private driver information. */ struct __DRIscreenPrivateRec { - /** - * Display for this screen - */ - __DRInativeDisplay *display; - /** * Current screen's number */ @@ -418,37 +388,19 @@ struct __DRIscreenPrivateRec { struct __DriverAPIRec DriverAPI; /** - * \name DDX version * DDX / 2D driver version information. - * \todo Replace these fields with a \c __DRIversionRec. */ - /*@{*/ - int ddxMajor; - int ddxMinor; - int ddxPatch; - /*@}*/ + __DRIversion ddx_version; /** - * \name DRI version * DRI X extension version information. - * \todo Replace these fields with a \c __DRIversionRec. */ - /*@{*/ - int driMajor; - int driMinor; - int driPatch; - /*@}*/ + __DRIversion dri_version; /** - * \name DRM version * DRM (kernel module) version information. - * \todo Replace these fields with a \c __DRIversionRec. */ - /*@{*/ - int drmMajor; - int drmMinor; - int drmPatch; - /*@}*/ + __DRIversion drm_version; /** * ID used when the client sets the drawable lock. @@ -475,7 +427,7 @@ struct __DRIscreenPrivateRec { * - the device lock * - the device-independent per-drawable and per-context(?) information */ - XF86DRISAREAPtr pSAREA; + drm_sarea_t *pSAREA; /** * \name Direct frame buffer access information @@ -513,11 +465,6 @@ struct __DRIscreenPrivateRec { */ __DRIcontextPrivate dummyContextPriv; - /** - * Hash table to hold the drawable information for this screen. - */ - void *drawHash; - /** * Device-dependent private information (not stored in the SAREA). * @@ -526,24 +473,28 @@ struct __DRIscreenPrivateRec { void *private; /** - * GLX visuals / FBConfigs for this screen. These are stored as a - * linked list. - * - * \note - * This field is \b only used in conjunction with the old interfaces. If - * the new interfaces are used, this field will be set to \c NULL and will - * not be dereferenced. + * Pointer back to the \c __DRIscreen that contains this structure. */ - __GLcontextModes *modes; + __DRIscreen *psc; /** - * Pointer back to the \c __DRIscreen that contains this structure. + * Extensions provided by this driver. */ - - __DRIscreen *psc; + const __DRIextension **extensions; }; +/** + * Used to store a version which includes a major range instead of a single + * major version number. + */ +struct __DRIutilversionRec2 { + int major_min; /** min allowed Major version number. */ + int major_max; /** max allowed Major version number. */ + int minor; /**< Minor version number. */ + int patch; /**< Patch-level. */ +}; + extern void __driUtilMessage(const char *f, ...); @@ -553,28 +504,27 @@ extern void __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp); -extern __DRIscreenPrivate * __driUtilCreateNewScreen( __DRInativeDisplay *dpy, - int scrn, __DRIscreen *psc, __GLcontextModes * modes, +extern __DRIscreenPrivate * __driUtilCreateNewScreen( int scr, __DRIscreen *psc, + __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, int internal_api_version, + drm_sarea_t *pSAREA, int fd, int internal_api_version, const struct __DriverAPIRec *driverAPI ); -#ifndef DRI_NEW_INTERFACE_ONLY -extern __DRIscreenPrivate * -__driUtilCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, - int numConfigs, __GLXvisualConfig *config, - const struct __DriverAPIRec *driverAPI); -#endif /* DRI_NEW_INTERFACE_ONLY */ - /* Test the version of the internal GLX API. Returns a value like strcmp. */ extern int -driCompareGLXAPIVersion( GLuint required_version ); +driCompareGLXAPIVersion( GLint required_version ); extern float driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, int64_t current_ust ); -#endif /* GLX_DIRECT_RENDERING */ +/** + * Pointer to the \c __DRIinterfaceMethods passed to the driver by the loader. + * + * This pointer is set in the driver's \c __driCreateNewScreen function and + * is defined in dri_util.c. + */ +extern const __DRIinterfaceMethods * dri_interface; #endif /* _DRI_UTIL_H_ */